S70GL02GS U-Boot and Linux Support

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DaWi_3430881
Level 3
Level 3
First like given

Hello memory experts,

   I have a custom system that uses two nor S70GL02GS12 devices in parallel to create a 32-bit data bus which is connected to an Intel FPGA running Linux on a NIOS processor. The system worked great when we were using Micron 2Gb flash devices, cfi command set 1, but those are end of life so we switched to the S70GL02GS, cfi commands set 2. It seems that the S70GL02 reports the whole device size instead of each die size. U-Boot would come up with "ERROR: too many flash sectors". After working though the code I added a fix to the end of the flash_fixup_amd function, qry->dev_size -= 1;. This fixed the U-Boot problem. Although when un-protecting the the flash it is really slow. The older flash was almost instantaneous.

U-Boot fix

static void flash_fixup_amd(flash_info_t *info, struct cfi_qry *qry)

{

    /* check if flash geometry needs reversal */

    if (qry->num_erase_regions > 1) {

        /* reverse geometry if top boot part */

        if (info->cfi_version < 0x3131) {

            /* CFI < 1.1, try to guess from device id */

            if ((info->device_id & 0x80) != 0)

                cfi_reverse_geometry(qry);

        } else if (flash_read_uchar(info, info->ext_addr + 0xf) == 3) {

            /* CFI >= 1.1, deduct from top/bottom flag */

            /* note: ext_addr is valid since cfi_version > 0 */

            cfi_reverse_geometry(qry);

        }

    }   

    qry->dev_size -= 1; /* added to change the way Spansion chip reports size. From 2^28 to 2^27. */

}

On to the Linux part:

I applied the most recent patch to the cfi_probe.c file and still have problems. The system boots up but cannot write to the flash.

Linux-boot output for flash device

Bad S70GL02GS CFI data; adjust to detect 2 chips

0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x004801

NOR chip too large to fit in mapping. Attempting to cope...

Amd/Fujitsu Extended Query Table at 0x0040

  Amd/Fujitsu Extended Query version 1.5.

number of CFI chips: 1

Reducing visibility of 262144KiB chip to 65536KiB

Bad S70GL02GS CFI data; adjust to detect 2 chips

0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x004801

NOR chip too large to fit in mapping. Attempting to cope...

Amd/Fujitsu Extended Query Table at 0x0040

  Amd/Fujitsu Extended Query version 1.5.

number of CFI chips: 1

Reducing visibility of 262144KiB chip to 65536KiB

Concatenating MTD devices:

(0): "0.flash"

(1): "0.flash"

into device "0.flash"

7 ofpart partitions found on MTD device 0.flash

Creating 7 MTD partitions on "0.flash":

0x000000000000-0x000000040000 : "U-Boot"

0x000000040000-0x000000080000 : "Device Tree"

0x000000080000-0x0000000c0000 : "Spare"

0x0000000c0000-0x000000100000 : "U-Boot Environment"

0x000000100000-0x000000400000 : "Kernel Image"

0x000000400000-0x000001000000 : "Root"

0x000001000000-0x000010000000 : "User"

mtd: partition "User" extends beyond the end of device "0.flash" -- size truncated to 0x7000000

Flash part of Linux DTS file

flash_extender: flash@0x0 {

    compatible = "cfi-flash";

    //reg = < 0x00000000 0x10000000 >;

    reg = < 0x00000000 0x04000000

            0x04000000 0x04000000>;

    bank-width = < 4 >;

    device-width = < 2 >;

    #address-cells = < 1 >;

    #size-cells = < 1 >;

    partition@0 {

        reg = < 0x00000000 0x00040000 >;

        label = "U-Boot";

    }; //end partition@0

    partition@40000 {

        reg = < 0x00040000 0x00040000 >;

        label = "Device Tree";

    }; //end partition@40000

    partition@80000 {

        reg = < 0x00080000 0x00040000 >;

        label = "Spare";

    }; //end partition@80000

    partition@c0000 {

        reg = < 0x000c0000 0x00040000 >;

        label = "U-Boot Environment";

    }; //end partition@c0000

    partition@100000 {

        reg = < 0x00100000 0x00300000 >;

        label = "Kernel Image";

    }; //end partition@100000

    partition@400000 {

        reg = < 0x00400000 0x00c00000 >;

        label = "Root";

    }; //end partition@400000

    partition@1000000 {

        reg = < 0x01000000 0x0F000000 >;

        label = "User";

    }; //end partition@1000000

}; //end flash@0x0

