Commit 2976581e authored by Alessandro Rubini's avatar Alessandro Rubini

README, nic/README: merged into doc/ (next commit)

parent cd587c54
This directory hosts the minic and nic drivers for the WR switch. The
minic, together with the underlying vhdl implementation, is work by
Tomasz Wlostowski. The rest and any bug is by Alessandro Rubini,
but Tom helped integrating with the new vhdl and testing stuff.
This package is meant to include all white-rabbit software. Part of
this comes from the white-rabbit svn repository on, part comes
from separate repositories that I merged here.
Structure of this package
All documentation lives in doc/ , where all *.in files are the sources
(texinfo files, plain ascii, but please ask me before adding or
removing chapter or sections -- or emacs and its texinfo-mode).
This file.
When tarball are released, output files are part of the archive.
GNU GPL Version 2. This package is copyrighted by CERN and
released as free software.
Used to compile the various drivers. You should set LINUX
in your environment or in the command line of "make".
The directories host original work by Tomasz, copied here from svn.
The directory hosts the kernel patches, split by kernel versions.
I have a git tree for that, and the patches here have been
spit out by "git format-patch". See a later section about git.
This is the new driver, for the new logic design.
Compiling the kernel
To compile the kernel, you need to retrieve the pristine sources for
2.6.35 and apply the patches for the switch. You can do that using git
or with old-style tar+patch. See the subsection about how to get
the sources.
Once you have the wrswitch kernel, you should cd to its main directory
and compile in this way. Note that the CROSS_COMPILE prefix may be the
one you built using buildroot or more or less any other cross-gcc. The
CROSS_COMPILE variable must end with the hyphen tha appears before "gcc"
in the name of the actual compiler.
export ARCH=arm
export CROSS_COMPILE=/path/to/cross/arm-linux-
make wrswitchv2_defconfig
make uImage
Finally, copy the uImage to your tftp server directory, as the
boot-loader in the switch is preconfigured to get a file called
"uImage" from your tftp server.
cp arch/arm/boot/uImage /tftpboot
Using git
If you use git, you are expected to already have some copy of Linus'
official tree. Let's say it's in /usr/src/linux-vanilla.git . In that
case, you should first check out 2.6.35 and then fetch the wrswitch
branch. The git tree where I have the stuff is
What follows is one possible way, adding branches to the vanilla
tree. (I use different names for the various items to help the
non-expert git user in differentiatine them, a cleaner approach would
be using "wrswtichv2" for all items in the different ocntexts).
cd /usr/src/linux-vanilla.git
git remote add gnudd git://
git fetch gnudd
git checkout -b wr-kernel gnudd/wrswitch2-dev
Af this point, you checkout is a new branch that corresponds to the
"wrswitch2-dev" branch on my gnudd server.
Another option is creating a different checkout that uses data from
the Linus tree you already have on your system. (Strictly speaking,
you can avoid creating the "linus" remote to fetch it, but I feel this
is clearer).
export GIT_ALTERNATE_OBJECT_DIRECTORIES=/usr/src/linux-vanilla.git/objects
mkdir /usr/src/linux-wr
cd /usr/src/linux-wr
git init
git remote add linus /usr/src/linux-vanilla.git/objects
git remote add gnudd git://
git fetch linus
git fetch gnudd
git checkout -b wr-kernel gnudd/wrswitch2-dev
Please note that if you don't have a local "Linus" tree first, your
fetch from gnudd will take several hours. You should first fetch from
a mainstream server the official kernel to make this operation fast.
To make the "GIT_ALTERNATE_OBJECT_DIRECTORIES" setting persistent, you
can save it to local repository:
echo /usr/src/linux-vanilla/objects > .git/objects/info/alternates
Using tar and patch
If you are not a git user, you might apply the patches, with this
procedure, using your national mirror instead of
Let's assume your starting current directory is the one where this
README lives.
cd /usr/src/linux-wr
tar xjf linux-2.6.35.tar.bz2
mv linux-2.6.35/* linux-2.6.35/.??* .
rmdir linux-2.6.35
for n in in $DOCDIR/patches/2.6.35/*; do cat $n | patch -p1; done
Compiling the modules
To compile the drivers please run "make", after setting up
the proper environment variables:
should point to the kernel directory. For example,
export LINUX=/usr/src/linux-wr
should be the same prefix you used to cross-compile the
kernel. If CROSS_COMPILE_ARM is set, it is used as a
default (the name CROSS_COMPILE_ARM is used in wrdev2 scripts)
should be "arm", but the Makefile set it if not defined.
With the variables in place, after "make" you'll have a few kernel
modules, with extension ".ko", that should be copied to the target
system and loaded. Let's assume the target is T=
scp $(find . -name '*.ko') root@$T:/wr/lib/modules
The previous command assumes you either know the root password of your
private key is authorized in the target system. The latter happens if
you build the filesystem using wrdev2, which copies your public key to
the target.
Integration with wrdev2
Tomasz released some scripts, as a standalong "wrdev2.tar.gz" package
and available in the White Rabbit svn under "build_scripts". The svn
version is better as the ramdisk is made using initramfs rather then
This code is replacing part of that material with different
procedures, and integration is currently non-existent.
You are expected to build the switch system using the other script-set
and then replace the kernel and modules with what is available here.
Over time I plan to integrate better, and possibly replace wrdev2 by
bringing in here all the good material that is found there.
As I write this (Apr 2011) this repository is somewhat messy because
it's merge-in-progress between several packages written independently.
This is the NIC driver for white rabbit. It is definitely work in progress.
The source has not been tested (only compile-tested), and has been
laid out to be as understandable as possible, since I'm not the one
who's going to debug it.
These notes are for the ones who will debug my crap. The published one
will be different, hopefully.
* The Makefile
You can "export WRN_DEBUG=y" to force all pr_debug and netdev_dbg
into real printks (with KERN_DEBUG priority: you get them in dmesg
or you need to raise the console priority to see them on the console).
* The naming conventionss
wrn_ as a prefix is used for all functions and macros, so you
immediately know if sth is ours or comes from elsewhere
(as an exception, names of our own bits and registers are kept
as I got them, the context should say sth about what they arr)
wrn is always a pointer to the wr-nic overall structure
ep is the pointer to the endpoint structure
dev is the pointer to the network device (device.c is an
exception, is uses "netdev" instead, sorry for the confution)
* The different files
The module is called wr-nic.ko which comes from several object files.
This is the layout. Files which need to be fixed have FIXME inside and
in this list as well.
The directory includes the register lists. See the REAME
in there about how to recreate them.
This includes only #defines for magic project-wide constants.
It then includes the wbgen-generated headers for indivitual
register blocks.
the header is used for sharing stuff between sources. Unlike
the previous one, which it includes, it define kernel-level
registering and unregistering the module
the actual probe and remove functions, and the driver structure
Talking with the actual endpoints, including the probe part.
Mii/phy stuff is here, as well as the polling timer for link status.
standard networking stuff: interrupts and so on
FIXME: open and close must be verified
FIXME: everything is missing
ethtool operations
the pulse-per-second mechanism. This might want to be registered
in Linux using drivers/pps, but it must be looked at. This
file is currently registering itself as a timesource.
FIXME: everything
all the stuff related to timestamping
FIXME: a lot of stuff
calibration and readout
FIXME: everything
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment