Re: Booting and installing on the Olimex Teres laptop

2019-08-12 Thread Mark Kettenis
> Date: Sun, 11 Aug 2019 23:49:10 +
> From: ioh 
> 
> I have been able to successfully install OpenBSD Current Aug 06
> 2019 on the Olimex Teres laptop.  It has very similar hardware to
> the PineBook, arm64 allwinner, etc.  I used u-boot-sunxi-with-spl.bin
> from u-boot v2019.07 (teres_i_defconfig) and Arm Trusted Firmware
> v2.1. The dtb (sun50i-a64-teres-i.dtb) is from the OpenBSD 6.5-release
> ports tree.
> 
> To complete kernel initialization from either the install bsd.rd
> or bsd from an install, the ohci driver must be disabled.  I have
> included the serial console output and dmesg of first a boot without
> the ohci driver disabled, and then the boot log of my successful
> install with ohci disabled.  According to linux dmesg or the
> sun50i-a64-teres-i.dts, ohci is available so the driver is probed
> correctly - but even after several minutes the initialization process
> will not continue past the line "ohci0 at simplebus0".

The hang at that point suggests that accessing the OHCI registers
hangs the machine.  That happened in the past when the relevant clock
wasn't running or when the OHCI logic block wasn't brought out of
reset.  But those issues got fixed and ohci(4) works fine on other
boards that use the Allwinner A64 SoC.  What seems to be different is
that the Teres-i only has the 2nd USB controller enabled.

> What works: the embedded mmc and external mmc, external usb ports,
> the serial line, and if xorg is running, the display.

The "arm64 glass console" diff I posted last weekend should give you a
framebuffer console.  Note that that diff is for the bootloader, so
you'll need to build and install it and then run installboot.  That
diff is probably going to be committed today or tomorrow so you could
just wait a few days for a new snapshot.

> What does not: wifi (as expected, realtek 8723bs), keyboard and
> trackpad.

There is some evidence of the keyboard that shows up in dmesg:

> umodem0 at uhub1 port 4 configuration 1 interface 2 "Olimex Ltd. TERES 
> Keyboard+Touchpad (drv)" rev 1.10/0.01 addr 5
> umodem0: data interface 3, has no CM over data, has break
> umodem0: status change notification available
> ucom0 at umodem0

It'd be interesting to see what happens if you disable umoden(4) and
see what the USB descriptors are for that device.  For that purpose
install the usbutils package and post the output of "lsusb -v".

> Please let me know if there is anything I can do to help improve
> support for this platform.  I tried building a DEBUG kernel and
> booting with "verbose" from the UKC> prompt but did not find any
> useful (afaik) information. I don't know how else to get more verbose
> information from the initialization process (add printf's to the
> driver code?).

Adding printfs is probably the way to go here.  Start with
ohci_fdt_attach() in sys/dev/fdt/ohci_fdt.c and try to pinpoint at
which point it hangs.

