board-4430sdp.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Board support file for OMAP4430 SDP.
  3. *
  4. * Copyright (C) 2009 Texas Instruments
  5. *
  6. * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
  7. *
  8. * Based on mach-omap2/board-3430sdp.c
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/io.h>
  18. #include <linux/gpio.h>
  19. #include <linux/usb/otg.h>
  20. #include <linux/spi/spi.h>
  21. #include <mach/hardware.h>
  22. #include <mach/omap4-common.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/map.h>
  26. #include <plat/board.h>
  27. #include <plat/common.h>
  28. #include <plat/control.h>
  29. #include <plat/timer-gp.h>
  30. #include <plat/usb.h>
  31. #define ETH_KS8851_IRQ 34
  32. #define ETH_KS8851_POWER_ON 48
  33. #define ETH_KS8851_QUART 138
  34. static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
  35. {
  36. .modalias = "ks8851",
  37. .bus_num = 1,
  38. .chip_select = 0,
  39. .max_speed_hz = 24000000,
  40. .irq = ETH_KS8851_IRQ,
  41. },
  42. };
  43. static int omap_ethernet_init(void)
  44. {
  45. int status;
  46. /* Request of GPIO lines */
  47. status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
  48. if (status) {
  49. pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
  50. return status;
  51. }
  52. status = gpio_request(ETH_KS8851_QUART, "quart");
  53. if (status) {
  54. pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
  55. goto error1;
  56. }
  57. status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
  58. if (status) {
  59. pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
  60. goto error2;
  61. }
  62. /* Configuration of requested GPIO lines */
  63. status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
  64. if (status) {
  65. pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
  66. goto error3;
  67. }
  68. status = gpio_direction_output(ETH_KS8851_QUART, 1);
  69. if (status) {
  70. pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
  71. goto error3;
  72. }
  73. status = gpio_direction_input(ETH_KS8851_IRQ);
  74. if (status) {
  75. pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
  76. goto error3;
  77. }
  78. return 0;
  79. error3:
  80. gpio_free(ETH_KS8851_IRQ);
  81. error2:
  82. gpio_free(ETH_KS8851_QUART);
  83. error1:
  84. gpio_free(ETH_KS8851_POWER_ON);
  85. return status;
  86. }
  87. static struct platform_device sdp4430_lcd_device = {
  88. .name = "sdp4430_lcd",
  89. .id = -1,
  90. };
  91. static struct platform_device *sdp4430_devices[] __initdata = {
  92. &sdp4430_lcd_device,
  93. };
  94. static struct omap_lcd_config sdp4430_lcd_config __initdata = {
  95. .ctrl_name = "internal",
  96. };
  97. static struct omap_board_config_kernel sdp4430_config[] __initdata = {
  98. { OMAP_TAG_LCD, &sdp4430_lcd_config },
  99. };
  100. static void __init omap_4430sdp_init_irq(void)
  101. {
  102. omap_board_config = sdp4430_config;
  103. omap_board_config_size = ARRAY_SIZE(sdp4430_config);
  104. omap2_init_common_hw(NULL, NULL);
  105. #ifdef CONFIG_OMAP_32K_TIMER
  106. omap2_gp_clockevent_set_gptimer(1);
  107. #endif
  108. gic_init_irq();
  109. omap_gpio_init();
  110. }
  111. static struct omap_musb_board_data musb_board_data = {
  112. .interface_type = MUSB_INTERFACE_UTMI,
  113. .mode = MUSB_PERIPHERAL,
  114. .power = 100,
  115. };
  116. static int __init omap4_i2c_init(void)
  117. {
  118. /*
  119. * Phoenix Audio IC needs I2C1 to
  120. * start with 400 KHz or less
  121. */
  122. omap_register_i2c_bus(1, 400, NULL, 0);
  123. omap_register_i2c_bus(2, 400, NULL, 0);
  124. omap_register_i2c_bus(3, 400, NULL, 0);
  125. omap_register_i2c_bus(4, 400, NULL, 0);
  126. return 0;
  127. }
  128. static void __init omap_4430sdp_init(void)
  129. {
  130. int status;
  131. omap4_i2c_init();
  132. platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
  133. omap_serial_init();
  134. /* OMAP4 SDP uses internal transceiver so register nop transceiver */
  135. usb_nop_xceiv_register();
  136. /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
  137. if (!cpu_is_omap44xx())
  138. usb_musb_init(&musb_board_data);
  139. status = omap_ethernet_init();
  140. if (status) {
  141. pr_err("Ethernet initialization failed: %d\n", status);
  142. } else {
  143. sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
  144. spi_register_board_info(sdp4430_spi_board_info,
  145. ARRAY_SIZE(sdp4430_spi_board_info));
  146. }
  147. }
  148. static void __init omap_4430sdp_map_io(void)
  149. {
  150. omap2_set_globals_443x();
  151. omap44xx_map_common_io();
  152. }
  153. MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
  154. /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
  155. .phys_io = 0x48000000,
  156. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  157. .boot_params = 0x80000100,
  158. .map_io = omap_4430sdp_map_io,
  159. .init_irq = omap_4430sdp_init_irq,
  160. .init_machine = omap_4430sdp_init,
  161. .timer = &omap_timer,
  162. MACHINE_END