
Board Overview
-----------------------------

The Cyclone IQ80310 board is an evaluation platform for Intel's 80200 Xscale
CPU and 80312 Intelligent I/O chipset (collectively called IOP310 chipset).

The 80312 contains dual PCI hoses (called the ATUs), a PCI-to-PCI bridge,
three DMA channels (1 on secondary PCI, one on primary PCI ), I2C, I2O
messaging unit, XOR unit for RAID operations, a bus performance monitoring
unit, and a memory controller with ECC features.

For more information on the board, see http://developer.intel.com/iio

Port Status
-----------------------------

Supported:

- MTD/JFFS/JFFS2
- NFS root
- RAMDISK root
- 2ndary PCI slots
- Onboard ethernet
- Serial ports (ttyS0/S1)
- Cache/TLB locking on 80200 CPU
- Performance monitoring unit on 80200 CPU
- 80200 Performance Monitoring Unit
- Acting as a system controller on Cyclone 80303BP PCI backplane
- DMA engines (EXPERIMENTAL)
- 80312 Bus Performance Monitor (EXPERIMENTAL)
- Application Accelerator Unit (XOR engine for RAID) (EXPERIMENTAL)
- Messaging Unit (EXPERIMENTAL)

TODO:
- I2C

Building the Kernel
-----------------------------
make iq80310_config
make oldconfig
make zImage

This will build an image setup for BOOTP/NFS root support.  To change this,
just run make menuconfig and disable nfs root or add a "root=" option.

Preparing the Hardware
-----------------------------

This document assumes you're using a Rev D or newer board running
Redboot as the bootloader.  Note that the version of RedBoot provided
with the boards has a major issue and you need to replace it with the
latest RedBoot. You can grab the source from the ECOS CVS or you can
get a prebuilt image and burn it in using FRU at:

   ftp://source.mvista.com/pub/xscale/iq80310/redboot.bin

Make sure you do an 'fis init' command once you boot with the new
RedBoot image.



Downloading Linux
-----------------------------

Assuming you have your development system setup to act as a bootp/dhcp
server and running tftp:

   RedBoot> load -r -b 0xa1008000 /tftpboot/zImage.xs
   Raw file loaded 0xa1008000-0xa1094bd8

If you're not using dhcp/tftp, you can use y-modem instead:

   RedBoot> load -r -b 0xa1008000 -m y

Note that on Rev D. of the board, tftp does not work due to intermittent
interrupt issues, so you need to download using ymodem.

Once the download is completed:

   RedBoot> go 0xa1008000

Root Devices
-----------------------------

A kernel is not useful without a root filesystem, and you have several
choices with this board:  NFS root, RAMDISK, or JFFS/JFFS2.  For development
purposes, it is suggested that you use NFS root for easy access to various
tools.  Once you're ready to deploy, probably want to utilize JFFS/JFFS2 on
the flash device.

MTD on the IQ80310
-----------------------------

Linux on the IQ80310 supports RedBoot FIS paritioning if it is enabled.
Out of the box, once you've done 'fis init' on RedBoot, you will get
the following partitioning scheme:

   root@192.168.0.14:~# cat /proc/mtd
   dev:    size   erasesize  name
   mtd0: 00040000 00020000 "RedBoot"
   mtd1: 00040000 00020000 "RedBoot[backup]"
   mtd2: 0075f000 00020000 "unallocated space"
   mtd3: 00001000 00020000 "RedBoot config"
   mtd4: 00020000 00020000 "FIS directory"

To create an FIS directory, you need to use the fis command in RedBoot.
As an example, you can burn the kernel into the flash once it's downloaded:

   RedBoot> fis create -b 0xa1008000 -l 0x8CBAC -r 0xa1008000 -f 0x80000 kernel
   ... Erase from 0x00080000-0x00120000: .....
   ... Program from 0xa1008000-0xa1094bac at 0x00080000: .....
   ... Unlock from 0x007e0000-0x00800000: .
   ... Erase from 0x007e0000-0x00800000: .
   ... Program from 0xa1fdf000-0xa1fff000 at 0x007e0000: .
   ... Lock from 0x007e0000-0x00800000: .

   RedBoot> fis list
   Name              FLASH addr  Mem addr    Length      Entry point
   RedBoot           0x00000000  0x00000000  0x00040000  0x00000000
   RedBoot[backup]   0x00040000  0x00040000  0x00040000  0x00000000
   RedBoot config    0x007DF000  0x007DF000  0x00001000  0x00000000
   FIS directory     0x007E0000  0x007E0000  0x00020000  0x00000000
   kernel            0x00080000  0xA1008000  0x000A0000  0x00000000

This leads to the following Linux MTD setup:

   mtroot@192.168.0.14:~# cat /proc/mtd
   dev:    size   erasesize  name
   mtd0: 00040000 00020000 "RedBoot"
   mtd1: 00040000 00020000 "RedBoot[backup]"
   mtd2: 000a0000 00020000 "kernel"
   mtd3: 006bf000 00020000 "unallocated space"
   mtd4: 00001000 00020000 "RedBoot config"
   mtd5: 00020000 00020000 "FIS directory"

