2 * linux/arch/arm/mach-pxa/gumstix.c
4 * Support for the Gumstix motherboards.
6 * Original Author: Craig Hughes
7 * Created: Feb 14, 2008
8 * Copyright: Craig Hughes
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.
14 * Implemented based on lubbock.c by Nicolas Pitre and code from Craig
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/delay.h>
24 #include <linux/mtd/mtd.h>
25 #include <linux/mtd/partitions.h>
26 #include <linux/gpio.h>
27 #include <linux/err.h>
28 #include <linux/clk.h>
29 #include <linux/usb/gpio_vbus.h>
31 #include <asm/setup.h>
32 #include <asm/memory.h>
33 #include <asm/mach-types.h>
34 #include <mach/hardware.h>
36 #include <asm/sizes.h>
38 #include <asm/mach/arch.h>
39 #include <asm/mach/map.h>
40 #include <asm/mach/irq.h>
41 #include <asm/mach/flash.h>
44 #include <linux/platform_data/mmc-pxamci.h>
50 static struct resource flash_resource = {
53 .flags = IORESOURCE_MEM,
56 static struct mtd_partition gumstix_partitions[] = {
61 .mask_flags = MTD_WRITEABLE /* force read-only */
64 .size = MTDPART_SIZ_FULL,
65 .offset = MTDPART_OFS_APPEND
69 static struct flash_platform_data gumstix_flash_data = {
70 .map_name = "cfi_probe",
71 .parts = gumstix_partitions,
72 .nr_parts = ARRAY_SIZE(gumstix_partitions),
76 static struct platform_device gumstix_flash_device = {
77 .name = "pxa2xx-flash",
80 .platform_data = &gumstix_flash_data,
82 .resource = &flash_resource,
86 static struct platform_device *devices[] __initdata = {
87 &gumstix_flash_device,
91 static struct pxamci_platform_data gumstix_mci_platform_data = {
92 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
95 static void __init gumstix_mmc_init(void)
97 pxa_set_mci_info(&gumstix_mci_platform_data);
100 static void __init gumstix_mmc_init(void)
102 pr_debug("Gumstix mmc disabled\n");
106 #ifdef CONFIG_USB_PXA25X
107 static struct gpio_vbus_mach_info gumstix_udc_info = {
108 .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn,
109 .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx,
112 static struct platform_device gumstix_gpio_vbus = {
116 .platform_data = &gumstix_udc_info,
120 static void __init gumstix_udc_init(void)
122 platform_device_register(&gumstix_gpio_vbus);
125 static void gumstix_udc_init(void)
127 pr_debug("Gumstix udc is disabled\n");
132 /* Normally, the bootloader would have enabled this 32kHz clock but many
133 ** boards still have u-boot 1.1.4 so we check if it has been turned on and
134 ** if not, we turn it on with a warning message. */
135 static void gumstix_setup_bt_clock(void)
139 if (!(readl(OSCC) & OSCC_OOK))
140 pr_warn("32kHz clock was not on. Bootloader may need to be updated\n");
144 writel(readl(OSCC) | OSCC_OON, OSCC);
146 if (readl(OSCC) & OSCC_OOK)
151 pr_err("Failed to start 32kHz clock\n");
154 static void __init gumstix_bluetooth_init(void)
158 gumstix_setup_bt_clock();
160 err = gpio_request(GPIO_GUMSTIX_BTRESET, "BTRST");
162 pr_err("gumstix: failed request gpio for bluetooth reset\n");
166 err = gpio_direction_output(GPIO_GUMSTIX_BTRESET, 1);
168 pr_err("gumstix: can't reset bluetooth\n");
171 gpio_set_value(GPIO_GUMSTIX_BTRESET, 0);
173 gpio_set_value(GPIO_GUMSTIX_BTRESET, 1);
176 static void gumstix_bluetooth_init(void)
178 pr_debug("Gumstix Bluetooth is disabled\n");
182 static unsigned long gumstix_pin_config[] __initdata = {
195 int __attribute__((weak)) am200_init(void)
200 int __attribute__((weak)) am300_init(void)
205 static void __init carrier_board_init(void)
208 * put carrier/expansion board init here if
209 * they cannot be detected programatically
215 static void __init gumstix_init(void)
217 pxa2xx_mfp_config(ARRAY_AND_SIZE(gumstix_pin_config));
219 pxa_set_ffuart_info(NULL);
220 pxa_set_btuart_info(NULL);
221 pxa_set_stuart_info(NULL);
222 pxa_set_hwuart_info(NULL);
224 gumstix_bluetooth_init();
227 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
228 carrier_board_init();
231 MACHINE_START(GUMSTIX, "Gumstix")
232 .atag_offset = 0x100, /* match u-boot bi_boot_params */
233 .map_io = pxa25x_map_io,
234 .nr_irqs = PXA_NR_IRQS,
235 .init_irq = pxa25x_init_irq,
236 .handle_irq = pxa25x_handle_irq,
237 .init_time = pxa_timer_init,
238 .init_machine = gumstix_init,
239 .restart = pxa_restart,