blob: a6dae6c2e3c1f96b749eb8526fccfbd7cf4b04d7 [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
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,
Jamie Iles9a6879b2011-09-27 20:07:05 +010084 .handle_irq = vic_handle_irq,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010085 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +010086 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +010087MACHINE_END
88#endif
89
Manfred Gruberd941caa2006-12-17 22:10:48 +010090#ifdef CONFIG_MACH_MICRO9M
Hubert Feurstein14636002009-10-07 08:39:09 +010091MACHINE_START(MICRO9M, "Contec Micro9-Mid")
Hubert Feurstein94150092009-10-07 08:36:07 +010092 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -040093 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010094 .map_io = ep93xx_map_io,
95 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +010096 .handle_irq = vic_handle_irq,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +010097 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +010098 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +010099MACHINE_END
100#endif
101
Manfred Gruberd941caa2006-12-17 22:10:48 +0100102#ifdef CONFIG_MACH_MICRO9L
Hubert Feurstein14636002009-10-07 08:39:09 +0100103MACHINE_START(MICRO9L, "Contec Micro9-Lite")
Hubert Feurstein94150092009-10-07 08:36:07 +0100104 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400105 .atag_offset = 0x100,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100106 .map_io = ep93xx_map_io,
107 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +0100108 .handle_irq = vic_handle_irq,
Hartley Sweetene48f3fa2008-12-08 17:57:22 +0100109 .timer = &ep93xx_timer,
Hubert Feurstein14636002009-10-07 08:39:09 +0100110 .init_machine = micro9_init_machine,
Manfred Gruberd941caa2006-12-17 22:10:48 +0100111MACHINE_END
112#endif
Hubert Feurstein72323442009-10-07 08:41:01 +0100113
114#ifdef CONFIG_MACH_MICRO9S
115MACHINE_START(MICRO9S, "Contec Micro9-Slim")
116 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400117 .atag_offset = 0x100,
Hubert Feurstein72323442009-10-07 08:41:01 +0100118 .map_io = ep93xx_map_io,
119 .init_irq = ep93xx_init_irq,
Jamie Iles9a6879b2011-09-27 20:07:05 +0100120 .handle_irq = vic_handle_irq,
Hubert Feurstein72323442009-10-07 08:41:01 +0100121 .timer = &ep93xx_timer,
122 .init_machine = micro9_init_machine,
123MACHINE_END
124#endif