board-h3.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * linux/arch/arm/mach-omap/board-h3.c
  3. *
  4. * This file contains OMAP1710 H3 specific code.
  5. *
  6. * Copyright (C) 2004 Texas Instruments, Inc.
  7. * Copyright (C) 2002 MontaVista Software, Inc.
  8. * Copyright (C) 2001 RidgeRun, Inc.
  9. * Author: RidgeRun, Inc.
  10. * Greg Lonnon (glonnon@ridgerun.com) or info@ridgerun.com
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. #include <linux/config.h>
  17. #include <linux/types.h>
  18. #include <linux/init.h>
  19. #include <linux/major.h>
  20. #include <linux/kernel.h>
  21. #include <linux/device.h>
  22. #include <linux/errno.h>
  23. #include <linux/mtd/mtd.h>
  24. #include <linux/mtd/partitions.h>
  25. #include <asm/setup.h>
  26. #include <asm/page.h>
  27. #include <asm/hardware.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/flash.h>
  31. #include <asm/mach/map.h>
  32. #include <asm/arch/gpio.h>
  33. #include <asm/arch/irqs.h>
  34. #include <asm/arch/mux.h>
  35. #include <asm/arch/tc.h>
  36. #include <asm/arch/usb.h>
  37. #include "common.h"
  38. extern int omap_gpio_init(void);
  39. static int __initdata h3_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
  40. static struct mtd_partition h3_partitions[] = {
  41. /* bootloader (U-Boot, etc) in first sector */
  42. {
  43. .name = "bootloader",
  44. .offset = 0,
  45. .size = SZ_128K,
  46. .mask_flags = MTD_WRITEABLE, /* force read-only */
  47. },
  48. /* bootloader params in the next sector */
  49. {
  50. .name = "params",
  51. .offset = MTDPART_OFS_APPEND,
  52. .size = SZ_128K,
  53. .mask_flags = 0,
  54. },
  55. /* kernel */
  56. {
  57. .name = "kernel",
  58. .offset = MTDPART_OFS_APPEND,
  59. .size = SZ_2M,
  60. .mask_flags = 0
  61. },
  62. /* file system */
  63. {
  64. .name = "filesystem",
  65. .offset = MTDPART_OFS_APPEND,
  66. .size = MTDPART_SIZ_FULL,
  67. .mask_flags = 0
  68. }
  69. };
  70. static struct flash_platform_data h3_flash_data = {
  71. .map_name = "cfi_probe",
  72. .width = 2,
  73. .parts = h3_partitions,
  74. .nr_parts = ARRAY_SIZE(h3_partitions),
  75. };
  76. static struct resource h3_flash_resource = {
  77. .start = OMAP_CS2B_PHYS,
  78. .end = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
  79. .flags = IORESOURCE_MEM,
  80. };
  81. static struct platform_device flash_device = {
  82. .name = "omapflash",
  83. .id = 0,
  84. .dev = {
  85. .platform_data = &h3_flash_data,
  86. },
  87. .num_resources = 1,
  88. .resource = &h3_flash_resource,
  89. };
  90. static struct resource smc91x_resources[] = {
  91. [0] = {
  92. .start = OMAP1710_ETHR_START, /* Physical */
  93. .end = OMAP1710_ETHR_START + 0xf,
  94. .flags = IORESOURCE_MEM,
  95. },
  96. [1] = {
  97. .start = OMAP_GPIO_IRQ(40),
  98. .end = OMAP_GPIO_IRQ(40),
  99. .flags = IORESOURCE_IRQ,
  100. },
  101. };
  102. static struct platform_device smc91x_device = {
  103. .name = "smc91x",
  104. .id = 0,
  105. .num_resources = ARRAY_SIZE(smc91x_resources),
  106. .resource = smc91x_resources,
  107. };
  108. #define GPTIMER_BASE 0xFFFB1400
  109. #define GPTIMER_REGS(x) (0xFFFB1400 + (x * 0x800))
  110. #define GPTIMER_REGS_SIZE 0x46
  111. static struct resource intlat_resources[] = {
  112. [0] = {
  113. .start = GPTIMER_REGS(0), /* Physical */
  114. .end = GPTIMER_REGS(0) + GPTIMER_REGS_SIZE,
  115. .flags = IORESOURCE_MEM,
  116. },
  117. [1] = {
  118. .start = INT_1610_GPTIMER1,
  119. .end = INT_1610_GPTIMER1,
  120. .flags = IORESOURCE_IRQ,
  121. },
  122. };
  123. static struct platform_device intlat_device = {
  124. .name = "omap_intlat",
  125. .id = 0,
  126. .num_resources = ARRAY_SIZE(intlat_resources),
  127. .resource = intlat_resources,
  128. };
  129. static struct platform_device *devices[] __initdata = {
  130. &flash_device,
  131. &smc91x_device,
  132. &intlat_device,
  133. };
  134. static struct omap_usb_config h3_usb_config __initdata = {
  135. /* usb1 has a Mini-AB port and external isp1301 transceiver */
  136. .otg = 2,
  137. #ifdef CONFIG_USB_GADGET_OMAP
  138. .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */
  139. #elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  140. /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
  141. .hmc_mode = 20, /* 1:dev|otg(off) 1:host 2:disabled */
  142. #endif
  143. .pins[1] = 3,
  144. };
  145. static struct omap_board_config_kernel h3_config[] = {
  146. { OMAP_TAG_USB, &h3_usb_config },
  147. };
  148. static void __init h3_init(void)
  149. {
  150. (void) platform_add_devices(devices, ARRAY_SIZE(devices));
  151. }
  152. static void __init h3_init_smc91x(void)
  153. {
  154. omap_cfg_reg(W15_1710_GPIO40);
  155. if (omap_request_gpio(40) < 0) {
  156. printk("Error requesting gpio 40 for smc91x irq\n");
  157. return;
  158. }
  159. omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE);
  160. }
  161. void h3_init_irq(void)
  162. {
  163. omap_init_irq();
  164. omap_gpio_init();
  165. h3_init_smc91x();
  166. }
  167. static void __init h3_map_io(void)
  168. {
  169. omap_map_io();
  170. omap_serial_init(h3_serial_ports);
  171. }
  172. MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
  173. /* Maintainer: Texas Instruments, Inc. */
  174. .phys_ram = 0x10000000,
  175. .phys_io = 0xfff00000,
  176. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  177. .boot_params = 0x10000100,
  178. .map_io = h3_map_io,
  179. .init_irq = h3_init_irq,
  180. .init_machine = h3_init,
  181. .timer = &omap_timer,
  182. MACHINE_END