board-osk.c 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /*
  2. * linux/arch/arm/mach-omap1/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 <linux/interrupt.h>
  32. #include <linux/mtd/mtd.h>
  33. #include <linux/mtd/partitions.h>
  34. #include <asm/hardware.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/mach/arch.h>
  37. #include <asm/mach/map.h>
  38. #include <asm/mach/flash.h>
  39. #include <asm/arch/gpio.h>
  40. #include <asm/arch/usb.h>
  41. #include <asm/arch/mux.h>
  42. #include <asm/arch/tc.h>
  43. #include <asm/arch/common.h>
  44. static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
  45. static struct mtd_partition osk_partitions[] = {
  46. /* bootloader (U-Boot, etc) in first sector */
  47. {
  48. .name = "bootloader",
  49. .offset = 0,
  50. .size = SZ_128K,
  51. .mask_flags = MTD_WRITEABLE, /* force read-only */
  52. },
  53. /* bootloader params in the next sector */
  54. {
  55. .name = "params",
  56. .offset = MTDPART_OFS_APPEND,
  57. .size = SZ_128K,
  58. .mask_flags = 0,
  59. }, {
  60. .name = "kernel",
  61. .offset = MTDPART_OFS_APPEND,
  62. .size = SZ_2M,
  63. .mask_flags = 0
  64. }, {
  65. .name = "filesystem",
  66. .offset = MTDPART_OFS_APPEND,
  67. .size = MTDPART_SIZ_FULL,
  68. .mask_flags = 0
  69. }
  70. };
  71. static struct flash_platform_data osk_flash_data = {
  72. .map_name = "cfi_probe",
  73. .width = 2,
  74. .parts = osk_partitions,
  75. .nr_parts = ARRAY_SIZE(osk_partitions),
  76. };
  77. static struct resource osk_flash_resource = {
  78. /* this is on CS3, wherever it's mapped */
  79. .flags = IORESOURCE_MEM,
  80. };
  81. static struct platform_device osk5912_flash_device = {
  82. .name = "omapflash",
  83. .id = 0,
  84. .dev = {
  85. .platform_data = &osk_flash_data,
  86. },
  87. .num_resources = 1,
  88. .resource = &osk_flash_resource,
  89. };
  90. static struct resource osk5912_smc91x_resources[] = {
  91. [0] = {
  92. .start = OMAP_OSK_ETHR_START, /* Physical */
  93. .end = OMAP_OSK_ETHR_START + 0xf,
  94. .flags = IORESOURCE_MEM,
  95. },
  96. [1] = {
  97. .start = OMAP_GPIO_IRQ(0),
  98. .end = OMAP_GPIO_IRQ(0),
  99. .flags = IORESOURCE_IRQ,
  100. },
  101. };
  102. static struct platform_device osk5912_smc91x_device = {
  103. .name = "smc91x",
  104. .id = -1,
  105. .num_resources = ARRAY_SIZE(osk5912_smc91x_resources),
  106. .resource = osk5912_smc91x_resources,
  107. };
  108. static struct resource osk5912_cf_resources[] = {
  109. [0] = {
  110. .start = OMAP_GPIO_IRQ(62),
  111. .end = OMAP_GPIO_IRQ(62),
  112. .flags = IORESOURCE_IRQ,
  113. },
  114. };
  115. static struct platform_device osk5912_cf_device = {
  116. .name = "omap_cf",
  117. .id = -1,
  118. .dev = {
  119. .platform_data = (void *) 2 /* CS2 */,
  120. },
  121. .num_resources = ARRAY_SIZE(osk5912_cf_resources),
  122. .resource = osk5912_cf_resources,
  123. };
  124. static struct platform_device osk5912_mcbsp1_device = {
  125. .name = "omap_mcbsp",
  126. .id = 1,
  127. };
  128. static struct platform_device *osk5912_devices[] __initdata = {
  129. &osk5912_flash_device,
  130. &osk5912_smc91x_device,
  131. &osk5912_cf_device,
  132. &osk5912_mcbsp1_device,
  133. };
  134. static void __init osk_init_smc91x(void)
  135. {
  136. if ((omap_request_gpio(0)) < 0) {
  137. printk("Error requesting gpio 0 for smc91x irq\n");
  138. return;
  139. }
  140. /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
  141. EMIFS_CCS(1) |= 0x2;
  142. }
  143. static void __init osk_init_cf(void)
  144. {
  145. omap_cfg_reg(M7_1610_GPIO62);
  146. if ((omap_request_gpio(62)) < 0) {
  147. printk("Error requesting gpio 62 for CF irq\n");
  148. return;
  149. }
  150. /* the CF I/O IRQ is really active-low */
  151. set_irq_type(OMAP_GPIO_IRQ(62), IRQT_FALLING);
  152. }
  153. static void __init osk_init_irq(void)
  154. {
  155. omap_init_irq();
  156. omap_gpio_init();
  157. osk_init_smc91x();
  158. osk_init_cf();
  159. }
  160. static struct omap_usb_config osk_usb_config __initdata = {
  161. /* has usb host connector (A) ... for development it can also
  162. * be used, with a NONSTANDARD gender-bending cable/dongle, as
  163. * a peripheral.
  164. */
  165. #ifdef CONFIG_USB_GADGET_OMAP
  166. .register_dev = 1,
  167. .hmc_mode = 0,
  168. #else
  169. .register_host = 1,
  170. .hmc_mode = 16,
  171. .rwc = 1,
  172. #endif
  173. .pins[0] = 2,
  174. };
  175. static struct omap_board_config_kernel osk_config[] = {
  176. { OMAP_TAG_USB, &osk_usb_config },
  177. };
  178. #ifdef CONFIG_OMAP_OSK_MISTRAL
  179. #ifdef CONFIG_PM
  180. static irqreturn_t
  181. osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs)
  182. {
  183. return IRQ_HANDLED;
  184. }
  185. #endif
  186. static void __init osk_mistral_init(void)
  187. {
  188. /* FIXME here's where to feed in framebuffer, touchpad, and
  189. * keyboard setup ... not in the drivers for those devices!
  190. *
  191. * NOTE: we could actually tell if there's a Mistral board
  192. * attached, e.g. by trying to read something from the ads7846.
  193. * But this is too early for that...
  194. */
  195. /* the sideways button (SW1) is for use as a "wakeup" button */
  196. omap_cfg_reg(N15_1610_MPUIO2);
  197. if (omap_request_gpio(OMAP_MPUIO(2)) == 0) {
  198. int ret = 0;
  199. omap_set_gpio_direction(OMAP_MPUIO(2), 1);
  200. set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING);
  201. #ifdef CONFIG_PM
  202. /* share the IRQ in case someone wants to use the
  203. * button for more than wakeup from system sleep.
  204. */
  205. ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)),
  206. &osk_mistral_wake_interrupt,
  207. SA_SHIRQ, "mistral_wakeup",
  208. &osk_mistral_wake_interrupt);
  209. if (ret != 0) {
  210. omap_free_gpio(OMAP_MPUIO(2));
  211. printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
  212. ret);
  213. } else
  214. enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2)));
  215. #endif
  216. } else
  217. printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
  218. }
  219. #else
  220. static void __init osk_mistral_init(void) { }
  221. #endif
  222. static void __init osk_init(void)
  223. {
  224. osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
  225. osk_flash_resource.end += SZ_32M - 1;
  226. platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
  227. omap_board_config = osk_config;
  228. omap_board_config_size = ARRAY_SIZE(osk_config);
  229. USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
  230. osk_mistral_init();
  231. }
  232. static void __init osk_map_io(void)
  233. {
  234. omap_map_common_io();
  235. omap_serial_init(osk_serial_ports);
  236. }
  237. MACHINE_START(OMAP_OSK, "TI-OSK")
  238. /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
  239. .phys_ram = 0x10000000,
  240. .phys_io = 0xfff00000,
  241. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  242. .boot_params = 0x10000100,
  243. .map_io = osk_map_io,
  244. .init_irq = osk_init_irq,
  245. .init_machine = osk_init,
  246. .timer = &omap_timer,
  247. MACHINE_END