blob: dc431c5f04cee416a7fa102658189cc27949628e [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,
Russell King32751662011-11-05 09:54:14 +000088 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +010089MACHINE_END
90#endif
91
Manfred Gruberd941caa2006-12-17 22:10:48 +010092#ifdef CONFIG_MACH_MICRO9M
Hubert Feurstein14636002009-10-07 08:39:09 +010093MACHINE_START(MICRO9M, "Contec Micro9-Mid")
Hubert Feurstein94150092009-10-07 08:36:07 +010094 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -040095 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010096 .map_io = ep93xx_map_io,
97 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +010098 .handle_irq = vic_handle_irq,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010099 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100100 .init_machine = micro9_init_machine,
Russell King32751662011-11-05 09:54:14 +0000101 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100102MACHINE_END
103#endif
104
Manfred Gruberd941caa2006-12-17 22:10:48 +0100105#ifdef CONFIG_MACH_MICRO9L
Hubert Feurstein14636002009-10-07 08:39:09 +0100106MACHINE_START(MICRO9L, "Contec Micro9-Lite")
Hubert Feurstein94150092009-10-07 08:36:07 +0100107 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400108 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100109 .map_io = ep93xx_map_io,
110 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +0100111 .handle_irq = vic_handle_irq,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100112 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100113 .init_machine = micro9_init_machine,
Russell King32751662011-11-05 09:54:14 +0000114 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100115MACHINE_END
116#endif
Hubert Feurstein72323442009-10-07 08:41:01 +0100117
118#ifdef CONFIG_MACH_MICRO9S
119MACHINE_START(MICRO9S, "Contec Micro9-Slim")
120 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400121 .atag_offset = 0x100,
Hubert Feurstein72323442009-10-07 08:41:01 +0100122 .map_io = ep93xx_map_io,
123 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +0100124 .handle_irq = vic_handle_irq,
Hubert Feurstein72323442009-10-07 08:41:01 +0100125 .timer = &ep93xx_timer,
126 .init_machine = micro9_init_machine,
Russell King32751662011-11-05 09:54:14 +0000127 .restart = ep93xx_restart,
Hubert Feurstein72323442009-10-07 08:41:01 +0100128MACHINE_END
129#endif