]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] 5282/1: pxa: add CM-X255 support
authorMike Rapoport <mike@compulab.co.il>
Sun, 5 Oct 2008 09:26:55 +0000 (10:26 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 7 Oct 2008 11:05:07 +0000 (12:05 +0100)
Signed-off-by: Russ Dill <russ.dill@gmail.com>
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/Kconfig
arch/arm/mach-pxa/Makefile
arch/arm/mach-pxa/cm-x255.c [new file with mode: 0644]
arch/arm/mach-pxa/cm-x2xx-pci.c
arch/arm/mach-pxa/cm-x2xx.c
drivers/mtd/nand/cmx270_nand.c

index 92a298bb13c4b3175165217ca78c6178a3fc0703..40d1d21b9e2999173c3b7834765425af40ab5913 100644 (file)
@@ -207,9 +207,11 @@ config MACH_SAAR
        select PXA930
 
 config MACH_ARMCORE
-       bool "CompuLab CM-X270 modules"
+       bool "CompuLab CM-X255/CM-X270 modules"
        select PXA27x
        select IWMMXT
+       select PXA25x
+       select PXA_SSP
 
 config MACH_CM_X300
        bool "CompuLab CM-X300 modules"
index d2d179ecfc50578dd7b2d74e88107e3c346a8ce7..f0dfc9689ed4aaa7133fcd4bb48ca09143ba74a9 100644 (file)
@@ -53,7 +53,7 @@ obj-$(CONFIG_MACH_LITTLETON)  += littleton.o
 obj-$(CONFIG_MACH_TAVOREVB)    += tavorevb.o
 obj-$(CONFIG_MACH_SAAR)                += saar.o
 
-obj-$(CONFIG_MACH_ARMCORE)      += cm-x2xx.o cm-x270.o
+obj-$(CONFIG_MACH_ARMCORE)      += cm-x2xx.o cm-x255.o cm-x270.o
 obj-$(CONFIG_MACH_CM_X300)      += cm-x300.o
 obj-$(CONFIG_PXA_EZX)           += ezx.o
 
diff --git a/arch/arm/mach-pxa/cm-x255.c b/arch/arm/mach-pxa/cm-x255.c
new file mode 100644 (file)
index 0000000..15c5b9d
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * linux/arch/arm/mach-pxa/cm-x255.c
+ *
+ * Copyright (C) 2007, 2008 CompuLab, Ltd.
+ * Mike Rapoport <mike@compulab.co.il>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/irq.h>
+#include <linux/gpio.h>
+
+#include <linux/spi/spi.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach-types.h>
+#include <asm/mach/map.h>
+
+#include <mach/pxa2xx-regs.h>
+#include <mach/mfp-pxa25x.h>
+#include <mach/pxa2xx_spi.h>
+#include <mach/bitfield.h>
+
+#include "generic.h"
+
+static unsigned long cmx255_pin_config[] = {
+       /* AC'97 */
+       GPIO28_AC97_BITCLK,
+       GPIO29_AC97_SDATA_IN_0,
+       GPIO30_AC97_SDATA_OUT,
+       GPIO31_AC97_SYNC,
+
+       /* BTUART */
+       GPIO42_BTUART_RXD,
+       GPIO43_BTUART_TXD,
+       GPIO44_BTUART_CTS,
+       GPIO45_BTUART_RTS,
+
+       /* STUART */
+       GPIO46_STUART_RXD,
+       GPIO47_STUART_TXD,
+
+       /* LCD */
+       GPIO58_LCD_LDD_0,
+       GPIO59_LCD_LDD_1,
+       GPIO60_LCD_LDD_2,
+       GPIO61_LCD_LDD_3,
+       GPIO62_LCD_LDD_4,
+       GPIO63_LCD_LDD_5,
+       GPIO64_LCD_LDD_6,
+       GPIO65_LCD_LDD_7,
+       GPIO66_LCD_LDD_8,
+       GPIO67_LCD_LDD_9,
+       GPIO68_LCD_LDD_10,
+       GPIO69_LCD_LDD_11,
+       GPIO70_LCD_LDD_12,
+       GPIO71_LCD_LDD_13,
+       GPIO72_LCD_LDD_14,
+       GPIO73_LCD_LDD_15,
+       GPIO74_LCD_FCLK,
+       GPIO75_LCD_LCLK,
+       GPIO76_LCD_PCLK,
+       GPIO77_LCD_BIAS,
+
+       /* SSP1 */
+       GPIO23_SSP1_SCLK,
+       GPIO24_SSP1_SFRM,
+       GPIO25_SSP1_TXD,
+       GPIO26_SSP1_RXD,
+
+       /* SSP2 */
+       GPIO81_SSP2_CLK_OUT,
+       GPIO82_SSP2_FRM_OUT,
+       GPIO83_SSP2_TXD,
+       GPIO84_SSP2_RXD,
+
+       /* PC Card */
+       GPIO48_nPOE,
+       GPIO49_nPWE,
+       GPIO50_nPIOR,
+       GPIO51_nPIOW,
+       GPIO52_nPCE_1,
+       GPIO53_nPCE_2,
+       GPIO54_nPSKTSEL,
+       GPIO55_nPREG,
+       GPIO56_nPWAIT,
+       GPIO57_nIOIS16,
+
+       /* SDRAM and local bus */
+       GPIO15_nCS_1,
+       GPIO78_nCS_2,
+       GPIO79_nCS_3,
+       GPIO80_nCS_4,
+       GPIO33_nCS_5,
+       GPIO18_RDY,
+
+       /* GPIO */
+       GPIO0_GPIO      | WAKEUP_ON_EDGE_BOTH,
+       GPIO9_GPIO,                             /* PC card reset */
+
+       /* NAND controls */
+       GPIO5_GPIO      | MFP_LPM_DRIVE_HIGH,   /* NAND CE# */
+       GPIO4_GPIO      | MFP_LPM_DRIVE_LOW,    /* NAND ALE */
+       GPIO3_GPIO      | MFP_LPM_DRIVE_LOW,    /* NAND CLE */
+       GPIO10_GPIO,                            /* NAND Ready/Busy */
+
+       /* interrupts */
+       GPIO22_GPIO,    /* DM9000 interrupt */
+};
+
+#if defined(CONFIG_SPI_PXA2XX)
+static struct pxa2xx_spi_master pxa_ssp_master_info = {
+       .num_chipselect = 1,
+};
+
+static struct spi_board_info spi_board_info[] __initdata = {
+       [0] = {
+               .modalias       = "rtc-max6902",
+               .max_speed_hz   = 1000000,
+               .bus_num        = 1,
+               .chip_select    = 0,
+       },
+};
+
+static void __init cmx255_init_rtc(void)
+{
+       pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
+       spi_register_board_info(ARRAY_AND_SIZE(spi_board_info));
+}
+#else
+static inline void cmx255_init_rtc(void) {}
+#endif
+
+void __init cmx255_init(void)
+{
+       pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx255_pin_config));
+
+       cmx255_init_rtc();
+}
index b6e93ecbf9da40f66dcd8f6e88339cc412fdde4f..3156b25f6e9dce438b93a2cac629ceb67ae0d610 100644 (file)
@@ -131,7 +131,11 @@ static int __init cmx2xx_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
        if (slot == 9)
                return IT8152_PCI_INTA;
 
