apritzel / pine64

Pine64 Linux images and information
119 stars 28 forks source link

How-to activate USB and/or SDIO? #6

Closed umiddelb closed 8 years ago

umiddelb commented 8 years ago

I'd like to get a network device up and running on the p64 (before setting up something like PPP/SLIP over UART).

apritzel commented 8 years ago

USB is within reach, and should be doable by adding the right nodes to the DT. You should be able to copy (and adjust) them from another Allwinner DT. Not sure if the H3 is a good base here, since the USB design is different from the A64. My hunch is that another recent Allwinner chip would be a better base. However this most likely will not work with the kernel from the image. The reason is that I cheated a bit with the clocks to get it running with minimal patches. USB needs proper clock support, and the upcoming kernel patches should fix this. This is based on the impression that you don't need the tricks and patches that are needed for the H3 USB support, which is still WIP AFAIK.

I haven't looked at SDIO yet, so atm cannot tell anything about it. At least the WiFi chip on the module from Pine64 seems to be supported by upstream Linux.

If you are interested, I can provide two PPP command lines for both host and client lines I found in my notes. Also you may try to set the baudrate higher, most USB serial adapters can cope with this. Not sure if it works, though. If the Pine64 UART denies to set the higher baudrate, I am thinking of another hack (just respond if you are interested). This might alleviate your current pain with the Pine64 until USB is ready.

umiddelb commented 8 years ago

I didn't manage to find the p64 dts in your kernel sources (arch/arm64/boot/dts).

For WiFi, I've found rtl8723bs, but /sys/bus/sdio/devices is empty.

I've tried to boot the 3.10 kernel provided by the BSP (lichee_linux_310.tar.gz) with no success (no sign of life at all, the 4.4 kernel starts to boot with the 3.10 dtb but gets stuck).

I'd like to try the PPP command line. The UART is connected directly to a ODROID C1 UART, no USB adapter.

apritzel commented 8 years ago

This is just a dump of some command line I got from a colleague, haven't tried it yet. Please don't take it verbatim, but adjust the values and wildcards in there and experiment with the settings. On the Pine64:

# pppd /dev/ttyS0 230400 local xonxoff passive persist mtu 576 noauth 169.254.x.x
# route add default gw 169.254.x.x

On your host (Odroid in your case):

# pppd /dev/ttyUSB0 230400 local xonxoff mtu 576 noauth 169.254.x.y
# iptables -t nat -A POSTROUTING -s 169.254.x.y -j MASQUERADE
# echo 1 >/proc/sys/net/ipv4/ip_forward

The DT is in that other a64-wip repository with the long name, but that is work in progress, as it says on the tin. Otherwise you can dump the DT from the running system via /sys/firmware.

umiddelb commented 8 years ago

thank you. To do this I need at least another UART on the P64 to work which isn't actually the case. I've tried your recent kernel (v1), but USB/SDIO still doesn't work (or do I need to update the dtb as well?).

apritzel commented 8 years ago

For the v1 kernel you should use the DTB from that very same branch, but this is WIP and will definitely change, so please don't build or publish anything on this (some for the already published image, btw). And USB/SDIO still doesn't work there, simply because I haven't tried it yet and there are more important things to get right first (firmware and DT nodes naming, for instance). It should be pretty easy to hack the old DT to add the other UARTs (by taking inspirations from the new DT, for instance or copy the existing UART node and adjust the address). Also technically you should be able to use just one serial port, I remember some nice way of launching pppd as a login shell (back in the 90's those modem dialins worked this way). So you can boot it up normally, close your terminal program on the PC and tell some script on your PC to login on the Pine64, launch pppd locally which connects to the pppd on the Pine64. That's the theory, at least, haven't tried this.

umiddelb commented 8 years ago

the dtb from the v1 branch seems not include device nodes for mmcblk0

Starting kernel ...

