board-perseus2.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * linux/arch/arm/mach-omap1/board-perseus2.c
  3. *
  4. * Modified from board-generic.c
  5. *
  6. * Original OMAP730 support by Jean Pihet <j-pihet@ti.com>
  7. * Updated for 2.6 by Kevin Hilman <kjh@hilman.org>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/device.h>
  16. #include <linux/delay.h>
  17. #include <linux/mtd/mtd.h>
  18. #include <linux/mtd/partitions.h>
  19. #include <asm/hardware.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/flash.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/arch/tc.h>
  25. #include <asm/arch/gpio.h>
  26. #include <asm/arch/mux.h>
  27. #include <asm/arch/fpga.h>
  28. #include <asm/arch/common.h>
  29. static struct resource smc91x_resources[] = {
  30. [0] = {
  31. .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */
  32. .end = H2P2_DBG_FPGA_ETHR_START + 0xf,
  33. .flags = IORESOURCE_MEM,
  34. },
  35. [1] = {
  36. .start = INT_730_MPU_EXT_NIRQ,
  37. .end = 0,
  38. .flags = IORESOURCE_IRQ,
  39. },
  40. };
  41. static int __initdata p2_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 0};
  42. static struct mtd_partition p2_partitions[] = {
  43. /* bootloader (U-Boot, etc) in first sector */
  44. {
  45. .name = "bootloader",
  46. .offset = 0,
  47. .size = SZ_128K,
  48. .mask_flags = MTD_WRITEABLE, /* force read-only */
  49. },
  50. /* bootloader params in the next sector */
  51. {
  52. .name = "params",
  53. .offset = MTDPART_OFS_APPEND,
  54. .size = SZ_128K,
  55. .mask_flags = 0,
  56. },
  57. /* kernel */
  58. {
  59. .name = "kernel",
  60. .offset = MTDPART_OFS_APPEND,
  61. .size = SZ_2M,
  62. .mask_flags = 0
  63. },
  64. /* rest of flash is a file system */
  65. {
  66. .name = "rootfs",
  67. .offset = MTDPART_OFS_APPEND,
  68. .size = MTDPART_SIZ_FULL,
  69. .mask_flags = 0
  70. },
  71. };
  72. static struct flash_platform_data p2_flash_data = {
  73. .map_name = "cfi_probe",
  74. .width = 2,
  75. .parts = p2_partitions,
  76. .nr_parts = ARRAY_SIZE(p2_partitions),
  77. };
  78. static struct resource p2_flash_resource = {
  79. .start = OMAP_CS0_PHYS,
  80. .end = OMAP_CS0_PHYS + SZ_32M - 1,
  81. .flags = IORESOURCE_MEM,
  82. };
  83. static struct platform_device p2_flash_device = {
  84. .name = "omapflash",
  85. .id = 0,
  86. .dev = {
  87. .platform_data = &p2_flash_data,
  88. },
  89. .num_resources = 1,
  90. .resource = &p2_flash_resource,
  91. };
  92. static struct platform_device smc91x_device = {
  93. .name = "smc91x",
  94. .id = 0,
  95. .num_resources = ARRAY_SIZE(smc91x_resources),
  96. .resource = smc91x_resources,
  97. };
  98. static struct platform_device *devices[] __initdata = {
  99. &p2_flash_device,
  100. &smc91x_device,
  101. };
  102. static void __init omap_perseus2_init(void)
  103. {
  104. (void) platform_add_devices(devices, ARRAY_SIZE(devices));
  105. }
  106. static void __init perseus2_init_smc91x(void)
  107. {
  108. fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
  109. mdelay(50);
  110. fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
  111. H2P2_DBG_FPGA_LAN_RESET);
  112. mdelay(50);
  113. }
  114. void omap_perseus2_init_irq(void)
  115. {
  116. omap_init_irq();
  117. omap_gpio_init();
  118. perseus2_init_smc91x();
  119. }
  120. /* Only FPGA needs to be mapped here. All others are done with ioremap */
  121. static struct map_desc omap_perseus2_io_desc[] __initdata = {
  122. {H2P2_DBG_FPGA_BASE, H2P2_DBG_FPGA_START, H2P2_DBG_FPGA_SIZE,
  123. MT_DEVICE},
  124. };
  125. static void __init omap_perseus2_map_io(void)
  126. {
  127. omap_map_common_io();
  128. iotable_init(omap_perseus2_io_desc,
  129. ARRAY_SIZE(omap_perseus2_io_desc));
  130. /* Early, board-dependent init */
  131. /*
  132. * Hold GSM Reset until needed
  133. */
  134. omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
  135. /*
  136. * UARTs -> done automagically by 8250 driver
  137. */
  138. /*
  139. * CSx timings, GPIO Mux ... setup
  140. */
  141. /* Flash: CS0 timings setup */
  142. omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
  143. omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
  144. /*
  145. * Ethernet support trough the debug board
  146. * CS1 timings setup
  147. */
  148. omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
  149. omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
  150. /*
  151. * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
  152. * It is used as the Ethernet controller interrupt
  153. */
  154. omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
  155. omap_serial_init(p2_serial_ports);
  156. }
  157. MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
  158. /* Maintainer: Kevin Hilman <kjh@hilman.org> */
  159. .phys_ram = 0x10000000,
  160. .phys_io = 0xfff00000,
  161. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  162. .boot_params = 0x10000100,
  163. .map_io = omap_perseus2_map_io,
  164. .init_irq = omap_perseus2_init_irq,
  165. .init_machine = omap_perseus2_init,
  166. .timer = &omap_timer,
  167. MACHINE_END