board-dt.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
  3. *
  4. * arch/arm/mach-kirkwood/board-dt.c
  5. *
  6. * Marvell DreamPlug Reference Board Setup
  7. *
  8. * This file is licensed under the terms of the GNU General Public
  9. * License version 2. This program is licensed "as is" without any
  10. * warranty of any kind, whether express or implied.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <linux/ata_platform.h>
  17. #include <linux/mv643xx_eth.h>
  18. #include <linux/of.h>
  19. #include <linux/of_address.h>
  20. #include <linux/of_fdt.h>
  21. #include <linux/of_irq.h>
  22. #include <linux/of_platform.h>
  23. #include <linux/gpio.h>
  24. #include <linux/leds.h>
  25. #include <linux/mtd/physmap.h>
  26. #include <linux/spi/flash.h>
  27. #include <linux/spi/spi.h>
  28. #include <linux/spi/orion_spi.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/mach/arch.h>
  31. #include <mach/kirkwood.h>
  32. #include <plat/mvsdio.h>
  33. #include "common.h"
  34. #include "mpp.h"
  35. static struct of_device_id kirkwood_dt_match_table[] __initdata = {
  36. { .compatible = "simple-bus", },
  37. { }
  38. };
  39. struct mtd_partition dreamplug_partitions[] = {
  40. {
  41. .name = "u-boot",
  42. .size = SZ_512K,
  43. .offset = 0,
  44. },
  45. {
  46. .name = "u-boot env",
  47. .size = SZ_64K,
  48. .offset = SZ_512K + SZ_512K,
  49. },
  50. {
  51. .name = "dtb",
  52. .size = SZ_64K,
  53. .offset = SZ_512K + SZ_512K + SZ_512K,
  54. },
  55. };
  56. static const struct flash_platform_data dreamplug_spi_slave_data = {
  57. .type = "mx25l1606e",
  58. .name = "spi_flash",
  59. .parts = dreamplug_partitions,
  60. .nr_parts = ARRAY_SIZE(dreamplug_partitions),
  61. };
  62. static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
  63. {
  64. .modalias = "m25p80",
  65. .platform_data = &dreamplug_spi_slave_data,
  66. .irq = -1,
  67. .max_speed_hz = 50000000,
  68. .bus_num = 0,
  69. .chip_select = 0,
  70. },
  71. };
  72. static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
  73. .phy_addr = MV643XX_ETH_PHY_ADDR(0),
  74. };
  75. static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
  76. .phy_addr = MV643XX_ETH_PHY_ADDR(1),
  77. };
  78. static struct mv_sata_platform_data dreamplug_sata_data = {
  79. .n_ports = 1,
  80. };
  81. static struct mvsdio_platform_data dreamplug_mvsdio_data = {
  82. /* unfortunately the CD signal has not been connected */
  83. };
  84. static struct gpio_led dreamplug_led_pins[] = {
  85. {
  86. .name = "dreamplug:blue:bluetooth",
  87. .gpio = 47,
  88. .active_low = 1,
  89. },
  90. {
  91. .name = "dreamplug:green:wifi",
  92. .gpio = 48,
  93. .active_low = 1,
  94. },
  95. {
  96. .name = "dreamplug:green:wifi_ap",
  97. .gpio = 49,
  98. .active_low = 1,
  99. },
  100. };
  101. static struct gpio_led_platform_data dreamplug_led_data = {
  102. .leds = dreamplug_led_pins,
  103. .num_leds = ARRAY_SIZE(dreamplug_led_pins),
  104. };
  105. static struct platform_device dreamplug_leds = {
  106. .name = "leds-gpio",
  107. .id = -1,
  108. .dev = {
  109. .platform_data = &dreamplug_led_data,
  110. }
  111. };
  112. static unsigned int dreamplug_mpp_config[] __initdata = {
  113. MPP0_SPI_SCn,
  114. MPP1_SPI_MOSI,
  115. MPP2_SPI_SCK,
  116. MPP3_SPI_MISO,
  117. MPP47_GPIO, /* Bluetooth LED */
  118. MPP48_GPIO, /* Wifi LED */
  119. MPP49_GPIO, /* Wifi AP LED */
  120. 0
  121. };
  122. static void __init dreamplug_init(void)
  123. {
  124. /*
  125. * Basic setup. Needs to be called early.
  126. */
  127. kirkwood_mpp_conf(dreamplug_mpp_config);
  128. spi_register_board_info(dreamplug_spi_slave_info,
  129. ARRAY_SIZE(dreamplug_spi_slave_info));
  130. kirkwood_spi_init();
  131. kirkwood_ehci_init();
  132. kirkwood_ge00_init(&dreamplug_ge00_data);
  133. kirkwood_ge01_init(&dreamplug_ge01_data);
  134. kirkwood_sata_init(&dreamplug_sata_data);
  135. kirkwood_sdio_init(&dreamplug_mvsdio_data);
  136. platform_device_register(&dreamplug_leds);
  137. }
  138. static void __init kirkwood_dt_init(void)
  139. {
  140. kirkwood_init();
  141. if (of_machine_is_compatible("globalscale,dreamplug"))
  142. dreamplug_init();
  143. of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
  144. }
  145. static const char *kirkwood_dt_board_compat[] = {
  146. "globalscale,dreamplug",
  147. NULL
  148. };
  149. DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
  150. /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
  151. .map_io = kirkwood_map_io,
  152. .init_early = kirkwood_init_early,
  153. .init_irq = kirkwood_init_irq,
  154. .timer = &kirkwood_timer,
  155. .init_machine = kirkwood_dt_init,
  156. .restart = kirkwood_restart,
  157. .dt_compat = kirkwood_dt_board_compat,
  158. MACHINE_END