blob: 8711e299229b2350abc0cdfae51a9b9f0b3e8f84 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Imre Kalozdcdeeb22007-06-02 15:47:51 +01002/*
3 * arch/arm/mach-ixp4xx/wg302-setup.c
4 *
5 * Board setup for the Netgear WG302 v2 and WAG302 v2
6 *
7 * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
8 *
9 * based on coyote-setup.c:
10 * Copyright (C) 2003-2005 MontaVista Software, Inc.
11 *
12 * Author: Imre Kaloz <kaloz@openwrt.org>
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/device.h>
19#include <linux/serial.h>
20#include <linux/tty.h>
21#include <linux/serial_8250.h>
Imre Kalozdcdeeb22007-06-02 15:47:51 +010022
23#include <asm/types.h>
24#include <asm/setup.h>
25#include <asm/memory.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010026#include <mach/hardware.h>
Imre Kalozdcdeeb22007-06-02 15:47:51 +010027#include <asm/irq.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/flash.h>
31
Linus Walleijdc8ef8cd2018-12-29 15:47:52 +010032#include "irqs.h"
33
Imre Kalozdcdeeb22007-06-02 15:47:51 +010034static struct flash_platform_data wg302v2_flash_data = {
35 .map_name = "cfi_probe",
36 .width = 2,
37};
38
39static struct resource wg302v2_flash_resource = {
40 .flags = IORESOURCE_MEM,
41};
42
43static struct platform_device wg302v2_flash = {
44 .name = "IXP4XX-Flash",
45 .id = 0,
46 .dev = {
47 .platform_data = &wg302v2_flash_data,
48 },
49 .num_resources = 1,
50 .resource = &wg302v2_flash_resource,
51};
52
53static struct resource wg302v2_uart_resource = {
54 .start = IXP4XX_UART2_BASE_PHYS,
55 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
56 .flags = IORESOURCE_MEM,
57};
58
59static struct plat_serial8250_port wg302v2_uart_data[] = {
60 {
61 .mapbase = IXP4XX_UART2_BASE_PHYS,
62 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
63 .irq = IRQ_IXP4XX_UART2,
64 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
65 .iotype = UPIO_MEM,
66 .regshift = 2,
67 .uartclk = IXP4XX_UART_XTAL,
68 },
69 { },
70};
71
72static struct platform_device wg302v2_uart = {
73 .name = "serial8250",
74 .id = PLAT8250_DEV_PLATFORM,
75 .dev = {
76 .platform_data = wg302v2_uart_data,
77 },
78 .num_resources = 1,
79 .resource = &wg302v2_uart_resource,
80};
81
82static struct platform_device *wg302v2_devices[] __initdata = {
83 &wg302v2_flash,
84 &wg302v2_uart,
85};
86
87static void __init wg302v2_init(void)
88{
89 ixp4xx_sys_init();
90
91 wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
92 wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
93
94 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
95 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
96
97 platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices));
98}
99
100#ifdef CONFIG_MACH_WG302V2
101MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2")
102 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
Imre Kalozdcdeeb22007-06-02 15:47:51 +0100103 .map_io = ixp4xx_map_io,
Rob Herringf4495882012-03-06 15:01:53 -0600104 .init_early = ixp4xx_init_early,
Imre Kalozdcdeeb22007-06-02 15:47:51 +0100105 .init_irq = ixp4xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700106 .init_time = ixp4xx_timer_init,
Nicolas Pitree022c722011-07-05 22:38:13 -0400107 .atag_offset = 0x100,
Imre Kalozdcdeeb22007-06-02 15:47:51 +0100108 .init_machine = wg302v2_init,
Nicolas Pitre7553ee72011-07-05 22:28:09 -0400109#if defined(CONFIG_PCI)
110 .dma_zone_size = SZ_64M,
111#endif
Russell Kingd1b860f2011-11-05 12:10:55 +0000112 .restart = ixp4xx_restart,
Imre Kalozdcdeeb22007-06-02 15:47:51 +0100113MACHINE_END
114#endif