blob: 49fbee5adde2051831ea654d764ea47f738c158d [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
31 *************************************************************************/
32static struct physmap_flash_data micro9_flash_data;
Manfred Gruberd941caa2006-12-17 22:10:48 +010033
Hubert Feurstein14636002009-10-07 08:39:09 +010034static struct resource micro9_flash_resource = {
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010035 .start = EP93XX_CS1_PHYS_BASE,
36 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
37 .flags = IORESOURCE_MEM,
Manfred Gruberd941caa2006-12-17 22:10:48 +010038};
39
Hubert Feurstein14636002009-10-07 08:39:09 +010040static struct platform_device micro9_flash = {
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010041 .name = "physmap-flash",
42 .id = 0,
43 .dev = {
Hubert Feurstein14636002009-10-07 08:39:09 +010044 .platform_data = &micro9_flash_data,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010045 },
46 .num_resources = 1,
Hubert Feurstein14636002009-10-07 08:39:09 +010047 .resource = &micro9_flash_resource,
Manfred Gruberd941caa2006-12-17 22:10:48 +010048};
49
Hubert Feurstein14636002009-10-07 08:39:09 +010050static void __init __micro9_register_flash(unsigned int width)
Manfred Gruberd941caa2006-12-17 22:10:48 +010051{
Hubert Feurstein14636002009-10-07 08:39:09 +010052 micro9_flash_data.width = width;
53
54 platform_device_register(&micro9_flash);
Manfred Gruberd941caa2006-12-17 22:10:48 +010055}
56
Hubert Feurstein14636002009-10-07 08:39:09 +010057static unsigned int __init micro9_detect_bootwidth(void)
58{
59 u32 v;
60
61 /* Detect the bus width of the external flash memory */
62 v = __raw_readl(EP93XX_SYSCON_SYSCFG);
63 if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
64 return 4; /* 32-bit */
65 else
66 return 2; /* 16-bit */
67}
68
69static void __init micro9_register_flash(void)
70{
71 if (machine_is_micro9())
72 __micro9_register_flash(4);
73 else if (machine_is_micro9m())
74 __micro9_register_flash(micro9_detect_bootwidth());
75}
76
77
78/*************************************************************************
79 * Micro9 Ethernet
80 *************************************************************************/
81static struct ep93xx_eth_data micro9_eth_data = {
82 .phy_id = 0x1f,
83};
84
85
86static void __init micro9_init_machine(void)
Manfred Gruberd941caa2006-12-17 22:10:48 +010087{
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010088 ep93xx_init_devices();
Hubert Feurstein14636002009-10-07 08:39:09 +010089 ep93xx_register_eth(&micro9_eth_data, 1);
90 micro9_register_flash();
Manfred Gruberd941caa2006-12-17 22:10:48 +010091}
92
Hubert Feurstein14636002009-10-07 08:39:09 +010093
94#ifdef CONFIG_MACH_MICRO9H
95MACHINE_START(MICRO9, "Contec Micro9-High")
Hubert Feurstein94150092009-10-07 08:36:07 +010096 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010097 .phys_io = EP93XX_APB_PHYS_BASE,
98 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
99 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
100 .map_io = ep93xx_map_io,
101 .init_irq = ep93xx_init_irq,
102 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100103 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100104MACHINE_END
105#endif
106
Manfred Gruberd941caa2006-12-17 22:10:48 +0100107#ifdef CONFIG_MACH_MICRO9M
Hubert Feurstein14636002009-10-07 08:39:09 +0100108MACHINE_START(MICRO9M, "Contec Micro9-Mid")
Hubert Feurstein94150092009-10-07 08:36:07 +0100109 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100110 .phys_io = EP93XX_APB_PHYS_BASE,
111 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
Hubert Feurstein14636002009-10-07 08:39:09 +0100112 .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100113 .map_io = ep93xx_map_io,
114 .init_irq = ep93xx_init_irq,
115 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100116 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100117MACHINE_END
118#endif
119
Manfred Gruberd941caa2006-12-17 22:10:48 +0100120#ifdef CONFIG_MACH_MICRO9L
Hubert Feurstein14636002009-10-07 08:39:09 +0100121MACHINE_START(MICRO9L, "Contec Micro9-Lite")
Hubert Feurstein94150092009-10-07 08:36:07 +0100122 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100123 .phys_io = EP93XX_APB_PHYS_BASE,
124 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
125 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
126 .map_io = ep93xx_map_io,
127 .init_irq = ep93xx_init_irq,
128 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100129 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100130MACHINE_END
131#endif