kurobox_pro-setup.c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /*
  2. * arch/arm/mach-orion5x/kurobox_pro-setup.c
  3. *
  4. * Maintainer: Ronen Shitrit <rshitrit@marvell.com>
  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/pci.h>
  14. #include <linux/irq.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/mtd/nand.h>
  17. #include <linux/mv643xx_eth.h>
  18. #include <linux/i2c.h>
  19. #include <linux/ata_platform.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/gpio.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/pci.h>
  24. #include <asm/arch/orion5x.h>
  25. #include <asm/plat-orion/orion_nand.h>
  26. #include "common.h"
  27. #include "mpp.h"
  28. /*****************************************************************************
  29. * KUROBOX-PRO Info
  30. ****************************************************************************/
  31. /*
  32. * 256K NOR flash Device bus boot chip select
  33. */
  34. #define KUROBOX_PRO_NOR_BOOT_BASE 0xf4000000
  35. #define KUROBOX_PRO_NOR_BOOT_SIZE SZ_256K
  36. /*
  37. * 256M NAND flash on Device bus chip select 1
  38. */
  39. #define KUROBOX_PRO_NAND_BASE 0xfc000000
  40. #define KUROBOX_PRO_NAND_SIZE SZ_2M
  41. /*****************************************************************************
  42. * 256MB NAND Flash on Device bus CS0
  43. ****************************************************************************/
  44. static struct mtd_partition kurobox_pro_nand_parts[] = {
  45. {
  46. .name = "uImage",
  47. .offset = 0,
  48. .size = SZ_4M,
  49. }, {
  50. .name = "rootfs",
  51. .offset = SZ_4M,
  52. .size = SZ_64M,
  53. }, {
  54. .name = "extra",
  55. .offset = SZ_4M + SZ_64M,
  56. .size = SZ_256M - (SZ_4M + SZ_64M),
  57. },
  58. };
  59. static struct resource kurobox_pro_nand_resource = {
  60. .flags = IORESOURCE_MEM,
  61. .start = KUROBOX_PRO_NAND_BASE,
  62. .end = KUROBOX_PRO_NAND_BASE + KUROBOX_PRO_NAND_SIZE - 1,
  63. };
  64. static struct orion_nand_data kurobox_pro_nand_data = {
  65. .parts = kurobox_pro_nand_parts,
  66. .nr_parts = ARRAY_SIZE(kurobox_pro_nand_parts),
  67. .cle = 0,
  68. .ale = 1,
  69. .width = 8,
  70. };
  71. static struct platform_device kurobox_pro_nand_flash = {
  72. .name = "orion_nand",
  73. .id = -1,
  74. .dev = {
  75. .platform_data = &kurobox_pro_nand_data,
  76. },
  77. .resource = &kurobox_pro_nand_resource,
  78. .num_resources = 1,
  79. };
  80. /*****************************************************************************
  81. * 256KB NOR Flash on BOOT Device
  82. ****************************************************************************/
  83. static struct physmap_flash_data kurobox_pro_nor_flash_data = {
  84. .width = 1,
  85. };
  86. static struct resource kurobox_pro_nor_flash_resource = {
  87. .flags = IORESOURCE_MEM,
  88. .start = KUROBOX_PRO_NOR_BOOT_BASE,
  89. .end = KUROBOX_PRO_NOR_BOOT_BASE + KUROBOX_PRO_NOR_BOOT_SIZE - 1,
  90. };
  91. static struct platform_device kurobox_pro_nor_flash = {
  92. .name = "physmap-flash",
  93. .id = 0,
  94. .dev = {
  95. .platform_data = &kurobox_pro_nor_flash_data,
  96. },
  97. .num_resources = 1,
  98. .resource = &kurobox_pro_nor_flash_resource,
  99. };
  100. /*****************************************************************************
  101. * PCI
  102. ****************************************************************************/
  103. static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  104. {
  105. int irq;
  106. /*
  107. * Check for devices with hard-wired IRQs.
  108. */
  109. irq = orion5x_pci_map_irq(dev, slot, pin);
  110. if (irq != -1)
  111. return irq;
  112. /*
  113. * PCI isn't used on the Kuro
  114. */
  115. printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n");
  116. return -1;
  117. }
  118. static struct hw_pci kurobox_pro_pci __initdata = {
  119. .nr_controllers = 2,
  120. .swizzle = pci_std_swizzle,
  121. .setup = orion5x_pci_sys_setup,
  122. .scan = orion5x_pci_sys_scan_bus,
  123. .map_irq = kurobox_pro_pci_map_irq,
  124. };
  125. static int __init kurobox_pro_pci_init(void)
  126. {
  127. if (machine_is_kurobox_pro())
  128. pci_common_init(&kurobox_pro_pci);
  129. return 0;
  130. }
  131. subsys_initcall(kurobox_pro_pci_init);
  132. /*****************************************************************************
  133. * Ethernet
  134. ****************************************************************************/
  135. static struct mv643xx_eth_platform_data kurobox_pro_eth_data = {
  136. .phy_addr = 8,
  137. .force_phy_addr = 1,
  138. };
  139. /*****************************************************************************
  140. * RTC 5C372a on I2C bus
  141. ****************************************************************************/
  142. static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = {
  143. I2C_BOARD_INFO("rs5c372a", 0x32),
  144. };
  145. /*****************************************************************************
  146. * SATA
  147. ****************************************************************************/
  148. static struct mv_sata_platform_data kurobox_pro_sata_data = {
  149. .n_ports = 2,
  150. };
  151. /*****************************************************************************
  152. * General Setup
  153. ****************************************************************************/
  154. static struct orion5x_mpp_mode kurobox_pro_mpp_modes[] __initdata = {
  155. { 0, MPP_UNUSED },
  156. { 1, MPP_UNUSED },
  157. { 2, MPP_GPIO }, /* GPIO Micon */
  158. { 3, MPP_GPIO }, /* GPIO Rtc */
  159. { 4, MPP_UNUSED },
  160. { 5, MPP_UNUSED },
  161. { 6, MPP_NAND }, /* NAND Flash REn */
  162. { 7, MPP_NAND }, /* NAND Flash WEn */
  163. { 8, MPP_UNUSED },
  164. { 9, MPP_UNUSED },
  165. { 10, MPP_UNUSED },
  166. { 11, MPP_UNUSED },
  167. { 12, MPP_SATA_LED }, /* SATA 0 presence */
  168. { 13, MPP_SATA_LED }, /* SATA 1 presence */
  169. { 14, MPP_SATA_LED }, /* SATA 0 active */
  170. { 15, MPP_SATA_LED }, /* SATA 1 active */
  171. { 16, MPP_UNUSED },
  172. { 17, MPP_UNUSED },
  173. { 18, MPP_UNUSED },
  174. { 19, MPP_UNUSED },
  175. { -1 },
  176. };
  177. static void __init kurobox_pro_init(void)
  178. {
  179. /*
  180. * Setup basic Orion functions. Need to be called early.
  181. */
  182. orion5x_init();
  183. orion5x_mpp_conf(kurobox_pro_mpp_modes);
  184. /*
  185. * Configure peripherals.
  186. */
  187. orion5x_ehci0_init();
  188. orion5x_ehci1_init();
  189. orion5x_eth_init(&kurobox_pro_eth_data);
  190. orion5x_i2c_init();
  191. orion5x_sata_init(&kurobox_pro_sata_data);
  192. orion5x_uart0_init();
  193. orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
  194. KUROBOX_PRO_NOR_BOOT_SIZE);
  195. platform_device_register(&kurobox_pro_nor_flash);
  196. if (machine_is_kurobox_pro()) {
  197. orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE,
  198. KUROBOX_PRO_NAND_SIZE);
  199. platform_device_register(&kurobox_pro_nand_flash);
  200. }
  201. i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
  202. }
  203. #ifdef CONFIG_MACH_KUROBOX_PRO
  204. MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro")
  205. /* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */
  206. .phys_io = ORION5X_REGS_PHYS_BASE,
  207. .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
  208. .boot_params = 0x00000100,
  209. .init_machine = kurobox_pro_init,
  210. .map_io = orion5x_map_io,
  211. .init_irq = orion5x_init_irq,
  212. .timer = &orion5x_timer,
  213. .fixup = tag_fixup_mem32,
  214. MACHINE_END
  215. #endif
  216. #ifdef CONFIG_MACH_LINKSTATION_PRO
  217. MACHINE_START(LINKSTATION_PRO, "Buffalo Linkstation Pro/Live")
  218. /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */
  219. .phys_io = ORION5X_REGS_PHYS_BASE,
  220. .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
  221. .boot_params = 0x00000100,
  222. .init_machine = kurobox_pro_init,
  223. .map_io = orion5x_map_io,
  224. .init_irq = orion5x_init_irq,
  225. .timer = &orion5x_timer,
  226. .fixup = tag_fixup_mem32,
  227. MACHINE_END
  228. #endif