kurobox_pro-setup.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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 <asm/mach-types.h>
  20. #include <asm/gpio.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/pci.h>
  23. #include <asm/arch/orion.h>
  24. #include <asm/arch/platform.h>
  25. #include "common.h"
  26. /*****************************************************************************
  27. * KUROBOX-PRO Info
  28. ****************************************************************************/
  29. /*
  30. * 256K NOR flash Device bus boot chip select
  31. */
  32. #define KUROBOX_PRO_NOR_BOOT_BASE 0xf4000000
  33. #define KUROBOX_PRO_NOR_BOOT_SIZE SZ_256K
  34. /*
  35. * 256M NAND flash on Device bus chip select 1
  36. */
  37. #define KUROBOX_PRO_NAND_BASE 0xfc000000
  38. #define KUROBOX_PRO_NAND_SIZE SZ_2M
  39. /*****************************************************************************
  40. * 256MB NAND Flash on Device bus CS0
  41. ****************************************************************************/
  42. static struct mtd_partition kurobox_pro_nand_parts[] = {
  43. {
  44. .name = "uImage",
  45. .offset = 0,
  46. .size = SZ_4M,
  47. },
  48. {
  49. .name = "rootfs",
  50. .offset = SZ_4M,
  51. .size = SZ_64M,
  52. },
  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. /*
  106. * PCI isn't used on the Kuro
  107. */
  108. if (dev->bus->number == orion_pcie_local_bus_nr())
  109. return IRQ_ORION_PCIE0_INT;
  110. else
  111. printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n");
  112. return -1;
  113. }
  114. static struct hw_pci kurobox_pro_pci __initdata = {
  115. .nr_controllers = 1,
  116. .swizzle = pci_std_swizzle,
  117. .setup = orion_pci_sys_setup,
  118. .scan = orion_pci_sys_scan_bus,
  119. .map_irq = kurobox_pro_pci_map_irq,
  120. };
  121. static int __init kurobox_pro_pci_init(void)
  122. {
  123. if (machine_is_kurobox_pro())
  124. pci_common_init(&kurobox_pro_pci);
  125. return 0;
  126. }
  127. subsys_initcall(kurobox_pro_pci_init);
  128. /*****************************************************************************
  129. * Ethernet
  130. ****************************************************************************/
  131. static struct mv643xx_eth_platform_data kurobox_pro_eth_data = {
  132. .phy_addr = 8,
  133. .force_phy_addr = 1,
  134. };
  135. /*****************************************************************************
  136. * RTC 5C372a on I2C bus
  137. ****************************************************************************/
  138. static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = {
  139. .driver_name = "rtc-rs5c372",
  140. .type = "rs5c372a",
  141. .addr = 0x32,
  142. };
  143. /*****************************************************************************
  144. * General Setup
  145. ****************************************************************************/
  146. static struct platform_device *kurobox_pro_devices[] __initdata = {
  147. &kurobox_pro_nor_flash,
  148. &kurobox_pro_nand_flash,
  149. };
  150. static void __init kurobox_pro_init(void)
  151. {
  152. /*
  153. * Setup basic Orion functions. Need to be called early.
  154. */
  155. orion_init();
  156. /*
  157. * Setup the CPU address decode windows for our devices
  158. */
  159. orion_setup_cpu_win(ORION_DEV_BOOT, KUROBOX_PRO_NOR_BOOT_BASE,
  160. KUROBOX_PRO_NOR_BOOT_SIZE, -1);
  161. orion_setup_cpu_win(ORION_DEV0, KUROBOX_PRO_NAND_BASE,
  162. KUROBOX_PRO_NAND_SIZE, -1);
  163. /*
  164. * Open a special address decode windows for the PCIE WA.
  165. */
  166. orion_write(ORION_REGS_BASE | 0x20074, ORION_PCIE_WA_BASE);
  167. orion_write(ORION_REGS_BASE | 0x20070, (0x7941 |
  168. (((ORION_PCIE_WA_SIZE >> 16) - 1)) << 16));
  169. /*
  170. * Setup Multiplexing Pins --
  171. * MPP[0-1] Not used
  172. * MPP[2] GPIO Micon
  173. * MPP[3] GPIO RTC
  174. * MPP[4-5] Not used
  175. * MPP[6] Nand Flash REn
  176. * MPP[7] Nand Flash WEn
  177. * MPP[8-11] Not used
  178. * MPP[12] SATA 0 presence Indication
  179. * MPP[13] SATA 1 presence Indication
  180. * MPP[14] SATA 0 active Indication
  181. * MPP[15] SATA 1 active indication
  182. * MPP[16-19] Not used
  183. */
  184. orion_write(MPP_0_7_CTRL, 0x44220003);
  185. orion_write(MPP_8_15_CTRL, 0x55550000);
  186. orion_write(MPP_16_19_CTRL, 0x0);
  187. orion_gpio_set_valid_pins(0x0000000c);
  188. platform_add_devices(kurobox_pro_devices, ARRAY_SIZE(kurobox_pro_devices));
  189. i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
  190. orion_eth_init(&kurobox_pro_eth_data);
  191. }
  192. MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro")
  193. /* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */
  194. .phys_io = ORION_REGS_BASE,
  195. .io_pg_offst = ((ORION_REGS_BASE) >> 18) & 0xFFFC,
  196. .boot_params = 0x00000100,
  197. .init_machine = kurobox_pro_init,
  198. .map_io = orion_map_io,
  199. .init_irq = orion_init_irq,
  200. .timer = &orion_timer,
  201. MACHINE_END