* [PATCH] cfi_cmdset_0001.c: CFI 1.0 and CFI 1.1
@ 2009-05-16 11:34 Daniel Ribeiro
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Ribeiro @ 2009-05-16 11:34 UTC (permalink / raw)
To: David Woodhouse; +Cc: openezx-devel, linux-mtd
This patch allows otpinfo for CFI >= 1.0 and burst read for CFI >= 1.1.
references:
1.0: http://www.datasheetcatalog.org/datasheets2/81/816884_1.pdf
1.1: http://milkymist.org/doc/MT28F640J3.pdf
http://www.delorie.com/agenda/specs/29066709.pdf
Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
---
drivers/mtd/chips/cfi_cmdset_0001.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index c240454..bf07d14 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -319,6 +319,7 @@ static inline struct cfi_pri_intelext *
read_pri_intelext(struct map_info *map, __u16 adr)
{
struct cfi_pri_intelext *extp;
+ unsigned int extra_size = 0;
unsigned int extp_size = sizeof(*extp);
again:
@@ -340,19 +341,24 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extp->BlkStatusRegMask = le16_to_cpu(extp->BlkStatusRegMask);
extp->ProtRegAddr = le16_to_cpu(extp->ProtRegAddr);
- if (extp->MajorVersion == '1' && extp->MinorVersion >= '3') {
- unsigned int extra_size = 0;
- int nb_parts, i;
+ if (extp->MinorVersion >= '0') {
+ extra_size = 0;
/* Protection Register info */
extra_size += (extp->NumProtectionFields - 1) *
sizeof(struct cfi_intelext_otpinfo);
+ }
+ if (extp->MinorVersion >= '1') {
/* Burst Read info */
extra_size += 2;
if (extp_size < sizeof(*extp) + extra_size)
goto need_more;
- extra_size += extp->extra[extra_size-1];
+ extra_size += extp->extra[extra_size - 1];
+ }
+
+ if (extp->MinorVersion >= '3') {
+ int nb_parts, i;
/* Number of hardware-partitions */
extra_size += 1;
--
tg: (1406de8..) mtd/cfi1.1-has-extra-too (depends on: master)
--
Daniel Ribeiro
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] cfi_cmdset_0001.c: CFI 1.0 and CFI 1.1
@ 2009-05-17 11:02 Daniel Ribeiro
2009-05-18 23:28 ` Nicolas Pitre
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Ribeiro @ 2009-05-17 11:02 UTC (permalink / raw)
To: David Woodhouse; +Cc: Nicolas Pitre, openezx-devel, linux-mtd
This patch allows otpinfo for CFI >= 1.0 and burst read for CFI >= 1.1.
(sent again with CC to Nicolas Pitre)
references:
1.0: http://www.datasheetcatalog.org/datasheets2/81/816884_1.pdf
1.1: http://milkymist.org/doc/MT28F640J3.pdf
http://www.delorie.com/agenda/specs/29066709.pdf
Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
---
drivers/mtd/chips/cfi_cmdset_0001.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index c240454..bf07d14 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -319,6 +319,7 @@ static inline struct cfi_pri_intelext *
read_pri_intelext(struct map_info *map, __u16 adr)
{
struct cfi_pri_intelext *extp;
+ unsigned int extra_size = 0;
unsigned int extp_size = sizeof(*extp);
again:
@@ -340,19 +341,24 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extp->BlkStatusRegMask = le16_to_cpu(extp->BlkStatusRegMask);
extp->ProtRegAddr = le16_to_cpu(extp->ProtRegAddr);
- if (extp->MajorVersion == '1' && extp->MinorVersion >= '3') {
- unsigned int extra_size = 0;
- int nb_parts, i;
+ if (extp->MinorVersion >= '0') {
+ extra_size = 0;
/* Protection Register info */
extra_size += (extp->NumProtectionFields - 1) *
sizeof(struct cfi_intelext_otpinfo);
+ }
+ if (extp->MinorVersion >= '1') {
/* Burst Read info */
extra_size += 2;
if (extp_size < sizeof(*extp) + extra_size)
goto need_more;
- extra_size += extp->extra[extra_size-1];
+ extra_size += extp->extra[extra_size - 1];
+ }
+
+ if (extp->MinorVersion >= '3') {
+ int nb_parts, i;
/* Number of hardware-partitions */
extra_size += 1;
--
tg: (1406de8..) mtd/cfi1.1-has-extra-too (depends on: master)
--
Daniel Ribeiro
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cfi_cmdset_0001.c: CFI 1.0 and CFI 1.1
2009-05-17 11:02 Daniel Ribeiro
@ 2009-05-18 23:28 ` Nicolas Pitre
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Pitre @ 2009-05-18 23:28 UTC (permalink / raw)
To: Daniel Ribeiro; +Cc: linux-mtd, openezx-devel, David Woodhouse
On Sun, 17 May 2009, Daniel Ribeiro wrote:
> This patch allows otpinfo for CFI >= 1.0 and burst read for CFI >= 1.1.
> (sent again with CC to Nicolas Pitre)
>
> references:
> 1.0: http://www.datasheetcatalog.org/datasheets2/81/816884_1.pdf
>
> 1.1: http://milkymist.org/doc/MT28F640J3.pdf
> http://www.delorie.com/agenda/specs/29066709.pdf
>
> Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
Acked-by: Nicolas Pitre <nico@cam.org>
> ---
> drivers/mtd/chips/cfi_cmdset_0001.c | 14 ++++++++++----
> 1 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
> index c240454..bf07d14 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0001.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0001.c
> @@ -319,6 +319,7 @@ static inline struct cfi_pri_intelext *
> read_pri_intelext(struct map_info *map, __u16 adr)
> {
> struct cfi_pri_intelext *extp;
> + unsigned int extra_size = 0;
> unsigned int extp_size = sizeof(*extp);
>
> again:
> @@ -340,19 +341,24 @@ read_pri_intelext(struct map_info *map, __u16 adr)
> extp->BlkStatusRegMask = le16_to_cpu(extp->BlkStatusRegMask);
> extp->ProtRegAddr = le16_to_cpu(extp->ProtRegAddr);
>
> - if (extp->MajorVersion == '1' && extp->MinorVersion >= '3') {
> - unsigned int extra_size = 0;
> - int nb_parts, i;
> + if (extp->MinorVersion >= '0') {
> + extra_size = 0;
>
> /* Protection Register info */
> extra_size += (extp->NumProtectionFields - 1) *
> sizeof(struct cfi_intelext_otpinfo);
> + }
>
> + if (extp->MinorVersion >= '1') {
> /* Burst Read info */
> extra_size += 2;
> if (extp_size < sizeof(*extp) + extra_size)
> goto need_more;
> - extra_size += extp->extra[extra_size-1];
> + extra_size += extp->extra[extra_size - 1];
> + }
> +
> + if (extp->MinorVersion >= '3') {
> + int nb_parts, i;
>
> /* Number of hardware-partitions */
> extra_size += 1;
> --
> tg: (1406de8..) mtd/cfi1.1-has-extra-too (depends on: master)
>
> --
> Daniel Ribeiro
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-18 23:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-16 11:34 [PATCH] cfi_cmdset_0001.c: CFI 1.0 and CFI 1.1 Daniel Ribeiro
-- strict thread matches above, loose matches on Subject: below --
2009-05-17 11:02 Daniel Ribeiro
2009-05-18 23:28 ` Nicolas Pitre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).