blob: 7e40fe70933bcf4190117aa29a8cbb6b9dbe138d [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001// SPDX-License-Identifier: GPL-2.0
2/*
3 * arch/arm/mach-ixp4xx/coyote-setup.c
4 *
5 * Board setup for ADI Engineering and IXDGP425 boards
6 *
7 * Copyright (C) 2003-2005 MontaVista Software, Inc.
8 *
9 * Author: Deepak Saxena <dsaxena@plexity.net>
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/device.h>
15#include <linux/serial.h>
16#include <linux/tty.h>
17#include <linux/serial_8250.h>
18
19#include <asm/types.h>
20#include <asm/setup.h>
21#include <asm/memory.h>
22#include <mach/hardware.h>
23#include <asm/irq.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/flash.h>
27
28#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
29#define COYOTE_IDE_BASE_VIRT 0xFFFE1000
30#define COYOTE_IDE_REGION_SIZE 0x1000
31
32#define COYOTE_IDE_DATA_PORT 0xFFFE10E0
33#define COYOTE_IDE_CTRL_PORT 0xFFFE10FC
34#define COYOTE_IDE_ERROR_PORT 0xFFFE10E2
35#define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5
36
37static struct flash_platform_data coyote_flash_data = {
38 .map_name = "cfi_probe",
39 .width = 2,
40};
41
42static struct resource coyote_flash_resource = {
43 .flags = IORESOURCE_MEM,
44};
45
46static struct platform_device coyote_flash = {
47 .name = "IXP4XX-Flash",
48 .id = 0,
49 .dev = {
50 .platform_data = &coyote_flash_data,
51 },
52 .num_resources = 1,
53 .resource = &coyote_flash_resource,
54};
55
56static struct resource coyote_uart_resource = {
57 .start = IXP4XX_UART2_BASE_PHYS,
58 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
59 .flags = IORESOURCE_MEM,
60};
61
62static struct plat_serial8250_port coyote_uart_data[] = {
63 {
64 .mapbase = IXP4XX_UART2_BASE_PHYS,
65 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
66 .irq = IRQ_IXP4XX_UART2,
67 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
68 .iotype = UPIO_MEM,
69 .regshift = 2,
70 .uartclk = IXP4XX_UART_XTAL,
71 },
72 { },
73};
74
75static struct platform_device coyote_uart = {
76 .name = "serial8250",
77 .id = PLAT8250_DEV_PLATFORM,
78 .dev = {
79 .platform_data = coyote_uart_data,
80 },
81 .num_resources = 1,
82 .resource = &coyote_uart_resource,
83};
84
85static struct platform_device *coyote_devices[] __initdata = {
86 &coyote_flash,
87 &coyote_uart
88};
89
90static void __init coyote_init(void)
91{
92 ixp4xx_sys_init();
93
94 coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
95 coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
96
97 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
98 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
99
100 if (machine_is_ixdpg425()) {
101 coyote_uart_data[0].membase =
102 (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
103 coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS;
104 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
105 }
106
107 platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
108}
109
110#ifdef CONFIG_ARCH_ADI_COYOTE
111MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
112 /* Maintainer: MontaVista Software, Inc. */
113 .map_io = ixp4xx_map_io,
114 .init_early = ixp4xx_init_early,
115 .init_irq = ixp4xx_init_irq,
116 .init_time = ixp4xx_timer_init,
117 .atag_offset = 0x100,
118 .init_machine = coyote_init,
119#if defined(CONFIG_PCI)
120 .dma_zone_size = SZ_64M,
121#endif
122 .restart = ixp4xx_restart,
123MACHINE_END
124#endif
125
126/*
127 * IXDPG425 is identical to Coyote except for which serial port
128 * is connected.
129 */
130#ifdef CONFIG_MACH_IXDPG425
131MACHINE_START(IXDPG425, "Intel IXDPG425")
132 /* Maintainer: MontaVista Software, Inc. */
133 .map_io = ixp4xx_map_io,
134 .init_early = ixp4xx_init_early,
135 .init_irq = ixp4xx_init_irq,
136 .init_time = ixp4xx_timer_init,
137 .atag_offset = 0x100,
138 .init_machine = coyote_init,
139 .restart = ixp4xx_restart,
140MACHINE_END
141#endif
142