blob: 0b136a831c59563100312646d0b1b1324e8c4e20 [file] [log] [blame]
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -07001/*
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
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070026#include <linux/init.h>
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070027#include <linux/platform_device.h>
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070028#include <linux/i2c.h>
29#include <linux/i2c/at24.h>
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070030#include <linux/mtd/mtd.h>
31#include <linux/mtd/nand.h>
32#include <linux/mtd/partitions.h>
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070033
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070034#include <asm/mach-types.h>
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070035#include <asm/mach/arch.h>
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070036#include <asm/mach/flash.h>
37
38#include <mach/dm644x.h>
39#include <mach/common.h>
40#include <mach/i2c.h>
41#include <mach/serial.h>
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070042#include <mach/mux.h>
Sergei Shtylyov355fb4e2009-10-30 23:46:14 +040043#include <mach/usb.h>
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070044
Cyril Chemparathy782f2d72010-09-15 10:11:25 -040045#define SFFSDR_PHY_ID "0:01"
Kevin Hilman28552c22010-02-25 15:36:38 -080046static struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070047 /* U-Boot Environment: Block 0
48 * UBL: Block 1
49 * U-Boot: Blocks 6-7 (256 kb)
50 * Integrity Kernel: Blocks 8-31 (3 Mb)
51 * Integrity Data: Blocks 100-END
52 */
53 {
54 .name = "Linux Kernel",
55 .offset = 32 * SZ_128K,
56 .size = 16 * SZ_128K, /* 2 Mb */
57 .mask_flags = MTD_WRITEABLE, /* Force read-only */
58 },
59 {
60 .name = "Linux ROOT",
61 .offset = MTDPART_OFS_APPEND,
62 .size = 256 * SZ_128K, /* 32 Mb */
63 .mask_flags = 0, /* R/W */
64 },
65};
66
67static struct flash_platform_data davinci_sffsdr_nandflash_data = {
68 .parts = davinci_sffsdr_nandflash_partition,
69 .nr_parts = ARRAY_SIZE(davinci_sffsdr_nandflash_partition),
70};
71
72static struct resource davinci_sffsdr_nandflash_resource[] = {
73 {
Sergei Shtylyov70342172010-04-16 21:29:11 +040074 .start = DM644X_ASYNC_EMIF_DATA_CE0_BASE,
75 .end = DM644X_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070076 .flags = IORESOURCE_MEM,
77 }, {
Sergei Shtylyov70342172010-04-16 21:29:11 +040078 .start = DM644X_ASYNC_EMIF_CONTROL_BASE,
79 .end = DM644X_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1,
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070080 .flags = IORESOURCE_MEM,
81 },
82};
83
84static struct platform_device davinci_sffsdr_nandflash_device = {
85 .name = "davinci_nand", /* Name of driver */
86 .id = 0,
87 .dev = {
88 .platform_data = &davinci_sffsdr_nandflash_data,
89 },
90 .num_resources = ARRAY_SIZE(davinci_sffsdr_nandflash_resource),
91 .resource = davinci_sffsdr_nandflash_resource,
92};
93
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -070094static struct at24_platform_data eeprom_info = {
95 .byte_len = (64*1024) / 8,
96 .page_size = 32,
97 .flags = AT24_FLAG_ADDR16,
98};
99
100static struct i2c_board_info __initdata i2c_info[] = {
101 {
102 I2C_BOARD_INFO("24lc64", 0x50),
103 .platform_data = &eeprom_info,
104 },
105 /* Other I2C devices:
106 * MSP430, addr 0x23 (not used)
107 * PCA9543, addr 0x70 (setup done by U-Boot)
108 * ADS7828, addr 0x48 (ADC for voltage monitoring.)
109 */
110};
111
112static struct davinci_i2c_platform_data i2c_pdata = {
113 .bus_freq = 20 /* kHz */,
114 .bus_delay = 100 /* usec */,
115};
116
117static void __init sffsdr_init_i2c(void)
118{
119 davinci_init_i2c(&i2c_pdata);
120 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
121}
122
123static struct platform_device *davinci_sffsdr_devices[] __initdata = {
124 &davinci_sffsdr_nandflash_device,
125};
126
127static struct davinci_uart_config uart_config __initdata = {
128 .enabled_uarts = (1 << 0),
129};
130
131static void __init davinci_sffsdr_map_io(void)
132{
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -0700133 dm644x_init();
134}
135
136static __init void davinci_sffsdr_init(void)
137{
Mark A. Greer972412b2009-04-15 12:40:56 -0700138 struct davinci_soc_info *soc_info = &davinci_soc_info;
139
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -0700140 platform_add_devices(davinci_sffsdr_devices,
141 ARRAY_SIZE(davinci_sffsdr_devices));
142 sffsdr_init_i2c();
143 davinci_serial_init(&uart_config);
Cyril Chemparathy782f2d72010-09-15 10:11:25 -0400144 soc_info->emac_pdata->phy_id = SFFSDR_PHY_ID;
Sergei Shtylyov355fb4e2009-10-30 23:46:14 +0400145 davinci_setup_usb(0, 0); /* We support only peripheral mode. */
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -0700146
147 /* mux VLYNQ pins */
148 davinci_cfg_reg(DM644X_VLYNQEN);
149 davinci_cfg_reg(DM644X_VLYNQWD);
150}
151
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -0700152MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
153 /* Maintainer: Hugo Villeneuve hugo.villeneuve@lyrtech.com */
Nicolas Pitree7e56012011-07-05 22:38:11 -0400154 .atag_offset = 0x100,
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -0700155 .map_io = davinci_sffsdr_map_io,
Cyril Chemparathybd808942010-05-07 17:06:37 -0400156 .init_irq = davinci_irq_init,
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -0700157 .timer = &davinci_timer,
158 .init_machine = davinci_sffsdr_init,
Nicolas Pitref68deab2011-07-05 22:28:08 -0400159 .dma_zone_size = SZ_128M,
Sekhar Noric6121dd2011-12-05 11:29:46 +0100160 .restart = davinci_restart,
Hugo Villeneuvef5ce6a62009-04-29 16:46:57 -0700161MACHINE_END