> U-Boot SPL 2019.07 (Aug 06 2019 - 22:39:39 +)
> DRAM: 2048 MiB
> Trying to boot from MMC2
> NOTICE:  BL31: v2.1(release):v2.1
> NOTICE:  BL31: Built : 22:20:23, Aug  6 2019
> NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
> NOTICE:  BL31: Found U-Boot DTB at 0x408a4a0, model: Olimex A64 Teres-I
> NOTICE:  BL31: PMIC: Detected AXP803 on RSB.
> 
> 
> U-Boot 2019.07 (Aug 06 2019 - 22:39:39 +) Allwinner Technology
> 
> CPU:   Allwinner A64 (SUN50I)
> Model: Olimex A64 Teres-I
> DRAM:  2 GiB
> MMC:   Device 'mmc@1c11000': seq 1 is in use by 'mmc@1c1'
> mmc@1c0f000: 0, mmc@1c1: 2, mmc@1c11000: 1
> Loading Environment from FAT... *** Warning - bad CRC, using default 
> environment
> 
> In:serial
> Out:   vidconsole
> Err:   vidconsole
> Net:   No ethernet found.
> starting USB...
> Bus usb@1c1b000: USB EHCI 1.00
> scanning bus usb@1c1b000 for devices... 2 USB Device(s) found
>scanning usb for storage devices... 0 Storage Device(s) found
> Hit any key to stop autoboot:  0
> switch to partitions #0, OK
> mmc1(part 0) is current device
> Scanning mmc 1:1...
> 19606 bytes read in 4 ms (4.7 MiB/s)
> Found EFI removable media binary efi/boot/bootaa64.efi
> MMC: no card present
> Scanning disk m...@1c0f000.blk...
> Disk m...@1c0f000.blk not ready
> Card did not respond to voltage select!
> Scanning disk m...@1c1.blk...
> Disk m...@1c1.blk not ready
> Scanning disk m...@1c11000.blk...
> Found 3 disks
> BootOrder not defined
> EFI boot manager: Cannot load any image
> 159484 bytes read in 10 ms (15.2 MiB/s)
> disks: sd0*
> >> OpenBSD/arm64 BOOTAA64 0.17
> boot>
> booting sd0a:/bsd: 6060108+1228568+514296+816936 
> [422297+109+714912+416614]=0xac09f8
> type 0x2 pa 0x4000 va 0x4000 pages 0x4000 attr 0x8
> type 0x7 pa 0x4400 va 0x4400 pages 0x3ef8 attr 0x8
> type 0x4 pa 0x47ef8000 va 0x47ef8000 pages 0x10 attr 0x8
> type 0x7 pa 0x47f08000 va 0x47f08000 pages 0x705e9 attr 0x8
> type 0x2 pa 0xb84f1000 va 0xb84f1000 pages 0xa0e attr 0x8
> type 0x1 pa 0xb8eff000 va 0xb8eff000 pages 0x27 attr 0x8
> type 0x0 pa 0xb8f26000 va 0

Re: Booting and installing on the Olimex Teres laptop

2019-08-12 Thread ioh
On Mon, Aug 12, Matthieu Herrb wrote:
> On Sun, Aug 11, 2019 at 11:49:10PM +, ioh wrote:
> > 
> > I have been able to successfully install OpenBSD Current Aug 06
> > 2019 on the Olimex Teres laptop.  It has very similar hardware to
> > the PineBook, arm64 allwinner, etc.  I used u-boot-sunxi-with-spl.bin
> > from u-boot v2019.07 (teres_i_defconfig) and Arm Trusted Firmware
> > v2.1. The dtb (sun50i-a64-teres-i.dtb) is from the OpenBSD 6.5-release
> > ports tree.
> > 
> > To complete kernel initialization from either the install bsd.rd
> > or bsd from an install, the ohci driver must be disabled.  I have
> > included the serial console output and dmesg of first a boot without
> > the ohci driver disabled, and then the boot log of my successful
> > install with ohci disabled.  According to linux dmesg or the
> > sun50i-a64-teres-i.dts, ohci is available so the driver is probed
> > correctly - but even after several minutes the initialization process
> > will not continue past the line "ohci0 at simplebus0".
> > 
> > What works: the embedded mmc and external mmc, external usb ports,
> > the serial line, and if xorg is running, the display.  What does
> > not: wifi (as expected, realtek 8723bs), keyboard and trackpad.
> > 
> > Please let me know if there is anything I can do to help improve
> > support for this platform.  I tried building a DEBUG kernel and
> > booting with "verbose" from the UKC> prompt but did not find any
> > useful (afaik) information. I don't know how else to get more verbose
> > information from the initialization process (add printf's to the
> > driver code?).
> 
> > umodem0 at uhub1 port 4 configuration 1 interface 2 "Olimex Ltd. TERES 
> > Keyboard+Touchpad (drv)" rev 1.10/0.01 addr 5
> > umodem0: data interface 3, has no CM over data, has break
> > umodem0: status change notification available
> > ucom0 at umodem0
> 
> That is a bit strange and explains why keyboard/touchpad don't work.
> 
> On the pinebook there is an internal usb hub on which attaches ate uhub1
> and the keyboard and trackpad are uhid devices behind it.
> 
> uhub4 at uhub1 port 1 configuration 1 interface 0 "Genesys Logic USB2.0 Hub" 
> rev 2.00/88.32 addr 2
> uhidev0 at uhub4 port 1 configuration 1 interface 0 "HAILUCK CO.,LTD USB 
> KEYBOARD" rev 1.10/1.00 addr 3
> uhidev0: iclass 3/1
> ukbd0 at uhidev0: 8 variable keys, 6 key codes
> wskbd0 at ukbd0: console keyboard, using wsdisplay0
> uhidev1 at uhub4 port 1 configuration 1 interface 1 "HAILUCK CO.,LTD USB 
> KEYBOARD" rev 1.10/1.00 addr 3
> uhidev1: iclass 3/0, 9 report ids
> ums0 at uhidev1 reportid 1: 5 buttons, Z and W dir
> wsmouse0 at ums0 mux 0

