| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/arm/mach-sa1100/pleb.c | 
 | 3 |  */ | 
 | 4 |  | 
 | 5 | #include <linux/init.h> | 
 | 6 | #include <linux/kernel.h> | 
 | 7 | #include <linux/tty.h> | 
 | 8 | #include <linux/ioport.h> | 
| Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 9 | #include <linux/platform_device.h> | 
| Thomas Gleixner | 119c641 | 2006-07-01 22:32:38 +0100 | [diff] [blame] | 10 | #include <linux/irq.h> | 
| Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 11 | #include <linux/io.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/mtd/partitions.h> | 
 | 13 |  | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 14 | #include <mach/hardware.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/setup.h> | 
 | 16 | #include <asm/mach-types.h> | 
 | 17 |  | 
 | 18 | #include <asm/mach/arch.h> | 
 | 19 | #include <asm/mach/map.h> | 
 | 20 | #include <asm/mach/flash.h> | 
 | 21 | #include <asm/mach/serial_sa1100.h> | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 22 | #include <mach/irqs.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 |  | 
 | 24 | #include "generic.h" | 
 | 25 |  | 
 | 26 |  | 
 | 27 | /* | 
 | 28 |  * Ethernet IRQ mappings | 
 | 29 |  */ | 
 | 30 |  | 
 | 31 | #define PLEB_ETH0_P		(0x20000300)	/* Ethernet 0 in PCMCIA0 IO */ | 
 | 32 | #define PLEB_ETH0_V		(0xf6000300) | 
 | 33 |  | 
 | 34 | #define GPIO_ETH0_IRQ		GPIO_GPIO(21) | 
 | 35 | #define GPIO_ETH0_EN		GPIO_GPIO(26) | 
 | 36 |  | 
 | 37 | #define IRQ_GPIO_ETH0_IRQ	IRQ_GPIO21 | 
 | 38 |  | 
 | 39 | static struct resource smc91x_resources[] = { | 
 | 40 | 	[0] = { | 
| Kristoffer Ericson | bda0308 | 2008-09-29 17:09:10 +0100 | [diff] [blame] | 41 | 		.start	= PLEB_ETH0_P, | 
 | 42 | 		.end	= PLEB_ETH0_P | 0x03ffffff, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | 		.flags	= IORESOURCE_MEM, | 
 | 44 | 	}, | 
 | 45 | #if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */ | 
 | 46 | 	[1] = { | 
 | 47 | 		.start	= IRQ_GPIO_ETH0_IRQ, | 
 | 48 | 		.end	= IRQ_GPIO_ETH0_IRQ, | 
 | 49 | 		.flags	= IORESOURCE_IRQ, | 
 | 50 | 	}, | 
 | 51 | #endif | 
 | 52 | }; | 
 | 53 |  | 
 | 54 |  | 
 | 55 | static struct platform_device smc91x_device = { | 
 | 56 | 	.name		= "smc91x", | 
 | 57 | 	.id		= 0, | 
 | 58 | 	.num_resources	= ARRAY_SIZE(smc91x_resources), | 
 | 59 | 	.resource	= smc91x_resources, | 
 | 60 | }; | 
 | 61 |  | 
 | 62 | static struct platform_device *devices[] __initdata = { | 
 | 63 | 	&smc91x_device, | 
 | 64 | }; | 
 | 65 |  | 
 | 66 |  | 
 | 67 | /* | 
 | 68 |  * Pleb's memory map | 
 | 69 |  * has flash memory (typically 4 or 8 meg) selected by | 
 | 70 |  * the two SA1100 lowest chip select outputs. | 
 | 71 |  */ | 
 | 72 | static struct resource pleb_flash_resources[] = { | 
 | 73 | 	[0] = { | 
 | 74 | 		.start = SA1100_CS0_PHYS, | 
 | 75 | 		.end   = SA1100_CS0_PHYS + SZ_8M - 1, | 
 | 76 | 		.flags = IORESOURCE_MEM, | 
 | 77 | 	}, | 
 | 78 | 	[1] = { | 
 | 79 | 		.start = SA1100_CS1_PHYS, | 
 | 80 | 		.end   = SA1100_CS1_PHYS + SZ_8M - 1, | 
 | 81 | 		.flags = IORESOURCE_MEM, | 
 | 82 | 	} | 
 | 83 | }; | 
 | 84 |  | 
 | 85 |  | 
 | 86 | static struct mtd_partition pleb_partitions[] = { | 
 | 87 | 	{ | 
 | 88 | 		.name		= "blob", | 
| Kristoffer Ericson | bda0308 | 2008-09-29 17:09:10 +0100 | [diff] [blame] | 89 | 		.offset		= 0, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | 		.size		= 0x00020000, | 
 | 91 | 	}, { | 
 | 92 | 		.name		= "kernel", | 
| Kristoffer Ericson | bda0308 | 2008-09-29 17:09:10 +0100 | [diff] [blame] | 93 | 		.offset		= MTDPART_OFS_APPEND, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | 		.size		= 0x000e0000, | 
 | 95 | 	}, { | 
 | 96 | 		.name		= "rootfs", | 
| Kristoffer Ericson | bda0308 | 2008-09-29 17:09:10 +0100 | [diff] [blame] | 97 | 		.offset		= MTDPART_OFS_APPEND, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | 		.size		= 0x00300000, | 
 | 99 | 	} | 
 | 100 | }; | 
 | 101 |  | 
 | 102 |  | 
 | 103 | static struct flash_platform_data pleb_flash_data = { | 
 | 104 | 	.map_name = "cfi_probe", | 
 | 105 | 	.parts = pleb_partitions, | 
 | 106 | 	.nr_parts = ARRAY_SIZE(pleb_partitions), | 
 | 107 | }; | 
 | 108 |  | 
 | 109 |  | 
 | 110 | static void __init pleb_init(void) | 
 | 111 | { | 
| Russell King | 7a5b4e1 | 2009-10-06 14:55:53 +0100 | [diff] [blame] | 112 | 	sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | 			      ARRAY_SIZE(pleb_flash_resources)); | 
 | 114 |  | 
 | 115 |  | 
 | 116 | 	platform_add_devices(devices, ARRAY_SIZE(devices)); | 
 | 117 | } | 
 | 118 |  | 
 | 119 |  | 
 | 120 | static void __init pleb_map_io(void) | 
 | 121 | { | 
 | 122 | 	sa1100_map_io(); | 
 | 123 |  | 
 | 124 | 	sa1100_register_uart(0, 3); | 
| Kristoffer Ericson | 9398253 | 2008-11-26 20:58:43 +0100 | [diff] [blame] | 125 | 	sa1100_register_uart(1, 1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 |  | 
| Kristoffer Ericson | 9398253 | 2008-11-26 20:58:43 +0100 | [diff] [blame] | 127 | 	GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD); | 
 | 128 | 	GPDR |= GPIO_UART_TXD; | 
 | 129 | 	GPDR &= ~GPIO_UART_RXD; | 
 | 130 | 	PPAR |= PPAR_UPR; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 |  | 
 | 132 | 	/* | 
 | 133 | 	 * Fix expansion memory timing for network card | 
 | 134 | 	 */ | 
 | 135 | 	MECR = ((2<<10) | (2<<5) | (2<<0)); | 
 | 136 |  | 
 | 137 | 	/* | 
 | 138 | 	 * Enable the SMC ethernet controller | 
 | 139 | 	 */ | 
 | 140 | 	GPDR |= GPIO_ETH0_EN;	/* set to output */ | 
 | 141 | 	GPCR  = GPIO_ETH0_EN;	/* clear MCLK (enable smc) */ | 
 | 142 |  | 
 | 143 | 	GPDR &= ~GPIO_ETH0_IRQ; | 
 | 144 |  | 
| Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 145 | 	set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | } | 
 | 147 |  | 
 | 148 | MACHINE_START(PLEB, "PLEB") | 
| Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 149 | 	.phys_io	= 0x80000000, | 
 | 150 | 	.io_pg_offst	= ((0xf8000000) >> 18) & 0xfffc, | 
 | 151 | 	.map_io		= pleb_map_io, | 
 | 152 | 	.init_irq	= sa1100_init_irq, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | 	.timer		= &sa1100_timer, | 
 | 154 | 	.init_machine   = pleb_init, | 
 | 155 | MACHINE_END |