blob: c0092472fa589761d4d6afc281bf9b4c6c4abac7 [file] [log] [blame]
Jaya Kumar90b8fc32008-03-15 05:11:07 +01001/*
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>
Russell Kinga09e64f2008-08-05 16:14:15 +010029#include <mach/hardware.h>
Jaya Kumar90b8fc32008-03-15 05:11:07 +010030#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>
Russell Kinga09e64f2008-08-05 16:14:15 +010037#include <mach/mmc.h>
38#include <mach/udc.h>
39#include <mach/gumstix.h>
Jaya Kumar90b8fc32008-03-15 05:11:07 +010040
Russell Kinga09e64f2008-08-05 16:14:15 +010041#include <mach/pxa-regs.h>
42#include <mach/pxa2xx-regs.h>
43#include <mach/pxa2xx-gpio.h>
Jaya Kumar90b8fc32008-03-15 05:11:07 +010044
45#include "generic.h"
46
47static struct resource flash_resource = {
48 .start = 0x00000000,
49 .end = SZ_64M - 1,
50 .flags = IORESOURCE_MEM,
51};
52
53static 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
66static 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
73static 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
83static struct platform_device *devices[] __initdata = {
84 &gumstix_flash_device,
85};
86
87#ifdef CONFIG_MMC_PXA
88static struct pxamci_platform_data gumstix_mci_platform_data;
89
90static 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
100static 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
105static void __init gumstix_mmc_init(void)
106{
107 pxa_set_mci_info(&gumstix_mci_platform_data);
108}
109#else
110static 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
117static 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
122static void __init gumstix_udc_init(void)
123{
124 pxa_set_udc_info(&gumstix_udc_info);
125}
126#else
127static void gumstix_udc_init(void)
128{
129 printk(KERN_INFO "Gumstix udc is disabled\n");
130}
131#endif
132
133static 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
140MACHINE_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,
148MACHINE_END