board-dreamplug.c 3.4 KB

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