INFO:    BL3-1: Next image address = 0x41080000
INFO:    BL3-1: Next image spsr = 0x3c5
Booting Linux on physical CPU 0x0
Linux version 4.5.0-rc1+ (alarm@alarm) (gcc version 5.3.0 (GCC) ) #3 SMP PREEMPT Sat Feb 13 11:37:43 UTC 2016
Boot CPU: AArch64 Processor [410fd034]
Ignoring memory range 0x40000000 - 0x41000000
earlycon: Early serial console at MMIO32 0x1c28000 (options '')
bootconsole [uart0] enabled
efi: Getting EFI parameters from FDT:
efi: UEFI not found.
cma: Reserved 16 MiB at 0x000000007f000000
kasan: KernelAddressSanitizer initialized
psci: probing for conduit method from DT.
psci: PSCIv0.2 detected in firmware.
psci: Using standard PSCI v0.2 function IDs
psci: Trusted OS migration not required
PERCPU: Embedded 20 pages/cpu @ffffffc03df96000 s41472 r8192 d32256 u81920
Detected VIPT I-cache on CPU0
CPU features: enabling workaround for ARM erratum 845719
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 254016
Kernel command line: console=ttyS0,115200n8 earlycon=uart,mmio32,0x01c28000 root=/dev/mmcblk0p3 rootwait ro fsck.repair=yes androidboot.serialno=2400519008081429098b androidboot.hardware=sun51
log_buf_len individual max cpu contribution: 4096 bytes
log_buf_len total cpu_extra contributions: 12288 bytes
log_buf_len min size: 16384 bytes
log_buf_len: 32768 bytes
early log buf free: 14484(88%)
PID hash table entries: 4096 (order: 3, 32768 bytes)
Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
software IO TLB [mem 0x71a00000-0x75a00000] (64MB) mapped at [ffffffc030a00000-ffffffc0349fffff]
Memory: 783832K/1032192K available (8647K kernel code, 2765K rwdata, 3984K rodata, 764K init, 323K bss, 231976K reserved, 16384K cma-reserved)
Virtual kernel memory layout:
    kasan   : 0xffffff8000000000 - 0xffffff9000000000   (    64 GB)
    vmalloc : 0xffffff9000010000 - 0xffffffbdbfff0000   (   182 GB)
    vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
              0xffffffbdc1040000 - 0xffffffbdc2000000   (    15 MB actual)
    fixed   : 0xffffffbffa7fd000 - 0xffffffbffac00000   (  4108 KB)
    PCI I/O : 0xffffffbffae00000 - 0xffffffbffbe00000   (    16 MB)
    modules : 0xffffffbffc000000 - 0xffffffc000000000   (    64 MB)
    memory  : 0xffffffc000000000 - 0xffffffc03f000000   (  1008 MB)
      .init : 0xffffffc000cd8000 - 0xffffffc000d97000   (   764 KB)
      .text : 0xffffffc000080000 - 0xffffffc000cd7cc4   ( 12640 KB)
      .data : 0xffffffc000d97000 - 0xffffffc00104a400   (  2765 KB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
Preemptible hierarchical RCU implementation.
        Build-time adjustment of leaf fanout to 64.
        RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4.
RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=4
NR_IRQS:64 nr_irqs:64 0
Architected cp15 timer(s) running at 24.00MHz (virt).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
Console: colour dummy device 80x25
Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000)
pid_max: default: 32768 minimum: 301
Security Framework initialized
Mount-cache hash table entries: 2048 (order: 2, 16384 bytes)
Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes)
ASID allocator initialised with 65536 entries
EFI services will not be available.
Detected VIPT I-cache on CPU1
CPU1: Booted secondary processor [410fd034]
Detected VIPT I-cache on CPU2
CPU2: Booted secondary processor [410fd034]
Detected VIPT I-cache on CPU3
CPU3: Booted secondary processor [410fd034]
Brought up 4 CPUs
SMP: Total of 4 processors activated.
CPU: All CPU(s) started at EL1
alternatives: patching kernel code
devtmpfs: initialized
DMI not present or invalid.
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
cpuidle: using governor ladder
cpuidle: using governor menu
vdso: 2 pages (1 code @ ffffffc000d9d000, 1 data @ ffffffc000d9c000)
hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
DMA: preallocated 256 KiB pool for atomic allocations
Serial: AMBA PL011 UART driver
HugeTLB registered 2 MB page size, pre-allocated 0 pages
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
dmi: Firmware registration failed.
clocksource: Switched to clocksource arch_sys_counter
VFS: Disk quotas dquot_6.6.0
VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 5, 131072 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
kvm [1]: HYP mode not available
futex hash table entries: 1024 (order: 5, 131072 bytes)
audit: initializing netlink subsys (disabled)
audit: type=2000 audit(0.468:1): initialized
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
fuse init (API version 7.24)
9p: Installing v9fs 9p2000 file system support
io scheduler noop registered
io scheduler cfq registered (default)
a64-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
console [ttyS0] disabled
1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 9, base_baud = 1500000) is a U6_16550A
console [ttyS0] enabled
console [ttyS0] enabled
bootconsole [uart0] disabled
bootconsole [uart0] disabled
1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 10, base_baud = 1500000) is a U6_16550A
1c28c00.serial: ttyS3 at MMIO 0x1c28c00 (irq = 11, base_baud = 1500000) is a U6_16550A
1c29000.serial: ttyS1 at MMIO 0x1c29000 (irq = 12, base_baud = 1500000) is a U6_16550A
msm_serial: driver initialized
Unable to detect cache hierarchy from DT for CPU 0
loop: module loaded
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-pci: OHCI PCI platform driver
ohci-platform: OHCI generic platform driver
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
NET: Registered protocol family 17
9pnet: Installing 9P2000 support
Key type dns_resolver registered
registered taskstats version 1
hctosys: unable to open rtc device (rtc0)
Waiting for root device /dev/mmcblk0p3...
apritzel commented 8 years ago

No the mmc node is there (as you can easily verify). But this failure is a known issue with the DT from the beginning, we are deugging this at the moment, feel free to chime and help on #linux-sunxi