Patchwork [U-Boot,v2,01/12] mtd: spi: winbond: add W25PXX support

login
register
mail settings
Submitter Kuo-Jung Su
Date April 18, 2013, 9:25 a.m.
Message ID <1366277139-29728-2-git-send-email-dantesu@gmail.com>
Download mbox | patch
Permalink /patch/237571/
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Comments

Kuo-Jung Su - April 18, 2013, 9:25 a.m.
From: Kuo-Jung Su <dantesu@faraday-tech.com>

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
---
 drivers/mtd/spi/winbond.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Kuo-Jung Su - April 26, 2013, 8:02 a.m.
From: Kuo-Jung Su <dantesu@faraday-tech.com>

To: u-boot@lists.denx.de
CC: Albert Aribaud <albert.u.boot@aribaud.net>

These patches introduce Faraday A36x SoC platform support.

Here are some public documents for your reference.

    http://www.faraday-tech.com/html/documentation/index.html

There is also a A369 QEMU emulator available at my github account:

    https://github.com/dantesu1218/qemu.git

Here is quick start for QEMU:

1. Download the QEMU source tree

    $ git clone -b qemu-1.3.0 https://github.com/dantesu1218/qemu.git

2. Build & Install the QEMU:

    $ ./configure --target-list=arm-softmmu
    $ make
    $ make install

3. Launch u-boot with QEMU:

    $ qemu-system-arm -M a369 -m 512M -nographic -kernel ~/u-boot-devel/u-boot

