18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * auxio.h:  Definitions and code for the Auxiliary I/O register.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef _SPARC_AUXIO_H
88c2ecf20Sopenharmony_ci#define _SPARC_AUXIO_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <asm/vaddrs.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* This register is an unsigned char in IO space.  It does two things.
138c2ecf20Sopenharmony_ci * First, it is used to control the front panel LED light on machines
148c2ecf20Sopenharmony_ci * that have it (good for testing entry points to trap handlers and irq's)
158c2ecf20Sopenharmony_ci * Secondly, it controls various floppy drive parameters.
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci#define AUXIO_ORMEIN      0xf0    /* All writes must set these bits. */
188c2ecf20Sopenharmony_ci#define AUXIO_ORMEIN4M    0xc0    /* sun4m - All writes must set these bits. */
198c2ecf20Sopenharmony_ci#define AUXIO_FLPY_DENS   0x20    /* Floppy density, high if set. Read only. */
208c2ecf20Sopenharmony_ci#define AUXIO_FLPY_DCHG   0x10    /* A disk change occurred.  Read only. */
218c2ecf20Sopenharmony_ci#define AUXIO_EDGE_ON     0x10    /* sun4m - On means Jumper block is in. */
228c2ecf20Sopenharmony_ci#define AUXIO_FLPY_DSEL   0x08    /* Drive select/start-motor. Write only. */
238c2ecf20Sopenharmony_ci#define AUXIO_LINK_TEST   0x08    /* sun4m - On means TPE Carrier detect. */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Set the following to one, then zero, after doing a pseudo DMA transfer. */
268c2ecf20Sopenharmony_ci#define AUXIO_FLPY_TCNT   0x04    /* Floppy terminal count. Write only. */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* Set the following to zero to eject the floppy. */
298c2ecf20Sopenharmony_ci#define AUXIO_FLPY_EJCT   0x02    /* Eject floppy disk.  Write only. */
308c2ecf20Sopenharmony_ci#define AUXIO_LED         0x01    /* On if set, off if unset. Read/Write */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/*
358c2ecf20Sopenharmony_ci * NOTE: these routines are implementation dependent--
368c2ecf20Sopenharmony_ci * understand the hardware you are querying!
378c2ecf20Sopenharmony_ci */
388c2ecf20Sopenharmony_civoid set_auxio(unsigned char bits_on, unsigned char bits_off);
398c2ecf20Sopenharmony_ciunsigned char get_auxio(void); /* .../asm/floppy.h */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/*
428c2ecf20Sopenharmony_ci * The following routines are provided for driver-compatibility
438c2ecf20Sopenharmony_ci * with sparc64 (primarily sunlance.c)
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define AUXIO_LTE_ON    1
478c2ecf20Sopenharmony_ci#define AUXIO_LTE_OFF   0
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* auxio_set_lte - Set Link Test Enable (TPE Link Detect)
508c2ecf20Sopenharmony_ci *
518c2ecf20Sopenharmony_ci * on - AUXIO_LTE_ON or AUXIO_LTE_OFF
528c2ecf20Sopenharmony_ci */
538c2ecf20Sopenharmony_ci#define auxio_set_lte(on) \
548c2ecf20Sopenharmony_cido { \
558c2ecf20Sopenharmony_ci	if(on) { \
568c2ecf20Sopenharmony_ci		set_auxio(AUXIO_LINK_TEST, 0); \
578c2ecf20Sopenharmony_ci	} else { \
588c2ecf20Sopenharmony_ci		set_auxio(0, AUXIO_LINK_TEST); \
598c2ecf20Sopenharmony_ci	} \
608c2ecf20Sopenharmony_ci} while (0)
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define AUXIO_LED_ON    1
638c2ecf20Sopenharmony_ci#define AUXIO_LED_OFF   0
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* auxio_set_led - Set system front panel LED
668c2ecf20Sopenharmony_ci *
678c2ecf20Sopenharmony_ci * on - AUXIO_LED_ON or AUXIO_LED_OFF
688c2ecf20Sopenharmony_ci */
698c2ecf20Sopenharmony_ci#define auxio_set_led(on) \
708c2ecf20Sopenharmony_cido { \
718c2ecf20Sopenharmony_ci	if(on) { \
728c2ecf20Sopenharmony_ci		set_auxio(AUXIO_LED, 0); \
738c2ecf20Sopenharmony_ci	} else { \
748c2ecf20Sopenharmony_ci		set_auxio(0, AUXIO_LED); \
758c2ecf20Sopenharmony_ci	} \
768c2ecf20Sopenharmony_ci} while (0)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#endif /* !(__ASSEMBLY__) */
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/* AUXIO2 (Power Off Control) */
828c2ecf20Sopenharmony_ciextern volatile u8 __iomem *auxio_power_register;
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define	AUXIO_POWER_DETECT_FAILURE	32
858c2ecf20Sopenharmony_ci#define	AUXIO_POWER_CLEAR_FAILURE	2
868c2ecf20Sopenharmony_ci#define	AUXIO_POWER_OFF			1
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#endif /* !(_SPARC_AUXIO_H) */
90