board-ldp.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * linux/arch/arm/mach-omap2/board-ldp.c
  3. *
  4. * Copyright (C) 2008 Texas Instruments Inc.
  5. * Nishant Kamat <nskamat@ti.com>
  6. *
  7. * Modified from mach-omap2/board-3430sdp.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/delay.h>
  17. #include <linux/input.h>
  18. #include <linux/workqueue.h>
  19. #include <linux/err.h>
  20. #include <linux/clk.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/spi/ads7846.h>
  23. #include <mach/hardware.h>
  24. #include <asm/mach-types.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <mach/board-ldp.h>
  28. #include <mach/mcspi.h>
  29. #include <mach/gpio.h>
  30. #include <mach/board.h>
  31. #include <mach/common.h>
  32. #include <mach/gpmc.h>
  33. #include <asm/io.h>
  34. #include <asm/delay.h>
  35. #include <mach/control.h>
  36. #define SDP3430_SMC91X_CS 3
  37. static struct resource ldp_smc911x_resources[] = {
  38. [0] = {
  39. .start = OMAP34XX_ETHR_START,
  40. .end = OMAP34XX_ETHR_START + SZ_4K,
  41. .flags = IORESOURCE_MEM,
  42. },
  43. [1] = {
  44. .start = 0,
  45. .end = 0,
  46. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  47. },
  48. };
  49. static struct platform_device ldp_smc911x_device = {
  50. .name = "smc911x",
  51. .id = -1,
  52. .num_resources = ARRAY_SIZE(ldp_smc911x_resources),
  53. .resource = ldp_smc911x_resources,
  54. };
  55. static struct platform_device *ldp_devices[] __initdata = {
  56. &ldp_smc911x_device,
  57. };
  58. static inline void __init ldp_init_smc911x(void)
  59. {
  60. int eth_cs;
  61. unsigned long cs_mem_base;
  62. int eth_gpio = 0;
  63. eth_cs = LDP_SMC911X_CS;
  64. if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
  65. printk(KERN_ERR "Failed to request GPMC mem for smc911x\n");
  66. return;
  67. }
  68. ldp_smc911x_resources[0].start = cs_mem_base + 0x0;
  69. ldp_smc911x_resources[0].end = cs_mem_base + 0xf;
  70. udelay(100);
  71. eth_gpio = LDP_SMC911X_GPIO;
  72. ldp_smc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
  73. if (omap_request_gpio(eth_gpio) < 0) {
  74. printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
  75. eth_gpio);
  76. return;
  77. }
  78. gpio_direction_input(eth_gpio);
  79. }
  80. static void __init omap_ldp_init_irq(void)
  81. {
  82. omap2_init_common_hw();
  83. omap_init_irq();
  84. omap_gpio_init();
  85. ldp_init_smc911x();
  86. }
  87. static struct omap_uart_config ldp_uart_config __initdata = {
  88. .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
  89. };
  90. static struct omap_board_config_kernel ldp_config[] __initdata = {
  91. { OMAP_TAG_UART, &ldp_uart_config },
  92. };
  93. static int __init omap_i2c_init(void)
  94. {
  95. omap_register_i2c_bus(1, 2600, NULL, 0);
  96. omap_register_i2c_bus(2, 400, NULL, 0);
  97. omap_register_i2c_bus(3, 400, NULL, 0);
  98. return 0;
  99. }
  100. static void __init omap_ldp_init(void)
  101. {
  102. omap_i2c_init();
  103. platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
  104. omap_board_config = ldp_config;
  105. omap_board_config_size = ARRAY_SIZE(ldp_config);
  106. omap_serial_init();
  107. }
  108. static void __init omap_ldp_map_io(void)
  109. {
  110. omap2_set_globals_343x();
  111. omap2_map_common_io();
  112. }
  113. MACHINE_START(OMAP_LDP, "OMAP LDP board")
  114. .phys_io = 0x48000000,
  115. .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
  116. .boot_params = 0x80000100,
  117. .map_io = omap_ldp_map_io,
  118. .init_irq = omap_ldp_init_irq,
  119. .init_machine = omap_ldp_init,
  120. .timer = &omap_timer,
  121. MACHINE_END