cerf.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*
  2. * linux/arch/arm/mach-sa1100/cerf.c
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * Apr-2003 : Removed some old PDA crud [FB]
  9. * Oct-2003 : Added uart2 resource [FB]
  10. * Jan-2004 : Removed io map for flash [FB]
  11. */
  12. #include <linux/init.h>
  13. #include <linux/gpio/machine.h>
  14. #include <linux/kernel.h>
  15. #include <linux/tty.h>
  16. #include <linux/platform_data/sa11x0-serial.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/irq.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/partitions.h>
  21. #include <linux/gpio.h>
  22. #include <linux/leds.h>
  23. #include <mach/hardware.h>
  24. #include <asm/setup.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/flash.h>
  28. #include <asm/mach/map.h>
  29. #include <mach/cerf.h>
  30. #include <linux/platform_data/mfd-mcp-sa11x0.h>
  31. #include <mach/irqs.h>
  32. #include "generic.h"
  33. static struct resource cerfuart2_resources[] = {
  34. [0] = DEFINE_RES_MEM(0x80030000, SZ_64K),
  35. };
  36. static struct platform_device cerfuart2_device = {
  37. .name = "sa11x0-uart",
  38. .id = 2,
  39. .num_resources = ARRAY_SIZE(cerfuart2_resources),
  40. .resource = cerfuart2_resources,
  41. };
  42. /* Compact Flash */
  43. static struct gpiod_lookup_table cerf_cf_gpio_table = {
  44. .dev_id = "sa11x0-pcmcia.1",
  45. .table = {
  46. GPIO_LOOKUP("gpio", 19, "bvd2", GPIO_ACTIVE_HIGH),
  47. GPIO_LOOKUP("gpio", 20, "bvd1", GPIO_ACTIVE_HIGH),
  48. GPIO_LOOKUP("gpio", 21, "reset", GPIO_ACTIVE_HIGH),
  49. GPIO_LOOKUP("gpio", 22, "ready", GPIO_ACTIVE_HIGH),
  50. GPIO_LOOKUP("gpio", 23, "detect", GPIO_ACTIVE_LOW),
  51. { },
  52. },
  53. };
  54. /* LEDs */
  55. struct gpio_led cerf_gpio_leds[] = {
  56. {
  57. .name = "cerf:d0",
  58. .default_trigger = "heartbeat",
  59. .gpio = 0,
  60. },
  61. {
  62. .name = "cerf:d1",
  63. .default_trigger = "cpu0",
  64. .gpio = 1,
  65. },
  66. {
  67. .name = "cerf:d2",
  68. .default_trigger = "default-on",
  69. .gpio = 2,
  70. },
  71. {
  72. .name = "cerf:d3",
  73. .default_trigger = "default-on",
  74. .gpio = 3,
  75. },
  76. };
  77. static struct gpio_led_platform_data cerf_gpio_led_info = {
  78. .leds = cerf_gpio_leds,
  79. .num_leds = ARRAY_SIZE(cerf_gpio_leds),
  80. };
  81. static struct platform_device cerf_leds = {
  82. .name = "leds-gpio",
  83. .id = -1,
  84. .dev = {
  85. .platform_data = &cerf_gpio_led_info,
  86. }
  87. };
  88. static struct platform_device *cerf_devices[] __initdata = {
  89. &cerfuart2_device,
  90. &cerf_leds,
  91. };
  92. #ifdef CONFIG_SA1100_CERF_FLASH_32MB
  93. # define CERF_FLASH_SIZE 0x02000000
  94. #elif defined CONFIG_SA1100_CERF_FLASH_16MB
  95. # define CERF_FLASH_SIZE 0x01000000
  96. #elif defined CONFIG_SA1100_CERF_FLASH_8MB
  97. # define CERF_FLASH_SIZE 0x00800000
  98. #else
  99. # error "Undefined flash size for CERF"
  100. #endif
  101. static struct mtd_partition cerf_partitions[] = {
  102. {
  103. .name = "Bootloader",
  104. .size = 0x00020000,
  105. .offset = 0x00000000,
  106. }, {
  107. .name = "Params",
  108. .size = 0x00040000,
  109. .offset = 0x00020000,
  110. }, {
  111. .name = "Kernel",
  112. .size = 0x00100000,
  113. .offset = 0x00060000,
  114. }, {
  115. .name = "Filesystem",
  116. .size = CERF_FLASH_SIZE-0x00160000,
  117. .offset = 0x00160000,
  118. }
  119. };
  120. static struct flash_platform_data cerf_flash_data = {
  121. .map_name = "cfi_probe",
  122. .parts = cerf_partitions,
  123. .nr_parts = ARRAY_SIZE(cerf_partitions),
  124. };
  125. static struct resource cerf_flash_resource =
  126. DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
  127. static void __init cerf_init_irq(void)
  128. {
  129. sa1100_init_irq();
  130. irq_set_irq_type(CERF_ETH_IRQ, IRQ_TYPE_EDGE_RISING);
  131. }
  132. static struct map_desc cerf_io_desc[] __initdata = {
  133. { /* Crystal Ethernet Chip */
  134. .virtual = 0xf0000000,
  135. .pfn = __phys_to_pfn(0x08000000),
  136. .length = 0x00100000,
  137. .type = MT_DEVICE
  138. }
  139. };
  140. static void __init cerf_map_io(void)
  141. {
  142. sa1100_map_io();
  143. iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc));
  144. sa1100_register_uart(0, 3);
  145. sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
  146. sa1100_register_uart(2, 1);
  147. }
  148. static struct mcp_plat_data cerf_mcp_data = {
  149. .mccr0 = MCCR0_ADM,
  150. .sclk_rate = 11981000,
  151. };
  152. static void __init cerf_init(void)
  153. {
  154. sa11x0_ppc_configure_mcp();
  155. platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
  156. sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
  157. sa11x0_register_mcp(&cerf_mcp_data);
  158. sa11x0_register_pcmcia(1, &cerf_cf_gpio_table);
  159. }
  160. MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
  161. /* Maintainer: support@intrinsyc.com */
  162. .map_io = cerf_map_io,
  163. .nr_irqs = SA1100_NR_IRQS,
  164. .init_irq = cerf_init_irq,
  165. .init_time = sa1100_timer_init,
  166. .init_machine = cerf_init,
  167. .init_late = sa11x0_init_late,
  168. .restart = sa11x0_restart,
  169. MACHINE_END