3.13 kernel with working sunxi mmc / sdc support!

2,475 views
Skip to first unread message

Hans de Goede

unread,
Dec 2, 2013, 9:25:55 AM12/2/13
to linux-sunxi, David Lanzendörfer, Emilio Lopez, Richard W.M. Jones
Hi,

Thanks to the great work done on this by David Lanzend�rfer, and
spending almost the entire weekend on debugging things to get the
last bits fixed, I now have a tree with an upstream kernel
with working sdcard support.

This is still a bit rough (it works reliable but needs some code
cleanup) I've only tested on A20 so far, sun5i should work fine
too, it needs some adjustments for sun4i, but those should not
be too hard.

So I now have a (test / wip) tree with:
-Emilio's latest clock patches rebased (automatic) on 3.13rc2
(they were based on 3.13rc1). Both sata and sdcard support
would not have been possible without Emilio's great work.
-Working sata driver (Thanks to the great work done by oliv3r
and ianc)
-gmac driver, this seems to be:
1) broken on cubietruck, likely a pinmux issue
2) now also broken on the cubieboard2, I think it was broken
by the rebase to 3.13rc2
I'll investigate these 2 issues as time allows
-Support for the second cpu core
-Working sdcard support !

You can grab it here:
https://github.com/jwrdegoede/linux-sunxi/commits/sunxi-test

These bits helped me to get the kernel to see the card,
mount it and then hang halfway during boot:
https://github.com/jwrdegoede/linux-sunxi/commit/923ec2edfb63f83bc4c852468b4a2302f4b92d82

And this one turned out to be the trick to fix the hangs, it
is a one liner, but with big consequences, I advise everyone
to read the commit msg, so we don't need to relearn this
expensive (time wise) lesson with other ip blocks:
https://github.com/jwrdegoede/linux-sunxi/commit/22cf01e5cdc3a53855412643e8dc62056cc8b2fb

Regards,

Hans

Richard W.M. Jones

unread,
Dec 2, 2013, 12:10:49 PM12/2/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez
On Mon, Dec 02, 2013 at 03:25:55PM +0100, Hans de Goede wrote:
> https://github.com/jwrdegoede/linux-sunxi/commits/sunxi-test

Hans,

Do you have a suggested .config for use with this kernel?

Also, do you compile with modules enabled? And if so how do you
prepare an initramfs?

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org

Hans de Goede

unread,
Dec 2, 2013, 1:31:16 PM12/2/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez
Hi,

On 12/02/2013 06:10 PM, Richard W.M. Jones wrote:
> On Mon, Dec 02, 2013 at 03:25:55PM +0100, Hans de Goede wrote:
>> https://github.com/jwrdegoede/linux-sunxi/commits/sunxi-test
>
> Hans,
>
> Do you have a suggested .config for use with this kernel?

