* [PATCH] MTD: fix endian issue of additional protection fields
@ 2006-06-12 15:34 Christian Hohnstaedt
2006-06-12 17:01 ` Nicolas Pitre
0 siblings, 1 reply; 5+ messages in thread
From: Christian Hohnstaedt @ 2006-06-12 15:34 UTC (permalink / raw)
To: linux-mtd
add byte-swapping for extended OTP areas (NumProtectionFields > 1)
Signed-off-by: Christian Hohnstaedt <chohnstaedt@innominate.com>
---
| 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
0bdeefafb76db54cdb12a10e8fcc5c197221c276
--git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 0d43581..3227d1e 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -279,11 +279,24 @@ read_pri_intelext(struct map_info *map,
if (extp->MajorVersion == '1' && extp->MinorVersion >= '3') {
unsigned int extra_size = 0;
int nb_parts, i;
+ struct cfi_intelext_otpinfo *otp;
/* Protection Register info */
extra_size += (extp->NumProtectionFields - 1) *
sizeof(struct cfi_intelext_otpinfo);
+ if (extp_size < sizeof(*extp) + extra_size)
+ goto need_more;
+
+ /* Byteswapping for additional ProtectionFields */
+ otp = (struct cfi_intelext_otpinfo*)(extp->extra);
+ for (i=1; i<extp->NumProtectionFields; i++) {
+ otp->ProtRegAddr = le32_to_cpu(otp->ProtRegAddr);
+ otp->FactGroups = le16_to_cpu(otp->FactGroups);
+ otp->UserGroups = le16_to_cpu(otp->UserGroups);
+ otp++;
+ }
+
/* Burst Read info */
extra_size += 2;
if (extp_size < sizeof(*extp) + extra_size)
--
Christian Hohnstaedt
Software Engineer
Innominate Security Technologies AG /device attached security/
tel: +49.30.6392-3285
fax: +49.30.6392-3307
Albert-Einstein-Str. 14
D-12489 Berlin, Germany
http://www.innominate.com
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] MTD: fix endian issue of additional protection fields
2006-06-12 15:34 [PATCH] MTD: fix endian issue of additional protection fields Christian Hohnstaedt
@ 2006-06-12 17:01 ` Nicolas Pitre
2006-06-12 22:07 ` Does anyone have patches for Sibley on the 2.4 kernel? Justin Treon
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Pitre @ 2006-06-12 17:01 UTC (permalink / raw)
To: Christian Hohnstaedt; +Cc: linux-mtd
On Mon, 12 Jun 2006, Christian Hohnstaedt wrote:
> add byte-swapping for extended OTP areas (NumProtectionFields > 1)
>
> Signed-off-by: Christian Hohnstaedt <chohnstaedt@innominate.com>
Signed-off-by: Nicolas Pitre <nico@cam.org>
>
> ---
>
> drivers/mtd/chips/cfi_cmdset_0001.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
> 0bdeefafb76db54cdb12a10e8fcc5c197221c276
> diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
> index 0d43581..3227d1e 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0001.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0001.c
> @@ -279,11 +279,24 @@ read_pri_intelext(struct map_info *map,
> if (extp->MajorVersion == '1' && extp->MinorVersion >= '3') {
> unsigned int extra_size = 0;
> int nb_parts, i;
> + struct cfi_intelext_otpinfo *otp;
>
> /* Protection Register info */
> extra_size += (extp->NumProtectionFields - 1) *
> sizeof(struct cfi_intelext_otpinfo);
>
> + if (extp_size < sizeof(*extp) + extra_size)
> + goto need_more;
> +
> + /* Byteswapping for additional ProtectionFields */
> + otp = (struct cfi_intelext_otpinfo*)(extp->extra);
> + for (i=1; i<extp->NumProtectionFields; i++) {
> + otp->ProtRegAddr = le32_to_cpu(otp->ProtRegAddr);
> + otp->FactGroups = le16_to_cpu(otp->FactGroups);
> + otp->UserGroups = le16_to_cpu(otp->UserGroups);
> + otp++;
> + }
> +
> /* Burst Read info */
> extra_size += 2;
> if (extp_size < sizeof(*extp) + extra_size)
> --
> Christian Hohnstaedt
> Software Engineer
>
> Innominate Security Technologies AG /device attached security/
> tel: +49.30.6392-3285
> fax: +49.30.6392-3307
> Albert-Einstein-Str. 14
> D-12489 Berlin, Germany
> http://www.innominate.com
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
Nicolas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Does anyone have patches for Sibley on the 2.4 kernel?
2006-06-12 17:01 ` Nicolas Pitre
@ 2006-06-12 22:07 ` Justin Treon
2006-06-12 22:49 ` David Woodhouse
2006-06-13 0:55 ` Nicolas Pitre
0 siblings, 2 replies; 5+ messages in thread
From: Justin Treon @ 2006-06-12 22:07 UTC (permalink / raw)
To: linux-mtd
MTD,
Does anyone have patches for Intel M18 Flash (a.k.a.
Sibley) on the 2.4 kernel?
If no one has a patch, would it be easier to port MTD
back to the 2.4 kernel or to insert the changes for
Sibley into the old version of MTD?
Justin
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Does anyone have patches for Sibley on the 2.4 kernel?
2006-06-12 22:07 ` Does anyone have patches for Sibley on the 2.4 kernel? Justin Treon
@ 2006-06-12 22:49 ` David Woodhouse
2006-06-13 0:55 ` Nicolas Pitre
1 sibling, 0 replies; 5+ messages in thread
From: David Woodhouse @ 2006-06-12 22:49 UTC (permalink / raw)
To: Justin Treon; +Cc: linux-mtd
On Mon, 2006-06-12 at 15:07 -0700, Justin Treon wrote:
> If no one has a patch, would it be easier to port MTD
> back to the 2.4 kernel or to insert the changes for
> Sibley into the old version of MTD?
or (3), port your board support to the 2.6 kernel.
--
dwmw2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Does anyone have patches for Sibley on the 2.4 kernel?
2006-06-12 22:07 ` Does anyone have patches for Sibley on the 2.4 kernel? Justin Treon
2006-06-12 22:49 ` David Woodhouse
@ 2006-06-13 0:55 ` Nicolas Pitre
1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Pitre @ 2006-06-13 0:55 UTC (permalink / raw)
To: Justin Treon; +Cc: linux-mtd
On Mon, 12 Jun 2006, Justin Treon wrote:
> Does anyone have patches for Intel M18 Flash (a.k.a.
> Sibley) on the 2.4 kernel?
>
> If no one has a patch, would it be easier to port MTD
> back to the 2.4 kernel or to insert the changes for
> Sibley into the old version of MTD?
Sibley changes are rather scattered around the whole of
cfi-cmdset-0001.c as well as special handling in JFFS2.
so you'd need to backport current MTD code to your 2.4.kernel if you
want it to work reliably.
Your best bet is certainly to add support for your board to a 2.6 kernel
though.
Nicolas
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-06-13 0:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-12 15:34 [PATCH] MTD: fix endian issue of additional protection fields Christian Hohnstaedt
2006-06-12 17:01 ` Nicolas Pitre
2006-06-12 22:07 ` Does anyone have patches for Sibley on the 2.4 kernel? Justin Treon
2006-06-12 22:49 ` David Woodhouse
2006-06-13 0:55 ` Nicolas Pitre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox