blob: 373583c298255179d5b4f553d61dc9d38081e874 [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
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
Ryan Mallon258249e2012-01-11 09:06:08 +110024#include "soc.h"
Manfred Gruberd941caa2006-12-17 22:10:48 +010025
Hubert Feurstein14636002009-10-07 08:39:09 +010026/*************************************************************************
27 * Micro9 NOR Flash
28 *
29 * Micro9-High has up to 64MB of 32-bit flash on CS1
30 * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
Daniel Mack3ad2f3f2010-02-03 08:01:28 +080031 * Micro9-Lite uses a separate MTD map driver for flash support
Hubert Feurstein72323442009-10-07 08:41:01 +010032 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
Hubert Feurstein14636002009-10-07 08:39:09 +010033 *************************************************************************/
Hubert Feurstein14636002009-10-07 08:39:09 +010034static unsigned int __init micro9_detect_bootwidth(void)
35{
36 u32 v;
37
38 /* Detect the bus width of the external flash memory */
39 v = __raw_readl(EP93XX_SYSCON_SYSCFG);
40 if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
41 return 4; /* 32-bit */
42 else
43 return 2; /* 16-bit */
44}
45
46static void __init micro9_register_flash(void)
47{
Hartley Sweeten16bcf782010-06-10 16:19:08 +010048 unsigned int width;
49
Hubert Feurstein14636002009-10-07 08:39:09 +010050 if (machine_is_micro9())
Hartley Sweeten16bcf782010-06-10 16:19:08 +010051 width = 4;
Hubert Feurstein72323442009-10-07 08:41:01 +010052 else if (machine_is_micro9m() || machine_is_micro9s())
Hartley Sweeten16bcf782010-06-10 16:19:08 +010053 width = micro9_detect_bootwidth();
54 else
55 width = 0;
56
57 if (width)
58 ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
Hubert Feurstein14636002009-10-07 08:39:09 +010059}
60
61
62/*************************************************************************
63 * Micro9 Ethernet
64 *************************************************************************/
Hartley Sweetenb370e082010-03-18 18:04:06 +010065static struct ep93xx_eth_data __initdata micro9_eth_data = {
Hubert Feurstein14636002009-10-07 08:39:09 +010066 .phy_id = 0x1f,
67};
68
69
70static void __init micro9_init_machine(void)
Manfred Gruberd941caa2006-12-17 22:10:48 +010071{
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010072 ep93xx_init_devices();
Hubert Feurstein14636002009-10-07 08:39:09 +010073 ep93xx_register_eth(&micro9_eth_data, 1);
74 micro9_register_flash();
Manfred Gruberd941caa2006-12-17 22:10:48 +010075}
76
Hubert Feurstein14636002009-10-07 08:39:09 +010077
78#ifdef CONFIG_MACH_MICRO9H
79MACHINE_START(MICRO9, "Contec Micro9-High")
Hubert Feurstein94150092009-10-07 08:36:07 +010080 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -040081 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010082 .map_io = ep93xx_map_io,
83 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -070084 .init_time = ep93xx_timer_init,
Hubert Feurstein14636002009-10-07 08:39:09 +010085 .init_machine = micro9_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +080086 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +000087 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +010088MACHINE_END
89#endif
90
Manfred Gruberd941caa2006-12-17 22:10:48 +010091#ifdef CONFIG_MACH_MICRO9M
Hubert Feurstein14636002009-10-07 08:39:09 +010092MACHINE_START(MICRO9M, "Contec Micro9-Mid")
Hubert Feurstein94150092009-10-07 08:36:07 +010093 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -040094 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010095 .map_io = ep93xx_map_io,
96 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -070097 .init_time = ep93xx_timer_init,
Hubert Feurstein14636002009-10-07 08:39:09 +010098 .init_machine = micro9_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +080099 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000100 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100101MACHINE_END
102#endif
103
Manfred Gruberd941caa2006-12-17 22:10:48 +0100104#ifdef CONFIG_MACH_MICRO9L
Hubert Feurstein14636002009-10-07 08:39:09 +0100105MACHINE_START(MICRO9L, "Contec Micro9-Lite")
Hubert Feurstein94150092009-10-07 08:36:07 +0100106 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400107 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100108 .map_io = ep93xx_map_io,
109 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700110 .init_time = ep93xx_timer_init,
Hubert Feurstein14636002009-10-07 08:39:09 +0100111 .init_machine = micro9_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800112 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000113 .restart = ep93xx_restart,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100114MACHINE_END
115#endif
Hubert Feurstein72323442009-10-07 08:41:01 +0100116
117#ifdef CONFIG_MACH_MICRO9S
118MACHINE_START(MICRO9S, "Contec Micro9-Slim")
119 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400120 .atag_offset = 0x100,
Hubert Feurstein72323442009-10-07 08:41:01 +0100121 .map_io = ep93xx_map_io,
122 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700123 .init_time = ep93xx_timer_init,
Hubert Feurstein72323442009-10-07 08:41:01 +0100124 .init_machine = micro9_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800125 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000126 .restart = ep93xx_restart,
Hubert Feurstein72323442009-10-07 08:41:01 +0100127MACHINE_END
128#endif