From 6331310ae98a6caf5729716b85b1fbadd06b2de1 Mon Sep 17 00:00:00 2001 From: Eric Brower Date: Tue, 22 Apr 2003 08:43:16 -0700 Subject: [PATCH] [SPARC]: Refactor AUXIO support. --- arch/sparc/kernel/auxio.c | 51 ++++++-- arch/sparc/kernel/sparc_ksyms.c | 3 +- arch/sparc/mm/sun4c.c | 2 +- arch/sparc/prom/misc.c | 2 +- arch/sparc64/kernel/auxio.c | 131 +++++++++++++++++---- arch/sparc64/kernel/entry.S | 7 +- arch/sparc64/kernel/power.c | 5 +- arch/sparc64/kernel/sparc64_ksyms.c | 3 +- drivers/fc4/soc.c | 1 - drivers/fc4/socal.c | 1 - drivers/net/sunlance.c | 2 +- include/asm-sparc/auxio.h | 77 ++++++------ include/asm-sparc/floppy.h | 4 +- include/asm-sparc64/auxio.h | 175 +++++++++++++--------------- 14 files changed, 290 insertions(+), 174 deletions(-) diff --git a/arch/sparc/kernel/auxio.c b/arch/sparc/kernel/auxio.c index fe34b090020b6..44b6dd75ec58c 100644 --- a/arch/sparc/kernel/auxio.c +++ b/arch/sparc/kernel/auxio.c @@ -6,13 +6,19 @@ #include #include #include +#include #include #include #include #include /* memset(), Linux has no bzero() */ /* 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) { @@ -23,7 +29,6 @@ void __init auxio_probe(void) switch (sparc_cpu_model) { case sun4d: case sun4: - auxio_register = 0; return; default: break; @@ -37,12 +42,10 @@ void __init auxio_probe(void) if(!auxio_nd) { #ifdef CONFIG_PCI /* There may be auxio on Ebus */ - auxio_register = 0; return; #else if(prom_searchsiblings(node, "leds")) { /* VME chassis sun4m machine, no auxio exists. */ - auxio_register = 0; return; } prom_printf("Cannot find auxio node, cannot continue...\n"); @@ -56,14 +59,46 @@ void __init auxio_probe(void) r.flags = auxregs[0].which_io & 0xF; r.start = auxregs[0].phys_addr; r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1; - auxio_register = (unsigned char *) sbus_ioremap(&r, 0, - auxregs[0].reg_size, "auxio"); + auxio_register = sbus_ioremap(&r, 0, auxregs[0].reg_size, "auxio"); /* Fix the address on sun4m and sun4c. */ if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 || 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); } diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index 7c4abb81d46c8..72f156526627a 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c @@ -158,7 +158,8 @@ EXPORT_SYMBOL(rtc_lock); EXPORT_SYMBOL(mostek_lock); EXPORT_SYMBOL(mstk48t02_regs); #if CONFIG_SUN_AUXIO -EXPORT_SYMBOL(auxio_register); +EXPORT_SYMBOL(set_auxio); +EXPORT_SYMBOL(get_auxio); #endif EXPORT_SYMBOL(request_fast_irq); EXPORT_SYMBOL(io_remap_page_range); diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index e4da22250441a..2f28f983c86e9 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -248,7 +248,7 @@ void sun4c_complete_all_stores(void) _unused = sun4c_get_context(); sun4c_set_context(_unused); #ifdef CONFIG_SUN_AUXIO - _unused = *AUXREG; + _unused = get_auxio(); #endif } diff --git a/arch/sparc/prom/misc.c b/arch/sparc/prom/misc.c index 0bcd09af481a5..5c7aa0c97f37b 100644 --- a/arch/sparc/prom/misc.c +++ b/arch/sparc/prom/misc.c @@ -68,7 +68,7 @@ prom_cmdline(void) install_linux_ticker(); spin_unlock_irqrestore(&prom_lock, flags); #ifdef CONFIG_SUN_AUXIO - TURN_ON_LED; + set_auxio(AUXIO_LED, 0); #endif if(!serial_console && prom_palette) prom_palette (0); diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c index bf54c874f5cd8..09a97496ecf09 100644 --- a/arch/sparc64/kernel/auxio.c +++ b/arch/sparc64/kernel/auxio.c @@ -1,28 +1,114 @@ /* auxio.c: Probing for the Sparc AUXIO register at boot time. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) + * + * Refactoring for unified NCR/PCIO support 2002 Eric Brower (ebrower@usa.net) */ #include -#include #include -#include -#include #include -#include #include #include #include -#include #include #include -#include -#include -#include +#include + +/* 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 */ -unsigned long auxio_register = 0; +void auxio_set_lte(int on) +{ + 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) { @@ -37,11 +123,15 @@ void __init auxio_probe(void) } 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 + else { struct linux_ebus *ebus; struct linux_ebus_device *edev = 0; - unsigned long led_auxio; for_each_ebus(ebus) { for_each_ebusdev(edev, ebus) { @@ -50,19 +140,12 @@ found_sdev: } } ebus_done: - if (edev) { - led_auxio = edev->resource[0].start; - outl(0x01, led_auxio); - return; + auxio_devtype = AUXIO_TYPE_EBUS; + auxio_register = (unsigned long) + ioremap(edev->resource[0].start, sizeof(u32)); } -#endif - auxio_register = 0UL; - return; } - - /* Map the register both read and write */ - auxio_register = sbus_ioremap(&sdev->resource[0], 0, - sdev->reg_addrs[0].reg_size, "auxiliaryIO"); - TURN_ON_LED; + auxio_set_led(AUXIO_LED_ON); +#endif } diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index ea855f89b1c5e..2678db1ea4b9e 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S @@ -20,6 +20,7 @@ #include #include #include +#include /* #define SYSCALL_TRACING 1 */ @@ -662,9 +663,11 @@ floppy_tdone: sethi %hi(auxio_register), %g1 ldx [%g1 + %lo(auxio_register)], %g7 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 - 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; diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index f10e3394bf2cd..862fa9d6ba614 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c @@ -14,14 +14,13 @@ #include #include +#include #define __KERNEL_SYSCALLS__ #include #ifdef CONFIG_PCI 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 int button_pressed; @@ -51,7 +50,7 @@ void machine_power_off(void) * same effect, so until I figure out * 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 #endif /* CONFIG_PCI */ if (poweroff_method != NULL) { diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index d0a0a4f04c08f..bfadb6c43c0e3 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -197,7 +197,8 @@ EXPORT_SYMBOL(mostek_lock); EXPORT_SYMBOL(mstk48t02_regs); EXPORT_SYMBOL(request_fast_irq); #if CONFIG_SUN_AUXIO -EXPORT_SYMBOL(auxio_register); +EXPORT_SYMBOL(auxio_set_led); +EXPORT_SYMBOL(auxio_set_lte); #endif #if CONFIG_SBUS EXPORT_SYMBOL(sbus_root); diff --git a/drivers/fc4/soc.c b/drivers/fc4/soc.c index 6257a249ffd36..16f15672678ab 100644 --- a/drivers/fc4/soc.c +++ b/drivers/fc4/soc.c @@ -40,7 +40,6 @@ static char *version = #include #include -#include #include #include diff --git a/drivers/fc4/socal.c b/drivers/fc4/socal.c index 80ad18fd0b7a3..db01b6d7fa223 100644 --- a/drivers/fc4/socal.c +++ b/drivers/fc4/socal.c @@ -36,7 +36,6 @@ static char *version = #include #include -#include #include #include diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index 52e66ed7c0e7e..a2f21b82510d6 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c @@ -1417,7 +1417,7 @@ static int __init sparc_lance_init(struct net_device *dev, "'tpe-link-test?'\n", dev->name); printk(KERN_NOTICE "%s: warning: mail any problems " "to ecd@skynet.be\n", dev->name); - set_auxio(AUXIO_LINK_TEST, 0); + auxio_set_lte(AUXIO_LTE_ON); } no_link_test: lp->auto_select = 1; diff --git a/include/asm-sparc/auxio.h b/include/asm-sparc/auxio.h index adffbf9337acf..ee83aefb20dca 100644 --- a/include/asm-sparc/auxio.h +++ b/include/asm-sparc/auxio.h @@ -9,8 +9,6 @@ #include #include -extern unsigned char *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 * that have it (good for testing entry points to trap handlers and irq's) @@ -31,41 +29,52 @@ extern unsigned char *auxio_register; #define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */ #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) -#define TURN_OFF_LED if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_LED)) -#define FLIP_LED if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) ^ AUXIO_LED) -#define FLPY_MOTORON if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_DSEL) -#define FLPY_MOTOROFF if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_DSEL)) -#define FLPY_TCNTON if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_TCNT) -#define FLPY_TCNTOFF if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_TCNT)) +/* + * NOTE: these routines are implementation dependent-- + * understand the hardware you are querying! + */ +extern void set_auxio(unsigned char bits_on, unsigned char bits_off); +extern unsigned char get_auxio(void); /* .../asm-sparc/floppy.h */ -#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 { \ - unsigned char regval; \ - unsigned long flags; \ - save_flags(flags); cli(); \ - switch(sparc_cpu_model) { \ - case sun4c: \ - regval = *AUXREG; \ - *AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN; \ - break; \ - case sun4m: \ - if(!AUXREG) \ - break; /* VME chassic sun4m, no auxio. */ \ - regval = *AUXREG; \ - *AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M; \ - break; \ - case sun4d: \ - break; \ - default: \ - panic("Can't set AUXIO register on this machine."); \ - }; \ - restore_flags(flags); \ -} while(0) + if(on) { \ + set_auxio(AUXIO_LINK_TEST, 0); \ + } else { \ + set_auxio(0, AUXIO_LINK_TEST); \ + } \ +} while (0) + +#define AUXIO_LED_ON 1 +#define AUXIO_LED_OFF 0 + +/* auxio_set_led - Set system front panel LED + * + * on - AUXIO_LED_ON or AUXIO_LED_OFF + */ +#define auxio_set_led(on) \ +do { \ + if(on) { \ + set_auxio(AUXIO_LED, 0); \ + } else { \ + set_auxio(0, AUXIO_LED); \ + } \ +} while (0) + #endif /* !(__ASSEMBLY__) */ diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h index 9215d32e22857..484fae9b00e76 100644 --- a/include/asm-sparc/floppy.h +++ b/include/asm-sparc/floppy.h @@ -115,7 +115,7 @@ static unsigned char sun_82072_fd_inb(int port) case 5: /* FD_DATA */ return sun_fdc->data_82072; 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?"); } @@ -337,7 +337,7 @@ static int sun_floppy_init(void) sun_fdops.fd_inb = sun_82072_fd_inb; sun_fdops.fd_outb = sun_82072_fd_outb; fdc_status = &sun_fdc->status_82072; - /* printk("AUXIO @0x%p\n", auxio_register); */ /* P3 */ + /* printk("AUXIO @0x%lx\n", auxio_register); */ /* P3 */ } else { sun_fdops.fd_inb = sun_82077_fd_inb; sun_fdops.fd_outb = sun_82077_fd_outb; diff --git a/include/asm-sparc64/auxio.h b/include/asm-sparc64/auxio.h index eb5c0a380285b..5eb01dd471507 100644 --- a/include/asm-sparc64/auxio.h +++ b/include/asm-sparc64/auxio.h @@ -1,111 +1,98 @@ /* $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) + * + * Refactoring for unified NCR/PCIO support 2002 Eric Brower (ebrower@usa.net) */ #ifndef _SPARC64_AUXIO_H #define _SPARC64_AUXIO_H -#include -#include - -/* FIXME: All of this should be checked for sun4u. It has /sbus/auxio, but - I don't know whether it is the same and don't have a floppy */ - -extern unsigned long 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 - * that have it (good for testing entry points to trap handlers and irq's) - * Secondly, it controls various floppy drive parameters. +/* AUXIO implementations: + * sbus-based NCR89C105 "Slavio" + * LED/Floppy (AUX1) register + * Power (AUX2) register + * + * ebus-based auxio on PCIO + * LED Auxio Register + * Power Auxio Register + * + * Register definitions from NCR _NCR89C105 Chip Specification_ + * + * 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_ORMEIN4M 0xc0 /* sun4m - All writes must set these bits. */ -#define AUXIO_FLPY_DENS 0x20 /* Floppy density, high if set. Read only. */ -#define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */ -#define AUXIO_EDGE_ON 0x10 /* sun4m - On means Jumper block is in. */ -#define AUXIO_FLPY_DSEL 0x08 /* Drive select/start-motor. Write only. */ -#define AUXIO_LINK_TEST 0x08 /* sun4m - On means TPE Carrier detect. */ - -/* Set the following to one, then zero, after doing a pseudo DMA transfer. */ -#define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */ - -/* Set the following to zero to eject the floppy. */ -#define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */ -#define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */ - -#define AUXREG (auxio_register) +#define AUXIO_AUX1_MASK 0xc0 /* Mask bits */ +#define AUXIO_AUX1_FDENS 0x20 /* Floppy Density Sense */ +#define AUXIO_AUX1_LTE 0x08 /* Link Test Enable */ +#define AUXIO_AUX1_MMUX 0x04 /* Monitor/Mouse Mux */ +#define AUXIO_AUX1_FTCNT 0x02 /* Terminal Count, */ +#define AUXIO_AUX1_LED 0x01 /* System LED */ + +/* SLAVIO AUX2 @ 0x1910000 + * ------------------------------------------------- + * | (R) | (R) | D | (R) | (R) | (R) | C | F | + * ------------------------------------------------- + * (R) - bits 7:6,4:2 are reserved and should be masked in s/w + * D - Power Failure Detect (1=power fail) + * C - Clear Power Failure Detect Int (1=clear) + * F - Power Off (1=power off) + */ +#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 */ -#define TURN_ON_LED \ -do { if (AUXREG) \ - sbus_writeb(sbus_readb(AUXREG) | \ - (AUXIO_ORMEIN | AUXIO_LED), AUXREG); \ -} while(0) -#define TURN_OFF_LED \ -do { if (AUXREG) \ - sbus_writeb((sbus_readb(AUXREG) | \ - AUXIO_ORMEIN) & (~AUXIO_LED), \ - AUXREG); \ -} while(0) -#define FLIP_LED \ -do { if (AUXREG) \ - sbus_writeb((sbus_readb(AUXREG) | \ - AUXIO_ORMEIN) ^ AUXIO_LEN, \ - AUXREG); \ -} while(0) -#define FLPY_MOTORON \ -do { if (AUXREG) \ - sbus_writeb(sbus_readb(AUXREG) | \ - (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) +/* Register definitions from Sun Microsystems _PCIO_ p/n 802-7837 + * + * PCIO LED Auxio @ 0x726000 + * ------------------------------------------------- + * | 31:1 Unused | LED | + * ------------------------------------------------- + * Bits 31:1 unused + * LED - System LED on front panel (0=off, 1=on) + */ +#define AUXIO_PCIO_LED 0x01 /* System LED */ + +/* PCIO Power Auxio @ 0x724000 + * ------------------------------------------------- + * | 31:2 Unused | CPO | SPO | + * ------------------------------------------------- + * Bits 31:2 unused + * CPO - Courtesy Power Off (1=off) + * SPO - System Power Off (1=off) + */ +#define AUXIO_PCIO_CPWR_OFF 0x02 /* Courtesy Power Off */ +#define AUXIO_PCIO_SPWR_OFF 0x01 /* System Power Off */ #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); - newval = regval | bits_on; - newval &= ~bits_off; - newval |= AUXIO_ORMEIN4M; - sbus_writeb(newval, AUXREG); - } - local_irq_restore(flags); -} -#endif /* !(__ASSEMBLY__) */ +#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 + */ +extern void auxio_set_lte(int on); -/* AUXIO2 (Power Off Control) */ -extern __volatile__ unsigned char * auxio_power_register; +#define AUXIO_LED_ON 1 +#define AUXIO_LED_OFF 0 -#define AUXIO_POWER_DETECT_FAILURE 32 -#define AUXIO_POWER_CLEAR_FAILURE 2 -#define AUXIO_POWER_OFF 1 +/* auxio_set_led - Set system front panel LED + * + * 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) */ -- 2.53.0