Linux Audio

Check our new training course

Loading...
v4.17
  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
 23#include <linux/types.h>
 24#include <linux/init.h>
 25#include <linux/clk.h>
 26#include <linux/gpio.h>
 27#include <linux/delay.h>
 28#include <linux/platform_device.h>
 29#include <linux/interrupt.h>
 30#include <linux/moduleparam.h>
 31#include <linux/smsc911x.h>
 32#include <linux/mtd/physmap.h>
 33#include <linux/spi/spi.h>
 34#include <linux/mfd/mc13783.h>
 35#include <linux/usb/otg.h>
 36#include <linux/usb/ulpi.h>
 37#include <linux/regulator/machine.h>
 38#include <linux/regulator/fixed.h>
 39
 40#include <asm/mach-types.h>
 41#include <asm/mach/arch.h>
 42#include <asm/mach/time.h>
 43#include <asm/mach/map.h>
 44
 45#include "board-mx31lilly.h"
 46#include "common.h"
 
 
 
 
 47#include "devices-imx31.h"
 48#include "ehci.h"
 49#include "hardware.h"
 50#include "iomux-mx3.h"
 51#include "ulpi.h"
 52
 53/*
 54 * This file contains module-specific initialization routines for LILLY-1131.
 55 * Initialization of peripherals found on the baseboard is implemented in the
 56 * appropriate baseboard support code.
 57 */
 58
 59static unsigned int mx31lilly_pins[] __initdata = {
 60	MX31_PIN_CTS1__CTS1,
 61	MX31_PIN_RTS1__RTS1,
 62	MX31_PIN_TXD1__TXD1,
 63	MX31_PIN_RXD1__RXD1,
 64	MX31_PIN_CTS2__CTS2,
 65	MX31_PIN_RTS2__RTS2,
 66	MX31_PIN_TXD2__TXD2,
 67	MX31_PIN_RXD2__RXD2,
 68	MX31_PIN_CSPI3_MOSI__RXD3,
 69	MX31_PIN_CSPI3_MISO__TXD3,
 70	MX31_PIN_CSPI3_SCLK__RTS3,
 71	MX31_PIN_CSPI3_SPI_RDY__CTS3,
 72};
 73
 74/* UART */
 75static const struct imxuart_platform_data uart_pdata __initconst = {
 76	.flags = IMXUART_HAVE_RTSCTS,
 77};
 78
 79/* SMSC ethernet support */
 80
 81static struct resource smsc91x_resources[] = {
 82	{
 83		.start	= MX31_CS4_BASE_ADDR,
 84		.end	= MX31_CS4_BASE_ADDR + 0xffff,
 85		.flags	= IORESOURCE_MEM,
 86	},
 87	{
 88		/* irq number is run-time assigned */
 
 89		.flags	= IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
 90	}
 91};
 92
 93static struct smsc911x_platform_config smsc911x_config = {
 94	.phy_interface	= PHY_INTERFACE_MODE_MII,
 95	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
 96	.irq_type	= SMSC911X_IRQ_TYPE_OPEN_DRAIN,
 97	.flags		= SMSC911X_USE_32BIT |
 98			  SMSC911X_SAVE_MAC_ADDRESS |
 99			  SMSC911X_FORCE_INTERNAL_PHY,
100};
101
102static struct platform_device smsc91x_device = {
103	.name		= "smsc911x",
104	.id		= -1,
105	.num_resources	= ARRAY_SIZE(smsc91x_resources),
106	.resource	= smsc91x_resources,
107	.dev		= {
108		.platform_data = &smsc911x_config,
109	}
110};
111
112/* NOR flash */
113static struct physmap_flash_data nor_flash_data = {
114	.width  = 2,
115};
116
117static struct resource nor_flash_resource = {
118	.start	= 0xa0000000,
119	.end	= 0xa1ffffff,
120	.flags	= IORESOURCE_MEM,
121};
122
123static struct platform_device physmap_flash_device = {
124	.name	= "physmap-flash",
125	.id	= 0,
126	.dev	= {
127		.platform_data  = &nor_flash_data,
128	},
129	.resource = &nor_flash_resource,
130	.num_resources = 1,
131};
132
133/* USB */
134
135#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
136			PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
137
138static int usbh1_init(struct platform_device *pdev)
139{
140	int pins[] = {
141		MX31_PIN_CSPI1_MOSI__USBH1_RXDM,
142		MX31_PIN_CSPI1_MISO__USBH1_RXDP,
143		MX31_PIN_CSPI1_SS0__USBH1_TXDM,
144		MX31_PIN_CSPI1_SS1__USBH1_TXDP,
145		MX31_PIN_CSPI1_SS2__USBH1_RCV,
146		MX31_PIN_CSPI1_SCLK__USBH1_OEB,
147		MX31_PIN_CSPI1_SPI_RDY__USBH1_FS,
148	};
149
150	mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H1");
151
152	mxc_iomux_set_pad(MX31_PIN_CSPI1_MOSI, USB_PAD_CFG);
153	mxc_iomux_set_pad(MX31_PIN_CSPI1_MISO, USB_PAD_CFG);
154	mxc_iomux_set_pad(MX31_PIN_CSPI1_SS0, USB_PAD_CFG);
155	mxc_iomux_set_pad(MX31_PIN_CSPI1_SS1, USB_PAD_CFG);
156	mxc_iomux_set_pad(MX31_PIN_CSPI1_SS2, USB_PAD_CFG);
157	mxc_iomux_set_pad(MX31_PIN_CSPI1_SCLK, USB_PAD_CFG);
158	mxc_iomux_set_pad(MX31_PIN_CSPI1_SPI_RDY, USB_PAD_CFG);
159
160	mxc_iomux_set_gpr(MUX_PGP_USB_SUSPEND, true);
161
162	mdelay(10);
163
164	return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
165			MXC_EHCI_INTERFACE_SINGLE_UNI);
166}
167
168static int usbh2_init(struct platform_device *pdev)
169{
170	int pins[] = {
171		MX31_PIN_USBH2_DATA0__USBH2_DATA0,
172		MX31_PIN_USBH2_DATA1__USBH2_DATA1,
173		MX31_PIN_USBH2_CLK__USBH2_CLK,
174		MX31_PIN_USBH2_DIR__USBH2_DIR,
175		MX31_PIN_USBH2_NXT__USBH2_NXT,
176		MX31_PIN_USBH2_STP__USBH2_STP,
177	};
178
179	mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H2");
180
181	mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
182	mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
183	mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
184	mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
185	mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
186	mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
187	mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
188	mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
189	mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
190	mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
191	mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
192	mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
193
194	mxc_iomux_set_gpr(MUX_PGP_UH2, true);
195
196	/* chip select */
197	mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
198				"USBH2_CS");
199	gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
200	gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
201
202	mdelay(10);
203
204	return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
205}
206
207static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
208	.init	= usbh1_init,
209	.portsc	= MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
210};
211
212static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
213	.init	= usbh2_init,
214	.portsc	= MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
215};
216
217static void __init lilly1131_usb_init(void)
218{
219	imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
220
221	usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
222			ULPI_OTG_DRVVBUS_EXT);
223	if (usbh2_pdata.otg)
224		imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
225}
226
227/* SPI */
228
229static int spi_internal_chipselect[] = {
230	MXC_SPI_CS(0),
231	MXC_SPI_CS(1),
232	MXC_SPI_CS(2),
233};
234
235static const struct spi_imx_master spi0_pdata __initconst = {
236	.chipselect = spi_internal_chipselect,
237	.num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
238};
239
240static const struct spi_imx_master spi1_pdata __initconst = {
241	.chipselect = spi_internal_chipselect,
242	.num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
243};
244
245static struct mc13xxx_platform_data mc13783_pdata __initdata = {
246	.flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
247};
248
249static struct spi_board_info mc13783_dev __initdata = {
250	.modalias	= "mc13783",
251	.max_speed_hz	= 1000000,
252	.bus_num	= 1,
253	.chip_select	= 0,
254	.platform_data	= &mc13783_pdata,
255	/* irq number is run-time assigned */
256};
257
258static struct platform_device *devices[] __initdata = {
259	&smsc91x_device,
260	&physmap_flash_device,
261};
262
263static int mx31lilly_baseboard;
264core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
265
266static struct regulator_consumer_supply dummy_supplies[] = {
267	REGULATOR_SUPPLY("vdd33a", "smsc911x"),
268	REGULATOR_SUPPLY("vddvario", "smsc911x"),
269};
270
271static void __init mx31lilly_board_init(void)
272{
273	imx31_soc_init();
274
275	mxc_iomux_setup_multiple_pins(mx31lilly_pins,
276				      ARRAY_SIZE(mx31lilly_pins), "mx31lily");
277
278	imx31_add_imx_uart0(&uart_pdata);
279	imx31_add_imx_uart1(&uart_pdata);
280	imx31_add_imx_uart2(&uart_pdata);
 
 
 
 
281
282	mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS");
283
284	/* SPI */
285	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SCLK__SCLK, "SPI1_CLK");
286	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MOSI__MOSI, "SPI1_TX");
287	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MISO__MISO, "SPI1_RX");
288	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, "SPI1_RDY");
289	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS0__SS0, "SPI1_SS0");
290	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS1__SS1, "SPI1_SS1");
291	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS2__SS2, "SPI1_SS2");
292
293	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SCLK__SCLK, "SPI2_CLK");
294	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MOSI__MOSI, "SPI2_TX");
295	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MISO__MISO, "SPI2_RX");
296	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, "SPI2_RDY");
297	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS0__SS0, "SPI2_SS0");
298	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1");
299	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2");
300
301	imx31_add_spi_imx0(&spi0_pdata);
302	imx31_add_spi_imx1(&spi1_pdata);
303
304	regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
305}
306
307static void __init mx31lilly_late_init(void)
308{
309	if (mx31lilly_baseboard == MX31LILLY_DB)
310		mx31lilly_db_init();
311
312	mc13783_dev.irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
313	spi_register_board_info(&mc13783_dev, 1);
314
315	smsc91x_resources[1].start =
316			gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0));
317	smsc91x_resources[1].end =
318			gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0));
319	platform_add_devices(devices, ARRAY_SIZE(devices));
320
321	/* USB */
322	lilly1131_usb_init();
323}
324
325static void __init mx31lilly_timer_init(void)
326{
327	mx31_clocks_init(26000000);
328}
329
 
 
 
 
330MACHINE_START(LILLY1131, "INCO startec LILLY-1131")
331	.atag_offset = 0x100,
332	.map_io = mx31_map_io,
333	.init_early = imx31_init_early,
334	.init_irq = mx31_init_irq,
335	.init_time	= mx31lilly_timer_init,
336	.init_machine	= mx31lilly_board_init,
337	.init_late	= mx31lilly_late_init,
338	.restart	= mxc_restart,
339MACHINE_END
v3.1
  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
 23#include <linux/types.h>
 24#include <linux/init.h>
 25#include <linux/clk.h>
 26#include <linux/gpio.h>
 27#include <linux/delay.h>
 28#include <linux/platform_device.h>
 29#include <linux/interrupt.h>
 
 30#include <linux/smsc911x.h>
 31#include <linux/mtd/physmap.h>
 32#include <linux/spi/spi.h>
 33#include <linux/mfd/mc13783.h>
 34#include <linux/usb/otg.h>
 35#include <linux/usb/ulpi.h>
 
 
 36
 37#include <asm/mach-types.h>
 38#include <asm/mach/arch.h>
 39#include <asm/mach/time.h>
 40#include <asm/mach/map.h>
 41
 42#include <mach/hardware.h>
 43#include <mach/common.h>
 44#include <mach/iomux-mx3.h>
 45#include <mach/board-mx31lilly.h>
 46#include <mach/ulpi.h>
 47
 48#include "devices-imx31.h"
 
 
 
 
 49
 50/*
 51 * This file contains module-specific initialization routines for LILLY-1131.
 52 * Initialization of peripherals found on the baseboard is implemented in the
 53 * appropriate baseboard support code.
 54 */
 55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 56/* SMSC ethernet support */
 57
 58static struct resource smsc91x_resources[] = {
 59	{
 60		.start	= MX31_CS4_BASE_ADDR,
 61		.end	= MX31_CS4_BASE_ADDR + 0xffff,
 62		.flags	= IORESOURCE_MEM,
 63	},
 64	{
 65		.start	= IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
 66		.end	= IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
 67		.flags	= IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
 68	}
 69};
 70
 71static struct smsc911x_platform_config smsc911x_config = {
 72	.phy_interface	= PHY_INTERFACE_MODE_MII,
 73	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
 74	.irq_type	= SMSC911X_IRQ_TYPE_OPEN_DRAIN,
 75	.flags		= SMSC911X_USE_32BIT |
 76			  SMSC911X_SAVE_MAC_ADDRESS |
 77			  SMSC911X_FORCE_INTERNAL_PHY,
 78};
 79
 80static struct platform_device smsc91x_device = {
 81	.name		= "smsc911x",
 82	.id		= -1,
 83	.num_resources	= ARRAY_SIZE(smsc91x_resources),
 84	.resource	= smsc91x_resources,
 85	.dev		= {
 86		.platform_data = &smsc911x_config,
 87	}
 88};
 89
 90/* NOR flash */
 91static struct physmap_flash_data nor_flash_data = {
 92	.width  = 2,
 93};
 94
 95static struct resource nor_flash_resource = {
 96	.start	= 0xa0000000,
 97	.end	= 0xa1ffffff,
 98	.flags	= IORESOURCE_MEM,
 99};