I use the attached config (which is taken from the Fedora F-20
arm kernels + the new sunxi bits enabled.

> Also, do you compile with modules enabled? And if so how do you
> prepare an initramfs?

It does use modules, but I've made everything necessary to find
the rootfs (be it sata or mmc) built-in, so no initramfs is needed.

Regards,

Hans

p.s.

Note ethernet is currently broken on the cubietruck, I hope to
be able to fix that soon.
.config

Richard W.M. Jones

unread,
Dec 2, 2013, 2:12:52 PM12/2/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez
Thanks. That works pretty good. Surprisingly ethernet *does* work
for me [this is a Cubietruck].

$ ssh cube
Last login: Mon Dec 2 12:07:50 2013 from choo.home.annexia.org
rjones@cube:~$ uname -a
Linux cube.home.annexia.org 3.13.0-rc2+ #13 SMP Mon Dec 2 14:01:19 EST 2013 armv7l armv7l armv7l GNU/Linux
rjones@cube:~$ free -m
total used free shared buffers cached
Mem: 2015 348 1667 1 16 251
-/+ buffers/cache: 80 1935
Swap: 488 0 488
rjones@cube:~$ cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 4 (v7l)
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 4

processor : 1
model name : ARMv7 Processor rev 4 (v7l)
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 4

Hardware : Allwinner sun7i (A20) Family
Revision : 0000
Serial : 0000000000000000

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

ezaulz...@gmail.com

unread,
Dec 2, 2013, 2:33:45 PM12/2/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez, Richard W.M. Jones
ast login: Fri Jan 1 00:02:53 UTC 2010 on ttyS0
Linux Cubie 3.13.0-rc1-50636-g8d5d332-dirty #2 SMP Mon Dec 2 16:28:48 BRST 2013 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@Cubie:~# uname -a
Linux Cubie 3.13.0-rc1-50636-g8d5d332-dirty #2 SMP Mon Dec 2 16:28:48 BRST 2013 armv7l GNU/Linux
root@Cubie:~# ^C
root@Cubie:~# free -m


total used free shared buffers cached

Mem: 1007 49 958 0 6 22
-/+ buffers/cache: 20 987
Swap: 0 0 0
root@Cubie:~# cat /proc/cpuinfo


processor : 0
model name : ARMv7 Processor rev 4 (v7l)

Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae

CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 4

processor : 1
model name : ARMv7 Processor rev 4 (v7l)

Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae

ezaulz...@gmail.com

unread,
Dec 2, 2013, 2:34:41 PM12/2/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez, Richard W.M. Jones
U-Boot 2014.01-rc1-09128-gd4312a6 (Nov 30 2013 - 16:41:38) Allwinner Technology

CPU: Allwinner A20 (SUN7I)
Board: Cubieboard2
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: emac
Hit any key to stop autoboot: 0
** Unrecognized filesystem type **
** File not found boot/uEnv.txt **
** File not found uEnv.txt **
** Unrecognized filesystem type **
372 bytes read in 10 ms (36.1 KiB/s)
Jumping to boot.scr
## Executing script at 44000000
3654656 bytes read in 195 ms (17.9 MiB/s)
12651 bytes read in 15 ms (823.2 KiB/s)
## Booting kernel from Legacy Image at 46000000 ...
Image Name: Linux-3.13.0-rc1-50636-g8d5d332-
Created: 2013-12-02 18:28:51 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3654592 Bytes = 3.5 MiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 49000000
Booting using the fdt blob at 0x49000000
Loading Kernel Image ... OK
Using Device Tree in place at 49000000, end 4900616a

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 3.13.0-rc1-50636-g8d5d332-dirty (root@vbi7) (gcc version 4.7.2 (Debian 4.7.2-5) ) #2 SMP Mon Dec 2 16:28:48 BRST 2013
[ 0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Cubietech Cubieboard2
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] PERCPU: Embedded 5 pages/cpu @c0fa5000 s6976 r0 d13504 u32768
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260624
[ 0.000000] Kernel command line: console=tty0 console=ttyS0,115200 hdmi.audio=EDID:0 disp.screen0_output_mode=EDID:1280x800p60 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait panic=10
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 1031708K/1048576K available (4976K kernel code, 588K rwdata, 1412K rodata, 478K init, 284K bss, 16868K reserved, 270336K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xf0000000 - 0xff000000 ( 240 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xef800000 ( 760 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0645484 (6390 kB)
[ 0.000000] .init : 0xc0646000 - 0xc06bdb40 ( 479 kB)
[ 0.000000] .data : 0xc06be000 - 0xc0751200 ( 589 kB)
[ 0.000000] .bss : 0xc0751208 - 0xc0798514 ( 285 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] console [tty0] enabled
[ 0.000728] Calibrating delay loop... 1915.28 BogoMIPS (lpj=9576448)
[ 0.060044] pid_max: default: 32768 minimum: 301
[ 0.060222] Mount-cache hash table entries: 512
[ 0.063058] CPU: Testing write buffer coherency: ok
[ 0.063377] /cpus/cpu@0 missing clock-frequency property
[ 0.063409] /cpus/cpu@1 missing clock-frequency property
[ 0.063429] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.063549] Setting up static identity map for 0x404b5d70 - 0x404b5e08
[ 0.063684] unable to find compatible sirf rstc node in dtb
[ 0.076034] CPU1: Booted secondary processor
[ 0.134473] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.134587] Brought up 2 CPUs
[ 0.134635] SMP: Total of 2 processors activated.
[ 0.134648] CPU: All CPU(s) started in SVC mode.
[ 0.135425] devtmpfs: initialized
[ 0.139311] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4
[ 0.139583] pinctrl core: initialized pinctrl subsystem
[ 0.139963] regulator-dummy: no parameters
[ 0.140346] NET: Registered protocol family 16
[ 0.140749] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.144142] Serial: AMBA PL011 UART driver
[ 0.149137] bio: create slab <bio-0> at 0
[ 0.150296] edma-dma-engine edma-dma-engine.0: Can't allocate PaRAM dummy slot
[ 0.150344] edma-dma-engine: probe of edma-dma-engine.0 failed with error -5
[ 0.150543] reg-fixed-voltage ahci-5v.3: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/ahci_pwr_pin@0, deferring probe
[ 0.150578] platform ahci-5v.3: Driver reg-fixed-voltage requests probe deferral
[ 0.150719] vcc_3v3: 3300 mV
[ 0.151631] SCSI subsystem initialized
[ 0.152064] usbcore: registered new interface driver usbfs
[ 0.152118] usbcore: registered new interface driver hub
[ 0.152232] usbcore: registered new device driver usb
[ 0.152683] pps_core: LinuxPPS API ver. 1 registered
[ 0.152703] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giom...@linux.it>
[ 0.152740] PTP clock support registered
[ 0.152783] EDAC MC: Ver: 3.0.0
[ 0.153868] Switched to clocksource timer
[ 0.154478] Clockevents: could not switch to one-shot mode:
[ 0.154489] Clockevents: could not switch to one-shot mode: dummy_timer is not functional.
[ 0.154492] Could not switch to high resolution mode on CPU 1
[ 0.154535] dummy_timer is not functional.
[ 0.154548] Could not switch to high resolution mode on CPU 0
[ 0.161714] NET: Registered protocol family 2
[ 0.162319] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.162415] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.162546] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.162637] TCP: reno registered
[ 0.162659] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.162726] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.163015] NET: Registered protocol family 1
[ 0.163382] RPC: Registered named UNIX socket transport module.
[ 0.163407] RPC: Registered udp transport module.
[ 0.163421] RPC: Registered tcp transport module.
[ 0.163435] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.165515] bounce pool size: 64 pages
[ 0.173800] NFS: Registering the id_resolver key type
[ 0.173888] Key type id_resolver registered
[ 0.173909] Key type id_legacy registered
[ 0.174178] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.174206] io scheduler noop registered
[ 0.174220] io scheduler deadline registered
[ 0.174377] io scheduler cfq registered (default)
[ 0.176443] sunxi-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.223288] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.245296] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 33, base_baud = 1500000) is a U6_16550A
[ 0.788584] console [ttyS0] enabled
[ 0.792389] Serial: IMX driver
[ 0.796072] serial: Freescale lpuart driver
[ 0.800451] [drm] Initialized drm 1.1.0 20060810
[ 0.806666] Sunxi extensions to stmmac
[ 0.810504] Ring mode enabled
[ 0.813565] No HW DMA feature register supported
[ 0.818132] Normal descriptors
[ 0.821464] Wake-Up On Lan supported
[ 0.826199] libphy: stmmac: probed
[ 0.829615] eth0: PHY ID 00008201 at 1 IRQ 0 (stmmac-0:01) active
[ 0.835806] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.842338] ehci-platform: EHCI generic platform driver
[ 0.847673] ehci-omap: OMAP-EHCI Host Controller driver
[ 0.852955] ehci-orion: EHCI orion driver
[ 0.857040] SPEAr-ehci: EHCI SPEAr driver
[ 0.861102] tegra-ehci: Tegra EHCI driver
[ 0.865352] usbcore: registered new interface driver usb-storage
[ 0.872179] mousedev: PS/2 mouse device common for all mice
[ 0.878685] sdhci: Secure Digital Host Controller Interface driver
[ 0.884912] sdhci: Copyright(c) Pierre Ossman
[ 0.984466] [mmc]: sdc0 Probe: base:0xf0094000 irq:64 sg_cpu:f0096000(6eba4000) ret 0.
[ 0.992454] sdhci-pltfm: SDHCI platform and OF driver helper
[ 0.998741] usbcore: registered new interface driver usbhid
[ 1.004325] usbhid: USB HID core driver
[ 1.008453] TCP: cubic registered
[ 1.012321] NET: Registered protocol family 10
[ 1.017617] sit: IPv6 over IPv4 tunneling driver
[ 1.022924] Key type dns_resolver registered
[ 1.027452] Registering SWP/SWPB emulation handler
[ 1.033406] ahci-5v: 5000 mV
[ 1.036557] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 1.043604] Waiting for root device /dev/mmcblk0p1...
[ 2.485270] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 52, RTO !!
[ 2.555256] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 52, RTO !!
[ 2.925257] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 5, RTO !!
[ 2.933311] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 5, RTO !!
[ 2.941386] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 5, RTO !!
[ 2.949454] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 5, RTO !!
[ 4.794474] mmc0: new high speed SDHC card at address e624
[ 4.800328] isa bounce pool size: 16 pages
[ 4.804604] mmcblk0: mmc0:e624 SU08G 7.40 GiB
[ 4.878758] mmcblk0: p1
[ 5.089220] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[ 5.097412] VFS: Mounted root (ext4 filesystem) readonly on device 179:1.
[ 5.303204] devtmpfs: mounted
[ 5.306754] Freeing unused kernel memory: 476K (c0646000 - c06bd000)
INIT: version 2.88 booting
[info] Using makefile-style concurrent boot in runlevel S.
[....] Starting the hotplug events dispatcher: udevd[ 15.668160] udevd[152]: starting version 175
. ok
[....] Synthesizing the initial hotplug events...done.
[....] Waiting for /dev to be fully populated...[ 18.974663] random: nonblocking pool is initialized
done.
[....] Setting preliminary keymap...done.
[....] Setting parameters of disc: (none). ok
[....] Activating swap...done.
[ 38.924673] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
[....] Cleaning up temporary files... /tmp. ok
[....] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
done.
[....] Mounting local filesystems...done.
[....] Activating swapfile swap...done.
[....] Cleaning up temporary files.... ok
[....] Setting kernel variables ...done.
[....] Configuring network interfaces...done.
[....] Cleaning up temporary files.... ok
[info] Setting console screen modes.
setterm: cannot (un)set powersave mode: Inappropriate ioctl for device
[info] Skipping font and keymap setup (handled by console-setup).
[....] Setting up console font and keymap...done.
[....] Setting up X socket directories... /tmp/.X11-unix /tmp/.ICE-unix. ok
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting enhanced syslogd: rsyslogd. ok
speech-dispatcher disabled; edit /etc/default/speech-dispatcher
[....] Starting periodic command scheduler: cron. ok
[....] Starting system message bus: dbus. ok
[....] Starting network connection manager: NetworkManager. ok
[....] Starting bluetooth: bluetoothd rfcommCan't open RFCOMM control socket: Address family not supported by protocol
. ok
[....] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon. ok
saned disabled; edit /etc/default/saned
[....] PulseAudio configured for per-user sessions ... (warning).
[....] Starting GNOME Display Manager: gdm3. ok

