162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * auxio.h:  Definitions and code for the Auxiliary I/O register.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci#ifndef _SPARC_AUXIO_H
862306a36Sopenharmony_ci#define _SPARC_AUXIO_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include <asm/vaddrs.h>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/* This register is an unsigned char in IO space.  It does two things.
1362306a36Sopenharmony_ci * First, it is used to control the front panel LED light on machines
1462306a36Sopenharmony_ci * that have it (good for testing entry points to trap handlers and irq's)
1562306a36Sopenharmony_ci * Secondly, it controls various floppy drive parameters.
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci#define AUXIO_ORMEIN      0xf0    /* All writes must set these bits. */
1862306a36Sopenharmony_ci#define AUXIO_ORMEIN4M    0xc0    /* sun4m - All writes must set these bits. */
1962306a36Sopenharmony_ci#define AUXIO_FLPY_DENS   0x20    /* Floppy density, high if set. Read only. */
2062306a36Sopenharmony_ci#define AUXIO_FLPY_DCHG   0x10    /* A disk change occurred.  Read only. */
2162306a36Sopenharmony_ci#define AUXIO_EDGE_ON     0x10    /* sun4m - On means Jumper block is in. */
2262306a36Sopenharmony_ci#define AUXIO_FLPY_DSEL   0x08    /* Drive select/start-motor. Write only. */
2362306a36Sopenharmony_ci#define AUXIO_LINK_TEST   0x08    /* sun4m - On means TPE Carrier detect. */
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci/* Set the following to one, then zero, after doing a pseudo DMA transfer. */
2662306a36Sopenharmony_ci#define AUXIO_FLPY_TCNT   0x04    /* Floppy terminal count. Write only. */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/* Set the following to zero to eject the floppy. */
2962306a36Sopenharmony_ci#define AUXIO_FLPY_EJCT   0x02    /* Eject floppy disk.  Write only. */
3062306a36Sopenharmony_ci#define AUXIO_LED         0x01    /* On if set, off if unset. Read/Write */
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#ifndef __ASSEMBLY__
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/*
3562306a36Sopenharmony_ci * NOTE: these routines are implementation dependent--
3662306a36Sopenharmony_ci * understand the hardware you are querying!
3762306a36Sopenharmony_ci */
3862306a36Sopenharmony_civoid set_auxio(unsigned char bits_on, unsigned char bits_off);
3962306a36Sopenharmony_ciunsigned char get_auxio(void); /* .../asm/floppy.h */
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/*
4262306a36Sopenharmony_ci * The following routines are provided for driver-compatibility
4362306a36Sopenharmony_ci * with sparc64 (primarily sunlance.c)
4462306a36Sopenharmony_ci */
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#define AUXIO_LTE_ON    1
4762306a36Sopenharmony_ci#define AUXIO_LTE_OFF   0
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/* auxio_set_lte - Set Link Test Enable (TPE Link Detect)
5062306a36Sopenharmony_ci *
5162306a36Sopenharmony_ci * on - AUXIO_LTE_ON or AUXIO_LTE_OFF
5262306a36Sopenharmony_ci */
5362306a36Sopenharmony_ci#define auxio_set_lte(on) \
5462306a36Sopenharmony_cido { \
5562306a36Sopenharmony_ci	if(on) { \
5662306a36Sopenharmony_ci		set_auxio(AUXIO_LINK_TEST, 0); \
5762306a36Sopenharmony_ci	} else { \
5862306a36Sopenharmony_ci		set_auxio(0, AUXIO_LINK_TEST); \
5962306a36Sopenharmony_ci	} \
6062306a36Sopenharmony_ci} while (0)
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci#define AUXIO_LED_ON    1
6362306a36Sopenharmony_ci#define AUXIO_LED_OFF   0
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/* auxio_set_led - Set system front panel LED
6662306a36Sopenharmony_ci *
6762306a36Sopenharmony_ci * on - AUXIO_LED_ON or AUXIO_LED_OFF
6862306a36Sopenharmony_ci */
6962306a36Sopenharmony_ci#define auxio_set_led(on) \
7062306a36Sopenharmony_cido { \
7162306a36Sopenharmony_ci	if(on) { \
7262306a36Sopenharmony_ci		set_auxio(AUXIO_LED, 0); \
7362306a36Sopenharmony_ci	} else { \
7462306a36Sopenharmony_ci		set_auxio(0, AUXIO_LED); \
7562306a36Sopenharmony_ci	} \
7662306a36Sopenharmony_ci} while (0)
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#endif /* !(__ASSEMBLY__) */
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci/* AUXIO2 (Power Off Control) */
8262306a36Sopenharmony_ciextern volatile u8 __iomem *auxio_power_register;
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci#define	AUXIO_POWER_DETECT_FAILURE	32
8562306a36Sopenharmony_ci#define	AUXIO_POWER_CLEAR_FAILURE	2
8662306a36Sopenharmony_ci#define	AUXIO_POWER_OFF			1
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#endif /* !(_SPARC_AUXIO_H) */
90