diff options
author | Mike Rapoport <mike@compulab.co.il> | 2008-10-05 09:25:44 (GMT) |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-07 11:05:05 (GMT) |
commit | da591937ba8c3a98ced845247859693a27543863 (patch) | |
tree | 93ae125daa920e2f844f10f2392484caff2e6d6e /arch/arm | |
parent | 7d76e3f171216757a2ea630d76442084f88a0b4c (diff) | |
download | linux-da591937ba8c3a98ced845247859693a27543863.tar.xz |
[ARM] 5280/1: pxa: prepare cm-x2xx.c and cm-x2xx-pci.[ch] for addition of CM-X255
- Change CM-X255 and CM-X270 common function prefix from cmx270 to cmx2xx
- Split cmx2xx_init to common and CM-X270-specific parts
- Use dynamic assignement for DM9000 resources and led GPIOs.
Signed-off-by: Russ Dill <russ.dill@gmail.com>
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-pxa/cm-x2xx-pci.c | 50 | ||||
-rw-r--r-- | arch/arm/mach-pxa/cm-x2xx-pci.h | 18 | ||||
-rw-r--r-- | arch/arm/mach-pxa/cm-x2xx.c | 171 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/memory.h | 4 |
4 files changed, 126 insertions, 117 deletions
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c index 2d5bcea..b6e93ec 100644 --- a/arch/arm/mach-pxa/cm-x2xx-pci.c +++ b/arch/arm/mach-pxa/cm-x2xx-pci.c @@ -1,5 +1,5 @@ /* - * linux/arch/arm/mach-pxa/cm-x270-pci.c + * linux/arch/arm/mach-pxa/cm-x2xx-pci.c * * PCI bios-type initialisation for PCI machines * @@ -28,7 +28,7 @@ #include <asm/hardware/it8152.h> unsigned long it8152_base_address; -static int cmx270_it8152_irq_gpio; +static int cmx2xx_it8152_irq_gpio; /* * Only first 64MB of memory can be accessed via PCI. @@ -36,13 +36,13 @@ static int cmx270_it8152_irq_gpio; * This is really ugly and we need a better way of specifying * DMA-capable regions of memory. */ -void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size, +void __init cmx2xx_pci_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size) { unsigned int sz = SZ_64M >> PAGE_SHIFT; if (machine_is_armcore()) { - pr_info("Adjusting zones for CM-X270\n"); + pr_info("Adjusting zones for CM-X2XX\n"); /* * Only adjust if > 64M on current system @@ -57,29 +57,29 @@ void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size, } } -static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) +static void cmx2xx_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) { /* clear our parent irq */ - GEDR(cmx270_it8152_irq_gpio) = GPIO_bit(cmx270_it8152_irq_gpio); + GEDR(cmx2xx_it8152_irq_gpio) = GPIO_bit(cmx2xx_it8152_irq_gpio); it8152_irq_demux(irq, desc); } -void __cmx270_pci_init_irq(int irq_gpio) +void __cmx2xx_pci_init_irq(int irq_gpio) { it8152_init_irq(); - cmx270_it8152_irq_gpio = irq_gpio; + cmx2xx_it8152_irq_gpio = irq_gpio; set_irq_type(gpio_to_irq(irq_gpio), IRQ_TYPE_EDGE_RISING); - set_irq_chained_handler(gpio_to_irq(irq_gpio), cmx270_it8152_irq_demux); + set_irq_chained_handler(gpio_to_irq(irq_gpio), cmx2xx_it8152_irq_demux); } #ifdef CONFIG_PM static unsigned long sleep_save_ite[10]; -void __cmx270_pci_suspend(void) +void __cmx2xx_pci_suspend(void) { /* save ITE state */ sleep_save_ite[0] = __raw_readl(IT8152_INTC_PDCNIMR); @@ -91,7 +91,7 @@ void __cmx270_pci_suspend(void) __raw_writel((0), IT8152_INTC_LPCNIRR); } -void __cmx270_pci_resume(void) +void __cmx2xx_pci_resume(void) { /* restore IT8152 state */ __raw_writel((sleep_save_ite[0]), IT8152_INTC_PDCNIMR); @@ -99,12 +99,12 @@ void __cmx270_pci_resume(void) __raw_writel((sleep_save_ite[2]), IT8152_INTC_LPNIAR); } #else -void cmx270_pci_suspend(void) {} -void cmx270_pci_resume(void) {} +void cmx2xx_pci_suspend(void) {} +void cmx2xx_pci_resume(void) {} #endif /* PCI IRQ mapping*/ -static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init cmx2xx_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) { int irq; @@ -116,14 +116,14 @@ static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) /* Here comes the ugly part. The routing is baseboard specific, - but defining a platform for each possible base of CM-X270 is - unrealistic. Here we keep mapping for ATXBase and SB-X270. + but defining a platform for each possible base of CM-X2XX is + unrealistic. Here we keep mapping for ATXBase and SB-X2XX. */ /* ATXBASE PCI slot */ if (slot == 7) return IT8152_PCI_INTA; - /* ATXBase/SB-x270 CardBus */ + /* ATXBase/SB-X2XX CardBus */ if (slot == 8 || slot == 0) return IT8152_PCI_INTB; @@ -144,9 +144,9 @@ static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) return(0); } -static void cmx270_pci_preinit(void) +static void cmx2xx_pci_preinit(void) { - pr_info("Initializing CM-X270 PCI subsystem\n"); + pr_info("Initializing CM-X2XX PCI subsystem\n"); __raw_writel(0x800, IT8152_PCI_CFG_ADDR); if (__raw_readl(IT8152_PCI_CFG_DATA) == 0x81521283) { @@ -200,21 +200,21 @@ static void cmx270_pci_preinit(void) } } -static struct hw_pci cmx270_pci __initdata = { +static struct hw_pci cmx2xx_pci __initdata = { .swizzle = pci_std_swizzle, - .map_irq = cmx270_pci_map_irq, + .map_irq = cmx2xx_pci_map_irq, .nr_controllers = 1, .setup = it8152_pci_setup, .scan = it8152_pci_scan_bus, - .preinit = cmx270_pci_preinit, + .preinit = cmx2xx_pci_preinit, }; -static int __init cmx270_init_pci(void) +static int __init cmx2xx_init_pci(void) { if (machine_is_armcore()) - pci_common_init(&cmx270_pci); + pci_common_init(&cmx2xx_pci); return 0; } -subsys_initcall(cmx270_init_pci); +subsys_initcall(cmx2xx_init_pci); diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.h b/arch/arm/mach-pxa/cm-x2xx-pci.h index 48f532f..e24aad2 100644 --- a/arch/arm/mach-pxa/cm-x2xx-pci.h +++ b/arch/arm/mach-pxa/cm-x2xx-pci.h @@ -1,13 +1,13 @@ -extern void __cmx270_pci_init_irq(int irq_gpio); -extern void __cmx270_pci_suspend(void); -extern void __cmx270_pci_resume(void); +extern void __cmx2xx_pci_init_irq(int irq_gpio); +extern void __cmx2xx_pci_suspend(void); +extern void __cmx2xx_pci_resume(void); #ifdef CONFIG_PCI -#define cmx270_pci_init_irq(x) __cmx270_pci_init_irq(x) -#define cmx270_pci_suspend(x) __cmx270_pci_suspend(x) -#define cmx270_pci_resume(x) __cmx270_pci_resume(x) +#define cmx2xx_pci_init_irq(x) __cmx2xx_pci_init_irq(x) +#define cmx2xx_pci_suspend(x) __cmx2xx_pci_suspend(x) +#define cmx2xx_pci_resume(x) __cmx2xx_pci_resume(x) #else -#define cmx270_pci_init_irq(x) do {} while (0) -#define cmx270_pci_suspend(x) do {} while (0) -#define cmx270_pci_resume(x) do {} while (0) +#define cmx2xx_pci_init_irq(x) do {} while (0) +#define cmx2xx_pci_suspend(x) do {} while (0) +#define cmx2xx_pci_resume(x) do {} while (0) #endif diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c index 5988377..cc79005 100644 --- a/arch/arm/mach-pxa/cm-x2xx.c +++ b/arch/arm/mach-pxa/cm-x2xx.c @@ -1,5 +1,5 @@ /* - * linux/arch/arm/mach-pxa/cm-x270.c + * linux/arch/arm/mach-pxa/cm-x2xx.c * * Copyright (C) 2007, 2008 CompuLab, Ltd. * Mike Rapoport <mike@compulab.co.il> @@ -38,20 +38,23 @@ #include "cm-x2xx-pci.h" /* virtual addresses for statically mapped regions */ -#define CMX270_VIRT_BASE (0xe8000000) -#define CMX270_IT8152_VIRT (CMX270_VIRT_BASE) +#define CMX2XX_VIRT_BASE (0xe8000000) +#define CMX2XX_IT8152_VIRT (CMX2XX_VIRT_BASE) #define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22)) -#define DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22)) +#define CMX270_DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22)) + +/* leds */ +#define CMX270_GPIO_RED (93) +#define CMX270_GPIO_GREEN (94) /* GPIO IRQ usage */ #define GPIO10_ETHIRQ (10) -#define GPIO22_IT8152_IRQ (22) +#define CMX270_GPIO_IT8152_IRQ (22) #define GPIO83_MMC_IRQ (83) #define GPIO95_GFXIRQ (95) #define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ) -#define CMX270_IT8152_IRQ IRQ_GPIO(GPIO22_IT8152_IRQ) #define CMX270_MMC_IRQ IRQ_GPIO(GPIO83_MMC_IRQ) #define CMX270_GFXIRQ IRQ_GPIO(GPIO95_GFXIRQ) @@ -160,13 +163,13 @@ static unsigned long cmx270_pin_config[] = { #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) static struct resource cmx270_dm9000_resource[] = { [0] = { - .start = DM9000_PHYS_BASE, - .end = DM9000_PHYS_BASE + 4, + .start = CMX270_DM9000_PHYS_BASE, + .end = CMX270_DM9000_PHYS_BASE + 3, .flags = IORESOURCE_MEM, }, [1] = { - .start = DM9000_PHYS_BASE + 8, - .end = DM9000_PHYS_BASE + 8 + 500, + .start = CMX270_DM9000_PHYS_BASE + 8, + .end = CMX270_DM9000_PHYS_BASE + 8 + 500, .flags = IORESOURCE_MEM, }, [2] = { @@ -180,37 +183,37 @@ static struct dm9000_plat_data cmx270_dm9000_platdata = { .flags = DM9000_PLATF_32BITONLY, }; -static struct platform_device cmx270_dm9000_device = { +static struct platform_device cmx2xx_dm9000_device = { .name = "dm9000", .id = 0, .num_resources = ARRAY_SIZE(cmx270_dm9000_resource), - .resource = cmx270_dm9000_resource, .dev = { .platform_data = &cmx270_dm9000_platdata, } }; -static void __init cmx270_init_dm9000(void) +static void __init cmx2xx_init_dm9000(void) { - platform_device_register(&cmx270_dm9000_device); + cmx2xx_dm9000_device.resource = cmx270_dm9000_resource, + platform_device_register(&cmx2xx_dm9000_device); } #else -static inline void cmx270_init_dm9000(void) {} +static inline void cmx2xx_init_dm9000(void) {} #endif /* UCB1400 touchscreen controller */ #if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) -static struct platform_device cmx270_ts_device = { +static struct platform_device cmx2xx_ts_device = { .name = "ucb1400_ts", .id = -1, }; -static void __init cmx270_init_touchscreen(void) +static void __init cmx2xx_init_touchscreen(void) { - platform_device_register(&cmx270_ts_device); + platform_device_register(&cmx2xx_ts_device); } #else -static inline void cmx270_init_touchscreen(void) {} +static inline void cmx2xx_init_touchscreen(void) {} #endif /* V3020 RTC */ @@ -242,45 +245,45 @@ static void __init cmx270_init_rtc(void) platform_device_register(&cmx270_rtc_device); } #else -static inline void cmx270_init_rtc(void) {} +static inline void cmx2xx_init_rtc(void) {} #endif /* CM-X270 LEDs */ #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) -static struct gpio_led cmx270_leds[] = { +static struct gpio_led cmx2xx_leds[] = { [0] = { - .name = "cm-x270:red", + .name = "cm-x2xx:red", .default_trigger = "nand-disk", - .gpio = 93, .active_low = 1, }, [1] = { - .name = "cm-x270:green", + .name = "cm-x2xx:green", .default_trigger = "heartbeat", - .gpio = 94, .active_low = 1, }, }; -static struct gpio_led_platform_data cmx270_gpio_led_pdata = { - .num_leds = ARRAY_SIZE(cmx270_leds), - .leds = cmx270_leds, +static struct gpio_led_platform_data cmx2xx_gpio_led_pdata = { + .num_leds = ARRAY_SIZE(cmx2xx_leds), + .leds = cmx2xx_leds, }; -static struct platform_device cmx270_led_device = { +static struct platform_device cmx2xx_led_device = { .name = "leds-gpio", .id = -1, .dev = { - .platform_data = &cmx270_gpio_led_pdata, + .platform_data = &cmx2xx_gpio_led_pdata, }, }; -static void __init cmx270_init_leds(void) +static void __init cmx2xx_init_leds(void) { - platform_device_register(&cmx270_led_device); + cmx2xx_leds[0].gpio = CMX270_GPIO_RED; + cmx2xx_leds[1].gpio = CMX270_GPIO_GREEN; + platform_device_register(&cmx2xx_led_device); } #else -static inline void cmx270_init_leds(void) {} +static inline void cmx2xx_init_leds(void) {} #endif /* 2700G graphics */ @@ -543,32 +546,32 @@ static struct pxafb_mach_info generic_stn_640x480 = { .cmap_static = 0, }; -static struct pxafb_mach_info *cmx270_display = &generic_crt_640x480; +static struct pxafb_mach_info *cmx2xx_display = &generic_crt_640x480; -static int __init cmx270_set_display(char *str) +static int __init cmx2xx_set_display(char *str) { int disp_type = simple_strtol(str, NULL, 0); switch (disp_type) { case MTYPE_STN320x240: - cmx270_display = &generic_stn_320x240; + cmx2xx_display = &generic_stn_320x240; break; case MTYPE_TFT640x480: - cmx270_display = &generic_tft_640x480; + cmx2xx_display = &generic_tft_640x480; break; case MTYPE_CRT640x480: - cmx270_display = &generic_crt_640x480; + cmx2xx_display = &generic_crt_640x480; break; case MTYPE_CRT800x600: - cmx270_display = &generic_crt_800x600; + cmx2xx_display = &generic_crt_800x600; break; case MTYPE_TFT320x240: - cmx270_display = &generic_tft_320x240; + cmx2xx_display = &generic_tft_320x240; break; case MTYPE_STN640x480: - cmx270_display = &generic_stn_640x480; + cmx2xx_display = &generic_stn_640x480; break; default: /* fallback to CRT 640x480 */ - cmx270_display = &generic_crt_640x480; + cmx2xx_display = &generic_crt_640x480; break; } return 1; @@ -577,18 +580,18 @@ static int __init cmx270_set_display(char *str) /* This should be done really early to get proper configuration for frame buffer. - Indeed, pxafb parameters can be used istead, but CM-X270 bootloader + Indeed, pxafb parameters can be used istead, but CM-X2XX bootloader has limitied line length for kernel command line, and also it will break compatibitlty with proprietary releases already in field. */ -__setup("monitor=", cmx270_set_display); +__setup("monitor=", cmx2xx_set_display); -static void __init cmx270_init_display(void) +static void __init cmx2xx_init_display(void) { - set_pxa_fb_info(cmx270_display); + set_pxa_fb_info(cmx2xx_display); } #else -static inline void cmx270_init_display(void) {} +static inline void cmx2xx_init_display(void) {} #endif /* PXA27x OHCI controller setup */ @@ -679,9 +682,9 @@ static inline void cmx270_init_mmc(void) {} #ifdef CONFIG_PM static unsigned long sleep_save_msc[10]; -static int cmx270_suspend(struct sys_device *dev, pm_message_t state) +static int cmx2xx_suspend(struct sys_device *dev, pm_message_t state) { - cmx270_pci_suspend(); + cmx2xx_pci_suspend(); /* save MSC registers */ sleep_save_msc[0] = MSC0; @@ -703,9 +706,9 @@ static int cmx270_suspend(struct sys_device *dev, pm_message_t state) return 0; } -static int cmx270_resume(struct sys_device *dev) +static int cmx2xx_resume(struct sys_device *dev) { - cmx270_pci_resume(); + cmx2xx_pci_resume(); /* restore MSC registers */ MSC0 = sleep_save_msc[0]; @@ -715,92 +718,98 @@ static int cmx270_resume(struct sys_device *dev) return 0; } -static struct sysdev_class cmx270_pm_sysclass = { +static struct sysdev_class cmx2xx_pm_sysclass = { .name = "pm", - .resume = cmx270_resume, - .suspend = cmx270_suspend, + .resume = cmx2xx_resume, + .suspend = cmx2xx_suspend, }; -static struct sys_device cmx270_pm_device = { - .cls = &cmx270_pm_sysclass, +static struct sys_device cmx2xx_pm_device = { + .cls = &cmx2xx_pm_sysclass, }; -static int __init cmx270_pm_init(void) +static int __init cmx2xx_pm_init(void) { int error; - error = sysdev_class_register(&cmx270_pm_sysclass); + error = sysdev_class_register(&cmx2xx_pm_sysclass); if (error == 0) - error = sysdev_register(&cmx270_pm_device); + error = sysdev_register(&cmx2xx_pm_device); return error; } #else -static int __init cmx270_pm_init(void) { return 0; } +static int __init cmx2xx_pm_init(void) { return 0; } #endif #if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE) -static void __init cmx270_init_ac97(void) +static void __init cmx2xx_init_ac97(void) { pxa_set_ac97_info(NULL); } #else -static inline void cmx270_init_ac97(void) {} +static inline void cmx2xx_init_ac97(void) {} #endif static void __init cmx270_init(void) { - cmx270_pm_init(); - pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config)); - cmx270_init_dm9000(); cmx270_init_rtc(); - cmx270_init_display(); cmx270_init_mmc(); cmx270_init_ohci(); - cmx270_init_ac97(); - cmx270_init_touchscreen(); - cmx270_init_leds(); cmx270_init_2700G(); } -static void __init cmx270_init_irq(void) +static void __init cmx2xx_init(void) +{ + cmx2xx_pm_init(); + + cmx270_init(); + + cmx2xx_init_dm9000(); + cmx2xx_init_display(); + cmx2xx_init_ac97(); + cmx2xx_init_touchscreen(); + cmx2xx_init_leds(); +} + +static void __init cmx2xx_init_irq(void) { pxa27x_init_irq(); - cmx270_pci_init_irq(GPIO22_IT8152_IRQ); + cmx2xx_pci_init_irq(CMX270_GPIO_IT8152_IRQ); } #ifdef CONFIG_PCI /* Map PCI companion statically */ -static struct map_desc cmx270_io_desc[] __initdata = { +static struct map_desc cmx2xx_io_desc[] __initdata = { [0] = { /* PCI bridge */ - .virtual = CMX270_IT8152_VIRT, + .virtual = CMX2XX_IT8152_VIRT, .pfn = __phys_to_pfn(PXA_CS4_PHYS), .length = SZ_64M, .type = MT_DEVICE }, }; -static void __init cmx270_map_io(void) +static void __init cmx2xx_map_io(void) { pxa_map_io(); - iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc)); + iotable_init(cmx2xx_io_desc, ARRAY_SIZE(cmx2xx_io_desc)); - it8152_base_address = CMX270_IT8152_VIRT; + it8152_base_address = CMX2XX_IT8152_VIRT; } #else -static void __init cmx270_map_io(void) +static void __init cmx2xx_map_io(void) { pxa_map_io(); } #endif -MACHINE_START(ARMCORE, "Compulab CM-x270") +MACHINE_START(ARMCORE, "Compulab CM-X2XX") .boot_params = 0xa0000100, .phys_io = 0x40000000, .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, - .map_io = cmx270_map_io, - .init_irq = cmx270_init_irq, + .map_io = cmx2xx_map_io, + .init_irq = cmx2xx_init_irq, .timer = &pxa_timer, - .init_machine = cmx270_init, + .init_machine = cmx2xx_init, MACHINE_END diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h index 552eb7f..59aef89 100644 --- a/arch/arm/mach-pxa/include/mach/memory.h +++ b/arch/arm/mach-pxa/include/mach/memory.h @@ -40,11 +40,11 @@ #define NODE_MEM_SIZE_BITS 26 #if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) -void cmx270_pci_adjust_zones(int node, unsigned long *size, +void cmx2xx_pci_adjust_zones(int node, unsigned long *size, unsigned long *holes); #define arch_adjust_zones(node, size, holes) \ - cmx270_pci_adjust_zones(node, size, holes) + cmx2xx_pci_adjust_zones(node, size, holes) #define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1) #endif |