gumstix.c 3.3 KB

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