aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/cm-x2xx.c
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2008-10-05 05:25:44 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-07 07:05:05 -0400
commitda591937ba8c3a98ced845247859693a27543863 (patch)
tree93ae125daa920e2f844f10f2392484caff2e6d6e /arch/arm/mach-pxa/cm-x2xx.c
parent7d76e3f171216757a2ea630d76442084f88a0b4c (diff)
[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/mach-pxa/cm-x2xx.c')
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c171
1 files changed, 90 insertions, 81 deletions
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index 598837798425..cc79005b1794 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-pxa/cm-x270.c 2 * linux/arch/arm/mach-pxa/cm-x2xx.c
3 * 3 *
4 * Copyright (C) 2007, 2008 CompuLab, Ltd. 4 * Copyright (C) 2007, 2008 CompuLab, Ltd.
5 * Mike Rapoport <mike@compulab.co.il> 5 * Mike Rapoport <mike@compulab.co.il>
@@ -38,20 +38,23 @@
38#include "cm-x2xx-pci.h" 38#include "cm-x2xx-pci.h"
39 39
40/* virtual addresses for statically mapped regions */ 40/* virtual addresses for statically mapped regions */
41#define CMX270_VIRT_BASE (0xe8000000) 41#define CMX2XX_VIRT_BASE (0xe8000000)
42#define CMX270_IT8152_VIRT (CMX270_VIRT_BASE) 42#define CMX2XX_IT8152_VIRT (CMX2XX_VIRT_BASE)
43 43
44#define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22)) 44#define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22))
45#define DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22)) 45#define CMX270_DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22))
46
47/* leds */
48#define CMX270_GPIO_RED (93)
49#define CMX270_GPIO_GREEN (94)
46 50
47/* GPIO IRQ usage */ 51/* GPIO IRQ usage */
48#define GPIO10_ETHIRQ (10) 52#define GPIO10_ETHIRQ (10)
49#define GPIO22_IT8152_IRQ (22) 53#define CMX270_GPIO_IT8152_IRQ (22)
50#define GPIO83_MMC_IRQ (83) 54#define GPIO83_MMC_IRQ (83)
51#define GPIO95_GFXIRQ (95) 55#define GPIO95_GFXIRQ (95)
52 56
53#define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ) 57#define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ)
54#define CMX270_IT8152_IRQ IRQ_GPIO(GPIO22_IT8152_IRQ)
55#define CMX270_MMC_IRQ IRQ_GPIO(GPIO83_MMC_IRQ) 58#define CMX270_MMC_IRQ IRQ_GPIO(GPIO83_MMC_IRQ)
56#define CMX270_GFXIRQ IRQ_GPIO(GPIO95_GFXIRQ) 59#define CMX270_GFXIRQ IRQ_GPIO(GPIO95_GFXIRQ)
57 60
@@ -160,13 +163,13 @@ static unsigned long cmx270_pin_config[] = {
160#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) 163#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
161static struct resource cmx270_dm9000_resource[] = { 164static struct resource cmx270_dm9000_resource[] = {
162 [0] = { 165 [0] = {
163 .start = DM9000_PHYS_BASE, 166 .start = CMX270_DM9000_PHYS_BASE,
164 .end = DM9000_PHYS_BASE + 4, 167 .end = CMX270_DM9000_PHYS_BASE + 3,
165 .flags = IORESOURCE_MEM, 168 .flags = IORESOURCE_MEM,
166 }, 169 },
167 [1] = { 170 [1] = {
168 .start = DM9000_PHYS_BASE + 8, 171 .start = CMX270_DM9000_PHYS_BASE + 8,
169 .end = DM9000_PHYS_BASE + 8 + 500, 172 .end = CMX270_DM9000_PHYS_BASE + 8 + 500,
170 .flags = IORESOURCE_MEM, 173 .flags = IORESOURCE_MEM,
171 }, 174 },
172 [2] = { 175 [2] = {
@@ -180,37 +183,37 @@ static struct dm9000_plat_data cmx270_dm9000_platdata = {
180 .flags = DM9000_PLATF_32BITONLY, 183 .flags = DM9000_PLATF_32BITONLY,
181}; 184};
182 185
183static struct platform_device cmx270_dm9000_device = { 186static struct platform_device cmx2xx_dm9000_device = {
184 .name = "dm9000", 187 .name = "dm9000",
185 .id = 0, 188 .id = 0,
186 .num_resources = ARRAY_SIZE(cmx270_dm9000_resource), 189 .num_resources = ARRAY_SIZE(cmx270_dm9000_resource),
187 .resource = cmx270_dm9000_resource,
188 .dev = { 190 .dev = {
189 .platform_data = &cmx270_dm9000_platdata, 191 .platform_data = &cmx270_dm9000_platdata,
190 } 192 }
191}; 193};
192 194
193static void __init cmx270_init_dm9000(void) 195static void __init cmx2xx_init_dm9000(void)
194{ 196{
195 platform_device_register(&cmx270_dm9000_device); 197 cmx2xx_dm9000_device.resource = cmx270_dm9000_resource,
198 platform_device_register(&cmx2xx_dm9000_device);
196} 199}
197#else 200#else
198static inline void cmx270_init_dm9000(void) {} 201static inline void cmx2xx_init_dm9000(void) {}
199#endif 202#endif
200 203
201/* UCB1400 touchscreen controller */ 204/* UCB1400 touchscreen controller */
202#if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) 205#if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
203static struct platform_device cmx270_ts_device = { 206static struct platform_device cmx2xx_ts_device = {
204 .name = "ucb1400_ts", 207 .name = "ucb1400_ts",
205 .id = -1, 208 .id = -1,
206}; 209};
207 210
208static void __init cmx270_init_touchscreen(void) 211static void __init cmx2xx_init_touchscreen(void)
209{ 212{
210 platform_device_register(&cmx270_ts_device); 213 platform_device_register(&cmx2xx_ts_device);
211} 214}
212#else 215#else
213static inline void cmx270_init_touchscreen(void) {} 216static inline void cmx2xx_init_touchscreen(void) {}
214#endif 217#endif
215 218
216/* V3020 RTC */ 219/* V3020 RTC */
@@ -242,45 +245,45 @@ static void __init cmx270_init_rtc(void)
242 platform_device_register(&cmx270_rtc_device); 245 platform_device_register(&cmx270_rtc_device);
243} 246}
244#else 247#else
245static inline void cmx270_init_rtc(void) {} 248static inline void cmx2xx_init_rtc(void) {}
246#endif 249#endif
247 250
248/* CM-X270 LEDs */ 251/* CM-X270 LEDs */
249#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 252#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
250static struct gpio_led cmx270_leds[] = { 253static struct gpio_led cmx2xx_leds[] = {
251 [0] = { 254 [0] = {
252 .name = "cm-x270:red", 255 .name = "cm-x2xx:red",
253 .default_trigger = "nand-disk", 256 .default_trigger = "nand-disk",
254 .gpio = 93,
255 .active_low = 1, 257 .active_low = 1,
256 }, 258 },
257 [1] = { 259 [1] = {
258 .name = "cm-x270:green", 260 .name = "cm-x2xx:green",
259 .default_trigger = "heartbeat", 261 .default_trigger = "heartbeat",
260 .gpio = 94,
261 .active_low = 1, 262 .active_low = 1,
262 }, 263 },
263}; 264};
264 265
265static struct gpio_led_platform_data cmx270_gpio_led_pdata = { 266static struct gpio_led_platform_data cmx2xx_gpio_led_pdata = {
266 .num_leds = ARRAY_SIZE(cmx270_leds), 267 .num_leds = ARRAY_SIZE(cmx2xx_leds),
267 .leds = cmx270_leds, 268 .leds = cmx2xx_leds,
268}; 269};
269 270
270static struct platform_device cmx270_led_device = { 271static struct platform_device cmx2xx_led_device = {
271 .name = "leds-gpio", 272 .name = "leds-gpio",
272 .id = -1, 273 .id = -1,
273 .dev = { 274 .dev = {
274 .platform_data = &cmx270_gpio_led_pdata, 275 .platform_data = &cmx2xx_gpio_led_pdata,
275 }, 276 },
276}; 277};
277 278
278static void __init cmx270_init_leds(void) 279static void __init cmx2xx_init_leds(void)
279{ 280{
280 platform_device_register(&cmx270_led_device); 281 cmx2xx_leds[0].gpio = CMX270_GPIO_RED;
282 cmx2xx_leds[1].gpio = CMX270_GPIO_GREEN;
283 platform_device_register(&cmx2xx_led_device);
281} 284}
282#else 285#else
283static inline void cmx270_init_leds(void) {} 286static inline void cmx2xx_init_leds(void) {}
284#endif 287#endif
285 288
286/* 2700G graphics */ 289/* 2700G graphics */
@@ -543,32 +546,32 @@ static struct pxafb_mach_info generic_stn_640x480 = {
543 .cmap_static = 0, 546 .cmap_static = 0,
544}; 547};
545 548
546static struct pxafb_mach_info *cmx270_display = &generic_crt_640x480; 549static struct pxafb_mach_info *cmx2xx_display = &generic_crt_640x480;
547 550
548static int __init cmx270_set_display(char *str) 551static int __init cmx2xx_set_display(char *str)
549{ 552{
550 int disp_type = simple_strtol(str, NULL, 0); 553 int disp_type = simple_strtol(str, NULL, 0);
551 switch (disp_type) { 554 switch (disp_type) {
552 case MTYPE_STN320x240: 555 case MTYPE_STN320x240:
553 cmx270_display = &generic_stn_320x240; 556 cmx2xx_display = &generic_stn_320x240;
554 break; 557 break;
555 case MTYPE_TFT640x480: 558 case MTYPE_TFT640x480:
556 cmx270_display = &generic_tft_640x480; 559 cmx2xx_display = &generic_tft_640x480;
557 break; 560 break;
558 case MTYPE_CRT640x480: 561 case MTYPE_CRT640x480:
559 cmx270_display = &generic_crt_640x480; 562 cmx2xx_display = &generic_crt_640x480;
560 break; 563 break;
561 case MTYPE_CRT800x600: 564 case MTYPE_CRT800x600:
562 cmx270_display = &generic_crt_800x600; 565 cmx2xx_display = &generic_crt_800x600;
563 break; 566 break;
564 case MTYPE_TFT320x240: 567 case MTYPE_TFT320x240:
565 cmx270_display = &generic_tft_320x240; 568 cmx2xx_display = &generic_tft_320x240;
566 break; 569 break;
567 case MTYPE_STN640x480: 570 case MTYPE_STN640x480:
568 cmx270_display = &generic_stn_640x480; 571 cmx2xx_display = &generic_stn_640x480;
569 break; 572 break;
570 default: /* fallback to CRT 640x480 */ 573 default: /* fallback to CRT 640x480 */
571 cmx270_display = &generic_crt_640x480; 574 cmx2xx_display = &generic_crt_640x480;
572 break; 575 break;
573 } 576 }
574 return 1; 577 return 1;
@@ -577,18 +580,18 @@ static int __init cmx270_set_display(char *str)
577/* 580/*
578 This should be done really early to get proper configuration for 581 This should be done really early to get proper configuration for
579 frame buffer. 582 frame buffer.
580 Indeed, pxafb parameters can be used istead, but CM-X270 bootloader 583 Indeed, pxafb parameters can be used istead, but CM-X2XX bootloader
581 has limitied line length for kernel command line, and also it will 584 has limitied line length for kernel command line, and also it will
582 break compatibitlty with proprietary releases already in field. 585 break compatibitlty with proprietary releases already in field.
583*/ 586*/
584__setup("monitor=", cmx270_set_display); 587__setup("monitor=", cmx2xx_set_display);
585 588
586static void __init cmx270_init_display(void) 589static void __init cmx2xx_init_display(void)
587{ 590{
588 set_pxa_fb_info(cmx270_display); 591 set_pxa_fb_info(cmx2xx_display);
589} 592}
590#else 593#else
591static inline void cmx270_init_display(void) {} 594static inline void cmx2xx_init_display(void) {}
592#endif 595#endif
593 596
594/* PXA27x OHCI controller setup */ 597/* PXA27x OHCI controller setup */
@@ -679,9 +682,9 @@ static inline void cmx270_init_mmc(void) {}
679#ifdef CONFIG_PM 682#ifdef CONFIG_PM
680static unsigned long sleep_save_msc[10]; 683static unsigned long sleep_save_msc[10];
681 684
682static int cmx270_suspend(struct sys_device *dev, pm_message_t state) 685static int cmx2xx_suspend(struct sys_device *dev, pm_message_t state)
683{ 686{
684 cmx270_pci_suspend(); 687 cmx2xx_pci_suspend();
685 688
686 /* save MSC registers */ 689 /* save MSC registers */
687 sleep_save_msc[0] = MSC0; 690 sleep_save_msc[0] = MSC0;
@@ -703,9 +706,9 @@ static int cmx270_suspend(struct sys_device *dev, pm_message_t state)
703 return 0; 706 return 0;
704} 707}
705 708
706static int cmx270_resume(struct sys_device *dev) 709static int cmx2xx_resume(struct sys_device *dev)
707{ 710{
708 cmx270_pci_resume(); 711 cmx2xx_pci_resume();
709 712
710 /* restore MSC registers */ 713 /* restore MSC registers */
711 MSC0 = sleep_save_msc[0]; 714 MSC0 = sleep_save_msc[0];
@@ -715,92 +718,98 @@ static int cmx270_resume(struct sys_device *dev)
715 return 0; 718 return 0;
716} 719}
717 720
718static struct sysdev_class cmx270_pm_sysclass = { 721static struct sysdev_class cmx2xx_pm_sysclass = {
719 .name = "pm", 722 .name = "pm",
720 .resume = cmx270_resume, 723 .resume = cmx2xx_resume,
721 .suspend = cmx270_suspend, 724 .suspend = cmx2xx_suspend,
722}; 725};
723 726
724static struct sys_device cmx270_pm_device = { 727static struct sys_device cmx2xx_pm_device = {
725 .cls = &cmx270_pm_sysclass, 728 .cls = &cmx2xx_pm_sysclass,
726}; 729};
727 730
728static int __init cmx270_pm_init(void) 731static int __init cmx2xx_pm_init(void)
729{ 732{
730 int error; 733 int error;
731 error = sysdev_class_register(&cmx270_pm_sysclass); 734 error = sysdev_class_register(&cmx2xx_pm_sysclass);
732 if (error == 0) 735 if (error == 0)
733 error = sysdev_register(&cmx270_pm_device); 736 error = sysdev_register(&cmx2xx_pm_device);
734 return error; 737 return error;
735} 738}
736#else 739#else
737static int __init cmx270_pm_init(void) { return 0; } 740static int __init cmx2xx_pm_init(void) { return 0; }
738#endif 741#endif
739 742
740#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE) 743#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
741static void __init cmx270_init_ac97(void) 744static void __init cmx2xx_init_ac97(void)
742{ 745{
743 pxa_set_ac97_info(NULL); 746 pxa_set_ac97_info(NULL);
744} 747}
745#else 748#else
746static inline void cmx270_init_ac97(void) {} 749static inline void cmx2xx_init_ac97(void) {}
747#endif 750#endif
748 751
749static void __init cmx270_init(void) 752static void __init cmx270_init(void)
750{ 753{
751 cmx270_pm_init();
752
753 pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config)); 754 pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config));
754 755
755 cmx270_init_dm9000();
756 cmx270_init_rtc(); 756 cmx270_init_rtc();
757 cmx270_init_display();
758 cmx270_init_mmc(); 757 cmx270_init_mmc();
759 cmx270_init_ohci(); 758 cmx270_init_ohci();
760 cmx270_init_ac97();
761 cmx270_init_touchscreen();
762 cmx270_init_leds();
763 cmx270_init_2700G(); 759 cmx270_init_2700G();
764} 760}
765 761
766static void __init cmx270_init_irq(void) 762static void __init cmx2xx_init(void)
763{
764 cmx2xx_pm_init();
765
766 cmx270_init();
767
768 cmx2xx_init_dm9000();
769 cmx2xx_init_display();
770 cmx2xx_init_ac97();
771 cmx2xx_init_touchscreen();
772 cmx2xx_init_leds();
773}
774
775static void __init cmx2xx_init_irq(void)
767{ 776{
768 pxa27x_init_irq(); 777 pxa27x_init_irq();
769 778
770 cmx270_pci_init_irq(GPIO22_IT8152_IRQ); 779 cmx2xx_pci_init_irq(CMX270_GPIO_IT8152_IRQ);
771} 780}
772 781
773#ifdef CONFIG_PCI 782#ifdef CONFIG_PCI
774/* Map PCI companion statically */ 783/* Map PCI companion statically */
775static struct map_desc cmx270_io_desc[] __initdata = { 784static struct map_desc cmx2xx_io_desc[] __initdata = {
776 [0] = { /* PCI bridge */ 785 [0] = { /* PCI bridge */
777 .virtual = CMX270_IT8152_VIRT, 786 .virtual = CMX2XX_IT8152_VIRT,
778 .pfn = __phys_to_pfn(PXA_CS4_PHYS), 787 .pfn = __phys_to_pfn(PXA_CS4_PHYS),
779 .length = SZ_64M, 788 .length = SZ_64M,
780 .type = MT_DEVICE 789 .type = MT_DEVICE
781 }, 790 },
782}; 791};
783 792
784static void __init cmx270_map_io(void) 793static void __init cmx2xx_map_io(void)
785{ 794{
786 pxa_map_io(); 795 pxa_map_io();
787 iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc)); 796 iotable_init(cmx2xx_io_desc, ARRAY_SIZE(cmx2xx_io_desc));
788 797
789 it8152_base_address = CMX270_IT8152_VIRT; 798 it8152_base_address = CMX2XX_IT8152_VIRT;
790} 799}
791#else 800#else
792static void __init cmx270_map_io(void) 801static void __init cmx2xx_map_io(void)
793{ 802{
794 pxa_map_io(); 803 pxa_map_io();
795} 804}
796#endif 805#endif
797 806
798MACHINE_START(ARMCORE, "Compulab CM-x270") 807MACHINE_START(ARMCORE, "Compulab CM-X2XX")
799 .boot_params = 0xa0000100, 808 .boot_params = 0xa0000100,
800 .phys_io = 0x40000000, 809 .phys_io = 0x40000000,
801 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 810 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
802 .map_io = cmx270_map_io, 811 .map_io = cmx2xx_map_io,
803 .init_irq = cmx270_init_irq, 812 .init_irq = cmx2xx_init_irq,
804 .timer = &pxa_timer, 813 .timer = &pxa_timer,
805 .init_machine = cmx270_init, 814 .init_machine = cmx2xx_init,
806MACHINE_END 815MACHINE_END