diff mbox

[v4,11/11] block: m25p80: at25128a/at25256a models

Message ID 1456128205-5092-12-git-send-email-marcin.krzeminski@nokia.com (mailing list archive)
State New, archived
Headers show

Commit Message

marcin.krzeminski@nokia.com Feb. 22, 2016, 8:03 a.m. UTC
From: Marcin Krzeminski <marcin.krzeminski@nokia.com>

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

Comments

Peter Crosthwaite March 17, 2016, 5:39 p.m. UTC | #1
On Mon, Feb 22, 2016 at 12:03 AM,  <marcin.krzeminski@nokia.com> wrote:
> From: Marcin Krzeminski <marcin.krzeminski@nokia.com>
>
> Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>
> ---
>  hw/block/m25p80.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 2b7d19f..987fe07 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -99,6 +99,12 @@ static const FlashPartInfo known_devices[] = {
>
>      { INFO("at45db081d",  0x1f2500,      0,  64 << 10,  16, ER_4K) },
>
> +    /* Atmel EEPROMS - it is assumed, that don't care bit in command
> +     * is set to 0. Block protection is not supported.
> +     */
> +    { INFO("at25128a-nonjedec", 0x0,     0,         1, 131072, WR_1) },
> +    { INFO("at25256a-nonjedec", 0x0,     0,         1, 262144, WR_1) },
> +
>      /* EON -- en25xxx */
>      { INFO("en25f32",     0x1c3116,      0,  64 << 10,  64, ER_4K) },
>      { INFO("en25p32",     0x1c2016,      0,  64 << 10,  64, 0) },
> @@ -438,6 +444,11 @@ void flash_write8(Flash *s, uint64_t addr, uint8_t data)
>
>  static inline int get_addr_length(Flash *s)
>  {
> +   /* check if eeprom is in use */
> +    if (s->pi->flags == WR_1) {
> +        return 2;
> +    }
> +

Neat!

But I think this indicates the flag is incorrectly named. Should be
renamed to EEPROM or something like.

Otherwise:

Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>

>     switch (s->cmd_in_progress) {
>     case PP4:
>     case READ4:
> --
> 2.5.0
>
marcin.krzeminski@nokia.com March 17, 2016, 9:51 p.m. UTC | #2
W dniu 17.03.2016 o 18:39, Peter Crosthwaite pisze:
> On Mon, Feb 22, 2016 at 12:03 AM,  <marcin.krzeminski@nokia.com> wrote:
>> From: Marcin Krzeminski <marcin.krzeminski@nokia.com>
>>
>> Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>
>> ---
>>  hw/block/m25p80.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
>> index 2b7d19f..987fe07 100644
>> --- a/hw/block/m25p80.c
>> +++ b/hw/block/m25p80.c
>> @@ -99,6 +99,12 @@ static const FlashPartInfo known_devices[] = {
>>
>>      { INFO("at45db081d",  0x1f2500,      0,  64 << 10,  16, ER_4K) },
>>
>> +    /* Atmel EEPROMS - it is assumed, that don't care bit in command
>> +     * is set to 0. Block protection is not supported.
>> +     */
>> +    { INFO("at25128a-nonjedec", 0x0,     0,         1, 131072, WR_1) },
>> +    { INFO("at25256a-nonjedec", 0x0,     0,         1, 262144, WR_1) },
>> +
>>      /* EON -- en25xxx */
>>      { INFO("en25f32",     0x1c3116,      0,  64 << 10,  64, ER_4K) },
>>      { INFO("en25p32",     0x1c2016,      0,  64 << 10,  64, 0) },
>> @@ -438,6 +444,11 @@ void flash_write8(Flash *s, uint64_t addr, uint8_t data)
>>
>>  static inline int get_addr_length(Flash *s)
>>  {
>> +   /* check if eeprom is in use */
>> +    if (s->pi->flags == WR_1) {
>> +        return 2;
>> +    }
>> +
>
> Neat!
>
> But I think this indicates the flag is incorrectly named. Should be
> renamed to EEPROM or something like.
Yes, EEPROM sound much better. Will be changed in v5.

Thanks,
Marcin
>
>
> Otherwise:
>
> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
>
>>     switch (s->cmd_in_progress) {
>>     case PP4:
>>     case READ4:
>> --
>> 2.5.0
>>
>
>
diff mbox

Patch

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 2b7d19f..987fe07 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -99,6 +99,12 @@  static const FlashPartInfo known_devices[] = {
 
     { INFO("at45db081d",  0x1f2500,      0,  64 << 10,  16, ER_4K) },
 
+    /* Atmel EEPROMS - it is assumed, that don't care bit in command
+     * is set to 0. Block protection is not supported.
+     */
+    { INFO("at25128a-nonjedec", 0x0,     0,         1, 131072, WR_1) },
+    { INFO("at25256a-nonjedec", 0x0,     0,         1, 262144, WR_1) },
+
     /* EON -- en25xxx */
     { INFO("en25f32",     0x1c3116,      0,  64 << 10,  64, ER_4K) },
     { INFO("en25p32",     0x1c2016,      0,  64 << 10,  64, 0) },
@@ -438,6 +444,11 @@  void flash_write8(Flash *s, uint64_t addr, uint8_t data)
 
 static inline int get_addr_length(Flash *s)
 {
+   /* check if eeprom is in use */
+    if (s->pi->flags == WR_1) {
+        return 2;
+    }
+
    switch (s->cmd_in_progress) {
    case PP4:
    case READ4: