Skip to contentSkip to conversation

arm: add Faraday A36x SoC platform support

PATCH Superseded Kuo-Jung Su 12 participants 311 messages Mar 29, 2013 – Apr 7, 2014 Page 3 of 3

Subsystems (16)
lore
Share & tools
lore
#240 lore raw

v7 cover arm: add Faraday A36x SoC platform support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

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 + U-Boot:

1. Download the QEMU source tree

   $ git clone -b qemu-1.5.1 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-2013.07/u-boot

Changes for v7:
- Update license to use SPDX identifiers.
- cfi_flash: drop the patch to unmap_physmem(), because it's already applied.
- ftnandc021: put_unaligned() -> memcpy()
- ftnandc021: update ecc relatived function prototypes to fix compile warnnings.

Changes for v6:
- Drop ethernet driver updates for ftmac110&ftgmac100, because they are already commited.
- arch/arm/cpu/faraday/cpu.c:

     struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

- arch/arm/cpu/faraday/cmd_bootfa.c: fix compiler warnning
- arch/arm/cpu/faraday/cmd_bootfa.c: use shorter paragraph in commit message, and move the original statement into the top of source file.
- ftnandc021: update README for CONFIG_SYS_FTNANDC021_TIMING
- ftnandc021: remove illegal type-punning

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Make 'arm: dma_alloc_coherent: malloc() -> memalign()' as a separate patch
- Make 'cfi_flash: use buffer length in unmap_physmem()' as a separate patch
- Define Faraday machine type in board's config header file
- Add the rationale to the command 'bootfa'
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Chain the video:FTLCDC200 back to this patch series.
- Chain the nand:FTNANDC021 back to this patch series.
- Chain the net:FTGMAC100 & FTMAC110 back to this patch series.
- Update Faraday Firmware Image Format:
1. Drop u-boot image support to simplify the design.
Since it's not possible for the hard-wired ROM code of A360/A369 to support U-boot images. And the real bootloader for A360/A369 is actually Faraday bootcode2, rather than U-Boot.
2. Add image creation timestamp
- Update 'arch/arm/cpu/faraday/start.S' with the new design, which move relocation into 'arch/arm/lib/relocate.S'
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise IRQ & MMU design: Now the exception table would be mapped to

     0x00000000 as a small page(4KB), rather than runtime adjust after
     relocation finished.

- Revise irq:FTINTC020 design, now the irq is always enabled inside irq_install_handler().
- Revise clock management system
- Revise FTPWMTMR010 & FTTMR010 timer design:
1. Drop IRQ dependant implementation
2. Use gd->arch.timer_rate_hz for timer clock source
3. Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break down the patch series:
- Patches without hard dependency to this series are now seperate patches.
- Split up the patch into more logical changesets (i.e. interrupt & timers are now split up)
- Drop the faraday/nand.h to remove dependency to ftnandc021
- Drop the faraday/mmc.h to remove dependency to ftsdc010
- Add change logs to each part of the patch series to make patchwork be able to grab comments.

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: dma_alloc_coherent: malloc() -> memalign()
video: add Faraday FTLCDC200 LCD controller support
nand: add Faraday FTNANDC021 NAND controller support
arm: add MMU/D-Cache support for Faraday cores
arm: add Faraday processor core support
arm: add Faraday FTINTC020 interrupt controller support
arm: add Faraday FTTMR010 timer support
arm: add Faraday FTPWMTMR010 timer support
arm: add customized boot command for Faraday Images
mmc: ftsdc010_mci: clk_get_rate() -> clock_get_rate()
arm: add Faraday A360/A369 SoC platform support

 MAINTAINERS                                   |    5 +
 README                                        |   10 +
 arch/arm/cpu/faraday/Makefile                 |   42 ++
 arch/arm/cpu/faraday/a360/Makefile            |   33 ++
 arch/arm/cpu/faraday/a369/Makefile            |   34 ++
 arch/arm/cpu/faraday/a369/cmd_fa606.c         |   74 +++
 arch/arm/cpu/faraday/cmd_bootfa.c             |  267 +++++++++++
 arch/arm/cpu/faraday/config.mk                |   17 +
 arch/arm/cpu/faraday/cpu.c                    |  333 ++++++++++++++
 arch/arm/cpu/faraday/ftintc020.c              |  144 ++++++
 arch/arm/cpu/faraday/ftpwmtmr010.c            |  116 +++++
 arch/arm/cpu/faraday/fttmr010.c               |  124 +++++
 arch/arm/cpu/faraday/fwimage.h                |   35 ++
 arch/arm/cpu/faraday/fwimage2.h               |   55 +++
 arch/arm/cpu/faraday/start.S                  |  419 +++++++++++++++++
 arch/arm/cpu/u-boot.lds                       |   11 +
 arch/arm/include/asm/arch-a360/hardware.h     |   72 +++
 arch/arm/include/asm/arch-a360/pmu.h          |   83 ++++
 arch/arm/include/asm/arch-a360/scu.h          |   67 +++
 arch/arm/include/asm/arch-a369/ahbc.h         |   22 +
 arch/arm/include/asm/arch-a369/hardware.h     |   86 ++++
 arch/arm/include/asm/arch-a369/scu.h          |  212 +++++++++
 arch/arm/include/asm/arch-faraday/clock.h     |   29 ++
 arch/arm/include/asm/arch-faraday/interrupt.h |   17 +
 arch/arm/include/asm/dma-mapping.h            |   58 ++-
 arch/arm/include/asm/global_data.h            |    4 +
 arch/arm/include/asm/io.h                     |  159 ++++++-
 arch/arm/include/asm/system.h                 |    7 +-
 arch/arm/lib/cache-cp15.c                     |    9 +
 board/faraday/a360evb/Makefile                |   29 ++
 board/faraday/a360evb/board.c                 |   71 +++
 board/faraday/a360evb/clock.c                 |   71 +++
 board/faraday/a360evb/config.mk               |   17 +
 board/faraday/a360evb/lowlevel_init.S         |   16 +
 board/faraday/a369evb/Makefile                |   29 ++
 board/faraday/a369evb/board.c                 |  175 +++++++
 board/faraday/a369evb/clock.c                 |   81 ++++
 board/faraday/a369evb/config.mk               |   17 +
 board/faraday/a369evb/lowlevel_init.S         |  119 +++++
 boards.cfg                                    |    3 +
 drivers/mmc/ftsdc010_mci.c                    |    2 +-
 drivers/mtd/nand/Makefile                     |    1 +
 drivers/mtd/nand/ftnandc021.c                 |  609 +++++++++++++++++++++++++
 drivers/video/Makefile                        |    1 +
 drivers/video/ftlcdc200.c                     |  136 ++++++
 drivers/video/ftlcdc200_panel.c               |  209 +++++++++
 include/common.h                              |    5 +
 include/configs/a360.h                        |   70 +++
 include/configs/a369-common.h                 |   85 ++++
 include/configs/a369.h                        |   47 ++
 include/configs/a369_fa606te.h                |   40 ++
 include/configs/faraday-common.h              |  242 ++++++++++
 include/faraday/ftintc020.h                   |   36 ++
 include/faraday/ftlcdc200.h                   |  178 ++++++++
 include/faraday/ftnandc021.h                  |  152 ++++++
 include/faraday/ftpwmtmr010.h                 |   40 ++
 include/faraday/ftsmc020.h                    |    1 +
 include/faraday/fttmr010.h                    |   17 +
 include/lcd.h                                 |   33 ++
 59 files changed, 5062 insertions(+), 14 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.c
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 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/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/ahbc.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 arch/arm/include/asm/arch-faraday/clock.h
 create mode 100644 arch/arm/include/asm/arch-faraday/interrupt.h
 create mode 100644 board/faraday/a360evb/Makefile
 create mode 100644 board/faraday/a360evb/board.c
 create mode 100644 board/faraday/a360evb/clock.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/clock.c
 create mode 100644 board/faraday/a369evb/config.mk
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 drivers/mtd/nand/ftnandc021.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/faraday-common.h
 create mode 100644 include/faraday/ftintc020.h
 create mode 100644 include/faraday/ftlcdc200.h
 create mode 100644 include/faraday/ftnandc021.h
 create mode 100644 include/faraday/ftpwmtmr010.h

--
1.7.9.5

#241 lore raw

PATCH v7 1/11 arm: dma_alloc_coherent: malloc() -> memalign()

From: Kuo-Jung Su <[email protected]>

Even though the MMU/D-cache is off, some DMA engines still expect strict address alignment.

For example, the incoming Faraday FTMAC110 & FTGMAC100 ethernet controllers expect the tx/rx descriptors should always be aligned to 16-bytes boundary.

CC Albert ARIBAUD <[email protected]>

---
Changes for v6, v7:
- Nothing updates

Changes for v5:
- Initial commit, which is separated from "arm: add MMU/D-Cache support for Faraday cores"

 arch/arm/include/asm/dma-mapping.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/dma-mapping.h +1 -1
