Skip to contentSkip to conversation

snowball: Add support for ux500 based snowball board

PATCH Superseded mathieu.poirier at linaro.org 1 participant 4 messages Jul 5, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/11 snowball: Add support for ux500 based snowball board

From: "Mathieu J. Poirier" <[email protected]>

---
Changes for v2:
- Fixed white space errors.
- Fixed typedef pin_cfg_t declaration.
- Added maintainer entry.

---
 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(-)
MAINTAINERS +4 -0
index e55893b..e22ee5a 100644
@@ -946,6 +946,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
index a723f67..b28052d 100644
@@ -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
index fb3b09a..36a0ff3 100644
@@ -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
index ed581ae..d4c5137 100644
@@ -156,6 +156,8 @@ int serial_init (void)
 			writel(lcr, &regs->fr);
 
 		writel(lcr, &regs->pl011_rlcr);
+		/* lcrh needs to be set again for change to be effective */
+		writel(lcr, &regs->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
#1 lore raw

PATCH v2 2/11 u8500: Moving prcmu to cpu directory

From: "Mathieu J. Poirier" <[email protected]>

This is to allow the prcmu functions to be used by multiple u8500-based processors.

---
Changes for v2:
- Fixed white space errors.

---
 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
index 270aa40..77accde 100644
@@ -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
index 4091a42..4ea2212 100644
@@ -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
index 5f85fdc..6e3fc87 100644
@@ -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
#2 lore raw

PATCH v2 5/11 snowball: Moving to ux500.v2 addess scheme for PRCMU access

In reply to mathieu.poirier at linaro.org

From: "Mathieu J. Poirier" <[email protected]>

Addresses between ux500.v1 and ux500.v2 have changed slightly, hence mandating a review of the PRCMU access methods.

---
Changes for v2:
- Refactored to apply cleanly over previous v2 changes.

---
 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
index 4918bbc..934428f 100644
@@ -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
index 6bb95ec..9208880 100644
@@ -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
index 1fd4d2a..9862eb3 100644
@@ -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
#3 lore raw

PATCH v2 11/11 snowball: Adding board specific cache cleanup routine

In reply to mathieu.poirier at linaro.org

From: "Mathieu J. Poirier" <[email protected]>

Following ARM's reference manuel for initializing the cache - the kernel won't boot otherwise.

---
Changes for v2:
- Using correct I/O access function.
- Added cache controller address offsets for clarity.

---
 arch/arm/cpu/armv7/u8500/cpu.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/u8500/cpu.c +26 -0
index 02bb332..6f95c30 100644
@@ -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