Debian GNU/Linux 7 Cubie ttyS0

Chen-Yu Tsai

unread,
Dec 3, 2013, 4:44:34 AM12/3/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez
Hi Hans,


Note ethernet is currently broken on the cubietruck, I hope to
be able to fix that soon.

Ethernet on the cubietruck does not work under gigabit speeds.
However it does work with 10/100 Mbps.
This is true for both allwinner gmac and stmmac drivers.

I have no idea why this is, however gigabit does work under 3.4 kernel.

Assistance on this issue is much appreciated.

Regards,
Wens

Richard W.M. Jones

unread,
Dec 3, 2013, 7:39:51 AM12/3/13
to linux...@googlegroups.com
This kernel hangs at boot if the SATA drive is attached:

[ 1.408752] ahci-5v: 5000 mV
[ 1.412247] Lets probe!
[ 1.414780] device ahci allocated
[ 1.418102] got ahb_sata clk
[ 1.421066] got pll6_sata clk
[ 1.424035] device matched
[ 1.426825] got mem res
[ 1.429267] got irq res
[ 1.431733] registered resources
[ 1.434956] added data
<--- no more output after this, sometimes it actually powers off here

However, attaching the SATA drive *after* it has booted works fine:

[ 70.988823] ata1: exception Emask 0x10 SAct 0x0 SErr 0x4050002 action 0xe frozen
[ 70.996282] ata1: irq_stat 0x00000040, connection status changed
[ 71.002346] ata1: SError: { RecovComm PHYRdyChg CommWake DevExch }
[ 71.008562] ata1: hard resetting link
[ 74.037755] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 74.057830] ata1.00: ATA-8: ST250LM004 HN-M250MBB, 2AR10002, max UDMA/133
[ 74.064656] ata1.00: 488397168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[ 74.094004] ata1.00: configured for UDMA/133
[ 74.098409] ata1: EH complete
[ 74.103569] scsi 0:0:0:0: Direct-Access ATA ST250LM004 HN-M2 2AR1 PQ: 0 ANSI: 5
[ 74.149809] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
[ 74.157298] sd 0:0:0:0: [sda] 4096-byte physical blocks
[ 74.174434] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 74.218201] sd 0:0:0:0: [sda] Write Protect is off
[ 74.223009] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[ 74.258054] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 74.335536] sda: unknown partition table
[ 74.358529] sd 0:0:0:0: [sda] Attached SCSI disk

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

