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