This looks pretty similar to what happens on linux. Here is a section of the 
armbian dmesg:
[5.356506] usb 2-1.4: new full-speed USB device number 5 using ehci-platform
[5.471104] usb 2-1.4: New USB device found, idVendor=15ba, idProduct=003c, 
bcdDevice= 0.01
[5.471120] usb 2-1.4: New USB device strings: Mfr=1, Product=2, 
SerialNumber=220
[5.471126] usb 2-1.4: Product: TERES Keyboard+Touchpad
[5.471132] usb 2-1.4: Manufacturer: Olimex Ltd.
[5.471138] usb 2-1.4: SerialNumber: A4138353330351F08041
[5.489383] input: Olimex Ltd. TERES Keyboard+Touchpad as 
/devices/platform/soc/1c1b000.usb/usb2/2-1/2-1.4/2-1.4:1.0/0003:15BA:003C.0002/input/input2
[5.549363] hid-generic 0003:15BA:003C.0002: input,hidraw0: USB HID v1.11 
Keyboard [Olimex Ltd. TERES Keyboard+Touchpad] on usb-1c1b000.usb-1.4/input0
[5.558421] input: Olimex Ltd. TERES Keyboard+Touchpad as 
/devices/platform/soc/1c1b000.usb/usb2/2-1/2-1.4/2-1.4:1.1/0003:15BA:003C.0003/input/input3
[5.558859] hid-generic 0003:15BA:003C.0003: input,hidraw1: USB HID v1.11 
Mouse [Olimex Ltd. TERES Keyboard+Touchpad] on usb-1c1b000.usb-1.4/input1

And the complete armbian boot logs if you're interested: http://ix.io/1xWt
-- 
ioh



Re: Booting and installing on the Olimex Teres laptop

2019-08-12 Thread ioh
On Mon, Aug 12, Mark Kettenis wrote:
> > Date: Sun, 11 Aug 2019 23:49:10 +
> > From: ioh 
> > 
> > I have been able to successfully install OpenBSD Current Aug 06
> > 2019 on the Olimex Teres laptop.  It has very similar hardware to
> > the PineBook, arm64 allwinner, etc.  I used u-boot-sunxi-with-spl.bin
> > from u-boot v2019.07 (teres_i_defconfig) and Arm Trusted Firmware
> > v2.1. The dtb (sun50i-a64-teres-i.dtb) is from the OpenBSD 6.5-release
> > ports tree.
> > 
> > To complete kernel initialization from either the install bsd.rd
> > or bsd from an install, the ohci driver must be disabled.  I have
> > included the serial console output and dmesg of first a boot without
> > the ohci driver disabled, and then the boot log of my successful
> > install with ohci disabled.  According to linux dmesg or the
> > sun50i-a64-teres-i.dts, ohci is available so the driver is probed
> > correctly - but even after several minutes the initialization process
> > will not continue past the line "ohci0 at simplebus0".
> 
> The hang at that point suggests that accessing the OHCI registers
> hangs the machine.  That happened in the past when the relevant clock
> wasn't running or when the OHCI logic block wasn't brought out of
> reset.  But those issues got fixed and ohci(4) works fine on other
> boards that use the Allwinner A64 SoC.  What seems to be different is
> that the Teres-i only has the 2nd USB controller enabled.
> 
> > What works: the embedded mmc and external mmc, external usb ports,
> > the serial line, and if xorg is running, the display.
> 
> The "arm64 glass console" diff I posted last weekend should give you a
> framebuffer console.  Note that that diff is for the bootloader, so
> you'll need to build and install it and then run installboot.  That
> diff is probably going to be committed today or tomorrow so you could
> just wait a few days for a new snapshot.

