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