xref: /linux/arch/mips/sgi-ip22/ip22-hpc.c (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  * ip22-hpc.c: Routines for generic manipulation of the HPC controllers.
41da177e4SLinus Torvalds  *
579add627SJustin P. Mattock  * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
61da177e4SLinus Torvalds  * Copyright (C) 1998 Ralf Baechle
71da177e4SLinus Torvalds  */
81da177e4SLinus Torvalds 
926dd3e4fSPaul Gortmaker #include <linux/export.h>
101da177e4SLinus Torvalds #include <linux/init.h>
111da177e4SLinus Torvalds #include <linux/types.h>
121da177e4SLinus Torvalds 
131da177e4SLinus Torvalds #include <asm/io.h>
141da177e4SLinus Torvalds #include <asm/sgi/hpc3.h>
151da177e4SLinus Torvalds #include <asm/sgi/ioc.h>
161da177e4SLinus Torvalds #include <asm/sgi/ip22.h>
171da177e4SLinus Torvalds 
181da177e4SLinus Torvalds struct hpc3_regs *hpc3c0, *hpc3c1;
191da177e4SLinus Torvalds 
201da177e4SLinus Torvalds EXPORT_SYMBOL(hpc3c0);
211da177e4SLinus Torvalds EXPORT_SYMBOL(hpc3c1);
221da177e4SLinus Torvalds 
231da177e4SLinus Torvalds struct sgioc_regs *sgioc;
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds EXPORT_SYMBOL(sgioc);
261da177e4SLinus Torvalds 
271da177e4SLinus Torvalds /* We need software copies of these because they are write only. */
281da177e4SLinus Torvalds u8 sgi_ioc_reset, sgi_ioc_write;
291da177e4SLinus Torvalds 
301da177e4SLinus Torvalds extern char *system_type;
311da177e4SLinus Torvalds 
sgihpc_init(void)321da177e4SLinus Torvalds void __init sgihpc_init(void)
331da177e4SLinus Torvalds {
341da177e4SLinus Torvalds 	/* ioremap can't fail */
351da177e4SLinus Torvalds 	hpc3c0 = (struct hpc3_regs *)
361da177e4SLinus Torvalds 		 ioremap(HPC3_CHIP0_BASE, sizeof(struct hpc3_regs));
371da177e4SLinus Torvalds 	hpc3c1 = (struct hpc3_regs *)
381da177e4SLinus Torvalds 		 ioremap(HPC3_CHIP1_BASE, sizeof(struct hpc3_regs));
391da177e4SLinus Torvalds 	/* IOC lives in PBUS PIO channel 6 */
401da177e4SLinus Torvalds 	sgioc = (struct sgioc_regs *)hpc3c0->pbus_extregs[6];
411da177e4SLinus Torvalds 
421da177e4SLinus Torvalds 	hpc3c0->pbus_piocfg[6][0] |= HPC3_PIOCFG_DS16;
431da177e4SLinus Torvalds 	if (ip22_is_fullhouse()) {
441da177e4SLinus Torvalds 		/* Full House comes with INT2 which lives in PBUS PIO
451da177e4SLinus Torvalds 		 * channel 4 */
461da177e4SLinus Torvalds 		sgint = (struct sgint_regs *)hpc3c0->pbus_extregs[4];
471da177e4SLinus Torvalds 		system_type = "SGI Indigo2";
481da177e4SLinus Torvalds 	} else {
491da177e4SLinus Torvalds 		/* Guiness comes with INT3 which is part of IOC */
501da177e4SLinus Torvalds 		sgint = &sgioc->int3;
511da177e4SLinus Torvalds 		system_type = "SGI Indy";
521da177e4SLinus Torvalds 	}
531da177e4SLinus Torvalds 
541da177e4SLinus Torvalds 	sgi_ioc_reset = (SGIOC_RESET_PPORT | SGIOC_RESET_KBDMOUSE |
551da177e4SLinus Torvalds 			 SGIOC_RESET_EISA | SGIOC_RESET_ISDN |
561da177e4SLinus Torvalds 			 SGIOC_RESET_LC0OFF);
571da177e4SLinus Torvalds 
581da177e4SLinus Torvalds 	sgi_ioc_write = (SGIOC_WRITE_EASEL | SGIOC_WRITE_NTHRESH |
591da177e4SLinus Torvalds 			 SGIOC_WRITE_TPSPEED | SGIOC_WRITE_EPSEL |
601da177e4SLinus Torvalds 			 SGIOC_WRITE_U0AMODE | SGIOC_WRITE_U1AMODE);
611da177e4SLinus Torvalds 
621da177e4SLinus Torvalds 	sgioc->reset = sgi_ioc_reset;
631da177e4SLinus Torvalds 	sgioc->write = sgi_ioc_write;
641da177e4SLinus Torvalds }
65