board-perseus2.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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/platform_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. #include <asm/arch/board.h>
  30. static struct resource smc91x_resources[] = {
  31. [0] = {
  32. .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */
  33. .end = H2P2_DBG_FPGA_ETHR_START + 0xf,
  34. .flags = IORESOURCE_MEM,
  35. },
  36. [1] = {
  37. .start = INT_730_MPU_EXT_NIRQ,
  38. .end = 0,
  39. .flags = IORESOURCE_IRQ,
  40. },
  41. };
  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 struct omap_uart_config perseus2_uart_config __initdata = {
  103. .enabled_uarts = ((1 << 0) | (1 << 1)),
  104. };
  105. static struct omap_lcd_config perseus2_lcd_config __initdata = {
  106. .panel_name = "p2",
  107. .ctrl_name = "internal",
  108. };
  109. static struct omap_board_config_kernel perseus2_config[] = {
  110. { OMAP_TAG_UART, &perseus2_uart_config },
  111. { OMAP_TAG_LCD, &perseus2_lcd_config },
  112. };
  113. static void __init omap_perseus2_init(void)
  114. {
  115. (void) platform_add_devices(devices, ARRAY_SIZE(devices));
  116. omap_board_config = perseus2_config;
  117. omap_board_config_size = ARRAY_SIZE(perseus2_config);
  118. omap_serial_init();
  119. }
  120. static void __init perseus2_init_smc91x(void)
  121. {
  122. fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
  123. mdelay(50);
  124. fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
  125. H2P2_DBG_FPGA_LAN_RESET);
  126. mdelay(50);
  127. }
  128. void omap_perseus2_init_irq(void)
  129. {
  130. omap_init_irq();
  131. omap_gpio_init();
  132. perseus2_init_smc91x();
  133. }
  134. /* Only FPGA needs to be mapped here. All others are done with ioremap */
  135. static struct map_desc omap_perseus2_io_desc[] __initdata = {
  136. {
  137. .virtual = H2P2_DBG_FPGA_BASE,
  138. .pfn = __phys_to_pfn(H2P2_DBG_FPGA_START),
  139. .length = H2P2_DBG_FPGA_SIZE,
  140. .type = MT_DEVICE
  141. }
  142. };
  143. static void __init omap_perseus2_map_io(void)
  144. {
  145. omap_map_common_io();
  146. iotable_init(omap_perseus2_io_desc,
  147. ARRAY_SIZE(omap_perseus2_io_desc));
  148. /* Early, board-dependent init */
  149. /*
  150. * Hold GSM Reset until needed
  151. */
  152. omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
  153. /*
  154. * UARTs -> done automagically by 8250 driver
  155. */
  156. /*
  157. * CSx timings, GPIO Mux ... setup
  158. */
  159. /* Flash: CS0 timings setup */
  160. omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
  161. omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
  162. /*
  163. * Ethernet support through the debug board
  164. * CS1 timings setup
  165. */
  166. omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
  167. omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
  168. /*
  169. * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
  170. * It is used as the Ethernet controller interrupt
  171. */
  172. omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
  173. }
  174. MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
  175. /* Maintainer: Kevin Hilman <kjh@hilman.org> */
  176. .phys_io = 0xfff00000,
  177. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  178. .boot_params = 0x10000100,
  179. .map_io = omap_perseus2_map_io,
  180. .init_irq = omap_perseus2_init_irq,
  181. .init_machine = omap_perseus2_init,
  182. .timer = &omap_timer,
  183. MACHINE_END