100
101static struct platform_device physmap_flash_device = {
102	.name	= "physmap-flash",
103	.id	= 0,
104	.dev	= {
105		.platform_data  = &nor_flash_data,
106	},
107	.resource = &nor_flash_resource,
108	.num_resources = 1,
109};
110
111/* USB */
112
113#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
114			PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
115
116static int usbh1_init(struct platform_device *pdev)
117{
118	int pins[] = {
119		MX31_PIN_CSPI1_MOSI__USBH1_RXDM,
120		MX31_PIN_CSPI1_MISO__USBH1_RXDP,
121		MX31_PIN_CSPI1_SS0__USBH1_TXDM,
122		MX31_PIN_CSPI1_SS1__USBH1_TXDP,
123		MX31_PIN_CSPI1_SS2__USBH1_RCV,
124		MX31_PIN_CSPI1_SCLK__USBH1_OEB,
125		MX31_PIN_CSPI1_SPI_RDY__USBH1_FS,
126	};
127
128	mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H1");
129
130	mxc_iomux_set_pad(MX31_PIN_CSPI1_MOSI, USB_PAD_CFG);
131	mxc_iomux_set_pad(MX31_PIN_CSPI1_MISO, USB_PAD_CFG);
132	mxc_iomux_set_pad(MX31_PIN_CSPI1_SS0, USB_PAD_CFG);
133	mxc_iomux_set_pad(MX31_PIN_CSPI1_SS1, USB_PAD_CFG);
134	mxc_iomux_set_pad(MX31_PIN_CSPI1_SS2, USB_PAD_CFG);
135	mxc_iomux_set_pad(MX31_PIN_CSPI1_SCLK, USB_PAD_CFG);
136	mxc_iomux_set_pad(MX31_PIN_CSPI1_SPI_RDY, USB_PAD_CFG);
137
138	mxc_iomux_set_gpr(MUX_PGP_USB_SUSPEND, true);
139
140	mdelay(10);
141
142	return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
143			MXC_EHCI_INTERFACE_SINGLE_UNI);
144}
145
146static int usbh2_init(struct platform_device *pdev)
147{
148	int pins[] = {
149		MX31_PIN_USBH2_DATA0__USBH2_DATA0,
150		MX31_PIN_USBH2_DATA1__USBH2_DATA1,
151		MX31_PIN_USBH2_CLK__USBH2_CLK,
152		MX31_PIN_USBH2_DIR__USBH2_DIR,
153		MX31_PIN_USBH2_NXT__USBH2_NXT,
154		MX31_PIN_USBH2_STP__USBH2_STP,
155	};
156
157	mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H2");
158
159	mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
160	mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
161	mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
162	mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
163	mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
164	mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
165	mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
166	mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
167	mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
168	mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
169	mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
170	mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
171
172	mxc_iomux_set_gpr(MUX_PGP_UH2, true);
173
174	/* chip select */
175	mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
176				"USBH2_CS");
177	gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
178	gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
179
180	mdelay(10);
181
182	return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
183}
184
185static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
186	.init	= usbh1_init,
187	.portsc	= MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
188};
189
190static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
191	.init	= usbh2_init,
192	.portsc	= MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
193};
194
195static void __init lilly1131_usb_init(void)
196{
197	imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
198
199	usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
200			ULPI_OTG_DRVVBUS_EXT);
201	if (usbh2_pdata.otg)
202		imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
203}
204
205/* SPI */
206
207static int spi_internal_chipselect[] = {
208	MXC_SPI_CS(0),
209	MXC_SPI_CS(1),
210	MXC_SPI_CS(2),
211};
212
213static const struct spi_imx_master spi0_pdata __initconst = {
214	.chipselect = spi_internal_chipselect,
215	.num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
216};
217
218static const struct spi_imx_master spi1_pdata __initconst = {
219	.chipselect = spi_internal_chipselect,
220	.num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
221};
222
223static struct mc13xxx_platform_data mc13783_pdata __initdata = {
224	.flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
225};
226
227static struct spi_board_info mc13783_dev __initdata = {
228	.modalias	= "mc13783",
229	.max_speed_hz	= 1000000,
230	.bus_num	= 1,
231	.chip_select	= 0,
232	.platform_data	= &mc13783_pdata,
233	.irq		= IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
234};
235
236static struct platform_device *devices[] __initdata = {
237	&smsc91x_device,
238	&physmap_flash_device,
239};
240
241static int mx31lilly_baseboard;
242core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
243
 
 
 
 
 