flash1: flash@0xd0000000 {

    compatible = "cfi-flash";

    //reg = < 0xD0000000 0x10000000 >;

    reg = < 0xD0000000 0x04000000

            0xD4000000 0x04000000>;

    bank-width = < 4 >;

    device-width = < 2 >;

    #address-cells = < 1 >;

    #size-cells = < 1 >;

   

    partition@0 {

            reg = < 0x00000000 0x07A00000 >;

            label = "Free";

    }; //end partition@0 122MB

    partition@7A00000 {

            reg = < 0x07A00000 0x00400000 >;

            label = "USER DATA";

    }; //end partition@7A00000 4MB

    partition@7E00000 {

            reg = < 0x07E00000 0x001C0000 >;

            label = "AUDIO Binary";

    }; //end partition@7D00000 1,792kB

    partition@7FC0000 {

        reg = < 0x07FC0000 0x00040000 >;

        label = "USB Binary";

    }; //end partition@8000000

   

    partition@8000000 {

        reg = < 0x08000000 0x04000000 >;

        label = "FPGA_IMAGE_1";

    }; //end partition@8000000

    partition@C000000 {

        reg = < 0x0C000000 0x04000000 >;

        label = "FPGA_IMAGE_2";

    }; //end partition@C000000

   

   

}; //end flash@0xd0000000

While Linux is booting there is a lot of the following type errors.

Freeing unused kernel memory: 92K (d0230000 - d0247000)

jffs2: Write of 44 bytes at 0x00951348 failed. returned -5, retlen 40

jffs2: Write of 44 bytes at 0x00951374 failed. returned -5, retlen 40

jffs2: Write of 44 bytes at 0x009513e4 failed. returned -5, retlen 40

jffs2: Write of 44 bytes at 0x00951410 failed. returned -5, retlen 40

jffs2: Write of 44 bytes at 0x00951480 failed. returned -5, retlen 40

jffs2: Write of 44 bytes at 0x009514ac failed. returned -5, retlen 40

jffs2: Node CRC 01080108 != calculated CRC 53a7c94d for node at 00118808

jffs2: Node CRC 01480148 != calculated CRC 9be635ab for node at 0011929c

jffs2: Node CRC 01080108 != calculated CRC 53a7c94d for node at 00119b54

jffs2: Node CRC 01480148 != calculated CRC 9be635ab for node at 0011a5c8

jffs2: Node CRC 01080108 != calculated CRC 53a7c94d for node at 0011b0a4

jffs2: Node CRC 01480148 != calculated CRC 9be635ab for node at 0011b964

jffs2: notice: (727) jffs2_get_inode_nodes: Node header CRC failed at 0x089cc8. {0108,0108,01480148,01080108}

jffs2: Node totlen on flash (0x01080108) != totlen from node ref (0x00000134)

jffs2: warning: (727) jffs2_do_read_inode_internal: no data nodes found for ino #141

If anyone can help it would be greatly appreciated.

Thanks in advance,

Dave

0 Likes
1 Solution

Bushra,

  I do not see any errors in the syslog/messages log file..

When I do the ls and du commands nothing is listed.

root@nios2: /root $ ls -l /usr/local

total 0

root@nios2: /root $ du -sk /usr/local

0      /usr/local

I cannot find and garbage or lost+found directories anywhere.

Something strange is happening. I am trying to mount /dev/mtd6 to /usr/local. When I run the mtdinfo on mtd5 I get the following. But when I do that on mtd6 Linux says it's not a character device.