Hans de Goede

unread,
Dec 3, 2013, 8:56:40 AM12/3/13
to linux...@googlegroups.com
Hi,

On 12/03/2013 01:39 PM, Richard W.M. Jones wrote:
> This kernel hangs at boot if the SATA drive is attached:
>
> [ 1.408752] ahci-5v: 5000 mV
> [ 1.412247] Lets probe!
> [ 1.414780] device ahci allocated
> [ 1.418102] got ahb_sata clk
> [ 1.421066] got pll6_sata clk
> [ 1.424035] device matched
> [ 1.426825] got mem res
> [ 1.429267] got irq res
> [ 1.431733] registered resources
> [ 1.434956] added data
> <--- no more output after this, sometimes it actually powers off here
>
> However, attaching the SATA drive *after* it has booted works fine:

Sounds like your power-supply is not up to the task (or the usb-port
you're using to power the drive does not provide enough juice).

Try using an external 5v powersupply which can deliver up to 2a. Or
try using a less power-hungry disk (I use an ozc vertex 2 64 GB
ssd myself, which draws 0.35 A max).

Regards,

Hans

Hans de Goede

unread,
Dec 3, 2013, 6:05:44 PM12/3/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez
Hi,
I've been debugging this tonight, and I'm happy to report that I've found
the cause. The problem is the drive level for the io pins being to low,
by changing allwinner,drive = <0>; to allwinner,drive = <3>; in the
gmac section of un7i-a20.dtsi gigabit speeds will work.

While working on this I also noticed that stmmac_platform.c
does not set dma_cfg->burst_len, leaving it at 0. This should
be 8 for the A20 afaik. This means we will need a patch to get
this from devicetree.

Regards,

Hans

Chen-Yu Tsai

unread,
Dec 3, 2013, 10:10:44 PM12/3/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez, Hans de Goede
Hi,

On Wed, Dec 4, 2013 at 7:05 AM, Hans de Goede <hdeg...@redhat.com> wrote:
> I've been debugging this tonight, and I'm happy to report that I've found
> the cause. The problem is the drive level for the io pins being to low,
> by changing allwinner,drive = <0>; to allwinner,drive = <3>; in the
> gmac section of un7i-a20.dtsi gigabit speeds will work.

The drive strength was too low, and at high frequencies,
the clock or signals would get skewed or deteriorate, correct?

Thank you for finding this.

I pushed patches for u-boot and linux kernel support.

U-boot: https://github.com/wens/u-boot-sunxi/tree/sunxi-dw-gmac-cb2
This tree is based on jemk's work to get gmac working with dw driver.

Kernel: https://github.com/wens/linux/tree/sunxi-next-stmmac
Just a fixup for io pin drive levels over my previous tree.

> While working on this I also noticed that stmmac_platform.c
> does not set dma_cfg->burst_len, leaving it at 0. This should
> be 8 for the A20 afaik. This means we will need a patch to get
> this from devicetree.

dma_cfg->burst_len is for AXI bus mode. Allwinner code does not
touch this register. Safe to say that GMAC doesn't support it.

pbl, or DMA programmable burst length, is set in dma_cfg->pbl,
which itself is set from "snps,pbl" DT property.
The register contents match what is configured.

Also the driver sets the 4xPBL flag, so the correct value in DT is 2, not 8.
This is a minor issue, but it does lead to a bit of confusion.


Regards,
Wens

Hans de Goede

unread,
Dec 4, 2013, 4:36:05 AM12/4/13
to Chen-Yu Tsai, linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez
Hi,

On 12/04/2013 04:10 AM, Chen-Yu Tsai wrote:
> Hi,
>
> On Wed, Dec 4, 2013 at 7:05 AM, Hans de Goede <hdeg...@redhat.com> wrote:
>> I've been debugging this tonight, and I'm happy to report that I've found
>> the cause. The problem is the drive level for the io pins being to low,
>> by changing allwinner,drive = <0>; to allwinner,drive = <3>; in the
>> gmac section of un7i-a20.dtsi gigabit speeds will work.
>
> The drive strength was too low, and at high frequencies,
> the clock or signals would get skewed or deteriorate, correct?

Correct.

>
> Thank you for finding this.
>
> I pushed patches for u-boot and linux kernel support.
>
> U-boot: https://github.com/wens/u-boot-sunxi/tree/sunxi-dw-gmac-cb2
> This tree is based on jemk's work to get gmac working with dw driver.

Thanks for also working on u-boot support for the gmac. Ive one remark
about this commit:
https://github.com/wens/u-boot-sunxi/commit/e3218cdee7feaf9f4a212b8fc8ab52fe493bf5cd

Checking for a specific board in generic code like this is not
acceptable IMHO. Instead you should add a new CONFIG_ define,
ie CONFIG_RGMII_PHY or some such, add that to the cubie truck
line in bpards.cfg, and use the RGMII settings if that is set.

This should also help switching other A20 boards over to using
the GMAC driver, ie the olinuxio A20 board.

Regards,

Hans

Eddy Beaupré

unread,
Dec 4, 2013, 7:31:21 AM12/4/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez, Richard W.M. Jones
There must be something i'm not doing right. The kernel won't boot. Here's how i compile it:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOADADDR=0x40008000 make uImage dtbs

<copy uImage and cubietruck.dtb to sd card>

And to boot it i do:

ext2load mmc 0 0x46000000 /boot/uImage
ext2load mmc 0 0x49000000 /boot/sun7i-a20-cubietruck.dtb
env set fdt_high ffffffff
bootm 0x46000000 - 0x49000000

Here's the log i get :

U-Boot 2014.01-rc1-09128-gd4312a6 (Nov 30 2013 - 18:36:18) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Board: Cubietruck
I2C:   ready
DRAM:  2 GiB

MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   emac
Hit any key to stop autoboot:  0
sun7i# ext2load mmc 0 0x46000000 /boot/uImage
5191680 bytes read in 272 ms (18.2 MiB/s)
sun7i# ext2load mmc 0 0x49000000 /boot/sun7i-a20-cubietruck.dtb
12816 bytes read in 20 ms (625 KiB/s)
sun7i# env set fdt_high ffffffff
sun7i# bootm 0x46000000 - 0x49000000

## Booting kernel from Legacy Image at 46000000 ...
   Image Name:   Linux-3.13.0-rc2+
   Created:      2013-12-04  11:39:01 UTC

   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5191616 Bytes = 5 MiB

   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 49000000
   Booting using the fdt blob at 0x49000000
   Loading Kernel Image ... OK
   Using Device Tree in place at 49000000, end 4900620f

Starting kernel ...




Hans de Goede

unread,
Dec 4, 2013, 7:55:11 AM12/4/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez, Richard W.M. Jones
Hi,

On 12/04/2013 01:31 PM, Eddy Beaupr� wrote:
> There must be something i'm not doing right. The kernel won't boot. Here's how i compile it:
>
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOADADDR=0x40008000 make uImage dtbs
>
> <copy uImage and cubietruck.dtb to sd card>
>
> And to boot it i do:
>
> ext2load mmc 0 0x46000000 /boot/uImage
> ext2load mmc 0 0x49000000 /boot/sun7i-a20-cubietruck.dtb
> env set fdt_high ffffffff
> bootm 0x46000000 - 0x49000000

Here is the boot cmds I'm using, notice the setting of bootargs,
which is necessary both to get output on the serial port,
as well as to help the kernel find its rootfs:

env set fdt_high ffffffff
ext2load mmc 0 0x46000000 uImage.new
ext2load mmc 0 0x49000000 dtb
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p3 ro rootwait
bootm 0x46000000 - 0x49000000

Regards,

Hans

Chen-Yu Tsai

unread,
Dec 4, 2013, 10:05:34 AM12/4/13
to linux...@googlegroups.com, Hans de Goede, David Lanzendörfer, Emilio Lopez, Jens Kuske
Hi,

>> U-boot: https://github.com/wens/u-boot-sunxi/tree/sunxi-dw-gmac-cb2
>> This tree is based on jemk's work to get gmac working with dw driver.
> Thanks for also working on u-boot support for the gmac. Ive one remark
> about this commit:
> https://github.com/wens/u-boot-sunxi/commit/e3218cdee7feaf9f4a212b8fc8ab52fe493bf5cd
>
> Checking for a specific board in generic code like this is not
> acceptable IMHO. Instead you should add a new CONFIG_ define,
> ie CONFIG_RGMII_PHY or some such, add that to the cubie truck
> line in bpards.cfg, and use the RGMII settings if that is set.

I see some SoCs using CONFIG_RMII or CONFIG_RGMII.

Here's version 2 of the patch series:
https://github.com/wens/u-boot-sunxi/tree/sunxi-gmac-v2

Changes:
- MII/RGMII mode is now based on config option
https://github.com/wens/u-boot-sunxi/commit/604c4ca1c1fb9d65d7d69c85fa071ff6bac996bc
- Don't select GNULL pins under RGMII mode (issue raised by torbenh3)
https://github.com/wens/u-boot-sunxi/commit/2f1dede182f3d136746221a5da3e3670e66622eb
- Reordered patches


Regards,

Wens

Richard W.M. Jones

unread,
Dec 4, 2013, 11:38:10 AM12/4/13
to Eddy Beaupré, linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez
On Wed, Dec 04, 2013 at 04:31:21AM -0800, Eddy Beaupr� wrote:
> There must be something i'm not doing right. The kernel won't boot. Here's
> how i compile it:
>
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOADADDR=0x40008000 make
> uImage dtbs
>
> <copy uImage and cubietruck.dtb to sd card>
>
> And to boot it i do:
>
> ext2load mmc 0 0x46000000 /boot/uImage
> ext2load mmc 0 0x49000000 /boot/sun7i-a20-cubietruck.dtb
> env set fdt_high ffffffff
> bootm 0x46000000 - 0x49000000

The obvious thing missing are any boot arguments, which likely means
your kernel output is going to a non-existent tty or /dev/null. I use:

setenv bootargs console=ttyS0,115200 loglevel=9 earlyprintk ro rootwait root=/dev/mmcblk0p3

What I also suggest is that you compile the kernel with
CONFIG_DEBUG_LL and CONFIG_EARLY_PRINTK.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones

Alejandro Mery

unread,
Dec 4, 2013, 5:37:13 PM12/4/13
to linux...@googlegroups.com
hi, would you mind commiting it as a defconfig for the sake of the
nightlies? ;-)

