From bb336515fd6b443a7532f1a7f7643d0b5b3c1811 Mon Sep 17 00:00:00 2001 From: Justin Waters Date: Wed, 27 Feb 2008 11:50:03 -0500 Subject: MX27Litekit: Add basic display support The patches did not contain the board specific information to initialize the display. This patch will add support for the Sharp VGA display from LogicPD. We would eventually like to add support for other displays as well. This patch is based on work by the user fszczerba on the LogicPD forums. Signed-off-by: Justin Waters --- drivers/video/mxc/mxcfb_modedb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/video/mxc/mxcfb_modedb.c b/drivers/video/mxc/mxcfb_modedb.c index 1eca0a526f04..03f5d5b802da 100644 --- a/drivers/video/mxc/mxcfb_modedb.c +++ b/drivers/video/mxc/mxcfb_modedb.c @@ -58,6 +58,22 @@ struct fb_videomode mxcfb_modedb[] = { "TV-VGA", 60, 640, 480, 40574, 35, 45, 9, 1, 46, 5, 0, FB_VMODE_NONINTERLACED, 0, }, + { + /* 640x480 @ 60 Hz */ + "Sharp-VGA", + 60, 640, 480, // 60 Hz, 640x480 + 35285, // 35.285 ns clock period + 128, 128, // left & right margin + 34, 10, // upper & lower margin + 2, 2, // hsync & vsync len + 0 + //| FB_SYNC_CLK_IDLE_EN + | FB_SYNC_OE_ACT_HIGH + //| FB_SYNC_HOR_HIGH_ACT + , + FB_VMODE_NONINTERLACED, + 0, + }, }; int mxcfb_modedb_sz = ARRAY_SIZE(mxcfb_modedb); -- cgit v1.2.3 From 304d61558ceff4813567507e8c18a476f0c11594 Mon Sep 17 00:00:00 2001 From: Justin Waters Date: Fri, 16 May 2008 11:17:55 -0400 Subject: MX27Litekit: Update NOR Flash partition table The NOR flash on the Litekit is significantly smaller than that on the ADS board. This breaks the partitions into three blocks: one for LogicLoader, one for the LogicLoader configuration data, and one for miscellaneous use. Signed-off-by: Justin Waters --- arch/arm/mach-mx27/mx27lite.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-mx27/mx27lite.c b/arch/arm/mach-mx27/mx27lite.c index bdd480a76dab..45009c2c3f79 100644 --- a/arch/arm/mach-mx27/mx27lite.c +++ b/arch/arm/mach-mx27/mx27lite.c @@ -161,37 +161,22 @@ static inline void mxc_init_keypad(void) static struct mtd_partition mxc_nor_partitions[] = { { - .name = "Bootloader", - .size = 512 * 1024, + .name = "nor.bootloader", + .size = 256 * 1024, .offset = 0x00000000, .mask_flags = MTD_WRITEABLE /* force read-only */ }, { - .name = "nor.Kernel", - .size = 2 * 1024 * 1024, + .name = "nor.config", + .size = 64 * 1024, .offset = MTDPART_OFS_APPEND, - .mask_flags = 0}, - { - .name = "nor.userfs", - .size = 14 * 1024 * 1024, - .offset = MTDPART_OFS_APPEND, - .mask_flags = 0}, - { - .name = "nor.rootfs", - .size = 12 * 1024 * 1024, - .offset = MTDPART_OFS_APPEND, - .mask_flags = MTD_WRITEABLE}, - { - .name = "FIS directory", - .size = 12 * 1024, - .offset = 0x01FE0000, .mask_flags = MTD_WRITEABLE /* force read-only */ }, { - .name = "Redboot config", + .name = "nor.extra", .size = MTDPART_SIZ_FULL, - .offset = 0x01FFF000, - .mask_flags = MTD_WRITEABLE /* force read-only */ + .offset = MTDPART_OFS_APPEND, + .mask_flags = 0 }, }; -- cgit v1.2.3 From 8063d396638e4dad0d713bd7abbc1dd7ad190e1a Mon Sep 17 00:00:00 2001 From: Justin Waters Date: Tue, 20 May 2008 16:29:13 -0400 Subject: MX27LITE_GPIO: Fix GPIO conflicts between USB Host 2 and SPI 1 USB Host 2 and SPI 1 only conflict with one pin. If the SPI bus is not using the slave select 2 (SS2) pin (which the Atlas chip does not), then you can use both the SPI 1 and USB Host 2 interfaces simultaneously. This patch disables the MSB of the slave select if Host 2 is enabled. This will limit SPI1 to only 4 slaves instead of 8. Signed-off-by: Justin Waters --- arch/arm/mach-mx27/mx27lite_gpio.c | 14 ++++++++++---- drivers/usb/host/Kconfig | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-mx27/mx27lite_gpio.c b/arch/arm/mach-mx27/mx27lite_gpio.c index 45b1e68fb791..395517e1f55a 100644 --- a/arch/arm/mach-mx27/mx27lite_gpio.c +++ b/arch/arm/mach-mx27/mx27lite_gpio.c @@ -407,7 +407,11 @@ void gpio_spi_active(int cspi_mod) gpio_request_mux(MX27_PIN_CSPI1_RDY, GPIO_MUX_PRIMARY); gpio_request_mux(MX27_PIN_CSPI1_SS0, GPIO_MUX_PRIMARY); gpio_request_mux(MX27_PIN_CSPI1_SS1, GPIO_MUX_PRIMARY); + +/* This pin conflicts with the USB Host 2 Interface. */ +#if !defined(CONFIG_USB_EHCI_ARC_H2) gpio_request_mux(MX27_PIN_CSPI1_SS2, GPIO_MUX_PRIMARY); +#endif break; case 1: /*SPI2 */ @@ -420,10 +424,10 @@ void gpio_spi_active(int cspi_mod) break; case 2: /*SPI3 */ - gpio_request_mux(MX27_PIN_SD1_D0, GPIO_MUX_ALT); - gpio_request_mux(MX27_PIN_SD1_CMD, GPIO_MUX_ALT); - gpio_request_mux(MX27_PIN_SD1_CLK, GPIO_MUX_ALT); - gpio_request_mux(MX27_PIN_SD1_D3, GPIO_MUX_ALT); + gpio_request_mux(MX27_PIN_SD1_D0, GPIO_MUX_ALT); /* MISO */ + gpio_request_mux(MX27_PIN_SD1_CMD, GPIO_MUX_ALT); /* MOSI */ + gpio_request_mux(MX27_PIN_SD1_CLK, GPIO_MUX_ALT); /* SCLK */ + gpio_request_mux(MX27_PIN_SD1_D3, GPIO_MUX_ALT); /* SS */ break; default: @@ -447,7 +451,9 @@ void gpio_spi_inactive(int cspi_mod) gpio_free_mux(MX27_PIN_CSPI1_RDY); gpio_free_mux(MX27_PIN_CSPI1_SS0); gpio_free_mux(MX27_PIN_CSPI1_SS1); +#if !defined(CONFIG_USB_EHCI_ARC_H2) gpio_free_mux(MX27_PIN_CSPI1_SS2); +#endif break; case 1: /*SPI2 */ diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index cc7e2449a934..fce00f72d362 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -48,7 +48,7 @@ config USB_EHCI_ARC_H1 config USB_EHCI_ARC_H2 bool "Support for Host2 port on Freescale controller" depends on USB_EHCI_ARC && \ - ((ARCH_MX27 && !SPI_MXC_SELECT1 && !SPI_MXC_SELECT2) || \ + ((ARCH_MX27 && !SPI_MXC_SELECT2) || \ ARCH_MX3) ---help--- Enable support for the USB Host2 port. -- cgit v1.2.3 From 68bfb81f26a08b79c3e2e08a1e85b1b69f887009 Mon Sep 17 00:00:00 2001 From: Justin Waters Date: Tue, 20 May 2008 16:39:42 -0400 Subject: Update pin configuration for USB Host 2 on the Lite Kit. The USB Host 2 on the MX27 Litekit uses the USB_POWER and USB_OC_B pins for power and overcurrent detect, respectively. In order to make them function properly, we need to assign those pins to the Host 2 driver and change the H2PM field of the USB_CTRL register on the i.MX27. Signed-off-by: Justin Waters --- arch/arm/mach-mx27/mx27lite_gpio.c | 7 ++++++- arch/arm/plat-mxc/usb_common.c | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mx27/mx27lite_gpio.c b/arch/arm/mach-mx27/mx27lite_gpio.c index 395517e1f55a..b4734635af49 100644 --- a/arch/arm/mach-mx27/mx27lite_gpio.c +++ b/arch/arm/mach-mx27/mx27lite_gpio.c @@ -244,7 +244,9 @@ int gpio_usbh2_active(void) gpio_request_mux(MX27_PIN_CSPI2_SCLK, GPIO_MUX_ALT) || gpio_request_mux(MX27_PIN_CSPI2_MISO, GPIO_MUX_ALT) || gpio_request_mux(MX27_PIN_CSPI2_MOSI, GPIO_MUX_ALT) || - gpio_request_mux(MX27_PIN_CSPI1_SS2, GPIO_MUX_ALT)) + gpio_request_mux(MX27_PIN_CSPI1_SS2, GPIO_MUX_ALT) || + gpio_request_mux(MX27_PIN_USB_OC_B, GPIO_MUX_PRIMARY) || + gpio_request_mux(MX27_PIN_USB_PWR, GPIO_MUX_PRIMARY)) return -EINVAL; //__raw_writew(PBC_BCTRL3_HSH_EN, PBC_BCTRL3_CLEAR_REG); @@ -278,6 +280,9 @@ void gpio_usbh2_inactive(void) gpio_set_puen(MX27_PIN_CSPI2_MISO, 1); gpio_set_puen(MX27_PIN_CSPI2_MOSI, 1); gpio_set_puen(MX27_PIN_CSPI1_SS2, 1); + + gpio_free_mux(MX27_PIN_USB_OC_B); + gpio_free_mux(MX27_PIN_USB_PWR); //__raw_writew(PBC_BCTRL3_HSH_EN, PBC_BCTRL3_SET_REG); } diff --git a/arch/arm/plat-mxc/usb_common.c b/arch/arm/plat-mxc/usb_common.c index 73781aa705fa..f56392fba3f6 100644 --- a/arch/arm/plat-mxc/usb_common.c +++ b/arch/arm/plat-mxc/usb_common.c @@ -320,10 +320,18 @@ static void usbh2_set_ulpi_xcvr(void) { pr_debug("%s\n", __FUNCTION__); USBCTRL &= ~(UCTRL_H2SIC_MASK | UCTRL_BPE); /* disable bypass mode */ + +#if defined(CONFIG_MACH_MX27LITE) + USBCTRL |= UCTRL_H2WIE | /* wakeup intr enable */ + UCTRL_H2UIE | /* ULPI intr enable */ + UCTRL_H2DT | /* disable H2 TLL */ + !UCTRL_H2PM; /* power mask */ +#else USBCTRL |= UCTRL_H2WIE | /* wakeup intr enable */ UCTRL_H2UIE | /* ULPI intr enable */ UCTRL_H2DT | /* disable H2 TLL */ UCTRL_H2PM; /* power mask */ +#endif UH2_PORTSC1 &= ~PORTSC_PTS_MASK; /* set ULPI xcvr */ UH2_PORTSC1 |= PORTSC_PTS_ULPI; -- cgit v1.2.3 From 4c2a2437ea37c42778c318cb6626668518001193 Mon Sep 17 00:00:00 2001 From: Justin Waters Date: Tue, 20 May 2008 17:25:18 -0400 Subject: MX27LITE_GPIO: Fix pins for USBOTG interface The USBOTG interface uses two GPIO pins for its PWR_EN and OC signals. These pins are associated with the OTG interface and the PWR_EN is cleared since the power enable signal for the power controller is low-true. Signed-off-by: Justin Waters --- arch/arm/mach-mx27/mx27lite_gpio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-mx27/mx27lite_gpio.c b/arch/arm/mach-mx27/mx27lite_gpio.c index b4734635af49..5e8ff4262a66 100644 --- a/arch/arm/mach-mx27/mx27lite_gpio.c +++ b/arch/arm/mach-mx27/mx27lite_gpio.c @@ -302,10 +302,15 @@ int gpio_usbotg_hs_active(void) gpio_request_mux(MX27_PIN_USBOTG_CLK, GPIO_MUX_PRIMARY) || gpio_request_mux(MX27_PIN_USBOTG_DATA7, GPIO_MUX_PRIMARY) || - gpio_request_mux(MX27_PIN_USB_OC_B, GPIO_MUX_PRIMARY) || - gpio_request_mux(MX27_PIN_USB_PWR, GPIO_MUX_PRIMARY)) + /* Use TXDM and TXDP pins as power and Overcurrent control */ + gpio_request_mux(MX27_PIN_USBH1_TXDM, GPIO_MUX_GPIO) || + gpio_request_mux(MX27_PIN_USBH1_TXDP, GPIO_MUX_GPIO)) return -EINVAL; + mxc_set_gpio_direction(MX27_PIN_USBH1_TXDM, 0); /* USB1_PWR_nEN */ + mxc_set_gpio_direction(MX27_PIN_USBH1_TXDP, 1); /* USB1_nOC */ + mxc_set_gpio_dataout(MX27_PIN_USBH1_TXDM, 0); + //__raw_writew(PBC_BCTRL3_OTG_HS_EN, PBC_BCTRL3_CLEAR_REG); //__raw_writew(PBC_BCTRL3_OTG_VBUS_EN, PBC_BCTRL3_CLEAR_REG); @@ -328,8 +333,8 @@ void gpio_usbotg_hs_inactive(void) gpio_free_mux(MX27_PIN_USBOTG_CLK); gpio_free_mux(MX27_PIN_USBOTG_DATA7); - gpio_free_mux(MX27_PIN_USB_OC_B); - gpio_free_mux(MX27_PIN_USB_PWR); + gpio_free_mux(MX27_PIN_USBH1_TXDM); + gpio_free_mux(MX27_PIN_USBH1_TXDP); //__raw_writew(PBC_BCTRL3_OTG_HS_EN, PBC_BCTRL3_SET_REG); } -- cgit v1.2.3 From 969c26a51d236659812b97209f1f1f6cd5f64c32 Mon Sep 17 00:00:00 2001 From: Justin Waters Date: Wed, 21 May 2008 11:04:59 -0400 Subject: RTC_MXC: Handle shared interrupts properly The MXC RTC driver interrupt handler never checked to make sure it was handling the correct IRQ. This was causing it to oops whenever CONFIG_DEBUG_SHIRQ was enabled in the kernel. This fixes that problem by checking the IRQ status registers on the RTC module whenever the IRQ occurs. Signed-off-by: Justin Waters --- drivers/rtc/rtc-mxc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index da96395d7f8f..4c186934042f 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c @@ -317,13 +317,25 @@ static int rtc_update_alarm(struct device *dev, struct rtc_time *alrm) */ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) { - struct platform_device *pdev = dev_id; - struct rtc_plat_data *pdata = platform_get_drvdata(pdev); - void __iomem *ioaddr = pdata->ioaddr; + struct platform_device *pdev; + struct rtc_plat_data *pdata; + void __iomem *ioaddr; u32 status; u32 events = 0; spin_lock(&rtc_lock); - status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR); + status = readw(IO_ADDRESS(RTC_BASE_ADDR + RTC_RTCISR)) & + readw(IO_ADDRESS(RTC_BASE_ADDR + RTC_RTCIENR)); + + /* This IRQ is shared, so make sure an interrupt really occurred */ + if (unlikely(!status)) { + spin_unlock(&rtc_lock); + return IRQ_NONE; + } + + pdev = dev_id; + pdata = platform_get_drvdata(pdev); + ioaddr = pdata->ioaddr; + /* clear interrupt sources */ writew(status, ioaddr + RTC_RTCISR); -- cgit v1.2.3