root@nios2: /tmp $ mtdinfo /dev/mtd5 -M

mtd5

Name:                          Root

Type:                          nor

Eraseblock size:                262144 bytes, 256.0 KiB

Amount of eraseblocks:          48 (12582912 bytes, 12.0 MiB)

Minimum input/output unit size: 1 byte

Sub-page size:                  1 byte

Character device major/minor:  90:10

Bad blocks are allowed:        false

Device is writable:            true

Eraseblock map:

  0: 00000000          1: 00040000          2: 00080000          3: 000c0000

  4: 00100000          5: 00140000          6: 00180000          7: 001c0000

  8: 00200000          9: 00240000        10: 00280000        11: 002c0000

12: 00300000        13: 00340000        14: 00380000        15: 003c0000

16: 00400000        17: 00440000        18: 00480000        19: 004c0000

20: 00500000        21: 00540000        22: 00580000        23: 005c0000

24: 00600000        25: 00640000        26: 00680000        27: 006c0000

28: 00700000        29: 00740000        30: 00780000        31: 007c0000

32: 00800000        33: 00840000        34: 00880000        35: 008c0000

36: 00900000        37: 00940000        38: 00980000        39: 009c0000

40: 00a00000        41: 00a40000        42: 00a80000        43: 00ac0000

44: 00b00000        45: 00b40000        46: 00b80000        47: 00bc0000

root@nios2: /tmp $ mtdinfo /dev/mtd6 -M

libmtd: error!: "/dev/mtd6" is not a character device

mtdinfo: error!: cannot get information about MTD device "/dev/mtd6"

        error 22 (Invalid argument)

root@nios2: /tmp $

I am able to do a raw write to /dev/mtd6. I copied a file to it and was able to do a cat /dev/mtd6 and see the contents of the file.

Thanks,

Dave

View solution in original post

0 Likes
21 Replies
BushraH_91
Moderator
Moderator
Moderator
750 replies posted 50 likes received 250 solutions authored

Hello,

Thank you for contacting Cypress Community Forum. Currently we are reviewing the issue and get back to you as soon as we find the resolution. Response will be delayed due to weekend.

Have a wonderful weekend

Regards,

Bushra

0 Likes

I changed the DTB back to the original single reg of reg = < 0x00000000 0x10000000 >; Now the output looks better when Linux boots.

Bad S70GL02GS CFI data; adjust to detect 2 chips

0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x004801

Amd/Fujitsu Extended Query Table at 0x0040

  Amd/Fujitsu Extended Query version 1.5.

number of CFI chips: 1

7 ofpart partitions found on MTD device 0.flash

Creating 7 MTD partitions on "0.flash":

0x000000000000-0x000000040000 : "U-Boot"

0x000000040000-0x000000080000 : "Device Tree"

0x000000080000-0x0000000c0000 : "Spare"

0x0000000c0000-0x000000100000 : "U-Boot Environment"

0x000000100000-0x000000400000 : "Kernel Image"

0x000000400000-0x000001000000 : "Root"

0x000001000000-0x000010000000 : "User"

Bad S70GL02GS CFI data; adjust to detect 2 chips

d0000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x004801

Amd/Fujitsu Extended Query Table at 0x0040

  Amd/Fujitsu Extended Query version 1.5.

number of CFI chips: 1

6 ofpart partitions found on MTD device d0000000.flash

Creating 6 MTD partitions on "d0000000.flash":

0x000000000000-0x000007a00000 : "Free"

0x000007a00000-0x000007e00000 : "USER DATA"

0x000007e00000-0x000007fc0000 : "AUDIO Binary"

0x000007fc0000-0x000008000000 : "USB Binary"

0x000008000000-0x00000c000000 : "FPGA_IMAGE_1"

0x00000c000000-0x000010000000 : "FPGA_IMAGE_2"

Linux is still having problems writing to the flash.

Flash writing error during boot.

Initializing random number generator... jffs2: Write of 51 bytes at 0x00951560 failed. returned -5, retlen 48

