3 The following patch series adds support for the Technologic Systems
4 TS-7800[1]. This is an updated driver to the one I posted before[2] which
5 takes on all the advice and fixes suggested here.
11 Signed-off-by: Alexander Clouter <alex@digriz.org.uk>
13 [1] http://www.embeddedarm.com/products/board-detail.php?product=TS-7800
14 [2] http://lists.arm.linux.org.uk/lurker/message/20080522.190133.54887e96.en.html
17 arch/arm/mach-orion5x/Kconfig | 7 +
18 arch/arm/mach-orion5x/Makefile | 1 +
19 arch/arm/mach-orion5x/ts78xx-setup.c | 257 ++++++++++++++++++++++++++++++++++
20 3 files changed, 265 insertions(+), 0 deletions(-)
21 create mode 100644 arch/arm/mach-orion5x/ts78xx-setup.c
23 --- a/arch/arm/mach-orion5x/Kconfig
24 +++ b/arch/arm/mach-orion5x/Kconfig
26 Say 'Y' here if you want your kernel to support the
27 HP Media Vault mv2120 or mv5100.
30 + bool "Technologic Systems TS-78xx"
31 + select CPU_FEROCEON_OLD_ID
33 + Say 'Y' here if you want your kernel to support the
34 + Technologic Systems TS-78xx platform.
39 --- a/arch/arm/mach-orion5x/Makefile
40 +++ b/arch/arm/mach-orion5x/Makefile
42 obj-$(CONFIG_MACH_TS409) += ts409-setup.o
43 obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o
44 obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
45 +obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o
47 +++ b/arch/arm/mach-orion5x/ts78xx-setup.c
50 + * arch/arm/mach-orion5x/ts78xx-setup.c
52 + * Maintainer: Alexander Clouter <alex@digriz.org.uk>
54 + * This file is licensed under the terms of the GNU General Public
55 + * License version 2. This program is licensed "as is" without any
56 + * warranty of any kind, whether express or implied.
59 +#include <linux/kernel.h>
60 +#include <linux/init.h>
61 +#include <linux/platform_device.h>
62 +#include <linux/mtd/physmap.h>
63 +#include <linux/mv643xx_eth.h>
64 +#include <linux/ata_platform.h>
65 +#include <linux/m48t86.h>
66 +#include <asm/mach-types.h>
67 +#include <asm/mach/arch.h>
68 +#include <asm/mach/map.h>
69 +#include <asm/arch/orion5x.h>
73 +/*****************************************************************************
75 + ****************************************************************************/
78 + * FPGA - lives where the PCI bus would be at ORION5X_PCI_MEM_PHYS_BASE
80 +#define TS78XX_FPGA_REGS_PHYS_BASE 0xe8000000
81 +#define TS78XX_FPGA_REGS_VIRT_BASE 0xff900000
82 +#define TS78XX_FPGA_REGS_SIZE SZ_1M
84 +#define TS78XX_FPGA_REGS_RTC_CTRL TS78XX_FPGA_REGS_VIRT_BASE | 0x808
85 +#define TS78XX_FPGA_REGS_RTC_DATA TS78XX_FPGA_REGS_VIRT_BASE | 0x80c
88 + * 512kB NOR flash Device
90 +#define TS78XX_NOR_BOOT_BASE 0xff800000
91 +#define TS78XX_NOR_BOOT_SIZE SZ_512K
93 +/*****************************************************************************
94 + * I/O Address Mapping
95 + ****************************************************************************/
96 +static struct map_desc ts78xx_io_desc[] __initdata = {
98 + .virtual = TS78XX_FPGA_REGS_VIRT_BASE,
99 + .pfn = __phys_to_pfn(TS78XX_FPGA_REGS_PHYS_BASE),
100 + .length = TS78XX_FPGA_REGS_SIZE,
105 +void __init ts78xx_map_io(void)
108 + iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc));
111 +/*****************************************************************************
112 + * 512kB NOR Boot Flash - the chip is a M25P40
113 + ****************************************************************************/
114 +static struct mtd_partition ts78xx_nor_boot_flash_resources[] = {
116 + .name = "ts-bootrom",
118 + /* only the first 256kB is used */
120 + .mask_flags = MTD_WRITEABLE,
124 +static struct physmap_flash_data ts78xx_nor_boot_flash_data = {
126 + .parts = ts78xx_nor_boot_flash_resources,
127 + .nr_parts = ARRAY_SIZE(ts78xx_nor_boot_flash_resources),
130 +static struct resource ts78xx_nor_boot_flash_resource = {
131 + .flags = IORESOURCE_MEM,
132 + .start = TS78XX_NOR_BOOT_BASE,
133 + .end = TS78XX_NOR_BOOT_BASE + TS78XX_NOR_BOOT_SIZE - 1,
136 +static struct platform_device ts78xx_nor_boot_flash = {
137 + .name = "physmap-flash",
140 + .platform_data = &ts78xx_nor_boot_flash_data,
142 + .num_resources = 1,
143 + .resource = &ts78xx_nor_boot_flash_resource,
146 +/*****************************************************************************
148 + ****************************************************************************/
151 + * WARNING: TS shunt the PCI IO via the FPGA so that you could build soft-PCI
152 + * devices for it and what-not. There is nothing on the PCI or
153 + * PCIe buses so probably nothing really to do yet here, if ever
156 +/*****************************************************************************
158 + ****************************************************************************/
159 +static struct mv643xx_eth_platform_data ts78xx_eth_data = {
161 + .force_phy_addr = 1,
164 +/*****************************************************************************
165 + * RTC M48T86 - nicked^Wborrowed from arch/arm/mach-ep93xx/ts72xx.c
166 + ****************************************************************************/
167 +static unsigned char ts78xx_rtc_readbyte(unsigned long addr)
169 + writeb(addr, TS78XX_FPGA_REGS_RTC_CTRL);
170 + return readb(TS78XX_FPGA_REGS_RTC_DATA);
173 +static void ts78xx_rtc_writebyte(unsigned char value, unsigned long addr)
175 + writeb(addr, TS78XX_FPGA_REGS_RTC_CTRL);
176 + writeb(value, TS78XX_FPGA_REGS_RTC_DATA);
179 +static struct m48t86_ops ts78xx_rtc_ops = {
180 + .readbyte = ts78xx_rtc_readbyte,
181 + .writebyte = ts78xx_rtc_writebyte,
184 +static struct platform_device ts78xx_rtc_device = {
185 + .name = "rtc-m48t86",
188 + .platform_data = &ts78xx_rtc_ops,
190 + .num_resources = 0,
193 +/*****************************************************************************
195 + ****************************************************************************/
196 +static struct mv_sata_platform_data ts78xx_sata_data = {
200 +/*****************************************************************************
202 + ****************************************************************************/
203 +static void __init ts78xx_init(void)
205 +#ifdef CONFIG_RTC_DRV_M48T86
206 + unsigned char tmp_rtc0, tmp_rtc1;
210 + * Setup basic Orion functions. Need to be called early.
214 + orion5x_mpp_conf(0, MPP_UNUSED);
217 + * MPP[1] JTAG Clock
218 + * MPP[2] JTAG Data In
219 + * MPP[3] Lattice ECP2 256 FPGA - PB2B
220 + * MPP[4] JTAG Data Out
222 + * MPP[6] Lattice ECP2 256 FPGA - PB31A_CLK4+
223 + * MPP[7] Lattice ECP2 256 FPGA - PB22B
226 + orion5x_mpp_conf(8, MPP_UNUSED);
227 + orion5x_mpp_conf(9, MPP_UNUSED);
228 + orion5x_mpp_conf(10, MPP_UNUSED);
229 + orion5x_mpp_conf(11, MPP_UNUSED);
230 + orion5x_mpp_conf(12, MPP_UNUSED);
231 + orion5x_mpp_conf(13, MPP_UNUSED);
232 + orion5x_mpp_conf(14, MPP_UNUSED);
233 + orion5x_mpp_conf(15, MPP_UNUSED);
234 + orion5x_mpp_conf(16, MPP_UART);
235 + orion5x_mpp_conf(17, MPP_UART);
236 + orion5x_mpp_conf(18, MPP_UART);
237 + orion5x_mpp_conf(19, MPP_UART);
240 + * MPP[20] PCI Clock Out 1
241 + * MPP[21] PCI Clock Out 0
249 + * Configure peripherals.
251 + orion5x_ehci0_init();
252 + orion5x_ehci1_init();
253 + orion5x_eth_init(&ts78xx_eth_data);
254 + orion5x_sata_init(&ts78xx_sata_data);
255 + orion5x_uart0_init();
256 + orion5x_uart1_init();
258 + orion5x_setup_dev_boot_win(TS78XX_NOR_BOOT_BASE,
259 + TS78XX_NOR_BOOT_SIZE);
260 + platform_device_register(&ts78xx_nor_boot_flash);
262 +#ifdef CONFIG_RTC_DRV_M48T86
264 + * TS uses some of the user storage space on the RTC chip so see if it
265 + * is present; as it's an optional feature at purchase time and not all
266 + * boards will have it present
268 + * I've used the method TS use in their rtc7800.c example for the
269 + * detection logic; a little 'funky' but thats what floats my boat
271 + * TODO: track down a guinea pig without an RTC to see if we can work
272 + * out a better RTC detection routine
274 + tmp_rtc0 = ts78xx_rtc_readbyte(126);
275 + tmp_rtc1 = ts78xx_rtc_readbyte(127);
277 + ts78xx_rtc_writebyte(0x00, 126);
278 + ts78xx_rtc_writebyte(0x55, 127);
279 + if (ts78xx_rtc_readbyte(127) == 0x55) {
280 + ts78xx_rtc_writebyte(0xaa, 127);
281 + if (ts78xx_rtc_readbyte(127) == 0xaa
282 + && ts78xx_rtc_readbyte(126) == 0x00) {
283 + ts78xx_rtc_writebyte(tmp_rtc0, 126);
284 + ts78xx_rtc_writebyte(tmp_rtc1, 127);
285 + platform_device_register(&ts78xx_rtc_device);
289 + printk(KERN_INFO "TS-78xx RTC not detected\n");
296 +MACHINE_START(TS78XX, "Technologic Systems TS-78xx SBC")
297 + /* Maintainer: Alexander Clouter <alex@digriz.org.uk> */
298 + .phys_io = ORION5X_REGS_PHYS_BASE,
299 + .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
300 + .boot_params = 0x00000100,
301 + .init_machine = ts78xx_init,
302 + .map_io = ts78xx_map_io,
303 + .init_irq = orion5x_init_irq,
304 + .timer = &orion5x_timer,