openrd-setup.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * arch/arm/mach-kirkwood/openrd-setup.c
  3. *
  4. * Marvell OpenRD (Base|Client|Ultimate) 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/ata_platform.h>
  16. #include <linux/mv643xx_eth.h>
  17. #include <linux/i2c.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 "common.h"
  23. #include "mpp.h"
  24. static struct mtd_partition openrd_nand_parts[] = {
  25. {
  26. .name = "u-boot",
  27. .offset = 0,
  28. .size = SZ_1M,
  29. .mask_flags = MTD_WRITEABLE
  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 mv643xx_eth_platform_data openrd_ge00_data = {
  41. .phy_addr = MV643XX_ETH_PHY_ADDR(8),
  42. };
  43. static struct mv643xx_eth_platform_data openrd_ge01_data = {
  44. .phy_addr = MV643XX_ETH_PHY_ADDR(24),
  45. };
  46. static struct mv_sata_platform_data openrd_sata_data = {
  47. .n_ports = 2,
  48. };
  49. static struct mvsdio_platform_data openrd_mvsdio_data = {
  50. .gpio_card_detect = 29, /* MPP29 used as SD card detect */
  51. };
  52. static unsigned int openrd_mpp_config[] __initdata = {
  53. MPP29_GPIO,
  54. 0
  55. };
  56. static struct i2c_board_info i2c_board_info[] __initdata = {
  57. {
  58. I2C_BOARD_INFO("cs42l51", 0x4a),
  59. },
  60. };
  61. static void __init openrd_init(void)
  62. {
  63. /*
  64. * Basic setup. Needs to be called early.
  65. */
  66. kirkwood_init();
  67. kirkwood_mpp_conf(openrd_mpp_config);
  68. kirkwood_uart0_init();
  69. kirkwood_nand_init(ARRAY_AND_SIZE(openrd_nand_parts), 25);
  70. kirkwood_ehci_init();
  71. if (machine_is_openrd_ultimate()) {
  72. openrd_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
  73. openrd_ge01_data.phy_addr = MV643XX_ETH_PHY_ADDR(1);
  74. }
  75. kirkwood_ge00_init(&openrd_ge00_data);
  76. if (!machine_is_openrd_base())
  77. kirkwood_ge01_init(&openrd_ge01_data);
  78. kirkwood_sata_init(&openrd_sata_data);
  79. kirkwood_sdio_init(&openrd_mvsdio_data);
  80. kirkwood_i2c_init();
  81. if (machine_is_openrd_client()) {
  82. i2c_register_board_info(0, i2c_board_info,
  83. ARRAY_SIZE(i2c_board_info));
  84. kirkwood_audio_init();
  85. }
  86. }
  87. static int __init openrd_pci_init(void)
  88. {
  89. if (machine_is_openrd_base() ||
  90. machine_is_openrd_client() ||
  91. machine_is_openrd_ultimate())
  92. kirkwood_pcie_init(KW_PCIE0);
  93. return 0;
  94. }
  95. subsys_initcall(openrd_pci_init);
  96. #ifdef CONFIG_MACH_OPENRD_BASE
  97. MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board")
  98. /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
  99. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  100. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  101. .boot_params = 0x00000100,
  102. .init_machine = openrd_init,
  103. .map_io = kirkwood_map_io,
  104. .init_irq = kirkwood_init_irq,
  105. .timer = &kirkwood_timer,
  106. MACHINE_END
  107. #endif
  108. #ifdef CONFIG_MACH_OPENRD_CLIENT
  109. MACHINE_START(OPENRD_CLIENT, "Marvell OpenRD Client Board")
  110. /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
  111. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  112. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  113. .boot_params = 0x00000100,
  114. .init_machine = openrd_init,
  115. .map_io = kirkwood_map_io,
  116. .init_irq = kirkwood_init_irq,
  117. .timer = &kirkwood_timer,
  118. MACHINE_END
  119. #endif
  120. #ifdef CONFIG_MACH_OPENRD_ULTIMATE
  121. MACHINE_START(OPENRD_ULTIMATE, "Marvell OpenRD Ultimate Board")
  122. /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
  123. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  124. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  125. .boot_params = 0x00000100,
  126. .init_machine = openrd_init,
  127. .map_io = kirkwood_map_io,
  128. .init_irq = kirkwood_init_irq,
  129. .timer = &kirkwood_timer,
  130. MACHINE_END
  131. #endif