http://dl.linux-sunxi.org/nightly/linux-sunxi/linux-sunxi-hansg-test/
http://dl.linux-sunxi.org/nightly/linux-sunxi/linux-sunxi-hansg-test-sunxi_full/

cheers!
Alejandro

Eddy Beaupré

unread,
Dec 4, 2013, 6:33:31 PM12/4/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez, Richard W.M. Jones


On Wednesday, December 4, 2013 7:55:11 AM UTC-5, Hans de Goede wrote:
Hi,


Yay! It work... Now i feel ashame for not figuring the bootargs all by myself... Thanks

Hans de Goede

unread,
Dec 5, 2013, 3:12:10 AM12/5/13
to linux...@googlegroups.com
Hi,

On 12/04/2013 11:37 PM, Alejandro Mery wrote:
> On 02/12/13 19:31, Hans de Goede wrote:
>> Hi,
>>
>> On 12/02/2013 06:10 PM, Richard W.M. Jones wrote:
>>> On Mon, Dec 02, 2013 at 03:25:55PM +0100, Hans de Goede wrote:
>>>> https://github.com/jwrdegoede/linux-sunxi/commits/sunxi-test
>>>
>>> Hans,
>>>
>>> Do you have a suggested .config for use with this kernel?
>>
>> I use the attached config (which is taken from the Fedora F-20
>> arm kernels + the new sunxi bits enabled.
>>
>>> Also, do you compile with modules enabled? And if so how do you
>>> prepare an initramfs?
>>
>> It does use modules, but I've made everything necessary to find
>> the rootfs (be it sata or mmc) built-in, so no initramfs is needed.
>>
>> Regards,
>>
>> Hans
>>
>> p.s.
>>
>> Note ethernet is currently broken on the cubietruck, I hope to
>> be able to fix that soon.
>>
>
> hi, would you mind commiting it as a defconfig for the sake of the nightlies? ;-)

