blob: 5062fcb8849854234fa1770721c37089d69d3684 [file] [log] [blame]
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +00001/*
2 * linux/arch/arm/mach-imx/mach-apf9328.c
3 *
4 * Copyright (c) 2005-2011 ARMadeus systems <support@armadeus.com>
5 *
6 * This work is based on mach-scb9328.c which is:
7 * Copyright (c) 2004 Sascha Hauer <saschahauer@web.de>
8 * Copyright (c) 2006-2008 Juergen Beisert <jbeisert@netscape.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 */
15
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/platform_device.h>
19#include <linux/mtd/physmap.h>
20#include <linux/dm9000.h>
Shawn Guo438196c2011-12-05 10:12:28 +080021#include <linux/gpio.h>
Gwenhael Goavec-Merou7a994812011-10-08 17:19:49 +020022#include <linux/i2c.h>
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +000023
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/time.h>
27
28#include <mach/common.h>
29#include <mach/hardware.h>
30#include <mach/irqs.h>
31#include <mach/iomux-mx1.h>
32
33#include "devices-imx1.h"
34
35static const int apf9328_pins[] __initconst = {
36 /* UART1 */
37 PC9_PF_UART1_CTS,
38 PC10_PF_UART1_RTS,
39 PC11_PF_UART1_TXD,
40 PC12_PF_UART1_RXD,
41 /* UART2 */
42 PB28_PF_UART2_CTS,
43 PB29_PF_UART2_RTS,
44 PB30_PF_UART2_TXD,
45 PB31_PF_UART2_RXD,
Gwenhael Goavec-Merou7a994812011-10-08 17:19:49 +020046 /* I2C */
47 PA15_PF_I2C_SDA,
48 PA16_PF_I2C_SCL,
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +000049};
50
51/*
52 * The APF9328 can have up to 32MB NOR Flash
53 */
54static struct resource flash_resource = {
55 .start = MX1_CS0_PHYS,
56 .end = MX1_CS0_PHYS + SZ_32M - 1,
57 .flags = IORESOURCE_MEM,
58};
59
60static struct physmap_flash_data apf9328_flash_data = {
61 .width = 2,
62};
63
64static struct platform_device apf9328_flash_device = {
65 .name = "physmap-flash",
66 .id = 0,
67 .dev = {
68 .platform_data = &apf9328_flash_data,
69 },
70 .resource = &flash_resource,
71 .num_resources = 1,
72};
73
74/*
75 * APF9328 has a DM9000 Ethernet controller
76 */
77static struct dm9000_plat_data dm9000_setup = {
78 .flags = DM9000_PLATF_16BITONLY
79};
80
81static struct resource dm9000_resources[] = {
82 {
83 .start = MX1_CS4_PHYS + 0x00C00000,
84 .end = MX1_CS4_PHYS + 0x00C00001,
85 .flags = IORESOURCE_MEM,
86 }, {
87 .start = MX1_CS4_PHYS + 0x00C00002,
88 .end = MX1_CS4_PHYS + 0x00C00003,
89 .flags = IORESOURCE_MEM,
90 }, {
Shawn Guo438196c2011-12-05 10:12:28 +080091 /* irq number is run-time assigned */
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +000092 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
93 },
94};
95
96static struct platform_device dm9000x_device = {
97 .name = "dm9000",
98 .id = 0,
99 .num_resources = ARRAY_SIZE(dm9000_resources),
100 .resource = dm9000_resources,
101 .dev = {
102 .platform_data = &dm9000_setup,
103 }
104};
105
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +0000106static const struct imxuart_platform_data uart1_pdata __initconst = {
107 .flags = IMXUART_HAVE_RTSCTS,
108};
109
Gwenhael Goavec-Merou7a994812011-10-08 17:19:49 +0200110static const struct imxi2c_platform_data apf9328_i2c_data __initconst = {
111 .bitrate = 100000,
112};
113
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +0000114static struct platform_device *devices[] __initdata = {
115 &apf9328_flash_device,
116 &dm9000x_device,
117};
118
119static void __init apf9328_init(void)
120{
Shawn Guob78d8e52011-06-06 00:07:55 +0800121 imx1_soc_init();
122
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +0000123 mxc_gpio_setup_multiple_pins(apf9328_pins,
124 ARRAY_SIZE(apf9328_pins),
125 "APF9328");
126
Fabio Estevam07d14832011-05-10 11:21:00 -0300127 imx1_add_imx_uart0(NULL);
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +0000128 imx1_add_imx_uart1(&uart1_pdata);
129
Gwenhael Goavec-Merou7a994812011-10-08 17:19:49 +0200130 imx1_add_imx_i2c(&apf9328_i2c_data);
131
Shawn Guo438196c2011-12-05 10:12:28 +0800132 dm9000_resources[2].start = gpio_to_irq(IMX_GPIO_NR(2, 14));
133 dm9000_resources[2].end = gpio_to_irq(IMX_GPIO_NR(2, 14));
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +0000134 platform_add_devices(devices, ARRAY_SIZE(devices));
135}
136
137static void __init apf9328_timer_init(void)
138{
139 mx1_clocks_init(32768);
140}
141
142static struct sys_timer apf9328_timer = {
143 .init = apf9328_timer_init,
144};
145
146MACHINE_START(APF9328, "Armadeus APF9328")
147 /* Maintainer: Gwenhael Goavec-Merou, ARMadeus Systems */
148 .map_io = mx1_map_io,
149 .init_early = imx1_init_early,
150 .init_irq = mx1_init_irq,
Sascha Hauerffa2ea32011-09-20 14:31:24 +0200151 .handle_irq = imx1_handle_irq,
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +0000152 .timer = &apf9328_timer,
153 .init_machine = apf9328_init,
Russell King65ea7882011-11-06 17:12:08 +0000154 .restart = mxc_restart,
Gwenhael Goavec-Merou7fc92c62011-04-29 05:21:39 +0000155MACHINE_END