Subject: Re: GPIO on the Soekris net4801
To: Jared D. McNeill <jmcneill@invisible.ca>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: current-users
Date: 10/15/2005 16:19:53
In message <F591D879-6D04-4363-BA2D-B46D5CF87B67@invisible.ca>, "Jared D. McNei
ll" writes:
>I've recently added support for gpio on the Soekris net4801 based on  
>the code from OpenBSD. If you want to play with the error LED on your  
>system, do the following:
>
>     1. Update -current sources
>     2. Add the following to your kernel config:
>nsclpcsio* at isa?
>gscpcib* at pci? dev ? function ?
>gpio* at nsclpcsio?
>gpio* at gscpcib?
>     3. Build a new kernel and userland (to get /usr/include/sys/ 
>gpio.h and /usr/sbin/gpioctl).
>     4. With a new MAKEDEV in /dev, 'sh MAKEDEV gpio'
>
>Then, if you want to control the error LED, first configure the pin:
>     # gpioctl -c 20 on pp
>
>Now you can control the error LED.
>
>To turn it on:
>     # gpioctl 20 1
>To turn it off:
>     # gpioctl 20 0
>To toggle the LED (eg if it's on, turn it off; if it's off, turn it on):
>     # gpioctl 20 2
>
>Have fun!
>

I tried this, but something weird happened: the kernel couldn't find 
wd0 at boot time.  Here's the dmesg:

	> boot nnetbsd -s
	booting hd0a:nnetbsd (howto 0x2)
	7415363+301712+393316 [417824+384956]=0x8814d4
	BIOS CFG: Model-SubM-Rev: fc-00-00, 0x74<EBDA,KBDINT,RTC,IC2>
	Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
	    The NetBSD Foundation, Inc.  All rights reserved.
	Copyright (c) 1982, 1986, 1989, 1991, 1993
	    The Regents of the University of California.  All rights reserved.

	NetBSD 3.99.9 (SOEGEN2) #5: Sat Oct 15 16:15:00 EDT 2005
		smb@bigboy.machshav.com:/sys/arch/i386/compile/SOEGEN2
	total memory = 127 MB
	avail memory = 116 MB
	BIOS32 rev. 0 found at 0xf7840
	mainbus0 (root)
	cpu0 at mainbus0: (uniprocessor)
	cpu0: National Semiconductor Geode GX1 (586-class), 266.66 MHz, id 0x540
	cpu0: features 808131<FPU,TSC,MSR,CX8>
	cpu0: features 808131<CMOV,MMX>
	cpu0: "Geode(TM) Integrated Processor by National Semi"
	cpu0: I-cache 12K uOp cache 8-way
	WARNING: broken TSC disabled
	pci0 at mainbus0 bus 0: configuration mode 1
	pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
	pchb0 at pci0 dev 0 function 0
	pchb0: Cyrix MediaGX Built-in PCI Host Controller (rev. 0x00)
	sip0 at pci0 dev 6 function 0: NatSemi DP83815 10/100 Ethernet, rev 00
	sip0: interrupting at irq 10
	sip0: Ethernet address 00:00:24:c4:f4:40
	nsphyter0 at sip0 phy 0: DP83815 10/100 media interface, rev. 1
	nsphyter0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
	sip1 at pci0 dev 7 function 0: NatSemi DP83815 10/100 Ethernet, rev 00
	sip1: interrupting at irq 10
	sip1: Ethernet address 00:00:24:c4:f4:41
	nsphyter1 at sip1 phy 0: DP83815 10/100 media interface, rev. 1
	nsphyter1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
	sip2 at pci0 dev 8 function 0: NatSemi DP83815 10/100 Ethernet, rev 00
	sip2: interrupting at irq 10
	sip2: Ethernet address 00:00:24:c4:f4:42
	nsphyter2 at sip2 phy 0: DP83815 10/100 media interface, rev. 1
	nsphyter2: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
	gscpcib0 at pci0 dev 18 function 0
	gscpcib0: National Semiconductor SC1100 PCI-ISA bridge (rev. 0x00)
	gpio0 at gscpcib0: 64 pins
	National Semiconductor SC1100 SMI/ACPI (miscellaneous bridge) at pci0 dev 18 fun
	ction 1 not configured
	geodeide0 at pci0 dev 18 function 2
	geodeide0: AMD Geode SC1100 IDE controller (rev. 0x01)
	geodeide0: bus-master DMA support present
	geodeide0: primary channel wired to compatibility mode
	geodeide0: primary channel interrupting at irq 14
	atabus0 at geodeide0 channel 0
	geodeide0: secondary channel wired to compatibility mode
	geodeide0: secondary channel interrupting at irq 15
	atabus1 at geodeide0 channel 1
	geodewdog0 at pci0 dev 18 function 5: AMD Geode SC1100 Watchdog Timer
	ohci0 at pci0 dev 19 function 0: Compaq USB Controller (rev. 0x08)
	ohci0: interrupting at irq 11
	ohci0: OHCI version 1.0, legacy support
	usb0 at ohci0: USB revision 1.0
	uhub0 at usb0
	uhub0: Compaq OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
	uhub0: 3 ports with 3 removable, self powered
	isa at gscpcib0 not configured
	isa0 at mainbus0
	com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
	com0: console
	com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
	attimer0 at isa0 port 0x40-0x43: AT Timer
	pcppi0 at isa0 port 0x61
	midi0 at pcppi0: PC speaker
	sysbeep0 at pcppi0
	nsclpcsio0 at isa0 port 0x2e-0x2f: NSC PC87366 rev. 9
	nsclpcsio0: GPIO at 0x6600
	nsclpcsio0: TMS at 0x6640
	nsclpcsio0: TMS in standby mode
	nsclpcsio0: TMS awoken
	gpio1 at nsclpcsio0: 29 pins
	isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
	npx0 at isa0 port 0xf0-0xff: using exception 16
	pcppi0: attached to attimer0
	isapnp0: no ISA Plug 'n Play devices found
	Kernelized RAIDframe activated
	IPsec: Initialized Security Association Processing.
	boot device: <unknown>
	root device: wd0a
	use one of: raid0[a-p] raid1[a-p] raid2[a-p] raid3[a-p] raid4[a-p] raid5[a-p] ra
	id6[a-p] raid7[a-p] sip0 sip1 sip2 ddb halt reboot
	root device: 

