diff mbox

Revert "sdhci-of-esdhc: Support 8BIT bus width."

Message ID 1431673364.13197.10.camel@transmode.se
State New
Headers show

Commit Message

Joakim Tjernlund May 15, 2015, 7:02 a.m. UTC
On Fri, 2015-05-15 at 14:29 +0800, Kevin Hao wrote:
> This reverts commit 459fe0cfda71835eacc0b24571e8425cea975688.
> It causes kernel panic due to a null pointer reference to .set_bus_width
> on fsl p2020rdb board.
>   Unable to handle kernel paging request for instruction fetch
>   Faulting instruction address: 0x00000000
>   Oops: Kernel access of bad area, sig: 11 [#1]
>   SMP NR_CPUS=8 P2020 RDB
>   Modules linked in:
>   CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.1.0-rc3-next-20150514-00001-g76c7a15bee83 #103
>   task: ea858000 ti: ea846000 task.ti: ea846000
>   NIP: 00000000 LR: c048036c CTR: 00000000
>   REGS: ea847c70 TRAP: 0400   Not tainted  (4.1.0-rc3-next-20150514-00001-g76c7a15bee83)
>   MSR: 00021000 <CE,ME>  CR: 22010022  XER: 00000000
> 
>   GPR00: c04802c4 ea847d20 ea858000 eaa3ab00 00000000 00000f20 00000002 00000000
>   GPR08: 00000000 00000000 00000000 90000000 22010022 00000000 c0002a68 00000000
>   GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 c08a64e0 000000e9
>   GPR24: c080f398 c08a0000 00000000 0000000e 00029000 eaa3ab28 eaa3a9f0 eaa3ab00
>   NIP [00000000]   (null)
>   LR [c048036c] sdhci_do_set_ios+0x164/0x824
>   Call Trace:
>   [ea847d20] [c04802c4] sdhci_do_set_ios+0xbc/0x824 (unreliable)
>   [ea847d40] [c0480a60] sdhci_set_ios+0x34/0x4c
>   [ea847d50] [c046c96c] mmc_power_up.part.16+0x3c/0x120
>   [ea847d70] [c046da10] mmc_start_host+0x50/0xa4
>   [ea847d80] [c046ee28] mmc_add_host+0x50/0x78
>   [ea847d90] [c0481438] sdhci_add_host+0x8c4/0xcc0
>   [ea847db0] [c0485824] sdhci_esdhc_probe+0xa8/0xc8
>   [ea847dd0] [c032ed28] platform_drv_probe+0x3c/0xa4
>   [ea847df0] [c032d170] driver_probe_device+0x1f0/0x2c4
>   [ea847e10] [c032d370] __driver_attach+0xbc/0xc0
>   [ea847e30] [c032b178] bus_for_each_dev+0x6c/0xb8
>   [ea847e60] [c032c6b8] bus_add_driver+0x168/0x220
>   [ea847e80] [c032da70] driver_register+0x88/0x130
>   [ea847e90] [c000234c] do_one_initcall+0x8c/0x1e0
>   [ea847f00] [c0815b08] kernel_init_freeable+0x138/0x1d4
>   [ea847f30] [c0002a7c] kernel_init+0x14/0x100
>   [ea847f40] [c000e838] ret_from_kernel_thread+0x5c/0x64
> 
> Signed-off-by: Kevin Hao <haokexin@gmail.com>

Reverting this seem a bit to much. Looking in the log it seems commit
 2317f56c055fcad524bf6a873df48a754e7ebc4d 
introduced the error by not checking for host->ops->set_bus_width before
calling it.

How does this work for you?

Comments

Kevin Hao May 15, 2015, 7:36 a.m. UTC | #1
On Fri, May 15, 2015 at 07:02:44AM +0000, Joakim Tjernlund wrote:
> Reverting this seem a bit to much. Looking in the log it seems commit
>  2317f56c055fcad524bf6a873df48a754e7ebc4d 
> introduced the error by not checking for host->ops->set_bus_width before
> calling it.
> 
> How does this work for you?

No. My sd card still don't work with this change.

> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index c80287a..23603b2 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1528,7 +1528,10 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
>         if (host->ops->platform_send_init_74_clocks)
>                 host->ops->platform_send_init_74_clocks(host, ios->power_mode);
>  
> -       host->ops->set_bus_width(host, ios->bus_width);
> +       if (host->ops->set_bus_width)
> +               host->ops->set_bus_width(host, ios->bus_width);
> +       else
> +               sdhci_set_bus_width(host, ios->bus_width);

The default sdhci_set_bus_width() doesn't apply to the esdhc controller on my
board (p2020rdb). This controller is compatible with the sd host specification
2.0 and the implementation of sdhci_set_bus_width() can't set the bus width
correctly for it.

Thanks,
Kevin
Joakim Tjernlund May 15, 2015, 7:49 a.m. UTC | #2
On Fri, 2015-05-15 at 15:36 +0800, Kevin Hao wrote:
> On Fri, May 15, 2015 at 07:02:44AM +0000, Joakim Tjernlund wrote:
> > Reverting this seem a bit to much. Looking in the log it seems commit
> >  2317f56c055fcad524bf6a873df48a754e7ebc4d 
> > introduced the error by not checking for host->ops->set_bus_width before
> > calling it.
> > 
> > How does this work for you?
> 
> No. My sd card still don't work with this change.
> 
> > 
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index c80287a..23603b2 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -1528,7 +1528,10 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
> >         if (host->ops->platform_send_init_74_clocks)
> >                 host->ops->platform_send_init_74_clocks(host, ios->power_mode);
> >  
> > -       host->ops->set_bus_width(host, ios->bus_width);
> > +       if (host->ops->set_bus_width)
> > +               host->ops->set_bus_width(host, ios->bus_width);
> > +       else
> > +               sdhci_set_bus_width(host, ios->bus_width);
> 
> The default sdhci_set_bus_width() doesn't apply to the esdhc controller on my
> board (p2020rdb). This controller is compatible with the sd host specification
> 2.0 and the implementation of sdhci_set_bus_width() can't set the bus width
> correctly for it.

But the controller is the same as for T1042 I presume? The bus width is in SDHCI_HOST_CONTROL
and the 8BIT is bit 29 in the register?

What bus width do you use and what is the failure?

 Jocke
 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kevin Hao May 17, 2015, 5:04 a.m. UTC | #3
On Fri, May 15, 2015 at 07:49:29AM +0000, Joakim Tjernlund wrote:
> On Fri, 2015-05-15 at 15:36 +0800, Kevin Hao wrote:
> > On Fri, May 15, 2015 at 07:02:44AM +0000, Joakim Tjernlund wrote:
> > > Reverting this seem a bit to much. Looking in the log it seems commit
> > >  2317f56c055fcad524bf6a873df48a754e7ebc4d 
> > > introduced the error by not checking for host->ops->set_bus_width before
> > > calling it.
> > > 
> > > How does this work for you?
> > 
> > No. My sd card still don't work with this change.
> > 
> > > 
> > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > > index c80287a..23603b2 100644
> > > --- a/drivers/mmc/host/sdhci.c
> > > +++ b/drivers/mmc/host/sdhci.c
> > > @@ -1528,7 +1528,10 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
> > >         if (host->ops->platform_send_init_74_clocks)
> > >                 host->ops->platform_send_init_74_clocks(host, ios->power_mode);
> > >  
> > > -       host->ops->set_bus_width(host, ios->bus_width);
> > > +       if (host->ops->set_bus_width)
> > > +               host->ops->set_bus_width(host, ios->bus_width);
> > > +       else
> > > +               sdhci_set_bus_width(host, ios->bus_width);
> > 
> > The default sdhci_set_bus_width() doesn't apply to the esdhc controller on my
> > board (p2020rdb). This controller is compatible with the sd host specification
> > 2.0 and the implementation of sdhci_set_bus_width() can't set the bus width
> > correctly for it.
> 
> But the controller is the same as for T1042 I presume?

No. As I know the controller on t1042 is compatible with sd host specification 3.

> The bus width is in SDHCI_HOST_CONTROL
> and the 8BIT is bit 29 in the register?

Yes, that is true.

> 
> What bus width do you use and what is the failure?

4 bit sd card. I got some error like this:
mmcblk0: error -84 transferring data, sector 3911672, nr 8, cmd response 0x900, card status 0xb0

Thanks,
Kevin

> 
>nk  Jocke
>  
>
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c80287a..23603b2 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1528,7 +1528,10 @@  static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
        if (host->ops->platform_send_init_74_clocks)
                host->ops->platform_send_init_74_clocks(host, ios->power_mode);
 
-       host->ops->set_bus_width(host, ios->bus_width);
+       if (host->ops->set_bus_width)
+               host->ops->set_bus_width(host, ios->bus_width);
+       else
+               sdhci_set_bus_width(host, ios->bus_width);
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html