Commit | Line | Data |
---|---|---|
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 | ||
f5ce6a67 | 26 | #include <linux/init.h> |
f5ce6a67 | 27 | #include <linux/platform_device.h> |
f5ce6a67 HV |
28 | #include <linux/i2c.h> |
29 | #include <linux/i2c/at24.h> | |
f5ce6a67 HV |
30 | #include <linux/mtd/mtd.h> |
31 | #include <linux/mtd/nand.h> | |
32 | #include <linux/mtd/partitions.h> | |
f5ce6a67 | 33 | |
f5ce6a67 | 34 | #include <asm/mach-types.h> |
f5ce6a67 | 35 | #include <asm/mach/arch.h> |
f5ce6a67 HV |
36 | #include <asm/mach/flash.h> |
37 | ||
f5ce6a67 | 38 | #include <mach/common.h> |
ec2a0833 | 39 | #include <linux/platform_data/i2c-davinci.h> |
f5ce6a67 | 40 | #include <mach/serial.h> |
f5ce6a67 | 41 | #include <mach/mux.h> |
ec2a0833 | 42 | #include <linux/platform_data/usb-davinci.h> |
f5ce6a67 | 43 | |
39c6d2d1 MH |
44 | #include "davinci.h" |
45 | ||
f6f97588 | 46 | #define SFFSDR_PHY_ID "davinci_mdio-0:01" |
28552c2e | 47 | static struct mtd_partition davinci_sffsdr_nandflash_partition[] = { |
f5ce6a67 HV |
48 | /* U-Boot Environment: Block 0 |
49 | * UBL: Block 1 | |
50 | * U-Boot: Blocks 6-7 (256 kb) | |
51 | * Integrity Kernel: Blocks 8-31 (3 Mb) | |
52 | * Integrity Data: Blocks 100-END | |
53 | */ | |
54 | { | |
55 | .name = "Linux Kernel", | |
56 | .offset = 32 * SZ_128K, | |
57 | .size = 16 * SZ_128K, /* 2 Mb */ | |
58 | .mask_flags = MTD_WRITEABLE, /* Force read-only */ | |
59 | }, | |
60 | { | |
61 | .name = "Linux ROOT", | |
62 | .offset = MTDPART_OFS_APPEND, | |
63 | .size = 256 * SZ_128K, /* 32 Mb */ | |
64 | .mask_flags = 0, /* R/W */ | |
65 | }, | |
66 | }; | |
67 | ||
68 | static struct flash_platform_data davinci_sffsdr_nandflash_data = { | |
69 | .parts = davinci_sffsdr_nandflash_partition, | |
70 | .nr_parts = ARRAY_SIZE(davinci_sffsdr_nandflash_partition), | |
71 | }; | |
72 | ||
73 | static struct resource davinci_sffsdr_nandflash_resource[] = { | |
74 | { | |
70342174 SS |
75 | .start = DM644X_ASYNC_EMIF_DATA_CE0_BASE, |
76 | .end = DM644X_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1, | |
f5ce6a67 HV |
77 | .flags = IORESOURCE_MEM, |
78 | }, { | |
70342174 SS |
79 | .start = DM644X_ASYNC_EMIF_CONTROL_BASE, |
80 | .end = DM644X_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, | |
f5ce6a67 HV |
81 | .flags = IORESOURCE_MEM, |
82 | }, | |
83 | }; | |
84 | ||
85 | static struct platform_device davinci_sffsdr_nandflash_device = { | |
86 | .name = "davinci_nand", /* Name of driver */ | |
87 | .id = 0, | |
88 | .dev = { | |
89 | .platform_data = &davinci_sffsdr_nandflash_data, | |
90 | }, | |
91 | .num_resources = ARRAY_SIZE(davinci_sffsdr_nandflash_resource), | |
92 | .resource = davinci_sffsdr_nandflash_resource, | |
93 | }; | |
94 | ||
f5ce6a67 HV |
95 | static struct at24_platform_data eeprom_info = { |
96 | .byte_len = (64*1024) / 8, | |
97 | .page_size = 32, | |
98 | .flags = AT24_FLAG_ADDR16, | |
99 | }; | |
100 | ||
101 | static struct i2c_board_info __initdata i2c_info[] = { | |
102 | { | |
103 | I2C_BOARD_INFO("24lc64", 0x50), | |
104 | .platform_data = &eeprom_info, | |
105 | }, | |
106 | /* Other I2C devices: | |
107 | * MSP430, addr 0x23 (not used) | |
108 | * PCA9543, addr 0x70 (setup done by U-Boot) | |
109 | * ADS7828, addr 0x48 (ADC for voltage monitoring.) | |
110 | */ | |
111 | }; | |
112 | ||
113 | static struct davinci_i2c_platform_data i2c_pdata = { | |
114 | .bus_freq = 20 /* kHz */, | |
115 | .bus_delay = 100 /* usec */, | |
116 | }; | |
117 | ||
118 | static void __init sffsdr_init_i2c(void) | |
119 | { | |
120 | davinci_init_i2c(&i2c_pdata); | |
121 | i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); | |
122 | } | |
123 | ||
124 | static struct platform_device *davinci_sffsdr_devices[] __initdata = { | |
125 | &davinci_sffsdr_nandflash_device, | |
126 | }; | |
127 | ||
128 | static struct davinci_uart_config uart_config __initdata = { | |
129 | .enabled_uarts = (1 << 0), | |
130 | }; | |
131 | ||
132 | static void __init davinci_sffsdr_map_io(void) | |
133 | { | |
f5ce6a67 HV |
134 | dm644x_init(); |
135 | } | |
136 | ||
137 | static __init void davinci_sffsdr_init(void) | |
138 | { | |
972412b6 MG |
139 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
140 | ||
f5ce6a67 HV |
141 | platform_add_devices(davinci_sffsdr_devices, |
142 | ARRAY_SIZE(davinci_sffsdr_devices)); | |
143 | sffsdr_init_i2c(); | |
144 | davinci_serial_init(&uart_config); | |
782f2d78 | 145 | soc_info->emac_pdata->phy_id = SFFSDR_PHY_ID; |
355fb4e3 | 146 | davinci_setup_usb(0, 0); /* We support only peripheral mode. */ |
f5ce6a67 HV |
147 | |
148 | /* mux VLYNQ pins */ | |
149 | davinci_cfg_reg(DM644X_VLYNQEN); | |
150 | davinci_cfg_reg(DM644X_VLYNQWD); | |
151 | } | |
152 | ||
f5ce6a67 HV |
153 | MACHINE_START(SFFSDR, "Lyrtech SFFSDR") |
154 | /* Maintainer: Hugo Villeneuve hugo.villeneuve@lyrtech.com */ | |
e7e56014 | 155 | .atag_offset = 0x100, |
f5ce6a67 | 156 | .map_io = davinci_sffsdr_map_io, |
bd808947 | 157 | .init_irq = davinci_irq_init, |
f5ce6a67 HV |
158 | .timer = &davinci_timer, |
159 | .init_machine = davinci_sffsdr_init, | |
3aa3e840 | 160 | .init_late = davinci_init_late, |
f68deabf | 161 | .dma_zone_size = SZ_128M, |
c6121ddd | 162 | .restart = davinci_restart, |
f5ce6a67 | 163 | MACHINE_END |