Because I've been having trouble trying to build a minimal kernel, I'm 
using more or less GENERIC; here's a diff of the failing kernel from 
yesterday's -current GENERIC:

	166c166
	< #file-system  TMPFS           # experimental - Efficient memory file-system
	---
	> file-system   TMPFS           # experimental - Efficient memory file-system
	179c179
	< #options      GATEWAY         # packet forwarding
	---
	> options       GATEWAY         # packet forwarding
	182,184c182,184
	< #options      IPSEC           # IP security
	< #options      IPSEC_ESP       # IP security (encryption part; define w/IPSEC)
	< #options      IPSEC_NAT_T     # IPsec NAT traversal (NAT-T)
	---
	> options       IPSEC           # IP security
	> options       IPSEC_ESP       # IP security (encryption part; define w/IPSEC)
	> options       IPSEC_NAT_T     # IPsec NAT traversal (NAT-T)
	425c425
	< #gscpcib* at pci? dev ? function ?    # NS Geode PCI-ISA w/ GPIO support
	---
	> gscpcib* at pci? dev ? function ?     # NS Geode PCI-ISA w/ GPIO support
	577,578c577,578
	< #nsclpcsio*   at isa?
	< #gpio*                at nsclpcsio?
	---
	> nsclpcsio*    at isa?
	> gpio*         at nsclpcsio?
	592c592
	< #gpio*        at gscpcib?
	---
	> gpio* at gscpcib?