From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Mon, 3 Oct 2011 12:41:34 +0200 Subject: [U-Boot] [PATCH] mmc: test mmc bus width on startup In-Reply-To: <1317632636-12688-1-git-send-email-leiwen@marvell.com> References: <1317632636-12688-1-git-send-email-leiwen@marvell.com> Message-ID: <201110031241.34844.marek.vasut@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday, October 03, 2011 11:03:56 AM Lei Wen wrote: > For we don't know mmc bus width from reading registers, the only way > to check is to test. > > Change-Id: Ia50df480bd14349e36ac8217d8d290cf732db089 > Signed-off-by: Lei Wen > --- [...] > + if (!err && ext_csd[160] == test_csd[160] > + && ext_csd[175] == test_csd[175] > + && ext_csd[192] == test_csd[192] > + && ext_csd[224] == test_csd[224] > + && memcmp(&ext_csd[212], &test_csd[212], 4) == 0) { > + mmc->card_caps |= width; > + break; > + } > } > > if (mmc->card_caps & MMC_MODE_HS) { Hi Lei, I see you're accessing the ext_csd via some magic constants. Can you possibly convert it to structure-based access ? Like struct ext_csd csd; csd->member ... ? Cheers