Skip to contentSkip to conversation

MX5: Make the weim structure complete

PATCH Superseded Fabio Estevam 2 participants 6 messages May 23, 2011 – Jun 7, 2011 1 message not in the archive

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/4 MX5: Make the weim structure complete

---
Changes since v4:
- Change the definition of WEIM single-bit field
Changes since v3:
- No changes
Changes since v2:
- Add CS1_BASE_ADDR for MX51
- Add WEIM Registers

 arch/arm/include/asm/arch-mx5/imx-regs.h |  131 ++++++++++++++++++++++++++++--
 1 files changed, 125 insertions(+), 6 deletions(-)
arch/arm/include/asm/arch-mx5/imx-regs.h +125 -6
index a1849f8..e136607 100644
@@ -32,6 +32,7 @@
 #define CSD0_BASE_ADDR          0x90000000
 #define CSD1_BASE_ADDR          0xA0000000
 #define NFC_BASE_ADDR_AXI       0xCFFF0000
+#define CS1_BASE_ADDR           0xB8000000
 #elif defined(CONFIG_MX53)
 #define IPU_CTRL_BASE_ADDR      0x18000000
 #define SPBA0_BASE_ADDR         0x50000000
@@ -41,6 +42,7 @@
 #define CSD1_BASE_ADDR          0xB0000000
 #define NFC_BASE_ADDR_AXI       0xF7FF0000
 #define IRAM_BASE_ADDR          0xF8000000
+#define CS1_BASE_ADDR           0xF4000000
 #else
 #error "CPU_TYPE not defined"
 #endif
@@ -129,6 +131,90 @@
 #define SAHARA_BASE_ADDR	(AIPS2_BASE_ADDR + 0x000F8000)
 
 /*
+ * WEIM CSnGCR1
+ */
+#define CSEN		1
+#define SWR		(1 << 1)
+#define SRD		(1 << 2)
+#define MUM		(1 << 3)
+#define WFL		(1 << 4)
+#define RFL		(1 << 5)
+#define CRE		(1 << 6)
+#define CREP		(1 << 7)
+#define BL(x)		(((x) & 0x7) << 8)
+#define WC		(1 << 11)
+#define BCD(x)		(((x) & 0x3) << 12)
+#define BCS(x)		(((x) & 0x3) << 14)
+#define DSZ(x)		(((x) & 0x7) << 16)
+#define SP		(1 << 19)
+#define CSREC(x)	(((x) & 0x7) << 20)
+#define AUS		(1 << 23)
+#define GBC(x)		(((x) & 0x7) << 24)
+#define WP		(1 << 27)
+#define PSZ(x)		(((x) & 0x0f << 28)
+
+/*
+ * WEIM CSnGCR2
+ */
+#define ADH(x)		(((x) & 0x3))
+#define DAPS(x)		(((x) & 0x0f << 4)
+#define DAE		(1 << 8)
+#define DAP		(1 << 9)
+#define MUX16_BYP	(1 << 12)
+
+/*
+ * WEIM CSnRCR1
+ */
+#define RCSN(x)		(((x) & 0x7))
+#define RCSA(x)		(((x) & 0x7) << 4)
+#define OEN(x)		(((x) & 0x7) << 8)
+#define OEA(x)		(((x) & 0x7) << 12)
+#define RADVN(x)	(((x) & 0x7) << 16)
+#define RAL		(1 << 19)
+#define RADVA(x)	(((x) & 0x7) << 20)
+#define RWSC(x)		(((x) & 0x3f) << 24)
+
+/*
+ * WEIM CSnRCR2
+ */
+#define RBEN(x)		(((x) & 0x7))
+#define RBE		(1 << 3)
+#define RBEA(x)		(((x) & 0x7) << 4)
+#define RL(x)		(((x) & 0x3) << 8)
+#define PAT(x)		(((x) & 0x7) << 12)
+#define APR		(1 << 15)
+
+/*
+ * WEIM CSnWCR1
+ */
+#define WCSN(x)		(((x) & 0x7))
+#define WCSA(x)		(((x) & 0x7) << 3)
+#define WEN(x)		(((x) & 0x7) << 6)
+#define WEA(x)		(((x) & 0x7) << 9)
+#define WBEN(x)		(((x) & 0x7) << 12)
+#define WBEA(x)		(((x) & 0x7) << 15)
+#define WADVN(x)	(((x) & 0x7) << 18)
+#define WADVA(x)	(((x) & 0x7) << 21)
+#define WWSC(x)		(((x) & 0x3f) << 24)
+#define WBED1		(1 << 30)
+#define WAL		(1 << 31)
+
+/*
+ * WEIM CSnWCR2
+ */
+#define WBED		1
+
+/*
+ * WEIM WCR
+ */
+#define BCM		1
+#define GBCD(x)		(((x) & 0x3) << 1)
+#define INTEN		(1 << 4)
+#define INTPOL		(1 << 5)
+#define WDOG_EN		(1 << 8)
+#define WDOG_LIMIT(x)	(((x) & 0x3) << 9)
+
+/*
  * Number of GPIO pins per port
  */
 #define GPIO_NUM_PIN            32
