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 more than three weeks ago, was modified after comments were received but never got an official ACK.
Resending again in it's last revision.
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
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 | 182 ++++++ 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 | 172 ++++++ 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 ++++++++ 26 files changed, 2554 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 RESEND 1/11 snowball: Add support for ux500 based snowball board
From: "Mathieu J. Poirier" <[email protected]>
---
Changes for v2:
- White space cleanup.
- Cleaned #defines.
- Removal of unnecessary defines.
--- arch/arm/include/asm/arch-u8500/db8500_gpio.h | 42 ++ arch/arm/include/asm/arch-u8500/db8500_pincfg.h | 172 ++++++ 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 ++++++++ 10 files changed, 1682 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-u8500/db8500_gpio.h new file +42 -0
@@ -0,0 +1,42 @@ +/* +* Structures and registers for GPIO access in the Nomadik SoC +* +* Code ported from Nomadik GPIO driver in ST-Ericsson Linux kernel code. +* The purpose is that GPIO config found in kernel should work by simply +* copy-paste it to U-boot. +* +* Ported to U-boot by: +* Copyright (C) 2010 Joakim Axelsson <joakim.axelsson AT stericsson.com> +* Copyright (C) 2008 STMicroelectronics +* Author: Prafulla WADASKAR <[email protected]> +* Copyright (C) 2009 Alessandro Rubini <[email protected]> +* +* 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. +*/ + +#ifndef __DB8500_GPIO_H__ +#define __DB8500_GPIO_H__ + +/* Alternate functions: function C is set in hw by setting both A and B */ +enum db8500_gpio_alt { +DB8500_GPIO_ALT_GPIO =0 , +DB8500_GPIO_ALT_A =1 , +DB8500_GPIO_ALT_B =2 , +DB8500_GPIO_ALT_C = (DB8500_GPIO_ALT_A |DB8500_GPIO_ALT_B ) +}; + +enum db8500_gpio_pull { +DB8500_GPIO_PULL_NONE , +DB8500_GPIO_PULL_UP , +DB8500_GPIO_PULL_DOWN +}; + +void db8500_gpio_set_pull (unsigned gpio,enum db8500_gpio_pull pull); +void db8500_gpio_make_input (unsigned gpio); +int db8500_gpio_get_input (unsigned gpio); +void db8500_gpio_make_output (unsigned gpio,int val); +void db8500_gpio_set_output (unsigned gpio,int val); + +#endif /* __DB8500_GPIO_H__ */
arch/arm/include/asm/arch-u8500/db8500_pincfg.h new file +172 -0
172 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
@@ -232,6 +232,7 @@ harmony arm armv7 harmony nvidia seaboard arm armv7 seaboard nvidia tegra2 ventana arm armv7 ventana 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
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_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 RESEND 1/11 snowball: Add support for ux500 based snowball board
Dear mathieu.poirier at linaro.org,
Quoted 9 lines · In message <[email protected]> you…
From: "Mathieu J. Poirier" <[email protected]>
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>---
Changes for v2:
- White space cleanup.
- Cleaned #defines.
- Removal of unnecessary defines.
Quoted 12 lines
--- arch/arm/include/asm/arch-u8500/db8500_gpio.h | 42 ++ arch/arm/include/asm/arch-u8500/db8500_pincfg.h | 172 ++++++ 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 ++++++++ 10 files changed, 1682 insertions(+), 0 deletions(-)
Entry to MAINTAINERS missing.
Also, there are a large number of checkpatch warnings, mostly "line over 80 characters".
Please fix.
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 No one wants war. -- Kirk, "Errand of Mercy", stardate 3201.7
PATCH RESEND 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(-)
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 RESEND 2/11 u8500: Moving prcmu to cpu directory
Dear mathieu.poirier at linaro.org,
Quoted 7 lines · In message <[email protected]> you…
From: "Mathieu J. Poirier" <[email protected]>
This is to allow the prcmu functions to be used by multiple u8500-based processors.
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>
Quoted 9 lines
--- 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(-)
Again checkpatch warnings: "Whitespace before semicolon".
Please fix.
Best regards,
Wolfgang Denk
Signature · 7 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
In any group of employed individuals the only naturally early riser
is _always_ the office manager, who will _always_ leave reproachful
little notes ... on the desks of their subordinates.
- Terry Pratchett, _Lords and Ladies_PATCH RESEND 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.
---
Changes for v2:
- Cleaned #defines in snowball.h
--- 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(-)
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 RESEND 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 RESEND 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
@@ -35,10 +35,11 @@#include <asm/errno.h> #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 ; + +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 ); + } -/* checking any already on-going transaction */ -while ((readl (PRCM_MBOX_CPU_VAL ) & (1 << num)) && timeout--) +/* check any already on-going transaction */ +while ((readl (PRCM_MBOX_CPU_VAL ) &I2C_MBOX_BIT ) && 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--) ; -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); +printf ("%s:read return status= %d\n" , __func__, 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 RESEND 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.
---
Changes for v2:
- Cleaned #defines in snowball.h
--- 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 RESEND 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 RESEND 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 RESEND 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 RESEND 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.
---
Changes for v2:
- Moved from __attribute__(...) to __weak.
changes for v3:
- Choosing more explicit name for extra cache management routine.
--- 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 RESEND 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.
---
Changes for v2:
- Correcting cache maintenance register address.
- Invalidating all 16 bits in cache maintenance register.
- Polling cache maintenance register for cleared bits.
- Added comments to the code.
- Re-worked commit description.
--- arch/arm/cpu/armv7/u8500/cpu.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/u8500/cpu.c +16 -0
@@ -73,6 +73,22 @@ static unsigned int read_asicid(void)return readl (address); } +void cpu_cache_initialization (void ) +{ +/* invalidate all cache entries */ + *((volatile unsigned int *)(0xA041277C )) =0xFFFF ; + +/* ways are set to '0' when they are totally +* cleaned and invalidated +*/ +while (*((volatile unsigned int *)(0xA041277C )) &0xFF ) + ; + +/* Invalidate register 9 D and I lockdown */ + *((volatile unsigned int *)(0xA0412900 )) =0xFF ; + *((volatile unsigned int *)(0xA0412904 )) =0xFF ; +} +#ifdef CONFIG_ARCH_CPU_INIT /* * SOC specific cpu init
Signature · 1 line
1.7.5.4
PATCH RESEND 11/11 snowball: Adding board specific cache cleanup routine
Dear mathieu.poirier at linaro.org,
Quoted 17 lines · In message <[email protected]> you…
From: "Mathieu J. Poirier" <[email protected]>
Following ARM's reference manuel for initializing the cache - the kernel won't boot otherwise.
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>---
Changes for v2:
- Correcting cache maintenance register address.
- Invalidating all 16 bits in cache maintenance register.
- Polling cache maintenance register for cleared bits.
- Added comments to the code.
- Re-worked commit description.--- arch/arm/cpu/armv7/u8500/cpu.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
...
Quoted 4 lines
arch/arm/cpu/armv7/u8500/cpu.c +4
-0+void cpu_cache_initialization (void ) +{ +/* invalidate all cache entries */ + *((volatile unsigned int *)(0xA041277C )) =0xFFFF ;
...
Quoted 1 line
arch/arm/cpu/armv7/u8500/cpu.c +1
-0+while (*((volatile unsigned int *)(0xA041277C )) &0xFF )
...
arch/arm/cpu/armv7/u8500/cpu.c static unsigned int read_asicid(void) · line 89
Quoted 2 lines
arch/arm/cpu/armv7/u8500/cpu.c +2
-0+ *((volatile unsigned int *)(0xA0412900 )) =0xFF ; + *((volatile unsigned int *)(0xA0412904 )) =0xFF ;
NAK. Please use proper I/O accessors, and declare a C struct to access these registers.
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 Was hei?t Windows auf Indianisch? - "Wei?er Mann, der auf Sanduhr wartet!"
PATCH RESEND 11/11 snowball: Adding board specific cache cleanup routine
Quoted 26 lines · Wolfgang Denk
Dear mathieu.poirier at linaro.org,
Quoted 17 lines · In message <[email protected]> you…
From: "Mathieu J. Poirier" <[email protected]>
Following ARM's reference manuel for initializing the cache - the kernel won't boot otherwise.
Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by John Rigby <[email protected]>---
Changes for v2:
- Correcting cache maintenance register address.
- Invalidating all 16 bits in cache maintenance register.
- Polling cache maintenance register for cleared bits.
- Added comments to the code.
- Re-worked commit description.--- arch/arm/cpu/armv7/u8500/cpu.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)...
Quoted 4 lines
arch/arm/cpu/armv7/u8500/cpu.c +4
-0+void cpu_cache_initialization (void ) +{ +/* invalidate all cache entries */ + *((volatile unsigned int *)(0xA041277C )) =0xFFFF ;...
Quoted 7 lines
Quoted 1 line
arch/arm/cpu/armv7/u8500/cpu.c +1
-0+while (*((volatile unsigned int *)(0xA041277C )) &0xFF )...
arch/arm/cpu/armv7/u8500/cpu.c static unsigned int read_asicid(void) · line 89
Quoted 2 lines
arch/arm/cpu/armv7/u8500/cpu.c +2
-0+ *((volatile unsigned int *)(0xA0412900 )) =0xFF ; + *((volatile unsigned int *)(0xA0412904 )) =0xFF ;NAK. Please use proper I/O accessors, and declare a C struct to access these registers.
Ok, to make sure I do this properly please point me to an example in the code base where I can find I/O accessors.
Also, could you be more specific about the C struct you're like to see implemented - again and example in the code would be welcomed.
Thanks,
Mathieu.
Quoted 5 lines
Best regards,
Wolfgang Denk
PATCH RESEND 11/11 snowball: Adding board specific cache cleanup routine
Quoted 5 lines · Mathieu Poirier
Quoted 2 lines
NAK. Please use proper I/O accessors, and declare a C struct to access these registers.
Ok, to make sure I do this properly please point me to an example in the code base where I can find I/O accessors.
Take at how the registers are read/written at look at arch/arm/cpu/armv7/mx6/soc.c , for example.
Regards,
Fabio Estevam
PATCH RESEND 11/11 snowball: Adding board specific cache cleanup routine
In reply to Mathieu PoirierDear Mathieu,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 6 lines
arch/arm/cpu/armv7/u8500/cpu.c static unsigned int read_asicid(void) · line 89
Quoted 3 lines
arch/arm/cpu/armv7/u8500/cpu.c +2
-0+ *((volatile unsigned int *)(0xA0412900 )) =0xFF ; + *((volatile unsigned int *)(0xA0412904 )) =0xFF ;NAK. Please use proper I/O accessors, and declare a C struct to access these registers.
Quoted 5 lines
Ok, to make sure I do this properly please point me to an example in the code base where I can find I/O accessors.
Also, could you be more specific about the C struct you're like to see implemented - again and example in the code would be welcomed.
See arch/arm/include/asm/io.h for the respective I/O accessors.
As I have no idea which registers might be hidden by these magig numbers 0xA0412900 or 0xA0412904 it's hard for me to find any good example. See for example accesses like the
writel(val, &ccm->cgr0);
in arch/arm/cpu/arm926ejs/mx25/generic.c, etc. etc.
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 Remember, there's a big difference between kneeling down and bending over. - Frank Zappa