Flameman/dht-walnut

For more interesting projects done by Flameman, be sure to check out his project index

= DHT-Walnut-Flameman =

Note
This project is deprecated, RIP. Jtag software is also deprecated, vendor removed the support for amcc44x.

Introduction
The Target-goal of this page is
 * install gentoo-ppc32 into harddisk
 * make the board able to boot from it
 * describe how to build a jtag cable (to debug and recover from "Brickage")
 * describe something useful with you can do with the board
 * describe other Operating System available for the board

logical steps about installing gentoo
 * add the JTAG connector at J10 (you could skip it, it is suggested)
 * build the JTAG cable (you could skip it, it is suggested))
 * replace the bootloader with ppcboot 1.1.6/U-boot 1.1.4
 * make partitions on the Hard Disk
 * populate them
 * set the bootloader environment to boot from the Hard Disk

People you could contact if you need help
Please let me know of any success or issues you encounter. carlojpisani@gmail.com

About the board
DHT-Walnut is a shortened name for the Digital Home Technologies PCB 01070201 Rev. 1.1.

The DHT-Walnut board is based on the AMCC-Walnut (still available, and still expensive :P). It is a more improved board described at www.amcc.com.

A "walnut" searching will inform about schematic and software.

Also keep attention @ DENX: they  have developed a lot for the AMCC-Walnut board, and you could find a linux patch for your problem, prettier documentation, developer suit, and much more: in case, you are suggested to have a look to their web pages.

you could find it on ebay, search for "walnut", or "powerpc"

MIND UP the differences between "DHT WALNUT" and "AMCC WALNUT" (ALSO CALLED "IBM WALNUT")

Overview
The board consists of:


 * CPU PowerPC 405GP running at 266mhz
 * RAM PC133 SDRAM slot, currently, only supports single sidded DIMMs
 * LAN On-chip 405GP ethernet, board doesn't have an ethernet MAC address (the monitor/bootloader is able to fix it)
 * UART DCE serial port, speeds up to 230k, only tested to 115200bps
 * PCI two pci slots, keyed for 5V only cards
 * IDE Promise Technologies PDC20265 IDE
 * ROM 512k of boot flash, AMD 29LV040B (amd29lv040b.pdf), soldered on the PCB, if you like to use a socket you have to consider the bootloader will check for the flash manufactor ID, so or you replace the 29LV040B with an other socked-29LV040B, or you have to modify the bootloader
 * POWER the board need to be 12v dc powered 2A max, it is able to feed the hard disk
 * System PCB 6.00" x 7.5" board size
 * RTC the real time clock chip is missing
 * RAM 32M PC133 SDRAM DIMM, the board has issues with more than 128M: if you inspect the pcb, you will see that the DIMM connector has same pin missing, this is the reason why you can't use DIMM bigger than 128M
 * PCI IEEE-1394 card supported by OHCI driver
 * PCI additional ethernet board needed cause the on board ethernet is implemented by the IBM-ppc-405GP, for example netbsd is not able to drive it, so in case you need an additional board, the one provided with DHT is good enough
 * FIRMWARE PPCBoot v.1.1.2 in flash (it has issues with environment, it need to be replaced with a gooder one)

Memory Locations
memory map of the board will be added as soon as possible

Memory Area   Address Range Mapped   Size  Number of Level 2 pages ---    Local Memory   0 - Ram size           32MB  8 PCI Memory    0x80000000-0x83FFFFFF  64MB  16 PCI IO Regn 1 0xE8000000-0xE800FFFF  64K   1 PCI IO Regn 2 0xE8800000-0xE88FFFFF  1MB   1 PCI CFG       0xEEC00000-0xEEC00FFF  4K    1 PCI IACK      0xEED00000-0xEED00FFF  4K    0 * PP Bridge     0xEF400000-0xEF400FFF  4K    1 UART IO Space 0xEF600000-0xEF600FFF  4K    0 * NVRAM Space   0xF0000000-0xF0001FFF  8K    1 (only on ibm-walnut) Flash         0xFFF80000-0xFFFFFFFF  512K  1

the u-boot image "sits" at the end of the flash, the 4xx PPC's boot from location 0xfffffffc, so the bootloader needs to be located at the end, so if u-boot is 256kbyte then it is located 0xfffc0000 ... 0xffffffff

the dht-walnut flash memory mapped, it's mapped via the 405gp EBC (external bus controller)

...

about the memory & the MMU
PowerPC Architecture - Memory Management Unit (MMU)

