Re: Soekris net6501 GPIO LED support
* Ted Unangst t...@tedunangst.com [2014-12-08 13:28:36]: On Mon, Dec 08, 2014 at 11:52, Matt Dainty wrote: * Jonathan Gray j...@jsg.id.au [2014-12-08 08:08:19]: Well any name that includes gpio that isn't taken should be fine. I went with soekrisgpio(4) as there are longer driver names in the tree, (acpithinkpad(4) seems to hold that record from my quick scan) so rather than try and come up with some witty contraction I picked that. skgpio should be sufficient. skgpio it is. Matt Index: share/man/man4/gpio.4 === RCS file: /cvs/src/share/man/man4/gpio.4,v retrieving revision 1.22 diff -u -p -r1.22 gpio.4 --- share/man/man4/gpio.4 21 Jan 2014 11:02:00 - 1.22 +++ share/man/man4/gpio.4 9 Dec 2014 18:05:26 - @@ -30,6 +30,7 @@ .Cd gpio* at omgpio? Pq armv7 .Cd gpio* at pcagpio? .Cd gpio* at pcaled? +.Cd gpio* at skgpio? Pq amd64, i386 .Cd gpio0 at voyager? Pq loongson .Pp .Fd #include sys/types.h Index: share/man/man4/isa.4 === RCS file: /cvs/src/share/man/man4/isa.4,v retrieving revision 1.72 diff -u -p -r1.72 isa.4 --- share/man/man4/isa.418 Mar 2014 22:36:31 - 1.72 +++ share/man/man4/isa.49 Dec 2014 18:05:26 - @@ -222,6 +222,8 @@ PCMCIA controllers PC (ISA) keyboard controller driver .It Xr pcppi 4 PC (ISA) control and timer port driver +.It Xr skgpio 4 +Soekris net6501 GPIO and LEDs driver .It Xr vga 4 VGA graphics driver for wscons .El Index: share/man/man4/man4.amd64/Makefile === RCS file: /cvs/src/share/man/man4/man4.amd64/Makefile,v retrieving revision 1.15 diff -u -p -r1.15 Makefile --- share/man/man4/man4.amd64/Makefile 27 May 2012 12:24:33 - 1.15 +++ share/man/man4/man4.amd64/Makefile 9 Dec 2014 18:05:26 - @@ -1,7 +1,7 @@ # $OpenBSD: Makefile,v 1.15 2012/05/27 12:24:33 jsg Exp $ MAN= amdpcib.4 apm.4 autoconf.4 bios.4 cpu.4 intro.4 ioapic.4 \ - mem.4 mpbios.4 nvram.4 mtrr.4 pctr.4 tcpcib.4 + mem.4 mpbios.4 nvram.4 mtrr.4 pctr.4 skgpio.4 tcpcib.4 MLINKS+= mem.4 kmem.4 MANSUBDIR=amd64 Index: share/man/man4/man4.amd64/skgpio.4 === RCS file: share/man/man4/man4.amd64/skgpio.4 diff -N share/man/man4/man4.amd64/skgpio.4 --- /dev/null 1 Jan 1970 00:00:00 - +++ share/man/man4/man4.amd64/skgpio.4 9 Dec 2014 18:05:26 - @@ -0,0 +1,57 @@ +.\ $OpenBSD$ +.\ +.\ Copyright (c) 2014 Matt Dainty m...@bodgit-n-scarper.com +.\ +.\ Permission to use, copy, modify, and distribute this software for any +.\ purpose with or without fee is hereby granted, provided that the above +.\ copyright notice and this permission notice appear in all copies. +.\ +.\ THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\ +.Dd $Mdocdate$ +.Dt SKGPIO 4 amd64 +.Os +.Sh NAME +.Nm skgpio +.Nd Soekris net6501 GPIO and LEDs +.Sh SYNOPSIS +.Cd skgpio0 at isa? port 0x680 +.Cd gpio* at skgpio? +.Sh DESCRIPTION +The +.Nm +driver provides support for the GPIO and LEDs as implemented by the Xilinx +Spartan FGPA integrated into the Soekris net6501 programmed with the default +bitstream found in the BIOS. +.Pp +Two standard +.Xr gpio 4 +interfaces are provided, one for the 16 real pins which can be configured as +either inputs or outputs and another with 2 output-only pins that map +to the error and ready LEDs respectively. +Both may be used with +.Xr gpioctl 8 . +.Sh SEE ALSO +.Xr intro 4 , +.Xr isa 4 , +.Xr gpio 4 , +.Xr gpioctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 5.7 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Matt Dainty Aq m...@bodgit-n-scarper.com . +.Sh BUGS +If the Xilinx FPGA is programmed with a different bistream, the driver will +likely not function. Index: share/man/man4/man4.i386/Makefile === RCS file: /cvs/src/share/man/man4/man4.i386/Makefile,v retrieving revision 1.72 diff -u -p -r1.72 Makefile --- share/man/man4/man4.i386/Makefile 27 May 2012 12:24:33 - 1.72 +++ share/man/man4/man4.i386/Makefile 9 Dec 2014 18:05:26 - @@ -7,7 +7,7 @@ MAN=amdpcib.4 amdmsr.4 apm.4 autoconf.4 ichpcib.4 intro.4 ioapic.4 \ joy.4 le.4 lms.4 mem.4 mms.4 mpbios.4 mtrr.4 npx.4 nvram.4 \ pas.4 pcibios.4 pctr.4 piixpcib.4 sb.4 \ - sea.4 tcpcib.4 uha.4 wds.4 wdt.4 wss.4 +
Re: Soekris net6501 GPIO LED support
On Tue, Dec 09, 2014 at 01:14:16PM -0500, Matt Dainty wrote: * Ted Unangst t...@tedunangst.com [2014-12-08 13:28:36]: On Mon, Dec 08, 2014 at 11:52, Matt Dainty wrote: * Jonathan Gray j...@jsg.id.au [2014-12-08 08:08:19]: Well any name that includes gpio that isn't taken should be fine. I went with soekrisgpio(4) as there are longer driver names in the tree, (acpithinkpad(4) seems to hold that record from my quick scan) so rather than try and come up with some witty contraction I picked that. skgpio should be sufficient. skgpio it is. Thanks, applied with a minor tweak to the .Xr ordering mandoc -Tlint complained about.
Re: Soekris net6501 GPIO LED support
On Fri, Dec 05, 2014 at 01:32:08PM -0500, Matt Dainty wrote: * Jonathan Gray j...@jsg.id.au [2014-12-05 10:16:41]: Perhaps a driver name change to reflect that this is to interface to the fpga on the soekris? This is tcpcib(4) all over again ;-) NetBSD committed this driver as soekrisgpio but I thought that might be a bit too long. Any opinions or suggestions? Well any name that includes gpio that isn't taken should be fine. It doesn't seem that soekris have a particular name for the interface (or any actual documentation of it...).
Re: Soekris net6501 GPIO LED support
* Jonathan Gray j...@jsg.id.au [2014-12-08 08:08:19]: Well any name that includes gpio that isn't taken should be fine. I went with soekrisgpio(4) as there are longer driver names in the tree, (acpithinkpad(4) seems to hold that record from my quick scan) so rather than try and come up with some witty contraction I picked that. It doesn't seem that soekris have a particular name for the interface (or any actual documentation of it...). No, I'm struggling to find where I found the programming interface for it, I can't find it in the manual. It must've come from the mailing list. Revised patch below. Matt Index: share/man/man4/gpio.4 === RCS file: /cvs/src/share/man/man4/gpio.4,v retrieving revision 1.22 diff -u -p -r1.22 gpio.4 --- share/man/man4/gpio.4 21 Jan 2014 11:02:00 - 1.22 +++ share/man/man4/gpio.4 8 Dec 2014 16:34:26 - @@ -30,6 +30,7 @@ .Cd gpio* at omgpio? Pq armv7 .Cd gpio* at pcagpio? .Cd gpio* at pcaled? +.Cd gpio* at soekrisgpio? Pq amd64, i386 .Cd gpio0 at voyager? Pq loongson .Pp .Fd #include sys/types.h Index: share/man/man4/isa.4 === RCS file: /cvs/src/share/man/man4/isa.4,v retrieving revision 1.72 diff -u -p -r1.72 isa.4 --- share/man/man4/isa.418 Mar 2014 22:36:31 - 1.72 +++ share/man/man4/isa.48 Dec 2014 16:34:26 - @@ -222,6 +222,8 @@ PCMCIA controllers PC (ISA) keyboard controller driver .It Xr pcppi 4 PC (ISA) control and timer port driver +.It Xr soekrisgpio 4 +Soekris net6501 GPIO and LEDs driver .It Xr vga 4 VGA graphics driver for wscons .El Index: share/man/man4/man4.amd64/Makefile === RCS file: /cvs/src/share/man/man4/man4.amd64/Makefile,v retrieving revision 1.15 diff -u -p -r1.15 Makefile --- share/man/man4/man4.amd64/Makefile 27 May 2012 12:24:33 - 1.15 +++ share/man/man4/man4.amd64/Makefile 8 Dec 2014 16:34:26 - @@ -1,7 +1,7 @@ # $OpenBSD: Makefile,v 1.15 2012/05/27 12:24:33 jsg Exp $ MAN= amdpcib.4 apm.4 autoconf.4 bios.4 cpu.4 intro.4 ioapic.4 \ - mem.4 mpbios.4 nvram.4 mtrr.4 pctr.4 tcpcib.4 + mem.4 mpbios.4 nvram.4 mtrr.4 pctr.4 soekrisgpio.4 tcpcib.4 MLINKS+= mem.4 kmem.4 MANSUBDIR=amd64 Index: share/man/man4/man4.amd64/soekrisgpio.4 === RCS file: share/man/man4/man4.amd64/soekrisgpio.4 diff -N share/man/man4/man4.amd64/soekrisgpio.4 --- /dev/null 1 Jan 1970 00:00:00 - +++ share/man/man4/man4.amd64/soekrisgpio.4 8 Dec 2014 16:34:26 - @@ -0,0 +1,57 @@ +.\ $OpenBSD$ +.\ +.\ Copyright (c) 2014 Matt Dainty m...@bodgit-n-scarper.com +.\ +.\ Permission to use, copy, modify, and distribute this software for any +.\ purpose with or without fee is hereby granted, provided that the above +.\ copyright notice and this permission notice appear in all copies. +.\ +.\ THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\ +.Dd $Mdocdate$ +.Dt SOEKRISGPIO 4 amd64 +.Os +.Sh NAME +.Nm soekrisgpio +.Nd Soekris net6501 GPIO and LEDs +.Sh SYNOPSIS +.Cd soekrisgpio0 at isa? port 0x680 +.Cd gpio* at soekrisgpio? +.Sh DESCRIPTION +The +.Nm +driver provides support for the GPIO and LEDs as implemented by the Xilinx +Spartan FGPA integrated into the Soekris net6501 programmed with the default +bitstream found in the BIOS. +.Pp +Two standard +.Xr gpio 4 +interfaces are provided, one for the 16 real pins which can be configured as +either inputs or outputs and another with 2 output-only pins that map +to the error and ready LEDs respectively. +Both may be used with +.Xr gpioctl 8 . +.Sh SEE ALSO +.Xr intro 4 , +.Xr isa 4 , +.Xr gpio 4 , +.Xr gpioctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 5.7 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Matt Dainty Aq m...@bodgit-n-scarper.com . +.Sh BUGS +If the Xilinx FPGA is programmed with a different bistream, the driver will +likely not function. Index: share/man/man4/man4.i386/Makefile === RCS file: /cvs/src/share/man/man4/man4.i386/Makefile,v retrieving revision 1.72 diff -u -p -r1.72 Makefile --- share/man/man4/man4.i386/Makefile 27 May 2012 12:24:33 - 1.72 +++ share/man/man4/man4.i386/Makefile 8 Dec 2014 16:34:26 - @@ -7,7 +7,7 @@ MAN=amdpcib.4 amdmsr.4 apm.4 autoconf.4 ichpcib.4 intro.4 ioapic.4 \
Re: Soekris net6501 GPIO LED support
On Mon, Dec 08, 2014 at 11:52, Matt Dainty wrote: * Jonathan Gray j...@jsg.id.au [2014-12-08 08:08:19]: Well any name that includes gpio that isn't taken should be fine. I went with soekrisgpio(4) as there are longer driver names in the tree, (acpithinkpad(4) seems to hold that record from my quick scan) so rather than try and come up with some witty contraction I picked that. skgpio should be sufficient.
Re: Soekris net6501 GPIO LED support
Anyone? * Matt Dainty m...@bodgit-n-scarper.com [2014-11-21 07:10:24]: * Dimitri Sokolyuk de...@dim13.org [2014-11-05 22:05:26]: I would also like to ask, if there are any plans on reviewing and committing this code into base? Here's an updated patch with the driver and associated man page changes against -current. Any objections to committing this? Matt Index: share/man/man4/gpio.4 === RCS file: /cvs/src/share/man/man4/gpio.4,v retrieving revision 1.22 diff -u -p -r1.22 gpio.4 --- share/man/man4/gpio.4 21 Jan 2014 11:02:00 - 1.22 +++ share/man/man4/gpio.4 21 Nov 2014 11:38:17 - @@ -30,6 +30,7 @@ .Cd gpio* at omgpio? Pq armv7 .Cd gpio* at pcagpio? .Cd gpio* at pcaled? +.Cd gpio* at soekris? Pq amd64, i386 .Cd gpio0 at voyager? Pq loongson .Pp .Fd #include sys/types.h Index: share/man/man4/isa.4 === RCS file: /cvs/src/share/man/man4/isa.4,v retrieving revision 1.72 diff -u -p -r1.72 isa.4 --- share/man/man4/isa.4 18 Mar 2014 22:36:31 - 1.72 +++ share/man/man4/isa.4 21 Nov 2014 11:38:17 - @@ -222,6 +222,8 @@ PCMCIA controllers PC (ISA) keyboard controller driver .It Xr pcppi 4 PC (ISA) control and timer port driver +.It Xr soekris 4 +Soekris net6501 GPIO and LEDs driver .It Xr vga 4 VGA graphics driver for wscons .El Index: share/man/man4/man4.amd64/Makefile === RCS file: /cvs/src/share/man/man4/man4.amd64/Makefile,v retrieving revision 1.15 diff -u -p -r1.15 Makefile --- share/man/man4/man4.amd64/Makefile27 May 2012 12:24:33 - 1.15 +++ share/man/man4/man4.amd64/Makefile21 Nov 2014 11:38:17 - @@ -1,7 +1,7 @@ #$OpenBSD: Makefile,v 1.15 2012/05/27 12:24:33 jsg Exp $ MAN= amdpcib.4 apm.4 autoconf.4 bios.4 cpu.4 intro.4 ioapic.4 \ - mem.4 mpbios.4 nvram.4 mtrr.4 pctr.4 tcpcib.4 + mem.4 mpbios.4 nvram.4 mtrr.4 pctr.4 soekris.4 tcpcib.4 MLINKS+= mem.4 kmem.4 MANSUBDIR=amd64 Index: share/man/man4/man4.amd64/soekris.4 === RCS file: share/man/man4/man4.amd64/soekris.4 diff -N share/man/man4/man4.amd64/soekris.4 --- /dev/null 1 Jan 1970 00:00:00 - +++ share/man/man4/man4.amd64/soekris.4 21 Nov 2014 11:38:17 - @@ -0,0 +1,57 @@ +.\ $OpenBSD$ +.\ +.\ Copyright (c) 2014 Matt Dainty m...@bodgit-n-scarper.com +.\ +.\ Permission to use, copy, modify, and distribute this software for any +.\ purpose with or without fee is hereby granted, provided that the above +.\ copyright notice and this permission notice appear in all copies. +.\ +.\ THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\ +.Dd $Mdocdate$ +.Dt SOEKRIS 4 amd64 +.Os +.Sh NAME +.Nm soekris +.Nd Soekris net6501 GPIO and LEDs +.Sh SYNOPSIS +.Cd soekris0 at isa? port 0x680 +.Cd gpio* at soekris? +.Sh DESCRIPTION +The +.Nm +driver provides support for the GPIO and LEDs as implemented by the Xilinx +Spartan FGPA integrated into the Soekris net6501 programmed with the default +bitstream found in the BIOS. +.Pp +Two standard +.Xr gpio 4 +interfaces are provided, one for the 16 real pins which can be configured as +either inputs or outputs and another with 2 output-only pins that map +to the error and ready LEDs respectively. +Both may be used with +.Xr gpioctl 8 . +.Sh SEE ALSO +.Xr intro 4 , +.Xr isa 4 , +.Xr gpio 4 , +.Xr gpioctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 5.7 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Matt Dainty Aq m...@bodgit-n-scarper.com . +.Sh BUGS +If the Xilinx FPGA is programmed with a different bistream, the driver will +likely not function. Index: share/man/man4/man4.i386/Makefile === RCS file: /cvs/src/share/man/man4/man4.i386/Makefile,v retrieving revision 1.72 diff -u -p -r1.72 Makefile --- share/man/man4/man4.i386/Makefile 27 May 2012 12:24:33 - 1.72 +++ share/man/man4/man4.i386/Makefile 21 Nov 2014 11:38:17 - @@ -7,7 +7,7 @@ MAN= amdpcib.4 amdmsr.4 apm.4 autoconf.4 ichpcib.4 intro.4 ioapic.4 \ joy.4 le.4 lms.4 mem.4 mms.4 mpbios.4 mtrr.4 npx.4 nvram.4 \ pas.4 pcibios.4 pctr.4 piixpcib.4 sb.4 \ - sea.4 tcpcib.4 uha.4 wds.4 wdt.4 wss.4 + sea.4
Re: Soekris net6501 GPIO LED support
Perhaps a driver name change to reflect that this is to interface to the fpga on the soekris? I wonder if the 16 bit general purpose I/O, 26 pins header, connected to FPGA on the net6801 will have the same interface. On Fri, Dec 05, 2014 at 10:05:46AM -0500, Matt Dainty wrote: Anyone?
Re: Soekris net6501 GPIO LED support
* Jonathan Gray j...@jsg.id.au [2014-12-05 10:16:41]: Perhaps a driver name change to reflect that this is to interface to the fpga on the soekris? This is tcpcib(4) all over again ;-) NetBSD committed this driver as soekrisgpio but I thought that might be a bit too long. Any opinions or suggestions? I wonder if the 16 bit general purpose I/O, 26 pins header, connected to FPGA on the net6801 will have the same interface. I saw this too. Without seeing any details my hunch is it will probably be very similar. Matt On Fri, Dec 05, 2014 at 10:05:46AM -0500, Matt Dainty wrote: Anyone?
Re: Soekris net6501 GPIO LED support
I can confirm it working on net6501-70 at least for the LED-part on 5.6-stable. It works as expected. # dmesg | grep gpio gpio0 at soekris0: 16 pins gpio1 at soekris0: 2 pins However there is some irregularity in reporting of pin-number too: # gpioctl gpio0 /dev/gpio0: 0 pins # gpioctl gpio1 /dev/gpio1: 2 pins I would also like to ask, if there are any plans on reviewing and committing this code into base? wbr, Dima Apologies if I missed something but to me it looks like this was neither commited nor declined. This is about src/sys/dev/isa/soekris.c (nonexistent) and not src/sys/arch/amd64/amd64/bios.c Revision 1.23 Fake 'SMBIOS detection' for the Soekris boxes, by Matt Dainty References: http://marc.info/?l=openbsd-techm=136317575910043 http://marc.info/?l=openbsd-techm=137130692221862 Bye, Marcus m...@bodgit-n-scarper.com (Matt Dainty), 2013.03.13 (Wed) 12:55 (CET): * Matt Dainty m...@bodgit-n-scarper.com [2013-01-14 11:13:59]: Attached is a patch that adds soekris(4) which provides access to the GPIO and LEDs as implemented by the onboard Xilinx FPGA on the Soekris net6501. The driver provides two GPIO buses; one for the 16 real GPIO pins exposed on the board, and another which has the LEDs coerced into the GPIO framework as output-only pins. I kept them separate to prevent confusion and make the code slightly simpler, if it's preferred to have just one GPIO bus let me know. It's enabled in the kernel config with: soekris0 at isa? port 0x680 gpio*at soekris? The driver cannot be enabled by default as there's no reliable way to detect the hardware, it's just a handful of I/O ports at a known address, (GPIO isn't enabled by default in GENERIC so a kernel compile is required regardless). This is what is shown at boot: soekris0 at isa0 port 0x680/32 gpio0 at soekris0: 16 pins gpio1 at soekris0: 2 pins I then have the following in /etc/rc.securelevel: gpioctl -q gpio1 0 set out error_led gpioctl -q gpio1 1 set out ready_led If this driver is acceptable I can send a further patch with man pages. Tested on a Soekris net6501 running amd64, LEDs work and I've put simple LED and pushbutton circuits on the GPIO pins. Here's an updated patch for the driver, the only change is in the *_match() function that is now simplified and much more reliable thanks to the committed Soekris comBIOS patch to bios(4). I've still left the GENERIC config unchanged as there's no other gpio(4) drivers enabled, I'm guessing as general policy. I'll send a separate patch with the various man page changes. Matt --- /dev/null Wed Mar 13 10:27:40 2013 +++ sys/dev/isa/soekris.c Tue Feb 19 08:31:10 2013 @@ -0,0 +1,239 @@ +/* $OpenBSD$ */ + +/* + * Copyright (c) 2013 Matt Dainty m...@bodgit-n-scarper.com + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Soekris net6501 GPIO and LEDs as implemented by the onboard Xilinx FPGA + */ + +#include sys/param.h +#include sys/systm.h +#include sys/device.h +#include sys/gpio.h + +#include machine/bus.h +#include machine/intr.h + +#include dev/isa/isavar.h + +#include dev/gpio/gpiovar.h + +#defineSOEKRIS_BASE0x680 /* Base address of FPGA I/O */ +#defineSOEKRIS_IOSIZE 32 /* I/O region size */ + +#defineSOEKRIS_NPINS 16 /* Number of Pins */ +#defineSOEKRIS_GPIO_INPUT 0x000 /* Current state of pins */ +#defineSOEKRIS_GPIO_OUTPUT 0x004 /* Set state of output pins */ +#defineSOEKRIS_GPIO_RESET 0x008 /* Reset output pins */ +#defineSOEKRIS_GPIO_SET0x00c /* Set output pins */ +#defineSOEKRIS_GPIO_DIR0x010 /* Direction, set for output */ + +#defineSOEKRIS_NLEDS 2 /* Number of LEDs */ +#defineSOEKRIS_LED_ERROR 0x01c /* Offset to error LED */ +#defineSOEKRIS_LED_READY 0x01d /* Offset to ready LED */ + +extern char *hw_vendor, *hw_prod; + +const u_int soekris_led_offset[SOEKRIS_NLEDS] = { + SOEKRIS_LED_ERROR,
Re: Soekris net6501 GPIO LED support
Apologies if I missed something but to me it looks like this was neither commited nor declined. This is about src/sys/dev/isa/soekris.c (nonexistent) and not src/sys/arch/amd64/amd64/bios.c Revision 1.23 Fake 'SMBIOS detection' for the Soekris boxes, by Matt Dainty References: http://marc.info/?l=openbsd-techm=136317575910043 http://marc.info/?l=openbsd-techm=137130692221862 Bye, Marcus m...@bodgit-n-scarper.com (Matt Dainty), 2013.03.13 (Wed) 12:55 (CET): * Matt Dainty m...@bodgit-n-scarper.com [2013-01-14 11:13:59]: Attached is a patch that adds soekris(4) which provides access to the GPIO and LEDs as implemented by the onboard Xilinx FPGA on the Soekris net6501. The driver provides two GPIO buses; one for the 16 real GPIO pins exposed on the board, and another which has the LEDs coerced into the GPIO framework as output-only pins. I kept them separate to prevent confusion and make the code slightly simpler, if it's preferred to have just one GPIO bus let me know. It's enabled in the kernel config with: soekris0 at isa? port 0x680 gpio*at soekris? The driver cannot be enabled by default as there's no reliable way to detect the hardware, it's just a handful of I/O ports at a known address, (GPIO isn't enabled by default in GENERIC so a kernel compile is required regardless). This is what is shown at boot: soekris0 at isa0 port 0x680/32 gpio0 at soekris0: 16 pins gpio1 at soekris0: 2 pins I then have the following in /etc/rc.securelevel: gpioctl -q gpio1 0 set out error_led gpioctl -q gpio1 1 set out ready_led If this driver is acceptable I can send a further patch with man pages. Tested on a Soekris net6501 running amd64, LEDs work and I've put simple LED and pushbutton circuits on the GPIO pins. Here's an updated patch for the driver, the only change is in the *_match() function that is now simplified and much more reliable thanks to the committed Soekris comBIOS patch to bios(4). I've still left the GENERIC config unchanged as there's no other gpio(4) drivers enabled, I'm guessing as general policy. I'll send a separate patch with the various man page changes. Matt --- /dev/null Wed Mar 13 10:27:40 2013 +++ sys/dev/isa/soekris.c Tue Feb 19 08:31:10 2013 @@ -0,0 +1,239 @@ +/* $OpenBSD$ */ + +/* + * Copyright (c) 2013 Matt Dainty m...@bodgit-n-scarper.com + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Soekris net6501 GPIO and LEDs as implemented by the onboard Xilinx FPGA + */ + +#include sys/param.h +#include sys/systm.h +#include sys/device.h +#include sys/gpio.h + +#include machine/bus.h +#include machine/intr.h + +#include dev/isa/isavar.h + +#include dev/gpio/gpiovar.h + +#define SOEKRIS_BASE0x680 /* Base address of FPGA I/O */ +#define SOEKRIS_IOSIZE 32 /* I/O region size */ + +#define SOEKRIS_NPINS 16 /* Number of Pins */ +#define SOEKRIS_GPIO_INPUT 0x000 /* Current state of pins */ +#define SOEKRIS_GPIO_OUTPUT 0x004 /* Set state of output pins */ +#define SOEKRIS_GPIO_RESET 0x008 /* Reset output pins */ +#define SOEKRIS_GPIO_SET0x00c /* Set output pins */ +#define SOEKRIS_GPIO_DIR0x010 /* Direction, set for output */ + +#define SOEKRIS_NLEDS 2 /* Number of LEDs */ +#define SOEKRIS_LED_ERROR 0x01c /* Offset to error LED */ +#define SOEKRIS_LED_READY 0x01d /* Offset to ready LED */ + +extern char *hw_vendor, *hw_prod; + +const u_int soekris_led_offset[SOEKRIS_NLEDS] = { + SOEKRIS_LED_ERROR, SOEKRIS_LED_READY +}; + +struct soekris_softc { + struct devicesc_dev; + + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + + struct gpio_chipset_tag sc_gpio_gc; + gpio_pin_t sc_gpio_pins[SOEKRIS_NPINS]; + + /* Fake GPIO device for the LEDs */ + struct gpio_chipset_tag sc_led_gc; + gpio_pin_t sc_led_pins[SOEKRIS_NLEDS]; +}; + +int soekris_match(struct device *, void *, void *); +void soekris_attach(struct device *, struct device *, void *); +int
Re: Soekris net6501 GPIO LED support
* Matt Dainty m...@bodgit-n-scarper.com [2013-01-14 11:13:59]: Attached is a patch that adds soekris(4) which provides access to the GPIO and LEDs as implemented by the onboard Xilinx FPGA on the Soekris net6501. The driver provides two GPIO buses; one for the 16 real GPIO pins exposed on the board, and another which has the LEDs coerced into the GPIO framework as output-only pins. I kept them separate to prevent confusion and make the code slightly simpler, if it's preferred to have just one GPIO bus let me know. It's enabled in the kernel config with: soekris0 at isa? port 0x680 gpio*at soekris? The driver cannot be enabled by default as there's no reliable way to detect the hardware, it's just a handful of I/O ports at a known address, (GPIO isn't enabled by default in GENERIC so a kernel compile is required regardless). This is what is shown at boot: soekris0 at isa0 port 0x680/32 gpio0 at soekris0: 16 pins gpio1 at soekris0: 2 pins I then have the following in /etc/rc.securelevel: gpioctl -q gpio1 0 set out error_led gpioctl -q gpio1 1 set out ready_led If this driver is acceptable I can send a further patch with man pages. Tested on a Soekris net6501 running amd64, LEDs work and I've put simple LED and pushbutton circuits on the GPIO pins. Here's an updated patch for the driver, the only change is in the *_match() function that is now simplified and much more reliable thanks to the committed Soekris comBIOS patch to bios(4). I've still left the GENERIC config unchanged as there's no other gpio(4) drivers enabled, I'm guessing as general policy. I'll send a separate patch with the various man page changes. Matt --- /dev/null Wed Mar 13 10:27:40 2013 +++ sys/dev/isa/soekris.c Tue Feb 19 08:31:10 2013 @@ -0,0 +1,239 @@ +/* $OpenBSD$ */ + +/* + * Copyright (c) 2013 Matt Dainty m...@bodgit-n-scarper.com + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Soekris net6501 GPIO and LEDs as implemented by the onboard Xilinx FPGA + */ + +#include sys/param.h +#include sys/systm.h +#include sys/device.h +#include sys/gpio.h + +#include machine/bus.h +#include machine/intr.h + +#include dev/isa/isavar.h + +#include dev/gpio/gpiovar.h + +#defineSOEKRIS_BASE0x680 /* Base address of FPGA I/O */ +#defineSOEKRIS_IOSIZE 32 /* I/O region size */ + +#defineSOEKRIS_NPINS 16 /* Number of Pins */ +#defineSOEKRIS_GPIO_INPUT 0x000 /* Current state of pins */ +#defineSOEKRIS_GPIO_OUTPUT 0x004 /* Set state of output pins */ +#defineSOEKRIS_GPIO_RESET 0x008 /* Reset output pins */ +#defineSOEKRIS_GPIO_SET0x00c /* Set output pins */ +#defineSOEKRIS_GPIO_DIR0x010 /* Direction, set for output */ + +#defineSOEKRIS_NLEDS 2 /* Number of LEDs */ +#defineSOEKRIS_LED_ERROR 0x01c /* Offset to error LED */ +#defineSOEKRIS_LED_READY 0x01d /* Offset to ready LED */ + +extern char *hw_vendor, *hw_prod; + +const u_int soekris_led_offset[SOEKRIS_NLEDS] = { + SOEKRIS_LED_ERROR, SOEKRIS_LED_READY +}; + +struct soekris_softc { + struct devicesc_dev; + + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + + struct gpio_chipset_tag sc_gpio_gc; + gpio_pin_t sc_gpio_pins[SOEKRIS_NPINS]; + + /* Fake GPIO device for the LEDs */ + struct gpio_chipset_tag sc_led_gc; + gpio_pin_t sc_led_pins[SOEKRIS_NLEDS]; +}; + +int soekris_match(struct device *, void *, void *); +voidsoekris_attach(struct device *, struct device *, void *); +int soekris_gpio_read(void *, int); +voidsoekris_gpio_write(void *, int, int); +voidsoekris_gpio_ctl(void *, int, int); +int soekris_led_read(void *, int); +voidsoekris_led_write(void *, int, int); +voidsoekris_led_ctl(void *, int, int); + +struct cfattach soekris_ca = { + sizeof(struct soekris_softc), soekris_match, soekris_attach +}; + +struct cfdriver soekris_cd = { + NULL, soekris, DV_DULL +}; + +int +soekris_match(struct device *parent, void *match, void *aux) +{ + struct isa_attach_args *ia = aux; +
Re: Soekris net6501 GPIO LED support
* Matt Dainty m...@bodgit-n-scarper.com [2013-03-13 07:56:14]: I'll send a separate patch with the various man page changes. And here's the man page changes. Matt --- /dev/null Wed Mar 13 10:31:11 2013 +++ share/man/man4/man4.amd64/soekris.4 Tue Feb 19 08:34:54 2013 @@ -0,0 +1,57 @@ +.\ $OpenBSD$ +.\ +.\ Copyright (c) 2013 Matt Dainty m...@bodgit-n-scarper.com +.\ +.\ Permission to use, copy, modify, and distribute this software for any +.\ purpose with or without fee is hereby granted, provided that the above +.\ copyright notice and this permission notice appear in all copies. +.\ +.\ THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\ +.Dd $Mdocdate$ +.Dt SOEKRIS 4 amd64 +.Os +.Sh NAME +.Nm soekris +.Nd Soekris net6501 GPIO and LEDs +.Sh SYNOPSIS +.Cd soekris0 at isa? port 0x680 +.Cd gpio* at soekris? +.Sh DESCRIPTION +The +.Nm +driver provides support for the GPIO and LEDs as implemented by the Xilinx +Spartan FGPA integrated into the Soekris net6501 programmed with the default +bitstream found in the BIOS. +.Pp +Two standard +.Xr gpio 4 +interfaces are provided, one for the 16 real pins which can be configured as +either inputs or outputs and another with 2 output-only pins that map +to the error and ready LEDs respectively. +Both may be used with +.Xr gpioctl 8 . +.Sh SEE ALSO +.Xr intro 4 , +.Xr isa 4 , +.Xr gpio 4 , +.Xr gpioctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 5.3 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Matt Dainty Aq m...@bodgit-n-scarper.com . +.Sh BUGS +If the Xilinx FPGA is programmed with a different bistream, the driver will +likely not function. --- /dev/null Wed Mar 13 10:31:27 2013 +++ share/man/man4/man4.i386/soekris.4 Tue Feb 19 08:35:23 2013 @@ -0,0 +1,57 @@ +.\ $OpenBSD$ +.\ +.\ Copyright (c) 2013 Matt Dainty m...@bodgit-n-scarper.com +.\ +.\ Permission to use, copy, modify, and distribute this software for any +.\ purpose with or without fee is hereby granted, provided that the above +.\ copyright notice and this permission notice appear in all copies. +.\ +.\ THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\ +.Dd $Mdocdate$ +.Dt SOEKRIS 4 i386 +.Os +.Sh NAME +.Nm soekris +.Nd Soekris net6501 GPIO and LEDs +.Sh SYNOPSIS +.Cd soekris0 at isa? port 0x680 +.Cd gpio* at soekris? +.Sh DESCRIPTION +The +.Nm +driver provides support for the GPIO and LEDs as implemented by the Xilinx +Spartan FGPA integrated into the Soekris net6501 programmed with the default +bitstream found in the BIOS. +.Pp +Two standard +.Xr gpio 4 +interfaces are provided, one for the 16 real pins which can be configured as +either inputs or outputs and another with 2 output-only pins that map +to the error and ready LEDs respectively. +Both may be used with +.Xr gpioctl 8 . +.Sh SEE ALSO +.Xr intro 4 , +.Xr isa 4 , +.Xr gpio 4 , +.Xr gpioctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 5.3 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Matt Dainty Aq m...@bodgit-n-scarper.com . +.Sh BUGS +If the Xilinx FPGA is programmed with a different bistream, the driver will +likely not function. --- share/man/man4/man4.amd64/Makefile.orig Tue Jan 8 15:20:04 2013 +++ share/man/man4/man4.amd64/Makefile Tue Jan 8 15:21:00 2013 @@ -1,7 +1,7 @@ # $OpenBSD: Makefile,v 1.15 2012/05/27 12:24:33 jsg Exp $ MAN= amdpcib.4 apm.4 autoconf.4 bios.4 cpu.4 intro.4 ioapic.4 \ - mem.4 mpbios.4 nvram.4 mtrr.4 pctr.4 tcpcib.4 + mem.4 mpbios.4 nvram.4 mtrr.4 pctr.4 soekris.4 tcpcib.4 MLINKS+= mem.4 kmem.4 MANSUBDIR=amd64 --- share/man/man4/man4.i386/Makefile.orig Tue Jan 8 15:19:56 2013 +++ share/man/man4/man4.i386/Makefile Tue Jan 8 15:20:36 2013 @@ -7,7 +7,7 @@ ichpcib.4 intro.4 ioapic.4 \ joy.4 le.4 lms.4 mem.4 mms.4 mpbios.4 mtrr.4 npx.4 nvram.4 \ pas.4 pcibios.4 pctr.4 piixpcib.4 sb.4 \ - sea.4 tcpcib.4 uha.4 wds.4 wdt.4 wss.4 + sea.4 soekris.4 tcpcib.4 uha.4 wds.4 wdt.4 wss.4 MLINKS+= mem.4 kmem.4 MANSUBDIR=i386 --- share/man/man4/gpio.4.orig Tue Jan 8 15:22:00 2013 +++
Soekris net6501 GPIO LED support
Attached is a patch that adds soekris(4) which provides access to the GPIO and LEDs as implemented by the onboard Xilinx FPGA on the Soekris net6501. The driver provides two GPIO buses; one for the 16 real GPIO pins exposed on the board, and another which has the LEDs coerced into the GPIO framework as output-only pins. I kept them separate to prevent confusion and make the code slightly simpler, if it's preferred to have just one GPIO bus let me know. It's enabled in the kernel config with: soekris0 at isa? port 0x680 gpio*at soekris? The driver cannot be enabled by default as there's no reliable way to detect the hardware, it's just a handful of I/O ports at a known address, (GPIO isn't enabled by default in GENERIC so a kernel compile is required regardless). This is what is shown at boot: soekris0 at isa0 port 0x680/32 gpio0 at soekris0: 16 pins gpio1 at soekris0: 2 pins I then have the following in /etc/rc.securelevel: gpioctl -q gpio1 0 set out error_led gpioctl -q gpio1 1 set out ready_led If this driver is acceptable I can send a further patch with man pages. Tested on a Soekris net6501 running amd64, LEDs work and I've put simple LED and pushbutton circuits on the GPIO pins. Comments? Matt --- /dev/null Tue Jan 8 21:22:57 2013 +++ sys/dev/isa/soekris.c Tue Jan 8 21:17:02 2013 @@ -0,0 +1,235 @@ +/* $OpenBSD$ */ + +/* + * Copyright (c) 2013 Matt Dainty m...@bodgit-n-scarper.com + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Soekris net6501 GPIO and LEDs as implemented by the onboard Xilinx FPGA + */ + +#include sys/param.h +#include sys/systm.h +#include sys/device.h +#include sys/gpio.h + +#include machine/bus.h +#include machine/intr.h + +#include dev/isa/isavar.h + +#include dev/gpio/gpiovar.h + +#defineSOEKRIS_BASE0x680 /* Base address of FPGA I/O */ +#defineSOEKRIS_IOSIZE 32 /* I/O region size */ + +#defineSOEKRIS_NPINS 16 /* Number of Pins */ +#defineSOEKRIS_GPIO_INPUT 0x000 /* Current state of pins */ +#defineSOEKRIS_GPIO_OUTPUT 0x004 /* Set state of output pins */ +#defineSOEKRIS_GPIO_RESET 0x008 /* Reset output pins */ +#defineSOEKRIS_GPIO_SET0x00c /* Set output pins */ +#defineSOEKRIS_GPIO_DIR0x010 /* Direction, set for output */ + +#defineSOEKRIS_NLEDS 2 /* Number of LEDs */ +#defineSOEKRIS_LED_ERROR 0x01c /* Offset to error LED */ +#defineSOEKRIS_LED_READY 0x01d /* Offset to ready LED */ + +const u_int soekris_led_offset[SOEKRIS_NLEDS] = { + SOEKRIS_LED_ERROR, SOEKRIS_LED_READY +}; + +struct soekris_softc { + struct devicesc_dev; + + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + + struct gpio_chipset_tag sc_gpio_gc; + gpio_pin_t sc_gpio_pins[SOEKRIS_NPINS]; + + /* Fake GPIO device for the LEDs */ + struct gpio_chipset_tag sc_led_gc; + gpio_pin_t sc_led_pins[SOEKRIS_NLEDS]; +}; + +int soekris_match(struct device *, void *, void *); +voidsoekris_attach(struct device *, struct device *, void *); +int soekris_gpio_read(void *, int); +voidsoekris_gpio_write(void *, int, int); +voidsoekris_gpio_ctl(void *, int, int); +int soekris_led_read(void *, int); +voidsoekris_led_write(void *, int, int); +voidsoekris_led_ctl(void *, int, int); + +struct cfattach soekris_ca = { + sizeof(struct soekris_softc), soekris_match, soekris_attach +}; + +struct cfdriver soekris_cd = { + NULL, soekris, DV_DULL +}; + +int +soekris_match(struct device *parent, void *match, void *aux) +{ + struct isa_attach_args *ia = aux; + bus_space_handle_t ioh; + + /* Need some sort of heuristic to match the Soekris net6501 */ + + if (ia-ia_iobase != SOEKRIS_BASE || bus_space_map(ia-ia_iot, + ia-ia_iobase, SOEKRIS_IOSIZE, 0, ioh) != 0) + return (0); + + bus_space_unmap(ia-ia_iot, ioh, SOEKRIS_IOSIZE); + ia-ia_iosize = SOEKRIS_IOSIZE; + ia-ipa_nio = 1; + ia-ipa_nmem = 0; + ia-ipa_nirq = 0; + ia-ipa_ndrq = 0; + + return (1); +} + +void
Re: Soekris net6501 GPIO LED support
2013/1/14 Matt Dainty m...@bodgit-n-scarper.com: Attached is a patch that adds soekris(4) which provides access to the GPIO and LEDs as implemented by the onboard Xilinx FPGA on the Soekris Dunno if I am out of my league here, but: +void +soekris_gpio_write(void *arg, int pin, int value) +{ + struct soekris_softc *sc = arg; + u_int16_t data; + + data = bus_space_read_2(sc-sc_iot, sc-sc_ioh, SOEKRIS_GPIO_INPUT); + + if (value == GPIO_PIN_LOW) + data = ~(1 pin); + else if (value == GPIO_PIN_HIGH) + data |= (1 pin); + + bus_space_write_2(sc-sc_iot, sc-sc_ioh, SOEKRIS_GPIO_OUTPUT, data); +} +void +soekris_led_write(void *arg, int pin, int value) +{ + struct soekris_softc *sc = arg; + + bus_space_write_1(sc-sc_iot, sc-sc_ioh, soekris_led_offset[pin], + value); These two (and the read function) don't really seem to prevent me from writing or reading pin/led 23498324 and have it wander far off into memory. Then again, that protection may be at the ioctl level, making my whole comment moot, but at least bus_space_write_N() doesn't check it afterwards. -- May the most significant bit of your life be positive.