MX5: Make the weim structure complete
Subsystems (2)
PATCH v4 1/4 MX5: Make the weim structure complete
---
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
@@ -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 (x) (x) +#define SWR (x) ((x) << 1) +#define SRD (x) ((x) << 2) +#define MUM (x) ((x) << 3) +#define WFL (x) ((x) << 4) +#define RFL (x) ((x) << 5) +#define CRE (x) ((x) << 6) +#define CREP (x) ((x) << 7) +#define BL (x) (((x) & 0x7) << 8) +#define WC (x) ((x) << 11) +#define BCD (x) (((x) & 0x3) << 12) +#define BCS (x) (((x) & 0x3) << 14) +#define DSZ (x) (((x) & 0x7) << 16) +#define SP (x) ((x) << 19) +#define CSREC (x) (((x) & 0x7) << 20) +#define AUS (x) ((x) << 23) +#define GBC (x) (((x) & 0x7) << 24) +#define WP (x) ((x) << 27) +#define PSZ (x) (((x) & 0x0f << 28) + +/* +* WEIM CSnGCR2 +*/ +#define ADH (x) (((x) & 0x3)) +#define DAPS (x) (((x) & 0x0f << 4) +#define DAE (x) ((x) << 8) +#define DAP (x) ((x) << 9) +#define MUX16_BYP (x) ((x) << 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 (x) ((x) << 19) +#define RADVA (x) (((x) & 0x7) << 20) +#define RWSC (x) (((x) & 0x3f) << 24) + +/* +* WEIM CSnRCR2 +*/ +#define RBEN (x) (((x) & 0x7)) +#define RBE (x) ((x) << 3) +#define RBEA (x) (((x) & 0x7) << 4) +#define RL (x) (((x) & 0x3) << 8) +#define PAT (x) (((x) & 0x7) << 12) +#define APR (x) ((x) << 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 (x) ((x) << 30) +#define WAL (x) ((x) << 31) + +/* +* WEIM CSnWCR2 +*/ +#define WBED (x) (x) + +/* +* WEIM WCR +*/ +#define BCM (x) (x) +#define GBCD (x) (((x) & 0x3) << 1) +#define INTEN (x) ((x) << 4) +#define INTPOL (x) ((x) << 5) +#define WDOG_EN (x) ((x) << 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
PATCH v4 2/4 MX5: Add iomux structure
---
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
@@ -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
PATCH v4 3/4 MX5: Introduce a function for setting the chip select size
---
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
@@ -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
@@ -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
@@ -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
PATCH v4 4/4 MX53: Add initial support for MX53ARD
---
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 | 308 ++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/mx53ard.h | 198 +++++++++++++++++++ 6 files changed, 652 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
@@ -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 +308 -0
308 lines not on this page · raw message
boards.cfg +1 -0
@@ -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
PATCH v4 1/4 MX5: Make the weim structure complete
In reply to Fabio EstevamQuoted 2 lines · Fabio Estevam
Signed-off-by Fabio Estevam <[email protected]>---
Hi Fabio,
arch/arm/include/asm/arch-mx5/imx-regs.h line 140
Quoted 7 lines
+ * WEIM CSnGCR1
+ */arch/arm/include/asm/arch-mx5/imx-regs.h +5
-0+#define CSEN (x) (x) +#define SWR (x) ((x) << 1) +#define SRD (x) ((x) << 2) +#define MUM (x) ((x) << 3) +#define WFL (x) ((x) << 4)
Probably the macros for single bits can take confusion. Why do we need a parameter ?
I am expecting that CSEN(1) sets the bit and CSEN(0) resets the bit, and this is obviously not the case, because we use them in or-wise or to mask some bits. For single bits there is no test about the parameter and I could use CSEN(7), and that is completely wrong.
Is it not better to remove the parameter for single bits ? If we define for example
SRD (1 << 2)
it is always clear what we want to do and there is no way to generate confusion. And no need to check the parameter.
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: [email protected] =====================================================================