| Robert Schwebel | 34e31d8 | 2008-01-08 08:44:23 +0100 | [diff] [blame] | 1 | /* | 
 | 2 |  *  linux/arch/arm/mach-pxa/pcm027.c | 
 | 3 |  *  Support for the Phytec phyCORE-PXA270 CPU card (aka PCM-027). | 
 | 4 |  * | 
 | 5 |  *  Refer | 
 | 6 |  *   http://www.phytec.com/products/sbc/ARM-XScale/phyCORE-XScale-PXA270.html | 
 | 7 |  *  for additional hardware info | 
 | 8 |  * | 
 | 9 |  *  Author:	Juergen Kilb | 
 | 10 |  *  Created:	April 05, 2005 | 
 | 11 |  *  Copyright:	Phytec Messtechnik GmbH | 
 | 12 |  *  e-Mail:	armlinux@phytec.de | 
 | 13 |  * | 
 | 14 |  *  based on Intel Mainstone Board | 
 | 15 |  * | 
 | 16 |  *  Copyright 2007 Juergen Beisert @ Pengutronix (j.beisert@pengutronix.de) | 
 | 17 |  * | 
 | 18 |  *  This program is free software; you can redistribute it and/or modify | 
 | 19 |  *  it under the terms of the GNU General Public License version 2 as | 
 | 20 |  *  published by the Free Software Foundation. | 
 | 21 |  */ | 
 | 22 |  | 
 | 23 | #include <linux/irq.h> | 
 | 24 | #include <linux/platform_device.h> | 
 | 25 | #include <linux/mtd/physmap.h> | 
 | 26 | #include <linux/spi/spi.h> | 
 | 27 | #include <linux/leds.h> | 
 | 28 | #include <asm/mach-types.h> | 
 | 29 | #include <asm/mach/arch.h> | 
 | 30 | #include <asm/arch/hardware.h> | 
 | 31 | #include <asm/arch/pxa-regs.h> | 
