U-Boot on Raspberry Pi, step 4: DWC OTG, Control transactions

After rather busy weekend I finally got control transaction support for DWC OTG controller working on Raspberry Pi. U-Boot DWC OTG driver is cut-down version of Linux driver that works in polling mode. Stability is not very good at the moment though. And make sure to use latest firmware files. It does matter. Next step - bulk transactions. Repo: https://github.com/gonzoua/u-boot-pi Raspberry-Pi # usb info 1: Hub, USB Revision 1.10 - DWC OTG RootHub - Class: Hub - PacketSize: 8 Configurations: 1 - Vendor: 0x0000 Product 0x0000 Version 0.0 Configuration: 1 - Interfaces: 1 Self Powered 0mA Interface: 0 - Alternate Setting 0, Endpoints: 1 - Class Hub - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms 2: Hub, USB Revision 2.0 - Class: Hub - PacketSize: 64 Configurations: 1 - Vendor: 0x0424 Product 0x9512 Version 2.0 Configuration: 1 - Interfaces: 1 Self Powered Remote Wakeup 2mA Interface: 0 - Alternate Setting 0, Endpoints: 1 - Class Hub - Endpoint 1 In Interrupt MaxPacket 1 Interval 255ms 3: Vendor specific, USB Revision 2.0 - Class: Vendor specific - PacketSize: 64 Configurations: 1 - Vendor: 0x0424 Product 0xec00 Version 2.0 Configuration: 1 - Interfaces: 1 Self Powered Remote Wakeup 2mA Interface: 0 - Alternate Setting 0, Endpoints: 3 - Class Vendor specific - Endpoint 1 In Bulk MaxPacket 64 - Endpoint 2 Out Bulk MaxPacket 64 - Endpoint 3 In Interrupt MaxPacket 16 Interval 1ms

June 12, 2012 · 2 min · 233 words · Oleksandr Tymoshenko

R-Pi Boot process

Just a note to myself to keep useful info. Bakul Shah in freebsd-arm quotes R-Pi forum, but I failed to find original. Stage 1 boot is in the on-chip ROM. Loads stage2 in the L2 cache! Stage 2 is bootcode.bin. Enables SDRAM and loads stage3 Stage 3 is loader.bin. Knows about elf format and load start.elf start.elf loads kernel.img (+ it is the main gpu code). It reads config.txt, cmdline.txt and bcm2835.dtb If the dtb file exists, it is loaded at 0x100 & kernel @ 0x8000 Else if disable_commandline_tags is set load kernel @ 0x0 Else if load kernel @ 0x8000 and put ATAGS at 0x100 See Issue 16 in https://github.com/raspberrypi/linux/issues kernel.img, is the first thing that runs on the ARM processor. And more information on config.txt here

June 4, 2012 · 1 min · 128 words · Oleksandr Tymoshenko

U-Boot for Raspberry Pi, step 3

Finally I received my female/male cables for inter-board connects (my soldering skill is close to zero) and got FTDI-based TTL/USB converter work. I had more luck with it then with my old trusty TTL/RS232 converter. No garbage in linux output, serial input works for u-boot. You can find content of boot partition of SD-card I use here. Fully functional serial port means that boot-over-serial should work and I do not need to move SD-card between R-Pi and card reader to get new version of u-boot running. So based on this post I managed to automate compile/run/fix cycle to some extent. Not C-Kermit expert here, so the script is lame but it does its work: ...

June 3, 2012 · 2 min · 285 words · Oleksandr Tymoshenko

U-Boot for Raspberry Pi, step 2

I had some issues with console output from U-Boot on my R-Pi but Alexander Rybalko submitted patch that seems to fix them. One more issue that needed to be resolved: mysterious hangs in relocate_code. Some digging revealed that system hangs once PC reaches address 0x100. Some more digging yielded that at this address is used by GPU part of loader to store arguments for kernel. So after tweaking .text offset for u-boot and generating proper image using this tool I finally got: ...

May 26, 2012 · 1 min · 209 words · Oleksandr Tymoshenko

FreeBSD on Raspberry Pi: baby steps

Thanks to Robert Watson I got my hands on brand new raspberry pi device (model B) and now trying to get FreeBSD running on it. That turned out to be non-trivial task. For one - there is no way to netboot the board. At least I failed to find it. It seems that initial Linux bring-up was done on evaluation modules with proper bootloader, JTAG support and whatnot and for public use limited boot loader was released. So instead porting FreeBSD on it I face the task of porting U-Boot. Which is not something entirely impossible. ...

May 21, 2012 · 2 min · 346 words · Oleksandr Tymoshenko

FreeBSD on ARM devices

Damjan Marion published nice how-to for getting FreeBSD running on BeagleBone. Using it I managed to get my PandaBoard ES running off SD card. The only modifications to this instructions are: Use PANDABOARD kernel config. Stock version is configured to use NFS so it should be modified to use SD card as root. MLO and u-boot.bin binaries are different. I used these. You’ll need boot.scr too. Performance is still affected by using write-through caches by default, but this issue should be fixed soon. ...

April 19, 2012 · 8 min · 1521 words · Oleksandr Tymoshenko

Flyswatter JTAG and AVR32

Today I soldered AVR32 adapter for Flyswatter JTAG. Actually it’s very simple task - just connect respective pins and make common ground wire. No capacitors, resistors or MOSFETs. Idea was to make it nice and neat but having bought wrong breadboard and soldered first headers in a wrong place I just let it flow and here it is: From aesthetics point of view suck, but it also works and it’s everything I need: ...

August 9, 2010 · 1 min · 100 words · Oleksandr Tymoshenko

Minor OpenOCD fixes

Back from the land of GUI software. I have bought one more Flyswatter JTAG recently and now have two boards connected to my home box. Unfortunately both Flyswatters got the same USB serial number so stock openocd opens only the first device it stumbles upon. Here is small patch that adds ft2232_index command to OpenOCD FTDI driver that allows to point at specific device to open. Works only with libftdi. In the same directory you can find my configs for AR71XX-based RouterStation Pro and Portwell’s CAM-0010 device based on Octeon CN3010

July 6, 2010 · 1 min · 91 words · Oleksandr Tymoshenko

Writing FreeBSD NIC driver

I’ve been through writing NIC driver 2.5 times. 0.5 was porting ADM5120 switch driver by Ruslan Ermilov and Vsevolod Lobko from NetBSD. The usual routine for this kind of thing is “take existing driver and rewrite it”, e.g. copy selected parts or remove unnecessary ones. So I decided that it would be nice to skip “remove” part of procedure next time. All cards I had to deal with (“both” wouldn’t be that impressive here) had similar design save for registers layout and some quirks. I believe that vast majority of NICs have the same design to some extent: there are circular RX/TX rings of more or less similar structure, interrupt status/mask register, media settings registers, you name it. Not a rocket science. ...

February 19, 2010 · 1 min · 193 words · Oleksandr Tymoshenko

FreeBSD/MIPS & clang/LLVM

Now I know a little bit more about clang. I can’t say it’s quite useful for MIPS yet, but it’s nice to see some progress in this field. My findings might be inaccurate and any corrections are welcome. No proper cross-compilation so far. Clang team plans to do it “right way” but so far it’s just an item on their ToDo list: Universal driver. There are command-line options like -ccc-host-triple to get target assembler code, but names for assembler/linker are hardcoded to as/ld, which puts some restriction on building target toolchain UPD: -ccc-host-triple does the trick OK ...

January 18, 2010 · 2 min · 259 words · Oleksandr Tymoshenko