From: Takashi Iwai Subject: Re: [PATCH] mmc: Test bus-width for old MMC devices (v2) Date: Wed, 22 Dec 2010 09:59:44 +0100 Message-ID: References: <20101216234032.GA17239@void.printf.net> <50D31EC8-BD9E-4920-8CEB-2AD10DF9C5C5@marvell.com> <20101217034342.GA19673@void.printf.net> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from cantor2.suse.de ([195.135.220.15]:35877 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751868Ab0LVI7u (ORCPT ); Wed, 22 Dec 2010 03:59:50 -0500 In-Reply-To: Sender: linux-mmc-owner@vger.kernel.org List-Id: linux-mmc@vger.kernel.org To: zhangfei gao Cc: Philip Rakity , Chris Ball , Aries Lee , Qiming Wu , "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" At Tue, 21 Dec 2010 22:56:32 -0500, zhangfei gao wrote: >=20 > On Tue, Dec 21, 2010 at 11:36 AM, Philip Rakity = wrote: > > > > > > Can you please try this diff and see if it works for you. > > > > Will do formal patch after your testing. =C2=A0What card is failing= ? > > > > Please let me know the manufacturing information so can add card to= my test suite. > > > > Philip > > > > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c > > index 1d8409f..77072c8 100644 > > --- a/drivers/mmc/core/mmc.c > > +++ b/drivers/mmc/core/mmc.c > > @@ -558,6 +558,8 @@ static int mmc_init_card(struct mmc_host *host,= u32 ocr, > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = EXT_CSD_BUS_WIDTH, > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = ext_csd_bits[idx][0]); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0if (!err) { > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mmc_set_bus_width_ddr(card->host= , > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bus_width, MMC_SDR_MODE); > Test OK, > Curious why move here, then mmc_set_bus_width_ddr is called twice in > fact when ddr=3D0 && (!(host->caps & MMC_CAP_BUS_WIDTH_TEST)), thoug= h > not impact function. > mmc_set_bus_width is mmc_set_bus_width_ddr(host, width, MMC_SDR_MODE)= =2E Right. How about the patch below? This one just moves the call before caps test, so it's simpler (and avoiding double calls). thanks, Takashi =3D=3D=3D =46rom b66b9704f8d2fefa402741fb17949224b2766b4f Mon Sep 17 00:00:00 200= 1 =46rom: Takashi Iwai Date: Wed, 22 Dec 2010 09:54:33 +0100 Subject: [PATCH] mmc: fix mmc_set_bus_width_ddr() call without bus-widt= h-test cap With the bus-width test patch, mmc_set_bus_width*() isn't called proper= ly when the driver doesn't set MMC_CAP_BUS_WIDTH and no DDR mode. This patch fixes the regression by moving the call up before the cap te= st. Signed-off-by: Takashi Iwai --- drivers/mmc/core/mmc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 1d8409f..c86dd73 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -558,6 +558,8 @@ static int mmc_init_card(struct mmc_host *host, u32= ocr, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx][0]); if (!err) { + mmc_set_bus_width_ddr(card->host, + bus_width, MMC_SDR_MODE); /* * If controller can't handle bus width test, * use the highest bus width to maintain @@ -565,8 +567,6 @@ static int mmc_init_card(struct mmc_host *host, u32= ocr, */ if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST)) break; - mmc_set_bus_width_ddr(card->host, - bus_width, MMC_SDR_MODE); err =3D mmc_bus_test(card, bus_width); if (!err) break; --=20 1.7.3.4