Support for ST-Ericsson snowball board
Subsystems (4)
cover Support for ST-Ericsson snowball board
From: "Mathieu J. Poirier" <[email protected]>
This set adds support for the ST-Ericsson u8500 based snowball board. Doing so it moves u8500-href code around to allow for code reuse between boards.
It was sent out during the 12.07 cycle but never received an official ACK.
John Rigby (1):
u8500: Separating mmc config parameters from driver
Mathieu J. Poirier (10):
snowball: Add support for ux500 based snowball board
u8500: Moving prcmu to cpu directory
snowball: Adding architecture dependent initialisation
snowball: Adding CPU clock initialisation
snowball: Moving to ux500.v2 addess scheme for PRCMU access
snowball: applying power to LAN and GBF controllers
u8500: Moving processor-specific functions to cpu area.
u8500: Enabling power to MMC device on AB8500 V2
armv7: Adding cpu specific cache managmenent
snowball: Adding board specific cache cleanup routine
MAINTAINERS | 4 + arch/arm/cpu/armv7/cpu.c | 8 + arch/arm/cpu/armv7/u8500/Makefile | 2 +- arch/arm/cpu/armv7/u8500/clock.c | 34 + arch/arm/cpu/armv7/u8500/cpu.c | 192 ++++++ arch/arm/cpu/armv7/u8500/prcmu.c | 229 +++++++ arch/arm/include/asm/arch-u8500/clock.h | 5 +- arch/arm/include/asm/arch-u8500/db8500_gpio.h | 42 ++ arch/arm/include/asm/arch-u8500/db8500_pincfg.h | 170 +++++ arch/arm/include/asm/arch-u8500/hardware.h | 33 +- arch/arm/include/asm/arch-u8500/prcmu.h | 76 +++ arch/arm/include/asm/arch-u8500/sys_proto.h | 1 + board/armltd/vexpress/ca9x4_ct_vxp.c | 21 +- board/st-ericsson/snowball/Makefile | 51 ++ board/st-ericsson/snowball/db8500_pins.h | 745 +++++++++++++++++++++++ board/st-ericsson/snowball/snowball.c | 367 +++++++++++ board/st-ericsson/u8500/Makefile | 2 +- board/st-ericsson/u8500/prcmu-fw.h | 55 -- board/st-ericsson/u8500/prcmu.c | 165 ----- board/st-ericsson/u8500/u8500_href.c | 99 +--- boards.cfg | 1 + drivers/gpio/Makefile | 1 + drivers/gpio/db8500_gpio.c | 225 +++++++ drivers/mmc/arm_pl180_mmci.c | 132 ++--- drivers/mmc/arm_pl180_mmci.h | 27 +- drivers/serial/serial_pl01x.c | 2 + include/configs/snowball.h | 268 ++++++++ 27 files changed, 2566 insertions(+), 391 deletions(-) create mode 100644 arch/arm/cpu/armv7/u8500/cpu.c create mode 100644 arch/arm/cpu/armv7/u8500/prcmu.c create mode 100644 arch/arm/include/asm/arch-u8500/db8500_gpio.h create mode 100644 arch/arm/include/asm/arch-u8500/db8500_pincfg.h create mode 100644 arch/arm/include/asm/arch-u8500/prcmu.h create mode 100644 board/st-ericsson/snowball/Makefile create mode 100644 board/st-ericsson/snowball/db8500_pins.h create mode 100644 board/st-ericsson/snowball/snowball.c delete mode 100644 board/st-ericsson/u8500/prcmu-fw.h delete mode 100644 board/st-ericsson/u8500/prcmu.c create mode 100644 drivers/gpio/db8500_gpio.c create mode 100644 include/configs/snowball.h
Signature · 1 line
1.7.5.4
PATCH 1/11 snowball: Add support for ux500 based snowball board
From: "Mathieu J. Poirier" <[email protected]>
--- MAINTAINERS | 4 + arch/arm/include/asm/arch-u8500/db8500_gpio.h | 42 ++ arch/arm/include/asm/arch-u8500/db8500_pincfg.h | 170 +++++ board/st-ericsson/snowball/Makefile | 51 ++ board/st-ericsson/snowball/db8500_pins.h | 745 +++++++++++++++++++++++ board/st-ericsson/snowball/snowball.c | 185 ++++++ boards.cfg | 1 + drivers/gpio/Makefile | 1 + drivers/gpio/db8500_gpio.c | 225 +++++++ drivers/serial/serial_pl01x.c | 2 + include/configs/snowball.h | 258 ++++++++ 11 files changed, 1684 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-u8500/db8500_gpio.h create mode 100644 arch/arm/include/asm/arch-u8500/db8500_pincfg.h create mode 100644 board/st-ericsson/snowball/Makefile create mode 100644 board/st-ericsson/snowball/db8500_pins.h create mode 100644 board/st-ericsson/snowball/snowball.c create mode 100644 drivers/gpio/db8500_gpio.c create mode 100644 include/configs/snowball.h
MAINTAINERS +4 -0
@@ -959,6 +959,10 @@ Vladimir Zapolskiy <[email protected]> devkit3250 lpc32xx +Mathieu Poirier <[email protected]> + + snowball ARM ARMV7 (u8500 SoC) + ------------------------------------------------------------------------- Unknown / orphaned boards:
arch/arm/include/asm/arch-u8500/db8500_gpio.h new file +42 -0
42 lines not on this page · raw message
arch/arm/include/asm/arch-u8500/db8500_pincfg.h new file +170 -0
170 lines not on this page · raw message
board/st-ericsson/snowball/Makefile new file +51 -0
51 lines not on this page · raw message
board/st-ericsson/snowball/db8500_pins.h new file +745 -0
745 lines not on this page · raw message
board/st-ericsson/snowball/snowball.c new file +185 -0
185 lines not on this page · raw message
boards.cfg +1 -0
@@ -256,6 +256,7 @@ seaboard arm armv7 seaboard nvidia ventana arm armv7 ventana nvidia tegra2 whistler arm armv7 whistler nvidia tegra2 u8500_href arm armv7 u8500 st-ericsson u8500 +snowball arm armv7 snowball st-ericsson u8500 actux1_4_16 arm ixp actux1 - - actux1:FLASH2X2 actux1_4_32 arm ixp actux1 - - actux1:FLASH2X2,RAM_32MB actux1_8_16 arm ixp actux1 - - actux1:FLASH1X8
drivers/gpio/Makefile +1 -0
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_TEGRA_GPIO) += tegra_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o COBJS-$(CONFIG_ALTERA_PIO) += altera_pio.o COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o +COBJS-$(CONFIG_DB8500_GPIO) += db8500_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/db8500_gpio.c new file +225 -0
225 lines not on this page · raw message
drivers/serial/serial_pl01x.c +2 -0
@@ -156,6 +156,8 @@ int serial_init (void)writel (lcr, ®s->fr);writel (lcr, ®s->pl011_rlcr); +/* lcrh needs to be set again for change to be effective */ + writel(lcr, ®s->pl011_lcrh); }#endif /* Finally, enable the UART */
include/configs/snowball.h new file +258 -0
258 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 1/11 snowball: Add support for ux500 based snowball board
Quoted 4 lines · mathieu.poirier at linaro.org
From: "Mathieu J. Poirier" <[email protected]>
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>
[snip]
Quoted 1 line
+++ b/board/st-ericsson/snowball/Makefile
[snip]
Quoted 1 line
+#prcmu.o
Drop please.
[snip]
Quoted 15 lines
+++
b/board/st-ericsson/snowball/snowball.cboard/st-ericsson/snowball/snowball.c new file +14
-0+int dram_init (void ) +{ +uint32_t unused_cols_rows; +unsigned int nrows; +unsigned int ncols; + + gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; + gd->ram_size =PHYS_SDRAM_SIZE_1 ; + +/* +* Assumption: 2 CS active, both CS have same layout. +* 15 rows max, 11 cols max (controller spec). +* memory chip has 8 banks, I/O width 32 bit. +* The correct way would be to read MR#8: I/O width and density,
board/st-ericsson/snowball/snowball.c line 182
Quoted 10 lines
board/st-ericsson/snowball/snowball.c new file +10
-0+* but this requires locking against the PRCMU firmware. +* Simplified approach: +* Read number of unused rows and columns from mem controller. +* size = nCS x 2^(rows+cols) x nbanks x buswidth_bytes +*/ + unused_cols_rows =readl (DMC_CTL_97 ); + nrows =15 - (unused_cols_rows &0x07 ); + ncols =11 - ((unused_cols_rows &0x0700 ) >>8 ); + gd->ram_size = gd->bd->bi_dram[0 ].size = +2 * (1 << (nrows + ncols)) *8 *4 ;
Please use get_mem_size(CONFIG_SYS_SDRAM_BASE, possible-max-size) (and defining CONFIG_SYS_MAX_RAM_SIZE is common convention) instead of all the above.
[snip]
Quoted 1 line
+++
b/drivers/gpio/db8500_gpio.c
[snip]
drivers/gpio/db8500_gpio.c line 29
Quoted 5 lines
drivers/gpio/db8500_gpio.c new file +5
-0+/* +* Macros to work with IO space +* Not actually used? +*/ +#define __iomem
<linux/compiler.h> provides this for us, please use that instead.
Signature · 1 line
Tom
PATCH 1/11 snowball: Add support for ux500 based snowball board
Thanks for the review - see my comments below.
Mathieu.
Quoted 35 lines · Tom Rini
Quoted 4 lines · mathieu.poirier at linaro.org
From: "Mathieu J. Poirier" <[email protected]>
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>[snip]
Quoted 1 line
+++ b/board/st-ericsson/snowball/Makefile
[snip]
Quoted 1 line
+#prcmu.o
Drop please.
[snip]
Quoted 21 lines
+++
b/board/st-ericsson/snowball/snowball.cboard/st-ericsson/snowball/snowball.c new file +20
-0+int dram_init (void ) +{ +uint32_t unused_cols_rows; +unsigned int nrows; +unsigned int ncols; + + gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; + gd->ram_size =PHYS_SDRAM_SIZE_1 ; + +/* +* Assumption: 2 CS active, both CS have same layout. +* 15 rows max, 11 cols max (controller spec). +* memory chip has 8 banks, I/O width 32 bit. +* The correct way would be to read MR#8: I/O width and density, +* but this requires locking against the PRCMU firmware. +* Simplified approach: +* Read number of unused rows and columns from mem controller. +* size = nCS x 2^(rows+cols) x nbanks x buswidth_bytes +*/ + unused_cols_rows =readl (DMC_CTL_97 );
Quoted 9 lines
board/st-ericsson/snowball/snowball.c line 182
Quoted 4 lines
board/st-ericsson/snowball/snowball.c new file +4
-0+ nrows =15 - (unused_cols_rows &0x07 ); + ncols =11 - ((unused_cols_rows &0x0700 ) >>8 ); + gd->ram_size = gd->bd->bi_dram[0 ].size = +2 * (1 << (nrows + ncols)) *8 *4 ;Please use
get_mem_size(CONFIG_SYS_SDRAM_BASE, possible-max-size)(and definingCONFIG_SYS_MAX_RAM_SIZEis common convention) instead of all the above.
Is 'get_mem_size' supposed to be an existing API ? I grep'ed for it in the code to no avail.
Quoted 11 lines
[snip]
Quoted 1 line
+++
b/drivers/gpio/db8500_gpio.c[snip]
drivers/gpio/db8500_gpio.c line 29
Quoted 5 lines
drivers/gpio/db8500_gpio.c new file +5
-0+/* +* Macros to work with IO space +* Not actually used? +*/ +#define __iomem<
linux/compiler.h> provides this for us, please use that instead.
PATCH 1/11 snowball: Add support for ux500 based snowball board
Quoted 50 lines · Mathieu Poirier
Thanks for the review - see my comments below.
Mathieu.
Quoted 35 lines · Tom Rini
Quoted 4 lines · mathieu.poirier at linaro.org
From: "Mathieu J. Poirier" <[email protected]>
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>[snip]
Quoted 1 line
+++ b/board/st-ericsson/snowball/Makefile
[snip]
Quoted 1 line
+#prcmu.o
Drop please.
[snip]
Quoted 21 lines
+++
b/board/st-ericsson/snowball/snowball.cboard/st-ericsson/snowball/snowball.c new file +20
-0+int dram_init (void ) +{ +uint32_t unused_cols_rows; +unsigned int nrows; +unsigned int ncols; + + gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; + gd->ram_size =PHYS_SDRAM_SIZE_1 ; + +/* +* Assumption: 2 CS active, both CS have same layout. +* 15 rows max, 11 cols max (controller spec). +* memory chip has 8 banks, I/O width 32 bit. +* The correct way would be to read MR#8: I/O width and density, +* but this requires locking against the PRCMU firmware. +* Simplified approach: +* Read number of unused rows and columns from mem controller. +* size = nCS x 2^(rows+cols) x nbanks x buswidth_bytes +*/ + unused_cols_rows =readl (DMC_CTL_97 );Quoted 9 lines
board/st-ericsson/snowball/snowball.c line 182
Quoted 4 lines
board/st-ericsson/snowball/snowball.c new file +4
-0+ nrows =15 - (unused_cols_rows &0x07 ); + ncols =11 - ((unused_cols_rows &0x0700 ) >>8 ); + gd->ram_size = gd->bd->bi_dram[0 ].size = +2 * (1 << (nrows + ncols)) *8 *4 ;Please use
get_mem_size(CONFIG_SYS_SDRAM_BASE, possible-max-size)(and definingCONFIG_SYS_MAX_RAM_SIZEis common convention) instead of all the above.
Quoted 2 lines
Is '
get_mem_size' supposed to be an existing API ? I grep'ed for it in the code to no avail.
Arg, sorry, mental error. get_ram_size is the right one.
Signature · 1 line
Tom
PATCH 1/11 snowball: Add support for ux500 based snowball board
In reply to mathieu.poirier at linaro.orgQuoted 4 lines · mathieu.poirier at linaro.org
From: "Mathieu J. Poirier" <[email protected]>
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>
[snip]
Quoted 1 line
+#define
CONFIG_SYS_BAUDRATE_TABLE{ 9600, 19200, 38400, 57600, 115200 }
[snip]
Quoted 1 line
+#define
CONFIG_SYS_PROMPT_HUSH_PS2"> "
Both of these aren't needed now, as well. Sorry / thanks!
Signature · 1 line
Tom
PATCH 2/11 u8500: Moving prcmu to cpu directory
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
This is to allow the prcmu functions to be used by multiple u8500-based processors.
--- arch/arm/cpu/armv7/u8500/Makefile | 2 +- arch/arm/cpu/armv7/u8500/prcmu.c | 164 ++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-u8500/prcmu.h | 55 ++++++++++ board/st-ericsson/u8500/Makefile | 2 +- board/st-ericsson/u8500/prcmu-fw.h | 55 ---------- board/st-ericsson/u8500/prcmu.c | 165 ------------------------------- board/st-ericsson/u8500/u8500_href.c | 2 +- 7 files changed, 222 insertions(+), 223 deletions(-) create mode 100644 arch/arm/cpu/armv7/u8500/prcmu.c create mode 100644 arch/arm/include/asm/arch-u8500/prcmu.h delete mode 100644 board/st-ericsson/u8500/prcmu-fw.h delete mode 100644 board/st-ericsson/u8500/prcmu.c
arch/arm/cpu/armv7/u8500/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS = timer.o clock.o +COBJS = timer.o clock.o prcmu.o SOBJS = lowlevel.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
arch/arm/cpu/armv7/u8500/prcmu.c new file +164 -0
164 lines not on this page · raw message
arch/arm/include/asm/arch-u8500/prcmu.h new file +55 -0
55 lines not on this page · raw message
board/st-ericsson/u8500/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk CFLAGS += -D__RELEASE -D__STN_8500 LIB = $(obj)lib$(BOARD).o -COBJS := u8500_href.o gpio.o prcmu.o +COBJS := u8500_href.o gpio.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
board/st-ericsson/u8500/prcmu-fw.h deleted +0 -55
55 lines not on this page · raw message
board/st-ericsson/u8500/prcmu.c deleted +0 -165
165 lines not on this page · raw message
board/st-ericsson/u8500/u8500_href.c +1 -1
@@ -27,7 +27,7 @@#include <asm/arch/hardware.h> #include <asm/arch/sys_proto.h> #ifdef CONFIG_MMC -#include "prcmu-fw.h" +#include <asm/arch/prcmu.h> #include "../../../drivers/mmc/arm_pl180_mmci.h" #endif
Signature · 1 line
1.7.5.4
PATCH 3/11 snowball: Adding architecture dependent initialisation
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
Enabling timers and clocks in PRCMU and cleaning up mailbox.
--- arch/arm/cpu/armv7/u8500/Makefile | 2 +- arch/arm/cpu/armv7/u8500/cpu.c | 41 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv7/u8500/prcmu.c | 30 ++++++++++++++++++++++ arch/arm/include/asm/arch-u8500/prcmu.h | 24 ++++++++++++++---- board/st-ericsson/u8500/u8500_href.c | 2 +- include/configs/snowball.h | 1 + 6 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 arch/arm/cpu/armv7/u8500/cpu.c
arch/arm/cpu/armv7/u8500/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS = timer.o clock.o prcmu.o +COBJS = timer.o clock.o prcmu.o cpu.o SOBJS = lowlevel.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
arch/arm/cpu/armv7/u8500/cpu.c new file +41 -0
41 lines not on this page · raw message
arch/arm/cpu/armv7/u8500/prcmu.c +30 -0
@@ -40,6 +40,8 @@#define PRCM_MBOX_CPU_SET (U8500_PRCMU_BASE + 0x100)#define PRCM_MBOX_CPU_CLR (U8500_PRCMU_BASE + 0x104) +#define I2C_MBOX_BIT (1 << 5) +static int prcmu_is_ready (void ) {int ready =readb (PRCM_XP70_CUR_PWR_STATE ) ==AP_EXECUTE ;
@@ -162,3 +164,31 @@ int prcmu_i2c_write(u8 reg, u16 slave, u8 reg_data)return -1 ; } } + +void u8500_prcmu_enable (u32 *reg) +{ +writel (readl (reg) | (1 <<8 ), reg); +} + +void db8500_prcmu_init (void ) +{ +/* Enable timers */ +writel (1 <<17 ,PRCM_TCR ); + +u8500_prcmu_enable ((u32 *)PRCM_PER1CLK_MGT_REG ); +u8500_prcmu_enable ((u32 *)PRCM_PER2CLK_MGT_REG ); +u8500_prcmu_enable ((u32 *)PRCM_PER3CLK_MGT_REG ); +/* PER4CLK does not exist */ +u8500_prcmu_enable ((u32 *)PRCM_PER5CLK_MGT_REG ); +u8500_prcmu_enable ((u32 *)PRCM_PER6CLK_MGT_REG ); +/* Only exists in ED but is always ok to write to */ +u8500_prcmu_enable ((u32 *)PRCM_PER7CLK_MGT_REG ); + +u8500_prcmu_enable ((u32 *)PRCM_UARTCLK_MGT_REG ); +u8500_prcmu_enable ((u32 *)PRCM_I2CCLK_MGT_REG ); + +u8500_prcmu_enable ((u32 *)PRCM_SDMMCCLK_MGT_REG ); + +/* Clean up the mailbox interrupts after pre-u-boot code. */ +writel (I2C_MBOX_BIT ,PRCM_ARM_IT1_CLEAR ); +}
arch/arm/include/asm/arch-u8500/prcmu.h +19 -5
@@ -27,12 +27,23 @@#define I2C_RD_OK 2#define I2CWRITE 0 -#define _PRCMU_TCDM_BASE U8500_PRCMU_TCDM_BASE -#define PRCM_XP70_CUR_PWR_STATE (_PRCMU_TCDM_BASE + 0xFFC)/* 4 BYTES */ - -#define PRCM_REQ_MB5 (_PRCMU_TCDM_BASE + 0xE44)/* 4 bytes */ -#define PRCM_ACK_MB5 (_PRCMU_TCDM_BASE + 0xDF4)/* 4 bytes */ +#define PRCMU_BASE U8500_PRCMU_BASE +#define PRCM_UARTCLK_MGT_REG (PRCMU_BASE + 0x018) +#define PRCM_MSPCLK_MGT_REG (PRCMU_BASE + 0x01C) +#define PRCM_I2CCLK_MGT_REG (PRCMU_BASE + 0x020) +#define PRCM_SDMMCCLK_MGT_REG (PRCMU_BASE + 0x024) +#define PRCM_PER1CLK_MGT_REG (PRCMU_BASE + 0x02C) +#define PRCM_PER2CLK_MGT_REG (PRCMU_BASE + 0x030) +#define PRCM_PER3CLK_MGT_REG (PRCMU_BASE + 0x034) +#define PRCM_PER5CLK_MGT_REG (PRCMU_BASE + 0x038) +#define PRCM_PER6CLK_MGT_REG (PRCMU_BASE + 0x03C) +#define PRCM_PER7CLK_MGT_REG (PRCMU_BASE + 0x040) +#define PRCM_ARM_IT1_CLEAR (PRCMU_BASE + 0x48C) +#define PRCM_TCR (PRCMU_BASE + 0x1C8) +#define PRCM_REQ_MB5 (PRCMU_BASE + 0xE44) +#define PRCM_ACK_MB5 (PRCMU_BASE + 0xDF4) +#define PRCM_XP70_CUR_PWR_STATE (PRCMU_BASE + 0xFFC)/* Mailbox 5 Requests */ #define PRCM_REQ_MB5_I2COPTYPE_REG (PRCM_REQ_MB5 + 0x0)#define PRCM_REQ_MB5_BIT_FIELDS (PRCM_REQ_MB5 + 0x1)
@@ -52,4 +63,7 @@extern int prcmu_i2c_read (u8 reg,u16 slave);extern int prcmu_i2c_write (u8 reg,u16 slave,u8 reg_data); +void u8500_prcmu_enable (u32 *reg); +void db8500_prcmu_init (void ); +#endif /* __MACH_PRCMU_FW_V1_H */
board/st-ericsson/u8500/u8500_href.c +1 -1
@@ -26,8 +26,8 @@#include <asm/arch/gpio.h> #include <asm/arch/hardware.h> #include <asm/arch/sys_proto.h> -#ifdef CONFIG_MMC #include <asm/arch/prcmu.h> +#ifdef CONFIG_MMC #include "../../../drivers/mmc/arm_pl180_mmci.h" #endif
include/configs/snowball.h +1 -0
@@ -31,6 +31,7 @@#define CONFIG_SNOWBALL #define CONFIG_SYS_ICACHE_OFF #define CONFIG_SYS_DCACHE_OFF +#define CONFIG_ARCH_CPU_INIT /* * High Level Configuration Options
Signature · 1 line
1.7.5.4
PATCH 4/11 snowball: Adding CPU clock initialisation
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
--- arch/arm/cpu/armv7/u8500/clock.c | 34 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv7/u8500/cpu.c | 2 + arch/arm/include/asm/arch-u8500/clock.h | 5 +--- 3 files changed, 37 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/u8500/clock.c +34 -0
@@ -54,3 +54,37 @@ void u8500_clock_enable(int periph, int cluster, int kern)if (cluster !=-1 )writel (1 << cluster, &clkrst->pcken); } + +void db8500_clocks_init (void ) +{ +/* +* Enable all clocks. This is u-boot, we can enable it all. There is no +* powersave in u-boot. +*/ + +u8500_clock_enable (1 ,9 ,-1 );/* GPIO0 */ +u8500_clock_enable (2 ,11 ,-1 );/* GPIO1 */ +u8500_clock_enable (3 ,8 ,-1 );/* GPIO2 */ +u8500_clock_enable (5 ,1 ,-1 );/* GPIO3 */ +u8500_clock_enable (3 ,6 ,6 );/* UART2 */ +u8500_clock_enable (3 ,3 ,3 );/* I2C0 */ +u8500_clock_enable (1 ,5 ,5 );/* SDI0 */ +u8500_clock_enable (2 ,4 ,2 );/* SDI4 */ +u8500_clock_enable (6 ,6 ,-1 );/* MTU0 */ +u8500_clock_enable (3 ,4 ,4 );/* SDI2 */ + +/* +* Enabling clocks for all devices which are AMBA devices in the +* kernel. Otherwise they will not get probe()'d because the +* peripheral ID register will not be powered. +*/ + +/* XXX: some of these differ between ED/V1 */ + +u8500_clock_enable (1 ,1 ,1 );/* UART1 */ +u8500_clock_enable (1 ,0 ,0 );/* UART0 */ +u8500_clock_enable (3 ,2 ,2 );/* SSP1 */ +u8500_clock_enable (3 ,1 ,1 );/* SSP0 */ +u8500_clock_enable (2 ,8 ,-1 );/* SPI0 */ +u8500_clock_enable (2 ,5 ,3 );/* MSP2 */ +}
arch/arm/cpu/armv7/u8500/cpu.c +2 -0
@@ -27,6 +27,7 @@#include <common.h> #include <asm/io.h> #include <asm/arch/prcmu.h> +#include <asm/arch/clock.h> #ifdef CONFIG_ARCH_CPU_INIT /*
@@ -35,6 +36,7 @@int arch_cpu_init (void ) {db8500_prcmu_init (); +db8500_clocks_init ();return 0 ; }
arch/arm/include/asm/arch-u8500/clock.h +1 -4
@@ -64,9 +64,6 @@ struct prcmu {extern void u8500_clock_enable (int periph,int kern,int cluster); -static inline void u8500_prcmu_enable (unsigned int *reg) -{ -writel (readl (reg) | (1 <<8 ), reg); -} +void db8500_clocks_init (void );#endif /* __ASM_ARCH_CLOCK */
Signature · 1 line
1.7.5.4
PATCH 5/11 snowball: Moving to ux500.v2 addess scheme for PRCMU access
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
Addresses between ux500.v1 and ux500.v2 have changed slightly, hence mandating a review of the PRCMU access methods.
--- arch/arm/cpu/armv7/u8500/prcmu.c | 91 +++++++++++++++++++--------- arch/arm/include/asm/arch-u8500/hardware.h | 2 +- arch/arm/include/asm/arch-u8500/prcmu.h | 10 ++- 3 files changed, 71 insertions(+), 32 deletions(-)
arch/arm/cpu/armv7/u8500/prcmu.c +63 -28
@@ -36,9 +36,10 @@#include <asm/arch/prcmu.h> /* CPU mailbox registers */ -#define PRCM_MBOX_CPU_VAL (U8500_PRCMU_BASE + 0x0fc) -#define PRCM_MBOX_CPU_SET (U8500_PRCMU_BASE + 0x100) -#define PRCM_MBOX_CPU_CLR (U8500_PRCMU_BASE + 0x104) +#define PRCMU_I2C_WRITE (slave) \ + (((slave) << 1) | I2CWRITE | (1 << 6)) +#define PRCMU_I2C_READ (slave) \ + (((slave) << 1) | I2CREAD | (1 << 6))#define I2C_MBOX_BIT (1 << 5)
@@ -50,26 +51,39 @@ static int prcmu_is_ready(void)return ready; } -static int _wait_for_req_complete (int num) +static int wait_for_i2c_mbx_rdy (void ) { -int timeout =1000 ; +int timeout =10000 ; -/* checking any already on-going transaction */ -while ((readl (PRCM_MBOX_CPU_VAL ) & (1 << num)) && timeout) +if (readl (PRCM_ARM_IT1_VAL ) &I2C_MBOX_BIT ) { +printf ("prcmu: warning i2c mailbox was not acked\n" ); +/* clear mailbox 5 ack irq */ +writel (I2C_MBOX_BIT ,PRCM_ARM_IT1_CLEAR ); + } + +/* check any already on-going transaction */ +while ((readl (PRCM_MBOX_CPU_VAL ) &I2C_MBOX_BIT ) && timeout) timeout--; - timeout =1000 ; +if (timeout ==0 ) +return -1 ; + +return 0 ; +} + +static int wait_for_i2c_req_done (void ) +{ +int timeout =10000 ;/* Set an interrupt to XP70 */ -writel (1 << num,PRCM_MBOX_CPU_SET ); +writel (I2C_MBOX_BIT ,PRCM_MBOX_CPU_SET ); -while ((readl (PRCM_MBOX_CPU_VAL ) & (1 << num)) && timeout) +/* wait for mailbox 5 (i2c) ack */ +while (!(readl (PRCM_ARM_IT1_VAL ) &I2C_MBOX_BIT ) && timeout) timeout--; -if (!timeout) { -printf ("PRCMU operation timed out\n" ); +if (timeout ==0 )return -1 ; - }return 0 ; }
@@ -84,6 +98,7 @@ int prcmu_i2c_read(u8 reg, u16 slave) {uint8_t i2c_status;uint8_t i2c_val; +int ret;if (!prcmu_is_ready ())return -1 ;
@@ -91,13 +106,23 @@ int prcmu_i2c_read(u8 reg, u16 slave)debug ("\nprcmu_4500_i2c_read:bank=%x;reg=%x;\n" , reg, slave); + ret =wait_for_i2c_mbx_rdy (); +if (ret) { +printf ("prcmu_i2c_read: mailbox became not ready\n" ); +return ret; + } +/* prepare the data for mailbox 5 */ -writeb ((reg <<1 ) |I2CREAD ,PRCM_REQ_MB5_I2COPTYPE_REG ); +writeb (PRCMU_I2C_READ (reg),PRCM_REQ_MB5_I2COPTYPE_REG );writeb ((1 <<3 ) |0x0 ,PRCM_REQ_MB5_BIT_FIELDS );writeb (slave,PRCM_REQ_MB5_I2CSLAVE );writeb (0 ,PRCM_REQ_MB5_I2CVAL ); -_wait_for_req_complete (REQ_MB5 ); + ret =wait_for_i2c_req_done (); +if (ret) { +printf ("prcmu_i2c_read: mailbox request timed out\n" ); +return ret; + }/* retrieve values */ debug("ack-mb5:transfer status = %x\n",
@@ -109,16 +134,14 @@ int prcmu_i2c_read(u8 reg, u16 slave) i2c_status =readb (PRCM_ACK_MB5_STATUS ); i2c_val =readb (PRCM_ACK_MB5_VAL ); +/* clear mailbox 5 ack irq */ +writel (I2C_MBOX_BIT ,PRCM_ARM_IT1_CLEAR );if (i2c_status ==I2C_RD_OK )return i2c_val; -else { - -printf ("prcmu_i2c_read:read return status= %d\n" , - i2c_status); -return -1 ; - } +printf ("prcmu_i2c_read:read return status= %d\n" , i2c_status); +return -1 ; }/**
@@ -131,6 +154,7 @@ int prcmu_i2c_read(u8 reg, u16 slave)int prcmu_i2c_write (u8 reg,u16 slave,u8 reg_data) {uint8_t i2c_status; +int ret;if (!prcmu_is_ready ())return -1 ;
@@ -138,14 +162,23 @@ int prcmu_i2c_write(u8 reg, u16 slave, u8 reg_data)debug ("\nprcmu_4500_i2c_write:bank=%x;reg=%x;\n" , reg, slave); + ret =wait_for_i2c_mbx_rdy (); +if (ret) { +printf ("prcmu_i2c_write: mailbox became not ready\n" ); +return ret; + } +/* prepare the data for mailbox 5 */ -writeb ((reg <<1 ) |I2CWRITE ,PRCM_REQ_MB5_I2COPTYPE_REG ); +writeb (PRCMU_I2C_WRITE (reg),PRCM_REQ_MB5_I2COPTYPE_REG );writeb ((1 <<3 ) |0x0 ,PRCM_REQ_MB5_BIT_FIELDS );writeb (slave,PRCM_REQ_MB5_I2CSLAVE );writeb (reg_data,PRCM_REQ_MB5_I2CVAL ); -debug ("\ncpu_is_u8500v11\n" ); -_wait_for_req_complete (REQ_MB5 ); + ret =wait_for_i2c_req_done (); +if (ret) { +printf ("prcmu_i2c_write: mailbox request timed out\n" ); +return ret; + }/* retrieve values */ debug("ack-mb5:transfer status = %x\n",
@@ -157,12 +190,14 @@ int prcmu_i2c_write(u8 reg, u16 slave, u8 reg_data) i2c_status =readb (PRCM_ACK_MB5_STATUS );debug ("\ni2c_status = %x\n" , i2c_status); +/* clear mailbox 5 ack irq */ +writel (I2C_MBOX_BIT ,PRCM_ARM_IT1_CLEAR ); +if (i2c_status ==I2C_WR_OK )return 0 ; -else { -printf ("ape-i2c: i2c_status : 0x%x\n" , i2c_status); -return -1 ; - } + +printf ("%s: i2c_status : 0x%x\n" , __func__, i2c_status); +return -1 ; }void u8500_prcmu_enable (u32 *reg)
arch/arm/include/asm/arch-u8500/hardware.h +1 -1
@@ -62,7 +62,7 @@/* Per4 */ #define U8500_PRCMU_BASE (U8500_PER4_BASE + 0x07000) -#define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x0f000) +#define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x06800)/* Per3 */ #define U8500_UART2_BASE (U8500_PER3_BASE + 0x7000)
arch/arm/include/asm/arch-u8500/prcmu.h +7 -3
@@ -28,6 +28,7 @@#define I2CWRITE 0#define PRCMU_BASE U8500_PRCMU_BASE +#define PRCMU_BASE_TCDM U8500_PRCMU_TCDM_BASE#define PRCM_UARTCLK_MGT_REG (PRCMU_BASE + 0x018)#define PRCM_MSPCLK_MGT_REG (PRCMU_BASE + 0x01C)#define PRCM_I2CCLK_MGT_REG (PRCMU_BASE + 0x020)
@@ -38,12 +39,15 @@#define PRCM_PER5CLK_MGT_REG (PRCMU_BASE + 0x038)#define PRCM_PER6CLK_MGT_REG (PRCMU_BASE + 0x03C)#define PRCM_PER7CLK_MGT_REG (PRCMU_BASE + 0x040) +#define PRCM_MBOX_CPU_VAL (PRCMU_BASE + 0x0FC) +#define PRCM_MBOX_CPU_SET (PRCMU_BASE + 0x100)#define PRCM_ARM_IT1_CLEAR (PRCMU_BASE + 0x48C) +#define PRCM_ARM_IT1_VAL (PRCMU_BASE + 0x494)#define PRCM_TCR (PRCMU_BASE + 0x1C8) -#define PRCM_REQ_MB5 (PRCMU_BASE + 0xE44) -#define PRCM_ACK_MB5 (PRCMU_BASE + 0xDF4) -#define PRCM_XP70_CUR_PWR_STATE (PRCMU_BASE + 0xFFC) +#define PRCM_REQ_MB5 (PRCMU_BASE_TCDM + 0xE44) +#define PRCM_ACK_MB5 (PRCMU_BASE_TCDM + 0xDF4) +#define PRCM_XP70_CUR_PWR_STATE (PRCMU_BASE_TCDM + 0xFFC)/* Mailbox 5 Requests */ #define PRCM_REQ_MB5_I2COPTYPE_REG (PRCM_REQ_MB5 + 0x0)#define PRCM_REQ_MB5_BIT_FIELDS (PRCM_REQ_MB5 + 0x1)
Signature · 1 line
1.7.5.4
PATCH 6/11 snowball: applying power to LAN and GBF controllers
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
LAN and GBF need to be powered explicitely, doing so with interface to AB8500 companion chip.
--- arch/arm/include/asm/arch-u8500/hardware.h | 11 +++- arch/arm/include/asm/arch-u8500/prcmu.h | 7 ++- board/st-ericsson/snowball/snowball.c | 87 ++++++++++++++++++++++++++++ include/configs/snowball.h | 1 + 4 files changed, 103 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-u8500/hardware.h +10 -1
@@ -62,7 +62,7 @@/* Per4 */ #define U8500_PRCMU_BASE (U8500_PER4_BASE + 0x07000) -#define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x06800) +#define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000)/* Per3 */ #define U8500_UART2_BASE (U8500_PER3_BASE + 0x7000)
@@ -80,4 +80,13 @@#define U8500_BOOTROM_BASE 0x9001f000#define U8500_BOOTROM_ASIC_ID_OFFSET 0x0ff4 +/* AB8500 specifics */ +#define AB8500_MISC 0x0010 +#define AB8500_GPIO_SEL2_REG 0x1001 +#define AB8500_GPIO_DIR2_REG 0x1011 +#define AB8500_GPIO_DIR4_REG 0x1013 +#define AB8500_GPIO_SEL4_REG 0x1003 +#define AB8500_GPIO_OUT2_REG 0x1021 +#define AB8500_GPIO_OUT4_REG 0x1023 +#endif /* __ASM_ARCH_HARDWARE_H */
arch/arm/include/asm/arch-u8500/prcmu.h +5 -2
@@ -64,8 +64,11 @@#define REQ_MB5 5 -extern int prcmu_i2c_read (u8 reg,u16 slave); -extern int prcmu_i2c_write (u8 reg,u16 slave,u8 reg_data); +#define ab8500_read prcmu_i2c_read +#define ab8500_write prcmu_i2c_write + +int prcmu_i2c_read (u8 reg,u16 slave); +int prcmu_i2c_write (u8 reg,u16 slave,u8 reg_data);void u8500_prcmu_enable (u32 *reg);void db8500_prcmu_init (void );
board/st-ericsson/snowball/snowball.c +87 -0
96 lines not on this page · raw message
include/configs/snowball.h +1 -0
@@ -32,6 +32,7 @@#define CONFIG_SYS_ICACHE_OFF #define CONFIG_SYS_DCACHE_OFF #define CONFIG_ARCH_CPU_INIT +#define CONFIG_BOARD_LATE_INIT /* * High Level Configuration Options
Signature · 1 line
1.7.5.4
PATCH 7/11 u8500: Moving processor-specific functions to cpu area.
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
Functions such as providing power to the MMC device and reading the processor version register should be in the cpu area for access by multiple u8500-based boards.
--- arch/arm/cpu/armv7/u8500/cpu.c | 86 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-u8500/sys_proto.h | 1 + board/st-ericsson/u8500/u8500_href.c | 75 +----------------------- 3 files changed, 88 insertions(+), 74 deletions(-)
arch/arm/cpu/armv7/u8500/cpu.c +86 -0
@@ -28,6 +28,30 @@#include <asm/io.h> #include <asm/arch/prcmu.h> #include <asm/arch/clock.h> +#include <asm/arch/hardware.h> + +#include <asm/arch/hardware.h> + +#define CPUID_DB8500V1 0x411fc091 +#define CPUID_DB8500V2 0x412fc091 +#define ASICID_DB8500V11 0x008500A1 + +static unsigned int read_asicid (void ) +{ +unsigned int *address = (void *)U8500_BOOTROM_BASE + +U8500_BOOTROM_ASIC_ID_OFFSET ; +return readl (address); +} + +static int cpu_is_u8500v11 (void ) +{ +return read_asicid () ==ASICID_DB8500V11 ; +} + +static int cpu_is_u8500v2 (void ) +{ +return read_cpuid () ==CPUID_DB8500V2 ; +}#ifdef CONFIG_ARCH_CPU_INIT /*
@@ -41,3 +65,65 @@ int arch_cpu_init(void)return 0 ; }#endif /* CONFIG_ARCH_CPU_INIT */ + +#ifdef CONFIG_MMC + +#define LDO_VAUX3_MASK 0x3 +#define LDO_VAUX3_ENABLE 0x1 +#define VAUX3_VOLTAGE_2_9V 0xd + +#define AB8500_REGU_CTRL2 0x4 +#define AB8500_REGU_VRF1VAUX3_REGU_REG 0x040A +#define AB8500_REGU_VRF1VAUX3_SEL_REG 0x0421 + +int u8500_mmc_power_init (void ) +{ +int ret; +int val; + +if (!cpu_is_u8500v11 ()) +return 0 ; + +/* +* On v1.1 HREF boards (HREF+), Vaux3 needs to be enabled for the SD +* card to work. This is done by enabling the regulators in the AB8500 +* via PRCMU I2C transactions. +* +* This code is derived from the handling of AB8500_LDO_VAUX3 in +* ab8500_ldo_enable() and ab8500_ldo_disable() in Linux. +* +* Turn off and delay is required to have it work across soft reboots. +*/ + + ret =prcmu_i2c_read (AB8500_REGU_CTRL2 ,AB8500_REGU_VRF1VAUX3_REGU_REG ); +if (ret <0 ) + goto out; + + val = ret; + +/* Turn off */ + ret =prcmu_i2c_write (AB8500_REGU_CTRL2 ,AB8500_REGU_VRF1VAUX3_REGU_REG , + val & ~LDO_VAUX3_MASK ); +if (ret <0 ) + goto out; + +udelay (10 *1000 ); + +/* Set the voltage to 2.9V */ + ret =prcmu_i2c_write (AB8500_REGU_CTRL2 , +AB8500_REGU_VRF1VAUX3_SEL_REG , +VAUX3_VOLTAGE_2_9V ); +if (ret <0 ) + goto out; + + val = val & ~LDO_VAUX3_MASK ; + val = val |LDO_VAUX3_ENABLE ; + +/* Turn on the supply */ + ret =prcmu_i2c_write (AB8500_REGU_CTRL2 , +AB8500_REGU_VRF1VAUX3_REGU_REG , val); + +out: +return ret; +} +#endif /* CONFIG_MMC */
arch/arm/include/asm/arch-u8500/sys_proto.h +1 -0
@@ -23,5 +23,6 @@#define _SYS_PROTO_H_void gpio_init (void ); +int u8500_mmc_power_init (void );#endif /* _SYS_PROTO_H_ */
board/st-ericsson/u8500/u8500_href.c +1 -74
93 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 7/11 u8500: Moving processor-specific functions to cpu area.
Quoted 8 lines · mathieu.poirier at linaro.org
From: "Mathieu J. Poirier" <[email protected]>
Functions such as providing power to the MMC device and reading the processor version register should be in the cpu area for access by multiple u8500-based boards.
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>
[snip]
arch/arm/cpu/armv7/u8500/cpu.c line 54
Quoted 4 lines
arch/arm/cpu/armv7/u8500/cpu.c +4
-0+static int cpu_is_u8500v2 (void ) +{ +return read_cpuid () ==CPUID_DB8500V2 ; +}
This isn't used yet, so causes a new warning. I'm moving this (and the define) to the next patch, where they are used. With that change and my Signed-off-by, applied to u-boot-staging/trini at ti.com
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120810/0d46b656/attachment.pgp>
PATCH 8/11 u8500: Enabling power to MMC device on AB8500 V2
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
Register mapping has changed on power control chip between the first and second revision.
--- arch/arm/cpu/armv7/u8500/cpu.c | 89 ++++++++++++++++++++-------- arch/arm/include/asm/arch-u8500/hardware.h | 22 ++++++- board/st-ericsson/snowball/snowball.c | 5 ++ 3 files changed, 88 insertions(+), 28 deletions(-)
arch/arm/cpu/armv7/u8500/cpu.c +63 -26
@@ -36,11 +36,19 @@#define CPUID_DB8500V2 0x412fc091#define ASICID_DB8500V11 0x008500A1 -static unsigned int read_asicid (void ) +static unsigned int read_asicid (void ); + +static inline unsigned int read_cpuid (void ) { -unsigned int *address = (void *)U8500_BOOTROM_BASE - +U8500_BOOTROM_ASIC_ID_OFFSET ; -return readl (address); +unsigned int val; + +/* Main ID register (MIDR) */ + asm("mrc p15, 0, %0, c0, c0, 0" + :"=r" (val) + : + :"cc" ); + +return val; }static int cpu_is_u8500v11 (void )
@@ -53,6 +61,18 @@ static int cpu_is_u8500v2(void)return read_cpuid () ==CPUID_DB8500V2 ; } +static unsigned int read_asicid (void ) +{ +unsigned int *address; + +if (cpu_is_u8500v2 ()) + address = (void *)U8500_ASIC_ID_LOC_V2 ; +else + address = (void *)U8500_ASIC_ID_LOC_ED_V1 ; + +return readl (address); +} +#ifdef CONFIG_ARCH_CPU_INIT /* * SOC specific cpu init
@@ -68,22 +88,22 @@ int arch_cpu_init(void)#ifdef CONFIG_MMC -#define LDO_VAUX3_MASK 0x3 -#define LDO_VAUX3_ENABLE 0x1 -#define VAUX3_VOLTAGE_2_9V 0xd - -#define AB8500_REGU_CTRL2 0x4 -#define AB8500_REGU_VRF1VAUX3_REGU_REG 0x040A -#define AB8500_REGU_VRF1VAUX3_SEL_REG 0x0421 -int u8500_mmc_power_init (void ) {int ret; -int val; +int enable, voltage; +int ab8500_revision; -if (!cpu_is_u8500v11 ()) +if (!cpu_is_u8500v11 () && !cpu_is_u8500v2 ())return 0 ; +/* Get AB8500 revision */ + ret =ab8500_read (AB8500_MISC ,AB8500_REV_REG ); +if (ret <0 ) + goto out; + + ab8500_revision = ret; +/* * On v1.1 HREF boards (HREF+), Vaux3 needs to be enabled for the SD * card to work. This is done by enabling the regulators in the AB8500
@@ -95,33 +115,50 @@ int u8500_mmc_power_init(void)* Turn off and delay is required to have it work across soft reboots. */ - ret =prcmu_i2c_read (AB8500_REGU_CTRL2 ,AB8500_REGU_VRF1VAUX3_REGU_REG ); +/* Turn off (read-modify-write) */ + ret =ab8500_read (AB8500_REGU_CTRL2 , +AB8500_REGU_VRF1VAUX3_REGU_REG );if (ret <0 ) goto out; - val = ret; + enable = ret;/* Turn off */ - ret =prcmu_i2c_write (AB8500_REGU_CTRL2 ,AB8500_REGU_VRF1VAUX3_REGU_REG , - val & ~LDO_VAUX3_MASK ); + ret =ab8500_write (AB8500_REGU_CTRL2 , +AB8500_REGU_VRF1VAUX3_REGU_REG , + enable & ~LDO_VAUX3_ENABLE_MASK );if (ret <0 ) goto out;udelay (10 *1000 ); -/* Set the voltage to 2.9V */ - ret =prcmu_i2c_write (AB8500_REGU_CTRL2 , -AB8500_REGU_VRF1VAUX3_SEL_REG , -VAUX3_VOLTAGE_2_9V ); +/* Set the voltage to 2.91 V or 2.9 V without overriding VRF1 value */ + ret =ab8500_read (AB8500_REGU_CTRL2 , +AB8500_REGU_VRF1VAUX3_SEL_REG );if (ret <0 ) goto out; - val = val & ~LDO_VAUX3_MASK ; - val = val |LDO_VAUX3_ENABLE ; + voltage = ret; + +if (ab8500_revision <0x20 ) { + voltage &= ~LDO_VAUX3_SEL_MASK ; + voltage |=LDO_VAUX3_SEL_2V9 ; + }else { + voltage &= ~LDO_VAUX3_V2_SEL_MASK ; + voltage |=LDO_VAUX3_V2_SEL_2V91 ; + } + + ret =ab8500_write (AB8500_REGU_CTRL2 , +AB8500_REGU_VRF1VAUX3_SEL_REG , voltage); +if (ret <0 ) + goto out;/* Turn on the supply */ - ret =prcmu_i2c_write (AB8500_REGU_CTRL2 , -AB8500_REGU_VRF1VAUX3_REGU_REG , val); + enable &= ~LDO_VAUX3_ENABLE_MASK ; + enable |=LDO_VAUX3_ENABLE_VAL ; + + ret =ab8500_write (AB8500_REGU_CTRL2 , +AB8500_REGU_VRF1VAUX3_REGU_REG , enable); out:return ret;
arch/arm/include/asm/arch-u8500/hardware.h +20 -2
@@ -77,11 +77,21 @@#define U8500_CLKRST1_BASE (U8500_PER1_BASE + 0xf000)/* Last page of Boot ROM */ -#define U8500_BOOTROM_BASE 0x9001f000 -#define U8500_BOOTROM_ASIC_ID_OFFSET 0x0ff4 +#define U8500_BOOTROM_BASE 0x90000000 +#define U8500_ASIC_ID_LOC_ED_V1 (U8500_BOOTROM_BASE + 0x1FFF4) +#define U8500_ASIC_ID_LOC_V2 (U8500_BOOTROM_BASE + 0x1DBF4)/* AB8500 specifics */ + +/* address bank */ +#define AB8500_REGU_CTRL2 0x0004#define AB8500_MISC 0x0010 + +/* registers */ +#define AB8500_REGU_VRF1VAUX3_REGU_REG 0x040A +#define AB8500_REGU_VRF1VAUX3_SEL_REG 0x0421 +#define AB8500_REV_REG 0x1080 +#define AB8500_GPIO_SEL2_REG 0x1001#define AB8500_GPIO_DIR2_REG 0x1011#define AB8500_GPIO_DIR4_REG 0x1013
@@ -89,4 +99,12 @@#define AB8500_GPIO_OUT2_REG 0x1021#define AB8500_GPIO_OUT4_REG 0x1023 +#define LDO_VAUX3_ENABLE_MASK 0x3 +#define LDO_VAUX3_ENABLE_VAL 0x1 +#define LDO_VAUX3_SEL_MASK 0xf +#define LDO_VAUX3_SEL_2V9 0xd +#define LDO_VAUX3_V2_SEL_MASK 0x7 +#define LDO_VAUX3_V2_SEL_2V91 0x7 + +#endif /* __ASM_ARCH_HARDWARE_H */
board/st-ericsson/snowball/snowball.c +5 -0
@@ -27,6 +27,7 @@#include <asm/arch/db8500_pincfg.h> #include <asm/arch/prcmu.h> #include <asm/arch/hardware.h> +#include <asm/arch/sys_proto.h> #include "db8500_pins.h"
@@ -268,5 +269,9 @@ int board_late_init(void)if ((raise_ab8500_gpio16 () <0 ))printf ("error: cant' raise GPIO16\n" ); +#ifdef CONFIG_MMC +u8500_mmc_power_init (); +#endif /* CONFIG_MMC */ +return 0 ; }
Signature · 1 line
1.7.5.4
PATCH 8/11 u8500: Enabling power to MMC device on AB8500 V2
Quoted 7 lines · mathieu.poirier at linaro.org
From: "Mathieu J. Poirier" <[email protected]>
Register mapping has changed on power control chip between the first and second revision.
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>
I've added in the cpu_is_u8500v2 from the previous patch in the series here, added my Signed-off-by and merged to u-boot-staging/trini at ti.com, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120810/943cb53a/attachment.pgp>
PATCH 9/11 u8500: Separating mmc config parameters from driver
In reply to mathieu.poirier at linaro.orgFrom: John Rigby <[email protected]>
Configuration in vexpress and u8500.v1 is different from what is needed in u8500.v2. As such, card configuration specifics need to reside in the board file rather than the driver.
--- board/armltd/vexpress/ca9x4_ct_vxp.c | 21 +++++- board/st-ericsson/snowball/snowball.c | 92 ++++++++++++++++++++++- board/st-ericsson/u8500/u8500_href.c | 22 +++++- drivers/mmc/arm_pl180_mmci.c | 132 +++++++++++++-------------------- drivers/mmc/arm_pl180_mmci.h | 27 ++++++- include/configs/snowball.h | 8 ++ 6 files changed, 214 insertions(+), 88 deletions(-)
board/armltd/vexpress/ca9x4_ct_vxp.c +20 -1
@@ -33,6 +33,8 @@* MA 02111-1307 USA */ #include <common.h> +#include <malloc.h> +#include <errno.h> #include <netdev.h> #include <asm/io.h> #include <asm/arch/systimer.h>
@@ -90,8 +92,25 @@ int board_eth_init(bd_t *bis)int cpu_mmc_init (bd_t *bis) {int rc =0 ; + (void ) bis;#ifdef CONFIG_ARM_PL180_MMCI - rc =arm_pl180_mmci_init (); +struct pl180_mmc_host *host; + + host =malloc (sizeof (struct pl180_mmc_host )); +if (!host) +return -ENOMEM ; +memset (host,0 ,sizeof (*host)); + +strcpy (host->name,"MMC" ); + host->base = (struct sdi_registers *)CONFIG_ARM_PL180_MMCI_BASE ; + host->pwr_init =INIT_PWR ; + host->clkdiv_init =SDI_CLKCR_CLKDIV_INIT_V1 |SDI_CLKCR_CLKEN ; + host->voltages =VOLTAGE_WINDOW_MMC ; + host->caps =0 ; + host->clock_in =ARM_MCLK ; + host->clock_min =ARM_MCLK / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 +1 )); + host->clock_max =CONFIG_ARM_PL180_MMCI_CLOCK_FREQ ; + rc =arm_pl180_mmci_init (host);#endif return rc; }
board/st-ericsson/snowball/snowball.c +91 -1
106 lines not on this page · raw message
board/st-ericsson/u8500/u8500_href.c +19 -3
@@ -18,6 +18,7 @@#include <config.h> #include <common.h> +#include <malloc.h> #include <i2c.h> #include <asm/types.h> #include <asm/io.h>
@@ -375,12 +376,27 @@ static int u8500_mmci_board_init(void)int board_mmc_init (bd_t *bd) { +struct pl180_mmc_host *host; +if (u8500_mmci_board_init ())return -ENODEV ; -if (arm_pl180_mmci_init ()) -return -ENODEV ; -return 0 ; + host =malloc (sizeof (struct pl180_mmc_host )); +if (!host) +return -ENOMEM ; +memset (host,0 ,sizeof (*host)); + +strcpy (host->name,"MMC" ); + host->base = (struct sdi_registers *)CONFIG_ARM_PL180_MMCI_BASE ; + host->pwr_init =INIT_PWR ; + host->clkdiv_init =SDI_CLKCR_CLKDIV_INIT_V1 |SDI_CLKCR_CLKEN ; + host->voltages =VOLTAGE_WINDOW_MMC ; + host->caps =0 ; + host->clock_in =ARM_MCLK ; + host->clock_min =ARM_MCLK / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 +1 )); + host->clock_max =CONFIG_ARM_PL180_MMCI_CLOCK_FREQ ; + +return arm_pl180_mmci_init (host); }#endif
drivers/mmc/arm_pl180_mmci.c +52 -80
239 lines not on this page · raw message
drivers/mmc/arm_pl180_mmci.h +24 -3
@@ -26,8 +26,6 @@#ifndef __ARM_PL180_MMCI_H__#define __ARM_PL180_MMCI_H__ -int arm_pl180_mmci_init (void ); -#define COMMAND_REG_DELAY 300#define DATA_REG_DELAY 1000#define CLK_CHANGE_DELAY 2000
@@ -59,8 +57,13 @@ int arm_pl180_mmci_init(void);#define SDI_CLKCR_WIDBUS_MASK 0x00001800#define SDI_CLKCR_WIDBUS_1 0x00000000#define SDI_CLKCR_WIDBUS_4 0x00000800 +/* V2 only */ +#define SDI_CLKCR_WIDBUS_8 0x00001000 +#define SDI_CLKCR_NEDGE 0x00002000 +#define SDI_CLKCR_HWFC_EN 0x00004000 -#define SDI_CLKCR_CLKDIV_INIT 0x000000C6/* MCLK/(2*(0xC6+1)) => 505KHz */ +#define SDI_CLKCR_CLKDIV_INIT_V1 0x000000C6/* MCLK/(2*(0xC6+1)) => 505KHz */ +#define SDI_CLKCR_CLKDIV_INIT_V2 0x000000FD/* SDI command register bits */ #define SDI_CMD_CMDINDEX_MASK 0x000000FF
@@ -144,6 +147,8 @@ int arm_pl180_mmci_init(void);#define SDI_DCTRL_DBOOTMODEEN 0x00002000#define SDI_DCTRL_BUSYMODE 0x00004000#define SDI_DCTRL_DDR_MODE 0x00008000 +#define SDI_DCTRL_DBLOCKSIZE_V2_MASK 0x7fff0000 +#define SDI_DCTRL_DBLOCKSIZE_V2_SHIFT 16#define SDI_FIFO_BURST_SIZE 8
@@ -180,4 +185,20 @@ struct sdi_registers { u32 pcell_id3; /* 0xFFC*/ }; +struct pl180_mmc_host { +struct sdi_registers *base; +char name[32 ]; +unsigned int b_max; +unsigned int voltages; +unsigned int caps; +unsigned int clock_in; +unsigned int clock_min; +unsigned int clock_max; +unsigned int clkdiv_init; +unsigned int pwr_init; +int version2; +}; + +int arm_pl180_mmci_init (struct pl180_mmc_host *); +#endif
include/configs/snowball.h +8 -0
@@ -231,6 +231,14 @@#endif /* +* MMC related configs +*/ +#define CONFIG_ARM_PL180_MMCI +#define MMC_BLOCK_SIZE 512 +#define CFG_EMMC_BASE 0x80114000 +#define CFG_MMC_BASE 0x80126000 + +/* * FLASH and environment organization */ #define CONFIG_SYS_NO_FLASH
Signature · 1 line
1.7.5.4
PATCH 9/11 u8500: Separating mmc config parameters from driver
Quoted 8 lines · mathieu.poirier at linaro.org
From: John Rigby <[email protected]>
Configuration in vexpress and u8500.v1 is different from what is needed in u8500.v2. As such, card configuration specifics need to reside in the board file rather than the driver.
Signed-off-by John Rigby <[email protected]>Signed-off-by Mathieu Poirier <[email protected]>
[snip]
Quoted 4 lines
board/st-ericsson/snowball/snowball.c +0
-0
[snip]
board/st-ericsson/snowball/snowball.c static int do_command(struct mmc *dev, struct mmc_cmd *cmd) · line 80
Quoted 7 lines
board/st-ericsson/snowball/snowball.c +2
-1@@ -80,7 +76,8 @@ static int do_command(struct mmc *dev, struct mmc_cmd *cmd) {int result;u32 sdi_cmd =0 ; -struct mmc_host *host = dev->priv; +struct pl180_mmc_host *host = dev->priv; +u32 lap =0 ;
lap is unused. Removing.
This patch has been applied to u-boot-staging/trini at ti.com with the above change and a Signed-off-by from me.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120810/cecc63fb/attachment.pgp>
PATCH 10/11 armv7: Adding cpu specific cache managmenent
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
Some CPU (i.e u8500) need more cache management before launching the Linux kernel.
--- arch/arm/cpu/armv7/cpu.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/cpu.c +8 -0
@@ -36,6 +36,7 @@#include <asm/system.h> #include <asm/cache.h> #include <asm/armv7.h> +#include <linux/compiler.h> void save_boot_params_default (u32 r0,u32 r1,u32 r2,u32 r3) {
@@ -44,6 +45,8 @@ void save_boot_params_default(u32 r0, u32 r1, u32 r2, u32 r3)void save_boot_params (u32 r0,u32 r1,u32 r2,u32 r3) __attribute__((weak,alias ("save_boot_params_default" ))); +void __weak cpu_cache_initialization (void ){} +int cleanup_before_linux (void ) {/*
@@ -81,5 +84,10 @@ int cleanup_before_linux(void)*/ invalidate_dcache_all (); +/* +* Some CPU need more cache attention before starting the kernel. +*/ +cpu_cache_initialization (); +return 0 ; }
Signature · 1 line
1.7.5.4
PATCH 11/11 snowball: Adding board specific cache cleanup routine
In reply to mathieu.poirier at linaro.orgFrom: "Mathieu J. Poirier" <[email protected]>
Following ARM's reference manuel for initializing the cache - the kernel won't boot otherwise.
--- arch/arm/cpu/armv7/u8500/cpu.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/u8500/cpu.c +26 -0
@@ -36,6 +36,14 @@#define CPUID_DB8500V2 0x412fc091#define ASICID_DB8500V11 0x008500A1 +#define CACHE_CONTR_BASE 0xA0412000 +/* Cache controller register offsets +* as found in ARM's technical reference manual +*/ +#define CACHE_INVAL_BY_WAY (CACHE_CONTR_BASE + 0x77C) +#define CACHE_LOCKDOWN_BY_D (CACHE_CONTR_BASE + 0X900) +#define CACHE_LOCKDOWN_BY_I (CACHE_CONTR_BASE + 0X904) +static unsigned int read_asicid (void );static inline unsigned int read_cpuid (void )
@@ -73,6 +81,24 @@ static unsigned int read_asicid(void)return readl (address); } +void cpu_cache_initialization (void ) +{ +unsigned int value; +/* invalidate all cache entries */ +writel (0xFFFF ,CACHE_INVAL_BY_WAY ); + +/* ways are set to '0' when they are totally +* cleaned and invalidated +*/ +do { + value =readl (CACHE_INVAL_BY_WAY ); + }while (value &0xFF ); + +/* Invalidate register 9 D and I lockdown */ +writel (0xFF ,CACHE_LOCKDOWN_BY_D ); +writel (0xFF ,CACHE_LOCKDOWN_BY_I ); +} +#ifdef CONFIG_ARCH_CPU_INIT /* * SOC specific cpu init
Signature · 1 line
1.7.5.4
cover Support for ST-Ericsson snowball board
In reply to mathieu.poirier at linaro.orgQuoted 56 lines · mathieu.poirier at linaro.org
From: "Mathieu J. Poirier" <[email protected]>
This set adds support for the ST-Ericsson u8500 based snowball board. Doing so it moves u8500-href code around to allow for code reuse between boards.
It was sent out during the 12.07 cycle but never received an official ACK.
John Rigby (1):
u8500: Separating mmc config parameters from driverMathieu J. Poirier (10):
snowball: Add support for ux500 based snowball board
u8500: Moving prcmu to cpu directory
snowball: Adding architecture dependent initialisation
snowball: Adding CPU clock initialisation
snowball: Moving to ux500.v2 addess scheme for PRCMU access
snowball: applying power to LAN and GBF controllers
u8500: Moving processor-specific functions to cpu area.
u8500: Enabling power to MMC device on AB8500 V2
armv7: Adding cpu specific cache managmenent
snowball: Adding board specific cache cleanup routineMAINTAINERS | 4 + arch/arm/cpu/armv7/cpu.c | 8 + arch/arm/cpu/armv7/u8500/Makefile | 2 +- arch/arm/cpu/armv7/u8500/clock.c | 34 + arch/arm/cpu/armv7/u8500/cpu.c | 192 ++++++ arch/arm/cpu/armv7/u8500/prcmu.c | 229 +++++++ arch/arm/include/asm/arch-u8500/clock.h | 5 +- arch/arm/include/asm/arch-u8500/db8500_gpio.h | 42 ++ arch/arm/include/asm/arch-u8500/db8500_pincfg.h | 170 +++++ arch/arm/include/asm/arch-u8500/hardware.h | 33 +- arch/arm/include/asm/arch-u8500/prcmu.h | 76 +++ arch/arm/include/asm/arch-u8500/sys_proto.h | 1 + board/armltd/vexpress/ca9x4_ct_vxp.c | 21 +- board/st-ericsson/snowball/Makefile | 51 ++ board/st-ericsson/snowball/db8500_pins.h | 745 +++++++++++++++++++++++ board/st-ericsson/snowball/snowball.c | 367 +++++++++++ board/st-ericsson/u8500/Makefile | 2 +- board/st-ericsson/u8500/prcmu-fw.h | 55 -- board/st-ericsson/u8500/prcmu.c | 165 ----- board/st-ericsson/u8500/u8500_href.c | 99 +--- boards.cfg | 1 + drivers/gpio/Makefile | 1 + drivers/gpio/db8500_gpio.c | 225 +++++++ drivers/mmc/arm_pl180_mmci.c | 132 ++--- drivers/mmc/arm_pl180_mmci.h | 27 +- drivers/serial/serial_pl01x.c | 2 + include/configs/snowball.h | 268 ++++++++ 27 files changed, 2566 insertions(+), 391 deletions(-) create mode 100644 arch/arm/cpu/armv7/u8500/cpu.c create mode 100644 arch/arm/cpu/armv7/u8500/prcmu.c create mode 100644 arch/arm/include/asm/arch-u8500/db8500_gpio.h create mode 100644 arch/arm/include/asm/arch-u8500/db8500_pincfg.h
Quoted 8 lines
create mode 100644 arch/arm/include/asm/arch-u8500/prcmu.h create mode 100644 board/st-ericsson/snowball/Makefile create mode 100644 board/st-ericsson/snowball/db8500_pins.h create mode 100644 board/st-ericsson/snowball/snowball.c delete mode 100644 board/st-ericsson/u8500/prcmu-fw.h delete mode 100644 board/st-ericsson/u8500/prcmu.c create mode 100644 drivers/gpio/db8500_gpio.c create mode 100644 include/configs/snowball.h
With a few very minor changes that I've sent to the list, I've applied this to u-boot-staging/trini at ti.com, thanks for your patience!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120810/fe882ba2/attachment.pgp>