board-perseus2.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * linux/arch/arm/mach-omap/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/gpio.h>
  25. #include <asm/arch/mux.h>
  26. #include <asm/arch/fpga.h>
  27. #include "common.h"
  28. static struct resource smc91x_resources[] = {
  29. [0] = {
  30. .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */
  31. .end = H2P2_DBG_FPGA_ETHR_START + 0xf,
  32. .flags = IORESOURCE_MEM,
  33. },
  34. [1] = {
  35. .start = INT_730_MPU_EXT_NIRQ,
  36. .end = 0,
  37. .flags = IORESOURCE_IRQ,
  38. },
  39. };
  40. static int __initdata p2_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 0};
  41. static struct mtd_partition p2_partitions[] = {
  42. /* bootloader (U-Boot, etc) in first sector */
  43. {
  44. .name = "bootloader",
  45. .offset = 0,
  46. .size = SZ_128K,
  47. .mask_flags = MTD_WRITEABLE, /* force read-only */
  48. },
  49. /* bootloader params in the next sector */
  50. {
  51. .name = "params",
  52. .offset = MTDPART_OFS_APPEND,
  53. .size = SZ_128K,
  54. .mask_flags = 0,
  55. },
  56. /* kernel */
  57. {
  58. .name = "kernel",
  59. .offset = MTDPART_OFS_APPEND,
  60. .size = SZ_2M,
  61. .mask_flags = 0
  62. },
  63. /* rest of flash is a file system */
  64. {
  65. .name = "rootfs",
  66. .offset = MTDPART_OFS_APPEND,
  67. .size = MTDPART_SIZ_FULL,
  68. .mask_flags = 0
  69. },
  70. };
  71. static struct flash_platform_data p2_flash_data = {
  72. .map_name = "cfi_probe",
  73. .width = 2,
  74. .parts = p2_partitions,
  75. .nr_parts = ARRAY_SIZE(p2_partitions),
  76. };
  77. static struct resource p2_flash_resource = {
  78. .start = OMAP_FLASH_0_START,
  79. .end = OMAP_FLASH_0_START + OMAP_FLASH_0_SIZE - 1,
  80. .flags = IORESOURCE_MEM,
  81. };
  82. static struct platform_device p2_flash_device = {
  83. .name = "omapflash",
  84. .id = 0,
  85. .dev = {
  86. .platform_data = &p2_flash_data,
  87. },
  88. .num_resources = 1,
  89. .resource = &p2_flash_resource,
  90. };
  91. static struct platform_device smc91x_device = {
  92. .name = "smc91x",
  93. .id = 0,
  94. .num_resources = ARRAY_SIZE(smc91x_resources),
  95. .resource = smc91x_resources,
  96. };
  97. static struct platform_device *devices[] __initdata = {
  98. &p2_flash_device,
  99. &smc91x_device,
  100. };
  101. static void __init omap_perseus2_init(void)
  102. {
  103. (void) platform_add_devices(devices, ARRAY_SIZE(devices));
  104. }
  105. static void __init perseus2_init_smc91x(void)
  106. {
  107. fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
  108. mdelay(50);
  109. fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
  110. H2P2_DBG_FPGA_LAN_RESET);
  111. mdelay(50);
  112. }
  113. void omap_perseus2_init_irq(void)
  114. {
  115. omap_init_irq();
  116. omap_gpio_init();
  117. perseus2_init_smc91x();
  118. }
  119. /* Only FPGA needs to be mapped here. All others are done with ioremap */
  120. static struct map_desc omap_perseus2_io_desc[] __initdata = {
  121. {H2P2_DBG_FPGA_BASE, H2P2_DBG_FPGA_START, H2P2_DBG_FPGA_SIZE,
  122. MT_DEVICE},
  123. };
  124. static void __init omap_perseus2_map_io(void)
  125. {
  126. omap_map_io();
  127. iotable_init(omap_perseus2_io_desc,
  128. ARRAY_SIZE(omap_perseus2_io_desc));
  129. /* Early, board-dependent init */
  130. /*
  131. * Hold GSM Reset until needed
  132. */
  133. omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
  134. /*
  135. * UARTs -> done automagically by 8250 driver
  136. */
  137. /*
  138. * CSx timings, GPIO Mux ... setup
  139. */
  140. /* Flash: CS0 timings setup */
  141. omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
  142. omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
  143. /*
  144. * Ethernet support trough the debug board
  145. * CS1 timings setup
  146. */
  147. omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
  148. omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
  149. /*
  150. * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
  151. * It is used as the Ethernet controller interrupt
  152. */
  153. omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
  154. omap_serial_init(p2_serial_ports);
  155. }
  156. MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
  157. MAINTAINER("Kevin Hilman <kjh@hilman.org>")
  158. BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
  159. BOOT_PARAMS(0x10000100)
  160. MAPIO(omap_perseus2_map_io)
  161. INITIRQ(omap_perseus2_init_irq)
  162. INIT_MACHINE(omap_perseus2_init)
  163. .timer = &omap_timer,
  164. MACHINE_END