mx31lilly.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * LILLY-1131 module support
  3. *
  4. * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
  5. *
  6. * based on code for other MX31 boards,
  7. *
  8. * Copyright 2005-2007 Freescale Semiconductor
  9. * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
  10. * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. */
  26. #include <linux/types.h>
  27. #include <linux/init.h>
  28. #include <linux/clk.h>
  29. #include <linux/platform_device.h>
  30. #include <linux/interrupt.h>
  31. #include <linux/smsc911x.h>
  32. #include <linux/mtd/physmap.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/time.h>
  36. #include <asm/mach/map.h>
  37. #include <mach/hardware.h>
  38. #include <mach/common.h>
  39. #include <mach/iomux-mx3.h>
  40. #include <mach/board-mx31lilly.h>
  41. #include "devices.h"
  42. /*
  43. * This file contains module-specific initialization routines for LILLY-1131.
  44. * Initialization of peripherals found on the baseboard is implemented in the
  45. * appropriate baseboard support code.
  46. */
  47. /* SMSC ethernet support */
  48. static struct resource smsc91x_resources[] = {
  49. {
  50. .start = CS4_BASE_ADDR,
  51. .end = CS4_BASE_ADDR + 0xffff,
  52. .flags = IORESOURCE_MEM,
  53. },
  54. {
  55. .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
  56. .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
  57. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
  58. }
  59. };
  60. static struct smsc911x_platform_config smsc911x_config = {
  61. .phy_interface = PHY_INTERFACE_MODE_MII,
  62. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  63. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  64. .flags = SMSC911X_USE_32BIT |
  65. SMSC911X_SAVE_MAC_ADDRESS |
  66. SMSC911X_FORCE_INTERNAL_PHY,
  67. };
  68. static struct platform_device smsc91x_device = {
  69. .name = "smsc911x",
  70. .id = -1,
  71. .num_resources = ARRAY_SIZE(smsc91x_resources),
  72. .resource = smsc91x_resources,
  73. .dev = {
  74. .platform_data = &smsc911x_config,
  75. }
  76. };
  77. /* NOR flash */
  78. static struct physmap_flash_data nor_flash_data = {
  79. .width = 2,
  80. };
  81. static struct resource nor_flash_resource = {
  82. .start = 0xa0000000,
  83. .end = 0xa1ffffff,
  84. .flags = IORESOURCE_MEM,
  85. };
  86. static struct platform_device physmap_flash_device = {
  87. .name = "physmap-flash",
  88. .id = 0,
  89. .dev = {
  90. .platform_data = &nor_flash_data,
  91. },
  92. .resource = &nor_flash_resource,
  93. .num_resources = 1,
  94. };
  95. static struct platform_device *devices[] __initdata = {
  96. &smsc91x_device,
  97. &physmap_flash_device,
  98. &mxc_i2c_device1,
  99. };
  100. static int mx31lilly_baseboard;
  101. core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
  102. static void __init mx31lilly_board_init(void)
  103. {
  104. switch (mx31lilly_baseboard) {
  105. case MX31LILLY_NOBOARD:
  106. break;
  107. case MX31LILLY_DB:
  108. mx31lilly_db_init();
  109. break;
  110. default:
  111. printk(KERN_ERR "Illegal mx31lilly_baseboard type %d\n",
  112. mx31lilly_baseboard);
  113. }
  114. mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS");
  115. mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MOSI__SCL, "I2C SCL");
  116. mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MISO__SDA, "I2C SDA");
  117. platform_add_devices(devices, ARRAY_SIZE(devices));
  118. }
  119. static void __init mx31lilly_timer_init(void)
  120. {
  121. mx31_clocks_init(26000000);
  122. }
  123. static struct sys_timer mx31lilly_timer = {
  124. .init = mx31lilly_timer_init,
  125. };
  126. MACHINE_START(LILLY1131, "INCO startec LILLY-1131")
  127. .phys_io = AIPS1_BASE_ADDR,
  128. .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  129. .boot_params = PHYS_OFFSET + 0x100,
  130. .map_io = mx31_map_io,
  131. .init_irq = mxc_init_irq,
  132. .init_machine = mx31lilly_board_init,
  133. .timer = &mx31lilly_timer,
  134. MACHINE_END