blob: d83b80478b091781086bd94ad087d3d606995260 [file] [log] [blame]
Manfred Gruberd941caa2006-12-17 22:10:48 +01001/*
2 * linux/arch/arm/mach-ep93xx/micro9.c
3 *
4 * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH
Hubert Feurstein94150092009-10-07 08:36:07 +01005 * Manfred Gruber <m.gruber@tirol.com>
6 * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH
7 * Hubert Feurstein <hubert.feurstein@contec.at>
Manfred Gruberd941caa2006-12-17 22:10:48 +01008 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
Manfred Gruberd941caa2006-12-17 22:10:48 +010014#include <linux/kernel.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010015#include <linux/init.h>
Manfred Gruberd941caa2006-12-17 22:10:48 +010016#include <linux/platform_device.h>
Manfred Gruberd941caa2006-12-17 22:10:48 +010017#include <linux/mtd/physmap.h>
18
Russell Kinga09e64f2008-08-05 16:14:15 +010019#include <mach/hardware.h>
Manfred Gruberd941caa2006-12-17 22:10:48 +010020
Manfred Gruberd941caa2006-12-17 22:10:48 +010021#include <asm/mach-types.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010022#include <asm/mach/arch.h>
23
Manfred Gruberd941caa2006-12-17 22:10:48 +010024
Hubert Feurstein14636002009-10-07 08:39:09 +010025/*************************************************************************
26 * Micro9 NOR Flash
27 *
28 * Micro9-High has up to 64MB of 32-bit flash on CS1
29 * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
30 * Micro9-Lite uses a seperate MTD map driver for flash support
Hubert Feurstein72323442009-10-07 08:41:01 +010031 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
Hubert Feurstein14636002009-10-07 08:39:09 +010032 *************************************************************************/
33static struct physmap_flash_data micro9_flash_data;
Manfred Gruberd941caa2006-12-17 22:10:48 +010034
Hubert Feurstein14636002009-10-07 08:39:09 +010035static struct resource micro9_flash_resource = {
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010036 .start = EP93XX_CS1_PHYS_BASE,
37 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
38 .flags = IORESOURCE_MEM,
Manfred Gruberd941caa2006-12-17 22:10:48 +010039};
40
Hubert Feurstein14636002009-10-07 08:39:09 +010041static struct platform_device micro9_flash = {
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010042 .name = "physmap-flash",
43 .id = 0,
44 .dev = {
Hubert Feurstein14636002009-10-07 08:39:09 +010045 .platform_data = &micro9_flash_data,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010046 },
47 .num_resources = 1,
Hubert Feurstein14636002009-10-07 08:39:09 +010048 .resource = &micro9_flash_resource,
Manfred Gruberd941caa2006-12-17 22:10:48 +010049};
50
Hubert Feurstein14636002009-10-07 08:39:09 +010051static void __init __micro9_register_flash(unsigned int width)
Manfred Gruberd941caa2006-12-17 22:10:48 +010052{
Hubert Feurstein14636002009-10-07 08:39:09 +010053 micro9_flash_data.width = width;
54
55 platform_device_register(&micro9_flash);
Manfred Gruberd941caa2006-12-17 22:10:48 +010056}
57
Hubert Feurstein14636002009-10-07 08:39:09 +010058static unsigned int __init micro9_detect_bootwidth(void)
59{
60 u32 v;
61
62 /* Detect the bus width of the external flash memory */
63 v = __raw_readl(EP93XX_SYSCON_SYSCFG);
64 if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
65 return 4; /* 32-bit */
66 else
67 return 2; /* 16-bit */
68}
69
70static void __init micro9_register_flash(void)
71{
72 if (machine_is_micro9())
73 __micro9_register_flash(4);
Hubert Feurstein72323442009-10-07 08:41:01 +010074 else if (machine_is_micro9m() || machine_is_micro9s())
Hubert Feurstein14636002009-10-07 08:39:09 +010075 __micro9_register_flash(micro9_detect_bootwidth());
76}
77
78
79/*************************************************************************
80 * Micro9 Ethernet
81 *************************************************************************/
82static struct ep93xx_eth_data micro9_eth_data = {
83 .phy_id = 0x1f,
84};
85
86
87static void __init micro9_init_machine(void)
Manfred Gruberd941caa2006-12-17 22:10:48 +010088{
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010089 ep93xx_init_devices();
Hubert Feurstein14636002009-10-07 08:39:09 +010090 ep93xx_register_eth(&micro9_eth_data, 1);
91 micro9_register_flash();
Manfred Gruberd941caa2006-12-17 22:10:48 +010092}
93
Hubert Feurstein14636002009-10-07 08:39:09 +010094
95#ifdef CONFIG_MACH_MICRO9H
96MACHINE_START(MICRO9, "Contec Micro9-High")
Hubert Feurstein94150092009-10-07 08:36:07 +010097 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010098 .phys_io = EP93XX_APB_PHYS_BASE,
99 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
100 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
101 .map_io = ep93xx_map_io,
102 .init_irq = ep93xx_init_irq,
103 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100104 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100105MACHINE_END
106#endif
107
Manfred Gruberd941caa2006-12-17 22:10:48 +0100108#ifdef CONFIG_MACH_MICRO9M
Hubert Feurstein14636002009-10-07 08:39:09 +0100109MACHINE_START(MICRO9M, "Contec Micro9-Mid")
Hubert Feurstein94150092009-10-07 08:36:07 +0100110 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100111 .phys_io = EP93XX_APB_PHYS_BASE,
112 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
Hubert Feurstein14636002009-10-07 08:39:09 +0100113 .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100114 .map_io = ep93xx_map_io,
115 .init_irq = ep93xx_init_irq,
116 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100117 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100118MACHINE_END
119#endif
120
Manfred Gruberd941caa2006-12-17 22:10:48 +0100121#ifdef CONFIG_MACH_MICRO9L
Hubert Feurstein14636002009-10-07 08:39:09 +0100122MACHINE_START(MICRO9L, "Contec Micro9-Lite")
Hubert Feurstein94150092009-10-07 08:36:07 +0100123 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100124 .phys_io = EP93XX_APB_PHYS_BASE,
125 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
126 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
127 .map_io = ep93xx_map_io,
128 .init_irq = ep93xx_init_irq,
129 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100130 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100131MACHINE_END
132#endif
Hubert Feurstein72323442009-10-07 08:41:01 +0100133
134#ifdef CONFIG_MACH_MICRO9S
135MACHINE_START(MICRO9S, "Contec Micro9-Slim")
136 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
137 .phys_io = EP93XX_APB_PHYS_BASE,
138 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
139 .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
140 .map_io = ep93xx_map_io,
141 .init_irq = ep93xx_init_irq,
142 .timer = &ep93xx_timer,
143 .init_machine = micro9_init_machine,
144MACHINE_END
145#endif