18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/mach-ixp4xx/wg302-setup.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Board setup for the Netgear WG302 v2 and WAG302 v2 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * based on coyote-setup.c: 108c2ecf20Sopenharmony_ci * Copyright (C) 2003-2005 MontaVista Software, Inc. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Author: Imre Kaloz <kaloz@openwrt.org> 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/kernel.h> 178c2ecf20Sopenharmony_ci#include <linux/init.h> 188c2ecf20Sopenharmony_ci#include <linux/device.h> 198c2ecf20Sopenharmony_ci#include <linux/serial.h> 208c2ecf20Sopenharmony_ci#include <linux/tty.h> 218c2ecf20Sopenharmony_ci#include <linux/serial_8250.h> 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#include <asm/types.h> 248c2ecf20Sopenharmony_ci#include <asm/setup.h> 258c2ecf20Sopenharmony_ci#include <asm/memory.h> 268c2ecf20Sopenharmony_ci#include <mach/hardware.h> 278c2ecf20Sopenharmony_ci#include <asm/irq.h> 288c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 298c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 308c2ecf20Sopenharmony_ci#include <asm/mach/flash.h> 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#include "irqs.h" 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistatic struct flash_platform_data wg302v2_flash_data = { 358c2ecf20Sopenharmony_ci .map_name = "cfi_probe", 368c2ecf20Sopenharmony_ci .width = 2, 378c2ecf20Sopenharmony_ci}; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_cistatic struct resource wg302v2_flash_resource = { 408c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cistatic struct platform_device wg302v2_flash = { 448c2ecf20Sopenharmony_ci .name = "IXP4XX-Flash", 458c2ecf20Sopenharmony_ci .id = 0, 468c2ecf20Sopenharmony_ci .dev = { 478c2ecf20Sopenharmony_ci .platform_data = &wg302v2_flash_data, 488c2ecf20Sopenharmony_ci }, 498c2ecf20Sopenharmony_ci .num_resources = 1, 508c2ecf20Sopenharmony_ci .resource = &wg302v2_flash_resource, 518c2ecf20Sopenharmony_ci}; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistatic struct resource wg302v2_uart_resource = { 548c2ecf20Sopenharmony_ci .start = IXP4XX_UART2_BASE_PHYS, 558c2ecf20Sopenharmony_ci .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, 568c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistatic struct plat_serial8250_port wg302v2_uart_data[] = { 608c2ecf20Sopenharmony_ci { 618c2ecf20Sopenharmony_ci .mapbase = IXP4XX_UART2_BASE_PHYS, 628c2ecf20Sopenharmony_ci .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 638c2ecf20Sopenharmony_ci .irq = IRQ_IXP4XX_UART2, 648c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 658c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 668c2ecf20Sopenharmony_ci .regshift = 2, 678c2ecf20Sopenharmony_ci .uartclk = IXP4XX_UART_XTAL, 688c2ecf20Sopenharmony_ci }, 698c2ecf20Sopenharmony_ci { }, 708c2ecf20Sopenharmony_ci}; 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_cistatic struct platform_device wg302v2_uart = { 738c2ecf20Sopenharmony_ci .name = "serial8250", 748c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM, 758c2ecf20Sopenharmony_ci .dev = { 768c2ecf20Sopenharmony_ci .platform_data = wg302v2_uart_data, 778c2ecf20Sopenharmony_ci }, 788c2ecf20Sopenharmony_ci .num_resources = 1, 798c2ecf20Sopenharmony_ci .resource = &wg302v2_uart_resource, 808c2ecf20Sopenharmony_ci}; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cistatic struct platform_device *wg302v2_devices[] __initdata = { 838c2ecf20Sopenharmony_ci &wg302v2_flash, 848c2ecf20Sopenharmony_ci &wg302v2_uart, 858c2ecf20Sopenharmony_ci}; 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic void __init wg302v2_init(void) 888c2ecf20Sopenharmony_ci{ 898c2ecf20Sopenharmony_ci ixp4xx_sys_init(); 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); 928c2ecf20Sopenharmony_ci wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; 958c2ecf20Sopenharmony_ci *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices)); 988c2ecf20Sopenharmony_ci} 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#ifdef CONFIG_MACH_WG302V2 1018c2ecf20Sopenharmony_ciMACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2") 1028c2ecf20Sopenharmony_ci /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ 1038c2ecf20Sopenharmony_ci .map_io = ixp4xx_map_io, 1048c2ecf20Sopenharmony_ci .init_early = ixp4xx_init_early, 1058c2ecf20Sopenharmony_ci .init_irq = ixp4xx_init_irq, 1068c2ecf20Sopenharmony_ci .init_time = ixp4xx_timer_init, 1078c2ecf20Sopenharmony_ci .atag_offset = 0x100, 1088c2ecf20Sopenharmony_ci .init_machine = wg302v2_init, 1098c2ecf20Sopenharmony_ci#if defined(CONFIG_PCI) 1108c2ecf20Sopenharmony_ci .dma_zone_size = SZ_64M, 1118c2ecf20Sopenharmony_ci#endif 1128c2ecf20Sopenharmony_ci .restart = ixp4xx_restart, 1138c2ecf20Sopenharmony_ciMACHINE_END 1148c2ecf20Sopenharmony_ci#endif 115