From: Lukasz Majewski Date: Mon, 02 Apr 2012 17:10:10 +0200 Subject: [U-Boot] [PATCH] mmc:fix: Set mmc width according to MMC host capabilities In-Reply-To: <20120326152215.391b6a94@lmajewski.digital.local> References: <1331626038-20893-1-git-send-email-l.majewski@samsung.com> <20120326152215.391b6a94@lmajewski.digital.local> Message-ID: <20120402171010.0b293465@lmajewski.digital.local> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Andy, > Hi Andy, > > > This patch sets the MMC width according to the MMC host > > capabilities. It turned out, that there are some targets (e.g. > > GONI), which are able to read data from SPI only at 4 bit mode. > > This patch restricts the width number according to the MMC host. > > > > Signed-off-by: Lukasz Majewski > > Signed-off-by: Kyungmin Park > > Cc: Andy Fleming > > --- > > drivers/mmc/mmc.c | 4 +++- > > include/mmc.h | 3 +++ > > 2 files changed, 6 insertions(+), 1 deletions(-) > > > > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c > > index 49c3349..51c0106 100644 > > --- a/drivers/mmc/mmc.c > > +++ b/drivers/mmc/mmc.c > > @@ -1103,7 +1103,9 @@ int mmc_startup(struct mmc *mmc) > > else > > mmc_set_clock(mmc, 25000000); > > } else { > > - for (width = EXT_CSD_BUS_WIDTH_8; width >= 0; > > width--) { > > + width = ((mmc->host_caps & > > MMC_MODE_MASK_WIDTH_BITS) > > >> > > + MMC_MODE_WIDTH_BITS_SHIFT); > > + for (; width >= 0; width--) { > > /* Set the card to use 4 bit*/ > > err = mmc_switch(mmc, > > EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, width); > > diff --git a/include/mmc.h b/include/mmc.h > > index 30c2375..ff2f28e 100644 > > --- a/include/mmc.h > > +++ b/include/mmc.h > > @@ -47,6 +47,9 @@ > > #define MMC_MODE_SPI 0x400 > > #define MMC_MODE_HC 0x800 > > > > +#define MMC_MODE_MASK_WIDTH_BITS (MMC_MODE_4BIT | MMC_MODE_8BIT) > > +#define MMC_MODE_WIDTH_BITS_SHIFT 8 > > + > > #define SD_DATA_4BIT 0x00040000 > > > > #define IS_SD(x) (x->version & SD_VERSION_SD) > > Do you have any opinions/comments about this patch? > It has already spent some time on the mainling list and nobody > complaint :-) > Do you have any questions about this patch? -- Best regards, Lukasz Majewski Samsung Poland R&D Center Platform Group