Skip to content

Instantly share code, notes, and snippets.

@bradfa
Last active October 20, 2017 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradfa/63302c3b82a4b514c0a709e8e0ff78a0 to your computer and use it in GitHub Desktop.
Save bradfa/63302c3b82a4b514c0a709e8e0ff78a0 to your computer and use it in GitHub Desktop.
Renesas RZ/A1 Notes

I have an Avnet/Architech Hachiko board without SDRAM. It uses RZ/A1H R7S72100 with 10 MB SRAM SoC in QFP package. I want to run mainline U-Boot and Linux on it.

Vendor documentation on the board: http://architechboards-hachiko-tiny.readthedocs.io/en/latest/ and http://downloads.architechboards.com/doc/Hachiko/download.html

BSP that came with it from the vendor used patches to U-Boot and Linux provided in: https://github.com/bradfa/meta-hachiko

It seems there's some amount of support in mainline Linux for RZ/A1 but I'm not sure how much. It's unclear to me how much support there is in mainline U-Boot. Either way, I want to run mainline on this board as I want to learn and if needed, contribute code upstream.

General Notes

  • The Hachiko board seems to be really poorly designed for use as a code development tool :(
  • elinux.org has some good info on the Peach board: http://elinux.org/RZ-A/Boards/GR-PEACH-mainline and http://elinux.org/RZ-A/Boards/GR-PEACH-bsp both rely on using a Segger J-Link to program the QSPI flash (which we can probably also do for Hachiko).
  • There's no push-button reset on the board but ~RESET is brought out to connector CN5-4 and it's right between ground pins so we can use that. Although actually using it results in a very strange reset condition as some parts of the board seem to turn off while others stay on leading to the board not booting after a reset low is applied...
  • The FTDI FT232RL that's on the board is annoyingly wired as the VBUS that comes into the USB port to the FTDI also will provide power to the rest of the board. Isolating this FTDI that it stays on while the board is off doesn't appear to be easy to do. But we can remove resistors R15 and R17 and wire in our own 3.3 V UART interface on the resistors' pads with an external FTDI (or similar). You can fix this! ;) http://www.bradfordembedded.com/2017/07/hachiko-uart-sanity-rework
  • Programming the SPI flash parts with an external programmer will require holding the board in reset and lifting the SPI flash pin 3 ~RESET pin from the board as there's no isolation of the SPI flash parts' power or reset lines. So realistically, the only way to program the SPI flash is to get u-boot into SRAM and run it so we can download and write to flash, or to use JTAG (Renesas has a semi-hosting document which seems annoying to follow: http://downloads.architechboards.com/hachiko/doc/RZ_A1H_sflash_sample_rev0.01e.pdf )
  • There's very little silkscreen to indicate reference designators on the board, so matching up physical components with schematic refdes is annoying.

U-Boot Notes

  • U-Boot newer than v2017.01 (ie: 2017.05 and current master branch) have a hard time dealing with non-standard CROSS_COMPILE environment variables, it seems. My normal arm-ka-linux-gnueabi- value ends up with u-boot Makefile getting all messed up and failing to build some fdt tools. Using the Debian provided arm-linux-gnueabi-gcc toolchain and binutils seems to fix it.
  • Most Renesas ARM parts appear to use the "rmobile" name/brand in U-Boot.
  • R7S72100 Ethernet MAC has support in drivers/net/sh_eth.{c,h} since v2014.07 release but doesn't seem to have any users of SH_ETH_TYPE_RZ as of today.
  • Found a note from Anantha at PHYTECH (https://renesasrulz.com/rz/f/rz---forum/7978/sdcard-booting) which said that they are writing the "loader program" (I think) to the SD card with sudo dd if=u-boot.bin of=/dev/sdb seek=117 bs=512 conv=fsync. They are then told to try the Renesas vkrza1h_sdhi program to create a bootable SD card. Seeking to offset 117 is very similar to how some TI SoC boot from SD card...
  • Renesas has a set of patches (commits) on top of u-boot 2017.05 available here: https://github.com/renesas-rz/rza_u-boot-2017.05 but looking through some of the code, it doesn't seem like the way it is implemented will be upstreamable without some work.

Linux Notes

  • Linux 4.12 seems to have MMC/SD support for R7S72100, and there's some amount of device tree files for at least one R7S72100 board with what looks like external SDRAM.
  • The ArchiTech provided u-boot and Linux load Linux into SRAM and execute from SRAM but the device tree is referenced directly from QSPI. The provided Linux is loaded uncompressed into SRAM and is only 1.4 MB in size, which is quite decently small.
  • When building a non-multiplatform non-LPAE ARM kernel, CONFIG_XIP_KERNEL setting allows building an XIP Linux kernel with make xipImage. You must provide the CONFIG_XIP_PHYS_ADDR address at which the kernel will be stored to flash within the SoC's memory map. This would be useful for running from QSPI, especially on the RZ/A1L parts.

TODO:

  1. Figure out how to boot from SD card on Hachiko board. Renesas official SoC docs do not specify in detail how to setup the SD card, but they do specify how the ROM code acts before and after loading the "loader program" 28 kiB file from the SD card into SRAM.
  2. Fix non-standard CROSS_COMPILE (but still valid!) ftd tools build failures in U-Boot?
  3. Figure out how to wire up a reset button on Hachiko board. (This is actually really annoying due to the way the reset controller is setup.)
U-Boot 2013.04-RZLSP-V2.0.0-g3e59aa2 (Mar 11 2014 - 09:48:13)
I2C: ready
DRAM: 10 MiB
SF: Detected S25FL512S with page size 512, total 64 MiB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
riic_wait_for_icsr2: Timeout!(bit = 4 icsr2 = 0, iccr2 = 2)
riic_wait_for_icsr2: Timeout!(bit = 8 icsr2 = 0, iccr2 = 2)
Net: sh_eth
Hit any key to stop autoboot: 0
(Re)start USB...
USB0: check_usb_device_connecting timeout.
scanning bus 0 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
** Bad device usb 0 **
** Bad device usb 0 **
## Booting kernel from Legacy Image at 180c0000 ...
Image Name: Linux-3.8.13-RZLSP-V2.0.0-g08256
Created: 2014-03-11 8:48:37 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1461264 Bytes = 1.4 MiB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 184c0000
Booting using the fdt blob at 0x184c0000
Loading Kernel Image ... OK
OK
Loading Device Tree to 208f0000, end 208f312b ... OK
Starting kernel ...
Booting Linux on physical CPU 0x0
Linux version 3.8.13-RZLSP-V2.0.0-g08256ff (carlo@satan) (gcc version 4.7.3 20130102 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.01-20130125 - Linaro GCC 2013.01) ) #4 PREEMPT Tue Mar 11 09:48:36 CET 2014
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=58c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: hachiko, model: HACHIKO
debug: ignoring loglevel setting.
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 2560
free_area_init_node: node 0, pgdat c0248564, node_mem_map c0272000
Normal zone: 20 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 2540 pages, LIFO batch:0
bootconsole [early_ttySC3] enabled
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 2540
Kernel command line: console=ttySC3,115200 root=/dev/mtdblock4 rw rootfstype=jffs2 ignore_loglevel earlyprintk=sh-sci.3,115200 init=/init
PID hash table entries: 64 (order: -4, 256 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
__ex_table already sorted, skipping sort
Memory: 10MB = 10MB total
Memory: 7560k/7560k available, 2680k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc1000000 - 0xff000000 ( 992 MB)
lowmem : 0xc0000000 - 0xc0a00000 ( 10 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf800000 - 0xbfe00000 ( 6 MB)
.text : 0xc0008000 - 0xc02114cc (2086 kB)
.init : 0xc0212000 - 0xc02256c8 ( 78 kB)
.data : 0xc0226000 - 0xc0249000 ( 140 kB)
.bss : 0xc0249000 - 0xc0271178 ( 161 kB)
NR_IRQS:16 nr_irqs:16 16
sched_clock: 32 bits at 128 Hz, resolution 7812500ns, wraps every 3489660920ms
Console: colour dummy device 80x30
sh_mtu2.0: used for clock events
sh_mtu2.0: used for periodic clock events
Calibrating delay loop... 798.24 BogoMIPS (lpj=3117056)
pid_max: default: 4096 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x20199ac8 - 0x20199af8
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
(null): vdc5fb.0: channel 0 is turned off
(null): vdc5fb.1: channel 1 is turned off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 16
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
SuperH SCI(F) driver initialized
sh-sci.0: ttySC0 at MMIO 0xe8007000 (irq = 223) is a scif
console [ttySC3] enabled, bootconsole disabled
console [ttySC3] enabled, bootconsole disabled
sh-sci.1: ttySC1 at MMIO 0xe8007800 (irq = 227) is a scif
sh-sci.2: ttySC2 at MMIO 0xe8008000 (irq = 231) is a scif
sh-sci.3: ttySC3 at MMIO 0xe8008800 (irq = 235) is a scif
sh-sci.4: ttySC4 at MMIO 0xe8009000 (irq = 239) is a scif
sh-sci.5: ttySC5 at MMIO 0xe8009800 (irq = 243) is a scif
sh-sci.6: ttySC6 at MMIO 0xe800a000 (irq = 247) is a scif
sh-sci.7: ttySC7 at MMIO 0xe800a800 (irq = 251) is a scif
rspi rspi.0: master is unqueued, this is deprecated
rspi rspi.0: probed
rspi rspi.1: master is unqueued, this is deprecated
rspi rspi.1: probed
rspi rspi.2: master is unqueued, this is deprecated
rspi rspi.2: probed
rspi rspi.3: master is unqueued, this is deprecated
rspi rspi.3: probed
rspi rspi.4: master is unqueued, this is deprecated
rspi rspi.4: probed
m25p80 spi5.0: s25fl512s (65536 Kbytes)
Creating 5 MTD partitions on "m25p80":
0x000000000000-0x000000080000 : "spibsc0_loader"
0x000000080000-0x0000000c0000 : "spibsc0_bootenv"
0x0000000c0000-0x0000004c0000 : "spibsc0_kernel"
0x0000004c0000-0x000000500000 : "spibsc0_dtb"
0x000000500000-0x000004000000 : "spibsc0_rootfs"
spibsc spibsc.0: probed
spibsc spibsc.1: probed
CAN device driver interface
rz_can rz_can.0: device registered (clock: 33325000, ch: 1, k_tx: 4, k_rx: 3)
libphy: sh_mii: probed
Base address at 0xe8203000, 10:00:00:00:00:00, IRQ 359.
r8a66597_hcd r8a66597_hcd.0: USB Host Controller
r8a66597_hcd r8a66597_hcd.0: new USB bus registered, assigned bus number 1
r8a66597_hcd r8a66597_hcd.0: irq 73, io base 0xe8010000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
r8a66597_hcd r8a66597_hcd.1: USB Host Controller
r8a66597_hcd r8a66597_hcd.1: new USB bus registered, assigned bus number 2
r8a66597_hcd r8a66597_hcd.1: irq 74, io base 0xe8207000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
i2c-riic i2c-riic.0: version 2013-04-19: 100[kbps]
i2c-riic i2c-riic.1: version 2013-04-19: 100[kbps]
i2c-riic i2c-riic.3: version 2013-04-19: 100[kbps]
sh_mobile_sdhi sh_mobile_sdhi.0: Runtime PM disabled, clock forced on.
sh_mobile_sdhi sh_mobile_sdhi.0: mmc0 base at 0xe804e000 clock rate 66 MHz
sh_mmcif sh_mmcif: Runtime PM disabled, clock forced on.
sh_mmcif sh_mmcif: driver version 2010-04-28
sh_pfc gpio: Cant find gpio chip
sh_mtu2 sh_mtu2.0: kept as earlytimer
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
sh_adc sh_adc.0: version 2013-06-12
TCP: cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
VFS: Mounted root (jffs2 filesystem) on device 31:4.
devtmpfs: mounted
Freeing init memory: 76K
mount: mounting none on /dev failed: Device or resource busy
ifup: interface lo already configured
/ #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment