MPC8260SAR

hosted by sourceforge


Project Page


Author: Alex Zeffertt
Company: Cambridge Broadband Ltd.


Introduction

mpc8260sar is an linux ATM device driver for the PowerQUICCII range of processors.  The PowerQUICCII is the 2nd generation of PowerQUICC processors designed by Motorola for networking applications.  The MPC8260 is a member of the PowerQUICCII range, but actually all MPC82xx and MPC83xx processors are also PowerQUICCIIs, and this driver should work equally well on those.

This device driver can be built as either kernel resident or as a loadable module.  It meets the linux ATM device driver API - which basically means that it acts as a glue layer between the hardware SAR engine and the kernel's ATM networking stack.  In the case of the PowerQUICCII the SAR engine resides in its 2nd generation Comms Processor Module, or CPM.

  1. Introduction
  2. Disclaimer
  3. History/Credits
  4. Features
  5. Prerequisites
    1. Software
    2. Hardware
    3. Documentation
  6. Build Instructions
    1. Development platform
    2. Kernel and modules
      1. Linux 2.6
    3. Standalone ATM to Ethernet bridging application
    4. U-boot
      1. CR826/PM828
      2. MPC8272ADS
      3. PQ2FADS
  7. Installation Instructions
    1. u-boot
    2. nfs root filesystem
    3. standalone application
    4. Phy control utility
  8. Performance
  9. Design notes
  10. Help Wanted

Disclaimer

This software is licenced under the GPL.  Share and enjoy!

History/Credits

Back in 2001 I published the original PowerQUICCI driver and named it mpc860sar.  I was helped by Daris Nevil, who gave me a starting point in the form of some GPL'd code, and by Dave Pegler who wrote some of the final driver code.

This driver was then ported to the PowerQUICCII by a number of people and published here.  Later my company decided to upgrade to the PowerQUICCII themselves and I had a look at this project.  This code was extremely helpful to me but it did not work out of the box and I found I had to do a lot of work to get the driver operational, to restore some of the original features, and to improve performance.  As a result the final code bears little resemblance to the original port and I felt this justified consolidating the changes by creating a new project rather than sending the authors of the original port a patch.  I hope this does not offend anyone.

I'd like to thank Russell McGuire for sending a fix concerning the calculation of the internal BRG rate for systems with low speed PHYs.

I'd also like to thank Fabien Clement for adding PQ2FADS and linux-2.6 support.

Features

A brief summary of the features offered by mpc8260sar.
  1. 2 priorities for tx.  CBR channels are top priority, UBR are bottom priority.
  2. 2 priorities for rx.  CBR receptions are handled in interrupt.  UBR are reception handling is scheduled for later processing by the kernel and has lower priority.
  3. Full QoS spec supported.  This includes min_pcr, pcr, and max_pcr on both UBR and CBR rings.
  4. AAL0 and AAL5 support.
  5. Overbooking supported on UBR ring (auto VC off), strict bandwidth accounting on CBR ring.
  6. VPI/VCI range configurable at build time.  Currently 0-0/0-16383
  7. Up to 62 internal channels (using on-chip Dual Port RAM) - configurable up to 254 depending on DPRAM availability.
  8. Up to 64 external channels (using external SDRAM) - configurable up to 64k depending on SDRAM availability.
  9. Extensive statistics in /proc/net/atm/utopia:0
  10. Buffer size of 1632 bytes - optimising for ethernet over ATM.
  11. AAL5 frames may span multiple buffers up to 9180 bytes - allowing for CLIP support.
  12. Quick interrupt handling with low priority work offloaded to scheduled tasks by kernel
  13.  Kernel resident or loadable module
  14. Support for phy-ioctls and loopback SAR ioctl
  15. Optional support for prevention of process CPU starvation.  See CONFIG_CPU_STARVATION_WATCHDOG.
  16. Currently supports CR826/PM828, MPC8272ADS, and PQ2FADS development boards

Prerequisites

You are free to choose any PQII platform and linux kernel you wish.  However, the following list describes the platform on which I developed and tested the code, and is therefore your best bet if you want to get things up and running quickly.  If anyone wishes to contribute patches and/orinstructions for other platforms I am happy to include them in the project.

Software

  1. ELDK 3.1.1 build 2005-03-07 (also available on CDROM from denx.de)
  2. ELDK 3.1.1 build 2005-03-07 source RPMS (also available on CDROM from denx.de)
  3. Denx LinuxPPC development kernel dated 2005-03-06.  This is automatically installed by the ELDK, but can also be checked out of Denx CVS:
    cvs -z6 -d :pserver:anonymous@www.denx.de:/cvsroot co -P -D 2005-03-06 linuxppc_2_4_devel
  4. Patches and additional SRPMS from this site.  See build instructions below.

