18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/mach-ixp4xx/coyote-setup.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Board setup for ADI Engineering and IXDGP425 boards
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2003-2005 MontaVista Software, Inc.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Author: Deepak Saxena <dsaxena@plexity.net>
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/kernel.h>
138c2ecf20Sopenharmony_ci#include <linux/init.h>
148c2ecf20Sopenharmony_ci#include <linux/device.h>
158c2ecf20Sopenharmony_ci#include <linux/serial.h>
168c2ecf20Sopenharmony_ci#include <linux/tty.h>
178c2ecf20Sopenharmony_ci#include <linux/serial_8250.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include <asm/types.h>
208c2ecf20Sopenharmony_ci#include <asm/setup.h>
218c2ecf20Sopenharmony_ci#include <asm/memory.h>
228c2ecf20Sopenharmony_ci#include <mach/hardware.h>
238c2ecf20Sopenharmony_ci#include <asm/irq.h>
248c2ecf20Sopenharmony_ci#include <asm/mach-types.h>
258c2ecf20Sopenharmony_ci#include <asm/mach/arch.h>
268c2ecf20Sopenharmony_ci#include <asm/mach/flash.h>
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#include "irqs.h"
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define COYOTE_IDE_BASE_PHYS	IXP4XX_EXP_BUS_BASE(3)
318c2ecf20Sopenharmony_ci#define COYOTE_IDE_BASE_VIRT	0xFFFE1000
328c2ecf20Sopenharmony_ci#define COYOTE_IDE_REGION_SIZE	0x1000
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define COYOTE_IDE_DATA_PORT	0xFFFE10E0
358c2ecf20Sopenharmony_ci#define COYOTE_IDE_CTRL_PORT	0xFFFE10FC
368c2ecf20Sopenharmony_ci#define COYOTE_IDE_ERROR_PORT	0xFFFE10E2
378c2ecf20Sopenharmony_ci#define IRQ_COYOTE_IDE		IRQ_IXP4XX_GPIO5
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistatic struct flash_platform_data coyote_flash_data = {
408c2ecf20Sopenharmony_ci	.map_name	= "cfi_probe",
418c2ecf20Sopenharmony_ci	.width		= 2,
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistatic struct resource coyote_flash_resource = {
458c2ecf20Sopenharmony_ci	.flags		= IORESOURCE_MEM,
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic struct platform_device coyote_flash = {
498c2ecf20Sopenharmony_ci	.name		= "IXP4XX-Flash",
508c2ecf20Sopenharmony_ci	.id		= 0,
518c2ecf20Sopenharmony_ci	.dev		= {
528c2ecf20Sopenharmony_ci		.platform_data = &coyote_flash_data,
538c2ecf20Sopenharmony_ci	},
548c2ecf20Sopenharmony_ci	.num_resources	= 1,
558c2ecf20Sopenharmony_ci	.resource	= &coyote_flash_resource,
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistatic struct resource coyote_uart_resource = {
598c2ecf20Sopenharmony_ci	.start	= IXP4XX_UART2_BASE_PHYS,
608c2ecf20Sopenharmony_ci	.end	= IXP4XX_UART2_BASE_PHYS + 0x0fff,
618c2ecf20Sopenharmony_ci	.flags	= IORESOURCE_MEM,
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistatic struct plat_serial8250_port coyote_uart_data[] = {
658c2ecf20Sopenharmony_ci	{
668c2ecf20Sopenharmony_ci		.mapbase	= IXP4XX_UART2_BASE_PHYS,
678c2ecf20Sopenharmony_ci		.membase	= (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
688c2ecf20Sopenharmony_ci		.irq		= IRQ_IXP4XX_UART2,
698c2ecf20Sopenharmony_ci		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
708c2ecf20Sopenharmony_ci		.iotype		= UPIO_MEM,
718c2ecf20Sopenharmony_ci		.regshift	= 2,
728c2ecf20Sopenharmony_ci		.uartclk	= IXP4XX_UART_XTAL,
738c2ecf20Sopenharmony_ci	},
748c2ecf20Sopenharmony_ci	{ },
758c2ecf20Sopenharmony_ci};
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_cistatic struct platform_device coyote_uart = {
788c2ecf20Sopenharmony_ci	.name		= "serial8250",
798c2ecf20Sopenharmony_ci	.id		= PLAT8250_DEV_PLATFORM,
808c2ecf20Sopenharmony_ci	.dev			= {
818c2ecf20Sopenharmony_ci		.platform_data	= coyote_uart_data,
828c2ecf20Sopenharmony_ci	},
838c2ecf20Sopenharmony_ci	.num_resources	= 1,
848c2ecf20Sopenharmony_ci	.resource	= &coyote_uart_resource,
858c2ecf20Sopenharmony_ci};
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_cistatic struct platform_device *coyote_devices[] __initdata = {
888c2ecf20Sopenharmony_ci	&coyote_flash,
898c2ecf20Sopenharmony_ci	&coyote_uart
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_cistatic void __init coyote_init(void)
938c2ecf20Sopenharmony_ci{
948c2ecf20Sopenharmony_ci	ixp4xx_sys_init();
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci	coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
978c2ecf20Sopenharmony_ci	coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci	*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
1008c2ecf20Sopenharmony_ci	*IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci	if (machine_is_ixdpg425()) {
1038c2ecf20Sopenharmony_ci		coyote_uart_data[0].membase =
1048c2ecf20Sopenharmony_ci			(char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
1058c2ecf20Sopenharmony_ci		coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS;
1068c2ecf20Sopenharmony_ci		coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
1078c2ecf20Sopenharmony_ci	}
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci	platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
1108c2ecf20Sopenharmony_ci}
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#ifdef CONFIG_ARCH_ADI_COYOTE
1138c2ecf20Sopenharmony_ciMACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
1148c2ecf20Sopenharmony_ci	/* Maintainer: MontaVista Software, Inc. */
1158c2ecf20Sopenharmony_ci	.map_io		= ixp4xx_map_io,
1168c2ecf20Sopenharmony_ci	.init_early	= ixp4xx_init_early,
1178c2ecf20Sopenharmony_ci	.init_irq	= ixp4xx_init_irq,
1188c2ecf20Sopenharmony_ci	.init_time	= ixp4xx_timer_init,
1198c2ecf20Sopenharmony_ci	.atag_offset	= 0x100,
1208c2ecf20Sopenharmony_ci	.init_machine	= coyote_init,
1218c2ecf20Sopenharmony_ci#if defined(CONFIG_PCI)
1228c2ecf20Sopenharmony_ci	.dma_zone_size	= SZ_64M,
1238c2ecf20Sopenharmony_ci#endif
1248c2ecf20Sopenharmony_ci	.restart	= ixp4xx_restart,
1258c2ecf20Sopenharmony_ciMACHINE_END
1268c2ecf20Sopenharmony_ci#endif
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/*
1298c2ecf20Sopenharmony_ci * IXDPG425 is identical to Coyote except for which serial port
1308c2ecf20Sopenharmony_ci * is connected.
1318c2ecf20Sopenharmony_ci */
1328c2ecf20Sopenharmony_ci#ifdef CONFIG_MACH_IXDPG425
1338c2ecf20Sopenharmony_ciMACHINE_START(IXDPG425, "Intel IXDPG425")
1348c2ecf20Sopenharmony_ci	/* Maintainer: MontaVista Software, Inc. */
1358c2ecf20Sopenharmony_ci	.map_io		= ixp4xx_map_io,
1368c2ecf20Sopenharmony_ci	.init_early	= ixp4xx_init_early,
1378c2ecf20Sopenharmony_ci	.init_irq	= ixp4xx_init_irq,
1388c2ecf20Sopenharmony_ci	.init_time	= ixp4xx_timer_init,
1398c2ecf20Sopenharmony_ci	.atag_offset	= 0x100,
1408c2ecf20Sopenharmony_ci	.init_machine	= coyote_init,
1418c2ecf20Sopenharmony_ci	.restart	= ixp4xx_restart,
1428c2ecf20Sopenharmony_ciMACHINE_END
1438c2ecf20Sopenharmony_ci#endif
1448c2ecf20Sopenharmony_ci
145