Excellent, I'm looking forward to testing it out when it hits snapshots.

> > What does not: wifi (as expected, realtek 8723bs), keyboard and
> > trackpad.
> 
> There is some evidence of the keyboard that shows up in dmesg:
> 
> > umodem0 at uhub1 port 4 configuration 1 interface 2 "Olimex Ltd. TERES 
> > Keyboard+Touchpad (drv)" rev 1.10/0.01 addr 5
> > umodem0: data interface 3, has no CM over data, has break
> > umodem0: status change notification available
> > ucom0 at umodem0
> 
> It'd be interesting to see what happens if you disable umoden(4) and
> see what the USB descriptors are for that device.  For that purpose
> install the usbutils package and post the output of "lsusb -v".

After disabling ohci and umodem in boot_config, here is the
lsusb -v and dmesg outputs. It appears ugen then picks up the
keyboard, but still no response when pressing any keys.

# lsusb -v

Bus 000 Device 001: ID :  
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass9 Hub
  bDeviceSubClass 0 Unused
  bDeviceProtocol 1 Single TT
  bMaxPacketSize064
  idVendor   0x 
  idProduct  0x 
  bcdDevice1.00
  iManufacturer   1 Generic
  iProduct2 EHCI root hub
  iSerial 0 
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   25
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0 
bmAttributes 0xc0
  Self Powered
MaxPower0mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 9 Hub
  bInterfaceSubClass  0 Unused
  bInterfaceProtocol  0 Full speed (or root) hub
  iInterface  0 
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0008  1x 8 bytes
bInterval  12
Hub Descriptor:
  bLength  10
  bDescriptorType  41
  nNbrPorts 1
  wHubCharacteristic 0x0002
No power switching (usb 1.0)
Ganged overcurrent protection
TT think time 8 FS bits
  bPwrOn2PwrGood  200 * 2 milli seconds
  bHubContrCurrent  0 milli Ampere
  DeviceRemovable0x00
  PortPwrCtrlMask0x00
 Hub Port Status:
   Port 1: .0503 highspeed power enable connect
Device Status: 0x0001
  Self Powered

Bus 000 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass9 Hub
  bDeviceSubClass 0 

Re: Booting and installing on the Olimex Teres laptop

2019-08-12 Thread ioh
On Mon, Aug 12, Mark Kettenis wrote:
> > Date: Sun, 11 Aug 2019 23:49:10 +
> > From: ioh 
> > 
> > I have been able to successfully install OpenBSD Current Aug 06
> > 2019 on the Olimex Teres laptop.  It has very similar hardware to
> > the PineBook, arm64 allwinner, etc.  I used u-boot-sunxi-with-spl.bin
> > from u-boot v2019.07 (teres_i_defconfig) and Arm Trusted Firmware
> > v2.1. The dtb (sun50i-a64-teres-i.dtb) is from the OpenBSD 6.5-release
> > ports tree.
> > 
> > To complete kernel initialization from either the install bsd.rd
> > or bsd from an install, the ohci driver must be disabled.  I have
> > included the serial console output and dmesg of first a boot without
> > the ohci driver disabled, and then the boot log of my successful
> > install with ohci disabled.  According to linux dmesg or the
> > sun50i-a64-teres-i.dts, ohci is available so the driver is probed
> > correctly - but even after several minutes the initialization process
> > will not continue past the line "ohci0 at simplebus0".
> 
> The hang at that point suggests that accessing the OHCI registers
> hangs the machine.  That happened in the past when the relevant clock
> wasn't running or when the OHCI logic block wasn't brought out of
> reset.  But those issues got fixed and ohci(4) works fine on other
> boards that use the Allwinner A64 SoC.  What seems to be different is
> that the Teres-i only has the 2nd USB controller enabled.
> 
> Adding printfs is probably the way to go here.  Start with
> ohci_fdt_attach() in sys/dev/fdt/ohci_fdt.c and try to pinpoint at
> which point it hangs.

