davinci: Move serial platform_device into SoC-specific files
[deliverable/linux.git] / arch / arm / mach-davinci / board-sffsdr.c
CommitLineData
f5ce6a67
HV
1/*
2 * Lyrtech SFFSDR board support.
3 *
4 * Copyright (C) 2008 Philip Balister, OpenSDR <philip@opensdr.com>
5 * Copyright (C) 2008 Lyrtech <www.lyrtech.com>
6 *
7 * Based on DV-EVM platform, original copyright follows:
8 *
9 * Copyright (C) 2007 MontaVista Software, Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <linux/kernel.h>
27#include <linux/module.h>
28#include <linux/init.h>
29#include <linux/dma-mapping.h>
30#include <linux/platform_device.h>
31#include <linux/gpio.h>
32
33#include <linux/i2c.h>
34#include <linux/i2c/at24.h>
35#include <linux/etherdevice.h>
36#include <linux/mtd/mtd.h>
37#include <linux/mtd/nand.h>
38#include <linux/mtd/partitions.h>
39#include <linux/mtd/physmap.h>
40#include <linux/io.h>
41
42#include <asm/setup.h>
43#include <asm/mach-types.h>
44
45#include <asm/mach/arch.h>
46#include <asm/mach/map.h>
47#include <asm/mach/flash.h>
48
49#include <mach/dm644x.h>
50#include <mach/common.h>
ac7b75b5 51#include <mach/emac.h>
f5ce6a67
HV
52#include <mach/i2c.h>
53#include <mach/serial.h>
54#include <mach/psc.h>
55#include <mach/mux.h>
79c3c0b7 56#include <mach/common.h>
f5ce6a67 57
ac7b75b5
KH
58#define SFFSDR_PHY_MASK (0x2)
59#define SFFSDR_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
60
f5ce6a67
HV
61#define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e00000
62#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
63
64struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
65 /* U-Boot Environment: Block 0
66 * UBL: Block 1
67 * U-Boot: Blocks 6-7 (256 kb)
68 * Integrity Kernel: Blocks 8-31 (3 Mb)
69 * Integrity Data: Blocks 100-END
70 */
71 {
72 .name = "Linux Kernel",
73 .offset = 32 * SZ_128K,
74 .size = 16 * SZ_128K, /* 2 Mb */
75 .mask_flags = MTD_WRITEABLE, /* Force read-only */
76 },
77 {
78 .name = "Linux ROOT",
79 .offset = MTDPART_OFS_APPEND,
80 .size = 256 * SZ_128K, /* 32 Mb */
81 .mask_flags = 0, /* R/W */
82 },
83};
84
85static struct flash_platform_data davinci_sffsdr_nandflash_data = {
86 .parts = davinci_sffsdr_nandflash_partition,
87 .nr_parts = ARRAY_SIZE(davinci_sffsdr_nandflash_partition),
88};
89
90static struct resource davinci_sffsdr_nandflash_resource[] = {
91 {
92 .start = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE,
93 .end = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
94 .flags = IORESOURCE_MEM,
95 }, {
96 .start = DAVINCI_ASYNC_EMIF_CONTROL_BASE,
97 .end = DAVINCI_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1,
98 .flags = IORESOURCE_MEM,
99 },
100};
101
102static struct platform_device davinci_sffsdr_nandflash_device = {
103 .name = "davinci_nand", /* Name of driver */
104 .id = 0,
105 .dev = {
106 .platform_data = &davinci_sffsdr_nandflash_data,
107 },
108 .num_resources = ARRAY_SIZE(davinci_sffsdr_nandflash_resource),
109 .resource = davinci_sffsdr_nandflash_resource,
110};
111
ac7b75b5
KH
112static struct emac_platform_data sffsdr_emac_pdata = {
113 .phy_mask = SFFSDR_PHY_MASK,
114 .mdio_max_freq = SFFSDR_MDIO_FREQUENCY,
115};
f5ce6a67
HV
116
117static struct at24_platform_data eeprom_info = {
118 .byte_len = (64*1024) / 8,
119 .page_size = 32,
120 .flags = AT24_FLAG_ADDR16,
121};
122
123static struct i2c_board_info __initdata i2c_info[] = {
124 {
125 I2C_BOARD_INFO("24lc64", 0x50),
126 .platform_data = &eeprom_info,
127 },
128 /* Other I2C devices:
129 * MSP430, addr 0x23 (not used)
130 * PCA9543, addr 0x70 (setup done by U-Boot)
131 * ADS7828, addr 0x48 (ADC for voltage monitoring.)
132 */
133};
134
135static struct davinci_i2c_platform_data i2c_pdata = {
136 .bus_freq = 20 /* kHz */,
137 .bus_delay = 100 /* usec */,
138};
139
140static void __init sffsdr_init_i2c(void)
141{
142 davinci_init_i2c(&i2c_pdata);
143 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
144}
145
146static struct platform_device *davinci_sffsdr_devices[] __initdata = {
147 &davinci_sffsdr_nandflash_device,
148};
149
150static struct davinci_uart_config uart_config __initdata = {
151 .enabled_uarts = (1 << 0),
152};
153
154static void __init davinci_sffsdr_map_io(void)
155{
f5ce6a67
HV
156 dm644x_init();
157}
158
159static __init void davinci_sffsdr_init(void)
160{
161 platform_add_devices(davinci_sffsdr_devices,
162 ARRAY_SIZE(davinci_sffsdr_devices));
163 sffsdr_init_i2c();
164 davinci_serial_init(&uart_config);
ac7b75b5 165 dm644x_init_emac(&sffsdr_emac_pdata);
f5ce6a67
HV
166 setup_usb(0, 0); /* We support only peripheral mode. */
167
168 /* mux VLYNQ pins */
169 davinci_cfg_reg(DM644X_VLYNQEN);
170 davinci_cfg_reg(DM644X_VLYNQWD);
171}
172
173static __init void davinci_sffsdr_irq_init(void)
174{
175 davinci_irq_init();
176}
177
178MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
179 /* Maintainer: Hugo Villeneuve hugo.villeneuve@lyrtech.com */
180 .phys_io = IO_PHYS,
181 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
182 .boot_params = (DAVINCI_DDR_BASE + 0x100),
183 .map_io = davinci_sffsdr_map_io,
184 .init_irq = davinci_sffsdr_irq_init,
185 .timer = &davinci_timer,
186 .init_machine = davinci_sffsdr_init,
187MACHINE_END
This page took 0.032712 seconds and 5 git commands to generate.