^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) * ip22-hpc.c: Routines for generic manipulation of the HPC controllers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1998 Ralf Baechle
^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/export.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/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/sgi/hpc3.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm/sgi/ioc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <asm/sgi/ip22.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct hpc3_regs *hpc3c0, *hpc3c1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) EXPORT_SYMBOL(hpc3c0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) EXPORT_SYMBOL(hpc3c1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct sgioc_regs *sgioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) EXPORT_SYMBOL(sgioc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* We need software copies of these because they are write only. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) u8 sgi_ioc_reset, sgi_ioc_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) extern char *system_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) void __init sgihpc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* ioremap can't fail */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) hpc3c0 = (struct hpc3_regs *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ioremap(HPC3_CHIP0_BASE, sizeof(struct hpc3_regs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) hpc3c1 = (struct hpc3_regs *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) ioremap(HPC3_CHIP1_BASE, sizeof(struct hpc3_regs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) /* IOC lives in PBUS PIO channel 6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) sgioc = (struct sgioc_regs *)hpc3c0->pbus_extregs[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) hpc3c0->pbus_piocfg[6][0] |= HPC3_PIOCFG_DS16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) if (ip22_is_fullhouse()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /* Full House comes with INT2 which lives in PBUS PIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * channel 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) sgint = (struct sgint_regs *)hpc3c0->pbus_extregs[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) system_type = "SGI Indigo2";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* Guiness comes with INT3 which is part of IOC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) sgint = &sgioc->int3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) system_type = "SGI Indy";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) sgi_ioc_reset = (SGIOC_RESET_PPORT | SGIOC_RESET_KBDMOUSE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) SGIOC_RESET_EISA | SGIOC_RESET_ISDN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) SGIOC_RESET_LC0OFF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) sgi_ioc_write = (SGIOC_WRITE_EASEL | SGIOC_WRITE_NTHRESH |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) SGIOC_WRITE_TPSPEED | SGIOC_WRITE_EPSEL |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) SGIOC_WRITE_U0AMODE | SGIOC_WRITE_U1AMODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) sgioc->reset = sgi_ioc_reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) sgioc->write = sgi_ioc_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) }