blob: dcaee043628ee449590edebba994e32636a8ab98 [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>
17
18#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/time.h>
21
22#include <mach/common.h>
23#include <mach/hardware.h>
24#include <mach/irqs.h>
Uwe Kleine-Könige835d882010-02-16 11:07:49 +010025#include <mach/iomux-mx1.h>
Sascha Hauer24205632009-01-28 17:36:37 +010026
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +020027#include "devices-imx1.h"
Sascha Hauer24205632009-01-28 17:36:37 +010028
29/*
30 * This scb9328 has a 32MiB flash
31 */
32static struct resource flash_resource = {
Uwe Kleine-König05a31852010-03-04 21:02:41 +010033 .start = MX1_CS0_PHYS,
34 .end = MX1_CS0_PHYS + (32 * 1024 * 1024) - 1,
Sascha Hauer24205632009-01-28 17:36:37 +010035 .flags = IORESOURCE_MEM,
36};
37
38static struct physmap_flash_data scb_flash_data = {
39 .width = 2,
40};
41
42static struct platform_device scb_flash_device = {
43 .name = "physmap-flash",
44 .id = 0,
45 .dev = {
46 .platform_data = &scb_flash_data,
47 },
48 .resource = &flash_resource,
49 .num_resources = 1,
50};
51
52/*
53 * scb9328 has a DM9000 network controller
54 * connected to CS5, with 16 bit data path
55 * and interrupt connected to GPIO 3
56 */
57
58/*
59 * internal datapath is fixed 16 bit
60 */
61static struct dm9000_plat_data dm9000_platdata = {
62 .flags = DM9000_PLATF_16BITONLY,
63};
64
65/*
66 * the DM9000 drivers wants two defined address spaces
67 * to gain access to address latch registers and the data path.
68 */
69static struct resource dm9000x_resources[] = {
Sascha Hauer9b0e6db2009-06-23 12:14:39 +020070 {
Sascha Hauer24205632009-01-28 17:36:37 +010071 .name = "address area",
Uwe Kleine-König05a31852010-03-04 21:02:41 +010072 .start = MX1_CS5_PHYS,
73 .end = MX1_CS5_PHYS + 1,
Sascha Hauer9b0e6db2009-06-23 12:14:39 +020074 .flags = IORESOURCE_MEM, /* address access */
75 }, {
Sascha Hauer24205632009-01-28 17:36:37 +010076 .name = "data area",
Uwe Kleine-König05a31852010-03-04 21:02:41 +010077 .start = MX1_CS5_PHYS + 4,
78 .end = MX1_CS5_PHYS + 5,
Sascha Hauer9b0e6db2009-06-23 12:14:39 +020079 .flags = IORESOURCE_MEM, /* data access */
80 }, {
Sascha Hauer24205632009-01-28 17:36:37 +010081 .start = IRQ_GPIOC(3),
82 .end = IRQ_GPIOC(3),
Sascha Hauer9b0e6db2009-06-23 12:14:39 +020083 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Sascha Hauer24205632009-01-28 17:36:37 +010084 },
85};
86
87static struct platform_device dm9000x_device = {
88 .name = "dm9000",
89 .id = 0,
90 .num_resources = ARRAY_SIZE(dm9000x_resources),
91 .resource = dm9000x_resources,
92 .dev = {
93 .platform_data = &dm9000_platdata,
94 }
95};
96
Uwe Kleine-König6c80ee52010-09-28 21:53:31 +020097static const int mxc_uart1_pins[] = {
Sascha Hauer24205632009-01-28 17:36:37 +010098 PC9_PF_UART1_CTS,
99 PC10_PF_UART1_RTS,
100 PC11_PF_UART1_TXD,
101 PC12_PF_UART1_RXD,
102};
103
104static int uart1_mxc_init(struct platform_device *pdev)
105{
106 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
107 ARRAY_SIZE(mxc_uart1_pins), "UART1");
108}
109
Uwe Kleine-Königa02b0422010-03-05 11:04:45 +0100110static void uart1_mxc_exit(struct platform_device *pdev)
Sascha Hauer24205632009-01-28 17:36:37 +0100111{
112 mxc_gpio_release_multiple_pins(mxc_uart1_pins,
113 ARRAY_SIZE(mxc_uart1_pins));
Sascha Hauer24205632009-01-28 17:36:37 +0100114}
115
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +0200116static const struct imxuart_platform_data uart_pdata __initconst = {
Sascha Hauer24205632009-01-28 17:36:37 +0100117 .init = uart1_mxc_init,
118 .exit = uart1_mxc_exit,
119 .flags = IMXUART_HAVE_RTSCTS,
120};
121
122static struct platform_device *devices[] __initdata = {
123 &scb_flash_device,
124 &dm9000x_device,
125};
126
127/*
128 * scb9328_init - Init the CPU card itself
129 */
130static void __init scb9328_init(void)
131{
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +0200132 imx1_add_imx_uart0(&uart_pdata);
Sascha Hauer24205632009-01-28 17:36:37 +0100133
134 printk(KERN_INFO"Scb9328: Adding devices\n");
135 platform_add_devices(devices, ARRAY_SIZE(devices));
136}
137
138static void __init scb9328_timer_init(void)
139{
140 mx1_clocks_init(32000);
141}
142
143static struct sys_timer scb9328_timer = {
144 .init = scb9328_timer_init,
145};
146
147MACHINE_START(SCB9328, "Synertronixx scb9328")
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100148 /* Sascha Hauer */
149 .boot_params = 0x08000100,
150 .map_io = mx1_map_io,
151 .init_early = imx1_init_early,
152 .init_irq = mx1_init_irq,
153 .timer = &scb9328_timer,
154 .init_machine = scb9328_init,
Sascha Hauer24205632009-01-28 17:36:37 +0100155MACHINE_END