No I would not mind, but I need a bit of the cluebat as to how to do that ...

Regards,

Hans

Michal Suchanek

unread,
Dec 6, 2013, 3:26:54 PM12/6/13
to linux-sunxi, Hans de Goede, David Lanzendörfer, Emilio Lopez, Jens Kuske
I can boot over NFS with this one on CT with Gbit network.

Thanks

Michal

Eddy Beaupré

unread,
Dec 8, 2013, 11:17:14 PM12/8/13
to linux...@googlegroups.com, David Lanzendörfer, Emilio Lopez, Richard W.M. Jones
Since i'm lazy and about sure i will foget one day how to boot it, i ended up with a few lines to add to uEnv.txt to setup everything:

uEnv.txt:
setaddr=if test -z \\"$dtb\\"; then kernel_loadaddr=0x48000000; else kernel_loadaddr=0x46000000 && dtb_loadaddr=0x49000000 && extrabootm="- ${dtb_loadaddr}" && fdt_high=ffffffff; fi
loadscript
=if ext2load $device $partition 0x43000000 ${bootpath}script.bin; then true; elif fatload $device $partition 0x43000000 ${bootpath}script.bin; then true; else false; fi
loadkernel
=if ext2load $device $partition ${kernel_loadaddr} ${bootpath}${kernel}; then true; elif fatload $device $partition ${kernel_loadaddr} ${bootpath}${kernel}; then true; else false; fi
loaddtb
=if test -z \\"$dtb\\"; then true; elif ext2load $device $partition ${dtb_loadaddr} ${bootpath}${dtb}; then true; elif fatload $device $partition ${dtb_loadaddr} ${bootpath}${dtb}; then true; else false; fi;
autoboot
=run setaddr && run loadscript && run loadkernel && run loaddtb && run setargs && bootm ${kernel_loadaddr} ${extrabootm}
bootpath
=/boot/



