mmc: msm_sdcc: handle the platform gpio_data not present case
PATCH 1/7 mmc: msm_sdcc: handle the platform gpio_data not present case
From: Subhash Jadavani <[email protected]>
If platform gpio_data is not present then don't do any gpio configuration.
--- drivers/mmc/host/msm_sdcc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/msm_sdcc.c +1 -1
@@ -939,7 +939,7 @@ static void msmsdcc_setup_gpio(struct msmsdcc_host *host, bool enable)struct msm_mmc_gpio_data *curr;int i, rc =0 ; -if (!host->plat->gpio_data && host->gpio_config_status == enable) +if (!host->plat->gpio_data || host->gpio_config_status == enable)return ; curr = host->plat->gpio_data;
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 2/7 mmc: msm_sdcc: Handle error cases in probe
--- drivers/mmc/host/msm_sdcc.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/mmc/host/msm_sdcc.c +11 -3
@@ -1206,7 +1206,7 @@ msmsdcc_probe(struct platform_device *pdev) host->base =ioremap (memres->start,PAGE_SIZE );if (!host->base) { ret = -ENOMEM ; - goto out; + goto host_free; } host->cmd_irqres = cmd_irqres;
@@ -1221,13 +1221,15 @@ msmsdcc_probe(struct platform_device *pdev)/* * Setup DMA */ -msmsdcc_init_dma (host); + ret =msmsdcc_init_dma (host); +if (ret) + goto ioremap_free;/* Get our clocks */ host->pclk =clk_get (&pdev->dev,"sdc_pclk" );if (IS_ERR (host->pclk)) { ret =PTR_ERR (host->pclk); - goto host_free; + goto dma_free; } host->clk =clk_get (&pdev->dev,"sdc_clk" );
@@ -1368,6 +1370,12 @@ msmsdcc_probe(struct platform_device *pdev)clk_put (host->clk); pclk_put:clk_put (host->pclk); +dma_free: +dma_free_coherent (NULL ,sizeof (struct msmsdcc_nc_dmadata ), + host->dma.nc, host->dma.nc_busaddr); +ioremap_free: +tasklet_kill (&host->dma_tlet); +iounmap (host->base); host_free:mmc_free_host (mmc); out:
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v2 2/7 mmc: msm_sdcc: Handle error cases in probe
--- drivers/mmc/host/msm_sdcc.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/mmc/host/msm_sdcc.c +11 -3
@@ -1206,7 +1206,7 @@ msmsdcc_probe(struct platform_device *pdev) host->base =ioremap (memres->start,PAGE_SIZE );if (!host->base) { ret = -ENOMEM ; - goto out; + goto host_free; } host->cmd_irqres = cmd_irqres;
@@ -1221,13 +1221,15 @@ msmsdcc_probe(struct platform_device *pdev)/* * Setup DMA */ -msmsdcc_init_dma (host); + ret =msmsdcc_init_dma (host); +if (ret) + goto ioremap_free;/* Get our clocks */ host->pclk =clk_get (&pdev->dev,"sdc_pclk" );if (IS_ERR (host->pclk)) { ret =PTR_ERR (host->pclk); - goto host_free; + goto dma_free; } host->clk =clk_get (&pdev->dev,"sdc_clk" );
@@ -1368,6 +1370,12 @@ msmsdcc_probe(struct platform_device *pdev)clk_put (host->clk); pclk_put:clk_put (host->pclk); +dma_free: +dma_free_coherent (NULL ,sizeof (struct msmsdcc_nc_dmadata ), + host->dma.nc, host->dma.nc_busaddr); +ioremap_free: +tasklet_kill (&host->dma_tlet); +iounmap (host->base); host_free:mmc_free_host (mmc); out:
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 3/7 mmc: msm_sdcc: Enable SDC host->clk only after setting the rate.
In reply to Sahitya TummalaFor clocks that support rates which can be set (most clocks other than _pclk AHB clocks), a rate must be set using clk_set_rate() before the clock is enabled for the first time with clk_enable(). Subsequent calls to clk_enable() need not be preceded with the clk_set_rate() calls unless we wish to change the clock rate that is set previously.
SDC host->clk is currently enabled without setting the clock rate even once. This patch fixes this, by ensuring that the clock rate for this clock is first set before enabling the clock.
--- drivers/mmc/host/msm_sdcc.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/mmc/host/msm_sdcc.c +6 -6
@@ -1238,17 +1238,17 @@ msmsdcc_probe(struct platform_device *pdev) goto pclk_put; } -/* Enable clocks */ - ret =msmsdcc_enable_clocks (host); -if (ret) - goto clk_put; - ret =clk_set_rate (host->clk, msmsdcc_fmin);if (ret) {pr_err ("%s: Clock rate set failed (%d)\n" , __func__, ret); - goto clk_disable; + goto clk_put; } +/* Enable clocks */ + ret =msmsdcc_enable_clocks (host); +if (ret) + goto clk_put; + host->pclk_rate =clk_get_rate (host->pclk); host->clk_rate =clk_get_rate (host->clk);
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v2 3/7 mmc: msm_sdcc: Enable SDC host->clk only after setting the rate.
For clocks that support rates which can be set (most clocks other than _pclk AHB clocks), a rate must be set using clk_set_rate() before the clock is enabled for the first time with clk_enable(). Subsequent calls to clk_enable() need not be preceded with the clk_set_rate() calls unless we wish to change the clock rate that is set previously.
SDC host->clk is currently enabled without setting the clock rate even once. This patch fixes this, by ensuring that the clock rate for this clock is first set before enabling the clock.
--- drivers/mmc/host/msm_sdcc.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/mmc/host/msm_sdcc.c +6 -6
@@ -1238,17 +1238,17 @@ msmsdcc_probe(struct platform_device *pdev) goto pclk_put; } -/* Enable clocks */ - ret =msmsdcc_enable_clocks (host); -if (ret) - goto clk_put; - ret =clk_set_rate (host->clk, msmsdcc_fmin);if (ret) {pr_err ("%s: Clock rate set failed (%d)\n" , __func__, ret); - goto clk_disable; + goto clk_put; } +/* Enable clocks */ + ret =msmsdcc_enable_clocks (host); +if (ret) + goto clk_put; + host->pclk_rate =clk_get_rate (host->pclk); host->clk_rate =clk_get_rate (host->clk);
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 4/7 msm: mmc: Remove "pio_irq" resource
In reply to Sahitya TummalaOn some targets, MCI_IRQ_MASK1 is not routed to the MSM in which case only "cmd_irq" must be used even for PIO. With this change, all the targets will use only "cmd_irq" for both CMD and PIO.
--- arch/arm/mach-msm/devices-msm7x00.c | 24 ------------------------ arch/arm/mach-msm/devices-qsd8x50.c | 24 ------------------------ drivers/mmc/host/msm_sdcc.c | 8 ++------ drivers/mmc/host/msm_sdcc.h | 1 - 4 files changed, 2 insertions(+), 55 deletions(-)
arch/arm/mach-msm/devices-msm7x00.c +0 -24
@@ -176,12 +176,6 @@ static struct resource resources_sdc1[] = { .name = "cmd_irq", }, { - .start = INT_SDC1_1, - .end = INT_SDC1_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, - { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq" },
@@ -204,12 +198,6 @@ static struct resource resources_sdc2[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC2_1, - .end = INT_SDC2_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
@@ -233,12 +221,6 @@ static struct resource resources_sdc3[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC3_1, - .end = INT_SDC3_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
@@ -262,12 +244,6 @@ static struct resource resources_sdc4[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC4_1, - .end = INT_SDC4_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
arch/arm/mach-msm/devices-qsd8x50.c +0 -24
@@ -140,12 +140,6 @@ static struct resource resources_sdc1[] = { .name = "cmd_irq", }, { - .start = INT_SDC1_1, - .end = INT_SDC1_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, - { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq" },
@@ -168,12 +162,6 @@ static struct resource resources_sdc2[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC2_1, - .end = INT_SDC2_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
@@ -197,12 +185,6 @@ static struct resource resources_sdc3[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC3_1, - .end = INT_SDC3_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
@@ -226,12 +208,6 @@ static struct resource resources_sdc4[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC4_1, - .end = INT_SDC4_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
drivers/mmc/host/msm_sdcc.c +2 -6
@@ -1150,7 +1150,6 @@ msmsdcc_probe(struct platform_device *pdev)struct msmsdcc_host *host;struct mmc_host *mmc;struct resource *cmd_irqres =NULL ; -struct resource *pio_irqres =NULL ;struct resource *stat_irqres =NULL ;struct resource *memres =NULL ;struct resource *dmares =NULL ;
@@ -1175,12 +1174,10 @@ msmsdcc_probe(struct platform_device *pdev) dmares =platform_get_resource (pdev,IORESOURCE_DMA ,0 ); cmd_irqres =platform_get_resource_byname (pdev,IORESOURCE_IRQ ,"cmd_irq" ); - pio_irqres =platform_get_resource_byname (pdev,IORESOURCE_IRQ , -"pio_irq" ); stat_irqres =platform_get_resource_byname (pdev,IORESOURCE_IRQ ,"status_irq" ); -if (!cmd_irqres || !pio_irqres || !memres) { +if (!cmd_irqres || !memres) {pr_err ("%s: Invalid resource\n" , __func__);return -ENXIO ; }
@@ -1210,7 +1207,6 @@ msmsdcc_probe(struct platform_device *pdev) } host->cmd_irqres = cmd_irqres; - host->pio_irqres = pio_irqres; host->memres = memres; host->dmares = dmares;spin_lock_init (&host->lock);
@@ -1327,7 +1323,7 @@ msmsdcc_probe(struct platform_device *pdev)if (ret) goto stat_irq_free; - ret =request_irq (pio_irqres->start, msmsdcc_pio_irq,IRQF_SHARED , + ret =request_irq (cmd_irqres->start, msmsdcc_pio_irq,IRQF_SHARED ,DRIVER_NAME " (pio)" , host);if (ret) goto cmd_irq_free;
drivers/mmc/host/msm_sdcc.h +0 -1
@@ -202,7 +202,6 @@ struct msmsdcc_stats {struct msmsdcc_host {struct resource *cmd_irqres; -struct resource *pio_irqres;struct resource *memres;struct resource *dmares;void __iomem *base;
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v2 4/7 msm: mmc: Remove "pio_irq" resource
On some targets, MCI_IRQ_MASK1 is not routed to the MSM in which case only "cmd_irq" must be used even for PIO. With this change, all the targets will use only "cmd_irq" for both CMD and PIO.
--- arch/arm/mach-msm/devices-msm7x00.c | 24 ------------------------ arch/arm/mach-msm/devices-qsd8x50.c | 24 ------------------------ drivers/mmc/host/msm_sdcc.c | 8 ++------ drivers/mmc/host/msm_sdcc.h | 1 - 4 files changed, 2 insertions(+), 55 deletions(-)
arch/arm/mach-msm/devices-msm7x00.c +0 -24
@@ -176,12 +176,6 @@ static struct resource resources_sdc1[] = { .name = "cmd_irq", }, { - .start = INT_SDC1_1, - .end = INT_SDC1_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, - { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq" },
@@ -204,12 +198,6 @@ static struct resource resources_sdc2[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC2_1, - .end = INT_SDC2_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
@@ -233,12 +221,6 @@ static struct resource resources_sdc3[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC3_1, - .end = INT_SDC3_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
@@ -262,12 +244,6 @@ static struct resource resources_sdc4[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC4_1, - .end = INT_SDC4_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
arch/arm/mach-msm/devices-qsd8x50.c +0 -24
@@ -140,12 +140,6 @@ static struct resource resources_sdc1[] = { .name = "cmd_irq", }, { - .start = INT_SDC1_1, - .end = INT_SDC1_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, - { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq" },
@@ -168,12 +162,6 @@ static struct resource resources_sdc2[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC2_1, - .end = INT_SDC2_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
@@ -197,12 +185,6 @@ static struct resource resources_sdc3[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC3_1, - .end = INT_SDC3_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
@@ -226,12 +208,6 @@ static struct resource resources_sdc4[] = { .flags = IORESOURCE_IRQ, .name = "cmd_irq", }, - { - .start = INT_SDC4_1, - .end = INT_SDC4_1, - .flags = IORESOURCE_IRQ, - .name = "pio_irq", - }, { .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, .name = "status_irq"
drivers/mmc/host/msm_sdcc.c +2 -6
@@ -1150,7 +1150,6 @@ msmsdcc_probe(struct platform_device *pdev)struct msmsdcc_host *host;struct mmc_host *mmc;struct resource *cmd_irqres =NULL ; -struct resource *pio_irqres =NULL ;struct resource *stat_irqres =NULL ;struct resource *memres =NULL ;struct resource *dmares =NULL ;
@@ -1175,12 +1174,10 @@ msmsdcc_probe(struct platform_device *pdev) dmares =platform_get_resource (pdev,IORESOURCE_DMA ,0 ); cmd_irqres =platform_get_resource_byname (pdev,IORESOURCE_IRQ ,"cmd_irq" ); - pio_irqres =platform_get_resource_byname (pdev,IORESOURCE_IRQ , -"pio_irq" ); stat_irqres =platform_get_resource_byname (pdev,IORESOURCE_IRQ ,"status_irq" ); -if (!cmd_irqres || !pio_irqres || !memres) { +if (!cmd_irqres || !memres) {pr_err ("%s: Invalid resource\n" , __func__);return -ENXIO ; }
@@ -1210,7 +1207,6 @@ msmsdcc_probe(struct platform_device *pdev) } host->cmd_irqres = cmd_irqres; - host->pio_irqres = pio_irqres; host->memres = memres; host->dmares = dmares;spin_lock_init (&host->lock);
@@ -1327,7 +1323,7 @@ msmsdcc_probe(struct platform_device *pdev)if (ret) goto stat_irq_free; - ret =request_irq (pio_irqres->start, msmsdcc_pio_irq,IRQF_SHARED , + ret =request_irq (cmd_irqres->start, msmsdcc_pio_irq,IRQF_SHARED ,DRIVER_NAME " (pio)" , host);if (ret) goto cmd_irq_free;
drivers/mmc/host/msm_sdcc.h +0 -1
@@ -202,7 +202,6 @@ struct msmsdcc_stats {struct msmsdcc_host {struct resource *cmd_irqres; -struct resource *pio_irqres;struct resource *memres;struct resource *dmares;void __iomem *base;
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 5/7 mmc: msm_sdcc: Use MCI_INT_MASK0 for PIO interrupts
In reply to Sahitya TummalaNot all targets have IRQ1 line routed from the SD controller to the processor. So we cannot rely on IRQ1 for PIO interrupts. This patch moves all PIO interrupts to IRQ0 and enables the PIO mode.
--- drivers/mmc/host/msm_sdcc.c | 20 ++++++++++++++++---- drivers/mmc/host/msm_sdcc.h | 5 +++++ 2 files changed, 21 insertions(+), 4 deletions(-)
drivers/mmc/host/msm_sdcc.c +16 -4
@@ -213,7 +213,8 @@ msmsdcc_dma_exec_func(struct msm_dmov_cmd *cmd)msmsdcc_writel (host, host->cmd_timeout,MMCIDATATIMER );msmsdcc_writel (host, (unsigned int )host->curr.xfer_size,MMCIDATALENGTH ); -msmsdcc_writel (host, host->cmd_pio_irqmask,MMCIMASK1 ); +msmsdcc_writel (host, (msmsdcc_readl (host,MMCIMASK0 ) & + (~MCI_IRQ_PIO )) | host->cmd_pio_irqmask,MMCIMASK0 );msmsdcc_writel (host, host->cmd_datactrl,MMCIDATACTRL );if (host->cmd_cmd) {
@@ -543,7 +544,9 @@ msmsdcc_start_data(struct msmsdcc_host *host, struct mmc_data *data,msmsdcc_writel (host, host->curr.xfer_size,MMCIDATALENGTH ); -msmsdcc_writel (host, pio_irqmask,MMCIMASK1 ); +msmsdcc_writel (host, (msmsdcc_readl (host,MMCIMASK0 ) & + (~MCI_IRQ_PIO )) | pio_irqmask,MMCIMASK0 ); +msmsdcc_writel (host, datactrl,MMCIDATACTRL );if (cmd) {
@@ -659,8 +662,13 @@ msmsdcc_pio_irq(int irq, void *dev_id) {struct msmsdcc_host *host = dev_id;uint32_t status; +u32 mci_mask0 =0 ; status =msmsdcc_readl (host,MMCISTATUS ); + mci_mask0 =msmsdcc_readl (host,MMCIMASK0 ); + +if (((mci_mask0 & status) &MCI_IRQ_PIO ) ==0 ) +return IRQ_NONE ; do { unsigned long flags;
@@ -719,10 +727,12 @@ msmsdcc_pio_irq(int irq, void *dev_id) }while (1 );if (status &MCI_RXACTIVE && host->curr.xfer_remain <MCI_FIFOSIZE ) -msmsdcc_writel (host,MCI_RXDATAAVLBLMASK ,MMCIMASK1 ); +msmsdcc_writel (host, (mci_mask0 & (~MCI_IRQ_PIO )) | +MCI_RXDATAAVLBLMASK ,MMCIMASK0 );if (!host->curr.xfer_remain) -msmsdcc_writel (host,0 ,MMCIMASK1 ); +msmsdcc_writel (host, (mci_mask0 & (~MCI_IRQ_PIO )) |0 , +MMCIMASK0 );return IRQ_HANDLED ; }
@@ -854,6 +864,8 @@ msmsdcc_irq(int irq, void *dev_id) do { status = msmsdcc_readl(host, MMCISTATUS); status &= msmsdcc_readl(host, MMCIMASK0); + if ((status & (~MCI_IRQ_PIO)) == 0) + break; msmsdcc_writel(host, status, MMCICLEAR); if (status & MCI_SDIOINTR)
drivers/mmc/host/msm_sdcc.h +5 -0
@@ -140,6 +140,11 @@ MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATAENDMASK|MCI_PROGDONEMASK) +#define MCI_IRQ_PIO \ + (MCI_RXDATAAVLBLMASK | MCI_TXDATAAVLBLMASK | MCI_RXFIFOEMPTYMASK | \ + MCI_TXFIFOEMPTYMASK | MCI_RXFIFOFULLMASK | MCI_TXFIFOFULLMASK | \ + MCI_RXFIFOHALFFULLMASK | MCI_TXFIFOHALFEMPTYMASK | \ + MCI_RXACTIVEMASK | MCI_TXACTIVEMASK)/* * The size of the FIFO in bytes. */
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 5/7] mmc: msm_sdcc: Use MCI_INT_MASK0 for PIO interrupts
drivers/mmc/host/msm_sdcc.c msmsdcc_pio_irq(int irq, void *dev_id) · line 665
Quoted 5 lines · Sahitya Tummala
drivers/mmc/host/msm_sdcc.c +1
-0@@ -659,8 +662,13 @@ msmsdcc_pio_irq(int irq, void *dev_id) {struct msmsdcc_host *host = dev_id;uint32_t status; +u32 mci_mask0 =0 ;
Is this assignment there to silence an "unused variable" warning? If it is, please use the uninitialized_var macro. If it isn't please remove the assignment.
Quoted 9 lines
drivers/mmc/host/msm_sdcc.c +4
-0status =msmsdcc_readl (host,MMCISTATUS ); + mci_mask0 =msmsdcc_readl (host,MMCIMASK0 ); + +if (((mci_mask0 & status) &MCI_IRQ_PIO ) ==0 ) +return IRQ_NONE ; do { unsigned long flags;
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v2 5/7 mmc: msm_sdcc: Use MCI_INT_MASK0 for PIO interrupts
In reply to Sahitya TummalaNot all targets have IRQ1 line routed from the SD controller to the processor. So we cannot rely on IRQ1 for PIO interrupts. This patch moves all PIO interrupts to IRQ0 and enables the PIO mode.
--- drivers/mmc/host/msm_sdcc.c | 20 ++++++++++++++++---- drivers/mmc/host/msm_sdcc.h | 5 +++++ 2 files changed, 21 insertions(+), 4 deletions(-)
drivers/mmc/host/msm_sdcc.c +16 -4
@@ -213,7 +213,8 @@ msmsdcc_dma_exec_func(struct msm_dmov_cmd *cmd)msmsdcc_writel (host, host->cmd_timeout,MMCIDATATIMER );msmsdcc_writel (host, (unsigned int )host->curr.xfer_size,MMCIDATALENGTH ); -msmsdcc_writel (host, host->cmd_pio_irqmask,MMCIMASK1 ); +msmsdcc_writel (host, (msmsdcc_readl (host,MMCIMASK0 ) & + (~MCI_IRQ_PIO )) | host->cmd_pio_irqmask,MMCIMASK0 );msmsdcc_writel (host, host->cmd_datactrl,MMCIDATACTRL );if (host->cmd_cmd) {
@@ -543,7 +544,9 @@ msmsdcc_start_data(struct msmsdcc_host *host, struct mmc_data *data,msmsdcc_writel (host, host->curr.xfer_size,MMCIDATALENGTH ); -msmsdcc_writel (host, pio_irqmask,MMCIMASK1 ); +msmsdcc_writel (host, (msmsdcc_readl (host,MMCIMASK0 ) & + (~MCI_IRQ_PIO )) | pio_irqmask,MMCIMASK0 ); +msmsdcc_writel (host, datactrl,MMCIDATACTRL );if (cmd) {
@@ -659,8 +662,13 @@ msmsdcc_pio_irq(int irq, void *dev_id) {struct msmsdcc_host *host = dev_id;uint32_t status; +u32 mci_mask0; status =msmsdcc_readl (host,MMCISTATUS ); + mci_mask0 =msmsdcc_readl (host,MMCIMASK0 ); + +if (((mci_mask0 & status) &MCI_IRQ_PIO ) ==0 ) +return IRQ_NONE ; do { unsigned long flags;
@@ -719,10 +727,12 @@ msmsdcc_pio_irq(int irq, void *dev_id) }while (1 );if (status &MCI_RXACTIVE && host->curr.xfer_remain <MCI_FIFOSIZE ) -msmsdcc_writel (host,MCI_RXDATAAVLBLMASK ,MMCIMASK1 ); +msmsdcc_writel (host, (mci_mask0 & (~MCI_IRQ_PIO )) | +MCI_RXDATAAVLBLMASK ,MMCIMASK0 );if (!host->curr.xfer_remain) -msmsdcc_writel (host,0 ,MMCIMASK1 ); +msmsdcc_writel (host, (mci_mask0 & (~MCI_IRQ_PIO )) |0 , +MMCIMASK0 );return IRQ_HANDLED ; }
@@ -854,6 +864,8 @@ msmsdcc_irq(int irq, void *dev_id) do { status = msmsdcc_readl(host, MMCISTATUS); status &= msmsdcc_readl(host, MMCIMASK0); + if ((status & (~MCI_IRQ_PIO)) == 0) + break; msmsdcc_writel(host, status, MMCICLEAR); if (status & MCI_SDIOINTR)
drivers/mmc/host/msm_sdcc.h +5 -0
@@ -140,6 +140,11 @@ MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATAENDMASK|MCI_PROGDONEMASK) +#define MCI_IRQ_PIO \ + (MCI_RXDATAAVLBLMASK | MCI_TXDATAAVLBLMASK | MCI_RXFIFOEMPTYMASK | \ + MCI_TXFIFOEMPTYMASK | MCI_RXFIFOFULLMASK | MCI_TXFIFOFULLMASK | \ + MCI_RXFIFOHALFFULLMASK | MCI_TXFIFOHALFEMPTYMASK | \ + MCI_RXACTIVEMASK | MCI_TXACTIVEMASK)/* * The size of the FIFO in bytes. */
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 6/7 mmc: msm_sdcc: Change initialization order of busclk_timer in probe
In reply to Sahitya TummalaIntialize busclk_timer before it is accessed in probe.
--- drivers/mmc/host/msm_sdcc.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/msm_sdcc.c +4 -4
@@ -1209,6 +1209,10 @@ msmsdcc_probe(struct platform_device *pdev) host->plat = plat; host->mmc = mmc; host->curr.cmd =NULL ; +init_timer (&host->busclk_timer); + host->busclk_timer.data = (unsigned long ) host; + host->busclk_timer.function = msmsdcc_busclk_expired; + host->cmdpoll =1 ;
@@ -1326,10 +1330,6 @@ msmsdcc_probe(struct platform_device *pdev) host->eject = !host->oldstat; } -init_timer (&host->busclk_timer); - host->busclk_timer.data = (unsigned long ) host; - host->busclk_timer.function = msmsdcc_busclk_expired; - ret =request_irq (cmd_irqres->start, msmsdcc_irq,IRQF_SHARED ,DRIVER_NAME " (cmd)" , host);if (ret)
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v2 6/7 mmc: msm_sdcc: Change initialization order of busclk_timer in probe
Intialize busclk_timer before it is accessed in probe.
--- drivers/mmc/host/msm_sdcc.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/msm_sdcc.c +4 -4
@@ -1209,6 +1209,10 @@ msmsdcc_probe(struct platform_device *pdev) host->plat = plat; host->mmc = mmc; host->curr.cmd =NULL ; +init_timer (&host->busclk_timer); + host->busclk_timer.data = (unsigned long ) host; + host->busclk_timer.function = msmsdcc_busclk_expired; + host->cmdpoll =1 ;
@@ -1326,10 +1330,6 @@ msmsdcc_probe(struct platform_device *pdev) host->eject = !host->oldstat; } -init_timer (&host->busclk_timer); - host->busclk_timer.data = (unsigned long ) host; - host->busclk_timer.function = msmsdcc_busclk_expired; - ret =request_irq (cmd_irqres->start, msmsdcc_irq,IRQF_SHARED ,DRIVER_NAME " (cmd)" , host);if (ret)
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 7/7 mmc: msm_sdcc: Handle dma resource not present case
In reply to Sahitya TummalaFrom: Subhash Jadavani <[email protected]>
If DMA resource is not available then SDCC driver should atleast work in PIO data transfer mode.
--- drivers/mmc/host/msm_sdcc.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
drivers/mmc/host/msm_sdcc.c +10 -5
@@ -1233,9 +1233,13 @@ msmsdcc_probe(struct platform_device *pdev)/* * Setup DMA */ - ret =msmsdcc_init_dma (host); -if (ret) - goto ioremap_free; +if (host->dmares) { + ret =msmsdcc_init_dma (host); +if (ret) + goto ioremap_free; + }else { + host->dma.channel =-1 ; + }/* Get our clocks */ host->pclk =clk_get (&pdev->dev,"sdc_pclk" );
@@ -1379,8 +1383,9 @@ msmsdcc_probe(struct platform_device *pdev) pclk_put:clk_put (host->pclk); dma_free: -dma_free_coherent (NULL ,sizeof (struct msmsdcc_nc_dmadata ), - host->dma.nc, host->dma.nc_busaddr); +if (host->dmares) +dma_free_coherent (NULL ,sizeof (struct msmsdcc_nc_dmadata ), + host->dma.nc, host->dma.nc_busaddr); ioremap_free:tasklet_kill (&host->dma_tlet);iounmap (host->base);
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v2 7/7 mmc: msm_sdcc: Handle dma resource not present case
From: Subhash Jadavani <[email protected]>
If DMA resource is not available then SDCC driver should atleast work in PIO data transfer mode.
--- drivers/mmc/host/msm_sdcc.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
drivers/mmc/host/msm_sdcc.c +10 -5
@@ -1233,9 +1233,13 @@ msmsdcc_probe(struct platform_device *pdev)/* * Setup DMA */ - ret =msmsdcc_init_dma (host); -if (ret) - goto ioremap_free; +if (host->dmares) { + ret =msmsdcc_init_dma (host); +if (ret) + goto ioremap_free; + }else { + host->dma.channel =-1 ; + }/* Get our clocks */ host->pclk =clk_get (&pdev->dev,"sdc_pclk" );
@@ -1379,8 +1383,9 @@ msmsdcc_probe(struct platform_device *pdev) pclk_put:clk_put (host->pclk); dma_free: -dma_free_coherent (NULL ,sizeof (struct msmsdcc_nc_dmadata ), - host->dma.nc, host->dma.nc_busaddr); +if (host->dmares) +dma_free_coherent (NULL ,sizeof (struct msmsdcc_nc_dmadata ), + host->dma.nc, host->dma.nc_busaddr); ioremap_free:tasklet_kill (&host->dma_tlet);iounmap (host->base);
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v2 1/7 mmc: msm_sdcc: handle the platform gpio_data not present case
In reply to Sahitya TummalaFrom: Subhash Jadavani <[email protected]>
If platform gpio_data is not present then don't do any gpio configuration.
--- drivers/mmc/host/msm_sdcc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/msm_sdcc.c +1 -1
@@ -939,7 +939,7 @@ static void msmsdcc_setup_gpio(struct msmsdcc_host *host, bool enable)struct msm_mmc_gpio_data *curr;int i, rc =0 ; -if (!host->plat->gpio_data && host->gpio_config_status == enable) +if (!host->plat->gpio_data || host->gpio_config_status == enable)return ; curr = host->plat->gpio_data;
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.