fsl_esdhc.c bug
All,
There is a bug rendering SDCard support useless on Freescale esdhc controller.
File drivers/mmc/fsl_esdhc.c, function esdhc_pio_read_write
*change: *
struct fsl_esdhc *regs = mmc->priv;
*to:*
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; volatile struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
How do I/we get this into the mainstream?
I cloned the repository, and have it fixed. First time using git, and trying to contribute to OpenSource too.
Regards,
Jim
Hi Jim
Quoted 4 lines · Jim Lentz
All,
There is a bug rendering SDCard support useless on Freescale esdhc
controller.
Quoted 11 lines
File
drivers/mmc/fsl_esdhc.c, functionesdhc_pio_read_write*change: *
struct
fsl_esdhc*regs =mmc->priv;*to:*
struct
fsl_esdhc_cfg*cfg = (structfsl_esdhc_cfg*)mmc->priv; volatile structfsl_esdhc*regs = (structfsl_esdhc*)cfg->esdhc_base;
use of volatile is highly likely to be wrong
Quoted 2 lines
How do I/we get this into the mainstream?
First read:
http://www.denx.de/wiki/U-Boot/CodingStyle
And:
http://www.denx.de/wiki/U-Boot/Patches
Quoted 2 lines
I cloned the repository, and have it fixed. First time using git, and
trying to contribute to OpenSource too.
git format-patch and git send-email
Regards,
Graeme
Hi Jim,
Quoted 4 lines · Jim Lentz
All,
There is a bug rendering SDCard support useless on Freescale esdhc controller.
Which Freescale processor do you use?
Please describe in details the problem you see, how to reproduce it, the U-boot version
that you use, etc.
Regards,
Fabio Estevam
Quoted 9 lines · Fabio Estevam
Hi Jim,
Quoted 4 lines · Jim Lentz
All,
There is a bug rendering SDCard support useless on Freescale esdhc controller.
Which Freescale processor do you use?
Quoted 7 lines
Please describe in details the problem you see, how to reproduce it, the U-boot version
that you use, etc.Regards,
Fabio Estevam
Freescale P2020. Latest U-boot version.
Easiest way to see it is typing mmcinfo at the U-boot cli. It will hang.
By default, PIO mode is selected when CONFIG_P2020 is defined. Legacy P2020 silicon revisions require PIO mode.
The esdhc_pio_read_write function has a bad reg pointer.
Jim
Quoted 17 lines · Jim Lentz
Quoted 9 lines · Fabio Estevam
Hi Jim,
Quoted 4 lines · Jim Lentz
All,
There is a bug rendering SDCard support useless on Freescale esdhc controller.
Which Freescale processor do you use?
Quoted 7 lines
Please describe in details the problem you see, how to reproduce it, the U-boot version
that you use, etc.Regards,
Fabio Estevam
Quoted 9 lines
Freescale P2020. Latest U-boot version.
Easiest way to see it is typing mmcinfo at the U-boot cli. It will hang.
By default, PIO mode is selected when
CONFIG_P2020is defined. Legacy P2020 silicon revisions require PIO mode.The
esdhc_pio_read_writefunction has a bad reg pointer.
Hi Jim,
I tested this on my P2020, and PIO mode fails as you describe. Your fix works. I've attached a patch which is suitable for inclusion into U-Boot. Feel free to submit your own patch to supercede this one. It is a bug you found, you should get credit for it! :)
It looks like the patch which introduced this code (77c1458d1 "ppc/85xx:
PIO Support for FSL eSDHC Controller Driver") was carried out of tree for a while. While it was out of tree, another commit happened (c67bee146 "fsl_esdhc: add support for mx51 processor") which changed how the mmc->priv variable is used.