* [PATCH] cfi_flash_intel: support 1024b buffer write
@ 2010-07-30 9:49 Eric Bénard
2010-08-04 7:42 ` Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: Eric Bénard @ 2010-07-30 9:49 UTC (permalink / raw)
To: s.hauer; +Cc: barebox
newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible
to write a buffer size of 0x200 which the actual flash_write_cmd
doesn't permit as it's limited to a uchar parameter.
Signed-off-by: Eric Bénard <eric@eukrea.com>
---
drivers/nor/cfi_flash.c | 11 +++++++++++
drivers/nor/cfi_flash.h | 1 +
drivers/nor/cfi_flash_intel.c | 5 ++++-
3 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index fa5e5ee..6f45da6 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -886,6 +886,17 @@ void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, u
flash_write_word(info, cword, addr);
}
+void flash_write_cmd16 (struct flash_info *info, flash_sect_t sect, uint offset, ushort cmd)
+{
+
+ uchar *addr;
+ cfiword_t cword;
+
+ addr = flash_make_addr (info, sect, offset);
+ cword.w = cmd;
+ flash_write_word(info, cword, addr);
+}
+
int flash_isequal (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd)
{
cfiptr_t cptr;
diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
index 057e56c..d7e6ea2 100644
--- a/drivers/nor/cfi_flash.h
+++ b/drivers/nor/cfi_flash.h
@@ -189,6 +189,7 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;
int flash_isset (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
+void flash_write_cmd16 (struct flash_info * info, flash_sect_t sect, uint offset, ushort cmd);
flash_sect_t find_sector (struct flash_info *info, ulong addr);
int flash_status_check (struct flash_info *info, flash_sect_t sector,
uint64_t tout, char *prompt);
diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
index 4344760..96bf33f 100644
--- a/drivers/nor/cfi_flash_intel.c
+++ b/drivers/nor/cfi_flash_intel.c
@@ -71,7 +71,10 @@ static int intel_flash_write_cfibuffer (struct flash_info *info, ulong dest, con
/* reduce the number of loops by the width of the port */
cnt = len >> (info->portwidth - 1);
- flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
+ if (cnt >= 0x100)
+ flash_write_cmd16 (info, sector, 0, (ushort) cnt - 1);
+ else
+ flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
while (cnt-- > 0) {
if (bankwidth_is_1(info)) {
*dst.cp++ = *src.cp++;
--
1.6.3.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cfi_flash_intel: support 1024b buffer write
2010-07-30 9:49 [PATCH] cfi_flash_intel: support 1024b buffer write Eric Bénard
@ 2010-08-04 7:42 ` Sascha Hauer
2010-08-04 7:48 ` Eric Bénard
0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2010-08-04 7:42 UTC (permalink / raw)
To: Eric Bénard; +Cc: barebox
On Fri, Jul 30, 2010 at 11:49:55AM +0200, Eric Bénard wrote:
> newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible
> to write a buffer size of 0x200 which the actual flash_write_cmd
> doesn't permit as it's limited to a uchar parameter.
So I guess these chips have 16 data lines?
Unfortunately this won't work when two of these are parallel. You'd have
to duplicate the command for the upper 16 bit.
Sascha
>
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
> drivers/nor/cfi_flash.c | 11 +++++++++++
> drivers/nor/cfi_flash.h | 1 +
> drivers/nor/cfi_flash_intel.c | 5 ++++-
> 3 files changed, 16 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
> index fa5e5ee..6f45da6 100644
> --- a/drivers/nor/cfi_flash.c
> +++ b/drivers/nor/cfi_flash.c
> @@ -886,6 +886,17 @@ void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, u
> flash_write_word(info, cword, addr);
> }
>
> +void flash_write_cmd16 (struct flash_info *info, flash_sect_t sect, uint offset, ushort cmd)
> +{
> +
> + uchar *addr;
> + cfiword_t cword;
> +
> + addr = flash_make_addr (info, sect, offset);
> + cword.w = cmd;
> + flash_write_word(info, cword, addr);
> +}
> +
> int flash_isequal (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd)
> {
> cfiptr_t cptr;
> diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
> index 057e56c..d7e6ea2 100644
> --- a/drivers/nor/cfi_flash.h
> +++ b/drivers/nor/cfi_flash.h
> @@ -189,6 +189,7 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;
>
> int flash_isset (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
> void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
> +void flash_write_cmd16 (struct flash_info * info, flash_sect_t sect, uint offset, ushort cmd);
> flash_sect_t find_sector (struct flash_info *info, ulong addr);
> int flash_status_check (struct flash_info *info, flash_sect_t sector,
> uint64_t tout, char *prompt);
> diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
> index 4344760..96bf33f 100644
> --- a/drivers/nor/cfi_flash_intel.c
> +++ b/drivers/nor/cfi_flash_intel.c
> @@ -71,7 +71,10 @@ static int intel_flash_write_cfibuffer (struct flash_info *info, ulong dest, con
> /* reduce the number of loops by the width of the port */
> cnt = len >> (info->portwidth - 1);
>
> - flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
> + if (cnt >= 0x100)
> + flash_write_cmd16 (info, sector, 0, (ushort) cnt - 1);
> + else
> + flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
> while (cnt-- > 0) {
> if (bankwidth_is_1(info)) {
> *dst.cp++ = *src.cp++;
> --
> 1.6.3.3
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cfi_flash_intel: support 1024b buffer write
2010-08-04 7:42 ` Sascha Hauer
@ 2010-08-04 7:48 ` Eric Bénard
2010-08-04 8:00 ` Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: Eric Bénard @ 2010-08-04 7:48 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
Le 04/08/2010 09:42, Sascha Hauer a écrit :
> On Fri, Jul 30, 2010 at 11:49:55AM +0200, Eric Bénard wrote:
>> newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible
>> to write a buffer size of 0x200 which the actual flash_write_cmd
>> doesn't permit as it's limited to a uchar parameter.
>
> So I guess these chips have 16 data lines?
>
actual flash_write_cmd is also used on chips with 16 data lines (like
P30 or P33 Numonyx).
>
>Unfortunately this won't work when two of these are parallel. You'd have
> to duplicate the command for the upper 16 bit.
>
Does actual flash_write_cmd works when 2 chips are parallel ?
Eric
> Sascha
>
>>
>> Signed-off-by: Eric Bénard<eric@eukrea.com>
>> ---
>> drivers/nor/cfi_flash.c | 11 +++++++++++
>> drivers/nor/cfi_flash.h | 1 +
>> drivers/nor/cfi_flash_intel.c | 5 ++++-
>> 3 files changed, 16 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
>> index fa5e5ee..6f45da6 100644
>> --- a/drivers/nor/cfi_flash.c
>> +++ b/drivers/nor/cfi_flash.c
>> @@ -886,6 +886,17 @@ void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, u
>> flash_write_word(info, cword, addr);
>> }
>>
>> +void flash_write_cmd16 (struct flash_info *info, flash_sect_t sect, uint offset, ushort cmd)
>> +{
>> +
>> + uchar *addr;
>> + cfiword_t cword;
>> +
>> + addr = flash_make_addr (info, sect, offset);
>> + cword.w = cmd;
>> + flash_write_word(info, cword, addr);
>> +}
>> +
>> int flash_isequal (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd)
>> {
>> cfiptr_t cptr;
>> diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
>> index 057e56c..d7e6ea2 100644
>> --- a/drivers/nor/cfi_flash.h
>> +++ b/drivers/nor/cfi_flash.h
>> @@ -189,6 +189,7 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;
>>
>> int flash_isset (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
>> void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
>> +void flash_write_cmd16 (struct flash_info * info, flash_sect_t sect, uint offset, ushort cmd);
>> flash_sect_t find_sector (struct flash_info *info, ulong addr);
>> int flash_status_check (struct flash_info *info, flash_sect_t sector,
>> uint64_t tout, char *prompt);
>> diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
>> index 4344760..96bf33f 100644
>> --- a/drivers/nor/cfi_flash_intel.c
>> +++ b/drivers/nor/cfi_flash_intel.c
>> @@ -71,7 +71,10 @@ static int intel_flash_write_cfibuffer (struct flash_info *info, ulong dest, con
>> /* reduce the number of loops by the width of the port */
>> cnt = len>> (info->portwidth - 1);
>>
>> - flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
>> + if (cnt>= 0x100)
>> + flash_write_cmd16 (info, sector, 0, (ushort) cnt - 1);
>> + else
>> + flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
>> while (cnt--> 0) {
>> if (bankwidth_is_1(info)) {
>> *dst.cp++ = *src.cp++;
>> --
>> 1.6.3.3
>>
>>
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cfi_flash_intel: support 1024b buffer write
2010-08-04 7:48 ` Eric Bénard
@ 2010-08-04 8:00 ` Sascha Hauer
0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2010-08-04 8:00 UTC (permalink / raw)
To: Eric Bénard; +Cc: barebox
On Wed, Aug 04, 2010 at 09:48:48AM +0200, Eric Bénard wrote:
> Hi Sascha,
>
> Le 04/08/2010 09:42, Sascha Hauer a écrit :
>> On Fri, Jul 30, 2010 at 11:49:55AM +0200, Eric Bénard wrote:
>>> newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible
>>> to write a buffer size of 0x200 which the actual flash_write_cmd
>>> doesn't permit as it's limited to a uchar parameter.
>>
>> So I guess these chips have 16 data lines?
>>
> actual flash_write_cmd is also used on chips with 16 data lines (like
> P30 or P33 Numonyx).
Yes. I meant that 8 wouldn't be enough because the command gets
wider than 8bit.
>
>>
> >Unfortunately this won't work when two of these are parallel. You'd have
>> to duplicate the command for the upper 16 bit.
>>
> Does actual flash_write_cmd works when 2 chips are parallel ?
At least it's supposed to ;)
See flash_make_cmd, it iterates over all bytes in info->portwidth and
writes cmd or 0 into the buffer depending on info->chipwidth.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] cfi_flash_intel: support 1024b buffer write
@ 2010-05-17 16:14 Eric Bénard
2010-05-17 16:19 ` Eric Bénard
0 siblings, 1 reply; 6+ messages in thread
From: Eric Bénard @ 2010-05-17 16:14 UTC (permalink / raw)
To: barebox
newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible
to write a buffer size of 0x200 which the actual flash_write_cmd
doesn't permit as it's limited to a uchar parameter.
Signed-off-by: Eric Bénard <eric@eukrea.com>
---
drivers/nor/cfi_flash.c | 11 +++++++++++
drivers/nor/cfi_flash.h | 1 +
drivers/nor/cfi_flash_intel.c | 5 ++++-
3 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index dbfb004..b17d1a0 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -863,6 +863,17 @@ void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset, uchar
flash_write_word(info, cword, addr);
}
+void flash_write_cmd16 (flash_info_t * info, flash_sect_t sect, uint offset, ushort cmd)
+{
+
+ uchar *addr;
+ cfiword_t cword;
+
+ addr = flash_make_addr (info, sect, offset);
+ cword.w = cmd;
+ flash_write_word(info, cword, addr);
+}
+
int flash_isequal (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd)
{
cfiptr_t cptr;
diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
index a8fa879..23a4792 100644
--- a/drivers/nor/cfi_flash.h
+++ b/drivers/nor/cfi_flash.h
@@ -182,6 +182,7 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;
int flash_isset (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd);
void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd);
+void flash_write_cmd16 (flash_info_t * info, flash_sect_t sect, uint offset, ushort cmd);
flash_sect_t find_sector (flash_info_t * info, ulong addr);
int flash_status_check (flash_info_t * info, flash_sect_t sector,
uint64_t tout, char *prompt);
diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
index e4dfdfa..5b804db 100644
--- a/drivers/nor/cfi_flash_intel.c
+++ b/drivers/nor/cfi_flash_intel.c
@@ -71,7 +71,10 @@ static int intel_flash_write_cfibuffer (flash_info_t * info, ulong dest, const u
/* reduce the number of loops by the width of the port */
cnt = len >> (info->portwidth - 1);
- flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
+ if (cnt > 0x100)
+ flash_write_cmd16 (info, sector, 0, (ushort) cnt - 1);
+ else
+ flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
while (cnt-- > 0) {
if (bankwidth_is_1(info)) {
*dst.cp++ = *src.cp++;
--
1.6.3.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cfi_flash_intel: support 1024b buffer write
2010-05-17 16:14 Eric Bénard
@ 2010-05-17 16:19 ` Eric Bénard
0 siblings, 0 replies; 6+ messages in thread
From: Eric Bénard @ 2010-05-17 16:19 UTC (permalink / raw)
To: barebox
Le 17/05/2010 18:14, Eric Bénard a écrit :
> newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible
> to write a buffer size of 0x200 which the actual flash_write_cmd
> doesn't permit as it's limited to a uchar parameter.
>
note : there is certainly a better way to fix this problem but I think
this would need much more work in cfi_flash and may break other
platforms, so I sent this patch which may help peoples using recent
flashs but I'm quite sure it won't be pushed ;-)
Eric
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-08-04 8:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-30 9:49 [PATCH] cfi_flash_intel: support 1024b buffer write Eric Bénard
2010-08-04 7:42 ` Sascha Hauer
2010-08-04 7:48 ` Eric Bénard
2010-08-04 8:00 ` Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2010-05-17 16:14 Eric Bénard
2010-05-17 16:19 ` Eric Bénard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox