board-h4.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * linux/arch/arm/mach-omap/omap2/board-h4.c
  3. *
  4. * Copyright (C) 2005 Nokia Corporation
  5. * Author: Paul Mundt <paul.mundt@nokia.com>
  6. *
  7. * Modified from mach-omap/omap1/board-generic.c
  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/mtd/mtd.h>
  17. #include <linux/mtd/partitions.h>
  18. #include <linux/delay.h>
  19. #include <asm/hardware.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/map.h>
  23. #include <asm/mach/flash.h>
  24. #include <asm/arch/gpio.h>
  25. #include <asm/arch/mux.h>
  26. #include <asm/arch/usb.h>
  27. #include <asm/arch/board.h>
  28. #include <asm/arch/common.h>
  29. #include <asm/arch/prcm.h>
  30. #include <asm/io.h>
  31. #include <asm/delay.h>
  32. static struct mtd_partition h4_partitions[] = {
  33. /* bootloader (U-Boot, etc) in first sector */
  34. {
  35. .name = "bootloader",
  36. .offset = 0,
  37. .size = SZ_128K,
  38. .mask_flags = MTD_WRITEABLE, /* force read-only */
  39. },
  40. /* bootloader params in the next sector */
  41. {
  42. .name = "params",
  43. .offset = MTDPART_OFS_APPEND,
  44. .size = SZ_128K,
  45. .mask_flags = 0,
  46. },
  47. /* kernel */
  48. {
  49. .name = "kernel",
  50. .offset = MTDPART_OFS_APPEND,
  51. .size = SZ_2M,
  52. .mask_flags = 0
  53. },
  54. /* file system */
  55. {
  56. .name = "filesystem",
  57. .offset = MTDPART_OFS_APPEND,
  58. .size = MTDPART_SIZ_FULL,
  59. .mask_flags = 0
  60. }
  61. };
  62. static struct flash_platform_data h4_flash_data = {
  63. .map_name = "cfi_probe",
  64. .width = 2,
  65. .parts = h4_partitions,
  66. .nr_parts = ARRAY_SIZE(h4_partitions),
  67. };
  68. static struct resource h4_flash_resource = {
  69. .start = H4_CS0_BASE,
  70. .end = H4_CS0_BASE + SZ_64M - 1,
  71. .flags = IORESOURCE_MEM,
  72. };
  73. static struct platform_device h4_flash_device = {
  74. .name = "omapflash",
  75. .id = 0,
  76. .dev = {
  77. .platform_data = &h4_flash_data,
  78. },
  79. .num_resources = 1,
  80. .resource = &h4_flash_resource,
  81. };
  82. static struct resource h4_smc91x_resources[] = {
  83. [0] = {
  84. .start = OMAP24XX_ETHR_START, /* Physical */
  85. .end = OMAP24XX_ETHR_START + 0xf,
  86. .flags = IORESOURCE_MEM,
  87. },
  88. [1] = {
  89. .start = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
  90. .end = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
  91. .flags = IORESOURCE_IRQ,
  92. },
  93. };
  94. static struct platform_device h4_smc91x_device = {
  95. .name = "smc91x",
  96. .id = -1,
  97. .num_resources = ARRAY_SIZE(h4_smc91x_resources),
  98. .resource = h4_smc91x_resources,
  99. };
  100. static struct platform_device *h4_devices[] __initdata = {
  101. &h4_smc91x_device,
  102. &h4_flash_device,
  103. };
  104. static inline void __init h4_init_smc91x(void)
  105. {
  106. /* Make sure CS1 timings are correct */
  107. GPMC_CONFIG1_1 = 0x00011200;
  108. GPMC_CONFIG2_1 = 0x001f1f01;
  109. GPMC_CONFIG3_1 = 0x00080803;
  110. GPMC_CONFIG4_1 = 0x1c091c09;
  111. GPMC_CONFIG5_1 = 0x041f1f1f;
  112. GPMC_CONFIG6_1 = 0x000004c4;
  113. GPMC_CONFIG7_1 = 0x00000f40 | (0x08000000 >> 24);
  114. udelay(100);
  115. omap_cfg_reg(M15_24XX_GPIO92);
  116. if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) {
  117. printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
  118. OMAP24XX_ETHR_GPIO_IRQ);
  119. return;
  120. }
  121. omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1);
  122. }
  123. static void __init omap_h4_init_irq(void)
  124. {
  125. omap_init_irq();
  126. omap_gpio_init();
  127. h4_init_smc91x();
  128. }
  129. static struct omap_uart_config h4_uart_config __initdata = {
  130. .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
  131. };
  132. static struct omap_mmc_config h4_mmc_config __initdata = {
  133. .mmc [0] = {
  134. .enabled = 1,
  135. .wire4 = 1,
  136. .wp_pin = -1,
  137. .power_pin = -1,
  138. .switch_pin = -1,
  139. },
  140. };
  141. static struct omap_lcd_config h4_lcd_config __initdata = {
  142. .panel_name = "h4",
  143. .ctrl_name = "internal",
  144. };
  145. static struct omap_board_config_kernel h4_config[] = {
  146. { OMAP_TAG_UART, &h4_uart_config },
  147. { OMAP_TAG_MMC, &h4_mmc_config },
  148. { OMAP_TAG_LCD, &h4_lcd_config },
  149. };
  150. static void __init omap_h4_init(void)
  151. {
  152. /*
  153. * Make sure the serial ports are muxed on at this point.
  154. * You have to mux them off in device drivers later on
  155. * if not needed.
  156. */
  157. platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
  158. omap_board_config = h4_config;
  159. omap_board_config_size = ARRAY_SIZE(h4_config);
  160. omap_serial_init();
  161. }
  162. static void __init omap_h4_map_io(void)
  163. {
  164. omap_map_common_io();
  165. }
  166. MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
  167. /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
  168. .phys_io = 0x48000000,
  169. .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
  170. .boot_params = 0x80000100,
  171. .map_io = omap_h4_map_io,
  172. .init_irq = omap_h4_init_irq,
  173. .init_machine = omap_h4_init,
  174. .timer = &omap_timer,
  175. MACHINE_END