Skip to contentSkip to conversation

sf: Add common probe support

PATCH RESEND Superseded Jagannadha Sutradharudu Teki 3 participants 5 messages Aug 6, 2013 – Aug 19, 2013

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover sf: Add common probe support

Hi All,

This is a v2 series for "sf: Add common probe support"

I am u-boot/spi custodian, I removed all flash drivers files(except ramtron, handled in a separate driver) and implemented a common probe support.

Tested SST, STMICR, SPANSION, WINBOND from my side, REQUEST FOR ALL SPI CODE FLASH_UESRS/CONTRIBUTORS/REST_USER, PLEASE TEST THESE CHANGES W.R.T YOUR HW IF POSSIBLE.

Please let me know for any issues/concerns/questions.

--
Thanks,
Jagan.

Jagannadha Sutradharudu Teki (20):
sf: Divide spi_flash into multiple parts
sf: probe: Add new spi_flash_probe support
sf: probe: Add support for M25P* flash parts
sf: probe: Add support for EN25Q* flash parts
sf: probe: Add support for GD25* flash parts
sf: probe: Add support for MX25L* flash parts
sf: probe: Add support for W25* flash parts
sf: probe: Add support for S25FL* flash parts
sf: probe: Add support for SST25* flash parts
sf: probe: Add support for AT45DB* flash parts
sf: probe: Give proper spacing on flash table attributes
sf: probe: Add support for SST_WP
sf: probe: Add support to clear flash BP# bits
sf: probe: Add support for erase sector selection flag
sf: probe: Add support for flag status polling
sf: probe: Move BAR config to spi_flash_validate_ids
sf: Add proper comment style on spi_flash structure
sf: ramtron: Add support for separate flash driver
sf: Remove unneeded flash drivers files
sf: probe: Add support for EN25Q64

 drivers/mtd/spi/Makefile             |  15 +-
 drivers/mtd/spi/atmel.c              | 544 ---------------------------------
 drivers/mtd/spi/eon.c                |  60 ----
 drivers/mtd/spi/gigadevice.c         |  65 ----
 drivers/mtd/spi/macronix.c           |  98 ------
 drivers/mtd/spi/ramtron.c            | 287 ------------------
 drivers/mtd/spi/spansion.c           | 141 ---------
 drivers/mtd/spi/spi_flash.c          | 569 +----------------------------------
 drivers/mtd/spi/spi_flash_internal.h |  21 +-
 drivers/mtd/spi/spi_flash_ops.c      | 403 +++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash_probe.c    | 368 ++++++++++++++++++++++
 drivers/mtd/spi/sst.c                | 232 --------------
 drivers/mtd/spi/stmicro.c            | 202 -------------
 drivers/mtd/spi/winbond.c            | 141 ---------
 include/configs/top9000.h            |   1 -
 include/spi_flash.h                  |  79 +++--
 16 files changed, 841 insertions(+), 2385 deletions(-)
 delete mode 100644 drivers/mtd/spi/atmel.c
 delete mode 100644 drivers/mtd/spi/eon.c
 delete mode 100644 drivers/mtd/spi/gigadevice.c
 delete mode 100644 drivers/mtd/spi/macronix.c
 delete mode 100644 drivers/mtd/spi/ramtron.c
 delete mode 100644 drivers/mtd/spi/spansion.c
 create mode 100644 drivers/mtd/spi/spi_flash_ops.c
 create mode 100644 drivers/mtd/spi/spi_flash_probe.c
 delete mode 100644 drivers/mtd/spi/sst.c
 delete mode 100644 drivers/mtd/spi/stmicro.c
 delete mode 100644 drivers/mtd/spi/winbond.c
Signature · 1 line
1.8.3
#1 lore raw

v2 cover sf: Add common probe support

Hi All,

Quoted 58 lines · Jagannadha Sutradharudu Teki

Hi All,

This is a v2 series for "sf: Add common probe support"

I am u-boot/spi custodian, I removed all flash drivers files(except ramtron, handled in a separate driver) and implemented a common probe support.

Tested SST, STMICR, SPANSION, WINBOND from my side, REQUEST FOR ALL SPI CODE FLASH_UESRS/CONTRIBUTORS/REST_USER, PLEASE TEST THESE CHANGES W.R.T YOUR HW IF POSSIBLE.

