190b8fc34SJaya Kumar /* 290b8fc34SJaya Kumar * linux/arch/arm/mach-pxa/gumstix.c 390b8fc34SJaya Kumar * 490b8fc34SJaya Kumar * Support for the Gumstix motherboards. 590b8fc34SJaya Kumar * 690b8fc34SJaya Kumar * Original Author: Craig Hughes 790b8fc34SJaya Kumar * Created: Feb 14, 2008 890b8fc34SJaya Kumar * Copyright: Craig Hughes 990b8fc34SJaya Kumar * 1090b8fc34SJaya Kumar * This program is free software; you can redistribute it and/or modify 1190b8fc34SJaya Kumar * it under the terms of the GNU General Public License version 2 as 1290b8fc34SJaya Kumar * published by the Free Software Foundation. 1390b8fc34SJaya Kumar * 1490b8fc34SJaya Kumar * Implemented based on lubbock.c by Nicolas Pitre and code from Craig 1590b8fc34SJaya Kumar * Hughes 1690b8fc34SJaya Kumar */ 1790b8fc34SJaya Kumar 1890b8fc34SJaya Kumar #include <linux/module.h> 1990b8fc34SJaya Kumar #include <linux/kernel.h> 2090b8fc34SJaya Kumar #include <linux/init.h> 2190b8fc34SJaya Kumar #include <linux/platform_device.h> 2290b8fc34SJaya Kumar #include <linux/interrupt.h> 2390b8fc34SJaya Kumar #include <linux/mtd/mtd.h> 2490b8fc34SJaya Kumar #include <linux/mtd/partitions.h> 2590b8fc34SJaya Kumar 2690b8fc34SJaya Kumar #include <asm/setup.h> 2790b8fc34SJaya Kumar #include <asm/memory.h> 2890b8fc34SJaya Kumar #include <asm/mach-types.h> 29*a09e64fbSRussell King #include <mach/hardware.h> 3090b8fc34SJaya Kumar #include <asm/irq.h> 3190b8fc34SJaya Kumar #include <asm/sizes.h> 3290b8fc34SJaya Kumar 3390b8fc34SJaya Kumar #include <asm/mach/arch.h> 3490b8fc34SJaya Kumar #include <asm/mach/map.h> 3590b8fc34SJaya Kumar #include <asm/mach/irq.h> 3690b8fc34SJaya Kumar #include <asm/mach/flash.h> 37*a09e64fbSRussell King #include <mach/mmc.h> 38*a09e64fbSRussell King #include <mach/udc.h> 39*a09e64fbSRussell King #include <mach/gumstix.h> 4090b8fc34SJaya Kumar 41*a09e64fbSRussell King #include <mach/pxa-regs.h> 42*a09e64fbSRussell King #include <mach/pxa2xx-regs.h> 43*a09e64fbSRussell King #include <mach/pxa2xx-gpio.h> 4490b8fc34SJaya Kumar 4590b8fc34SJaya Kumar #include "generic.h" 4690b8fc34SJaya Kumar 4790b8fc34SJaya Kumar static struct resource flash_resource = { 4890b8fc34SJaya Kumar .start = 0x00000000, 4990b8fc34SJaya Kumar .end = SZ_64M - 1, 5090b8fc34SJaya Kumar .flags = IORESOURCE_MEM, 5190b8fc34SJaya Kumar }; 5290b8fc34SJaya Kumar 5390b8fc34SJaya Kumar static struct mtd_partition gumstix_partitions[] = { 5490b8fc34SJaya Kumar { 5590b8fc34SJaya Kumar .name = "Bootloader", 5690b8fc34SJaya Kumar .size = 0x00040000, 5790b8fc34SJaya Kumar .offset = 0, 5890b8fc34SJaya Kumar .mask_flags = MTD_WRITEABLE /* force read-only */ 5990b8fc34SJaya Kumar } , { 6090b8fc34SJaya Kumar .name = "rootfs", 6190b8fc34SJaya Kumar .size = MTDPART_SIZ_FULL, 6290b8fc34SJaya Kumar .offset = MTDPART_OFS_APPEND 6390b8fc34SJaya Kumar } 6490b8fc34SJaya Kumar }; 6590b8fc34SJaya Kumar 6690b8fc34SJaya Kumar static struct flash_platform_data gumstix_flash_data = { 6790b8fc34SJaya Kumar .map_name = "cfi_probe", 6890b8fc34SJaya Kumar .parts = gumstix_partitions, 6990b8fc34SJaya Kumar .nr_parts = ARRAY_SIZE(gumstix_partitions), 7090b8fc34SJaya Kumar .width = 2, 7190b8fc34SJaya Kumar }; 7290b8fc34SJaya Kumar 7390b8fc34SJaya Kumar static struct platform_device gumstix_flash_device = { 7490b8fc34SJaya Kumar .name = "pxa2xx-flash", 7590b8fc34SJaya Kumar .id = 0, 7690b8fc34SJaya Kumar .dev = { 7790b8fc34SJaya Kumar .platform_data = &gumstix_flash_data, 7890b8fc34SJaya Kumar }, 7990b8fc34SJaya Kumar .resource = &flash_resource, 8090b8fc34SJaya Kumar .num_resources = 1, 8190b8fc34SJaya Kumar }; 8290b8fc34SJaya Kumar 8390b8fc34SJaya Kumar static struct platform_device *devices[] __initdata = { 8490b8fc34SJaya Kumar &gumstix_flash_device, 8590b8fc34SJaya Kumar }; 8690b8fc34SJaya Kumar 8790b8fc34SJaya Kumar #ifdef CONFIG_MMC_PXA 8890b8fc34SJaya Kumar static struct pxamci_platform_data gumstix_mci_platform_data; 8990b8fc34SJaya Kumar 9090b8fc34SJaya Kumar static int gumstix_mci_init(struct device *dev, irq_handler_t detect_int, 9190b8fc34SJaya Kumar void *data) 9290b8fc34SJaya Kumar { 9390b8fc34SJaya Kumar pxa_gpio_mode(GPIO6_MMCCLK_MD); 9490b8fc34SJaya Kumar pxa_gpio_mode(GPIO53_MMCCLK_MD); 9590b8fc34SJaya Kumar pxa_gpio_mode(GPIO8_MMCCS0_MD); 9690b8fc34SJaya Kumar 9790b8fc34SJaya Kumar return 0; 9890b8fc34SJaya Kumar } 9990b8fc34SJaya Kumar 10090b8fc34SJaya Kumar static struct pxamci_platform_data gumstix_mci_platform_data = { 10190b8fc34SJaya Kumar .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 10290b8fc34SJaya Kumar .init = gumstix_mci_init, 10390b8fc34SJaya Kumar }; 10490b8fc34SJaya Kumar 10590b8fc34SJaya Kumar static void __init gumstix_mmc_init(void) 10690b8fc34SJaya Kumar { 10790b8fc34SJaya Kumar pxa_set_mci_info(&gumstix_mci_platform_data); 10890b8fc34SJaya Kumar } 10990b8fc34SJaya Kumar #else 11090b8fc34SJaya Kumar static void __init gumstix_mmc_init(void) 11190b8fc34SJaya Kumar { 11290b8fc34SJaya Kumar printk(KERN_INFO "Gumstix mmc disabled\n"); 11390b8fc34SJaya Kumar } 11490b8fc34SJaya Kumar #endif 11590b8fc34SJaya Kumar 11690b8fc34SJaya Kumar #ifdef CONFIG_USB_GADGET_PXA2XX 11790b8fc34SJaya Kumar static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = { 11890b8fc34SJaya Kumar .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn, 11990b8fc34SJaya Kumar .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx, 12090b8fc34SJaya Kumar }; 12190b8fc34SJaya Kumar 12290b8fc34SJaya Kumar static void __init gumstix_udc_init(void) 12390b8fc34SJaya Kumar { 12490b8fc34SJaya Kumar pxa_set_udc_info(&gumstix_udc_info); 12590b8fc34SJaya Kumar } 12690b8fc34SJaya Kumar #else 12790b8fc34SJaya Kumar static void gumstix_udc_init(void) 12890b8fc34SJaya Kumar { 12990b8fc34SJaya Kumar printk(KERN_INFO "Gumstix udc is disabled\n"); 13090b8fc34SJaya Kumar } 13190b8fc34SJaya Kumar #endif 13290b8fc34SJaya Kumar 13390b8fc34SJaya Kumar static void __init gumstix_init(void) 13490b8fc34SJaya Kumar { 13590b8fc34SJaya Kumar gumstix_udc_init(); 13690b8fc34SJaya Kumar gumstix_mmc_init(); 13790b8fc34SJaya Kumar (void) platform_add_devices(devices, ARRAY_SIZE(devices)); 13890b8fc34SJaya Kumar } 13990b8fc34SJaya Kumar 14090b8fc34SJaya Kumar MACHINE_START(GUMSTIX, "Gumstix") 14190b8fc34SJaya Kumar .phys_io = 0x40000000, 14290b8fc34SJaya Kumar .boot_params = 0xa0000100, /* match u-boot bi_boot_params */ 14390b8fc34SJaya Kumar .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 14490b8fc34SJaya Kumar .map_io = pxa_map_io, 14590b8fc34SJaya Kumar .init_irq = pxa25x_init_irq, 14690b8fc34SJaya Kumar .timer = &pxa_timer, 14790b8fc34SJaya Kumar .init_machine = gumstix_init, 14890b8fc34SJaya Kumar MACHINE_END 149