-       /* SB-x270 Ethernet */
+       /* CM-x255 Onboard Ethernet */
+       if (slot == 15)
+               return IT8152_PCI_INTC;
+
+       /* SB-x2xx Ethernet */
        if (slot == 16)
                return IT8152_PCI_INTA;
 
index cb16eb5bac8f688b396088ec864fd0227489d61c..0b3ce3b6d896e4f348d04a408e13849ccce5538d 100644 (file)
@@ -32,6 +32,7 @@
 #include "generic.h"
 #include "cm-x2xx-pci.h"
 
+extern void cmx255_init(void);
 extern void cmx270_init(void);
 
 /* virtual addresses for statically mapped regions */
@@ -39,19 +40,43 @@ extern void cmx270_init(void);
 #define CMX2XX_IT8152_VIRT     (CMX2XX_VIRT_BASE)
 
 /* physical address if local-bus attached devices */
+#define CMX255_DM9000_PHYS_BASE (PXA_CS1_PHYS + (8 << 22))
 #define CMX270_DM9000_PHYS_BASE        (PXA_CS1_PHYS + (6 << 22))
 
 /* leds */
+#define CMX255_GPIO_RED                (27)
+#define CMX255_GPIO_GREEN      (32)
 #define CMX270_GPIO_RED                (93)
 #define CMX270_GPIO_GREEN      (94)
 
 /* GPIO IRQ usage */
