gumstix.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. #include <linux/module.h>
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/mtd/mtd.h>
  23. #include <linux/mtd/partitions.h>
  24. #include <asm/setup.h>
  25. #include <asm/memory.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/hardware.h>
  28. #include <asm/irq.h>
  29. #include <asm/sizes.h>
  30. #include <asm/mach/arch.h>
  31. #include <asm/mach/map.h>
  32. #include <asm/mach/irq.h>
  33. #include <asm/mach/flash.h>
  34. #include <asm/arch/mmc.h>
  35. #include <asm/arch/udc.h>
  36. #include <asm/arch/gumstix.h>
  37. #include <asm/arch/pxa-regs.h>
  38. #include <asm/arch/pxa2xx-regs.h>
  39. #include <asm/arch/pxa2xx-gpio.h>
  40. #include "generic.h"
  41. static struct resource flash_resource = {
  42. .start = 0x00000000,
  43. .end = SZ_64M - 1,
  44. .flags = IORESOURCE_MEM,
  45. };
  46. static struct mtd_partition gumstix_partitions[] = {
  47. {
  48. .name = "Bootloader",
  49. .size = 0x00040000,
  50. .offset = 0,
  51. .mask_flags = MTD_WRITEABLE /* force read-only */
  52. } , {
  53. .name = "rootfs",
  54. .size = MTDPART_SIZ_FULL,
  55. .offset = MTDPART_OFS_APPEND
  56. }
  57. };
  58. static struct flash_platform_data gumstix_flash_data = {
  59. .map_name = "cfi_probe",
  60. .parts = gumstix_partitions,
  61. .nr_parts = ARRAY_SIZE(gumstix_partitions),
  62. .width = 2,
  63. };
  64. static struct platform_device gumstix_flash_device = {
  65. .name = "pxa2xx-flash",
  66. .id = 0,
  67. .dev = {
  68. .platform_data = &gumstix_flash_data,
  69. },
  70. .resource = &flash_resource,
  71. .num_resources = 1,
  72. };
  73. static struct platform_device *devices[] __initdata = {
  74. &gumstix_flash_device,
  75. };
  76. #ifdef CONFIG_MMC_PXA
  77. static struct pxamci_platform_data gumstix_mci_platform_data;
  78. static int gumstix_mci_init(struct device *dev, irq_handler_t detect_int,
  79. void *data)
  80. {
  81. pxa_gpio_mode(GPIO6_MMCCLK_MD);
  82. pxa_gpio_mode(GPIO53_MMCCLK_MD);
  83. pxa_gpio_mode(GPIO8_MMCCS0_MD);
  84. return 0;
  85. }
  86. static struct pxamci_platform_data gumstix_mci_platform_data = {
  87. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  88. .init = gumstix_mci_init,
  89. };
  90. static void __init gumstix_mmc_init(void)
  91. {
  92. pxa_set_mci_info(&gumstix_mci_platform_data);
  93. }
  94. #else
  95. static void __init gumstix_mmc_init(void)
  96. {
  97. printk(KERN_INFO "Gumstix mmc disabled\n");
  98. }
  99. #endif
  100. #ifdef CONFIG_USB_GADGET_PXA2XX
  101. static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = {
  102. .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn,
  103. .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx,
  104. };
  105. static void __init gumstix_udc_init(void)
  106. {
  107. pxa_set_udc_info(&gumstix_udc_info);
  108. }
  109. #else
  110. static void gumstix_udc_init(void)
  111. {
  112. printk(KERN_INFO "Gumstix udc is disabled\n");
  113. }
  114. #endif
  115. static void __init gumstix_init(void)
  116. {
  117. gumstix_udc_init();
  118. gumstix_mmc_init();
  119. (void) platform_add_devices(devices, ARRAY_SIZE(devices));
  120. }
  121. MACHINE_START(GUMSTIX, "Gumstix")
  122. .phys_io = 0x40000000,
  123. .boot_params = 0xa0000100, /* match u-boot bi_boot_params */
  124. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  125. .map_io = pxa_map_io,
  126. .init_irq = pxa25x_init_irq,
  127. .timer = &pxa_timer,
  128. .init_machine = gumstix_init,
  129. MACHINE_END