diff mbox

[3/9] m25p80: Allow more than four banks.

Message ID 1465998071-7355-4-git-send-email-marcin.krzeminski@nokia.com (mailing list archive)
State New, archived
Headers show

Commit Message

marcin.krzeminski@nokia.com June 15, 2016, 1:41 p.m. UTC
From: Marcin Krzeminski <marcin.krzeminski@nokia.com>

Allow to have more than four 16MiB regions for bigger flash devices.

Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>
---
 hw/block/m25p80.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Cédric Le Goater June 16, 2016, 7:09 a.m. UTC | #1
On 06/15/2016 03:41 PM, marcin.krzeminski@nokia.com wrote:
> From: Marcin Krzeminski <marcin.krzeminski@nokia.com>
> 
> Allow to have more than four 16MiB regions for bigger flash devices.
> 
> Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

> ---
>  hw/block/m25p80.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 342f7c9..6910c52 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -129,7 +129,6 @@ typedef struct FlashPartInfo {
>  #define EVCFG_QUAD_IO_ENABLED (1 << 7)
>  #define NVCFG_4BYTE_ADDR_MASK (1 << 0)
>  #define NVCFG_LOWER_SEGMENT_MASK (1 << 1)
> -#define CFG_UPPER_128MB_SEG_ENABLED 0x3
> 
>  /* Numonyx (Micron) Flag Status Register macros */
>  #define FSR_4BYTE_ADDR_MODE_ENABLED 0x1
> @@ -545,7 +544,7 @@ static void complete_collecting_data(Flash *s)
>      }
> 
>      if (get_addr_length(s) == 3) {
> -        s->cur_addr += (s->ear & 0x3) * MAX_3BYTES_SIZE;
> +        s->cur_addr += s->ear * MAX_3BYTES_SIZE;
>      }
> 
>      s->state = STATE_IDLE;
> @@ -644,7 +643,7 @@ static void reset_memory(Flash *s)
>              s->four_bytes_address_mode = true;
>          }
>          if (!(s->nonvolatile_cfg & NVCFG_LOWER_SEGMENT_MASK)) {
> -            s->ear = CFG_UPPER_128MB_SEG_ENABLED;
> +            s->ear = s->size / MAX_3BYTES_SIZE - 1;
>          }
>          break;
>      default:
>
diff mbox

Patch

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 342f7c9..6910c52 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -129,7 +129,6 @@  typedef struct FlashPartInfo {
 #define EVCFG_QUAD_IO_ENABLED (1 << 7)
 #define NVCFG_4BYTE_ADDR_MASK (1 << 0)
 #define NVCFG_LOWER_SEGMENT_MASK (1 << 1)
-#define CFG_UPPER_128MB_SEG_ENABLED 0x3
 
 /* Numonyx (Micron) Flag Status Register macros */
 #define FSR_4BYTE_ADDR_MODE_ENABLED 0x1
@@ -545,7 +544,7 @@  static void complete_collecting_data(Flash *s)
     }
 
     if (get_addr_length(s) == 3) {
-        s->cur_addr += (s->ear & 0x3) * MAX_3BYTES_SIZE;
+        s->cur_addr += s->ear * MAX_3BYTES_SIZE;
     }
 
     s->state = STATE_IDLE;
@@ -644,7 +643,7 @@  static void reset_memory(Flash *s)
             s->four_bytes_address_mode = true;
         }
         if (!(s->nonvolatile_cfg & NVCFG_LOWER_SEGMENT_MASK)) {
-            s->ear = CFG_UPPER_128MB_SEG_ENABLED;
+            s->ear = s->size / MAX_3BYTES_SIZE - 1;
         }
         break;
     default: