From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Mon, 11 Oct 2010 04:17:01 -0400 Subject: [U-Boot] [PATCH V5 1/2] MTD/SPI: introduce table driven probing In-Reply-To: <4CB2C32A.8070203@emk-elektronik.de> References: <1286290600-18988-1-git-send-email-u-boot@emk-elektronik.de> <201010110328.10519.vapier@gentoo.org> <4CB2C32A.8070203@emk-elektronik.de> Message-ID: <201010110417.02557.vapier@gentoo.org> 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 11, 2010 03:56:26 Reinhard Meyer wrote: > Dear Mike Frysinger, > > > On Tuesday, October 05, 2010 10:56:39 Reinhard Meyer wrote: > >> + /* > >> + * count the number of continuation bytes, but > >> + * leave at least 3 bytes to the end of the buffer untouched > >> + */ > >> + for (shift = 0, idp = idbuf; > >> + shift < (sizeof(idbuf) - 3) && *idp == 0x7f; > >> + shift++, idp++) > >> + ; > >> + > >> + /* search the table for matches in shift and id */ > >> + for (i = 0; i < ARRAY_SIZE(flashes); i++) { > >> + if (flashes[i].shift == shift && flashes[i].idcode == *idp) { > >> + /* we have a match, call probe */ > >> + flash = flashes[i].probe(spi, idp); > >> + if (flash) > >> + break; > >> + } > >> > >> } > > > > thinking about this some more, i see two problems. (1) we've been > > providing 4 bytes to probe funcs (like the spansion), so 3 is too small. > > (2) all of the probe devices today expect to get the whole idcode > > buffer. so if we're going to change this API, we need to fix all the > > probe funcs too. but that is a lot of changes to roll into one commit, > > so let's first focus on converting to a table without changing any probe > > semantics. > > NONE of the existing functions work with expansion, so they all get the > unshifted, full ID buffer. err, right. was thinking it also shifted off the manu id byte and not just the continuation bytes. i'll tweak the patch i posted and pull in your ramtron patch. > If you provide the unshifted buffer to the function, the function should > get the shift amount as well. Otherwise the function will again have look > how many 0x7e's to skip.... not really. the probe funcs already know the layout of the idcode, so starting at a constant offset of 3 is the same as starting at 1. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20101011/ceea04b1/attachment.pgp