blob: 1525d7b5f1b74b6d06ac1276a56a45c23781e060 [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 King6920b5a2012-09-21 10:18:58 +01009#include <linux/platform_data/sa11x0-serial.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010010#include <linux/platform_device.h>
Thomas Gleixner119c6412006-07-01 22:32:38 +010011#include <linux/irq.h>
Russell Kingfced80c2008-09-06 12:10:45 +010012#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/mtd/partitions.h>
Arnd Bergmannb70661c2015-02-25 16:31:57 +010014#include <linux/smc91x.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Russell Kinga09e64f2008-08-05 16:14:15 +010016#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <asm/setup.h>
18#include <asm/mach-types.h>
19
20#include <asm/mach/arch.h>
21#include <asm/mach/map.h>
22#include <asm/mach/flash.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010023#include <mach/irqs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
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
40static struct resource smc91x_resources[] = {
Russell Kinga1810992012-01-12 10:25:29 +000041 [0] = DEFINE_RES_MEM(PLEB_ETH0_P, 0x04000000),
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */
Russell Kinga1810992012-01-12 10:25:29 +000043 [1] = DEFINE_RES_IRQ(IRQ_GPIO_ETH0_IRQ),
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#endif
45};
46
Arnd Bergmannb70661c2015-02-25 16:31:57 +010047static struct smc91x_platdata smc91x_platdata = {
48 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
49};
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
51static struct platform_device smc91x_device = {
52 .name = "smc91x",
53 .id = 0,
54 .num_resources = ARRAY_SIZE(smc91x_resources),
55 .resource = smc91x_resources,
Arnd Bergmannb70661c2015-02-25 16:31:57 +010056 .dev = {
Arnd Bergmann04b91702015-03-04 23:39:18 +010057 .platform_data = &smc91x_platdata,
Arnd Bergmannb70661c2015-02-25 16:31:57 +010058 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070059};
60
61static struct platform_device *devices[] __initdata = {
62 &smc91x_device,
63};
64
65
66/*
67 * Pleb's memory map
68 * has flash memory (typically 4 or 8 meg) selected by
69 * the two SA1100 lowest chip select outputs.
70 */
71static struct resource pleb_flash_resources[] = {
Russell Kinga1810992012-01-12 10:25:29 +000072 [0] = DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_8M),
73 [1] = DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_8M),
Linus Torvalds1da177e2005-04-16 15:20:36 -070074};
75
76
77static struct mtd_partition pleb_partitions[] = {
78 {
79 .name = "blob",
Kristoffer Ericsonbda03082008-09-29 17:09:10 +010080 .offset = 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 .size = 0x00020000,
82 }, {
83 .name = "kernel",
Kristoffer Ericsonbda03082008-09-29 17:09:10 +010084 .offset = MTDPART_OFS_APPEND,
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 .size = 0x000e0000,
86 }, {
87 .name = "rootfs",
Kristoffer Ericsonbda03082008-09-29 17:09:10 +010088 .offset = MTDPART_OFS_APPEND,
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 .size = 0x00300000,
90 }
91};
92
93
94static struct flash_platform_data pleb_flash_data = {
95 .map_name = "cfi_probe",
96 .parts = pleb_partitions,
97 .nr_parts = ARRAY_SIZE(pleb_partitions),
98};
99
100
101static void __init pleb_init(void)
102{
Russell King7a5b4e12009-10-06 14:55:53 +0100103 sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 ARRAY_SIZE(pleb_flash_resources));
105
106
107 platform_add_devices(devices, ARRAY_SIZE(devices));
108}
109
110
111static void __init pleb_map_io(void)
112{
113 sa1100_map_io();
114
115 sa1100_register_uart(0, 3);
Kristoffer Ericson93982532008-11-26 20:58:43 +0100116 sa1100_register_uart(1, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
Kristoffer Ericson93982532008-11-26 20:58:43 +0100118 GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
119 GPDR |= GPIO_UART_TXD;
120 GPDR &= ~GPIO_UART_RXD;
121 PPAR |= PPAR_UPR;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
123 /*
124 * Fix expansion memory timing for network card
125 */
126 MECR = ((2<<10) | (2<<5) | (2<<0));
127
128 /*
129 * Enable the SMC ethernet controller
130 */
131 GPDR |= GPIO_ETH0_EN; /* set to output */
132 GPCR = GPIO_ETH0_EN; /* clear MCLK (enable smc) */
133
134 GPDR &= ~GPIO_ETH0_IRQ;
135
Thomas Gleixner6845664a2011-03-24 13:25:22 +0100136 irq_set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137}
138
139MACHINE_START(PLEB, "PLEB")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100140 .map_io = pleb_map_io,
Rob Herringf314f332012-02-24 00:06:51 +0100141 .nr_irqs = SA1100_NR_IRQS,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100142 .init_irq = sa1100_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700143 .init_time = sa1100_timer_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 .init_machine = pleb_init,
Shawn Guo7fea1ba2012-04-26 21:22:45 +0800145 .init_late = sa11x0_init_late,
Russell Kingd9ca5832011-11-05 10:28:50 +0000146 .restart = sa11x0_restart,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147MACHINE_END