^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) * linux/arch/sh/boards/sh03/setup.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2004 Interface Co.,Ltd. Saito.K
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/ata_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm/rtc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <mach-sh03/mach/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <mach-sh03/mach/sh03.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/addrspace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static void __init init_sh03_IRQ(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) plat_irq_setup_pins(IRQ_MODE_IRQ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static struct resource cf_ide_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) .start = 0x1f0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) .end = 0x1f0 + 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .flags = IORESOURCE_IO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) .start = 0x1f0 + 0x206,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .end = 0x1f0 +8 + 0x206 + 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .flags = IORESOURCE_IO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) [2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .start = IRL2_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) static struct platform_device cf_ide_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) .name = "pata_platform",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .num_resources = ARRAY_SIZE(cf_ide_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .resource = cf_ide_resources,
^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) static struct resource heartbeat_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .start = 0xa0800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) .end = 0xa0800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) },
^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 heartbeat_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .name = "heartbeat",
^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(heartbeat_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) .resource = heartbeat_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static struct platform_device *sh03_devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) &heartbeat_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) &cf_ide_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static int __init sh03_devices_setup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) pgprot_t prot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) unsigned long paddrbase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) void *cf_ide_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) /* open I/O area window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) paddrbase = virt_to_phys((void *)PA_AREA5_IO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) if (!cf_ide_base) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) printk("allocate_cf_area : can't open CF I/O window!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) cf_ide_resources[0].start += (unsigned long)cf_ide_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) cf_ide_resources[0].end += (unsigned long)cf_ide_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) cf_ide_resources[1].start += (unsigned long)cf_ide_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) cf_ide_resources[1].end += (unsigned long)cf_ide_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) device_initcall(sh03_devices_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) static struct sh_machine_vector mv_sh03 __initmv = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) .mv_name = "Interface (CTP/PCI-SH03)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) .mv_init_irq = init_sh03_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) };