Patches to support Ramtron SPI FRAMs
Patch 1 adds generalisation to spi_flash.c to allow for table driven probing of JEDEC and NON-JEDEC conformant devices
Patch 2 adds the actual Ramtron support
Patch 2 requires Patch 1 to be applied first.
PATCH v3 1/1 MTD/SPI: introduce table driven probing
for JEDEC devices without and with extension bytes for non JEDEC devices
--- drivers/mtd/spi/spi_flash.c | 139 +++++++++++++++++++++++++++++-------------- 1 files changed, 94 insertions(+), 45 deletions(-)
drivers/mtd/spi/spi_flash.c +94 -45
@@ -1,8 +1,26 @@/* -* SPI flash interface +* (C) Copyright 2010 +* Reinhard Meyer, EMK Elektronik, reinhard.meyer at emk-elektronik.de * * Copyright (C) 2008 Atmel Corporation -* Licensed under the GPL-2 or later. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA */ #include <common.h>
@@ -96,13 +114,59 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,return ret; } +/* +* the following table holds all device probe functions +* +* shift: number of continuation bytes before the ID +* idcode: the expected IDCODE or 0xff for non JEDEC devices +* probe: the function to call +* +* non JEDEC devices should be ordered in the table such that +* the probe functions with best detection algorithms come first +* +* several matching entries are permitted, they will be tried +* in sequence until a probe function returns non NULL +* +* IDBUF_LEN may be redefined if a device detection requires +* more then 5 bytes read. +*/ +#define IDBUF_LEN 5 +const struct { +const u8 shift; +const u8 idcode; +struct spi_flash *(*probe) (struct spi_slave *spi,u8 *idcode); +} flashes[] = { +#ifdef CONFIG_SPI_FLASH_SPANSION + {0 ,0x01 , spi_flash_probe_spansion, }, +#endif +#ifdef CONFIG_SPI_FLASH_ATMEL + {0 ,0x1F , spi_flash_probe_atmel, }, +#endif +#ifdef CONFIG_SPI_FLASH_MACRONIX + {0 ,0xc2 , spi_flash_probe_macronix, }, +#endif +#ifdef CONFIG_SPI_FLASH_WINBOND + {0 ,0xef , spi_flash_probe_winbond, }, +#endif +#ifdef CONFIG_SPI_FLASH_STMICRO + {0 ,0x20 , spi_flash_probe_stmicro, }, + {0 ,0xff , spi_flash_probe_stmicro, }, +#endif +#ifdef CONFIG_SPI_FLASH_SST + {0 ,0xBF , spi_flash_probe_sst, }, +#endif +}; +struct spi_flash *spi_flash_probe (unsigned int bus,unsigned int cs,unsigned int max_hz,unsigned int spi_mode) {struct spi_slave *spi; -struct spi_flash *flash; +struct spi_flash *flash =NULL ;int ret; -u8 idcode[5 ]; +int shift; +int i; +u8 idbuf[IDBUF_LEN ]; +u8 *idp; spi =spi_setup_slave (bus, cs, max_hz, spi_mode);if (!spi) {
@@ -117,53 +181,38 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, }/* Read the ID codes */ - ret =spi_flash_cmd (spi,CMD_READ_ID , &idcode,sizeof (idcode)); + ret =spi_flash_cmd (spi,CMD_READ_ID , &idbuf,sizeof (idbuf));if (ret) goto err_read_id; -debug ("SF: Got idcode %02x %02x %02x %02x %02x\n" , idcode[0 ], - idcode[1 ], idcode[2 ], idcode[3 ], idcode[4 ]); - -switch (idcode[0 ]) { -#ifdef CONFIG_SPI_FLASH_SPANSION -case 0x01 : - flash =spi_flash_probe_spansion (spi, idcode); -break ; -#endif -#ifdef CONFIG_SPI_FLASH_ATMEL -case 0x1F : - flash =spi_flash_probe_atmel (spi, idcode); -break ; -#endif -#ifdef CONFIG_SPI_FLASH_MACRONIX -case 0xc2 : - flash =spi_flash_probe_macronix (spi, idcode); -break ; +#ifdef DEBUG +printf ("SF: Got idcodes\n" ); +print_buffer (0 , idbuf,1 ,sizeof (idbuf),0 );#endif -#ifdef CONFIG_SPI_FLASH_WINBOND -case 0xef : - flash =spi_flash_probe_winbond (spi, idcode); -break ; -#endif -#ifdef CONFIG_SPI_FLASH_STMICRO -case 0x20 : -case 0xff :/* Let the stmicro func handle non-JEDEC ids */ - flash =spi_flash_probe_stmicro (spi, idcode); -break ; -#endif -#ifdef CONFIG_SPI_FLASH_SST -case 0xBF : - flash =spi_flash_probe_sst (spi, idcode); -break ; -#endif -default : -printf ("SF: Unsupported manufacturer %02X\n" , idcode[0 ]); - flash =NULL ; -break ; - } -if (!flash) +/* +* 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 ; + } + } + +if (!flash) { +printf ("SF: Unsupported manufacturer %02X\n" , *idp); goto err_manufacturer_probe; + }spi_release_bus (spi);
Signature · 1 line
1.5.6.5
PATCH v3 1/1 MTD/SPI: add support for Ramtron FRAMs
JEDEC types
non JEDEC types
--- drivers/mtd/spi/Makefile | 1 + drivers/mtd/spi/ramtron.c | 321 ++++++++++++++++++++++++++++++++++ drivers/mtd/spi/spi_flash.c | 8 + drivers/mtd/spi/spi_flash_internal.h | 1 + 4 files changed, 331 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/spi/ramtron.c
drivers/mtd/spi/Makefile +1 -0
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_SPI_FLASH_SPANSION) += spansion.o COBJS-$(CONFIG_SPI_FLASH_SST) += sst.o COBJS-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.o COBJS-$(CONFIG_SPI_FLASH_WINBOND) += winbond.o +COBJS-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.o COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o COBJS := $(COBJS-y)
drivers/mtd/spi/ramtron.c new file +321 -0
321 lines not on this page · raw message
drivers/mtd/spi/spi_flash.c +8 -0
@@ -155,6 +155,14 @@ const struct { #ifdef CONFIG_SPI_FLASH_SST { 0, 0xBF, spi_flash_probe_sst, }, #endif +#ifdef CONFIG_SPI_FRAM_RAMTRON + { 6, 0xc2, spi_fram_probe_ramtron, }, +# ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC + { 0, 0xff, spi_fram_probe_ramtron, }, +# endif +# undef IDBUF_LEN +# define IDBUF_LEN 9 /* we need to read 6+3 bytes */ +#endif }; struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
drivers/mtd/spi/spi_flash_internal.h +1 -0
@@ -50,3 +50,4 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode);struct spi_flash *spi_flash_probe_sst (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_flash_probe_stmicro (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_flash_probe_winbond (struct spi_slave *spi,u8 *idcode); +struct spi_flash *spi_fram_probe_ramtron (struct spi_slave *spi,u8 *idcode);
Signature · 1 line
1.5.6.5
Dear Reinhard Meyer,
Quoted 6 lines · In message <[email protected]> you…
Patch 1 adds generalisation to
spi_flash.cto allow for table driven probing of JEDEC and NON-JEDEC conformant devicesPatch 2 adds the actual Ramtron support
Patch 2 requires Patch 1 to be applied first.
In this case patches MUST be numbered.
Best regards,
Wolfgang Denk
Signature · 8 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The only solution is ... a balance of power. We arm our side with exactly that much more. A balance of power -- the trickiest, most difficult, dirtiest game of them all. But the only one that preserves both sides. -- Kirk, "A Private Little War", stardate 4211.8
Dear Wolfgang Denk,
Quoted 1 line
In this case patches MUST be numbered.
I know, and I expected them to be numbered by send-email, but I have to have them numbered by format-patch. But there is now the catch that I got 8 commits and it numbers consequently 1/8, 2/8. What simple trick allows me to format-patch only HEAD~8 and HEAD~7 ?
Reinhard
Dear Reinhard Meyer,
Quoted 5 lines · In message <[email protected]> you wrote:
I know, and I expected them to be numbered by send-email, but I have to have them numbered by format-patch. But there is now the catch that I got 8 commits and it numbers consequently 1/8, 2/8. What simple trick allows me to format-patch only HEAD~8 and HEAD~7 ?
git format-patch -n HEAD~9..HEAD~7 ?
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It's certainly convenient the way the crime (or condition) of
stupidity carries with it its own punishment, automatically
admisistered without remorse, pity, or prejudice. :-)
-- Tom Christiansen in <[email protected]>Dear Wolfgang Denk,
Quoted 6 lines
Quoted 4 lines
I know, and I expected them to be numbered by send-email, but I have to have them numbered by format-patch. But there is now the catch that I got 8 commits and it numbers consequently 1/8, 2/8. What simple trick allows me to format-patch only HEAD~8 and HEAD~7 ?
git format-patch -n HEAD~9..HEAD~7 ?
Thanks. Way too simple to see the dots through a big redwood board. (though I'd use HEAD~8..HEAD~7)
Is there a similar simple trick to produce the 0/n e-Mail? I mean without hand entering Subject and Body into the send-email phase? Like having it in a prepared file?
Reinhard
Dear Reinhard Meyer,
Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 7 lines
Quoted 5 lines
I know, and I expected them to be numbered by send-email, but I have to have them numbered by format-patch. But there is now the catch that I got 8 commits and it numbers consequently 1/8, 2/8. What simple trick allows me to format-patch only HEAD~8 and HEAD~7 ?
git format-patch -n HEAD~9..HEAD~7 ?
Thanks. Way too simple to see the dots through a big redwood board. (though I'd use HEAD~8..HEAD~7)
This would give you only a single patch, representing the commit at HEAD~7
Quoted 3 lines
Is there a similar simple trick to produce the 0/n e-Mail? I mean without hand entering Subject and Body into the send-email phase? Like having it in a prepared file?
Maybe the "--compose" to "git send-email" is what you are looking for:
--compose
Invoke a text editor (see GIT_EDITOR in git-var(1)) to edit an introductory message for the patch series.
When --compose is used, git send-email will use the From, Subject, and In-Reply-To headers specified in the message. If the body of the message (what you type after the headers and a blank line) only contains blank (or GIT:
prefixed) lines the summary won't be sent, but From, Subject, and In-Reply-To headers will be used unless they are removed.
Missing From or In-Reply-To headers will be prompted for.
See the CONFIGURATION section for sendemail.multiedit.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Respect is a rational process -- McCoy, "The Galileo Seven", stardate 2822.3
Dear Wolfgang Denk,
Quoted 5 lines
Quoted 2 lines
Thanks. Way too simple to see the dots through a big redwood board. (though I'd use HEAD~8..HEAD~7)
This would give you only a single patch, representing the commit at HEAD~7
Thanks for clarifying! Interesting logic, however ;)
Quoted 6 lines
Quoted 4 lines
Is there a similar simple trick to produce the 0/n e-Mail? I mean without hand entering Subject and Body into the send-email phase? Like having it in a prepared file?
Maybe the "--compose" to "git send-email" is what you are looking for:
I had used that one. It just seemed awkward to have a text editor open and then to read a file into it...
Reinhard
Dear Reinhard Meyer,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 3 lines
Thanks. Way too simple to see the dots through a big redwood board. (though I'd use HEAD~8..HEAD~7)
This would give you only a single patch, representing the commit at HEAD~7
Thanks for clarifying! Interesting logic, however ;)
In which way "interesting"? A commit represents a state. A patch represents a change from one state into another one, so it seems logical to me that you hve to specify the "from commit" and the "to commit" IDs.
Quoted 2 lines
I had used that one. It just seemed awkward to have a text editor open and then to read a file into it...
export EDITOR=/bin/cat ? ;-)
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The world is coming to an end -- save your buffers!
Quoted 6 lines · On Sunday, September 12, 2010 15:06:07 Wolfgang Denk wrote:
Quoted 3 lines · Reinhard Meyer
Is there a similar simple trick to produce the 0/n e-Mail? I mean without hand entering Subject and Body into the send-email phase? Like having it in a prepared file?
Maybe the "--compose" to "git send-email" is what you are looking for:
or --cover-letter
-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/20100912/9f6ba775/attachment.pgp
Dear Mike Frysinger,
Quoted 9 lines · On Sunday, September 12, 2010 15:06:07 Wolfgang Denk wrote:
Quoted 6 lines
Quoted 3 lines · Reinhard Meyer
Is there a similar simple trick to produce the 0/n e-Mail? I mean without hand entering Subject and Body into the send-email phase? Like having it in a prepared file?
Maybe the "--compose" to "git send-email" is what you are looking for:
or --cover-letter
That sounds promising. I'll check that tomorrow. Anyway you might have a look at the two patches before I resend them tomorrow with proper subjects, so any comments/wishes might be addressed before I do that.
Reinhard
v4 cover Patches to support Ramtron SPI FRAMs
In reply to Reinhard MeyerPatch 1 adds generalisation to spi_flash.c to allow for table driven probing of JEDEC and NON-JEDEC conformant devices
Patch 2 adds the actual Ramtron support
Patch 2 requires Patch 1 to be applied first.
PATCH v4 1/2 MTD/SPI: introduce table driven probing
for JEDEC devices without and with extension bytes for non JEDEC devices
--- drivers/mtd/spi/spi_flash.c | 137 +++++++++++++++++++++++++++++-------------- 1 files changed, 93 insertions(+), 44 deletions(-)
drivers/mtd/spi/spi_flash.c +93 -44
@@ -1,8 +1,26 @@/* -* SPI flash interface +* (C) Copyright 2010 +* Reinhard Meyer, EMK Elektronik, reinhard.meyer at emk-elektronik.de * * Copyright (C) 2008 Atmel Corporation -* Licensed under the GPL-2 or later. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA */ #include <common.h>
@@ -96,13 +114,59 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,return ret; } +/* +* the following table holds all device probe functions +* +* shift: number of continuation bytes before the ID +* idcode: the expected IDCODE or 0xff for non JEDEC devices +* probe: the function to call +* +* non JEDEC devices should be ordered in the table such that +* the probe functions with best detection algorithms come first +* +* several matching entries are permitted, they will be tried +* in sequence until a probe function returns non NULL +* +* IDBUF_LEN may be redefined if a device detection requires +* more then 5 bytes read. +*/ +#define IDBUF_LEN 5 +const struct { +const u8 shift; +const u8 idcode; +struct spi_flash *(*probe) (struct spi_slave *spi,u8 *idcode); +} flashes[] = { +#ifdef CONFIG_SPI_FLASH_SPANSION + {0 ,0x01 , spi_flash_probe_spansion, }, +#endif +#ifdef CONFIG_SPI_FLASH_ATMEL + {0 ,0x1F , spi_flash_probe_atmel, }, +#endif +#ifdef CONFIG_SPI_FLASH_MACRONIX + {0 ,0xc2 , spi_flash_probe_macronix, }, +#endif +#ifdef CONFIG_SPI_FLASH_WINBOND + {0 ,0xef , spi_flash_probe_winbond, }, +#endif +#ifdef CONFIG_SPI_FLASH_STMICRO + {0 ,0x20 , spi_flash_probe_stmicro, }, + {0 ,0xff , spi_flash_probe_stmicro, }, +#endif +#ifdef CONFIG_SPI_FLASH_SST + {0 ,0xBF , spi_flash_probe_sst, }, +#endif +}; +struct spi_flash *spi_flash_probe (unsigned int bus,unsigned int cs,unsigned int max_hz,unsigned int spi_mode) {struct spi_slave *spi; -struct spi_flash *flash; +struct spi_flash *flash =NULL ;int ret; -u8 idcode[5 ]; +int shift; +int i; +u8 idbuf[IDBUF_LEN ]; +u8 *idp; spi =spi_setup_slave (bus, cs, max_hz, spi_mode);if (!spi) {
@@ -117,53 +181,38 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, }/* Read the ID codes */ - ret =spi_flash_cmd (spi,CMD_READ_ID , &idcode,sizeof (idcode)); + ret =spi_flash_cmd (spi,CMD_READ_ID , &idbuf,sizeof (idbuf));if (ret) goto err_read_id; -debug ("SF: Got idcode %02x %02x %02x %02x %02x\n" , idcode[0 ], - idcode[1 ], idcode[2 ], idcode[3 ], idcode[4 ]); - -switch (idcode[0 ]) { -#ifdef CONFIG_SPI_FLASH_SPANSION -case 0x01 : - flash =spi_flash_probe_spansion (spi, idcode); -break ; -#endif -#ifdef CONFIG_SPI_FLASH_ATMEL -case 0x1F : - flash =spi_flash_probe_atmel (spi, idcode); -break ; -#endif -#ifdef CONFIG_SPI_FLASH_MACRONIX -case 0xc2 : - flash =spi_flash_probe_macronix (spi, idcode); -break ; -#endif -#ifdef CONFIG_SPI_FLASH_WINBOND -case 0xef : - flash =spi_flash_probe_winbond (spi, idcode); -break ; -#endif -#ifdef CONFIG_SPI_FLASH_STMICRO -case 0x20 : -case 0xff :/* Let the stmicro func handle non-JEDEC ids */ - flash =spi_flash_probe_stmicro (spi, idcode); -break ; +#ifdef DEBUG +printf ("SF: Got idcodes\n" ); +print_buffer (0 , idbuf,1 ,sizeof (idbuf),0 );#endif -#ifdef CONFIG_SPI_FLASH_SST -case 0xBF : - flash =spi_flash_probe_sst (spi, idcode); -break ; -#endif -default : -printf ("SF: Unsupported manufacturer %02X\n" , idcode[0 ]); - flash =NULL ; -break ; + +/* +* 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 ; + } } -if (!flash) +if (!flash) { +printf ("SF: Unsupported manufacturer %02X\n" , *idp); goto err_manufacturer_probe; + }spi_release_bus (spi);
Signature · 1 line
1.5.6.5
PATCH v4 2/2 MTD/SPI: add support for Ramtron FRAMs
JEDEC types
non JEDEC types
--- drivers/mtd/spi/Makefile | 1 + drivers/mtd/spi/ramtron.c | 321 ++++++++++++++++++++++++++++++++++ drivers/mtd/spi/spi_flash.c | 8 + drivers/mtd/spi/spi_flash_internal.h | 1 + 4 files changed, 331 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/spi/ramtron.c
drivers/mtd/spi/Makefile +1 -0
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_SPI_FLASH_SPANSION) += spansion.o COBJS-$(CONFIG_SPI_FLASH_SST) += sst.o COBJS-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.o COBJS-$(CONFIG_SPI_FLASH_WINBOND) += winbond.o +COBJS-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.o COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o COBJS := $(COBJS-y)
drivers/mtd/spi/ramtron.c new file +321 -0
321 lines not on this page · raw message
drivers/mtd/spi/spi_flash.c +8 -0
@@ -155,6 +155,14 @@ const struct { #ifdef CONFIG_SPI_FLASH_SST { 0, 0xBF, spi_flash_probe_sst, }, #endif +#ifdef CONFIG_SPI_FRAM_RAMTRON + { 6, 0xc2, spi_fram_probe_ramtron, }, +# ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC + { 0, 0xff, spi_fram_probe_ramtron, }, +# endif +# undef IDBUF_LEN +# define IDBUF_LEN 9 /* we need to read 6+3 bytes */ +#endif }; struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
drivers/mtd/spi/spi_flash_internal.h +1 -0
@@ -50,3 +50,4 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode);struct spi_flash *spi_flash_probe_sst (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_flash_probe_stmicro (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_flash_probe_winbond (struct spi_slave *spi,u8 *idcode); +struct spi_flash *spi_fram_probe_ramtron (struct spi_slave *spi,u8 *idcode);
Signature · 1 line
1.5.6.5
PATCH v4 2/2 MTD/SPI: add support for Ramtron FRAMs
Quoted 2 lines · On Tuesday, September 14, 2010 10:50:09 Reinhard Meyer wrote:
JEDEC types
non JEDEC types
this changelog is useless ... either make it say something, or just leave it empty
Quoted 8 lines
drivers/mtd/spi/ramtron.c new file +8
-0+static int ramtron_common (struct spi_flash *flash, +u32 offset,size_t len,void *buf,u8 command) +{ + +if (sn->params->addr_len ==3 && sn->params->merge_cmd ==0 ) { + cmd[0 ] = command; + cmd[1 ] = offset >>16 ; + cmd[2 ] = offset >>8 ;
drivers/mtd/spi/ramtron.c line 189
Quoted 10 lines
drivers/mtd/spi/ramtron.c new file +10
-0+ cmd[3 ] = offset; + cmd_len =4 ; + } +else if (sn->params->addr_len ==2 && sn->params->merge_cmd ==0 ) { + cmd[0 ] = command; + cmd[1 ] = offset >>8 ; + cmd[2 ] = offset; + cmd_len =3 ; + } +else {
i thought i had mentioned this before, but those else statements need cuddling
drivers/mtd/spi/ramtron.c line 199
Quoted 6 lines
drivers/mtd/spi/ramtron.c new file +6
-0+/* claim the bus */ + ret =spi_claim_bus (flash->spi); +if (ret) { +debug ("SF: Unable to claim SPI bus\n" ); +return ret; + }
i'm thinking we should push the bus claim from the read/write funcs into the common spi flash layer ... not that this is specific to your flash. we can do this after yours gets merged.
drivers/mtd/spi/ramtron.c line 302
Quoted 1 line
drivers/mtd/spi/ramtron.c new file +1
-0+ sn =malloc (sizeof (struct ramtron_spi_fram ));
sizeof(*sn)
otherwise, this looks good
-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/20100914/4d8ad000/attachment.pgp
PATCH v4 2/2 MTD/SPI: add support for Ramtron FRAMs
Dear Mike Frysinger, All:)
Quoted 39 lines · On Tuesday, September 14, 2010 10:50:09 Reinhard Meyer wrote:
Quoted 2 lines
JEDEC types
non JEDEC typesthis changelog is useless ... either make it say something, or just leave it empty
Quoted 8 lines
drivers/mtd/spi/ramtron.c new file +8
-0+static int ramtron_common (struct spi_flash *flash, +u32 offset,size_t len,void *buf,u8 command) +{ + +if (sn->params->addr_len ==3 && sn->params->merge_cmd ==0 ) { + cmd[0 ] = command; + cmd[1 ] = offset >>16 ; + cmd[2 ] = offset >>8 ;drivers/mtd/spi/ramtron.c line 189
Quoted 10 lines
drivers/mtd/spi/ramtron.c new file +10
-0+ cmd[3 ] = offset; + cmd_len =4 ; + } +else if (sn->params->addr_len ==2 && sn->params->merge_cmd ==0 ) { + cmd[0 ] = command; + cmd[1 ] = offset >>8 ; + cmd[2 ] = offset; + cmd_len =3 ; + } +else {i thought i had mentioned this before, but those else statements need cuddling
drivers/mtd/spi/ramtron.c line 199
Quoted 6 lines
drivers/mtd/spi/ramtron.c new file +6
-0+/* claim the bus */ + ret =spi_claim_bus (flash->spi); +if (ret) { +debug ("SF: Unable to claim SPI bus\n" ); +return ret; + }i'm thinking we should push the bus claim from the read/write funcs into the common spi flash layer ... not that this is specific to your flash. we can do this after yours gets merged.
Quoted 6 lines
drivers/mtd/spi/ramtron.c line 302
Quoted 1 line
drivers/mtd/spi/ramtron.c new file +1
-0+ sn =malloc (sizeof (struct ramtron_spi_fram ));
sizeof(*sn)otherwise, this looks good
-mike
I am unsure whether currently I should put further effort into this, because this won't work on architectures with incomplete relocation. The pointers in the "probe" table would need relocation fixups otherwise.
Reinhard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reinhard_meyer.vcf
Type: text/x-vcard
Size: 370 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101004/ef09b784/attachment.vcf
PATCH v4 2/2 MTD/SPI: add support for Ramtron FRAMs
Dear Reinhard Meyer,
Quoted 4 lines · In message <[email protected]> you wrote:
I am unsure whether currently I should put further effort into this, because this won't work on architectures with incomplete relocation. The pointers in the "probe" table would need relocation fixups otherwise.
The relocation problems will be fixed one way or another. We must find a solution for this problem, so please go on...
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If all the Chinese simultaneously jumped into the Pacific off a 10 foot platform erected 10 feet off their coast, it would cause a tidal wave that would destroy everything in this country west of Nebraska.
PATCH v4 1/2 MTD/SPI: introduce table driven probing
In reply to Reinhard MeyerQuoted 3 lines · On Tuesday, September 14, 2010 10:50:08 Reinhard Meyer wrote:
for JEDEC devices without and with extension bytes for non JEDEC devices
Signed-off-by Reinhard Meyer <[email protected]>
needs to be a blank line before s-o-b tags and friends
Quoted 1 line
- * Licensed under the GPL-2 or later.
this is unnecessary noise. drop this hunk.
drivers/mtd/spi/spi_flash.c struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, · line 200
Quoted 8 lines
drivers/mtd/spi/spi_flash.c +8
-0+/* +* 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++) + ;
is the offset of 3 necessary ? seems a little fragile ...
-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/20100914/26e6e7d5/attachment.pgp
PATCH v4 1/2 MTD/SPI: introduce table driven probing
Quoted 10 lines · Mike Frysinger
Quoted 3 lines · On Tuesday, September 14, 2010 10:50:08 Reinhard Meyer wrote:
for JEDEC devices without and with extension bytes for non JEDEC devices
Signed-off-by Reinhard Meyer<[email protected]>needs to be a blank line before s-o-b tags and friends
Quoted 1 line
- * Licensed under the GPL-2 or later.
this is unnecessary noise. drop this hunk.
Drop what? The removal?
Quoted 11 lines
drivers/mtd/spi/spi_flash.c struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, · line 200
Quoted 9 lines
drivers/mtd/spi/spi_flash.c +8
-0+/* +* 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++) + ;is the offset of 3 necessary ? seems a little fragile ...
Any JEDEC device seems to have at least 3 bytes of ID. Unless we start passing the length of the remainder of idbuf we need to make sure the probe function can safely access 3 bytes.
Reinhard
PATCH v4 1/2 MTD/SPI: introduce table driven probing
Quoted 6 lines · On Tuesday, September 14, 2010 14:29:30 Reinhard Meyer wrote:
Quoted 5 lines · Mike Frysinger
Quoted 3 lines · On Tuesday, September 14, 2010 10:50:08 Reinhard Meyer wrote:
for JEDEC devices without and with extension bytes for non JEDEC devices
Signed-off-by Reinhard Meyer<[email protected]>
Quoted 7 lines
Quoted 5 lines
needs to be a blank line before s-o-b tags and friends
Quoted 1 line
- * Licensed under the GPL-2 or later.
this is unnecessary noise. drop this hunk.
Drop what? The removal?
the whole license change. leave it the way it is.
Quoted 11 lines
Quoted 10 lines
drivers/mtd/spi/spi_flash.c struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, · line 200
Quoted 8 lines
drivers/mtd/spi/spi_flash.c +8
-0+/* +* 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++) + ;is the offset of 3 necessary ? seems a little fragile ...
Quoted 3 lines
Any JEDEC device seems to have at least 3 bytes of ID. Unless we start passing the length of the remainder of idbuf we need to make sure the probe function can safely access 3 bytes.
considering we've pre-screened the length and known devices, i dont think this will be a problem. i guess just extend the comment above it a little explaining the 3 byte logic.
-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/20100914/a322bd96/attachment.pgp