Skip to main content.
Navigation:
DENX
>
PPCEmbedded
>
DeviceDrivers
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
PPCEmbedded
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
PPCEmbedded Home
Changes
Index
Search
Go
List of pages in PPCEmbedded
Search
%SECTION0{name=DeviceDrivers}% Device Drivers The kernel already includes device drivers for the on-chip serial and ethernet ports. %SECTION1{name=Examples}% Examples For helpful MPC8xx-specific device driver examples, see [[http://lists.linuxppc.org/listarcs/linuxppc-embedded/200001/msg00221.html]] [[ftp://ftp.denx.de/pub/LinuxPPC/usr/src/drivers.tar.gz]] %SECTION1{name=FlashDriver}% Flash memory %SECTION2{name=FlashDeviceDriver}% Flash Device Driver [[ftp://ftp.denx.de/pub/LinuxPPC/usr/src/CDK.tar.gz]] A flash driver will give you access to devices, which are useful during development and for field upgrades and are ideal for storing fixed size persistent configuration data like your board's Ethernet MAC address. This is true for drivers supporting a number of vendors' devices. The flash driver does auto-erase when the length of data written per *write()* is exactly the corresponding erase block size. So usually you just need to do: <verbatim> open (/dev/flash???) lseek(specific erase region) write(data, region size) </verbatim> %SECTION2{name=QSLinuxFlashDriver}% QSLinux Flash Driver * [[http://qslinux.org]] and [[ftp://qslinux.org]] QSLinux contains a fully functioning FLASH driver, and an interface to the Ext2FS filesystem, with compression. %SECTION2{name=MTD}% Memory Technology Device (MTD) Subsystem * [[http://www.linux-mtd.infradead.org/]] The MTD subsystem offers a more general solution which allows you to treat the flash as a regular block device on which you can mount a filesystem. It's ideal for large amounts of variable sized data or applications requiring a traditional writable filesystem, provided by the [[JFFS][JournalingFlashFilesystem]]. However, some work is required to get the MTD to run on PowerPC, as it does not yet support big endian. %SECTION2{name=DOC}% M-Systems Disk-On-Chip * [[http://www.linux-mtd.infradead.org/doc2000.html]] This is supported via the [[MTD][MemoryTechnologyDevice]] Subsystem. %SECTION1{name=PCMCIACards}% PCMCIA Cards For a PCMCIA driver, see [[http://lists.linuxppc.org/listarcs/linuxppc-embedded/200002/msg00093.html]] There are also some fairly detailed notes available at [[ftp://ftp.absoval.com/pub/rpxlite/]] and [[http://lists.linuxppc.org/listarcs/linuxppc-embedded/200005/msg00227.html]] For generic Linux PCMCIA info, see [[http://pcmcia.sourceforge.org/ftp/doc/PCMCIA-PROG.html]]. %SECTION1{name=IDE}% IDE/ATA Disk Drives There are lots of options for connecting IDE drives. You need to at least configure =CONFIG_BLK_DEV_IDE= and =CONFIG_BLK_DEV_IDEDISK=. Search for [[http://lists.linuxppc.org/cgi-bin/wilma/wilma_glimpse/linuxppc-embedded?query=IDE][IDE]]. Also, see [[http://www.bluebutton.com/proj/mbxlinux/]] %SECTION1{name=PCIBridge}% PCI Bridge * Search for [[http://lists.linuxppc.org/cgi-bin/wilma/wilma_glimpse/linuxppc-embedded?query=QSPAN][QSPAN]] or [[http://lists.linuxppc.org/cgi-bin/wilma/wilma_glimpse/linuxppc-embedded?query=PowerSpan][PowerSpan]]. %SECTION1{name=Watchdog}% Watchdog Using the on-chip watchdog to provide the basic "write kicked" _/dev/watchdog_ interface described in _Documentation/watchdog.txt_ is problematic, because the SYPCR register controlling it can only be written once after reset to both set the timeout and enable the watchdog. Once enabled, the boot loader and kernel must keep it from expiring up until the point where the user application opens _/dev/watchdog_. Littering the generic kernel decompress and startup codes with watchdog kicks to do this isn't acceptable to other Linux users. Hence, hardware watchdog support hasn't been implemented yet. The general plan to solve this problem is described in [[http://lists.linuxppc.org/listarcs/linuxppc-embedded/199910/msg00026.html]] You can probably use Linux's software watchdog in the meantime. %SECTION1{name=USB}% USB for MPC850/823 * [[http://www.honeywell.se/inu/usb/]] These devices can be made to operate as a USB host or slave. Search for [[http://lists.linuxppc.org/cgi-bin/wilma/wilma_glimpse/linuxppc-embedded?query=USB][USB]]. Also see the Programming Guide for Linux USB Device Drivers at [[http://usb.in.tum.de/usbdoc/]] %SECTION1{name=ADAndDA}% A/D and D/A Use something that "frames" the data and the SI/TDM interface works really sweet. Take a look at the CS4218 audio codec driver for the Embedded Planet boards. It's floating around in the 2.2.13 kernels on the MontaVista site. %SECTION1{name=VME}% VME Numerous VME [[CommercialBoards][boardvendors]] offer Linux support through software partners such as %REF{type=Section,topic=CompilerToolset,name=DENX,text=DENX}%. Some older patches and tarballs to use Linux on VME boards and simplify the access to the VME bus are available at [[ftp://vlab1.iram.es/pub/linux-vme/]] %SECTION1{name=HDLCPPP}% HDLC/PPP * [[http://qslinux.org/docs/snmc/hdlc/index.html]] Provides support for the HDLC protocol, running the PPP layer in order to transport IP packets across a synchronous serial link. %SECTION1{name=SPI}% SPI * [[ftp://216.118.31.75/pub/]] This driver is an interface for the [[SPI]] controller in MPC8xx. The driver is written to work with the microcode patches to correct the parameter RAM problems. The driver supports basic init, open, close, read, and write functions. %SECTION1{name=LinuxSTREAMS}% Linux STREAMS (LiS) * [[http://www.gcom.com/home/linux/lis/]] LiS is a software package that comprises an implementation of SVR4-compatible STREAMS for Linux in the form of a loadable kernel module. A patch to port it to MPC8xx based Embedded PowerPC systems is available at [[ftp://ftp.denx.de/pub/LinuxPPC/usr/src/LiS/]] %SECTION1{name=AccessingPeripheralsFromUserSpace}% Accessing peripherals from user space This code snippet is for accessing hardware registers from *user* space. The program needs CAP_SYS_RAWIO and /dev/mem permissions. Don't forget -O compile optimisation for asm inline's. <verbatim> /* * Usage: * volatile void *p = ioremap(MY_HARD_REG_ADDR, 4096); * ... * out_8(p, state ^= 0x1); * * * Copyright (C) 2003 Stephane Fillod */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> #ifdef __PPC__ extern inline void out_8(volatile unsigned char *addr, unsigned val) { __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); } /* etc., cf asm/io.h */ #else extern inline void out_8(volatile unsigned char *addr, unsigned val) { *addr = val & 0xff; } #endif volatile void * ioremap(unsigned long physaddr, unsigned size) { static int axs_mem_fd = -1; unsigned long page_addr, ofs_addr, reg, pgmask; void* reg_mem = NULL; /* * looks like mmap wants aligned addresses? */ pgmask = getpagesize()-1; page_addr = physaddr & ~pgmask; ofs_addr = physaddr & pgmask; /* * Don't forget O_SYNC, esp. if address is in RAM region. * Note: if you do know you'll access in Read Only mode, * pass O_RDONLY to open, and PROT_READ only to mmap */ if (axs_mem_fd == -1) { axs_mem_fd = open("/dev/mem", O_RDWR|O_SYNC); if (axs_mem_fd < 0) { perror("AXS: can't open /dev/mem"); return NULL; } } /* memory map */ reg_mem = mmap( (caddr_t)reg_mem, size+ofs_addr, PROT_READ|PROT_WRITE, MAP_SHARED, axs_mem_fd, page_addr ); if (reg_mem == MAP_FAILED) { perror("AXS: mmap error"); close(axs_mem_fd); return NULL; } reg = (unsigned long )reg_mem + ofs_addr; return (volatile void *)reg; } int iounmap(volatile void *start, size_t length) { unsigned long ofs_addr; ofs_addr = (unsigned long)start & (getpagesize()-1); /* do some cleanup when you're done with it */ return munmap((void*)start-ofs_addr, length+ofs_addr); } </verbatim>
10. Kernel
1. Introduction
12. Runtime Library
Prev
Home
Next