The PowerPC 405 supports 4 GB of flat (non-segmented) address space. The Memory Management Unit (MMU) provides Address Translation, Protection Functions, and Storage Attribute Control for this address space. The MMU supports demand-paged virtual memory using multiple page sizes of 1 KB up to16 MB. When supported by system software, the MMU provides the following functions:


 * Translation of the 4 GB logical address space into a physical address space
 * Independent enabling of instruction translation and protection from that of data translation and protection
 * Page-level access control using the translation mechanism
 * Software control over the page replacement strategy
 * Additional protection control using zones
 * Storage attributes for cache policy and speculative memory access control

The Translation Look-aside Buffer (TLB) is used to control memory translation and protection. Each one of its 64 entries specifies a page translation. It is fully associative and can simultaneously hold translations for any combination of page sizes. To prevent TLB contention between data and instruction accesses, a 4-entry instruction and an 8-entry data shadow TLB are maintained by the processor transparently to the software. Software manages the initialization and replacement of TLB entries.

The PowerPC 405 includes instructions for managing TLB entries by software running in privileged mode. This capability gives significant control to system software over the implementation of a page replacement strategy. Storage attributes are provided to control access of memory regions. When memory translation is enabled, storage attributes are maintained on a page basis and read from the TLB when a memory access occurs. When memory translation is disabled, storage attributes are maintained in storage attribute control registers. A zone protection register (ZPR) is provided to allow system software to override the TLB access controls without requiring the manipulation of individual TLB entries.

Problems
hi, i found a problem using a pci sound card in the DHT-WALNUT. It has been correctly recognized by the kernel, the DMA feature (ppc405-dma) is setted, but the card is not working.
 * uboot (tested on 1.1.4) has issues in PCI/DMA initialization. More will be post in the future

somebody says it is a bug, somebody says ppcboot solves the problem inizializing the pci in the correct way. I don't know, i'm using the uboot v1.1.4 and it is not working

also have a look to this

<> but i already thought so when i saw the "pci long" output <> no BAR was assigned with an address <> this was different some time ago <> could be something changed in the last few months in the common pci support <> i'll check with an ex-kollegue and let you know <> this will take till beginning of next week though <> hey, i just checked the source (sometimes helpful) <> you just need to enable the host bridge configuration via an env variable <> => setenv pciconfighost yes <> then <> => saveenv <> => reset <> after this reset the BAR1 will be configured: <> => pci long <> Scanning PCI devices on bus 0 <> Found PCI device 00.00.00: <>  vendor ID =                   0x1014 <>  device ID =                   0x0156 <>  command register =            0x0006 <>  status register =             0x2210 <>  revision ID =                 0x01 <>  class code =                  0x0b (Processor) <>  sub class code =              0x20 <>  programming interface =       0x00 <>  cache line =                  0x00 <>  latency time =                0x87 <>  header type =                 0x00 <>  BIST =                        0x00 <>  base address 0 =              0x00000000 <>  base address 1 =              0x80000008

could you help me to understand how to plug a soundcard ?

Images of the board


see more detailed photo dht-walnut-ppc405-top

= JTAG =

The BEST solution is to equip your lab with the bdi2000. This hardware is expensive a lot, 'cause it is not a simple download cable, it's a professional debugger

For this dht-walnut project it has been used "OCD Commander is macraigor's free debugger software", that i'm going to illustrate

Flameman/dht-walnut/jtag

= Firnware and Bootloaders =


 * ppcboot (not suggested)
 * U-Boot (it can't load kernel >=2.5.25)
 * U-Boot-kanojio (under development, it will be able to boot kernel >2.6.25, see below)

Flameman/dht-walnut/firmware

about issues, and ideas, they are also reported here Flameman/dht-walnut/rootfs

about uboot
Flameman/uboot

= rootfs =

storage device: HardDisk, microdrive or Compact Flash, put a rootfs on it

Flameman/dht-walnut/rootfs

= OS = Operating System available for this board

NetBSD

 * Netbsd has a port for "IBM PowerPC 405GP based Walnut evaluation board", this is not the DHT-Walnut, this is an other way to call the AMCC-Walnut (yes just to be confusing). Ok, it is not for DHT-Walnut, but this port could be (easealy / hardly) adapted to the DHT-Walnut with some work / over work

Hardware that is known to work with

 * see netbsd web, the hw could be (easealy / hardly) adapted to the DHT-Walnut with some work / over work

.

Gentoo-PPC/32

 * Version 2.4 (Mostly) working kernel binary and config from jbevren with matrox fbcon and usb input support. Current issues: USB keyboard input doesnt seem to work, but events reach /dev/input/event0
 * Version 2.6 working ... tested vanilla kernel 2.6.16.3, 2.6.24 (actually running)

boot from HD
Work In Progress

ppcboot/U-Boot provides only basic functionality to access Hard disks: you can print the partition table and read and write blocks (addressed by absolute block number), but there is no support to create new partitions or to read files from any type of filesystem. The current version of ppcboot-1.1.6 has a problem with writing to hdd, however, once the Linux kernel is loaded and the userland initialized, the hdd can be accesses normally through PIO and DMA modes. This may or may-not be fixed in the future.

As usual, you can get some information about the available IDE commands using the help command in ppcboot:

=> help ide ide reset - reset IDE controller ide info - show available IDE devices ide device [dev] - show or set current device ide part [dev] - print partition table of one or all IDE devices ide read addr blk# cnt ide write addr blk# cnt - read/write `cnt' blocks starting at block `blk#' to/from memory address `addr'

You may create the needed partitions by tftpbooting Linux and an appropriate userland, then use fdisk to partition the disk. Then reboot back to ppcboot.

ppcboot can be configured for DOS and Mac OS? type partition tables. Since ppcboot cannot read files from a filesystem you should create one (or more) small partitions (maybe 1 or 2 MB) if you want to boot from the "disk". (The size of these partitions will depend on how large your kernel and userland images are)

You should create the following partiton table:

hde: hdx1 hdx2 hdx3 hdx4
 * 1) fdisk /dev/hdx

