1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * arch/arm/mach-ixp4xx/gtwx5715-setup.c
4 *
5 * Gemtek GTWX5715 (Linksys WRV54G) board setup
6 *
7 * Copyright (C) 2004 George T. Joseph
8 * Derived from Coyote
9 */
10
11#include <linux/init.h>
12#include <linux/device.h>
13#include <linux/serial.h>
14#include <linux/tty.h>
15#include <linux/serial_8250.h>
16#include <asm/types.h>
17#include <asm/setup.h>
18#include <asm/memory.h>
19#include <mach/hardware.h>
20#include <asm/irq.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/flash.h>
24
25#include "irqs.h"
26
27/* GPIO 5,6,7 and 12 are hard wired to the Kendin KS8995M Switch
28   and operate as an SPI type interface.  The details of the interface
29   are available on Kendin/Micrel's web site. */
30
31#define GTWX5715_KSSPI_SELECT	5
32#define GTWX5715_KSSPI_TXD	6
33#define GTWX5715_KSSPI_CLOCK	7
34#define GTWX5715_KSSPI_RXD	12
35
36/* The "reset" button is wired to GPIO 3.
37   The GPIO is brought "low" when the button is pushed. */
38
39#define GTWX5715_BUTTON_GPIO	3
40
41/* Board Label      Front Label
42   LED1             Power
43   LED2             Wireless-G
44   LED3             not populated but could be
45   LED4             Internet
46   LED5 - LED8      Controlled by KS8995M Switch
47   LED9             DMZ */
48
49#define GTWX5715_LED1_GPIO	2
50#define GTWX5715_LED2_GPIO	9
51#define GTWX5715_LED3_GPIO	8
52#define GTWX5715_LED4_GPIO	1
53#define GTWX5715_LED9_GPIO	4
54
55/*
56 * Xscale UART registers are 32 bits wide with only the least
57 * significant 8 bits having any meaning.  From a configuration
58 * perspective, this means 2 things...
59 *
60 *   Setting .regshift = 2 so that the standard 16550 registers
61 *   line up on every 4th byte.
62 *
63 *   Shifting the register start virtual address +3 bytes when
64 *   compiled big-endian.  Since register writes are done on a
65 *   single byte basis, if the shift isn't done the driver will
66 *   write the value into the most significant byte of the register,
67 *   which is ignored, instead of the least significant.
68 */
69
70#ifdef	__ARMEB__
71#define	REG_OFFSET	3
72#else
73#define	REG_OFFSET	0
74#endif
75
76/*
77 * Only the second or "console" uart is connected on the gtwx5715.
78 */
79
80static struct resource gtwx5715_uart_resources[] = {
81	{
82		.start	= IXP4XX_UART2_BASE_PHYS,
83		.end	= IXP4XX_UART2_BASE_PHYS + 0x0fff,
84		.flags	= IORESOURCE_MEM,
85	},
86	{
87		.start	= IRQ_IXP4XX_UART2,
88		.end	= IRQ_IXP4XX_UART2,
89		.flags	= IORESOURCE_IRQ,
90	},
91	{ },
92};
93
94
95static struct plat_serial8250_port gtwx5715_uart_platform_data[] = {
96	{
97	.mapbase	= IXP4XX_UART2_BASE_PHYS,
98	.membase	= (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
99	.irq		= IRQ_IXP4XX_UART2,
100	.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
101	.iotype		= UPIO_MEM,
102	.regshift	= 2,
103	.uartclk	= IXP4XX_UART_XTAL,
104	},
105	{ },
106};
107
108static struct platform_device gtwx5715_uart_device = {
109	.name		= "serial8250",
110	.id		= PLAT8250_DEV_PLATFORM,
111	.dev			= {
112		.platform_data	= gtwx5715_uart_platform_data,
113	},
114	.num_resources	= 2,
115	.resource	= gtwx5715_uart_resources,
116};
117
118static struct flash_platform_data gtwx5715_flash_data = {
119	.map_name	= "cfi_probe",
120	.width		= 2,
121};
122
123static struct resource gtwx5715_flash_resource = {
124	.flags		= IORESOURCE_MEM,
125};
126
127static struct platform_device gtwx5715_flash = {
128	.name		= "IXP4XX-Flash",
129	.id		= 0,
130	.dev		= {
131		.platform_data = &gtwx5715_flash_data,
132	},
133	.num_resources	= 1,
134	.resource	= &gtwx5715_flash_resource,
135};
136
137static struct platform_device *gtwx5715_devices[] __initdata = {
138	&gtwx5715_uart_device,
139	&gtwx5715_flash,
140};
141
142static void __init gtwx5715_init(void)
143{
144	ixp4xx_sys_init();
145
146	gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
147	gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;
148
149	platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
150}
151
152
153MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")
154	/* Maintainer: George Joseph */
155	.map_io		= ixp4xx_map_io,
156	.init_early	= ixp4xx_init_early,
157	.init_irq	= ixp4xx_init_irq,
158	.init_time	= ixp4xx_timer_init,
159	.atag_offset	= 0x100,
160	.init_machine	= gtwx5715_init,
161#if defined(CONFIG_PCI)
162	.dma_zone_size	= SZ_64M,
163#endif
164	.restart	= ixp4xx_restart,
165MACHINE_END
166
167
168