@@ -231,12 +317,45 @@ struct clkctl {
 
 /* WEIM registers */
 struct weim {
-	u32	csgcr1;
-	u32	csgcr2;
-	u32	csrcr1;
-	u32	csrcr2;
-	u32	cswcr1;
-	u32	cswcr2;
+	u32	cs0gcr1;
+	u32	cs0gcr2;
+	u32	cs0rcr1;
+	u32	cs0rcr2;
+	u32	cs0wcr1;
+	u32	cs0wcr2;
+	u32	cs1gcr1;
+	u32	cs1gcr2;
+	u32	cs1rcr1;
+	u32	cs1rcr2;
+	u32	cs1wcr1;
+	u32	cs1wcr2;
+	u32	cs2gcr1;
+	u32	cs2gcr2;
+	u32	cs2rcr1;
+	u32	cs2rcr2;
+	u32	cs2wcr1;
+	u32	cs2wcr2;
+	u32	cs3gcr1;
+	u32	cs3gcr2;
+	u32	cs3rcr1;
+	u32	cs3rcr2;
+	u32	cs3wcr1;
+	u32	cs3wcr2;
+	u32	cs4gcr1;
+	u32	cs4gcr2;
+	u32	cs4rcr1;
+	u32	cs4rcr2;
+	u32	cs4wcr1;
+	u32	cs4wcr2;
+	u32	cs5gcr1;
+	u32	cs5gcr2;
+	u32	cs5rcr1;
+	u32	cs5rcr2;
+	u32	cs5wcr1;
+	u32	cs5wcr2;
+	u32	wcr;
+	u32	wiar;
+	u32	ear;
 };
 
 /* GPIO Registers */
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH v5 2/4 MX5: Add iomux structure

---
Changes since v4:
- No changes
Changes since v3:
- No changes
Changes since v2:
- Distinguish iomuxc struct between MX51 and MX53

 arch/arm/include/asm/arch-mx5/imx-regs.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-mx5/imx-regs.h +23 -0
index b65b11f..3c61c7f 100644
@@ -358,6 +358,29 @@ struct weim {
 	u32	ear;
 };
 
+#if defined(CONFIG_MX51)
+struct iomuxc {
+	u32	gpr0;
+	u32	gpr1;
+	u32	omux0;
+	u32	omux1;
+	u32	omux2;
+	u32	omux3;
+	u32	omux4;
+};
+#elif defined(CONFIG_MX53)
+struct iomuxc {
+	u32	gpr0;
+	u32	gpr1;
+	u32	gpr2;
+	u32	omux0;
+	u32	omux1;
+	u32	omux2;
+	u32	omux3;
+	u32	omux4;
+};
+#endif
+
 /* GPIO Registers */
 struct gpio_regs {
 	u32	gpio_dr;
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH v5 3/4 MX5: Introduce a function for setting the chip select size

---
Changes since v4:
- No changes
Changes since v3:
- Print the chip size in the case of error

 arch/arm/cpu/armv7/mx5/soc.c              |   30 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx5/imx-regs.h  |    5 ++++
 arch/arm/include/asm/arch-mx5/sys_proto.h |    2 +-
 3 files changed, 36 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/mx5/soc.c +30 -0
index 40b8b56..e599df8 100644
@@ -163,6 +163,36 @@ int cpu_mmc_init(bd_t *bis)
 #endif
 }
 
+void set_chipselect_size(int const cs_size)
+{
+	unsigned int reg;
+	struct iomuxc *iomuxc_regs = (struct weim *)IOMUXC_BASE_ADDR;
+	reg = readl(&iomuxc_regs->gpr1);
+
+	switch (cs_size) {
+	case CS0_128:
+		reg &= ~0x7;	/* CS0=128MB, CS1=0, CS2=0, CS3=0 */
+		reg |= 0x5;
+		break;
+	case CS0_64M_CS1_64M:
+		reg &= ~0x3F;	/* CS0=64MB, CS1=64MB, CS2=0, CS3=0 */
+		reg |= 0x1B;
+		break;
+	case CS0_64M_CS1_32M_CS2_32M:
+		reg &= ~0x1FF;	/* CS0=64MB, CS1=32MB, CS2=32MB, CS3=0 */
+		reg |= 0x4B;
+		break;
+	case CS0_32M_CS1_32M_CS2_32M_CS3_32M:
+		reg &= ~0xFFF;  /* CS0=32MB, CS1=32MB, CS2=32MB, CS3=32MB */
+		reg |= 0x249;
+		break;
+	default:
+		printf("Unknown chip select size: %d\n", cs_size);
+		break;
+	}
+
+	writel(reg, &iomuxc_regs->gpr1);
+}
 
 void reset_cpu(ulong addr)
 {
arch/arm/include/asm/arch-mx5/imx-regs.h +5 -0
index 9d2046a..5163614 100644
@@ -214,6 +214,11 @@
 #define WDOG_EN(x)	((x) << 8)
 #define WDOG_LIMIT(x)	(((x) & 0x3) << 9)
 
+#define CS0_128					0
+#define CS0_64M_CS1_64M				1
+#define CS0_64M_CS1_32M_CS2_32M			2
+#define CS0_32M_CS1_32M_CS2_32M_CS3_32M		3
+
 /*
  * Number of GPIO pins per port
  */
arch/arm/include/asm/arch-mx5/sys_proto.h +1 -1
index f687503..ce63675 100644
@@ -27,5 +27,5 @@
 u32 get_cpu_rev(void);
 #define is_soc_rev(rev)	((get_cpu_rev() & 0xFF) - rev)
 void sdelay(unsigned long);
-
+void set_chipselect_size(int const);
 #endif
Signature · 1 line
1.6.0.4
#3 lore raw

PATCH v5 4/4 MX53: Add initial support for MX53ARD

---
Changes since v4:
- Changed the weim cs1 settings for the single-bit fields
- Removed unused 'reg' variable inside weim_smc911x_iomux()
- Made void weim_cs1_settings() and weim_smc911x_iomux() static Changes since v3:
- No changes
Changes since v2:
- Use macros for setting up weim register
- Use set_chipselect_size function
- Rename the file to imximage_dd3.cfg to make explicit the DDR type.

 MAINTAINERS                              |    1 +
 board/freescale/mx53ard/Makefile         |   48 +++++
 board/freescale/mx53ard/imximage_dd3.cfg |   96 ++++++++++
 board/freescale/mx53ard/mx53ard.c        |  306 ++++++++++++++++++++++++++++++
 boards.cfg                               |    1 +
 include/configs/mx53ard.h                |  198 +++++++++++++++++++
 6 files changed, 650 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/mx53ard/Makefile
 create mode 100644 board/freescale/mx53ard/imximage_dd3.cfg
 create mode 100644 board/freescale/mx53ard/mx53ard.c
 create mode 100644 include/configs/mx53ard.h
MAINTAINERS +1 -0
index 07237e3..b63f53f 100644
@@ -639,6 +639,7 @@ Kristoffer Ericson <[email protected]>
 Fabio Estevam <[email protected]>
 
 	mx31pdk		i.MX31
+	mx53ard		i.MX53
 	mx53smd		i.MX53
 
 Peter Figuli <[email protected]>
board/freescale/mx53ard/Makefile new file +48 -0

48 lines not on this page · raw message

board/freescale/mx53ard/imximage_dd3.cfg new file +96 -0

96 lines not on this page · raw message

board/freescale/mx53ard/mx53ard.c new file +306 -0

306 lines not on this page · raw message

boards.cfg +1 -0
index 9339981..a616f29 100644
@@ -124,6 +124,7 @@ dkb			     arm         arm926ejs   -                   Marvell        pantheon
 ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
 efikamx                      arm         armv7       efikamx             -              mx5
 mx51evk                      arm         armv7       mx51evk             freescale      mx5		mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg
+mx53ard                      arm         armv7       mx53ard             freescale      mx5		mx53ard:IMX_CONFIG=board/freescale/mx53ard/imximage_dd3.cfg
 mx53evk                      arm         armv7       mx53evk             freescale      mx5		mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg
 mx53loco                     arm         armv7       mx53loco            freescale      mx5		mx53loco:IMX_CONFIG=board/freescale/mx53loco/imximage.cfg
 mx53smd                      arm         armv7       mx53smd             freescale      mx5		mx53smd:IMX_CONFIG=board/freescale/mx53smd/imximage.cfg
include/configs/mx53ard.h new file +198 -0

198 lines not on this page · raw message

Signature · 1 line
1.6.0.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

PATCH v5 1/4 MX5: Make the weim structure complete

Quoted 4 lines · Fabio Estevam

Hi Stefano,

Does this patch series look fine now?

Hi Fabio,

I have no comments about your last post. However, as you posted the first patchset for the MX53ARD when the merge window was already closed (not last Wolfgang has already published the 2011.06-rc1), I will put the MX53ARD (including the WEIM patch) into u-boot-imx, next branch, and not directly into u-boot-imx/master.

Best regards,
Stefano Babic

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-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#6 lore raw

PATCH v5 1/4 MX5: Make the weim structure complete

In reply to a message not in the archive
Quoted 4 lines · Fabio Estevam

Hi Stefano,

Does this patch series look fine now?

Hi Fabio,

I see some warnings that must be dropped before putting your patches into the mainline:

Configuring for mx53ard - Board: mx53ard, Options:
IMX_CONFIG=board/freescale/mx53ard/imximage_dd3.cfg soc.c: In function 'set_chipselect_size':
soc.c:169: warning: initialization from incompatible pointer type

In fact:

struct iomuxc *iomuxc_regs = (struct weim *)IOMUXC_BASE_ADDR;
^-- this should be struct iomuxc

mx53ard.c:176: warning: function declaration isn't a prototype mx53ard.c:259: warning: function declaration isn't a prototype

due to static void weim_smc911x_iomux() instead of static void weim_smc911x_iomux(void).

Can you fix them ?

Best regards,
Stefano Babic

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-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================