index 009863b..55a4e26 100644
@@ -16,7 +16,7 @@ enum dma_data_direction {
 
 static void *dma_alloc_coherent(size_t len, unsigned long *handle)
 {
-	*handle = (unsigned long)malloc(len);
+	*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
 	return (void *)*handle;
 }
 

--
1.7.9.5

#242 lore raw

PATCH v7 1/11 arm: dma_alloc_coherent: malloc() -> memalign()

Hi Kuo-Jung,

Quoted 36 lines · Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Even though the MMU/D-cache is off, some DMA engines still expect strict address alignment.

For example, the incoming Faraday FTMAC110 & FTGMAC100 ethernet controllers expect the tx/rx descriptors should always be aligned to 16-bytes boundary.

CC Albert ARIBAUD <[email protected]>

---
Changes for v6, v7:
- Nothing updates

Changes for v5:
- Initial commit, which is separated from "arm: add MMU/D-Cache support for Faraday cores"

 arch/arm/include/asm/dma-mapping.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/dma-mapping.h +1 -2
index 009863b..55a4e26 100644
@@ -16,7 +16,7 @@ enum dma_data_direction {
 
 static void *dma_alloc_coherent(size_t len, unsigned long *handle)
 {
-	*handle = (unsigned long)malloc(len);
+	*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
 	return (void *)*handle;
 }
 
--
Quoted 2 lines

1.7.9.5

Applied to u-boot-arm/master, thanks!

Amicalement,

Signature · 1 line
Albert.
#243 lore raw

PATCH v7 2/11 video: add Faraday FTLCDC200 LCD controller support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTLCDC200 Color LCD controller performs translation of pixel-coded data into the required formats and timings to drive a variety of single/dual mono and color LCDs.

Depending on the LCD type and mode, the unpacked data can represent:
1. an actual true display gray or color value
2. an address to a 256 x 16 bit wide palette RAM gray or color value.

The FTLCDC200 generates 4 individual interrupts for:
1. DMA FIFO underflow
2. base address update
3. vertical status
4. bus error.

There is also a single combined interrupt that is raised when any of the individual interrupts become active.

CC Albert Aribaud <[email protected]>
CC Anatolij Gustschin <[email protected]>

---
Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Coding Style cleanup:

     struct chip_regs __iomem *regs -> struct chip_regs *regs

- Chain it back to Faraday A360/A369 patch series, because Faraday A369 depends on the header file of this patch for I2C work-around.(Enable I2C clock to prevent I2C bus hangs)

Changes for v4:
- Nothing updates

Changes for v3:
- Nothing updates

Changes for v2:
- Make it a separate patch, rather then a part of Faraday A36x patch series

 drivers/video/Makefile          |    1 +
 drivers/video/ftlcdc200.c       |  136 +++++++++++++++++++++++++
 drivers/video/ftlcdc200_panel.c |  209 +++++++++++++++++++++++++++++++++++++++
 include/faraday/ftlcdc200.h     |  178 +++++++++++++++++++++++++++++++++
 include/lcd.h                   |   33 +++++++
 5 files changed, 557 insertions(+)
 create mode 100644 drivers/video/ftlcdc200.c
 create mode 100644 drivers/video/ftlcdc200_panel.c
 create mode 100644 include/faraday/ftlcdc200.h
drivers/video/Makefile +1 -0
index f1fb26c..873ee26 100644
@@ -19,6 +19,7 @@ COBJS-$(CONFIG_EXYNOS_MIPI_DSIM) += exynos_mipi_dsi.o exynos_mipi_dsi_common.o \
 				exynos_mipi_dsi_lowlevel.o
 COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
+COBJS-$(CONFIG_FTLCDC200) += ftlcdc200.o ftlcdc200_panel.o
 COBJS-$(CONFIG_MPC8XX_LCD) += mpc8xx_lcd.o
 COBJS-$(CONFIG_PXA_LCD) += pxa_lcd.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
drivers/video/ftlcdc200.c new file +136 -0

136 lines not on this page · raw message

drivers/video/ftlcdc200_panel.c new file +209 -0

209 lines not on this page · raw message

include/faraday/ftlcdc200.h new file +178 -0

178 lines not on this page · raw message

include/lcd.h +33 -0
index b54255a..37dbc79 100644
@@ -237,6 +237,39 @@ typedef struct vidinfo {
 
 void init_panel_info(vidinfo_t *vid);
 
+#elif defined(CONFIG_FTLCDC200)
+
+typedef struct vidinfo {
+	ushort	vl_col;		/* Number of columns (i.e. 800) */
+	ushort	vl_row;		/* Number of rows (i.e. 600) */
+
+	u_char	vl_bpix;	/* Bits per pixel, 0 = 1, 1 = 2 ... 4 = 16 */
+
+	/* Timing Parameters */
+	u_char	vl_fps;		/* Frame per second */
+
+	u_char	vl_hsw;
+	u_char	vl_hbp;
+	u_char	vl_hfp;
+
+	u_char	vl_vsw;
+	u_char	vl_vbp;
+	u_char	vl_vfp;
+
+	/* Pre-defined FTLCDC200 register values */
+	u_long	vl_enable;	/* LCDEnable */
+	u_long	vl_pixel;	/* PanelPixel */
+	u_long	vl_polarity;/* Polarity */
+	u_long	vl_serial;	/* SerialPanelPixel */
+	u_long	vl_ccir656;	/* CCIR656 */
+
+	/* Panel name */
+	char	*vl_name;
+
+	ushort	*cmap;		/* Pointer to the colormap */
+	void	*priv;		/* Pointer to driver-specific data */
+} vidinfo_t;
+
 #else
 
 typedef struct vidinfo {

--
1.7.9.5

#244 lore raw

PATCH v7 2/11 video: add Faraday FTLCDC200 LCD controller support

Quoted 46 lines · On Mon, 29 Jul 2013 13:51:44 +0800 Kuo-Jung Su <[email protected]> wrote:

From: Kuo-Jung Su <[email protected]>

Faraday FTLCDC200 Color LCD controller performs translation of pixel-coded data into the required formats and timings to drive a variety of single/dual mono and color LCDs.

Depending on the LCD type and mode, the unpacked data can represent:
1. an actual true display gray or color value
2. an address to a 256 x 16 bit wide palette RAM gray or color value.

The FTLCDC200 generates 4 individual interrupts for:
1. DMA FIFO underflow
2. base address update
3. vertical status
4. bus error.

There is also a single combined interrupt that is raised when any of the individual interrupts become active.

CC Albert Aribaud <[email protected]>
CC Anatolij Gustschin <[email protected]>

---
Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Coding Style cleanup:

     struct chip_regs __iomem *regs -> struct chip_regs *regs

- Chain it back to Faraday A360/A369 patch series, because Faraday A369 depends on the header file of this patch for I2C work-around.(Enable I2C clock to prevent I2C bus hangs)

Changes for v4:
- Nothing updates

Changes for v3:
- Nothing updates

Changes for v2:
- Make it a separate patch, rather then a part of Faraday A36x patch series

Quoted 9 lines
 drivers/video/Makefile          |    1 +
 drivers/video/ftlcdc200.c       |  136 +++++++++++++++++++++++++
 drivers/video/ftlcdc200_panel.c |  209 +++++++++++++++++++++++++++++++++++++++
 include/faraday/ftlcdc200.h     |  178 +++++++++++++++++++++++++++++++++
 include/lcd.h                   |   33 +++++++
 5 files changed, 557 insertions(+)
 create mode 100644 drivers/video/ftlcdc200.c
 create mode 100644 drivers/video/ftlcdc200_panel.c
 create mode 100644 include/faraday/ftlcdc200.h

Thanks,

Anatolij

#245 lore raw

PATCH v7 3/11 nand: add Faraday FTNANDC021 NAND controller support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTNANDC021 is an integrated NAND flash controller. It use a build-in command table to abstract the underlying NAND flash control logic.

For example:

Issuing a command 0x10 to FTNANDC021 would result in a page write + a read status operation.

CC Albert ARIBAUD <[email protected]>
CC Scott Wood <[email protected]>

---
Changes for v7:
- ftnandc021.[ch]: Update license to use SPDX identifiers.
- ftnandc021.c: put_unaligned() -> memcpy()
- ftnandc021.c: update ecc relatived function prototypes to fix compile warnnings.

Changes for v6:
- Update README for CONFIG_SYS_FTNANDC021_TIMING
- Remove illegal type-punning by introducing put_unaligned() & get_unaligned().

Changes for v5 (Part of A360/A369 patch series):
- Coding Style cleanup:

     struct chip_regs __iomem *regs -> struct chip_regs *regs

- For there is a strong dependancy between this and A360/A369 patch series, it had been chained back to A360/A369 patch series.
- The latest nand_base requires the ecc.strength to be set properlly, so this patch adds ecc.strength setting accroding to ECC algorithm.

Changes for v5 (Standalone):
- Update README for the description of CONFIG_SYS_FTNANDC021_TIMING.
- Drop redundant white space. (i.e. if (mtd->writesize >= ' '4096))

Changes for v4:
- Make it a separate patch, rather then a part of Faraday A36x patch series
- Drop the faraday/nand.h to remove dependency to Faraday A36x patch series.
- CONFIG_SYS_NAND_TIMING -> CONFIG_SYS_FTNANDC021_TIMING
- Remove non-ECC code.
- Implement private hwecc read/write_page functions to get rid of .eccpos & .eccbytes.
- Use macro constants for timeout control

Changes for v3:
- Coding Style cleanup.
- 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.
- Re-write this driver with ECC enabled and correct column address handling for OOB read/write,
- Fix issuses addressed by Scott.

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().

 README                        |   10 +
 drivers/mtd/nand/Makefile     |    1 +
 drivers/mtd/nand/ftnandc021.c |  609 +++++++++++++++++++++++++++++++++++++++++
 include/faraday/ftnandc021.h  |  152 ++++++++++
 4 files changed, 772 insertions(+)
 create mode 100644 drivers/mtd/nand/ftnandc021.c
 create mode 100644 include/faraday/ftnandc021.h
README +10 -0
index a5c3e8d..f4b0dbe 100644
@@ -4076,6 +4076,16 @@ Low Level (hardware related) configuration options:
 		- drivers/mtd/nand/ndfc.c
 		- drivers/mtd/nand/mxc_nand.c
 
+- CONFIG_SYS_FTNANDC021_TIMING
+		This option specifies an array of customized timing parameters
+		for Faraday FTNANDC021 NAND flash controller.
+		e.g.
+		#define CONFIG_SYS_FTNANDC021_TIMING \
+			{ CONFIG_NAND_K9F4G08U0B_AC1, CONFIG_NAND_K9F4G08U0B_AC2 }
+		where CONFIG_NAND_K9F4G08U0B_AC[1/2] are the optimized AC
+		timing parameters for register AC_TIMING1 and AC_TIMING2 which
+		control the timing for CLE, ALE, WE and RE signals.
+
 - CONFIG_SYS_NDFC_EBC0_CFG
 		Sets the EBC0_CFG register for the NDFC. If not defined
 		a default value will be used.
drivers/mtd/nand/Makefile +1 -0
index e27e0b7..ee85b8a 100644
@@ -48,6 +48,7 @@ COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 COBJS-$(CONFIG_NAND_FSMC) += fsmc_nand.o
+COBJS-$(CONFIG_NAND_FTNANDC021) += ftnandc021.o
 COBJS-$(CONFIG_NAND_JZ4740) += jz4740_nand.o
 COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
drivers/mtd/nand/ftnandc021.c new file +609 -0

609 lines not on this page · raw message

include/faraday/ftnandc021.h new file +152 -0

152 lines not on this page · raw message

--
1.7.9.5

#246 lore raw

PATCH v7 3/11 nand: add Faraday FTNANDC021 NAND controller support

Quoted 20 lines · Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTNANDC021 is an integrated NAND flash controller. It use a build-in command table to abstract the underlying NAND flash control logic.

For example:

Issuing a command 0x10 to FTNANDC021 would result in a page write + a read status operation.

CC Albert ARIBAUD <[email protected]>
CC Scott Wood <[email protected]>

---
Changes for v7:
- ftnandc021.[ch]: Update license to use SPDX identifiers.
- ftnandc021.c: put_unaligned() -> memcpy()
- ftnandc021.c: update ecc relatived function prototypes to fix compile warnnings.

[snip]

drivers/mtd/nand/ftnandc021.c line 15

Quoted 6 lines
drivers/mtd/nand/ftnandc021.c new file +6 -0
+#include <common.h>
+#include <asm/errno.h>
+#include <asm/io.h>
+#include <asm/unaligned.h>
+#include <nand.h>
+#include <malloc.h>

asm/unaligned.h can come out now that you've switched to memcpy()...

In any case:

-Scott

#247 lore raw

PATCH v7 3/11 nand: add Faraday FTNANDC021 NAND controller support

2013/7/30 Scott Wood <[email protected]>:

Quoted 35 lines · Kuo-Jung Su
Quoted 21 lines

From: Kuo-Jung Su <[email protected]>

Faraday FTNANDC021 is an integrated NAND flash controller. It use a build-in command table to abstract the underlying NAND flash control logic.

For example:

Issuing a command 0x10 to FTNANDC021 would result in a page write + a read status operation.

CC Albert ARIBAUD <[email protected]>
CC Scott Wood <[email protected]>

---
Changes for v7:
- ftnandc021.[ch]: Update license to use SPDX identifiers.
- ftnandc021.c: put_unaligned() -> memcpy()
- ftnandc021.c: update ecc relatived function prototypes to fix compile warnnings.

[snip]

drivers/mtd/nand/ftnandc021.c line 15

Quoted 7 lines
drivers/mtd/nand/ftnandc021.c new file +6 -0
+#include <common.h>
+#include <asm/errno.h>
+#include <asm/io.h>
+#include <asm/unaligned.h>
+#include <nand.h>
+#include <malloc.h>

asm/unaligned.h can come out now that you've switched to memcpy()...

Quoted 3 lines

In any case:

Got it, thanks.
I'll make a separate cosmetic patch for it. (or probably in V8)

Signature · 2 lines
Best wishes,
Kuo-Jung Su
#248 lore raw

PATCH v7 4/11 arm: add MMU/D-Cache support for Faraday cores

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

This updates the map_physmem()/unmap_physmem(), and use them to implement dma_alloc_coherent() & dma_free_coherent().

It uses 1MB section for each mapping, and thus wastes lots of address space, however this should still be good enough for tiny systems (i.e. u-boot).

CC Albert Aribaud <[email protected]>

---
Changes for v6, v7:
- Nothing updates

Changes for v5:
- Add void dram_bank_mmu_setup() into 'arch/arm/cpu/faraday/cpu.c' to override the weak function in "cache-cp15.c".
- Use small page (4KB) to map relocated exception table to 0x0000

Changes for v4:
- Coding Style cleanup.

Changes for v3:
- Coding Style cleanup.
- Always insert a blank line between declarations and code.
- dma-mapping.h: Have the global data ptr declared outside functions.
- dma-mapping.h: Add #if...#else...#endif to dma_free_coherent().
- Drop static non-cached region, now we use map_physmem()/unmap_physmem() for dynamic mappings.

Changes for v2:
- Coding Style cleanup.
- cache-cp15: Enable write buffer in write-through mode.

 arch/arm/include/asm/dma-mapping.h |   56 ++++++++++++-
 arch/arm/include/asm/global_data.h |    4 +
 arch/arm/include/asm/io.h          |  159 ++++++++++++++++++++++++++++++++++--
 arch/arm/include/asm/system.h      |    7 +-
 arch/arm/lib/cache-cp15.c          |    9 ++
 5 files changed, 223 insertions(+), 12 deletions(-)
arch/arm/include/asm/dma-mapping.h +55 -1
index 55a4e26..e066204 100644
@@ -8,22 +8,76 @@
 #ifndef __ASM_ARM_DMA_MAPPING_H
 #define __ASM_ARM_DMA_MAPPING_H
 
+#if defined(CONFIG_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+#include <asm/u-boot.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <malloc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+#endif /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
+
 enum dma_data_direction {
 	DMA_BIDIRECTIONAL	= 0,
 	DMA_TO_DEVICE		= 1,
 	DMA_FROM_DEVICE		= 2,
 };
 
-static void *dma_alloc_coherent(size_t len, unsigned long *handle)
+static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
 {
+#if defined(CONFIG_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+	void *map, *va = memalign(ARCH_DMA_MINALIGN, len);
+
+	if (va && gd->arch.cpu_mmu) {
+		invalidate_dcache_range((ulong)va, (ulong)va + len);
+		map = map_physmem((phys_addr_t)va, len, MAP_NOCACHE);
+		if (!map)
+			free(va);
+		va = map;
+	}
+
+	if (handle)
+		*handle = virt_to_phys(va);
+
+	return va;
+#else  /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
 	*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
 	return (void *)*handle;
+#endif /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
+}
+
+static inline void dma_free_coherent(void *vaddr, ulong len)
+{
+#if defined(CONFIG_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+	void *tmp = (void *)virt_to_phys(vaddr);
+	unmap_physmem(vaddr, len);
+	vaddr = tmp;
+#endif
+	free(vaddr);
 }
 
 static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
 					   enum dma_data_direction dir)
 {
+#if defined(CONFIG_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+	if (gd->arch.cpu_mmu) {
+		switch (dir) {
+		case DMA_BIDIRECTIONAL:
+		case DMA_TO_DEVICE:
+			flush_dcache_range((ulong)vaddr,
+				(ulong)vaddr + len);
+			break;
+
+		case DMA_FROM_DEVICE:
+			invalidate_dcache_range((ulong)vaddr,
+				(ulong)vaddr + len);
+			break;
+		}
+	}
+	return virt_to_phys((void *)vaddr);
+#else  /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
 	return (unsigned long)vaddr;
+#endif /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
 }
 
 static inline void dma_unmap_single(volatile void *vaddr, size_t len,
arch/arm/include/asm/global_data.h +4 -0
index 79a9597..587ecbc 100644
@@ -26,6 +26,10 @@ struct arch_global_data {
 	unsigned long	pllb_rate_hz;
 	unsigned long	at91_pllb_usb_init;
 #endif
+#ifdef CONFIG_FARADAY
+	unsigned long   cpu_id;
+	unsigned long   cpu_mmu;	/* has mmu */
+#endif
 	/* "static data" needed by most of timer.c on ARM platforms */
 	unsigned long timer_rate_hz;
 	unsigned long tbu;
arch/arm/include/asm/io.h +151 -8

187 lines not on this page · raw message

arch/arm/include/asm/system.h +4 -3
index 760345f..050b707 100644
@@ -97,9 +97,10 @@ static inline void set_dacr(unsigned int val)
 
 /* options available for data cache on each page */
 enum dcache_option {
-	DCACHE_OFF = 0x12,
-	DCACHE_WRITETHROUGH = 0x1a,
-	DCACHE_WRITEBACK = 0x1e,
+	DCACHE_OFF = 0x12,          /* non-cached + non-buffered */
+	DCACHE_WRITECOMBINE = 0x16, /* non-cached + buffered */
+	DCACHE_WRITETHROUGH = 0x1a, /* cached + non-buffered */
+	DCACHE_WRITEBACK = 0x1e,    /* cached + buffered */
 };
 
 /* Size of an MMU section */
arch/arm/lib/cache-cp15.c +9 -0
index 8642010..3259a33 100644
@@ -110,6 +110,10 @@ static inline void mmu_setup(void)
 
 	/* and enable the mmu */
 	reg = get_cr();	/* get control reg. */
+#ifdef CONFIG_FARADAY
+	reg |= CR_W;	/* enable write buffer */
+	reg |= CR_Z;	/* enable branch prediction */
+#endif
 	cp_delay();
 	set_cr(reg | CR_M);
 }
@@ -124,6 +128,11 @@ static void cache_enable(uint32_t cache_bit)
 {
 	uint32_t reg;
 
+#ifdef CONFIG_FARADAY
+	if (!gd->arch.cpu_mmu && (cache_bit == CR_C))
+		return;
+#endif
+
 	/* The data cache is not active unless the mmu is enabled too */
 	if ((cache_bit == CR_C) && !mmu_enabled())
 		mmu_setup();

--
1.7.9.5

#249 lore raw

PATCH v7 5/11 arm: add Faraday processor core support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

This adds i/d-cache control, mmu setup & bootstrap code for Faraday cores.

CC Albert Aribaud <[email protected]>

---
Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Initial commit which is separated from
"arm: add Faraday common utilities"

 arch/arm/cpu/faraday/Makefile  |   39 ++++
 arch/arm/cpu/faraday/config.mk |   17 ++
 arch/arm/cpu/faraday/cpu.c     |  333 +++++++++++++++++++++++++++++++
 arch/arm/cpu/faraday/start.S   |  419 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 808 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 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/start.S
arch/arm/cpu/faraday/Makefile new file +39 -0
new file mode 100644
index 0000000..acc09eb
@@ -0,0 +1,39 @@
+#
+# (C) Copyright 2013 Faraday Technology
+# Dante Su <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(CPU).o
+
+src-y  := cpu.o
+
+START	= start.o
+COBJS	= $(src-y)
+
+ifdef	CONFIG_SPL_BUILD
+ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
+START	:=
+endif
+endif
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(START) $(LIB)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/arm/cpu/faraday/config.mk new file +17 -0
new file mode 100644
index 0000000..eed9c81
@@ -0,0 +1,17 @@
+#
+# (C) Copyright 2013 Faraday Technology
+# Dante Su <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/faraday/cpu.c new file +333 -0

333 lines not on this page · raw message

arch/arm/cpu/faraday/start.S new file +419 -0

419 lines not on this page · raw message

--
1.7.9.5

#250 lore raw

PATCH v7 6/11 arm: add Faraday FTINTC020 interrupt controller support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

CC Albert Aribaud <[email protected]>

---
Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Coding Style cleanup.
- Now the irq is always enabled inside irq_install_handler().

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile    |    1 +
 arch/arm/cpu/faraday/ftintc020.c |  144 ++++++++++++++++++++++++++++++++++++++
 include/common.h                 |    3 +
 include/faraday/ftintc020.h      |   36 ++++++++++
 4 files changed, 184 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftintc020.c
 create mode 100644 include/faraday/ftintc020.h
arch/arm/cpu/faraday/Makefile +1 -0
index acc09eb..6302a1d 100644
@@ -10,6 +10,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(CPU).o
 
 src-y  := cpu.o
+src-$(CONFIG_FTINTC020)   += ftintc020.o
 
 START	= start.o
 COBJS	= $(src-y)
arch/arm/cpu/faraday/ftintc020.c new file +144 -0

144 lines not on this page · raw message

include/common.h +3 -0
index 8addf43..dbebecf 100644
@@ -94,6 +94,9 @@ typedef volatile unsigned char	vu_char;
 #ifdef CONFIG_SOC_DA8XX
 #include <asm/arch/hardware.h>
 #endif
+#ifdef CONFIG_FARADAY
+#include <asm/arch-faraday/interrupt.h>
+#endif
 
 #include <part.h>
 #include <flash.h>
include/faraday/ftintc020.h new file +36 -0
new file mode 100644
index 0000000..1afeb7c
@@ -0,0 +1,36 @@
+/*
+ * arch/arm/cpu/faraday/ftintc020.h
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef ARCH_ARM_CPU_FARADAY_FTINTC020_H
+#define ARCH_ARM_CPU_FARADAY_FTINTC020_H
+
+struct ftintc020_pic_regs {
+	uint32_t src; /* source register */
+	uint32_t ena; /* enable register */
+	uint32_t scr; /* status clear register */
+	uint32_t tmr; /* trigger mode register */
+	uint32_t tlr; /* trigger level register */
+	uint32_t sr;  /* status register */
+	uint32_t rsvd[2];
+};
+
+struct ftintc020_regs {
+	/* IRQ/FIQ:  0 ~ 31 */
+	struct ftintc020_pic_regs irq32; /* 0x00 - 0x1C: IRQ 0 ~ 31 */
+	struct ftintc020_pic_regs fiq32; /* 0x20 - 0x3C: FIQ 0 ~ 31 */
+	uint32_t rsvd1[4];               /* 0x40 - 0x4C: Reserved */
+	uint32_t revision;               /* 0x50: Revision Register */
+	uint32_t feature;                /* 0x54: Feature Register */
+	uint32_t rsvd2[2];               /* 0x58 - 0x5C: Reserved */
+	/* IRQ/FIQ: 32 ~ 63 */
+	struct ftintc020_pic_regs irq64; /* 0x60 - 0x7C: IRQ 32 ~ 63 */
+	struct ftintc020_pic_regs fiq64; /* 0x80 - 0x9C: FIQ 32 ~ 63 */
+};
+
+#endif

--
1.7.9.5

#251 lore raw

PATCH v7 7/11 arm: add Faraday FTTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

CC Albert Aribaud <[email protected]>

---
Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile   |    1 +
 arch/arm/cpu/faraday/fttmr010.c |  124 +++++++++++++++++++++++++++++++++++++++
 include/faraday/fttmr010.h      |   17 ++++++
 3 files changed, 142 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
arch/arm/cpu/faraday/Makefile +1 -0
index 6302a1d..df28792 100644
@@ -11,6 +11,7 @@ LIB	= $(obj)lib$(CPU).o
 
 src-y  := cpu.o
 src-$(CONFIG_FTINTC020)   += ftintc020.o
+src-$(CONFIG_FTTMR010)    += fttmr010.o
 
 START	= start.o
 COBJS	= $(src-y)
arch/arm/cpu/faraday/fttmr010.c new file +124 -0

124 lines not on this page · raw message

include/faraday/fttmr010.h +17 -0
index 2ab68d1..21ab113 100644
@@ -45,6 +45,16 @@ struct fttmr010 {
 #define FTTMR010_TM1_CLOCK	(1 << 1)
 #define FTTMR010_TM1_ENABLE	(1 << 0)
 
+#define FTTMR010_TM1_CRMASK \
+	(FTTMR010_TM1_UPDOWN | FTTMR010_TM1_OFENABLE \
+	| FTTMR010_TM1_CLOCK | FTTMR010_TM1_ENABLE)
+#define FTTMR010_TM2_CRMASK \
+	(FTTMR010_TM2_UPDOWN | FTTMR010_TM2_OFENABLE \
+	| FTTMR010_TM2_CLOCK | FTTMR010_TM2_ENABLE)
+#define FTTMR010_TM3_CRMASK \
+	(FTTMR010_TM3_UPDOWN | FTTMR010_TM3_OFENABLE \
+	| FTTMR010_TM3_CLOCK | FTTMR010_TM3_ENABLE)
+
 /*
  * Timer Interrupt State & Mask Registers
  */
@@ -58,4 +68,11 @@ struct fttmr010 {
 #define FTTMR010_TM1_MATCH2	(1 << 1)
 #define FTTMR010_TM1_MATCH1	(1 << 0)
 
+#define FTTMR010_TM1_ISRMASK \
+	(FTTMR010_TM1_OVERFLOW | FTTMR010_TM1_MATCH2 | FTTMR010_TM1_MATCH1)
+#define FTTMR010_TM2_ISRMASK \
+	(FTTMR010_TM2_OVERFLOW | FTTMR010_TM2_MATCH2 | FTTMR010_TM2_MATCH1)
+#define FTTMR010_TM3_ISRMASK \
+	(FTTMR010_TM3_OVERFLOW | FTTMR010_TM3_MATCH2 | FTTMR010_TM3_MATCH1)
+
 #endif	/* __FTTMR010_H */

--
1.7.9.5

#252 lore raw

PATCH v7 8/11 arm: add Faraday FTPWMTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

CC Albert Aribaud <[email protected]>

---
Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile      |    1 +
 arch/arm/cpu/faraday/ftpwmtmr010.c |  116 ++++++++++++++++++++++++++++++++++++
 include/faraday/ftpwmtmr010.h      |   40 +++++++++++++
 3 files changed, 157 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 create mode 100644 include/faraday/ftpwmtmr010.h
arch/arm/cpu/faraday/Makefile +1 -0
index df28792..715bb5d 100644
@@ -12,6 +12,7 @@ LIB	= $(obj)lib$(CPU).o
 src-y  := cpu.o
 src-$(CONFIG_FTINTC020)   += ftintc020.o
 src-$(CONFIG_FTTMR010)    += fttmr010.o
+src-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o
 
 START	= start.o
 COBJS	= $(src-y)
arch/arm/cpu/faraday/ftpwmtmr010.c new file +116 -0

116 lines not on this page · raw message

include/faraday/ftpwmtmr010.h new file +40 -0
new file mode 100644
index 0000000..806f4c0
@@ -0,0 +1,40 @@
+/*
+ * arch/arm/cpu/faraday/ftpwmtmr010.h
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef ARCH_ARM_CPU_FARADAY_FTPWMTMR010_H
+#define ARCH_ARM_CPU_FARADAY_FTPWMTMR010_H
+
+struct ftpwmtmr010_timer {
+	uint32_t ctrl;	/* Control */
+#define CTRL_EXTCLK			(1 << 0) /* use external clock */
+#define CTRL_START			(1 << 1) /* timer start */
+#define CTRL_UPDATE			(1 << 2) /* update timer counter */
+#define CTRL_AUTORELOAD		(1 << 4) /* auto-reload timer counter */
+#define CTRL_INTEN			(1 << 5) /* interrupt enabled */
+
+	uint32_t cntb;	/* Count buffer */
+	uint32_t cmpb;	/* Compare buffer */
+	uint32_t cnto;	/* Count observation */
+};
+
+struct ftpwmtmr010_regs {
+	/* 0x00: Interrupt status register */
+	uint32_t isr;
+
+	/* 0x04 - 0x0C: Reserved */
+	uint32_t rsvd[3];
+
+	/* 0x10 - 0x8C: timer registers */
+	struct ftpwmtmr010_timer t[8];
+
+	/* 0x90: Revision register */
+	uint32_t rev;
+};
+
+#endif

--
1.7.9.5

#253 lore raw

PATCH v7 9/11 arm: add customized boot command for Faraday Images

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

At the time of writting, none of Faraday NAND & SPI controllers supports XIP (eXecute In Place), and the 1st stage bootstrap stored in embedded ROM is not compatible to U-Boot design.

So this patch is added to support booting from Faraday Images.

CC Albert Aribaud <[email protected]>

---
Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Fix compiler warnning
- Use shorter paragraph in commit message, and move the original statement into the top of cmd_bootfa.c.

Changes for v5:
- Rename from 'arm: add Faraday firmware image utility' into 'arm: add Faraday specific boot command'
- Add missing CRC check to the command 'bootfa'.
- Add rationale to the command 'bootfa'.

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Always insert a blank line between declarations and code.

Changes for v2:
- Coding Style cleanup.

 arch/arm/cpu/faraday/Makefile     |    2 +-
 arch/arm/cpu/faraday/cmd_bootfa.c |  267 +++++++++++++++++++++++++++++++++++++
 arch/arm/cpu/faraday/fwimage.h    |   35 +++++
 arch/arm/cpu/faraday/fwimage2.h   |   55 ++++++++
 arch/arm/cpu/u-boot.lds           |   11 ++
 5 files changed, 369 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/faraday/cmd_bootfa.c
 create mode 100644 arch/arm/cpu/faraday/fwimage.h
 create mode 100644 arch/arm/cpu/faraday/fwimage2.h
arch/arm/cpu/faraday/Makefile +1 -1
index 715bb5d..289823c 100644
@@ -9,7 +9,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(CPU).o
 
-src-y  := cpu.o
+src-y  := cpu.o cmd_bootfa.o
 src-$(CONFIG_FTINTC020)   += ftintc020.o
 src-$(CONFIG_FTTMR010)    += fttmr010.o
 src-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o
arch/arm/cpu/faraday/cmd_bootfa.c new file +267 -0

267 lines not on this page · raw message

arch/arm/cpu/faraday/fwimage.h new file +35 -0
new file mode 100644
index 0000000..c01799b
@@ -0,0 +1,35 @@
+/*
+ * linux/arch/arm/plat-faraday/fwimage.h
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _ARCH_ARM_PLAT_FARADAY_FWIMAGE_H
+#define _ARCH_ARM_PLAT_FARADAY_FWIMAGE_H
+
+struct fwparam {
+	uint32_t count;
+	uint32_t version; /* ycmo100525: for firmware image version */
+	uint32_t addr[31];
+	uint32_t data[31];
+};
+
+struct fwfile {
+	char name[64];
+	uint32_t size;
+};
+
+struct fwimage {
+	uint32_t magic; /* Image Header Magic */
+	uint32_t length;/* Image Header Length */
+
+	/* 256 bytes, embedded paramters area */
+	struct fwparam param;
+
+	struct fwfile  file[1];
+};
+
+#endif /* _ARCH_ARM_PLAT_FARADAY_FWIMAGE_H */
arch/arm/cpu/faraday/fwimage2.h new file +55 -0

55 lines not on this page · raw message

arch/arm/cpu/u-boot.lds +11 -0
index 490aed2..f3ea681 100644
@@ -7,6 +7,8 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#include <config.h>
+
 OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
 OUTPUT_ARCH(arm)
 ENTRY(_start)
@@ -19,6 +21,15 @@ SECTIONS
 	{
 		*(.__image_copy_start)
 		CPUDIR/start.o (.text*)
+#ifdef CONFIG_FARADAY
+		/*
+		 * Dante Su 2012.10.09:
+		 * Reserved for the faimage v2.1.
+		 * 1. CPUDIR/start.o: It shall never be > 4KB.
+		 * 2. faimage header: It shall always be stored at 0x1000, and <= 1KB.
+		 */
+		. = 0x00001400;
+#endif
 		*(.text*)
 	}
 

--
1.7.9.5

#254 lore raw

PATCH v7 9/11 arm: add customized boot command for Faraday Images

Hi Kuo-Jung,

Quoted 6 lines · Kuo-Jung Su

+ * At the time of writting, none of Faraday NAND & SPI controllers
+ * supports XIP (eXecute In Place). So the Faraday A360/A369 SoC has
+ * to implement a 1st level bootstrap code stored in the embedded ROM
+ * inside the SoC.
+ *
+ * After power-on, the ROM code (1st level bootstrap code) would load

Quoted 8 lines

+ * the 2nd bootstrap code into SRAM without any SDRAM initialization.
+ *
+ * The 2nd bootstrap code would then initialize SDRAM and load the
+ * generic firmware (u-boot/linux) into SDRAM, and finally make
+ * a long-jump to the firmware.
+ *
+ * Which means the SPL design of U-boot would never fit to A360/A369,
+ * since it's usually not possible to alter a embedded ROM code.

Sorry, but I don't see why SPL could not run in SRAM as the 2nd bootloader in your description; SPL certainly does not try to "alter a embedded ROM". So, please rewrite the paragraph with the correct reason why SPL cannot be the 2nd bootloader, e.g., is it

- because the 2nd bootloader is actually in ROM?
- because the SRAM is too small?
- ...

In any case:

Quoted 3 lines

+ * And because both the 1st & 2nd level bootstrap code use the private
+ * Faraday Firmware Image Format, it would be better to drop U-boot
+ * image support to simplify the design.

"Drop"? Certainly not. "Introduce a new image format where U-Boot is prepended with a header defined as follow...", yes -- you can even make a case that, if SPL cannot be the 2nd bootloader, then SPL is actually "dropped" for this platform. Please rewrite.

Also: could the whole description and rationale be moved to some README.* file either arch/arm/cpu/faraday or in doc/ so that readers oof the C file can see the start of the actual code without having to scroll through hundreds of comment lines?

Amicalement,

Signature · 1 line
Albert.
#255 lore raw

PATCH v7 9/11 arm: add customized boot command for Faraday Images

2013/9/14 Albert ARIBAUD <[email protected]>:

Quoted 25 lines

Hi Kuo-Jung,

Quoted 6 lines · Kuo-Jung Su

+ * At the time of writting, none of Faraday NAND & SPI controllers
+ * supports XIP (eXecute In Place). So the Faraday A360/A369 SoC has
+ * to implement a 1st level bootstrap code stored in the embedded ROM
+ * inside the SoC.
+ *
+ * After power-on, the ROM code (1st level bootstrap code) would load

Quoted 8 lines

+ * the 2nd bootstrap code into SRAM without any SDRAM initialization.
+ *
+ * The 2nd bootstrap code would then initialize SDRAM and load the
+ * generic firmware (u-boot/linux) into SDRAM, and finally make
+ * a long-jump to the firmware.
+ *
+ * Which means the SPL design of U-boot would never fit to A360/A369,
+ * since it's usually not possible to alter a embedded ROM code.

Sorry, but I don't see why SPL could not run in SRAM as the 2nd bootloader in your description; SPL certainly does not try to "alter a embedded ROM". So, please rewrite the paragraph with the correct reason why SPL cannot be the 2nd bootloader, e.g., is it

Quoted 6 lines

- because the 2nd bootloader is actually in ROM?
- because the SRAM is too small?
- ...

In any case:

Got it, thanks.
I'll try to study the SPL again, and rewrite the paragraph.

Quoted 9 lines
Quoted 3 lines

+ * And because both the 1st & 2nd level bootstrap code use the private
+ * Faraday Firmware Image Format, it would be better to drop U-boot
+ * image support to simplify the design.

"Drop"? Certainly not. "Introduce a new image format where U-Boot is prepended with a header defined as follow...", yes -- you can even make a case that, if SPL cannot be the 2nd bootloader, then SPL is actually "dropped" for this platform. Please rewrite.

Got it, thanks

Quoted 5 lines

Also: could the whole description and rationale be moved to some README.* file either arch/arm/cpu/faraday or in doc/ so that readers oof the C file can see the start of the actual code without having to scroll through hundreds of comment lines?

Got it, thanks

Quoted 3 lines

Amicalement,
--
Albert.

Signature · 2 lines
Best wishes,
Kuo-Jung Su
#256 lore raw

PATCH v7 10/11 mmc: ftsdc010_mci: clk_get_rate() -> clock_get_rate()

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

This updates ftsdc010_mci.c for latest Faraday clock APIs.

CC Albert Aribaud <[email protected]>
CC Andy Fleming <[email protected]>

---
Changes for v6, v7:
- Nothing updates

Changes for v5:
- Initial commit

 drivers/mmc/ftsdc010_mci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/ftsdc010_mci.c +1 -1
index 7600d5c..54976b0 100644
@@ -366,7 +366,7 @@ int ftsdc010_mmc_init(int devid)
 #ifdef CONFIG_SYS_CLK_FREQ
 	chip->sclk = CONFIG_SYS_CLK_FREQ;
 #else
-	chip->sclk = clk_get_rate("SDC");
+	chip->sclk = clock_get_rate(MMC_CLK);
 #endif
 
 	mmc->voltages  = MMC_VDD_32_33 | MMC_VDD_33_34;

--
1.7.9.5

#257 lore raw

PATCH v7 11/11 arm: add Faraday A360/A369 SoC platform support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

This adds board support for the Faraday A360/A369 SoC platforms.

Working functions:
- MMU/D-cache
- SD Host controller
- USB EHCI controller
- USB Gadget controller
- Network
- NAND

CC Albert Aribaud <[email protected]>

---
Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- arch/arm/cpu/faraday/cpu.c:

     struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Define Faraday machine type in board's config header file
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise clock management system

Changes for v4:
- Coding Style cleanup.
- Break-down the interrupt, timers and common utilties.

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.
- 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().

 MAINTAINERS                                   |    5 +
 arch/arm/cpu/faraday/a360/Makefile            |   33 ++++
 arch/arm/cpu/faraday/a369/Makefile            |   34 ++++
 arch/arm/cpu/faraday/a369/cmd_fa606.c         |   74 ++++++++
 arch/arm/include/asm/arch-a360/hardware.h     |   72 ++++++++
 arch/arm/include/asm/arch-a360/pmu.h          |   83 +++++++++
 arch/arm/include/asm/arch-a360/scu.h          |   67 +++++++
 arch/arm/include/asm/arch-a369/ahbc.h         |   22 +++
 arch/arm/include/asm/arch-a369/hardware.h     |   86 +++++++++
 arch/arm/include/asm/arch-a369/scu.h          |  212 ++++++++++++++++++++++
 arch/arm/include/asm/arch-faraday/clock.h     |   29 +++
 arch/arm/include/asm/arch-faraday/interrupt.h |   17 ++
 board/faraday/a360evb/Makefile                |   29 +++
 board/faraday/a360evb/board.c                 |   71 ++++++++
 board/faraday/a360evb/clock.c                 |   71 ++++++++
 board/faraday/a360evb/config.mk               |   17 ++
 board/faraday/a360evb/lowlevel_init.S         |   16 ++
 board/faraday/a369evb/Makefile                |   29 +++
 board/faraday/a369evb/board.c                 |  175 ++++++++++++++++++
 board/faraday/a369evb/clock.c                 |   81 +++++++++
 board/faraday/a369evb/config.mk               |   17 ++
 board/faraday/a369evb/lowlevel_init.S         |  119 ++++++++++++
 boards.cfg                                    |    3 +
 include/common.h                              |    2 +
 include/configs/a360.h                        |   70 +++++++
 include/configs/a369-common.h                 |   85 +++++++++
 include/configs/a369.h                        |   47 +++++
 include/configs/a369_fa606te.h                |   40 ++++
 include/configs/faraday-common.h              |  242 +++++++++++++++++++++++++
 include/faraday/ftsmc020.h                    |    1 +
 30 files changed, 1849 insertions(+)
 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/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/ahbc.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 arch/arm/include/asm/arch-faraday/clock.h
 create mode 100644 arch/arm/include/asm/arch-faraday/interrupt.h
 create mode 100644 board/faraday/a360evb/Makefile
 create mode 100644 board/faraday/a360evb/board.c
 create mode 100644 board/faraday/a360evb/clock.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/clock.c
 create mode 100644 board/faraday/a369evb/config.mk
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 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/faraday-common.h
MAINTAINERS +5 -0
index 081cf96..c0d4417 100644
@@ -644,6 +644,11 @@ Po-Yu Chuang <[email protected]>
 
 	a320evb		FA526 (ARM920T-like) (a320 SoC)
 
+Kuo-Jung Su <[email protected]>
+
+	a360evb		FA626TE (Faraday ARMv5TE) (a360 SoC)
+	a369evb		FA626TE & FA606TE (Faraday ARMv5TE) (a369 SoC)
+
 Eric Cooper <[email protected]>
 
 	dockstar	ARM926EJS (Kirkwood SoC)
arch/arm/cpu/faraday/a360/Makefile new file +33 -0
new file mode 100644
index 0000000..aecae59
@@ -0,0 +1,33 @@
+#
+# (C) Copyright 2013 Faraday Technology
+# Dante Su <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).o
+
+obj-y   :=
+
+COBJS	:= $(obj-y)
+SOBJS	:=
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/arm/cpu/faraday/a369/Makefile new file +34 -0
new file mode 100644
index 0000000..69376c3
@@ -0,0 +1,34 @@
+#
+# (C) Copyright 2013 Faraday Technology
+# Dante Su <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).o
+
+obj-y   :=
+obj-$(CONFIG_CMD_FA606) += cmd_fa606.o
+
+COBJS	:= $(obj-y)
+SOBJS	:=
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/arm/cpu/faraday/a369/cmd_fa606.c new file +74 -0

74 lines not on this page · raw message

arch/arm/include/asm/arch-a360/hardware.h new file +72 -0

72 lines not on this page · raw message

arch/arm/include/asm/arch-a360/pmu.h new file +83 -0

83 lines not on this page · raw message

arch/arm/include/asm/arch-a360/scu.h new file +67 -0

67 lines not on this page · raw message

arch/arm/include/asm/arch-a369/ahbc.h new file +22 -0
new file mode 100644
index 0000000..30e6724
@@ -0,0 +1,22 @@
+/*
+ * arch/arm/include/asm/arch-a369/ahbc.h
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_AHBC_H
+#define __ASM_ARCH_AHBC_H
+
+struct a369ahbc_regs {
+	uint32_t slave[32];/* Slave Device Configurations */
+	uint32_t priority; /* Priority */
+	uint32_t idle_cnt; /* IDLE Counter */
+	uint32_t control;  /* Control Register */
+	uint32_t revision; /* Revision ID */
+	uint32_t cpusao;   /* CPUS (FA606TE) Address Offset */
+};
+
+#endif
arch/arm/include/asm/arch-a369/hardware.h new file +86 -0

86 lines not on this page · raw message

arch/arm/include/asm/arch-a369/scu.h new file +212 -0

212 lines not on this page · raw message

arch/arm/include/asm/arch-faraday/clock.h new file +29 -0
new file mode 100644
index 0000000..6c10415
@@ -0,0 +1,29 @@
+/*
+ * asm/arch-faraday/clock.h
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _ASM_ARCH_FARADAY_CLOCK_H
+#define _ASM_ARCH_FARADAY_CLOCK_H
+
+/* Clock identifiers */
+enum clk_id {
+	SYS_CLK,
+	AHB_CLK,
+	APB_CLK,
+	CPU_CLK,
+	I2C_CLK,
+	MMC_CLK,
+	SDC_CLK,
+	SPI_CLK,
+	SSP_CLK,
+};
+
+void  clock_init(void);
+ulong clock_get_rate(enum clk_id id);
+
+#endif	/* _ASM_ARCH_FARADAY_CLOCK_H */
arch/arm/include/asm/arch-faraday/interrupt.h new file +17 -0
new file mode 100644
index 0000000..5eb406c
@@ -0,0 +1,17 @@
+/*
+ * asm/arch-faraday/interrupt.h
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _ASM_ARCH_FARADAY_INTERRUPT_H
+#define _ASM_ARCH_FARADAY_INTERRUPT_H
+
+void irq_set_trigger(int irq, int edge, int low);
+void irq_enable(int irq);
+void irq_disable(int irq);
+
+#endif	/* _ASM_ARCH_FARADAY_INTERRUPT_H */
board/faraday/a360evb/Makefile new file +29 -0
new file mode 100644
index 0000000..233f6d3
@@ -0,0 +1,29 @@
+#
+# (C) Copyright 2013 Faraday Technology
+# Dante Su <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	:= board.o clock.o
+SOBJS	:= lowlevel_init.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/faraday/a360evb/board.c new file +71 -0

71 lines not on this page · raw message

board/faraday/a360evb/clock.c new file +71 -0

71 lines not on this page · raw message

board/faraday/a360evb/config.mk new file +17 -0
new file mode 100644
index 0000000..bbc18c8
@@ -0,0 +1,17 @@
+#
+# (C) Copyright 2013 Faraday Technology
+# Dante Su <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+#########################################################################
+
+ALL += $(obj)u-boot.img
+
+# Environment variables in NAND
+#ifeq ($(ENV),NAND)
+#PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND
+#else
+#PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH
+#endif
board/faraday/a360evb/lowlevel_init.S new file +16 -0
new file mode 100644
index 0000000..90480aa
@@ -0,0 +1,16 @@
+/*
+ * Board specific setup info
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
board/faraday/a369evb/Makefile new file +29 -0
new file mode 100644
index 0000000..233f6d3
@@ -0,0 +1,29 @@
+#
+# (C) Copyright 2013 Faraday Technology
+# Dante Su <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	:= board.o clock.o
+SOBJS	:= lowlevel_init.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/faraday/a369evb/board.c new file +175 -0

175 lines not on this page · raw message

board/faraday/a369evb/clock.c new file +81 -0

81 lines not on this page · raw message

board/faraday/a369evb/config.mk new file +17 -0
new file mode 100644
index 0000000..bbc18c8
@@ -0,0 +1,17 @@
+#
+# (C) Copyright 2013 Faraday Technology
+# Dante Su <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+#########################################################################
+
+ALL += $(obj)u-boot.img
+
+# Environment variables in NAND
+#ifeq ($(ENV),NAND)
+#PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND
+#else
+#PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH
+#endif
board/faraday/a369evb/lowlevel_init.S new file +119 -0

119 lines not on this page · raw message

boards.cfg +3 -0
index 944ed4c..ed45524 100644
@@ -72,6 +72,9 @@ mini2440                     arm         arm920t     mini2440            friendl
 VCMA9                        arm         arm920t     vcma9               mpl            s3c24x0
 smdk2410                     arm         arm920t     -                   samsung        s3c24x0
 omap1510inn                  arm         arm925t     -                   ti
+a360                         arm         faraday     a360evb             faraday        a360
+a369                         arm         faraday     a369evb             faraday        a369
+a369_fa606te                 arm         faraday     a369evb             faraday        a369
 integratorap_cm926ejs        arm         arm926ejs   integrator          armltd         -           integratorap:CM926EJ_S
 integratorcp_cm926ejs        arm         arm926ejs   integrator          armltd         -           integratorcp:CM924EJ_S
 aspenite                     arm         arm926ejs   -                   Marvell        armada100
include/common.h +2 -0
index dbebecf..ab9f0d2 100644
@@ -95,6 +95,8 @@ typedef volatile unsigned char	vu_char;
 #include <asm/arch/hardware.h>
 #endif
 #ifdef CONFIG_FARADAY
+#include <asm/arch/hardware.h>
+#include <asm/arch-faraday/clock.h>
 #include <asm/arch-faraday/interrupt.h>
 #endif
 
include/configs/a360.h new file +70 -0

70 lines not on this page · raw message

include/configs/a369-common.h new file +85 -0

85 lines not on this page · raw message

include/configs/a369.h new file +47 -0

47 lines not on this page · raw message

include/configs/a369_fa606te.h new file +40 -0
new file mode 100644
index 0000000..521f14e
@@ -0,0 +1,40 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * Support for Faraday A369(FIE3369) boards.
+ * Tested on A369 EVB2 with 512MB SDRAM and 256MB nand flash.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_A369_FA606TE_PLATFORM
+
+/* Support external AHB */
+/* #define CONFIG_SUPP_EXTAHB */
+
+/* Support USB RNDIS Ethernet */
+/* #define CONFIG_SUPP_USB_RNDIS */
+
+/* Support VGA Console */
+/* #define CONFIG_SUPP_VGA_CONSOLE */
+
+/* Support interrupt */
+/* #define CONFIG_USE_IRQ */
+
+/* Disable MMU/D-CACHE */
+#define CONFIG_SYS_DCACHE_OFF
+
+/* Disable I-CACHE */
+#define CONFIG_SYS_ICACHE_OFF
+
+/* Set interrupt controler to FTINCT020.1 */
+#define CONFIG_FTINTC020_BASE       CONFIG_FTINTC020_BASE1
+
+/* A369 common configuration */
+#include "a369-common.h"
+
+#endif
include/configs/faraday-common.h new file +242 -0

242 lines not on this page · raw message

include/faraday/ftsmc020.h +1 -0
index 54120ab..89809b6 100644
@@ -70,5 +70,6 @@ void ftsmc020_init(void);
 #define FTSMC020_TPR_WTC(x)	(((x) & 0x3) << 6)
 #define FTSMC020_TPR_AHT(x)	(((x) & 0x3) << 4)
 #define FTSMC020_TPR_TRNA(x)	(((x) & 0xf) << 0)
+#define FTSMC020_TPR_WORST	0x0f1ff3ff /* worst but safe */
 
 #endif	/* __FTSMC020_H */

--
1.7.9.5

#258 lore raw

PATCH v8 1/1 nand: add Faraday FTNANDC021 NAND controller support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTNANDC021 is an integrated NAND flash controller. It use a build-in command table to abstract the underlying NAND flash control logic.

For example:

Issuing a command 0x10 to FTNANDC021 would result in a page write + a read status operation.

CC Albert ARIBAUD <[email protected]>
CC Scott Wood <[email protected]>

---
Changes for v8:
- Add ftnandc021 spl driver
- Drop '#include <asm/unaligned.h>'
- Coding style cleanup
- Update NAND flash ecc layout
- Split from Faraday A36x patch series

Changes for v7:
- ftnandc021.[ch]: Update license to use SPDX identifiers.
- ftnandc021.c: put_unaligned() -> memcpy()
- ftnandc021.c: update ecc relatived function prototypes to fix compile warnnings.

Changes for v6:
- Update README for CONFIG_SYS_FTNANDC021_TIMING
- Remove illegal type-punning by introducing put_unaligned() & get_unaligned().

Changes for v5 (Part of A360/A369 patch series):
- Coding Style cleanup:

     struct chip_regs __iomem *regs -> struct chip_regs *regs

- For there is a strong dependancy between this and A360/A369 patch series, it had been chained back to A360/A369 patch series.
- The latest nand_base requires the ecc.strength to be set properlly, so this patch adds ecc.strength setting accroding to ECC algorithm.

Changes for v5 (Standalone):
- Update README for the description of CONFIG_SYS_FTNANDC021_TIMING.
- Drop redundant white space. (i.e. if (mtd->writesize >= ' '4096))

Changes for v4:
- Make it a separate patch, rather then a part of Faraday A36x patch series
- Drop the faraday/nand.h to remove dependency to Faraday A36x patch series.
- CONFIG_SYS_NAND_TIMING -> CONFIG_SYS_FTNANDC021_TIMING
- Remove non-ECC code.
- Implement private hwecc read/write_page functions to get rid of .eccpos & .eccbytes.
- Use macro constants for timeout control

Changes for v3:
- Coding Style cleanup.
- 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.
- Re-write this driver with ECC enabled and correct column address handling for OOB read/write.
- Fix issuses addressed by Scott.

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().

 README                            |    6 +
 drivers/mtd/nand/Makefile         |    2 +
 drivers/mtd/nand/ftnandc021.c     |  608 +++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/ftnandc021_spl.c |  203 +++++++++++++
 include/faraday/ftnandc021.h      |  151 +++++++++
 5 files changed, 970 insertions(+)
 create mode 100644 drivers/mtd/nand/ftnandc021.c
 create mode 100644 drivers/mtd/nand/ftnandc021_spl.c
 create mode 100644 include/faraday/ftnandc021.h
README +6 -0
index 5def773..a8d3039 100644
@@ -4227,6 +4227,12 @@ Low Level (hardware related) configuration options:
 		- drivers/mtd/nand/ndfc.c
 		- drivers/mtd/nand/mxc_nand.c
 
+- CONFIG_SYS_FTNANDC021_TIMING
+		This option specifies an array of customized timing parameters
+		for Faraday FTNANDC021 NAND flash controller.
+		e.g.
+		#define CONFIG_SYS_FTNANDC021_TIMING { 0x02240264, 0x42054209 }
+
 - CONFIG_SYS_NDFC_EBC0_CFG
 		Sets the EBC0_CFG register for the NDFC. If not defined
 		a default value will be used.
drivers/mtd/nand/Makefile +2 -0
index e145cd1..7e6d441 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
 obj-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 obj-$(CONFIG_NAND_FSMC) += fsmc_nand.o
+obj-$(CONFIG_NAND_FTNANDC021) += ftnandc021.o
 obj-$(CONFIG_NAND_JZ4740) += jz4740_nand.o
 obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
@@ -66,6 +67,7 @@ else  # minimal SPL drivers
 
 obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o
 obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_spl.o
+obj-$(CONFIG_NAND_FTNANDC021) += ftnandc021_spl.o
 obj-$(CONFIG_NAND_MXC) += mxc_nand_spl.o
 
 endif # drivers
drivers/mtd/nand/ftnandc021.c new file +608 -0

608 lines not on this page · raw message

drivers/mtd/nand/ftnandc021_spl.c new file +203 -0

203 lines not on this page · raw message

include/faraday/ftnandc021.h new file +151 -0

151 lines not on this page · raw message

--
1.7.9.5

#259 lore raw

PATCH v8 1/1 nand: add Faraday FTNANDC021 NAND controller support

Quoted 15 lines · Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTNANDC021 is an integrated NAND flash controller. It use a build-in command table to abstract the underlying NAND flash control logic.

For example:

Issuing a command 0x10 to FTNANDC021 would result in a page write + a read status operation.

CC Albert ARIBAUD <[email protected]>
CC Scott Wood <[email protected]>
Quoted 7 lines

---
Changes for v8:
- Add ftnandc021 spl driver
- Drop '#include <asm/unaligned.h>'
- Coding style cleanup
- Update NAND flash ecc layout
- Split from Faraday A36x patch series

Please unsplit (or just have the custodian that takes the other Faraday patches take this with the ack). My understanding is that U-Boot's dead code rules prevent me from applying this separately from a board that uses it (it also makes it hard for me to verify that it builds).

-Scott

#260 lore raw

PATCH v8 1/1 nand: add Faraday FTNANDC021 NAND controller support

Got it, thanks, and sorry for the mess I made.

I'll send out the unsplit patch after the Faraday platform patches got commited.

2014-03-04 10:17 GMT+08:00 Scott Wood <[email protected]>:

Quoted 32 lines · Kuo-Jung Su
Quoted 15 lines

From: Kuo-Jung Su <[email protected]>

Faraday FTNANDC021 is an integrated NAND flash controller. It use a build-in command table to abstract the underlying NAND flash control logic.

For example:

Issuing a command 0x10 to FTNANDC021 would result in a page write + a read status operation.

CC Albert ARIBAUD <[email protected]>
CC Scott Wood <[email protected]>
Quoted 7 lines

---
Changes for v8:
- Add ftnandc021 spl driver
- Drop '#include <asm/unaligned.h>'
- Coding style cleanup
- Update NAND flash ecc layout
- Split from Faraday A36x patch series

Please unsplit (or just have the custodian that takes the other Faraday patches take this with the ack). My understanding is that U-Boot's dead code rules prevent me from applying this separately from a board that uses it (it also makes it hard for me to verify that it builds).

-Scott

Signature · 2 lines
Best wishes,
Kuo-Jung Su
#261 lore raw

v8 cover arm: add Faraday A36x SoC platform support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

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 + U-Boot:

1. Download the QEMU source tree

   $ git clone -b qemu-1.5.1 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-2014.01/u-boot

Changes for v8:
- Revise MMU/D-cache support
- Revise Faraday SoC common configurations.
- Drop FTINTC020 interrupt controller support.
- Drop FTLCDC200 LCD controller support.
- Drop FTNANDC021 NAND flash controller support, it would be latter submitted as a standalone patch set.
- Drop proprietary Faraday SPL support, the u-boot-spl would be adapted instead. However because it depends on the FTNANDC021 patch set, so it would be submitted after the FTNANDC021 patch set get committed.

Changes for v7:
- Update license to use SPDX identifiers.
- cfi_flash: drop the patch to unmap_physmem(), because it's already applied.
- ftnandc021: put_unaligned() -> memcpy()
- ftnandc021: update ecc relatived function prototypes to fix compile warnnings.

Changes for v6:
- Drop ethernet driver updates for ftmac110&ftgmac100, because they are already commited.
- arch/arm/cpu/faraday/cpu.c:

     struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

- arch/arm/cpu/faraday/cmd_bootfa.c: fix compiler warnning
- arch/arm/cpu/faraday/cmd_bootfa.c: use shorter paragraph in commit message, and move the original statement into the top of source file.
- ftnandc021: update README for CONFIG_SYS_FTNANDC021_TIMING
- ftnandc021: remove illegal type-punning

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Make 'arm: dma_alloc_coherent: malloc() -> memalign()' as a separate patch
- Make 'cfi_flash: use buffer length in unmap_physmem()' as a separate patch
- Define Faraday machine type in board's config header file
- Add the rationale to the command 'bootfa'
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Chain the video:FTLCDC200 back to this patch series.
- Chain the nand:FTNANDC021 back to this patch series.
- Chain the net:FTGMAC100 & FTMAC110 back to this patch series.
- Update Faraday Firmware Image Format:
1. Drop u-boot image support to simplify the design.
Since it's not possible for the hard-wired ROM code of A360/A369 to support U-boot images. And the real bootloader for A360/A369 is actually Faraday bootcode2, rather than U-Boot.
2. Add image creation timestamp
- Update 'arch/arm/cpu/faraday/start.S' with the new design, which move relocation into 'arch/arm/lib/relocate.S'
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise IRQ & MMU design: Now the exception table would be mapped to

     0x00000000 as a small page(4KB), rather than runtime adjust after
     relocation finished.

- Revise irq:FTINTC020 design, now the irq is always enabled inside irq_install_handler().
- Revise clock management system
- Revise FTPWMTMR010 & FTTMR010 timer design:
1. Drop IRQ dependant implementation
2. Use gd->arch.timer_rate_hz for timer clock source
3. Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break down the patch series:
- Patches without hard dependency to this series are now seperate patches.
- Split up the patch into more logical changesets (i.e. interrupt & timers are now split up)
- Drop the faraday/nand.h to remove dependency to ftnandc021
- Drop the faraday/mmc.h to remove dependency to ftsdc010
- Add change logs to each part of the patch series to make patchwork be able to grab comments.

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 (8):
arm: global_data: prepare for Faraday SoC support
arm: make mmu_enabled() a global function
arm: add Faraday ARM cores support
arm: faraday: revise the DMA API
arm: faraday: add FTPWMTMR010 timer support
arm: faraday: add FTTMR010 timer support
arm: faraday: add A360 SoC support
arm: faraday: add A369 SoC support

 arch/arm/cpu/faraday/Makefile             |   13 +
 arch/arm/cpu/faraday/a360/Makefile        |    8 +
 arch/arm/cpu/faraday/a369/Makefile        |    8 +
 arch/arm/cpu/faraday/cache.c              |  190 ++++++++++++++
 arch/arm/cpu/faraday/config.mk            |   15 ++
 arch/arm/cpu/faraday/cpu.c                |  206 +++++++++++++++
 arch/arm/cpu/faraday/ftpwmtmr010.c        |  112 ++++++++
 arch/arm/cpu/faraday/fttmr010.c           |  123 +++++++++
 arch/arm/cpu/faraday/start.S              |  407 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-a360/hardware.h |   70 +++++
 arch/arm/include/asm/arch-a360/sysc.h     |   68 +++++
 arch/arm/include/asm/arch-a369/hardware.h |   88 +++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++
 arch/arm/include/asm/config.h             |   12 +
 arch/arm/include/asm/dma-mapping.h        |   37 +++
 arch/arm/include/asm/faraday-common.h     |   13 +
 arch/arm/include/asm/global_data.h        |    4 +
 arch/arm/include/asm/io.h                 |   19 +-
 arch/arm/lib/cache-cp15.c                 |    7 +-
 board/faraday/a360evb/Makefile            |    9 +
 board/faraday/a360evb/board.c             |   70 +++++
 board/faraday/a360evb/clock.c             |   62 +++++
 board/faraday/a360evb/lowlevel_init.S     |   15 ++
 board/faraday/a369evb/Makefile            |    9 +
 board/faraday/a369evb/board.c             |  122 +++++++++
 board/faraday/a369evb/clock.c             |   68 +++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 boards.cfg                                |    2 +
 include/common.h                          |    5 +
 include/configs/a360.h                    |   58 ++++
 include/configs/a369.h                    |  103 ++++++++
 include/configs/faraday-common.h          |  253 ++++++++++++++++++
 include/faraday/ftpwmtmr010.h             |   41 +++
 include/faraday/ftsmc020.h                |    1 +
 include/faraday/fttmr010.h                |   17 ++
 35 files changed, 2458 insertions(+), 3 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/cache.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/ftpwmtmr010.c
 create mode 100644 arch/arm/cpu/faraday/fttmr010.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/sysc.h
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 arch/arm/include/asm/faraday-common.h
 create mode 100644 board/faraday/a360evb/Makefile
 create mode 100644 board/faraday/a360evb/board.c
 create mode 100644 board/faraday/a360evb/clock.c
 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/clock.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 include/configs/a360.h
 create mode 100644 include/configs/a369.h
 create mode 100644 include/configs/faraday-common.h
 create mode 100644 include/faraday/ftpwmtmr010.h

--
1.7.9.5

#262 lore raw

PATCH v8 1/8 arm: global_data: prepare for Faraday SoC support

From: Kuo-Jung Su <[email protected]>

Add 'cpu_id' and 'has_mmu' for Faraday SoC platforms

CC Albert Aribaud <[email protected]>

---
Changes for v8:
- Initial commit

 arch/arm/include/asm/global_data.h |    4 ++++
 arch/arm/lib/cache-cp15.c          |    5 +++++
 2 files changed, 9 insertions(+)
arch/arm/include/asm/global_data.h +4 -0
index e126436..db24a16 100644
@@ -26,6 +26,10 @@ struct arch_global_data {
 	unsigned long	pllb_rate_hz;
 	unsigned long	at91_pllb_usb_init;
 #endif
+#ifdef CONFIG_SOC_FARADAY
+	unsigned long cpu_id;
+	unsigned long has_mmu;
+#endif
 	/* "static data" needed by most of timer.c on ARM platforms */
 	unsigned long timer_rate_hz;
 	unsigned long tbu;
arch/arm/lib/cache-cp15.c +5 -0
index 8642010..550cced 100644
@@ -90,6 +90,11 @@ static inline void mmu_setup(void)
 	int i;
 	u32 reg;
 
+#ifdef CONFIG_SOC_FARADAY
+	if (!gd->arch.has_mmu)
+		return;
+#endif
+
 	arm_init_before_mmu();
 	/* Set up an identity-mapping for all 4GB, rw for everyone */
 	for (i = 0; i < 4096; i++)

--
1.7.9.5

#263 lore raw

PATCH v8 2/8 arm: make mmu_enabled() a global function

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

By making mmu_enabled() a global function, we could reuse the code in other mmu/d-cache related routines.

CC Albert Aribaud <[email protected]>

---
Changes for v8:
- Initial commit

 arch/arm/lib/cache-cp15.c |    2 +-
 include/common.h          |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/lib/cache-cp15.c +1 -1
index 550cced..61264e8 100644
@@ -119,7 +119,7 @@ static inline void mmu_setup(void)
 	set_cr(reg | CR_M);
 }
 
-static int mmu_enabled(void)
+int mmu_enabled(void)
 {
 	return get_cr() & CR_M;
 }
include/common.h +1 -0
index d49c514..44c6bab 100644
@@ -549,6 +549,7 @@ void	icache_disable(void);
 int	dcache_status (void);
 void	dcache_enable (void);
 void	dcache_disable(void);
+int	mmu_enabled(void);
 void	mmu_disable(void);
 #if defined(CONFIG_ARM)
 void	relocate_code(ulong);

--
1.7.9.5

#264 lore raw

PATCH v8 3/8 arm: add Faraday ARM cores support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Here is the list of verified cores:

1. FA606TE (ARMv5TE, no mmu)
2. FA626TE (ARMv5TE)

CC Albert Aribaud <[email protected]>

---
Changes for v8:
- add arm_init_before_mmu() & mmu_page_table_flush()

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Initial commit

 arch/arm/cpu/faraday/Makefile  |   10 +
 arch/arm/cpu/faraday/cache.c   |  190 +++++++++++++++++++
 arch/arm/cpu/faraday/config.mk |   15 ++
 arch/arm/cpu/faraday/cpu.c     |  176 +++++++++++++++++
 arch/arm/cpu/faraday/start.S   |  407 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 798 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/cache.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/start.S
arch/arm/cpu/faraday/Makefile new file +10 -0
new file mode 100644
index 0000000..c859238
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y := start.o
+
+obj-y   += cpu.o cache.o
arch/arm/cpu/faraday/cache.c new file +190 -0

190 lines not on this page · raw message

arch/arm/cpu/faraday/config.mk new file +15 -0
new file mode 100644
index 0000000..f39e70b
@@ -0,0 +1,15 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_CPPFLAGS += -march=armv5te
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/faraday/cpu.c new file +176 -0

176 lines not on this page · raw message

arch/arm/cpu/faraday/start.S new file +407 -0

407 lines not on this page · raw message

--
1.7.9.5

#265 lore raw

PATCH v8 4/8 arm: faraday: revise the DMA API

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

The DMA API is revised as follow:

1. Create an un-cached shadow memory for malloc(), the un-cached shadow memory is controlled by CONFIG_CONSISTENT_DMA_START and CONFIG_CONSISTENT_DMA_END, and initialized inside arch_early_init_r().

2. The virtual address returned by dma_alloc_coherent() always points to the corresponding uncached shadow memory initialized at step 1.

3. The dma_map_single() will now invalidate/flush caches.

4. The virt_to_phys() will now calculate the physical address from the section tables.

CC Albert Aribaud <[email protected]>

---
Changes for v8:
- Revised to use a shadow uncached region for malloc().

Changes for v6, v7:
- Nothing updates

Changes for v5:
- Add void dram_bank_mmu_setup() into 'arch/arm/cpu/faraday/cpu.c' to override the weak function in "cache-cp15.c".
- Use small page (4KB) to map relocated exception table to 0x0000

Changes for v4:
- Coding Style cleanup.

Changes for v3:
- Coding Style cleanup.
- Always insert a blank line between declarations and code.
- dma-mapping.h: Have the global data ptr declared outside functions.
- dma-mapping.h: Add #if...#else...#endif to dma_free_coherent().
- Drop static non-cached region, now we use map_physmem()/unmap_physmem() for dynamic mappings.

Changes for v2:
- Coding Style cleanup.
- cache-cp15: Enable write buffer in write-through mode.

 arch/arm/cpu/faraday/cpu.c         |   30 +++++++++++++++++++++++++++++
 arch/arm/include/asm/config.h      |   12 ++++++++++++
 arch/arm/include/asm/dma-mapping.h |   37 ++++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/io.h          |   19 ++++++++++++++++--
 4 files changed, 96 insertions(+), 2 deletions(-)
arch/arm/cpu/faraday/cpu.c +30 -0
index d3c8a9e..83bc7f7 100644
@@ -101,6 +101,36 @@ int print_cpuinfo(void)
 }
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
+#ifdef CONFIG_ARCH_EARLY_INIT_R
+int	arch_early_init_r(void)
+{
+#ifndef CONFIG_SYS_DCACHE_OFF
+	uint32_t mask = ~(SZ_1M - 1);
+	uint32_t phys = mem_malloc_start & mask;
+	uint32_t stop = (mem_malloc_end + (SZ_1M - 1)) & mask;
+	uint32_t size = stop - phys;
+	uint32_t virt = CONFIG_CONSISTENT_DMA_START & mask;
+	uint32_t *sect_table = (uint32_t *)gd->arch.tlb_addr;
+
+	if (!mmu_enabled())
+		return 0;
+
+	if (size > (CONFIG_CONSISTENT_DMA_END - virt))
+		panic("malloc size is too large for dma buffer\n");
+
+	while (size > 0) {
+		sect_table[virt >> 20] = phys | (3 << 10) | DCACHE_OFF;
+		virt += SZ_1M;
+		phys += SZ_1M;
+		size -= SZ_1M;
+	}
+
+	mmu_page_table_flush(mem_malloc_start & mask, stop);
+#endif /* !CONFIG_SYS_DCACHE_OFF */
+	return 0;
+}
+#endif /* CONFIG_ARCH_EARLY_INIT_R */
+
 int cleanup_before_linux(void)
 {
 	/*
arch/arm/include/asm/config.h +12 -0
index 99b703e..295907c 100644
@@ -7,6 +7,18 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
+#if defined(CONFIG_SOC_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+#ifndef CONFIG_ARCH_EARLY_INIT_R
+#define CONFIG_ARCH_EARLY_INIT_R
+#endif
+#ifndef CONFIG_CONSISTENT_DMA_START
+#define CONFIG_CONSISTENT_DMA_START   0xff000000
+#endif
+#ifndef CONFIG_CONSISTENT_DMA_END
+#define CONFIG_CONSISTENT_DMA_END     0xfff00000
+#endif
+#endif /* CONFIG_SOC_FARADAY && !CONFIG_SYS_DCACHE_OFF */
+
 #define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 #endif
arch/arm/include/asm/dma-mapping.h +37 -0
index 55a4e26..3b76046 100644
@@ -8,6 +8,10 @@
 #ifndef __ASM_ARM_DMA_MAPPING_H
 #define __ASM_ARM_DMA_MAPPING_H
 
+#if defined(CONFIG_SOC_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+#include <malloc.h>
+#endif /* CONFIG_SOC_FARADAY && !CONFIG_SYS_DCACHE_OFF */
+
 enum dma_data_direction {
 	DMA_BIDIRECTIONAL	= 0,
 	DMA_TO_DEVICE		= 1,
@@ -16,13 +20,46 @@ enum dma_data_direction {
 
 static void *dma_alloc_coherent(size_t len, unsigned long *handle)
 {
+#if defined(CONFIG_SOC_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+	uint32_t ofs;
+	void *mem = memalign(ARCH_DMA_MINALIGN, len);
+
+	if (handle)
+		*handle = (unsigned long)mem;
+
+	if (mem && mmu_enabled()) {
+		invalidate_dcache_range((ulong)mem, (ulong)mem + len);
+		ofs = (uint32_t)mem - (mem_malloc_start & 0xfff00000);
+		mem = (void *)(CONFIG_CONSISTENT_DMA_START + ofs);
+	}
+
+	return mem;
+#else  /* CONFIG_SOC_FARADAY && !CONFIG_SYS_DCACHE_OFF */
 	*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
+#endif /* CONFIG_SOC_FARADAY && !CONFIG_SYS_DCACHE_OFF */
 	return (void *)*handle;
 }
 
 static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
 					   enum dma_data_direction dir)
 {
+#if defined(CONFIG_SOC_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+	if (mmu_enabled()) {
+		switch (dir) {
+		case DMA_BIDIRECTIONAL:
+		case DMA_TO_DEVICE:
+			flush_dcache_range((ulong)vaddr,
+				(ulong)vaddr + len);
+			break;
+
+		case DMA_FROM_DEVICE:
+			invalidate_dcache_range((ulong)vaddr,
+				(ulong)vaddr + len);
+			break;
+		}
+		return virt_to_phys((void *)vaddr);
+	}
+#endif /* CONFIG_SOC_FARADAY && !CONFIG_SYS_DCACHE_OFF */
 	return (unsigned long)vaddr;
 }
 
arch/arm/include/asm/io.h +17 -2
index 1fbc531..b55d9e1 100644
@@ -28,6 +28,9 @@
 #if 0	/* XXX###XXX */
 #include <asm/arch/hardware.h>
 #endif	/* XXX###XXX */
+#if defined(CONFIG_SOC_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+#include <common.h>
+#endif
 
 static inline void sync(void)
 {
@@ -57,9 +60,21 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
-static inline phys_addr_t virt_to_phys(void * vaddr)
+static inline phys_addr_t virt_to_phys(void *vaddr)
 {
-	return (phys_addr_t)(vaddr);
+#if defined(CONFIG_SOC_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+	DECLARE_GLOBAL_DATA_PTR;
+	u32 *sect_table = (u32 *)gd->arch.tlb_addr;
+	phys_addr_t phys = (phys_addr_t)vaddr;
+
+	if (!vaddr || !mmu_enabled())
+		return phys;
+
+	phys = sect_table[(u32)vaddr >> 20] & 0xfff00000;
+	return phys + ((phys_addr_t)vaddr & 0x000fffff);
+#else  /* CONFIG_SOC_FARADAY && !CONFIG_SYS_DCACHE_OFF */
+	return (phys_addr_t)vaddr;
+#endif /* CONFIG_SOC_FARADAY && !CONFIG_SYS_DCACHE_OFF */
 }
 
 /*

--
1.7.9.5

#266 lore raw

PATCH v8 5/8 arm: faraday: add FTPWMTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTPWMTMR010 is a simple APB device which supports both timer and pwm functions.

CC Albert Aribaud <[email protected]>

---
Changes for v8:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile      |    2 +
 arch/arm/cpu/faraday/ftpwmtmr010.c |  112 ++++++++++++++++++++++++++++++++++++
 include/faraday/ftpwmtmr010.h      |   41 +++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 create mode 100644 include/faraday/ftpwmtmr010.h
arch/arm/cpu/faraday/Makefile +2 -0
index c859238..9bcdeba 100644
@@ -8,3 +8,5 @@
 extra-y := start.o
 
 obj-y   += cpu.o cache.o
+
+obj-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o
arch/arm/cpu/faraday/ftpwmtmr010.c new file +112 -0

112 lines not on this page · raw message

include/faraday/ftpwmtmr010.h new file +41 -0

41 lines not on this page · raw message

--
1.7.9.5

#267 lore raw

PATCH v8 6/8 arm: faraday: add FTTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTTMR010 is a simple APB device which supports generic timer functions.

CC Albert Aribaud <[email protected]>

---
Changes for v8:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile   |    1 +
 arch/arm/cpu/faraday/fttmr010.c |  123 +++++++++++++++++++++++++++++++++++++++
 include/faraday/fttmr010.h      |   17 ++++++
 3 files changed, 141 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
arch/arm/cpu/faraday/Makefile +1 -0
index 9bcdeba..19c5796 100644
@@ -9,4 +9,5 @@ extra-y := start.o
 
 obj-y   += cpu.o cache.o
 
+obj-$(CONFIG_FTTMR010)    += fttmr010.o
 obj-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o
arch/arm/cpu/faraday/fttmr010.c new file +123 -0

123 lines not on this page · raw message

include/faraday/fttmr010.h +17 -0
index 2ab68d1..21ab113 100644
@@ -45,6 +45,16 @@ struct fttmr010 {
 #define FTTMR010_TM1_CLOCK	(1 << 1)
 #define FTTMR010_TM1_ENABLE	(1 << 0)
 
+#define FTTMR010_TM1_CRMASK \
+	(FTTMR010_TM1_UPDOWN | FTTMR010_TM1_OFENABLE \
+	| FTTMR010_TM1_CLOCK | FTTMR010_TM1_ENABLE)
+#define FTTMR010_TM2_CRMASK \
+	(FTTMR010_TM2_UPDOWN | FTTMR010_TM2_OFENABLE \
+	| FTTMR010_TM2_CLOCK | FTTMR010_TM2_ENABLE)
+#define FTTMR010_TM3_CRMASK \
+	(FTTMR010_TM3_UPDOWN | FTTMR010_TM3_OFENABLE \
+	| FTTMR010_TM3_CLOCK | FTTMR010_TM3_ENABLE)
+
 /*
  * Timer Interrupt State & Mask Registers
  */
@@ -58,4 +68,11 @@ struct fttmr010 {
 #define FTTMR010_TM1_MATCH2	(1 << 1)
 #define FTTMR010_TM1_MATCH1	(1 << 0)
 
+#define FTTMR010_TM1_ISRMASK \
+	(FTTMR010_TM1_OVERFLOW | FTTMR010_TM1_MATCH2 | FTTMR010_TM1_MATCH1)
+#define FTTMR010_TM2_ISRMASK \
+	(FTTMR010_TM2_OVERFLOW | FTTMR010_TM2_MATCH2 | FTTMR010_TM2_MATCH1)
+#define FTTMR010_TM3_ISRMASK \
+	(FTTMR010_TM3_OVERFLOW | FTTMR010_TM3_MATCH2 | FTTMR010_TM3_MATCH1)
+
 #endif	/* __FTTMR010_H */

--
1.7.9.5

#268 lore raw

PATCH v8 7/8 arm: faraday: add A360 SoC support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

This adds board support for the Faraday A360 SoC platform.

Working functions:
- MMU/D-cache
- SD Host controller
- USB EHCI controller
- Network
- I2C EEPROM
- UART

CC Albert Aribaud <[email protected]>

---
Changes for v8:
- Make A360 a standalong changeset.

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:

	- arch/arm/cpu/faraday/cpu.c:
	  struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Define Faraday machine type in board's config header file
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise clock management system

Changes for v4:
- Coding Style cleanup.
- Break-down the interrupt, timers and common utilties.

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.
- 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().

 arch/arm/cpu/faraday/a360/Makefile        |    8 +
 arch/arm/include/asm/arch-a360/hardware.h |   70 ++++++++
 arch/arm/include/asm/arch-a360/sysc.h     |   68 ++++++++
 arch/arm/include/asm/faraday-common.h     |   13 ++
 board/faraday/a360evb/Makefile            |    9 +
 board/faraday/a360evb/board.c             |   70 ++++++++
 board/faraday/a360evb/clock.c             |   62 +++++++
 board/faraday/a360evb/lowlevel_init.S     |   15 ++
 boards.cfg                                |    1 +
 include/common.h                          |    4 +
 include/configs/a360.h                    |   58 +++++++
 include/configs/faraday-common.h          |  253 +++++++++++++++++++++++++++++
 12 files changed, 631 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/a360/Makefile
 create mode 100644 arch/arm/include/asm/arch-a360/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a360/sysc.h
 create mode 100644 arch/arm/include/asm/faraday-common.h
 create mode 100644 board/faraday/a360evb/Makefile
 create mode 100644 board/faraday/a360evb/board.c
 create mode 100644 board/faraday/a360evb/clock.c
 create mode 100644 board/faraday/a360evb/lowlevel_init.S
 create mode 100644 include/configs/a360.h
 create mode 100644 include/configs/faraday-common.h
arch/arm/cpu/faraday/a360/Makefile new file +8 -0
new file mode 100644
index 0000000..b244f22
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y   :=
arch/arm/include/asm/arch-a360/hardware.h new file +70 -0

70 lines not on this page · raw message

arch/arm/include/asm/arch-a360/sysc.h new file +68 -0

68 lines not on this page · raw message

arch/arm/include/asm/faraday-common.h new file +13 -0
new file mode 100644
index 0000000..e8c4c83
@@ -0,0 +1,13 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _ASM_FARADAY_COMMON_H
+#define _ASM_FARADAY_COMMON_H
+
+ulong clk_get_rate(const char *id);
+
+#endif	/* _ASM_FARADAY_COMMON_H */
board/faraday/a360evb/Makefile new file +9 -0
new file mode 100644
index 0000000..42fef70
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o clock.o
+obj-y	+= lowlevel_init.o
board/faraday/a360evb/board.c new file +70 -0

70 lines not on this page · raw message

board/faraday/a360evb/clock.c new file +62 -0

62 lines not on this page · raw message

board/faraday/a360evb/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..cbc006d
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/tw/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index c602a16..304417d 100644
@@ -59,6 +59,7 @@ Active  arm         arm720t        -           armltd          integrator
 Active  arm         arm920t        -           armltd          integrator          integratorap_cm920t                  integratorap:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        -           armltd          integrator          integratorcp_cm920t                  integratorcp:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        a320        faraday         -                   a320evb                              -                                                                                                                                 Po-Yu Chuang <[email protected]>
+Active  arm         faraday        a360        faraday         a360evb             a360evb                              a360                                                                                                                              Kuo-Jung Su <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek                         at91rm9200ek                                                                                                                      Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek_ram                     at91rm9200ek:RAMBOOT                                                                                                              Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        BuS             eb_cpux9k2          eb_cpux9k2                           eb_cpux9k2                                                                                                                        Jens Scharsig <[email protected]>
include/common.h +4 -0
index 44c6bab..5dd1ea1 100644
@@ -94,6 +94,10 @@ typedef volatile unsigned char	vu_char;
 #ifdef CONFIG_SOC_DA8XX
 #include <asm/arch/hardware.h>
 #endif
+#ifdef CONFIG_SOC_FARADAY
+#include <asm/arch/hardware.h>
+#include <asm/faraday-common.h>
+#endif
 
 #include <part.h>
 #include <flash.h>
include/configs/a360.h new file +58 -0

58 lines not on this page · raw message

include/configs/faraday-common.h new file +253 -0

253 lines not on this page · raw message

--
1.7.9.5

#269 lore raw

PATCH v8 8/8 arm: faraday: add A369 SoC support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

This adds board support for the Faraday A369 SoC platform.

Working functions:
- MMU/D-cache
- SD Host controller
- USB EHCI controller
- Network
- I2C EEPROM
- UART

CC Albert Aribaud <[email protected]>

---
Changes for v8:
- Make A369 a standalong changeset.

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:

	- arch/arm/cpu/faraday/cpu.c:
	  struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Define Faraday machine type in board's config header file
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise clock management system

Changes for v4:
- Coding Style cleanup.
- Break-down the interrupt, timers and common utilties.

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.
- 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().

 arch/arm/cpu/faraday/a369/Makefile        |    8 ++
 arch/arm/include/asm/arch-a369/hardware.h |   88 ++++++++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++++++++++++++++
 board/faraday/a369evb/Makefile            |    9 ++
 board/faraday/a369evb/board.c             |  122 +++++++++++++++++
 board/faraday/a369evb/clock.c             |   68 ++++++++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 boards.cfg                                |    1 +
 include/configs/a369.h                    |  103 ++++++++++++++
 include/faraday/ftsmc020.h                |    1 +
 10 files changed, 626 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/clock.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 include/configs/a369.h
arch/arm/cpu/faraday/a369/Makefile new file +8 -0
new file mode 100644
index 0000000..1081c06
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y :=
arch/arm/include/asm/arch-a369/hardware.h new file +88 -0

88 lines not on this page · raw message

arch/arm/include/asm/arch-a369/sysc.h new file +211 -0

211 lines not on this page · raw message

board/faraday/a369evb/Makefile new file +9 -0
new file mode 100644
index 0000000..42fef70
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, [email protected].
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o clock.o
+obj-y	+= lowlevel_init.o
board/faraday/a369evb/board.c new file +122 -0

122 lines not on this page · raw message

board/faraday/a369evb/clock.c new file +68 -0

68 lines not on this page · raw message

board/faraday/a369evb/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..cbc006d
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/tw/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index 304417d..53a0133 100644
@@ -60,6 +60,7 @@ Active  arm         arm920t        -           armltd          integrator
 Active  arm         arm920t        -           armltd          integrator          integratorcp_cm920t                  integratorcp:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        a320        faraday         -                   a320evb                              -                                                                                                                                 Po-Yu Chuang <[email protected]>
 Active  arm         faraday        a360        faraday         a360evb             a360evb                              a360                                                                                                                              Kuo-Jung Su <[email protected]>
+Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek                         at91rm9200ek                                                                                                                      Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek_ram                     at91rm9200ek:RAMBOOT                                                                                                              Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        BuS             eb_cpux9k2          eb_cpux9k2                           eb_cpux9k2                                                                                                                        Jens Scharsig <[email protected]>
include/configs/a369.h new file +103 -0

103 lines not on this page · raw message

include/faraday/ftsmc020.h +1 -0
index 54120ab..485d7c2 100644
@@ -70,5 +70,6 @@ void ftsmc020_init(void);
 #define FTSMC020_TPR_WTC(x)	(((x) & 0x3) << 6)
 #define FTSMC020_TPR_AHT(x)	(((x) & 0x3) << 4)
 #define FTSMC020_TPR_TRNA(x)	(((x) & 0xf) << 0)
+#define FTSMC020_TPR_FAILSAFE	0x0f1ff3ff /* fail-safe timing */
 
 #endif	/* __FTSMC020_H */

--
1.7.9.5

#270 lore raw

v9 cover arm: add Faraday SoC platform support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

These patches introduce Faraday A369 & Virtual SoC platform support.

Here are some public documents for your reference.

http://www.faraday-tech.com/html/Product/SoCPlatform/SoCreativeIII.htm
http://www.faraday-tech.com/html/documentation/index.html

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

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

Here is quick start for QEMU + U-Boot:

1. Download the QEMU source tree

   $ git clone -b qemu-1.5.1 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-2014.01/u-boot

Changes for v9:
- Shrink the patch by dropping MMU/D-cache support, and see if we could get this patch accepted ASAP.
- Replace the out-of-date A360 EVB with Faraday Virtual Machine (FVM).
- Build 'arch_preboot_os()' only when CONFIG_CMD_BOOTM is defined.
- Add do_go_exec() to override the default behavior of 'go' command.
- Make Faraday SoC helper files & ftsmc020 standalone changesets.
- Coding style cleanup.

Changes for v8:
- Revise MMU/D-cache support
- Revise Faraday SoC common configurations.
- Drop FTINTC020 interrupt controller support.
- Drop FTLCDC200 LCD controller support.
- Drop FTNANDC021 NAND flash controller support, it would be latter submitted as a standalone patch set.
- Drop proprietary Faraday SPL support, the u-boot-spl would be adapted instead. However because it depends on the FTNANDC021 patch set, so it would be submitted after the FTNANDC021 patch set get committed.

Changes for v7:
- Update license to use SPDX identifiers.
- cfi_flash: drop the patch to unmap_physmem(), because it's already applied.
- ftnandc021: put_unaligned() -> memcpy()
- ftnandc021: update ecc relatived function prototypes to fix compile warnnings.

Changes for v6:
- Drop ethernet driver updates for ftmac110&ftgmac100, because they are already commited.
- arch/arm/cpu/faraday/cpu.c:

     struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

- arch/arm/cpu/faraday/cmd_bootfa.c: fix compiler warnning
- arch/arm/cpu/faraday/cmd_bootfa.c: use shorter paragraph in commit message, and move the original statement into the top of source file.
- ftnandc021: update README for CONFIG_SYS_FTNANDC021_TIMING
- ftnandc021: remove illegal type-punning

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Make 'arm: dma_alloc_coherent: malloc() -> memalign()' as a separate patch
- Make 'cfi_flash: use buffer length in unmap_physmem()' as a separate patch
- Define Faraday machine type in board's config header file
- Add the rationale to the command 'bootfa'
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Chain the video:FTLCDC200 back to this patch series.
- Chain the nand:FTNANDC021 back to this patch series.
- Chain the net:FTGMAC100 & FTMAC110 back to this patch series.
- Update Faraday Firmware Image Format:
1. Drop u-boot image support to simplify the design.
Since it's not possible for the hard-wired ROM code of A360/A369 to support U-boot images. And the real bootloader for A360/A369 is actually Faraday bootcode2, rather than U-Boot.
2. Add image creation timestamp
- Update 'arch/arm/cpu/faraday/start.S' with the new design, which move relocation into 'arch/arm/lib/relocate.S'
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise IRQ & MMU design: Now the exception table would be mapped to

     0x00000000 as a small page(4KB), rather than runtime adjust after
     relocation finished.

- Revise irq:FTINTC020 design, now the irq is always enabled inside irq_install_handler().
- Revise clock management system
- Revise FTPWMTMR010 & FTTMR010 timer design:
1. Drop IRQ dependant implementation
2. Use gd->arch.timer_rate_hz for timer clock source
3. Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break down the patch series:
- Patches without hard dependency to this series are now seperate patches.
- Split up the patch into more logical changesets (i.e. interrupt & timers are now split up)
- Drop the faraday/nand.h to remove dependency to ftnandc021
- Drop the faraday/mmc.h to remove dependency to ftsdc010
- Add change logs to each part of the patch series to make patchwork be able to grab comments.

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 (7):
arm: add Faraday ARMv5TE cores support
arm: add Faraday SoC helper files
arm: faraday: add FTTMR010 timer support
arm: faraday: add FTPWMTMR010 timer support
arm: faraday: ftsmc020: add a fail-safe macro constant
arm: faraday: add A369 evaluation board support
arm: faraday: add Faraday Virtual Machine support

 arch/arm/cpu/faraday/Makefile             |   13 +
 arch/arm/cpu/faraday/a369/Makefile        |    8 +
 arch/arm/cpu/faraday/cache.c              |  164 ++++++++++++
 arch/arm/cpu/faraday/config.mk            |   15 ++
 arch/arm/cpu/faraday/cpu.c                |  115 ++++++++
 arch/arm/cpu/faraday/ftpwmtmr010.c        |  112 ++++++++
 arch/arm/cpu/faraday/fttmr010.c           |  123 +++++++++
 arch/arm/cpu/faraday/fvm/Makefile         |    8 +
 arch/arm/cpu/faraday/start.S              |  407 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-a369/hardware.h |   88 +++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++
 arch/arm/include/asm/arch-fvm/hardware.h  |   76 ++++++
 arch/arm/include/asm/faraday.h            |   13 +
 board/faraday/a369evb/Makefile            |    9 +
 board/faraday/a369evb/board.c             |  122 +++++++++
 board/faraday/a369evb/clock.c             |   68 +++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 board/faraday/fvm/Makefile                |    9 +
 board/faraday/fvm/board.c                 |   60 +++++
 board/faraday/fvm/clock.c                 |   49 ++++
 board/faraday/fvm/lowlevel_init.S         |   15 ++
 boards.cfg                                |    2 +
 include/common.h                          |    3 +
 include/configs/a369.h                    |  111 ++++++++
 include/configs/faraday-common.h          |  314 ++++++++++++++++++++++
 include/configs/fvm.h                     |   61 +++++
 include/faraday/ftpwmtmr010.h             |   41 +++
 include/faraday/ftsmc020.h                |    1 +
 include/faraday/fttmr010.h                |   17 ++
 29 files changed, 2250 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/cpu/faraday/cache.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/ftpwmtmr010.c
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
 create mode 100644 arch/arm/cpu/faraday/fvm/Makefile
 create mode 100644 arch/arm/cpu/faraday/start.S
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 arch/arm/include/asm/arch-fvm/hardware.h
 create mode 100644 arch/arm/include/asm/faraday.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/clock.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 board/faraday/fvm/Makefile
 create mode 100644 board/faraday/fvm/board.c
 create mode 100644 board/faraday/fvm/clock.c
 create mode 100644 board/faraday/fvm/lowlevel_init.S
 create mode 100644 include/configs/a369.h
 create mode 100644 include/configs/faraday-common.h
 create mode 100644 include/configs/fvm.h
 create mode 100644 include/faraday/ftpwmtmr010.h

--
1.7.9.5

#271 lore raw

PATCH v9 1/7 arm: add Faraday ARMv5TE cores support

From: Kuo-Jung Su <[email protected]>

Here is the list of verified cores:

1. FA606TE (ARMv5TE, no mmu)
2. FA626TE (ARMv5TE)

CC Albert Aribaud <[email protected]>

---
Changes for v9:
- Build 'arch_preboot_os()' only when CONFIG_CMD_BOOTM is defined.
- Add do_go_exec() to override the default behavior of 'go' command.

Changes for v8:
- add arm_init_before_mmu() & mmu_page_table_flush()

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Initial commit

 arch/arm/cpu/faraday/Makefile  |   10 +
 arch/arm/cpu/faraday/cache.c   |  164 ++++++++++++++++
 arch/arm/cpu/faraday/config.mk |   15 ++
 arch/arm/cpu/faraday/cpu.c     |  115 ++++++++++++
 arch/arm/cpu/faraday/start.S   |  407 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 711 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/cache.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/start.S
arch/arm/cpu/faraday/Makefile new file +10 -0
new file mode 100644
index 0000000..c859238
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y := start.o
+
+obj-y   += cpu.o cache.o
arch/arm/cpu/faraday/cache.c new file +164 -0

164 lines not on this page · raw message

arch/arm/cpu/faraday/config.mk new file +15 -0
new file mode 100644
index 0000000..f39e70b
@@ -0,0 +1,15 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_CPPFLAGS += -march=armv5te
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/faraday/cpu.c new file +115 -0

115 lines not on this page · raw message

arch/arm/cpu/faraday/start.S new file +407 -0

407 lines not on this page · raw message

--
1.7.9.5

#272 lore raw

PATCH v9 2/7 arm: add Faraday SoC helper files

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

1. arch/arm/include/asm/faraday.h:
Faraday SoC header file

2. include/configs/faraday-common.h:
Faraday SoC common/default configurations

CC Albert Aribaud <[email protected]>

---
Changes for v9:
- Separated as a standalone changeset by first time.

 arch/arm/include/asm/faraday.h   |   13 ++
 include/common.h                 |    3 +
 include/configs/faraday-common.h |  314 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 330 insertions(+)
 create mode 100644 arch/arm/include/asm/faraday.h
 create mode 100644 include/configs/faraday-common.h
arch/arm/include/asm/faraday.h new file +13 -0
new file mode 100644
index 0000000..2b59af1
@@ -0,0 +1,13 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _ASM_FARADAY_H
+#define _ASM_FARADAY_H
+
+ulong clk_get_rate(const char *id);
+
+#endif	/* EOF */
include/common.h +3 -0
index d49c514..eaac828 100644
@@ -94,6 +94,9 @@ typedef volatile unsigned char	vu_char;
 #ifdef CONFIG_SOC_DA8XX
 #include <asm/arch/hardware.h>
 #endif
+#ifdef CONFIG_SOC_FARADAY
+#include <asm/faraday.h>
+#endif
 
 #include <part.h>
 #include <flash.h>
include/configs/faraday-common.h new file +314 -0

314 lines not on this page · raw message

--
1.7.9.5

#273 lore raw

PATCH v9 3/7 arm: faraday: add FTTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTTMR010 is a simple APB device which supports generic timer functions.

CC Albert Aribaud <[email protected]>

---
Changes for v9:
- Nothing updates

Changes for v8:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile   |    2 +
 arch/arm/cpu/faraday/fttmr010.c |  123 +++++++++++++++++++++++++++++++++++++++
 include/faraday/fttmr010.h      |   17 ++++++
 3 files changed, 142 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
arch/arm/cpu/faraday/Makefile +2 -0
index c859238..73f6934 100644
@@ -8,3 +8,5 @@
 extra-y := start.o
 
 obj-y   += cpu.o cache.o
+
+obj-$(CONFIG_FTTMR010)    += fttmr010.o
arch/arm/cpu/faraday/fttmr010.c new file +123 -0

123 lines not on this page · raw message

include/faraday/fttmr010.h +17 -0
index 2ab68d1..21ab113 100644
@@ -45,6 +45,16 @@ struct fttmr010 {
 #define FTTMR010_TM1_CLOCK	(1 << 1)
 #define FTTMR010_TM1_ENABLE	(1 << 0)
 
+#define FTTMR010_TM1_CRMASK \
+	(FTTMR010_TM1_UPDOWN | FTTMR010_TM1_OFENABLE \
+	| FTTMR010_TM1_CLOCK | FTTMR010_TM1_ENABLE)
+#define FTTMR010_TM2_CRMASK \
+	(FTTMR010_TM2_UPDOWN | FTTMR010_TM2_OFENABLE \
+	| FTTMR010_TM2_CLOCK | FTTMR010_TM2_ENABLE)
+#define FTTMR010_TM3_CRMASK \
+	(FTTMR010_TM3_UPDOWN | FTTMR010_TM3_OFENABLE \
+	| FTTMR010_TM3_CLOCK | FTTMR010_TM3_ENABLE)
+
 /*
  * Timer Interrupt State & Mask Registers
  */
@@ -58,4 +68,11 @@ struct fttmr010 {
 #define FTTMR010_TM1_MATCH2	(1 << 1)
 #define FTTMR010_TM1_MATCH1	(1 << 0)
 
+#define FTTMR010_TM1_ISRMASK \
+	(FTTMR010_TM1_OVERFLOW | FTTMR010_TM1_MATCH2 | FTTMR010_TM1_MATCH1)
+#define FTTMR010_TM2_ISRMASK \
+	(FTTMR010_TM2_OVERFLOW | FTTMR010_TM2_MATCH2 | FTTMR010_TM2_MATCH1)
+#define FTTMR010_TM3_ISRMASK \
+	(FTTMR010_TM3_OVERFLOW | FTTMR010_TM3_MATCH2 | FTTMR010_TM3_MATCH1)
+
 #endif	/* __FTTMR010_H */

--
1.7.9.5

#274 lore raw

PATCH v9 4/7 arm: faraday: add FTPWMTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTPWMTMR010 is a simple APB device which supports both timer and pwm functions.

CC Albert Aribaud <[email protected]>

---
Changes for v9:
- Nothing updates

Changes for v8:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile      |    1 +
 arch/arm/cpu/faraday/ftpwmtmr010.c |  112 ++++++++++++++++++++++++++++++++++++
 include/faraday/ftpwmtmr010.h      |   41 +++++++++++++
 3 files changed, 154 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 create mode 100644 include/faraday/ftpwmtmr010.h
arch/arm/cpu/faraday/Makefile +1 -0
index 73f6934..19c5796 100644
@@ -10,3 +10,4 @@ extra-y := start.o
 obj-y   += cpu.o cache.o
 
 obj-$(CONFIG_FTTMR010)    += fttmr010.o
+obj-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o
arch/arm/cpu/faraday/ftpwmtmr010.c new file +112 -0

112 lines not on this page · raw message

include/faraday/ftpwmtmr010.h new file +41 -0

41 lines not on this page · raw message

--
1.7.9.5

#275 lore raw

PATCH v9 5/7 arm: faraday: ftsmc020: add a fail-safe macro constant

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Add a macro constant for fail-safe timing value.

CC Albert Aribaud <[email protected]>

---
Changes for v9:
- Separated as a standalone changeset by first time.

 include/faraday/ftsmc020.h |    1 +
 1 file changed, 1 insertion(+)
include/faraday/ftsmc020.h +1 -0
index 54120ab..485d7c2 100644
@@ -70,5 +70,6 @@ void ftsmc020_init(void);
 #define FTSMC020_TPR_WTC(x)	(((x) & 0x3) << 6)
 #define FTSMC020_TPR_AHT(x)	(((x) & 0x3) << 4)
 #define FTSMC020_TPR_TRNA(x)	(((x) & 0xf) << 0)
+#define FTSMC020_TPR_FAILSAFE	0x0f1ff3ff /* fail-safe timing */
 
 #endif	/* __FTSMC020_H */

--
1.7.9.5

#276 lore raw

PATCH v9 6/7 arm: faraday: add A369 evaluation board support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

The A369 is an ARM CPU-based SoC with rich SoC features and convenient FPGA link for building fast system prototyping and volume production.

More information about this hardware can be found at:
http://www.faraday-tech.com/html/Product/SoCPlatform/SoCreativeIII.htm

CC Albert Aribaud <[email protected]>

---
Changes for v9:
- Revise the commit message.

Changes for v8:
- Make A369 a standalong changeset.

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:

	- arch/arm/cpu/faraday/cpu.c:
	  struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Define Faraday machine type in board's config header file
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise clock management system

Changes for v4:
- Coding Style cleanup.
- Break-down the interrupt, timers and common utilties.

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.
- 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().

 arch/arm/cpu/faraday/a369/Makefile        |    8 ++
 arch/arm/include/asm/arch-a369/hardware.h |   88 ++++++++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++++++++++++++++
 board/faraday/a369evb/Makefile            |    9 ++
 board/faraday/a369evb/board.c             |  122 +++++++++++++++++
 board/faraday/a369evb/clock.c             |   68 ++++++++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 boards.cfg                                |    1 +
 include/configs/a369.h                    |  111 +++++++++++++++
 9 files changed, 633 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/clock.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 include/configs/a369.h
arch/arm/cpu/faraday/a369/Makefile new file +8 -0
new file mode 100644
index 0000000..1081c06
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y :=
arch/arm/include/asm/arch-a369/hardware.h new file +88 -0

88 lines not on this page · raw message

arch/arm/include/asm/arch-a369/sysc.h new file +211 -0

211 lines not on this page · raw message

board/faraday/a369evb/Makefile new file +9 -0
new file mode 100644
index 0000000..42fef70
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, [email protected].
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o clock.o
+obj-y	+= lowlevel_init.o
board/faraday/a369evb/board.c new file +122 -0

122 lines not on this page · raw message

board/faraday/a369evb/clock.c new file +68 -0

68 lines not on this page · raw message

board/faraday/a369evb/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..2085760
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index a8336cc..a998452 100644
@@ -59,6 +59,7 @@ Active  arm         arm720t        -           armltd          integrator
 Active  arm         arm920t        -           armltd          integrator          integratorap_cm920t                  integratorap:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        -           armltd          integrator          integratorcp_cm920t                  integratorcp:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        a320        faraday         -                   a320evb                              -                                                                                                                                 Po-Yu Chuang <[email protected]>
+Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek                         at91rm9200ek                                                                                                                      Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek_ram                     at91rm9200ek:RAMBOOT                                                                                                              Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        BuS             eb_cpux9k2          eb_cpux9k2                           eb_cpux9k2                                                                                                                        Jens Scharsig <[email protected]>
include/configs/a369.h new file +111 -0

111 lines not on this page · raw message

--
1.7.9.5

#277 lore raw

PATCH v9 7/7 arm: faraday: add Faraday Virtual Machine support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday Virtual Machine (FVM) is a QEMU based emulator which is designed for early stage software development (e.g., IPL, SPL).

Please check the link bellow for details:
https://github.com/dantesu1218/qemu/blob/qemu-1.5.1/hw/arm/faraday_fvm.c

CC Albert Aribaud <[email protected]>

---
Changes for v9:
- Initial commit

 arch/arm/cpu/faraday/fvm/Makefile        |    8 ++++
 arch/arm/include/asm/arch-fvm/hardware.h |   76 ++++++++++++++++++++++++++++++
 board/faraday/fvm/Makefile               |    9 ++++
 board/faraday/fvm/board.c                |   60 +++++++++++++++++++++++
 board/faraday/fvm/clock.c                |   49 +++++++++++++++++++
 board/faraday/fvm/lowlevel_init.S        |   15 ++++++
 boards.cfg                               |    1 +
 include/configs/fvm.h                    |   61 ++++++++++++++++++++++++
 8 files changed, 279 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fvm/Makefile
 create mode 100644 arch/arm/include/asm/arch-fvm/hardware.h
 create mode 100644 board/faraday/fvm/Makefile
 create mode 100644 board/faraday/fvm/board.c
 create mode 100644 board/faraday/fvm/clock.c
 create mode 100644 board/faraday/fvm/lowlevel_init.S
 create mode 100644 include/configs/fvm.h
arch/arm/cpu/faraday/fvm/Makefile new file +8 -0
new file mode 100644
index 0000000..1081c06
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y :=
arch/arm/include/asm/arch-fvm/hardware.h new file +76 -0

76 lines not on this page · raw message

board/faraday/fvm/Makefile new file +9 -0
new file mode 100644
index 0000000..42fef70
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o clock.o
+obj-y	+= lowlevel_init.o
board/faraday/fvm/board.c new file +60 -0

60 lines not on this page · raw message

board/faraday/fvm/clock.c new file +49 -0

49 lines not on this page · raw message

board/faraday/fvm/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..cbc006d
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/tw/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index a998452..089f539 100644
@@ -60,6 +60,7 @@ Active  arm         arm920t        -           armltd          integrator
 Active  arm         arm920t        -           armltd          integrator          integratorcp_cm920t                  integratorcp:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        a320        faraday         -                   a320evb                              -                                                                                                                                 Po-Yu Chuang <[email protected]>
 Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
+Active  arm         faraday        fvm         faraday         -                   fvm                                  -                                                                                                                                 Kuo-Jung Su <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek                         at91rm9200ek                                                                                                                      Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek_ram                     at91rm9200ek:RAMBOOT                                                                                                              Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        BuS             eb_cpux9k2          eb_cpux9k2                           eb_cpux9k2                                                                                                                        Jens Scharsig <[email protected]>
include/configs/fvm.h new file +61 -0

61 lines not on this page · raw message

--
1.7.9.5

#278 lore raw

v10 cover arm: add Faraday SoC platform support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

These patches introduce Faraday A369 & Virtual SoC platform support.

Here are some public documents for your reference.

http://www.faraday-tech.com/html/Product/SoCPlatform/SoCreativeIII.htm
http://www.faraday-tech.com/html/documentation/index.html

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

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

Here is a quick start for QEMU + U-Boot:

1. Download the QEMU source tree

   $ git clone -b qemu-1.5.1 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-2014.01/u-boot

Changes for v10:
- As per Albert's request, merge patch 1, 2 and patch 5, 6
- Add missing header file for FTSDC021

Changes for v9:
- Shrink the patch by dropping MMU/D-cache support, and see if we could get this patch accepted ASAP.
- Replace the out-of-date A360 EVB with Faraday Virtual Machine (FVM).
- Build 'arch_preboot_os()' only when CONFIG_CMD_BOOTM is defined.
- Add do_go_exec() to override the default behavior of 'go' command.
- Make Faraday SoC helper files & ftsmc020 standalone changesets.
- Coding style cleanup.

Changes for v8:
- Revise MMU/D-cache support
- Revise Faraday SoC common configurations.
- Drop FTINTC020 interrupt controller support.
- Drop FTLCDC200 LCD controller support.
- Drop FTNANDC021 NAND flash controller support, it would be latter submitted as a standalone patch set.
- Drop proprietary Faraday SPL support, the u-boot-spl would be adapted instead. However because it depends on the FTNANDC021 patch set, so it would be submitted after the FTNANDC021 patch set get committed.

Changes for v7:
- Update license to use SPDX identifiers.
- cfi_flash: drop the patch to unmap_physmem(), because it's already applied.
- ftnandc021: put_unaligned() -> memcpy()
- ftnandc021: update ecc relatived function prototypes to fix compile warnnings.

Changes for v6:
- Drop ethernet driver updates for ftmac110&ftgmac100, because they are already commited.
- arch/arm/cpu/faraday/cpu.c:

     struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

- arch/arm/cpu/faraday/cmd_bootfa.c: fix compiler warnning
- arch/arm/cpu/faraday/cmd_bootfa.c: use shorter paragraph in commit message, and move the original statement into the top of source file.
- ftnandc021: update README for CONFIG_SYS_FTNANDC021_TIMING
- ftnandc021: remove illegal type-punning

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Make 'arm: dma_alloc_coherent: malloc() -> memalign()' as a separate patch
- Make 'cfi_flash: use buffer length in unmap_physmem()' as a separate patch
- Define Faraday machine type in board's config header file
- Add the rationale to the command 'bootfa'
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Chain the video:FTLCDC200 back to this patch series.
- Chain the nand:FTNANDC021 back to this patch series.
- Chain the net:FTGMAC100 & FTMAC110 back to this patch series.
- Update Faraday Firmware Image Format:
1. Drop u-boot image support to simplify the design.
Since it's not possible for the hard-wired ROM code of A360/A369 to support U-boot images. And the real bootloader for A360/A369 is actually Faraday bootcode2, rather than U-Boot.
2. Add image creation timestamp
- Update 'arch/arm/cpu/faraday/start.S' with the new design, which move relocation into 'arch/arm/lib/relocate.S'
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise IRQ & MMU design: Now the exception table would be mapped to

     0x00000000 as a small page(4KB), rather than runtime adjust after
     relocation finished.

- Revise irq:FTINTC020 design, now the irq is always enabled inside irq_install_handler().
- Revise clock management system
- Revise FTPWMTMR010 & FTTMR010 timer design:
1. Drop IRQ dependant implementation
2. Use gd->arch.timer_rate_hz for timer clock source
3. Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break down the patch series:
- Patches without hard dependency to this series are now seperate patches.
- Split up the patch into more logical changesets (i.e. interrupt & timers are now split up)
- Drop the faraday/nand.h to remove dependency to ftnandc021
- Drop the faraday/mmc.h to remove dependency to ftsdc010
- Add change logs to each part of the patch series to make patchwork be able to grab comments.

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 (6):
arm: add Faraday ARMv5TE cores support
arm: faraday: add FTTMR010 timer support
arm: faraday: add FTPWMTMR010 timer support
arm: faraday: add A369 evaluation board support
arm: faraday: add missing header file for FTSDC021
arm: faraday: add virtual machine support

 arch/arm/cpu/faraday/Makefile             |   13 +
 arch/arm/cpu/faraday/a369/Makefile        |    8 +
 arch/arm/cpu/faraday/cache.c              |  164 ++++++++++++
 arch/arm/cpu/faraday/config.mk            |   15 ++
 arch/arm/cpu/faraday/cpu.c                |  115 ++++++++
 arch/arm/cpu/faraday/ftpwmtmr010.c        |  112 ++++++++
 arch/arm/cpu/faraday/fttmr010.c           |  123 +++++++++
 arch/arm/cpu/faraday/fvm/Makefile         |    8 +
 arch/arm/cpu/faraday/start.S              |  407 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-a369/hardware.h |   88 +++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++
 arch/arm/include/asm/arch-fvm/hardware.h  |   76 ++++++
 arch/arm/include/asm/faraday.h            |   13 +
 board/faraday/a369evb/Makefile            |    9 +
 board/faraday/a369evb/board.c             |  122 +++++++++
 board/faraday/a369evb/clock.c             |   68 +++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 board/faraday/fvm/Makefile                |    9 +
 board/faraday/fvm/board.c                 |   60 +++++
 board/faraday/fvm/clock.c                 |   49 ++++
 board/faraday/fvm/lowlevel_init.S         |   15 ++
 boards.cfg                                |    2 +
 include/common.h                          |    3 +
 include/configs/a369.h                    |  111 ++++++++
 include/configs/faraday-common.h          |  314 ++++++++++++++++++++++
 include/configs/fvm.h                     |   61 +++++
 include/faraday/ftpwmtmr010.h             |   41 +++
 include/faraday/ftsdc021.h                |   13 +
 include/faraday/ftsmc020.h                |    1 +
 include/faraday/fttmr010.h                |   17 ++
 30 files changed, 2263 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/cpu/faraday/cache.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/ftpwmtmr010.c
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
 create mode 100644 arch/arm/cpu/faraday/fvm/Makefile
 create mode 100644 arch/arm/cpu/faraday/start.S
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 arch/arm/include/asm/arch-fvm/hardware.h
 create mode 100644 arch/arm/include/asm/faraday.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/clock.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 board/faraday/fvm/Makefile
 create mode 100644 board/faraday/fvm/board.c
 create mode 100644 board/faraday/fvm/clock.c
 create mode 100644 board/faraday/fvm/lowlevel_init.S
 create mode 100644 include/configs/a369.h
 create mode 100644 include/configs/faraday-common.h
 create mode 100644 include/configs/fvm.h
 create mode 100644 include/faraday/ftpwmtmr010.h
 create mode 100644 include/faraday/ftsdc021.h

--
1.7.9.5

#279 lore raw

PATCH v10 1/6 arm: add Faraday ARMv5TE cores support

From: Kuo-Jung Su <[email protected]>

Here is the list of verified cores:

1. FA606TE (ARMv5TE, no mmu)
2. FA626TE (ARMv5TE)

CC Albert Aribaud <[email protected]>

---
Changes for v10:
- Merge [arm: add Faraday SoC helper files]

Changes for v9:
- Build 'arch_preboot_os()' only when CONFIG_CMD_BOOTM is defined.
- Add do_go_exec() to override the default behavior of 'go' command.

Changes for v8:
- add arm_init_before_mmu() & mmu_page_table_flush()

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Initial commit

 arch/arm/cpu/faraday/Makefile    |   10 +
 arch/arm/cpu/faraday/cache.c     |  164 +++++++++++++++
 arch/arm/cpu/faraday/config.mk   |   15 ++
 arch/arm/cpu/faraday/cpu.c       |  115 +++++++++++
 arch/arm/cpu/faraday/start.S     |  407 ++++++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/faraday.h   |   13 ++
 include/common.h                 |    3 +
 include/configs/faraday-common.h |  314 +++++++++++++++++++++++++++++
 8 files changed, 1041 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/cache.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/start.S
 create mode 100644 arch/arm/include/asm/faraday.h
 create mode 100644 include/configs/faraday-common.h
arch/arm/cpu/faraday/Makefile new file +10 -0
new file mode 100644
index 0000000..c859238
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y := start.o
+
+obj-y   += cpu.o cache.o
arch/arm/cpu/faraday/cache.c new file +164 -0

164 lines not on this page · raw message

arch/arm/cpu/faraday/config.mk new file +15 -0
new file mode 100644
index 0000000..f39e70b
@@ -0,0 +1,15 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_CPPFLAGS += -march=armv5te
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/faraday/cpu.c new file +115 -0

115 lines not on this page · raw message

arch/arm/cpu/faraday/start.S new file +407 -0

407 lines not on this page · raw message

arch/arm/include/asm/faraday.h new file +13 -0
new file mode 100644
index 0000000..2b59af1
@@ -0,0 +1,13 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _ASM_FARADAY_H
+#define _ASM_FARADAY_H
+
+ulong clk_get_rate(const char *id);
+
+#endif	/* EOF */
include/common.h +3 -0
index ea3e5ed..faae212 100644
@@ -91,6 +91,9 @@ typedef volatile unsigned char	vu_char;
 #ifdef CONFIG_SOC_DA8XX
 #include <asm/arch/hardware.h>
 #endif
+#ifdef CONFIG_SOC_FARADAY
+#include <asm/faraday.h>
+#endif
 
 #include <part.h>
 #include <flash.h>
include/configs/faraday-common.h new file +314 -0

314 lines not on this page · raw message

--
1.7.9.5

#280 lore raw

PATCH v10 2/6 arm: faraday: add FTTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTTMR010 is a simple APB device which supports generic timer functions.

CC Albert Aribaud <[email protected]>

---
Changes for v8, v9, v10:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile   |    2 +
 arch/arm/cpu/faraday/fttmr010.c |  123 +++++++++++++++++++++++++++++++++++++++
 include/faraday/fttmr010.h      |   17 ++++++
 3 files changed, 142 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
arch/arm/cpu/faraday/Makefile +2 -0
index c859238..73f6934 100644
@@ -8,3 +8,5 @@
 extra-y := start.o
 
 obj-y   += cpu.o cache.o
+
+obj-$(CONFIG_FTTMR010)    += fttmr010.o
arch/arm/cpu/faraday/fttmr010.c new file +123 -0

123 lines not on this page · raw message

include/faraday/fttmr010.h +17 -0
index 2ab68d1..21ab113 100644
@@ -45,6 +45,16 @@ struct fttmr010 {
 #define FTTMR010_TM1_CLOCK	(1 << 1)
 #define FTTMR010_TM1_ENABLE	(1 << 0)
 
+#define FTTMR010_TM1_CRMASK \
+	(FTTMR010_TM1_UPDOWN | FTTMR010_TM1_OFENABLE \
+	| FTTMR010_TM1_CLOCK | FTTMR010_TM1_ENABLE)
+#define FTTMR010_TM2_CRMASK \
+	(FTTMR010_TM2_UPDOWN | FTTMR010_TM2_OFENABLE \
+	| FTTMR010_TM2_CLOCK | FTTMR010_TM2_ENABLE)
+#define FTTMR010_TM3_CRMASK \
+	(FTTMR010_TM3_UPDOWN | FTTMR010_TM3_OFENABLE \
+	| FTTMR010_TM3_CLOCK | FTTMR010_TM3_ENABLE)
+
 /*
  * Timer Interrupt State & Mask Registers
  */
@@ -58,4 +68,11 @@ struct fttmr010 {
 #define FTTMR010_TM1_MATCH2	(1 << 1)
 #define FTTMR010_TM1_MATCH1	(1 << 0)
 
+#define FTTMR010_TM1_ISRMASK \
+	(FTTMR010_TM1_OVERFLOW | FTTMR010_TM1_MATCH2 | FTTMR010_TM1_MATCH1)
+#define FTTMR010_TM2_ISRMASK \
+	(FTTMR010_TM2_OVERFLOW | FTTMR010_TM2_MATCH2 | FTTMR010_TM2_MATCH1)
+#define FTTMR010_TM3_ISRMASK \
+	(FTTMR010_TM3_OVERFLOW | FTTMR010_TM3_MATCH2 | FTTMR010_TM3_MATCH1)
+
 #endif	/* __FTTMR010_H */

--
1.7.9.5

#281 lore raw

PATCH v10 3/6 arm: faraday: add FTPWMTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTPWMTMR010 is a simple APB device which supports both timer and pwm functions.

CC Albert Aribaud <[email protected]>

---
Changes for v8, v9, v10:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile      |    1 +
 arch/arm/cpu/faraday/ftpwmtmr010.c |  112 ++++++++++++++++++++++++++++++++++++
 include/faraday/ftpwmtmr010.h      |   41 +++++++++++++
 3 files changed, 154 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 create mode 100644 include/faraday/ftpwmtmr010.h
arch/arm/cpu/faraday/Makefile +1 -0
index 73f6934..19c5796 100644
@@ -10,3 +10,4 @@ extra-y := start.o
 obj-y   += cpu.o cache.o
 
 obj-$(CONFIG_FTTMR010)    += fttmr010.o
+obj-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o
arch/arm/cpu/faraday/ftpwmtmr010.c new file +112 -0

112 lines not on this page · raw message

include/faraday/ftpwmtmr010.h new file +41 -0

41 lines not on this page · raw message

--
1.7.9.5

#282 lore raw

PATCH v10 4/6 arm: faraday: add A369 evaluation board support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

The A369 is an ARM CPU-based SoC with rich SoC features and convenient FPGA link for building fast system prototyping and mass production.

More information about this hardware can be found at:
http://www.faraday-tech.com/html/Product/SoCPlatform/SoCreativeIII.htm

CC Albert Aribaud <[email protected]>

---
Changes for v10:
- Merge [arm: faraday: ftsmc020: add a fail-safe macro constant]

Changes for v9:
- Revise the commit message.

Changes for v8:
- Make A369 a standalong changeset.

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:

	- arch/arm/cpu/faraday/cpu.c:
	  struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Define Faraday machine type in board's config header file
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise clock management system

Changes for v4:
- Coding Style cleanup.
- Break-down the interrupt, timers and common utilties.

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.
- 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().

 arch/arm/cpu/faraday/a369/Makefile        |    8 ++
 arch/arm/include/asm/arch-a369/hardware.h |   88 ++++++++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++++++++++++++++
 board/faraday/a369evb/Makefile            |    9 ++
 board/faraday/a369evb/board.c             |  122 +++++++++++++++++
 board/faraday/a369evb/clock.c             |   68 ++++++++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 boards.cfg                                |    1 +
 include/configs/a369.h                    |  111 +++++++++++++++
 include/faraday/ftsmc020.h                |    1 +
 10 files changed, 634 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/clock.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 include/configs/a369.h
arch/arm/cpu/faraday/a369/Makefile new file +8 -0
new file mode 100644
index 0000000..1081c06
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y :=
arch/arm/include/asm/arch-a369/hardware.h new file +88 -0

88 lines not on this page · raw message

arch/arm/include/asm/arch-a369/sysc.h new file +211 -0

211 lines not on this page · raw message

board/faraday/a369evb/Makefile new file +9 -0
new file mode 100644
index 0000000..42fef70
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, [email protected].
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o clock.o
+obj-y	+= lowlevel_init.o
board/faraday/a369evb/board.c new file +122 -0

122 lines not on this page · raw message

board/faraday/a369evb/clock.c new file +68 -0

68 lines not on this page · raw message

board/faraday/a369evb/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..2085760
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index 0e663d9..194dffe 100644
@@ -60,6 +60,7 @@ Active  arm         arm720t        -           armltd          integrator
 Active  arm         arm920t        -           armltd          integrator          integratorap_cm920t                  integratorap:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        -           armltd          integrator          integratorcp_cm920t                  integratorcp:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        a320        faraday         -                   a320evb                              -                                                                                                                                 Po-Yu Chuang <[email protected]>
+Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek                         at91rm9200ek                                                                                                                      Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek_ram                     at91rm9200ek:RAMBOOT                                                                                                              Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        BuS             eb_cpux9k2          eb_cpux9k2                           eb_cpux9k2                                                                                                                        Jens Scharsig <[email protected]>
include/configs/a369.h new file +111 -0

111 lines not on this page · raw message

include/faraday/ftsmc020.h +1 -0
index 54120ab..485d7c2 100644
@@ -70,5 +70,6 @@ void ftsmc020_init(void);
 #define FTSMC020_TPR_WTC(x)	(((x) & 0x3) << 6)
 #define FTSMC020_TPR_AHT(x)	(((x) & 0x3) << 4)
 #define FTSMC020_TPR_TRNA(x)	(((x) & 0xf) << 0)
+#define FTSMC020_TPR_FAILSAFE	0x0f1ff3ff /* fail-safe timing */
 
 #endif	/* __FTSMC020_H */

--
1.7.9.5

#283 lore raw

PATCH v10 5/6 arm: faraday: add missing header file for FTSDC021

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

For the Faraday FTSDC021 (SDHCI) controller driver source is sent out before the patches for Faraday Virtual Machine (FVM) which actually uses this chip.

The header file (ftsdc021.h) has been accidentally removed by commit: 3b98b57fa - include: delete unused header files

This patch simply rollback this removal.

CC Albert Aribaud <[email protected]>

---
Changes for v10:
- Initial commit

 include/faraday/ftsdc021.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 include/faraday/ftsdc021.h
include/faraday/ftsdc021.h new file +13 -0
new file mode 100644
index 0000000..de8e250
@@ -0,0 +1,13 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __FTSDC021_H
+#define __FTSDC021_H
+
+int ftsdc021_sdhci_init(u32 regbase);
+
+#endif /* __FTSDC021_H */

--
1.7.9.5

#284 lore raw

PATCH v10 6/6 arm: faraday: add virtual machine support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday Virtual Machine (FVM) is a QEMU based emulator which is designed for early stage software development (i.e., IPL, SPL development).

Please check the link bellow for details:
https://github.com/dantesu1218/qemu/blob/qemu-1.5.1/hw/arm/faraday_fvm.c

CC Albert Aribaud <[email protected]>

---
Changes for v10:
- Nothing updates

Changes for v9:
- Initial commit

 arch/arm/cpu/faraday/fvm/Makefile        |    8 ++++
 arch/arm/include/asm/arch-fvm/hardware.h |   76 ++++++++++++++++++++++++++++++
 board/faraday/fvm/Makefile               |    9 ++++
 board/faraday/fvm/board.c                |   60 +++++++++++++++++++++++
 board/faraday/fvm/clock.c                |   49 +++++++++++++++++++
 board/faraday/fvm/lowlevel_init.S        |   15 ++++++
 boards.cfg                               |    1 +
 include/configs/fvm.h                    |   61 ++++++++++++++++++++++++
 8 files changed, 279 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fvm/Makefile
 create mode 100644 arch/arm/include/asm/arch-fvm/hardware.h
 create mode 100644 board/faraday/fvm/Makefile
 create mode 100644 board/faraday/fvm/board.c
 create mode 100644 board/faraday/fvm/clock.c
 create mode 100644 board/faraday/fvm/lowlevel_init.S
 create mode 100644 include/configs/fvm.h
arch/arm/cpu/faraday/fvm/Makefile new file +8 -0
new file mode 100644
index 0000000..1081c06
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y :=
arch/arm/include/asm/arch-fvm/hardware.h new file +76 -0

76 lines not on this page · raw message

board/faraday/fvm/Makefile new file +9 -0
new file mode 100644
index 0000000..42fef70
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o clock.o
+obj-y	+= lowlevel_init.o
board/faraday/fvm/board.c new file +60 -0

60 lines not on this page · raw message

board/faraday/fvm/clock.c new file +49 -0

49 lines not on this page · raw message

board/faraday/fvm/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..cbc006d
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/tw/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index 194dffe..e783231 100644
@@ -61,6 +61,7 @@ Active  arm         arm920t        -           armltd          integrator
 Active  arm         arm920t        -           armltd          integrator          integratorcp_cm920t                  integratorcp:CM920T                                                                                                               Linus Walleij <[email protected]>
 Active  arm         arm920t        a320        faraday         -                   a320evb                              -                                                                                                                                 Po-Yu Chuang <[email protected]>
 Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
+Active  arm         faraday        fvm         faraday         -                   fvm                                  -                                                                                                                                 Kuo-Jung Su <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek                         at91rm9200ek                                                                                                                      Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        atmel           at91rm9200ek        at91rm9200ek_ram                     at91rm9200ek:RAMBOOT                                                                                                              Andreas Bie?mann <[email protected]>
 Active  arm         arm920t        at91        BuS             eb_cpux9k2          eb_cpux9k2                           eb_cpux9k2                                                                                                                        Jens Scharsig <[email protected]>
include/configs/fvm.h new file +61 -0

61 lines not on this page · raw message

--
1.7.9.5

#285 lore raw

v10 cover arm: add Faraday SoC platform support

In reply to Kuo-Jung Su

Hi Kuo-Jung,

Quoted 3 lines · Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

These patches introduce Faraday A369 & Virtual SoC platform support.

Except for patches 4/6 and 6/6 in which boards.cfg needed manual fixing (due to commit 3fa67050), the series applies to current u-boot-arm/master, but building fails for both a369evb and fvm with multiple instances of this error:

include/asm/arch/hardware.h:14:23: fatal error: asm/sizes.h: No such file or directory

Can you please rebase (for boards.cfg) and diagnose?

Amicalement,

Signature · 1 line
Albert.
#286 lore raw

v10 cover arm: add Faraday SoC platform support

2014-03-25 20:41 GMT+08:00 Albert ARIBAUD <[email protected]>:

Quoted 9 lines

Hi Kuo-Jung,

Quoted 3 lines · Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

These patches introduce Faraday A369 & Virtual SoC platform support.

Quoted 8 lines

Except for patches 4/6 and 6/6 in which boards.cfg needed manual fixing (due to commit 3fa67050), the series applies to current u-boot-arm/master, but building fails for both a369evb and fvm with multiple instances of this error:

include/asm/arch/hardware.h:14:23: fatal error: asm/sizes.h: No such file or directory

It's because that the 'asm/sizes.h' has been moved to 'linux/sizes.h' by commit 1ace4022394.

Quoted 2 lines

Can you please rebase (for boards.cfg) and diagnose?

Sure, the updated patches are on the way.

Signature · 2 lines
Best wishes,
Kuo-Jung Su
#287 lore raw

v11 cover arm: add Faraday SoC platform support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

These patches introduce Faraday A369 & Virtual SoC platform support.

Here are some public documents for your reference.

http://www.faraday-tech.com/html/Product/SoCPlatform/SoCreativeIII.htm
http://www.faraday-tech.com/html/documentation/index.html

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

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

Here is a quick start for QEMU + U-Boot:

1. Download the QEMU source tree

   $ git clone -b qemu-1.5.1 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-2014.01/u-boot

Changes for v11:
- Fix boards.cfg (due to commit 3fa67050)
- Rename <asm/sizes.h> to <linux/sizes.h> (due to commit 1ace4022)
- Directly specify the timer object in 'arch/arm/cpu/faraday/<soc>/Makefile' instead of using CONFIG_FTTMR010 in 'arch/arm/cpu/faraday/Makefile'
- Directly specify the timer object in 'arch/arm/cpu/faraday/<soc>/Makefile' instead of using CONFIG_FTPWMTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v10:
- As per Albert's request, merge patch 1, 2 and patch 5, 6
- Add missing header file for FTSDC021

Changes for v9:
- Shrink the patch by dropping MMU/D-cache support, and see if we could get this patch accepted ASAP.
- Replace the out-of-date A360 EVB with Faraday Virtual Machine (FVM).
- Build 'arch_preboot_os()' only when CONFIG_CMD_BOOTM is defined.
- Add do_go_exec() to override the default behavior of 'go' command.
- Make Faraday SoC helper files & ftsmc020 standalone changesets.
- Coding style cleanup.

Changes for v8:
- Revise MMU/D-cache support
- Revise Faraday SoC common configurations.
- Drop FTINTC020 interrupt controller support.
- Drop FTLCDC200 LCD controller support.
- Drop FTNANDC021 NAND flash controller support, it would be latter submitted as a standalone patch set.
- Drop proprietary Faraday SPL support, the u-boot-spl would be adapted instead. However because it depends on the FTNANDC021 patch set, so it would be submitted after the FTNANDC021 patch set get committed.

Changes for v7:
- Update license to use SPDX identifiers.
- cfi_flash: drop the patch to unmap_physmem(), because it's already applied.
- ftnandc021: put_unaligned() -> memcpy()
- ftnandc021: update ecc relatived function prototypes to fix compile warnnings.

Changes for v6:
- Drop ethernet driver updates for ftmac110&ftgmac100, because they are already commited.
- arch/arm/cpu/faraday/cpu.c:

     struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

- arch/arm/cpu/faraday/cmd_bootfa.c: fix compiler warnning
- arch/arm/cpu/faraday/cmd_bootfa.c: use shorter paragraph in commit message, and move the original statement into the top of source file.
- ftnandc021: update README for CONFIG_SYS_FTNANDC021_TIMING
- ftnandc021: remove illegal type-punning

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Make 'arm: dma_alloc_coherent: malloc() -> memalign()' as a separate patch
- Make 'cfi_flash: use buffer length in unmap_physmem()' as a separate patch
- Define Faraday machine type in board's config header file
- Add the rationale to the command 'bootfa'
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Chain the video:FTLCDC200 back to this patch series.
- Chain the nand:FTNANDC021 back to this patch series.
- Chain the net:FTGMAC100 & FTMAC110 back to this patch series.
- Update Faraday Firmware Image Format:
1. Drop u-boot image support to simplify the design.
Since it's not possible for the hard-wired ROM code of A360/A369 to support U-boot images. And the real bootloader for A360/A369 is actually Faraday bootcode2, rather than U-Boot.
2. Add image creation timestamp
- Update 'arch/arm/cpu/faraday/start.S' with the new design, which move relocation into 'arch/arm/lib/relocate.S'
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise IRQ & MMU design: Now the exception table would be mapped to

     0x00000000 as a small page(4KB), rather than runtime adjust after
     relocation finished.

- Revise irq:FTINTC020 design, now the irq is always enabled inside irq_install_handler().
- Revise clock management system
- Revise FTPWMTMR010 & FTTMR010 timer design:
1. Drop IRQ dependant implementation
2. Use gd->arch.timer_rate_hz for timer clock source
3. Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break down the patch series:
- Patches without hard dependency to this series are now seperate patches.
- Split up the patch into more logical changesets (i.e. interrupt & timers are now split up)
- Drop the faraday/nand.h to remove dependency to ftnandc021
- Drop the faraday/mmc.h to remove dependency to ftsdc010
- Add change logs to each part of the patch series to make patchwork be able to grab comments.

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 (6):
arm: add Faraday ARMv5TE cores support
arm: faraday: add FTTMR010 timer support
arm: faraday: add FTPWMTMR010 timer support
arm: faraday: add A369 evaluation board support
arm: faraday: add missing header file for FTSDC021
arm: faraday: add virtual machine support

 arch/arm/cpu/faraday/Makefile             |   10 +
 arch/arm/cpu/faraday/a369/Makefile        |    8 +
 arch/arm/cpu/faraday/cache.c              |  164 ++++++++++++
 arch/arm/cpu/faraday/config.mk            |   15 ++
 arch/arm/cpu/faraday/cpu.c                |  115 ++++++++
 arch/arm/cpu/faraday/ftpwmtmr010.c        |  112 ++++++++
 arch/arm/cpu/faraday/fttmr010.c           |  123 +++++++++
 arch/arm/cpu/faraday/fvm/Makefile         |    8 +
 arch/arm/cpu/faraday/start.S              |  407 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-a369/hardware.h |   88 +++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++
 arch/arm/include/asm/arch-fvm/hardware.h  |   76 ++++++
 arch/arm/include/asm/faraday.h            |   13 +
 board/faraday/a369evb/Makefile            |    9 +
 board/faraday/a369evb/board.c             |  122 +++++++++
 board/faraday/a369evb/clock.c             |   68 +++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 board/faraday/fvm/Makefile                |    9 +
 board/faraday/fvm/board.c                 |   60 +++++
 board/faraday/fvm/clock.c                 |   49 ++++
 board/faraday/fvm/lowlevel_init.S         |   15 ++
 boards.cfg                                |    2 +
 include/common.h                          |    3 +
 include/configs/a369.h                    |  108 ++++++++
 include/configs/faraday-common.h          |  314 ++++++++++++++++++++++
 include/configs/fvm.h                     |   58 ++++
 include/faraday/ftpwmtmr010.h             |   41 +++
 include/faraday/ftsdc021.h                |   13 +
 include/faraday/ftsmc020.h                |    1 +
 include/faraday/fttmr010.h                |   17 ++
 30 files changed, 2254 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/cpu/faraday/cache.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/ftpwmtmr010.c
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
 create mode 100644 arch/arm/cpu/faraday/fvm/Makefile
 create mode 100644 arch/arm/cpu/faraday/start.S
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 arch/arm/include/asm/arch-fvm/hardware.h
 create mode 100644 arch/arm/include/asm/faraday.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/clock.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 board/faraday/fvm/Makefile
 create mode 100644 board/faraday/fvm/board.c
 create mode 100644 board/faraday/fvm/clock.c
 create mode 100644 board/faraday/fvm/lowlevel_init.S
 create mode 100644 include/configs/a369.h
 create mode 100644 include/configs/faraday-common.h
 create mode 100644 include/configs/fvm.h
 create mode 100644 include/faraday/ftpwmtmr010.h
 create mode 100644 include/faraday/ftsdc021.h

--
1.7.9.5

#288 lore raw

PATCH v11 1/6 arm: add Faraday ARMv5TE cores support

From: Kuo-Jung Su <[email protected]>

Here is the list of verified cores:

1. FA606TE (ARMv5TE, no mmu)
2. FA626TE (ARMv5TE)

CC Albert Aribaud <[email protected]>

---
Changes for v11:
- Nothing updates

Changes for v10:
- Merge [arm: add Faraday SoC helper files]

Changes for v9:
- Build 'arch_preboot_os()' only when CONFIG_CMD_BOOTM is defined.
- Add do_go_exec() to override the default behavior of 'go' command.

Changes for v8:
- add arm_init_before_mmu() & mmu_page_table_flush()

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Initial commit

 arch/arm/cpu/faraday/Makefile    |   10 +
 arch/arm/cpu/faraday/cache.c     |  164 +++++++++++++++
 arch/arm/cpu/faraday/config.mk   |   15 ++
 arch/arm/cpu/faraday/cpu.c       |  115 +++++++++++
 arch/arm/cpu/faraday/start.S     |  407 ++++++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/faraday.h   |   13 ++
 include/common.h                 |    3 +
 include/configs/faraday-common.h |  314 +++++++++++++++++++++++++++++
 8 files changed, 1041 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/cache.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/start.S
 create mode 100644 arch/arm/include/asm/faraday.h
 create mode 100644 include/configs/faraday-common.h
arch/arm/cpu/faraday/Makefile new file +10 -0
new file mode 100644
index 0000000..c859238
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y := start.o
+
+obj-y   += cpu.o cache.o
arch/arm/cpu/faraday/cache.c new file +164 -0

164 lines not on this page · raw message

arch/arm/cpu/faraday/config.mk new file +15 -0
new file mode 100644
index 0000000..f39e70b
@@ -0,0 +1,15 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_CPPFLAGS += -march=armv5te
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/faraday/cpu.c new file +115 -0

115 lines not on this page · raw message

arch/arm/cpu/faraday/start.S new file +407 -0

407 lines not on this page · raw message

arch/arm/include/asm/faraday.h new file +13 -0
new file mode 100644
index 0000000..2b59af1
@@ -0,0 +1,13 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _ASM_FARADAY_H
+#define _ASM_FARADAY_H
+
+ulong clk_get_rate(const char *id);
+
+#endif	/* EOF */
include/common.h +3 -0
index 5c9bd08..de3120c 100644
@@ -88,6 +88,9 @@ typedef volatile unsigned char	vu_char;
 #ifdef CONFIG_SOC_DA8XX
 #include <asm/arch/hardware.h>
 #endif
+#ifdef CONFIG_SOC_FARADAY
+#include <asm/faraday.h>
+#endif
 
 #include <part.h>
 #include <flash.h>
include/configs/faraday-common.h new file +314 -0

314 lines not on this page · raw message

--
1.7.9.5

#289 lore raw

PATCH v11 1/6 arm: add Faraday ARMv5TE cores support

Dear Kuo-Jung Su,

Quoted 6 lines · In message <[email protected]> you wrote:

From: Kuo-Jung Su <[email protected]>

Here is the list of verified cores:

1. FA606TE (ARMv5TE, no mmu)
2. FA626TE (ARMv5TE)

...

Quoted 5 lines
include/configs/faraday-common.h new file +0 -0
new file mode 100644
index 0000000..546c0a9

...

Quoted 5 lines
include/configs/faraday-common.h new file +5 -0
+#ifndef CONFIG_ETHADDR
+#define CONFIG_ETHADDR              00:41:71:00:00:50
+#endif
+
+#ifndef CONFIG_IPADDR

include/configs/faraday-common.h line 137

Quoted 10 lines
include/configs/faraday-common.h new file +10 -0
+#define CONFIG_IPADDR               10.0.0.192
+#endif
+
+#ifndef CONFIG_NETMASK
+#define CONFIG_NETMASK              255.255.255.0
+#endif
+
+#ifndef CONFIG_SERVERIP
+#define CONFIG_SERVERIP             10.0.0.128
+#endif

We do not allow such static network configuration. Especially assigning the same MAC address to all devices is deadly. Also, the address is not an officially assigned nor a local one. Please remove all this code.

include/configs/faraday-common.h line 245

Quoted 4 lines
include/configs/faraday-common.h new file +4 -0
+# endif
+# ifndef CONFIG_G_DNL_VENDOR_NUM
+# define CONFIG_G_DNL_VENDOR_NUM    0x1d50  /* OpenMoko */
+# endif

This looks wrong to me?

include/configs/faraday-common.h line 248

Quoted 3 lines
include/configs/faraday-common.h new file +3 -0
+# ifndef CONFIG_G_DNL_PRODUCT_NUM
+# define CONFIG_G_DNL_PRODUCT_NUM   0x5119
+# endif

Is this a valid ID?

include/configs/faraday-common.h line 267

Quoted 5 lines
include/configs/faraday-common.h new file +5 -0
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE           256
+
+/* Max number of command args */
+#define CONFIG_SYS_MAXARGS          32

You use a large number of args with a tiny console buffer? This looks suspicious. Please check.

Quoted 1 line

+#define CONFIG_CMD_AUTOSCRIPT /* support autoscript */

This has been removed years ago. Please use CONFIG_CMD_SOURCE instead.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
To program is to be.
#290 lore raw

PATCH v11 1/6 arm: add Faraday ARMv5TE cores support

2014-03-26 14:47 GMT+08:00 Wolfgang Denk <[email protected]>:

Quoted 28 lines

Dear Kuo-Jung Su,

Quoted 6 lines · In message <[email protected]> you wrote:

From: Kuo-Jung Su <[email protected]>

Here is the list of verified cores:

1. FA606TE (ARMv5TE, no mmu)
2. FA626TE (ARMv5TE)

...

Quoted 5 lines
include/configs/faraday-common.h new file +0 -0
new file mode 100644
index 0000000..546c0a9

...

Quoted 12 lines
include/configs/faraday-common.h new file +12 -0
+#ifndef CONFIG_ETHADDR
+#define CONFIG_ETHADDR              00:41:71:00:00:50
+#endif
+
+#ifndef CONFIG_IPADDR
+#define CONFIG_IPADDR               10.0.0.192
+#endif
+
+#ifndef CONFIG_NETMASK
+#define CONFIG_NETMASK              255.255.255.0
+#endif
+
Quoted 9 lines

include/configs/faraday-common.h line 137

Quoted 3 lines
include/configs/faraday-common.h new file +3 -0
+#ifndef CONFIG_SERVERIP
+#define CONFIG_SERVERIP             10.0.0.128
+#endif

We do not allow such static network configuration. Especially assigning the same MAC address to all devices is deadly. Also, the address is not an officially assigned nor a local one. Please remove all this code.

Got it, thanks

Quoted 7 lines

include/configs/faraday-common.h line 245

Quoted 4 lines
include/configs/faraday-common.h new file +4 -0
+# endif
+# ifndef CONFIG_G_DNL_VENDOR_NUM
+# define CONFIG_G_DNL_VENDOR_NUM    0x1d50  /* OpenMoko */
+# endif

This looks wrong to me?

Quoted 6 lines

include/configs/faraday-common.h line 248

Quoted 3 lines
include/configs/faraday-common.h new file +3 -0
+# ifndef CONFIG_G_DNL_PRODUCT_NUM
+# define CONFIG_G_DNL_PRODUCT_NUM   0x5119
+# endif

Is this a valid ID?

By stealing the OpenMoko's vendor id & product id, I could directly use the OpenMoko dfu-util without any modifications.

And unfortunately we don't have a registered OUI for Faraday Technology, so I'll remove this ID in the next release.

Quoted 9 lines

include/configs/faraday-common.h line 267

Quoted 5 lines
include/configs/faraday-common.h new file +5 -0
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE           256
+
+/* Max number of command args */
+#define CONFIG_SYS_MAXARGS          32

You use a large number of args with a tiny console buffer? This looks suspicious. Please check.

Got it, thanks

Quoted 5 lines
Quoted 1 line

+#define CONFIG_CMD_AUTOSCRIPT /* support autoscript */

This has been removed years ago. Please use CONFIG_CMD_SOURCE instead.

Got it, thanks

Signature · 2 lines
Best wishes,
Kuo-Jung Su
#291 lore raw

PATCH v11 2/6 arm: faraday: add FTTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTTMR010 is a simple APB device which supports generic timer functions.

CC Albert Aribaud <[email protected]>

---
Changes for v11:
- Directly specify the timer object in 'arch/arm/cpu/faraday/<soc>/Makefile' instead of using CONFIG_FTTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v8, v9, v10:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/fttmr010.c |  123 +++++++++++++++++++++++++++++++++++++++
 include/faraday/fttmr010.h      |   17 ++++++
 2 files changed, 140 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
arch/arm/cpu/faraday/fttmr010.c new file +123 -0
new file mode 100644
index 0000000..28b0086
@@ -0,0 +1,123 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/tw/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <faraday/fttmr010.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct fttmr010 *regs = (void __iomem *)CONFIG_FTTMR010_BASE;
+
+void udelay_masked(unsigned long usec)
+{
+	ulong freq = gd->arch.timer_rate_hz;
+
+	/* Disable Timer2 */
+	clrbits_le32(&regs->cr, FTTMR010_TM2_CRMASK);
+	/* Disable Timer2 interrupts */
+	writel(FTTMR010_TM2_ISRMASK, &regs->interrupt_mask);
+	/* Clear Timer2 interrupts */
+	writel(FTTMR010_TM2_ISRMASK, &regs->interrupt_state);
+
+	/* Configure Timer2 */
+	writel((freq / 1000000) * usec, &regs->timer2_counter);
+	writel(0, &regs->timer2_load);
+	writel(0, &regs->timer2_match1);
+	writel(0, &regs->timer2_match2);
+
+	/* Enable Timer2 */
+	setbits_le32(&regs->cr,
+		FTTMR010_TM2_OFENABLE | FTTMR010_TM2_ENABLE);
+
+	/* Wait until timeout */
+	while (!(readl(&regs->interrupt_state) & FTTMR010_TM2_ISRMASK))
+		;
+}
+
+void reset_timer_masked(void)
+{
+	ulong freq = gd->arch.timer_rate_hz;
+
+	/* Disable Timer1 */
+	clrbits_le32(&regs->cr, FTTMR010_TM1_CRMASK);
+
+	/* Disable & Clear Timer1 interrupts */
+	writel(FTTMR010_TM1_ISRMASK, &regs->interrupt_mask);
+	writel(FTTMR010_TM1_ISRMASK, &regs->interrupt_state);
+
+	/* Setup a longest periodic timer */
+	writel((0xffffffff / freq) * freq, &regs->timer1_counter);
+	writel((0xffffffff / freq) * freq, &regs->timer1_load);
+
+	writel(0, &regs->timer1_match1);
+	writel(0, &regs->timer1_match2);
+
+	/* Disable match interrupts */
+	writel(FTTMR010_TM1_MATCH1 | FTTMR010_TM1_MATCH2,
+		&regs->interrupt_mask);
+
+	/* Enable Timer1 with overflow interrupt */
+	setbits_le32(&regs->cr,
+		FTTMR010_TM1_OFENABLE | FTTMR010_TM1_ENABLE);
+}
+
+ulong get_timer_masked(void)
+{
+	ulong freq = gd->arch.timer_rate_hz;
+	ulong secs = 0xffffffff / freq;
+	ulong ms = freq / CONFIG_SYS_HZ;
+
+	if (readl(&regs->interrupt_state) & FTTMR010_TM1_ISRMASK) {
+		writel(FTTMR010_TM1_ISRMASK, &regs->interrupt_state);
+		gd->arch.tbl += secs * CONFIG_SYS_HZ;
+	}
+
+	return gd->arch.tbl
+		+ ((secs * freq) - readl(&regs->timer1_counter)) / ms;
+}
+
+int timer_init(void)
+{
+	gd->arch.tbl = 0;
+	reset_timer_masked();
+	return 0;
+}
+
+void reset_timer(void)
+{
+	reset_timer_masked();
+}
+
+ulong get_timer(ulong base)
+{
+	return get_timer_masked() - base;
+}
+
+void __udelay(unsigned long usec)
+{
+	udelay_masked(usec);
+}
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+	return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+	return CONFIG_SYS_HZ;
+}
include/faraday/fttmr010.h +17 -0
index 2ab68d1..21ab113 100644
@@ -45,6 +45,16 @@ struct fttmr010 {
 #define FTTMR010_TM1_CLOCK	(1 << 1)
 #define FTTMR010_TM1_ENABLE	(1 << 0)
 
+#define FTTMR010_TM1_CRMASK \
+	(FTTMR010_TM1_UPDOWN | FTTMR010_TM1_OFENABLE \
+	| FTTMR010_TM1_CLOCK | FTTMR010_TM1_ENABLE)
+#define FTTMR010_TM2_CRMASK \
+	(FTTMR010_TM2_UPDOWN | FTTMR010_TM2_OFENABLE \
+	| FTTMR010_TM2_CLOCK | FTTMR010_TM2_ENABLE)
+#define FTTMR010_TM3_CRMASK \
+	(FTTMR010_TM3_UPDOWN | FTTMR010_TM3_OFENABLE \
+	| FTTMR010_TM3_CLOCK | FTTMR010_TM3_ENABLE)
+
 /*
  * Timer Interrupt State & Mask Registers
  */
@@ -58,4 +68,11 @@ struct fttmr010 {
 #define FTTMR010_TM1_MATCH2	(1 << 1)
 #define FTTMR010_TM1_MATCH1	(1 << 0)
 
+#define FTTMR010_TM1_ISRMASK \
+	(FTTMR010_TM1_OVERFLOW | FTTMR010_TM1_MATCH2 | FTTMR010_TM1_MATCH1)
+#define FTTMR010_TM2_ISRMASK \
+	(FTTMR010_TM2_OVERFLOW | FTTMR010_TM2_MATCH2 | FTTMR010_TM2_MATCH1)
+#define FTTMR010_TM3_ISRMASK \
+	(FTTMR010_TM3_OVERFLOW | FTTMR010_TM3_MATCH2 | FTTMR010_TM3_MATCH1)
+
 #endif	/* __FTTMR010_H */

--
1.7.9.5

#292 lore raw

PATCH v11 3/6 arm: faraday: add FTPWMTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTPWMTMR010 is a simple APB device which supports both timer and pwm functions.

CC Albert Aribaud <[email protected]>

---
Changes for v11:
- Directly specify the timer object in 'arch/arm/cpu/faraday/<soc>/Makefile' instead of using CONFIG_FTPWMTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v8, v9, v10:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/ftpwmtmr010.c |  112 ++++++++++++++++++++++++++++++++++++
 include/faraday/ftpwmtmr010.h      |   41 +++++++++++++
 2 files changed, 153 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 create mode 100644 include/faraday/ftpwmtmr010.h
arch/arm/cpu/faraday/ftpwmtmr010.c new file +112 -0
new file mode 100644
index 0000000..1032e44
@@ -0,0 +1,112 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/tw/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#include <faraday/ftpwmtmr010.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define TIMER_ID    0
+
+static struct ftpwmtmr010_regs *regs =
+	(void __iomem *)CONFIG_FTPWMTMR010_BASE;
+
+void udelay_masked(unsigned long usec)
+{
+	int id = TIMER_ID + 1;
+	ulong freq = gd->arch.timer_rate_hz;
+
+	/* timer re-start */
+	writel(0, &regs->t[id].ctrl);
+	writel(BIT_MASK(id), &regs->isr);
+	writel(0, &regs->t[id].cmpb);
+	writel((freq / 1000000) * usec, &regs->t[id].cntb);
+	writel(CTRL_INTEN | CTRL_START | CTRL_UPDATE, &regs->t[id].ctrl);
+
+	/* wait for timer interrupt */
+	while (!(readl(&regs->isr) & BIT_MASK(id)))
+		;
+
+	/* timer disabled */
+	writel(0, &regs->t[id].ctrl);
+	writel(BIT_MASK(id), &regs->isr);
+}
+
+void reset_timer_masked(void)
+{
+	int id = TIMER_ID;
+	ulong freq = gd->arch.timer_rate_hz;
+
+	writel(0, &regs->t[id].ctrl);
+	writel(BIT_MASK(id), &regs->isr);
+
+	/* setup a longest periodic timer */
+	writel((0xffffffff / freq) * freq, &regs->t[id].cntb);
+
+	writel(0, &regs->t[id].cmpb);
+	writel(CTRL_AUTORELOAD | CTRL_INTEN | CTRL_START | CTRL_UPDATE,
+		&regs->t[id].ctrl);
+}
+
+ulong get_timer_masked(void)
+{
+	int id = TIMER_ID;
+	ulong freq = gd->arch.timer_rate_hz;
+	ulong secs = 0xffffffff / freq;
+	ulong ms = freq / CONFIG_SYS_HZ;
+
+	if (readl(&regs->isr) & BIT_MASK(id)) {
+		writel(BIT_MASK(id), &regs->isr);
+		gd->arch.tbl += secs * CONFIG_SYS_HZ;
+	}
+
+	return gd->arch.tbl
+		+ ((secs * freq - readl(&regs->t[id].cnto)) / ms);
+}
+
+int timer_init(void)
+{
+	gd->arch.tbl = 0;
+	reset_timer_masked();
+	return 0;
+}
+
+void reset_timer(void)
+{
+	reset_timer_masked();
+}
+
+ulong get_timer(ulong base)
+{
+	return get_timer_masked() - base;
+}
+
+void __udelay(unsigned long usec)
+{
+	udelay_masked(usec);
+}
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+	return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+	return CONFIG_SYS_HZ;
+}
include/faraday/ftpwmtmr010.h new file +41 -0

41 lines not on this page · raw message

--
1.7.9.5

#293 lore raw

PATCH v11 4/6 arm: faraday: add A369 evaluation board support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

The A369 is an ARM CPU-based SoC with rich SoC features and convenient FPGA link for building fast system prototyping and mass production.

More information about this hardware can be found at:
http://www.faraday-tech.com/html/Product/SoCPlatform/SoCreativeIII.htm

CC Albert Aribaud <[email protected]>

---
Changes for v11:
- Fix boards.cfg (due to commit 3fa67050)
- Rename <asm/sizes.h> to <linux/sizes.h> (due to commit 1ace4022)
- Directly specify the timer object in 'arch/arm/cpu/faraday/a369/Makefile' instead of using CONFIG_FTPWMTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v10:
- Merge [arm: faraday: ftsmc020: add a fail-safe macro constant]

Changes for v9:
- Revise the commit message.

Changes for v8:
- Make A369 a standalong changeset.

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:

	- arch/arm/cpu/faraday/cpu.c:
	  struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Define Faraday machine type in board's config header file
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise clock management system

Changes for v4:
- Coding Style cleanup.
- Break-down the interrupt, timers and common utilties.

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.
- 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().

 arch/arm/cpu/faraday/a369/Makefile        |    8 ++
 arch/arm/include/asm/arch-a369/hardware.h |   88 ++++++++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++++++++++++++++
 board/faraday/a369evb/Makefile            |    9 ++
 board/faraday/a369evb/board.c             |  122 +++++++++++++++++
 board/faraday/a369evb/clock.c             |   68 ++++++++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 boards.cfg                                |    1 +
 include/configs/a369.h                    |  108 +++++++++++++++
 include/faraday/ftsmc020.h                |    1 +
 10 files changed, 631 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/clock.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 include/configs/a369.h
arch/arm/cpu/faraday/a369/Makefile new file +8 -0
new file mode 100644
index 0000000..8a7c979
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y := ../ftpwmtmr010.o
arch/arm/include/asm/arch-a369/hardware.h new file +88 -0

88 lines not on this page · raw message

arch/arm/include/asm/arch-a369/sysc.h new file +211 -0

211 lines not on this page · raw message

board/faraday/a369evb/Makefile new file +9 -0
new file mode 100644
index 0000000..42fef70
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, [email protected].
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o clock.o
+obj-y	+= lowlevel_init.o
board/faraday/a369evb/board.c new file +122 -0

122 lines not on this page · raw message

board/faraday/a369evb/clock.c new file +68 -0

68 lines not on this page · raw message

board/faraday/a369evb/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..2085760
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index 69c8936..49c4f85 100644
@@ -390,6 +390,7 @@ Active  arm         armv7:arm720t  tegra20     toradex         colibri_t20_iris
 Active  arm         armv7:arm720t  tegra30     avionic-design  tec-ng              tec-ng                               -                                                                                                                                 Alban Bedel <[email protected]>
 Active  arm         armv7:arm720t  tegra30     nvidia          beaver              beaver                               -                                                                                                                                 Tom Warren <[email protected]>:Stephen Warren <[email protected]>
 Active  arm         armv7:arm720t  tegra30     nvidia          cardhu              cardhu                               -                                                                                                                                 Tom Warren <[email protected]>
+Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
 Active  arm         pxa            -           -               -                   balloon3                             -                                                                                                                                 Marek Vasut <[email protected]>
 Active  arm         pxa            -           -               -                   h2200                                -                                                                                                                                 Lukasz Dalek <[email protected]>
 Active  arm         pxa            -           -               -                   palmld                               -                                                                                                                                 Marek Vasut <[email protected]>
include/configs/a369.h new file +108 -0

108 lines not on this page · raw message

include/faraday/ftsmc020.h +1 -0
index 54120ab..485d7c2 100644
@@ -70,5 +70,6 @@ void ftsmc020_init(void);
 #define FTSMC020_TPR_WTC(x)	(((x) & 0x3) << 6)
 #define FTSMC020_TPR_AHT(x)	(((x) & 0x3) << 4)
 #define FTSMC020_TPR_TRNA(x)	(((x) & 0xf) << 0)
+#define FTSMC020_TPR_FAILSAFE	0x0f1ff3ff /* fail-safe timing */
 
 #endif	/* __FTSMC020_H */

--
1.7.9.5

#294 lore raw

PATCH v11 5/6 arm: faraday: add missing header file for FTSDC021

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

For the Faraday FTSDC021 (SDHCI) controller driver source is sent out before the patches for Faraday Virtual Machine (FVM) which actually uses this chip.

The header file (ftsdc021.h) has been accidentally removed by commit: 3b98b57fa - include: delete unused header files

This patch simply rollback this removal.

CC Albert Aribaud <[email protected]>

---
Changes for v11:
- Nothing updates

Changes for v10:
- Initial commit

 include/faraday/ftsdc021.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 include/faraday/ftsdc021.h
include/faraday/ftsdc021.h new file +13 -0
new file mode 100644
index 0000000..de8e250
@@ -0,0 +1,13 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __FTSDC021_H
+#define __FTSDC021_H
+
+int ftsdc021_sdhci_init(u32 regbase);
+
+#endif /* __FTSDC021_H */

--
1.7.9.5

#295 lore raw

PATCH v11 6/6 arm: faraday: add virtual machine support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday Virtual Machine (FVM) is a QEMU based emulator which is designed for early stage software development (i.e., IPL, SPL development).

Please check the link bellow for details:
https://github.com/dantesu1218/qemu/blob/qemu-1.5.1/hw/arm/faraday_fvm.c

CC Albert Aribaud <[email protected]>

---
Changes for v11:
- Fix boards.cfg (due to commit 3fa67050)
- Rename <asm/sizes.h> to <linux/sizes.h> (due to commit 1ace4022)
- Directly specify the timer object in 'arch/arm/cpu/faraday/fvm/Makefile' instead of using CONFIG_FTTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v10:
- Nothing updates

Changes for v9:
- Initial commit

 arch/arm/cpu/faraday/fvm/Makefile        |    8 ++++
 arch/arm/include/asm/arch-fvm/hardware.h |   76 ++++++++++++++++++++++++++++++
 board/faraday/fvm/Makefile               |    9 ++++
 board/faraday/fvm/board.c                |   60 +++++++++++++++++++++++
 board/faraday/fvm/clock.c                |   49 +++++++++++++++++++
 board/faraday/fvm/lowlevel_init.S        |   15 ++++++
 boards.cfg                               |    1 +
 include/configs/fvm.h                    |   58 +++++++++++++++++++++++
 8 files changed, 276 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fvm/Makefile
 create mode 100644 arch/arm/include/asm/arch-fvm/hardware.h
 create mode 100644 board/faraday/fvm/Makefile
 create mode 100644 board/faraday/fvm/board.c
 create mode 100644 board/faraday/fvm/clock.c
 create mode 100644 board/faraday/fvm/lowlevel_init.S
 create mode 100644 include/configs/fvm.h
arch/arm/cpu/faraday/fvm/Makefile new file +8 -0
new file mode 100644
index 0000000..9c1eaa8
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y := ../fttmr010.o
arch/arm/include/asm/arch-fvm/hardware.h new file +76 -0

76 lines not on this page · raw message

board/faraday/fvm/Makefile new file +9 -0
new file mode 100644
index 0000000..42fef70
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o clock.o
+obj-y	+= lowlevel_init.o
board/faraday/fvm/board.c new file +60 -0

60 lines not on this page · raw message

board/faraday/fvm/clock.c new file +49 -0

49 lines not on this page · raw message

board/faraday/fvm/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..cbc006d
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/tw/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index 49c4f85..824d1d0 100644
@@ -391,6 +391,7 @@ Active  arm         armv7:arm720t  tegra30     avionic-design  tec-ng
 Active  arm         armv7:arm720t  tegra30     nvidia          beaver              beaver                               -                                                                                                                                 Tom Warren <[email protected]>:Stephen Warren <[email protected]>
 Active  arm         armv7:arm720t  tegra30     nvidia          cardhu              cardhu                               -                                                                                                                                 Tom Warren <[email protected]>
 Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
+Active  arm         faraday        fvm         faraday         -                   fvm                                  -                                                                                                                                 Kuo-Jung Su <[email protected]>
 Active  arm         pxa            -           -               -                   balloon3                             -                                                                                                                                 Marek Vasut <[email protected]>
 Active  arm         pxa            -           -               -                   h2200                                -                                                                                                                                 Lukasz Dalek <[email protected]>
 Active  arm         pxa            -           -               -                   palmld                               -                                                                                                                                 Marek Vasut <[email protected]>
include/configs/fvm.h new file +58 -0

58 lines not on this page · raw message

--
1.7.9.5

#296 lore raw

PATCH v11 6/6 arm: faraday: add virtual machine support

Dear Kuo-Jung Su,

Quoted 5 lines · In message <[email protected]> you wrote:

From: Kuo-Jung Su <[email protected]>

Faraday Virtual Machine (FVM) is a QEMU based emulator which is designed for early stage software development (i.e., IPL, SPL development).

...

Quoted 11 lines
board/faraday/fvm/clock.c new file +11 -0
+ulong clk_get_rate(const char *id)
+{
+	ulong ret = 0;
+
+	if (!strcmp(id, "AHB"))
+		ret = clk_get_rate_ahb();
+	else if (!strcmp(id, "APB"))
+		ret = clk_get_rate_apb();
+	else if (!strcmp(id, "CPU"))
+		ret = clk_get_rate_cpu();
+	else if (!strcmp(id, "I2C"))

board/faraday/fvm/clock.c line 49

Quoted 10 lines
board/faraday/fvm/clock.c new file +10 -0
+		ret = clk_get_rate_apb();
+	else if (!strcmp(id, "SSP"))
+		ret = clk_get_rate_apb();
+	else if (!strcmp(id, "SPI"))
+		ret = clk_get_rate_ahb();
+	else if (!strcmp(id, "MMC") || !strcmp(id, "SDC"))
+		ret = clk_get_rate_ahb();
+
+	return ret;
+}

I have seen basically identical code in [PATCH v11 4/6] arm: faraday:
add A369 evaluation board; please move this (and other common code) into a common location so we have only one implementation of common code.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You don't stop doing things because you get old.  You get old because
you stop doing things.                            - Rosamunde Pilcher
#297 lore raw

PATCH v11 6/6 arm: faraday: add virtual machine support

2014-03-26 14:52 GMT+08:00 Wolfgang Denk <[email protected]>:

Quoted 27 lines

Dear Kuo-Jung Su,

Quoted 5 lines · In message <[email protected]> you wrote:

From: Kuo-Jung Su <[email protected]>

Faraday Virtual Machine (FVM) is a QEMU based emulator which is designed for early stage software development (i.e., IPL, SPL development).

...

Quoted 18 lines
board/faraday/fvm/clock.c new file +18 -0
+ulong clk_get_rate(const char *id)
+{
+     ulong ret = 0;
+
+     if (!strcmp(id, "AHB"))
+             ret = clk_get_rate_ahb();
+     else if (!strcmp(id, "APB"))
+             ret = clk_get_rate_apb();
+     else if (!strcmp(id, "CPU"))
+             ret = clk_get_rate_cpu();
+     else if (!strcmp(id, "I2C"))
+             ret = clk_get_rate_apb();
+     else if (!strcmp(id, "SSP"))
+             ret = clk_get_rate_apb();
+     else if (!strcmp(id, "SPI"))
+             ret = clk_get_rate_ahb();
+     else if (!strcmp(id, "MMC") || !strcmp(id, "SDC"))
+             ret = clk_get_rate_ahb();
Quoted 9 lines

board/faraday/fvm/clock.c line 49

Quoted 3 lines
board/faraday/fvm/clock.c new file +3 -0
+
+     return ret;
+}

I have seen basically identical code in [PATCH v11 4/6] arm: faraday:
add A369 evaluation board; please move this (and other common code) into a common location so we have only one implementation of common code.

Got it, thanks

Signature · 2 lines
Best wishes,
Kuo-Jung Su
#298 lore raw

v12 cover arm: add Faraday SoC platform support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

These patches introduce Faraday A369 & Virtual SoC platform support.

Here are some public documents for your reference.

http://www.faraday-tech.com/html/Product/SoCPlatform/SoCreativeIII.htm
http://www.faraday-tech.com/html/documentation/index.html

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

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

Here is a quick start for QEMU + U-Boot:

1. Download the QEMU source tree

   $ git clone -b qemu-1.5.1 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-2014.01/u-boot

Changes for v12:
- Coding style cleanup.
- Move strlcpy() from ether.c to string.c
- Add Linux legacy clock framework support (no common clock).
- Migrate to generic board model (CONFIG_SYS_GENERIC_BOARD).
- Drop pre-defined Ethernet MAC for all platforms.
- Drop USB-DFU support due to lack of registered Vendor ID.
- CONFIG_SYS_MAXARGS: 32 -> 8
- CONFIG_CMD_AUTOSCRIPT -> CONFIG_CMD_SOURCE

Changes for v11:
- Fix boards.cfg (due to commit 3fa67050)
- Rename <asm/sizes.h> to <linux/sizes.h> (due to commit 1ace4022)
- Directly specify the timer object in 'arch/arm/cpu/faraday/<soc>/Makefile' instead of using CONFIG_FTTMR010 in 'arch/arm/cpu/faraday/Makefile'
- Directly specify the timer object in 'arch/arm/cpu/faraday/<soc>/Makefile' instead of using CONFIG_FTPWMTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v10:
- As per Albert's request, merge patch 1, 2 and patch 5, 6
- Add missing header file for FTSDC021

Changes for v9:
- Shrink the patch by dropping MMU/D-cache support, and see if we could get this patch accepted ASAP.
- Replace the out-of-date A360 EVB with Faraday Virtual Machine (FVM).
- Build 'arch_preboot_os()' only when CONFIG_CMD_BOOTM is defined.
- Add do_go_exec() to override the default behavior of 'go' command.
- Make Faraday SoC helper files & ftsmc020 standalone changesets.
- Coding style cleanup.

Changes for v8:
- Revise MMU/D-cache support
- Revise Faraday SoC common configurations.
- Drop FTINTC020 interrupt controller support.
- Drop FTLCDC200 LCD controller support.
- Drop FTNANDC021 NAND flash controller support, it would be latter submitted as a standalone patch set.
- Drop proprietary Faraday SPL support, the u-boot-spl would be adapted instead. However because it depends on the FTNANDC021 patch set, so it would be submitted after the FTNANDC021 patch set get committed.

Changes for v7:
- Update license to use SPDX identifiers.
- cfi_flash: drop the patch to unmap_physmem(), because it's already applied.
- ftnandc021: put_unaligned() -> memcpy()
- ftnandc021: update ecc relatived function prototypes to fix compile warnnings.

Changes for v6:
- Drop ethernet driver updates for ftmac110&ftgmac100, because they are already commited.
- arch/arm/cpu/faraday/cpu.c:

     struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

- arch/arm/cpu/faraday/cmd_bootfa.c: fix compiler warnning
- arch/arm/cpu/faraday/cmd_bootfa.c: use shorter paragraph in commit message, and move the original statement into the top of source file.
- ftnandc021: update README for CONFIG_SYS_FTNANDC021_TIMING
- ftnandc021: remove illegal type-punning

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Make 'arm: dma_alloc_coherent: malloc() -> memalign()' as a separate patch
- Make 'cfi_flash: use buffer length in unmap_physmem()' as a separate patch
- Define Faraday machine type in board's config header file
- Add the rationale to the command 'bootfa'
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Chain the video:FTLCDC200 back to this patch series.
- Chain the nand:FTNANDC021 back to this patch series.
- Chain the net:FTGMAC100 & FTMAC110 back to this patch series.
- Update Faraday Firmware Image Format:
1. Drop u-boot image support to simplify the design.
Since it's not possible for the hard-wired ROM code of A360/A369 to support U-boot images. And the real bootloader for A360/A369 is actually Faraday bootcode2, rather than U-Boot.
2. Add image creation timestamp
- Update 'arch/arm/cpu/faraday/start.S' with the new design, which move relocation into 'arch/arm/lib/relocate.S'
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise IRQ & MMU design: Now the exception table would be mapped to

     0x00000000 as a small page(4KB), rather than runtime adjust after
     relocation finished.

- Revise irq:FTINTC020 design, now the irq is always enabled inside irq_install_handler().
- Revise clock management system
- Revise FTPWMTMR010 & FTTMR010 timer design:
1. Drop IRQ dependant implementation
2. Use gd->arch.timer_rate_hz for timer clock source
3. Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break down the patch series:
- Patches without hard dependency to this series are now seperate patches.
- Split up the patch into more logical changesets (i.e. interrupt & timers are now split up)
- Drop the faraday/nand.h to remove dependency to ftnandc021
- Drop the faraday/mmc.h to remove dependency to ftsdc010
- Add change logs to each part of the patch series to make patchwork be able to grab comments.

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 (8):
libc: move strlcpy() from ether.c to string.c
arm: add legacy linux clock framework support
arm: add Faraday ARMv5TE platform common libraries
arm: faraday: add FTTMR010 timer suppor
arm: faraday: add FTPWMTMR010 timer support
arm: faraday: add A369 evaluation board support
arm: faraday: add missing header file for FTSDC021
arm: faraday: add faraday virtual machine support

 arch/arm/cpu/faraday/Makefile             |   13 +
 arch/arm/cpu/faraday/a369/Makefile        |    8 +
 arch/arm/cpu/faraday/a369/clock.c         |   87 ++++++
 arch/arm/cpu/faraday/a369/core.c          |   21 ++
 arch/arm/cpu/faraday/a369/core.h          |   15 ++
 arch/arm/cpu/faraday/a369/pinmux.c        |   37 +++
 arch/arm/cpu/faraday/cache.c              |  164 ++++++++++++
 arch/arm/cpu/faraday/clk.c                |   67 +++++
 arch/arm/cpu/faraday/config.mk            |   15 ++
 arch/arm/cpu/faraday/cpu.c                |  116 ++++++++
 arch/arm/cpu/faraday/ftpwmtmr010.c        |  112 ++++++++
 arch/arm/cpu/faraday/fttmr010.c           |  123 +++++++++
 arch/arm/cpu/faraday/fvm/Makefile         |    8 +
 arch/arm/cpu/faraday/fvm/clock.c          |   70 +++++
 arch/arm/cpu/faraday/fvm/core.c           |   20 ++
 arch/arm/cpu/faraday/fvm/core.h           |   14 +
 arch/arm/cpu/faraday/start.S              |  407 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-a369/clkdev.h   |   20 ++
 arch/arm/include/asm/arch-a369/hardware.h |   88 +++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++
 arch/arm/include/asm/arch-fvm/clkdev.h    |   20 ++
 arch/arm/include/asm/arch-fvm/hardware.h  |   76 ++++++
 arch/arm/include/asm/clkdev.h             |   29 ++
 board/faraday/a369evb/Makefile            |    9 +
 board/faraday/a369evb/board.c             |  118 +++++++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 board/faraday/fvm/Makefile                |    9 +
 board/faraday/fvm/board.c                 |   65 +++++
 board/faraday/fvm/lowlevel_init.S         |   15 ++
 boards.cfg                                |    2 +
 drivers/Makefile                          |    1 +
 drivers/clk/Makefile                      |    8 +
 drivers/clk/clkdev.c                      |  207 +++++++++++++++
 drivers/i2c/fti2c010.c                    |    3 +-
 drivers/mmc/ftsdc010_mci.c                |    3 +-
 drivers/mmc/ftsdc021_sdhci.c              |    3 +-
 drivers/spi/ftssp010_spi.c                |    3 +-
 drivers/usb/gadget/ether.c                |   24 --
 include/configs/a369.h                    |  104 ++++++++
 include/configs/faraday-common.h          |  276 +++++++++++++++++++
 include/configs/fvm.h                     |   68 +++++
 include/faraday/clkdev.h                  |   19 ++
 include/faraday/ftpwmtmr010.h             |   41 +++
 include/faraday/ftsdc021.h                |   13 +
 include/faraday/ftsmc020.h                |    1 +
 include/faraday/fttmr010.h                |   17 ++
 include/linux/clk.h                       |  181 +++++++++++++
 include/linux/clkdev.h                    |   45 ++++
 include/linux/string.h                    |    3 +
 lib/string.c                              |   25 ++
 50 files changed, 2991 insertions(+), 28 deletions(-)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/cpu/faraday/a369/clock.c
 create mode 100644 arch/arm/cpu/faraday/a369/core.c
 create mode 100644 arch/arm/cpu/faraday/a369/core.h
 create mode 100644 arch/arm/cpu/faraday/a369/pinmux.c
 create mode 100644 arch/arm/cpu/faraday/cache.c
 create mode 100644 arch/arm/cpu/faraday/clk.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/ftpwmtmr010.c
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
 create mode 100644 arch/arm/cpu/faraday/fvm/Makefile
 create mode 100644 arch/arm/cpu/faraday/fvm/clock.c
 create mode 100644 arch/arm/cpu/faraday/fvm/core.c
 create mode 100644 arch/arm/cpu/faraday/fvm/core.h
 create mode 100644 arch/arm/cpu/faraday/start.S
 create mode 100644 arch/arm/include/asm/arch-a369/clkdev.h
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 arch/arm/include/asm/arch-fvm/clkdev.h
 create mode 100644 arch/arm/include/asm/arch-fvm/hardware.h
 create mode 100644 arch/arm/include/asm/clkdev.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 board/faraday/fvm/Makefile
 create mode 100644 board/faraday/fvm/board.c
 create mode 100644 board/faraday/fvm/lowlevel_init.S
 create mode 100644 drivers/clk/Makefile
 create mode 100644 drivers/clk/clkdev.c
 create mode 100644 include/configs/a369.h
 create mode 100644 include/configs/faraday-common.h
 create mode 100644 include/configs/fvm.h
 create mode 100644 include/faraday/clkdev.h
 create mode 100644 include/faraday/ftpwmtmr010.h
 create mode 100644 include/faraday/ftsdc021.h
 create mode 100644 include/linux/clk.h
 create mode 100644 include/linux/clkdev.h

--
1.7.9.5

#299 lore raw

PATCH v12 1/8 libc: move strlcpy() from ether.c to string.c

From: Kuo-Jung Su <[email protected]>

It would be better to have strlcpy() moved to lib/string.c, so that it could be reused by others without enabling USB Gadget Ethernet.

CC Albert Aribaud <[email protected]>
CC Wolfgang Denk <[email protected]>
Cc Marek Vasut <[email protected]>

---
Changes for v12:
- Initial commit

 drivers/usb/gadget/ether.c |   24 ------------------------
 include/linux/string.h     |    3 +++
 lib/string.c               |   25 +++++++++++++++++++++++++
 3 files changed, 28 insertions(+), 24 deletions(-)
drivers/usb/gadget/ether.c +0 -24
index cc6cc1f..cabd81f 100644
@@ -857,30 +857,6 @@ DEFINE_CACHE_ALIGN_BUFFER(u8, control_req, USB_BUFSIZ);
 DEFINE_CACHE_ALIGN_BUFFER(u8, status_req, STATUS_BYTECOUNT);
 #endif
 
-
-/**
- * strlcpy - Copy a %NUL terminated string into a sized buffer
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- * @size: size of destination buffer
- *
- * Compatible with *BSD: the result is always a valid
- * NUL-terminated string that fits in the buffer (unless,
- * of course, the buffer size is zero). It does not pad
- * out the result like strncpy() does.
- */
-size_t strlcpy(char *dest, const char *src, size_t size)
-{
-	size_t ret = strlen(src);
-
-	if (size) {
-		size_t len = (ret >= size) ? size - 1 : ret;
-		memcpy(dest, src, len);
-		dest[len] = '\0';
-	}
-	return ret;
-}
-
 /*============================================================================*/
 
 /*
include/linux/string.h +3 -0
index 8e44855..5c9d6c3 100644
@@ -23,6 +23,9 @@ extern __kernel_size_t strspn(const char *,const char *);
 #ifndef __HAVE_ARCH_STRCPY
 extern char * strcpy(char *,const char *);
 #endif
+#ifndef __HAVE_ARCH_STRLCPY
+extern __kernel_size_t strlcpy(char *, const char *, __kernel_size_t);
+#endif
 #ifndef __HAVE_ARCH_STRNCPY
 extern char * strncpy(char *,const char *, __kernel_size_t);
 #endif
lib/string.c +25 -0
index 29c2ca7..adf718c 100644
@@ -80,6 +80,31 @@ char * strcpy(char * dest,const char *src)
 }
 #endif
 
+#ifndef __HAVE_ARCH_STRLCPY
+/**
+ * strlcpy - Copy a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
+ *
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero). It does not pad
+ * out the result like strncpy() does.
+ */
+size_t strlcpy(char *dest, const char *src, size_t size)
+{
+	size_t ret = strlen(src);
+
+	if (size) {
+		size_t len = (ret >= size) ? size - 1 : ret;
+		memcpy(dest, src, len);
+		dest[len] = '\0';
+	}
+	return ret;
+}
+#endif
+
 #ifndef __HAVE_ARCH_STRNCPY
 /**
  * strncpy - Copy a length-limited, %NUL-terminated string

--
1.7.9.5

#300 lore raw

PATCH v12 1/8 libc: move strlcpy() from ether.c to string.c

Quoted 10 lines · Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

It would be better to have strlcpy() moved to lib/string.c, so that it could be reused by others without enabling USB Gadget Ethernet.

CC Albert Aribaud <[email protected]>
CC Wolfgang Denk <[email protected]>
Cc Marek Vasut <[email protected]>

Good article on strlcpy() is here [1]. I suggest we remove strlcpy() altogether and use standard posix functions like strncpy() instead. I am on Ulrich Drepper side on this, strlcpy() is just hiding bugs.

[1] https://lwn.net/Articles/507319/

Best regards,
Marek Vasut

#301 lore raw

PATCH v12 1/8 libc: move strlcpy() from ether.c to string.c

2014-04-01 17:16 GMT+08:00 Marek Vasut <[email protected]>:

Quoted 12 lines · Kuo-Jung Su
Quoted 10 lines

From: Kuo-Jung Su <[email protected]>

It would be better to have strlcpy() moved to lib/string.c, so that it could be reused by others without enabling USB Gadget Ethernet.

CC Albert Aribaud <[email protected]>
CC Wolfgang Denk <[email protected]>
Cc Marek Vasut <[email protected]>
Quoted 6 lines

Good article on strlcpy() is here [1]. I suggest we remove strlcpy() altogether and use standard posix functions like strncpy() instead. I am on Ulrich Drepper side on this, strlcpy() is just hiding bugs.

[1] https://lwn.net/Articles/507319/

Agree, I'll use strncpy instead of strlcpy in drivers/clk/clkdev.c & drivers/usb/gadget/ether.c

And the patch for drivers/usb/gadget/ether.c would not be bonded to this patch series.

Signature · 2 lines
Best wishes,
Kuo-Jung Su
#302 lore raw

PATCH v12 1/8 libc: move strlcpy() from ether.c to string.c

Quoted 17 lines · Kuo-Jung Su

2014-04-01 17:16 GMT+08:00 Marek Vasut <[email protected]>:

Quoted 16 lines · Kuo-Jung Su
Quoted 10 lines

From: Kuo-Jung Su <[email protected]>

It would be better to have strlcpy() moved to lib/string.c, so that it could be reused by others without enabling USB Gadget Ethernet.

CC Albert Aribaud <[email protected]>
CC Wolfgang Denk <[email protected]>
Cc Marek Vasut <[email protected]>

Good article on strlcpy() is here [1]. I suggest we remove strlcpy() altogether and use standard posix functions like strncpy() instead. I am on Ulrich Drepper side on this, strlcpy() is just hiding bugs.

Quoted 7 lines
Quoted 1 line

[1] https://lwn.net/Articles/507319/

Agree, I'll use strncpy instead of strlcpy in drivers/clk/clkdev.c & drivers/usb/gadget/ether.c

And the patch for drivers/usb/gadget/ether.c would not be bonded to this patch series.

Can you please remove that strlcpy() implementation while at it ?

Best regards,
Marek Vasut

#303 lore raw

PATCH v12 1/8 libc: move strlcpy() from ether.c to string.c

2014-04-03 16:16 GMT+08:00 Marek Vasut <[email protected]>:

Quoted 23 lines · Kuo-Jung Su
Quoted 22 lines

2014-04-01 17:16 GMT+08:00 Marek Vasut <[email protected]>:

Quoted 12 lines · Kuo-Jung Su
Quoted 10 lines

From: Kuo-Jung Su <[email protected]>

It would be better to have strlcpy() moved to lib/string.c, so that it could be reused by others without enabling USB Gadget Ethernet.

CC Albert Aribaud <[email protected]>
CC Wolfgang Denk <[email protected]>
Cc Marek Vasut <[email protected]>
Quoted 5 lines

Good article on strlcpy() is here [1]. I suggest we remove strlcpy() altogether and use standard posix functions like strncpy() instead. I am on Ulrich Drepper side on this, strlcpy() is just hiding bugs.

[1] https://lwn.net/Articles/507319/

Agree, I'll use strncpy instead of strlcpy in drivers/clk/clkdev.c & drivers/usb/gadget/ether.c

Quoted 7 lines
Quoted 2 lines

And the patch for drivers/usb/gadget/ether.c would not be bonded to this patch series.

Can you please remove that strlcpy() implementation while at it ?

Best regards,
Marek Vasut

Sure, but I'm still waiting for more inputs, so it would be delivered few days later.

Signature · 2 lines
Best wishes,
Kuo-Jung Su
#304 lore raw

PATCH v12 2/8 arm: add legacy linux clock framework support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

This ports the legacy linux clock framework from linux-3.10 (i.e., no common clock support)

Please check the list bellow for details:

1. CONFIG_CLKDEV_LOOKUP
- Core clock management APIs
- clk_get_sys(), clk_put(), clkdev_add(), clkdev_add_table() clkdev_alloc(), clkdev_drop(), clk_register_clkdev(), clk_register_clkdevs()

2. CONFIG_HAVE_MACH_CLKDEV (CONFIG_HAVE_ARCH_CLKDEV in U-Boot)
- Use this to have machine specific structs & defines included in asm/clkdev.h

3. CONFIG_HAVE_CLK_PREPARE
- This prepares the clock source for use
- clk_prepare(), clk_unprepare()

CC Albert Aribaud <[email protected]>
CC Wolfgang Denk <[email protected]>

---
Changes for v12:
- Initial commit

 arch/arm/include/asm/clkdev.h |   29 ++++++
 drivers/Makefile              |    1 +
 drivers/clk/Makefile          |    8 ++
 drivers/clk/clkdev.c          |  207 +++++++++++++++++++++++++++++++++++++++++
 include/linux/clk.h           |  181 +++++++++++++++++++++++++++++++++++
 include/linux/clkdev.h        |   45 +++++++++
 6 files changed, 471 insertions(+)
 create mode 100644 arch/arm/include/asm/clkdev.h
 create mode 100644 drivers/clk/Makefile
 create mode 100644 drivers/clk/clkdev.c
 create mode 100644 include/linux/clk.h
 create mode 100644 include/linux/clkdev.h
arch/arm/include/asm/clkdev.h new file +29 -0
new file mode 100644
index 0000000..2b605aa
@@ -0,0 +1,29 @@
+/*
+ *  arch/arm/include/asm/clkdev.h
+ *
+ *  Copyright (C) 2008 Russell King.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Helper for the clk API to assist looking up a struct clk.
+ */
+#ifndef __ASM_CLKDEV_H
+#define __ASM_CLKDEV_H
+
+#ifdef CONFIG_HAVE_ARCH_CLKDEV
+#include <asm/arch/clkdev.h>
+#else
+#define __clk_get(clk)	({ 1; })
+#define __clk_put(clk)	do { } while (0)
+#endif
+
+#include <malloc.h>
+
+static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
+{
+	return calloc(1, size);
+}
+
+#endif
drivers/Makefile +1 -0
index 5d03f37..b1aba5e 100644
@@ -1,6 +1,7 @@
 obj-$(CONFIG_BIOSEMU) += bios_emulator/
 obj-y += block/
 obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/
+obj-y += clk/
 obj-y += crypto/
 obj-$(CONFIG_FPGA) += fpga/
 obj-y += hwmon/
drivers/clk/Makefile new file +8 -0
new file mode 100644
index 0000000..d1479d2
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2007
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o
drivers/clk/clkdev.c new file +207 -0

207 lines not on this page · raw message

include/linux/clk.h new file +181 -0

181 lines not on this page · raw message

include/linux/clkdev.h new file +45 -0

45 lines not on this page · raw message

--
1.7.9.5

#305 lore raw

PATCH v12 3/8 arm: add Faraday ARMv5TE platform common libraries

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

This includes the Faraday ARMv5TE core support and generic clock framework.

Here is the list of verified Faraday ARM cores:

1. FA606TE (ARMv5TE, no mmu)
2. FA626TE (ARMv5TE)

CC Albert Aribaud <[email protected]>

---
Changes for v12:
- Add Linux legacy clock framework support (no common clock).
- Migrate to generic board model (CONFIG_SYS_GENERIC_BOARD).
- Drop pre-defined Ethernet MAC for all platforms.
- Drop USB-DFU support due to lack of registered Vendor ID.
- CONFIG_SYS_MAXARGS: 32 -> 8
- CONFIG_CMD_AUTOSCRIPT -> CONFIG_CMD_SOURCE

Changes for v11:
- Nothing updates

Changes for v10:
- Merge [arm: add Faraday SoC helper files]

Changes for v9:
- Build 'arch_preboot_os()' only when CONFIG_CMD_BOOTM is defined.
- Add do_go_exec() to override the default behavior of 'go' command.

Changes for v8:
- add arm_init_before_mmu() & mmu_page_table_flush()

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Initial commit

 arch/arm/cpu/faraday/Makefile    |   10 +
 arch/arm/cpu/faraday/cache.c     |  164 +++++++++++++++
 arch/arm/cpu/faraday/clk.c       |   67 +++++++
 arch/arm/cpu/faraday/config.mk   |   15 ++
 arch/arm/cpu/faraday/cpu.c       |  116 +++++++++++
 arch/arm/cpu/faraday/start.S     |  407 ++++++++++++++++++++++++++++++++++++++
 drivers/i2c/fti2c010.c           |    3 +-
 drivers/mmc/ftsdc010_mci.c       |    3 +-
 drivers/mmc/ftsdc021_sdhci.c     |    3 +-
 drivers/spi/ftssp010_spi.c       |    3 +-
 include/configs/faraday-common.h |  276 ++++++++++++++++++++++++++
 include/faraday/clkdev.h         |   19 ++
 12 files changed, 1082 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/cache.c
 create mode 100644 arch/arm/cpu/faraday/clk.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/start.S
 create mode 100644 include/configs/faraday-common.h
 create mode 100644 include/faraday/clkdev.h
arch/arm/cpu/faraday/Makefile new file +10 -0
new file mode 100644
index 0000000..ab8d5f8
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y := start.o
+
+obj-y   += cpu.o cache.o clk.o
arch/arm/cpu/faraday/cache.c new file +164 -0

164 lines not on this page · raw message

arch/arm/cpu/faraday/clk.c new file +67 -0

67 lines not on this page · raw message

arch/arm/cpu/faraday/config.mk new file +15 -0
new file mode 100644
index 0000000..f39e70b
@@ -0,0 +1,15 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_CPPFLAGS += -march=armv5te
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/faraday/cpu.c new file +116 -0

116 lines not on this page · raw message

arch/arm/cpu/faraday/start.S new file +407 -0

407 lines not on this page · raw message

drivers/i2c/fti2c010.c +2 -1
index 68d9a42..a4e7efc 100644
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <linux/clk.h>
 #include <i2c.h>
 
 #include "fti2c010.h"
@@ -22,7 +23,7 @@
 #endif
 
 #ifndef CONFIG_FTI2C010_CLOCK
-#define CONFIG_FTI2C010_CLOCK   clk_get_rate("I2C")
+#define CONFIG_FTI2C010_CLOCK   clk_get_rate(clk_get_sys(NULL, "I2C"))
 #endif
 
 #ifndef CONFIG_FTI2C010_TIMEOUT
drivers/mmc/ftsdc010_mci.c +2 -1
index a620678..f2ab0c5 100644
@@ -15,6 +15,7 @@
 #include <asm/io.h>
 #include <asm/errno.h>
 #include <asm/byteorder.h>
+#include <linux/clk.h>
 #include <faraday/ftsdc010.h>
 
 #define CFG_CMD_TIMEOUT (CONFIG_SYS_HZ >> 4) /* 250 ms */
@@ -339,7 +340,7 @@ int ftsdc010_mmc_init(int devid)
 #ifdef CONFIG_SYS_CLK_FREQ
 	chip->sclk = CONFIG_SYS_CLK_FREQ;
 #else
-	chip->sclk = clk_get_rate("SDC");
+	chip->sclk = clk_get_rate(clk_get_sys(NULL, "MMC"));
 #endif
 
 	chip->cfg.name = "ftsdc010";
drivers/mmc/ftsdc021_sdhci.c +2 -1
index 1f6cdba..6244dac 100644
@@ -8,9 +8,10 @@
 #include <common.h>
 #include <malloc.h>
 #include <sdhci.h>
+#include <linux/clk.h>
 
 #ifndef CONFIG_FTSDC021_CLOCK
-#define CONFIG_FTSDC021_CLOCK   clk_get_rate("MMC")
+#define CONFIG_FTSDC021_CLOCK   clk_get_rate(clk_get_sys(NULL, "MMC"))
 #endif
 
 int ftsdc021_sdhci_init(u32 regbase)
drivers/spi/ftssp010_spi.c +2 -1
index aa3b5a0..c590dd5 100644
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <linux/clk.h>
 #include <linux/compat.h>
 #include <asm/io.h>
 #include <malloc.h>
@@ -25,7 +26,7 @@
 #endif
 
 #ifndef CONFIG_FTSSP010_CLOCK
-#define CONFIG_FTSSP010_CLOCK       clk_get_rate("SSP");
+#define CONFIG_FTSSP010_CLOCK       clk_get_rate(clk_get_sys(NULL, "SSP"))
 #endif
 
 #ifndef CONFIG_FTSSP010_TIMEOUT
include/configs/faraday-common.h new file +276 -0

276 lines not on this page · raw message

include/faraday/clkdev.h new file +19 -0
new file mode 100644
index 0000000..b879d55
@@ -0,0 +1,19 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __FARADAY_CLKDEV_H
+#define __FARADAY_CLKDEV_H
+
+struct faraday_clk_ops {
+	int (*enable)(void);
+	void (*disable)(void);
+	unsigned long (*get_rate)(void);
+	long (*round_rate)(unsigned long rate);
+	int (*set_rate)(unsigned long rate);
+};
+
+#endif /* __FARADAY_CLKDEV_H */

--
1.7.9.5

#306 lore raw

PATCH v12 4/8 arm: faraday: add FTTMR010 timer suppor

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTTMR010 is a simple APB device which supports generic timer functions.

CC Albert Aribaud <[email protected]>

---
Changes for v12:
- Rollback to v10.
Because we now always have core.[ch] inside arch/arm/cpu/faraday/<soc>/, so it's no longer necessary to add some object files in 'arch/arm/cpu/faraday/<soc>/Makefile' to avoid linking errors.

Changes for v11:
- Directly specify the timer object in 'arch/arm/cpu/faraday/<soc>/Makefile' instead of using CONFIG_FTTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v8, v9, v10:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile   |    2 +
 arch/arm/cpu/faraday/fttmr010.c |  123 +++++++++++++++++++++++++++++++++++++++
 include/faraday/fttmr010.h      |   17 ++++++
 3 files changed, 142 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c
arch/arm/cpu/faraday/Makefile +2 -0
index ab8d5f8..521147f 100644
@@ -8,3 +8,5 @@
 extra-y := start.o
 
 obj-y   += cpu.o cache.o clk.o
+
+obj-$(CONFIG_FTTMR010)    += fttmr010.o
arch/arm/cpu/faraday/fttmr010.c new file +123 -0

123 lines not on this page · raw message

include/faraday/fttmr010.h +17 -0
index 2ab68d1..21ab113 100644
@@ -45,6 +45,16 @@ struct fttmr010 {
 #define FTTMR010_TM1_CLOCK	(1 << 1)
 #define FTTMR010_TM1_ENABLE	(1 << 0)
 
+#define FTTMR010_TM1_CRMASK \
+	(FTTMR010_TM1_UPDOWN | FTTMR010_TM1_OFENABLE \
+	| FTTMR010_TM1_CLOCK | FTTMR010_TM1_ENABLE)
+#define FTTMR010_TM2_CRMASK \
+	(FTTMR010_TM2_UPDOWN | FTTMR010_TM2_OFENABLE \
+	| FTTMR010_TM2_CLOCK | FTTMR010_TM2_ENABLE)
+#define FTTMR010_TM3_CRMASK \
+	(FTTMR010_TM3_UPDOWN | FTTMR010_TM3_OFENABLE \
+	| FTTMR010_TM3_CLOCK | FTTMR010_TM3_ENABLE)
+
 /*
  * Timer Interrupt State & Mask Registers
  */
@@ -58,4 +68,11 @@ struct fttmr010 {
 #define FTTMR010_TM1_MATCH2	(1 << 1)
 #define FTTMR010_TM1_MATCH1	(1 << 0)
 
+#define FTTMR010_TM1_ISRMASK \
+	(FTTMR010_TM1_OVERFLOW | FTTMR010_TM1_MATCH2 | FTTMR010_TM1_MATCH1)
+#define FTTMR010_TM2_ISRMASK \
+	(FTTMR010_TM2_OVERFLOW | FTTMR010_TM2_MATCH2 | FTTMR010_TM2_MATCH1)
+#define FTTMR010_TM3_ISRMASK \
+	(FTTMR010_TM3_OVERFLOW | FTTMR010_TM3_MATCH2 | FTTMR010_TM3_MATCH1)
+
 #endif	/* __FTTMR010_H */

--
1.7.9.5

#307 lore raw

PATCH v12 5/8 arm: faraday: add FTPWMTMR010 timer support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday FTPWMTMR010 is a simple APB device which supports both timer and pwm functions.

CC Albert Aribaud <[email protected]>

---
Changes for v12:
- Rollback to v10.
Because we now always have core.[ch] inside arch/arm/cpu/faraday/<soc>/, so it's no longer necessary to add some object files in 'arch/arm/cpu/faraday/<soc>/Makefile' to avoid linking errors.

Changes for v11:
- Directly specify the timer object in 'arch/arm/cpu/faraday/<soc>/Makefile' instead of using CONFIG_FTPWMTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v8, v9, v10:
- Nothing updates

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:
- Nothing updates

Changes for v5:
- Drop IRQ dependant implementation
- Use gd->arch.timer_rate_hz for timer clock source
- Use gd->arch.tbl for timestamp

Changes for v4:
- Coding Style cleanup.
- Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.

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().

 arch/arm/cpu/faraday/Makefile      |    1 +
 arch/arm/cpu/faraday/ftpwmtmr010.c |  112 ++++++++++++++++++++++++++++++++++++
 include/faraday/ftpwmtmr010.h      |   41 +++++++++++++
 3 files changed, 154 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 create mode 100644 include/faraday/ftpwmtmr010.h
arch/arm/cpu/faraday/Makefile +1 -0
index 521147f..fe9fb21 100644
@@ -10,3 +10,4 @@ extra-y := start.o
 obj-y   += cpu.o cache.o clk.o
 
 obj-$(CONFIG_FTTMR010)    += fttmr010.o
+obj-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o
arch/arm/cpu/faraday/ftpwmtmr010.c new file +112 -0

112 lines not on this page · raw message

include/faraday/ftpwmtmr010.h new file +41 -0

41 lines not on this page · raw message

--
1.7.9.5

#308 lore raw

PATCH v12 6/8 arm: faraday: add A369 evaluation board support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

The A369 is an ARM CPU-based SoC with rich SoC features and convenient FPGA link for building fast system prototyping and mass production.

More information about this hardware can be found at:
http://www.faraday-tech.com/html/Product/SoCPlatform/SoCreativeIII.htm

CC Albert Aribaud <[email protected]>

---
Changes for v12:
- Add Linux legacy clock framework support (no common clock).
- Drop board_early_init_f()
- Coding style cleanup

Changes for v11:
- Fix boards.cfg (due to commit 3fa67050)
- Rename <asm/sizes.h> to <linux/sizes.h> (due to commit 1ace4022)
- Directly specify the timer object in 'arch/arm/cpu/faraday/a369/Makefile' instead of using CONFIG_FTPWMTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v10:
- Merge [arm: faraday: ftsmc020: add a fail-safe macro constant]

Changes for v9:
- Revise the commit message.

Changes for v8:
- Make A369 a standalong changeset.

Changes for v7:
- Update license to use SPDX identifiers.

Changes for v6:

	- arch/arm/cpu/faraday/cpu.c:
	  struct ftwdt010_wdt __iomem *regs -> struct ftwdt010_wdt *regs

Changes for v5:
- Coding Style cleanup:
1. struct chip_regs __iomem *regs -> struct chip_regs *regs
2. Move Faraday specific APIs into asm/arch-faraday/*.h
- Fix Copyright notices (dates) throughout the patch
- Define Faraday machine type in board's config header file
- Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
- Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch would restart after this patch series have been accepted.
- Revise clock management system

Changes for v4:
- Coding Style cleanup.
- Break-down the interrupt, timers and common utilties.

Changes for v3:
- Coding Style cleanup.
- Drop macros for wirtel()/readl(), call them directly.
- Always insert a blank line between declarations and code.
- Add '__iomem' to all the declaration of HW register pointers.
- 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().

 arch/arm/cpu/faraday/a369/Makefile        |    8 ++
 arch/arm/cpu/faraday/a369/clock.c         |   87 ++++++++++++
 arch/arm/cpu/faraday/a369/core.c          |   21 +++
 arch/arm/cpu/faraday/a369/core.h          |   15 ++
 arch/arm/cpu/faraday/a369/pinmux.c        |   37 +++++
 arch/arm/include/asm/arch-a369/clkdev.h   |   20 +++
 arch/arm/include/asm/arch-a369/hardware.h |   88 ++++++++++++
 arch/arm/include/asm/arch-a369/sysc.h     |  211 +++++++++++++++++++++++++++++
 board/faraday/a369evb/Makefile            |    9 ++
 board/faraday/a369evb/board.c             |  118 ++++++++++++++++
 board/faraday/a369evb/lowlevel_init.S     |   15 ++
 boards.cfg                                |    1 +
 include/configs/a369.h                    |  104 ++++++++++++++
 include/faraday/ftsmc020.h                |    1 +
 14 files changed, 735 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/a369/Makefile
 create mode 100644 arch/arm/cpu/faraday/a369/clock.c
 create mode 100644 arch/arm/cpu/faraday/a369/core.c
 create mode 100644 arch/arm/cpu/faraday/a369/core.h
 create mode 100644 arch/arm/cpu/faraday/a369/pinmux.c
 create mode 100644 arch/arm/include/asm/arch-a369/clkdev.h
 create mode 100644 arch/arm/include/asm/arch-a369/hardware.h
 create mode 100644 arch/arm/include/asm/arch-a369/sysc.h
 create mode 100644 board/faraday/a369evb/Makefile
 create mode 100644 board/faraday/a369evb/board.c
 create mode 100644 board/faraday/a369evb/lowlevel_init.S
 create mode 100644 include/configs/a369.h
arch/arm/cpu/faraday/a369/Makefile new file +8 -0
new file mode 100644
index 0000000..8f14bfd
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y := core.o clock.o pinmux.o
arch/arm/cpu/faraday/a369/clock.c new file +87 -0

87 lines not on this page · raw message

arch/arm/cpu/faraday/a369/core.c new file +21 -0
new file mode 100644
index 0000000..f3eec4a
@@ -0,0 +1,21 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include "core.h"
+
+/*
+ * This arch_cpu_init() overrides the weak function
+ * in "arch/arm/lib/board.c".
+ */
+int arch_cpu_init(void)
+{
+	pinmux_init();
+	clock_init();
+	return 0;
+}
arch/arm/cpu/faraday/a369/core.h new file +15 -0
new file mode 100644
index 0000000..558950e
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __A369_CORE_H
+#define __A369_CORE_H
+
+void clock_init(void);
+void pinmux_init(void);
+
+#endif
arch/arm/cpu/faraday/a369/pinmux.c new file +37 -0
new file mode 100644
index 0000000..41cd83d
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/sysc.h>
+
+static struct sysc_regs *sysc = (void __iomem *)CONFIG_SYSC_BASE;
+
+void pinmux_init(void)
+{
+	/* If it's an external CPU */
+	if (readl(&sysc->ehwcfg) & EHWCFG_EXTCPU) {
+		writel(HCLKGR_CPUM | HCLKGR_CPUS | HCLKGR_ISP,
+		       &sysc->hclkgr);
+		setbits_le32(&sysc->gpmux, GPMUX_EXTIRQ);
+	} else {
+#ifdef CONFIG_A369_EXTAHB
+		/* Enable external AHB */
+		writel(HCLKGR_CPUS, &sysc->hclkgr);
+		writel(GPMUX_DEFAULT, &sysc->gpmux);
+		clrbits_le32(&sysc->sccfg[0], SCCFG0_EXTAHB_MASK);
+		setbits_le32(&sysc->sccfg[0], SCCFG0_EXTAHB_FREQ(8));
+#else
+		/* Enable SD1 */
+		writel(MFPMUX0_DEFAULT, &sysc->mfpmux[0]);
+#endif
+	}
+
+	/* Clock: SD = AHB, SSP = APB (SPI mode) */
+	writel(SCCFG1_DEFAULT, &sysc->sccfg[1]);
+}
arch/arm/include/asm/arch-a369/clkdev.h new file +20 -0
new file mode 100644
index 0000000..912b46a
@@ -0,0 +1,20 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_CLKDEV_H
+#define __ASM_ARCH_CLKDEV_H
+
+#include <faraday/clkdev.h>
+
+struct clk {
+	struct faraday_clk_ops ops;
+};
+
+#define __clk_get(clk) ({ 1; })
+#define __clk_put(clk) do { } while (0)
+
+#endif /* __ASM_ARCH_CLKDEV_H */
arch/arm/include/asm/arch-a369/hardware.h new file +88 -0

88 lines not on this page · raw message

arch/arm/include/asm/arch-a369/sysc.h new file +211 -0

211 lines not on this page · raw message

board/faraday/a369evb/Makefile new file +9 -0
new file mode 100644
index 0000000..920ce43
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, [email protected].
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o
+obj-y	+= lowlevel_init.o
board/faraday/a369evb/board.c new file +118 -0

118 lines not on this page · raw message

board/faraday/a369evb/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..2085760
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index 69c8936..49c4f85 100644
@@ -390,6 +390,7 @@ Active  arm         armv7:arm720t  tegra20     toradex         colibri_t20_iris
 Active  arm         armv7:arm720t  tegra30     avionic-design  tec-ng              tec-ng                               -                                                                                                                                 Alban Bedel <[email protected]>
 Active  arm         armv7:arm720t  tegra30     nvidia          beaver              beaver                               -                                                                                                                                 Tom Warren <[email protected]>:Stephen Warren <[email protected]>
 Active  arm         armv7:arm720t  tegra30     nvidia          cardhu              cardhu                               -                                                                                                                                 Tom Warren <[email protected]>
+Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
 Active  arm         pxa            -           -               -                   balloon3                             -                                                                                                                                 Marek Vasut <[email protected]>
 Active  arm         pxa            -           -               -                   h2200                                -                                                                                                                                 Lukasz Dalek <[email protected]>
 Active  arm         pxa            -           -               -                   palmld                               -                                                                                                                                 Marek Vasut <[email protected]>
include/configs/a369.h new file +104 -0

104 lines not on this page · raw message

include/faraday/ftsmc020.h +1 -0
index 54120ab..485d7c2 100644
@@ -70,5 +70,6 @@ void ftsmc020_init(void);
 #define FTSMC020_TPR_WTC(x)	(((x) & 0x3) << 6)
 #define FTSMC020_TPR_AHT(x)	(((x) & 0x3) << 4)
 #define FTSMC020_TPR_TRNA(x)	(((x) & 0xf) << 0)
+#define FTSMC020_TPR_FAILSAFE	0x0f1ff3ff /* fail-safe timing */
 
 #endif	/* __FTSMC020_H */

--
1.7.9.5

#309 lore raw

PATCH v12 7/8 arm: faraday: add missing header file for FTSDC021

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

For the Faraday FTSDC021 (SDHCI) controller driver source is sent out before the patches for Faraday Virtual Machine (FVM) which actually uses this chip.

So its header file (ftsdc021.h) has been accidentally removed by commit 3b98b57fa.

This patch simply rollback this removal.

CC Albert Aribaud <[email protected]>

---
Changes for v11, v12:
- Nothing updates

Changes for v10:
- Initial commit

 include/faraday/ftsdc021.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 include/faraday/ftsdc021.h
include/faraday/ftsdc021.h new file +13 -0
new file mode 100644
index 0000000..de8e250
@@ -0,0 +1,13 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __FTSDC021_H
+#define __FTSDC021_H
+
+int ftsdc021_sdhci_init(u32 regbase);
+
+#endif /* __FTSDC021_H */

--
1.7.9.5

#310 lore raw

PATCH v12 8/8 arm: faraday: add faraday virtual machine support

In reply to Kuo-Jung Su

From: Kuo-Jung Su <[email protected]>

Faraday Virtual Machine (FVM) is a QEMU based emulator which is designed for early stage software development (i.e., IPL, SPL development).

Please check the link bellow for details:
https://github.com/dantesu1218/qemu/blob/qemu-1.5.1/hw/arm/faraday_fvm.c

CC Albert Aribaud <[email protected]>

---
Changes for v12:
- Add Linux legacy clock framework support (no common clock).
- Drop board_early_init_f()
- Coding style cleanup

Changes for v11:
- Fix boards.cfg (due to commit 3fa67050)
- Rename <asm/sizes.h> to <linux/sizes.h> (due to commit 1ace4022)
- Directly specify the timer object in 'arch/arm/cpu/faraday/fvm/Makefile' instead of using CONFIG_FTTMR010 in 'arch/arm/cpu/faraday/Makefile'

Changes for v10:
- Nothing updates

Changes for v9:
- Initial commit

 arch/arm/cpu/faraday/fvm/Makefile        |    8 ++++
 arch/arm/cpu/faraday/fvm/clock.c         |   70 +++++++++++++++++++++++++++
 arch/arm/cpu/faraday/fvm/core.c          |   20 ++++++++
 arch/arm/cpu/faraday/fvm/core.h          |   14 ++++++
 arch/arm/include/asm/arch-fvm/clkdev.h   |   20 ++++++++
 arch/arm/include/asm/arch-fvm/hardware.h |   76 ++++++++++++++++++++++++++++++
 board/faraday/fvm/Makefile               |    9 ++++
 board/faraday/fvm/board.c                |   65 +++++++++++++++++++++++++
 board/faraday/fvm/lowlevel_init.S        |   15 ++++++
 boards.cfg                               |    1 +
 include/configs/fvm.h                    |   68 ++++++++++++++++++++++++++
 11 files changed, 366 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fvm/Makefile
 create mode 100644 arch/arm/cpu/faraday/fvm/clock.c
 create mode 100644 arch/arm/cpu/faraday/fvm/core.c
 create mode 100644 arch/arm/cpu/faraday/fvm/core.h
 create mode 100644 arch/arm/include/asm/arch-fvm/clkdev.h
 create mode 100644 arch/arm/include/asm/arch-fvm/hardware.h
 create mode 100644 board/faraday/fvm/Makefile
 create mode 100644 board/faraday/fvm/board.c
 create mode 100644 board/faraday/fvm/lowlevel_init.S
 create mode 100644 include/configs/fvm.h
arch/arm/cpu/faraday/fvm/Makefile new file +8 -0
new file mode 100644
index 0000000..5836aff
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y := core.o clock.o
arch/arm/cpu/faraday/fvm/clock.c new file +70 -0

70 lines not on this page · raw message

arch/arm/cpu/faraday/fvm/core.c new file +20 -0
new file mode 100644
index 0000000..318fe72
@@ -0,0 +1,20 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include "core.h"
+
+/*
+ * This arch_cpu_init() overrides the weak function
+ * in "arch/arm/lib/board.c".
+ */
+int arch_cpu_init(void)
+{
+	clock_init();
+	return 0;
+}
arch/arm/cpu/faraday/fvm/core.h new file +14 -0
new file mode 100644
index 0000000..937c780
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __FVM_CORE_H
+#define __FVM_CORE_H
+
+void clock_init(void);
+
+#endif
arch/arm/include/asm/arch-fvm/clkdev.h new file +20 -0
new file mode 100644
index 0000000..912b46a
@@ -0,0 +1,20 @@
+/*
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_CLKDEV_H
+#define __ASM_ARCH_CLKDEV_H
+
+#include <faraday/clkdev.h>
+
+struct clk {
+	struct faraday_clk_ops ops;
+};
+
+#define __clk_get(clk) ({ 1; })
+#define __clk_put(clk) do { } while (0)
+
+#endif /* __ASM_ARCH_CLKDEV_H */
arch/arm/include/asm/arch-fvm/hardware.h new file +76 -0

76 lines not on this page · raw message

board/faraday/fvm/Makefile new file +9 -0
new file mode 100644
index 0000000..920ce43
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= board.o
+obj-y	+= lowlevel_init.o
board/faraday/fvm/board.c new file +65 -0

65 lines not on this page · raw message

board/faraday/fvm/lowlevel_init.S new file +15 -0
new file mode 100644
index 0000000..cbc006d
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2013
+ * Faraday Technology Corporation. <http://www.faraday-tech.com/tw/>
+ * Kuo-Jung Su <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <config.h>
+#include <version.h>
+
+/* Set up the platform, once the cpu has been initialized */
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc,lr
boards.cfg +1 -0
index 49c4f85..824d1d0 100644
@@ -391,6 +391,7 @@ Active  arm         armv7:arm720t  tegra30     avionic-design  tec-ng
 Active  arm         armv7:arm720t  tegra30     nvidia          beaver              beaver                               -                                                                                                                                 Tom Warren <[email protected]>:Stephen Warren <[email protected]>
 Active  arm         armv7:arm720t  tegra30     nvidia          cardhu              cardhu                               -                                                                                                                                 Tom Warren <[email protected]>
 Active  arm         faraday        a369        faraday         a369evb             a369evb                              a369                                                                                                                              Kuo-Jung Su <[email protected]>
+Active  arm         faraday        fvm         faraday         -                   fvm                                  -                                                                                                                                 Kuo-Jung Su <[email protected]>
 Active  arm         pxa            -           -               -                   balloon3                             -                                                                                                                                 Marek Vasut <[email protected]>
 Active  arm         pxa            -           -               -                   h2200                                -                                                                                                                                 Lukasz Dalek <[email protected]>
 Active  arm         pxa            -           -               -                   palmld                               -                                                                                                                                 Marek Vasut <[email protected]>
include/configs/fvm.h new file +68 -0

68 lines not on this page · raw message

--
1.7.9.5