sheevaplug-setup.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * arch/arm/mach-kirkwood/sheevaplug-setup.c
  3. *
  4. * Marvell SheevaPlug Reference Board Setup
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/mtd/nand.h>
  14. #include <linux/mtd/partitions.h>
  15. #include <linux/mv643xx_eth.h>
  16. #include <linux/gpio.h>
  17. #include <linux/leds.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/arch.h>
  20. #include <mach/kirkwood.h>
  21. #include <plat/mvsdio.h>
  22. #include <plat/orion_nand.h>
  23. #include "common.h"
  24. #include "mpp.h"
  25. static struct mtd_partition sheevaplug_nand_parts[] = {
  26. {
  27. .name = "u-boot",
  28. .offset = 0,
  29. .size = SZ_1M
  30. }, {
  31. .name = "uImage",
  32. .offset = MTDPART_OFS_NXTBLK,
  33. .size = SZ_4M
  34. }, {
  35. .name = "root",
  36. .offset = MTDPART_OFS_NXTBLK,
  37. .size = MTDPART_SIZ_FULL
  38. },
  39. };
  40. static struct resource sheevaplug_nand_resource = {
  41. .flags = IORESOURCE_MEM,
  42. .start = KIRKWOOD_NAND_MEM_PHYS_BASE,
  43. .end = KIRKWOOD_NAND_MEM_PHYS_BASE +
  44. KIRKWOOD_NAND_MEM_SIZE - 1,
  45. };
  46. static struct orion_nand_data sheevaplug_nand_data = {
  47. .parts = sheevaplug_nand_parts,
  48. .nr_parts = ARRAY_SIZE(sheevaplug_nand_parts),
  49. .cle = 0,
  50. .ale = 1,
  51. .width = 8,
  52. .chip_delay = 25,
  53. };
  54. static struct platform_device sheevaplug_nand_flash = {
  55. .name = "orion_nand",
  56. .id = -1,
  57. .dev = {
  58. .platform_data = &sheevaplug_nand_data,
  59. },
  60. .resource = &sheevaplug_nand_resource,
  61. .num_resources = 1,
  62. };
  63. static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
  64. .phy_addr = MV643XX_ETH_PHY_ADDR(0),
  65. };
  66. static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
  67. // unfortunately the CD signal has not been connected */
  68. };
  69. static struct gpio_led sheevaplug_led_pins[] = {
  70. {
  71. .name = "plug:green:health",
  72. .default_trigger = "default-on",
  73. .gpio = 49,
  74. .active_low = 1,
  75. },
  76. };
  77. static struct gpio_led_platform_data sheevaplug_led_data = {
  78. .leds = sheevaplug_led_pins,
  79. .num_leds = ARRAY_SIZE(sheevaplug_led_pins),
  80. };
  81. static struct platform_device sheevaplug_leds = {
  82. .name = "leds-gpio",
  83. .id = -1,
  84. .dev = {
  85. .platform_data = &sheevaplug_led_data,
  86. }
  87. };
  88. static unsigned int sheevaplug_mpp_config[] __initdata = {
  89. MPP29_GPIO, /* USB Power Enable */
  90. MPP49_GPIO, /* LED */
  91. 0
  92. };
  93. static void __init sheevaplug_init(void)
  94. {
  95. /*
  96. * Basic setup. Needs to be called early.
  97. */
  98. kirkwood_init();
  99. kirkwood_mpp_conf(sheevaplug_mpp_config);
  100. kirkwood_uart0_init();
  101. if (gpio_request(29, "USB Power Enable") != 0 ||
  102. gpio_direction_output(29, 1) != 0)
  103. printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
  104. kirkwood_ehci_init();
  105. kirkwood_ge00_init(&sheevaplug_ge00_data);
  106. kirkwood_sdio_init(&sheevaplug_mvsdio_data);
  107. platform_device_register(&sheevaplug_nand_flash);
  108. platform_device_register(&sheevaplug_leds);
  109. }
  110. MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
  111. /* Maintainer: shadi Ammouri <shadi@marvell.com> */
  112. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  113. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  114. .boot_params = 0x00000100,
  115. .init_machine = sheevaplug_init,
  116. .map_io = kirkwood_map_io,
  117. .init_irq = kirkwood_init_irq,
  118. .timer = &kirkwood_timer,
  119. MACHINE_END