1 // SPDX-License-Identifier: GPL-2.0
3 * linux/arch/arm/mach-sa1100/pleb.c
6 #include <linux/init.h>
7 #include <linux/kernel.h>
9 #include <linux/ioport.h>
10 #include <linux/platform_data/sa11x0-serial.h>
11 #include <linux/platform_device.h>
12 #include <linux/irq.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/smc91x.h>
17 #include <mach/hardware.h>
18 #include <asm/setup.h>
19 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/map.h>
23 #include <asm/mach/flash.h>
24 #include <mach/irqs.h>
30 * Ethernet IRQ mappings
33 #define PLEB_ETH0_P (0x20000300) /* Ethernet 0 in PCMCIA0 IO */
34 #define PLEB_ETH0_V (0xf6000300)
36 #define GPIO_ETH0_IRQ GPIO_GPIO(21)
37 #define GPIO_ETH0_EN GPIO_GPIO(26)
39 #define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21
41 static struct resource smc91x_resources
[] = {
42 [0] = DEFINE_RES_MEM(PLEB_ETH0_P
, 0x04000000),
43 #if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */
44 [1] = DEFINE_RES_IRQ(IRQ_GPIO_ETH0_IRQ
),
48 static struct smc91x_platdata smc91x_platdata
= {
49 .flags
= SMC91X_USE_16BIT
| SMC91X_USE_8BIT
| SMC91X_NOWAIT
,
52 static struct platform_device smc91x_device
= {
55 .num_resources
= ARRAY_SIZE(smc91x_resources
),
56 .resource
= smc91x_resources
,
58 .platform_data
= &smc91x_platdata
,
62 static struct platform_device
*devices
[] __initdata
= {
69 * has flash memory (typically 4 or 8 meg) selected by
70 * the two SA1100 lowest chip select outputs.
72 static struct resource pleb_flash_resources
[] = {
73 [0] = DEFINE_RES_MEM(SA1100_CS0_PHYS
, SZ_8M
),
74 [1] = DEFINE_RES_MEM(SA1100_CS1_PHYS
, SZ_8M
),
78 static struct mtd_partition pleb_partitions
[] = {
85 .offset
= MTDPART_OFS_APPEND
,
89 .offset
= MTDPART_OFS_APPEND
,
95 static struct flash_platform_data pleb_flash_data
= {
96 .map_name
= "cfi_probe",
97 .parts
= pleb_partitions
,
98 .nr_parts
= ARRAY_SIZE(pleb_partitions
),
102 static void __init
pleb_init(void)
104 sa11x0_register_mtd(&pleb_flash_data
, pleb_flash_resources
,
105 ARRAY_SIZE(pleb_flash_resources
));
108 platform_add_devices(devices
, ARRAY_SIZE(devices
));
112 static void __init
pleb_map_io(void)
116 sa1100_register_uart(0, 3);
117 sa1100_register_uart(1, 1);
119 GAFR
|= (GPIO_UART_TXD
| GPIO_UART_RXD
);
120 GPDR
|= GPIO_UART_TXD
;
121 GPDR
&= ~GPIO_UART_RXD
;
125 * Fix expansion memory timing for network card
127 MECR
= ((2<<10) | (2<<5) | (2<<0));
130 * Enable the SMC ethernet controller
132 GPDR
|= GPIO_ETH0_EN
; /* set to output */
133 GPCR
= GPIO_ETH0_EN
; /* clear MCLK (enable smc) */
135 GPDR
&= ~GPIO_ETH0_IRQ
;
137 irq_set_irq_type(GPIO_ETH0_IRQ
, IRQ_TYPE_EDGE_FALLING
);
140 MACHINE_START(PLEB
, "PLEB")
141 .map_io
= pleb_map_io
,
142 .nr_irqs
= SA1100_NR_IRQS
,
143 .init_irq
= sa1100_init_irq
,
144 .init_time
= sa1100_timer_init
,
145 .init_machine
= pleb_init
,
146 .init_late
= sa11x0_init_late
,
147 .restart
= sa11x0_restart
,