| eric miao | a683b14 | 2008-03-03 09:44:25 +0800 | [diff] [blame] | 32 | #include <asm/arch/pxa2xx-gpio.h> | 
| Juergen Beisert | c9a28fa | 2008-01-29 23:43:49 +0100 | [diff] [blame] | 33 | #include <asm/arch/pxa2xx-regs.h> | 
| Robert Schwebel | 34e31d8 | 2008-01-08 08:44:23 +0100 | [diff] [blame] | 34 | #include <asm/arch/pxa2xx_spi.h> | 
 | 35 | #include <asm/arch/pcm027.h> | 
 | 36 | #include "generic.h" | 
 | 37 |  | 
 | 38 | /* | 
 | 39 |  * ABSTRACT: | 
 | 40 |  * | 
 | 41 |  * The PXA270 processor comes with a bunch of hardware on its silicon. | 
 | 42 |  * Not all of this hardware can be used at the same time and not all | 
 | 43 |  * is routed to module's connectors. Also it depends on the baseboard, what | 
 | 44 |  * kind of hardware can be used in which way. | 
 | 45 |  * -> So this file supports the main devices on the CPU card only! | 
 | 46 |  * Refer pcm990-baseboard.c how to extend this features to get a full | 
 | 47 |  * blown system with many common interfaces. | 
 | 48 |  * | 
 | 49 |  * The PCM-027 supports the following interfaces through its connectors and | 
 | 50 |  * will be used in pcm990-baseboard.c: | 
 | 51 |  * | 
 | 52 |  * - LCD support | 
 | 53 |  * - MMC support | 
 | 54 |  * - IDE/CF card | 
 | 55 |  * - FFUART | 
 | 56 |  * - BTUART | 
 | 57 |  * - IRUART | 
 | 58 |  * - AC97 | 
 | 59 |  * - SSP | 
 | 60 |  * - SSP3 | 
 | 61 |  * | 
 | 62 |  * Claimed GPIOs: | 
 | 63 |  * GPIO0 -> IRQ input from RTC | 
 | 64 |  * GPIO2 -> SYS_ENA*) | 
 | 65 |  * GPIO3 -> PWR_SCL | 
 | 66 |  * GPIO4 -> PWR_SDA | 
 | 67 |  * GPIO5 -> PowerCap0*) | 
 | 68 |  * GPIO6 -> PowerCap1*) | 
 | 69 |  * GPIO7 -> PowerCap2*) | 
 | 70 |  * GPIO8 -> PowerCap3*) | 
 | 71 |  * GPIO15 -> /CS1 | 
 | 72 |  * GPIO20 -> /CS2 | 
 | 73 |  * GPIO21 -> /CS3 | 
 | 74 |  * GPIO33 -> /CS5 network controller select | 
 | 75 |  * GPIO52 -> IRQ from network controller | 
 | 76 |  * GPIO78 -> /CS2 | 
 | 77 |  * GPIO80 -> /CS4 | 
 | 78 |  * GPIO90 -> LED0 | 
 | 79 |  * GPIO91 -> LED1 | 
 | 80 |  * GPIO114 -> IRQ from CAN controller | 
 | 81 |  * GPIO117 -> SCL | 
 | 82 |  * GPIO118 -> SDA | 
 | 83 |  * | 
 | 84 |  * *) CPU internal use only | 
 | 85 |  */ | 
 | 86 |  | 
 | 87 | /* | 
 | 88 |  * SMC91x network controller specific stuff | 
 | 89 |  */ | 
 | 90 | static struct resource smc91x_resources[] = { | 
 | 91 | 	[0] = { | 
 | 92 | 		.start	= PCM027_ETH_PHYS + 0x300, | 
 | 93 | 		.end	= PCM027_ETH_PHYS + PCM027_ETH_SIZE, | 
 | 94 | 		.flags	= IORESOURCE_MEM, | 
 | 95 | 	}, | 
 | 96 | 	[1] = { | 
 | 97 | 		.start	= PCM027_ETH_IRQ, | 
 | 98 | 		.end	= PCM027_ETH_IRQ, | 
 | 99 | 		/* note: smc91x's driver doesn't use the trigger bits yet */ | 
 | 100 | 		.flags	= IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE, | 
 | 101 | 	} | 
 | 102 | }; | 
 | 103 |  | 
 | 104 | static struct platform_device smc91x_device = { | 
 | 105 | 	.name		= "smc91x", | 
 | 106 | 	.id		= 0, | 
 | 107 | 	.num_resources	= ARRAY_SIZE(smc91x_resources), | 
 | 108 | 	.resource	= smc91x_resources, | 
 | 109 | }; | 
 | 110 |  | 
 | 111 | static struct physmap_flash_data pcm027_flash_data = { | 
 | 112 | 	.width  = 4, | 
 | 113 | }; | 
 | 114 |  | 
 | 115 | static struct resource pcm027_flash_resource = { | 
 | 116 | 	.start          = PCM027_FLASH_PHYS, | 
 | 117 | 	.end            = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 , | 
 | 118 | 	.flags          = IORESOURCE_MEM, | 
 | 119 | }; | 
 | 120 |  | 
 | 121 | static struct platform_device pcm027_flash = { | 
 | 122 | 	.name           = "physmap-flash", | 
 | 123 | 	.id             = 0, | 
 | 124 | 	.dev            = { | 
 | 125 | 		.platform_data  = &pcm027_flash_data, | 
 | 126 | 	}, | 
 | 127 | 	.resource       = &pcm027_flash_resource, | 
 | 128 | 	.num_resources  = 1, | 
 | 129 | }; | 
 | 130 |  | 
 | 131 | #ifdef CONFIG_LEDS_GPIO | 
 | 132 |  | 
 | 133 | static struct gpio_led pcm027_led[] = { | 
 | 134 | 	{ | 
 | 135 | 		.name = "led0:red",	/* FIXME */ | 
 | 136 | 		.gpio = PCM027_LED_CPU | 
 | 137 | 	}, | 
 | 138 | 	{ | 
 | 139 | 		.name = "led1:green",	/* FIXME */ | 
 | 140 | 		.gpio = PCM027_LED_HEARD_BEAT | 
 | 141 | 	}, | 
 | 142 | }; | 
 | 143 |  | 
 | 144 | static struct gpio_led_platform_data pcm027_led_data = { | 
 | 145 | 	.num_leds	= ARRAY_SIZE(pcm027_led), | 
 | 146 | 	.leds		= pcm027_led | 
 | 147 | }; | 
 | 148 |  | 
 | 149 | static struct platform_device pcm027_led_dev = { | 
 | 150 | 	.name		= "leds-gpio", | 
 | 151 | 	.id		= 0, | 
 | 152 | 	.dev		= { | 
 | 153 | 		.platform_data	= &pcm027_led_data, | 
 | 154 | 	}, | 
 | 155 | }; | 
 | 156 |  | 
 | 157 | #endif /* CONFIG_LEDS_GPIO */ | 
 | 158 |  | 
 | 159 | /* | 
 | 160 |  * declare the available device resources on this board | 
 | 161 |  */ | 
 | 162 | static struct platform_device *devices[] __initdata = { | 
 | 163 | 	&smc91x_device, | 
 | 164 | 	&pcm027_flash, | 
 | 165 | #ifdef CONFIG_LEDS_GPIO | 
 | 166 | 	&pcm027_led_dev | 
 | 167 | #endif | 
 | 168 | }; | 
 | 169 |  | 
 | 170 | /* | 
 | 171 |  * pcm027_init - breath some life into the board | 
 | 172 |  */ | 
 | 173 | static void __init pcm027_init(void) | 
 | 174 | { | 
 | 175 | 	/* system bus arbiter setting | 
 | 176 | 	 * - Core_Park | 
 | 177 | 	 * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4 | 
 | 178 | 	 */ | 
 | 179 | 	ARB_CNTRL = ARB_CORE_PARK | 0x234; | 
 | 180 |  | 
 | 181 | 	platform_add_devices(devices, ARRAY_SIZE(devices)); | 
 | 182 |  | 
 | 183 | 	/* LEDs (on demand only) */ | 
 | 184 | #ifdef CONFIG_LEDS_GPIO | 
 | 185 | 	pxa_gpio_mode(PCM027_LED_CPU | GPIO_OUT); | 
 | 186 | 	pxa_gpio_mode(PCM027_LED_HEARD_BEAT | GPIO_OUT); | 
 | 187 | #endif /* CONFIG_LEDS_GPIO */ | 
 | 188 |  | 
 | 189 | 	/* at last call the baseboard to initialize itself */ | 
 | 190 | #ifdef CONFIG_MACH_PCM990_BASEBOARD | 
 | 191 | 	pcm990_baseboard_init(); | 
 | 192 | #endif | 
 | 193 | } | 
 | 194 |  | 
 | 195 | static void __init pcm027_map_io(void) | 
 | 196 | { | 
 | 197 | 	pxa_map_io(); | 
 | 198 |  | 
 | 199 | 	/* initialize sleep mode regs (wake-up sources, etc) */ | 
 | 200 | 	PGSR0 = 0x01308000; | 
 | 201 | 	PGSR1 = 0x00CF0002; | 
 | 202 | 	PGSR2 = 0x0E294000; | 
 | 203 | 	PGSR3 = 0x0000C000; | 
 | 204 | 	PWER  = 0x40000000 | PWER_GPIO0 | PWER_GPIO1; | 
 | 205 | 	PRER  = 0x00000000; | 
 | 206 | 	PFER  = 0x00000003; | 
 | 207 | } | 
 | 208 |  | 
 | 209 | MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270") | 
 | 210 | 	/* Maintainer: Pengutronix */ | 
 | 211 | 	.boot_params	= 0xa0000100, | 
 | 212 | 	.phys_io	= 0x40000000, | 
 | 213 | 	.io_pg_offst	= (io_p2v(0x40000000) >> 18) & 0xfffc, | 
 | 214 | 	.map_io		= pcm027_map_io, | 
 | 215 | 	.init_irq	= pxa27x_init_irq, | 
 | 216 | 	.timer		= &pxa_timer, | 
 | 217 | 	.init_machine	= pcm027_init, | 
 | 218 | MACHINE_END |