Hardware

  1. Microsys PM828 Miriac Module.  Contains MPC8280 CPU, 128MB SDRAM, 32MB flash.  Available via Denx.
  2. Microsys CR826 Evaluation Carrier v2 with ATM option and PM5350 PHY.   Available via Denx.
  3. Standard ATX power supply, OC3 (SC) connectors, lots of CAT5.
OR

  1. Freescale MPC8272ADS development board.
  2. Standard ATX power supply, OC3 (SC) connectors, lots of CAT5.  (Should come with development board.)

OR
  1. Freescale PQ2FADS development board.

Documentation

  1. Very important: ELDK, linuxppc, and u-boot wiki.

Build Instructions

The following is merely a description of my development and build process.  You are free to attempt a different method yourself, but please try this before contacting me with queries.

Development platform

Read the ELDK chapter of the DULG user manual.  Now install the ELDK in /opt/eldk.  The cpu_family is ppc_6xx.

Prepare the target root directory /opt/eldk/ppc_6xx/ for use as an nfs-mounted root directory as described in the ELDK user manual (basically you need to run a couple of scripts as superuser).

Install the ELDK source CDROM, i.e. mount it and copy /mnt/cdrom/* to /opt/eldk/.

I have packaged the linux-atm utilities into an SRPM here.  Copy this to /opt/eldk/target/SRPMS.  Install this SRPM, rebuild the RPM using the instructions in the ELDK user manual, then install it onto the target root filesystem, again using the instructions in the ELDK user manual.

I have also packaged the bridge-utils utilities into an SRPM here.  Copy this to /opt/eldk/target/SRPMS.  Install this SRPM, rebuild the RPM using the instructions in the ELDK user manual, then install it onto the target root filesystem, again using the instructions in the ELDK user manual.

Kernel and modules

Change to the directory where the ELDK installs the kernel source:

    cd /opt/eldk/ppc_6xx/usr/src/linux-2.4.25/

First you must modify the default ELDK kernel to support the platforms, and integrate the ATM driver.  Apply the latest mpc8260sar patch, e.g.

    patch -p1 [--dry_run] < linuxppc-2005-03-06-2006-05-11.patch

(NB: The first date in the name of the patch is the date at which the original kernel code was checked out of Denx CVS.  The second date is the release date of the patch.  This is the latest release of the this patch.  As I make new releases I will update this link and move old releases here.  Older patches contain the ATM device driver as well.)

Next you must extract the ATM driver:

    tar xzf mpc8260sar-2006-02-22.tar.gz

Build the kernel, and build and install the modules:

    PATH=$PATH:/opt/eldk/bin:/opt/eldk/usr/bin
    export CROSS_COMPILE=ppc_6xx-
   
    make PM826_config    # If your platform is CR826/PM828
or
    make ads8272_config  # If your platform is MPC8272ADS
or
    make PQ2FADS_config  # If your platform is PQ2FADS
    make oldconfig
    make dep
    make uImage
    make modules
    make modules_install INSTALL_MOD_PATH=/opt/eldk/ppc_6xx

Linux 2.6

The ATM device driver itself supports linux-2.6.  Support for linux-2.6 was submitted by Fabien Clement and I have not tested it myself.  As yet there is no patch to integrate the atm/ directory into the linux-2.6 kernel but this should be fairly straightforward to do.

Standalone ATM to Ethernet bridging application

Here I shall describe how to build an example standalone ATM to Ethernet bridging application based on a kernel and simple ramdisk.  This code is based on the SELF SRPM in the ELDK source CDROM (see /opt/eldk/target/SRPMS/SELF-1.0-7.src.rpm).

    cd /opt/eldk/ppc_6xx/usr/src
    tar xzf SELF-atm2eth-bridge-app.tar.gz
    ln -sf linux-2.4.25 linux
    cd SELF
-atm2eth-bridge-app
    make clean all

This creates a combined kernel/ramdisk file /opt/eldk/ppc_6xx/usr/src/SELF-atm2eth-bridge-app/images/uMulti which, when run, starts a bridge br0 from nas999 to eth0.

U-boot

CR826/PM828

If you choose to rebuild u-boot you will probably need to do the following if you are using the CR826 board:

    cd /opt/eldk/ppc_6xx/usr/src/u-boot-1.1.3
    patch -p1 [--dry_run] < u-boot-1.1.3-pm82x-local-not-pcibus.patch

This patch is to work around the fact that since the CR826 has been modded for ATM, it needs a local bus to communicate with the ATM PHY management interface.  This is incompatible with PCI functionality, and the CPU has to be told this in the hard reset configuration word.

MPC8272ADS

You will need to rebuild u-boot because the default image from Freescale (u-boot-1.1.1) is configured to use FCC1 for ethernet, and this conflicts with the ATM driver.  You may want to apply this patch which enables u-boot to be burnt into the base of flash:

    cd /opt/eldk/ppc_6xx/usr/src/u-boot-1.1.3
    patch -p1 [--dry_run] < u-boot-1.1.3-boot-ads8272-from-flash-base.patch


If you do, you will also need to adjust jumper JP9 so that the CPU reads the Hard Reset Configuration Word from flash rather than from an on board CPLD called the BCSR.

PQ2FADS

The code which supports the PQ2FADS was submitted to me by Fabien Clement and I have not tested this platform.

Installation Instructions

u-boot

You will need to set up your u-boot environment to allow it to boot either the kernel+nfs root filesystem, or the standalone kernel+ramdisk image.  This log shows how I did it on the CR826/PM828 platform.  This log shows how I did it on the MPC8272ADS.

nfs root filesystem

Make sure your tftp server can serve a copy of /opt/eldk/ppc_6xx/usr/src/linux-2.4.25/arch/ppc/boot/images/uImage.  Also ensure that your NFS server can serve /opt/eldk/ppc_6xx.  (The DULG user manual can help with this.)   Then, on the serial console to u-boot type

    run nfsboot

Once the kernel has booted, log in and type

    modprobe atm-8260

standalone application

Make sure that your tftp server can serve a copy of /opt/eldk/ppc_6xx/usr/src/SELF-atm2eth-bridge-app/images/uMulti.  Then on the serial console to u-boot type:

    run multiboot

The board should start bridging straight away.

Phy control utility

On the CR826/PM828 development platform you can just use sonetdiag, which is installed by the linux-atm package (see above.)

On the MPC8272ADS and PQ2FADS development platform there is a later phy which is not compatible with sonetdiag.  Therefore you need to use a different utility called pm5384_ctrl, which you will need to build yourself, like so:

    ppc_6xx-gcc -o /opt/eldk/ppc_6xx/bin/pm5384_ctrl pm5384_ctrl.c -I/opt/eldk/ppc_6xx/usr/src/linux-2.4.25/include

Performance

The following spreadsheets were created by SmartBits, which was used to test the ATM to Ethernet bridging performance of the standalone application on the CR826/PM828 platform.

The upshot is that it can cope with an aggregate of over 75k packets per second.

Design notes

  1. The source code currently only builds for the PM826/CR826 or PM828/CR826 or MPC8272ADS.  In menuconfig I've added an 'choice' option for PM826 carrier board.  This option is presented if the the PM826 platform is selected.  The PM826_defconfig file in the patch selects the CONFIG_CR826 choice for this option.  The result of this is that CONFIG_MPC8260SAR is offered, and atm-8260.o will include cr826.o if it is built.  The file cr826.c contains the entry and exit points for the module and thus controls how the module is configured.  Similarly for the ADS build the file ads8272.c contains the entry and exit points.
  2. If other boards become supported then the driver should detect this from the CONFIG_ options and not build  cr826.c or ads8272.c.  Instead it should build another analogous source file containing a configuration appropriate to that board.
  3. I've added an option CONFIG_CPU_STARVATION_WATCHDOG which is not set in the .config written by the patch.  If selected this will build a watchdog that can be opened, configured, and patted by multiple independent user processes.  If any of these time out then the mpc8260sar and fcc_enet drivers will enter a low cpu-usage mode until all of the opened watchdogs have been patted.  The idea behind this is to protect important user processes from CPU starvation when the kernel is passing a lot of traffic.  You may or may not find it useful.
  4. I've made some small mods to the fcc_enet.c code.  Some are just protection against potential bugs, but I've also added support for CONFIG_CPU_STARVATION_WATCHDOG as described above.  Also, I re-enabled support for promiscuous mode which was for some unknown reason disabled.

Help Wanted

A list of things either not yet supported or not yet working.
  1. Better support for FCC1.  Currently the pins are all hardcoded.  I'm not sure if a different pin selection is possible on FCC1.
  2. MPHY support.  Zoran had apparently already done this for the atm8260 sourceforge project but I have not used that yet.  It would be nice to support both MPHY modes: direct and indirect polling.
  3. TC/IMA.  Currently we only support UTOPIA as a cell transport mechanism (see utopia.c).  It would be nice to support TC (ATM over E1) in a file called, say, tc.c, and IMA in a file called, say ima.c.
  4. ABR.  The driver currently only supports UBR and CBR.  Maybe we could add ABR support later.  The SAR can do it!
  5. AAL1/2.

ajz @ cambridgebroadband . com   2005-07-25