blob: 3d7cdab725b20ec278635ac41c96c4724b65db54 [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>
Jean-Christop PLAGNIOL-VILLARDd5257532009-11-02 20:13:32 +010017#include <linux/io.h>
Manfred Gruberd941caa2006-12-17 22:10:48 +010018
Russell Kinga09e64f2008-08-05 16:14:15 +010019#include <mach/hardware.h>
Manfred Gruberd941caa2006-12-17 22:10:48 +010020
Jamie Iles9a6879b2011-09-27 20:07:05 +010021#include <asm/hardware/vic.h>
Manfred Gruberd941caa2006-12-17 22:10:48 +010022#include <asm/mach-types.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010023#include <asm/mach/arch.h>
24
Ryan Mallon258249e2012-01-11 09:06:08 +110025#include "soc.h"
Manfred Gruberd941caa2006-12-17 22:10:48 +010026
Hubert Feurstein14636002009-10-07 08:39:09 +010027/*************************************************************************
28 * Micro9 NOR Flash
29 *
30 * Micro9-High has up to 64MB of 32-bit flash on CS1
31 * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
Daniel Mack3ad2f3f2010-02-03 08:01:28 +080032 * Micro9-Lite uses a separate MTD map driver for flash support
Hubert Feurstein72323442009-10-07 08:41:01 +010033 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
Hubert Feurstein14636002009-10-07 08:39:09 +010034 *************************************************************************/
Hubert Feurstein14636002009-10-07 08:39:09 +010035static unsigned int __init micro9_detect_bootwidth(void)
36{
37 u32 v;
38
39 /* Detect the bus width of the external flash memory */
40 v = __raw_readl(EP93XX_SYSCON_SYSCFG);
41 if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
42 return 4; /* 32-bit */
43 else
44 return 2; /* 16-bit */
45}
46
47static void __init micro9_register_flash(void)
48{
Hartley Sweeten16bcf782010-06-10 16:19:08 +010049 unsigned int width;
50
Hubert Feurstein14636002009-10-07 08:39:09 +010051 if (machine_is_micro9())
Hartley Sweeten16bcf782010-06-10 16:19:08 +010052 width = 4;
Hubert Feurstein72323442009-10-07 08:41:01 +010053 else if (machine_is_micro9m() || machine_is_micro9s())
Hartley Sweeten16bcf782010-06-10 16:19:08 +010054 width = micro9_detect_bootwidth();
55 else
56 width = 0;
57
58 if (width)
59 ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
Hubert Feurstein14636002009-10-07 08:39:09 +010060}
61
62
63/*************************************************************************
64 * Micro9 Ethernet
65 *************************************************************************/
Hartley Sweetenb370e082010-03-18 18:04:06 +010066static struct ep93xx_eth_data __initdata micro9_eth_data = {
Hubert Feurstein14636002009-10-07 08:39:09 +010067 .phy_id = 0x1f,
68};
69
70
71static void __init micro9_init_machine(void)
Manfred Gruberd941caa2006-12-17 22:10:48 +010072{
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010073 ep93xx_init_devices();
Hubert Feurstein14636002009-10-07 08:39:09 +010074 ep93xx_register_eth(&micro9_eth_data, 1);
75 micro9_register_flash();
Manfred Gruberd941caa2006-12-17 22:10:48 +010076}
77
Hubert Feurstein14636002009-10-07 08:39:09 +010078
79#ifdef CONFIG_MACH_MICRO9H
80MACHINE_START(MICRO9, "Contec Micro9-High")
Hubert Feurstein94150092009-10-07 08:36:07 +010081 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -040082 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010083 .map_io = ep93xx_map_io,
84 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +010085 .handle_irq = vic_handle_irq,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010086 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +010087 .init_machine = micro9_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +080088 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +000089 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +010090MACHINE_END
91#endif
92
Manfred Gruberd941caa2006-12-17 22:10:48 +010093#ifdef CONFIG_MACH_MICRO9M
Hubert Feurstein14636002009-10-07 08:39:09 +010094MACHINE_START(MICRO9M, "Contec Micro9-Mid")
Hubert Feurstein94150092009-10-07 08:36:07 +010095 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -040096 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010097 .map_io = ep93xx_map_io,
98 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +010099 .handle_irq = vic_handle_irq,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100100 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100101 .init_machine = micro9_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800102 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000103 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100104MACHINE_END
105#endif
106
Manfred Gruberd941caa2006-12-17 22:10:48 +0100107#ifdef CONFIG_MACH_MICRO9L
Hubert Feurstein14636002009-10-07 08:39:09 +0100108MACHINE_START(MICRO9L, "Contec Micro9-Lite")
Hubert Feurstein94150092009-10-07 08:36:07 +0100109 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400110 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100111 .map_io = ep93xx_map_io,
112 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +0100113 .handle_irq = vic_handle_irq,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100114 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100115 .init_machine = micro9_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800116 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000117 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100118MACHINE_END
119#endif
Hubert Feurstein72323442009-10-07 08:41:01 +0100120
121#ifdef CONFIG_MACH_MICRO9S
122MACHINE_START(MICRO9S, "Contec Micro9-Slim")
123 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400124 .atag_offset = 0x100,
Hubert Feurstein72323442009-10-07 08:41:01 +0100125 .map_io = ep93xx_map_io,
126 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +0100127 .handle_irq = vic_handle_irq,
Hubert Feurstein72323442009-10-07 08:41:01 +0100128 .timer = &ep93xx_timer,
129 .init_machine = micro9_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800130 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000131 .restart = ep93xx_restart,
Hubert Feurstein72323442009-10-07 08:41:01 +0100132MACHINE_END
133#endif