This is the printf's I added, followed by the dmesg output.  The
point at which init hangs is at bus_space_read_4() in ohci_fdt_attach().
Do you need further digging in bus_space_read_4, ie adding printf's
to that function too to find the exact line further, or is that
enough information?

Index: dev/fdt/ohci_fdt.c
===
RCS file: /cvs/src/sys/dev/fdt/ohci_fdt.c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 ohci_fdt.c
--- dev/fdt/ohci_fdt.c  7 Jan 2019 03:41:06 -   1.2
+++ dev/fdt/ohci_fdt.c  13 Aug 2019 00:53:06 -
@@ -71,6 +71,8 @@ ohci_fdt_match(struct device *parent, vo
 void
 ohci_fdt_attach(struct device *parent, struct device *self, void *aux)
 {
+printf("\nDEBUG: entering ohci_fdt_attach\n");
+
struct ohci_fdt_softc *sc = (struct ohci_fdt_softc *)self;
struct fdt_attach_args *faa = aux;
char *devname = sc->sc.sc_bus.bdev.dv_xname;
@@ -96,9 +98,13 @@ ohci_fdt_attach(struct device *parent, s
clock_enable_all(sc->sc_node);
reset_deassert_all(sc->sc_node);

+printf("DEBUG: Make it to here\n");
+
/* Record what interrupts were enabled by SMM/BIOS. */
sc->sc.sc_intre = bus_space_read_4(sc->sc.iot, sc->sc.ioh,
OHCI_INTERRUPT_ENABLE);
+
+printf("DEBUG: Do not make it here\n");

/* Disable interrupts, so we don't get any spurious ones. */
bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE,


OpenBSD 6.5-current (CUSTOM) #2: Mon Aug 12 17:45:21 PDT 2019
r...@hedges.my.domain:/sys/arch/arm64/compile/CUSTOM
real mem  = 2018398208 (1924MB)
avail mem = 1928859648 (1839MB)
mainbus0 at root: Olimex A64 Teres-I
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache
efi0 at mainbus0: UEFI 2.7
efi0: Das U-Boot rev 0x20190700
apm0 at mainbus0
psci0 at mainbus0: PSCI 1.1, SMCCC 1.1
"osc24M_clk" at mainbus0 not configured
"osc32k_clk" at mainbus0 not configured
"internal-osc-clk" at mainbus0 not configured
"sound_spdif" at mainbus0 not configured
"spdif-out" at mainbus0 not configured
agtimer0 at mainbus0: tick rate 24000 KHz
simplebus0 at mainbus0: "soc"
sxiccmu0 at simplebus0
sxipio0 at simplebus0: 103 pins
ampintc0 at simplebus0 nirq 224, ncpu 4: "interrupt-controller"
sxiccmu1 at simplebus0
sxipio1 at simplebus0: 13 pins
sxirsb0 at simplebus0
axppmic0 at sxirsb0 addr 0x3a3: AXP803
"de2" at simplebus0 not configured
"syscon" at simplebus0 not configured
"dma-controller" at simplebus0 not configured
"lcd-controller" at simplebus0 not configured
"lcd-controller" at simplebus0 not configured
sximmc0 at simplebus0
sdmmc0 at sximmc0: 4-bit, sd high-speed, mmc high-speed, dma
sximmc1 at simplebus0
sdmmc1 at sximmc1: 4-bit, sd high-speed, mmc high-speed, dma
sximmc2 at simplebus0
sdmmc2 at sximmc2: 8-bit, sd high-speed, mmc high-speed, dma
"eeprom" at simplebus0 not configured
"phy" at simplebus0 not configured
ehci0 at simplebus0
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Generic EHCI root hub" rev 2.00/1.00 
addr 1
ohci0 at simplebus0
DEBUG: entering ohci_fdt_attach
DEBUG: Make it to here

--
ioh