Please let me know for any issues/concerns/questions.

--
Thanks,
Jagan.

Jagannadha Sutradharudu Teki (20):
sf: Divide spi_flash into multiple parts
sf: probe: Add new spi_flash_probe support
sf: probe: Add support for M25P* flash parts
sf: probe: Add support for EN25Q* flash parts
sf: probe: Add support for GD25* flash parts
sf: probe: Add support for MX25L* flash parts
sf: probe: Add support for W25* flash parts
sf: probe: Add support for S25FL* flash parts
sf: probe: Add support for SST25* flash parts
sf: probe: Add support for AT45DB* flash parts
sf: probe: Give proper spacing on flash table attributes
sf: probe: Add support for SST_WP
sf: probe: Add support to clear flash BP# bits
sf: probe: Add support for erase sector selection flag
sf: probe: Add support for flag status polling
sf: probe: Move BAR config to spi_flash_validate_ids
sf: Add proper comment style on spi_flash structure
sf: ramtron: Add support for separate flash driver
sf: Remove unneeded flash drivers files
sf: probe: Add support for EN25Q64

 drivers/mtd/spi/Makefile             |  15 +-
 drivers/mtd/spi/atmel.c              | 544 ---------------------------------
 drivers/mtd/spi/eon.c                |  60 ----
 drivers/mtd/spi/gigadevice.c         |  65 ----
 drivers/mtd/spi/macronix.c           |  98 ------
 drivers/mtd/spi/ramtron.c            | 287 ------------------
 drivers/mtd/spi/spansion.c           | 141 ---------
 drivers/mtd/spi/spi_flash.c          | 569 +----------------------------------
 drivers/mtd/spi/spi_flash_internal.h |  21 +-
 drivers/mtd/spi/spi_flash_ops.c      | 403 +++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash_probe.c    | 368 ++++++++++++++++++++++
 drivers/mtd/spi/sst.c                | 232 --------------
 drivers/mtd/spi/stmicro.c            | 202 -------------
 drivers/mtd/spi/winbond.c            | 141 ---------
 include/configs/top9000.h            |   1 -
 include/spi_flash.h                  |  79 +++--
 16 files changed, 841 insertions(+), 2385 deletions(-)
 delete mode 100644 drivers/mtd/spi/atmel.c
 delete mode 100644 drivers/mtd/spi/eon.c
 delete mode 100644 drivers/mtd/spi/gigadevice.c
Quoted 9 lines
 delete mode 100644 drivers/mtd/spi/macronix.c
 delete mode 100644 drivers/mtd/spi/ramtron.c
 delete mode 100644 drivers/mtd/spi/spansion.c
 create mode 100644 drivers/mtd/spi/spi_flash_ops.c
 create mode 100644 drivers/mtd/spi/spi_flash_probe.c
 delete mode 100644 drivers/mtd/spi/sst.c
 delete mode 100644 drivers/mtd/spi/stmicro.c
 delete mode 100644 drivers/mtd/spi/winbond.c

Please find the test branch for this patch series, here.
http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/master-test

Request to test these changes on your boards.
Let me know for any issues.

--
Thanks,
Jagan.

#2 lore raw

v2 cover sf: Add common probe support

Hello Jagan,

Quoted 5 lines · Jagan Teki

Please find the test branch for this patch series, here.
http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/master-test

Request to test these changes on your boards.
Let me know for any issues.

Thanks for setting up a branch for easier testing. I've rebased the CuBox support patch series [1] on top of your branch and tested the result. SPI flash support worked before on CuBox, but fails with your branch.

At build time, the following warnings are issued (found using DBGFLAGS="-g -Werror"):

