Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2000 Deep Blue Solutions Ltd |
| 3 | * Copyright (C) 2002 Shane Nay (shane@minirl.com) |
| 4 | * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/init.h> |
| 23 | #include <linux/kernel.h> |
| 24 | #include <linux/memory.h> |
Magnus Lilja | 3211705 | 2009-04-14 22:00:07 +0200 | [diff] [blame] | 25 | #include <linux/platform_device.h> |
| 26 | #include <linux/gpio.h> |
| 27 | #include <linux/smsc911x.h> |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 28 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 29 | #include <mach/hardware.h> |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
Juergen Beisert | 9e8a30d | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 32 | #include <asm/mach/time.h> |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 33 | #include <asm/mach/map.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 34 | #include <mach/common.h> |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 35 | #include <asm/page.h> |
| 36 | #include <asm/setup.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 37 | #include <mach/board-mx31lite.h> |
Magnus Lilja | a854b8a | 2009-04-14 22:00:03 +0200 | [diff] [blame] | 38 | #include <mach/imx-uart.h> |
| 39 | #include <mach/iomux-mx3.h> |
Magnus Lilja | 3211705 | 2009-04-14 22:00:07 +0200 | [diff] [blame] | 40 | #include <mach/irqs.h> |
Magnus Lilja | 183c7ff | 2009-05-04 22:18:09 +0200 | [diff] [blame] | 41 | #include <mach/mxc_nand.h> |
Magnus Lilja | a854b8a | 2009-04-14 22:00:03 +0200 | [diff] [blame] | 42 | #include "devices.h" |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 43 | |
| 44 | /* |
Daniel Mack | b7d91a6 | 2009-11-19 12:02:06 +0100 | [diff] [blame^] | 45 | * This file contains the module-specific initialization routines. |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 46 | */ |
| 47 | |
Magnus Lilja | a854b8a | 2009-04-14 22:00:03 +0200 | [diff] [blame] | 48 | static unsigned int mx31lite_pins[] = { |
Magnus Lilja | 3211705 | 2009-04-14 22:00:07 +0200 | [diff] [blame] | 49 | /* LAN9117 IRQ pin */ |
| 50 | IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO), |
Magnus Lilja | a854b8a | 2009-04-14 22:00:03 +0200 | [diff] [blame] | 51 | }; |
| 52 | |
Magnus Lilja | 183c7ff | 2009-05-04 22:18:09 +0200 | [diff] [blame] | 53 | static struct mxc_nand_platform_data mx31lite_nand_board_info = { |
| 54 | .width = 1, |
| 55 | .hw_ecc = 1, |
| 56 | }; |
| 57 | |
Magnus Lilja | 3211705 | 2009-04-14 22:00:07 +0200 | [diff] [blame] | 58 | static struct smsc911x_platform_config smsc911x_config = { |
| 59 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 60 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 61 | .flags = SMSC911X_USE_16BIT, |
| 62 | }; |
| 63 | |
| 64 | static struct resource smsc911x_resources[] = { |
Sascha Hauer | 3f4f54b | 2009-06-23 12:12:00 +0200 | [diff] [blame] | 65 | { |
Magnus Lilja | 3211705 | 2009-04-14 22:00:07 +0200 | [diff] [blame] | 66 | .start = CS4_BASE_ADDR, |
| 67 | .end = CS4_BASE_ADDR + 0x100, |
| 68 | .flags = IORESOURCE_MEM, |
Sascha Hauer | 3f4f54b | 2009-06-23 12:12:00 +0200 | [diff] [blame] | 69 | }, { |
Magnus Lilja | 3211705 | 2009-04-14 22:00:07 +0200 | [diff] [blame] | 70 | .start = IOMUX_TO_IRQ(MX31_PIN_SFS6), |
| 71 | .end = IOMUX_TO_IRQ(MX31_PIN_SFS6), |
| 72 | .flags = IORESOURCE_IRQ, |
| 73 | }, |
| 74 | }; |
| 75 | |
| 76 | static struct platform_device smsc911x_device = { |
| 77 | .name = "smsc911x", |
| 78 | .id = -1, |
| 79 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 80 | .resource = smsc911x_resources, |
| 81 | .dev = { |
| 82 | .platform_data = &smsc911x_config, |
| 83 | }, |
| 84 | }; |
| 85 | |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 86 | /* |
| 87 | * This structure defines the MX31 memory map. |
| 88 | */ |
| 89 | static struct map_desc mx31lite_io_desc[] __initdata = { |
| 90 | { |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 91 | .virtual = SPBA0_BASE_ADDR_VIRT, |
| 92 | .pfn = __phys_to_pfn(SPBA0_BASE_ADDR), |
| 93 | .length = SPBA0_SIZE, |
Russell King | 9b727ab | 2008-09-07 12:45:01 +0100 | [diff] [blame] | 94 | .type = MT_DEVICE_NONSHARED |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 95 | }, { |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 96 | .virtual = CS4_BASE_ADDR_VIRT, |
| 97 | .pfn = __phys_to_pfn(CS4_BASE_ADDR), |
| 98 | .length = CS4_SIZE, |
| 99 | .type = MT_DEVICE |
| 100 | } |
| 101 | }; |
| 102 | |
| 103 | /* |
| 104 | * Set up static virtual mappings. |
| 105 | */ |
| 106 | void __init mx31lite_map_io(void) |
| 107 | { |
Sascha Hauer | cd4a05f | 2009-04-02 22:32:10 +0200 | [diff] [blame] | 108 | mx31_map_io(); |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 109 | iotable_init(mx31lite_io_desc, ARRAY_SIZE(mx31lite_io_desc)); |
| 110 | } |
| 111 | |
Daniel Mack | b7d91a6 | 2009-11-19 12:02:06 +0100 | [diff] [blame^] | 112 | static int mx31lite_baseboard; |
| 113 | core_param(mx31lite_baseboard, mx31lite_baseboard, int, 0444); |
| 114 | |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 115 | static void __init mxc_board_init(void) |
| 116 | { |
Sascha Hauer | 4f163eb | 2009-05-06 12:55:50 +0200 | [diff] [blame] | 117 | int ret; |
| 118 | |
Daniel Mack | b7d91a6 | 2009-11-19 12:02:06 +0100 | [diff] [blame^] | 119 | switch (mx31lite_baseboard) { |
| 120 | case MX31LITE_NOBOARD: |
| 121 | break; |
| 122 | case MX31LITE_DB: |
| 123 | mx31lite_db_init(); |
| 124 | break; |
| 125 | default: |
| 126 | printk(KERN_ERR "Illegal mx31lite_baseboard type %d\n", |
| 127 | mx31lite_baseboard); |
| 128 | } |
| 129 | |
Magnus Lilja | a854b8a | 2009-04-14 22:00:03 +0200 | [diff] [blame] | 130 | mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins), |
| 131 | "mx31lite"); |
| 132 | |
Magnus Lilja | 183c7ff | 2009-05-04 22:18:09 +0200 | [diff] [blame] | 133 | mxc_register_device(&mxc_nand_device, &mx31lite_nand_board_info); |
Magnus Lilja | 3211705 | 2009-04-14 22:00:07 +0200 | [diff] [blame] | 134 | |
| 135 | /* SMSC9117 IRQ pin */ |
Sascha Hauer | 4f163eb | 2009-05-06 12:55:50 +0200 | [diff] [blame] | 136 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); |
| 137 | if (ret) |
| 138 | pr_warning("could not get LAN irq gpio\n"); |
| 139 | else { |
| 140 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_SFS6)); |
| 141 | platform_device_register(&smsc911x_device); |
| 142 | } |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 143 | } |
| 144 | |
Juergen Beisert | 9e8a30d | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 145 | static void __init mx31lite_timer_init(void) |
| 146 | { |
Sascha Hauer | 30c730f | 2009-02-16 14:36:49 +0100 | [diff] [blame] | 147 | mx31_clocks_init(26000000); |
Juergen Beisert | 9e8a30d | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | struct sys_timer mx31lite_timer = { |
| 151 | .init = mx31lite_timer_init, |
| 152 | }; |
| 153 | |
Daniel Mack | b7d91a6 | 2009-11-19 12:02:06 +0100 | [diff] [blame^] | 154 | MACHINE_START(MX31LITE, "LogicPD i.MX31 SOM") |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 155 | /* Maintainer: Freescale Semiconductor, Inc. */ |
| 156 | .phys_io = AIPS1_BASE_ADDR, |
| 157 | .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, |
| 158 | .boot_params = PHYS_OFFSET + 0x100, |
| 159 | .map_io = mx31lite_map_io, |
Sascha Hauer | c5aa0ad | 2009-05-25 17:36:19 +0200 | [diff] [blame] | 160 | .init_irq = mx31_init_irq, |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 161 | .init_machine = mxc_board_init, |
Juergen Beisert | 9e8a30d | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 162 | .timer = &mx31lite_timer, |
Daniel Mack | 9a4cd7a | 2008-07-05 10:02:53 +0200 | [diff] [blame] | 163 | MACHINE_END |