Skip to contentSkip to conversation

fsl_esdhc.c bug

U-Boot Jim Lentz 4 participants 5 messages Dec 16, 2011

lore
Share & tools
lore

Jim Lentz

author
#0 lore raw

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

#1 lore raw

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, 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;

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

#2 lore raw
In reply to Jim Lentz

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

author
#3 lore raw
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

#4 lore raw
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_P2020 is defined. Legacy P2020 silicon revisions require PIO mode.

The esdhc_pio_read_write function 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.