Note that there is not a 1:1 mapping to the number of RedBoot paritions to
MTD partitions as unused space also gets allocated into MTD partitions.

As an aside, the -r option when creating the Kernel entry allows you to
simply do an 'fis load kernel' to copy the image from flash into memory.
You can then do an 'fis go 0xa1008000' to start Linux.

If you choose to use static partitioning instead of the RedBoot partioning:

   /dev/mtd0  0x00000000 - 0x0007ffff: Boot Monitor     (512k)
   /dev/mtd1  0x00080000 - 0x0011ffff: Kernel Image     (640K)
   /dev/mtd2  0x00120000 - 0x0071ffff: File System      (6M)
   /dev/mtd3  0x00720000 - 0x00800000: RedBoot Reserved (896K)

To use a JFFS1/2 root FS, you need to donwload the JFFS image using either
tftp or ymodem, and then copy it to flash:

   RedBoot> load -r -b 0xa1000000 /tftpboot/jffs.img
   Raw file loaded 0xa1000000-0xa1600000
   RedBoot> fis create -b 0xa1000000 -l 0x600000 -f 0x120000 jffs
   ... Erase from 0x00120000-0x00720000: ..................................
   ... Program from 0xa1000000-0xa1600000 at 0x00120000: ..................
   ......................
   ... Unlock from 0x007e0000-0x00800000: .
   ... Erase from 0x007e0000-0x00800000: .
   ... Program from 0xa1fdf000-0xa1fff000 at 0x007e0000: .
   ... Lock from 0x007e0000-0x00800000: .
   RedBoot> fis list
   Name              FLASH addr  Mem addr    Length      Entry point
   RedBoot           0x00000000  0x00000000  0x00040000  0x00000000
   RedBoot[backup]   0x00040000  0x00040000  0x00040000  0x00000000
   RedBoot config    0x007DF000  0x007DF000  0x00001000  0x00000000
   FIS directory     0x007E0000  0x007E0000  0x00020000  0x00000000
   kernel            0x00080000  0xA1008000  0x000A0000  0xA1008000
   jffs              0x00120000  0x00120000  0x00600000  0x00000000

This looks like this in Linux:

   root@192.168.0.14:~# cat /proc/mtd
   dev:    size   erasesize  name
   mtd0: 00040000 00020000 "RedBoot"
   mtd1: 00040000 00020000 "RedBoot[backup]"
   mtd2: 000a0000 00020000 "kernel"
   mtd3: 00600000 00020000 "jffs"
   mtd4: 000bf000 00020000 "unallocated space"
   mtd5: 00001000 00020000 "RedBoot config"
   mtd6: 00020000 00020000 "FIS directory"

You need to boot the kernel once and watch the boot messages to see how the
JFFS RedBoot partition mapped into the MTD partition scheme.

You can grab a pre-built JFFS image to use as a root file system at:

   ftp://source.mvista.com/pub/xscale/iq80310/jffs.img

For detailed info on using MTD and creating a JFFS image go to:

   http://www.linux-mtd.infradead.org.

For details on using RedBoot's FIS commands, type 'fis help' or consult
your RedBoot manual.

Contributors
-----------------------------

Thanks to Intel Corporation for providing the hardware.

John Clark <jclark@teamasa.com> - Initial discovery of RedBoot issues
Dave Jiang <dave.jiang@intel.com> - IRQ demux fixes, AAU, DMA, MU
Nicolas Pitre <nico@cam.org> - Initial port, cleanup, debugging
Matt Porter <mporter@mvista.com> - PCI subsystem development, debugging
Tim Sanders <tsanders@sanders.org> - Initial PCI code
Mark Salter <msalter@redhat.com> - RedBoot fixes
Deepak Saxena <dsaxena@mvista.com> - Cleanup, debug, cache lock, PMU

-----------------------------
Enjoy.

If you have any problems please contact Deepak Saxena <dsaxena@mvista.com>

A few notes from rmk
-----------------------------

These are notes of my initial experience getting the IQ80310 Rev D up and
running.  In total, it has taken many hours to work out what's going on...
The version of redboot used is:

 RedBoot(tm) bootstrap and debug environment, version UNKNOWN - built 14:58:21, Aug 15 2001


1. I've had a corrupted download of the redboot.bin file from Montavista's
   FTP site.  It would be a good idea if there were md5sums, sum or gpg
   signatures available to ensure the integrity of the downloaded files.
   The result of this was an apparantly 100% dead card.

2. RedBoot Intel EtherExpress Pro 100 driver seems to be very unstable -
   I've had it take out the whole of a 100mbit network for several minutes.
   The Hub indiates ZERO activity, despite machines attempting to communicate.
   Further to this, while tftping the kernel, the transfer will stall regularly,
   and might even drop the link LED.

3. There appears to be a bug in the Intel Documentation Pack that comes with
   the IQ80310 board.  Serial port 1, which is the socket next to the LEDs
   is address 0xfe810000, not 0xfe800000.

   Note that RedBoot uses either serial port 1 OR serial port 2, so if you
   have your console connected to the wrong port, you'll see redboot messages
   but not kernel boot messages.

4. Trying to use fconfig to setup a boot script fails - it hangs when trying
   to erase the flash.