make[1]: Entering directory `/lhome/sascha.silbe/src/u-boot/common'
arm-linux-gnueabi-gcc -g -Werror -Os -ffunction-sections -fdata-sections -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0x00600000 -I/lhome/sascha.silbe/src/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabi/4.7/include -pipe -DCONFIG_ARM -D__ARM__ -marm -mno-thumb-interwork -mabi=aapcs-linux -march=armv7-a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage -o cmd_sf.o cmd_sf.c -c
In file included from cmd_sf.c:11:0:
/lhome/sascha.silbe/src/u-boot/include/spi_flash.h:37:12: error: ?spi_write_cmds_array? defined but not used [-Werror=unused-variable] /lhome/sascha.silbe/src/u-boot/include/spi_flash.h:56:12: error: ?spi_read_cmds_array? defined but not used [-Werror=unused-variable]
cc1: all warnings being treated as errors
make[1]: *** [cmd_sf.o] Error 1

At run time, automatically reading the environment from SPI flash fails. "sf probe" and "sf read" both appear to work, but "sf probe" reports 64KiB page size and "sf read" only yields 0xff rather than the U-Boot binary that's at the start of SPI flash:

=== Begin ===
U-Boot 2013.07-00163-g753bc19 (Aug 11 2013 - 12:13:01)SolidRun CuBox

SoC:   Dove 88AP510 (A1)
CPU:   Marvell Sheeva (rev 5)
DRAM:  2 GiB
MMC:   Dove SDHCI0: 0

*** Warning - spi_flash_probe() failed, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   egiga0 Waiting for PHY auto negotiation to complete.... done

egiga0
Warning: failed to set MAC address

Hit any key to stop autoboot: 0
CuBox> sf probe
SF: Detected W25Q32BV with page size 64 KiB, total 4 MiB CuBox> sf read ${loadaddr} 0 0x20000
SF: 131072 bytes @ 0x0 Read: OK
CuBox> md.b ${loadaddr}

02000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
02000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
02000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
02000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

=== End ===

For comparison, this is what it looks like on top of current master:

=== Begin ===
U-Boot 2013.07-00123-gde877d3 (Aug 11 2013 - 13:39:44)SolidRun CuBox

SoC:   Dove 88AP510 (A1)
CPU:   Marvell Sheeva (rev 5)
DRAM:  2 GiB
MMC:   Dove SDHCI0: 0
SF: Detected W25Q32BV/W25Q32FV_SPI with page size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0 Waiting for PHY auto negotiation to complete... done

egiga0
Hit any key to stop autoboot: 0
CuBox> sf probe
SF: Detected W25Q32BV/W25Q32FV_SPI with page size 4 KiB, total 4 MiB CuBox> sf read ${loadaddr} 0 0x20000
SF: 131072 bytes @ 0x0 Read: OK
CuBox> md.b ${loadaddr}

02000000: 5a 00 00 00 54 67 04 00 00 00 00 00 00 02 00 00    Z...Tg..........
02000010: 00 00 60 00 00 00 60 00 00 00 00 00 00 00 01 dc    ..`...`.........
02000020: 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    @...............
02000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

CuBox>
=== End ===

Is there something that needs to be done differently now? Some additional function to call in board setup code or defines to set in the board configuration?

Sascha

[1] mid:1372195668-25496-1-git-send-email-t-uboot at infra-silbe.de

    http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/148412/focus=164287

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130811/de93ec32/attachment.pgp>

author
#3 lore raw

v2 cover sf: Add common probe support

Hi Sascha,

Thanks for testing master-test branch.

Quoted 18 lines · Sascha Silbe

Hello Jagan,

Quoted 5 lines · Jagan Teki

Please find the test branch for this patch series, here.
http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/master-test

Request to test these changes on your boards.
Let me know for any issues.

Thanks for setting up a branch for easier testing. I've rebased the CuBox support patch series [1] on top of your branch and tested the result. SPI flash support worked before on CuBox, but fails with your branch.

At build time, the following warnings are issued (found using DBGFLAGS="-g -Werror"):

Quoted 7 lines

make[1]: Entering directory `/lhome/sascha.silbe/src/u-boot/common'
arm-linux-gnueabi-gcc -g -Werror -Os -ffunction-sections -fdata-sections -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0x00600000 -I/lhome/sascha.silbe/src/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabi/4.7/include -pipe -DCONFIG_ARM -D__ARM__ -marm -mno-thumb-interwork -mabi=aapcs-linux -march=armv7-a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage -o cmd_sf.o cmd_sf.c -c
In file included from cmd_sf.c:11:0:
/lhome/sascha.silbe/src/u-boot/include/spi_flash.h:37:12: error: ?spi_write_cmds_array? defined but not used [-Werror=unused-variable] /lhome/sascha.silbe/src/u-boot/include/spi_flash.h:56:12: error: ?spi_read_cmds_array? defined but not used [-Werror=unused-variable]
cc1: all warnings being treated as errors
make[1]: *** [cmd_sf.o] Error 1