244static void __init mx31lilly_board_init(void)
245{
246	imx31_soc_init();
247
248	switch (mx31lilly_baseboard) {
249	case MX31LILLY_NOBOARD:
250		break;
251	case MX31LILLY_DB:
252		mx31lilly_db_init();
253		break;
254	default:
255		printk(KERN_ERR "Illegal mx31lilly_baseboard type %d\n",
256			mx31lilly_baseboard);
257	}
258
259	mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS");
260
261	/* SPI */
262	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SCLK__SCLK, "SPI1_CLK");
263	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MOSI__MOSI, "SPI1_TX");
264	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MISO__MISO, "SPI1_RX");
265	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, "SPI1_RDY");
266	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS0__SS0, "SPI1_SS0");
267	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS1__SS1, "SPI1_SS1");
268	mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS2__SS2, "SPI1_SS2");
269
270	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SCLK__SCLK, "SPI2_CLK");
271	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MOSI__MOSI, "SPI2_TX");
272	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MISO__MISO, "SPI2_RX");
273	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, "SPI2_RDY");
274	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS0__SS0, "SPI2_SS0");
275	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1");
276	mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2");
277
278	imx31_add_spi_imx0(&spi0_pdata);
279	imx31_add_spi_imx1(&spi1_pdata);
 
 
 
 
 
 
 
 
 
 
280	spi_register_board_info(&mc13783_dev, 1);
281
 
 
 
 
282	platform_add_devices(devices, ARRAY_SIZE(devices));
283
284	/* USB */
285	lilly1131_usb_init();
286}
287
288static void __init mx31lilly_timer_init(void)
289{
290	mx31_clocks_init(26000000);
291}
292
293static struct sys_timer mx31lilly_timer = {
294	.init	= mx31lilly_timer_init,
295};
296
297MACHINE_START(LILLY1131, "INCO startec LILLY-1131")
298	.boot_params = MX3x_PHYS_OFFSET + 0x100,
299	.map_io = mx31_map_io,
300	.init_early = imx31_init_early,
301	.init_irq = mx31_init_irq,
302	.timer = &mx31lilly_timer,
303	.init_machine = mx31lilly_board_init,
 
 
304MACHINE_END