jffs2: Write of 51 bytes at 0x00951594 failed. returned -5, retlen 48

urandom start: failed.

Thanks,

Dave

0 Likes
lock attach
Attachments are accessible only for community members.

Hello,

  1. Attached please find  Linux patch for the S70GL02GS, please try this.
  2. Yes for 2 devices interleaved you need to map 256 MB of space (0x10000000).
  3. After fixing the dtb, did you re-erase and re-format the JFFS2 partition?
  4. If the JFFS2 issue still exists, can you test to read/erase/write to the raw MTD, e.g. /dev/mtd0?

Thank you

Regards,

Bushra

0 Likes

Hi Bushra,

  I had already applied that patch. Just to make sure, I compared both of them and they matched.

This is what I have found:

On the previous flash devices, MT28FW02, U-Boot would automatically lock (RO) all partitions on startup. This is only a software lock in u-boot only, see below. When Linux booted, all sectors were unlocked (R/W). Not sure if Linux is unlocking all sectors but when listing them in Linux,  mtdinfo -M /dev/mtd6, for example, it showed they were all unlocked.

With the new flash devices, S70GL02GS, U-Boot does not automatically lock the sectors. If I manually lock all the sectors with "protect all on", U-Boot will lock all the sectors but it takes a long time. When Linux boots it cannot write to the flash. It seems U-Boot did a hardware lock. The flash functions in Linux do not work, for example, flash_unlock and flash_lock return an error 95 when executed. So, if I make sure that all sectors are unlocked in U-Boot then the system runs correctly and can write to the flash. The only issue I have now is the Linux flash commands not working with these new flash devices which is fine since I rarely use them.  The flash commands worked fine with the MT28 devices. They both have different CFI command sets if that makes a difference.

Thanks,

Dave

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

From U-Boot https://www.denx.de/wiki/DULG/UBootCmdGroupFlashhttp

