Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-ep93xx/micro9.c |
| 3 | * |
| 4 | * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH |
Hubert Feurstein | 9415009 | 2009-10-07 08:36:07 +0100 | [diff] [blame] | 5 | * Manfred Gruber <m.gruber@tirol.com> |
| 6 | * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH |
| 7 | * Hubert Feurstein <hubert.feurstein@contec.at> |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 8 | * |
| 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 Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 14 | #include <linux/kernel.h> |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 15 | #include <linux/init.h> |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 16 | #include <linux/platform_device.h> |
Jean-Christop PLAGNIOL-VILLARD | d525753 | 2009-11-02 20:13:32 +0100 | [diff] [blame] | 17 | #include <linux/io.h> |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 18 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 19 | #include <mach/hardware.h> |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 20 | |
Jamie Iles | 9a6879b | 2011-09-27 20:07:05 +0100 | [diff] [blame] | 21 | #include <asm/hardware/vic.h> |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 22 | #include <asm/mach-types.h> |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 23 | #include <asm/mach/arch.h> |
| 24 | |
Ryan Mallon | 258249e | 2012-01-11 09:06:08 +1100 | [diff] [blame] | 25 | #include "soc.h" |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 26 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 27 | /************************************************************************* |
| 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 Mack | 3ad2f3f | 2010-02-03 08:01:28 +0800 | [diff] [blame] | 32 | * Micro9-Lite uses a separate MTD map driver for flash support |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 33 | * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1 |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 34 | *************************************************************************/ |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 35 | static 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 | |
| 47 | static void __init micro9_register_flash(void) |
| 48 | { |
Hartley Sweeten | 16bcf78 | 2010-06-10 16:19:08 +0100 | [diff] [blame] | 49 | unsigned int width; |
| 50 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 51 | if (machine_is_micro9()) |
Hartley Sweeten | 16bcf78 | 2010-06-10 16:19:08 +0100 | [diff] [blame] | 52 | width = 4; |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 53 | else if (machine_is_micro9m() || machine_is_micro9s()) |
Hartley Sweeten | 16bcf78 | 2010-06-10 16:19:08 +0100 | [diff] [blame] | 54 | 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 Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | |
| 63 | /************************************************************************* |
| 64 | * Micro9 Ethernet |
| 65 | *************************************************************************/ |
Hartley Sweeten | b370e08 | 2010-03-18 18:04:06 +0100 | [diff] [blame] | 66 | static struct ep93xx_eth_data __initdata micro9_eth_data = { |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 67 | .phy_id = 0x1f, |
| 68 | }; |
| 69 | |
| 70 | |
| 71 | static void __init micro9_init_machine(void) |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 72 | { |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 73 | ep93xx_init_devices(); |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 74 | ep93xx_register_eth(µ9_eth_data, 1); |
| 75 | micro9_register_flash(); |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 76 | } |
| 77 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 78 | |
| 79 | #ifdef CONFIG_MACH_MICRO9H |
| 80 | MACHINE_START(MICRO9, "Contec Micro9-High") |
Hubert Feurstein | 9415009 | 2009-10-07 08:36:07 +0100 | [diff] [blame] | 81 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
Nicolas Pitre | e562cf1 | 2011-07-05 22:38:11 -0400 | [diff] [blame] | 82 | .atag_offset = 0x100, |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 83 | .map_io = ep93xx_map_io, |
| 84 | .init_irq = ep93xx_init_irq, |
Jamie Iles | 9a6879b | 2011-09-27 20:07:05 +0100 | [diff] [blame] | 85 | .handle_irq = vic_handle_irq, |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 86 | .timer = &ep93xx_timer, |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 87 | .init_machine = micro9_init_machine, |
Shawn Guo | c914283 | 2012-04-26 10:05:15 +0800 | [diff] [blame] | 88 | .init_late = ep93xx_init_late, |
Russell King | 3275166 | 2011-11-05 09:54:14 +0000 | [diff] [blame] | 89 | .restart = ep93xx_restart, |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 90 | MACHINE_END |
| 91 | #endif |
| 92 | |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 93 | #ifdef CONFIG_MACH_MICRO9M |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 94 | MACHINE_START(MICRO9M, "Contec Micro9-Mid") |
Hubert Feurstein | 9415009 | 2009-10-07 08:36:07 +0100 | [diff] [blame] | 95 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
Nicolas Pitre | e562cf1 | 2011-07-05 22:38:11 -0400 | [diff] [blame] | 96 | .atag_offset = 0x100, |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 97 | .map_io = ep93xx_map_io, |
| 98 | .init_irq = ep93xx_init_irq, |
Jamie Iles | 9a6879b | 2011-09-27 20:07:05 +0100 | [diff] [blame] | 99 | .handle_irq = vic_handle_irq, |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 100 | .timer = &ep93xx_timer, |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 101 | .init_machine = micro9_init_machine, |
Shawn Guo | c914283 | 2012-04-26 10:05:15 +0800 | [diff] [blame] | 102 | .init_late = ep93xx_init_late, |
Russell King | 3275166 | 2011-11-05 09:54:14 +0000 | [diff] [blame] | 103 | .restart = ep93xx_restart, |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 104 | MACHINE_END |
| 105 | #endif |
| 106 | |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 107 | #ifdef CONFIG_MACH_MICRO9L |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 108 | MACHINE_START(MICRO9L, "Contec Micro9-Lite") |
Hubert Feurstein | 9415009 | 2009-10-07 08:36:07 +0100 | [diff] [blame] | 109 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
Nicolas Pitre | e562cf1 | 2011-07-05 22:38:11 -0400 | [diff] [blame] | 110 | .atag_offset = 0x100, |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 111 | .map_io = ep93xx_map_io, |
| 112 | .init_irq = ep93xx_init_irq, |
Jamie Iles | 9a6879b | 2011-09-27 20:07:05 +0100 | [diff] [blame] | 113 | .handle_irq = vic_handle_irq, |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 114 | .timer = &ep93xx_timer, |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 115 | .init_machine = micro9_init_machine, |
Shawn Guo | c914283 | 2012-04-26 10:05:15 +0800 | [diff] [blame] | 116 | .init_late = ep93xx_init_late, |
Russell King | 3275166 | 2011-11-05 09:54:14 +0000 | [diff] [blame] | 117 | .restart = ep93xx_restart, |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 118 | MACHINE_END |
| 119 | #endif |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 120 | |
| 121 | #ifdef CONFIG_MACH_MICRO9S |
| 122 | MACHINE_START(MICRO9S, "Contec Micro9-Slim") |
| 123 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
Nicolas Pitre | e562cf1 | 2011-07-05 22:38:11 -0400 | [diff] [blame] | 124 | .atag_offset = 0x100, |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 125 | .map_io = ep93xx_map_io, |
| 126 | .init_irq = ep93xx_init_irq, |
Jamie Iles | 9a6879b | 2011-09-27 20:07:05 +0100 | [diff] [blame] | 127 | .handle_irq = vic_handle_irq, |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 128 | .timer = &ep93xx_timer, |
| 129 | .init_machine = micro9_init_machine, |
Shawn Guo | c914283 | 2012-04-26 10:05:15 +0800 | [diff] [blame] | 130 | .init_late = ep93xx_init_late, |
Russell King | 3275166 | 2011-11-05 09:54:14 +0000 | [diff] [blame] | 131 | .restart = ep93xx_restart, |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 132 | MACHINE_END |
| 133 | #endif |