Yes, i will fix this, please use -Wunused-variable as of now for testing to make build successful.

Quoted 7 lines

At run time, automatically reading the environment from SPI flash fails. "sf probe" and "sf read" both appear to work, but "sf probe" reports 64KiB page size and "sf read" only yields 0xff rather than the U-Boot binary that's at the start of SPI flash:

Quoted 8 lines

=== Begin ===
U-Boot 2013.07-00163-g753bc19 (Aug 11 2013 - 12:13:01)SolidRun CuBox

SoC:   Dove 88AP510 (A1)
CPU:   Marvell Sheeva (rev 5)
DRAM:  2 GiB
MMC:   Dove SDHCI0: 0

*** Warning - spi_flash_probe() failed, using default environment

Why this is got failed while env reading and again succeeded in below u-boot prompt?

Quoted 14 lines
In:    serial
Out:   serial
Err:   serial
Net:   egiga0 Waiting for PHY auto negotiation to complete.... done

egiga0
Warning: failed to set MAC address

Hit any key to stop autoboot: 0
CuBox> sf probe
SF: Detected W25Q32BV with page size 64 KiB, total 4 MiB CuBox> sf read ${loadaddr} 0 0x20000
SF: 131072 bytes @ 0x0 Read: OK
CuBox> md.b ${loadaddr}

Quoted 5 lines
02000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
02000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
02000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
02000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

=== End ===

Do you have any changes on ur controller driver w.r.t to working scenario in below log on master.?

I will work directly, as no changes of spi_flash_ops. Can you try to write some thing and read it back.

--
Thanks,
Jagan.

Quoted 31 lines

For comparison, this is what it looks like on top of current master:

=== Begin ===
U-Boot 2013.07-00123-gde877d3 (Aug 11 2013 - 13:39:44)SolidRun CuBox

SoC:   Dove 88AP510 (A1)
CPU:   Marvell Sheeva (rev 5)
DRAM:  2 GiB
MMC:   Dove SDHCI0: 0
SF: Detected W25Q32BV/W25Q32FV_SPI with page size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0 Waiting for PHY auto negotiation to complete... done

egiga0
Hit any key to stop autoboot: 0
CuBox> sf probe
SF: Detected W25Q32BV/W25Q32FV_SPI with page size 4 KiB, total 4 MiB CuBox> sf read ${loadaddr} 0 0x20000
SF: 131072 bytes @ 0x0 Read: OK
CuBox> md.b ${loadaddr}

02000000: 5a 00 00 00 54 67 04 00 00 00 00 00 00 02 00 00    Z...Tg..........
02000010: 00 00 60 00 00 00 60 00 00 00 00 00 00 00 01 dc    ..`...`.........
02000020: 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    @...............
02000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

CuBox>
=== End ===

Quoted 9 lines

Is there something that needs to be done differently now? Some additional function to call in board setup code or defines to set in the board configuration?

Sascha

[1] mid:1372195668-25496-1-git-send-email-t-uboot at infra-silbe.de

     http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/148412/focus=164287

--
Thanks,
Jagan.

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#4 lore raw

v2 cover sf: Add common probe support

Hi All,

Did anyone tested?
atmel,
ramtron,
eon,
gigadevice,
macronix
spi flash on this test spi repo.
http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/master-test

Request to test these new changes.

--
Thanks,
Jagan.

Quoted 165 lines · Jagan Teki

Hi Sascha,

Thanks for testing master-test branch.

Quoted 30 lines · Sascha Silbe

Hello Jagan,

Quoted 6 lines · Jagan Teki

Please find the test branch for this patch series, here.

http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/master-test

Request to test these changes on your boards.
Let me know for any issues.

Thanks for setting up a branch for easier testing. I've rebased the CuBox support patch series [1] on top of your branch and tested the result. SPI flash support worked before on CuBox, but fails with your branch.

At build time, the following warnings are issued (found using DBGFLAGS="-g -Werror"):

