Edit This Page Print this page

NetBSD support for the Mini2440

The FriendlyArm Mini2440 is a Single Board Computer based on the Samsung S3C2440 ARM9 CPU. It comes with either 64 MB of RAM and either 64MB or 128MB NAND Flash, and features 2MB NOR flash. For the full specs see the Mini2440 webpage at FriendlyArm.
Linux supports all features of the Mini2440, however, as far as I have found, no BSD systems have good support for the Mini2440. This project is an attempt to remedy this and learning some low-level programming at the same time. For this reason all code is written from scratch or based on existing NetBSD code, rather than trying to port the Linux code.
The basic support for the Samsung S3C2440 is based on the current S3C2410 in NetBSD, while the Mini2440 board support is based on the SMDK2410 board support code.

Git Repository

If you are interested in my latest development, I develop in the following git repository: 
git://gitorious.org/mini2440-netbsd/mini2440-netbsd.git

The development is against netbsd-current. 

Building a Kernel for MINI2440

The repository above supplies two kernel configurations for the MINI2440: MINI2440 which uses ld0f as root filesystem, and MINI2440_NFSROOT which uses a NFS root filesystem. Both configuration probably need to be adapted to your setup.

I use the build.sh-script to build both tools and the kernel itself. Assuming that the GIT repository has been checked out into /usr/local/netbsd/src, the following should build the MINI2440_NFSROOT kernel:

/usr/local/netbsd/src$ ./build -U -u -O ../obj -R ../release -T ../tools -m evbarm tools kernel=MINI2440_NFSROOT

Once the kernel has been build, the bootloader can be build by going to sys/arch/evbarm/mini2440/stand/bootloader and building it:

/usr/local/netbsd/src$ cd sys/arch/evbarm/mini2440/stand/bootloader
/usr/local/netbsd/src/sys/arch/evbarm/mini2440/stand/bootloader$ nbmake-evbarm

Note that this assumes that the path to nbmake-evbarm has to be in the path (probably located in /usr/local/netbsd/tools/bin), 

The bootloader will as default try to load netbsd.elf from ld0e, and  then try to boot via DHCP. This can be configured by editing Makefile (-DDEFAULT_BOOTFILE define).

Booting NetBSD on the MINI2440

The bootloader is  to be placed at 0x30A00000 in memory, and it will figure out how to place the kernel correctly.

Assuming that the bootloader is located on the first FAT partition on an SD-card, NetBSD can be booted with the following sequence in uboot:

MINI2440 # mmcinit
MINI2440 # fatload mmc0 0 0x30A00000 bootmini2440
MINI2440 # go 0x30A00000
...

 

Supported Features 

The table reflects that status of the git-repository. 

Feature  Status
Basic support for S3C2440

Done, boots both QEMU and real hardware.
Profiling works, but there seems to be a bit of a problem with the stat timer. 

S3C2440 UART
Done
DM9000 (MAC+PHY)

Partially Done: Works on the Mini2440 but only supports 16-bit transfer mode, and is generally a bit hacked.
Driver is "dm9000nic". 

S3C2440 SD Controller

Partially Done:

  • Supports only SD memory cards.
  • Has only been tested with 512MB, 1GB, and 2GB non-SDHC cards. 
  • There seem to be problems with SDHC cards.
  • DMA transfers are supported.
  • Wide bus transfers are supported.
S3C2440 DMA Controller

Partially Done: Supported well enough to use for transfers to/from the SD cards and the I2S bus:

  • One transfer per DMA channel a time, i.e. no queueing.
  • Byte, half-word, and word transfers are supported.
  • Only unit transfers, i.e. no burst 4 mode support.
  • Timeouts when waiting for transfers to complete.
  • Transfers can be aborted.
S3C2440 IIS Bus
Simple interface which supports playback and recording in Master mode only.
S3C2440 NAND Flash Controller Not Supported
S3C2440 LCD Controller
The S3C24x0 driver in netbsd-5 drives the LCD controller of the S3C2440 as well. The driver does, however, need some work.
FriendlyArm 7" LCD
Not Supported
FriendlyArm 3,5" LCD
Supported, but timings are not completely correct.
S3C2440 USB Host Controller
OHCI, works out-of the box with NetBSD OHCI drivers.
S3C2440 USB Device Controller
Not Supported
S3C2440 Touchscreen
Basic driver that provides a wscons mouse device and uses tpcalib for calibration.
A simple averaging filter is used to improve readings, which is a bit primitive. 
UDA1341TS (audio codec)
Supports playback, recording and most of the mixer controls.
S3C2440 RTC Not Supported 

 

 

Patches

 

Use GIT repository above instead of these patches. They are still listed here for completeness only. 

mini2440-20091028.patch
  • Initial patch which adds support for booting the Mini2440 (64MB version only) , UART, and a primitive DM9000 driver. 
  • Applies cleanly against netbsd-5.
mini2440-20091125.patch
  • Added support for the S3C2440 SD Controller and partial DMA support (enough for SD). 
  • The DM9000 driver was renamed to 'dm9000nic' to avoid name clashes with the device-mapper ('dm'). 
  • Applies cleanly against netbsd-5.
mini2440-20091228.patch
  • Fixed a bug in the DM9000 driver causing problems with transmitting data with a size not dividable by two. 
  • Generally improved the debug-output of the DM9000 driver.
  • DMA transfers can now be aborted, which gives a slightly more robust SD driver.
  • DMA transfers can be given a timeout when waiting for them to complete.
  • Replaced __set_cpsr_c with an assembly version in order to get profiling working. mcount was calling __set_cpsr_c, which in turn was calling mcount.
  • Applies cleanly against netbsd-5.
mini2440-20100108.patch
  • Added a simple driver for the S3C2440 touch controller.
  • Hacked S3C24x0 LCD controller driver to support HPCFBIO_GCON and WSDISPLAYIO_LINESBYTES ioctls.
  • Added display driver for the MINI2440 3,5" LCD display (NEC NL2432HC22)
  • Added event counting to the S3C2xx0 interrupt driver.
  • Applies cleanly against netbsd-5.

 


Modified: Thu 17-Feb-11 05:58:16 PST