/dev/hde1 ID=83   Linux < 2Mb, boot kernel, dd if=kernel of=here /dev/hde2 ID=83   Linux /dev/hde3 ID=83   Linux <  root & usr /dev/hde4 ID=82   Swap  < 32Mb, swap

You should also initialized /dev/hdx4 as swap space. Setting up swapspace
 * 1) mkswap /dev/hdx4

check how ppcboot/U-Boot will recognize this partition table: => ide part


 * dd if=kernel.img of=/dev/hdx1

To boot from a disk you can use the diskboot command:

=> help diskboot diskboot loadAddr dev:part

The diskboot command expects a load address in RAM, and a combination of device and partition numbers, separated by a colon. It then reads the image from disk and stores it in memory. We can now boot it using the bootm command [to automatically boot the image define the ppcboot environment autostart with the value =yes=].

=> diskboot 400000 0:1 ide_read dev 0 start 0, blocks 1 buffer at 3F9F8C0
 * 1) Valid DOS partition found ##

Loading from IDE device 0, partition 1: Name: hda1 Type: PPCBoot First Block: 63, # of blocks: 8001, Block Size: 512 ide_read dev 0 start 3F, blocks 1 buffer at 400000 Image Name:  DHT Kernel ..

=> bootm 400000 c00000 Image Name:  DHT Walnut Kernel Image Type:  PowerPC Linux Kernel Image (gzip compressed) ...
 * 1) Booting image at 00400000 ...

=> setenv bootargs root=/dev/ram0 => setenv autostart yes => disk 400000 0:1 \;\ diskboot c00000 0:2 \;\ bootm 400000 c00000 => bootd (i will post all my setenv)

The above procedure puts the userland image from the second partition into a ramdisk. If you would like the userland to be an ext2/3/rieser/xfs partition on the hdd do the following:


 * make the partiton table as above
 * put the kernel and small userland onto the first partitions as above
 * populate the root&usr partition with the appropriate files (gentoo-ppc32 distro)
 * change bootargs to "bootargs root=/def/hda3"
 * bootd to try out the new root, if it works ok, reboot back to ppcboot, change the bootargs again and saveenv
 * bootd and enjoy your new system.

env
=> printenv bootdelay=5 loads_echo=1 netdev=eth0 ramargs=setenv bootargs root=/dev/ram rw addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1 addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate} kernel_addr=fff80000 ramdisk_addr=fff80000 update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;cp.b 100000 fffc0000 40000;setenv filesize;saveenv ethact=ppc_4xx_eth0 hostname=walnut-ppc405 ethaddr=DE:AD:BE:EF:DE:AD preboot=echo "ide.part.1th stores kernel rawimage" myroot=/dev/hda4 myinit=/sbin/init fileaddr=800000 netmask=255.255.255.0 bootcmd=run boot-disk ; bootm myboot_diskpart=0:1 myboot_kernel_addr=800000 baudrate=9600 myuart=ttyS0 setconsole_uart=setenv myconsole ${myuart},${baudrate} setconsole_video=setenv myconsole tty video=${myvideofb} myvideofb=matroxfb:800x600-16@60 setbootargs=setenv bootargs console=${myconsole} root=${myroot} init=${myinit} myconsole=ttyS0,9600 bootargs=console=ttyS0,9600 root=/dev/hda4 init=/sbin/init boot-tftp=tftpboot ${myboot_kernel_addr} ${myboot_file} boot-disk=diskboot ${myboot_kernel_addr} ${myboot_diskpart} ipaddr=192.168.1.5 serverip=192.168.1.14 gatewayip=192.168.1.1 myboot_file=gentoo-walnut-ramrootfs.img ramrootfs=setenv bootargs console=ttyS0,9600 rdinit=/sbin/init init=/bin/bash stdin=serial stdout=serial stderr=serial ver=U-Boot 1.2.0-g7882751c-dirty (Apr 14 2007 - 16:44:37)

