blob: 1602575a0d5c47f8c3be09387f1fff63c737e41e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Kingd052d1b2005-10-29 19:07:23 +01009#include <linux/platform_device.h>
Thomas Gleixner119c6412006-07-01 22:32:38 +010010#include <linux/irq.h>
Russell Kingfced80c2008-09-06 12:10:45 +010011#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/mtd/partitions.h>
13
Russell Kinga09e64f2008-08-05 16:14:15 +010014#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#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 Kinga09e64f2008-08-05 16:14:15 +010022#include <mach/irqs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
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
39static struct resource smc91x_resources[] = {
Russell Kinga1810992012-01-12 10:25:29 +000040 [0] = DEFINE_RES_MEM(PLEB_ETH0_P, 0x04000000),
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */
Russell Kinga1810992012-01-12 10:25:29 +000042 [1] = DEFINE_RES_IRQ(IRQ_GPIO_ETH0_IRQ),
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#endif
44};
45
46
47static struct platform_device smc91x_device = {
48 .name = "smc91x",
49 .id = 0,
50 .num_resources = ARRAY_SIZE(smc91x_resources),
51 .resource = smc91x_resources,
52};
53
54static struct platform_device *devices[] __initdata = {
55 &smc91x_device,
56};
57
58
59/*
60 * Pleb's memory map
61 * has flash memory (typically 4 or 8 meg) selected by
62 * the two SA1100 lowest chip select outputs.
63 */
64static struct resource pleb_flash_resources[] = {
Russell Kinga1810992012-01-12 10:25:29 +000065 [0] = DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_8M),
66 [1] = DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_8M),
Linus Torvalds1da177e2005-04-16 15:20:36 -070067};
68
69
70static struct mtd_partition pleb_partitions[] = {
71 {
72 .name = "blob",
Kristoffer Ericsonbda03082008-09-29 17:09:10 +010073 .offset = 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 .size = 0x00020000,
75 }, {
76 .name = "kernel",
Kristoffer Ericsonbda03082008-09-29 17:09:10 +010077 .offset = MTDPART_OFS_APPEND,
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 .size = 0x000e0000,
79 }, {
80 .name = "rootfs",
Kristoffer Ericsonbda03082008-09-29 17:09:10 +010081 .offset = MTDPART_OFS_APPEND,
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 .size = 0x00300000,
83 }
84};
85
86
87static struct flash_platform_data pleb_flash_data = {
88 .map_name = "cfi_probe",
89 .parts = pleb_partitions,
90 .nr_parts = ARRAY_SIZE(pleb_partitions),
91};
92
93
94static void __init pleb_init(void)
95{
Russell King7a5b4e12009-10-06 14:55:53 +010096 sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 ARRAY_SIZE(pleb_flash_resources));
98
99
100 platform_add_devices(devices, ARRAY_SIZE(devices));
101}
102
103
104static void __init pleb_map_io(void)
105{
106 sa1100_map_io();
107
108 sa1100_register_uart(0, 3);
Kristoffer Ericson93982532008-11-26 20:58:43 +0100109 sa1100_register_uart(1, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110
Kristoffer Ericson93982532008-11-26 20:58:43 +0100111 GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
112 GPDR |= GPIO_UART_TXD;
113 GPDR &= ~GPIO_UART_RXD;
114 PPAR |= PPAR_UPR;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
116 /*
117 * Fix expansion memory timing for network card
118 */
119 MECR = ((2<<10) | (2<<5) | (2<<0));
120
121 /*
122 * Enable the SMC ethernet controller
123 */
124 GPDR |= GPIO_ETH0_EN; /* set to output */
125 GPCR = GPIO_ETH0_EN; /* clear MCLK (enable smc) */
126
127 GPDR &= ~GPIO_ETH0_IRQ;
128
Thomas Gleixner6845664a2011-03-24 13:25:22 +0100129 irq_set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130}
131
132MACHINE_START(PLEB, "PLEB")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100133 .map_io = pleb_map_io,
Rob Herringf314f332012-02-24 00:06:51 +0100134 .nr_irqs = SA1100_NR_IRQS,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100135 .init_irq = sa1100_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 .timer = &sa1100_timer,
137 .init_machine = pleb_init,
Russell Kingd9ca5832011-11-05 10:28:50 +0000138 .restart = sa11x0_restart,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139MACHINE_END