Daniel Mack | 65b1aa1 | 2009-05-20 19:54:33 +0200 | [diff] [blame] | 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 | |
| 27 | #include <linux/types.h> |
| 28 | #include <linux/init.h> |
| 29 | #include <linux/clk.h> |
Daniel Mack | cbaa6ca | 2009-05-20 19:54:35 +0200 | [diff] [blame] | 30 | #include <linux/platform_device.h> |
| 31 | #include <linux/interrupt.h> |
| 32 | #include <linux/smsc911x.h> |
Daniel Mack | 38160e0 | 2009-05-20 19:54:38 +0200 | [diff] [blame] | 33 | #include <linux/mtd/physmap.h> |
Daniel Mack | 65b1aa1 | 2009-05-20 19:54:33 +0200 | [diff] [blame] | 34 | |
| 35 | #include <asm/mach-types.h> |
| 36 | #include <asm/mach/arch.h> |
| 37 | #include <asm/mach/time.h> |
| 38 | #include <asm/mach/map.h> |
| 39 | |
| 40 | #include <mach/hardware.h> |
| 41 | #include <mach/common.h> |
| 42 | #include <mach/iomux-mx3.h> |
| 43 | #include <mach/board-mx31lilly.h> |
| 44 | |
| 45 | #include "devices.h" |
| 46 | |
| 47 | /* |
| 48 | * This file contains module-specific initialization routines for LILLY-1131. |
| 49 | * Initialization of peripherals found on the baseboard is implemented in the |
| 50 | * appropriate baseboard support code. |
| 51 | */ |
| 52 | |
Daniel Mack | cbaa6ca | 2009-05-20 19:54:35 +0200 | [diff] [blame] | 53 | /* SMSC ethernet support */ |
| 54 | |
| 55 | static struct resource smsc91x_resources[] = { |
| 56 | { |
| 57 | .start = CS4_BASE_ADDR, |
| 58 | .end = CS4_BASE_ADDR + 0xffff, |
| 59 | .flags = IORESOURCE_MEM, |
| 60 | }, |
| 61 | { |
| 62 | .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0), |
| 63 | .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0), |
| 64 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | static struct smsc911x_platform_config smsc911x_config = { |
| 69 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 70 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 71 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 72 | .flags = SMSC911X_USE_32BIT | |
| 73 | SMSC911X_SAVE_MAC_ADDRESS | |
| 74 | SMSC911X_FORCE_INTERNAL_PHY, |
| 75 | }; |
| 76 | |
| 77 | static struct platform_device smsc91x_device = { |
| 78 | .name = "smsc911x", |
| 79 | .id = -1, |
| 80 | .num_resources = ARRAY_SIZE(smsc91x_resources), |
| 81 | .resource = smsc91x_resources, |
| 82 | .dev = { |
| 83 | .platform_data = &smsc911x_config, |
| 84 | } |
| 85 | }; |
| 86 | |
Daniel Mack | 38160e0 | 2009-05-20 19:54:38 +0200 | [diff] [blame] | 87 | /* NOR flash */ |
| 88 | static struct physmap_flash_data nor_flash_data = { |
| 89 | .width = 2, |
| 90 | }; |
| 91 | |
| 92 | static struct resource nor_flash_resource = { |
| 93 | .start = 0xa0000000, |
| 94 | .end = 0xa1ffffff, |
| 95 | .flags = IORESOURCE_MEM, |
| 96 | }; |
| 97 | |
| 98 | static struct platform_device physmap_flash_device = { |
| 99 | .name = "physmap-flash", |
| 100 | .id = 0, |
| 101 | .dev = { |
| 102 | .platform_data = &nor_flash_data, |
| 103 | }, |
| 104 | .resource = &nor_flash_resource, |
| 105 | .num_resources = 1, |
| 106 | }; |
| 107 | |
Daniel Mack | cbaa6ca | 2009-05-20 19:54:35 +0200 | [diff] [blame] | 108 | static struct platform_device *devices[] __initdata = { |
| 109 | &smsc91x_device, |
Daniel Mack | 38160e0 | 2009-05-20 19:54:38 +0200 | [diff] [blame] | 110 | &physmap_flash_device, |
Daniel Mack | 4193d2d | 2009-05-20 19:54:39 +0200 | [diff] [blame] | 111 | &mxc_i2c_device1, |
Daniel Mack | cbaa6ca | 2009-05-20 19:54:35 +0200 | [diff] [blame] | 112 | }; |
| 113 | |
Daniel Mack | 65b1aa1 | 2009-05-20 19:54:33 +0200 | [diff] [blame] | 114 | static int mx31lilly_baseboard; |
| 115 | core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444); |
| 116 | |
| 117 | static void __init mx31lilly_board_init(void) |
| 118 | { |
| 119 | switch (mx31lilly_baseboard) { |
| 120 | case MX31LILLY_NOBOARD: |
| 121 | break; |
Daniel Mack | 1bc34f7 | 2009-05-20 19:54:34 +0200 | [diff] [blame] | 122 | case MX31LILLY_DB: |
| 123 | mx31lilly_db_init(); |
| 124 | break; |
Daniel Mack | 65b1aa1 | 2009-05-20 19:54:33 +0200 | [diff] [blame] | 125 | default: |
| 126 | printk(KERN_ERR "Illegal mx31lilly_baseboard type %d\n", |
| 127 | mx31lilly_baseboard); |
| 128 | } |
Daniel Mack | cbaa6ca | 2009-05-20 19:54:35 +0200 | [diff] [blame] | 129 | |
| 130 | mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS"); |
Daniel Mack | 4193d2d | 2009-05-20 19:54:39 +0200 | [diff] [blame] | 131 | mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MOSI__SCL, "I2C SCL"); |
| 132 | mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MISO__SDA, "I2C SDA"); |
Daniel Mack | cbaa6ca | 2009-05-20 19:54:35 +0200 | [diff] [blame] | 133 | |
| 134 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
Daniel Mack | 65b1aa1 | 2009-05-20 19:54:33 +0200 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | static void __init mx31lilly_timer_init(void) |
| 138 | { |
| 139 | mx31_clocks_init(26000000); |
| 140 | } |
| 141 | |
| 142 | static struct sys_timer mx31lilly_timer = { |
| 143 | .init = mx31lilly_timer_init, |
| 144 | }; |
| 145 | |
| 146 | MACHINE_START(LILLY1131, "INCO startec LILLY-1131") |
| 147 | .phys_io = AIPS1_BASE_ADDR, |
| 148 | .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, |
| 149 | .boot_params = PHYS_OFFSET + 0x100, |
| 150 | .map_io = mx31_map_io, |
Sascha Hauer | c5aa0ad | 2009-05-25 17:36:19 +0200 | [diff] [blame] | 151 | .init_irq = mx31_init_irq, |
Daniel Mack | 65b1aa1 | 2009-05-20 19:54:33 +0200 | [diff] [blame] | 152 | .init_machine = mx31lilly_board_init, |
| 153 | .timer = &mx31lilly_timer, |
| 154 | MACHINE_END |
| 155 | |