162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * ip22-hpc.c: Routines for generic manipulation of the HPC controllers. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 1996 David S. Miller (davem@davemloft.net) 662306a36Sopenharmony_ci * Copyright (C) 1998 Ralf Baechle 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/export.h> 1062306a36Sopenharmony_ci#include <linux/init.h> 1162306a36Sopenharmony_ci#include <linux/types.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include <asm/io.h> 1462306a36Sopenharmony_ci#include <asm/sgi/hpc3.h> 1562306a36Sopenharmony_ci#include <asm/sgi/ioc.h> 1662306a36Sopenharmony_ci#include <asm/sgi/ip22.h> 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_cistruct hpc3_regs *hpc3c0, *hpc3c1; 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciEXPORT_SYMBOL(hpc3c0); 2162306a36Sopenharmony_ciEXPORT_SYMBOL(hpc3c1); 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_cistruct sgioc_regs *sgioc; 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciEXPORT_SYMBOL(sgioc); 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/* We need software copies of these because they are write only. */ 2862306a36Sopenharmony_ciu8 sgi_ioc_reset, sgi_ioc_write; 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ciextern char *system_type; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_civoid __init sgihpc_init(void) 3362306a36Sopenharmony_ci{ 3462306a36Sopenharmony_ci /* ioremap can't fail */ 3562306a36Sopenharmony_ci hpc3c0 = (struct hpc3_regs *) 3662306a36Sopenharmony_ci ioremap(HPC3_CHIP0_BASE, sizeof(struct hpc3_regs)); 3762306a36Sopenharmony_ci hpc3c1 = (struct hpc3_regs *) 3862306a36Sopenharmony_ci ioremap(HPC3_CHIP1_BASE, sizeof(struct hpc3_regs)); 3962306a36Sopenharmony_ci /* IOC lives in PBUS PIO channel 6 */ 4062306a36Sopenharmony_ci sgioc = (struct sgioc_regs *)hpc3c0->pbus_extregs[6]; 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci hpc3c0->pbus_piocfg[6][0] |= HPC3_PIOCFG_DS16; 4362306a36Sopenharmony_ci if (ip22_is_fullhouse()) { 4462306a36Sopenharmony_ci /* Full House comes with INT2 which lives in PBUS PIO 4562306a36Sopenharmony_ci * channel 4 */ 4662306a36Sopenharmony_ci sgint = (struct sgint_regs *)hpc3c0->pbus_extregs[4]; 4762306a36Sopenharmony_ci system_type = "SGI Indigo2"; 4862306a36Sopenharmony_ci } else { 4962306a36Sopenharmony_ci /* Guiness comes with INT3 which is part of IOC */ 5062306a36Sopenharmony_ci sgint = &sgioc->int3; 5162306a36Sopenharmony_ci system_type = "SGI Indy"; 5262306a36Sopenharmony_ci } 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci sgi_ioc_reset = (SGIOC_RESET_PPORT | SGIOC_RESET_KBDMOUSE | 5562306a36Sopenharmony_ci SGIOC_RESET_EISA | SGIOC_RESET_ISDN | 5662306a36Sopenharmony_ci SGIOC_RESET_LC0OFF); 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci sgi_ioc_write = (SGIOC_WRITE_EASEL | SGIOC_WRITE_NTHRESH | 5962306a36Sopenharmony_ci SGIOC_WRITE_TPSPEED | SGIOC_WRITE_EPSEL | 6062306a36Sopenharmony_ci SGIOC_WRITE_U0AMODE | SGIOC_WRITE_U1AMODE); 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci sgioc->reset = sgi_ioc_reset; 6362306a36Sopenharmony_ci sgioc->write = sgi_ioc_write; 6462306a36Sopenharmony_ci} 65