^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) // Copyright 2007 Simtec Electronics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) // http://www.simtec.co.uk/products/EB2410ITX/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) // http://armlinux.simtec.co.uk/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) // Ben Dooks <ben@simtec.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/ata_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/mach/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include "map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <mach/irqs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include "bast.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* IDE ports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static struct pata_platform_info bast_ide_platdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) .ioport_shift = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) static struct resource bast_ide0_resource[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRI, 8 * 0x20),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static struct platform_device bast_device_ide0 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .name = "pata_platform",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) .num_resources = ARRAY_SIZE(bast_ide0_resource),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) .resource = bast_ide0_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .platform_data = &bast_ide_platdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .coherent_dma_mask = ~0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static struct resource bast_ide1_resource[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESEC, 8 * 0x20),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static struct platform_device bast_device_ide1 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .name = "pata_platform",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .num_resources = ARRAY_SIZE(bast_ide1_resource),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) .resource = bast_ide1_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) .platform_data = &bast_ide_platdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) .coherent_dma_mask = ~0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static struct platform_device *bast_ide_devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) &bast_device_ide0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) &bast_device_ide1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) static __init int bast_ide_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) if (machine_is_bast() || machine_is_vr1000())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) return platform_add_devices(bast_ide_devices,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) ARRAY_SIZE(bast_ide_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) fs_initcall(bast_ide_init);