sdio: add interface for host side SDIO interrupt reporting
Signed-off-by: Nicolas Pitre <npitre@mvista.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
This commit is contained in:
parent
112c9db91e
commit
17b759aff9
3 changed files with 18 additions and 1 deletions
|
@ -100,6 +100,9 @@ int mmc_add_host(struct mmc_host *host)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) &&
|
||||||
|
!host->ops->enable_sdio_irq);
|
||||||
|
|
||||||
if (!idr_pre_get(&mmc_host_idr, GFP_KERNEL))
|
if (!idr_pre_get(&mmc_host_idr, GFP_KERNEL))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,8 @@ static int sdio_irq_thread(void *_host)
|
||||||
* asynchronous notification of pending SDIO card interrupts
|
* asynchronous notification of pending SDIO card interrupts
|
||||||
* hence we poll for them in that case.
|
* hence we poll for them in that case.
|
||||||
*/
|
*/
|
||||||
period = msecs_to_jiffies(10);
|
period = (host->caps & MMC_CAP_SDIO_IRQ) ?
|
||||||
|
MAX_SCHEDULE_TIMEOUT : msecs_to_jiffies(10);
|
||||||
|
|
||||||
pr_debug("%s: IRQ thread started (poll period = %lu jiffies)\n",
|
pr_debug("%s: IRQ thread started (poll period = %lu jiffies)\n",
|
||||||
mmc_hostname(host), period);
|
mmc_hostname(host), period);
|
||||||
|
@ -104,11 +105,16 @@ static int sdio_irq_thread(void *_host)
|
||||||
ssleep(1);
|
ssleep(1);
|
||||||
|
|
||||||
set_task_state(current, TASK_INTERRUPTIBLE);
|
set_task_state(current, TASK_INTERRUPTIBLE);
|
||||||
|
if (host->caps & MMC_CAP_SDIO_IRQ)
|
||||||
|
host->ops->enable_sdio_irq(host, 1);
|
||||||
if (!kthread_should_stop())
|
if (!kthread_should_stop())
|
||||||
schedule_timeout(period);
|
schedule_timeout(period);
|
||||||
set_task_state(current, TASK_RUNNING);
|
set_task_state(current, TASK_RUNNING);
|
||||||
} while (!kthread_should_stop());
|
} while (!kthread_should_stop());
|
||||||
|
|
||||||
|
if (host->caps & MMC_CAP_SDIO_IRQ)
|
||||||
|
host->ops->enable_sdio_irq(host, 0);
|
||||||
|
|
||||||
pr_debug("%s: IRQ thread exiting with code %d\n",
|
pr_debug("%s: IRQ thread exiting with code %d\n",
|
||||||
mmc_hostname(host), ret);
|
mmc_hostname(host), ret);
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ struct mmc_host_ops {
|
||||||
void (*request)(struct mmc_host *host, struct mmc_request *req);
|
void (*request)(struct mmc_host *host, struct mmc_request *req);
|
||||||
void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios);
|
void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios);
|
||||||
int (*get_ro)(struct mmc_host *host);
|
int (*get_ro)(struct mmc_host *host);
|
||||||
|
void (*enable_sdio_irq)(struct mmc_host *host, int enable);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mmc_card;
|
struct mmc_card;
|
||||||
|
@ -89,6 +90,7 @@ struct mmc_host {
|
||||||
#define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */
|
#define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */
|
||||||
#define MMC_CAP_MMC_HIGHSPEED (1 << 2) /* Can do MMC high-speed timing */
|
#define MMC_CAP_MMC_HIGHSPEED (1 << 2) /* Can do MMC high-speed timing */
|
||||||
#define MMC_CAP_SD_HIGHSPEED (1 << 3) /* Can do SD high-speed timing */
|
#define MMC_CAP_SD_HIGHSPEED (1 << 3) /* Can do SD high-speed timing */
|
||||||
|
#define MMC_CAP_SDIO_IRQ (1 << 4) /* Can signal pending SDIO IRQs */
|
||||||
|
|
||||||
/* host specific block data */
|
/* host specific block data */
|
||||||
unsigned int max_seg_size; /* see blk_queue_max_segment_size */
|
unsigned int max_seg_size; /* see blk_queue_max_segment_size */
|
||||||
|
@ -150,5 +152,11 @@ extern int mmc_resume_host(struct mmc_host *);
|
||||||
extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
|
extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
|
||||||
extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
|
extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
|
||||||
|
|
||||||
|
static inline void mmc_signal_sdio_irq(struct mmc_host *host)
|
||||||
|
{
|
||||||
|
host->ops->enable_sdio_irq(host, 0);
|
||||||
|
wake_up_process(host->sdio_irq_thread);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Reference in a new issue