Changes for v3:
   - Coding Style cleanup.
     There is still one warnning reported by checkpatch.pl,
     however it's too deep for me to fix it.
     Here is the shapshot for it:
     -----------------------------------------------------
     WARNING: do not add new typedefs
     #9735: FILE: include/lcd.h:258:
     +typedef struct vidinfo {
     -----------------------------------------------------
   - Drop bit fields from c struct.
   - Drop macros for wirtel()/readl(), call them directly.
   - Always insert a blank line between declarations and code.
   - Replace all the infinite wait loop with a timeout.
   - Add '__iomem' to all the declaration of HW register pointers.
   - cmd_boot.c: Make it a separate stand-alone patch.
   - ftspi020: Make it a separate stand-alone patch.
   - dma-mapping.h: Have the global data ptr declared outside functions.
   - dma-mapping.h: Add #if...#else...#endif to dma_free_coherent().
   - MMU/D-Cache: Drop static non-cached region, now we use
     map_physmem()/unmap_physmem() for dynamic mappings.
   - ftmac110: Make a correction to multi-line comment style
   - ftmac110: Use random MAC address while having trouble
     to get one from environment variables.
   - ftmac110: Add comments to timing control registers.
   - ftnandc021: Re-write this driver with ECC enabled and
     correct column address handling for OOB read/write,
     and fixing issused addressed by Scott.
   - a36x_config: No more static global network configurations.
   - a36x_config: Add a common file for the redundant configurations.

Changes for v2:
   - Coding Style cleanup.
   - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
   - Use structure based hardware registers to replace the macro constants.
   - Replace BIT() with BIT_MASK().
   - echi-faraday: Remove debug codes.
   - ftmac110: Remove debug codes.
   - cache-cp15: Enable write buffer in write-through mode.

Kuo-Jung Su (11):
  arm: add MMU/D-Cache support for Faraday cores
  net: ftgmac100: add MMU/D-cache support
  net: add Faraday FTMAC110 10/100Mbps ethernet support
  i2c: add Faraday FTI2C010 I2C controller support
  spi: add Faraday FTSPI010 SPI controller support
  mmc: update the Faraday FTSDC010 driver to fix performance issue
  mtd: nand: add Faraday FTNANDC021 NAND controller support
  usb: ehci: add Faraday USB 2.0 EHCI support
  usb: gadget: add Faraday FOTG210 USB gadget support
  video: add Faraday FTLCDC200 LCD controller support
  arm: add Faraday A36x SoC platform support

 README                                    |    7 +
 arch/arm/cpu/faraday/Makefile             |   57 ++
 arch/arm/cpu/faraday/a360/Makefile        |   49 ++
 arch/arm/cpu/faraday/a369/Makefile        |   50 ++
 arch/arm/cpu/faraday/a369/cmd_fa606.c     |   72 +++
 arch/arm/cpu/faraday/cmd_bootfa.c         |  132 ++++
 arch/arm/cpu/faraday/config.mk            |   33 +
 arch/arm/cpu/faraday/cpu.c                |  238 +++++++
 arch/arm/cpu/faraday/ftintc020.h          |   37 ++
 arch/arm/cpu/faraday/ftpwmtmr010.c        |  156 +++++
 arch/arm/cpu/faraday/ftpwmtmr010.h        |   41 ++
 arch/arm/cpu/faraday/fttmr010.c           |  156 +++++
 arch/arm/cpu/faraday/fwimage.h            |   38 ++
 arch/arm/cpu/faraday/fwimage2.h           |   70 +++
 arch/arm/cpu/faraday/interrupts.c         |  151 +++++
 arch/arm/cpu/faraday/reset.c              |   38 ++
 arch/arm/cpu/faraday/start.S              |  523 ++++++++++++++++
 arch/arm/cpu/u-boot.lds                   |   11 +
 arch/arm/include/asm/arch-a360/hardware.h |   73 +++
 arch/arm/include/asm/arch-a360/pmu.h      |   39 ++
 arch/arm/include/asm/arch-a360/scu.h      |   27 +
 arch/arm/include/asm/arch-a369/hardware.h |   88 +++
 arch/arm/include/asm/arch-a369/scu.h      |   48 ++
 arch/arm/include/asm/dma-mapping.h        |   60 +-
 arch/arm/include/asm/global_data.h        |    4 +
 arch/arm/include/asm/io.h                 |  154 ++++-
 arch/arm/include/asm/mach-types.h         |    1 +
 arch/arm/include/asm/system.h             |    7 +-
 arch/arm/lib/cache-cp15.c                 |   30 +
 board/faraday/a360evb/Makefile            |   49 ++
 board/faraday/a360evb/board.c             |   65 ++
 board/faraday/a360evb/clk.c               |   57 ++
 board/faraday/a360evb/config.mk           |   33 +
 board/faraday/a360evb/lowlevel_init.S     |   33 +
 board/faraday/a369evb/Makefile            |   49 ++
 board/faraday/a369evb/board.c             |  188 ++++++
 board/faraday/a369evb/clk.c               |   72 +++
 board/faraday/a369evb/config.mk           |   33 +
 board/faraday/a369evb/lowlevel_init.S     |  136 ++++
 boards.cfg                                |    3 +
 common/usb_hub.c                          |    5 +
 drivers/i2c/Makefile                      |    1 +
 drivers/i2c/fti2c010.c                    |  360 +++++++++++
 drivers/i2c/fti2c010.h                    |   71 +++
 drivers/mmc/Makefile                      |    2 +-
 drivers/mmc/ftsdc010_esdhc.c              |  687 ---------------------
 drivers/mmc/ftsdc010_mci.c                |  375 ++++++++++++
 drivers/mtd/cfi_flash.c                   |    2 +-
 drivers/mtd/nand/Makefile                 |    1 +
 drivers/mtd/nand/ftnandc021.c             |  724 ++++++++++++++++++++++
 drivers/mtd/nand/ftnandc021.h             |  137 +++++
 drivers/net/Makefile                      |    1 +
 drivers/net/ftgmac100.c                   |   70 ++-
 drivers/net/ftmac110.c                    |  471 ++++++++++++++
 drivers/net/ftmac110.h                    |  126 ++++
 drivers/spi/Makefile                      |    1 +
 drivers/spi/ftssp010_spi.c                |  385 ++++++++++++
 drivers/spi/ftssp010_spi.h                |   86 +++
 drivers/usb/gadget/Makefile               |    1 +
 drivers/usb/gadget/fotg210.c              |  953 +++++++++++++++++++++++++++++
 drivers/usb/gadget/gadget_chips.h         |    8 +
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-faraday.c           |  122 ++++
 drivers/usb/host/ehci-hcd.c               |   11 +
 drivers/usb/host/ehci.h                   |    5 +
 drivers/video/Makefile                    |    1 +
 drivers/video/ftlcdc200.c                 |  144 +++++
 drivers/video/ftlcdc200_panel.c           |  210 +++++++
 include/common.h                          |   13 +
 include/configs/a360.h                    |   63 ++
 include/configs/a369-common.h             |   74 +++
 include/configs/a369.h                    |   33 +
 include/configs/a369_fa606te.h            |   26 +
 include/configs/a36x-common.h             |  303 +++++++++
 include/faraday/ftgpio010.h               |   25 +
 include/faraday/ftlcdc200.h               |  179 ++++++
 include/faraday/ftsdc010.h                |   16 +-
 include/faraday/fttmr010.h                |   17 +
 include/faraday/mmc.h                     |   16 +
 include/faraday/nand.h                    |   34 +
 include/lcd.h                             |   33 +
 include/netdev.h                          |    1 +
 include/usb/fotg210.h                     |   71 +++
 include/usb/fusbh200.h                    |   28 +
 84 files changed, 8275 insertions(+), 726 deletions(-)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/a360/Makefile
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/cpu/faraday/a369/cmd_fa606.c
 create mode 100644 arch/arm/cpu/faraday/cmd_bootfa.c
 create mode 100644 arch/arm/cpu/faraday/config.mk
 create mode 100644 arch/arm/cpu/faraday/cpu.c
 create mode 100644 arch/arm/cpu/faraday/ftintc020.h
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.h
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
 create mode 100644 arch/arm/cpu/faraday/fwimage.h
 create mode 100644 arch/arm/cpu/faraday/fwimage2.h
 create mode 100644 arch/arm/cpu/faraday/interrupts.c
 create mode 100644 arch/arm/cpu/faraday/reset.c
 create mode 100644 arch/arm/cpu/faraday/start.S
 create mode 100644 arch/arm/include/asm/arch-a360/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a360/pmu.h
 create mode 100644 arch/arm/include/asm/arch-a360/scu.h
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/scu.h
 create mode 100644 board/faraday/a360evb/Makefile
 create mode 100644 board/faraday/a360evb/board.c
 create mode 100644 board/faraday/a360evb/clk.c
 create mode 100644 board/faraday/a360evb/config.mk
 create mode 100644 board/faraday/a360evb/lowlevel_init.S
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/clk.c
 create mode 100644 board/faraday/a369evb/config.mk
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 drivers/i2c/fti2c010.c
 create mode 100644 drivers/i2c/fti2c010.h
 delete mode 100644 drivers/mmc/ftsdc010_esdhc.c
 create mode 100644 drivers/mmc/ftsdc010_mci.c
 create mode 100644 drivers/mtd/nand/ftnandc021.c
 create mode 100644 drivers/mtd/nand/ftnandc021.h
 create mode 100644 drivers/net/ftmac110.c
 create mode 100644 drivers/net/ftmac110.h
 create mode 100644 drivers/spi/ftssp010_spi.c
 create mode 100644 drivers/spi/ftssp010_spi.h
 create mode 100644 drivers/usb/gadget/fotg210.c
 create mode 100644 drivers/usb/host/ehci-faraday.c
 create mode 100644 drivers/video/ftlcdc200.c
 create mode 100644 drivers/video/ftlcdc200_panel.c
 create mode 100644 include/configs/a360.h
 create mode 100644 include/configs/a369-common.h
 create mode 100644 include/configs/a369.h
 create mode 100644 include/configs/a369_fa606te.h
 create mode 100644 include/configs/a36x-common.h
 create mode 100644 include/faraday/ftgpio010.h
 create mode 100644 include/faraday/ftlcdc200.h
 create mode 100644 include/faraday/mmc.h
 create mode 100644 include/faraday/nand.h
 create mode 100644 include/usb/fotg210.h
 create mode 100644 include/usb/fusbh200.h

--
1.7.9.5
Tom Rini - May 2, 2013, 10:27 p.m.
On Fri, Apr 26, 2013 at 04:02:29PM +0800, Kuo-Jung Su wrote:

> From: Kuo-Jung Su <dantesu@faraday-tech.com>
> 
> To: u-boot@lists.denx.de
> CC: Albert Aribaud <albert.u.boot@aribaud.net>
> 
> These patches introduce Faraday A36x SoC platform support.
> 
> Here are some public documents for your reference.
> 
>     http://www.faraday-tech.com/html/documentation/index.html
> 
> There is also a A369 QEMU emulator available at my github account:
> 
>     https://github.com/dantesu1218/qemu.git
> 
> Here is quick start for QEMU:
> 
> 1. Download the QEMU source tree
> 
>     $ git clone -b qemu-1.3.0 https://github.com/dantesu1218/qemu.git
> 
> 2. Build & Install the QEMU:
> 
>     $ ./configure --target-list=arm-softmmu
>     $ make
>     $ make install
> 
> 3. Launch u-boot with QEMU:
> 
>     $ qemu-system-arm -M a369 -m 512M -nographic -kernel ~/u-boot-devel/u-boot
> 
> Changes for v3:
>    - Coding Style cleanup.
>      There is still one warnning reported by checkpatch.pl,
>      however it's too deep for me to fix it.
>      Here is the shapshot for it:
>      -----------------------------------------------------
>      WARNING: do not add new typedefs
>      #9735: FILE: include/lcd.h:258:
>      +typedef struct vidinfo {
>      -----------------------------------------------------
>    - Drop bit fields from c struct.
>    - Drop macros for wirtel()/readl(), call them directly.
>    - Always insert a blank line between declarations and code.
>    - Replace all the infinite wait loop with a timeout.
>    - Add '__iomem' to all the declaration of HW register pointers.
>    - cmd_boot.c: Make it a separate stand-alone patch.
>    - ftspi020: Make it a separate stand-alone patch.
>    - dma-mapping.h: Have the global data ptr declared outside functions.
>    - dma-mapping.h: Add #if...#else...#endif to dma_free_coherent().
>    - MMU/D-Cache: Drop static non-cached region, now we use
>      map_physmem()/unmap_physmem() for dynamic mappings.
>    - ftmac110: Make a correction to multi-line comment style
>    - ftmac110: Use random MAC address while having trouble
>      to get one from environment variables.
>    - ftmac110: Add comments to timing control registers.
>    - ftnandc021: Re-write this driver with ECC enabled and
>      correct column address handling for OOB read/write,
>      and fixing issused addressed by Scott.
>    - a36x_config: No more static global network configurations.
>    - a36x_config: Add a common file for the redundant configurations.

I see a few:
/* --------------------
 * Comment
 */
in various places, and I pointed it out in the net changes, but I also
saw in the SPI block '100' being used as a timeout, rather than defined.
Please give everything a check for magic numbers and direct numbers used
as timeout, rather than a #define.
Kuo-Jung Su - May 3, 2013, 6:02 a.m.
2013/5/3 Tom Rini <trini@ti.com>:
> On Fri, Apr 26, 2013 at 04:02:29PM +0800, Kuo-Jung Su wrote:
>
>> From: Kuo-Jung Su <dantesu@faraday-tech.com>
>>
>> To: u-boot@lists.denx.de
>> CC: Albert Aribaud <albert.u.boot@aribaud.net>
>>
>> These patches introduce Faraday A36x SoC platform support.
>>
>> Here are some public documents for your reference.
>>
>>     http://www.faraday-tech.com/html/documentation/index.html
>>
>> There is also a A369 QEMU emulator available at my github account:
>>
>>     https://github.com/dantesu1218/qemu.git
>>
>> Here is quick start for QEMU:
>>
>> 1. Download the QEMU source tree
>>
>>     $ git clone -b qemu-1.3.0 https://github.com/dantesu1218/qemu.git
>>
>> 2. Build & Install the QEMU:
>>
>>     $ ./configure --target-list=arm-softmmu
>>     $ make
>>     $ make install
>>
>> 3. Launch u-boot with QEMU:
>>
>>     $ qemu-system-arm -M a369 -m 512M -nographic -kernel ~/u-boot-devel/u-boot
>>
>> Changes for v3:
>>    - Coding Style cleanup.
>>      There is still one warnning reported by checkpatch.pl,
>>      however it's too deep for me to fix it.
>>      Here is the shapshot for it:
>>      -----------------------------------------------------
>>      WARNING: do not add new typedefs
>>      #9735: FILE: include/lcd.h:258:
>>      +typedef struct vidinfo {
>>      -----------------------------------------------------
>>    - Drop bit fields from c struct.
>>    - Drop macros for wirtel()/readl(), call them directly.
>>    - Always insert a blank line between declarations and code.
>>    - Replace all the infinite wait loop with a timeout.
>>    - Add '__iomem' to all the declaration of HW register pointers.
>>    - cmd_boot.c: Make it a separate stand-alone patch.
>>    - ftspi020: Make it a separate stand-alone patch.
>>    - dma-mapping.h: Have the global data ptr declared outside functions.
>>    - dma-mapping.h: Add #if...#else...#endif to dma_free_coherent().
>>    - MMU/D-Cache: Drop static non-cached region, now we use
>>      map_physmem()/unmap_physmem() for dynamic mappings.
>>    - ftmac110: Make a correction to multi-line comment style
>>    - ftmac110: Use random MAC address while having trouble
>>      to get one from environment variables.
>>    - ftmac110: Add comments to timing control registers.
>>    - ftnandc021: Re-write this driver with ECC enabled and
>>      correct column address handling for OOB read/write,
>>      and fixing issused addressed by Scott.
>>    - a36x_config: No more static global network configurations.
>>    - a36x_config: Add a common file for the redundant configurations.
>
> I see a few:
> /* --------------------
>  * Comment
>  */

It's used in ftssp010_spi.c only, and it would be removed later.

> in various places, and I pointed it out in the net changes, but I also
> saw in the SPI block '100' being used as a timeout, rather than defined.
> Please give everything a check for magic numbers and direct numbers used
> as timeout, rather than a #define.
>

Got it, thanks

> --
> Tom



--
Best wishes,
Kuo-Jung Su

Patch

diff --git a/drivers/mtd/spi/winbond.c b/drivers/mtd/spi/winbond.c
index 2716209..2a27837 100644
--- a/drivers/mtd/spi/winbond.c
+++ b/drivers/mtd/spi/winbond.c
@@ -18,6 +18,21 @@  struct winbond_spi_flash_params {
 
 static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
 	{
+		.id			= 0x2014,
+		.nr_blocks		= 16,
+		.name			= "W25P80",
+	},
+	{
+		.id			= 0x2015,
+		.nr_blocks		= 32,
+		.name			= "W25P16",
+	},
+	{
+		.id			= 0x2016,
+		.nr_blocks		= 64,
+		.name			= "W25P32",
+	},
+	{
 		.id			= 0x3013,
 		.nr_blocks		= 8,
 		.name			= "W25X40",
@@ -104,7 +119,7 @@  struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
 	}
 
 	flash->page_size = 256;
-	flash->sector_size = 4096;
+	flash->sector_size = (idcode[1] == 0x20) ? 65536 : 4096;
 	flash->size = 4096 * 16 * params->nr_blocks;
 
 	return flash;