Re: alix2d2 LM86, no hw.sensors

2012-02-20 Thread Michal Mazurek
On Sun, Feb 19, 2012 at 01:12:13PM +0100, Mike Belopuhov wrote:
> and i forgot to mention that kernel config has to be patched too.
> thanks to shadchin@ for reminding.

It didn't work, here is the dmesg:

[15:19:ttyp0][root@T3:~:5]$ sysctl hw
hw.machine=i386
hw.model=Geode(TM) Integrated Processor by AMD PCS ("AuthenticAMD" 586-class)
hw.ncpu=1
hw.byteorder=1234
hw.pagesize=4096
hw.disknames=wd0:c8fc559b0e991404
hw.diskcount=1
hw.cpuspeed=499
hw.physmem=267976704
hw.usermem=267964416
hw.ncpufound=1
hw.allowpowerdown=1


OpenBSD 5.0 (GENERIC.MP) #0: Mon Feb 20 09:41:29 CET 2012
r...@t3.nmi:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: Geode(TM) Integrated Processor by AMD PCS ("AuthenticAMD" 586-class) 499 
MHz
cpu0: FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CFLUSH,MMX
real mem  = 267976704 (255MB)
avail mem = 253517824 (241MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 11/05/08, BIOS32 rev. 0 @ 0xfd088
pcibios0 at bios0: rev 2.1 @ 0xf/0x1
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xe/0xa800
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 1 function 0 "AMD Geode LX" rev 0x33
glxsb0 at pci0 dev 1 function 2 "AMD Geode LX Crypto" rev 0x00: RNG AES
vr0 at pci0 dev 9 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 10, address 
00:0d:b9:25:8f:ec
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x004063, 
model 0x0034
vr1 at pci0 dev 11 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 15, address 
00:0d:b9:25:8f:ed
ukphy1 at vr1 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x004063, 
model 0x0034
glxpcib0 at pci0 dev 15 function 0 "AMD CS5536 ISA" rev 0x03: rev 3, 32-bit 
3579545Hz timer, watchdog, gpio, i2c freq=0x7f
gpio0 at glxpcib0: 32 pins
iic0 at glxpcib0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
glxpcib0: negative ack, flags=0
pciide0 at pci0 dev 15 function 2 "AMD CS5536 IDE" rev 0x01: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: 
wd0: 1-sector PIO, LBA48, 3815MB, 7813120 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 ignored (disabled)
ohci0 at pci0 dev 15 function 4 "AMD CS5536 USB" rev 0x02: irq 12, version 1.0, 
legacy support
ehci0 at pci0 dev 15 function 5 "AMD CS5536 USB" rev 0x02: irq 12
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "AMD EHCI root hub" rev 2.00/1.00 addr 1
isa0 at glxpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 "AMD OHCI root hub" rev 1.00/1.00 addr 1
mtrr: K6-family MTRR support (2 registers)
nvram: invalid checksum
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
scsibus1 at softraid0: 256 targets
root on wd0a (c8fc559b0e991404.a) swap on wd0b dump on wd0b
clock: unknown CMOS layout

-- 
Michal Mazurek



Re: alix2d2 LM86, no hw.sensors

2012-02-19 Thread Mike Belopuhov
On Sun, Feb 19, 2012 at 00:06 +0100, Mike Belopuhov wrote:
> On Sat, Feb 18, 2012 at 03:09 +1100, Jonathan Gray wrote:
> > On Fri, Feb 17, 2012 at 04:20:25PM +0100, Michal Mazurek wrote:
> > > I have an alix2d2 running OpenBSD 5.0. There are no hw.sensors.
> > > The producer says there is an LM86 on board, which is supported by the
> > > maxtmp driver. It appears the driver is present in generic. I tried 
> > > starting
> > > sensorsd but got:
> > > daemon:Feb 17 13:12:04 T1 sensorsd[10445]: startup, system has 0 sensors
> > > 
> > > How can I read the temperature of my alix2d2 running OpenBSD 5.0?
> > 
> > There is no driver for the CS5535/CS5536 I2C controller the chip is 
> > connected to,
> > it won't work till that is written.
> > 
> 
> [un]surprisingly it's actually the same as gscsio(4).  here's a port
> of that code to glxpcib(4).  i don't have the hardware at hand, but
> i encourage you to test (:
> 
> cheers
> 
> Index: dev/pci/files.pci
> ===
> RCS file: /cvs/src/sys/dev/pci/files.pci,v
> retrieving revision 1.281
> diff -u -p -r1.281 files.pci
> --- dev/pci/files.pci 15 Nov 2011 22:27:53 -  1.281
> +++ dev/pci/files.pci 18 Feb 2012 23:03:52 -
> @@ -807,6 +807,6 @@ attachitherm at pci
>  file dev/pci/itherm.citherm
>  
>  # AMD Geode CS5536 PCI-ISA bridge
> -device   glxpcib: isabus, gpiobus
> +device   glxpcib: isabus, gpiobus, i2cbus
>  attach   glxpcib at pci
>  file dev/pci/glxpcib.c   glxpcib


and i forgot to mention that kernel config has to be patched too.
thanks to shadchin@ for reminding.

Index: arch/i386/conf/GENERIC
===
RCS file: /cvs/src/sys/arch/i386/conf/GENERIC,v
retrieving revision 1.730
diff -u -p -r1.730 GENERIC
--- arch/i386/conf/GENERIC  28 Jan 2012 00:39:15 -  1.730
+++ arch/i386/conf/GENERIC  19 Feb 2012 12:10:56 -
@@ -91,6 +91,7 @@ gscpcib* at pci?  # NS Geode SC1100 PCI-
 gpio*  at gscpcib?
 glxpcib* at pci?   # AMD CS5536 PCI-ISA bridge
 gpio*  at glxpcib?
+iic*   at glxpcib?
 kate*  at pci? # AMD K8 temperature sensor
 km*at pci? # AMD K10 temperature sensor
 amas*  at pci? disable # AMD memory configuration
Index: arch/loongson/conf/GENERIC
===
RCS file: /cvs/src/sys/arch/loongson/conf/GENERIC,v
retrieving revision 1.36
diff -u -p -r1.36 GENERIC
--- arch/loongson/conf/GENERIC  7 Jul 2011 23:41:09 -   1.36
+++ arch/loongson/conf/GENERIC  19 Feb 2012 12:10:56 -
@@ -39,6 +39,7 @@ pci*  at bonito?
 # Lemote Lynloong, Lemote Fuloong 2F and Lemote Yeeloong devices
 glxpcib*   at pci?
 gpio*  at glxpcib?
+iic*   at glxpcib?
 isa0   at glxpcib?
 mcclock0   at isa? port 0x70
 pckbc0 at isa? # Yeeloong only



Re: alix2d2 LM86, no hw.sensors

2012-02-18 Thread Mike Belopuhov
On Sat, Feb 18, 2012 at 03:09 +1100, Jonathan Gray wrote:
> On Fri, Feb 17, 2012 at 04:20:25PM +0100, Michal Mazurek wrote:
> > I have an alix2d2 running OpenBSD 5.0. There are no hw.sensors.
> > The producer says there is an LM86 on board, which is supported by the
> > maxtmp driver. It appears the driver is present in generic. I tried starting
> > sensorsd but got:
> > daemon:Feb 17 13:12:04 T1 sensorsd[10445]: startup, system has 0 sensors
> > 
> > How can I read the temperature of my alix2d2 running OpenBSD 5.0?
> 
> There is no driver for the CS5535/CS5536 I2C controller the chip is connected 
> to,
> it won't work till that is written.
> 

[un]surprisingly it's actually the same as gscsio(4).  here's a port
of that code to glxpcib(4).  i don't have the hardware at hand, but
i encourage you to test (:

cheers

Index: dev/pci/files.pci
===
RCS file: /cvs/src/sys/dev/pci/files.pci,v
retrieving revision 1.281
diff -u -p -r1.281 files.pci
--- dev/pci/files.pci   15 Nov 2011 22:27:53 -  1.281
+++ dev/pci/files.pci   18 Feb 2012 23:03:52 -
@@ -807,6 +807,6 @@ attach  itherm at pci
 file   dev/pci/itherm.citherm
 
 # AMD Geode CS5536 PCI-ISA bridge
-device glxpcib: isabus, gpiobus
+device glxpcib: isabus, gpiobus, i2cbus
 attach glxpcib at pci
 file   dev/pci/glxpcib.c   glxpcib
Index: dev/pci/glxpcib.c
===
RCS file: /cvs/src/sys/dev/pci/glxpcib.c,v
retrieving revision 1.3
diff -u -p -r1.3 glxpcib.c
--- dev/pci/glxpcib.c   23 Oct 2010 17:42:57 -  1.3
+++ dev/pci/glxpcib.c   18 Feb 2012 23:03:52 -
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #ifdef __i386__
@@ -35,6 +36,8 @@
 #endif
 
 #include 
+#include 
+
 #include 
 #include 
 #include 
@@ -133,6 +136,34 @@
 #define AMD5536_GPIO_IN_INVRT_EN 0x24  /* invert input */
 #defineAMD5536_GPIO_READ_BACK  0x30/* read back value */
 
+/* SMB */
+#define MSR_LBAR_SMB   DIVIL_LBAR_SMB
+#define MSR_SMB_SIZE   0x07
+#define MSR_SMB_ADDR_MASK  0xfff8
+#define AMD5536_SMB_SDA0x00 /* serial data */
+#define AMD5536_SMB_STS0x01 /* status */
+#define AMD5536_SMB_STS_SLVSTOP0x80 /* slave stop */
+#define AMD5536_SMB_STS_SDAST  0x40 /* smb data status */
+#define AMD5536_SMB_STS_BER0x20 /* bus error */
+#define AMD5536_SMB_STS_NEGACK 0x10 /* negative acknowledge */
+#define AMD5536_SMB_STS_MASTER 0x02 /* master */
+#define AMD5536_SMB_STS_XMIT   0x01 /* transmit or receive */
+#define AMD5536_SMB_CST0x02 /* control status */
+#define AMD5536_SMB_CST_MATCH  0x04 /* address match */
+#define AMD5536_SMB_CST_BB 0x02 /* bus busy */
+#define AMD5536_SMB_CST_BUSY   0x01 /* busy */
+#define AMD5536_SMB_CTL1   0x03 /* control 1 */
+#define AMD5536_SMB_CTL1_ACK   0x10 /* receive acknowledge */
+#define AMD5536_SMB_CTL1_INTEN 0x04 /* interrupt enable  */
+#define AMD5536_SMB_CTL1_STOP  0x02 /* stop */
+#define AMD5536_SMB_CTL1_START 0x01 /* start */
+#define AMD5536_SMB_ADDR   0x04 /* serial address */
+#define AMD5536_SMB_ADDR_SAEN  0x80 /* slave enable */
+#define AMD5536_SMB_CTL2   0x05 /* control 2 */
+#define AMD5536_SMB_CTL2_EN0x01 /* enable clock */
+#define AMD5536_SMB_CTL2_FREQ  0x78 /* 100 kHz */
+#define AMD5536_SMB_CTL3   0x06 /* control 3 */
+
 /*
  * MSR registers we want to preserve accross suspend/resume
  */
@@ -151,12 +182,21 @@ struct glxpcib_softc {
 
uint64_tsc_msrsave[nitems(glxpcib_msrlist)];
 
-#if !defined(SMALL_KERNEL) && NGPIO > 0
+#ifndef SMALL_KERNEL
+#if NGPIO > 0
/* GPIO interface */
bus_space_tag_t sc_gpio_iot;
bus_space_handle_t  sc_gpio_ioh;
struct gpio_chipset_tag sc_gpio_gc;
gpio_pin_t  sc_gpio_pins[AMD5536_GPIO_NPINS];
+#endif
+   /* I2C interface */
+   bus_space_tag_t sc_smb_iot;
+   bus_space_handle_t  sc_smb_ioh;
+   struct i2c_controller   sc_smb_ic;
+   struct rwlock   sc_smb_lck;
+
+   /* Watchdog */
int sc_wdog;
int sc_wdog_period;
 #endif
@@ -180,11 +220,23 @@ void  pcibattach(struct device *parent, s
 
 u_int  glxpcib_get_timecount(struct timecounter *tc);
 
-#if !defined(SMALL_KERNEL) && NGPIO > 0
+#ifndef SMALL_KERNEL
+int glxpcib_wdogctl_cb(void *, int);
+#if NGPIO > 0
 void   glxpcib_gpio_pin_ctl(void *, int, int);
 intglxpcib_gpio_pin_read(void *, int);
 void   glxpcib_gpio_pin_write(void *, int, int);
-int glxpcib_wdogctl_cb(void *, int);
+#endif
+intglxpcib_smb_acquire_bus(void *, int);
+void   glxpcib_smb_release_bus(void *, int);
+intglxpcib_smb_send_start(void *, int);
+intglxpcib_smb_send_stop(void *, int);
+void   glxpcib_smb_send_ack(void *, int);
+intglxpcib_smb_initiate_xfer(void *, i

Re: alix2d2 LM86, no hw.sensors

2012-02-17 Thread Jonathan Gray
On Fri, Feb 17, 2012 at 04:20:25PM +0100, Michal Mazurek wrote:
> I have an alix2d2 running OpenBSD 5.0. There are no hw.sensors.
> The producer says there is an LM86 on board, which is supported by the
> maxtmp driver. It appears the driver is present in generic. I tried starting
> sensorsd but got:
> daemon:Feb 17 13:12:04 T1 sensorsd[10445]: startup, system has 0 sensors
> 
> How can I read the temperature of my alix2d2 running OpenBSD 5.0?

There is no driver for the CS5535/CS5536 I2C controller the chip is connected 
to,
it won't work till that is written.



alix2d2 LM86, no hw.sensors

2012-02-17 Thread Michal Mazurek
I have an alix2d2 running OpenBSD 5.0. There are no hw.sensors.
The producer says there is an LM86 on board, which is supported by the
maxtmp driver. It appears the driver is present in generic. I tried starting
sensorsd but got:
daemon:Feb 17 13:12:04 T1 sensorsd[10445]: startup, system has 0 sensors

How can I read the temperature of my alix2d2 running OpenBSD 5.0?

[15:59:ttyp1][root@T3:~:1]$ sysctl hw
hw.machine=i386
hw.model=Geode(TM) Integrated Processor by AMD PCS ("AuthenticAMD" 586-class)
hw.ncpu=1
hw.byteorder=1234
hw.pagesize=4096
hw.disknames=wd0:c8fc559b0e991404
hw.diskcount=1
hw.cpuspeed=499
hw.physmem=267976704
hw.usermem=267964416
hw.ncpufound=1
hw.allowpowerdown=1
[15:59:ttyp1][root@T3:~:2]$ uname -a
OpenBSD T3.nmi 5.0 GENERIC.MP#59 i386

dmesg:
OpenBSD 5.0 (GENERIC.MP) #59: Wed Aug 17 10:19:44 MDT 2011
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: Geode(TM) Integrated Processor by AMD PCS ("AuthenticAMD" 586-class) 499 
MHz
cpu0: FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CFLUSH,MMX
real mem  = 267976704 (255MB)
avail mem = 253521920 (241MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 11/05/08, BIOS32 rev. 0 @ 0xfd088
pcibios0 at bios0: rev 2.1 @ 0xf/0x1
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xe/0xa800
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 1 function 0 "AMD Geode LX" rev 0x33
glxsb0 at pci0 dev 1 function 2 "AMD Geode LX Crypto" rev 0x00: RNG AES
vr0 at pci0 dev 9 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 10, address 
00:0d:b9:25:8f:ec
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x004063, 
model 0x0034
vr1 at pci0 dev 11 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 15, address 
00:0d:b9:25:8f:ed
ukphy1 at vr1 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x004063, 
model 0x0034
glxpcib0 at pci0 dev 15 function 0 "AMD CS5536 ISA" rev 0x03: rev 3, 32-bit 
3579545Hz timer, watchdog, gpio
gpio0 at glxpcib0: 32 pins
pciide0 at pci0 dev 15 function 2 "AMD CS5536 IDE" rev 0x01: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: 
wd0: 1-sector PIO, LBA48, 3815MB, 7813120 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 ignored (disabled)
ohci0 at pci0 dev 15 function 4 "AMD CS5536 USB" rev 0x02: irq 12, version 1.0, 
legacy support
ehci0 at pci0 dev 15 function 5 "AMD CS5536 USB" rev 0x02: irq 12
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "AMD EHCI root hub" rev 2.00/1.00 addr 1
isa0 at glxpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 "AMD OHCI root hub" rev 1.00/1.00 addr 1
mtrr: K6-family MTRR support (2 registers)
nvram: invalid checksum
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
scsibus1 at softraid0: 256 targets
root on wd0a (c8fc559b0e991404.a) swap on wd0b dump on wd0b

-- 
Michal Mazurek