The actual level of protection depends on the flash chips used on your hardware, and on the implementation of the flash device driver for this board. In most cases U-Boot provides just a simple software-protection, i. e. it prevents you from erasing or overwriting important stuff by accident (like the U-Boot code itself or U-Boot's environment variables), but it cannot prevent you from circumventing these restrictions - a nasty user who is loading and running his own flash driver code cannot and will not be stopped by this mechanism. Also, in most cases this protection is only effective while running U-Boot, i. e. any operating system will not know about "protected" flash areas and will happily erase these if requested to do so.

0 Likes

Hello David,

Where are you located?

> jffs2: Write of 51 bytes at 0x00951594 failed. returned -5, retlen 48

If retlen=48 this means, 48 bytes have been written, and 3 were remaining. Maybe the driver has some difficulties with partial words (we have a special 4 byte wide setup here).

Does it work with write chunks that are a multiple of 4 in size?

Does it also show up with dd writing on the raw device?

Thank you

Regards,

Bushra

0 Likes

Hello,

We are waiting for your response.

Thank you

Regards,

Bushra

0 Likes

Hello Bushra,

     I am located in Phoenix, AZ.

  I am not seeing the flash write error anymore. I solved the problem by making sure all the sectors of the S70GL02GS flash device are unlocked. If the sectors are locked from uboot I cannot write to the flash, even with dd.

Thanks,

Dave

0 Likes

Hello Dave,

Thank you for the update. Is your issue resolved completely or you have additional questions?

Have a wonderful weekend

Regards,

Bushra

0 Likes

Bushra,

  I almost have everything solved. When I do an mtd_debug on the old flash vs. the new flash there are differences in the mtd_flags. Why is this?

New S70GL02GS flash

root@nios2: /etc $ mtd_debug info /dev/mtd6

mtd.type = MTD_NORFLASH

mtd.flags = MTD_CAP_NORFLASH

mtd.size = 251658240 (240M)

mtd.erasesize = 262144 (256K)

mtd.writesize = 1

mtd.oobsize = 0

regions = 0

Old Flash

root@nios2: /etc $ mtd_debug info /dev/mtd6

mtd.type = MTD_NORFLASH

mtd.flags = MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_POWERUP_LOCK

mtd.size = 251658240 (240M)

mtd.erasesize = 262144 (256K)

mtd.writesize = 1

mtd.oobsize = 0

regions = 0

0 Likes

Also, I am unable to mount the /dev/mtd6 partition. On the old flash it was in the fstab file. When Linux tries to mount it while booting, it returns the following

jffs2: Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes

jffs2: empty_blocks 959, bad_blocks 0, c->nr_blocks 960

If I try to mount it manually I get the following

root@nios2: / $ mount -t jffs2 /dev/mtd6 /usr/local/

mount: mounting /dev/mtd6 on /usr/local/ failed: Block device required

0 Likes

Hello David,

Thank you for your update. I will discuss with our software group and get back to you.

Have a wonderful day

Regards,

Bushra

0 Likes

Hello Bushra,

  I am able to mount the mtd6 partition now but there still is a problem. After the mtd6 partition gets mounted the size of it gets smaller over a several minute period. If I keep typing df the following will be displayed.

root@nios2: /root $ mount -a

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M     12.5M    227.5M   5% /usr/local

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M     17.3M    222.8M   7% /usr/local

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M     23.3M    216.8M  10% /usr/local

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M     26.5M    213.5M  11% /usr/local

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M     40.5M    199.5M  17% /usr/local

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M    122.8M    117.3M  51% /usr/local

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M    199.0M     41.0M  83% /usr/local

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M    206.8M     33.3M  86% /usr/local

root@nios2: /root $ df

Filesystem                Size      Used Available Use% Mounted on

/dev/root                12.0M     12.0M         0 100% /

/dev/mtdblock6          240.0M    240.0M         0 100% /usr/local

It keeps going until it's 100% Used, also the root partition does the same thing.

Thanks,

Dave

0 Likes

Hello Dave,

Thank you for the update. Few questions for you.

Are there any errors in the syslog popping up during this time?

What do "ls -l /usr/local" or "du -sk /usr/local" indicate?

Are there garbage or lost+found directories that grow?

There is also a garbage collector thread running in the background. That thread is erasing sectors in the background, and if it fails it might disable the sectors. Would be another explanation.

Any results from the raw MTD test?

Thank you

Regards,

Bushra

0 Likes

Bushra,

  I do not see any errors in the syslog/messages log file..

When I do the ls and du commands nothing is listed.

root@nios2: /root $ ls -l /usr/local

total 0

root@nios2: /root $ du -sk /usr/local

0      /usr/local

I cannot find and garbage or lost+found directories anywhere.

Something strange is happening. I am trying to mount /dev/mtd6 to /usr/local. When I run the mtdinfo on mtd5 I get the following. But when I do that on mtd6 Linux says it's not a character device.

root@nios2: /tmp $ mtdinfo /dev/mtd5 -M

mtd5

Name:                          Root

Type:                          nor

Eraseblock size:                262144 bytes, 256.0 KiB

Amount of eraseblocks:          48 (12582912 bytes, 12.0 MiB)

Minimum input/output unit size: 1 byte

Sub-page size:                  1 byte

Character device major/minor:  90:10

Bad blocks are allowed:        false

Device is writable:            true

Eraseblock map:

  0: 00000000          1: 00040000          2: 00080000          3: 000c0000

  4: 00100000          5: 00140000          6: 00180000          7: 001c0000

  8: 00200000          9: 00240000        10: 00280000        11: 002c0000

12: 00300000        13: 00340000        14: 00380000        15: 003c0000

16: 00400000        17: 00440000        18: 00480000        19: 004c0000

20: 00500000        21: 00540000        22: 00580000        23: 005c0000

24: 00600000        25: 00640000        26: 00680000        27: 006c0000

28: 00700000        29: 00740000        30: 00780000        31: 007c0000

32: 00800000        33: 00840000        34: 00880000        35: 008c0000

36: 00900000        37: 00940000        38: 00980000        39: 009c0000

40: 00a00000        41: 00a40000        42: 00a80000        43: 00ac0000

44: 00b00000        45: 00b40000        46: 00b80000        47: 00bc0000

root@nios2: /tmp $ mtdinfo /dev/mtd6 -M

libmtd: error!: "/dev/mtd6" is not a character device

mtdinfo: error!: cannot get information about MTD device "/dev/mtd6"

        error 22 (Invalid argument)

root@nios2: /tmp $

I am able to do a raw write to /dev/mtd6. I copied a file to it and was able to do a cat /dev/mtd6 and see the contents of the file.

Thanks,

Dave

0 Likes
lock attach
Attachments are accessible only for community members.

Bushra,

  I figured it out. At one point early on, the system worked. Then I changed something. What I did was updated the cfi_cmdset_0002.c and the cfi_probe.c drivers to the latest. I didn't think this would cause a problem. I decided to start over with a new clone of the kernel and it worked. When Linux booted, it still complained about the size of the flash. I then updated the cfi_probe.c to the latest version and Linux stopped complaining about the flash size, see below. I attached the updated cfi_probe.c file if you want to look at it.

Why would an update to the latest cfi_cmdset_0002.c make things worse? Maybe it has something to do with the fact that I'm on kernel version 3.13 and the I updated the file from 4.xx. Probably not compatible.

Boot with Original cfi_probe.c

Line 2, 6, 17, and 21 show up, which is the correct thing to do. I believe the S70GL02GS reports twice the size.

0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x004801

NOR chip too large to fit in mapping. Attempting to cope...

Amd/Fujitsu Extended Query Table at 0x0040

  Amd/Fujitsu Extended Query version 1.5.

number of CFI chips: 1

Reducing visibility of 524288KiB chip to 262144KiB

7 ofpart partitions found on MTD device 0.flash

Creating 7 MTD partitions on "0.flash":

0x000000000000-0x000000040000 : "U-Boot"

0x000000040000-0x000000080000 : "Device Tree"

0x000000080000-0x0000000c0000 : "Spare"

0x0000000c0000-0x000000100000 : "U-Boot Environment"

0x000000100000-0x000000400000 : "Kernel Image"

0x000000400000-0x000001000000 : "Root"

0x000001000000-0x000010000000 : "User"

d0000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x004801

NOR chip too large to fit in mapping. Attempting to cope...

Amd/Fujitsu Extended Query Table at 0x0040

  Amd/Fujitsu Extended Query version 1.5.

number of CFI chips: 1

Reducing visibility of 524288KiB chip to 262144KiB

6 ofpart partitions found on MTD device d0000000.flash

Creating 6 MTD partitions on "d0000000.flash":

0x000000000000-0x000007a00000 : "Free"

0x000007a00000-0x000007e00000 : "USER DATA"

0x000007e00000-0x000007fc0000 : "AUDIO Binary"

0x000007fc0000-0x000008000000 : "USB Binary"

0x000008000000-0x00000c000000 : "FPGA_IMAGE_1"

0x00000c000000-0x000010000000 : "FPGA_IMAGE_2"

After cfi_probe.c updated

Changed to line line 1 and 15. Now it recognizes that this chip is reporting the wrong size and corrects it.

Bad S70GL02GS CFI data; adjust to detect 2 chips

0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x004801

Amd/Fujitsu Extended Query Table at 0x0040

  Amd/Fujitsu Extended Query version 1.5.

number of CFI chips: 1

7 ofpart partitions found on MTD device 0.flash

Creating 7 MTD partitions on "0.flash":

0x000000000000-0x000000040000 : "U-Boot"

0x000000040000-0x000000080000 : "Device Tree"

0x000000080000-0x0000000c0000 : "Spare"

0x0000000c0000-0x000000100000 : "U-Boot Environment"

0x000000100000-0x000000400000 : "Kernel Image"

0x000000400000-0x000001000000 : "Root"

0x000001000000-0x000010000000 : "User"

Bad S70GL02GS CFI data; adjust to detect 2 chips

d0000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x004801

Amd/Fujitsu Extended Query Table at 0x0040

  Amd/Fujitsu Extended Query version 1.5.

number of CFI chips: 1

6 ofpart partitions found on MTD device d0000000.flash

Creating 6 MTD partitions on "d0000000.flash":

0x000000000000-0x000007a00000 : "Free"

0x000007a00000-0x000007e00000 : "USER DATA"

0x000007e00000-0x000007fc0000 : "AUDIO Binary"

0x000007fc0000-0x000008000000 : "USB Binary"

0x000008000000-0x00000c000000 : "FPGA_IMAGE_1"

0x00000c000000-0x000010000000 : "FPGA_IMAGE_2"

Now this brings me back to where I was before. In Linux I cannot protect or unprotect any flash sectors.

Thanks,

Dave

0 Likes
lock attach
Attachments are accessible only for community members.

Hi Dave,

we do have a Linux patch for Advanced Sector Protection (ASP). With this patch installed, you can lock and unlock individual sectors (DYBs, PPBs, ...). I have attached it to this email. Please take a look at the documentation provided in the package.

Best regards,

Gernot

0 Likes

Gernot,

  Than you for the patch. I have successfully applied the patch only to notice afterwords that I will need to write new functions to take advantage of the patch. Do you have anything like flash_unlock or flash_lock source that uses this patch? As much as I'd love to write new functions I do not have time to do that right now.

Thanks,

Dave

0 Likes

Hi Dave,

GL-S flash devices have two basic mechanisms for sector based protection: volatile dynamic bits (DYBs, i.e. RAM) and persistent protection bits (PPBs, i.e. flash cells). The PPBs can all be erased in one operation for the entire device. If this is what is set by u-boot then the following short code should do the unlocking job. If mtd0 is part of your S70GL02GS then you can use the example without modifications, otherwise just pick a mtd that goes to your flash device (any partition is fine).

---------------------------------------------------------------- asp_ppb_clr.c ------------------------------------------------------------

#include <stdio.h>

#include <stdlib.h>

#include <fcntl.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <sys/ioctl.h>

#include <mtd/mtd-user.h>

main()

{

   int fd, ret;

   uint64_t adr = 0;

  

   if ((fd = open( "/dev/mtd0", O_RDWR)) == -1)

      { perror( "open() failed"); exit( -1); }

  

   //  Erase PPBs

  

   ret = ioctl( fd, SPN_IOCTL_SECTOR_PPB_UNLOCK_ALL, &adr);

   if (ret < 0)

      { perror( "ioctl(PPB_UNLOCK_ALL) failed"); exit( -1); }

  

   ret = ioctl( fd, SPN_IOCTL_SECTOR_PPB_READ, &adr);

   if (ret < 0)

      { perror( "ioctl(PPB_READ) failed"); exit( -1); }

  

   printf( "PPB after erasing: %d\n", ret);

}

-------------------------------------------------------------------------------------------------------------------------------------------------

If the DYBs are set by u-boot, then the code would have to look slightly different with a loop over all sectors. I can send you a similar short code for this as well if you want. Just let me know.

Best regards,

Gernot

0 Likes

Just another minor clarification: S70GL02GS parts have two silicon dies inside. For every die we have to do a PPB_UNLOCK_ALL (interleaved dies will be erased/unlocked simultaneously, no extra efforts needed for these). So in other words, you probably need to compile the example twice, with different mtds/partitions. Then call both executables to unlock the lower and upper dies.

PS: I agree, it would be quite useful to have a user space utility that manages all this. Actually, we might add one in the next release of the patch.

0 Likes

Gernot,

  I will try the code. So what I am doing currently is unlocking all sectors in u-boot and leaving them unlocked.

Also, please make a user space utility for the next patch. That would be great.

Thanks,

Dave

0 Likes

Hello Dave,

Do you have any additional question?

Thank you

Regards,

Bushra

0 Likes