From e1c9102d3bf0664a20e55e5709983bf1790d1029 Mon Sep 17 00:00:00 2001 From: Juergen Beisert Date: Thu, 18 Oct 2007 00:00:02 +0200 Subject: [PATCH 1/3] make it work with all current CPUs --- drivers/serial/serial_imx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c index b547b6cc3..14f3059bb 100644 --- a/drivers/serial/serial_imx.c +++ b/drivers/serial/serial_imx.c @@ -154,14 +154,17 @@ * create default values for different platforms */ #ifdef CONFIG_ARCH_IMX1 +# define UCR1_VAL (UCR1_UARTCLKEN) # define UCR3_VAL 0 # define UCR4_VAL (UCR4_CTSTL_32 | UCR4_REF16) #endif #ifdef CONFIG_ARCH_IMX27 +# define UCR1_VAL (UCR1_UARTCLKEN) # define UCR3_VAL (0x700 | UCR3_RXDMUXSEL) # define UCR4_VAL UCR4_CTSTL_32 #endif #ifdef CONFIG_ARCH_IMX31 +# define UCR1_VAL (0) # define UCR3_VAL (0x700 | UCR3_RXDMUXSEL) # define UCR4_VAL UCR4_CTSTL_32 #endif @@ -186,7 +189,7 @@ static int imx_serial_init_port(struct console_device *cdev) struct device_d *dev = cdev->dev; ulong base = dev->map_base; - UCR1(base) = UCR1_UARTCLKEN; + UCR1(base) = UCR1_VAL; UCR2(base) = UCR2_WS | UCR2_IRTS; UCR3(base) = UCR3_VAL; UCR4(base) = UCR4_VAL; @@ -199,7 +202,7 @@ static int imx_serial_init_port(struct console_device *cdev) /* Configure FIFOs */ UFCR(base) = 0xa81; -#ifdef CONFIG_ARCH_IMX27 +#if defined(CONFIG_ARCH_IMX27) || defined(CONFIG_ARCH_IMX31) ONEMS(base) = imx_serial_reffreq(base) / 1000; #endif From 075131631b11c665eb32804fdb5e3ab7d6fc4954 Mon Sep 17 00:00:00 2001 From: Juergen Beisert Date: Thu, 18 Oct 2007 00:04:47 +0200 Subject: [PATCH 2/3] make the clocksource work on current CPUs --- arch/arm/mach-imx/clocksource.c | 3 +- include/asm-arm/arch-imx/imx-regs.h | 24 +- include/asm-arm/arch-imx/imx1-regs.h | 24 +- include/asm-arm/arch-imx/imx27-regs.h | 24 +- include/asm-arm/arch-imx/imx31-regs.h | 414 +++----------------------- 5 files changed, 90 insertions(+), 399 deletions(-) diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c index e8894a330..767818535 100644 --- a/arch/arm/mach-imx/clocksource.c +++ b/arch/arm/mach-imx/clocksource.c @@ -63,8 +63,7 @@ static int clocksource_init (void) GPT(GPT_TCTL) = 0; /* We have no udelay by now */ GPT(GPT_TPRER) = 0; - GPT(GPT_TCTL) |= TCTL_FRR | (1<<1); /* Freerun Mode, PERCLK1 input */ - + GPT(GPT_TCTL) |= TCTL_FRR | (1<> 4) & 0x3f) << 20) -#define SIZE_YMAX(y) ( (y) & 0x1ff ) - -#define LCDC_VPW __REG(IMX_LCDC_BASE+0x08) -#define VPW_VPW(x) ( (x) & 0x3ff ) - -#define LCDC_CPOS __REG(IMX_LCDC_BASE+0x0C) -#define CPOS_CC1 (1<<31) -#define CPOS_CC0 (1<<30) -#define CPOS_OP (1<<28) -#define CPOS_CXP(x) (((x) & 3ff) << 16) -#define CPOS_CYP(y) ((y) & 0x1ff) - -#define LCDC_LCWHB __REG(IMX_LCDC_BASE+0x10) -#define LCWHB_BK_EN (1<<31) -#define LCWHB_CW(w) (((w) & 0x1f) << 24) -#define LCWHB_CH(h) (((h) & 0x1f) << 16) -#define LCWHB_BD(x) ((x) & 0xff) - -#define LCDC_LCHCC __REG(IMX_LCDC_BASE+0x14) -#define LCHCC_CUR_COL_R(r) (((r) & 0x1f) << 11) -#define LCHCC_CUR_COL_G(g) (((g) & 0x3f) << 5) -#define LCHCC_CUR_COL_B(b) ((b) & 0x1f) - -#define LCDC_PCR __REG(IMX_LCDC_BASE+0x18) -#define PCR_TFT (1<<31) -#define PCR_COLOR (1<<30) -#define PCR_PBSIZ_1 (0<<28) -#define PCR_PBSIZ_2 (1<<28) -#define PCR_PBSIZ_4 (2<<28) -#define PCR_PBSIZ_8 (3<<28) -#define PCR_BPIX_1 (0<<25) -#define PCR_BPIX_2 (1<<25) -#define PCR_BPIX_4 (2<<25) -#define PCR_BPIX_8 (3<<25) -#define PCR_BPIX_12 (4<<25) -#define PCR_BPIX_16 (4<<25) -#define PCR_PIXPOL (1<<24) -#define PCR_FLMPOL (1<<23) -#define PCR_LPPOL (1<<22) -#define PCR_CLKPOL (1<<21) -#define PCR_OEPOL (1<<20) -#define PCR_SCLKIDLE (1<<19) -#define PCR_END_SEL (1<<18) -#define PCR_END_BYTE_SWAP (1<<17) -#define PCR_REV_VS (1<<16) -#define PCR_ACD_SEL (1<<15) -#define PCR_ACD(x) (((x) & 0x7f) << 8) -#define PCR_SCLK_SEL (1<<7) -#define PCR_SHARP (1<<6) -#define PCR_PCD(x) ((x) & 0x3f) - -#define LCDC_HCR __REG(IMX_LCDC_BASE+0x1C) -#define HCR_H_WIDTH(x) (((x) & 0x3f) << 26) -#define HCR_H_WAIT_1(x) (((x) & 0xff) << 8) -#define HCR_H_WAIT_2(x) ((x) & 0xff) - -#define LCDC_VCR __REG(IMX_LCDC_BASE+0x20) -#define VCR_V_WIDTH(x) (((x) & 0x3f) << 26) -#define VCR_V_WAIT_1(x) (((x) & 0xff) << 8) -#define VCR_V_WAIT_2(x) ((x) & 0xff) - -#define LCDC_POS __REG(IMX_LCDC_BASE+0x24) -#define POS_POS(x) ((x) & 1f) - -#define LCDC_LSCR1 __REG(IMX_LCDC_BASE+0x28) -#define LSCR1_GRAY1(x) (((x) & 0xf) << 4) -#define LSCR1_GRAY2(x) ((x) & 0xf) - -#define LCDC_PWMR __REG(IMX_LCDC_BASE+0x2C) -#define PWMR_CLS(x) (((x) & 0x1ff) << 16) -#define PWMR_LDMSK (1<<15) -#define PWMR_SCR1 (1<<10) -#define PWMR_SCR0 (1<<9) -#define PWMR_CC_EN (1<<8) -#define PWMR_PW(x) ((x) & 0xff) - -#define LCDC_DMACR __REG(IMX_LCDC_BASE+0x30) -#define DMACR_BURST (1<<31) -#define DMACR_HM(x) (((x) & 0xf) << 16) -#define DMACR_TM(x) ((x) &0xf) - -#define LCDC_RMCR __REG(IMX_LCDC_BASE+0x34) -#define RMCR_LCDC_EN (1<<1) -#define RMCR_SELF_REF (1<<0) - -#define LCDC_LCDICR __REG(IMX_LCDC_BASE+0x38) -#define LCDICR_INT_SYN (1<<2) -#define LCDICR_INT_CON (1) - -#define LCDC_LCDISR __REG(IMX_LCDC_BASE+0x40) -#define LCDISR_UDR_ERR (1<<3) -#define LCDISR_ERR_RES (1<<2) -#define LCDISR_EOF (1<<1) -#define LCDISR_BOF (1<<0) - -/* - * UART port definitions in the serial driver - */ - -/* - * General purpose timers registers - */ -#define TCTL1 __REG(IMX_TIM1_BASE) -#define TPRER1 __REG(IMX_TIM1_BASE + 0x4) -#define TCMP1 __REG(IMX_TIM1_BASE + 0x8) -#define TCR1 __REG(IMX_TIM1_BASE + 0xc) -#define TCN1 __REG(IMX_TIM1_BASE + 0x10) -#define TSTAT1 __REG(IMX_TIM1_BASE + 0x14) -#define TCTL2 __REG(IMX_TIM2_BASE) -#define TPRER2 __REG(IMX_TIM2_BASE + 0x4) -#define TCMP2 __REG(IMX_TIM2_BASE + 0x8) -#define TCR2 __REG(IMX_TIM2_BASE + 0xc) -#define TCN2 __REG(IMX_TIM2_BASE + 0x10) -#define TSTAT2 __REG(IMX_TIM2_BASE + 0x14) - -/* - * General purpose timers bitfields - */ -#define TCTL_SWR (1<<15) /* Software reset */ -#define TCTL_FRR (1<<8) /* Freerun / restart */ -#define TCTL_CAP (3<<6) /* Capture Edge */ -#define TCTL_OM (1<<5) /* output mode */ -#define TCTL_IRQEN (1<<4) /* interrupt enable */ -#define TCTL_CLKSOURCE (7<<1) /* Clock source */ -#define TCTL_TEN (1) /* Timer enable */ -#define TPRER_PRES (0xff) /* Prescale */ -#define TSTAT_CAPT (1<<1) /* Capture event */ -#define TSTAT_COMP (1) /* Compare event */ -#endif - /* * ???????????? */ From 2e36bc0781f075a1ae8e69bca2e87082eb47a06e Mon Sep 17 00:00:00 2001 From: Juergen Beisert Date: Thu, 18 Oct 2007 00:06:03 +0200 Subject: [PATCH 3/3] adding devices to the newest Phytec BSP --- board/phycore_imx31/phycore_imx31.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/board/phycore_imx31/phycore_imx31.c b/board/phycore_imx31/phycore_imx31.c index e8171cc6e..457a8e430 100644 --- a/board/phycore_imx31/phycore_imx31.c +++ b/board/phycore_imx31/phycore_imx31.c @@ -29,15 +29,14 @@ #include /* - * ?MiB NOR type flash, connected to CS line 0, + * 32MiB NOR type flash, connected to CS line 0, * data width is */ static struct device_d cfi_dev = { .name = "cfi_flash", .id = "nor0", - - .map_base = 0x10000000, /* FIXME */ - .size = 16 * 1024 * 1024, /* FIXME */ + .map_base = IMX_CS0_BASE, + .size = 32 * 1024 * 1024, }; /* @@ -47,9 +46,8 @@ static struct device_d cfi_dev = { static struct device_d sram_dev = { .name = "sram", .id = "sram0", - - .map_base = 0x10000000, /* FIXME */ - .size = 16 * 1024 * 1024, /* FIXME */ + .map_base = IMX_CS4_BASE, + .size = 16 * 1024 * 1024, }; /* @@ -58,7 +56,6 @@ static struct device_d sram_dev = { static struct device_d nand_dev = { .name = "cfi_flash_nand", .id = "nand0", - .map_base = 0x10000000, /* FIXME */ .size = 16 * 1024 * 1024, /* FIXME */ }; @@ -71,18 +68,17 @@ static struct device_d nand_dev = { static struct device_d network_dev = { .name = "smsc9xxx", .id = "eth0", -#if 0 - .map_base = 0x10000000, /* FIXME */ + .map_base = IMX_CS1_BASE, .size = 16 * 1024 * 1024, /* FIXME */ -#endif }; +/* 128MiB */ static struct device_d sdram_dev = { .name = "ram", .id = "ram0", - .map_base = 0x08000000, /* FIXME */ - .size = 16 * 1024 * 1024, /* FIXME */ + .map_base = IMX_SDRAM_CS0, + .size = 128 * 1024 * 1024, .type = DEVICE_TYPE_DRAM, }; @@ -105,12 +101,11 @@ static int imx31_devices_init(void) imx_gpio_mode(MUX_CSPI2_MOSI_I2C2_SCL); imx_gpio_mode(MUX_CSPI2_MISO_I2C2_SCL); -#if 0 register_device(&cfi_dev); register_device(&sram_dev); - register_device(&cfi_dev); + register_device(&nand_dev); register_device(&network_dev); -#endif + register_device(&sdram_dev); return 0;