So when i want to use a kernel that need a dtb, all i have to do is set those two lines in uEnv.txt.

kernel
=uImage-3.13.0-rc2+
dtb
=dtbs/sun7i-a20-cubietruck.dtb



If dtb is not defined, u-boot load the kernel like it used to at 0x48000000. If dtb is defined, it ajust the address and load it. It's not the most elegant solution, but it work well. That's what i use in my armStrap script to setup SD. I've test it on the CubieBoard, CubieBoard2 and CubieTruck and so far so good. I can switch between the two types of kernel.


marco.aurel...@gmail.com

unread,
Jul 22, 2014, 11:08:12 AM7/22/14
to linux...@googlegroups.com, david.lan...@o2s.ch, emi...@elopez.com.ar, rjo...@redhat.com
Hi Hans,

Do you have other links to work with kvm on cubieboard2?

Regards,

Marco Aurelio

Richard W.M. Jones

unread,
Jul 22, 2014, 11:30:37 AM7/22/14
to marco.aurel...@gmail.com, linux...@googlegroups.com, david.lan...@o2s.ch, emi...@elopez.com.ar

Please don't keep sending this email. I also deleted the same
comment that you put on my blog. If someone knows, they will
reply. If they don't, sending the message 4 times will not help.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Reply all
Reply to author
Forward
0 new messages