• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/arch/arm/mach-sa1100/
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>
9#include <linux/platform_device.h>
10#include <linux/irq.h>
11#include <linux/io.h>
12#include <linux/mtd/partitions.h>
13
14#include <mach/hardware.h>
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>
22#include <mach/irqs.h>
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
39static struct resource smc91x_resources[] = {
40	[0] = {
41		.start	= PLEB_ETH0_P,
42		.end	= PLEB_ETH0_P | 0x03ffffff,
43		.flags	= IORESOURCE_MEM,
44	},
45};
46
47
48static struct platform_device smc91x_device = {
49	.name		= "smc91x",
50	.id		= 0,
51	.num_resources	= ARRAY_SIZE(smc91x_resources),
52	.resource	= smc91x_resources,
53};
54
55static struct platform_device *devices[] __initdata = {
56	&smc91x_device,
57};
58
59
60/*
61 * Pleb's memory map
62 * has flash memory (typically 4 or 8 meg) selected by
63 * the two SA1100 lowest chip select outputs.
64 */
65static struct resource pleb_flash_resources[] = {
66	[0] = {
67		.start = SA1100_CS0_PHYS,
68		.end   = SA1100_CS0_PHYS + SZ_8M - 1,
69		.flags = IORESOURCE_MEM,
70	},
71	[1] = {
72		.start = SA1100_CS1_PHYS,
73		.end   = SA1100_CS1_PHYS + SZ_8M - 1,
74		.flags = IORESOURCE_MEM,
75	}
76};
77
78
79static struct mtd_partition pleb_partitions[] = {
80	{
81		.name		= "blob",
82		.offset		= 0,
83		.size		= 0x00020000,
84	}, {
85		.name		= "kernel",
86		.offset		= MTDPART_OFS_APPEND,
87		.size		= 0x000e0000,
88	}, {
89		.name		= "rootfs",
90		.offset		= MTDPART_OFS_APPEND,
91		.size		= 0x00300000,
92	}
93};
94
95
96static struct flash_platform_data pleb_flash_data = {
97	.map_name = "cfi_probe",
98	.parts = pleb_partitions,
99	.nr_parts = ARRAY_SIZE(pleb_partitions),
100};
101
102
103static void __init pleb_init(void)
104{
105	sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
106			      ARRAY_SIZE(pleb_flash_resources));
107
108
109	platform_add_devices(devices, ARRAY_SIZE(devices));
110}
111
112
113static void __init pleb_map_io(void)
114{
115	sa1100_map_io();
116
117	sa1100_register_uart(0, 3);
118	sa1100_register_uart(1, 1);
119
120	GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
121	GPDR |= GPIO_UART_TXD;
122	GPDR &= ~GPIO_UART_RXD;
123	PPAR |= PPAR_UPR;
124
125	/*
126	 * Fix expansion memory timing for network card
127	 */
128	MECR = ((2<<10) | (2<<5) | (2<<0));
129
130	/*
131	 * Enable the SMC ethernet controller
132	 */
133	GPDR |= GPIO_ETH0_EN;	/* set to output */
134	GPCR  = GPIO_ETH0_EN;	/* clear MCLK (enable smc) */
135
136	GPDR &= ~GPIO_ETH0_IRQ;
137
138	set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING);
139}
140
141MACHINE_START(PLEB, "PLEB")
142	.phys_io	= 0x80000000,
143	.io_pg_offst	= ((0xf8000000) >> 18) & 0xfffc,
144	.map_io		= pleb_map_io,
145	.init_irq	= sa1100_init_irq,
146	.timer		= &sa1100_timer,
147	.init_machine   = pleb_init,
148MACHINE_END
149