Environment size: 1405/16379 bytes

Hardware that is known to work with
There is a list of the Hardware that is known to work (and not to work) with this board. Feel free to add, comment, feedback about it.

Compile from sources
kernel 2.6 has issues in the source's tree: the dht-Walnut has been originally ported to arch=ppc, while the new kernel tree is around arch=powerpcc, for this reason you need to specify the right arch or your compiler will have issues. Developers will port everything to arch=powerppc in the future

01-2010:
 * kernel >2.6.25 can't compile with ARCH=PPC, they need ARCH=POWERPC, they compile fine but they do not boot in uImage format cause of uBoot needs new style
 * kernel <=2.6.25 can be compiled with ARCH=PPC and they boot fine with my uboot-1.2-hack

report
29-01-2010: i am using 2.6.22 for production
 * 2.6.25 ARCH=ppc -- boots
 * 2.6.25 ARCH=powerpc -- hangs before any output


 * 28..31 have ARCH issues (probably case it was not properly ported from PPC to POWERPC)
 * 32..33 unchecked, but they should have device name inversion bug + LZMA bug

download
2007: kernel 2.6.19 full tested and working (suggested for production, there are issue with this wiki upload page, so if you need this kernel, you could email me, i will send by emaul)

compiled with gcc-3.4.6, basically it is a vanilla, with a bit of my patches i added in order to avoid myself from the differences between a common "ppc" platform and .. the 405GP/walnut.

14-06-2009: new kernel 2.6.30 needs to be hardly tested (with gcc-4.3.*) and (maybe) patched anyway, advantages about


 * the new supported pci/usb hw
 * the new dynamic tickless
 * the ext4
 * the new networking stack and congestion mechanisms

30-10-2010: new kernel (>=2.6.25 need new bootloader)

= Project: do something useful with the board =

DHT-Walnut as N.A.S.


I turned a DHT-Walnut + 300Gb hard disk into a file server to have my data files connected and shared to the LAN (Local Area Network).

N.A.S. stands for Network Attached Storage. They are storage devices attached to the lan. A NAS should be able to be connected to every kind of network. It should use both the access protocols NFS (Network File System) and CIFS (Common Internet File System)

I only enabled NFS service in the kernel configure because i don't need CIFS. UNIX servers use NFS, while Microsoft systems use CIFS, fortunately i don't have any Microsoft systems here :P Gentoo is installed in the first little partition of the hard disk (it is PC-partition style, so you can only have 4 partitions). It runs openssh, telnet, ftp, tftp, and NFS. As the fact there is no RTC chip installed i added special /etc/init.d/clock-sync to set the local time. The scrips uses rdata to retrieve the current time of an other machine.

In the photo you could see the case i realized: the hard drive is connected to the opened door, the DHT-walnut PCD has been placed inside, the green LED has been used to the frontal case to say "the booting has been completed, the system is ready" (used the gpio hack provided in patches for the 2.6.16-rc3). The black platform is from sony playstation2 and is is only a nice way to have the case vertically seated.

Don't keep about the ALS4000 pci sound board  plugged in the upper PCI bus. It has been plugged just to use the NAS as the giant (300Gb) ipod you have ever seen .... but this is an other story ....

Note: also scsi adaptec-2940 is working !!! i added 3x40Gb sca-scsi stored in a sun box

to be checked: sATA pci controller

please report any other working hardware here, or @ flamemaniii@gmail.com

or feel free to add newer lines to Flameman/dht-walnut

development
thinking new things ... but it should be compatible with "free time constraints" =P

See also Flameman/dht-walnut/develop

if you need pci-riser
PCI Riser Card 5V 32-bit 2 Slot passive Edge connector X1 of the riser card is inserted in a free 5 V 32-bit slot on the PC motherboard. Slot X2 is then connected and ready for use. The second PCI slot X3 receives its special signals for bus arbitration and interrupt control via the cable from card X4, which is inserted in any other slot on the PCI motherboards. The assembly does not contain any active components. This means that the board is suitable for operation with V(I/O) = 5 V as well as V(I/O) = 3.3 V. The coding of connectors X2 and X3 with this variant is for V(I/O) = 5 V.

Misc

 * See also Flameman/dht-walnut/proof