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> |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 17 | #include <linux/mtd/physmap.h> |
| 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 | |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 21 | #include <asm/mach-types.h> |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 22 | #include <asm/mach/arch.h> |
| 23 | |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 24 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 25 | /************************************************************************* |
| 26 | * Micro9 NOR Flash |
| 27 | * |
| 28 | * Micro9-High has up to 64MB of 32-bit flash on CS1 |
| 29 | * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1 |
| 30 | * Micro9-Lite uses a seperate MTD map driver for flash support |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 31 | * 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] | 32 | *************************************************************************/ |
| 33 | static struct physmap_flash_data micro9_flash_data; |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 34 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 35 | static struct resource micro9_flash_resource = { |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 36 | .start = EP93XX_CS1_PHYS_BASE, |
| 37 | .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1, |
| 38 | .flags = IORESOURCE_MEM, |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 39 | }; |
| 40 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 41 | static struct platform_device micro9_flash = { |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 42 | .name = "physmap-flash", |
| 43 | .id = 0, |
| 44 | .dev = { |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 45 | .platform_data = µ9_flash_data, |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 46 | }, |
| 47 | .num_resources = 1, |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 48 | .resource = µ9_flash_resource, |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 49 | }; |
| 50 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 51 | static void __init __micro9_register_flash(unsigned int width) |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 52 | { |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 53 | micro9_flash_data.width = width; |
| 54 | |
| 55 | platform_device_register(µ9_flash); |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 56 | } |
| 57 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 58 | static unsigned int __init micro9_detect_bootwidth(void) |
| 59 | { |
| 60 | u32 v; |
| 61 | |
| 62 | /* Detect the bus width of the external flash memory */ |
| 63 | v = __raw_readl(EP93XX_SYSCON_SYSCFG); |
| 64 | if (v & EP93XX_SYSCON_SYSCFG_LCSN7) |
| 65 | return 4; /* 32-bit */ |
| 66 | else |
| 67 | return 2; /* 16-bit */ |
| 68 | } |
| 69 | |
| 70 | static void __init micro9_register_flash(void) |
| 71 | { |
| 72 | if (machine_is_micro9()) |
| 73 | __micro9_register_flash(4); |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 74 | else if (machine_is_micro9m() || machine_is_micro9s()) |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 75 | __micro9_register_flash(micro9_detect_bootwidth()); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | /************************************************************************* |
| 80 | * Micro9 Ethernet |
| 81 | *************************************************************************/ |
| 82 | static struct ep93xx_eth_data micro9_eth_data = { |
| 83 | .phy_id = 0x1f, |
| 84 | }; |
| 85 | |
| 86 | |
| 87 | static void __init micro9_init_machine(void) |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 88 | { |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 89 | ep93xx_init_devices(); |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 90 | ep93xx_register_eth(µ9_eth_data, 1); |
| 91 | micro9_register_flash(); |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 92 | } |
| 93 | |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 94 | |
| 95 | #ifdef CONFIG_MACH_MICRO9H |
| 96 | MACHINE_START(MICRO9, "Contec Micro9-High") |
Hubert Feurstein | 9415009 | 2009-10-07 08:36:07 +0100 | [diff] [blame] | 97 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 98 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 99 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 100 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 101 | .map_io = ep93xx_map_io, |
| 102 | .init_irq = ep93xx_init_irq, |
| 103 | .timer = &ep93xx_timer, |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 104 | .init_machine = micro9_init_machine, |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 105 | MACHINE_END |
| 106 | #endif |
| 107 | |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 108 | #ifdef CONFIG_MACH_MICRO9M |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 109 | MACHINE_START(MICRO9M, "Contec Micro9-Mid") |
Hubert Feurstein | 9415009 | 2009-10-07 08:36:07 +0100 | [diff] [blame] | 110 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 111 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 112 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 113 | .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100, |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 114 | .map_io = ep93xx_map_io, |
| 115 | .init_irq = ep93xx_init_irq, |
| 116 | .timer = &ep93xx_timer, |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 117 | .init_machine = micro9_init_machine, |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 118 | MACHINE_END |
| 119 | #endif |
| 120 | |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 121 | #ifdef CONFIG_MACH_MICRO9L |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 122 | MACHINE_START(MICRO9L, "Contec Micro9-Lite") |
Hubert Feurstein | 9415009 | 2009-10-07 08:36:07 +0100 | [diff] [blame] | 123 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
Hartley Sweeten | e48f3fa | 2008-12-08 17:57:22 +0100 | [diff] [blame] | 124 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 125 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 126 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 127 | .map_io = ep93xx_map_io, |
| 128 | .init_irq = ep93xx_init_irq, |
| 129 | .timer = &ep93xx_timer, |
Hubert Feurstein | 1463600 | 2009-10-07 08:39:09 +0100 | [diff] [blame] | 130 | .init_machine = micro9_init_machine, |
Manfred Gruber | d941caa | 2006-12-17 22:10:48 +0100 | [diff] [blame] | 131 | MACHINE_END |
| 132 | #endif |
Hubert Feurstein | 7232344 | 2009-10-07 08:41:01 +0100 | [diff] [blame] | 133 | |
| 134 | #ifdef CONFIG_MACH_MICRO9S |
| 135 | MACHINE_START(MICRO9S, "Contec Micro9-Slim") |
| 136 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
| 137 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 138 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 139 | .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100, |
| 140 | .map_io = ep93xx_map_io, |
| 141 | .init_irq = ep93xx_init_irq, |
| 142 | .timer = &ep93xx_timer, |
| 143 | .init_machine = micro9_init_machine, |
| 144 | MACHINE_END |
| 145 | #endif |