kurobox_pro-setup.c 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /*
  2. * arch/arm/mach-orion/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/orion.h>
  25. #include <asm/arch/platform.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. /*
  107. * PCI isn't used on the Kuro
  108. */
  109. if (dev->bus->number == orion_pcie_local_bus_nr())
  110. return IRQ_ORION_PCIE0_INT;
  111. else
  112. printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n");
  113. return -1;
  114. }
  115. static struct hw_pci kurobox_pro_pci __initdata = {
  116. .nr_controllers = 1,
  117. .swizzle = pci_std_swizzle,
  118. .setup = orion_pci_sys_setup,
  119. .scan = orion_pci_sys_scan_bus,
  120. .map_irq = kurobox_pro_pci_map_irq,
  121. };
  122. static int __init kurobox_pro_pci_init(void)
  123. {
  124. if (machine_is_kurobox_pro())
  125. pci_common_init(&kurobox_pro_pci);
  126. return 0;
  127. }
  128. subsys_initcall(kurobox_pro_pci_init);
  129. /*****************************************************************************
  130. * Ethernet
  131. ****************************************************************************/
  132. static struct mv643xx_eth_platform_data kurobox_pro_eth_data = {
  133. .phy_addr = 8,
  134. .force_phy_addr = 1,
  135. };
  136. /*****************************************************************************
  137. * RTC 5C372a on I2C bus
  138. ****************************************************************************/
  139. static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = {
  140. .driver_name = "rtc-rs5c372",
  141. .type = "rs5c372a",
  142. .addr = 0x32,
  143. };
  144. /*****************************************************************************
  145. * SATA
  146. ****************************************************************************/
  147. static struct mv_sata_platform_data kurobox_pro_sata_data = {
  148. .n_ports = 2,
  149. };
  150. /*****************************************************************************
  151. * General Setup
  152. ****************************************************************************/
  153. static struct platform_device *kurobox_pro_devices[] __initdata = {
  154. &kurobox_pro_nor_flash,
  155. &kurobox_pro_nand_flash,
  156. };
  157. static void __init kurobox_pro_init(void)
  158. {
  159. /*
  160. * Setup basic Orion functions. Need to be called early.
  161. */
  162. orion_init();
  163. /*
  164. * Setup the CPU address decode windows for our devices
  165. */
  166. orion_setup_cpu_win(ORION_DEV_BOOT, KUROBOX_PRO_NOR_BOOT_BASE,
  167. KUROBOX_PRO_NOR_BOOT_SIZE, -1);
  168. orion_setup_cpu_win(ORION_DEV0, KUROBOX_PRO_NAND_BASE,
  169. KUROBOX_PRO_NAND_SIZE, -1);
  170. /*
  171. * Open a special address decode windows for the PCIE WA.
  172. */
  173. orion_write(ORION_REGS_VIRT_BASE | 0x20074, ORION_PCIE_WA_PHYS_BASE);
  174. orion_write(ORION_REGS_VIRT_BASE | 0x20070, (0x7941 |
  175. (((ORION_PCIE_WA_SIZE >> 16) - 1)) << 16));
  176. /*
  177. * Setup Multiplexing Pins --
  178. * MPP[0-1] Not used
  179. * MPP[2] GPIO Micon
  180. * MPP[3] GPIO RTC
  181. * MPP[4-5] Not used
  182. * MPP[6] Nand Flash REn
  183. * MPP[7] Nand Flash WEn
  184. * MPP[8-11] Not used
  185. * MPP[12] SATA 0 presence Indication
  186. * MPP[13] SATA 1 presence Indication
  187. * MPP[14] SATA 0 active Indication
  188. * MPP[15] SATA 1 active indication
  189. * MPP[16-19] Not used
  190. */
  191. orion_write(MPP_0_7_CTRL, 0x44220003);
  192. orion_write(MPP_8_15_CTRL, 0x55550000);
  193. orion_write(MPP_16_19_CTRL, 0x0);
  194. orion_gpio_set_valid_pins(0x0000000c);
  195. platform_add_devices(kurobox_pro_devices, ARRAY_SIZE(kurobox_pro_devices));
  196. i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
  197. orion_eth_init(&kurobox_pro_eth_data);
  198. orion_sata_init(&kurobox_pro_sata_data);
  199. }
  200. MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro")
  201. /* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */
  202. .phys_io = ORION_REGS_PHYS_BASE,
  203. .io_pg_offst = ((ORION_REGS_VIRT_BASE) >> 18) & 0xFFFC,
  204. .boot_params = 0x00000100,
  205. .init_machine = kurobox_pro_init,
  206. .map_io = orion_map_io,
  207. .init_irq = orion_init_irq,
  208. .timer = &orion_timer,
  209. MACHINE_END