[ARM] 4867/1: Adds flash, udc, mci support for gumstix F boards
[linux-2.6-block.git] / arch / arm / mach-pxa / gumstix.c
CommitLineData
90b8fc34
JK
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
44#include "generic.h"
45
46static struct resource flash_resource = {
47 .start = 0x00000000,
48 .end = SZ_64M - 1,
49 .flags = IORESOURCE_MEM,
50};
51
52static struct mtd_partition gumstix_partitions[] = {
53 {
54 .name = "Bootloader",
55 .size = 0x00040000,
56 .offset = 0,
57 .mask_flags = MTD_WRITEABLE /* force read-only */
58 } , {
59 .name = "rootfs",
60 .size = MTDPART_SIZ_FULL,
61 .offset = MTDPART_OFS_APPEND
62 }
63};
64
65static struct flash_platform_data gumstix_flash_data = {
66 .map_name = "cfi_probe",
67 .parts = gumstix_partitions,
68 .nr_parts = ARRAY_SIZE(gumstix_partitions),
69 .width = 2,
70};
71
72static struct platform_device gumstix_flash_device = {
73 .name = "pxa2xx-flash",
74 .id = 0,
75 .dev = {
76 .platform_data = &gumstix_flash_data,
77 },
78 .resource = &flash_resource,
79 .num_resources = 1,
80};
81
82static struct platform_device *devices[] __initdata = {
83 &gumstix_flash_device,
84};
85
86#ifdef CONFIG_MMC_PXA
87static struct pxamci_platform_data gumstix_mci_platform_data;
88
89static int gumstix_mci_init(struct device *dev, irq_handler_t detect_int,
90 void *data)
91{
92 pxa_gpio_mode(GPIO6_MMCCLK_MD);
93 pxa_gpio_mode(GPIO53_MMCCLK_MD);
94 pxa_gpio_mode(GPIO8_MMCCS0_MD);
95
96 return 0;
97}
98
99static struct pxamci_platform_data gumstix_mci_platform_data = {
100 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
101 .init = gumstix_mci_init,
102};
103
104static void __init gumstix_mmc_init(void)
105{
106 pxa_set_mci_info(&gumstix_mci_platform_data);
107}
108#else
109static void __init gumstix_mmc_init(void)
110{
111 printk(KERN_INFO "Gumstix mmc disabled\n");
112}
113#endif
114
115#ifdef CONFIG_USB_GADGET_PXA2XX
116static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = {
117 .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn,
118 .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx,
119};
120
121static void __init gumstix_udc_init(void)
122{
123 pxa_set_udc_info(&gumstix_udc_info);
124}
125#else
126static void gumstix_udc_init(void)
127{
128 printk(KERN_INFO "Gumstix udc is disabled\n");
129}
130#endif
131
132static void __init gumstix_init(void)
133{
134 gumstix_udc_init();
135 gumstix_mmc_init();
136 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
137}
138
139MACHINE_START(GUMSTIX, "Gumstix")
140 .phys_io = 0x40000000,
141 .boot_params = 0xa0000100, /* match u-boot bi_boot_params */
142 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
143 .map_io = pxa_map_io,
144 .init_irq = pxa25x_init_irq,
145 .timer = &pxa_timer,
146 .init_machine = gumstix_init,
147MACHINE_END