make[1]: Entering directory `/lhome/sascha.silbe/src/u-boot/common'
arm-linux-gnueabi-gcc -g -Werror -Os -ffunction-sections

(quoted diff) +0 -3
-fdata-sections -fno-common -ffixed-r8 -msoft-float  -D__KERNEL__
-DCONFIG_SYS_TEXT_BASE=0x00600000 -I/lhome/sascha.silbe/src/u-boot/include
-fno-builtin -ffreestanding -nostdinc -isystem

/usr/lib/gcc/arm-linux-gnueabi/4.7/include -pipe -DCONFIG_ARM -D__ARM__

(quoted diff) +0 -3
-marm -mno-thumb-interwork -mabi=aapcs-linux -march=armv7-a -Wall
-Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral
-Wno-format-security -fstack-usage     -o cmd_sf.o cmd_sf.c -c
Quoted 7 lines

In file included from cmd_sf.c:11:0:
/lhome/sascha.silbe/src/u-boot/include/spi_flash.h:37:12: error:
?spi_write_cmds_array? defined but not used [-Werror=unused-variable] /lhome/sascha.silbe/src/u-boot/include/spi_flash.h:56:12: error:
?spi_read_cmds_array? defined but not used [-Werror=unused-variable]
cc1: all warnings being treated as errors
make[1]: *** [cmd_sf.o] Error 1

Yes, i will fix this, please use -Wunused-variable as of now for testing to make build successful.

Quoted 7 lines

At run time, automatically reading the environment from SPI flash fails. "sf probe" and "sf read" both appear to work, but "sf probe" reports 64KiB page size and "sf read" only yields 0xff rather than the U-Boot binary that's at the start of SPI flash:

Quoted 8 lines

=== Begin ===
U-Boot 2013.07-00163-g753bc19 (Aug 11 2013 - 12:13:01)SolidRun CuBox

SoC:   Dove 88AP510 (A1)
CPU:   Marvell Sheeva (rev 5)
DRAM:  2 GiB
MMC:   Dove SDHCI0: 0

*** Warning - spi_flash_probe() failed, using default environment

Why this is got failed while env reading and again succeeded in below u-boot prompt?

Quoted 8 lines
In:    serial
Out:   serial
Err:   serial
Net:   egiga0 Waiting for PHY auto negotiation to complete.... done

egiga0
Warning: failed to set MAC address

Quoted 15 lines

Hit any key to stop autoboot: 0
CuBox> sf probe
SF: Detected W25Q32BV with page size 64 KiB, total 4 MiB CuBox> sf read ${loadaddr} 0 0x20000
SF: 131072 bytes @ 0x0 Read: OK
CuBox> md.b ${loadaddr}
02000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
................
02000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
................
02000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
................
02000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
................
=== End ===

Do you have any changes on ur controller driver w.r.t to working scenario in below log on master.?

I will work directly, as no changes of spi_flash_ops. Can you try to write some thing and read it back.

--
Thanks,
Jagan.

Quoted 39 lines

For comparison, this is what it looks like on top of current master:

=== Begin ===
U-Boot 2013.07-00123-gde877d3 (Aug 11 2013 - 13:39:44)SolidRun CuBox

SoC:   Dove 88AP510 (A1)
CPU:   Marvell Sheeva (rev 5)
DRAM:  2 GiB
MMC:   Dove SDHCI0: 0
SF: Detected W25Q32BV/W25Q32FV_SPI with page size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0 Waiting for PHY auto negotiation to complete... done

egiga0
Hit any key to stop autoboot: 0
CuBox> sf probe
SF: Detected W25Q32BV/W25Q32FV_SPI with page size 4 KiB, total 4 MiB CuBox> sf read ${loadaddr} 0 0x20000
SF: 131072 bytes @ 0x0 Read: OK
CuBox> md.b ${loadaddr}
02000000: 5a 00 00 00 54 67 04 00 00 00 00 00 00 02 00 00 Z...Tg..........
02000010: 00 00 60 00 00 00 60 00 00 00 00 00 00 00 01 dc ..............
02000020: 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 @...............
02000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
CuBox>
=== End ===

Is there something that needs to be done differently now? Some additional function to call in board setup code or defines to set in the board configuration?

Quoted 6 lines

Sascha

[1] mid:1372195668-25496-1-git-send-email-t-uboot at infra-silbe.de

http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/148412/focus=164287

--
Thanks,
Jagan.

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.