]> err.no Git - linux-2.6/blob - arch/arm/mach-pxa/gumstix.c
Merge branch 'for-2.6.26' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer...
[linux-2.6] / arch / arm / mach-pxa / gumstix.c
1 /*
2  *  linux/arch/arm/mach-pxa/gumstix.c
3  *
4  *  Support for the Gumstix motherboards.
5  *
6  *  Original Author:    Craig Hughes
7  *  Created:    Feb 14, 2008
8  *  Copyright:  Craig Hughes
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License version 2 as
12  *  published by the Free Software Foundation.
13  *
14  *  Implemented based on lubbock.c by Nicolas Pitre and code from Craig
15  *  Hughes
16  */
17
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/interrupt.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/partitions.h>
25
26 #include <asm/setup.h>
27 #include <asm/memory.h>
28 #include <asm/mach-types.h>
29 #include <asm/hardware.h>
30 #include <asm/irq.h>
31 #include <asm/sizes.h>
32
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
35 #include <asm/mach/irq.h>
36 #include <asm/mach/flash.h>
37 #include <asm/arch/mmc.h>
38 #include <asm/arch/udc.h>
39 #include <asm/arch/gumstix.h>
40
41 #include <asm/arch/pxa-regs.h>
42 #include <asm/arch/pxa2xx-regs.h>
43 #include <asm/arch/pxa2xx-gpio.h>
44
45 #include "generic.h"
46
47 static struct resource flash_resource = {
48         .start  = 0x00000000,
49         .end    = SZ_64M - 1,
50         .flags  = IORESOURCE_MEM,
51 };
52
53 static struct mtd_partition gumstix_partitions[] = {
54         {
55                 .name =         "Bootloader",
56                 .size =         0x00040000,
57                 .offset =       0,
58                 .mask_flags =   MTD_WRITEABLE  /* force read-only */
59         } , {
60                 .name =         "rootfs",
61                 .size =         MTDPART_SIZ_FULL,
62                 .offset =       MTDPART_OFS_APPEND
63         }
64 };
65
66 static struct flash_platform_data gumstix_flash_data = {
67         .map_name       = "cfi_probe",
68         .parts          = gumstix_partitions,
69         .nr_parts       = ARRAY_SIZE(gumstix_partitions),
70         .width          = 2,
71 };
72
73 static struct platform_device gumstix_flash_device = {
74         .name           = "pxa2xx-flash",
75         .id             = 0,
76         .dev = {
77                 .platform_data = &gumstix_flash_data,
78         },
79         .resource = &flash_resource,
80         .num_resources = 1,
81 };
82
83 static struct platform_device *devices[] __initdata = {
84         &gumstix_flash_device,
85 };
86
87 #ifdef CONFIG_MMC_PXA
88 static struct pxamci_platform_data gumstix_mci_platform_data;
89
90 static int gumstix_mci_init(struct device *dev, irq_handler_t detect_int,
91                                 void *data)
92 {
93         pxa_gpio_mode(GPIO6_MMCCLK_MD);
94         pxa_gpio_mode(GPIO53_MMCCLK_MD);
95         pxa_gpio_mode(GPIO8_MMCCS0_MD);
96
97         return 0;
98 }
99
100 static struct pxamci_platform_data gumstix_mci_platform_data = {
101         .ocr_mask       = MMC_VDD_32_33|MMC_VDD_33_34,
102         .init           = gumstix_mci_init,
103 };
104
105 static void __init gumstix_mmc_init(void)
106 {
107         pxa_set_mci_info(&gumstix_mci_platform_data);
108 }
109 #else
110 static void __init gumstix_mmc_init(void)
111 {
112         printk(KERN_INFO "Gumstix mmc disabled\n");
113 }
114 #endif
115
116 #ifdef CONFIG_USB_GADGET_PXA2XX
117 static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = {
118         .gpio_vbus              = GPIO_GUMSTIX_USB_GPIOn,
119         .gpio_pullup            = GPIO_GUMSTIX_USB_GPIOx,
120 };
121
122 static void __init gumstix_udc_init(void)
123 {
124         pxa_set_udc_info(&gumstix_udc_info);
125 }
126 #else
127 static void gumstix_udc_init(void)
128 {
129         printk(KERN_INFO "Gumstix udc is disabled\n");
130 }
131 #endif
132
133 static void __init gumstix_init(void)
134 {
135         gumstix_udc_init();
136         gumstix_mmc_init();
137         (void) platform_add_devices(devices, ARRAY_SIZE(devices));
138 }
139
140 MACHINE_START(GUMSTIX, "Gumstix")
141         .phys_io        = 0x40000000,
142         .boot_params    = 0xa0000100, /* match u-boot bi_boot_params */
143         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
144         .map_io         = pxa_map_io,
145         .init_irq       = pxa25x_init_irq,
146         .timer          = &pxa_timer,
147         .init_machine   = gumstix_init,
148 MACHINE_END