blob: 1f6bc3f7ae1478aec6e48948e3cde0b1b4169c52 [file] [log] [blame]
Sascha Hauer24205632009-01-28 17:36:37 +01001/*
Uwe Kleine-König95c00462009-12-09 20:12:07 +01002 * linux/arch/arm/mach-mx1/mach-scb9328.c
Sascha Hauer24205632009-01-28 17:36:37 +01003 *
4 * Copyright (c) 2004 Sascha Hauer <saschahauer@web.de>
5 * Copyright (c) 2006-2008 Juergen Beisert <jbeisert@netscape.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/interrupt.h>
16#include <linux/dm9000.h>
Shawn Guo438196c2011-12-05 10:12:28 +080017#include <linux/gpio.h>
Sascha Hauer24205632009-01-28 17:36:37 +010018
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/time.h>
22
Shawn Guoe3372472012-09-13 21:01:00 +080023#include "common.h"
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +020024#include "devices-imx1.h"
Shawn Guo50f2de62012-09-14 14:14:45 +080025#include "hardware.h"
Shawn Guo267dd342012-09-13 13:26:00 +080026#include "iomux-mx1.h"
Sascha Hauer24205632009-01-28 17:36:37 +010027
28/*
29 * This scb9328 has a 32MiB flash
30 */
31static struct resource flash_resource = {
Uwe Kleine-König05a31852010-03-04 21:02:41 +010032 .start = MX1_CS0_PHYS,
33 .end = MX1_CS0_PHYS + (32 * 1024 * 1024) - 1,
Sascha Hauer24205632009-01-28 17:36:37 +010034 .flags = IORESOURCE_MEM,
35};
36
37static struct physmap_flash_data scb_flash_data = {
38 .width = 2,
39};
40
41static struct platform_device scb_flash_device = {
42 .name = "physmap-flash",
43 .id = 0,
44 .dev = {
45 .platform_data = &scb_flash_data,
46 },
47 .resource = &flash_resource,
48 .num_resources = 1,
49};
50
51/*
52 * scb9328 has a DM9000 network controller
53 * connected to CS5, with 16 bit data path
54 * and interrupt connected to GPIO 3
55 */
56
57/*
58 * internal datapath is fixed 16 bit
59 */
60static struct dm9000_plat_data dm9000_platdata = {
61 .flags = DM9000_PLATF_16BITONLY,
62};
63
64/*
65 * the DM9000 drivers wants two defined address spaces
66 * to gain access to address latch registers and the data path.
67 */
68static struct resource dm9000x_resources[] = {
Sascha Hauer9b0e6db2009-06-23 12:14:39 +020069 {
Sascha Hauer24205632009-01-28 17:36:37 +010070 .name = "address area",
Uwe Kleine-König05a31852010-03-04 21:02:41 +010071 .start = MX1_CS5_PHYS,
72 .end = MX1_CS5_PHYS + 1,
Sascha Hauer9b0e6db2009-06-23 12:14:39 +020073 .flags = IORESOURCE_MEM, /* address access */
74 }, {
Sascha Hauer24205632009-01-28 17:36:37 +010075 .name = "data area",
Uwe Kleine-König05a31852010-03-04 21:02:41 +010076 .start = MX1_CS5_PHYS + 4,
77 .end = MX1_CS5_PHYS + 5,
Sascha Hauer9b0e6db2009-06-23 12:14:39 +020078 .flags = IORESOURCE_MEM, /* data access */
79 }, {
Shawn Guo438196c2011-12-05 10:12:28 +080080 /* irq number is run-time assigned */
Sascha Hauer9b0e6db2009-06-23 12:14:39 +020081 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Sascha Hauer24205632009-01-28 17:36:37 +010082 },
83};
84
85static struct platform_device dm9000x_device = {
86 .name = "dm9000",
87 .id = 0,
88 .num_resources = ARRAY_SIZE(dm9000x_resources),
89 .resource = dm9000x_resources,
90 .dev = {
91 .platform_data = &dm9000_platdata,
92 }
93};
94
Uwe Kleine-König6c80ee52010-09-28 21:53:31 +020095static const int mxc_uart1_pins[] = {
Sascha Hauer24205632009-01-28 17:36:37 +010096 PC9_PF_UART1_CTS,
97 PC10_PF_UART1_RTS,
98 PC11_PF_UART1_TXD,
99 PC12_PF_UART1_RXD,
100};
101
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +0200102static const struct imxuart_platform_data uart_pdata __initconst = {
Sascha Hauer24205632009-01-28 17:36:37 +0100103 .flags = IMXUART_HAVE_RTSCTS,
104};
105
106static struct platform_device *devices[] __initdata = {
107 &scb_flash_device,
108 &dm9000x_device,
109};
110
111/*
112 * scb9328_init - Init the CPU card itself
113 */
114static void __init scb9328_init(void)
115{
Shawn Guob78d8e52011-06-06 00:07:55 +0800116 imx1_soc_init();
117
Fabio Estevam31b738a2011-06-21 14:49:36 -0300118 mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
119 ARRAY_SIZE(mxc_uart1_pins), "UART1");
120
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +0200121 imx1_add_imx_uart0(&uart_pdata);
Sascha Hauer24205632009-01-28 17:36:37 +0100122
123 printk(KERN_INFO"Scb9328: Adding devices\n");
Shawn Guo438196c2011-12-05 10:12:28 +0800124 dm9000x_resources[2].start = gpio_to_irq(IMX_GPIO_NR(3, 3));
125 dm9000x_resources[2].end = gpio_to_irq(IMX_GPIO_NR(3, 3));
Sascha Hauer24205632009-01-28 17:36:37 +0100126 platform_add_devices(devices, ARRAY_SIZE(devices));
127}
128
129static void __init scb9328_timer_init(void)
130{
131 mx1_clocks_init(32000);
132}
133
Sascha Hauer24205632009-01-28 17:36:37 +0100134MACHINE_START(SCB9328, "Synertronixx scb9328")
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100135 /* Sascha Hauer */
Nicolas Pitredc8f1902011-07-05 22:38:12 -0400136 .atag_offset = 100,
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100137 .map_io = mx1_map_io,
138 .init_early = imx1_init_early,
139 .init_irq = mx1_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700140 .init_time = scb9328_timer_init,
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100141 .init_machine = scb9328_init,
Russell King65ea7882011-11-06 17:12:08 +0000142 .restart = mxc_restart,
Sascha Hauer24205632009-01-28 17:36:37 +0100143MACHINE_END