+#define GPIO22_ETHIRQ          (22)
 #define GPIO10_ETHIRQ          (10)
+#define CMX255_GPIO_IT8152_IRQ (0)
 #define CMX270_GPIO_IT8152_IRQ (22)
 
+#define CMX255_ETHIRQ          IRQ_GPIO(GPIO22_ETHIRQ)
 #define CMX270_ETHIRQ          IRQ_GPIO(GPIO10_ETHIRQ)
 
 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
+static struct resource cmx255_dm9000_resource[] = {
+       [0] = {
+               .start = CMX255_DM9000_PHYS_BASE,
+               .end   = CMX255_DM9000_PHYS_BASE + 3,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = CMX255_DM9000_PHYS_BASE + 4,
+               .end   = CMX255_DM9000_PHYS_BASE + 4 + 500,
+               .flags = IORESOURCE_MEM,
+       },
+       [2] = {
+               .start = CMX255_ETHIRQ,
+               .end   = CMX255_ETHIRQ,
+               .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
+       }
+};
+
 static struct resource cmx270_dm9000_resource[] = {
        [0] = {
                .start = CMX270_DM9000_PHYS_BASE,
@@ -85,7 +110,10 @@ static struct platform_device cmx2xx_dm9000_device = {
 
 static void __init cmx2xx_init_dm9000(void)
 {
-       cmx2xx_dm9000_device.resource = cmx270_dm9000_resource,
+       if (cpu_is_pxa25x())
+               cmx2xx_dm9000_device.resource = cmx255_dm9000_resource;
+       else
+               cmx2xx_dm9000_device.resource = cmx270_dm9000_resource;
        platform_device_register(&cmx2xx_dm9000_device);
 }
 #else
@@ -137,8 +165,13 @@ static struct platform_device cmx2xx_led_device = {
 
 static void __init cmx2xx_init_leds(void)
 {
-       cmx2xx_leds[0].gpio = CMX270_GPIO_RED;
-       cmx2xx_leds[1].gpio = CMX270_GPIO_GREEN;
+       if (cpu_is_pxa25x()) {
+               cmx2xx_leds[0].gpio = CMX255_GPIO_RED;
+               cmx2xx_leds[1].gpio = CMX255_GPIO_GREEN;
+       } else {
+               cmx2xx_leds[0].gpio = CMX270_GPIO_RED;
+               cmx2xx_leds[1].gpio = CMX270_GPIO_GREEN;
+       }
        platform_device_register(&cmx2xx_led_device);
 }
 #else
@@ -437,7 +470,10 @@ static void __init cmx2xx_init(void)
 {
        cmx2xx_pm_init();
 
-       cmx270_init();
+       if (cpu_is_pxa25x())
+               cmx255_init();
+       else
+               cmx270_init();
 
        cmx2xx_init_dm9000();
        cmx2xx_init_display();
@@ -450,7 +486,13 @@ static void __init cmx2xx_init_irq(void)
 {
        pxa27x_init_irq();
 
-       cmx2xx_pci_init_irq(CMX270_GPIO_IT8152_IRQ);
+       if (cpu_is_pxa25x()) {
+               pxa25x_init_irq();
+               cmx2xx_pci_init_irq(CMX255_GPIO_IT8152_IRQ);
+       } else {
+               pxa27x_init_irq();
+               cmx2xx_pci_init_irq(CMX270_GPIO_IT8152_IRQ);
+       }
 }
 
 #ifdef CONFIG_PCI
index 9eba3f04783a90962071f6ad5676c151c031301a..fa129c09bca8b8fc8f7613176b0e255891dcb80d 100644 (file)
@@ -156,7 +156,7 @@ static int cmx270_init(void)
        int mtd_parts_nb = 0;
        int ret;
 
-       if (!machine_is_armcore())
+       if (!(machine_is_armcore() && cpu_is_pxa27x()))
                return -ENODEV;
 
        ret = gpio_request(GPIO_NAND_CS, "NAND CS");