kurobox_pro-setup.c 6.9 KB

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