18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/mach-ixp4xx/gateway7001-setup.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Board setup for the Gateway 7001 board
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#include <linux/kernel.h>
168c2ecf20Sopenharmony_ci#include <linux/init.h>
178c2ecf20Sopenharmony_ci#include <linux/device.h>
188c2ecf20Sopenharmony_ci#include <linux/serial.h>
198c2ecf20Sopenharmony_ci#include <linux/tty.h>
208c2ecf20Sopenharmony_ci#include <linux/serial_8250.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#include <asm/types.h>
238c2ecf20Sopenharmony_ci#include <asm/setup.h>
248c2ecf20Sopenharmony_ci#include <asm/memory.h>
258c2ecf20Sopenharmony_ci#include <mach/hardware.h>
268c2ecf20Sopenharmony_ci#include <asm/irq.h>
278c2ecf20Sopenharmony_ci#include <asm/mach-types.h>
288c2ecf20Sopenharmony_ci#include <asm/mach/arch.h>
298c2ecf20Sopenharmony_ci#include <asm/mach/flash.h>
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#include "irqs.h"
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistatic struct flash_platform_data gateway7001_flash_data = {
348c2ecf20Sopenharmony_ci	.map_name	= "cfi_probe",
358c2ecf20Sopenharmony_ci	.width		= 2,
368c2ecf20Sopenharmony_ci};
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic struct resource gateway7001_flash_resource = {
398c2ecf20Sopenharmony_ci	.flags		= IORESOURCE_MEM,
408c2ecf20Sopenharmony_ci};
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistatic struct platform_device gateway7001_flash = {
438c2ecf20Sopenharmony_ci	.name		= "IXP4XX-Flash",
448c2ecf20Sopenharmony_ci	.id		= 0,
458c2ecf20Sopenharmony_ci	.dev		= {
468c2ecf20Sopenharmony_ci		.platform_data = &gateway7001_flash_data,
478c2ecf20Sopenharmony_ci	},
488c2ecf20Sopenharmony_ci	.num_resources	= 1,
498c2ecf20Sopenharmony_ci	.resource	= &gateway7001_flash_resource,
508c2ecf20Sopenharmony_ci};
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistatic struct resource gateway7001_uart_resource = {
538c2ecf20Sopenharmony_ci	.start	= IXP4XX_UART2_BASE_PHYS,
548c2ecf20Sopenharmony_ci	.end	= IXP4XX_UART2_BASE_PHYS + 0x0fff,
558c2ecf20Sopenharmony_ci	.flags	= IORESOURCE_MEM,
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistatic struct plat_serial8250_port gateway7001_uart_data[] = {
598c2ecf20Sopenharmony_ci	{
608c2ecf20Sopenharmony_ci		.mapbase	= IXP4XX_UART2_BASE_PHYS,
618c2ecf20Sopenharmony_ci		.membase	= (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
628c2ecf20Sopenharmony_ci		.irq		= IRQ_IXP4XX_UART2,
638c2ecf20Sopenharmony_ci		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
648c2ecf20Sopenharmony_ci		.iotype		= UPIO_MEM,
658c2ecf20Sopenharmony_ci		.regshift	= 2,
668c2ecf20Sopenharmony_ci		.uartclk	= IXP4XX_UART_XTAL,
678c2ecf20Sopenharmony_ci	},
688c2ecf20Sopenharmony_ci	{ },
698c2ecf20Sopenharmony_ci};
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistatic struct platform_device gateway7001_uart = {
728c2ecf20Sopenharmony_ci	.name		= "serial8250",
738c2ecf20Sopenharmony_ci	.id		= PLAT8250_DEV_PLATFORM,
748c2ecf20Sopenharmony_ci	.dev			= {
758c2ecf20Sopenharmony_ci		.platform_data	= gateway7001_uart_data,
768c2ecf20Sopenharmony_ci	},
778c2ecf20Sopenharmony_ci	.num_resources	= 1,
788c2ecf20Sopenharmony_ci	.resource	= &gateway7001_uart_resource,
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cistatic struct platform_device *gateway7001_devices[] __initdata = {
828c2ecf20Sopenharmony_ci	&gateway7001_flash,
838c2ecf20Sopenharmony_ci	&gateway7001_uart
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cistatic void __init gateway7001_init(void)
878c2ecf20Sopenharmony_ci{
888c2ecf20Sopenharmony_ci	ixp4xx_sys_init();
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci	gateway7001_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
918c2ecf20Sopenharmony_ci	gateway7001_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci	*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
948c2ecf20Sopenharmony_ci	*IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci	platform_add_devices(gateway7001_devices, ARRAY_SIZE(gateway7001_devices));
978c2ecf20Sopenharmony_ci}
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#ifdef CONFIG_MACH_GATEWAY7001
1008c2ecf20Sopenharmony_ciMACHINE_START(GATEWAY7001, "Gateway 7001 AP")
1018c2ecf20Sopenharmony_ci	/* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
1028c2ecf20Sopenharmony_ci	.map_io		= ixp4xx_map_io,
1038c2ecf20Sopenharmony_ci	.init_early	= ixp4xx_init_early,
1048c2ecf20Sopenharmony_ci	.init_irq	= ixp4xx_init_irq,
1058c2ecf20Sopenharmony_ci	.init_time	= ixp4xx_timer_init,
1068c2ecf20Sopenharmony_ci	.atag_offset	= 0x100,
1078c2ecf20Sopenharmony_ci	.init_machine	= gateway7001_init,
1088c2ecf20Sopenharmony_ci#if defined(CONFIG_PCI)
1098c2ecf20Sopenharmony_ci	.dma_zone_size	= SZ_64M,
1108c2ecf20Sopenharmony_ci#endif
1118c2ecf20Sopenharmony_ci	.restart	= ixp4xx_restart,
1128c2ecf20Sopenharmony_ciMACHINE_END
1138c2ecf20Sopenharmony_ci#endif
114