Commit 6331310a authored by Eric Brower's avatar Eric Brower Committed by David S. Miller

[SPARC]: Refactor AUXIO support.

parent 35dca6a2
...@@ -6,13 +6,19 @@ ...@@ -6,13 +6,19 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/spinlock.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/auxio.h> #include <asm/auxio.h>
#include <asm/string.h> /* memset(), Linux has no bzero() */ #include <asm/string.h> /* memset(), Linux has no bzero() */
/* Probe and map in the Auxiliary I/O register */ /* Probe and map in the Auxiliary I/O register */
unsigned char *auxio_register;
/* auxio_register is not static because it is referenced
* in entry.S::floppy_tdone
*/
unsigned long auxio_register = 0UL;
static spinlock_t auxio_lock = SPIN_LOCK_UNLOCKED;
void __init auxio_probe(void) void __init auxio_probe(void)
{ {
...@@ -23,7 +29,6 @@ void __init auxio_probe(void) ...@@ -23,7 +29,6 @@ void __init auxio_probe(void)
switch (sparc_cpu_model) { switch (sparc_cpu_model) {
case sun4d: case sun4d:
case sun4: case sun4:
auxio_register = 0;
return; return;
default: default:
break; break;
...@@ -37,12 +42,10 @@ void __init auxio_probe(void) ...@@ -37,12 +42,10 @@ void __init auxio_probe(void)
if(!auxio_nd) { if(!auxio_nd) {
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/* There may be auxio on Ebus */ /* There may be auxio on Ebus */
auxio_register = 0;
return; return;
#else #else
if(prom_searchsiblings(node, "leds")) { if(prom_searchsiblings(node, "leds")) {
/* VME chassis sun4m machine, no auxio exists. */ /* VME chassis sun4m machine, no auxio exists. */
auxio_register = 0;
return; return;
} }
prom_printf("Cannot find auxio node, cannot continue...\n"); prom_printf("Cannot find auxio node, cannot continue...\n");
...@@ -56,14 +59,46 @@ void __init auxio_probe(void) ...@@ -56,14 +59,46 @@ void __init auxio_probe(void)
r.flags = auxregs[0].which_io & 0xF; r.flags = auxregs[0].which_io & 0xF;
r.start = auxregs[0].phys_addr; r.start = auxregs[0].phys_addr;
r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1; r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1;
auxio_register = (unsigned char *) sbus_ioremap(&r, 0, auxio_register = sbus_ioremap(&r, 0, auxregs[0].reg_size, "auxio");
auxregs[0].reg_size, "auxio");
/* Fix the address on sun4m and sun4c. */ /* Fix the address on sun4m and sun4c. */
if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 || if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 ||
sparc_cpu_model == sun4c) sparc_cpu_model == sun4c)
auxio_register = (unsigned char *) ((int)auxio_register | 3); auxio_register |= 3;
set_auxio(AUXIO_LED, 0);
}
unsigned char get_auxio(void)
{
if(auxio_register)
return sbus_readb(auxio_register);
return 0;
}
TURN_ON_LED; void set_auxio(unsigned char bits_on, unsigned char bits_off)
{
unsigned char regval;
unsigned long flags;
spin_lock_irqsave(&auxio_lock, flags);
switch(sparc_cpu_model) {
case sun4c:
regval = sbus_readb(auxio_register);
sbus_writeb(((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN,
auxio_register);
break;
case sun4m:
if(!auxio_register)
break; /* VME chassic sun4m, no auxio. */
regval = sbus_readb(auxio_register);
sbus_writeb(((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M,
auxio_register);
break;
case sun4d:
break;
default:
panic("Can't set AUXIO register on this machine.");
};
spin_unlock_irqrestore(&auxio_lock, flags);
} }
......
...@@ -158,7 +158,8 @@ EXPORT_SYMBOL(rtc_lock); ...@@ -158,7 +158,8 @@ EXPORT_SYMBOL(rtc_lock);
EXPORT_SYMBOL(mostek_lock); EXPORT_SYMBOL(mostek_lock);
EXPORT_SYMBOL(mstk48t02_regs); EXPORT_SYMBOL(mstk48t02_regs);
#if CONFIG_SUN_AUXIO #if CONFIG_SUN_AUXIO
EXPORT_SYMBOL(auxio_register); EXPORT_SYMBOL(set_auxio);
EXPORT_SYMBOL(get_auxio);
#endif #endif
EXPORT_SYMBOL(request_fast_irq); EXPORT_SYMBOL(request_fast_irq);
EXPORT_SYMBOL(io_remap_page_range); EXPORT_SYMBOL(io_remap_page_range);
......
...@@ -248,7 +248,7 @@ void sun4c_complete_all_stores(void) ...@@ -248,7 +248,7 @@ void sun4c_complete_all_stores(void)
_unused = sun4c_get_context(); _unused = sun4c_get_context();
sun4c_set_context(_unused); sun4c_set_context(_unused);
#ifdef CONFIG_SUN_AUXIO #ifdef CONFIG_SUN_AUXIO
_unused = *AUXREG; _unused = get_auxio();
#endif #endif
} }
......
...@@ -68,7 +68,7 @@ prom_cmdline(void) ...@@ -68,7 +68,7 @@ prom_cmdline(void)
install_linux_ticker(); install_linux_ticker();
spin_unlock_irqrestore(&prom_lock, flags); spin_unlock_irqrestore(&prom_lock, flags);
#ifdef CONFIG_SUN_AUXIO #ifdef CONFIG_SUN_AUXIO
TURN_ON_LED; set_auxio(AUXIO_LED, 0);
#endif #endif
if(!serial_console && prom_palette) if(!serial_console && prom_palette)
prom_palette (0); prom_palette (0);
......
/* auxio.c: Probing for the Sparc AUXIO register at boot time. /* auxio.c: Probing for the Sparc AUXIO register at boot time.
* *
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
*
* Refactoring for unified NCR/PCIO support 2002 Eric Brower (ebrower@usa.net)
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/stddef.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/auxio.h>
#include <asm/sbus.h> #include <asm/sbus.h>
#include <asm/ebus.h> #include <asm/ebus.h>
#include <asm/fhc.h> #include <asm/auxio.h>
#include <asm/spitfire.h>
#include <asm/starfire.h> /* This cannot be static, as it is referenced in entry.S */
unsigned long auxio_register = 0UL;
enum auxio_type {
AUXIO_TYPE_NODEV,
AUXIO_TYPE_SBUS,
AUXIO_TYPE_EBUS
};
static enum auxio_type auxio_devtype = AUXIO_TYPE_NODEV;
static spinlock_t auxio_lock = SPIN_LOCK_UNLOCKED;
static void __auxio_sbus_set(u8 bits_on, u8 bits_off)
{
if(auxio_register) {
unsigned char regval;
unsigned long flags;
unsigned char newval;
spin_lock_irqsave(&auxio_lock, flags);
regval = sbus_readb(auxio_register);
newval = regval | bits_on;
newval &= ~bits_off;
newval &= ~AUXIO_AUX1_MASK;
sbus_writeb(newval, auxio_register);
spin_unlock_irqrestore(&auxio_lock, flags);
}
}
static void __auxio_ebus_set(u8 bits_on, u8 bits_off)
{
if(auxio_register) {
unsigned char regval;
unsigned long flags;
unsigned char newval;
spin_lock_irqsave(&auxio_lock, flags);
regval = (u8)readl(auxio_register);
newval = regval | bits_on;
newval &= ~bits_off;
writel((u32)newval, auxio_register);
spin_unlock_irqrestore(&auxio_lock, flags);
}
}
static inline void __auxio_ebus_set_led(int on)
{
(on) ? __auxio_ebus_set(AUXIO_PCIO_LED, 0) :
__auxio_ebus_set(0, AUXIO_PCIO_LED) ;
}
static inline void __auxio_sbus_set_led(int on)
{
(on) ? __auxio_sbus_set(AUXIO_AUX1_LED, 0) :
__auxio_sbus_set(0, AUXIO_AUX1_LED) ;
}
void auxio_set_led(int on)
{
switch(auxio_devtype) {
case AUXIO_TYPE_SBUS:
__auxio_sbus_set_led(on);
break;
case AUXIO_TYPE_EBUS:
__auxio_ebus_set_led(on);
break;
default:
break;
}
}
static inline void __auxio_sbus_set_lte(int on)
{
(on) ? __auxio_sbus_set(AUXIO_AUX1_LTE, 0) :
__auxio_sbus_set(0, AUXIO_AUX1_LTE) ;
}
/* Probe and map in the Auxiliary I/O register */ void auxio_set_lte(int on)
unsigned long auxio_register = 0; {
switch(auxio_devtype) {
case AUXIO_TYPE_SBUS:
__auxio_sbus_set_lte(on);
break;
case AUXIO_TYPE_EBUS:
/* FALL-THROUGH */
default:
break;
}
}
void __init auxio_probe(void) void __init auxio_probe(void)
{ {
...@@ -37,11 +123,15 @@ void __init auxio_probe(void) ...@@ -37,11 +123,15 @@ void __init auxio_probe(void)
} }
found_sdev: found_sdev:
if (!sdev) { if (sdev) {
auxio_devtype = AUXIO_TYPE_SBUS;
auxio_register = sbus_ioremap(&sdev->resource[0], 0,
sdev->reg_addrs[0].reg_size, "auxiliaryIO");
}
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
else {
struct linux_ebus *ebus; struct linux_ebus *ebus;
struct linux_ebus_device *edev = 0; struct linux_ebus_device *edev = 0;
unsigned long led_auxio;
for_each_ebus(ebus) { for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) { for_each_ebusdev(edev, ebus) {
...@@ -50,19 +140,12 @@ void __init auxio_probe(void) ...@@ -50,19 +140,12 @@ void __init auxio_probe(void)
} }
} }
ebus_done: ebus_done:
if (edev) { if (edev) {
led_auxio = edev->resource[0].start; auxio_devtype = AUXIO_TYPE_EBUS;
outl(0x01, led_auxio); auxio_register = (unsigned long)
return; ioremap(edev->resource[0].start, sizeof(u32));
} }
#endif
auxio_register = 0UL;
return;
} }
auxio_set_led(AUXIO_LED_ON);
/* Map the register both read and write */ #endif
auxio_register = sbus_ioremap(&sdev->resource[0], 0,
sdev->reg_addrs[0].reg_size, "auxiliaryIO");
TURN_ON_LED;
} }
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/visasm.h> #include <asm/visasm.h>
#include <asm/estate.h> #include <asm/estate.h>
#include <asm/auxio.h>
/* #define SYSCALL_TRACING 1 */ /* #define SYSCALL_TRACING 1 */
...@@ -662,9 +663,11 @@ floppy_tdone: ...@@ -662,9 +663,11 @@ floppy_tdone:
sethi %hi(auxio_register), %g1 sethi %hi(auxio_register), %g1
ldx [%g1 + %lo(auxio_register)], %g7 ldx [%g1 + %lo(auxio_register)], %g7
lduba [%g7] ASI_PHYS_BYPASS_EC_E, %g5 lduba [%g7] ASI_PHYS_BYPASS_EC_E, %g5
or %g5, 0xc2, %g5 or %g5, AUXIO_AUX1_FTCNT, %g5
/* andn %g5, AUXIO_AUX1_MASK, %g5 */
stba %g5, [%g7] ASI_PHYS_BYPASS_EC_E stba %g5, [%g7] ASI_PHYS_BYPASS_EC_E
andn %g5, 0x02, %g5 andn %g5, AUXIO_AUX1_FTCNT, %g5
/* andn %g5, AUXIO_AUX1_MASK, %g5 */
nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;
nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;
......
...@@ -14,14 +14,13 @@ ...@@ -14,14 +14,13 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/ebus.h> #include <asm/ebus.h>
#include <asm/auxio.h>
#define __KERNEL_SYSCALLS__ #define __KERNEL_SYSCALLS__
#include <linux/unistd.h> #include <linux/unistd.h>
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
static unsigned long power_reg = 0UL; static unsigned long power_reg = 0UL;
#define POWER_SYSTEM_OFF (1 << 0)
#define POWER_COURTESY_OFF (1 << 1)
static DECLARE_WAIT_QUEUE_HEAD(powerd_wait); static DECLARE_WAIT_QUEUE_HEAD(powerd_wait);
static int button_pressed; static int button_pressed;
...@@ -51,7 +50,7 @@ void machine_power_off(void) ...@@ -51,7 +50,7 @@ void machine_power_off(void)
* same effect, so until I figure out * same effect, so until I figure out
* what the difference is... * what the difference is...
*/ */
writel(POWER_COURTESY_OFF | POWER_SYSTEM_OFF, power_reg); writel(AUXIO_PCIO_CPWR_OFF | AUXIO_PCIO_SPWR_OFF, power_reg);
} else } else
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
if (poweroff_method != NULL) { if (poweroff_method != NULL) {
......
...@@ -197,7 +197,8 @@ EXPORT_SYMBOL(mostek_lock); ...@@ -197,7 +197,8 @@ EXPORT_SYMBOL(mostek_lock);
EXPORT_SYMBOL(mstk48t02_regs); EXPORT_SYMBOL(mstk48t02_regs);
EXPORT_SYMBOL(request_fast_irq); EXPORT_SYMBOL(request_fast_irq);
#if CONFIG_SUN_AUXIO #if CONFIG_SUN_AUXIO
EXPORT_SYMBOL(auxio_register); EXPORT_SYMBOL(auxio_set_led);
EXPORT_SYMBOL(auxio_set_lte);
#endif #endif
#if CONFIG_SBUS #if CONFIG_SBUS
EXPORT_SYMBOL(sbus_root); EXPORT_SYMBOL(sbus_root);
......
...@@ -40,7 +40,6 @@ static char *version = ...@@ -40,7 +40,6 @@ static char *version =
#include <asm/openprom.h> #include <asm/openprom.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/auxio.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/irq.h> #include <asm/irq.h>
......
...@@ -36,7 +36,6 @@ static char *version = ...@@ -36,7 +36,6 @@ static char *version =
#include <asm/openprom.h> #include <asm/openprom.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/auxio.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/irq.h> #include <asm/irq.h>
......
...@@ -1417,7 +1417,7 @@ static int __init sparc_lance_init(struct net_device *dev, ...@@ -1417,7 +1417,7 @@ static int __init sparc_lance_init(struct net_device *dev,
"'tpe-link-test?'\n", dev->name); "'tpe-link-test?'\n", dev->name);
printk(KERN_NOTICE "%s: warning: mail any problems " printk(KERN_NOTICE "%s: warning: mail any problems "
"to ecd@skynet.be\n", dev->name); "to ecd@skynet.be\n", dev->name);
set_auxio(AUXIO_LINK_TEST, 0); auxio_set_lte(AUXIO_LTE_ON);
} }
no_link_test: no_link_test:
lp->auto_select = 1; lp->auto_select = 1;
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/vaddrs.h> #include <asm/vaddrs.h>
extern unsigned char *auxio_register;
/* This register is an unsigned char in IO space. It does two things. /* This register is an unsigned char in IO space. It does two things.
* First, it is used to control the front panel LED light on machines * First, it is used to control the front panel LED light on machines
* that have it (good for testing entry points to trap handlers and irq's) * that have it (good for testing entry points to trap handlers and irq's)
...@@ -31,41 +29,52 @@ extern unsigned char *auxio_register; ...@@ -31,41 +29,52 @@ extern unsigned char *auxio_register;
#define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */ #define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */
#define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */ #define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */
#define AUXREG ((volatile unsigned char *)(auxio_register)) #ifndef __ASSEMBLY__
/* These are available on sun4c */ /*
#define TURN_ON_LED if (AUXREG) *AUXREG = (*AUXREG | AUXIO_ORMEIN | AUXIO_LED) * NOTE: these routines are implementation dependent--
#define TURN_OFF_LED if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_LED)) * understand the hardware you are querying!
#define FLIP_LED if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) ^ AUXIO_LED) */
#define FLPY_MOTORON if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_DSEL) extern void set_auxio(unsigned char bits_on, unsigned char bits_off);
#define FLPY_MOTOROFF if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_DSEL)) extern unsigned char get_auxio(void); /* .../asm-sparc/floppy.h */
#define FLPY_TCNTON if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_TCNT)
#define FLPY_TCNTOFF if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_TCNT))
#ifndef __ASSEMBLY__ /*
#define set_auxio(bits_on, bits_off) \ * The following routines are provided for driver-compatibility
* with sparc64 (primarily sunlance.c)
*/
#define AUXIO_LTE_ON 1
#define AUXIO_LTE_OFF 0
/* auxio_set_lte - Set Link Test Enable (TPE Link Detect)
*
* on - AUXIO_LTE_ON or AUXIO_LTE_OFF
*/
#define auxio_set_lte(on) \
do { \ do { \
unsigned char regval; \ if(on) { \
unsigned long flags; \ set_auxio(AUXIO_LINK_TEST, 0); \
save_flags(flags); cli(); \ } else { \
switch(sparc_cpu_model) { \ set_auxio(0, AUXIO_LINK_TEST); \
case sun4c: \ } \
regval = *AUXREG; \ } while (0)
*AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN; \
break; \ #define AUXIO_LED_ON 1
case sun4m: \ #define AUXIO_LED_OFF 0
if(!AUXREG) \
break; /* VME chassic sun4m, no auxio. */ \ /* auxio_set_led - Set system front panel LED
regval = *AUXREG; \ *
*AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M; \ * on - AUXIO_LED_ON or AUXIO_LED_OFF
break; \ */
case sun4d: \ #define auxio_set_led(on) \
break; \ do { \
default: \ if(on) { \
panic("Can't set AUXIO register on this machine."); \ set_auxio(AUXIO_LED, 0); \
}; \ } else { \
restore_flags(flags); \ set_auxio(0, AUXIO_LED); \
} while(0) } \
} while (0)
#endif /* !(__ASSEMBLY__) */ #endif /* !(__ASSEMBLY__) */
......
...@@ -115,7 +115,7 @@ static unsigned char sun_82072_fd_inb(int port) ...@@ -115,7 +115,7 @@ static unsigned char sun_82072_fd_inb(int port)
case 5: /* FD_DATA */ case 5: /* FD_DATA */
return sun_fdc->data_82072; return sun_fdc->data_82072;
case 7: /* FD_DIR */ case 7: /* FD_DIR */
return (*AUXREG & AUXIO_FLPY_DCHG)? 0x80: 0; return (get_auxio() & AUXIO_FLPY_DCHG)? 0x80: 0;
}; };
panic("sun_82072_fd_inb: How did I get here?"); panic("sun_82072_fd_inb: How did I get here?");
} }
...@@ -337,7 +337,7 @@ static int sun_floppy_init(void) ...@@ -337,7 +337,7 @@ static int sun_floppy_init(void)
sun_fdops.fd_inb = sun_82072_fd_inb; sun_fdops.fd_inb = sun_82072_fd_inb;
sun_fdops.fd_outb = sun_82072_fd_outb; sun_fdops.fd_outb = sun_82072_fd_outb;
fdc_status = &sun_fdc->status_82072; fdc_status = &sun_fdc->status_82072;
/* printk("AUXIO @0x%p\n", auxio_register); */ /* P3 */ /* printk("AUXIO @0x%lx\n", auxio_register); */ /* P3 */
} else { } else {
sun_fdops.fd_inb = sun_82077_fd_inb; sun_fdops.fd_inb = sun_82077_fd_inb;
sun_fdops.fd_outb = sun_82077_fd_outb; sun_fdops.fd_outb = sun_82077_fd_outb;
......
/* $Id: auxio.h,v 1.3 2001/06/05 08:16:34 davem Exp $ /* $Id: auxio.h,v 1.3 2001/06/05 08:16:34 davem Exp $
* auxio.h: Definitions and code for the Auxiliary I/O register. * auxio.h: Definitions and code for the Auxiliary I/O registers.
* *
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*
* Refactoring for unified NCR/PCIO support 2002 Eric Brower (ebrower@usa.net)
*/ */
#ifndef _SPARC64_AUXIO_H #ifndef _SPARC64_AUXIO_H
#define _SPARC64_AUXIO_H #define _SPARC64_AUXIO_H
#include <asm/system.h> /* AUXIO implementations:
#include <asm/io.h> * sbus-based NCR89C105 "Slavio"
* LED/Floppy (AUX1) register
/* FIXME: All of this should be checked for sun4u. It has /sbus/auxio, but * Power (AUX2) register
I don't know whether it is the same and don't have a floppy */ *
* ebus-based auxio on PCIO
extern unsigned long auxio_register; * LED Auxio Register
* Power Auxio Register
/* This register is an unsigned char in IO space. It does two things. *
* First, it is used to control the front panel LED light on machines * Register definitions from NCR _NCR89C105 Chip Specification_
* that have it (good for testing entry points to trap handlers and irq's) *
* Secondly, it controls various floppy drive parameters. * SLAVIO AUX1 @ 0x1900000
* -------------------------------------------------
* | (R) | (R) | D | (R) | E | M | T | L |
* -------------------------------------------------
* (R) - bit 7:6,4 are reserved and should be masked in s/w
* D - Floppy Density Sense (1=high density) R/O
* E - Link Test Enable, directly reflected on AT&T 7213 LTE pin
* M - Monitor/Mouse Mux, directly reflected on MON_MSE_MUX pin
* T - Terminal Count: sends TC pulse to 82077 floppy controller
* L - System LED on front panel (0=off, 1=on)
*/ */
#define AUXIO_ORMEIN 0xf0 /* All writes must set these bits. */ #define AUXIO_AUX1_MASK 0xc0 /* Mask bits */
#define AUXIO_ORMEIN4M 0xc0 /* sun4m - All writes must set these bits. */ #define AUXIO_AUX1_FDENS 0x20 /* Floppy Density Sense */
#define AUXIO_FLPY_DENS 0x20 /* Floppy density, high if set. Read only. */ #define AUXIO_AUX1_LTE 0x08 /* Link Test Enable */
#define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */ #define AUXIO_AUX1_MMUX 0x04 /* Monitor/Mouse Mux */
#define AUXIO_EDGE_ON 0x10 /* sun4m - On means Jumper block is in. */ #define AUXIO_AUX1_FTCNT 0x02 /* Terminal Count, */
#define AUXIO_FLPY_DSEL 0x08 /* Drive select/start-motor. Write only. */ #define AUXIO_AUX1_LED 0x01 /* System LED */
#define AUXIO_LINK_TEST 0x08 /* sun4m - On means TPE Carrier detect. */
/* SLAVIO AUX2 @ 0x1910000
/* Set the following to one, then zero, after doing a pseudo DMA transfer. */ * -------------------------------------------------
#define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */ * | (R) | (R) | D | (R) | (R) | (R) | C | F |
* -------------------------------------------------
/* Set the following to zero to eject the floppy. */ * (R) - bits 7:6,4:2 are reserved and should be masked in s/w
#define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */ * D - Power Failure Detect (1=power fail)
#define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */ * C - Clear Power Failure Detect Int (1=clear)
* F - Power Off (1=power off)
#define AUXREG (auxio_register) */
#define AUXIO_AUX2_MASK 0xdc /* Mask Bits */
#define AUXIO_AUX2_PFAILDET 0x20 /* Power Fail Detect */
#define AUXIO_AUX2_PFAILCLR 0x02 /* Clear Pwr Fail Det Intr */
#define AUXIO_AUX2_PWR_OFF 0x01 /* Power Off */
/* These are available on sun4c */ /* Register definitions from Sun Microsystems _PCIO_ p/n 802-7837
#define TURN_ON_LED \ *
do { if (AUXREG) \ * PCIO LED Auxio @ 0x726000
sbus_writeb(sbus_readb(AUXREG) | \ * -------------------------------------------------
(AUXIO_ORMEIN | AUXIO_LED), AUXREG); \ * | 31:1 Unused | LED |
} while(0) * -------------------------------------------------
#define TURN_OFF_LED \ * Bits 31:1 unused
do { if (AUXREG) \ * LED - System LED on front panel (0=off, 1=on)
sbus_writeb((sbus_readb(AUXREG) | \ */
AUXIO_ORMEIN) & (~AUXIO_LED), \ #define AUXIO_PCIO_LED 0x01 /* System LED */
AUXREG); \
} while(0) /* PCIO Power Auxio @ 0x724000
#define FLIP_LED \ * -------------------------------------------------
do { if (AUXREG) \ * | 31:2 Unused | CPO | SPO |
sbus_writeb((sbus_readb(AUXREG) | \ * -------------------------------------------------
AUXIO_ORMEIN) ^ AUXIO_LEN, \ * Bits 31:2 unused
AUXREG); \ * CPO - Courtesy Power Off (1=off)
} while(0) * SPO - System Power Off (1=off)
#define FLPY_MOTORON \ */
do { if (AUXREG) \ #define AUXIO_PCIO_CPWR_OFF 0x02 /* Courtesy Power Off */
sbus_writeb(sbus_readb(AUXREG) | \ #define AUXIO_PCIO_SPWR_OFF 0x01 /* System Power Off */
(AUXIO_ORMEIN | AUXIO_FLPY_DSEL), \
AUXREG); \
} while(0)
#define FLPY_MOTOROFF \
do { if (AUXREG) \
sbus_writeb((sbus_readb(AUXREG) | \
AUXIO_ORMEIN) & (~AUXIO_FLPY_DSEL), \
AUXREG); \
} while(0)
#define FLPY_TCNTON \
do { if (AUXREG) \
sbus_writeb((sbus_readb(AUXREG) | \
AUXIO_ORMEIN) | AUXIO_FLPY_TCNT, \
AUXREG); \
} while(0)
#define FLPY_TCNTOFF \
do { if (AUXREG) \
sbus_writeb((sbus_readb(AUXREG) | \
AUXIO_ORMEIN) & (~AUXIO_FLPY_TCNT), \
AUXREG); \
} while(0)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
static __inline__ void set_auxio(unsigned char bits_on, unsigned char bits_off)
{
unsigned char regval;
unsigned long flags;
local_irq_save(flags);
if (AUXREG) {
unsigned char newval;
regval = sbus_readb(AUXREG); #define AUXIO_LTE_ON 1
newval = regval | bits_on; #define AUXIO_LTE_OFF 0
newval &= ~bits_off;
newval |= AUXIO_ORMEIN4M;
sbus_writeb(newval, AUXREG);
}
local_irq_restore(flags);
}
#endif /* !(__ASSEMBLY__) */
/* auxio_set_lte - Set Link Test Enable (TPE Link Detect)
*
* on - AUXIO_LTE_ON or AUXIO_LTE_OFF
*/
extern void auxio_set_lte(int on);
/* AUXIO2 (Power Off Control) */ #define AUXIO_LED_ON 1
extern __volatile__ unsigned char * auxio_power_register; #define AUXIO_LED_OFF 0
#define AUXIO_POWER_DETECT_FAILURE 32 /* auxio_set_led - Set system front panel LED
#define AUXIO_POWER_CLEAR_FAILURE 2 *
#define AUXIO_POWER_OFF 1 * on - AUXIO_LED_ON or AUXIO_LED_OFF
*/
extern void auxio_set_led(int on);
#endif /* ifndef __ASSEMBLY__ */
#endif /* !(_SPARC_AUXIO_H) */ #endif /* !(_SPARC64_AUXIO_H) */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment