board-osk.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * linux/arch/arm/mach-omap/board-osk.c
  3. *
  4. * Board specific init for OMAP5912 OSK
  5. *
  6. * Written by Dirk Behme <dirk.behme@de.bosch.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  14. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  16. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  17. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  18. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  20. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  22. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. *
  24. * You should have received a copy of the GNU General Public License along
  25. * with this program; if not, write to the Free Software Foundation, Inc.,
  26. * 675 Mass Ave, Cambridge, MA 02139, USA.
  27. */
  28. #include <linux/kernel.h>
  29. #include <linux/init.h>
  30. #include <linux/device.h>
  31. #include <asm/hardware.h>
  32. #include <asm/mach-types.h>
  33. #include <asm/mach/arch.h>
  34. #include <asm/mach/map.h>
  35. #include <asm/arch/gpio.h>
  36. #include <asm/arch/usb.h>
  37. #include <asm/arch/mux.h>
  38. #include <asm/arch/tc.h>
  39. #include "common.h"
  40. static struct map_desc osk5912_io_desc[] __initdata = {
  41. { OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
  42. MT_DEVICE },
  43. };
  44. static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
  45. static struct resource osk5912_smc91x_resources[] = {
  46. [0] = {
  47. .start = OMAP_OSK_ETHR_START, /* Physical */
  48. .end = OMAP_OSK_ETHR_START + 0xf,
  49. .flags = IORESOURCE_MEM,
  50. },
  51. [1] = {
  52. .start = OMAP_GPIO_IRQ(0),
  53. .end = OMAP_GPIO_IRQ(0),
  54. .flags = IORESOURCE_IRQ,
  55. },
  56. };
  57. static struct platform_device osk5912_smc91x_device = {
  58. .name = "smc91x",
  59. .id = -1,
  60. .num_resources = ARRAY_SIZE(osk5912_smc91x_resources),
  61. .resource = osk5912_smc91x_resources,
  62. };
  63. static struct resource osk5912_cf_resources[] = {
  64. [0] = {
  65. .start = OMAP_GPIO_IRQ(62),
  66. .end = OMAP_GPIO_IRQ(62),
  67. .flags = IORESOURCE_IRQ,
  68. },
  69. };
  70. static struct platform_device osk5912_cf_device = {
  71. .name = "omap_cf",
  72. .id = -1,
  73. .dev = {
  74. .platform_data = (void *) 2 /* CS2 */,
  75. },
  76. .num_resources = ARRAY_SIZE(osk5912_cf_resources),
  77. .resource = osk5912_cf_resources,
  78. };
  79. static struct platform_device *osk5912_devices[] __initdata = {
  80. &osk5912_smc91x_device,
  81. &osk5912_cf_device,
  82. };
  83. static void __init osk_init_smc91x(void)
  84. {
  85. if ((omap_request_gpio(0)) < 0) {
  86. printk("Error requesting gpio 0 for smc91x irq\n");
  87. return;
  88. }
  89. omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
  90. /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
  91. EMIFS_CCS(1) |= 0x2;
  92. }
  93. static void __init osk_init_cf(void)
  94. {
  95. omap_cfg_reg(M7_1610_GPIO62);
  96. if ((omap_request_gpio(62)) < 0) {
  97. printk("Error requesting gpio 62 for CF irq\n");
  98. return;
  99. }
  100. /* it's really active-low */
  101. omap_set_gpio_edge_ctrl(62, OMAP_GPIO_FALLING_EDGE);
  102. }
  103. void osk_init_irq(void)
  104. {
  105. omap_init_irq();
  106. omap_gpio_init();
  107. osk_init_smc91x();
  108. osk_init_cf();
  109. }
  110. static struct omap_usb_config osk_usb_config __initdata = {
  111. /* has usb host connector (A) ... for development it can also
  112. * be used, with a NONSTANDARD gender-bending cable/dongle, as
  113. * a peripheral.
  114. */
  115. #ifdef CONFIG_USB_GADGET_OMAP
  116. .register_dev = 1,
  117. .hmc_mode = 0,
  118. #else
  119. .register_host = 1,
  120. .hmc_mode = 16,
  121. .rwc = 1,
  122. #endif
  123. .pins[0] = 2,
  124. };
  125. static struct omap_board_config_kernel osk_config[] = {
  126. { OMAP_TAG_USB, &osk_usb_config },
  127. };
  128. static void __init osk_init(void)
  129. {
  130. platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
  131. omap_board_config = osk_config;
  132. omap_board_config_size = ARRAY_SIZE(osk_config);
  133. USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
  134. }
  135. static void __init osk_map_io(void)
  136. {
  137. omap_map_io();
  138. iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
  139. omap_serial_init(osk_serial_ports);
  140. }
  141. MACHINE_START(OMAP_OSK, "TI-OSK")
  142. /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
  143. .phys_ram = 0x10000000,
  144. .phys_io = 0xfff00000,
  145. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  146. .boot_params = 0x10000100,
  147. .map_io = osk_map_io,
  148. .init_irq = osk_init_irq,
  149. .init_machine = osk_init,
  150. .timer = &omap_timer,
  151. MACHINE_END