Add New Notes

This commit is contained in:
geekard
2012-08-08 14:26:04 +08:00
commit 5ef7c20052
2374 changed files with 276187 additions and 0 deletions

14
Zim/Research/802.11p.txt Normal file
View File

@@ -0,0 +1,14 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T20:06:34+08:00
====== 802.11p ======
Created Wednesday 22 February 2012
http://baike.baidu.com/view/4327881.html?fromTaglist
802.11p ----- 无线局域网标准用于智能交通ITS。
  据称将由IEEE于2010年11月颁布。
  IEEE 802.11p又称WAVE,Wireless Access in the Vehicular Environment是一个由IEEE 802.11标准扩充的通信协议主要用于车载电子无线通信。它本质上是IEEE 802.11的扩充延伸符合智能交通系统ITSIntelligent Transportation Systems的相关应用。应用层面包括高速车辆之间以及车辆与ITS路边基础设施5.9千兆赫频段之间的数据交换。__IEEE 1609__标准则基于__IEEE 802.11p__通信协议的**上层应用标准**。
  802.11p将被用在车载通讯或称专用短距离通讯Dedicated Short Range CommunicationsDSRC系统中这是一个美国交通部U.S. Department of Transportation基于欧洲针对车辆的通讯网路特别是电子道路收费系统、车辆安全服务与车上的商业交易系统等应用而规划的中长距离继续传播空气介面ContinuousAir interfaces - Long and Medium RangeCALM系统的计划。该计划最终的愿景是建立一个允许车辆与路边无线接取器或是其他车辆间的通讯的全国性网络。这项工作的基础是ASTM E2213-03计划。
相关介绍:
  IEEE 802.11p 对传统的无线短距离网络技术加以扩展,可以实现对汽车非常有用的功能,包括:更先进的切换机制(handoff scheme)、移动操作、增强安全、识别(identification)、对等网络(peer-to-peer)认证。最重要的是在车载规定频率上进行通信。将充当DSRC(专用短程通讯)或者面向车载通讯的基础。车载通讯可以在汽车之间进行,也可以是汽车与路边基础设施网络之间进行。 从技术上来看对进行了多项针对汽车这样的特殊环境的改进如更先进的热点切换、更好地支持移动环境、增强了安全性、加强了身份认证等若要实现真正商用不同厂商产品间的互通性至关重要因此首先将标准在IEEE获得通过至关重要现在看来这似乎不是什么难事。目前的车载通信市场很大部分上由手机通信所主导但客观上说蜂窝通信覆盖成本比较高昂提供的带宽也比较有限。而使用802.11p有望降低部署成本、提高带宽、实时收集交通信息等而且支持身份认证则有望使代替RFID技术。 上述的优势有助于刺激厂商将Wi-Fi尤其是内置入汽车中而为节省成本和方便起见厂商极有可能将与传统的a/b/g工作于同一频段之中或者是整合这些标准的多模产品。使用IEEE的汽车厂商还有可能获得车载通信的运营权。

View File

@@ -0,0 +1,114 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T21:21:05+08:00
====== Hostapd介绍 ======
Created Wednesday 22 February 2012
http://blog.csdn.net/hinyunsin/article/details/6029663
===== Hostapd简介 =====
简单说hostapd能够使得无线网卡切换为__master模式__模拟AP(通常可以认为是路由器)功能也就是我们说的__软AP__(Soft AP)。
Hostapd的功能就是作为__AP的认证服务器__负责控制管理__stations__(通常可以认为带无线网卡的PC)的接入和认证。
通过Hostapd可以将无线网卡切换为__AP/Master模式__通过修改配置文件可以建立一个开放式的(不加密)的WEPWPA或WPA2的无线网络。并且通过修改配置文件可以设置无线网卡的各种参数包括频率信号beacon包时间间隔是否发送beacon包如果响应探针请求等等。还可以设置mac地址过滤条件等。具体可以参考它的配置文件说明。
下面就从官网上摘下的部分原因及翻译。翻译的不好请见谅。
hostapd is an IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.
Hostapd是IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP/RADIUS的认证器
**hostapd is a user space daemon **for access point and authentication servers. It implements IEEE 802.11 access point management, IEEE 802.1X/WPA/WPA2/EAP Authenticators, RADIUS client, EAP server, and RADIUS authentication server. The current version supports Linux (Host AP, madwifi, mac80211-based drivers) and FreeBSD (net80211).
Hostapd是一个访问点以及认证服务器的运行于用户空间的守护程序。它实现了IEEE 802.11接入带你(Access Point)的管理功能是IEEE 802.1X/WPA/WPA2/EAP的认证器,是 RADIUS client, EAP server, and RADIUS认证服务器。当前版本的hostapd支持linux上Host APmadwifi和基于mac80211协议栈的驱动程序以及FreeBSD上net80211协议栈的驱动程序。
hostapd is designed to be a "daemon" program that runs in the background and acts as the backend component controlling authentication. hostapd supports separate frontend programs and an example text-based frontend, hostapd_cli, is included with hostapd.
Hostapd是一个后台守护进程作为后台组件来控制和管理认证功能。Hostapd支持多个前台程序。hostapd_cli就是一个跟hostapd一起的命令行前台程序。
===== 支持特性 =====
Supported WPA/IEEE 802.11i/EAP/IEEE 802.1X features
支持WPA/IEEE 802.11i/EAP/IEEE 802.1X
WPA-PSK ("WPA-Personal")
WPA with EAP (with integrated EAP server or an external RADIUS backend authentication server) ("WPA-Enterprise")
key management for CCMP, TKIP, WEP104, WEP40
WPA and full IEEE 802.11i/RSN/WPA2
RSN: PMKSA caching, pre-authentication
IEEE 802.11r
IEEE 802.11w
RADIUS accounting
RADIUS authentication server with EAP
Wi-Fi Protected Setup (WPS)
Supported EAP methods (integrated EAP server and RADIUS authentication server)
EAP-TLS
EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1)
EAP-PEAP/TLS (both PEAPv0 and PEAPv1)
EAP-PEAP/GTC (both PEAPv0 and PEAPv1)
EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1)
EAP-TTLS/EAP-MD5-Challenge
EAP-TTLS/EAP-GTC
EAP-TTLS/EAP-MSCHAPv2
EAP-TTLS/MSCHAPv2
EAP-TTLS/EAP-TLS
EAP-TTLS/MSCHAP
EAP-TTLS/PAP
EAP-TTLS/CHAP
EAP-SIM
EAP-AKA
EAP-AKA'
EAP-PAX
EAP-PSK
EAP-SAKE
EAP-FAST
EAP-IKEv2
EAP-GPSK
Following methods are also supported, but since they do not generate keying material, they cannot be used with WPA or IEEE 802.1X WEP keying.
同样支持下面的这些功能但是这些不生成建钥资料所以它们不能够WPA 或者 IEEE 802.1X WEP一同使用
EAP-MD5-Challenge
EAP-MSCHAPv2
EAP-GTC
EAP-TNC (Trusted Network Connect; TNCS, IF-IMV, IF-T, IF-TNCCS)
===== 支持的无线网卡/驱动 =====
Linux mac80211 drivers
Host AP driver for Prism2/2.5/3
** madwifi** (Atheros ar521x) #已被__ath,ath5k,ath9k__取代
BSD net80211 layer (e.g., Atheros driver) (FreeBSD 6-CURRENT)
===== 如何确定一款无线网卡是否能被hostpad支持 =====
以ubuntu10.04为例
执行sudo aptitude install iw安装无线配置工具iw
执行__iw list__如果在下面的结果中出现AP字样那么就表示这款网卡支持hostapd
**Supported interface modes:**
* IBSS (Ad-Hoc)
* managed
* AP
* AP/VLAN
* WDS
* monitor
* mesh point
===== 推荐网址 =====
http://hostap.epitest.fi/hostapd/
http://wireless.kernel.org/en/users/Documentation/hostapd
https://help.ubuntu.com/community/WifiDocs/MasterMode
http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=hostapd/hostapd.conf

View File

@@ -0,0 +1,75 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T21:25:21+08:00
====== hostapd原理 ======
Created Wednesday 22 February 2012
http://haohetao.iteye.com/blog/1135353
* Wireless-Extensions--旧的无线驱动框架即wicd设置中的wext
* mac80211--为softMAC驱动服务的API
* cfg80211--新的配置API
* __nl80211__--新的用户控件<->内核空间通讯方式(一般系统内核并__没有编译__没有该模块)
[geekard@geekard ~]$ modinfo __cfg80211__
filename: /lib/modules/3.2.5-1-ARCH/kernel/net/wireless/cfg80211.ko.gz
description: **wireless configuration support**
license: GPL
author: Johannes Berg
depends: **rfkill**
[geekard@geekard ~]$ modinfo __mac80211 __#mac(media access control)
filename: /lib/modules/3.2.5-1-ARCH/kernel/net/mac80211/mac80211.ko.gz
license: GPL
description: ** IEEE 802.11 subsystem**
depends: **cfg80211**
intree: Y
[geekard@geekard ~]$ modinfo __rfkill__
filename: /lib/modules/3.2.5-1-ARCH/kernel/net/rfkill/rfkill.ko.gz
license: GPL
description: ** RF switch support (射频切换)**
author: Johannes Berg <johannes@sipsolutions.net>
author: Ivo van Doorn <IvDoorn@gmail.com>
depends:
[geekard@geekard ~]$
===== 组件交互的基本原理图 =====
[Wireless Card]
|
[Linux Kernel ]
|
[**udev**][libnl]-[__iw__]
| / \
[crda] \
| \
[ Wireless ] |[Regulatory] |[ Database ] |
|
|
[ hostapd ]
===== 理解每一部分是做什么的: =====
Wireless Card: Should be self explanitory... handles sending/receiving wireless packets
无线网卡:操作接收/发达无线包
Linux Kernel: The linux kernel contains the driver for the wireless card, the __mac80211 subsystem__ which handles packet generation and scheduling, and the __nl80211 subsystem__, which handles configuring the wireless interfaces for userspace
linux核linux核包涵了无线网尗的驱动mac80211子系统 处理包的产生与时序安排。nl80211处理__在用户空间配置无线接口__ cfg80211
__libnl: __libnl is the transport layer used to communicate with the kernel via __netlink__
libnl: 通过netlink与内核对话的传输层
__udev: __udev is the facility the kernel uses to pass events/calls to crda
udev:udev是内核通过events/calls到 crda的设施
__iw: __iw is a userspace utility that we can use to test that libnl is working correctly, as well as create additional virtual wireless interfaces on the wireless card
iw:是我们用来测试 libnl是否正确工作以及在无线网卡上创建额外的虚拟无线接口的用户空间工具 。
__crda: __**crda is a userspace program** that the kernel queries (through udev) to find what channels/frequencies are usable, and at what powers. This moves the information out of static tables maintained in kernel to userspace, which allows them to be updated without reloading drivers/rebooting
crda:是内核通过udev来查找什么频段频率是有效的在什么强度的用户空间程序。这个从内核维护的静态表中移到用户空间它可以不需要重载驱动和重启的情况下更新。
Wireless Regulatory Database: database of allowable frequencies and transmit power levels used by crda
无线控制数据库crda使用允许的频率和传输强度等级的数据库
__hostapd: __This is the daemon that handles generation of beacons and other wireless packets, as wel as wpa-psk, wpa2, etc encryptions.
hostapd:这是个用来操作信号的产生和其它无线包以及wpa-psk, wpa2等加密的守护进程。softMAC是一个用于描述无线网尗的类型的一个术语。

View File

@@ -0,0 +1,9 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T20:55:12+08:00
====== iw3945不支持AP模式 ======
Created Wednesday 22 February 2012
Driver Manufacturer cfg80211 AP IBSS mesh monitor PHY modes Buses
ath5k Atheros yes yes yes yes yes A/B/G PCI / PCI-E / PCMCIA
iwl3945 Intel yes __no__ __yes__ no no A/B/G PCI-E

View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-21T13:10:55+08:00
====== Error Notes ======
Created Tuesday 21 February 2012

View File

@@ -0,0 +1,29 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-08-05T18:21:54+08:00
====== b43 ======
Created Sunday 05 August 2012
Broadcom的BCM9 4318MPG系列miniPCI网卡需要在kernel中编译相应的驱动同时还要使用固件。
驱动位于kernel中的wireless menu中固件需要单独下载。注意firmware是由网卡芯片执行的所以
与CPU体系结构无关只需将其放到目标板的/lib/firmware/b43目录下即可(最后需要运行./ltib --config命令重新生
成rootfs.ext2.gz.uboot目录)。
broadcom的firmware按一下方法安装
wget http://bues.ch/b43/fwcutter/b43-fwcutter-015.tar.bz2
tar xvf b43-fwcutter-015.tar.bz2
cd b43-fwcutter-015/
make
sudo make install #安装fwcutter工具到host中
cd ..
export FIRMWARE_INSTALL_DIR="/lib/firmware"
wget http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2
tar xvf broadcom-wl-5.100.138.tar.bz2
sudo b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" broadcom-wl-5.100.138/linux/wl_apsta.o
ls /lib/firmware/b43/
sudo chmod -R 755 /lib/firmware/b43/
ls /lib/firmware/b43/
sudo mkdir -p ~/PPC/ltib-mpc8315erdb-20100719/rootfs/lib/firmware/b43
sudo cp /lib/firmware/b43/{bog*,ucode5.fw} [[~/PPC/ltib-mpc8315erdb-20100719/rootfs/lib/firmware/b43]]

View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-21T16:08:11+08:00
====== 下载错误 ======
Created Tuesday 21 February 2012

View File

@@ -0,0 +1,56 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-21T13:11:59+08:00
====== Bad Data CRC ======
Created Tuesday 21 February 2012
http://e2e.ti.com/support/embedded/linux/f/354/t/43146.aspx
解决方法将主机的MTU设为大于1468如1500即可
# ifconfig eth0 mtu 1500
-------------------------------------------------
Hi Tim,
Thanks for debugging this.
The only way forward here is to use wireshark or an equivalent network sniffer on the TFTP host and see what could __be wrong with the transfers__.
Looking at the data my guess is that __your host ethernet card is unable to handle MTU sized packets__. Note that I am still suspecting the host only because I haven't seen this problem on my setup nor see widespread complaints regarding this issue.
The 0x5BC in your analysis corresponds to 1468 which is what seems to be presented as block size option to the server:
96 /* 512 is poor choice for ethernet, **MTU is typically 1500.**
97 * Minus eth.hdrs thats __1468__. Can get 2x better throughput with
98 * almost-MTU block sizes. At least try... fall back to 512 if need be.
99 * (but those using CONFIG_IP_DEFRAG may want to set a larger block in cfg file)
100 */
101 #ifdef CONFIG_TFTP_BLOCKSIZE
102 #define TFTP_MTU_BLOCKSIZE CONFIG_TFTP_BLOCKSIZE
103 #else
104 #define TFTP_MTU_BLOCKSIZE __1468__
105#endif
Looking further into the code, it looks like this value can be overridden using the __"tftpblocksize"__ environment variable. Can you please set this variable to something lower say 1024 bytes and try tftp again?
Thanks,
Sekhar
---------------------------------------------------
Hey Sekhar & Anshuman:
We finally got this resolved. __It had to do with the MTU packet size in the u-boot image being set to 1468__. I was using a value of 1300 on my PC. To fix this, I did the following:
In the u-boot srouce code directory, I changed the file (__net/tftp.c__) in the u-boot source directory from:
#define TFTP_MTU_BLOCKSIZE 1468
static unsigned short TftpBlkSize=TFTP_BLOCK_SIZE;
static unsigned short TftpBlkSizeOption=TFTP_MTU_BLOCKSIZE;
to:
#define TFTP_MTU_BLOCKSIZE __1024__
static unsigned short TftpBlkSize=TFTP_BLOCK_SIZE;
static unsigned short TftpBlkSizeOption=TFTP_MTU_BLOCKSIZE;
and then rebuilt u-boot using the following:
make distclean
make **davinci_dm365_evm_config**
make
I used CCS to reflash the u-boot file on my FLASH on the board and then powered up the board using my Windows XP TFTP server and my VMWare Linux TFTP server and it worked just fine. Looks like the MTU packet size was different on the DM365 EVM relative to what I was using with my DM6446 and DM6467 and DM6467T EVMs. The MTU packet size on my PC was set at 1300__ to force it to use smaller packet sizes __from previous work I was doing with multicasting of video and needed smaller packet sizes to minimize packet losses.

View File

@@ -0,0 +1,47 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-21T13:05:46+08:00
====== chosen node create failed ======
Created Tuesday 21 February 2012
http://www.embeddedlinuxprimer.com/dtc
===== Using Device Tree Compiler =====
Get the dtc compiler and build it:
From your favorite working directory:
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/galak/dtc.git
$ cd dtc
$ make
$ sudo make install
To generate dtb source from the binary blob (dtb)
**$ dtc -I dtb -O dts /tftpboot/mpc8349.dtb >/tftpboot/mpc8349.dts**
To generate the dtb binary blob from source:
$ **dtc -O dtb arch/powerpc/boot/dts/mpc8349emitx.dts -S 20000 > /tftpboot/mpc8349emitx.dtb**
-S argument sets some spare space for the u-boot to add /choosen (and
some other) nodes.
------------------------------------------------------------------------
By challinan at 2008-11-26 08:29
Login or register to post comments
===== U-Boot Error: /chosen node create failed =====
If you get an error like this when you try to boot a kernel using U-Boot:
ERROR: /chosen node create failed - must RESET the board to recover.
It generally means that you __need to add some padding to your device tree binary__ (blob!). U-Boot tries to create nodes in your dtb, and if there is no room to create these nodes, it fails with an error similar to this one.
__Use -S as above__, to add additional padding to the dtb.
注意,只使用-S参数是不行的还要指定-R 参数。如下:
# __dtc -I dts -O dtb -R 8 -S 20000 mpc8315erdb-default.dts >mpc8315erdb-default.dtb__
注意上面的命令必须在root环境下运行(sudo不合适)因为dtc是一个脚本。
from
http://lists.denx.de/pipermail/u-boot/2007-December/027167.html

View File

@@ -0,0 +1,86 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-20T21:11:32+08:00
====== u-boot ======
Created Monday 20 February 2012
Filesystem stats, including padding:
Total size = 16028k
Total number of files = 605
Your ramdisk exceeds the old default size of 4096k, you may need to
set the command line argument for ramdisk_size in your bootloader
allowing 10% free this gives 17630k . For instance, for u-boot:
setenv bootargs root=/dev/ram rw ramdisk_size=17630
creating an ext2 compressed filesystem image: rootfs.ext2.gz
genext2fs: Running in LTIB backwards compatibility mode: -i -> -N
creating a uboot ramdisk image: rootfs.ext2.gz.uboot
Image Name: uboot ext2 ramdisk rootfs
Created: Mon Feb 20 20:47:49 2012
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
Data Size: 4764328 Bytes = 4652.66 kB = 4.54 MB
Load Address: 0x00000000
Entry Point: 0x00000000
Started: Mon Feb 20 20:40:22 2012
Ended: Mon Feb 20 20:47:49 2012
Elapsed: 447 seconds
Build Succeeded
==============3.1.8内核====================
WARN: /home/geekard/ppc/ltib-mpc8315erdb-20100719/rootfs.tmp/sbin/sln statically linked
WARN: /home/geekard/ppc/ltib-mpc8315erdb-20100719/rootfs.tmp/sbin/ldconfig statically linked
Filesystem stats, including padding:
Total size = 56860k
Total number of files = 885
Your ramdisk exceeds the old default size of 4096k, you may need to
set the command line argument for ramdisk_size in your bootloader
allowing 10% free this gives 62546k . For instance, for u-boot:
setenv bootargs root=/dev/ram rw ramdisk_size=62546
creating an ext2 compressed filesystem image: rootfs.ext2.gz
genext2fs: Running in LTIB backwards compatibility mode: -i -> -N
creating a uboot ramdisk image: rootfs.ext2.gz.uboot
Image Name: uboot ext2 ramdisk rootfs
Created: Tue Feb 21 17:07:03 2012
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
Data Size: 13446544 Bytes = 13131.39 kB = 12.82 MB
Load Address: 0x00000000
Entry Point: 0x00000000
Started: Tue Feb 21 17:04:48 2012
Ended: Tue Feb 21 17:07:03 2012
Elapsed: 135 seconds
Build Succeeded
== ============latest(/tftp.bak)======== ==
setenv bootargs root=/dev/ram rw ramdisk_size=61586
== ===========latest(/tftp)============ ==
setenv bootargs root=/dev/ram rw ramdisk_size=66959
== ====latest(libnl)================= ==
setenv bootargs root=/dev/ram rw ramdisk_size=67337
== latest(iw)=================== ==
setenv bootargs root=/dev/ram rw ramdisk_size=67460
== ========crda====== ==
setenv bootargs root=/dev/ram rw ramdisk_size=68613

View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T11:36:40+08:00
====== 启动相关 ======
Created Wednesday 22 February 2012

View File

@@ -0,0 +1,32 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-08-05T13:14:27+08:00
====== ath5k dump ======
Created Sunday 05 August 2012
[root@mpc8315erdb /home]#
irq 48: nobody cared (try booting with the "irqpoll" option)
Call Trace:
[dfff7f00] [c0007ac8] 0xc0007ac8 (unreliable)
[dfff7f40] [c0054b58] 0xc0054b58
[dfff7f60] [c0054e98] 0xc0054e98
[dfff7f90] [c0052ec4] 0xc0052ec4
[dfff7fd0] [c0052ff0] 0xc0052ff0
[dfff7fe0] [c00555c8] 0xc00555c8
[dfff7ff0] [c000cd3c] 0xc000cd3c
[c03b3eb0] [c0005534] 0xc0005534
[c03b3ee0] [c000eb80] 0xc000eb80
--- Exception: 501 at 0xc00085c8
LR = 0xc00085c8
[c03b3fa0] [c0008590] 0xc0008590 (unreliable)
[c03b3fc0] [c036d7a0] 0xc036d7a0
[c03b3ff0] [00003438] 0x003438
handlers:
[<e199ba00>] 0xe199ba00
__Disabling IRQ #48__
[root@mpc8315erdb /home]#
这是由于PCB板子上的中断线是漏极开漏的但是没有加上拉电阻这样就一直处于低电平。
kernel启动后认为是外部产生的中断所以执行ath5k的中断代码该代码会查找设备的中断状态
寄存器,但是读到的值为空(因为设备其实并没有产生中断)。所以提示nobody cared。

View File

@@ -0,0 +1,10 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-08-03T15:12:28+08:00
====== uboot bdinfo输出的memsize不对 ======
Created Friday 03 August 2012
这是由于comm/cmd_bdinfo.c中的print_lnum("memsize", bd->bi_memsize)使用的是64位的printf。需要将printf_lnum改为print_num()即可。
这个错误并不致命,修改与否都可以。

View File

@@ -0,0 +1,12 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T11:36:56+08:00
====== 内核不输出启动信息 ======
Created Wednesday 22 February 2012
这可能与uboot的环境变量bootargs中console设置错误有关正确的应该为
setenv bootargs root=/dev/ram rw console=ttyS0,115200 ramdisk_size=xxxx
注意ramdisk_size大小要和ltib输出的一致但可以比后者大否则kernel启动的最后
在mount该文件时会出错。

View File

@@ -0,0 +1,17 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T13:02:36+08:00
====== 调用ifconfig设置进行IP地址的设置提示Cannot assign requested address ======
Created Wednesday 22 February 2012
http://hi.baidu.com/wang_jianguang/blog/item/e6d4904c9e0ecd3aaec3abdb.html
Linux昨天晚上终于跑起来了文件系统也可以用了我在开机时调用ifconfig设置进行IP地址的设置可是总是会显示
ifconfig: SIOCSIFFLAGS: Cannot assign requested address
很纳闷网上查了一下__原来是MAC地址的问题__经过以下的处理就OK啦~
# ifconfig eth0 down
# ifconfig eth0 hw ether 00:00:AA:BB:CC:DD
# ifconfig eth0 up
eth0: link down
# ifeth0: link up, 100Mbps, full-duplex, lpa 0xCDE1

View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-21T16:08:40+08:00
====== 编译错误 ======
Created Tuesday 21 February 2012

View File

@@ -0,0 +1,63 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-08-04T18:48:18+08:00
====== busybox ======
Created Saturday 04 August 2012
1. 在编译老版本的busybox时出现
+ make menuconfig 'HOSTCC=ccache /usr/bin/gcc -B/usr/bin/'
Makefile:421: *** mixed implicit and normal rules. Stop.
error: Bad exit status from /home/geekard/PPC/ltib-mpc8315erdb-20100719/tmp/rpm-tmp.23736 (%build)
这是由于make工具版本太高的原因可以降级make为3.8.1或者升级busybox到最新版。我们__采用后者__方法。
2.下载最新版busybox。
[geekard@kb310 ltib-mpc8315erdb-20100719]$ rm -rf rpm/BUILD/busybox-1.11.2/*
[geekard@kb310 ltib-mpc8315erdb-20100719]$ rm -rf tmp/*
[geekard@kb310 ltib-mpc8315erdb-20100719]$ cp -r modify/busybox-1.20.2/* rpm/BUILD/busybox-1.11.2/
[geekard@kb310 ltib-mpc8315erdb-20100719]$ [[./ltib]] --config #注意在package list中选中configure busybox at build time
3. 编译时出错:
loginutils/passwd.c: In function 'passwd_main':
loginutils/passwd.c:104:16: error: storage size of 'rlimit_fsize' isn't known
loginutils/passwd.c:188:2: warning: implicit declaration of function 'setrlimit' [-Wimplicit-function-declaration]
loginutils/passwd.c:188:12: error: 'RLIMIT_FSIZE' undeclared (first use in this function)
loginutils/passwd.c:188:12: note: each undeclared identifier is reported only once for each function it appears in
loginutils/passwd.c:104:16: warning: unused variable 'rlimit_fsize' [-Wunused-variable]
make[1]: *** [loginutils/passwd.o] Error 1
make: *** [loginutils] Error 2
make: *** Waiting for unfinished jobs....
-------------------------------------------------------------------
http://lists.busybox.net/pipermail/busybox/2012-May/077766.html
Fix this by including sys/resource.h.
Signed-off-by: Markus Trippelsdorf <markus at trippelsdorf.de>
---
include/libbb.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/libbb.h b/include/libbb.h
index f12800f..e7806c2 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -40,6 +40,7 @@
#include <sys/poll.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
--
Markus
------------------------------
4. 提示找不到rpc/rpc.h文件
util-linux/mount.c:134:22: fatal error: rpc/rpc.h: No such file or directory
compilation terminated.
make[1]: *** [util-linux/mount.o] Error 1
make: *** [util-linux] Error 2
error: Bad exit status from /home/geekard/PPC/ltib-mpc8315erdb-20100719/tmp/rpm-tmp.84999 (%build)
这是由于glibc>2.16后将SUN RPC系列组件从glibc中删除了代之的是librpc项目库。解决方式是去掉mount命令的NFS文件类型选项。
Linux System Utilities —> [ ] mout support NFS filesystem on linux

View File

@@ -0,0 +1,17 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-08-05T18:18:20+08:00
====== crdb ======
Created Sunday 05 August 2012
在编译kernel时需要选中Network Supporting-->Wireless中的
[*] use statically compiled regulatory rules database
该database文件可以用git获取
git clone git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
目录中的db.txt即为database文件。然后将该文件复制到kernel的net/wiress目录中然后重新编译kernle即可
[geekard@kb310 ltib-mpc8315erdb-20100719]$ cp db.txt ~/PPC/source/linux-3.4.7/net/wireless/
附:
[[./db001.txt]]

View File

@@ -0,0 +1,702 @@
# This is the world regulatory domain
country 00:
(2402 - 2472 @ 40), (3, 20)
# Channel 12 - 13. No HT40 channel fits here
(2457 - 2482 @ 20), (3, 20), PASSIVE-SCAN, NO-IBSS
# Channel 14. Only JP enables this and for 802.11b only
(2474 - 2494 @ 20), (3, 20), PASSIVE-SCAN, NO-IBSS, NO-OFDM
# Channel 36 - 48
(5170 - 5250 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS
# NB: 5260 MHz - 5700 MHz requies DFS
# Channel 149 - 165
(5735 - 5835 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS
country AE:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country AL:
(2402 - 2482 @ 20), (N/A, 20)
country AM:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 18)
(5250 - 5330 @ 20), (N/A, 18), DFS
country AN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country AR:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country AT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country AU:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 23)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country AW:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country AZ:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
(5250 - 5330 @ 40), (N/A, 18), DFS
country BA: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country BB:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 23)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country BD:
(2402 - 2482 @ 40), (N/A, 20)
country BE: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country BG: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 23)
(5250 - 5290 @ 40), (N/A, 23), DFS
(5490 - 5710 @ 40), (N/A, 30), DFS
country BH:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
(5735 - 5835 @ 20), (N/A, 20)
country BL:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
(5250 - 5330 @ 40), (N/A, 18), DFS
country BN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5735 - 5835 @ 40), (N/A, 30)
country BO:
(2402 - 2482 @ 40), (N/A, 30)
(5735 - 5835 @ 40), (N/A, 30)
country BR:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country BY:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country BZ:
(2402 - 2482 @ 40), (N/A, 30)
(5735 - 5835 @ 40), (N/A, 30)
country CA:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country CH: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country CL:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5735 - 5835 @ 40), (N/A, 20)
country CN:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
(5850 - 5930 @ 20), (N/A, 30)
country CO:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country CR:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country CS:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country CY: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
# Data from http://www.ctu.eu/164/download/VOR/VOR-12-08-2005-34.pdf
# and http://www.ctu.eu/164/download/VOR/VOR-12-05-2007-6-AN.pdf
# Power at 5250 - 5350 MHz and 5470 - 5725 MHz can be doubled if TPC is
# implemented.
country CZ: DFS-ETSI
(2400 - 2483.5 @ 40), (N/A, 100 mW)
(5150 - 5250 @ 40), (N/A, 200 mW), NO-OUTDOOR
(5250 - 5350 @ 40), (N/A, 100 mW), NO-OUTDOOR, DFS
(5470 - 5725 @ 40), (N/A, 500 mW), DFS
# Data from "Frequenznutzungsplan" (as published in April 2008), downloaded from
# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38448/publicationFile/2659/Frequenznutzungsplan2008_Id17448pdf.pdf
# For the 5GHz range also see
# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38216/publicationFile/6579/WLAN5GHzVfg7_2010_28042010pdf.pdf
# The values have been reduced by a factor of 2 (3db) for non TPC devices
# (in other words: devices with TPC can use twice the tx power of this table).
# Note that the docs do not require TPC for 5150--5250; the reduction to
# 100mW thus is not strictly required -- however the conservative 100mW
# limit is used here as the non-interference with radar and satellite
# apps relies on the attenuation by the building walls only in the
# absence of DFS; the neighbour countries have 100mW limit here as well.
country DE: DFS-ETSI
# entries 279004 and 280006
(2400 - 2483.5 @ 40), (N/A, 100 mW)
# entry 303005
(5150 - 5250 @ 40), (N/A, 100 mW), NO-OUTDOOR
# entries 304002 and 305002
(5250 - 5350 @ 40), (N/A, 100 mW), NO-OUTDOOR, DFS
# entries 308002, 309001 and 310003
(5470 - 5725 @ 40), (N/A, 500 mW), DFS
country DK: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country DO:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country DZ:
(2402 - 2482 @ 40), (N/A, 20)
country EC:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country EE: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country EG:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
country ES: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country FI: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country FR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country GE:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
(5250 - 5330 @ 40), (N/A, 18), DFS
country GB: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country GD:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country GR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country GL: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
(5490 - 5710 @ 20), (N/A, 27), DFS
country GT:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country GU:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country HN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country HK:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country HR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country HT:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country HU: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country ID:
(2402 - 2482 @ 40), (N/A, 20)
country IE: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country IL:
(2402 - 2482 @ 40), (N/A, 20)
(5150 - 5250 @ 40), (N/A, 200 mW), NO-OUTDOOR
(5250 - 5350 @ 40), (N/A, 200 mW), NO-OUTDOOR, DFS
country IN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5735 - 5835 @ 40), (N/A, 20)
country IS: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country IR:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country IT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country JM:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country JP:
(2402 - 2472 @ 40), (N/A, 20)
(2457 - 2482 @ 20), (N/A, 20)
(2474 - 2494 @ 20), (N/A, 20), NO-OFDM
(4910 - 4930 @ 10), (N/A, 23)
(4910 - 4990 @ 40), (N/A, 23)
(4930 - 4950 @ 10), (N/A, 23)
(5030 - 5045 @ 10), (N/A, 23)
(5030 - 5090 @ 40), (N/A, 23)
(5050 - 5060 @ 10), (N/A, 23)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 23), DFS
country JO:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
country KE:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country KH:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country KP:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5330 @ 40), (3, 20)
(5160 - 5250 @ 40), (3, 20), DFS
(5490 - 5630 @ 40), (3, 30), DFS
(5735 - 5815 @ 40), (3, 30)
country KR:
(2402 - 2482 @ 20), (N/A, 20)
(5170 - 5250 @ 20), (3, 20)
(5250 - 5330 @ 20), (3, 20), DFS
(5490 - 5630 @ 20), (3, 30), DFS
(5735 - 5815 @ 20), (3, 30)
country KW:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
country KZ:
(2402 - 2482 @ 40), (N/A, 20)
country LB:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country LI: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country LK:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 20), DFS
(5490 - 5710 @ 20), (3, 20), DFS
(5735 - 5835 @ 20), (3, 30)
country LT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country LU: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country LV: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country MC: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
(5250 - 5330 @ 40), (N/A, 18), DFS
country MA:
(2402 - 2482 @ 40), (N/A, 20)
country MO:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 23)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country MK: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country MT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country MY:
(2402 - 2482 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 30), DFS
(5735 - 5835 @ 40), (N/A, 30)
country MX:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country NL: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20), NO-OUTDOOR
(5250 - 5330 @ 40), (N/A, 20), NO-OUTDOOR, DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country NO: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country NP:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country NZ:
(2402 - 2482 @ 40), (N/A, 30)
(5170 - 5250 @ 20), (3, 23)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country OM:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country PA:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country PE:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country PG:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country PH:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country PK:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country PL: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country PT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country PR:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country QA:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country RO: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country RU:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 20), (N/A, 30)
country RW:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country SA:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 23)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country SE: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country SG:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5735 - 5835 @ 40), (N/A, 20)
country SI: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country SK: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country SV:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country SY:
(2402 - 2482 @ 40), (N/A, 20)
country TW:
(2402 - 2472 @ 40), (3, 27)
(5270 - 5330 @ 40), (3, 17), DFS
(5735 - 5815 @ 40), (3, 30)
country TH:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country TT:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country TN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
country TR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
country UA:
(2402 - 2482 @ 40), (N/A, 20)
country US: DFS-FCC
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5600 @ 40), (3, 20), DFS
(5650 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country UY:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country UZ:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country VE:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5815 @ 40), (N/A, 23)
country VN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
country YE:
(2402 - 2482 @ 40), (N/A, 20)
country ZA:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country ZW:
(2402 - 2482 @ 40), (N/A, 20)

View File

@@ -0,0 +1,702 @@
# This is the world regulatory domain
country 00:
(2402 - 2472 @ 40), (3, 20)
# Channel 12 - 13. No HT40 channel fits here
(2457 - 2482 @ 20), (3, 20), PASSIVE-SCAN, NO-IBSS
# Channel 14. Only JP enables this and for 802.11b only
(2474 - 2494 @ 20), (3, 20), PASSIVE-SCAN, NO-IBSS, NO-OFDM
# Channel 36 - 48
(5170 - 5250 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS
# NB: 5260 MHz - 5700 MHz requies DFS
# Channel 149 - 165
(5735 - 5835 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS
country AE:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country AL:
(2402 - 2482 @ 20), (N/A, 20)
country AM:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 18)
(5250 - 5330 @ 20), (N/A, 18), DFS
country AN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country AR:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country AT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country AU:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 23)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country AW:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country AZ:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
(5250 - 5330 @ 40), (N/A, 18), DFS
country BA: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country BB:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 23)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country BD:
(2402 - 2482 @ 40), (N/A, 20)
country BE: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country BG: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 23)
(5250 - 5290 @ 40), (N/A, 23), DFS
(5490 - 5710 @ 40), (N/A, 30), DFS
country BH:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
(5735 - 5835 @ 20), (N/A, 20)
country BL:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
(5250 - 5330 @ 40), (N/A, 18), DFS
country BN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5735 - 5835 @ 40), (N/A, 30)
country BO:
(2402 - 2482 @ 40), (N/A, 30)
(5735 - 5835 @ 40), (N/A, 30)
country BR:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country BY:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country BZ:
(2402 - 2482 @ 40), (N/A, 30)
(5735 - 5835 @ 40), (N/A, 30)
country CA:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country CH: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country CL:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5735 - 5835 @ 40), (N/A, 20)
country CN:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
(5850 - 5930 @ 20), (N/A, 30)
country CO:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country CR:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country CS:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country CY: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
# Data from http://www.ctu.eu/164/download/VOR/VOR-12-08-2005-34.pdf
# and http://www.ctu.eu/164/download/VOR/VOR-12-05-2007-6-AN.pdf
# Power at 5250 - 5350 MHz and 5470 - 5725 MHz can be doubled if TPC is
# implemented.
country CZ: DFS-ETSI
(2400 - 2483.5 @ 40), (N/A, 100 mW)
(5150 - 5250 @ 40), (N/A, 200 mW), NO-OUTDOOR
(5250 - 5350 @ 40), (N/A, 100 mW), NO-OUTDOOR, DFS
(5470 - 5725 @ 40), (N/A, 500 mW), DFS
# Data from "Frequenznutzungsplan" (as published in April 2008), downloaded from
# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38448/publicationFile/2659/Frequenznutzungsplan2008_Id17448pdf.pdf
# For the 5GHz range also see
# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38216/publicationFile/6579/WLAN5GHzVfg7_2010_28042010pdf.pdf
# The values have been reduced by a factor of 2 (3db) for non TPC devices
# (in other words: devices with TPC can use twice the tx power of this table).
# Note that the docs do not require TPC for 5150--5250; the reduction to
# 100mW thus is not strictly required -- however the conservative 100mW
# limit is used here as the non-interference with radar and satellite
# apps relies on the attenuation by the building walls only in the
# absence of DFS; the neighbour countries have 100mW limit here as well.
country DE: DFS-ETSI
# entries 279004 and 280006
(2400 - 2483.5 @ 40), (N/A, 100 mW)
# entry 303005
(5150 - 5250 @ 40), (N/A, 100 mW), NO-OUTDOOR
# entries 304002 and 305002
(5250 - 5350 @ 40), (N/A, 100 mW), NO-OUTDOOR, DFS
# entries 308002, 309001 and 310003
(5470 - 5725 @ 40), (N/A, 500 mW), DFS
country DK: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country DO:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country DZ:
(2402 - 2482 @ 40), (N/A, 20)
country EC:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country EE: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country EG:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
country ES: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country FI: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country FR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country GE:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
(5250 - 5330 @ 40), (N/A, 18), DFS
country GB: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country GD:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country GR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country GL: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
(5490 - 5710 @ 20), (N/A, 27), DFS
country GT:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country GU:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country HN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country HK:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country HR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country HT:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country HU: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country ID:
(2402 - 2482 @ 40), (N/A, 20)
country IE: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country IL:
(2402 - 2482 @ 40), (N/A, 20)
(5150 - 5250 @ 40), (N/A, 200 mW), NO-OUTDOOR
(5250 - 5350 @ 40), (N/A, 200 mW), NO-OUTDOOR, DFS
country IN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5735 - 5835 @ 40), (N/A, 20)
country IS: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country IR:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country IT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country JM:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country JP:
(2402 - 2472 @ 40), (N/A, 20)
(2457 - 2482 @ 20), (N/A, 20)
(2474 - 2494 @ 20), (N/A, 20), NO-OFDM
(4910 - 4930 @ 10), (N/A, 23)
(4910 - 4990 @ 40), (N/A, 23)
(4930 - 4950 @ 10), (N/A, 23)
(5030 - 5045 @ 10), (N/A, 23)
(5030 - 5090 @ 40), (N/A, 23)
(5050 - 5060 @ 10), (N/A, 23)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 23), DFS
country JO:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
country KE:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country KH:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country KP:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5330 @ 40), (3, 20)
(5160 - 5250 @ 40), (3, 20), DFS
(5490 - 5630 @ 40), (3, 30), DFS
(5735 - 5815 @ 40), (3, 30)
country KR:
(2402 - 2482 @ 20), (N/A, 20)
(5170 - 5250 @ 20), (3, 20)
(5250 - 5330 @ 20), (3, 20), DFS
(5490 - 5630 @ 20), (3, 30), DFS
(5735 - 5815 @ 20), (3, 30)
country KW:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
country KZ:
(2402 - 2482 @ 40), (N/A, 20)
country LB:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country LI: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country LK:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 20), DFS
(5490 - 5710 @ 20), (3, 20), DFS
(5735 - 5835 @ 20), (3, 30)
country LT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country LU: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country LV: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country MC: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 18)
(5250 - 5330 @ 40), (N/A, 18), DFS
country MA:
(2402 - 2482 @ 40), (N/A, 20)
country MO:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 23)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country MK: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country MT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country MY:
(2402 - 2482 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 30), DFS
(5735 - 5835 @ 40), (N/A, 30)
country MX:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country NL: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20), NO-OUTDOOR
(5250 - 5330 @ 40), (N/A, 20), NO-OUTDOOR, DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country NO: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country NP:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country NZ:
(2402 - 2482 @ 40), (N/A, 30)
(5170 - 5250 @ 20), (3, 23)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country OM:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country PA:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country PE:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country PG:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country PH:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country PK:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country PL: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country PT: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country PR:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 23), DFS
(5735 - 5835 @ 40), (3, 30)
country QA:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country RO: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country RU:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 20), (N/A, 30)
country RW:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 30)
country SA:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 23)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country SE: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country SG:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5735 - 5835 @ 40), (N/A, 20)
country SI: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country SK: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
(5490 - 5710 @ 40), (N/A, 27), DFS
country SV:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (3, 17)
(5250 - 5330 @ 20), (3, 23), DFS
(5735 - 5835 @ 20), (3, 30)
country SY:
(2402 - 2482 @ 40), (N/A, 20)
country TW:
(2402 - 2472 @ 40), (3, 27)
(5270 - 5330 @ 40), (3, 17), DFS
(5735 - 5815 @ 40), (3, 30)
country TH:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country TT:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country TN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
country TR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 20), (N/A, 20)
(5250 - 5330 @ 20), (N/A, 20), DFS
country UA:
(2402 - 2482 @ 40), (N/A, 20)
country US: DFS-FCC
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5600 @ 40), (3, 20), DFS
(5650 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country UY:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country UZ:
(2402 - 2472 @ 40), (3, 27)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country VE:
(2402 - 2482 @ 40), (N/A, 20)
(5735 - 5815 @ 40), (N/A, 23)
country VN:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20), DFS
country YE:
(2402 - 2482 @ 40), (N/A, 20)
country ZA:
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ 40), (3, 17)
(5250 - 5330 @ 40), (3, 20), DFS
(5490 - 5710 @ 40), (3, 20), DFS
(5735 - 5835 @ 40), (3, 30)
country ZW:
(2402 - 2482 @ 40), (N/A, 20)

View File

@@ -0,0 +1,99 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-03-02T22:16:14+08:00
====== iw ======
Created Friday 02 March 2012
http://lists.gnu.org/archive/html/ltib/2009-10/msg00009.html
iw依赖于libnl需要先安装libnl(__同时部署到目标板根文件系统中)__。
__一、LTIB安装方法__
LTIB中加入iw支持的方法
1.获得源代码 iw-3.3.tar.bz2 , 计算其md5值存入iw-3.3.tar.bz2.md5文件中。
#md5sumiw-3.3.tar.bz2 >iw-3.3.tar.bz2.md5
2.将源文件和md5值拷贝到/opt/freescale/pkgs
#cp iw* [[/opt/freescale/pkgs]]
3.向~/ppc/ltib-mpc8315/dist/lfs-5.1/中添加spec文件可**以在template/template.spec的基础上修改**
# cd [[~/ppc/ltib-mpc8315/dist/lfs-5.1]]
# mkdir iw
# cd iw
__# cat iw.spec__
%define pfx /opt/freescale/rootfs/%{_target_cpu}
Summary : iw
Name : iw
Version : 3.3
Release : 1
License : gpl
Vendor : Freescale
Packager : geekard
Group : Development/Tools
URL : http://uestc.edu.cn
Source : %{name}-%{version}.tar.bz2
BuildRoot : %{_tmppath}/%{name}
Prefix : %{pfx}
%Description
%{summary}
%Prep
%setup
%Build
#./configure --prefix=%{_prefix} --host=$CFGHOST --build=%{_build} __ #iw不需配置直接编译__
make
%Install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT/%{pfx}
%Clean
rm -rf $RPM_BUILD_ROOT
%Files
%defattr(-,root,root)
%{pfx}/*
4. iw在编译的过程中需要生成version.c, 但是LTIB在编译过程中生成不了提示错误。
version.c中的内容与体系结构无关因此可以先在iw代码目录中运行make将生成的version.c复制到ltib的目录中。
5. 配置,编译,安装
# cp [[/opt/freescale/pkgs/iw-3.3.tar.bz2]] [[/tmp]]
#cd [[/tmp;]] tar xvf iw-3.3.tar.bz2
# cd iw-3.3
#
#make #非交叉编译这个过程中生成version.c
#cat version.c
#include "iw.h"
const char iw_version[] = "3.3-3-g135e65d";
#cd [[~/ppc/ltib-mpc8315/]]
#cp dist/lfs-1.5/iw/iw.spec .
#./ltib -m prep -p iw.spec #解压源代码到rpm/BUILD目录中
#cp [[/tmp/iw-3.3/version.c]] rpm/BUILD/iw-3.3 #将上一步生成的version.c复制到目录中
#./ltib -m scbuild -p iw.spec #编译
#./ltib -m scdeploy -p iw.spec #部署到根文件系统中
==== 二、使用交叉编译工具链的方法 ====
1.解压源代码:
$tar xvf iw-3.3.tar.bz2
$cd iw-3.3
2.在当前shell中导入交叉编译工具链的环境变量脚本
$source [[~/PPC/script/env.h]]
3.交叉编译libnl
$CC=powerpc-e300c3-linux-gnu-gcc make
4. 安装到目标板的根文件系统中
$make DESTDIR=/path-to-target-root-dir install
iw.tar.bz2见attachment dir。

View File

@@ -0,0 +1,156 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-03-02T22:05:51+08:00
====== libnl ======
Created Friday 02 March 2012
LTIB中加入libnl支持的方法
==== 一、使用LTIB的方法 ====
1.下载libnl-3.2.11.tar.gz文件计算其md5值。
#md5sum libnl-3.2.11.tar.gz >libnl-3.2.11.tar.gz.md5
2.将源文件和md5值拷贝到/opt/freescale/pkgs
#cp libnl* /opt/freescale/pkgs
3.向~/ppc/ltib-mpc8315/dist/lfs-5.1/中添加spec文件可以在template/template.spec的基础上修改
# cd ~/ppc/ltib-mpc8315/dist/lfs-5.1
# mkdir libnl
# cd libnl
__# cat libnl.spec__
%define pfx /opt/freescale/rootfs/%{_target_cpu}
Summary : libnl
Name : libnl
Version : 3.2.11
Release : 1 #任意值,必须要有。
License : gpl
Vendor : Freescale
Packager : geekard
Group : Development/Tools
URL : http://uestc.edu.cn
Source : __%{name}-%{version}.tar.gz #也可以手动指定全文件名LTIB会到/opt/freescale/pkgs下查找该文件__
BuildRoot : %{_tmppath}/%{name}
Prefix : %{pfx}
%Description
%{summary}
%Prep
%setup
%Build
./configure --prefix=%{_prefix} --host=$CFGHOST --build=%{_build}
make
%Install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT/%{pfx}
%Clean
rm -rf $RPM_BUILD_ROOT
%Files
%defattr(-,root,root)
%{pfx}/*
4. 预处理,编译,部署(添加到根文件系统中)
# cd ~/ppc/ltib-mpc8315
#cp dist/ltf-5.1/libnl/libnl.spec .
#./ltib -m prep -p libnl.spec
#./ltib -m scbuild -p libnl.spec
#./ltib -m scdeploy -p libnl.spec
== ==================== ==
-------------------------------------------------------------------------------
+ make
Making all in include
make[1]: Entering directory `/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/libnl-3.2.10/include'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/libnl-3.2.10/include'
Making all in lib
make[1]: Entering directory `/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/libnl-3.2.10/lib'
GEN route/pktloc_grammar.c
GEN route/cls/ematch_grammar.c
GEN route/cls/ematch_syntax.c
GEN route/pktloc_syntax.c
r__oute/cls/ematch_syntax.y:31.9-16: syntax error, unexpected identifier, expecting string__
make[1]: *** [route/cls/ematch_syntax.c] Error 1
make[1]: *** Waiting for unfinished jobs....
route/pktloc_syntax.y:11.9-16: syntax error, unexpected identifier, expecting string
make[1]: *** [route/pktloc_syntax.c] Error 1
make[1]: Leaving directory `/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/libnl-3.2.10/lib'
make: *** [all-recursive] Error 1
error: Bad exit status from /home/geekard/PPC/ltib-mpc8315erdb-20100719/tmp/rpm-tmp.19887 (%build)
原因是ltib使用的bison版本老了
http://permalink.gmane.org/gmane.comp.lib.uclibc.buildroot/30794
----------------
commit: http://git.buildroot.net/buildroot/commit/?id=5c22f20f4b12395a34ce47c1aba608fccaf1fbe0
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master
libnl build breaks with bison <2.4 with:
bison -y -d -o route/cls/ematch_syntax.c route/cls/ematch_syntax.y
route/cls/ematch_syntax.y:31.9-16: syntax error, unexpected
identifier, expecting string
So build our own known good version and use instead.
-------------------
解决的方法是将LTIB使用的bison指向系统较新的版本
# sudo ln -s /usr/bin/bison [[/opt/freescale/ltib/usr/bin/bison]]
-----------------------------------------------------------------------
> make[3]: Entering directory
> `/home/sriram/buildroot/buildroot-2011.11/output/build/libnl-3.0/lib'
> CC route/pktloc.lo
>
> route/pktloc.c: In function read_pktlocs:
> route/pktloc.c:127:34: error: __YY_BUF_SIZE undeclared__ (first use in
> this function)
> route/pktloc.c:127:34: note: each undeclared identifier is reported
> only once for each function it appears in
> make[3]: *** [route/pktloc.lo] Error 1
> make[3]: Leaving directory
> `/home/sriram/buildroot/buildroot-2011.11/output/build/libnl-3.0/lib'
> make[2]: *** [all] Error 2
> make[2]: Leaving directory
> `/home/sriram/buildroot/buildroot-2011.11/output/build/libnl-3.0/lib'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory
> `/home/sriram/buildroot/buildroot-2011.11/output/build/libnl-3.0'
> make: ***
> [/home/sriram/buildroot/buildroot-2011.11/output/build/libnl-3.0/.stamp_built]
> Error 2
--------------------------------
解决方法是http://lkml.indiana.edu/hypermail/linux/kernel/1202.2/01275.html
I added following lines of code in
libnl-3.0/lib/route/pktloc_grammer.h
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif
#ifndef YY_STATE_BUF_SIZE
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#endif
==== 二、使用交叉编译工具链的方法 ====
1.解压源代码:
$tar xvf libnl-3.2.11.tar.gz
2.在当前shell中导入交叉编译工具链的环境变量脚本
$source ~/PPC/script/env.h
3.交叉编译libnl
$ ./configure --prefix=/usr __--host=powerpc-linux --build=x86_64-unknown-linux-gnu #--build参数可以不用指定。__
$make
4. 安装到目标板的根文件系统中
$make install_root=/path-to-target-root-dir install
libnl-3.2.11文件件Attachment dir.

View File

@@ -0,0 +1,20 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-08-03T21:05:12+08:00
====== ltib ======
Created Friday 03 August 2012
1. 安装rpm-org和cpio软件包
yoaurt -S rpm-org cpio
2. 改变/opt目录可写
sudo chmod -R 777 [[/opt]]
3. 安装:
perl-net-http和perl-lwp-protocol-https
4.执行/usr/sbin/visudo命令在打开的文件中添加
geekard ALL = NOPASSWD: /bin/rpm, /opt/freescale/ltib/usr/bin/rpm
5.

View File

@@ -0,0 +1,25 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-06-06T15:28:16+08:00
====== sparse ======
Created Wednesday 06 June 2012
parse.h:
struct /* labeled_struct */ {
struct symbol *label_identifier;
/* struct statement *label_statement; */ 注释掉这一个成员
};
然后在
[geekard@kb310 pkgs]$ tar -cvzf sparse-0.4.tar.gz sparse-0.4
[geekard@kb310 pkgs]$ md5sum sparse-0.4.tar.gz >sparse-0.4.tar.gz.md5
[geekard@kb310 pkgs]$
两文件位于附件中:
[[./sparse-0001.4.tar.gz]]
[[./sparse-0001.4.tar.gz.md5]]
[[./sparse-0001.4-array-fix.patch]]
[[./sparse-0001.4-array-fix.patch.md5]]

View File

@@ -0,0 +1,46 @@
Steve Papacharalambous <stevep@freescale.com> 20 September 2007
This patch fixes build errors when building with later versions of gcc due
to increased strictness when declaring array variables without a size:
[snip]
CC test-lexing.o
In file included from test-lexing.c:18:
token.h:59: array size missing in `name'
token.h:140: array size missing in `data'
make: *** [test-lexing.o] Error 1
[/snip]
diff -uNr sparse-0.4.orig/allocate.h sparse-0.4/allocate.h
--- sparse-0.4.orig/allocate.h Sat Sep 15 20:56:10 2007
+++ sparse-0.4/allocate.h Thu Sep 20 08:45:03 2007
@@ -4,7 +4,7 @@
struct allocation_blob {
struct allocation_blob *next;
unsigned int left, offset;
- unsigned char data[];
+ unsigned char *data;
};
struct allocator_struct {
diff -uNr sparse-0.4.orig/token.h sparse-0.4/token.h
--- sparse-0.4.orig/token.h Sat Sep 15 20:56:10 2007
+++ sparse-0.4/token.h Thu Sep 20 08:45:31 2007
@@ -56,7 +56,7 @@
unsigned char tainted:1,
reserved:1,
keyword:1;
- char name[]; /* Actual identifier */
+ char *name; /* Actual identifier */
};
enum token_type {
@@ -137,7 +137,7 @@
struct string {
unsigned int length;
- char data[];
+ char *data;
};
/* will fit into 32 bits */

View File

@@ -0,0 +1 @@
7805f93b238db8c76fd4ac76b3344ff6 sparse-0.4-array-fix.patch

View File

@@ -0,0 +1 @@
669eb869434a3a8263ee5649d10a255c sparse-0.4.tar.gz

View File

@@ -0,0 +1,46 @@
Steve Papacharalambous <stevep@freescale.com> 20 September 2007
This patch fixes build errors when building with later versions of gcc due
to increased strictness when declaring array variables without a size:
[snip]
CC test-lexing.o
In file included from test-lexing.c:18:
token.h:59: array size missing in `name'
token.h:140: array size missing in `data'
make: *** [test-lexing.o] Error 1
[/snip]
diff -uNr sparse-0.4.orig/allocate.h sparse-0.4/allocate.h
--- sparse-0.4.orig/allocate.h Sat Sep 15 20:56:10 2007
+++ sparse-0.4/allocate.h Thu Sep 20 08:45:03 2007
@@ -4,7 +4,7 @@
struct allocation_blob {
struct allocation_blob *next;
unsigned int left, offset;
- unsigned char data[];
+ unsigned char *data;
};
struct allocator_struct {
diff -uNr sparse-0.4.orig/token.h sparse-0.4/token.h
--- sparse-0.4.orig/token.h Sat Sep 15 20:56:10 2007
+++ sparse-0.4/token.h Thu Sep 20 08:45:31 2007
@@ -56,7 +56,7 @@
unsigned char tainted:1,
reserved:1,
keyword:1;
- char name[]; /* Actual identifier */
+ char *name; /* Actual identifier */
};
enum token_type {
@@ -137,7 +137,7 @@
struct string {
unsigned int length;
- char data[];
+ char *data;
};
/* will fit into 32 bits */

View File

@@ -0,0 +1 @@
7805f93b238db8c76fd4ac76b3344ff6 sparse-0.4-array-fix.patch

View File

@@ -0,0 +1 @@
669eb869434a3a8263ee5649d10a255c sparse-0.4.tar.gz

View File

@@ -0,0 +1,58 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-08-02T15:31:27+08:00
====== uboot ======
Created Thursday 02 August 2012
1. ltib在编译uboot时长时间地停在下面的命令行上
powerpc-e300c3-linux-gnu-objcopy -O srec u-boot u-boot.srec
powerpc-e300c3-linux-gnu-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin
而且生成的uboot.bin文件非常大
[geekard@kb310 ltib-mpc8315erdb-20100719]$ ls -lh rpm/BUILD/u-boot-2009.03-rc2/u-boot.bin
-rwxr-xr-x 1 geekard geekard 4.0G Aug 4 15:18 rpm/BUILD/u-boot-2009.03-rc2/u-boot.bin
[geekard@kb310 ltib-mpc8315erdb-20100719]$
-----------------------------------
用readelf探查显示结果如下
[geekard@kb310 u-boot-2009.03-rc2]$ powerpc-e300c3-linux-gnu-readelf -l u-boot
Elf file type is EXEC (Executable file)
Entry point 0xfe000100
There are 3 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000094 __0x00000094__ 0x00000094 0x0b052 0x0b052 R 0x1
LOAD 0x00b0e8 0__xfe000000__ 0xfe000000 0x3f3ec 0x4877c RWE 0x8
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
Section to Segment mapping:
Segment Sections...
00 __.rodata.str1.1__
01 .text .text.unlikely .reloc .data .data.rel.ro.local .data.rel .data.rel.local .data.rel.ro .u_boot_cmd .bss
02
http://www.mail-archive.com/u-boot@lists.denx.de/msg06883.html
可见objcopy试图在u-boot.bin文件中的0x94到0xfe000000中填充0xff。解决方法是
diff -purN orig/cpu/mpc83xx/u-boot.lds u-boot/cpu/mpc83xx/u-boot.lds
--- orig/cpu/mpc83xx/u-boot.lds 2008-12-29 14:26:05.000000000 -0500
+++ u-boot/cpu/mpc83xx/u-boot.lds 2008-12-29 14:26:13.000000000 -0500
@@ -57,6 +57,7 @@ SECTIONS
. = ALIGN(16);
*(.rodata)
*(.rodata1)
__+ *(.rodata.str1.1)__
*(.rodata.str1.4)
*(.eh_frame)
}
------------------
[geekard@kb310 ltib-mpc8315erdb-20100719]$ ./ltib -m prep -p u-boot
[geekard@kb310 ltib-mpc8315erdb-20100719]$ cp modify/uboot/__MPC8315ERDB.h__ rpm/BUILD/u-boot-2009.03-rc2/include/configs/
[geekard@kb310 ltib-mpc8315erdb-20100719]$ cp modify/uboot/__u-boot.lds__ rpm/BUILD/u-boot-2009.03-rc2/cpu/mpc83xx/
[geekard@kb310 ltib-mpc8315erdb-20100719]$ ./ltib -m scbuild -p u-boot
MPC8315ERDB.h文件修改DDR为512MB关闭了eTSEC1.两文件位于附件中。
[[./MPC8315ERDB001.h]]
[[./u-boot001.lds]]

View File

@@ -0,0 +1,756 @@
/*
* Copyright (C) 2007, 2009 Freescale Semiconductor, Inc.
*
* Dave Liu <daveliu@freescale.com>
* Jerry Huang <Chang-Ming.Huang@freescale.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __CONFIG_H
#define __CONFIG_H
/*
* High Level Configuration Options
*/
#define CONFIG_E300 1 /* E300 family */
#define CONFIG_MPC83XX 1 /* MPC83xx family */
#define CONFIG_MPC831X 1 /* MPC831x CPU family */
#define CONFIG_MPC8315 1 /* MPC8315 CPU specific */
#define CONFIG_MPC8315ERDB 1 /* MPC8315ERDB board specific */
/*
* System Clock Setup
*/
#define CONFIG_83XX_CLKIN 66666667 /* in Hz */
#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN
#ifdef CONFIG_PCISLAVE
#define CONFIG_PCI
#define CONFIG_83XX_PCICLK 66666667 /* in Hz */
#endif /* CONFIG_PCISLAVE */
/*
* The 8315 silicon has three speed grade, they are
* A: CORE/CSB = 400MHz/133MHz
* B: CORE/CSB = 333MHz/133MHz
* C: CORE/CSB = 266MHz/133MHz
* Hardware Reset Configuration Word
* if CLKIN is 66.66MHz, then
* CSB = 133MHz, DDRC = 266MHz, LBC = 133MHz
* We choose the A type silicon as default, so the core is 400Mhz.
*/
#define CONFIG_SYS_FREQ_400MHz 1
#define CONFIG_SYS_FREQ_333MHz 2
#define CONFIG_SYS_FREQ_266MHz 3
#ifndef CONFIG_CORE_FREQ
#define CONFIG_CORE_FREQ CONFIG_SYS_FREQ_400MHz
#endif
#if (CONFIG_CORE_FREQ == CONFIG_SYS_FREQ_266MHz)
#define CONFIG_SYS_HRCW_LOW (\
HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
HRCWL_DDR_TO_SCB_CLK_2X1 |\
HRCWL_SVCOD_DIV_2 |\
HRCWL_CSB_TO_CLKIN_2X1 |\
HRCWL_CORE_TO_CSB_2X1)
#elif (CONFIG_CORE_FREQ == CONFIG_SYS_FREQ_333MHz)
#define CONFIG_SYS_HRCW_LOW (\
HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
HRCWL_DDR_TO_SCB_CLK_2X1 |\
HRCWL_SVCOD_DIV_2 |\
HRCWL_CSB_TO_CLKIN_2X1 |\
HRCWL_CORE_TO_CSB_2_5X1)
#else
#define CONFIG_SYS_HRCW_LOW (\
HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
HRCWL_DDR_TO_SCB_CLK_2X1 |\
HRCWL_SVCOD_DIV_2 |\
HRCWL_CSB_TO_CLKIN_2X1 |\
HRCWL_CORE_TO_CSB_3X1)
#endif
#ifdef CONFIG_NAND_SPL
#ifdef CONFIG_PCISLAVE
#define CONFIG_SYS_HRCW_HIGH (\
HRCWH_PCI_AGENT |\
HRCWH_PCI_ARBITER_DISABLE |\
HRCWH_CORE_ENABLE |\
HRCWH_FROM_0XFFF00100 |\
HRCWH_BOOTSEQ_DISABLE |\
HRCWH_SW_WATCHDOG_DISABLE |\
HRCWH_ROM_LOC_NAND_SP_8BIT |\
HRCWH_RL_EXT_NAND |\
HRCWH_TSEC1M_IN_RGMII |\
HRCWH_TSEC2M_IN_RGMII |\
HRCWH_BIG_ENDIAN |\
HRCWH_LALE_NORMAL)
#else
#define CONFIG_SYS_HRCW_HIGH (\
HRCWH_PCI_HOST |\
HRCWH_PCI_ARBITER_ENABLE |\
HRCWH_CORE_ENABLE |\
HRCWH_FROM_0XFFF00100 |\
HRCWH_BOOTSEQ_DISABLE |\
HRCWH_SW_WATCHDOG_DISABLE |\
HRCWH_ROM_LOC_NAND_SP_8BIT |\
HRCWH_RL_EXT_NAND |\
HRCWH_TSEC1M_IN_RGMII |\
HRCWH_TSEC2M_IN_RGMII |\
HRCWH_BIG_ENDIAN |\
HRCWH_LALE_NORMAL)
#endif
#else
#ifdef CONFIG_PCISLAVE
#define CONFIG_SYS_HRCW_HIGH (\
HRCWH_PCI_AGENT |\
HRCWH_PCI1_ARBITER_DISABLE |\
HRCWH_CORE_ENABLE |\
HRCWH_FROM_0X00000100 |\
HRCWH_BOOTSEQ_DISABLE |\
HRCWH_SW_WATCHDOG_DISABLE |\
HRCWH_ROM_LOC_LOCAL_16BIT |\
HRCWH_RL_EXT_LEGACY |\
HRCWH_TSEC1M_IN_RGMII |\
HRCWH_TSEC2M_IN_RGMII |\
HRCWH_BIG_ENDIAN |\
HRCWH_LALE_NORMAL)
#else
#define CONFIG_SYS_HRCW_HIGH (\
HRCWH_PCI_HOST |\
HRCWH_PCI1_ARBITER_ENABLE |\
HRCWH_CORE_ENABLE |\
HRCWH_FROM_0X00000100 |\
HRCWH_BOOTSEQ_DISABLE |\
HRCWH_SW_WATCHDOG_DISABLE |\
HRCWH_ROM_LOC_LOCAL_16BIT |\
HRCWH_RL_EXT_LEGACY |\
HRCWH_TSEC1M_IN_RGMII |\
HRCWH_TSEC2M_IN_RGMII |\
HRCWH_BIG_ENDIAN |\
HRCWH_LALE_NORMAL)
#endif
#endif
/*
* System IO Config
*/
#define CONFIG_SYS_SICRH 0x00000000
#define CONFIG_SYS_SICRL 0x00000000 /* 3.3V, no delay */
#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */
/*
* IMMR new address
*/
#define CONFIG_SYS_IMMR 0xE0000000
/*
* Arbiter Setup
*/
#define CONFIG_SYS_ACR_PIPE_DEP 3 /* Arbiter pipeline depth is 4 */
#define CONFIG_SYS_ACR_RPTCNT 3 /* Arbiter repeat count is 4 */
#define CONFIG_SYS_SPCR_TSECEP 3 /* eTSEC emergency priority is highest */
/*
* DDR Setup
*/
#define CONFIG_SYS_DDR_BASE 0x00000000 /* DDR is system memory */
#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_BASE
#define CONFIG_SYS_DDR_SDRAM_BASE CONFIG_SYS_DDR_BASE
#define CONFIG_SYS_DDR_SDRAM_CLK_CNTL DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05
#define CONFIG_SYS_DDRCDR_VALUE ( DDRCDR_EN \
| DDRCDR_PZ_LOZ \
| DDRCDR_NZ_LOZ \
| DDRCDR_ODT \
| DDRCDR_Q_DRN )
/* 0x7b880001 */
/*
* Manually set up DDR parameters
* consist of two chips HY5PS12621BFP-C4 from HYNIX
*/
#define CONFIG_SYS_DDR_SIZE 512 /* MB */
#define CONFIG_SYS_DDR_CS0_BNDS 0x0000001f
#define CONFIG_SYS_DDR_CS0_CONFIG ( CSCONFIG_EN \
| 0x00010000 /* ODT_WR to CSn */ \
| CSCONFIG_ROW_BIT_13 | CSCONFIG_COL_BIT_10 )
/* 0x80010102 */
#define CONFIG_SYS_DDR_TIMING_3 0x00000000
#define CONFIG_SYS_DDR_TIMING_0 ( ( 0 << TIMING_CFG0_RWT_SHIFT ) \
| ( 0 << TIMING_CFG0_WRT_SHIFT ) \
| ( 0 << TIMING_CFG0_RRT_SHIFT ) \
| ( 0 << TIMING_CFG0_WWT_SHIFT ) \
| ( 2 << TIMING_CFG0_ACT_PD_EXIT_SHIFT ) \
| ( 2 << TIMING_CFG0_PRE_PD_EXIT_SHIFT ) \
| ( 8 << TIMING_CFG0_ODT_PD_EXIT_SHIFT ) \
| ( 2 << TIMING_CFG0_MRS_CYC_SHIFT ) )
/* 0x00220802 */
#define CONFIG_SYS_DDR_TIMING_1 ( ( 2 << TIMING_CFG1_PRETOACT_SHIFT ) \
| ( 7 << TIMING_CFG1_ACTTOPRE_SHIFT ) \
| ( 2 << TIMING_CFG1_ACTTORW_SHIFT ) \
| ( 5 << TIMING_CFG1_CASLAT_SHIFT ) \
| ( 6 << TIMING_CFG1_REFREC_SHIFT ) \
| ( 2 << TIMING_CFG1_WRREC_SHIFT ) \
| ( 2 << TIMING_CFG1_ACTTOACT_SHIFT ) \
| ( 2 << TIMING_CFG1_WRTORD_SHIFT ) )
/* 0x27256222 */
#define CONFIG_SYS_DDR_TIMING_2 ( ( 1 << TIMING_CFG2_ADD_LAT_SHIFT ) \
| ( 4 << TIMING_CFG2_CPO_SHIFT ) \
| ( 2 << TIMING_CFG2_WR_LAT_DELAY_SHIFT ) \
| ( 2 << TIMING_CFG2_RD_TO_PRE_SHIFT ) \
| ( 2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT ) \
| ( 3 << TIMING_CFG2_CKE_PLS_SHIFT ) \
| ( 5 << TIMING_CFG2_FOUR_ACT_SHIFT) )
/* 0x121048c5 */
#define CONFIG_SYS_DDR_INTERVAL ( ( 0x0360 << SDRAM_INTERVAL_REFINT_SHIFT ) \
| ( 0x0100 << SDRAM_INTERVAL_BSTOPRE_SHIFT ) )
/* 0x03600100 */
#define CONFIG_SYS_DDR_SDRAM_CFG ( SDRAM_CFG_SREN \
| SDRAM_CFG_SDRAM_TYPE_DDR2 \
| SDRAM_CFG_32_BE )
/* 0x43080000 */
#define CONFIG_SYS_DDR_SDRAM_CFG2 0x00401000 /* 1 posted refresh */
#define CONFIG_SYS_DDR_MODE ( ( 0x0448 << SDRAM_MODE_ESD_SHIFT ) \
| ( 0x0232 << SDRAM_MODE_SD_SHIFT ) )
/* ODT 150ohm CL=3, AL=1 on SDRAM */
#define CONFIG_SYS_DDR_MODE2 0x00000000
/*
* Memory test
*/
#undef CONFIG_SYS_DRAM_TEST /* memory test, takes time */
#define CONFIG_SYS_MEMTEST_START 0x00040000 /* memtest region */
#define CONFIG_SYS_MEMTEST_END 0x00140000
/*
* The reserved memory
*/
#define CONFIG_SYS_MONITOR_BASE TEXT_BASE /* start of monitor */
#if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE) && !defined(CONFIG_NAND_U_BOOT)
#define CONFIG_SYS_RAMBOOT
#else
#undef CONFIG_SYS_RAMBOOT
#endif
#define CONFIG_SYS_MONITOR_LEN (384 * 1024) /* Reserve 384 kB for Mon */
#define CONFIG_SYS_MALLOC_LEN (512 * 1024) /* Reserved for malloc */
/*
* Initial RAM Base Address Setup
*/
#define CONFIG_SYS_INIT_RAM_LOCK 1
#define CONFIG_SYS_INIT_RAM_ADDR 0xE6000000 /* Initial RAM address */
#define CONFIG_SYS_INIT_RAM_END 0x1000 /* End of used area in RAM */
#define CONFIG_SYS_GBL_DATA_SIZE 0x100 /* num bytes initial data */
#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_END - CONFIG_SYS_GBL_DATA_SIZE)
/*
* Local Bus Configuration & Clock Setup
*/
#define CONFIG_SYS_LCRR (LCRR_DBYP | LCRR_CLKDIV_2)
#define CONFIG_SYS_LBC_LBCR 0x00040000
/*
* FLASH on the Local Bus
*/
#define CONFIG_SYS_FLASH_CFI /* use the Common Flash Interface */
#define CONFIG_FLASH_CFI_DRIVER /* use the CFI driver */
#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
#define CONFIG_SYS_FLASH_BASE 0xFE000000 /* FLASH base address */
#define CONFIG_SYS_FLASH_SIZE 8 /* FLASH size is 8M */
#define CONFIG_SYS_FLASH_PROTECTION 1 /* Use h/w Flash protection. */
#define CONFIG_SYS_LBLAWBAR0_PRELIM CONFIG_SYS_FLASH_BASE /* Window base at flash base */
#define CONFIG_SYS_LBLAWAR0_PRELIM 0x80000016 /* 8MB window size */
#define CONFIG_SYS_FLASH_BR_PRELIM ( CONFIG_SYS_FLASH_BASE /* Flash Base address */ \
| (2 << BR_PS_SHIFT) /* 16 bit port size */ \
| BR_V ) /* valid */
#define CONFIG_SYS_FLASH_OR_PRELIM ( (~(CONFIG_SYS_FLASH_SIZE - 1) << 20) \
| OR_UPM_XAM \
| OR_GPCM_CSNT \
| OR_GPCM_ACS_DIV2 \
| OR_GPCM_XACS \
| OR_GPCM_SCY_15 \
| OR_GPCM_TRLX \
| OR_GPCM_EHTR \
| OR_GPCM_EAD )
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* number of banks */
#define CONFIG_SYS_MAX_FLASH_SECT 135 /* 127 64KB sectors and 8 8KB top sectors per device */
#undef CONFIG_SYS_FLASH_CHECKSUM
#define CONFIG_SYS_FLASH_ERASE_TOUT 60000 /* Flash Erase Timeout (ms) */
#define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (ms) */
/*
* NAND Flash on the Local Bus
*/
#ifdef CONFIG_NAND_SPL
#define CONFIG_SYS_NAND_BASE 0xFFF00000
#else
#define CONFIG_SYS_NAND_BASE 0xE0600000 /* 0xE0600000 */
#endif
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define CONFIG_MTD_NAND_VERIFY_WRITE 1
#define CONFIG_CMD_NAND 1
#define CONFIG_NAND_FSL_ELBC 1
#ifndef CONFIG_NAND_ECC_OFF
#define CONFIG_SYS_NAND_BR_PRELIM ( CONFIG_SYS_NAND_BASE \
| (2<<BR_DECC_SHIFT) /* Use HW ECC */ \
| BR_PS_8 /* Port Size = 8 bit */ \
| BR_MS_FCM /* MSEL = FCM */ \
| BR_V ) /* valid */
#else
#define CONFIG_SYS_NAND_BR_PRELIM ( CONFIG_SYS_NAND_BASE \
| BR_PS_8 /* Port Size = 8 bit */ \
| BR_MS_FCM /* MSEL = FCM */ \
| BR_V )
#endif
#define CONFIG_SYS_NAND_OR_PRELIM ( 0xFFFF8000 /* length 32K */ \
| OR_FCM_CSCT \
| OR_FCM_CST \
| OR_FCM_CHT \
| OR_FCM_SCY_1 \
| OR_FCM_TRLX \
| OR_FCM_EHTR )
/* 0xFFFF8396 */
#define CONFIG_SYS_LBLAWBAR1_PRELIM CONFIG_SYS_NAND_BASE
#define CONFIG_SYS_LBLAWAR1_PRELIM 0x8000000E /* 32KB */
#define CONFIG_SYS_NAND_LBLAWBAR_PRELIM CONFIG_SYS_LBLAWBAR1_PRELIM
#define CONFIG_SYS_NAND_LBLAWAR_PRELIM CONFIG_SYS_LBLAWAR1_PRELIM
/*
* Swap CS0 / CS1 based upon NAND or NOR Flash Boot mode
*/
#if defined(CONFIG_NAND_U_BOOT)
#define CONFIG_SYS_BR0_PRELIM CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
#define CONFIG_SYS_OR0_PRELIM CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_FLASH_BR_PRELIM /* NOR Base address */
#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_FLASH_OR_PRELIM /* NOR Options */
#else
#define CONFIG_SYS_BR0_PRELIM CONFIG_SYS_FLASH_BR_PRELIM /* NOR Base address */
#define CONFIG_SYS_OR0_PRELIM CONFIG_SYS_FLASH_OR_PRELIM /* NOR Options */
#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
#endif /* CONFIG_NAND_U_BOOT */
/*
* NAND Boot Configuration, for board/../nand_boot.c
*/
#define CONFIG_SYS_NAND_BR0_PRELIM CONFIG_SYS_NAND_BR_PRELIM
#define CONFIG_SYS_NAND_OR0_PRELIM CONFIG_SYS_NAND_OR_PRELIM
#define CONFIG_SYS_NAND_LBLAWBAR0_PRELIM CONFIG_SYS_NAND_BASE
#define CONFIG_SYS_NAND_LBLAWAR0_PRELIM 0x8000000E /* 32KB */
#undef CONFIG_SYS_NAND_BOOT_QUIET /* Enable NAND boot status messages */
#define CONFIG_SYS_NAND_BOOT_SHOW_ECC_NUM /* Show corrected ECC errors */
#define CONFIG_SYS_NAND_PAGE_SIZE (512) /* NAND chip page size */
#define CONFIG_SYS_NAND_BLOCK_SIZE (16 << 10) /* NAND chip block size */
#define CONFIG_SYS_NAND_BAD_BLOCK_POS (5) /* Bad block marker location */
#define CONFIG_SYS_NAND_FMR ((15 << FMR_CWTO_SHIFT) | (0 << FMR_AL_SHIFT))
#define CONFIG_SYS_NAND_U_BOOT_SIZE (384 << 10) /* Size of RAM U-Boot image */
#define CONFIG_SYS_NAND_U_BOOT_DST (0x01000000) /* Load NUB to this addr */
#define CONFIG_SYS_NAND_U_BOOT_START (CONFIG_SYS_NAND_U_BOOT_DST + 0x120) /* NUB start */
#define CONFIG_SYS_NAND_U_BOOT_OFFS (16 << 10)
#define CONFIG_SYS_NAND_U_BOOT_RELOC 0x00010000
/*
* JFFS2 configuration
*/
#define CONFIG_JFFS2_NAND
/* mtdparts command line support */
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=nor,nand0=nand"
#define MTDPARTS_DEFAULT "mtdparts=nand:-@4m(jffs2)"
#define NAND_CACHE_PAGES 32
/*
* Serial Port
*/
#define CONFIG_CONS_INDEX 1
#undef CONFIG_SERIAL_SOFTWARE_FIFO
#define CONFIG_SYS_NS16550
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE 1
#define CONFIG_SYS_NS16550_CLK gd->csb_clk
#define CONFIG_SYS_BAUDRATE_TABLE \
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
#define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_IMMR+0x4500)
#define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_IMMR+0x4600)
/* Use the HUSH parser */
#define CONFIG_SYS_HUSH_PARSER
#ifdef CONFIG_SYS_HUSH_PARSER
#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#endif
/* Pass open firmware flat tree */
#define CONFIG_OF_LIBFDT 1
#define CONFIG_OF_BOARD_SETUP 1
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
/* I2C */
#define CONFIG_HARD_I2C /* I2C with hardware support */
#define CONFIG_FSL_I2C
#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */
#define CONFIG_SYS_I2C_SLAVE 0x7F
#define CONFIG_SYS_I2C_NOPROBES {0x51} /* Don't probe these addrs */
#define CONFIG_SYS_I2C_OFFSET 0x3000
#define CONFIG_SYS_I2C2_OFFSET 0x3100
/*
* Board info - revision and where boot from
*/
#define CONFIG_SYS_I2C_PCF8574A_ADDR 0x39
/*
* Config on-board RTC
*/
#define CONFIG_RTC_DS1337 /* ds1339 on board, use ds1337 rtc via i2c */
#define CONFIG_SYS_I2C_RTC_ADDR 0x68 /* at address 0x68 */
/*
* General PCI
* Addresses are mapped 1-1.
*/
#define CONFIG_SYS_PCI_MEM_BASE 0x80000000
#define CONFIG_SYS_PCI_MEM_PHYS CONFIG_SYS_PCI_MEM_BASE
#define CONFIG_SYS_PCI_MEM_SIZE 0x10000000 /* 256M */
#define CONFIG_SYS_PCI_MMIO_BASE 0x90000000
#define CONFIG_SYS_PCI_MMIO_PHYS CONFIG_SYS_PCI_MMIO_BASE
#define CONFIG_SYS_PCI_MMIO_SIZE 0x10000000 /* 256M */
#define CONFIG_SYS_PCI_IO_BASE 0x00000000
#define CONFIG_SYS_PCI_IO_PHYS 0xE0300000
#define CONFIG_SYS_PCI_IO_SIZE 0x100000 /* 1M */
#define CONFIG_SYS_PCI_SLV_MEM_LOCAL CONFIG_SYS_SDRAM_BASE
#define CONFIG_SYS_PCI_SLV_MEM_BUS 0x00000000
#define CONFIG_SYS_PCI_SLV_MEM_SIZE 0x80000000
#define CONFIG_SYS_PCIE1_BASE 0xA0000000
#define CONFIG_SYS_PCIE1_MEM_BASE 0xA0000000
#define CONFIG_SYS_PCIE1_MEM_PHYS 0xA0000000
#define CONFIG_SYS_PCIE1_MEM_SIZE 0x10000000
#define CONFIG_SYS_PCIE1_CFG_BASE 0xB0000000
#define CONFIG_SYS_PCIE1_CFG_SIZE 0x01000000
#define CONFIG_SYS_PCIE1_IO_BASE 0x00000000
#define CONFIG_SYS_PCIE1_IO_PHYS 0xB1000000
#define CONFIG_SYS_PCIE1_IO_SIZE 0x00800000
#define CONFIG_SYS_PCIE2_BASE 0xC0000000
#define CONFIG_SYS_PCIE2_MEM_BASE 0xC0000000
#define CONFIG_SYS_PCIE2_MEM_PHYS 0xC0000000
#define CONFIG_SYS_PCIE2_MEM_SIZE 0x10000000
#define CONFIG_SYS_PCIE2_CFG_BASE 0xD0000000
#define CONFIG_SYS_PCIE2_CFG_SIZE 0x01000000
#define CONFIG_SYS_PCIE2_IO_BASE 0x00000000
#define CONFIG_SYS_PCIE2_IO_PHYS 0xD1000000
#define CONFIG_SYS_PCIE2_IO_SIZE 0x00800000
#define CONFIG_PCI
#define CONFIG_83XX_GENERIC_PCI 1 /* Use generic PCI setup */
#define CONFIG_83XX_GENERIC_PCIE 1
#define CONFIG_83XX_GENERIC_PCIE_REGISTER_HOSES
#define PCI_VENDOR_ID_FREESCALE 0x1957
#define PCI_DEVICE_ID_MPC8315E 0x00b4
#define CONFIG_NET_MULTI
#define CONFIG_PCI_PNP /* do pci plug-and-play */
#define CONFIG_EEPRO100
#undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */
#define CONFIG_SKIP_PCI_SCAN
#ifndef CONFIG_NET_MULTI
#define CONFIG_NET_MULTI 1
#endif
#define CONFIG_HAS_FSL_DR_USB
/*
* TSEC
*/
#define CONFIG_TSEC_ENET /* TSEC ethernet support */
#define CONFIG_SYS_TSEC1_OFFSET 0x24000
#define CONFIG_SYS_TSEC1 (CONFIG_SYS_IMMR+CONFIG_SYS_TSEC1_OFFSET)
#define CONFIG_SYS_TSEC2_OFFSET 0x25000
#define CONFIG_SYS_TSEC2 (CONFIG_SYS_IMMR+CONFIG_SYS_TSEC2_OFFSET)
/*
* TSEC ethernet configuration
*/
#define CONFIG_MII 1 /* MII PHY management */
//#define CONFIG_TSEC1 1
//#define CONFIG_TSEC1_NAME "eTSEC0"
#define CONFIG_TSEC2 1
#define CONFIG_TSEC2_NAME "eTSEC0"
//#define TSEC1_PHY_ADDR 0
#define TSEC2_PHY_ADDR 1
//#define TSEC1_PHYIDX 0
#define TSEC2_PHYIDX 0
//#define TSEC1_FLAGS TSEC_GIGABIT
#define TSEC2_FLAGS TSEC_GIGABIT
/* Options are: eTSEC[0-1] */
#define CONFIG_ETHPRIME "eTSEC0"
/*
* SATA
*/
#define CONFIG_LIBATA
#define CONFIG_FSL_SATA
#define CONFIG_SYS_SATA_MAX_DEVICE 2
#define CONFIG_SATA1
#define CONFIG_SYS_SATA1_OFFSET 0x18000
#define CONFIG_SYS_SATA1 (CONFIG_SYS_IMMR + CONFIG_SYS_SATA1_OFFSET)
#define CONFIG_SYS_SATA1_FLAGS FLAGS_DMA
#define CONFIG_SATA2
#define CONFIG_SYS_SATA2_OFFSET 0x19000
#define CONFIG_SYS_SATA2 (CONFIG_SYS_IMMR + CONFIG_SYS_SATA2_OFFSET)
#define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA
#ifdef CONFIG_FSL_SATA
#define CONFIG_LBA48
#define CONFIG_CMD_SATA
#define CONFIG_DOS_PARTITION
#define CONFIG_CMD_EXT2
#endif
/*
* Environment
*/
#if defined(CONFIG_NAND_U_BOOT)
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_SIZE CONFIG_SYS_NAND_BLOCK_SIZE
#define CONFIG_ENV_OFFSET ((1024<<10) - (CONFIG_SYS_NAND_BLOCK_SIZE<<1))
#elif !defined(CFG_RAMBOOT)
#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
#define CONFIG_ENV_SECT_SIZE 0x10000 /* 64K(one sector) for env */
#define CONFIG_ENV_SIZE 0x2000
#else
#define CONFIG_SYS_NO_FLASH 1 /* Flash is not usable now */
#define CONFIG_ENV_IS_NOWHERE 1 /* Store ENV in memory only */
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - 0x1000)
#define CONFIG_ENV_SIZE 0x2000
#endif
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
#define CONFIG_SYS_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
/*
* BOOTP options
*/
#define CONFIG_BOOTP_BOOTFILESIZE
#define CONFIG_BOOTP_BOOTPATH
#define CONFIG_BOOTP_GATEWAY
#define CONFIG_BOOTP_HOSTNAME
/*
* Command line configuration.
*/
#include <config_cmd_default.h>
#define CONFIG_CMD_PING
#define CONFIG_CMD_I2C
#define CONFIG_CMD_MII
#define CONFIG_CMD_DATE
#define CONFIG_CMD_PCI
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_FDT
#if defined(CONFIG_SYS_RAMBOOT)
#undef CONFIG_CMD_SAVEENV
#undef CONFIG_CMD_LOADS
#endif
#define CONFIG_CMDLINE_EDITING 1 /* add command line history */
#undef CONFIG_WATCHDOG /* watchdog disabled */
/*
* Miscellaneous configurable options
*/
#define CONFIG_SYS_LONGHELP /* undef to save memory */
#define CONFIG_SYS_LOAD_ADDR 0x2000000 /* default load address */
#define CONFIG_SYS_PROMPT "=> " /* Monitor Command Prompt */
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
#else
#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
#endif
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
#define CONFIG_SYS_HZ 1000 /* decrementer freq: 1ms ticks */
/*
* For booting Linux, the board info and command line data
* have to be in the first 8 MB of memory, since this is
* the maximum mapped by the Linux kernel during initialization.
*/
#define CONFIG_SYS_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
/*
* Core HID Setup
*/
#define CONFIG_SYS_HID0_INIT 0x000000000
#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
HID0_ENABLE_DYNAMIC_POWER_MANAGMENT)
#define CONFIG_SYS_HID2 HID2_HBE
/*
* MMU Setup
*/
#define CONFIG_HIGH_BATS 1 /* High BATs supported */
/* DDR: cache cacheable, low 256MB */
#define CONFIG_SYS_IBAT0L (CONFIG_SYS_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT0U (CONFIG_SYS_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT0L CONFIG_SYS_IBAT0L
#define CONFIG_SYS_DBAT0U CONFIG_SYS_IBAT0U
/* IMMRBAR, PCI IO and NAND: cache-inhibit and guarded */
#define CONFIG_SYS_IBAT1L (CONFIG_SYS_IMMR | BATL_PP_10 | \
BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_IBAT1U (CONFIG_SYS_IMMR | BATU_BL_8M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT1L CONFIG_SYS_IBAT1L
#define CONFIG_SYS_DBAT1U CONFIG_SYS_IBAT1U
/* FLASH: icache cacheable, but dcache-inhibit and guarded */
#define CONFIG_SYS_IBAT2L (CONFIG_SYS_FLASH_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT2U (CONFIG_SYS_FLASH_BASE | BATU_BL_32M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT2L (CONFIG_SYS_FLASH_BASE | BATL_PP_10 | \
BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_DBAT2U CONFIG_SYS_IBAT2U
/* Stack in dcache: cacheable, no memory coherence */
#define CONFIG_SYS_IBAT3L (CONFIG_SYS_INIT_RAM_ADDR | BATL_PP_10)
#define CONFIG_SYS_IBAT3U (CONFIG_SYS_INIT_RAM_ADDR | BATU_BL_128K | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT3L CONFIG_SYS_IBAT3L
#define CONFIG_SYS_DBAT3U CONFIG_SYS_IBAT3U
/* PCI MEM space: cacheable */
#define CONFIG_SYS_IBAT4L (CONFIG_SYS_PCI_MEM_PHYS | BATL_PP_10 | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT4U (CONFIG_SYS_PCI_MEM_PHYS | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT4L CONFIG_SYS_IBAT4L
#define CONFIG_SYS_DBAT4U CONFIG_SYS_IBAT4U
/* PCI MMIO space: cache-inhibit and guarded */
#define CONFIG_SYS_IBAT5L (CONFIG_SYS_PCI_MMIO_PHYS | BATL_PP_10 | \
BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_IBAT5U (CONFIG_SYS_PCI_MMIO_PHYS | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT5L CONFIG_SYS_IBAT5L
#define CONFIG_SYS_DBAT5U CONFIG_SYS_IBAT5U
/* DDR: cache cacheable, high 256MB */
#define CONFIG_SYS_IBAT6L (0x10000000 | BATL_PP_10 | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT6U (0x10000000 | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT6L CONFIG_SYS_IBAT6L
#define CONFIG_SYS_DBAT6U CONFIG_SYS_IBAT6U
#define CONFIG_SYS_IBAT7L 0
#define CONFIG_SYS_IBAT7U 0
#define CONFIG_SYS_DBAT7L CONFIG_SYS_IBAT7L
#define CONFIG_SYS_DBAT7U CONFIG_SYS_IBAT7U
/*
* Internal Definitions
*
* Boot Flags
*/
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
#define BOOTFLAG_WARM 0x02 /* Software reboot */
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 230400 /* speed of kgdb serial port */
#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
#endif
/*
* Environment Configuration
*/
#define CONFIG_ENV_OVERWRITE
#if defined(CONFIG_TSEC_ENET)
#define CONFIG_HAS_ETH0
#define CONFIG_ETHADDR 04:00:00:00:00:0A
#define CONFIG_HAS_ETH1
#define CONFIG_ETH1ADDR 04:00:00:00:00:0B
#endif
#define CONFIG_BAUDRATE 115200
#define CONFIG_LOADADDR 500000 /* default location for tftp and bootm */
#define CONFIG_BOOTDELAY 6 /* -1 disables auto-boot */
#undef CONFIG_BOOTARGS /* the boot command will set bootargs */
#define CONFIG_PCI_CONFIG_HOST_BRIDGE 1
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"consoledev=ttyS0\0" \
"ramdiskaddr=1000000\0" \
"ramdiskfile=ramfs.83xx\0" \
"fdtaddr=400000\0" \
"fdtfile=mpc8315erdb.dtb\0" \
"pciconfighost=yes\0" \
""
#define CONFIG_NFSBOOTCOMMAND \
"setenv bootargs root=/dev/nfs rw " \
"nfsroot=$serverip:$rootpath " \
"ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \
"console=$consoledev,$baudrate $othbootargs;" \
"tftp $loadaddr $bootfile;" \
"tftp $fdtaddr $fdtfile;" \
"bootm $loadaddr - $fdtaddr"
#define CONFIG_RAMBOOTCOMMAND \
"setenv bootargs root=/dev/ram rw " \
"console=$consoledev,$baudrate $othbootargs;" \
"tftp $ramdiskaddr $ramdiskfile;" \
"tftp $loadaddr $bootfile;" \
"tftp $fdtaddr $fdtfile;" \
"bootm $loadaddr $ramdiskaddr $fdtaddr"
#define CONFIG_BOOTCOMMAND CONFIG_NFSBOOTCOMMAND
#endif /* __CONFIG_H */

View File

@@ -0,0 +1,756 @@
/*
* Copyright (C) 2007, 2009 Freescale Semiconductor, Inc.
*
* Dave Liu <daveliu@freescale.com>
* Jerry Huang <Chang-Ming.Huang@freescale.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __CONFIG_H
#define __CONFIG_H
/*
* High Level Configuration Options
*/
#define CONFIG_E300 1 /* E300 family */
#define CONFIG_MPC83XX 1 /* MPC83xx family */
#define CONFIG_MPC831X 1 /* MPC831x CPU family */
#define CONFIG_MPC8315 1 /* MPC8315 CPU specific */
#define CONFIG_MPC8315ERDB 1 /* MPC8315ERDB board specific */
/*
* System Clock Setup
*/
#define CONFIG_83XX_CLKIN 66666667 /* in Hz */
#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN
#ifdef CONFIG_PCISLAVE
#define CONFIG_PCI
#define CONFIG_83XX_PCICLK 66666667 /* in Hz */
#endif /* CONFIG_PCISLAVE */
/*
* The 8315 silicon has three speed grade, they are
* A: CORE/CSB = 400MHz/133MHz
* B: CORE/CSB = 333MHz/133MHz
* C: CORE/CSB = 266MHz/133MHz
* Hardware Reset Configuration Word
* if CLKIN is 66.66MHz, then
* CSB = 133MHz, DDRC = 266MHz, LBC = 133MHz
* We choose the A type silicon as default, so the core is 400Mhz.
*/
#define CONFIG_SYS_FREQ_400MHz 1
#define CONFIG_SYS_FREQ_333MHz 2
#define CONFIG_SYS_FREQ_266MHz 3
#ifndef CONFIG_CORE_FREQ
#define CONFIG_CORE_FREQ CONFIG_SYS_FREQ_400MHz
#endif
#if (CONFIG_CORE_FREQ == CONFIG_SYS_FREQ_266MHz)
#define CONFIG_SYS_HRCW_LOW (\
HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
HRCWL_DDR_TO_SCB_CLK_2X1 |\
HRCWL_SVCOD_DIV_2 |\
HRCWL_CSB_TO_CLKIN_2X1 |\
HRCWL_CORE_TO_CSB_2X1)
#elif (CONFIG_CORE_FREQ == CONFIG_SYS_FREQ_333MHz)
#define CONFIG_SYS_HRCW_LOW (\
HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
HRCWL_DDR_TO_SCB_CLK_2X1 |\
HRCWL_SVCOD_DIV_2 |\
HRCWL_CSB_TO_CLKIN_2X1 |\
HRCWL_CORE_TO_CSB_2_5X1)
#else
#define CONFIG_SYS_HRCW_LOW (\
HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
HRCWL_DDR_TO_SCB_CLK_2X1 |\
HRCWL_SVCOD_DIV_2 |\
HRCWL_CSB_TO_CLKIN_2X1 |\
HRCWL_CORE_TO_CSB_3X1)
#endif
#ifdef CONFIG_NAND_SPL
#ifdef CONFIG_PCISLAVE
#define CONFIG_SYS_HRCW_HIGH (\
HRCWH_PCI_AGENT |\
HRCWH_PCI_ARBITER_DISABLE |\
HRCWH_CORE_ENABLE |\
HRCWH_FROM_0XFFF00100 |\
HRCWH_BOOTSEQ_DISABLE |\
HRCWH_SW_WATCHDOG_DISABLE |\
HRCWH_ROM_LOC_NAND_SP_8BIT |\
HRCWH_RL_EXT_NAND |\
HRCWH_TSEC1M_IN_RGMII |\
HRCWH_TSEC2M_IN_RGMII |\
HRCWH_BIG_ENDIAN |\
HRCWH_LALE_NORMAL)
#else
#define CONFIG_SYS_HRCW_HIGH (\
HRCWH_PCI_HOST |\
HRCWH_PCI_ARBITER_ENABLE |\
HRCWH_CORE_ENABLE |\
HRCWH_FROM_0XFFF00100 |\
HRCWH_BOOTSEQ_DISABLE |\
HRCWH_SW_WATCHDOG_DISABLE |\
HRCWH_ROM_LOC_NAND_SP_8BIT |\
HRCWH_RL_EXT_NAND |\
HRCWH_TSEC1M_IN_RGMII |\
HRCWH_TSEC2M_IN_RGMII |\
HRCWH_BIG_ENDIAN |\
HRCWH_LALE_NORMAL)
#endif
#else
#ifdef CONFIG_PCISLAVE
#define CONFIG_SYS_HRCW_HIGH (\
HRCWH_PCI_AGENT |\
HRCWH_PCI1_ARBITER_DISABLE |\
HRCWH_CORE_ENABLE |\
HRCWH_FROM_0X00000100 |\
HRCWH_BOOTSEQ_DISABLE |\
HRCWH_SW_WATCHDOG_DISABLE |\
HRCWH_ROM_LOC_LOCAL_16BIT |\
HRCWH_RL_EXT_LEGACY |\
HRCWH_TSEC1M_IN_RGMII |\
HRCWH_TSEC2M_IN_RGMII |\
HRCWH_BIG_ENDIAN |\
HRCWH_LALE_NORMAL)
#else
#define CONFIG_SYS_HRCW_HIGH (\
HRCWH_PCI_HOST |\
HRCWH_PCI1_ARBITER_ENABLE |\
HRCWH_CORE_ENABLE |\
HRCWH_FROM_0X00000100 |\
HRCWH_BOOTSEQ_DISABLE |\
HRCWH_SW_WATCHDOG_DISABLE |\
HRCWH_ROM_LOC_LOCAL_16BIT |\
HRCWH_RL_EXT_LEGACY |\
HRCWH_TSEC1M_IN_RGMII |\
HRCWH_TSEC2M_IN_RGMII |\
HRCWH_BIG_ENDIAN |\
HRCWH_LALE_NORMAL)
#endif
#endif
/*
* System IO Config
*/
#define CONFIG_SYS_SICRH 0x00000000
#define CONFIG_SYS_SICRL 0x00000000 /* 3.3V, no delay */
#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */
/*
* IMMR new address
*/
#define CONFIG_SYS_IMMR 0xE0000000
/*
* Arbiter Setup
*/
#define CONFIG_SYS_ACR_PIPE_DEP 3 /* Arbiter pipeline depth is 4 */
#define CONFIG_SYS_ACR_RPTCNT 3 /* Arbiter repeat count is 4 */
#define CONFIG_SYS_SPCR_TSECEP 3 /* eTSEC emergency priority is highest */
/*
* DDR Setup
*/
#define CONFIG_SYS_DDR_BASE 0x00000000 /* DDR is system memory */
#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_BASE
#define CONFIG_SYS_DDR_SDRAM_BASE CONFIG_SYS_DDR_BASE
#define CONFIG_SYS_DDR_SDRAM_CLK_CNTL DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05
#define CONFIG_SYS_DDRCDR_VALUE ( DDRCDR_EN \
| DDRCDR_PZ_LOZ \
| DDRCDR_NZ_LOZ \
| DDRCDR_ODT \
| DDRCDR_Q_DRN )
/* 0x7b880001 */
/*
* Manually set up DDR parameters
* consist of two chips HY5PS12621BFP-C4 from HYNIX
*/
#define CONFIG_SYS_DDR_SIZE 512 /* MB */
#define CONFIG_SYS_DDR_CS0_BNDS 0x0000001f
#define CONFIG_SYS_DDR_CS0_CONFIG ( CSCONFIG_EN \
| 0x00010000 /* ODT_WR to CSn */ \
| CSCONFIG_ROW_BIT_13 | CSCONFIG_COL_BIT_10 )
/* 0x80010102 */
#define CONFIG_SYS_DDR_TIMING_3 0x00000000
#define CONFIG_SYS_DDR_TIMING_0 ( ( 0 << TIMING_CFG0_RWT_SHIFT ) \
| ( 0 << TIMING_CFG0_WRT_SHIFT ) \
| ( 0 << TIMING_CFG0_RRT_SHIFT ) \
| ( 0 << TIMING_CFG0_WWT_SHIFT ) \
| ( 2 << TIMING_CFG0_ACT_PD_EXIT_SHIFT ) \
| ( 2 << TIMING_CFG0_PRE_PD_EXIT_SHIFT ) \
| ( 8 << TIMING_CFG0_ODT_PD_EXIT_SHIFT ) \
| ( 2 << TIMING_CFG0_MRS_CYC_SHIFT ) )
/* 0x00220802 */
#define CONFIG_SYS_DDR_TIMING_1 ( ( 2 << TIMING_CFG1_PRETOACT_SHIFT ) \
| ( 7 << TIMING_CFG1_ACTTOPRE_SHIFT ) \
| ( 2 << TIMING_CFG1_ACTTORW_SHIFT ) \
| ( 5 << TIMING_CFG1_CASLAT_SHIFT ) \
| ( 6 << TIMING_CFG1_REFREC_SHIFT ) \
| ( 2 << TIMING_CFG1_WRREC_SHIFT ) \
| ( 2 << TIMING_CFG1_ACTTOACT_SHIFT ) \
| ( 2 << TIMING_CFG1_WRTORD_SHIFT ) )
/* 0x27256222 */
#define CONFIG_SYS_DDR_TIMING_2 ( ( 1 << TIMING_CFG2_ADD_LAT_SHIFT ) \
| ( 4 << TIMING_CFG2_CPO_SHIFT ) \
| ( 2 << TIMING_CFG2_WR_LAT_DELAY_SHIFT ) \
| ( 2 << TIMING_CFG2_RD_TO_PRE_SHIFT ) \
| ( 2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT ) \
| ( 3 << TIMING_CFG2_CKE_PLS_SHIFT ) \
| ( 5 << TIMING_CFG2_FOUR_ACT_SHIFT) )
/* 0x121048c5 */
#define CONFIG_SYS_DDR_INTERVAL ( ( 0x0360 << SDRAM_INTERVAL_REFINT_SHIFT ) \
| ( 0x0100 << SDRAM_INTERVAL_BSTOPRE_SHIFT ) )
/* 0x03600100 */
#define CONFIG_SYS_DDR_SDRAM_CFG ( SDRAM_CFG_SREN \
| SDRAM_CFG_SDRAM_TYPE_DDR2 \
| SDRAM_CFG_32_BE )
/* 0x43080000 */
#define CONFIG_SYS_DDR_SDRAM_CFG2 0x00401000 /* 1 posted refresh */
#define CONFIG_SYS_DDR_MODE ( ( 0x0448 << SDRAM_MODE_ESD_SHIFT ) \
| ( 0x0232 << SDRAM_MODE_SD_SHIFT ) )
/* ODT 150ohm CL=3, AL=1 on SDRAM */
#define CONFIG_SYS_DDR_MODE2 0x00000000
/*
* Memory test
*/
#undef CONFIG_SYS_DRAM_TEST /* memory test, takes time */
#define CONFIG_SYS_MEMTEST_START 0x00040000 /* memtest region */
#define CONFIG_SYS_MEMTEST_END 0x00140000
/*
* The reserved memory
*/
#define CONFIG_SYS_MONITOR_BASE TEXT_BASE /* start of monitor */
#if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE) && !defined(CONFIG_NAND_U_BOOT)
#define CONFIG_SYS_RAMBOOT
#else
#undef CONFIG_SYS_RAMBOOT
#endif
#define CONFIG_SYS_MONITOR_LEN (384 * 1024) /* Reserve 384 kB for Mon */
#define CONFIG_SYS_MALLOC_LEN (512 * 1024) /* Reserved for malloc */
/*
* Initial RAM Base Address Setup
*/
#define CONFIG_SYS_INIT_RAM_LOCK 1
#define CONFIG_SYS_INIT_RAM_ADDR 0xE6000000 /* Initial RAM address */
#define CONFIG_SYS_INIT_RAM_END 0x1000 /* End of used area in RAM */
#define CONFIG_SYS_GBL_DATA_SIZE 0x100 /* num bytes initial data */
#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_END - CONFIG_SYS_GBL_DATA_SIZE)
/*
* Local Bus Configuration & Clock Setup
*/
#define CONFIG_SYS_LCRR (LCRR_DBYP | LCRR_CLKDIV_2)
#define CONFIG_SYS_LBC_LBCR 0x00040000
/*
* FLASH on the Local Bus
*/
#define CONFIG_SYS_FLASH_CFI /* use the Common Flash Interface */
#define CONFIG_FLASH_CFI_DRIVER /* use the CFI driver */
#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
#define CONFIG_SYS_FLASH_BASE 0xFE000000 /* FLASH base address */
#define CONFIG_SYS_FLASH_SIZE 8 /* FLASH size is 8M */
#define CONFIG_SYS_FLASH_PROTECTION 1 /* Use h/w Flash protection. */
#define CONFIG_SYS_LBLAWBAR0_PRELIM CONFIG_SYS_FLASH_BASE /* Window base at flash base */
#define CONFIG_SYS_LBLAWAR0_PRELIM 0x80000016 /* 8MB window size */
#define CONFIG_SYS_FLASH_BR_PRELIM ( CONFIG_SYS_FLASH_BASE /* Flash Base address */ \
| (2 << BR_PS_SHIFT) /* 16 bit port size */ \
| BR_V ) /* valid */
#define CONFIG_SYS_FLASH_OR_PRELIM ( (~(CONFIG_SYS_FLASH_SIZE - 1) << 20) \
| OR_UPM_XAM \
| OR_GPCM_CSNT \
| OR_GPCM_ACS_DIV2 \
| OR_GPCM_XACS \
| OR_GPCM_SCY_15 \
| OR_GPCM_TRLX \
| OR_GPCM_EHTR \
| OR_GPCM_EAD )
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* number of banks */
#define CONFIG_SYS_MAX_FLASH_SECT 135 /* 127 64KB sectors and 8 8KB top sectors per device */
#undef CONFIG_SYS_FLASH_CHECKSUM
#define CONFIG_SYS_FLASH_ERASE_TOUT 60000 /* Flash Erase Timeout (ms) */
#define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (ms) */
/*
* NAND Flash on the Local Bus
*/
#ifdef CONFIG_NAND_SPL
#define CONFIG_SYS_NAND_BASE 0xFFF00000
#else
#define CONFIG_SYS_NAND_BASE 0xE0600000 /* 0xE0600000 */
#endif
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define CONFIG_MTD_NAND_VERIFY_WRITE 1
#define CONFIG_CMD_NAND 1
#define CONFIG_NAND_FSL_ELBC 1
#ifndef CONFIG_NAND_ECC_OFF
#define CONFIG_SYS_NAND_BR_PRELIM ( CONFIG_SYS_NAND_BASE \
| (2<<BR_DECC_SHIFT) /* Use HW ECC */ \
| BR_PS_8 /* Port Size = 8 bit */ \
| BR_MS_FCM /* MSEL = FCM */ \
| BR_V ) /* valid */
#else
#define CONFIG_SYS_NAND_BR_PRELIM ( CONFIG_SYS_NAND_BASE \
| BR_PS_8 /* Port Size = 8 bit */ \
| BR_MS_FCM /* MSEL = FCM */ \
| BR_V )
#endif
#define CONFIG_SYS_NAND_OR_PRELIM ( 0xFFFF8000 /* length 32K */ \
| OR_FCM_CSCT \
| OR_FCM_CST \
| OR_FCM_CHT \
| OR_FCM_SCY_1 \
| OR_FCM_TRLX \
| OR_FCM_EHTR )
/* 0xFFFF8396 */
#define CONFIG_SYS_LBLAWBAR1_PRELIM CONFIG_SYS_NAND_BASE
#define CONFIG_SYS_LBLAWAR1_PRELIM 0x8000000E /* 32KB */
#define CONFIG_SYS_NAND_LBLAWBAR_PRELIM CONFIG_SYS_LBLAWBAR1_PRELIM
#define CONFIG_SYS_NAND_LBLAWAR_PRELIM CONFIG_SYS_LBLAWAR1_PRELIM
/*
* Swap CS0 / CS1 based upon NAND or NOR Flash Boot mode
*/
#if defined(CONFIG_NAND_U_BOOT)
#define CONFIG_SYS_BR0_PRELIM CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
#define CONFIG_SYS_OR0_PRELIM CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_FLASH_BR_PRELIM /* NOR Base address */
#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_FLASH_OR_PRELIM /* NOR Options */
#else
#define CONFIG_SYS_BR0_PRELIM CONFIG_SYS_FLASH_BR_PRELIM /* NOR Base address */
#define CONFIG_SYS_OR0_PRELIM CONFIG_SYS_FLASH_OR_PRELIM /* NOR Options */
#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
#endif /* CONFIG_NAND_U_BOOT */
/*
* NAND Boot Configuration, for board/../nand_boot.c
*/
#define CONFIG_SYS_NAND_BR0_PRELIM CONFIG_SYS_NAND_BR_PRELIM
#define CONFIG_SYS_NAND_OR0_PRELIM CONFIG_SYS_NAND_OR_PRELIM
#define CONFIG_SYS_NAND_LBLAWBAR0_PRELIM CONFIG_SYS_NAND_BASE
#define CONFIG_SYS_NAND_LBLAWAR0_PRELIM 0x8000000E /* 32KB */
#undef CONFIG_SYS_NAND_BOOT_QUIET /* Enable NAND boot status messages */
#define CONFIG_SYS_NAND_BOOT_SHOW_ECC_NUM /* Show corrected ECC errors */
#define CONFIG_SYS_NAND_PAGE_SIZE (512) /* NAND chip page size */
#define CONFIG_SYS_NAND_BLOCK_SIZE (16 << 10) /* NAND chip block size */
#define CONFIG_SYS_NAND_BAD_BLOCK_POS (5) /* Bad block marker location */
#define CONFIG_SYS_NAND_FMR ((15 << FMR_CWTO_SHIFT) | (0 << FMR_AL_SHIFT))
#define CONFIG_SYS_NAND_U_BOOT_SIZE (384 << 10) /* Size of RAM U-Boot image */
#define CONFIG_SYS_NAND_U_BOOT_DST (0x01000000) /* Load NUB to this addr */
#define CONFIG_SYS_NAND_U_BOOT_START (CONFIG_SYS_NAND_U_BOOT_DST + 0x120) /* NUB start */
#define CONFIG_SYS_NAND_U_BOOT_OFFS (16 << 10)
#define CONFIG_SYS_NAND_U_BOOT_RELOC 0x00010000
/*
* JFFS2 configuration
*/
#define CONFIG_JFFS2_NAND
/* mtdparts command line support */
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=nor,nand0=nand"
#define MTDPARTS_DEFAULT "mtdparts=nand:-@4m(jffs2)"
#define NAND_CACHE_PAGES 32
/*
* Serial Port
*/
#define CONFIG_CONS_INDEX 1
#undef CONFIG_SERIAL_SOFTWARE_FIFO
#define CONFIG_SYS_NS16550
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE 1
#define CONFIG_SYS_NS16550_CLK gd->csb_clk
#define CONFIG_SYS_BAUDRATE_TABLE \
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
#define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_IMMR+0x4500)
#define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_IMMR+0x4600)
/* Use the HUSH parser */
#define CONFIG_SYS_HUSH_PARSER
#ifdef CONFIG_SYS_HUSH_PARSER
#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#endif
/* Pass open firmware flat tree */
#define CONFIG_OF_LIBFDT 1
#define CONFIG_OF_BOARD_SETUP 1
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
/* I2C */
#define CONFIG_HARD_I2C /* I2C with hardware support */
#define CONFIG_FSL_I2C
#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */
#define CONFIG_SYS_I2C_SLAVE 0x7F
#define CONFIG_SYS_I2C_NOPROBES {0x51} /* Don't probe these addrs */
#define CONFIG_SYS_I2C_OFFSET 0x3000
#define CONFIG_SYS_I2C2_OFFSET 0x3100
/*
* Board info - revision and where boot from
*/
#define CONFIG_SYS_I2C_PCF8574A_ADDR 0x39
/*
* Config on-board RTC
*/
#define CONFIG_RTC_DS1337 /* ds1339 on board, use ds1337 rtc via i2c */
#define CONFIG_SYS_I2C_RTC_ADDR 0x68 /* at address 0x68 */
/*
* General PCI
* Addresses are mapped 1-1.
*/
#define CONFIG_SYS_PCI_MEM_BASE 0x80000000
#define CONFIG_SYS_PCI_MEM_PHYS CONFIG_SYS_PCI_MEM_BASE
#define CONFIG_SYS_PCI_MEM_SIZE 0x10000000 /* 256M */
#define CONFIG_SYS_PCI_MMIO_BASE 0x90000000
#define CONFIG_SYS_PCI_MMIO_PHYS CONFIG_SYS_PCI_MMIO_BASE
#define CONFIG_SYS_PCI_MMIO_SIZE 0x10000000 /* 256M */
#define CONFIG_SYS_PCI_IO_BASE 0x00000000
#define CONFIG_SYS_PCI_IO_PHYS 0xE0300000
#define CONFIG_SYS_PCI_IO_SIZE 0x100000 /* 1M */
#define CONFIG_SYS_PCI_SLV_MEM_LOCAL CONFIG_SYS_SDRAM_BASE
#define CONFIG_SYS_PCI_SLV_MEM_BUS 0x00000000
#define CONFIG_SYS_PCI_SLV_MEM_SIZE 0x80000000
#define CONFIG_SYS_PCIE1_BASE 0xA0000000
#define CONFIG_SYS_PCIE1_MEM_BASE 0xA0000000
#define CONFIG_SYS_PCIE1_MEM_PHYS 0xA0000000
#define CONFIG_SYS_PCIE1_MEM_SIZE 0x10000000
#define CONFIG_SYS_PCIE1_CFG_BASE 0xB0000000
#define CONFIG_SYS_PCIE1_CFG_SIZE 0x01000000
#define CONFIG_SYS_PCIE1_IO_BASE 0x00000000
#define CONFIG_SYS_PCIE1_IO_PHYS 0xB1000000
#define CONFIG_SYS_PCIE1_IO_SIZE 0x00800000
#define CONFIG_SYS_PCIE2_BASE 0xC0000000
#define CONFIG_SYS_PCIE2_MEM_BASE 0xC0000000
#define CONFIG_SYS_PCIE2_MEM_PHYS 0xC0000000
#define CONFIG_SYS_PCIE2_MEM_SIZE 0x10000000
#define CONFIG_SYS_PCIE2_CFG_BASE 0xD0000000
#define CONFIG_SYS_PCIE2_CFG_SIZE 0x01000000
#define CONFIG_SYS_PCIE2_IO_BASE 0x00000000
#define CONFIG_SYS_PCIE2_IO_PHYS 0xD1000000
#define CONFIG_SYS_PCIE2_IO_SIZE 0x00800000
#define CONFIG_PCI
#define CONFIG_83XX_GENERIC_PCI 1 /* Use generic PCI setup */
#define CONFIG_83XX_GENERIC_PCIE 1
#define CONFIG_83XX_GENERIC_PCIE_REGISTER_HOSES
#define PCI_VENDOR_ID_FREESCALE 0x1957
#define PCI_DEVICE_ID_MPC8315E 0x00b4
#define CONFIG_NET_MULTI
#define CONFIG_PCI_PNP /* do pci plug-and-play */
#define CONFIG_EEPRO100
#undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */
#define CONFIG_SKIP_PCI_SCAN
#ifndef CONFIG_NET_MULTI
#define CONFIG_NET_MULTI 1
#endif
#define CONFIG_HAS_FSL_DR_USB
/*
* TSEC
*/
#define CONFIG_TSEC_ENET /* TSEC ethernet support */
#define CONFIG_SYS_TSEC1_OFFSET 0x24000
#define CONFIG_SYS_TSEC1 (CONFIG_SYS_IMMR+CONFIG_SYS_TSEC1_OFFSET)
#define CONFIG_SYS_TSEC2_OFFSET 0x25000
#define CONFIG_SYS_TSEC2 (CONFIG_SYS_IMMR+CONFIG_SYS_TSEC2_OFFSET)
/*
* TSEC ethernet configuration
*/
#define CONFIG_MII 1 /* MII PHY management */
//#define CONFIG_TSEC1 1
//#define CONFIG_TSEC1_NAME "eTSEC0"
#define CONFIG_TSEC2 1
#define CONFIG_TSEC2_NAME "eTSEC0"
//#define TSEC1_PHY_ADDR 0
#define TSEC2_PHY_ADDR 1
//#define TSEC1_PHYIDX 0
#define TSEC2_PHYIDX 0
//#define TSEC1_FLAGS TSEC_GIGABIT
#define TSEC2_FLAGS TSEC_GIGABIT
/* Options are: eTSEC[0-1] */
#define CONFIG_ETHPRIME "eTSEC0"
/*
* SATA
*/
#define CONFIG_LIBATA
#define CONFIG_FSL_SATA
#define CONFIG_SYS_SATA_MAX_DEVICE 2
#define CONFIG_SATA1
#define CONFIG_SYS_SATA1_OFFSET 0x18000
#define CONFIG_SYS_SATA1 (CONFIG_SYS_IMMR + CONFIG_SYS_SATA1_OFFSET)
#define CONFIG_SYS_SATA1_FLAGS FLAGS_DMA
#define CONFIG_SATA2
#define CONFIG_SYS_SATA2_OFFSET 0x19000
#define CONFIG_SYS_SATA2 (CONFIG_SYS_IMMR + CONFIG_SYS_SATA2_OFFSET)
#define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA
#ifdef CONFIG_FSL_SATA
#define CONFIG_LBA48
#define CONFIG_CMD_SATA
#define CONFIG_DOS_PARTITION
#define CONFIG_CMD_EXT2
#endif
/*
* Environment
*/
#if defined(CONFIG_NAND_U_BOOT)
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_SIZE CONFIG_SYS_NAND_BLOCK_SIZE
#define CONFIG_ENV_OFFSET ((1024<<10) - (CONFIG_SYS_NAND_BLOCK_SIZE<<1))
#elif !defined(CFG_RAMBOOT)
#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
#define CONFIG_ENV_SECT_SIZE 0x10000 /* 64K(one sector) for env */
#define CONFIG_ENV_SIZE 0x2000
#else
#define CONFIG_SYS_NO_FLASH 1 /* Flash is not usable now */
#define CONFIG_ENV_IS_NOWHERE 1 /* Store ENV in memory only */
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - 0x1000)
#define CONFIG_ENV_SIZE 0x2000
#endif
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
#define CONFIG_SYS_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
/*
* BOOTP options
*/
#define CONFIG_BOOTP_BOOTFILESIZE
#define CONFIG_BOOTP_BOOTPATH
#define CONFIG_BOOTP_GATEWAY
#define CONFIG_BOOTP_HOSTNAME
/*
* Command line configuration.
*/
#include <config_cmd_default.h>
#define CONFIG_CMD_PING
#define CONFIG_CMD_I2C
#define CONFIG_CMD_MII
#define CONFIG_CMD_DATE
#define CONFIG_CMD_PCI
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_FDT
#if defined(CONFIG_SYS_RAMBOOT)
#undef CONFIG_CMD_SAVEENV
#undef CONFIG_CMD_LOADS
#endif
#define CONFIG_CMDLINE_EDITING 1 /* add command line history */
#undef CONFIG_WATCHDOG /* watchdog disabled */
/*
* Miscellaneous configurable options
*/
#define CONFIG_SYS_LONGHELP /* undef to save memory */
#define CONFIG_SYS_LOAD_ADDR 0x2000000 /* default load address */
#define CONFIG_SYS_PROMPT "=> " /* Monitor Command Prompt */
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
#else
#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
#endif
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
#define CONFIG_SYS_HZ 1000 /* decrementer freq: 1ms ticks */
/*
* For booting Linux, the board info and command line data
* have to be in the first 8 MB of memory, since this is
* the maximum mapped by the Linux kernel during initialization.
*/
#define CONFIG_SYS_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
/*
* Core HID Setup
*/
#define CONFIG_SYS_HID0_INIT 0x000000000
#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
HID0_ENABLE_DYNAMIC_POWER_MANAGMENT)
#define CONFIG_SYS_HID2 HID2_HBE
/*
* MMU Setup
*/
#define CONFIG_HIGH_BATS 1 /* High BATs supported */
/* DDR: cache cacheable, low 256MB */
#define CONFIG_SYS_IBAT0L (CONFIG_SYS_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT0U (CONFIG_SYS_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT0L CONFIG_SYS_IBAT0L
#define CONFIG_SYS_DBAT0U CONFIG_SYS_IBAT0U
/* IMMRBAR, PCI IO and NAND: cache-inhibit and guarded */
#define CONFIG_SYS_IBAT1L (CONFIG_SYS_IMMR | BATL_PP_10 | \
BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_IBAT1U (CONFIG_SYS_IMMR | BATU_BL_8M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT1L CONFIG_SYS_IBAT1L
#define CONFIG_SYS_DBAT1U CONFIG_SYS_IBAT1U
/* FLASH: icache cacheable, but dcache-inhibit and guarded */
#define CONFIG_SYS_IBAT2L (CONFIG_SYS_FLASH_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT2U (CONFIG_SYS_FLASH_BASE | BATU_BL_32M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT2L (CONFIG_SYS_FLASH_BASE | BATL_PP_10 | \
BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_DBAT2U CONFIG_SYS_IBAT2U
/* Stack in dcache: cacheable, no memory coherence */
#define CONFIG_SYS_IBAT3L (CONFIG_SYS_INIT_RAM_ADDR | BATL_PP_10)
#define CONFIG_SYS_IBAT3U (CONFIG_SYS_INIT_RAM_ADDR | BATU_BL_128K | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT3L CONFIG_SYS_IBAT3L
#define CONFIG_SYS_DBAT3U CONFIG_SYS_IBAT3U
/* PCI MEM space: cacheable */
#define CONFIG_SYS_IBAT4L (CONFIG_SYS_PCI_MEM_PHYS | BATL_PP_10 | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT4U (CONFIG_SYS_PCI_MEM_PHYS | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT4L CONFIG_SYS_IBAT4L
#define CONFIG_SYS_DBAT4U CONFIG_SYS_IBAT4U
/* PCI MMIO space: cache-inhibit and guarded */
#define CONFIG_SYS_IBAT5L (CONFIG_SYS_PCI_MMIO_PHYS | BATL_PP_10 | \
BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_IBAT5U (CONFIG_SYS_PCI_MMIO_PHYS | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT5L CONFIG_SYS_IBAT5L
#define CONFIG_SYS_DBAT5U CONFIG_SYS_IBAT5U
/* DDR: cache cacheable, high 256MB */
#define CONFIG_SYS_IBAT6L (0x10000000 | BATL_PP_10 | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT6U (0x10000000 | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT6L CONFIG_SYS_IBAT6L
#define CONFIG_SYS_DBAT6U CONFIG_SYS_IBAT6U
#define CONFIG_SYS_IBAT7L 0
#define CONFIG_SYS_IBAT7U 0
#define CONFIG_SYS_DBAT7L CONFIG_SYS_IBAT7L
#define CONFIG_SYS_DBAT7U CONFIG_SYS_IBAT7U
/*
* Internal Definitions
*
* Boot Flags
*/
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
#define BOOTFLAG_WARM 0x02 /* Software reboot */
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 230400 /* speed of kgdb serial port */
#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
#endif
/*
* Environment Configuration
*/
#define CONFIG_ENV_OVERWRITE
#if defined(CONFIG_TSEC_ENET)
#define CONFIG_HAS_ETH0
#define CONFIG_ETHADDR 04:00:00:00:00:0A
#define CONFIG_HAS_ETH1
#define CONFIG_ETH1ADDR 04:00:00:00:00:0B
#endif
#define CONFIG_BAUDRATE 115200
#define CONFIG_LOADADDR 500000 /* default location for tftp and bootm */
#define CONFIG_BOOTDELAY 6 /* -1 disables auto-boot */
#undef CONFIG_BOOTARGS /* the boot command will set bootargs */
#define CONFIG_PCI_CONFIG_HOST_BRIDGE 1
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"consoledev=ttyS0\0" \
"ramdiskaddr=1000000\0" \
"ramdiskfile=ramfs.83xx\0" \
"fdtaddr=400000\0" \
"fdtfile=mpc8315erdb.dtb\0" \
"pciconfighost=yes\0" \
""
#define CONFIG_NFSBOOTCOMMAND \
"setenv bootargs root=/dev/nfs rw " \
"nfsroot=$serverip:$rootpath " \
"ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \
"console=$consoledev,$baudrate $othbootargs;" \
"tftp $loadaddr $bootfile;" \
"tftp $fdtaddr $fdtfile;" \
"bootm $loadaddr - $fdtaddr"
#define CONFIG_RAMBOOTCOMMAND \
"setenv bootargs root=/dev/ram rw " \
"console=$consoledev,$baudrate $othbootargs;" \
"tftp $ramdiskaddr $ramdiskfile;" \
"tftp $loadaddr $bootfile;" \
"tftp $fdtaddr $fdtfile;" \
"bootm $loadaddr $ramdiskaddr $fdtaddr"
#define CONFIG_BOOTCOMMAND CONFIG_NFSBOOTCOMMAND
#endif /* __CONFIG_H */

View File

@@ -0,0 +1,125 @@
/*
* (C) Copyright 2006
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
OUTPUT_ARCH(powerpc)
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.rel.text : { *(.rel.text) }
.rela.text : { *(.rela.text) }
.rel.data : { *(.rel.data) }
.rela.data : { *(.rela.data) }
.rel.rodata : { *(.rel.rodata) }
.rela.rodata : { *(.rela.rodata) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) }
.plt : { *(.plt) }
.text :
{
cpu/mpc83xx/start.o (.text)
*(.text)
*(.fixup)
*(.got1)
. = ALIGN(16);
*(.rodata)
*(.rodata1)
*(.rodata.str1.1)
*(.rodata.str1.4)
*(.eh_frame)
}
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
/* Read-write section, merged into data segment: */
. = (. + 0x0FFF) & 0xFFFFF000;
_erotext = .;
PROVIDE (erotext = .);
.reloc :
{
*(.got)
_GOT2_TABLE_ = .;
*(.got2)
_FIXUP_TABLE_ = .;
*(.fixup)
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
.data :
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.dynamic)
CONSTRUCTORS
}
_edata = .;
PROVIDE (edata = .);
. = .;
__u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .;
. = .;
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(4096);
__init_begin = .;
.text.init : { *(.text.init) }
.data.init : { *(.data.init) }
. = ALIGN(4096);
__init_end = .;
__bss_start = .;
.bss (NOLOAD) :
{
*(.sbss) *(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
. = ALIGN(4);
}
_end = . ;
PROVIDE (end = .);
}
ENTRY(_start)

View File

@@ -0,0 +1,125 @@
/*
* (C) Copyright 2006
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
OUTPUT_ARCH(powerpc)
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.rel.text : { *(.rel.text) }
.rela.text : { *(.rela.text) }
.rel.data : { *(.rel.data) }
.rela.data : { *(.rela.data) }
.rel.rodata : { *(.rel.rodata) }
.rela.rodata : { *(.rela.rodata) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) }
.plt : { *(.plt) }
.text :
{
cpu/mpc83xx/start.o (.text)
*(.text)
*(.fixup)
*(.got1)
. = ALIGN(16);
*(.rodata)
*(.rodata1)
*(.rodata.str1.1)
*(.rodata.str1.4)
*(.eh_frame)
}
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
/* Read-write section, merged into data segment: */
. = (. + 0x0FFF) & 0xFFFFF000;
_erotext = .;
PROVIDE (erotext = .);
.reloc :
{
*(.got)
_GOT2_TABLE_ = .;
*(.got2)
_FIXUP_TABLE_ = .;
*(.fixup)
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
.data :
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.dynamic)
CONSTRUCTORS
}
_edata = .;
PROVIDE (edata = .);
. = .;
__u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .;
. = .;
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(4096);
__init_begin = .;
.text.init : { *(.text.init) }
.data.init : { *(.data.init) }
. = ALIGN(4096);
__init_end = .;
__bss_start = .;
.bss (NOLOAD) :
{
*(.sbss) *(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
. = ALIGN(4);
}
_end = . ;
PROVIDE (end = .);
}
ENTRY(_start)

View File

@@ -0,0 +1,21 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-08-04T20:47:40+08:00
====== udev ======
Created Saturday 04 August 2012
编译时出现下列错误:
udevd.c: In function 'udev_event_run':
udevd.c:239:3: warning: implicit declaration of function 'setpriority' [-Wimplicit-function-declaration]
udevd.c:239:3: warning: nested extern declaration of 'setpriority' [-Wnested-externs]
udevd.c:239:15: error: 'PRIO_PROCESS' undeclared (first use in this function)
udevd.c:239:15: note: each undeclared identifier is reported only once for each function it appears in
udevd.c: In function 'main':
udevd.c:1085:14: error: 'PRIO_PROCESS' undeclared (first use in this function)
-----------------
解决方法是:
在udevd.c中加入
#define PRIO_PROCESS 0
即可

View File

@@ -0,0 +1,8 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T11:06:09+08:00
====== 不要安装nfs-utils和portmap以及modinits软件包 ======
Created Wednesday 22 February 2012
由于busybox没有安装nfs工具包(目前还没解决)所以在ltib的package list中不要选择上面的三个软件包。

View File

@@ -0,0 +1,19 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-22T10:35:27+08:00
====== 编译glibc和base libs提示不兼容的libc.so ======
Created Wednesday 22 February 2012
http://www.mail-archive.com/ltib@nongnu.org/msg00623.html
这是由于glibc和base_libs的rpm控制脚本存在bug。
修改ltib目录下的dist/lfs-xx/glibc|base_libs目录下的spec文件中下面部分
# remove absolute paths from text search files (if they exist)
perl -w -e '
- @ARGV = grep { `file $_` =~ m,ASCII C program text, } @ARGV;
+ @ARGV = grep { `file $_` =~ m,ASCII\s+.*text, } @ARGV;
RTW这其实是__将生成的libc.so和libc_noshared.so中的绝对路径去掉__。
在新版本的工具链制作脚本中已经自动打上了上面的patch。

View File

@@ -0,0 +1,17 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-02-21T16:12:49+08:00
====== 编译新内核(3.1.8)是出现没找到mpc8315erdb-default.dts错误 ======
Created Tuesday 21 February 2012
原因是新内核目录arch/powerpc/boot/dts/目录下的没有mpc8315erdb*系列文件可以将ISO中的老内核(位于/opt/freescale/pkgs/linux-2.29.6.tar.bz2)同一目录下的mpc8315**系列文件拷贝到新内核目录。
[[./mpc8315erdb-1588.dts]]
[[./mpc8315erdb-default.dts]]
[[./mpc8315erdb-otg.dts]]
[[./mpc8315erdb-ulpi.dts]]
[[./mpc8315erdb.dts]]

View File

@@ -0,0 +1,464 @@
/dts-v1/;
/ {
compatible = "fsl,mpc8315erdb";
#address-cells = <0x1>;
#size-cells = <0x1>;
aliases {
ethernet0 = "/immr@e0000000/ethernet@24000";
ethernet1 = "/immr@e0000000/ethernet@25000";
serial0 = "/immr@e0000000/serial@4500";
serial1 = "/immr@e0000000/serial@4600";
pci0 = "/pci@e0008500";
pcie0 = "/pci@e0009000";
pcie1 = "/pci@e000a000";
};
cpus {
#address-cells = <0x1>;
#size-cells = <0x0>;
PowerPC,8315@0 {
device_type = "cpu";
reg = <0x0>;
d-cache-line-size = <0x20>;
i-cache-line-size = <0x20>;
d-cache-size = <0x4000>;
i-cache-size = <0x4000>;
timebase-frequency = <0x0>;
bus-frequency = <0x0>;
clock-frequency = <0x0>;
};
};
memory {
device_type = "memory";
reg = <0x0 0x8000000>;
};
localbus@e0005000 {
#address-cells = <0x2>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-elbc", "fsl,elbc", "simple-bus";
reg = <0xe0005000 0x1000>;
interrupts = <0x4d 0x8>;
interrupt-parent = <0x1>;
ranges = <0x0 0x0 0xfe000000 0x800000 0x1 0x0 0xe0600000 0x2000 0x2 0x0 0xf0000000 0x20000 0x3 0x0 0xfa000000 0x8000>;
flash@0,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x800000>;
bank-width = <0x2>;
device-width = <0x1>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
};
fs@100000 {
reg = <0x100000 0x400000>;
};
kernel@500000 {
reg = <0x500000 0x200000>;
};
dtb@700000 {
reg = <0x700000 0x100000>;
};
};
nand@1,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-fcm-nand", "fsl,elbc-fcm-nand";
reg = <0x1 0x0 0x2000>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
label = "U-Boot-NAND";
};
jffs2@100000 {
reg = <0x100000 0x800000>;
label = "JFFS2-NAND";
};
ramdisk@900000 {
reg = <0x900000 0x400000>;
label = "Ramdisk-NAND";
};
reserved@d00000 {
reg = <0xd00000 0x1000000>;
label = "Reserved-NAND";
};
kernel@1d00000 {
reg = <0x1d00000 0x200000>;
read-only;
label = "Kernel-NAND";
};
dtb@1f00000 {
reg = <0x1f00000 0x100000>;
read-only;
label = "DTB-NAND";
};
};
};
immr@e0000000 {
#address-cells = <0x1>;
#size-cells = <0x1>;
device_type = "soc";
compatible = "fsl,mpc8315-immr", "simple-bus";
ranges = <0x0 0xe0000000 0x100000>;
reg = <0xe0000000 0x200>;
bus-frequency = <0x0>;
wdt@200 {
device_type = "watchdog";
compatible = "mpc83xx_wdt";
reg = <0x200 0x100>;
};
i2c@3000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
cell-index = <0x0>;
compatible = "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <0xe 0x8>;
interrupt-parent = <0x1>;
dfsrr;
rtc@68 {
compatible = "dallas,ds1339";
reg = <0x68>;
};
mcu@a {
#gpio-cells = <0x2>;
compatible = "fsl,mc9s08qg8-mpc8315erdb", "fsl,mcu-mpc8349emitx";
reg = <0xa>;
gpio-controller;
};
};
spi@7000 {
cell-index = <0x0>;
compatible = "fsl,spi";
reg = <0x7000 0x1000>;
interrupts = <0x10 0x8>;
interrupt-parent = <0x1>;
mode = "cpu";
};
dma@82a8 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-dma", "fsl,elo-dma";
reg = <0x82a8 0x4>;
ranges = <0x0 0x8100 0x1a8>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
cell-index = <0x0>;
dma-channel@0 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x0 0x80>;
cell-index = <0x0>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@80 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x80 0x80>;
cell-index = <0x1>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@100 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x100 0x80>;
cell-index = <0x2>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@180 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x180 0x28>;
cell-index = <0x3>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
};
usb@23000 {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
#address-cells = <0x1>;
#size-cells = <0x0>;
interrupt-parent = <0x1>;
interrupts = <0x26 0x8>;
phy_type = "utmi";
sleep = <0x2 0xc00000>;
};
mdio@24520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-mdio";
reg = <0x24520 0x20>;
ethernet-phy@0 {
interrupt-parent = <0x1>;
interrupts = <0x14 0x8>;
reg = <0x0>;
device_type = "ethernet-phy";
linux,phandle = <0x4>;
};
ethernet-phy@1 {
interrupt-parent = <0x1>;
interrupts = <0x13 0x8>;
reg = <0x1>;
device_type = "ethernet-phy";
linux,phandle = <0x7>;
};
tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
linux,phandle = <0x3>;
};
};
mdio@25520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-tbi";
reg = <0x25520 0x20>;
tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
linux,phandle = <0x6>;
};
};
ptimer@24e00 {
compatible = "fsl,gianfar-ptp-timer";
reg = <0x24e00 0xb0>;
linux,phandle = <0x5>;
};
ethernet@24000 {
cell-index = <0x0>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x24000 0x1000>;
local-mac-address = [00 00 00 00 00 00];
interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>;
interrupt-parent = <0x1>;
tbi-handle = <0x3>;
phy-handle = <0x4>;
sleep = <0x2 0xc0000000>;
fsl,magic-packet;
fsl,lossless-flow-ctrl = <0x0>;
ptimer-handle = <0x5>;
};
ethernet@25000 {
cell-index = <0x1>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x25000 0x1000>;
local-mac-address = [00 00 00 00 00 00];
interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>;
interrupt-parent = <0x1>;
tbi-handle = <0x6>;
phy-handle = <0x7>;
sleep = <0x2 0x30000000>;
fsl,magic-packet;
fsl,lossless-flow-ctrl = <0x0>;
ptimer-handle = <0x5>;
};
serial@4500 {
cell-index = <0x0>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4500 0x100>;
clock-frequency = <0x7f28155>;
interrupts = <0x9 0x8>;
interrupt-parent = <0x1>;
};
serial@4600 {
cell-index = <0x1>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4600 0x100>;
clock-frequency = <0x7f28155>;
interrupts = <0xa 0x8>;
interrupt-parent = <0x1>;
};
crypto@30000 {
compatible = "fsl,sec3.3", "fsl,sec3.1", "fsl,sec3.0", "fsl,sec2.4", "fsl,sec2.2", "fsl,sec2.1", "fsl,sec2.0";
reg = <0x30000 0x10000>;
interrupts = <0xb 0x8>;
interrupt-parent = <0x1>;
fsl,num-channels = <0x4>;
fsl,channel-fifo-len = <0x18>;
fsl,exec-units-mask = <0x97c>;
fsl,descriptor-types-mask = <0x3ab0abf>;
};
sata@18000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x18000 0x1000>;
cell-index = <0x1>;
interrupts = <0x2c 0x8>;
interrupt-parent = <0x1>;
};
sata@19000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x19000 0x1000>;
cell-index = <0x2>;
interrupts = <0x2d 0x8>;
interrupt-parent = <0x1>;
};
tdm@16000 {
device_type = "tdm";
compatible = "fsl,mpc8315-tdm";
reg = <0x16000 0x200 0x2c000 0x2000>;
clock-frequency = <0x0>;
interrupts = <0x53 0x8 0x5e 0x8 0x3 0x8>;
interrupt-parent = <0x1>;
};
legerity {
device_type = "slic";
compatible = "legerity-slic";
clock-frequency = <0x0>;
interrupts = <0x16 0x8>;
interrupt-parent = <0x1>;
};
gpio@c00 {
device_type = "gpio";
compatible = "fsl,mpc8315-gpio";
reg = <0xc00 0x18>;
interrupt-parent = <0x1>;
};
interrupt-controller@700 {
compatible = "fsl,ipic";
interrupt-controller;
#address-cells = <0x0>;
#interrupt-cells = <0x2>;
reg = <0x700 0x100>;
device_type = "ipic";
linux,phandle = <0x1>;
};
ipic-msi@7c0 {
compatible = "fsl,ipic-msi";
reg = <0x7c0 0x40>;
msi-available-ranges = <0x0 0x100>;
interrupts = <0x43 0x8 0x4 0x8 0x51 0x8 0x52 0x8 0x56 0x8 0x57 0x8 0x58 0x8 0x59 0x8>;
interrupt-parent = <0x1>;
};
power@b00 {
compatible = "fsl,mpc8313-pmc", "fsl,mpc8349-pmc";
reg = <0xb00 0x100 0xa00 0x100>;
interrupts = <0x50 0x8>;
interrupt-parent = <0x1>;
fsl,mpc8313-wakeup-timer = <0x8>;
linux,phandle = <0x2>;
};
timer@500 {
compatible = "fsl,mpc8313-gtm", "fsl,gtm";
reg = <0x500 0x100>;
clock-frequency = <0x7ed6b40>;
interrupts = <0x5a 0x8 0x4e 0x8 0x54 0x8 0x48 0x8>;
interrupt-parent = <0x1>;
linux,phandle = <0x8>;
};
timer@600 {
compatible = "fsl,mpc8313-gtm", "fsl,gtm";
reg = <0x600 0x100>;
clock-frequency = <0x7ed6b40>;
interrupts = <0x5b 0x8 0x4f 0x8 0x55 0x8 0x49 0x8>;
interrupt-parent = <0x1>;
};
};
pci@e0008500 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <0x7000 0x0 0x0 0x1 0x1 0x12 0x8 0x7000 0x0 0x0 0x2 0x1 0x12 0x8 0x7000 0x0 0x0 0x3 0x1 0x12 0x8 0x7000 0x0 0x0 0x4 0x1 0x12 0x8 0x7800 0x0 0x0 0x1 0x1 0x11 0x8 0x7800 0x0 0x0 0x2 0x1 0x11 0x8 0x7800 0x0 0x0 0x3 0x1 0x11 0x8 0x7800 0x0 0x0 0x4 0x1 0x11 0x8 0x8000 0x0 0x0 0x1 0x1 0x30 0x8 0x8000 0x0 0x0 0x2 0x1 0x11 0x8 0x8000 0x0 0x0 0x3 0x1 0x30 0x8 0x8000 0x0 0x0 0x4 0x1 0x11 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x42 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0x90000000 0x90000000 0x0 0x10000000 0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000 0x1000000 0x0 0x0 0xe0300000 0x0 0x100000>;
clock-frequency = <0x3f940aa>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe0008500 0x100 0xe0008300 0x8>;
compatible = "fsl,mpc8349-pci";
device_type = "pci";
};
pci@e0009000 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
msi-available-ranges = <0x43 0x4 0x51 0x52 0x56 0x57 0x58 0x59>;
interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x1 0x8 0x0 0x0 0x0 0x2 0x1 0x1 0x8 0x0 0x0 0x0 0x3 0x1 0x1 0x8 0x0 0x0 0x0 0x4 0x1 0x1 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x1 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000 0x1000000 0x0 0x0 0xb1000000 0x0 0x800000>;
clock-frequency = <0x0>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe0009000 0x1000 0xb0000000 0x1000000>;
compatible = "fsl,mpc8315-pcie";
device_type = "pci";
};
pci@e000a000 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
msi-available-ranges = <0x43 0x4 0x51 0x52 0x56 0x57 0x58 0x59>;
interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x2 0x8 0x0 0x0 0x0 0x2 0x1 0x2 0x8 0x0 0x0 0x0 0x3 0x1 0x2 0x8 0x0 0x0 0x0 0x4 0x1 0x2 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x2 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0xc0000000 0xc0000000 0x0 0x10000000 0x1000000 0x0 0x0 0xd1000000 0x0 0x800000>;
clock-frequency = <0x0>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe000a000 0x1000 0xd0000000 0x1000000>;
compatible = "fsl,mpc8315-pcie";
device_type = "pci";
};
};

View File

@@ -0,0 +1,456 @@
/dts-v1/;
/ {
compatible = "fsl,mpc8315erdb";
#address-cells = <0x1>;
#size-cells = <0x1>;
aliases {
ethernet0 = "/immr@e0000000/ethernet@24000";
ethernet1 = "/immr@e0000000/ethernet@25000";
serial0 = "/immr@e0000000/serial@4500";
serial1 = "/immr@e0000000/serial@4600";
pci0 = "/pci@e0008500";
pcie0 = "/pci@e0009000";
pcie1 = "/pci@e000a000";
};
cpus {
#address-cells = <0x1>;
#size-cells = <0x0>;
PowerPC,8315@0 {
device_type = "cpu";
reg = <0x0>;
d-cache-line-size = <0x20>;
i-cache-line-size = <0x20>;
d-cache-size = <0x4000>;
i-cache-size = <0x4000>;
timebase-frequency = <0x0>;
bus-frequency = <0x0>;
clock-frequency = <0x0>;
};
};
memory {
device_type = "memory";
reg = <0x0 0x8000000>;
};
localbus@e0005000 {
#address-cells = <0x2>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-elbc", "fsl,elbc", "simple-bus";
reg = <0xe0005000 0x1000>;
interrupts = <0x4d 0x8>;
interrupt-parent = <0x1>;
ranges = <0x0 0x0 0xfe000000 0x800000 0x1 0x0 0xe0600000 0x2000 0x2 0x0 0xf0000000 0x20000 0x3 0x0 0xfa000000 0x8000>;
flash@0,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x800000>;
bank-width = <0x2>;
device-width = <0x1>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
};
fs@100000 {
reg = <0x100000 0x400000>;
};
kernel@500000 {
reg = <0x500000 0x200000>;
};
dtb@700000 {
reg = <0x700000 0x100000>;
};
};
nand@1,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-fcm-nand", "fsl,elbc-fcm-nand";
reg = <0x1 0x0 0x2000>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
label = "U-Boot-NAND";
};
jffs2@100000 {
reg = <0x100000 0x800000>;
label = "JFFS2-NAND";
};
ramdisk@900000 {
reg = <0x900000 0x400000>;
label = "Ramdisk-NAND";
};
reserved@d00000 {
reg = <0xd00000 0x1000000>;
label = "Reserved-NAND";
};
kernel@1d00000 {
reg = <0x1d00000 0x200000>;
read-only;
label = "Kernel-NAND";
};
dtb@1f00000 {
reg = <0x1f00000 0x100000>;
read-only;
label = "DTB-NAND";
};
};
};
immr@e0000000 {
#address-cells = <0x1>;
#size-cells = <0x1>;
device_type = "soc";
compatible = "fsl,mpc8315-immr", "simple-bus";
ranges = <0x0 0xe0000000 0x100000>;
reg = <0xe0000000 0x200>;
bus-frequency = <0x0>;
wdt@200 {
device_type = "watchdog";
compatible = "mpc83xx_wdt";
reg = <0x200 0x100>;
};
i2c@3000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
cell-index = <0x0>;
compatible = "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <0xe 0x8>;
interrupt-parent = <0x1>;
dfsrr;
rtc@68 {
compatible = "dallas,ds1339";
reg = <0x68>;
};
mcu@a {
#gpio-cells = <0x2>;
compatible = "fsl,mc9s08qg8-mpc8315erdb", "fsl,mcu-mpc8349emitx";
reg = <0xa>;
gpio-controller;
};
};
spi@7000 {
cell-index = <0x0>;
compatible = "fsl,spi";
reg = <0x7000 0x1000>;
interrupts = <0x10 0x8>;
interrupt-parent = <0x1>;
mode = "cpu";
};
dma@82a8 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-dma", "fsl,elo-dma";
reg = <0x82a8 0x4>;
ranges = <0x0 0x8100 0x1a8>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
cell-index = <0x0>;
dma-channel@0 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x0 0x80>;
cell-index = <0x0>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@80 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x80 0x80>;
cell-index = <0x1>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@100 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x100 0x80>;
cell-index = <0x2>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@180 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x180 0x28>;
cell-index = <0x3>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
};
usb@23000 {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
#address-cells = <0x1>;
#size-cells = <0x0>;
interrupt-parent = <0x1>;
interrupts = <0x26 0x8>;
phy_type = "utmi";
sleep = <0x2 0xc00000>;
};
mdio@24520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-mdio";
reg = <0x24520 0x20>;
ethernet-phy@0 {
interrupt-parent = <0x1>;
interrupts = <0x14 0x8>;
reg = <0x0>;
device_type = "ethernet-phy";
linux,phandle = <0x4>;
};
ethernet-phy@1 {
interrupt-parent = <0x1>;
interrupts = <0x13 0x8>;
reg = <0x1>;
device_type = "ethernet-phy";
linux,phandle = <0x6>;
};
tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
linux,phandle = <0x3>;
};
};
mdio@25520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-tbi";
reg = <0x25520 0x20>;
tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
linux,phandle = <0x5>;
};
};
ethernet@24000 {
cell-index = <0x0>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x24000 0x1000>;
local-mac-address = [00 00 00 00 00 00];
interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>;
interrupt-parent = <0x1>;
tbi-handle = <0x3>;
phy-handle = <0x4>;
sleep = <0x2 0xc0000000>;
fsl,magic-packet;
fsl,lossless-flow-ctrl = <0x0>;
};
ethernet@25000 {
cell-index = <0x1>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x25000 0x1000>;
local-mac-address = [00 00 00 00 00 00];
interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>;
interrupt-parent = <0x1>;
tbi-handle = <0x5>;
phy-handle = <0x6>;
sleep = <0x2 0x30000000>;
fsl,magic-packet;
fsl,lossless-flow-ctrl = <0x0>;
};
serial@4500 {
cell-index = <0x0>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4500 0x100>;
clock-frequency = <0x7f28155>;
interrupts = <0x9 0x8>;
interrupt-parent = <0x1>;
};
serial@4600 {
cell-index = <0x1>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4600 0x100>;
clock-frequency = <0x7f28155>;
interrupts = <0xa 0x8>;
interrupt-parent = <0x1>;
};
crypto@30000 {
compatible = "fsl,sec3.3", "fsl,sec3.1", "fsl,sec3.0", "fsl,sec2.4", "fsl,sec2.2", "fsl,sec2.1", "fsl,sec2.0";
reg = <0x30000 0x10000>;
interrupts = <0xb 0x8>;
interrupt-parent = <0x1>;
fsl,num-channels = <0x4>;
fsl,channel-fifo-len = <0x18>;
fsl,exec-units-mask = <0x97c>;
fsl,descriptor-types-mask = <0x3ab0abf>;
};
sata@18000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x18000 0x1000>;
cell-index = <0x1>;
interrupts = <0x2c 0x8>;
interrupt-parent = <0x1>;
};
sata@19000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x19000 0x1000>;
cell-index = <0x2>;
interrupts = <0x2d 0x8>;
interrupt-parent = <0x1>;
};
tdm@16000 {
device_type = "tdm";
compatible = "fsl,mpc8315-tdm";
reg = <0x16000 0x200 0x2c000 0x2000>;
clock-frequency = <0x0>;
interrupts = <0x53 0x8 0x5e 0x8 0x3 0x8>;
interrupt-parent = <0x1>;
};
legerity {
device_type = "slic";
compatible = "legerity-slic";
clock-frequency = <0x0>;
interrupts = <0x16 0x8>;
interrupt-parent = <0x1>;
};
gpio@c00 {
device_type = "gpio";
compatible = "fsl,mpc8315-gpio";
reg = <0xc00 0x18>;
interrupt-parent = <0x1>;
};
interrupt-controller@700 {
compatible = "fsl,ipic";
interrupt-controller;
#address-cells = <0x0>;
#interrupt-cells = <0x2>;
reg = <0x700 0x100>;
device_type = "ipic";
linux,phandle = <0x1>;
};
ipic-msi@7c0 {
compatible = "fsl,ipic-msi";
reg = <0x7c0 0x40>;
msi-available-ranges = <0x0 0x100>;
interrupts = <0x43 0x8 0x4 0x8 0x51 0x8 0x52 0x8 0x56 0x8 0x57 0x8 0x58 0x8 0x59 0x8>;
interrupt-parent = <0x1>;
};
power@b00 {
compatible = "fsl,mpc8313-pmc", "fsl,mpc8349-pmc";
reg = <0xb00 0x100 0xa00 0x100>;
interrupts = <0x50 0x8>;
interrupt-parent = <0x1>;
fsl,mpc8313-wakeup-timer = <0x7>;
linux,phandle = <0x2>;
};
timer@500 {
compatible = "fsl,mpc8313-gtm", "fsl,gtm";
reg = <0x500 0x100>;
clock-frequency = <0x7ed6b40>;
interrupts = <0x5a 0x8 0x4e 0x8 0x54 0x8 0x48 0x8>;
interrupt-parent = <0x1>;
linux,phandle = <0x7>;
};
timer@600 {
compatible = "fsl,mpc8313-gtm", "fsl,gtm";
reg = <0x600 0x100>;
clock-frequency = <0x7ed6b40>;
interrupts = <0x5b 0x8 0x4f 0x8 0x55 0x8 0x49 0x8>;
interrupt-parent = <0x1>;
};
};
pci@e0008500 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <0x7000 0x0 0x0 0x1 0x1 0x12 0x8 0x7000 0x0 0x0 0x2 0x1 0x12 0x8 0x7000 0x0 0x0 0x3 0x1 0x12 0x8 0x7000 0x0 0x0 0x4 0x1 0x12 0x8 0x7800 0x0 0x0 0x1 0x1 0x11 0x8 0x7800 0x0 0x0 0x2 0x1 0x11 0x8 0x7800 0x0 0x0 0x3 0x1 0x11 0x8 0x7800 0x0 0x0 0x4 0x1 0x11 0x8 0x8000 0x0 0x0 0x1 0x1 0x30 0x8 0x8000 0x0 0x0 0x2 0x1 0x11 0x8 0x8000 0x0 0x0 0x3 0x1 0x30 0x8 0x8000 0x0 0x0 0x4 0x1 0x11 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x42 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0x90000000 0x90000000 0x0 0x10000000 0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000 0x1000000 0x0 0x0 0xe0300000 0x0 0x100000>;
clock-frequency = <0x3f940aa>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe0008500 0x100 0xe0008300 0x8>;
compatible = "fsl,mpc8349-pci";
device_type = "pci";
};
pci@e0009000 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
msi-available-ranges = <0x43 0x4 0x51 0x52 0x56 0x57 0x58 0x59>;
interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x1 0x8 0x0 0x0 0x0 0x2 0x1 0x1 0x8 0x0 0x0 0x0 0x3 0x1 0x1 0x8 0x0 0x0 0x0 0x4 0x1 0x1 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x1 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000 0x1000000 0x0 0x0 0xb1000000 0x0 0x800000>;
clock-frequency = <0x0>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe0009000 0x1000 0xb0000000 0x1000000>;
compatible = "fsl,mpc8315-pcie";
device_type = "pci";
};
pci@e000a000 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
msi-available-ranges = <0x43 0x4 0x51 0x52 0x56 0x57 0x58 0x59>;
interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x2 0x8 0x0 0x0 0x0 0x2 0x1 0x2 0x8 0x0 0x0 0x0 0x3 0x1 0x2 0x8 0x0 0x0 0x0 0x4 0x1 0x2 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x2 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0xc0000000 0xc0000000 0x0 0x10000000 0x1000000 0x0 0x0 0xd1000000 0x0 0x800000>;
clock-frequency = <0x0>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe000a000 0x1000 0xd0000000 0x1000000>;
compatible = "fsl,mpc8315-pcie";
device_type = "pci";
};
};

View File

@@ -0,0 +1,465 @@
/dts-v1/;
/ {
compatible = "fsl,mpc8315erdb";
#address-cells = <0x1>;
#size-cells = <0x1>;
aliases {
ethernet0 = "/immr@e0000000/ethernet@24000";
ethernet1 = "/immr@e0000000/ethernet@25000";
serial0 = "/immr@e0000000/serial@4500";
serial1 = "/immr@e0000000/serial@4600";
pci0 = "/pci@e0008500";
pcie0 = "/pci@e0009000";
pcie1 = "/pci@e000a000";
};
cpus {
#address-cells = <0x1>;
#size-cells = <0x0>;
PowerPC,8315@0 {
device_type = "cpu";
reg = <0x0>;
d-cache-line-size = <0x20>;
i-cache-line-size = <0x20>;
d-cache-size = <0x4000>;
i-cache-size = <0x4000>;
timebase-frequency = <0x0>;
bus-frequency = <0x0>;
clock-frequency = <0x0>;
};
};
memory {
device_type = "memory";
reg = <0x0 0x8000000>;
};
localbus@e0005000 {
#address-cells = <0x2>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-elbc", "fsl,elbc", "simple-bus";
reg = <0xe0005000 0x1000>;
interrupts = <0x4d 0x8>;
interrupt-parent = <0x1>;
ranges = <0x0 0x0 0xfe000000 0x800000 0x1 0x0 0xe0600000 0x2000 0x2 0x0 0xf0000000 0x20000 0x3 0x0 0xfa000000 0x8000>;
flash@0,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x800000>;
bank-width = <0x2>;
device-width = <0x1>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
};
fs@100000 {
reg = <0x100000 0x400000>;
};
kernel@500000 {
reg = <0x500000 0x200000>;
};
dtb@700000 {
reg = <0x700000 0x100000>;
};
};
nand@1,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-fcm-nand", "fsl,elbc-fcm-nand";
reg = <0x1 0x0 0x2000>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
label = "U-Boot-NAND";
};
jffs2@100000 {
reg = <0x100000 0x800000>;
label = "JFFS2-NAND";
};
ramdisk@900000 {
reg = <0x900000 0x400000>;
label = "Ramdisk-NAND";
};
reserved@d00000 {
reg = <0xd00000 0x1000000>;
label = "Reserved-NAND";
};
kernel@1d00000 {
reg = <0x1d00000 0x200000>;
read-only;
label = "Kernel-NAND";
};
dtb@1f00000 {
reg = <0x1f00000 0x100000>;
read-only;
label = "DTB-NAND";
};
};
};
immr@e0000000 {
#address-cells = <0x1>;
#size-cells = <0x1>;
device_type = "soc";
compatible = "fsl,mpc8315-immr", "simple-bus";
ranges = <0x0 0xe0000000 0x100000>;
reg = <0xe0000000 0x200>;
bus-frequency = <0x0>;
wdt@200 {
device_type = "watchdog";
compatible = "mpc83xx_wdt";
reg = <0x200 0x100>;
};
i2c@3000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
cell-index = <0x0>;
compatible = "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <0xe 0x8>;
interrupt-parent = <0x1>;
dfsrr;
rtc@68 {
compatible = "dallas,ds1339";
reg = <0x68>;
};
mcu@a {
#gpio-cells = <0x2>;
compatible = "fsl,mc9s08qg8-mpc8315erdb", "fsl,mcu-mpc8349emitx";
reg = <0xa>;
gpio-controller;
};
};
spi@7000 {
cell-index = <0x0>;
compatible = "fsl,spi";
reg = <0x7000 0x1000>;
interrupts = <0x10 0x8>;
interrupt-parent = <0x1>;
mode = "cpu";
};
dma@82a8 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-dma", "fsl,elo-dma";
reg = <0x82a8 0x4>;
ranges = <0x0 0x8100 0x1a8>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
cell-index = <0x0>;
dma-channel@0 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x0 0x80>;
cell-index = <0x0>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@80 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x80 0x80>;
cell-index = <0x1>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@100 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x100 0x80>;
cell-index = <0x2>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@180 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x180 0x28>;
cell-index = <0x3>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
};
usb@23000 {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
#address-cells = <0x1>;
#size-cells = <0x0>;
interrupt-parent = <0x1>;
interrupts = <0x26 0x8>;
dr_mode = "otg";
phy_type = "ulpi";
sleep = <0x2 0xc00000>;
};
mdio@24520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-mdio";
reg = <0x24520 0x20>;
ethernet-phy@0 {
interrupt-parent = <0x1>;
interrupts = <0x14 0x8>;
reg = <0x0>;
device_type = "ethernet-phy";
linux,phandle = <0x4>;
};
ethernet-phy@1 {
interrupt-parent = <0x1>;
interrupts = <0x13 0x8>;
reg = <0x1>;
device_type = "ethernet-phy";
linux,phandle = <0x7>;
};
tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
linux,phandle = <0x3>;
};
};
mdio@25520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-tbi";
reg = <0x25520 0x20>;
tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
linux,phandle = <0x6>;
};
};
ptimer@24e00 {
compatible = "fsl,gianfar-ptp-timer";
reg = <0x24e00 0xb0>;
linux,phandle = <0x5>;
};
ethernet@24000 {
cell-index = <0x0>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x24000 0x1000>;
local-mac-address = [00 00 00 00 00 00];
interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>;
interrupt-parent = <0x1>;
tbi-handle = <0x3>;
phy-handle = <0x4>;
sleep = <0x2 0xc0000000>;
fsl,magic-packet;
fsl,lossless-flow-ctrl = <0x0>;
ptimer-handle = <0x5>;
};
ethernet@25000 {
cell-index = <0x1>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x25000 0x1000>;
local-mac-address = [00 00 00 00 00 00];
interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>;
interrupt-parent = <0x1>;
tbi-handle = <0x6>;
phy-handle = <0x7>;
sleep = <0x2 0x30000000>;
fsl,magic-packet;
fsl,lossless-flow-ctrl = <0x0>;
ptimer-handle = <0x5>;
};
serial@4500 {
cell-index = <0x0>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4500 0x100>;
clock-frequency = <0x7f28155>;
interrupts = <0x9 0x8>;
interrupt-parent = <0x1>;
};
serial@4600 {
cell-index = <0x1>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4600 0x100>;
clock-frequency = <0x7f28155>;
interrupts = <0xa 0x8>;
interrupt-parent = <0x1>;
};
crypto@30000 {
compatible = "fsl,sec3.3", "fsl,sec3.1", "fsl,sec3.0", "fsl,sec2.4", "fsl,sec2.2", "fsl,sec2.1", "fsl,sec2.0";
reg = <0x30000 0x10000>;
interrupts = <0xb 0x8>;
interrupt-parent = <0x1>;
fsl,num-channels = <0x4>;
fsl,channel-fifo-len = <0x18>;
fsl,exec-units-mask = <0x97c>;
fsl,descriptor-types-mask = <0x3ab0abf>;
};
sata@18000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x18000 0x1000>;
cell-index = <0x1>;
interrupts = <0x2c 0x8>;
interrupt-parent = <0x1>;
};
sata@19000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x19000 0x1000>;
cell-index = <0x2>;
interrupts = <0x2d 0x8>;
interrupt-parent = <0x1>;
};
tdm@16000 {
device_type = "tdm";
compatible = "fsl,mpc8315-tdm";
reg = <0x16000 0x200 0x2c000 0x2000>;
clock-frequency = <0x0>;
interrupts = <0x53 0x8 0x5e 0x8 0x3 0x8>;
interrupt-parent = <0x1>;
};
legerity {
device_type = "slic";
compatible = "legerity-slic";
clock-frequency = <0x0>;
interrupts = <0x16 0x8>;
interrupt-parent = <0x1>;
};
gpio@c00 {
device_type = "gpio";
compatible = "fsl,mpc8315-gpio";
reg = <0xc00 0x18>;
interrupt-parent = <0x1>;
};
interrupt-controller@700 {
compatible = "fsl,ipic";
interrupt-controller;
#address-cells = <0x0>;
#interrupt-cells = <0x2>;
reg = <0x700 0x100>;
device_type = "ipic";
linux,phandle = <0x1>;
};
ipic-msi@7c0 {
compatible = "fsl,ipic-msi";
reg = <0x7c0 0x40>;
msi-available-ranges = <0x0 0x100>;
interrupts = <0x43 0x8 0x4 0x8 0x51 0x8 0x52 0x8 0x56 0x8 0x57 0x8 0x58 0x8 0x59 0x8>;
interrupt-parent = <0x1>;
};
power@b00 {
compatible = "fsl,mpc8313-pmc", "fsl,mpc8349-pmc";
reg = <0xb00 0x100 0xa00 0x100>;
interrupts = <0x50 0x8>;
interrupt-parent = <0x1>;
fsl,mpc8313-wakeup-timer = <0x8>;
linux,phandle = <0x2>;
};
timer@500 {
compatible = "fsl,mpc8313-gtm", "fsl,gtm";
reg = <0x500 0x100>;
clock-frequency = <0x7ed6b40>;
interrupts = <0x5a 0x8 0x4e 0x8 0x54 0x8 0x48 0x8>;
interrupt-parent = <0x1>;
linux,phandle = <0x8>;
};
timer@600 {
compatible = "fsl,mpc8313-gtm", "fsl,gtm";
reg = <0x600 0x100>;
clock-frequency = <0x7ed6b40>;
interrupts = <0x5b 0x8 0x4f 0x8 0x55 0x8 0x49 0x8>;
interrupt-parent = <0x1>;
};
};
pci@e0008500 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <0x7000 0x0 0x0 0x1 0x1 0x12 0x8 0x7000 0x0 0x0 0x2 0x1 0x12 0x8 0x7000 0x0 0x0 0x3 0x1 0x12 0x8 0x7000 0x0 0x0 0x4 0x1 0x12 0x8 0x7800 0x0 0x0 0x1 0x1 0x11 0x8 0x7800 0x0 0x0 0x2 0x1 0x11 0x8 0x7800 0x0 0x0 0x3 0x1 0x11 0x8 0x7800 0x0 0x0 0x4 0x1 0x11 0x8 0x8000 0x0 0x0 0x1 0x1 0x30 0x8 0x8000 0x0 0x0 0x2 0x1 0x11 0x8 0x8000 0x0 0x0 0x3 0x1 0x30 0x8 0x8000 0x0 0x0 0x4 0x1 0x11 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x42 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0x90000000 0x90000000 0x0 0x10000000 0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000 0x1000000 0x0 0x0 0xe0300000 0x0 0x100000>;
clock-frequency = <0x3f940aa>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe0008500 0x100 0xe0008300 0x8>;
compatible = "fsl,mpc8349-pci";
device_type = "pci";
};
pci@e0009000 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
msi-available-ranges = <0x43 0x4 0x51 0x52 0x56 0x57 0x58 0x59>;
interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x1 0x8 0x0 0x0 0x0 0x2 0x1 0x1 0x8 0x0 0x0 0x0 0x3 0x1 0x1 0x8 0x0 0x0 0x0 0x4 0x1 0x1 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x1 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000 0x1000000 0x0 0x0 0xb1000000 0x0 0x800000>;
clock-frequency = <0x0>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe0009000 0x1000 0xb0000000 0x1000000>;
compatible = "fsl,mpc8315-pcie";
device_type = "pci";
};
pci@e000a000 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
msi-available-ranges = <0x43 0x4 0x51 0x52 0x56 0x57 0x58 0x59>;
interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x2 0x8 0x0 0x0 0x0 0x2 0x1 0x2 0x8 0x0 0x0 0x0 0x3 0x1 0x2 0x8 0x0 0x0 0x0 0x4 0x1 0x2 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x2 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0xc0000000 0xc0000000 0x0 0x10000000 0x1000000 0x0 0x0 0xd1000000 0x0 0x800000>;
clock-frequency = <0x0>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe000a000 0x1000 0xd0000000 0x1000000>;
compatible = "fsl,mpc8315-pcie";
device_type = "pci";
};
};

View File

@@ -0,0 +1,464 @@
/dts-v1/;
/ {
compatible = "fsl,mpc8315erdb";
#address-cells = <0x1>;
#size-cells = <0x1>;
aliases {
ethernet0 = "/immr@e0000000/ethernet@24000";
ethernet1 = "/immr@e0000000/ethernet@25000";
serial0 = "/immr@e0000000/serial@4500";
serial1 = "/immr@e0000000/serial@4600";
pci0 = "/pci@e0008500";
pcie0 = "/pci@e0009000";
pcie1 = "/pci@e000a000";
};
cpus {
#address-cells = <0x1>;
#size-cells = <0x0>;
PowerPC,8315@0 {
device_type = "cpu";
reg = <0x0>;
d-cache-line-size = <0x20>;
i-cache-line-size = <0x20>;
d-cache-size = <0x4000>;
i-cache-size = <0x4000>;
timebase-frequency = <0x0>;
bus-frequency = <0x0>;
clock-frequency = <0x0>;
};
};
memory {
device_type = "memory";
reg = <0x0 0x8000000>;
};
localbus@e0005000 {
#address-cells = <0x2>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-elbc", "fsl,elbc", "simple-bus";
reg = <0xe0005000 0x1000>;
interrupts = <0x4d 0x8>;
interrupt-parent = <0x1>;
ranges = <0x0 0x0 0xfe000000 0x800000 0x1 0x0 0xe0600000 0x2000 0x2 0x0 0xf0000000 0x20000 0x3 0x0 0xfa000000 0x8000>;
flash@0,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x800000>;
bank-width = <0x2>;
device-width = <0x1>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
};
fs@100000 {
reg = <0x100000 0x400000>;
};
kernel@500000 {
reg = <0x500000 0x200000>;
};
dtb@700000 {
reg = <0x700000 0x100000>;
};
};
nand@1,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-fcm-nand", "fsl,elbc-fcm-nand";
reg = <0x1 0x0 0x2000>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
label = "U-Boot-NAND";
};
jffs2@100000 {
reg = <0x100000 0x800000>;
label = "JFFS2-NAND";
};
ramdisk@900000 {
reg = <0x900000 0x400000>;
label = "Ramdisk-NAND";
};
reserved@d00000 {
reg = <0xd00000 0x1000000>;
label = "Reserved-NAND";
};
kernel@1d00000 {
reg = <0x1d00000 0x200000>;
read-only;
label = "Kernel-NAND";
};
dtb@1f00000 {
reg = <0x1f00000 0x100000>;
read-only;
label = "DTB-NAND";
};
};
};
immr@e0000000 {
#address-cells = <0x1>;
#size-cells = <0x1>;
device_type = "soc";
compatible = "fsl,mpc8315-immr", "simple-bus";
ranges = <0x0 0xe0000000 0x100000>;
reg = <0xe0000000 0x200>;
bus-frequency = <0x0>;
wdt@200 {
device_type = "watchdog";
compatible = "mpc83xx_wdt";
reg = <0x200 0x100>;
};
i2c@3000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
cell-index = <0x0>;
compatible = "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <0xe 0x8>;
interrupt-parent = <0x1>;
dfsrr;
rtc@68 {
compatible = "dallas,ds1339";
reg = <0x68>;
};
mcu@a {
#gpio-cells = <0x2>;
compatible = "fsl,mc9s08qg8-mpc8315erdb", "fsl,mcu-mpc8349emitx";
reg = <0xa>;
gpio-controller;
};
};
spi@7000 {
cell-index = <0x0>;
compatible = "fsl,spi";
reg = <0x7000 0x1000>;
interrupts = <0x10 0x8>;
interrupt-parent = <0x1>;
mode = "cpu";
};
dma@82a8 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "fsl,mpc8315-dma", "fsl,elo-dma";
reg = <0x82a8 0x4>;
ranges = <0x0 0x8100 0x1a8>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
cell-index = <0x0>;
dma-channel@0 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x0 0x80>;
cell-index = <0x0>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@80 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x80 0x80>;
cell-index = <0x1>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@100 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x100 0x80>;
cell-index = <0x2>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
dma-channel@180 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x180 0x28>;
cell-index = <0x3>;
interrupt-parent = <0x1>;
interrupts = <0x47 0x8>;
};
};
usb@23000 {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
#address-cells = <0x1>;
#size-cells = <0x0>;
interrupt-parent = <0x1>;
interrupts = <0x26 0x8>;
phy_type = "ulpi";
sleep = <0x2 0xc00000>;
};
mdio@24520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-mdio";
reg = <0x24520 0x20>;
ethernet-phy@0 {
interrupt-parent = <0x1>;
interrupts = <0x14 0x8>;
reg = <0x0>;
device_type = "ethernet-phy";
linux,phandle = <0x4>;
};
ethernet-phy@1 {
interrupt-parent = <0x1>;
interrupts = <0x13 0x8>;
reg = <0x1>;
device_type = "ethernet-phy";
linux,phandle = <0x7>;
};
tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
linux,phandle = <0x3>;
};
};
mdio@25520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-tbi";
reg = <0x25520 0x20>;
tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
linux,phandle = <0x6>;
};
};
ptimer@24e00 {
compatible = "fsl,gianfar-ptp-timer";
reg = <0x24e00 0xb0>;
linux,phandle = <0x5>;
};
ethernet@24000 {
cell-index = <0x0>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x24000 0x1000>;
local-mac-address = [00 00 00 00 00 00];
interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>;
interrupt-parent = <0x1>;
tbi-handle = <0x3>;
phy-handle = <0x4>;
sleep = <0x2 0xc0000000>;
fsl,magic-packet;
fsl,lossless-flow-ctrl = <0x0>;
ptimer-handle = <0x5>;
};
ethernet@25000 {
cell-index = <0x1>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x25000 0x1000>;
local-mac-address = [00 00 00 00 00 00];
interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>;
interrupt-parent = <0x1>;
tbi-handle = <0x6>;
phy-handle = <0x7>;
sleep = <0x2 0x30000000>;
fsl,magic-packet;
fsl,lossless-flow-ctrl = <0x0>;
ptimer-handle = <0x5>;
};
serial@4500 {
cell-index = <0x0>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4500 0x100>;
clock-frequency = <0x7f28155>;
interrupts = <0x9 0x8>;
interrupt-parent = <0x1>;
};
serial@4600 {
cell-index = <0x1>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4600 0x100>;
clock-frequency = <0x7f28155>;
interrupts = <0xa 0x8>;
interrupt-parent = <0x1>;
};
crypto@30000 {
compatible = "fsl,sec3.3", "fsl,sec3.1", "fsl,sec3.0", "fsl,sec2.4", "fsl,sec2.2", "fsl,sec2.1", "fsl,sec2.0";
reg = <0x30000 0x10000>;
interrupts = <0xb 0x8>;
interrupt-parent = <0x1>;
fsl,num-channels = <0x4>;
fsl,channel-fifo-len = <0x18>;
fsl,exec-units-mask = <0x97c>;
fsl,descriptor-types-mask = <0x3ab0abf>;
};
sata@18000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x18000 0x1000>;
cell-index = <0x1>;
interrupts = <0x2c 0x8>;
interrupt-parent = <0x1>;
};
sata@19000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x19000 0x1000>;
cell-index = <0x2>;
interrupts = <0x2d 0x8>;
interrupt-parent = <0x1>;
};
tdm@16000 {
device_type = "tdm";
compatible = "fsl,mpc8315-tdm";
reg = <0x16000 0x200 0x2c000 0x2000>;
clock-frequency = <0x0>;
interrupts = <0x53 0x8 0x5e 0x8 0x3 0x8>;
interrupt-parent = <0x1>;
};
legerity {
device_type = "slic";
compatible = "legerity-slic";
clock-frequency = <0x0>;
interrupts = <0x16 0x8>;
interrupt-parent = <0x1>;
};
gpio@c00 {
device_type = "gpio";
compatible = "fsl,mpc8315-gpio";
reg = <0xc00 0x18>;
interrupt-parent = <0x1>;
};
interrupt-controller@700 {
compatible = "fsl,ipic";
interrupt-controller;
#address-cells = <0x0>;
#interrupt-cells = <0x2>;
reg = <0x700 0x100>;
device_type = "ipic";
linux,phandle = <0x1>;
};
ipic-msi@7c0 {
compatible = "fsl,ipic-msi";
reg = <0x7c0 0x40>;
msi-available-ranges = <0x0 0x100>;
interrupts = <0x43 0x8 0x4 0x8 0x51 0x8 0x52 0x8 0x56 0x8 0x57 0x8 0x58 0x8 0x59 0x8>;
interrupt-parent = <0x1>;
};
power@b00 {
compatible = "fsl,mpc8313-pmc", "fsl,mpc8349-pmc";
reg = <0xb00 0x100 0xa00 0x100>;
interrupts = <0x50 0x8>;
interrupt-parent = <0x1>;
fsl,mpc8313-wakeup-timer = <0x8>;
linux,phandle = <0x2>;
};
timer@500 {
compatible = "fsl,mpc8313-gtm", "fsl,gtm";
reg = <0x500 0x100>;
clock-frequency = <0x7ed6b40>;
interrupts = <0x5a 0x8 0x4e 0x8 0x54 0x8 0x48 0x8>;
interrupt-parent = <0x1>;
linux,phandle = <0x8>;
};
timer@600 {
compatible = "fsl,mpc8313-gtm", "fsl,gtm";
reg = <0x600 0x100>;
clock-frequency = <0x7ed6b40>;
interrupts = <0x5b 0x8 0x4f 0x8 0x55 0x8 0x49 0x8>;
interrupt-parent = <0x1>;
};
};
pci@e0008500 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <0x7000 0x0 0x0 0x1 0x1 0x12 0x8 0x7000 0x0 0x0 0x2 0x1 0x12 0x8 0x7000 0x0 0x0 0x3 0x1 0x12 0x8 0x7000 0x0 0x0 0x4 0x1 0x12 0x8 0x7800 0x0 0x0 0x1 0x1 0x11 0x8 0x7800 0x0 0x0 0x2 0x1 0x11 0x8 0x7800 0x0 0x0 0x3 0x1 0x11 0x8 0x7800 0x0 0x0 0x4 0x1 0x11 0x8 0x8000 0x0 0x0 0x1 0x1 0x30 0x8 0x8000 0x0 0x0 0x2 0x1 0x11 0x8 0x8000 0x0 0x0 0x3 0x1 0x30 0x8 0x8000 0x0 0x0 0x4 0x1 0x11 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x42 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0x90000000 0x90000000 0x0 0x10000000 0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000 0x1000000 0x0 0x0 0xe0300000 0x0 0x100000>;
clock-frequency = <0x3f940aa>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe0008500 0x100 0xe0008300 0x8>;
compatible = "fsl,mpc8349-pci";
device_type = "pci";
};
pci@e0009000 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
msi-available-ranges = <0x43 0x4 0x51 0x52 0x56 0x57 0x58 0x59>;
interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x1 0x8 0x0 0x0 0x0 0x2 0x1 0x1 0x8 0x0 0x0 0x0 0x3 0x1 0x1 0x8 0x0 0x0 0x0 0x4 0x1 0x1 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x1 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000 0x1000000 0x0 0x0 0xb1000000 0x0 0x800000>;
clock-frequency = <0x0>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe0009000 0x1000 0xb0000000 0x1000000>;
compatible = "fsl,mpc8315-pcie";
device_type = "pci";
};
pci@e000a000 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
msi-available-ranges = <0x43 0x4 0x51 0x52 0x56 0x57 0x58 0x59>;
interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x2 0x8 0x0 0x0 0x0 0x2 0x1 0x2 0x8 0x0 0x0 0x0 0x3 0x1 0x2 0x8 0x0 0x0 0x0 0x4 0x1 0x2 0x8>;
interrupt-parent = <0x1>;
interrupts = <0x2 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x2000000 0x0 0xc0000000 0xc0000000 0x0 0x10000000 0x1000000 0x0 0x0 0xd1000000 0x0 0x800000>;
clock-frequency = <0x0>;
#interrupt-cells = <0x1>;
#size-cells = <0x2>;
#address-cells = <0x3>;
reg = <0xe000a000 0x1000 0xd0000000 0x1000000>;
compatible = "fsl,mpc8315-pcie";
device_type = "pci";
};
};

View File

@@ -0,0 +1,480 @@
/*
* MPC8315E RDB Device Tree Source
*
* Copyright 2007 Freescale Semiconductor Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
/dts-v1/;
/ {
compatible = "fsl,mpc8315erdb";
#address-cells = <1>;
#size-cells = <1>;
aliases {
ethernet0 = &enet0;
ethernet1 = &enet1;
serial0 = &serial0;
serial1 = &serial1;
pci0 = &pci0;
pci1 = &pci1;
pci2 = &pci2;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
PowerPC,8315@0 {
device_type = "cpu";
reg = <0x0>;
d-cache-line-size = <32>;
i-cache-line-size = <32>;
d-cache-size = <16384>;
i-cache-size = <16384>;
timebase-frequency = <0>; // from bootloader
bus-frequency = <0>; // from bootloader
clock-frequency = <0>; // from bootloader
};
};
memory {
device_type = "memory";
reg = <0x00000000 0x08000000>; // 128MB at 0
};
localbus@e0005000 {
#address-cells = <2>;
#size-cells = <1>;
compatible = "fsl,mpc8315-elbc", "fsl,elbc", "simple-bus";
reg = <0xe0005000 0x1000>;
interrupts = <77 0x8>;
interrupt-parent = <&ipic>;
// CS0 and CS1 are swapped when
// booting from nand, but the
// addresses are the same.
ranges = <0x0 0x0 0xfe000000 0x00800000
0x1 0x0 0xe0600000 0x00002000
0x2 0x0 0xf0000000 0x00020000
0x3 0x0 0xfa000000 0x00008000>;
flash@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x800000>;
bank-width = <2>;
device-width = <1>;
};
nand@1,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,mpc8315-fcm-nand",
"fsl,elbc-fcm-nand";
reg = <0x1 0x0 0x2000>;
u-boot@0 {
reg = <0x0 0x100000>;
read-only;
};
kernel@100000 {
reg = <0x100000 0x300000>;
};
fs@400000 {
reg = <0x400000 0x1c00000>;
};
};
};
immr@e0000000 {
#address-cells = <1>;
#size-cells = <1>;
device_type = "soc";
compatible = "fsl,mpc8315-immr", "simple-bus";
ranges = <0 0xe0000000 0x00100000>;
reg = <0xe0000000 0x00000200>;
bus-frequency = <0>;
wdt@200 {
device_type = "watchdog";
compatible = "mpc83xx_wdt";
reg = <0x200 0x100>;
};
i2c@3000 {
#address-cells = <1>;
#size-cells = <0>;
cell-index = <0>;
compatible = "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <14 0x8>;
interrupt-parent = <&ipic>;
dfsrr;
rtc@68 {
compatible = "dallas,ds1339";
reg = <0x68>;
};
mcu_pio: mcu@a {
#gpio-cells = <2>;
compatible = "fsl,mc9s08qg8-mpc8315erdb",
"fsl,mcu-mpc8349emitx";
reg = <0x0a>;
gpio-controller;
};
};
spi@7000 {
cell-index = <0>;
compatible = "fsl,spi";
reg = <0x7000 0x1000>;
interrupts = <16 0x8>;
interrupt-parent = <&ipic>;
mode = "cpu";
};
dma@82a8 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,mpc8315-dma", "fsl,elo-dma";
reg = <0x82a8 4>;
ranges = <0 0x8100 0x1a8>;
interrupt-parent = <&ipic>;
interrupts = <71 8>;
cell-index = <0>;
dma-channel@0 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0 0x80>;
cell-index = <0>;
interrupt-parent = <&ipic>;
interrupts = <71 8>;
};
dma-channel@80 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x80 0x80>;
cell-index = <1>;
interrupt-parent = <&ipic>;
interrupts = <71 8>;
};
dma-channel@100 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x100 0x80>;
cell-index = <2>;
interrupt-parent = <&ipic>;
interrupts = <71 8>;
};
dma-channel@180 {
compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
reg = <0x180 0x28>;
cell-index = <3>;
interrupt-parent = <&ipic>;
interrupts = <71 8>;
};
};
usb@23000 {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupt-parent = <&ipic>;
interrupts = <38 0x8>;
phy_type = "utmi";
};
enet0: ethernet@24000 {
#address-cells = <1>;
#size-cells = <1>;
cell-index = <0>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x24000 0x1000>;
ranges = <0x0 0x24000 0x1000>;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <32 0x8 33 0x8 34 0x8>;
interrupt-parent = <&ipic>;
tbi-handle = <&tbi0>;
phy-handle = < &phy0 >;
fsl,magic-packet;
mdio@520 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,gianfar-mdio";
reg = <0x520 0x20>;
phy0: ethernet-phy@0 {
interrupt-parent = <&ipic>;
interrupts = <20 0x8>;
reg = <0x0>;
device_type = "ethernet-phy";
};
phy1: ethernet-phy@1 {
interrupt-parent = <&ipic>;
interrupts = <19 0x8>;
reg = <0x1>;
device_type = "ethernet-phy";
};
tbi0: tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
};
};
};
enet1: ethernet@25000 {
#address-cells = <1>;
#size-cells = <1>;
cell-index = <1>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x25000 0x1000>;
ranges = <0x0 0x25000 0x1000>;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <35 0x8 36 0x8 37 0x8>;
interrupt-parent = <&ipic>;
tbi-handle = <&tbi1>;
phy-handle = < &phy1 >;
fsl,magic-packet;
mdio@520 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,gianfar-tbi";
reg = <0x520 0x20>;
tbi1: tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
};
};
};
serial0: serial@4500 {
cell-index = <0>;
device_type = "serial";
compatible = "fsl,ns16550", "ns16550";
reg = <0x4500 0x100>;
clock-frequency = <133333333>;
interrupts = <9 0x8>;
interrupt-parent = <&ipic>;
};
serial1: serial@4600 {
cell-index = <1>;
device_type = "serial";
compatible = "fsl,ns16550", "ns16550";
reg = <0x4600 0x100>;
clock-frequency = <133333333>;
interrupts = <10 0x8>;
interrupt-parent = <&ipic>;
};
crypto@30000 {
compatible = "fsl,sec3.3", "fsl,sec3.1", "fsl,sec3.0",
"fsl,sec2.4", "fsl,sec2.2", "fsl,sec2.1",
"fsl,sec2.0";
reg = <0x30000 0x10000>;
interrupts = <11 0x8>;
interrupt-parent = <&ipic>;
fsl,num-channels = <4>;
fsl,channel-fifo-len = <24>;
fsl,exec-units-mask = <0x97c>;
fsl,descriptor-types-mask = <0x3a30abf>;
};
sata@18000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x18000 0x1000>;
cell-index = <1>;
interrupts = <44 0x8>;
interrupt-parent = <&ipic>;
};
sata@19000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x19000 0x1000>;
cell-index = <2>;
interrupts = <45 0x8>;
interrupt-parent = <&ipic>;
};
gtm1: timer@500 {
compatible = "fsl,mpc8315-gtm", "fsl,gtm";
reg = <0x500 0x100>;
interrupts = <90 8 78 8 84 8 72 8>;
interrupt-parent = <&ipic>;
clock-frequency = <133333333>;
};
timer@600 {
compatible = "fsl,mpc8315-gtm", "fsl,gtm";
reg = <0x600 0x100>;
interrupts = <91 8 79 8 85 8 73 8>;
interrupt-parent = <&ipic>;
clock-frequency = <133333333>;
};
/* IPIC
* interrupts cell = <intr #, sense>
* sense values match linux IORESOURCE_IRQ_* defines:
* sense == 8: Level, low assertion
* sense == 2: Edge, high-to-low change
*/
ipic: interrupt-controller@700 {
interrupt-controller;
#address-cells = <0>;
#interrupt-cells = <2>;
reg = <0x700 0x100>;
device_type = "ipic";
};
ipic-msi@7c0 {
compatible = "fsl,ipic-msi";
reg = <0x7c0 0x40>;
msi-available-ranges = <0 0x100>;
interrupts = <0x43 0x8
0x4 0x8
0x51 0x8
0x52 0x8
0x56 0x8
0x57 0x8
0x58 0x8
0x59 0x8>;
interrupt-parent = < &ipic >;
};
pmc: power@b00 {
compatible = "fsl,mpc8315-pmc", "fsl,mpc8313-pmc",
"fsl,mpc8349-pmc";
reg = <0xb00 0x100 0xa00 0x100>;
interrupts = <80 8>;
interrupt-parent = <&ipic>;
fsl,mpc8313-wakeup-timer = <&gtm1>;
};
};
pci0: pci@e0008500 {
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <
/* IDSEL 0x0E -mini PCI */
0x7000 0x0 0x0 0x1 &ipic 18 0x8
0x7000 0x0 0x0 0x2 &ipic 18 0x8
0x7000 0x0 0x0 0x3 &ipic 18 0x8
0x7000 0x0 0x0 0x4 &ipic 18 0x8
/* IDSEL 0x0F -mini PCI */
0x7800 0x0 0x0 0x1 &ipic 17 0x8
0x7800 0x0 0x0 0x2 &ipic 17 0x8
0x7800 0x0 0x0 0x3 &ipic 17 0x8
0x7800 0x0 0x0 0x4 &ipic 17 0x8
/* IDSEL 0x10 - PCI slot */
0x8000 0x0 0x0 0x1 &ipic 48 0x8
0x8000 0x0 0x0 0x2 &ipic 17 0x8
0x8000 0x0 0x0 0x3 &ipic 48 0x8
0x8000 0x0 0x0 0x4 &ipic 17 0x8>;
interrupt-parent = <&ipic>;
interrupts = <66 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x02000000 0 0x90000000 0x90000000 0 0x10000000
0x42000000 0 0x80000000 0x80000000 0 0x10000000
0x01000000 0 0x00000000 0xe0300000 0 0x00100000>;
clock-frequency = <66666666>;
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <0xe0008500 0x100 /* internal registers */
0xe0008300 0x8>; /* config space access registers */
compatible = "fsl,mpc8349-pci";
device_type = "pci";
};
pci1: pcie@e0009000 {
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
device_type = "pci";
compatible = "fsl,mpc8315-pcie", "fsl,mpc8314-pcie";
reg = <0xe0009000 0x00001000>;
ranges = <0x02000000 0 0xa0000000 0xa0000000 0 0x10000000
0x01000000 0 0x00000000 0xb1000000 0 0x00800000>;
bus-range = <0 255>;
interrupt-map-mask = <0xf800 0 0 7>;
interrupt-map = <0 0 0 1 &ipic 1 8
0 0 0 2 &ipic 1 8
0 0 0 3 &ipic 1 8
0 0 0 4 &ipic 1 8>;
clock-frequency = <0>;
pcie@0 {
#address-cells = <3>;
#size-cells = <2>;
device_type = "pci";
reg = <0 0 0 0 0>;
ranges = <0x02000000 0 0xa0000000
0x02000000 0 0xa0000000
0 0x10000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00800000>;
};
};
pci2: pcie@e000a000 {
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
device_type = "pci";
compatible = "fsl,mpc8315-pcie", "fsl,mpc8314-pcie";
reg = <0xe000a000 0x00001000>;
ranges = <0x02000000 0 0xc0000000 0xc0000000 0 0x10000000
0x01000000 0 0x00000000 0xd1000000 0 0x00800000>;
bus-range = <0 255>;
interrupt-map-mask = <0xf800 0 0 7>;
interrupt-map = <0 0 0 1 &ipic 2 8
0 0 0 2 &ipic 2 8
0 0 0 3 &ipic 2 8
0 0 0 4 &ipic 2 8>;
clock-frequency = <0>;
pcie@0 {
#address-cells = <3>;
#size-cells = <2>;
device_type = "pci";
reg = <0 0 0 0 0>;
ranges = <0x02000000 0 0xc0000000
0x02000000 0 0xc0000000
0 0x10000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00800000>;
};
};
leds {
compatible = "gpio-leds";
pwr {
gpios = <&mcu_pio 0 0>;
default-state = "on";
};
hdd {
gpios = <&mcu_pio 1 0>;
linux,default-trigger = "ide-disk";
};
};
};

View File

@@ -0,0 +1,219 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-06-25T19:48:32+08:00
====== MPC8315E-RDB启动输出 ======
Created Monday 25 June 2012
U-Boot 1.3.0-rc2 (Mar 21 2008 - 16:00:02) MPC83XX
Reset Status:
CPU: e300c3, Rev: Unknown revision number:80b40012
Warning: Unsupported cpu revision!
Board: Freescale MPC8315ERDB Rev 1.0
I2C: ready
DRAM: 128 MB
PCIE0: No link
PCIE1: No link
FLASH: 8 MB
NAND: 32 MiB
In: serial
Out: serial
Err: serial
Net: eTSEC0, eTSEC1
Hit any key to stop autoboot: 0
## Booting image at fe500000 ...
Image Name: Linux-2.6.23
Created: 2008-03-21 6:25:53 UTC
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 1722476 Bytes = 1.6 MB
__Load Address__: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
__Uncompressing__ Kernel Image ... OK
## Loading RAMDisk Image at fe100000 ...
Image Name: uboot ext2 ramdisk rootfs
Created: 2008-03-21 6:57:09 UTC
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
Data Size: 3922502 Bytes = 3.7 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Booting using the fdt at 0xfe700000
Loading __Ramdisk__ to **07b71000**, end 07f2ea46 ... OK
Loading __Device Tree__ to 007fc000, end 007fefff ... OK
**//以上是UBoot启动输出以下为Kernel启动输出。**
Using MPC8315 RDB __machine description__ //对应的数据结构为__struct ppc_md__
Linux version 2.6.23 (yhh@rock) (gcc version 4.1.2) #1 Fri Mar 21 14:25:50 CST 8
Found initrd at 0xc7b71000:0xc7f2ea46 **//内核映射的虚拟地址从0XC000_0000开始而initrd所在的物理内存为0X07B7_1000**
**console** [udbg0] enabled **//尽可能早地初始化console以打印启动信息便于Debug。**
setup_arch: bootmem **//setup_arch是体系结构相关初始化的函数主要初始化SDRAM和PCI、PCIE**
mpc8315_rdb_setup_arch()
Freescale SerDes at e00e3000 initialized **//PCIE和SGMII初始化e00e3000为位于IMMBR中的控制寄存器**
Found MPC83xx __PCI host bridge__ at 0x0000000000008500. Firmware bus number: 0->0 **//两个PCI Slot**
Found MPC83xx PCI host bridge at 0x00000000e0009000. Firmware bus number: 0->0
Found MPC83xx PCI host bridge at 0x00000000e000a000. Firmware bus number: 0->0 **//一个Mini-PCI Slot**
arch: exit
Zone PFN ranges: **//PFNPage Frame NumberDDR SDRAM为128MB因此没有高端内存映射**
DMA 0 -> 32768 **//32K个PFN每个PFN大小为4KB因此DMA内存区域为128MB即所有的SDRAM空间都可用于DMA寻址**
Normal 32768 -> 32768
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0 -> 32768
Built 1 __zonelists__ in Zone order. Total pages: 32512
Kernel command line: root=/dev/ram rw console=ttyS0,115200 **//Uboot中指定的bootargs变量的值被用作内核命令行参数**
IPIC (__128__ IRQ sources) at faef7700
PID hash table entries: 512 (order: 9, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 122236k/131072k available (3380k kernel code, 8696k reserved, 148k data) **//kernel可管理的内存大小以及kenel自身所占的空间**
Mount-cache hash table entries: 512
NET: Registered protocol family 16 **//PHY初始化**
__PCI: Probing PCI hardware__ **//PCI总线设备枚举**
Generic PHY: Registered new driver
SCSI subsystem initialized **//SCSI必须先于USB、IDE和SATA初始化**
usbcore: registered new interface driver __usbfs__
usbcore: registered new **interface driver** hub
usbcore: registered new **device driver** usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
checking if image is __initramfs.__..it isn't (no cpio magic); looks like an __initrd__
__Freeing initrd memory__: 3830k freed
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
serial8250.0: __ttyS0__ at __MMIO__ 0xe0004500 (irq = 22) is a __16550A__ **//串口的控制寄存器使用MMIO形式访问0xe000_4500为串口控制器在IMMBR中的物理地址。**
console handover: boot [udbg0] -> real [ttyS0]
serial8250.0: __ttyS1__ at MMIO 0xe0004600 (irq = 23) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 32768K size 1024 blocksize
loop: module loaded
Intel(R) PRO/1000 Network Driver - version 7.3.20-k2-NAPI
Copyright (c) 1999-2006 Intel Corporation.
__Gianfar MII Bus__: probed
eth0: Gianfar Ethernet Controller Version 1.3-skbr, **04:00:00:00:00:0a**
GFAR: SKB Handler initialized at CPU#0(max=32)
eth0: MTU = 1500 (frame size=1526, truesize=1800)
eth0: Running with NAPI enabled
eth0: __64/64 RX/TX BD ring size__
eth1: Gianfar Ethernet Controller Version 1.3-skbr, 04:00:00:00:00:0b
GFAR: SKB Handler initialized at CPU#0(max=32)
eth1: MTU = 1500 (frame size=1526, truesize=1800)
eth1: Running with NAPI enabled
eth1: 64/64 RX/TX BD ring size
e100: Intel(R) PRO/100 Network Driver, 3.5.23-k4-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation
RTL821x Gigabit Ethernet: Registered new driver
st: Version 20070203, fixed bufsize 32768, s/g segs 256
fsl-sata e0018000.sata: Sata FSL Platform/CSB Driver init
scsi0 : sata_fsl
ata1: SATA max UDMA/133 cmd 0xc906c000 ctl 0x00000000 bmdma 0x00000000 irq 44
ata1: No Device OR PHYRDY change,Hstatus = 0xa0000000
ata1: reset failed (errno=-5), retrying in 10 secs
ata1: SATA link down (SStatus 0 SControl 300)
fsl-sata e0019000.sata: Sata FSL Platform/CSB Driver init
scsi1 : sata_fsl
ata2: SATA max UDMA/133 cmd 0xc906e000 ctl 0x00000000 bmdma 0x00000000 irq 45
ata2: No Device OR PHYRDY change,Hstatus = 0xa0000000
ata2: reset failed (errno=-5), retrying in 10 secs
ata2: SATA link down (SStatus 0 SControl 300)
__nor__: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
nor: Swapping erase regions for broken __CFI__ table.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
physmap-flash nor: __Using OF partition information__
Creating 4 MTD partitions on "nor":
0x00000000-0x00100000 : "U-Boot"
0x00100000-0x00500000 : "FileSystem"
0x00500000-0x00700000 : "Kernel"
0x00700000-0x00800000 : "DTB"
Freescale eLBC NAND Driver (C) 2006-2007 Freescale
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bi)
Scanning device for __bad blocks__
fsl-elbc fsl-elbc.0: Using __OF partition information__
Creating 6 MTD partitions on "nand":
0x00000000-0x00100000 : "U-Boot-NAND"
0x00100000-0x00900000 : "JFFS2-NAND"
0x00900000-0x00d00000 : "Ramdisk-NAND"
0x00d00000-0x01d00000 : "Reserve-NAND"
0x01d00000-0x01f00000 : "Kernel-NAND"
0x01f00000-0x02000000 : "DTB-NAND"
mpc83xx_spi.0: MPC83xx SPI Controller driver at 0xc9072000 (irq = 24)
usbmon: debugfs is not available
fsl-ehci fsl-ehci.0: Freescale **On-Chip EHCI Host Controller**
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 38, __io base 0xe0023000__
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
__hub 1-0:1.0: USB hub found__
hub 1-0:1.0: 1 port detected
usb 1-1: new high speed USB device using fsl-ehci and address 2
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
usbcore: registered new interface driver usblp
Initializing USB Mass Storage driver...
usbcore: registered new interface driver __usb-storage__
USB Mass Storage support registered.
i2c /dev entries driver
rtc-ds1307 0-0068: SET TIME!
rtc-ds1307 0-0068: rtc core: registered __ds1339__ as rtc0
rtc-ds1307 0-0068: setting the system clock to 2000-01-01 00:00:52 (946684852)
WDT driver for MPC83xx initialized. mode:reset timeout=65535 (32 seconds)
md: linear personality registered for level -1
md: raid0 personality registered for level 0
md: raid1 personality registered for level 1
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: Compressed image found at block 0
__VFS: Mounted root__ (ext2 filesystem).
__Freeing unused kernel memory: 164k init__
Setting the hostname to freescale
Mounting filesystems
mount: Mounting usbfs on /proc/bus/usb failed: No such file or directory
Running sysctl
Setting up networking on loopback device:
Setting up networking on eth0:
Setting up networking on eth1:
Starting inetd:
Starting SMB services: /etc/rc.d/init.d/smb: /etc/rc.d/init.d/smb: 18: nmbd: nod
/etc/rc.d/init.d/smb: /etc/rc.d/init.d/smb: 18: smbd: not found
Welcome to Freescale Semiconductor Embedded Linux Environment
!!!!! WARNING !!!!!!!
The default password for the root account is: root
please change this password using the 'passwd' command
and then edit this message (/etc/issue) to remove this message
freescale login:

View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-28T21:00:33+08:00
====== PowerPC开发 ======
Created Monday 28 November 2011

View File

@@ -0,0 +1,113 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-30T21:53:30+08:00
====== Freescale MPC8313 BSP使用说明 ======
Created Wednesday 30 November 2011
http://blog.csdn.net/aero_boy/article/details/5914527
这段时间在做MPC8313的开发, 在这里做一下笔记吧, 很多虽然是比较简单的东西,还是记录一下吧,免得已后忘了,以可以查查,以给后以第一次使用的人一个参考吧.
Freescale MPC8313 BSP使用说明
MPC8313的BSP使用的是LTIB为基础的配置工具. 安装盘ISO:
===== 1.LTIB安装 =====
a. mount ISO:
mount -o loop MPC8313E_RDB_K26_20070831-LTIB.iso /mnt/cdrom
b.以非root用户运行, 该用户需要有sudo权限:
/mnt/cdrom/install
然后根据提示输入安装路径.
注: a.提示找不到rpm-build
我是在ubuntu 10.04上安装, 系统带的rpm是 4.7的,需要卸裁后安装4.4版的rpm,
rpm_4.4.2.3-2ubuntu1_i386.deb,librpm4.4_4.4.2.3-2ubuntu1_i386.deb他们又依赖于libbeecrypt6_4.1.2-7_i386.deb
b.提示没有sudo root的权限
ltib安装是普通用户权限但是部分操作需要root用户权限。按照提示进行如下操作
#/usr/sbin/visudo
然后在文件最后添加如下内容:
USERNAME ALL = NOPASSWD:/bin/rpm, /opt/freescale/ltib/usr/bin/rpm
visudo实际就是编辑文件/etc/sudoers文件
c.提示bison错误
bison -y -d ./parse.y
make: *** [parse.c] Segmentation fault
解决:在运行./ltib之前修改”dist/lfs-5.1/bison/bison.spec”文件
在%Build段修改make为make CFLAGS=-O0。然后再运行./ltib。
d.提示util错误
make -C util
make: Entering directory `/opt/freescale/ltib/usr/src/rpm/BUILD/mtd/util'
gcc -I../include -O2 -Wall -g -c -o ftl_format.o ftl_format.c -g -Wp,-MD,.ftl_format.c.dep
In file included from /usr/include/endian.h:61,
from /usr/include/sys/types.h:217,
from ftl_format.c:38:
解决:修改“/opt/freescale/pkgs/mtd-utils-20060302-cf-byteswap_h-1.patch”文件
注掉 lines 46, 47 and 48 :
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
by
+//#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+//# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+//#endif
然后删除“/opt/freescale/ltib/usr/src/rpm/BUILD/mtd”这个目录最后再运行.__/ltib__
=== ltib的目录构成: ===
安装完成后会生成如下二个目录/opt/freescale/, <install_path>/ltib-<version>,
其中/opt/freescale/ltib下是ltib工具的相关工具集, /opt/freescale/pkgs源代码包相当多的开源软件包当然你也可以添加新的进去.
/opt/freescale/usr里面是powerpc-linux编译器
=== 编译目录: ===
编译时使用的内核在<install_path>/ltib-<version>/rpm/BUILD/linux 下.
===== 2.卸载 =====
只需要手动删除下列目录:
/opt/freescale/pkgs,
/opt/freescale/ltib,
<install_path>/ltib-<version>
===== 3.运行LTIB =====
cd <install_path>/ltib
./ltib
===== 4.配置 =====
./ltib -c
===== 5.编译结果 =====
<install_path>/ltib-<version>__/rootfs/ __目录下是编译完成的目标板的根文件系统.
===== 6.LTIB编译脚本配置 =====
注:以下的文件路径均以ltib的**安装路径**开始,如/ltib/config/ 表示安装路径的 ltib-<version> 下的config目录.
++ /ltib/config 目录下保存有ltib在配置时使用的__各种参数表__
packages.lkc配置对应配置界面主下菜单"Package List"下的可以选择的各种包的相关信息,可以配置包的依赖关系等.
network.lkc 配置对应菜单"Target System Configuration,Options->start networking->Network setup"
++ 配置完成后,__配置信息会保存__到/ltib/config/platform/<平台名称>/ 这个目录下.
这个目录下还保存了busybox和kernal的配置信息.
要自定义新的平台时,只需要复制以有的平台目录为一个新目录,然后修改目录下__的main.lkc__中的平台相关信息.
++ **RPM spec**文件:
RPM 的spec文件存入在/ltib/dist/lfs-<version>/<包名称> 目录下.
===== 7.ltib命令使用 =====
将指定的包解压出来,并使用__所有在.spec文件中设置的patch__:
./ltib -m prep -p <package>
编译一个包:
./ltib -m scbuild -p <package>
执行包安装,将安装到lfs-<version>/rootfs下:
./ltib -m scinstall -p <package>
在自己的修改完成后可以生成一个patch文件:
./ltib -m patchmerge -p <package>

View File

@@ -0,0 +1,70 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-03T15:22:10+08:00
====== Linux 设备和驱动加载的先后顺序 ======
Created Saturday 03 December 2011
http://blog.csdn.net/gorilla0123/article/details/5958874
Linux驱动先注册总线总线上可以先挂device也可以先挂driver那么究竟怎么控制先后的顺序呢。
Linux系统使用两种方式去加载系统中的模块动态和静态。
静态加载将所有模块的程序编译到Linux内核中由do_initcall函数加载
核心进程__/init/main.c__kernel_init--->do_basic_setup()--->do_initcalls该函数中会将在__initcall_start和__initcall_end之间定义的各个模块依次加载。那么在__initcall_start 和 __initcall_end之间都有些什么呢
找到__/arch/powerpc/kernel/vmlinux.lds__文件找到.initcall.init段
.initcall.init : {
__initcall_start = .;
*(.initcall0.init) *(.initcall0s.init) *(.initcall1.init) *(.initcall1s.init) *(.initcall2.init) *(.initcall2s.init) *(.initcall3.init) *(.initcall3s.init) *(.initcall4.init) *(.initcall4s.init) *(.initcall5.init) *(.initcall5s.init) *(.initcallrootfs.init) *(.initcall6.init) *(.initcall6s.init) *(.initcall7.init) *(.initcall7s.init)
__initcall_end = .;
}
可以看出在这两个宏之间依次排列了**14个等级的宏**由于这其中的宏是按先后顺序链接的所以也就表示这14个宏有优先级0>1>1s>2>2s………>7>7s。
那么这些宏有什么具体的意义呢这就要看__/include/linux/init.h__文件
#define pure_initcall(fn) __define_initcall("0",fn,0)
#define core_initcall(fn) __define_initcall("1",fn,1)
#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
#define postcore_initcall(fn) __define_initcall("2",fn,2)
#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s)
#define arch_initcall(fn) __define_initcall("3",fn,3)
#define arch_initcall_sync(fn) __define_initcall("3s",fn,3s)
#define subsys_initcall(fn) __define_initcall("4",fn,4)
#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s)
#define fs_initcall(fn) __define_initcall("5",fn,5)
#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s)
#define rootfs_initcall(fn) __define_initcall("rootfs",fn,rootfs)
#define device_initcall(fn) __define_initcall("6",fn,6)
#define device_initcall_sync(fn) __define_initcall("6s",fn,6s)
#define late_initcall(fn) __define_initcall("7",fn,7)
#define late_initcall_sync(fn) __define_initcall("7s",fn,7s)
这里就定义了具体的宏我们平时用的module_init在__静态编译__时就相当于device_initcall。举个例子在2.6.24的内核中gianfar_device使用的是arch_initcall而gianfar_driver使用的是module_init因为arch_initcall的优先级大于module_init所以gianfar设备驱动的device先于driver在总线上添加。

View File

@@ -0,0 +1,45 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-01T20:32:27+08:00
====== Linux下USB gadget设备详解 ======
Created Thursday 01 December 2011
http://www.deepin.org/article-2530-1.html
===== USB gadget是什么 =====
Linux-USB Gadget 驱动框架(以下简称 Gadget实现了USB 协议定义的__设备端的软件功能__。相对于 Linux USB 主机端Host 驱动而言, Gadget 驱动出现较晚它出现在2.4.23 以后。
  Gadget 框架提出了一套标准 API, 在底层, __USB 设备控制器__USB Device Controller, UDC驱动则实现这一套 API, 不同的 UDC (通常是 SOC 的一部分) 需要不同的驱动, 甚至基于同样的 UDC 的不同板子也需要进行代码修改。这一层我们可以称之为平台相关层。
  基于 API, Gadget 驱动实现了**一套硬件无关的功能**,这基本上可以对应到 USB 协议里 的各种 USB Class也有比如 USB Gadget Generic Serial 驱动,没有对应的 Class。当然Gadget 驱动还是**受限于底层提供的功能**的。比如 某些 Class 需要 USB Isochronous 端点,这时我们就不能支持该 Class。
  普通的 Gadget 驱动只实现一个功能(比如, u 盘usb 网卡。__复合设备__可以支持多个功能后面将仔细研究一下复合设备的实现。像智能手机 PDA这样的设备硬件支持较丰富的端点、DMA Buffer, 给软件提了支持复合功能的基础。
  有两点值得注意,第一是 usb gaget 驱动框架不象__ usb 主机端__有 usb core 的概念usb 主机可能支持成百类型的外设把通用功能抽象出来很有意义。Usb device 端则通常没有这个需求,一些通用功能抽象在一些 Helper 函数里就可以了。第二是 usb 2.0 里提出了 OTG 的概念,可以在同一接口上支持 host 以及 device 功能。OTG 是一个比较复杂的规范,以后有时间再研究。
**其实gadget的作用就是将一个usb device controller模拟为一个一个usb设备这样将该controller对应的USB接口插到别的设备上时就会被识别为模拟的usb设备。**
===== 控制器驱动 =====
  常见的 usb device 有 U 盘, usb 鼠标、键盘usb 蓝牙模块usb 读卡器等等。这些设备比较简单通常不会运行Linux。运行Linux Gadget 的通常是**一些集成 CPU 以及很多外设接口的 SOC **System-on-Chip 其中 CPU 通常为 32 bit 的 CPU, 并且 udc 也是该 SOC 的一部分(顺带还有 DMA 通道FIFO
  Linux 标准内核里支持各主流 SOC 的 udc 驱动make menuconfig 一下可以看到具体列表,其中值得一提的是 __dummy_hcd,__ 它是一个软件模拟的 udc, 在开发新的 gadget 驱动时很有帮助。
  控制器驱动处理很少的 USB 控制请求(主要由硬件负责的部分)。其它所有的控制请求,比如返回描述符,设置当前配置,由 Gadget Driver 完成。__控制器驱动一个主要责任就是负责管理各个端点的 I/O 队列__在 Gadget Driver 的 buffer 和硬件buffer 之间传输数据(通常是通过 DMA
  我们前面提过,上层 Gadget 驱动能够实现什么功能要依赖底层提供的硬件条件。比如一个复合设备需要至少 5 个端点,这些硬件特性通过一组 gadget_is_*()函数实现。
===== Gadget 驱动 =====
  基于底层提供的资源, Gadget 驱动可以运行在各种硬件平台上。重要的驱动有:
  Gadget Zero, 类似于 dummy hcd, 该驱动用于测试 udc 驱动。它会帮助您通过 USB-IF 测试。
  Ethernet over USB 该驱动**模拟以太网网口**,它支持多种运行方式:
  CDC Ethernet: usb 规范规定的 **Communications Device Class** “Ethernet Model” protocol。
  CDC Subset 对硬件要求最低的一种方式,主要是 Linux 主机支持该方式。
  RNDIS __微软公司__对 CDC Ethernet 的变种实现。
  File-backed Storage Gadget最常见的 U 盘功能实现。
  Serial Gadget 实现包括Generic Serial 实现只需要Bulk-in/Bulk-out端点+ep0CDC ACM 规范实现。
  Gadget Filesystem, 将 Gadget API 接口暴露给应用层以便在应用层实现user mode driver。
  MIDI: 暴露ALSA接口提供 recording 以及 playback 功能。

View File

@@ -0,0 +1,91 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-01-15T19:26:06+08:00
====== Linux驱动的platform机制 ======
Created Sunday 15 January 2012
最近在看SPI、I2C这样简单点的总线驱动程序从Linux2.6起内核引入了一套新的驱动管理和注册机制Platform_device和Platform_driver。现在Linux中大部分的设备驱动都可以使用这套机制总线为platform_bus设备用platform_device表示驱动用platform_driver进行注册。
Linux的这种platform driver机制和传统的device_driver机制相比一个十分明显的优势在于platform机制将本身的资源注册进内核由内核统一管理在驱动程序中使用这些资源时通过platform_device提供的标准接口进行申请并使用。这样提高了驱动和资源管理的独立性并且拥有较好的可移植性和安全性。下面是SPI驱动层次示意图Linux中的SPI总线可理解为SPI控制器引出的总线
和传统的驱动一样platform机制也分为三个步骤
1、总线注册阶段
内核启动初始化时的main.c文件中的kernel_init()→do_basic_setup()→driver_init()→platform_bus_init()→bus_register(&platform_bus_type)注册了一条platform总线虚拟总线platform_bus
2、添加设备阶段
设备注册的时候Platform_device_register()→platform_device_add()→(pdev→dev.bus = &platform_bus_type)→device_add(),就这样把设备给挂到虚拟的总线上。
3、驱动注册阶段
Platform_driver_register()→driver_register()→bus_add_driver()→driver_attach()→bus_for_each_dev(), 对在每个挂在虚拟的platform bus的设备作__driver_attach()→driver_probe_device(),判断drv→bus→match()是否执行成功此时通过指针执行platform_match→strncmp(pdev→name , drv→name , BUS_ID_SIZE),如果相符就调用really_probe(实际就是执行相应设备的platform_driver→probe(platform_device)。)开始真正的探测如果probe成功则绑定设备到该驱动。
从上面可以看出platform机制最后还是调用了bus_register() , device_add() , driver_register()这三个关键的函数。
下面看几个结构体:
[cpp] view plaincopy
struct platform_device (/include/linux/Platform_device.h)
{
const char * name;
int id;
struct device dev;
u32 num_resources;
struct resource * resource;
};
Platform_device结构体描述了一个platform结构的设备在其中包含了一般设备的结构体struct device dev;设备的资源结构体struct resource * resource;还有设备的名字const char * name。注意这个名字一定要和后面platform_driver.driver àname相同原因会在后面说明。
该结构体中最重要的就是resource结构这也是之所以引入platform机制的原因。
[cpp] view plaincopy
struct resource ( /include/linux/ioport.h)
{
resource_size_t start;
resource_size_t end;
const char *name;
unsigned long flags;
struct resource *parent, *sibling, *child;
};
其中 flags位表示该资源的类型start和end分别表示该资源的起始地址和结束地址(/include/linux/Platform_device.h)
[cpp] view plaincopy
struct platform_driver
{
int (*probe)(struct platform_device *);
int (*remove)(struct platform_device *);
void (*shutdown)(struct platform_device *);
int (*suspend)(struct platform_device *, pm_message_t state);
int (*suspend_late)(struct platform_device *, pm_message_t state);
int (*resume_early)(struct platform_device *);
int (*resume)(struct platform_device *);
struct device_driver driver;
};
Platform_driver结构体描述了一个platform结构的驱动。其中除了一些函数指针外还有一个一般驱动的device_driver结构。
名字要一致的原因:
上面说的驱动在注册的时候会调用函数bus_for_each_dev(), 对在每个挂在虚拟的platform bus的设备作__driver_attach()→driver_probe_device(),在此函数中会对dev和drv做初步的匹配调用的是drv->bus->match所指向的函数。platform_driver_register函数中drv->driver.bus = &platform_bus_type所以drv->bus->match就为platform_bus_type→match,为platform_match函数该函数如下
[cpp] view plaincopy
static int platform_match(struct device * dev, struct device_driver * drv)
{
struct platform_device *pdev = container_of(dev, struct platform_device, dev);
return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0);
}
是比较dev和drv的name相同则会进入really_probe函数从而进入自己写的probe函数做进一步的匹配。所以dev→name和driver→drv→name在初始化时一定要填一样的。
不同类型的驱动其match函数是不一样的这个platform的驱动比较的是dev和drv的名字还记得usb类驱动里的match吗它比较的是Product ID和Vendor ID。
个人总结Platform机制的好处
1、提供platform_bus_type类型的总线把那些不是总线型的soc设备都添加到这条虚拟总线上。使得总线——设备——驱动的模式可以得到普及。
2、提供platform_device和platform_driver类型的数据结构将传统的device和driver数据结构嵌入其中并且加入resource成员以便于和Open Firmware这种动态传递设备资源的新型bootloader和kernel 接轨。

View File

@@ -0,0 +1,305 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-03T15:25:18+08:00
====== MPC8314 e300核 uboot 调试 一 ======
Created Saturday 03 December 2011
http://blog.csdn.net/gorilla0123/article/details/5899452
历经2个多月完成了MPC8314最小系统uboot及Linux内核和根文件系统的调试。这是我第一次从头开始做小系统和内核的移植工作虽然调试的比较辛苦但是收获还是很多的。下面就介绍一下调试的过程和一些原理性的东西。
===== 1 MPC8314 上电流程 =====
系统上电后经过若干个时钟后MPC8314会检测**复位配置输入信号 **CFG_RESET_SOURCE[03]来确定**硬件配置字源选择**,在目标板上可以**设置跳线**来改变CFG_RESET_SOURCE[03]选择硬件配置字源。本系统中的硬件配置字存放在CPLD模拟的Flash空间中。
{{~/sync/notes/zim/Research/PowerPC开发/MPC8314_e300核_uboot_调试_一/1.gif}}
从相应的地方读取硬件配置字RCWLRCWH会设置相应的寄存器。其中RCWH中的__BMS__位值为1定义了e300核心的MSR[IP]位初始值如上图所示MSR[IP]为1决定中断向量的前缀为0xFFF启动存储空间的位置为0xFF80_0000~0xFFFF_FFFF;SWEN位为0禁止软件看门狗ROMLOC位为0b110RLEXT位为0b00确定了选择local bus GPCM-16bit ROM为__启动ROM__。复位向量和本地地址映射的默认启动ROM访问将直接指向ROMLOC指定的接口。选中的启动ROM的__本地访问窗口__LBLAW0将被使能并初始化基地址LBLAWBAR0为0xFF80_0000窗口大小为8M。这时Local Bus上的片选CS0的寄存器值为BR00000_0000,OR00000_0000。整个4G空间全是ROM每16M重复一次。
中断向量的前缀为0xFFF**复位向量**为100决定了系统复位后的__第一条指令__从0xFFF0_0100处获得。
/cpu/mpc83xx/u-boot.lds文件时**连接器脚本**文件,其中
.text :
{
cpu/mpc83xx/start.o (.text)
。 。 。 。 。
}
。 。 。 。 。 。
ENTRY(_start)
规定了代码段从/cpu/mpc83xx/__start.s__开始。而ENTRY(_start)这一句告诉编译器uboot.bin的镜像入口点为start.s中的_start标号。
所以我们要将UBOOT的代码烧写到16M Flash中偏移15M的地方保证了从0xFFF0_0100的空间取到的指令为uboot代码。并且还需要保证0xFFF0_0100为start标号。
2 uboot启动流程
2.1 uboot启动概述
Uboot的启动是从/cpu/mpc83xx/start.s中的_start标号开始的经历了 /cpu/mpc83xx/start.s/cpu/mpc83xx/cpu_init.c /lib_ppc/Board.c等几个文件中的多个汇编和C函数最后会在/lib_ppc/Board.c中的board_init_r函数中进入命令死循环等待执行键入的命令。其具体的流程如下图所示
2.2 init_e300_core 函数
初始化e300核心禁止中断响应只允许machine check中断和system reset中断禁止指令和数据地址转换即关闭MMU进行实地址转换设置为supervisor级别禁止看门狗无效指令和数据cache为系统创建一个干净可靠的初始环境。
2.3 窗口重映射
从前面MPC8314上电流程可以看出上电之后第一条代码是从0xFFF0_0100的地方开始执行的但是flash并不一定会分配在0xFF00_0000到0xFFFF_FFFF的地方以我们16M的为例。在本系统中Flash的地址就被分配到了0xFE00_0000到0xFEFF_FFFF的地方。所以这其中需要做一个跳转这正是这段代码中map_flash_by_law1remap_flash_by_law0等函数要做的具体的流程可以由下面的五张图来说明
1 开始时BR0OR0为全零4G全是重复的FlashCPU通过LBLAW0访问Flash
空间 FF80_0000到 FFFF_FFFF。
2 map_flash_by_law1函数使用LBLAW1映射FE00_0000到FEFF_FFFF这段空间。
3 跳转到FE00_0000这段空间执行代码由于4G空间重复只要偏移地址计算正确就
会顺序执行。
4 remap_flash_by_law0函数设置BR0为FE00_0000OR0大小为16M。
5 remap_flash_by_law0函数设置LBLAW0窗口映射FE00_0000到FE7F_FFFF区域
清除LBLAW1。
2.4 Dcache 中分配空间做堆栈
程序跑到这里就要进入第一个C函数了C函数的运行需要堆栈空间但这时RAM还没有初始化只能在Dcache中锁定一定的空间用于C的堆栈空间。
lock_ram_in_cache函数在Dcache中锁定4k的空间。
下面的几行代码将堆栈指针指向刚刚分配好的Dcache空间。
lis r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@h
ori r1, r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@l
li r0, 0
stwu r0, -4(r1)
2.5 cpu_init_f 函数
该函数是系统执行的第一个C语言的函数主要是做一些CPU 寄存器的初始化其中最重要的部分是初始化Local Access Windows的值和Local Bus上的片选BROR的值。这些值需要在/include/configs/MPC8315ERDB.h中配置好。
2.6 board_init_f 函数
该函数为板级初始化的第一个函数会对板子上很多硬件外设做初始化其中最重要的为init_sequence数组该数组里面包含了很多板级的硬件初始化函数在board_init_f函数中会依次的调用该数组中的函数去初始化各个硬件该数组如下
init_fnc_t *init_sequence[] = {
#if defined(CONFIG_BOARD_EARLY_INIT_F)
board_early_init_f,
#endif
#if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
get_clocks, /* get CPU and bus clocks (etc.) */
#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) /
&& !defined(CONFIG_TQM885D)
adjust_sdram_tbs_8xx,
#endif
init_timebase,
#endif
#ifdef CFG_ALLOC_DPRAM
#if !defined(CONFIG_CPM2)
dpram_init,
#endif
#endif
#if defined(CONFIG_BOARD_POSTCLK_INIT)
board_postclk_init,
#endif
env_init,
#if defined(CONFIG_8xx_CPUCLK_DEFAULT)
get_clocks_866, /* get CPU and bus clocks according to the environment variable */
sdram_adjust_866, /* adjust sdram refresh rate according to the new clock */
init_timebase,
#endif
init_baudrate,
serial_init,
console_init_f,
display_options,
#if defined(CONFIG_8260)
prt_8260_rsr,
prt_8260_clks,
#endif /* CONFIG_8260 */
#if defined(CONFIG_MPC83XX)
prt_83xx_rsr,
#endif
checkcpu,
#if defined(CONFIG_MPC5xxx)
prt_mpc5xxx_clks,
#endif /* CONFIG_MPC5xxx */
#if defined(CONFIG_MPC8220)
prt_mpc8220_clks,
#endif
checkboard,
INIT_FUNC_WATCHDOG_INIT
#if defined(CONFIG_MISC_INIT_F)
misc_init_f,
#endif
INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
init_func_i2c,
#endif
#if defined(CONFIG_DTT) /* Digital Thermometers and Thermostats */
dtt_init,
#endif
#ifdef CONFIG_POST
post_init_f,
#endif
INIT_FUNC_WATCHDOG_RESET
init_func_ram,
#if defined(CFG_DRAM_TEST)
testdram,
#endif /* CFG_DRAM_TEST */
INIT_FUNC_WATCHDOG_RESET
NULL, /* Terminate this list */
};
可以看到时钟,内存,串口,控制台等初始化函数的调用,其中串口的初始化要先于内存初始化。
2.7 relocate_code 函数
到目前为止boot代码都是在Flash中运行但是代码最终是要到RAM中运行的在上面的board_init_f函数中已经将RAM初始化好了具备了在RAM中运行程序的能力现在relocate_code函数需要做两个事情
1 从Flash中拷贝uboot的代码到RAM
2 记下现在执行代码的偏移跳转到RAM中相应的位置执行。
2.8 board_init_r 函数
该函数为板级初始化的第二阶段主要是初始化PCIPCIE网口Flash等设备关闭看门狗把前面借dcache做堆栈的空间解锁还给cache。在一切设备都初始化好后便会进去main_loop的死循环中。

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,69 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-29T22:26:16+08:00
====== NOR Flash ======
Created Tuesday 29 November 2011
http://baike.baidu.com/view/2741245.htm
目录
NOR Flash 和 NAND Flash
NOR和NAND详解
性能比较
接口差别
容量和成本
可靠性和耐用性
位交换
坏块处理
易于使用
软件支持
展开
编辑本段NOR Flash 和 NAND Flash
  是现在市场上两种主要的非易失闪存技术。Intel于1988年首先开发出NOR Flash 技术彻底改变了原先由EPROM(Electrically Programmable Read-Only-Memory电可编程序只读存储器)和EEPROM(电可擦只读存储器Electrically Erasable Programmable Read - Only Memory)一统天下的局面。紧接着1989年东芝公司发表了NAND Flash 结构强调降低每比特的成本有更高的性能并且像磁盘一样可以通过接口轻松升级。NOR Flash 的特点是芯片内执行XIP eXecute In Place这样应用程序可以直接在Flash闪存内运行不必再把代码读到系统RAM中。NOR 的传输效率很高在1~4MB的小容量时具有很高的成本效益但是很低的写入和擦除速度大大影响到它的性能。NAND的结构能提供极高的单元密度可以达到高存储密度并且写入和擦除的速度也很快。应用NAND的困难在于Flash的管理和需要特殊的系统接口。通常读取NOR的速度比NAND稍快一些而NAND的写入速度比NOR快很多在设计中应该考虑这些情况。——《ARM嵌入式Linux系统开发从入门到精髓》 李亚峰 欧文盛 等编著 清华大学出版社 P52 注释
编辑本段NOR和NAND详解
  NOR和NAND是现在市场上两种主要的非易失闪存技术。Intel于1988年首先开发出NOR flash技术彻底改变了原先由EPROM和EEPROM一统天下的局面。紧接着1989年东芝公司发表了NAND flash结构强调降低每比特的成本更高的性能并且象磁盘一样可以通过接口轻松升级。但是经过了十多年之后仍然有相当多的硬件工程师分不清NOR和NAND闪存。
  相“flash存储器”经常可以与相“NOR存储器”互换使用。许多业内人士也搞不清楚NAND闪存技术相对于NOR技术的优越之处因为大多数情况下闪存只是用来存储少量的代码这时NOR闪存更适合一些。而NAND则是高数据存储密度的理想解决方案。
  NOR的特点是芯片内执行(XIP, eXecute In Place)这样应用程序可以直接在flash闪存内运行不必再把代码读到系统RAM中。NOR的传输效率很高在14MB的小容量时具有很高的成本效益但是很低的写入和擦除速度大大影响了它的性能。
  NAND结构能提供极高的单元密度可以达到高存储密度并且写入和擦除的速度也很快。应用NAND的困难在于flash的管理需要特殊的系统接口。
编辑本段性能比较
  flash闪存是非易失存储器可以对称为块的存储器单元块进行擦写和再编程。任何flash器件的写入操作只能在空或已擦除的单元内进行所以大多数情况下在进行写入操作之前必须先执行擦除。NAND器件执行擦除操作是十分简单的而NOR则要求在进行擦除前先要将目标块内所有的位都写为0。
  由于擦除NOR器件时是以64128KB的块进行的执行一个写入/擦除操作的时间为5s与此相反擦除NAND器件是以832KB的块进行的执行相同的操作最多只需要4ms。
  执行擦除时块尺寸的不同进一步拉大了NOR和NADN之间的性能差距统计表明对于给定的一套写入操作(尤其是更新小文件时)更多的擦除操作必须在基于NOR的单元中进行。这样当选择存储解决方案时设计师必须权衡以下的各项因素。
  l 、NOR的读速度比NAND稍快一些。
  2、 NAND的写入速度比NOR快很多。
  3 、NAND的4ms擦除速度远比NOR的5s快。
  4 、大多数写入操作需要先进行擦除操作。
  5 、NAND的擦除单元更小相应的擦除电路更少。
编辑本段接口差别
  NOR flash带有SRAM接口有足够的地址引脚来寻址可以很容易地存取其内部的每一个字节。
  NAND器件使用复杂的I/O口来串行地存取数据各个产品或厂商的方法可能各不相同。8个引脚用来传送控制、地址和数据信息。
  NAND读和写操作采用512字节的块这一点有点像硬盘管理此类操作很自然地基于NAND的存储器就可以取代硬盘或其他块设备。
编辑本段容量和成本
  NAND flash的单元尺寸几乎是NOR器件的一半由于生产过程更为简单NAND结构可以在给定的模具尺寸内提供更高的容量也就相应地降低了价格。
  NOR flash占据了容量为116MB闪存市场的大部分而NAND flash只是用在8128MB的产品当中这也说明NOR主要应用在代码存储介质中NAND适合于数据存储NAND在CompactFlash、Secure Digital、PC Cards和MMC(多媒体存储卡Multi Media Card)存储卡市场上所占份额最大。
编辑本段可靠性和耐用性
  采用flash介质时一个需要重点考虑的问题是可靠性。对于需要扩展MTBF(平均故障间隔时间Mean Time Between Failures)的系统来说Flash是非常合适的存储方案。可以从寿命(耐用性)、位交换和坏块处理三个方面来比较NOR和NAND的可靠性。
  寿命(耐用性)
  在NAND闪存中每个块的最大擦写次数是一百万次而NOR的擦写次数是十万次。NAND存储器除了具有10比1的块擦除周期优势典型的NAND块尺寸要比NOR器件小8倍每个NAND存储器块在给定的时间内的删除次数要少一些。
编辑本段位交换
  所有flash器件都受位交换现象的困扰。在某些情况下(很少见NAND发生的次数要比NOR多),一个比特位会发生反转或被报告反转了。
  一位的变化可能不很明显,但是如果发生在一个关键文件上,这个小小的故障可能导致系统停机。如果只是报告有问题,多读几次就可能解决了。
  当然,如果这个位真的改变了,就必须采用错误探测/错误更正(EDC/ECC)算法。位反转的问题更多见于NAND闪存NAND的供应商建议使用NAND闪存的时候同时使用EDC/ECC算法。
  这个问题对于用NAND存储多媒体信息时倒不是致命的。当然如果用本地存储设备来存储操作系统、配置文件或其他敏感信息时必须使用EDC/ECC系统以确保可靠性。
编辑本段坏块处理
  NAND器件中的坏块是随机分布的。以前也曾有过消除坏块的努力但发现成品率太低代价太高根本不划算。
  NAND器件需要对介质进行初始化扫描以发现坏块并将坏块标记为不可用。在已制成的器件中如果通过可靠的方法不能进行这项处理将导致高故障率。
编辑本段易于使用
  可以非常直接地使用基于NOR的闪存可以像其他存储器那样连接并可以在上面直接运行代码。
  由于需要I/O接口NAND要复杂得多。各种NAND器件的存取方法因厂家而异。
  在使用NAND器件时必须先写入驱动程序才能继续执行其他操作。向NAND器件写入信息需要相当的技巧因为设计师绝不能向坏块写入这就意味着在NAND器件上自始至终都必须进行虚拟映射。
编辑本段软件支持
  当讨论软件支持的时候,应该区别基本的读/写/擦操作和高一级的用于磁盘仿真和闪存管理算法的软件,包括性能优化。
  在NOR器件上运行代码不需要任何的软件支持在NAND器件上进行同样操作时通常需要驱动程序也就是内存技术驱动程序(MTD)NAND和NOR器件在进行写入和擦除操作时都需要MTD(Memory Technology Devices)。
  使用NOR器件时所需要的MTD要相对少一些许多厂商都提供用于NOR器件的更高级软件这其中包括M-System的TrueFFS驱动该驱动被Wind River System、Microsoft、QNX Software System、Symbian和Intel等厂商所采用。
  驱动还用于对DiskOnChip产品进行仿真和NAND闪存的管理包括纠错、坏块处理和损耗平衡。

View File

@@ -0,0 +1,253 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-03T15:35:55+08:00
====== PowerPC 汇编简介 ======
Created Saturday 03 December 2011
http://www.ibm.com/developerworks/cn/linux/hardware/ppc/assembly/index.html
通常高级语言都具有向程序员__隐藏__许多普通的和重复性__细节__这一非常好的优点这样程序员就可以专注于他们的目标。然而有时程序员必须使用较低级语言例如当编写直接处理硬件的代码或编写对性能极其敏感的代码的时候。汇编语言是最接近硬件的编程语言这就很自然使它成为上述那些情况下最终使用的一种语言。
本文假设您对计算机设计(例如,您应该知道处理器中有寄存器并能访问内存)和操作系统(系统调用、异常和进程堆栈)有基本了解。本文对于不熟悉汇编的 PowerPC 程序员以及已知道 ia32 汇编并想扩展眼界的程序员都很有用。
===== PowerPC 简介 =====
**PowerPC 体系结构规范**PowerPC Architecture Specification发布于 1993 年,它是一个 64 位规范 ( 也包含 32 位子集 )。几乎所有常规可用的 PowerPC除了新型号 IBM RS/6000 和所有 IBM pSeries 高端服务器)都是 32 位的。
PowerPC 处理器有广泛的实现范围,包括从诸如 Power4 那样的高端服务器 CPU 到嵌入式 CPU 市场(任天堂 Gamecube 使用了 PowerPC。PowerPC 处理器有**非常强的嵌入式表现**因为它具有优异的性能、较低的能量损耗以及较低的散热量。除了象串行和以太网控制器那样的__集成 I/O__该嵌入式处理器与“台式机”CPU 存在非常显著的区别。例如4xx 系列 PowerPC 处理器缺乏浮点运算,并且还使用一个受软件控制的 TLB 进行内存管理,而不是象台式机芯片中那样采用反转页表。
PowerPC 处理器有 32 个32 位或 64 位__GPR__通用寄存器以及诸如 __PC__程序计数器也称为 IAR指令地址寄存器或 NIP下一指令指针、__LR__链接寄存器、__CR__条件寄存器等各种其它寄存器。有些 PowerPC CPU 还有 32 个 64 位 __FPR__浮点寄存器
===== RISC =====
PowerPC 体系结构是 RISC精简指令集计算体系结构的一个示例。因此
* 所有 PowerPC包括 64 位实现都使用__定长的 32 位指令__。
* PowerPC 处理模型要从内存检索数据、在寄存器中对它进行操作,然后将它存储回内存。几乎没有指令(除了装入和存储)是直接操作内存的。
===== 应用程序二进制接口ABI =====
从技术而言开发人员可以__将任一 GPR 用于任何操作__。例如由于不存在“堆栈指针寄存器”为此程序员就可以使用任何寄存器。实际上定义**一组约定**很有用这样二进制对象间就可以与不同的编译器和预先编写好的汇编代码进行__互操作__。
__调用约定__是由使用的 ABI应用程序二进制接口决定的。ppc32 Linux 和 NetBSD 实现使用 SVR4System V R4ABI而 ppc64 Linux 仿效了 AIX使用 PowerOpen ABI。ABI 还指定当调用子例程时哪些寄存器被认为是__易失型的__调用者保存(caller-save)以及哪些被认为是__非易失型的__被调用者保存(callee-save)),以及许多其它内容。
SVR4 ABI 指定了一些行为的具体示例:
* 由于 PowerPC 拥有如此多的 GPR32 个,而相比之下 ia32 只有 8 个所以__传递参数的寄存器__从 gpr3 开始。
* 寄存器 gpr3 到 gpr12 是易失型的(调用者保存)寄存器,如果需要的话,在调用子例程之前必须先保存它们并在返回之后恢复它们。
* 寄存器 gpr1 用来作为__栈帧指针__。
SVR4 的许多特性与 PowerOpen ABI 的相同,这样非常有助于互操作性。
===== 何时使用汇编 =====
在“Assembly HOWTO”请参阅 参考资料获取链接)中列出的所有优缺点 PowerPC 都有。
=== 机器特定的寄存器 ===
有时您必须接触较高级的语言完全不了解的 CPU 寄存器。尤其在编写操作系统的过程中会碰到这样的情况。一个简单示例是为您的代码分配它自己的堆栈 — 在 PowerPC 上,您**必须设置 r1** 。C 编译器将只对 r1 递增或递减,所以如果您的应用程序直接在硬件上运行,那么在调用 C 代码之前您必须设置 r1 。另一个示例是操作系统的异常处理程序,它必须很仔细地保存和恢复状态,每次只对一个寄存器进行操作,直到调用较高级代码是安全的为止。
但是当您面临必须使用低级硬件特性的情况时您应该__尽可能不使用汇编实现__
* C 代码是可移植的并为大量开发人员所了解;汇编代码(尤其是 PowerPC 汇编)却不是。
* 较高级代码的调试常常比汇编容易得多。
* 较高级代码在定义上比汇编更易于表达;换句话说,您可以使用较少代码(在较短时间内)完成较多任务。
如果您发现您在用汇编编写诸如循环或 C 结构那样的高级构造,那么请后退一步,先考虑使用其它语言是否会更容易完成。一般规则是使用足够恰当的汇编就可以允许您使用较高级语言来完成。
=== 优化 ===
人们想要使用汇编语言的最普遍原因之一是为了使慢程序运行得更快。但在这样的情况中,汇编绝对应该是您最后的选择。
对优化的一般建议已超出了本文的范围,不过以下是一些着手点:
* 概要分析
在开始任何优化工作之前您 __必须概要分析您的代码__。这不仅告诉您“热点”在哪里它们常常不在您所期望的地方而且它还在您完成时向您证明您已对一切进行了优化。一旦您找到了热点您就可以开始优化高级代码而不是尝试用汇编对它重写
* 算法优化
不管您的汇编是如何紧凑,如果您使用 n 4算法那么您的代码运行起来还会令人难以置信的慢。您应该先尝试包括使用__更合适的数据结构__在内的一些其它技术。如果您通过链表进行重复迭代那么请考虑使用散列表、二叉树或适合您应用程序的任何方法。
**编译器所能做的工作几乎总是比您编写汇编所能做的要好得多!**__不要尝试用汇编重写高级代码__请明智地利用诸如 -O3 之类的优化选项和象 __inline__ 那样的 C 伪指令。编译器知道象指令调度之类的诀窍,它考虑到处理器的内部结构并尝试使所有流水线总是维持全满。那样可能涉及在指令流里移动指令要比所要求的移动时间还要发生得早,这样做可以使在 CPU 等待内存完成读写时避免流水线的延迟。除非您使用汇编编写代码已经有许多年了,否则大多数人都不能亲手正确地执行这些任务。
===== 如何学习汇编 =====
gcc 是开始学习汇编的最佳工具(适用于任何体系结构)。 gcc -O3__ -S__ file.c 将调用 gas 汇编程序将源代码便以为 file.s gas 是 GNU 汇编程序)。在您喜爱的编辑器中打开 file.s ,您就会看见 C 代码的汇编输出。
您可能会看到您不理解的指令。可以在 The PowerPC Architecture: A Specification for a New Family of RISC Processors, 2nd. Ed以及 PowerPC Microprocessor Family: The Programming Environments for 32-bit Microprocessors请参阅 参考资料获取这些文档的链接)中进行查阅。不过,就象学习任何(口语)语言一样,某些单词很重要,您应该知道这些单词,而其它的可以被安全地忽略,直到您弄清了代码更为重要的特性。一个重要指令的典型示例就是分支系列的指令,例如 blr 。
===== 汇编示例 =====
== Hello World — ia32 汇编 ==
清单 1 直接复制自 Assembly HOWTO 中的 gas 示例,糟糕的是它完全特定于 ia32。它进行两个__直接的系统调用__第一个写到标准输出第二个退出应用程序包含返回代码 0 )。
直接进行系统调用非常少见一般情况下__应用程序与一个封装所有系统调用的 libc 库相连__。
清单 1. ia32 汇编 ( 下载此代码样本)
.data # **section declaration**
msg:
.string "Hello, world!\n"
len = . - msg # length of our dear string
.text # section declaration
# we must __export__ the __entry point__ to the ELF __linker__ or
.global _start # __loader__. They conventionally recognize** _start **as their
# entry point. Use** ld -e foo** to override the default.
_start:
# write our string to stdout
movl **$len**,%edx # third argument: message length
movl **$msg**,%ecx # second argument: pointer to message to write
movl $1,%ebx # first argument: file handle (stdout)
movl $4,%eax # system call number (sys_write)
__int__ $0x80 # call kernel
# and exit
movl $0,%ebx # first argument: **exit code**
movl $1,%eax # system call number (sys_exit)
__int __ $0x80 # call kernel
== Hello World — PPC32 汇编 ==
清单 2 是将相同代码直接转换成 PowerPC 汇编代码。
.data # section declaration - **variables only**
msg:
__.string __"Hello, world!\n"
len = . - msg # length of our dear string
.text # section declaration - **begin code**
__.global__ _start
_start:
# write our string to stdout
li 0,4 # syscall number (sys_write)
li 3,1 # first argument: file descriptor (stdout)
# second argument: pointer to message to write
lis 4,msg@ha # load top 16 bits of &msg
addi 4,4,msg@l # load bottom 16 bits
li 5,len # third argument: message length
__sc __ # call kernel
# and exit
li 0,1 # syscall number (sys_exit)
li 3,1 # first argument: exit code
sc # call kernel
== 有关清单 2 的一般说明 ==
PowerPC 汇编需要一个__目标寄存器__用于所有寄存器到寄存器的操作因为它是 RISC 体系结构)。该寄存器总是位于参数列表的第一个。
在 PPC Linux 中,系统调用是通过 __gpr0 中的系统调用syscall号和以 gpr3 开始的参数进行的__。系统调用号、参数序列以及参数个数在其它 PowerPC 操作系统NetBSD、Mac OS 等)中可能会有所不同,这是程序员通常利用 libc 库(它处理特定于 OS 的细节)进行系统调用的一个原因。
=== 寄存器表示法 ===
__PowerPC 寄存器有编号而没有名称__。对于初学者来说有时这会使人混淆因为 tts 无法轻易地与寄存器区分开。“ 3 ”可以表示值 3 或者寄存器 gpr3 ,或者浮点 fpr3 ,或者**特殊用途的寄存器 spr3** 。习惯了就好了。:)
=== 立即指令 ===
li 表示“__立即装入__”load instance它是表示“在编译时获取已知的常量值并将它存储到寄存器中”的一种方法。立即指令的另一个示例是 addi ,例如, addi 3,3,1 会按照 1 来递增 gpr3 的内容,然后将结果存储回 gpr3 。将之与 add 3,3,1 进行对照,后者将按照 gpr1 的内容 来递增 gpr3 的内容,并将结果存储回 gpr3 。
__以“i”结束的指令通常是立即指令。__
=== 助记符 ===
li 实际上不是一条指令;它真正的含义是助记符。 助记符有点象**预处理器宏**它是汇编程序接受的但__秘密转换成其它指令__的一条指令。在这种情况中 li 3,1 实际上被定义为 addi 3,0,1 。
眼尖的读者会注意到那些指令没有必要完全相同: addi 实际上向 gpr0 的 内容加 1将结果存储到 gpr3 ,是这样吗?的确是的,不过 PowerPC 规范指出 gpr0 有时具有值,而有时当作 0这取决于__环境__。在这种情况中而且 addi 描述显式地声明了这一点0 表示值 0而不是寄存器 gpr0 。
助记符对汇编程序开发人员以外的其它任何人根本不重要但当您查看反汇编输出时助记符会使人迷惑。不过GNU __objdump -d __可以非常有效地显示原始的助记符而不是实际出现在文件中的指令。例如 objdump 将显示助记符 nop ,而不是 ori 0,0,0 (真正使用的指令)。
=== 装入指针 ===
Hello World 示例最有趣部分是我们如何装入 msg 的地址。正如前面提到的__PowerPC 使用定长的 32 位指令__与 ia32 相反,后者使用可变长度的指令)。这个 32 位指令恰好是一个 32 位的整数。该整数被分成**大小不同的字段**
清单 3. addi 机器代码格式
--------------------------------------------------------------------------
| opcode | src register | dest register | immediate value |
| 6 bits | 5 bits | 5 bits | 16 bits |
--------------------------------------------------------------------------
字段的数量及其大小根据指令的不同而不同但这里的要点是__这些字段会占用指令空间__。就 addi 而言,在将上述清单的三个字段放入指令之后,就**只剩下 16 位**供您添加即时值!
那意味着 li 只能装入 16 位即时值。您不能只通过一条指令就将一个 32 位的指针装入 GPR。您必须使用两条指令首先装入高 16 位,然后是低 16 位。那恰恰就是__ @ha (“高”)和 @l “低”__后缀的用途。 @ha 的“a”部分处理__符号扩展__。为方便起见 lis (表示“**装入即时移位**” )将直接装入到 GPR 的高 16 位。然后余下的所有操作是添加较低位。
每当您装入一个绝对地址(或任何 32 位即时值请__务必使用这个诀窍__。在引用全局地址时它是最常用的。
lis r2 0x12345678
寄存器位: 0 1 2 3 4 5 6 7
立即数 0X1 2 3 4 — 5 6 7 8
立即数左移16位 0X5 6 7 8 ----0 0 0 0
存到r2中
lis r2 0x12345678@h
寄存器位: 0 1 2 3 4 5 6 7
立即数 0X1 2 3 4 — 5 6 7 8
0x12345678@h 0X1 2 3 4 只取立即数的高16位
立即数左移16位 0X1 2 3 4 ----0 0 0 0
存到r2中
addi 2,2,0X12345678@l # load bottom 16 bits
寄存器位: 0 1 2 3 4 5 6 7
立即数 0X1 2 3 4 — 5 6 7 8
0x12345678@l 0X0 0 0 0 ----5 6 7 8 (只取立即数的低16位)
== 清单 4. Hello World — PPC64 汇编 ==
清单 4 与上面的 32 位 PowerPC 示例(清单 2几乎相同。PowerPC 被设计成带 32 位实现的 64 位规范不仅如此PowerPC 用户级程序在那些实现上或多或少都与二进制兼容。在 Linux 下,**ppc32 二进制在 64 位硬件上可以完美地运行**(在各处做少许更改以使 32 位的用户区和 64 位内核都能看到变量类型)。
清单 4. PPC64 汇编 ( 下载此代码样本)
.data # section declaration - variables only
msg:
.string "Hello, world!\n"
len = . - msg # length of our dear string
.text # section declaration - begin code
.global _start
** .section ".opd","aw"**
**.align 3**
_start:
.quad ._start,.TOC.@tocbase,0
.previous
.global ._start
._start:
# write our string to stdout
li 0,4 # syscall number (sys_write)
li 3,1 # first argument: file descriptor (stdout)
# second argument: pointer to message to write
# load the address of 'msg':
# load high word into the **low word** of r4:
lis 4,msg@highest # load msg bits 48-63 into r4 bits 16-31
ori 4,4,msg@higher # load msg bits 32-47 into r4 bits 0-15
rldicr 4,4,32,31 # rotate r4's low word into r4's high word
# load low word into the low word of r4:
oris 4,4,msg@h # load msg bits 16-31 into r4 bits 16-31
ori 4,4,msg@l # load msg bits 0-15 into r4 bits 0-15
# done loading the address of 'msg'
li 5,len # third argument: message length
sc # call kernel
# and exit
li 0,1 # syscall number (sys_exit)
li 3,1 # first argument: exit code
sc # call kernel
ppc32 代码(清单 2和 ppc64 代码(清单 4之间只有两个区别。第一个是我们装入指针的方法第二个是那些有关 .opd section 的汇编程序伪指令。当将 ppc32 代码编译成 ppc32 二进制时,它在 ppc64 Linux 下工作得相当完美。
=== 装入指针 ===
在 ppc32 上,将 32 位即时值装入寄存器需要两条指令。在 ppc64 上,需要 5 条!为什么?
我们__还是使用 32 位固定长度的指令__它一次只能装入 16 位即时值。这时您至少需要四条指令64 位/每条指令 16 位 = 4 条指令)。但没有指令能直接装入到 64 位 GPR 的高位字。所以我们必须先装载到低位字,将它移到高位字,然后再次装入低位字。
__旋转指令__象这里看到的 rlicr 是臭名昭著地复杂并被开玩笑地称为图灵完成Turing-complete。如果您所需的全部就是装入 64 位即时值,那么不必担心 — 只要将这五条指令转换成宏,就不必再考虑这些指令了。
最后一个注意点:我们在这里使用了 @h 来替代 ppc32 示例中的 @ha ,因为我们后面提供低 16 位时使用了 ori ,而不是 addi 。在 RISC 机器上,经常可能用许多不同的方法来完成某项任务(例如,对于 nop ,就有许多可能的方法)。
=== 函数描述符 — .opd 节 ===
在 ppc64 Linux 下,当您定义并调用 C 函数 foo 时,那实际上**不是该函数代码的地址**。在汇编中如果您尝试使用__ bl __foo 那么您很快会发现您的程序崩溃了。__标号 foo 确实是 foo 函数描述符的地址__。ppc64 ELF ABI请参阅 参考资料)中详细描述了函数描述符,但是如果从 C 代码调用您的汇编,则您必须临时使用一个函数描述符(它只是包含** 3 个指针的结构**),因为编译器希望使用它。
我们这里没有包含任何 C 代码,但是 ELF ABI 还是显示 ELF 文件的入口点(缺省情况下是 _start )指向一个函数描述符。所以我们必须使用一个函数描述符,并且它应该在 .opd 节中。
那些汇编程序伪指令几乎都从 gcc -S 的输出中直接复制而来。这是您汇编代码中用于预处理器宏的另一个极佳候选指令。
===== 到哪里了解更多 =====
对于那些有兴趣学习更多有关 PowerPC 的读者而言,可以通过使用 __gcc -S__ (假如您手边有 PowerPC 机器)编译小型程序作为开始。如果您手边没有 PowerPC 机器,则请查阅参考资料一节中列出的 PPC 交叉编译 mini-howto以及其它站点和文档。还请尝试使用 gdb 的 psimPowerPC 模拟器)目标进行实验。它比你想象的要容易!也希望您能从中获得乐趣。

View File

@@ -0,0 +1,174 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-01T20:55:14+08:00
====== USB gadget设备驱动解析 ======
Created Thursday 01 December 2011
http://www.embedu.org/Column/Column113.htm
作者:刘洪涛,华清远见嵌入式学院金牌讲师。
利用Linux USB gadget设备驱动可以实现一些比较有意思的功能举两个例子 1、一个嵌入式产品中的某个存储设备或是一个存储设备的某个分区可以将给设备的USB接口连到另外一台电脑而该usb被当作设别从而非常方便的完成文件交互这个功能被广泛的应用于手机、数码相机等产品中。2、一个嵌入式设备通过USB连接到你的PC后在你的PC端会出现一个新的网络连接在嵌入式设备上也会有一个网卡设备你可以配置它们的IP地址并进行网络通讯俗称__USBNET__。
所有USB通讯的__设备端__都有usb device程序(和设备端对应的还是有__host side__,即usb device controller),通常称它们为**usb固件**。在一些功能简单的设备里用一些专用的可编程USB控制器就可以了。而在一些运行了类似linux操作系统的复杂的嵌入式系统中要完成usb device程序就会要求你不仅熟悉usb device控制器的操作还要熟悉操作系统的驱动架构通常带linux的嵌入式系统其usb是一个host side
我想通过 “功能体验”、“驱动调试”、“gadget驱动结构分析”、“编写一个自己的gadget驱动”这4个方面解析linux usb gadget设备驱动的编写方法。
===== 一、linux模拟U盘功能的实现 =====
在硬件环境为华清远见的fs2410平台软件环境为linux-2.6.26的linux系统上实现模拟U盘的功能。
向内核添加代码
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-clock.h>
#include <asm/plat-s3c24xx/udc.h>
修改arch/arm/mach-s3c2410/mach-smdk2410.c
/*USB device上拉电阻处理 */
static void smdk2410_udc_pullup(enum s3c2410_udc_cmd_e cmd)
{
u8 *s3c2410_pullup_info[] = {
" ",
"Pull-up enable",
"Pull-up disable",
"UDC reset, in case of"
};
printk("smdk2410_udc: %s\n",s3c2410_pullup_info[cmd]);
s3c2410_gpio_cfgpin(S3C2410_GPG9, S3C2410_GPG9_OUTP);
switch (cmd)
{
case S3C2410_UDC_P_ENABLE :
s3c2410_gpio_setpin(S3C2410_GPG9, 1); //set gpg9 output HIGH
break;
case S3C2410_UDC_P_DISABLE :
s3c2410_gpio_setpin(S3C2410_GPG9, 0); //set gpg9 output LOW
break;
case S3C2410_UDC_P_RESET :
//FIXME!!!
break;
default:
break;
}
}
static struct s3c2410_udc_mach_info smdk2410_udc_cfg __initdata = {
.udc_command = smdk2410_udc_pullup,
};
static struct platform_device *smdk2410_devices[] __initdata = {
…,
&s3c_device_usbgadget, /*USB gadget device设备登记*/
};
static void __init sdmk2410_init(void)
{
u32 upll_value;
set_s3c2410fb_info(&smdk2410_lcdcfg);
s3c24xx_udc_set_platdata(&smdk2410_udc_cfg); /* 初始化*/
s3c_device_sdi.dev.platform_data = &smdk2410_mmc_cfg;
/* Turn off suspend on both USB ports, and switch the
* selectable USB port to USB device mode. */
s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
S3C2410_MISCCR_USBSUSPND0 |
S3C2410_MISCCR_USBSUSPND1, 0x0);
/* 设置USB时钟 */
upll_value = (
0x78 << S3C2410_PLLCON_MDIVSHIFT)
| (0x02 << S3C2410_PLLCON_PDIVSHIFT)
| (0x03 << S3C2410_PLLCON_SDIVSHIFT);
while (upll_value != readl(S3C2410_UPLLCON)) {
writel(upll_value, S3C2410_UPLLCON);
udelay(20);
}
}
修改drivers/usb/gadget/file_storage.c
static void start_transfer(struct fsg_dev *fsg, struct usb_ep *ep,
struct usb_request *req, int *pbusy,
enum fsg_buffer_state *state)
{
int rc;
udelay(800);
……
}
__配置内核支持U盘模拟__
<*> USB Gadget Support --->
USB Peripheral Controller (S3C2410 USB Device Controller) --->
S3C2410 USB Device Controller
[*] S3C2410 udc debug messages
<M> USB Gadget Drivers
<M> File-backed Storage Gadget
3、编译内核
#make zImage
#make modules
在目录drivers/usb/gadget下生成**g_file_storage.ko**
===== 加载驱动,测试功能 =====
利用前面的生成的内核启动系统后加载g_file_storage.ko
#insmod g_file_storage.ko
#__ insmod g_file_storage.ko file=/dev/mtdblock2 stall=0 removable=1__
0.03 USB: usb_gadget_register_driver() 'g_file_storage'
0.04 USB: binding gadget driver 'g_file_storage'
0.05 USB: s3c2410_set_selfpowered()
g_file_storage gadget: File-backed Storage Gadget, version: 20 October 2004
g_file_storage gadget: Number of LUNs=1
g_file_storage gadget-lun0: ro=0, file: /dev/mtdblock3
0.06 USB: udc_enable called
smdk2410_udc: Pull-up enable
连接设备usb到windowswindows系统会自动设备到一个新的U盘加入。格式化U盘存入文件。卸载U盘后在目标板上执行如下操作
# mkdir /mnt/gadget
# mount -t vfat /dev/mtdblock2 /mnt/gadget/
#ls
可以看到windows存入U盘的文件。
===== 二、usbnet功能的实现 =====
配置内核支持usbnet
<*> USB Gadget Support --->
USB Peripheral Controller (S3C2410 USB Device Controller) --->
S3C2410 USB Device Controller
[*] S3C2410 udc debug messages
<M> USB Gadget Drivers
<M> **Ethernet Gadget** (with CDC Ethernet support)
[*] ** RNDIS support**
2、编译内核
#make zImage
#make modules
在目录drivers/usb/gadget下生成g_ether.ko
3、加载驱动测试功能
利用前面的生成的内核启动系统后加载g_ether.ko
#insmod g_ether.ko
__ #ifconfig usb0 192.168.1.120__
……
usb0 Link encap:Ethernet HWaddr 5E:C5:F6:D4:2B:91
inet addr:192.168.1.120 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:253 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:35277 (34.4 KiB) TX bytes:10152 (9.9 KiB)
连接设备到windowswindows系统会提示安装驱动根据提示安装上RNDIS驱动。这个驱动可以在网络上找到。此时windows会新生成一个网络连接配置它的ip地址等信息。然后就可以和目标系统通过USB实现网络通讯了。

View File

@@ -0,0 +1,202 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-01T20:59:38+08:00
====== Linux USB gadget设备驱动解析2---驱动调试 ======
Created Thursday 01 December 2011
http://www.embedu.org/Column/Column125.htm
这一节主要把在实现“linux模拟U盘功能”过程中的一些调试过程记录下来并加以解析。
===== 一、背景知识 =====
=== 1、USB Mass Storage类规范概述 ===
USB 组织在universal Serial Bus Mass Storage Class Spaceification 1.1版本中定义了__海量存储设备类__Mass Storage Class的规范这个类规范包括四个
独立的子类规范,即:
1. USB Mass Storage Class Control/Bulk/Interrupt (CBI) Transport
2.USB Mass Storage Class Bulk-Only Transport
3.USB Mass Storage Class ATA Command Block
4.USB Mass Storage Class UFI Command Specification
前两个子规范定义了数据/命令/状态在USB 上的传输方法。Bulk- Only 传输规范仅仅使用Bulk 端点传送数据/命令/状态CBI 传输规范则使用Control/Bulk/Interrupt 三种类型的端点进行数据/命令/状态传送。后两个子规范则定义了存储介质的操作命令。ATA 命令规范用于硬盘UFI 命令规范是针对USB 移动存储。
Microsoft Windows 中提供对Mass Storage 协议的支持因此USB 移动设备只需要遵循 Mass Storage 协议来组织数据和处理命令即可实现与PC 机交换数据。而Flash 的存储单元组织形式采用FAT16 文件系统这样就可以直接在Windows的浏览器中通过可移动磁盘来交换数据了Windows 负责对FAT16 文件系统的管理USB 设备不需要干预FAT16 文件系统操作的具体细节。
USBHost唯一通过描述符了解设备的有关信息根据这些信息建立起通信在这 些描述符中规定了设备所使用的协议、端点情况等。因此正确地提供描述符是USB 设备正常工作的先决条件。
Linux-2.6.26内核中在利用USB gadget驱动实现模拟U盘时主要涉及到file_storage.c、s3c2410_udc.c等驱动文件这些文件的具体结构将在下一篇文章中描述。此时我们想先从这些代码中找到USB描述描述符从中确定使用的存储类规范从而确定协议。确定通讯协议是我们调试的基础。
存储类规范是由接口描述符决定的。接口描述符各项的定义义如下:
其中bInterfaceClass、bInterfaceSubClass、bInterfaceProtocol可以判断出设备是否是存储类以及属于哪种存储子类和存储介质的操作命令。
在file_storage.c文件中
/* USB protocol value = the transport method */
#define USB_PR_CBI 0x00 // Control/Bulk/Interrupt
#define USB_PR_CB 0x01 // Control/Bulk w/o interrupt
#define USB_PR_BULK 0x50 // Bulk-only
/* USB subclass value = the protocol encapsulation */
#define USB_SC_RBC 0x01 // Reduced Block Commands (flash)
#define USB_SC_8020 0x02 // SFF-8020i, MMC-2, ATAPI (CD-ROM)
#define USB_SC_QIC 0x03 // QIC-157 (tape)
#define USB_SC_UFI 0x04 // UFI (floppy)
#define USB_SC_8070 0x05 // SFF-8070i (removable)
#define USB_SC_SCSI 0x06 // Transparent SCSI
默认的情况是:
mod_data = { // Default values
.transport_parm = "BBB",
.protocol_parm = "SCSI",
……
默认的赋值如下:
bInterfaceClass=08 表示:存储类
bInterfaceSubClass=0x06 表示透明的SCSI指令
bInterfaceProtocol=0x50 表示bulk-only 传输
2、BulkOnly 传输协议
下面看看BulkOnly 传输协议详细的规范请阅读《Universal Serial BusMass Storage ClassBulk-Only Transport》
设备插入到USB 后USB 即对设备进行搜索并要求设备提供相应的描述符。在USBHost 得到上述描述符后即完成了设备的配置识别出为BulkOnly 的Mass Storage 设备, 然后即进入BulkOnly 传输方式。在此方式下USB 与设备间的所有数据均通过BulkIn和BulkOut 来进行传输,不再通过控制端点传输任何数据。
在这种传输方式下有三种类型的数据在USB 和设备之间传送CBW、CSW 和普通数据。CBWCommand Block Wrapper即命令块包是从USB Host 发送到设备的命令, 命令格式遵从接口中的bInterfaceSubClass 所指定的命令块这里为SCSI 传输命令集。USB设备需要将SCSI 命令从CBW 中提取出来执行相应的命令完成以后向Host 发出反映 当前命令执行状态的CSWCommand Status WrapperHost 根据CSW 来决定是否继续发 送下一个CBW 或是数据。Host 要求USB 设备执行的命令可能为发送数据,则此时需要将 特定数据传送出去完毕后发出CSW以使Host 进行下一步的操作。USB 设备所执行的操
作可用下图描述:
CBW的格式如下
dCBWSignature:
CBW的标识固定值43425355h (little endian)。
dCBWTag:
主机发送的一个命令块标识设备需要原样作为dCSWTagCSW中的一部分再发送给Host;主要用于关联CSW到对应的CBW。
dCBWDataTransferLength:
本次CBW命令要求在命令与回应之间传输的字节数。如果为0则不传输数据。
bmCBWFlags:
反映数据传输的方向0 表示来自Host1 表示发至Host
bCBWLUN:
对于有多个LUN逻辑单元的设备用来选择具体目标。如果没有多个LUN则写0。
bCBWCBLength:
命令的长度范围在0~16.
CBWCB:
传输的具体命令符合bInterfaceSubClass.中定义的命令规范此处是SCSI
CSW命令格式如下
dCSWSignature:
CSW的标识固定值53425355h (little endian)
dCSWTag:
设置这个标识和CBW中的dCBWTag一致参照上面关于dCBWTag的解释
dCSWDataResidue:
还需要传送的数据此数据根据dCBWDataTransferLength本次已经传送的数据得到
bCSWStatus:
指示命令的执行状态。如果命令正确执行bCSWStatus 返回0 即可。
3、SCSI指令集
Bulk-Only 的CBW 中的CBWCB 中的内容即为如下格式的命令块描述符Command Block Descriptor。SCSI-2 有三种字长的命令6 字节、10字节和12字节Microsoft Windows 环境下支持12 字节长的命令。
Operation Code
操作代码表示特定的命令。高3 位为Group Code共有8 种组合,
即8 个组低5 五位为Command Code可以有32 种命令。
Logicol unit Number
为了兼容SCSI1 而设的,此处可以不必关心。
Logical block address
为高位在前低位在后的逻辑块地址即扇区地址。第2 位为高位第3、4、5 依次为低位。
Transfer length
为需要从逻辑块地址处开始传输的扇区数比如在Write 命令中)。
Parameter list length
为需要传输的数据长度比如在Mode Sense 命令中);
Allocation length
为初始程序为返回数据所分配的最大字节数,此值可以为零,表示不需要传送数据。
SCSI指令集的Direct Accesss 类型存储介质的传输命令有许多, Mass Storage协议只用到了其中的一些。更多的SCSI指令参见http://en.wikipedia.org/wiki/SCSI_command
指令代码 指令名称 说明
04h Format Unit 格式化存储单元
12h Inquiry 索取器件信息
1Bh Start/Stop load/unload
55h Mode select 允许Host对外部设备设置参数。
5Ah Mode Sense 向host传输参数
Eh Prevent/Allow Medium Removal 写保护
>28h Read10 Host读存储介质中的二进制数据
A8h Read12 同上,不过比较详细一点
25h Read Capacity 要求设备返回当前容量
23h Read Format Capacity 查询当前容量及可用空间
03h Request Sense 请求设备向主机返回执行结果,及状态数据
01h Rexero Unit 返回零轨道
2Bh Seek10 为设备分配到特定地址
1Dh Send Diagnostic 执行固件复位并执行诊断
00h Test Unit Ready 请求设备报告是否处于Ready状态
2Fh Verify 在存储中验证数据
2Ah Write10 从主机向介质写二进制数据
AAh Write12 同上,不过比较详细
2Eh Write and Verify 写二进制数据并验证
对于不同的命令,其命令块描述符略有不同,其要求的返回内容也有所不同,根据相 应的文档可以对每种请求作出适当的回应。比如下面是INQUIRY 请求的命令块描述符和其返回内容的数据格式INQUIRY
命令描述符:
返回数据格式
Host 会依次发出INQUIRY、Read Capacity、UFI Mode Sense 请求如果上述请求的返回结果都正确则Host 会发出READ 命令读取文件系统0 簇0 扇区的MBR 数据,进入文件系统识别阶段。
4、利用USB View观察结果
可通过USB View软件查看到USB设置阶段获取到的信息。
二、出现的主要问题
在调试过程中遇到了一个问题。现象是:在目标板加载完驱动后,即执行完:
# insmod g_file_storage.ko file=/dev/mtdblock2 stall=0 removable=1
接好USB线。此时在windows端设备出有usb storage设备加入但出现不了盘符。
下面记录下调试过程。
三、调试过程
根据规范当完成SCSI指令集中Inquiry 命令时可以出现盘符。所以可以通过bushound软件查看通讯过程找出原因。
下面是利用bushound工具在出现问题时采集到的数据。
Dev Phase Data Info Time Cmd.Phase. Ofs
--- ----- --------------------------------- ---------- ----- -----------
26 CTL 80 06 00 01 - 00 00 12 00 GET DESCRIPTR 0us 1.1.0
26 DI 12 01 10 01 - 00 00 00 10 - 25 05 a5 a4 - 12 03 01 02 ........%....... 4.8ms 1.2.0
03 01 .. 1.2.16
26 CTL 80 06 00 02 - 00 00 09 00 GET DESCRIPTR 14us 2.1.0
26 DI 09 02 20 00 - 01 01 04 c0 - 01 .. ...... 3.9ms 2.2.0
26 CTL 80 06 00 02 - 00 00 20 00 GET DESCRIPTR 16us 3.1.0
26 DI 09 02 20 00 - 01 01 04 c0 - 01 09 04 00 - 00 02 08 06 .. ............. 4.9ms 3.2.0
50 05 07 05 - 81 02 40 00 - 00 07 05 02 - 02 40 00 00 P.....@......@.. 3.2.16
26 CTL 80 06 00 03 - 00 00 02 00 GET DESCRIPTR 60us 4.1.0
26 DI 09 02 20 00 - 01 01 04 c0 - 01 .. ...... 3.9ms 2.2.0
26 DI 04 03 .. 3.9ms 3.1.0
26 CTL 80 06 00 03 - 00 00 04 00 GET DESCRIPTR 15us 5.1.0
26 DI 04 03 09 04 .... 3.9ms 6.1.0
26 CTL 80 06 03 03 - 09 04 02 00 GET DESCRIPTR 10us 1.2.16
26 DI 1a 03 .... 4.0ms 6.2.0
26 CTL 80 06 03 03 - 09 04 1a 00 GET DESCRIPTR 18us 7.1.0
26 DI 1a 03 33 00 - 37 00 32 00 - 30 00 34 00 - 31 00 37 00 ..3.7.2.0.4.1.7. 4.9ms 7.2.0
35 00 36 00 - 37 00 37 00 - 35 00 5.6.7.7.5. 7.2.16
26 CTL 00 09 01 00 - 00 00 00 00 SET CONFIG 16us 8.1.0
26 CTL 01 0b 00 00 - 00 00 00 00 SET INTERFACE 60ms 9.1.0
26 CTL a1 fe 00 00 - 00 00 01 00 CLASS 62ms 10.1.0
26 DI 00 . 3.9ms 10.2.0
26 DO 55 53 42 43 - 08 60 e0 86 - 24 00 00 00 - 80 00 06 12 USBC.`..$....... 985us 11.1.0
00 00 00 24 - 00 00 00 00 - 00 00 00 00 - 00 00 00 ...$........... 11.1.16
26 DI 00 80 02 02 - 1f 00 00 00 - 4c 69 6e 75 - 78 20 20 20 ........Linux 1.0ms 12.1.0
46 69 6c 65 - 2d 53 74 6f - 72 20 47 61 - 64 67 65 74 File-Stor Gadget 12.1.16
30 33 31 32 0312 12.1.32
26 CTL 80 06 00 02 - 00 00 20 00 GET DESCRIPTR 893ms 13.1.0
26 DI 09 02 20 00 - 01 01 04 c0 - 01 09 04 00 - 00 02 08 06 .. ............. 4.1ms 13.2.0
50 05 07 05 - 81 02 40 00 - 00 07 05 02 - 02 40 00 00 P.....@......@.. 13.2.16
26 CTL 80 06 00 02 - 00 00 20 00 GET DESCRIPTR 2.7sc 14.1.0
26 DI 09 02 20 00 - 01 01 04 c0 - 01 09 04 00 - 00 02 08 06 .. ............. 4.4ms 14.2.0
50 05 07 05 - 81 02 40 00 - 00 07 05 02 - 02 40 00 00 P.....@......@.. 14.2.16
26 USTS 05 00 00 c0 no response 2.8sc 15.1.0
注意上面红色部分的代码DO发出了55 53 42 43开始的CBW命令块命令码是12即Inquiry命令。要求目标返回Inquiry命令要求的数据长度是0x24。接下来设备端通过DI返回了设备信息。按照规范在返回完了数据后设备端还应该通过DI向系统返回CSW的值。但实际的捕获内容并没有。所以导致不能正确出现盘符。
在file_storage.c中发送数据时都会调用到start_transfer函数。在此函数中加入printk调试语句观察现象。发现只要加入的调试语句windows端就能够正常设别设备了。于是可以猜测是因为需要在连续两次发送之间加上一些延时。在函数中加入udelay800windows系统可以正常发现设备了。具体的代码架构将在下一遍文章中解析。
下面是程序正常后用bushound捕获到的数据。
红色部分可以看出设备正确的按照规范在发送完数据后返回CSW信息。
四、总结做好USB gadget驱动、或者USB host驱动调试需要
·掌握一定的知识基础
包括USB协议、具体的类设备规范、USB驱动程序架构、USB设备端控制器操作等。
·合理利用调试工具。
包括USB view 、bushound 、及一些硬件USB信号分析仪。

View File

@@ -0,0 +1,584 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-01T22:25:08+08:00
====== Linux USB gadget设备驱动解析4--编写一个gadget驱动 ======
Created Thursday 01 December 2011
一、编写计划
通过前面几节的基础本节计划编写一个简单的gadget驱动。重在让大家快速了解gadget驱动结构。
上节中简单介绍了zero.c程序。这个程序考虑到了多配置、高速传输、USB OTG等因素。应该说写的比较清楚是我们了解gadget驱动架构的一个非常好的途径。但把这些东西都放在一起对很多初学人员来说还是不能快速理解。那就再把它简化一些针对S3C2410平台只实现一个配置、一个接口、一个端点不考虑高速及OTG的情况。只完成单向从host端接收数据的功能但要把字符设备驱动结合在里面。这需要有一个host端的驱动来完成向device端发送数据。关于在主机端编写一个简单的USB设备驱动程序有很多的资料。相信大家很快就会完成的。
二、功能展示
1、PC端编写了一个usbtransfer.ko能够向device端发送数据
2、对目标平台编写一个gadget驱动名称是g_zero.ko
3、测试步骤
在目标平台基于S3C2410上加载gadget驱动
# insmod g_zero.ko
name=ep1-bulk
smdk2410_udc: Pull-up enable
# mknod /dev/usb_rcv c 251 0
#
在PC主机上加载驱动usbtransfer.ko
#insmod usbtransfer.ko
#mknod /dev/usbtransfer c 266 0
连接设备,目标平台的终端显示:
connected
目标平台读取数据
# cat /dev/usb_rcv
PC端发送数据
#echo “12345” > /dev/usbtransfer
#echo “abcd” > /dev/usbtransfer
设备端会显示收到的数据
# cat /dev/usb_rcv
12345
abcd
三、代码分析
下面的代码是在原有的zero.c基础上做了精简、修改的。一些结构的名称还是保留以前的但含义有所变化。如loopback_config不再表示loopback而只是单向的接收数据。
/*
* zero.c -- Gadget Zero, for simple USB development
* lht@farsight.com.cn
* All rights reserved.*/
/* #define VERBOSE_DEBUG */
#include <linux/kernel.h>
#include <linux/utsname.h>
#include <linux/device.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include "gadget_chips.h"
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/usb/input.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/types.h> /* size_t */
#include <linux/errno.h> /* error codes */
#include <asm/system.h>
#include <asm/io.h>
#include <linux/sched.h>
/*-------------------------------------------------------------------------*/
static const char shortname[] = "zero";
static const char loopback[] = "loop input to output";
static const char longname[] = "Gadget Zero";
static const char source_sink[] = "source and sink data";
#define STRING_MANUFACTURER 25
#define STRING_PRODUCT 42
#define STRING_SERIAL 101
#define STRING_SOURCE_SINK 250
#define STRING_LOOPBACK 251
//#define DRIVER_VENDOR_NUM 0x0525 /* NetChip */
//#define DRIVER_PRODUCT_NUM 0xa4a0 /* Linux-USB "Gadget Zero" */
#define DRIVER_VENDOR_NUM 0x5345 /* NetChip */
#define DRIVER_PRODUCT_NUM 0x1234 /* Linux-USB "Gadget Zero" */
static int usb_zero_major = 251;
/*-------------------------------------------------------------------------*/
static const char *EP_OUT_NAME; /* sink */
/*-------------------------------------------------------------------------*/
/* big enough to hold our biggest descriptor */
#define USB_BUFSIZ 256
struct zero_dev { //zero设备结构
spinlock_t lock;
struct usb_gadget *gadget;
struct usb_request *req; /* for control responses */
struct usb_ep *out_ep;
struct cdev cdev;
unsigned char data[128];
unsigned int data_size;
wait_queue_head_t bulkrq;
};
#define CONFIG_LOOPBACK 2
static struct usb_device_descriptor device_desc = { //设备描述符
.bLength = sizeof device_desc,
.bDescriptorType = USB_DT_DEVICE,
.bcdUSB = __constant_cpu_to_le16(0x0110),
.bDeviceClass = USB_CLASS_VENDOR_SPEC,
.idVendor = __constant_cpu_to_le16(DRIVER_VENDOR_NUM),
.idProduct = __constant_cpu_to_le16(DRIVER_PRODUCT_NUM),
.iManufacturer = STRING_MANUFACTURER,
.iProduct = STRING_PRODUCT,
.iSerialNumber = STRING_SERIAL,
.bNumConfigurations = 1,
};
static struct usb_endpoint_descriptor fs_sink_desc = { //端点描述符
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT, //对主机端来说,输出
.bmAttributes = USB_ENDPOINT_XFER_BULK,
};
static struct usb_config_descriptor loopback_config = { //配置描述符
.bLength = sizeof loopback_config,
.bDescriptorType = USB_DT_CONFIG,
/* compute wTotalLength on the fly */
.bNumInterfaces = 1,
.bConfigurationValue = CONFIG_LOOPBACK,
.iConfiguration = STRING_LOOPBACK,
.bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
.bMaxPower = 1, /* self-powered */
};
static const struct usb_interface_descriptor loopback_intf = { //接口描述符
.bLength = sizeof loopback_intf,
.bDescriptorType = USB_DT_INTERFACE,
.bNumEndpoints = 1,
.bInterfaceClass = USB_CLASS_VENDOR_SPEC,
.iInterface = STRING_LOOPBACK,
};
/* static strings, in UTF-8 */
#define STRING_MANUFACTURER 25
#define STRING_PRODUCT 42
#define STRING_SERIAL 101
#define STRING_SOURCE_SINK 250
#define STRING_LOOPBACK 251
static char manufacturer[50];
/* default serial number takes at least two packets */
static char serial[] = "0123456789.0123456789.0123456789";
static struct usb_string strings[] = { //字符串描述符
{ STRING_MANUFACTURER, manufacturer, },
{ STRING_PRODUCT, longname, },
{ STRING_SERIAL, serial, },
{ STRING_LOOPBACK, loopback, },
{ STRING_SOURCE_SINK, source_sink, },
{ } /* end of list */
};
static struct usb_gadget_strings stringtab = {
.language = 0x0409, /* en-us */
.strings = strings,
};
static const struct usb_descriptor_header *fs_loopback_function[] = {
(struct usb_descriptor_header *) &loopback_intf,
(struct usb_descriptor_header *) &fs_sink_desc,
NULL,
};
static int
usb_zero_open (struct inode *inode, struct file *file) //打开设备
{
struct zero_dev *dev =
container_of (inode->i_cdev, struct zero_dev, cdev);
file->private_data = dev;
init_waitqueue_head (&dev->bulkrq);
return 0;
}
static int
usb_zero_release (struct inode *inode, struct file *file) //关闭设备
{
return 0;
}
static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
{
kfree(req->buf);
usb_ep_free_request(ep, req);
}
static struct usb_request *alloc_ep_req(struct usb_ep *ep, unsigned length)//分配请求
{
struct usb_request *req;
req = usb_ep_alloc_request(ep, GFP_ATOMIC);
if (req) {
req->length = length;
req->buf = kmalloc(length, GFP_ATOMIC);
if (!req->buf) {
usb_ep_free_request(ep, req);
req = NULL;
}
}
return req;
}
static void source_sink_complete(struct usb_ep *ep, struct usb_request *req)//请求完成函数
{
struct zero_dev *dev = ep->driver_data;
int status = req->status;
switch (status) {
case 0: /* normal completion */
if (ep == dev->out_ep) {
memcpy(dev->data, req->buf, req-> actual);//返回数据拷贝到req->buf中 //dev->data_size=req->length;
dev->data_size=req->actual; //实际长度为req-> actual需要确认
req >short_not_ok为0。参考gadget.h中关于usb_request结构的注释
}
break;
/* this endpoint is normally active while we're configured */
case -ECONNABORTED: /* hardware forced ep reset */
case -ECONNRESET: /* request dequeued */
case -ESHUTDOWN: /* disconnect from host */
printk("%s gone (%d), %d/%d\n", ep->name, status,
req->actual, req->length);
case -EOVERFLOW: /* buffer overrun on read means that
* we didn't provide a big enough
* buffer.
*/
default:
#if 1
printk("%s complete --> %d, %d/%d\n", ep->name,
status, req->actual, req->length);
#endif
case -EREMOTEIO: /* short read */
break;
}
free_ep_req(ep, req);
wake_up_interruptible (&dev->bulkrq); //唤醒读函数
}
static struct usb_request *source_sink_start_ep(struct usb_ep *ep)//构造并发送读请求
{
struct usb_request *req;
int status;
//printk("in %s\n",__FUNCTION__);
req = alloc_ep_req(ep, 128);
if (!req)
return NULL;
memset(req->buf, 0, req->length);
req->complete = source_sink_complete; //请求完成函数
status = usb_ep_queue(ep, req, GFP_ATOMIC); //递交请求
if (status) {
struct zero_dev *dev = ep->driver_data;
printk("start %s --> %d\n", ep->name, status);
free_ep_req(ep, req);
req = NULL;
}
return req;
}
ssize_t
usb_zero_read (struct file * file, const char __user * buf, size_t count,loff_t * f_pos) //读设备
{
struct zero_dev *dev =file->private_data;
struct usb_request *req;
int status;
struct usb_ep *ep;
struct usb_gadget *gadget = dev->gadget;
ssize_t ret = 0;
int result;
ep=dev->out_ep;
source_sink_start_ep(ep);//构造、递交读请求
if (count < 0)
return -EINVAL;
interruptible_sleep_on (&dev->bulkrq);//睡眠,等到请求完成
if (copy_to_user (buf,dev->data,dev->data_size)) //拷贝读取的数据到用户空间
{
ret = -EFAULT;
}
else
{
ret = dev->data_size;
}
return ret;
}
struct file_operations usb_zero_fops = {
.owner = THIS_MODULE,
.read = usb_zero_read,
.open = usb_zero_open,
.release = usb_zero_release,
};
static void
usb_zero_setup_cdev (struct zero_dev *dev, int minor)//注册字符设备驱动
{
int err, devno = MKDEV (usb_zero_major, minor);
cdev_init(&dev->cdev, &usb_zero_fops);
dev->cdev.owner = THIS_MODULE;
err = cdev_add (&dev->cdev, devno, 1);
if (err)
printk ("Error adding usb_rcv\n");
}
static void zero_setup_complete(struct usb_ep *ep, struct usb_request *req)//配置端点0的请求
完成处理
{
if (req->status || req->actual != req->length)
printk("setup complete --> %d, %d/%d\n",
req->status, req->actual, req->length);
}
static void zero_reset_config(struct zero_dev *dev) //复位配置
{
usb_ep_disable(dev->out_ep);
dev->out_ep = NULL;
}
static void zero_disconnect(struct usb_gadget *gadget)//卸载驱动时被调用,做一些注销工作
{
struct zero_dev *dev = get_gadget_data(gadget);
unsigned long flags;
unregister_chrdev_region (MKDEV (usb_zero_major, 0), 1);
cdev_del (&(dev->cdev));
zero_reset_config(dev);
printk("in %s\n",__FUNCTION__);
}
static int config_buf(struct usb_gadget *gadget,
u8 *buf, u8 type, unsigned index)
{
//int is_source_sink;
int len;
const struct usb_descriptor_header **function;
int hs = 0;
function =fs_loopback_function;//根据fs_loopback_function得到长度
//此处len=配置9+1个接口9+1个端点7=25
len = usb_gadget_config_buf(&loopback_config,
buf, USB_BUFSIZ, function);
if (len < 0)
return len;
((struct usb_config_descriptor *) buf)->bDescriptorType = type;
return len;
}
static int set_loopback_config(struct zero_dev *dev)
{
int result = 0;
struct usb_ep *ep;
struct usb_gadget *gadget = dev->gadget;
ep=dev->out_ep;
const struct usb_endpoint_descriptor *d;
d = &fs_sink_desc;
result = usb_ep_enable(ep, d); //激活端点
//printk("");
if (result == 0) {
printk("connected\n"); //如果成功打印“connected”
}
else
printk("can't enable %s, result %d\n", ep->name, result);
return result;
}
static int zero_set_config(struct zero_dev *dev, unsigned number)
{
int result = 0;
struct usb_gadget *gadget = dev->gadget;
result = set_loopback_config(dev);//激活设备
if (result)
zero_reset_config(dev); //复位设备
else {
char *speed;
switch (gadget->speed) {
case USB_SPEED_LOW: speed = "low"; break;
case USB_SPEED_FULL: speed = "full"; break;
case USB_SPEED_HIGH: speed = "high"; break;
default: speed = " "; break;
}
}
return result;
}
/***
zero_setup完成USB设置阶段和具体功能相关的交互部分
***/
static int
zero_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
{
struct zero_dev *dev = get_gadget_data(gadget);
struct usb_request *req = dev->req;
int value = -EOPNOTSUPP;
u16 w_index = le16_to_cpu(ctrl->wIndex);
u16 w_value = le16_to_cpu(ctrl->wValue);
u16 w_length = le16_to_cpu(ctrl->wLength);
/* usually this stores reply data in the pre-allocated ep0 buffer,
* but config change events will reconfigure hardware.
*/
req->zero = 0;
switch (ctrl->bRequest) {
case USB_REQ_GET_DESCRIPTOR: //获取描述符
if (ctrl->bRequestType != USB_DIR_IN)
goto unknown;
switch (w_value >> 8) {
case USB_DT_DEVICE: //获取设备描述符
value = min(w_length, (u16) sizeof device_desc);
memcpy(req->buf, &device_desc, value);
break;
case USB_DT_CONFIG: //获取配置注意会根据fs_loopback_function读取到接口、端点描述符注意通过config_buf完成读取数据及数量的统计。
value = config_buf(gadget, req->buf,
w_value >> 8,
w_value & 0xff);
if (value >= 0)
value = min(w_length, (u16) value);
break;
case USB_DT_STRING:
value = usb_gadget_get_string(&stringtab,
w_value & 0xff, req->buf);
if (value >= 0)
value = min(w_length, (u16) value);
break;
}
break;
case USB_REQ_SET_CONFIGURATION:
if (ctrl->bRequestType != 0)
goto unknown;
spin_lock(&dev->lock);
value = zero_set_config(dev, w_value);//激活相应的端点
spin_unlock(&dev->lock);
break;
default:
unknown:
printk(
"unknown control req%02x.%02x v%04x i%04x l%d\n",
ctrl->bRequestType, ctrl->bRequest,
w_value, w_index, w_length);
}
/* respond with data transfer before status phase */
if (value >= 0) {
req->length = value;
req->zero = value < w_length;
value = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);//通过端点0完成setup
if (value < 0) {
printk("ep_queue --> %d\n", value);
req->status = 0;
zero_setup_complete(gadget->ep0, req);
}
}
/* device either stalls (value < 0) or reports success */
return value;
}
static void zero_unbind(struct usb_gadget *gadget) //解除绑定
{
struct zero_dev *dev = get_gadget_data(gadget);
printk("unbind\n");
unregister_chrdev_region (MKDEV (usb_zero_major, 0), 1);
cdev_del (&(dev->cdev));
/* we've already been disconnected ... no i/o is active */
if (dev->req) {
dev->req->length = USB_BUFSIZ;
free_ep_req(gadget->ep0, dev->req);
}
kfree(dev);
set_gadget_data(gadget, NULL);
}
static int __init zero_bind(struct usb_gadget *gadget) //绑定过程
{
struct zero_dev *dev;
struct usb_ep *ep;
int gcnum;
usb_ep_autoconfig_reset(gadget);
ep = usb_ep_autoconfig(gadget, &fs_sink_desc);//根据端点描述符及控制器端点情况,分配一个合适的端点。
if (!ep)
goto enomem;
EP_OUT_NAME = ep->name; //记录名称
gcnum = usb_gadget_controller_number(gadget);//获得控制器代号
if (gcnum >= 0)
device_desc.bcdDevice = cpu_to_le16(0x0200 + gcnum);//赋值设备描述符
else {
pr_warning("%s: controller '%s' not recognized\n",
shortname, gadget->name);
device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
}
dev = kzalloc(sizeof(*dev), GFP_KERNEL); //分配设备结构体
if (!dev)
return -ENOMEM;
spin_lock_init(&dev->lock);
dev->gadget = gadget;
set_gadget_data(gadget, dev);
dev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);//分配一个请求
if (!dev->req)
goto enomem;
dev->req->buf = kmalloc(USB_BUFSIZ, GFP_KERNEL);
if (!dev->req->buf)
goto enomem;
dev->req->complete = zero_setup_complete;
dev->out_ep=ep; //记录端点就是接收host端数据的端点
printk("name=%s\n",dev->out_ep->name); //打印出这个端点的名称
ep->driver_data=dev;
device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
usb_gadget_set_selfpowered(gadget);
gadget->ep0->driver_data = dev;
snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
init_utsname()->sysname, init_utsname()->release,
gadget->name);
/**************************字符设备注册*******************/
dev_t usb_zero_dev = MKDEV (usb_zero_major, 0);
int result = register_chrdev_region (usb_zero_dev, 1, "usb_zero");
if (result < 0)
{
printk (KERN_NOTICE "Unable to get usb_transfer region, error %d\n",result);
return 0;
}
usb_zero_setup_cdev (dev, 0);
return 0;
enomem:
zero_unbind(gadget);
return -ENOMEM;
}
/*-------------------------------------------------------------------------*/
static struct usb_gadget_driver zero_driver = { //gadget驱动的核心数据结构
#ifdef CONFIG_USB_GADGET_DUALSPEED
.speed = USB_SPEED_HIGH,
#else
.speed = USB_SPEED_FULL,
#endif
.function = (char *) longname,
.bind = zero_bind,
.unbind = __exit_p(zero_unbind),
.setup = zero_setup,
.disconnect = zero_disconnect,
//.suspend = zero_suspend, //不考虑电源管理的功能
//.resume = zero_resume,
.driver = {
.name = (char *) shortname,
.owner = THIS_MODULE,
},
};
MODULE_AUTHOR("David Brownell");
MODULE_LICENSE("GPL");
static int __init init(void)
{
return usb_gadget_register_driver(&zero_driver); //注册驱动调用bind绑定到控制器
}
module_init(init);
static void __exit cleanup(void)
{
usb_gadget_unregister_driver(&zero_driver); //注销驱动通常会调用到unbind解除绑定 //在s3c2410_udc.c中调用的是disconnect方法
}
module_exit(cleanup);
三、总结
时间关系上面的代码没有做太多的优化但功能都是测试通过。希望能给大家的学习提供一点帮助。最后想谈谈学习USB驱动的一些方法。
USB驱动比较难掌握主要原因是
复杂的USB协议包括USB基本协议、类规范等
控制器包括主机端、设备端。控制器本身相对复杂,其对应的主、从控制器驱动比较复杂
Hub功能及驱动、管理程序比较复杂
需要专业的硬件测试工具,硬件信号调试较困难
主、从端上层驱动程序本身不难,但由于对硬件不理解,及不好编写测试程序。所以往往望而却步。 我觉得学习USB驱动前应该有一个比较好的思路个人建议可以按下面的过程学习
熟悉USB协议。不用看完所有的协议重点关注一些概念、配置过程及数据包格式

View File

@@ -0,0 +1,280 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-01T22:23:48+08:00
====== USB gadget设备驱动解析3 ======
Created Thursday 01 December 2011
Linux USB 设备端驱动有两部分组成。一部分是USB 设备控制器(USB Device Controller, UDC)驱动、另一部分是硬件无关的功能驱动鼠标、u盘、usb串口、usb网络等也可以分为3层的分别是Controller Drivers、Gadget Drivers、Upper Layers大概意思都差不多。
一、控制器(USB Device Controller, UDC)驱动
Gadget 框架提出了一套标准 API, 在底层, USB 设备控制器驱动则实现这一套 API, 不同的 UDC需要不同的驱动 甚至基于同样的 UDC 的不同板子也需要进行代码修改。这一层是硬件相关层。
Linux 标准内核里支持各种主流 SOC 的 udc 驱动S3C2410、PXA270等。你可以通过内核直接配置支持。你也可以通过修改它们获取更高的效率。如s3c2410_uda.c 中并没有利用到控制器的dma功能你可以根据需要修改它。
要理解UDC驱动代码就必须对相应的硬件控制器熟悉。当然如果你对此不感兴趣或没时间熟悉也可以暂时跳过对硬件相关部分。本文也侧重于对软件结构的描述不关心硬件细节。
下面给出在UDC驱动中涉及到的一些关键数据结构及API参考s3c2410_uda.c
1.关键的数据结构及API
gadget api 提供了usb device controller 驱动和上层gadget驱动交互的接口。下面列出一些关键的数据结构。
struct usb_gadget {//代表一个UDC设备
/* readonly to gadget driver */
const struct usb_gadget_ops *ops; //设备的操作集
struct usb_ep *ep0; //ep0USB协议中的端点0, 处理setup()请求
struct list_head ep_list; /* of usb_ep */本设备支持的端点链表
enum usb_device_speed speed; //如USB_SPEED_LOW、USB_SPEED_FULL等
unsigned is_dualspeed:1; //支持full/high speed
unsigned is_otg:1; //OTG的特性
unsigned is_a_peripheral:1; //当前是A-peripheral而不是A-host
unsigned b_hnp_enable:1;
unsigned a_hnp_support:1;
unsigned a_alt_hnp_support:1;
const char *name;
struct device dev;
};
struct usb_gadget_driver {//代表一个gadget设备driverfile_storage.c中的fsg_driver
//又如如zero.c中的zero_driver
char *function; //一个字符串,如"Gadget Zero"
enum usb_device_speed speed;
int (*bind)(struct usb_gadget *);
void (*unbind)(struct usb_gadget *);
int (*setup)(struct usb_gadget *,
const struct usb_ctrlrequest *);
void (*disconnect)(struct usb_gadget *);
void (*suspend)(struct usb_gadget *);
void (*resume)(struct usb_gadget *)
/* FIXME support safe rmmod */
struct device_driver driver;
};
struct usb_gadget_ops {//代表设备的操作集
int (*get_frame)(struct usb_gadget *);
int (*wakeup)(struct usb_gadget *);
int (*set_selfpowered) (struct usb_gadget *, int is_selfpowered);
nt (*vbus_session) (struct usb_gadget *, int is_active);
int (*vbus_draw) (struct usb_gadget *, unsigned mA);
int (*pullup) (struct usb_gadget *, int is_on);
int (*ioctl)(struct usb_gadget *,
unsigned code, unsigned long param);
};
struct usb_ep {//代表一个端点
void *driver_data //
...
const struct usb_ep_ops *ops; //端点的操作集,如上
struct list_head ep_list; //gadget的所有ep的list
...
};
struct usb_ep_ops {//表示端点的操作集
...
int (*queue) (struct usb_ep *ep, struct usb_request *req,
gfp_t gfp_flags); //将一个usb_request提交给endpoint
//是数据传输的关键函数
...
};
struct usb_request {//表示一个传输的请求这与usb host端的urb类似
void *buf;
unsigned length;
dma_addr_t dma;
unsigned no_interrupt:1;
unsigned zero:1;
unsigned short_not_ok:1;
void (*complete)(struct usb_ep *ep,
struct usb_request *req);
void *context;
struct list_head list;
int status;
unsigned actual;
};
上述结构中具体每项的含义可以参考http://tali.admingilde.org/linux-docbook/gadget/
struct usb_request
在http://tali.admingilde.org/linux-docbook/gadget/re02.html中
Name
struct usb_request — describes one i/o request
Synopsis
struct usb_request {
void * buf;
unsigned length;
dma_addr_t dma;
unsigned no_interrupt:1;
unsigned zero:1;
unsigned short_not_ok:1;
void (* complete) (struct usb_ep *ep,struct usb_request *req);
void * context;
struct list_head list;
int status;
unsigned actual;
};
Members
buf
Buffer used for data. Always provide this; some controllers only use PIO, or don't use DMA for some endpoints.
length
Length of that data
dma
DMA address corresponding to 'buf'. If you don't set this field, and the usb controller needs one, it is responsible for mapping and unmapping the buffer.
no_interrupt
If true, hints that no completion irq is needed. Helpful sometimes with deep request queues that are handled directly by DMA controllers.
zero
If true, when writing data, makes the last packet be “short” by adding a zero length packet as needed;
short_not_ok
When reading data, makes short packets be treated as errors (queue stops advancing till cleanup).
complete
Function called when request completes, so this request and its buffer may be re-used. Reads terminate with a short packet, or when the buffer fills, whichever comes first. When writes terminate, some data bytes will usually still be in flight (often in a hardware fifo). Errors (for reads or writes) stop the queue from advancing until the completion function returns, so that any transfers invalidated by the error may first be dequeued.
context
For use by the completion callback
list
For use by the gadget driver.
status
Reports completion code, zero or a negative errno. Normally, faults block the transfer queue from advancing until the completion callback returns. Code “-ESHUTDOWN” indicates completion caused by device disconnect, or when the driver disabled the endpoint.
actual
Reports bytes transferred to/from the buffer. For reads (OUT transfers) this may be less than the requested length. If the short_not_ok flag is set, short reads are treated as errors even when status otherwise indicates successful completion. Note that for writes (IN transfers) some data bytes may still reside in a device-side FIFO when the request is reported as complete.
Description
These are allocated/freed through the endpoint they're used with. The hardware's driver can add extra per-request data to the memory it returns,whichoften avoids separate memory allocations (potential failures), later when the request is queued.
Request flags affect request handling, such as whether a zero length packet is written (the “zero” flag), whether a short read should be treated as anerror (blocking request queue advance, the “short_not_ok” flag), or hinting that an interrupt is not required (the “no_interrupt” flag, for use with deeprequest queues).
Bulk endpoints can use any size buffers, and can also be used for interrupt transfers. interrupt-only endpoints can be much less functional.
2、为USB gadget功能驱动提供的注册、注销函数
EXPORT_SYMBOL(usb_gadget_unregister_driver); //注销一个USB gadget功能驱动
EXPORT_SYMBOL(usb_gadget_register_driver);//注册一个USB gadget功能驱动
二、USB gadget功能驱动
如果内核已经支持了SOC的UDC驱动很多时候我们可以只关心这部分代码的编写。那么我们如何编写出一个类似usb 功能驱动呢?
usb 功能驱动应该至少要实现如下功能:
. 实现USB协议中端点0部分和具体功能相关的部分UDC驱动无法帮我们完成的部分。如USB_REQ_GET_DESCRIPTOR、USB_REQ_GET_CONFIGURATION等
完成了这个功能以后USB主机端系统就会设别出我们是一个什么样的设备。
. 实现数据交互功能
即如何实现向硬件控制器的端点发出读、写请求来完成数据交互;
. 具体功能的实现如如何实现一个usb net驱动或是一个usb storage驱动。
接下来以zero.c为例说明这3个方面是如何实现的。
1、zero设备介绍
作为一个简单的 gadget 驱动zero 的功能基于两个 BULK 端点实现了简单的输入输出功能, 它可以用作写新的 gadget 驱动的一个实例。
两个 BULK 端点为一个 IN 端点, 一个 OUT端点。基于这两个由底层提供的端点g_zero 驱动实现了两个 configuration。 第一个 configuration 提供了 sink/source功能两个端点一个负责输入一个负责输出其中输出的内容根据设置可以是全0也可以是按照某种算法生成的数据。另一个 configuration 提供了 loopback 接口, IN 端点负责把从 OUT 端点收到的数据反馈给 Host.
2、zero设备注册、注销
static int __init init(void)
{
return usb_gadget_register_driver(&zero_driver);
}
module_init(init);
static struct usb_gadget_driver zero_driver = {
#ifdef CONFIG_USB_GADGET_DUALSPEE
.speed = USB_SPEED_HIGH,
#else
.speed = USB_SPEED_FULL,
#endif
.function = (char *) longname,
.bind = zero_bind,
.unbind = __exit_p(zero_unbind),
.setup = zero_setup,
.disconnect = zero_disconnect,
.suspend = zero_suspend,
.resume = zero_resume,
.driver = {
.name = (char *) shortname,
.owner = THIS_MODULE,
},
};
构建一个usb_gadget_driver调用usb_gadget_register_driver注册函数即可注册一个usb gadget驱动。需要注意的是目前S3C2410主机控制器只能注册一个gadget功能驱动。这主要是由协议决定的。参考s3c2410_udc.c中的这段代码
int usb_gadget_register_driver(struct usb_gadget_driver *driver)
{……
if (udc->driver)//如果已经注册过了
return -EBUSY;
……
}
3、usb_gadget_driver结构
事实上我们的工作就是构建这个usb_gadget_driver结构。那么这个结构这样和我们上面要实现的3个目标联系起来呢。
. Setup zero_setup
处理host端发来的request处理host端发来的get_descriptor请求。 在这实现了前面提到的必须要实现的第一个功能。
. bind zero_bind
绑定dev与driver,在gadget driver注册驱动时被usb_gadget_register_driver调用绑定之后driver才能处理setup请求
另外通过usb_ep_autoconfig函数可以分配到名为EP_IN_NAME、EP_OUT_NAME两个端点。后面可以对两个端点发起数据传输请求和USB 主机端的urb请求非常相似大家可以和urb对照一些。
发起数据请求大致有以下几步:
struct usb_request *req;
req = alloc_ep_req(ep, buflen);//分配请求数据传输的方向由ep本身决定
req->complete = source_sink_complete; //请求完成后的处理函数
status = usb_ep_queue(ep, req, GFP_ATOMIC);//递交请求
free_ep_req(ep, req);//释放请求通常在请求处理函数complete中调用
. 通常在bind和unbind函数中注册具体的功能驱动
如果为了实现某个特定功能需要在设备端注册字符、块、网络设备驱动的话,选择的场
合通常是bind中注册unbind中卸载。如ether.c文件中
static int __init
eth_bind (struct usb_gadget *gadget)
{
……
status = register_netdev (dev->net); //注册网卡驱动
……
}
static void /* __init_or_exit */
eth_unbind (struct usb_gadget *gadget)
{
……
unregister_netdev (dev->net); //注销网卡驱动
……
}
这也让我们对在设备端实现一个字符、块、网络驱动的结构有了一些了解。
总结
本文对gadget的驱动结构做了简要的介绍。下一篇将介绍如何编写一个简单的gadget驱动及应用测试程序。

View File

@@ -0,0 +1,364 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-29T17:21:29+08:00
====== freescale LTIB使用总结 ======
Created Tuesday 29 November 2011
http://blog.chinaunix.net/space.php?uid=12077574&do=blog&id=145099
这里附上很久以前写的LTIB使用总结学习资料主要来自飞思卡尔的板子MPC8349E-mITXE板子的资料主要参考了<readme>,写的不是很详细,而且后来发现中间还有部分错误,不过懒得再修改了。
板级支持包BSP的下载http://www.freescale.com/powerbsp 搜索MPC8349E-mITXE,注册下载即可.
写在前面
符号'##'后面语句均为注释
需要做的操作命令以 '$' 或 '#'开头,且都位于一行的开始
以下绝大部分操作是针对于我们的开发主机(PC),其他是针对于开发板(MPC8349itx)
对于主机上的操作,所说目录路径是相对于/usr/local/mpc8349/mytest/来描述的
开发主机的系统为redhat9开发板通过串口1连接主机终端工具为minicom
在主机上使用的普通用户名为liuby用户主目录为/home/liuby/
符号'<<'和'>>'之间的内容表示随开发板自带的文件名
由于这是一个介绍ltib使用并涉及相关部分的文档所以呢首先来介绍一下ltib的安装
## 首先将**linux_BSP光盘**放入光驱然后以root用户挂载
$ su - root ## 切换身份到root用户需要root用户密码
# mount /dev/cdrom /mnt/cdrom -o loop ## 挂载光驱
# cp -rf /mnt/cdrom/ltib-mpc8349e-mitx /home/liuby/ ## copy到liuby的主目录下
# umount /mnt/cdrom ## 卸载光盘
# mkdir -m 777 /usr/local/mpc8349 ## 创建安装ltib的根目录
$ cd /usr/local/mpc8349/ ## 进入mpc8349目录是因为默认安装到当前工作目录
$ /home/liuby/ltib-mpc8349e-mitx/__install__ ## 这个会有个提示询问你是否接受install
## 输入'Y'接受install回答'yes' 接受 EULA
## 照上面操作,安装结束后的文件为/usr/local/mpc8349/**ltib-mpc8349itx-20070221/**
## 此位置下的doc/*文档有各种说明
## 下面进行安装,首先是**小文件系统**形式
$ cp -a ltib-mpc8349itx-20070221 small ## 这个只是复制,名字任意起的
$ cd small ## 进入到small目录下
$ ./ltib **--preconfig** config/platform/mpc8349itx/defconfig-min-fs --batch ## 开始build
## 此目录开始安装host支持包第一次安装可能时间会长些half an hour? maybe.
## 若发生错误,查看日志文件/usr/local/mpc8349/small/host_config.log
## 此编译的是小文件系统**rootfs.ext2.gz.uboot**并在rootfs下产生文件系统
## 只编译了文件系统没有内核镜像没有uboot镜像
## rootfs作为NFS输出目录(NFS-exported),是目标板的根文件系统
## 此编译用的是**uclibc**的库
## 建立交叉编译环境若想使用powerpc-linux-gcc自动补全功能需# vi /etc/bashrc在最后添加一句export PATH=/opt/freescale/usr/local/gcc-3.4.3-uClibc-0.9.28-1/powerpc-linux /bin:$PATH最后重启后可用# echo $PATH来查看环境变量中是否有/opt/mtwk/usr/local/powerpc-linux/gcc-3.4.3-glibc-2.3.3 /bin路径变量。
## 编译完毕会给出信息提示,然后继续完成下面的操作
$ cd .. ## 回到/usr/local/mpc8349/目录下
## 下面进行安装,这次是**大文件系统**形式
$ cp -a ltib-mpc8349itx-20070221 large ## 这个只是复制,名字任意起的
$ cd large ## 进入large目录下
$ ./ltib ## 开始了大文件系统的build
## 编译后的rootfs.ext2.gz.uboot会大很多并产生rootfs下文件系统
## 此次编译了**uboot内核和文件系统镜像**(难怪叫"the hard disk based file system")
## 编译后的u-boot,u-boot.bin,uImage(bootable_kernel),vmlinux,System.map,vsc7385_load.bin,linux.config在rootfs/boot/下
## 此次编译用的是glibc的库
## 调用的配置文件为config/platform/mpc8349itx/**.config**
## 注:文件夹ltib-mpc8349itx-20070221只是用来复制我们没做任何操作为何? 备份用的
## 注:当small或large下我们编译总是不成功时备份的作用就来了当然这是笨方法新手嘛值得原谅!
## 至此已经完成,下面是为了写这个文档而安装
$ cd /usr/local/mpc8349/ ## 进入未来工作目录的上一级
$ cp -a ltib-mpc8349itx-20070221 mytest ## 未来的工作目录诞生了
$ ./ltib --preconfig config/platform/mpc8349itx/defconfig-min-fs --batch
## 编译完毕,我的准备工作就结束了
## 后面的大多数介绍操作都是在此目录下(/usr/local/mpc8349/mytest/)
下面略述一种简单有效的方法编译内核和文件系统并顺便介绍ltib核心工作流程和思想然后再部分详述。
需要__修改内核或文件系统__并编译时一个比较简单的方法是利用自带的配置文件(eg:defconfig-min-fs),综述如下:
$ ./ltib --preconfig config/platform/mpc8349itx/defconfig-min-fs
## 此配置默认不编译bootloader: [ ] Build a boot loader
## 此配置文件默认编译时不能修改配置内核:(X) Dont build the Linux kernel
## 若想修改此配置:
## 若需要编译bootloader请找到并选中 [*] Build a boot loader
## 若要编译内核,请找到并选中 kernel (linux 2.6.13.4) ---> (X) linux 2.6.13.4 其__内核的默认配置文件__为 **nas_linux-2.6.13.4-mpc8349itx.config**
## 若要修改内核的默认文件为其他,请找到 kernel config file回车输入相应的配置文件名其默认目录为config/platform/mpc8349itx/
## 若想在编译时并修改内核,请找到并选中 [*] Configure the kernel
## 若想**修改文件系统**,添加或删除程序包,请进入 Package list ---> 并选中相应的包
## 若想修改**busybox**选项配置,请进入并选中 Package list ---> [*] Configure busybox at build time
## 其他目标系统配置、目标镜像生成选项配置类似。
## (解释)Load an Alternate Configuration File选项是选则一个已有的配置文件来自动配置各个选项
## Save Configuration to an Alternate File选项是将当前的配置信息保存为一个命名的文件名(eg:defconfig.liuby.today804)
## 最后退出时会弹出对话框选择Yes保存默认保存到config/platform/mpc8349itx/,名字是上面的命名
## 开始编译
## 附注:同时生成的配置文件也会另存为** defconfig.dev**(在config/platform/mpc8349itx/下)
## 再附注:defconfig.liuby.today804同样存在。
## 再再附注: 按键请看说明,主要包括上下左右键、空格、回车、搜索键(s)、ESC键。
## NB: 按ESC键要注意次数多按容易前功尽弃!
## 上面的操作做完后开始编译,假如选择了编译时配置内核,会弹出**内核的配置对话框**可用用上面类似的方法修改配置以添加8021Q模块支持为例
## 添加8021Q: 进入 Networking ---> [*] Networking support / Networking options ---> <*> 802.1Q VLAN Support (注:<M>是编译为模块的形式)
## 类似可以删除NTFS支持模块 < >NTFS file system support (注:以此为例是因为现在用不到NTFS)
## 检查是否支持NFS(注:写此是因为开发常用,不详写)
## 类似上面将内核配置信息保存为一个文件
## 内核开始编译
## 附注:生成的__内核配置文件__为 **nas_linux-2.6.13.4-mpc8349itx.config.dev**(在config/platform/mpc8349itx/下)
## 内核编译完成后开始选择程序包的编译如果选择了编译时配置busybox会弹出 BusyBox Configuration 配置对话框,配置和上面一样,下面随便举一例:
## 如删除fdisk工具编译进入Linux System Utilities去除选项 [ ] fdisk
## 如添加mount工具的nfs选项支持进入并选中 Linux System Utilities ---> [*] Support mounting NFS file systems
## 类似上面将busybox**配置信息**保存为一个文件
## busybox开始编译
## 附注: busybox是linux常用命令工具集可根据开发需要选择需要的命令工具
## 附注: 若不改文件名,生成的配置文件为**busybox.config**(在config/platform/mpc8349itx/下)
## 若是想向文件系统里添加自己写的应用程序或shell脚本。需要将相应的文件copy到**config/platform/mpc8349itx /merge/**文件夹下,此文件夹下的文件在开发板上相当于位于根文件系统下面。若想将程序烧进开发板后,开发板上电能自动执行程序或脚本,可以修改 config/platform/mpc8349itx/merge/etc/rc.d/rcS。注:此步操作需要在开始编译内核和文件系统之前做好。
## 以添加vlan配置模块vlan.ko和添加vlan及配置脚本vlan_config.sh为例:
## 在config/platform/mpc8349itx/merge/下创建一个文件夹(eg: mypro)
## 将vlan.ko和vlan_config.sh添加到新建文件夹下config/platform/mpc8349itx/merge/mypro/下,配置好权限
## 在config/platform/mpc8349itx/merge/etc/rc.d/rcS最后添加运行脚本和程序的语句(后面详细介绍)
==== 下面分别描述内核修改配置以文件系统添加应用程序和脚本 ====
在需要修改内核配置比如为内核添加编译新的模块功能时该如何完成下面以将支持8021Q VLAN协议的模块编译进我们需要的内核中为例来演示:
##首先按照前面所说的简单快捷的方式,执行命令:
$ ./ltib --preconfig config/platform/mpc8349itx/defconfig-min-fs
## defconfig-min-fs是安装ltib后的自带文件并没做修改。
## 在弹出的对话框中,通过上下键移动光标到 Choose your Kernel / kernel (**Dont build the Linux kernel**) 回车进入内核选择对话框,移动光标按空格键选中我们需要的内核 (X) linux 2.6.13.4,内核配置文件暂不修改,使用默认的。
## 为了能添加我们需要的8021Q支持模块需要修改内核的配置移动光标按空格键选中 [*] Configure the kernel这样在编译时可以修改其配置。
## 移动光标到Save Configuration to an Alternate File回车输入我们想将目前配置保存的文件名为defconfig-min-fs-modified任何回车。
## 左右移动光标到最下面的Exit弹出对话框询问是否保存配置文件选择'Yes'
## ltib开始根据配置进行工作。
## 很快又会弹出新的对话框 Linux Kernel Configuration
## 下面需要修改内核配置添加8021Q
## 移动光标选中 Networking ---> 回车弹出新的对话框,移动光标到 [*] Networking support 下面一行 Networking options ---> 然后回车,又弹出对话框,向下移动光标,按空格两次选中<*> 802.1Q VLAN Support 将其编译进我们需要的内核中。
## 然后按两次ESC回到Linux Kernel Configuration的主界面
## 移动光标选中 Save Configuration to an Alternate File 回车输入当前配置的保存名字 nas_linux-2.6.13.4-mpc8349itx.config-modified
## 左右移动光标选中最下面的Exit弹出对话框询问是否保存配置文件选中'Yes'
## ltib调用当前的配置信息编译内核。
当我们写好了开发板上的应用程序,并且已经做好了各种测试,需要烧写到板子,达到上电时应用程序已经在板子上了,甚至是可以开机自动运行,该如何操作呢,下面讲述
===== 如何向开发板添加应用程序及需要的脚本 =====
以添加VLAN配置模块vlan.ko和添加VLAN编号并配置ip的脚本 vlan_config.sh:
## 首先需要明白config/platform/mpc8349itx/merge/下面的各种文件就是通过编译后成为**开发板文件系统的一部分**,并且此文件夹下的文件就相当于位于开发板的根目录下。
## 在文件夹config/platform/mpc8349itx/merge/创建一个文件夹ourpro再将我们之前编译的VLAN配置模块 vlan.ko以及脚本vlan_config.sh添加到刚才创建的文件夹config/platform/mpc8349itx/merge /ourpro/下(用命令为mkdir,cp)
## 在config/platform/mpc8349itx/merge/etc/rc.d/rcS最后添加如下几句(可用命令vi完成)
+++++++++++下面为添加内容++++++++++++++
if [ $mode = "start" ]
then
if [ -x /ourpro/vlan_config.sh ]
then
/ourpro/vlan_config.sh
fi
fi
+++++++++++上面为添加内容++++++++++++++
## 附:vlan_config.sh脚本内容
++++++++++++下面为vlan_config.sh脚本内容++++++++++++++++
#!/bin/sh
# This script is used to add vlan configuration module
# and config eth1 with vlan-id and the relevant ip.
# date: Wed Aug 6 17:00:18 CST 2008
echo "Now start to config vlan ,please have patience. ^_^ "
echo "boot eth1 now"
ifconfig eth1 up
sleep 3
echo "insmod /ourpro/vlan.ko "
if [ -f /ourpro/vlan.ko ]
then
insmod /ourpro/vlan.ko
rmmod /ourpro/vlan.ko
usleep 100000
echo "Config vlan-name(1:6) ipaddr & netmask"
for x in 1 2 3 4 5 6
do
vconfig add eth1 $x
ifconfig eth1.$x 192.168.$x.1 netmask 255.255.255.0 up
echo eth1.$x 192.168.$x.1 netmask 255.255.255.0 up
done
echo "DONE. You can test vlan now. ^_^"
exit 0
fi
echo "Not found /ourpro/vlan.ko"
exit 0
++++++++++++上面为vlan_config.sh脚本内容++++++++++++++++
## 在以上操作中要注意权限的设置
## 要添加的文件和脚本,以及配置做好,可**以编译文件系统**了我们可以使用上面编译内核所生成的配置defconfig-min-fs-modified
$ ./ltib --preconfig config/platform/mpc8349itx/defconfig-min-fs-modified
## 首先弹出对话框 LTIB: Freescale MPC8349E-mITX board
## 若不希望再编译内核,移动光标到--- Choose your Kernel下面一行 kernel (linux 2.6.13.4) --->按空格进入弹出一个新的内核选择对话框kernel移动光标并按空格选中 (X) Dont build the Linux kernel 。若希望编译内核,则跳过此步。
## 此次操作我们选择编译内核,但不再编译时配置内核。
## 编译时不再配置内核选项,移动光标按空格去除选项 [ ] Configure the kernel。
## 移动光标到(nas_linux-2.6.13.4-mpc8349itx.config) kernel config file回车输入我们的内核配置文件nas_linux-2.6.13.4-mpc8349itx.config.dev确定返回到主对话框
## 移动光标到 Save Configuration to an Alternate File输入我们想保存为的文件名defconfig-min-fs-our-final
## 左右移动光标到< Exit >回车,然后会弹出是否保存新的配置文件,直接选择 < Yes > 回车
## 然后开始编译内核和文件系统
## 编译结束。
## 注:上面编译出的内核已经添加了8021Q内核模块文件系统里也包含vlan.ko和vlan_config.sh烧进开发板上电会自动执行vlan_config.sh实现添加vlan编号及配置ip信息。
## 文件夹rootfs/下的文件就相当于在开发板上看到的全部文件系统
## 我们需要的内核文件为rootfs/boot/uImage根文件系统文件为rootfs.ext2.gz.uboot
假如上面编译出来的内核文件和文件系统文件不小心删除了,或者文件遭到了破坏,需要重新编译,而且文件不需要变化的话,这里有一个比较简单的办法,执行如下命令可一次完成满足要求的内核和文件系统:
$ ./ltib --preconfig config/platform/mpc8349itx/defconfig-min-fs-our-final __--batch__
## 输入完这些命令回车就开始编译了中间不需要任何操作完全可以看会电影或者学学vim...,大约半小时后就可以看到你希望的结果 :)
上面编译出来的结果怎么知道一定是对的呢而且开发板的FLASH烧写都有次数限制一般情况下我们__不能随便烧写内核或文件系统到FLASH中__下面一个方法可以解决这一问题。
## 下面的方法是完全针对8349itx开发板出厂后设置未做修改时来完成的。
## 假如开发主机的ip地址为59.64.155.150开发板的ip地址59.64.155.79网关为59.64.155.1
## 开发主机上提供了__tftp服务__(参见另写的一篇笔记server.txt)其根目录为__/home/liuby/tftpboot/__
## 首先在tftp根目录下创建一个存放内核文件和根文件系统的目录down并将刚才编译的结果复制到此文件夹下
$ mkdir -m 777 /home/liuby/tftpboot/down
$ cp rootfs/boot/uImage /home/liuby/tftpboot/down/
$ cp rootfs.ext2.gz.uboot /home/liuby/tftpboot/down/
## 此时开发主机上的工作已经完成了,下面介绍开发板上需要做的工作
## 开发板的uboot默认有3秒的延迟来让我们确定是否进入操作系统在上电后uboot会给出一个提示:Hit any key to stop autoboot: 在这句后面的数字变为0之前按一下键盘。
## 在上一步按下键盘后终端上会出现uboot提示符 '=> '
=> getwayip=59.64.155.1
=> ipaddr=59.64.155.79
=> serverip=59.64.155.150
=> tftp_path=down
=> saveenv ## 保存uboot环境变量这样保存是为了方便__以后不再设置其参量__可不保存
## 一般不要修改uboot环境变量可参看<<MPC8349ITX_set-uboot-env.txt>>
=> run tftpramboot ## 下载内核和文件系统镜像到DDR memory中然后启动
## 系统启动后输入user id "root"with password "root"可以用ifconfig查看配置已经生效。好玩吧 ?!
## 也可以用"dmesg | grep -i 802"来查看内核是否支持8021Q
经过各种测试发现已经实现了所需要的功能我们想把这样的__内核和文件镜像固化到板子__上上面的办法显然不能满足要求了那有没有一个简单的办法呢答案是'有滴'只需要花几分钟时间就可以实现。LET'S START:
## 如上面介绍先把内核和文件系统镜像复制到tftp目录/home/liuby/tftpboot/down/下
## 下面的操作是在开发板启动后进入uboot提示符下进行
=> setenv bootdelay 3 ## 启动延迟3s
=> setenv loadaddr 200000 ## 下载到DDR内存中的起始地址
=> setenv kernaddr fe810000 ## flash中内核分配的起始地址
=> setenv ramdiskaddr fe9a0000 ## flash中文件系统分配的起始地址
=> setenv ipaddr 59.64.155.79
=> setenv netmask 255.255.255.0
=> setenv gatewayip 59.64.155.1
=> setenv serverip 59.64.155.150
=> setenv tftp_path=down ## 相对根目录的路径
## 以上操作都可以不做,保留下来只是想看看以前是多么菜,时光啊
=> tftpboot $loadaddr $tftp_path/uImage ## 下载内核镜像到DDR memory中
=> erase $kernaddr feefffff ## 擦除flash中为内核和文件系统分配的空间(起止地址之间)
=> cp.b $loadaddr $kernaddr $filesize ## 写内核到flash中filesize变量通过tftpboot获得
=> cmp.b $loadaddr $kernaddr $filesize ## 确认是否写错误
=> tftpboot $loadaddr $tftp_path/rootfs.ext2.gz.boot ## 下载小文件系统到DDR memory中
=> cp.b $loadaddr $ramdiskaddr $filesize ## 写文件系统到flash中
=> cmp.b $loadaddr $ramdiskaddr $filesize ## __确认__是否写错误
=> imls ## 确认写到flash中的镜像是否为有效的u-bootable镜像
=> boot ## 启动
## 系统上电发现就是我们想要实现的再重启发现仍然是心里默默地喊一个OH YEAH.
## 附一个常用的uboot命令吧: help 或者 ?
###### 附注:都快写到吐了,与烧写有关的不再写了,请参看<<Readme.txt>>,此文不是一般的强大。
下面再写一点ltib的常用命令参数吧虽然觉得对其编译内核和文件系统流程有了一定了解但是对其命令参数用过的还不是很多可以说是不甚了解下面介绍一些希望有用:
首先一个比较有用的命令参数就是help一个人忘记命令参数很常见何况刚开始熟悉这个工具。下面这个命令行可以查看ltib命令的使用帮助:
**$ ./ltib --help ** ## 这个等同于 ./ltib -h
在编译内核和文件系统时有时忘了我们选了哪些程序包来进行编译操作我们可以用下面的命令来查看__当前安装模式下所有可用的程序包__是否被选择编译进工程 :
$ ./ltib -m listpkgs ## 此命令是根据ltib的配置来显示
查看配置中已选编译的程序包,如内核版本包,系统工具包:
$ ./ltib -m listpkgs | grep ' y '
如果想看编译过程产生的信息并把这些信息也保存,以备以后查看,可用以下命令
$ ./ltib --preconfig config/platform/mpc8349itx/defconfig-min-fs-our-final --batch 2>&1 | tee ltib_log.txt
## 保存编译过程产生的信息及错误信息全部保存到ltib_log.txt文件中
ltib提供了一种__shell模式__它直接提供了我们当前配置的**交叉编译工具链模式**下面的命令能让我们进入ltib的shell环境
$ ./ltib -m shell ## 完成后会给出提示进入shell模式的提示符 'LTIB>'
## 输入exit可退出shell模式
## 下面的命令可以看一下这个有什么用,我直接给出命令,它下面就是这个命令的结果,不再解释
LTIB> gcc --version
powerpc-linux-uclibc-gcc (GCC) 3.4.3
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
LTIB>
有时候我们想看一下某些__程序包的源码__比如kernel、uboot等这些看了有益于身心健康的程序源码该怎么办呢? 还有一种情况就是这些源码中存放有板子的各种配置文件,比如内存映射分配,也需要看一下源码文件,其命令格式为
**$ ./ltib -m prep -p <program_package_name>**
## 下面这部分我是在large文件夹下操作所写路径也是相对于/usr/local/mpc8349/large/来写的而不是mytest文件夹下
## 例如我们要查看MPC8349ITX开发板上vsc7385的内存分配或查找VSC7385的驱动模块部分需要看uboot、内核源码以下命令得到内核源码
$ ./ltib -m prep -p kernel
## 解压后的内核源码位于rpm/BUILD/linux-2.6.13/
## 其中vsc7485的驱动是rpm/BUILD/linux-2.6.13/drivers/net/gianfar_phy.c
## 下面操作必须在原来的large文件夹下操作为什么这么做?自己思考吧。以下命令可以得到uboot源码
$ ./ltib -m prep -p u-boot
## 解压后得到的uboot源码位于rpm/BUILD/u-boot-1.1.3
## 其中有关MPC8349MITX板子配置信息的重要文件为/include/configs/MPC8349ITX.h
## 在上面的这个文件中可用看到VSC7385的内存分配基地址信息(#define CFG_VSC7385_BASE 0xF8000000)
## 不用uboot命令的话可参看一下源码帮助理解。
## 注:上面这段命令操作我之所以选择在/usr/local/mpc8349/large文件夹下是因为要得到某些程序源码首先它得编译过。
上面介绍了一个ltib编译内核和文件系统比较好用的办法当你比较熟悉了ltib工作流程完全__可以自己配置交叉编译工具链__内核和文件系统然后编译可以用下面这个命令行
$ ./ltib **--configure**
如果想重新产生所有内核和RFS镜像有以下三个办法:
## 办法一: 直**接调用配置文件编译**,如果配置文件没有更新,且编译过的目标镜像没有变化,会不进行编译。若有任何改动,会执行编译
$ ./ltib --preconfig config/platform/mpc8349itx/defconfig-min-fs-our-final --batch
## 办法二: 如办法一一样,但强制重新编译
$ ./ltib --preconfig config/platform/mpc8349itx/defconfig-min-fs-our-final --batch __-f__
## 办法三: 清除所有编译的程序包,然后重新配置编译镜像
$ ./ltib -m distclean ## 清除ltib工程文件
$ ./ltib --configure ## 重新配置编译
假如我们对**ltib的配置文件**不满意想自己通过配置操作来熟悉ltib的各种配置或者相关工作做完了甚至是看它不顺眼都可以采用此操作把LTIB完全卸载
## 首先执行命令:
$ ./ltib -m distclean ## 此操作将彻底清除所有当前ltib工程文件, 此命令不要轻易使用除非比较熟悉ltib编译配置过程
## 然后以root身份执行以下操作(注意:此操作将卸载所有的公共文件)
# rm -rf /opt/freescale/pkgs
# rm -rf /opt/freescale/ltib
# rm <install_path> ## 执行文件ltib的上级目录
## 另一种更加暴力的办法是root身份运行rm命令来删除所有
下面再写一下**外部内核模块**的编译假如我们有一个文件夹test(位于主目录/home/liuby/下)该文件夹包含程序源码文件test.c和Makefile这两个文件的内容附在此段内容的最后。
## 首先我们得到**内核源码**,然后再编译,为什么这么做,我也不懂~~~,有些纳闷,以后再解决
**$ ./ltib -m prep -p kernel**
$ ./ltib -m scbuild -p kernel ## 编译的镜像为rpm/BUILD/linux/arch/ppc/boot/images/uImage
## 将test文件夹copy到内核的driver文件夹下
$ cp -a ~/test rpm/BUILD/linux/drivers/
## vi修改driver文件夹下的Makefile
$ vi rpm/BUILD/linux/drivers/Makefile
## 可以仿照Makefile里的内容在最后添加如下一行
**ojb-m += test/ ## 然后保存退出**
## 修改test文件夹下的test.c和Makefile确保其正确无误。
## 下面的命令是进入__ltib的shell环境__然后进入到test目录然后编译
$ ./ltib -m shell
LTIB> cd rpm/BUILD/linux/drivers/test/
LTIB> make V=1** ARCH=ppc**
## rpm/BUILD/linux/drivers/test/test.ko就是我们想要的module下载到板子上用insmod test.ko来执行模块(rmmod test.ko是卸载模块)
++++++++++++++++下面为test.c程序内容++++++++++++++++++
#include <linux/init.h>
#include <linux/module.h>
#include <asm/mpc83xx.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
printk(KERN_ALERT "IMMR virtual address: %X\n", VIRT_IMMRBAR);
printk(KERN_ALERT "IMMRBAR: %08lX\n", *(unsigned long*)(VIRT_IMMRBAR + 0x00000));
printk(KERN_ALERT "SPRIDR : %08lX\n", *(unsigned long*)(VIRT_IMMRBAR + 0x00108));
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
++++++++++++++++上面为test.c程序内容++++++++++++++++++
+++++++++++++++下面为Makefile程序内容+++++++++++++++++
ifneq ($(KERNELRELEASE),)
obj-m := test.o
else
KDIR := ../..
PWD := $(shell pwd)
default:
$(MAKE)__ -C__ $(KDIR) M=$(PWD)
endif
+++++++++++++++上面为Makefile程序内容+++++++++++++++++
## 类似地我们可以编译vlan配置模块
┌——————————┐
│ 写完收工 │
└——————————┘

View File

@@ -0,0 +1,282 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-30T21:26:31+08:00
====== ltib(3)在嵌入式系统中实现nfs服务器 ======
Created Wednesday 30 November 2011
http://www.osow.org/wiki/Ltib%283%29%E5%9C%A8%E5%B5%8C%E5%85%A5%E5%BC%8F%E7%B3%BB%E7%BB%9F%E4%B8%AD%E5%AE%9E%E7%8E%B0nfs%E6%9C%8D%E5%8A%A1%E5%99%A8
NAS系统需要支持NFS协议这时的NAS作为NFS的服务器客户端通过NFS协议登录NAS来存取数据。
===== 1.安装nfs-utils =====
nfs-utils是nfs服务器端的用户程序。
在LTIB当前目录下使用下面命令进入LTIB配置界面。
**$./ltib --configure**
进入“package list”。选中nfs-utils
保存退出LTIB会将nfs-utils编译并部署在文件系统的/usr/sbin下。
==== 2.配置Linux内核 ====
在LTIB当前目录下使用下面命令进入LTIB配置界面。
$./ltib configure
选中“[]Configure the kernel”选项。这样在LTIB**配置过程中**会进入Linux内核配置。在内核配置界面
进入“File systems”进入“Network File systems”选中
<*> Provide NFSv3 server support选项
<*> NFS server support选项
<*> Provide NFS server over TCP support。
==== 3.编写nfs启动脚本 ====
启用nfs服务器的过程需要配置相关参数再启动相关应用程序。通过编写一个nfs启动脚本并将其添加到配置文件的**启动列表**中实现系统开机自动启动nfs服务器。
/etc/rc.d/init.d/nfs代码
# !/bin/sh
nfsd="/usr/sbin/rpc.nfsd"
mountd="/usr/sbin/rpc.mountd"
exportfs="/usr/sbin/exportfs"
portmap="/sbin/portmap"
Number of servers to be started by default
[ -z "$RPCNFSDCOUNT" ] && RPCNFSDCOUNT=4
Get the initial values for the input sock queues at the time of running the script.
if [ "$TUNE_QUEUE" = "yes" ]; then
  RMEM_DEFAULT=`/sbin/sysctl -n net.core.rmem_default`
  RMEM_MAX=`/sbin/sysctl -n net.core.rmem_max`
  # 256kb recommended minimum size based on SPECsfs NFS benchmarks
  [ -z "$NFS_QS" ] && NFS_QS=262144
fi
case "$1" in
 start)
  $portmap
  # Start daemons.
  # Apply input queue increase for nfs server
  if [ "$TUNE_QUEUE" = "yes" ]; then
    /sbin/sysctl -w net.core.rmem_default=$NFSD_QS >/dev/null 2>&1
    /sbin/sysctl -w net.core.rmem_max=$NFSD_QS >/dev/null 2>&1
  fi
  echo "Starting NFS services"
  $exportfs -r
  echo -n "Starting NFS daemon: "
  $nfsd $RPCNFSDCOUNT
  echo
  [ -n "$MOUNTD_PORT" ]
  && RPCMOUNTDOPTS="$RPCMOUNTDOPTS -p $MOUNTD_PORT"
  echo -n "Starting NFS mountd: "
  $mountd $RPCMOUNTDOPTS
  echo
  touch /var/lock/nfs
  # reset input queue for rest of network services
  if [ "$TUNE_QUEUE" = "yes" ]; then
    /sbin/sysctl -w net.core.rmem_default=$RMEM_DEFAULT >/dev/null 2>&1
    /sbin/sysctl -w net.core.rmem_max=$RMEM_MAX >/dev/null 2>&1
  fi
  ;;
  stop)
  # Stop daemons.
  echo -n "Shutting down NFS mountd: "
  killall -9 rpc.mountd
  echo
  echo -n "Shutting down NFS daemon: "
  killall -9 nfsd
  echo
  # Do it the last so that clients can still access the server
  # when the server is running.
  echo -n "Shutting down NFS services: "
  $exportfs -au
  rm -f /var/lock/nfs
  killall portmap
  ;;
 restart)
  $0 stop
  $0 start
  ;;
 reload)
  $exportfs -r
  touch /var/lock/nfs
  ;;
 *)
  echo "Usage: nfs {start|stop|restart|reload}"
  exit 1
esac
exit 0
===== 打开LTIB当前目录的下的config/userspace/ =====
**sysconfig.lkc**
===== 文件,添加如下代码。 =====
config SYSCFG_START_NFSD
  depends PKG_PORTMAP && PKG_NFS_UTILS
  bool "start nfs server"
  default y
  help
    Before enabling the NFS server, please check /etc/exports
这样在LTIB配置界面下的T**arget System Configuration Option**选项里就添加了开机启动nfs服务器的选项。
打开LTIB当前目录下的dist/lfs-5.1/sysconfig/__sysconfig.spec__ 文件添加SYSCFG_START_NFSD 宏的定义。
if [ "$SYSCFG_START_NFSD" = "y" ]
  then
    nfs=nfs
fi
打开LTIB当前目录的下的config/platform/mpc837xerdb/merge/**etc/rc.d/rc.conf**文件,做如下修改:
在all_services= line末尾添加“nfs”
在all_services_r= line起始添加“nfs”
在cfg_services and cfg_services_r.添加“$nfs”
手动启动或停止nfs服务器的命令分别是
./etc/rc.d/init.d/nfs start
./etc/rc.d/init.d/nfs stop
===== 4.nfs配置文件 =====
nfs的配置文件是/etc/exports在该配置文件中添加如下代码
/sharec *(rw,root_squash)
/mnt/md/public 192.168.1.1/192.168.1.255(rw,root_squash)
说明该配置文件有三列。第一列是nfs服务器开放的本地的共享文件夹路径第二列是指nfs客户端地址*表示任意地址192.168.1.1/192.168.1.255表示该网段地址);第三列是访问属性。
===== 5.使用nfs =====
在Linux下使用nfs协议挂载nfs服务器上的共享文件夹。首先建立挂载目录
mkdir /mnt/nfs
然后,挂载
mount t nfs o tcp 192.168.1.102:/share /mnt/nfs
其中
mount 挂载命令
t nfs 挂载文件系统类型为nfs
o tcp 使用基于tcp协议的nfso udp 使用基于udp协议的nfs
192.168.1.102:/share nfs服务器IP地址和共享文件夹路径
/mnt/nfs 挂载目录
挂载完成后可以使用dd命令写入和读出一个文件进行nfs访问测试。
写入:
[root@fedora8 nfs]# dd if=/dev/zero of=1GB_20100412 bs=10M count=100
100+0 records in
100+0 records out
1048576000 bytes (1.0 GB) copied, 92.1231 s, 11.4 MB/s
读取:
[root@fedora8 nfs]# dd if=1GB_20100412_tcp_bs1M of=/dev/null bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 105.538 s, 9.9 MB/s
卸载nfs的命令是
umount /mnt/nfs

View File

@@ -0,0 +1,136 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-28T21:00:38+08:00
====== powerpc mpc8313调试实验流程 ======
Created Monday 28 November 2011
http://blog.chinaunix.net/space.php?uid=12077574&do=blog&id=145091
mpc8313调试实验流程
硬件1. MPC8313ERDB development board
2. usbtap JTAG
软件1. codewarrior for powerpc
2. powerpc-linux-gcc
3. u-boot
4. linux kernel
一、 CPU片选分配和地址映射
address range target interface chip-select line device name port size(bits)
0x00000000~0x07ffffff DDR2 MCS0# DDR SDRAM(128 Mbyte) 32
0x80000000~0x9fffffff PCI Nil PCI memory space(512Mbyte) 32
0xe0000000~0xe00fffff internal bus Nil IMMR(1 Mbyte)
0xe2000000~0xe20fffff PCI Nil PCI I/O space(1 Mbyte) 32
0xe2800000~0xe2807fff NAND controller LCS1# NAND flash(32kbyte) 8
0xf0000000~0xf001ffff local bus LCS2# vsc7385(128kbyte) 8
0xfa000000~0xfa07ffff local bus LCS3# read/write buffer(32kbyte) 8
0xfe000000~0xfe7fffff local bus LCS0# boot flash(8Mbyte) 16
二、flash起始地址和内容分配
start ~ end definition
0xfe000000~0xfe0fffff u-boot
0xfe100000~0xfe2fffff linux kernel
0xfe300000~0xfe6fffff ramdisk/jffs file system
0xfe700000~0xfe70ffff of tree
0xfe710000~0xfe72ffff vitesse 7385 image_loader program
0xfe730000~0xfe7fdffff reserved
0xfe7fe000 ~0xfe7ffffff vitesse 7385 firmware image
三、编译u-boot并使用 codewarrior下载
u-boot$>make MPC8313ERDB_33_config
u-boot$>make all CROSS_COMPILE=powerpc-linux-
在进行u-boot烧写时先将拨码开关设置如下
Switch 1 2 3 4
SW3 1 0 1 1
SW4 1 1 1 1
烧写完成后关闭电源将其设置为默认如下:
Switch 1 2 3 4
SW3 0 0 0 0
SW4 1 1 1 1
连接好串口和网络接口,打开超级终端,启动 u-boot至命令提示符。
使用setenv设置环境变量正确的环境变量设置是启动linux保证设置内容如下
(需要根据自身硬件 环境修改)
CPU: e300c3, MPC8313, Rev: 1.0 at 333.333 MHz, CSB: 166.667 MHz
Board: Freescale MPC8313ERDB
I2C: ready
DRAM: 128 MB
FLASH: 8 MB
NAND: 32 MiB
In: serial
Out: serial
Err: serial
Net: TSEC0: No support for PHY id ffffffff; assuming generic
TSEC0, TSEC1 [PRIME]
Hit any key to stop autoboot: 0
=> printenv
ramboot=setenv rootdev /dev/ram;run setbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddr
nfsboot=setenv rootdev /dev/nfs;run setbootargs;run setipargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr
baudrate=115200
loads_echo=1
ethaddr=00:E0:0C:00:95:01
eth1addr=00:E0:0C:00:95:02
rootpath=/nfs/root/path
hostname=mpc8313erdb
bootfile=uImage
netdev=eth1
ethprime=TSEC1
uboot=u-boot.bin
tftpflash=tftpboot $loadaddr $uboot; protect off 0xFE000000 +$filesize; erase 0xFE000000 +$filesize; cp.b $loadaddr 0xFE000000 $filesize; protect on 0xFE000000 +$filesize; cmp.b $loadaddr 0xFE000000 $file
fdtfile=mpc8313erdb.dtb
console=ttyS0
setbootargs=setenv bootargs root=$rootdev rw console=$console,$baudrate $othbootargs
setipargs=setenv bootargs nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off root=$rootdev rw console=$console,$baudrate $othbootargs
ethact=TSEC1
loadaddr=200000
fdtaddr=400000
bootcmd=bootm fe100000 fe300000 fe700000
bootdelay=3
ramdiskaddr=fe300000
filesize=460000
fileaddr=1000000
famdiskfile=rootfs.ext2.gz.uboot
ramdiskfile=rootfs.ext2.gz.uboot
netmask=255.255.255.0
bootargs=nfsroot=192.168.3.100:/nfs/root/path ip=192.168.3.200:192.168.3.100:192.168.3.1:255.255.255.0:mpc8313erdb:eth1:off root= rw console=ttyS0,115200
rootdev=/dev/nfs run setbootargs run setipargs bootm fe100000 - fe700000
imboot=setenv rootdev /dev/nfs run setbootargs run setipargs bootm fe100000 - fe700000
ipaddr=192.168.2.201
serverip=192.168.2.200
gatewayip=192.168.2.1
stdin=serial
stdout=serial
stderr=serial
Environment size: 1672/8188 bytes
=>setenv shiboot rootdev "/dev/nfs; run setbootargs; run setipargs; bootm fe100000 - fe700000"
四、编译linux内核和结点文件dts驱动树
1. 编译内核(略)
2. 编译驱动树文件dts
linux-2.6.x/arch/powerpc/boot/dts$ dtc -b 0 -V 17 -R 4 -S 0x3000 -I dts -O dtb -f mpc8313erdb.dts > mpc8313.dtb
生成 mpc8313.dtb后搭建tftp服务
将编译好的内核、文件系统、驱动树文件的bin放在搭建好的tftp目录下。
五、使用tftp进 行内核、文件系统、驱动树文件的下载。
1. 烧写内核
=>tftp 200000 uImage
=>erase fe100000 fe2fffff
=>cp.b 200000 fe100000 $size(uImage文件大小)
2. 烧写文件系统
=>tftp 1000000 rootfs.ext2.gz.uboot
=>erase fe300000 fe6fffff
=>cp.b 1000000 fe300000 $size(rootfs.ext2.gz.uboot文件大小)
3. 烧写驱动树文件
=>tftp 400000 mpc8313.dtb
=>erase fe700000 fe70ffff
=>cp.b 400000 fe700000 $size(mpc8313.dtb)
至此boot kernel filesystem dtb全部烧写完成重启开发板启动至linux。
六、驱动程序加载
1. ping通网络使用NFS进行驱动加载。
/$> mount -t nfs -o nolock 192.168.x.x:/pctree/nfs/ /mnt
2. 加载/卸载驱动
/mnt>insmod **.ko
/mnt>rmmod **.ko

View File

@@ -0,0 +1,185 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-07T19:21:09+08:00
====== u-boot启动画面 ======
Created Wednesday 07 December 2011
http://www.kaoru-home.com/wp/archives/917
U-Boot 2010.06-dirty (Oct 13 2011 11:04:22) MPC83XX
Reset Status:
CPU: e300c3, MPC8309E, Rev: 1.1 at 400 MHz, CSB: 133.333 MHz, QE: 200 MHz
Board: Freescale MPC8309SOM
I2C: ready
DRAM: 128 MiB
FLASH: 8 MiB
Firmware Microcode version 0.0.0 for MPC8309 r1.0 for 8309 V1.0
QE: uploading microcode Microcode for MPC8309 r1.0
NAND: 64 MiB
*** Warning bad CRC, using default environment
In: serial
Out: serial
Err: serial
MMC: FSL_ESDHC: 0
Net: FSL UEC0, FSL UEC1, FSL UEC2
Hit any key to stop autoboot: 0
## Booting kernel from Legacy Image at fe100000 …
Image Name: Linux-2.6.34-g4ee8913-dirty
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 1791799 Bytes = 1.7 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum … OK
## Loading init Ramdisk from Legacy Image at fe300000 …
Image Name: uboot ext2 ramdisk rootfs
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
Data Size: 4903644 Bytes = 4.7 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum … OK
## Flattened Device Tree blob at fe0e0000
Booting using the fdt blob at 0xfe0e0000
Uncompressing Kernel Image … OK
Loading Ramdisk to 07a33000, end 07ee02dc … OK
Loading Device Tree to 007fb000, end 007fff8b … OK
Using MPC8309 SOM machine description
Linux version 2.6.34-g4ee8913-dirty (kaoru@dev) (gcc version 4.1.2) #7 Thu Oct 13 12:00:52 CST 2011
Found initrd at 0xc7a33000:0xc7ee02dc
bootconsole [udbg0] enabled
setup_arch: bootmem
mpc8309_som_setup_arch()
Found FSL PCI host bridge at 0x00000000e0008500. Firmware bus number: 0->0
PCI host bridge /pci@e0008500 (primary) ranges:
MEM 0×0000000080000000..0x000000008fffffff -> 0×0000000080000000 Prefetch
MEM 0×0000000090000000..0x000000009fffffff -> 0×0000000090000000
IO 0x00000000d0000000..0x00000000d3ffffff -> 0x00000000d0000000
arch: exit
Zone PFN ranges:
DMA 0×00000000 -> 0×00008000
Normal empty
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0×00000000 -> 0×00008000
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: root=/dev/ram rw panic=15 mem=128m console=ttyS0,115200
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 121348k/131072k available (3500k kernel code, 9724k reserved, 164k data, 92k bss, 164k init)
Kernel virtual memory layout:
* 0xfffdf000..0xfffff000 : fixmap
* 0xfcef7000..0xfe000000 : early ioremap
* 0xc9000000..0xfcef7000 : vmalloc & ioremap
Hierarchical RCU implementation.
NR_IRQS:512 nr_irqs:512
IPIC (128 IRQ sources) at c9000700
clocksource: timebase mult[7800001] shift[22] registered
Mount-cache hash table entries: 512
NET: Registered protocol family 16
PCI: Probing PCI hardware
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource timebase
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs…
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 4788k freed
JFFS2 version 2.2. (NAND) ? 2001-2006 Red Hat, Inc.
msgmni has been set to 246
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
console [ttyS0] enabled, bootconsole disabled
console [ttyS0] enabled, bootconsole disabled
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 16) is a 16550A
brd: module loaded
loop: module loaded
fe000000.flash: Found 2 x8 devices at 0×0 in 16-bit bank
NOR chip too large to fit in mapping. Attempting to cope…
Support for command set 0001 not present
gen_probe: No supported Vendor Command Set found
of-flash fe000000.flash: do_map_probe() failed
NAND device: Manufacturer ID: 0xec, Chip ID: 0×76 (Samsung NAND 64MiB 3,3V 8-bit)
RedBoot partition parsing not available
Creating 6 MTD partitions on "fff00000.flash":
0×000000000000-0×000000100000 : "U-Boot-NAND"
0×000000100000-0×000000200000 : "DTB-NAND"
0×000000200000-0×000000600000 : "Ramdisk-NAND"
0×000000600000-0x000000c00000 : "Reserved-NAND"
0x000000c00000-0×000002200000 : "Kernel-NAND"
0×000002200000-0x000003a00000 : "JFFS2-NAND"
eLBC NAND device at 0xfff00000, bank 1
mem->start=0xe0007000, irq=17
mpc8xxx_spi mpc8xxx_spi.0: at 0xc9078000 (irq = 17), CPU mode
Fixed MDIO Bus: probed
ucc_geth: QE UCC Gigabit Ethernet Controller
ucc_geth: UCC1 at 0xe0102000 (irq = 18)
ucc_geth: UCC2 at 0xe0103000 (irq = 19)
ucc_geth: UCC3 at 0xe0102200 (irq = 34)
step3
Freescale PowerQUICC MII Bus: probed
usbmon: debugfs is not available
ehci_hcd: USB 2.0 Enhanced Host Controller (EHCI) Driver
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 38, io base 0xe0023000
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 0.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver…
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mmc0: SDHCI controller on e002e000.sdhci [e002e000.sdhci] using DMA
TCP cubic registered
NET: Registered protocol family 17
RAMDISK: gzip image found at block 0
RAMDISK: incomplete write (18852 != 32768)
write error
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing unused kernel memory: 164k init
Mounting /proc and /sys
Starting the hotplug events dispatcher udevd
Synthesizing initial hotplug events
Setting the hostname to mpc8306som
Mounting filesystems
mount: mounting usbfs on /proc/bus/usb failed: No such file or directory
Running sysctl
Setting up networking on loopback device:
Setting up networking on eth0:
Setting up networking on eth1:
Starting inetd:
Welcome to the LTIB Embedded Linux Environment
!!!!! WARNING !!!!!!!
The default password for the root account is: root
please change this password using the passwd command
and then edit this message (/etc/issue) to remove this message
mpc8306som login:

View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-03T17:23:57+08:00
====== 基于PowerPC的Linux内核之旅 ======
Created Saturday 03 December 2011

View File

@@ -0,0 +1,223 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-03T17:24:15+08:00
====== 1. early init ======
Created Saturday 03 December 2011
http://www.linuxidc.com/Linux/2011-11/46581.htm
很早之前就有写基于PowerPC架构的Linux源代码分析的文章的想法但无奈于Linux源码量太大逻辑也很复杂再加上本身对PowerPC汇编了解不多闲暇时间也没有太多一直都没有什么机会。上个月工作上的事情因为硬件的耽误稍微少了些再加上自己之前分析U-Boot的源码时学了不少PowerPC汇编的知识又移植了Linux中的SPI和Nand Flash的驱动源码到vxWorks感觉时机比较成熟了踉踉跄跄的开始了尝试性的分析一点点的来还望不足之处高手能指出。本次的文章将只致力于PowerPC平台在加上本人对CPU内部机制比较感兴趣所以大部分内容都是在与具体的CPU初始化相关的.S文件中之后会根据我的经历选择性的分析内部中断机制和外设的驱动等内容。另外由于在对启动代码的分析阶段中大多数源代码都在Arch/Powerpc/Kernel文件夹下如果不是我会给出相对路径的。
相关阅读:
Linux PowerPC I2C驱动 之 I2C设备层的注册过程 http://www.linuxidc.com/Linux/2011-08/41104.htm
Linux PowerPC I2C驱动 之 I2C Adapter层的注册过程 http://www.linuxidc.com/Linux/2011-08/41103.htm
PowerPC体系下的Linux启动步骤和其他大多数架构都是类似的系统引导将从arch/powerpc/kernel/head_32.s开始执行再转到init/main.c中的start_kernel函数初始化内核。首先来看下入口点文件head_32.S其中的r1~r5这五个寄存器的内容及含义还不是很清楚但可以确定r5的初始值为0进而在start函数中跳转执行Setup_32.c中的early_init函数查看该函数的定义代码如下很简单
/*notrace为函数属性:禁止trace定义为__attribute__((no_instrument_function))
不懂的可以看我之前对此关键字的介绍*/
notrace unsigned long __init early_init(unsigned long dt_ptr)
{
/*reloc_offset定义于misc.s文件,用于返回(当前运行地址-链接地址)的值*/
unsigned long offset = reloc_offset();
struct cpu_spec *spec;
/* 首先清空bss段这里使用的是memset_io因为暂时没有cache可用*/
memset_io((void __iomem *)PTRRELOC(&__bss_start), 0,
__bss_stop - __bss_start);
/*确定cpu类型mfspr(SPRN_PVR)指令获取CPU的版本号*/
spec = identify_cpu(offset, mfspr(SPRN_PVR));
do_feature_fixups(spec->cpu_features,
PTRRELOC(&__start___ftr_fixup),
PTRRELOC(&__stop___ftr_fixup));
do_feature_fixups(spec->mmu_features,
PTRRELOC(&__start___mmu_ftr_fixup),
PTRRELOC(&__stop___mmu_ftr_fixup));
do_lwsync_fixups(spec->cpu_features,
PTRRELOC(&__start___lwsync_fixup),
PTRRELOC(&__stop___lwsync_fixup));
return KERNELBASE + offset;
}
在early_init中首先需要注意的是在此阶段内核运行时所在的地址可能与其连接地址有所不同所以在访问静态数据时都要使用reloc和ptrreloc函数这两个函数的定义在misc.s文件中具体代码如下
/*该函数返回(当前运行地址)减去(程序链接地址)的值,用于程序和数据
未映射到KERNELBASE时使用*/
_GLOBAL(reloc_offset)
mflr r0 /*链接寄存器的值*/
bl 1f /*跳转到1所在的地址这就是当前代码所在的实际地址这样通过mflr r3就将当前bl 1f的当前运行地址保存在r3中*/
1: mflr r3
PPC_LL r4,(2f-1b)(r3) /* PPC_LL意思为lwz,装载立即数,得到的r4为1f的链接地址*/
subf r3,r4,r3 /*二者相减,获取当前运行地址和链接地址的偏移*/
mtlr r0 /*恢复保存的函数地址*/
blr
.align 3
2: PPC_LONG 1b
上面说到的KERNELBASE它的定义位于asm\Page.h中是内核起始的虚拟地址通常情况下和PAGE_OFFSET相等。由于链接地址为0xc0000000(默认定义在configs/*_defconfig中)所以相减结果必定为负值。根据PowerPC ABI的规范r3为函数返回值寄存器所以就得到了当前运行地址和链接地址之间的偏移量了。这里要注意在这个函数中有一个很重要的隐含约定那就是假设如果曾经开启了mmu那么这个mmu的映射关系是1:1的映射即虚拟地址和物理地址是相同的。这是因为reloc_offset在计算偏移的时候是用"当前正在运行的地址"-"代码链接的地址"这个所谓当前正在运行的地址可以理解为实地址如果mmu的映射不是1:1的话那么在关闭了mmu之后这个当前运行的地址要再加上一个偏移才能得到实地址所以当前函数返回的偏移是假设mmu的映射为1:1时的偏移地址。切记这一点在bootloader中如果要使用mmu必须在映射bat寄存器时使用1:1的映射。
然后函数清空bss这里的__bss_start和__bss_stop的值是在Boot/zImage.lds.S中定义的再确定CPU的类型(identify_cpu)之后根据特定的CPU做相关的fix_up操作。至于identify_cpu里的代码在之前版本的内核里是定义在misc.s中的汇编代码现在成C语言的了理解起来不是很困难大致的步骤就是先通过PVR&pvr_mask== pvr_value在cpu_specs数组中找到与CPU对应的类型找到后将匹配的一组cpu参数当输入值调用setup_cpu_spec函数。这个也是个很简单的函数注释比代码还懂相信各位一定能看懂的它主要实现的功能是将原数组中定义的不足弥补譬如PMC(Performance Monitor Countor性能监视器)的个数还有一个OPROFILE是Linux下的性能分析工具具体机制没细看待高手分析吧以及工作于兼容模式的解决办法。这里就不再赘述。来看一下函数early_init的后面三个fixup函数这六个函数中的变量__start___**_fixup、__stop___**_fixup都在vmlinux.lds.s文件中定义这里linux使用了一个很高级的技巧来复用代码。因为不同的处理器具有不同的特性如单独的指令、数据Cache统一的指令数据Cache动态电源管理特性硬件或软件TLB查找等绝大部分CPU之间只是有特性的差异其它部分如指令集都是一样的专门为这些处理器提供不同的源文件显得多余同时又不便于统一维护。因此Linux在操作有关处理器特性的代码前后加上特殊的宏定义将此类代码放到单独的一个段中一旦CPU类型被确定以后如果CPU具有某特性则操作该特性的代码不作任何处理如果CPU不具备该特性则把操作该特性的代码全部替换成空操作指令nop所有的处理都在这个单独的段中完成。这种做法对于操作代码某特性代码量较少的情况下非常有用这样比使用判断然后跳转的组合指令来得更加有效上面提的六个变量在vmlinux.lds.S中这个段的定义为
. = ALIGN(8);
__ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
__start___ftr_fixup = .;
*(__ftr_fixup)
__stop___ftr_fixup = .;
}
此外在include/asm/Feature-fixup.h中有如下定义
#define BEGIN_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
#define BEGIN_FTR_SECTION START_FTR_SECTION(97)
#define END_FTR_SECTION_NESTED(msk, val, label) \
FTR_SECTION_ELSE_NESTED(label) \
MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
#define END_FTR_SECTION(msk, val) \
END_FTR_SECTION_NESTED(msk, val, 97)
所有特性相关的代码都放在BEGIN_FTR_SECTION和END_FTR_SECTION中。END_FTR_SECTION_IFSET的含义是指当cpu具有某项特性时包含在中间的代码有效不用替换对于END_FTR_SECTION_IFCLR则表示当cpu不具有某项特性时包含在中间的代码有效不用替换。包含在在BEGIN_XXX和END_XXX宏之间的代码在链接时存放到__ftr_fixup段中。至于那三个函数也就是实现这样的功能的通过特定的CPU获取其特性若需要特殊处理则添加相应功能否则置空。
完成了early_init函数后再跳转执行mmu_off函数用于关闭MMU功能包括清空BAT和TLB(快表)这里是为了后面初始化MMU做准备保证系统环境的干净。在mmu_off函数后程序还会继续跳转到clear_bats和flush_tlbs两个函数中执行清空的工作确保完全消除之前MMU开启的影响。具体的代码如下
mmu_off:
addi r4, r3, __after_mmu_off - _start /*r4为__after_mmu_off的偏移地址*/
mfmsr r3
andi. r0,r3,MSR_DR|MSR_IR /*通过检查MSR的DR和IR位判断MMU是否开启*/
beqlr /*若未开启则直接返回*/
andc r3,r3,r0 /*否则,将r0取反,即关闭MMU*/
mtspr SPRN_SRR0,r4
mtspr SPRN_SRR1,r3
sync
RFI /*Return From Interrupt,中断返回从SRR中重加载*/
其中的SRR为PowerPC中的machine status save/restore寄存器CPU在管理员模式下有两个SSR其中SSR0用于存放产生中断时的指令地址以及RFI(中断返回)命令执行时CPU的返回地址SSR1存放产生中断和恢复时的机器状态。该函数中的r3是由early_init返回的包含了当前运行的物理地址。这样说明了之后该段代码就好理解了先是将r3和r4分别加载当前机器状态和__after_mmu_off的运行地址然后判断当前CPU的MMU是否开启若开启则发生中断去执行__after_mmu_off完成后再返回。__after_mmu_off代码很简单就是两个调用跳转到clear_bats和flush_tlbs这两个函数代码简略如下
clear_bats:
li r10,0
mfspr r9,SPRN_PVR
rlwinm r9,r9,16,16,31 /*r9右移16位判断r9 = 1 for 601, 4 for 604 */
cmpwi r9, 1
beq 1f
/*写0清空*/
mtspr SPRN_DBAT0U,r10
…..
mtspr SPRN_DBAT3L,r10
1:
mtspr SPRN_IBAT0U,r10
…..
mtspr SPRN_IBAT3L,r10
blr
flush_tlbs:
lis r10, 0x40
1: addic. r10, r10, -0x1000
tlbie r10 /*tlbie为PowerPC操作码,对应POWER的为tlbi,意为使TLB入口无效*/
bgt 1b /*大于则跳转*/
sync
blr
流程比较简单自我感觉注释也清晰的很执行完这几个函数后CPU将重新初始化BAT寄存器。注意这里使用BAT的目的是为了在完全启用MMU之前先使用简单的BAT映射来设置Linux的运行环境从而使后面复杂的操作可以使用C语言完成。CPU再跳转执行initial_bats代码如下
initial_bats:
lis r11,PAGE_OFFSET@h /*默认为0xc0000000,定义于configs/mpc83xx_defconfig*/
mfspr r9,SPRN_PVR
rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
cmpwi 0,r9,1
bne 4f
ori r11,r11,4 /* set up BAT registers for 601 */
li r8,0x7f /* valid, block length = 8MB */
mtspr SPRN_IBAT0U,r11 /* N.B. 601 has valid bit in */
mtspr SPRN_IBAT0L,r8 /* lower BAT register */
addis r11,r11,0x800000@h
addis r8,r8,0x800000@h
mtspr SPRN_IBAT1U,r11
mtspr SPRN_IBAT1L,r8
addis r11,r11,0x800000@h
addis r8,r8,0x800000@h
mtspr SPRN_IBAT2U,r11
mtspr SPRN_IBAT2L,r8
isync
blr
4: tophys(r8,r11) /*此处相当于addis r8,r11,0指令*/
#ifdef CONFIG_SMP
ori r8,r8,0x12 /* R/W access, M=1 */
#else
ori r8,r8,2 /* R/W access */
#endif /* CONFIG_SMP */
ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
mtspr SPRN_DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
mtspr SPRN_DBAT0U,r11 /* bit in upper BAT register */
mtspr SPRN_IBAT0L,r8
mtspr SPRN_IBAT0U,r11
isync
blr
这段代码我注释的很少因为在我的板的datasheet里没有对BAT寄存器的各位详细说明所以还是看原来的解释吧。基本的意思就是在601平台使用的是3个8M的BAT位于PAGE_OFFSET起始的24M内存中而在其他平台则是一个256M的。这里三组BAT的24M空间对于当前的Linux内核并且在启动过程中没有动态内存分配来说足够了。启动早期初始化完成后CPU开始调用setup_cpu函数初始化CPU了该函数名为call_setup_cpu位于misc_32.s文件中(注意由于此时MMU一直处于关闭状态所以都要在开始时调用reloc_offset得到偏移并通过r3传出。后面的几个函数也是列代码时为节省空间就不贴该代码了),具体代码如下:
_GLOBAL(call_setup_cpu)
addis r4,r3,cur_cpu_spec@ha
addi r4,r4,cur_cpu_spec@l /*cur_cpu_spec即为对应结构体*/
lwz r4,0(r4)
add r4,r4,r3
lwz r5,CPU_SPEC_SETUP(r4) /*寻找对应cpu_spec结构体中的cpu_setup_t成员*/
cmpwi 0,r5,0
add r5,r5,r3
beqlr
mtctr r5
bctr
这里的宏定义CPU_SPEC_SETUP定义于asm-offsets.c文件中具体定义为DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup))即寻找cpu_setup_t成员。函数中的r3为数据偏移r4为指向cpu_spec的指针(重定位之后的即reloc_offset)。这里我的mpc83xx系列的CPU为603的结构较为简单需要初始化的包括FPU(Floating Point Unit)、HID0和清空LRU具体代码如下
_GLOBAL(__setup_cpu_603)
mflr r4
BEGIN_MMU_FTR_SECTIO /*宏定义在Feature-fixups.h中,此句为MMU feature dependent sections*/
li r10,0
mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking将SPRG4写0即清空LRU:Least Recently Used*/
END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU)
BEGIN_FTR_SECTION /* CPU feature dependent sections*/
bl __init_fpu_registers /*初始化FPU寄存器*/
END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE)
bl setup_common_caches /*初始化配置HID0,使能Cache*/
mtlr r4 /*重加载LR跳回来*/
blr
如上至于那四个BEGIN_**的宏含义就和上面说的一样为了代码的重用使得针对特定CPU的特性决定是否执行宏之间的操作。第一句将SPRG4写0这里要说明一下至于SPRG的概念可以看我之前一篇对E300处理器内核介绍的文章在32位PowerPC处理器中SPRG0、1用于存放异常向量表SPRG2用于指定当前正处于RTAS(Run-Time Abstraction Services)SPRG3用于存放线程信息(thread_info)的指针SPRG4中填充TLB和LRU的数据。该函数主要的两个功能就是初始化FPU和配置HID0代码分别如下
初始化FPU
_GLOBAL(__init_fpu_registers)
mfmsr r10
ori r11,r10,MSR_FP /*写r10 | Floating Point Enable*/
mtmsr r11
isync
addis r9,r3,empty_zero_page@ha /*定义于head_32.S中*/
addi r9,r9,empty_zero_page@ /*将empty_zero_page加载到r9*/l
REST_32FPRS(0,r9) /*多个lfd(装载浮点数)指令*/
sync
mtmsr r10
isync
blr

View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-03T17:11:18+08:00
====== 汇编 ======
Created Saturday 03 December 2011

View File

@@ -0,0 +1,110 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-03T17:11:22+08:00
====== PowerPC汇编指令集简析 ======
Created Saturday 03 December 2011
http://www.linuxidc.com/Linux/2011-09/43873.htm
在了解PowerPC汇编指令前需要先看下编程所用的__寄存器模型__PowerPC系统结构为大多数运算指令都定义了__Register-Register__的操作这些操作的源操作数从寄存器取得或作为**嵌入指令操作码中的立即数**提供。这里的e300核可分为用户编程模型和管理员编程模型该模型有32个GPR、32个FPR、特殊目的寄存器SPR和一些功能寄存器下图为二者的示意图
{{~/sync/notes/zim/Research/PowerPC开发/汇编/PowerPC汇编指令集简析/1.gif.jpe}}
{{~/sync/notes/zim/Research/PowerPC开发/汇编/PowerPC汇编指令集简析/2.jpe}}
上面这些寄存器可能不太好理解因为名字和Intel汇编不一样其实可以这样理解GPR就相当于EAX/EBX/ECX而CTR则完全就是ECX的功能是吧?区别就是__没有堆栈__而已咯。CR被分为8段每段4位分别代表LT、GT、EQ和SO(**小于、大于、等于和溢出**)LR用于记录**跳转地址**特殊寄存器XER用于记录__溢出和进位__标志FPSCR用于记录**浮点运算类型和异常**等。
再看下指令集大部分的CPU指令集可分为__数据读写、数值计算、流程控制和设备管理__四个部分由于PowerPC使用RISC指令字长为32bitEndian一般是可调的__默认为大端__另外PowerPC没有栈所以程序需要自己实现相关操作。首先为运算和逻辑指令列举如下
{{~/sync/notes/zim/Research/PowerPC开发/汇编/PowerPC汇编指令集简析/3.jpe}}
它们与__通用寄存器__有关源数据来自GPR 或16 位立即数目的是GPR 寄存器,**操作为32 位**GPR 中存放32 位更新数据。大多数指令都可以根据字面意思理解其作用注意还有一个“cntlzw”指令意为计算字中的第一个0用于在一个字中找到1时将一个指令中的0的数量找出它在决定例外寄存器中最高优先服务时有用。
下面是数据读写指令,它们对数据在**存储器中和通用寄存器中的传送**很有用若数据小于__传送长度__(单字,半字或字节)指令会使数据变位为32位将不同位填0或符号扩展。指令列举如下
{{~/sync/notes/zim/Research/PowerPC开发/汇编/PowerPC汇编指令集简析/4.jpe}}
这里需要注意的是上面列举的lbz和lhz两个指令并不完全等同于mov al,[ebx]和mov ax,[ebx+10]这两个因为前面两个是将字节和半字加载到r3时还清空了高位而后两条指令只是加载数据到eax并不会清空高位。
另外还有两个指令sthbrw和stwbrx对PowerPC存取小端格式数据很有用它们允许存取这样的数据若数据以小端顺序进入总线就把它存为大端顺序。
好了,现在来详细看下**赋值指令**,下面是最常见的赋值代码:
lis r3,0x1234
addi r3,r3,0x5678
这段代码的含义是将0x12345678加载到寄存器r3中。因为在RISC下PowerPC的每条指令都是32bit除去指令和寄存器参数编码只剩下16bit的长度描述立即数如立即数加载指令li
{{~/sync/notes/zim/Research/PowerPC开发/汇编/PowerPC汇编指令集简析/5.jpe}}
这样立即数SIMM只有16位所以需要两次加载使用lis(立即数载入并左移)和addi(立即数加法)两条指令完成。
再看下PowerPC不同的__子程序调用__
func: /* 子程序入口 */
blr /* 返回(跳转到lr地址) */
start:
bl func /* 调用func(跳转并__保存地址到lr__) */
li r1,1 /* 设置r1、r3 */
li r3,1
sc /* 系统调用,结束程序 */
这里的调用由PowerPC使用lr寄存器完成在bl指令跳转前下一条指令li r1,1的地址会被保存在lr而执行的func中的blr时系统会跳到lr表示的地址完成返回。
再来介绍下特殊寄存器的操作指令它们可以完成__特殊用途寄存器之间和通用寄存器之间的数据交换__**不可以直接**对特殊用途寄存器中的值进行处理,但是,可以将一个值先拷贝到一个通用寄存器上处理,再将信息存到特殊用途寄存器上。下面是指令集合:
{{~/sync/notes/zim/Research/PowerPC开发/汇编/PowerPC汇编指令集简析/6.jpe}}
这里回顾下PowerPC里没有堆栈那用什么实现模拟呢看下面的例子
f1:
__ mflr r2 __ /*保存lr中记录的地址到r2*/
stw r2,-8(r1) /*记录r2的值到__mem__[r1-8]*/
addi r1,r1,-60 /*r1后移60个字节完成进栈操作*/
...
addi r1,r1,60 /*r1前移60个字节准备出栈*/
lwz r2,-8(r1) /*读出老的lr值到r2*/
mtlr r2 /*将r2的内容复制到lr*/
blr /*返回(跳转到lr地址)*/
start:
...
bl f1 /*调用f1(跳转并保持地址到lr)*/
看到了吧,虽然没有提供栈的相关指令(PUSH/POP/CALL/RET)但应用程序可以__用r1模拟栈指针__实现多层调用对LR的记录和恢复。
前面说了PowerPC指令为32位长指令内仅有16位用于加载常量值由于地址最多可达到64位所以我们可以采用**每次一段**的方式载入地址,汇编程序中的@符号指示汇编程序给出一个符号值的特殊处理形式:@highest表示一个常量的第48-63位@higher表示一个常量的第32-48位@h16-31位@l0-15位。
下面是我们的一个稍大点的PowerPC汇编程序总结下上面的指令集实现的功能就是载入两个值并相加最后退出以结果为状态代码输出。代码如下
#sum.s第一个PowerPC汇编程序
.data
.align 3
#此处装载两个值
first_value:
.quad 1
second_value:
.quad 2
#写”.opd”(__official procedure descriptor__)
.section “.opd”,”aw”
.align 3
#._start的程序描述符即为程序名
.global _start
_start:
.quad .start, .TOC.@tocbase,0
#._text为程序代码段
.text
._start:
#装载地址高位
lis r7,first_value@highest
ori r7,r7,first_value@higher
#shift these up to the high-order bits
rldier r7,r7,32,31
#装载地址低位
oris r7,r7,first_value@h
ori r7,r7,first_value@l
#将第一个值载入寄存器4
ld r4,0(r7)
lis r7,second_value@highest
ori r7,r7,second_value@higher
rldicr r7,r7,32,31
oris r7,r7,second_value@h
ori r7,r7,second_value@l
ld r5,0(r7)
#二者相加并存到寄存器6
add r6,r4,r5
#程序退出
li 0,1 #寄存器0为系统调用
mr r3,r6 #将结果移到寄存器3中
sc #对内核进行系统调用

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -0,0 +1,145 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-04T22:40:00+08:00
====== PowerPC常用指令 ======
Created Sunday 04 December 2011
http://zhiwei.li/text/2008/11/powerpc-instruaction/
指令缩写
•st = store
•ld = load
•r = right
•l = left 或者 logical
•w = word
•u = update
•m = move
•f = from 或者 field
•t = to 或者 than
•i = Immediate
•h = half word
•z = zero
•b = branch
•n = and
•cmp = compare
•sub = subtract
•clr = clear
•cr = condition register
•lr = link register
•ctr = couter register
stwu = STore Word witch Update
stwu r1, <-frame_size>(r1)
在GDB/IDA汇编中通常写成
stwu %sp, -0×20(%sp)
意思是,先将 SP 放入到 (SP-20) 这个内存地址然后 SP = SP 20;
从特殊寄存器 取值 的 扩展助记符
mflr = Move From Link Register
mflr rt 等同于 mfspr rt,8
将连接寄存器的值 放到 RT
一般是 mflr %r0
存值到特殊寄存器 的 扩展 助记符
mtctr = Move To Counter Register
mtctr rs 等同 mtspr 9,rs
将 RS 的 值 放入 到 计数寄存器
mtcrf = Move to Condition Register Fields mtcrf FXM, RS 按照掩码FXM复制Rs的内容到 CR
FXM是8位控制 RS的32位8组共32位 复制过去,也就是说 FXM的1位可以控制 Rs的4位一位掩码 控制 一组 CR
条件寄存器扩展助记符
crclr = Control Register CLeaR?
crclr bx 等同于 crxor bx, bx, bx 作用是 将条件寄存器 相应的位 清零
例如 crclr so 等同于 crxor 3, 3, 3 将 CR0的 SO位 第3位) 清零
crclr 4*cr3+eq 等同于 crxor 14, 14, 14 将CR3的EQ位 清零
比较指令
cmpli = Compare Logical Immediate
cmplwi bf, ra, ui 等同于 cmpli bf, 0, ra, ui Compare Logical Word Immediate
所谓逻辑比较,就是同 无符号整数比较
存储指令
sth = Store Half 并且是存储高位 (16-31位)
载入指令
lhz = Load Half and Zero 载入半字并将高16位清零
lwzx = Load Word and Zero Indexed 意思 是 lwzx RT, RA, RB (Ra+Rb就是 地址)
跳转
bccl = bctrl (有别名的助记符)
Branch Conditional to Count Register 条件跳转到 计数寄存器 指定的地址
逻辑操作
ori 或者 oril = OR Immediate 同16位立即数进行 或 操作
循环掩码操作
循环左移 然后进行掩码操作是
PowerPC指令集的精华包含了一组非常强大的指令集
移位指令
slwi = Shift left immediate 左移 几位(位数用立即数表示)
rotlwi = Rotate left immediate 循环左移
抽取
extrwi = Extract and right justify immediate 例如 extrwi RX, RY, 1, 0
等同于 rlwinm RX, RY, 1, 31, 31
rlwinm or rlinm (Rotate Left Word Immediate Then AND with Mask)
插入
清除
clrlwi = Clear left immediate
怪异清除
clrlslwi = Clear (Left Word) and Shift Left clrlslwi %r0, %r0, 24,8 等同于 rlwinm RA, RS, 24-8, 31-24 = rlwinm Ra, Rs, 16, 7 rlwinm RA, RS, SH, MB, ME 将R0向左循环移动掩码是 [8, 15]
影响CR的 运算
如果Overflow Exception (OE)设置1, 那么结果影响定点异常寄存器的 Summary Overflow (SO)和 Overflow (OV), 助记符是 后面加o, addo
如果Record (Rc)设置1那么结果影响 Less Than (LT) zero, Greater Than (GT) zero, Equal To (EQ) zero, 和 Summary Overflow (SO) 等条件寄存器CR 助记符 是 后面加”点” add.
算术运算
注意方向
subf = Subtract From 注意,被减数 是后面的那个寄存器
计数器循环
在扩展助记符中,计数寄存器的语义可以通过在 b 后面立即添加 dz 或 dnz 来指定。
符号扩展
extsb
将最右边的8位保存左边的24位清零或者置1依赖于 右边8位的最高位)
 算术运算
除法 divwu (Divide Word Unsigned)
乘法 mullw(Multiple Low Word)

View File

@@ -0,0 +1,160 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-04T21:53:18+08:00
====== PowerPC指令集 ======
Created Sunday 04 December 2011
http://hi.baidu.com/power_nq/blog/item/07915d005fd20c0b1d958396.html
PowerPC 体系结构规范PowerPC Architecture Specification发布于 1993 年,它是一个 64 位规范 ( 也包含 32 位子集 )。几乎所有常规可用的 PowerPC除了新型号 IBM RS/6000 和所有 IBM pSeries 高端服务器)都是 32 位的。
PowerPC 处理器有 32 个32 位或 64 位GPR通用寄存器以及诸如 PC程序计数器也称为 IAR指令地址寄存器或 NIP下一指令指针、LR链接寄存器、CR条件寄存器等各种其它寄存器。有些 PowerPC CPU 还有 32 个 64 位 FPR浮点寄存器。MPC555使用的PowerPC CPU是带有FPR的。一些常用寄存器介绍如下
通用寄存器的用途:
r0   在函数开始function prologs时使用。
r1   堆栈指针相当于ia32架构中的esp寄存器idapro把这个寄存器反汇编标识为sp。
r2   __内容表__toc指针idapro把这个寄存器反汇编标识为rtoc。系统调用时它包含__系统调用号__这个好像跟系统有关吧
r3   作为__第一个参数__和返回值。
r4-r10 函数或系统调用开始的参数。
r11   用在指针的调用和当作一些语言的__环境指针__。
r12   它用在异常处理和glink动态连接器代码。
r13   保留作为__系统线程ID__。
r14-r31 作为**本地变量**,非易失性。
专用寄存器的用途:
lr   链接寄存器它用来存放函数调用结束处的返回地址。
ctr   计数寄存器,它用来当作循环计数器,会随特定转移操作而递减。
xer   __定点异常寄存器__存放整数运算操作的进位以及溢出信息。
msr   机器状态寄存器,用来配置微处理器的设定。
cr   条件寄存器它分成8个4位字段cr0-cr7它反映了某个算法操作的结果并且提供条件分支的机制。
寄存器r1、r14-r31是**非易失性**的这意味着它们的值在函数调用过程保持不变。寄存器r2也算非易失性但是只有在调用函数在调用后必须恢复它的值时才被处理。
寄存器r0、r3-r12和特殊寄存器lr、ctr、xer、fpscr是易失性的它们的值在函数调用过程中会发生变化。此外寄存器r0、r2、r11和r12可能会被交叉模块调用改变所以函数在调用的时候不能采用它们的值。
条件代码寄存器字段cr0、cr1、cr5、cr6和cr7是易失性的。cr2、cr3和cr4是非易失性的函数如果要改变它们必须保存并恢复这些字段。
__sc__是PowerPC用来表示系统调用r2寄存器指定系统调用号r3-r10寄存器是给该系统调用的参数。在执行系统调用指令之前有两个额外的先决条件LR寄存器必须保存返回系统调用地址的值并且在系统调用前执行crorc cr6, cr6, cr6指令
===== 应用程序二进制接口ABI =====
从技术而言,开发人员可以将任一 GPR 用于任何操作。例如,由于不存在:“堆栈指针寄存器”,为此程序员就可以使用任何寄存器。实际上,定义一组约定很有用,这样二进制对象就可以与不同的编译器和预先编写好的汇编代码进行互操作。
调用约定是由使用的 ABI应用程序二进制接口决定的。ppc32 Linux 和 NetBSD 实现使用 SVR4System V R4ABI而 ppc64 Linux 仿效了 AIX使用 PowerOpen ABI。ABI 还指定当调用子例程时哪些寄存器被认为是易失型的(调用者保存(caller-save))以及哪些被认为是非易失型的(被调用者保存(callee-save)),以及许多其它内容。
SVR4 ABI 指定了一些行为的具体示例:
-由于 PowerPC 拥有如此多的 GPR32 个,而相比之下 IA32 只有 8 个),所以**传递参数的寄存器从 gpr3 **开始。
-寄存器 gpr3 到 gpr12 是易失型的(调用者保存)寄存器,如果需要的话,在调用子例程之前必须先保存它们并在返回之后恢复它们。 -寄存器 gpr1 用来作为栈帧指针。
===== 指令格式 =====
PowerPC指令包括操作码和操作数两部分PowerPC支持三操作数的指令格式。如算术指令
add rDrArB
表示把rArB的和存放到rD寄存器中。
注意:
指令中的点号“.”表示指令将__更新条件寄存器CR0__。如add. rDrArB。
指令中的字母“c”表示指令显示说明结果__影响XER寄存器中的进位位__[CA]如addc rDrArB。
指令中的字母“e”表示在指令中__把XER[CA]中的数据作为一个操作数__并在XER[CA]位记录进位位 如adde rDrArB
指令中的字母“o”表示__溢出标志__。对于整数在XER[OA]位记录溢出和在CR0[SO]记录溢出位如addo rDrArB
===== 条件寄存器 =====
条件寄存器CR包括8个4bit的字段即CR0CR7。每个字段可以表示整数运算或比较的结果。每个条件字段可以记录比较结果即大于、小于、等于和总体溢出等。条件寄存器格式如图1所示。
===== 异常处理器 =====
整数异常寄存器XER是一个特殊功能寄存器它包括一些对增加计算精度有用的信息和出错信息。XER的格式如下
SO为总体溢出标志一旦有溢出位OV置位SO就会置位。
OV为溢出标志当发生溢出时置位否则清零在作乘法或除法运算时如果结果超过寄存器的表达范围则溢出置位。
CA为进位标志当最高位产生进位时置位否则清零扩展精度指令后述可以用CA作为操作符参与运算。
===== 存储/加载指令 =====
1 整数存储指令
整数存储指令如表2所示。
表2 整数存储指令
名称 助记符 语法格式
字节存储(偏移地址寻址) stb rS, d(rA)
字节存储(寄存器寻址) stbx rS, rA, rB
记录有效地址的字节存储(偏移地址寻址) stbu rS, d(rA)
记录有效地址的字节存储(寄存器寻址) stbux rS, rA, rB
半字存储(偏移地址寻址) sth rS, d(rA)
半字存储(寄存器寻址) sthx rS, rA, rB
记录有效地址的半字存储(偏移地址寻址) sthu rS, d(rA)
记录有效地址的半字存储(寄存器寻址) sthux rS, rA, rB
字存储(偏移地址寻址) stw rS, d(rA)
字存储(寄存器寻址) stwx rS, rA, rB
记录有效地址的字存储(偏移地址寻址) stwu rS, d(rA)
记录有效地址的字存储(寄存器寻址) stwux rS, rA, rB
1 字节存储指令stb偏移地址寻址
stb rSdrA
有效地址为rA的内容加shuzhi drS的**低8位**内容存储到有效地址为EA的存储器中。
2 字节存储指令stbx寄存器寻址
stbx rSrArB
有效地址为rA的内容加上rB的内容rS的低8位内容存储到有效地址为EA的存储器中。
3 记录有效地址的字节存储指令stbu偏移地址寻址
stub rSdrA
有效地址EArAdrS的低8位内容存储到有效地址为EA的存储器中。__rAEA__如果rA0则指令无效。
4 记录有效地址的字节存储指令stbux寄存器寻址
stbux rSrArB
有效地址EArArBrS的低8位内容存储到有效地址为EA的存储器中rAEA如果rA0则指令无效。
5 半字存储指令sth偏移地址寻址
sth rSdrA
有效地址EArAdrS的低16位内容存储到有效地址为EA的存储器中。
6 记录有效地址的半字存储指令sthu偏移地址寻址
sthu rSdrA
有效地址EArAdrS的低16位内容存储到有效地址为EA的存储器中。rAEA如果rA0则指令无效。
7 字存储指令stw偏移地址寻址
stw rSdrA
有效地址EArAdrS的32位内容存储到有效地址为EA的存储器中。
8 记录有效地址的字存储指令stwu偏移地址寻址
stwu rSdrA
有效地址EArAdrS的32位内容存储到有效地址为EA的存储器中rAEA如果rA0则指令无效。
9 记录有效地址的字存储指令stwux寄存器寻址
stwux rSrArB
有效地址EArArBrS的32位内容存储到有效地址为EA的存储器中。rAEA如果rA0则指令无效。
10字存储指令stwx寄存器寻址
stwx rSrArB
有效地址EArArBrS的32位内容存储到有效地址为EA的存储器中。

View File

@@ -0,0 +1,62 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-04T22:05:40+08:00
====== 整数加载指令 ======
Created Sunday 04 December 2011
http://hi.baidu.com/power_nq/blog/category/powerpc%D6%B8%C1%EE
整数加载指令如表3所示。
名称 助记符 语法格式
高位清零加载字节指令(偏移地址寻址) lbz rD, d(rA)
高位清零的加载字节指令(寄存器寻址) lbzx rD, rA, rB
高位清零的加载字节并记录有效地址指令(偏移地址寻址) lbzu rD, d(rA)
高位清零的加载字节并记录有效地址指令(寄存器寻址) lbzux rD, rA, rB
高位清零的加载半字指令(偏移地址寻址) lhz rD, d(rA)
高位清零的加载半字指令(寄存器寻址) lhzx rD, rA, rB
高位清零的加载半字并记录有效地址指令(偏移地址寻址) lhzu rD, d(rA)
高位清零的加载半字并记录有效地址指令(寄存器寻址) lhzux rD, rA, rB
加载半字指令(偏移地址寻址) lha rD, d(rA)
加载半字指令(寄存器寻址) lhax rD, rA, rB
加载半字并记录有效地址指令(偏移地址寻址) lhau rD, d(rA)
加载半字并记录有效地址指令(寄存器寻址) lhaux rD, rA, rB
加载字指令(偏移地址寻址) lwz rD, d(rA)
加载字指令(寄存器寻址) lwzx rD, rA, rB
加载字并记录有效地址指令(偏移地址寻址) lwzu rD, d(rA)
加载字并记录有效地址指令(寄存器寻址) lwzux rD, rA, rB
1 lbz rD, d(rA) EArA|0d。从存储器读取EA地址的内容并加载低8位到rD__rD的其他位清0__。不影响其他寄存器。
2 lbzu rD, d(rA) EArAd。从存储器读取EA地址一个字节的内容并加载低8位到rDrD的其他各位清零有效地址EA存放在rA中。
3 lbzux rDrArB EArArB。从存储器读取EA地址一个字节的内容并加载低8位到rDrD的其他各位清零EA存放在rA中。如果rA0或者rArD则指令无效。
4 lbzx rDrArB EArA|0rB。从存储器读取EA地址一个字节的内容并加载低8位到rDrD的其他各位清0。
5 lha rD, d(rA) EArA|0d。从存储器EA处读取两个字节的数并加载到rD的低16位。__rD的其他位填充最高位的值__。
6 lhax rDrArB EArArB。从存储器EA处读取两个字节的数并加载到rD的低16位。rD的其他位填充最高位的值。
7 lhau rD, d(rA) EArAd。从存储器EA处读取两个字节的数并加载到rD的低16位。rD的其他位填充最高位的值。EA存放在rA中如果rA0或者rArD则指令格式无效。
8 lhaux rDrArB EArArB。从存储器EA处读取两个字节的数并加载到rD的低16位。rD的其他位填充最高位的值。EA存放在rA中如果rA0或者rArD则指令格式无效。
9 lhz rD, d(rA) EArA|0d。从存储器EA处读取两个字节的数并加载到rD的低16位。rD的其他位清零。
10lhzu rD, d(rA) EArA|0d。从存储器EA处读取两个字节的数并加载到rD的低16位。rD其他位清零。EA存入rA如果rA0或者rArD则指令格式无效。
11lhzux rDrArB EArArB。从存储器EA处读取两个字节的数加载到rD的低16位rD其他位清零。EA存入rA如果rA0或者rArD则指令格式无效。
12lhzx rDrArB EArA|0rB从EA处读取两个字节的数并加载到rD的低16位将rD的其他位清零。
13lwz rDdrA EArA|0d从EA处读取4个字节的数并加载到rD。
14lwzu rDdrA EArAd从EA处读取4个字节的数并加载到rD。rAEA如果rA0或rArD则指令格式无效。
15lwzux rDrArB EArArB从EA处读取4个字节的数并加载到rD。rAEA如果rA0或rArD则指令格式无效。
16lwzx rDrArB EArA|0rB从EA处读取4个字节的数并加载到rD。

View File

@@ -0,0 +1,18 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-04T22:12:43+08:00
====== 整数多字存储-加载指令 ======
Created Sunday 04 December 2011
http://hi.baidu.com/power_nq/blog/item/b3df6522f702c349ad34de93.html
表3 整数多字存储/加载指令
名称 助记符 语法格式
多字加载 lmw rDdrA
多字存储 stmw rSdrA
1 lmw rDdrA EArAd。以EA起始的__n个连续的字加载到通用寄存器GPRs rD到r31处n32rD。__EA必须为4的倍数如果rA0则指令格式无效。指令执行时间长。
2 stmw rSdrA EArAd。__把通用寄存器从GPRs rS到GPRs r31存储到以EA起始的n个连续的字存储器__EA必须是4的倍数。指令执行时间长。

View File

@@ -0,0 +1,152 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-04T22:23:54+08:00
====== 特殊寄存器传送指令 ======
Created Sunday 04 December 2011
http://hi.baidu.com/power_nq/blog/item/6b0fc1fb3e2d19849e51469c.html
表6 特殊寄存器传送指令
名称 助记符 语法格式
读取机器状态寄存器 mfmsr rD
写入机器状态寄存器 mtmsr rS
读取特殊功能寄存器 mfspr rD, SPR
写入特殊功能寄存器 mtspr SPR, rS
读取段寄存器 __mfsr__ rD, SR
写入段寄存器 mtsr SR, rS
间接读取段寄存器 __mfsrin__ rD, rB
间接写入段寄存器 mtsrin rS, rB
读取时基寄存器 mftb rD, TBR
1 读取机器状态寄存器指令mfmsr
指令的编码格式:
指令的语法格式:
mfmsr rD
读取MSR的内容放入rD中这是__超级用户层__指令不影响其他寄存器。
2写入机器状态寄存器指令mtmsr
指令的编码格式:
指令的语法格式:
mtmsr rS
把rS的内容存入MSR中这是超级用户指令。
1 读取特殊功能寄存器指令mfspr
指令的编码格式:
指令的语法格式:
mfspr rDSPR
指令操作:
n<—spr[5-9]||spr[0-4]
rD<—spr(n)
特殊功能寄存器SPR的编码如表7所示将SPR的内容存入rD中。
表7 Power PC UISA SPR编码
spr 寄存器名
编码n
spr[5-9] spr[0-4]
1 00000 00001 XER
8 00000 01000 LR
9 00000 01001 CR
2 写入特殊功能寄存器指令mtspr
指令的编码格式:
指令的语法格式:
mtspr sprrS
把rS的内容存入到指定的特殊功能寄存器中。
3 读取段寄存器指令mfsr
指令的编码格式:
指令的语法格式:
mfsr rDSR
指令操作:
rD<—SEGREGSR
将段寄存器SR的内容读入rD中这是一个超级用户层指令。
1 写入段寄存器指令mtsr
指令的编码格式:
指令的语法格式:
mtsr SRrS
将rS中的内容读入SR这是一个__超级用户层__指令。
2 间接读取段寄存器指令mfsrin
指令的编码格式:
指令的语法格式:
mfsrin rDrB
指令操作:
rD<—SEGREGrB[0-3]
由rB寄存器的__03位选取的段寄存器__的内容复制到rD zhong。这是一个超级用户层指令。
3 间接写入段寄存器指令mtsrin
指令的编码格式:
指令的语法格式:
mtsrin rSrB
指令操作:
SEGREGrB[0-3]<—rS
将rS中的内容复制到由rB的03位__所指定的寄存器__中。这是一个超级用户层指令。
4 读取时基寄存器指令mftb
指令的编码格式:
指令的语法格式:
mftb rDTBR
指令操作:
n<—tbr[5-9]||tbr[0-4]
if n=268 then
rD<—TBL
else if n=269 then
rD<—TBU
该指令的TBR编码如表8所示。
表8 指令mftb的TBR编码
TBR 寄存器名 访问
编码 tbr[5-9] tbr[0-4]
268 01000 01100 TBL 用户
269 01000 01101 TBR 用户

View File

@@ -0,0 +1,28 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-04T22:25:20+08:00
====== 系统调用指令 ======
Created Sunday 04 December 2011
http://hi.baidu.com/power_nq/blog/item/eaf346fa6ff70f2f4f4aea9d.html
1 系统调用指令sc
指令的编码格式:
指令的使用:
sc指令调用操作系统去执行服务程序。当控制返回到一个执行系统调用的程序时寄存器的内容依赖于程序提供的系统所使用的寄存器的约定。
跟在sc指令后面的**有效指令地址被放在SRR0**中。MSR中的位0、59和1631被放在S**RR1中对应的位置**SRR1中位14和1015被设置为未定义值。当sc异常产生__异常处理程序更改MSR寄存器__。异常处理程序到__MSR[IP]形成基址加0xC00偏移量__形成的地址去取下一条指令。
受影响的寄存器有依赖于系统服务、SRR0、SRR1及MSR。
2 中断返回指令rfi
指令的编码格式:
指令操作:
MSR[16-23,25-27,30-31] <—SRR1[16-23,25-27,30-31]
NIA<—iea SRR0[0-29]||0b00
SRR1中的位0、59和1631被放在MSR中对应的位置。如果新的MSR值没有使能任何未完的操作则在MSR的控制下从地址SRR0[0-29]||0b00取下一条指令。
指令的使用中受影响的寄存器为MSR

View File

@@ -0,0 +1,86 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-12-04T22:14:51+08:00
====== 转移指令 ======
Created Sunday 04 December 2011
http://hi.baidu.com/power_nq/blog/item/b3df6522f702c349ad34de93.html
表4 分支控制指令
名称 助记符 语法格式
无条件转移 b( ba bl bla) target_addr
条件转移 bc( bca bcl bcla) BO,BI,target_addr
条件转移转移目标地址由LR指出 bclr(bclrl) BO,BI
条件转移转移目标地址由CTR指出 bcctr(bcctrl) BO,BI
1 无条件转移指令bxb ba bl bla
指令的编码格式:
指令的语法格式:
b target_addrAA=0 LK=0
ba target_addrAA=1 LK=0
bl target_addrAA=0 LK=1
bla target_addrAA=1 LK=1
如果AA0则转移目标地址为LI||0b00的值经符号位扩展后加上指令地址。
如果AA1则转移目标地址为LI||0b00的值经符号扩展后的值。
如果LK1则转移指令下一条指令的有效地址存放到连接寄存器。
1 条件转移指令bcx
指令编码格式:
指令语法格式:
bc BO, BI, target_addrAA0 LK0
bca BO, BI, target_addrAA1 LK0
bcl BO, BI, target_addrAA0 LK1
bcla BO, BI, target_addrAA1 LK1
BI字段表示条件寄存器__CR中的位__用于转移条件。BO字段操作码定义见表5。
表5 BO字段操作码定义
BO 说明
0000y 计数器CTR减量如果条件不成立则转移
0001y 计数器CTR减量如果条件不成立则转移
001zy 如果条件不成立,则转移
0100y 计数器CTR减量如果条件成立则转移
0101y 计数器CTR减量如果条件成立则转移
011zy 如果条件成立则转移
1z00y 计数器CTR减量如果CTR0则发生转移
1z01y 计数器CTR减量如果CTR0则发生转移
1z1zz 发生转移
位z表示该位可以被忽略位y表示是不是条件转移
2 条件转移指令bclx转移目标地址由LR指出
指令的编码格式:
指令的语法格式:
bclr BO, BI(LK=0)
bclrl BO, BI(LK=1)
BI字段表示条件寄存器CR中的位用于转移条件。
BO字段操作码定义如表5所示。
转移目标地址为LR[0-29]||0b00。
如果LK1则转移指令下一条有效地址存放到连接寄存器。
3 条件转移指令bcctrx转移目标地址由CTR指出
指令的编码格式:
指令的语法格式:
bcctr BO, BI(LK=0)
bcctrl BO, BI(LK=1)
转移目标地址是CTR||0b00。
如果LK1则转移指令下一条指令的有效地址存放到连接寄存器。
如果减量计数器BO[2]=0指令格式无效则转移到目标地址。

View File

@@ -0,0 +1,183 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-25T19:51:58+08:00
====== PowerPC简介 ======
Created Friday 25 November 2011
http://baike.baidu.com/view/405903.htm
PowerPC是一种RISC架构的CPU其基本的设计源自IBM的POWERPerformance Optimized With Enhanced RISC 的缩写)架构。
===== 目录 =====
简介
详细信息
Motorola系列微处理器
PowerQUICC系列
PowerPC联盟三巨头
联盟运作
PowerPC发展史
  POWER是1991年Apple、IBM、Motorola组成的**AIM联盟**所发展出的微处理器架构。PowerPC是整个AIM平台的一部分并且是到目前为止**唯一**的一部分。PowerPC 的历史可以追溯到早在1990年随RISC System/6000一起被介绍的IBM POWER架构。该设计是从早期的RISC架构比如IBM 801与MIPS架构的处理器得到灵感的。
  
  PowerPC 处理器有广泛的**实现范围**,包括从诸如 Power4 那样的高端服务器CPU 到嵌入式 CPU 市场 PowerPC任天堂 Gamecube 使用了 PowerPC。PowerPC 处理器有非常强的嵌入式表现,因为它具有优异的性能、较低的能量损耗以及较低的散热量。除了象串行和以太网控制器那样的集成 I/O该**嵌入式处理器**与台式机CPU 存在非常显著的区别。例如4xx 系列 PowerPC 处理器**缺乏浮点运算**并且还使用一个受软件控制的__ TLB __进行内存管理而不是象台式机芯片中那样采用反转页表。
  PowerPC 处理器有 32 个32 位或 64 位GPR通用寄存器以及诸如 PC程序计数器也称为 IAR指令地址寄存器或 NIP下一指令指针、LR链接寄存器、CR条件寄存器等各种其它寄存器。有些 PowerPC CPU 还有 32 个 64 位 FPR浮点寄存器
  PowerPC 体系结构是 RISC精简指令集计算体系结构的一个示例。因此
*   所有 PowerPC包括 64 位实现)都使用**定长**的 32 位指令。
*   PowerPC 处理模型要从内存检索数据、在寄存器中对它进行操作,然后将它存储回内存。几乎没有指令(除了装入和存储)是**直接**操作内存的。
===== Motorola系列微处理器 =====
  
  Motorola的基于PowerPC体系结构的嵌入式处理器芯片有MPC505、821、850、860、8240、8245、8260、8560等近几十种产品其中MPC860是Power QUICC系列的典型产品MPC8260是Power QUICC II系列的典型产品MPC8560是Power QUICC III系列的典型产品。
===== PowerQUICC系列 =====
  
=== Power QUICC系列微处理器 ===
  Power QUICC系列微处理器一般有三个功能模块组成**嵌入式PowerPC核(EMPCC)**, **系统接口单元(SIU)**以及**通信处理器(CPM)模块**这三个模块内部总线都是32位。
  嵌入式PowerPC核由嵌入式PowerPC核心、指令和数据缓存(Cache)及其各自的存储器管理单元(MMU)组成从功能上Power PC核可分为两个功能模块:**整数模块和加载/存储模块**。整数和加载/存储操作均由具有32位内部数据通道支持32位整数操作及算术操作的硬件直接执行。PowerPC核中的整数模块使用32 X 32 bit定点通用寄存器每时钟周期可以执行一条整数处理指令。整数模块中的单元仅在数据队列中的有效数据被传输时才被占用这样使得PowerPC核一直处于__低功耗__工作模式。
  系统接口单元SIU的功能是提供**内部总线和外部总线的接口**该接口单元具有32位微处理器的几乎所有的通用接口特性尽管Power PC核内部总线为32位但通过SIU可以将**外部总线**宽度__动态地配置__成8、16或32位以兼容数据总线宽度为8、 16或32位的外设或存储器。
  SIU单元中的存储器控制器支持最多与高达8组存储器的无缝连接每组的容量从32K字节到256M字节可变数据总线宽度可由4个独立的使能信号控制为8bits, 16bits或32bits。支持的存储器类型包括SRAM、SSRAM、EPOM、Flash ROM、DRAM, SDRAM等。存储器控制器为每一组存储器分别提供了可选的0到15个的等待状态以适应不同速度的存储器。SIU也支持其它需要双时钟访问的外部SRAM 和用突发方式访问的外部设备。SIU单元还提供其它几种功能:总线监视、假中断监视、软件看门狗、定时中断、复位控制、不占用内部开销的片内总线仲裁、JTAG1149.1测试口等。
  Power QUICC中除集成了PowerPC核还集成了一个32位的__RISC内核__。Power PC核主要执行**高层代码**而RISC则处理实际通信的**低层通信功能**两个处理器内核通过高达8K字节的内部双口RAM相互配合共同完成MPC854强大的通行控制和处理功能。CPM以RISC控制器为核心构成除包括一个RISC控制器外还包括七个串行DMA(SDMA)通道、两个串行通信控制器(SCC)、一个通用串行总线通道(USB)、两个串行管理控制器(SMC)、一个I2C接口和一个串行外围电路(SPI)可以通过灵活的编程方式实现对Ethemet、USB、T1/E1,ATM等的支持以及对UART, HDLC等多种通信协议的支持。
=== Power QUICC II系列微处理器 ===
  Power QUICCII 完全可以看作是Power QUICC的第二代在灵活性、扩展能力、集成度等方面提供了更高的性能。Power QUICC II同样由嵌入式的PowerPC核和通信处理模块CPM两部分集成而来。这种__双处理器__器的结构由于CPM承接了嵌入式Power PC核的外围接口任务所以较传统结构更加省电。CPM交替支持三个快速串行通信控制器(FCC),二个多通道控制器(MCC),四个串行通信控制器(SCC),二个串行管理控制器(SMC),一个串行外围接口电路(SPI)和一个12C接口。嵌入式的Power PC核和通信处理模块(CPM)的融和以及Power QUICCII的其他功能、性能缩短了技术人员在网络和通信产品方面的开发周期。
===== Power QUICCIII系列微处理器 =====
  同Power QUICCII相比Power QUICCIII集成度更高、功能更强大、具有更好的性能提升机制。Power QUICCIII中的CPM较Power QUICCII产品200MHz的CPM的运行速度提升了**66%**达到333MHz同时保持了与早期产品的向后兼容性。这使得客户能够最大范围的延续其现有的软件投入、简化未来的系统升级、又极大的节省开发周期。Power QUICCIII通过微代码具有的可扩展性和增加客户定制功能的特性能够使客户针对不同应用领域开发出各具特色的产品。这种从Power QUICC II开始就有的微代码复用功能已经成为简化和降低升级成本的主要设计考虑。
===== PowerPC联盟三巨头 =====
  
  1991年七月由苹果电脑、IBM、摩托罗拉三家公司联合发表共组__PowerPC联盟__的声明。声明中强调联盟的目标是
   IBM与苹果电脑将致力发展一套完全以__物件导向技术__的开放系统软件标准。
   IBM与苹果电脑计划要合作进一步整合麦金塔使其成为主从结构之环境。
   苹果电脑将调整未来IBM RS/6000 POWER结构**称为PowerPC**之单芯片,以用于未来苹果电脑的麦金塔个人电脑系统。
   IBM及苹果电脑计划合作创造一个广大工业发展的独立标准软件环境的证照。
   通过摩托罗拉将协助联盟,建立软硬件结合的标准。
  这个意欲打破由微特尔所垄断个人电脑市场的决定立刻在华尔街股市引起相当的震荡。因为联盟的三大发起公司英文名称是APPLE、IBM、MOTOROLA因此也有人称做AMI PowerPC联盟。
  就个人电脑的市场占有率来看WINTEL已占了全球百分之九十以上的市场。软硬双雄掌握电脑软硬件的核心真是不可一世。PowerPC联盟要想进行仰攻并不是一件容易的事。因此他们从硬件结构、系统整合、操作系统进行全面规划希望能以RISC的CPU、支援多种操作系统等崭新技术重建新的电脑规范。
  联盟的信心来自于,是软件推动着电脑工业前进,而决定软件未来的发展,就是物件导向技术。而该电脑工业得以发展无忧的关键因素,则是开放标准。而这两大武器,联盟都已齐备。
  苹果电脑可说是微电脑的先行者。她以八位的微电脑起家掳获了全球玩家的心。尤其是苹果二号在全球热卖让苹果电脑成为微电脑的代名词。而这股微电脑的热潮撼动了IBM。原本认为微电脑只不过是玩具的IBM高层大吃一惊。于是下令所属研发微电脑技术极其仓促地推出所谓个人电脑的结构欲与苹果电脑争雄。
  后来苹果电脑输掉此役王气于一夕之间黯然而收。因此苹果人长久以来一直认定IBM是他们可恨的敌人。
  然而苹果电脑在操作界面的优异表现总令苹果迷惊艳不已。而与MOTOROLA长久以来的合作默契也让苹果电脑在麦金塔系列的决定采用摩托洛勒所设计的68x系列继续与微软对抗到底。
  后来苹果独力研发RISC芯片及相关的操作系统。由于费用庞大难以支撑。而MOTOROLA的芯片仍然是CISC。也因此才有了与IBM合作的契机。
  IBM则是挟其威名用**十六位**电脑击退了苹果小子而成为__个人电脑的系统规格制定者__。当初采行开放结构的政策确实壮大了个人电脑的声势并迅速拓展市场最终引来各方菁英加入竞逐。但由领衔制定的规格并没有为带来多少财富甚至于连权杖都未能取得。譬如个人电脑的硬件基本元件是英特尔的产品。操作系统则由微软把持至今。而组装后的个人电脑其全球市占率首位早期是康百克后来则是戴尔。
  向以强大的研发实力称雄业界。他拥有坚强的硬件设计实力如诸多专利、中大型主机系列的。就个人电脑的操作系统而言则有OS/2。可是个人电脑的皇冠竟然落在别人头上最后连为人作嫁的系统组装都输给了后起之秀。这对蓝色巨人而言正是孰可忍孰不可忍
  摩托洛勒早期以八位的6502 CPU与苹果电脑合作愉快。在芯片设计也颇为自诩其功力,不料却败在英特尔手下,只得暂时放下个人电脑市场,转战无线通讯、数位讯号处理等领域。
  做为苹果电脑唯一的CPU供应商,摩托洛勒不但要设法保住这仅有的市场,还必须求新、求变,设法做到更快、更好、更便宜。进入九十年代,麦金塔系列推出新一代的操作系统,其功能更强大,操作介面更亲和。同时也需要硬件提供更强而有力的支援。
  IBM与英特尔,摩托洛勒拟扳倒后者的心甚于其他。经过仔细的评估,摩托洛勒认为跟IBM有合作空间,与英特尔则是死敌。
  虽然三者过往有许多恩怨,然而,摩托洛勒之于英特尔,苹果电脑之于微软,IBM之于英特尔、微软,他们与WINTEL的错综复杂的关系,实可载录成一册恩仇录。事实上,三者结盟是互蒙其利,又极具新闻的耸动性。最后三家公司,终于做出史无前例的决定:合组联盟。齐力制定工业标准,推动新一代个人电脑的软硬件结构。
  结盟后,三家厂商确实是互蒙其利的。苹果电脑获得两大世界级的厂商,提供CPU技术不断更新的保证。因为摩托洛勒的68000芯片已后继乏力,88000芯片也宣告停止,要确保后续新款机型的发展,不是寻求新的奥援,就是加入英特尔阵营。虽然,苹果对此也表示兴趣,曾将麦金塔操作系统改成英特尔的处理器的版本。
  而摩托洛勒加入联盟后,不但可以挥别芯片开发失败的阴影,获得传媒正面的青睐。还能在芯片制造分一杯羹,进一步获得IBM制程上的技术转移及芯片开发的强力支援。更重要的是,摩托洛勒能从协助开发芯片的过程,汲取必要的经验,为自己下一颗芯片铺路。
  IBM则是通过这两大伙伴,重新进入个人电脑市场。在这个市场里,IBM则享有绝对的发言权。虽然已经拥有OS/2,不过IBM对苹果电脑的物件导向操作系统还是很感兴趣。若这个市场能够成功,相关工作如芯片制造、硬件生产、系统整合与组装,也不是IBM一家公司就能吃得下来。因此,IBM也需要摩托洛勒在产能上的奥援。
  虽然PowerPC芯片的核心来自IBM的RS-6000,但为了借重摩托洛勒在无线传输的芯片设计能力,PowerPC芯片的汇排流采用了摩托洛勒的设计。这么一来,不但能够拉拢摩托洛勒,也可确保苹果电脑在旧款麦金塔努力的成果。
  1992年三月,三家公司进驻PowerPC所在基地,位于德州奥斯汀的山丘上,成立了索摩赛特(Somerset)设计中心。因为奥斯汀向来是IBM及摩托洛勒研发处理器的重镇,因此PowerPC芯片也选在这里。这个名字来自圆桌武士寻找圣杯的传奇故事。阿瑟王就是在索摩赛特(英国西南部的一郡)召集圆桌武士,共商寻找圣杯的大计。而这个字也有翻筋斗的意思,颇有孙悟空大闹天宫的翻转之意。
  由于,该芯片来自IBM的大型电脑技术,基础工作已经完成。这个计划的工作人员,只要将处理器技术调整成个人电脑可用,提供速度更快的处理器及原型机就可以了。
===== 联盟运作 =====
  
  联盟三巨头,个个有来头,因此联盟采行的是松散制联盟。也就是说,联盟的目标一致,但彼此并没有隶属关系,运作时也难以强制成员遵行。不过联盟负责制定规格、进行授权与认证等相关工作。
  分工方面,摩托洛勒主司芯片设计、制造。苹果电脑则是负责操作系统,还有组装及销售。IBM不愧是信息界的全能选手,他从上游的芯片设计、制造,到中游的系统整合、测试、操作系统,及下游的组装、销售,不但能全面参与,向来亦是个中好手。
  联盟宣布成立时台湾也立即由工研院电通所主导成立了『台湾新个人电脑联盟TNPCTaiwan New PC Consortium』。初期的成员包括大同、神达、大众、力捷、旭青、联电等厂商。
  与摩托洛勒向与台湾业界交好为了宣示全力支援两家公司联手在台湾成立『PowerPC技术中心』以示支持的决心。与摩托洛勒认为若有台湾电脑厂商支持PowerPC便很有机会拓展市场并尽快压低制造成本。而要使厂商支持垂手可得的技术资料、即时的技术支援是消弥障碍的第一步。
  不过,由于早期苹果二号在台湾遭到盗拷的不愉快经验,加上麦金塔在台湾的市场并不大,苹果电脑迟迟未选派人员进驻于此中心。使得TNPC的运作,只能以台湾较为熟悉的微软系统为主。
  后来,WINTEL更施出『汉贼不两立』的策略。TNPC运作不畅,原始厂商纷纷退出,只有力捷一家投入制造麦金塔相容机种。
  联盟力推的结构是『共用平台』。这个观念是希望做到,在同一个硬件结构上,可以同时执行多种操作系统。这与微软的目的不同,微软的新技术核心(就是NT命名的由来),则是希望同一个操作系统能够在不同的硬件上执行。
  PowerPC联盟承诺要做到:
   CPU采用新一代RISC CPU,扬弃CISC的过时结构。
   共用平台、开放环境。
   操作系统采微核心为结构。
   软件开发采物件导向。
   应用软件以文件为导向。
   以人为本的科技HCTHuman Centric Technology。它拟结合现有辨识技术、通讯、家电等。如语音、手写、视觉等辨识方式通讯如电视、广播甚至是具备智能的信息技术为人服务。
  以上这些技术是较新的技术,多半曾在其他平台出现。但很少有那家的硬件平台,做出如此多的商业承诺。PowerPC联盟在三巨头的带领下,并在诸多协力厂商的支援,提出了这个全新的个人电脑结构。
  IBM希望能够有一个开放的硬件环境,这个环境就是以PowerPC芯片为标准。硬件周边设备、操作系统、软件开发、应用软件,只要与这个标准相容,就可以在不同厂商组装出来的PowerPC机器上使用。
  这个由IBM所公布的标准,包括了处理器、汇排流、存贮器、输入输出等。操作系统设计者,只要按照这个硬件规格来设计,操作系统就成顺利在符合规格的机器上执行。
  而各家厂商只需要花钱购买硬件规格毋需支付权利金给或联盟就能生产。这就是第一代的硬件平台称做参考平台PREPPower PC Reference Platform。而与之相容的操作系统有AIX、Windows NT。
  不过由于缺乏苹果电脑的支援Mac OS并没有被转移到后来连一再宣称的也没能顺利移植过来。在缺乏两大主要操作系统的支援下只好宣告失败。
  第二代的平台则称为共用硬件参考平台CHRPCommon Hardware Reference Platform尽量使用业界的标准元件及开放式的设计吸引了不少有兴趣的厂商投入。而苹果电脑也宣称将全力支援这个平台。然而整个的开发时程延宕许久迄今仍在开发中。
  在软件开发进度严重延宕的情形下,三大巨头只好不断宣示对CHRP的支持,以杜绝外界纷扰的流言。因为许多厂商担心这个平台会重蹈PReP的覆辙,这样一来会令他们的心血全部作废。CHRP初期以MacOS及WINNT为两大转移目标,希望能够一举攻下由两大操作系统主宰的市场。
===== PowerPC发展史 =====
  
  1980
  IBM 发布了第一台基于__RISC(精简指令集计算机)架构__的原型机。早在上世纪70年代初基于IBM 科学家 John Cocke的发明RISC的理念大大简化了计算机操作指令加快系统运行速度使得计算机性能得到大幅度提升。如今RISC架构已经广泛应用于众多工作站和UNIX服务器系统中并被看作是未来主流的计算架构。
  1990
  IBM 推出基于RISC系统、运行AIX V3的新产品线RS/6000(现在称为IBM eServer p系列)。该系统架构后来被称为POWER(POWER1)意为增强RISC性能优化(Performance Optimization With Enhanced RISC)架构。
  1991
  IBM和苹果、摩托罗拉公司达成一系列合作协议内容包括推出支持苹果 Macintosh个人电脑与IBM网络相连的全新产品;推出面向PC机和低成本工作站的RISC架构PowerPC处理器;形成一个开放的系统环境保证IBM AIX和苹果Macintosh软件程序在两家公司设计的RISC系统中都能运行。此外开放的系统环境包括其他一些技术协议。
  1993
  IBM 推出可升级的POWER并行系统这是第一款采用RS/6000技术基于微处理器的超级计算机。在该系统中IBM 首次应用多处理器技术,可将复杂密集的任务进行分解,大大加快了计算机的运算速度,开创了业界先河。
  IBM和摩托罗拉公司推出PowerPC 601处理器该处理器是与苹果共同开发的。PowerPC上集成280多万个晶体管主频为50 MHz。
  IBM 发布了66 MHz 的POWER2 处理器首先应用于RS/6000系统。
  1994
  IBM 推出可升级的POWER并行系统 2 (Scalable POWERparallelSP2)。美国康乃尔理论研究中心配备了SP2超级计算机运行速度高达1360亿次/秒。欧洲粒子物理学实验室(CERN)采用一款64节点、运行AIX系统的IBM SP2速度位于欧洲前列。
  IBM 成功研发出新一代PowerPC 604处理器其强大的处理性能在批量生产的处理器产品中处于领先地位。IBM 技术人员还推出了业内最快的“无损”数据压缩芯片每秒钟能处理40 MB数据。7月IBM 交付第一百万个PowerPC 601 处理器。
  IBM发布首个基于Power 架构的嵌入式控制器PowerPC 403GA。
  1995
  __PowerPC64__位RISC处理器开始应用于IBM AS/400 操作系统中。
  8月苹果公司推出首款基于Power架构的笔记本电脑 PowerBook 500它采用IBM的 PowerPC 603e 处理器。
  1996
  IBM 推出全新的32位POWER2超级芯片(P2SC)主频达135 MHz 首先应用于RS/6000系统。基于POWER2 架构的P2SC采用了高密度CMOS技术单个芯片上集成1500万个晶体管。
  1997
  IBM“深蓝”超级计算机在经过多局较量后击败了国际象棋冠军Garry Kasparov。“深蓝”是一款32节点的IBM RS/6000 SP计算机处理器采用32位P2SC运行AIX操作系统。在比赛期间“深蓝”的平均运算速度为每秒1亿2600万步。目前这台超级计算机被安放在美国华盛顿特区的史密森国家博物馆内。
  IBM 为美国国家宇航局提供一款32位的PowerPC微处理器其运算速度可达每秒3500万次主要用于__火星探测__计划。经过洛克希德马丁实验室改造后最终形成可抗辐射的RAD 6000芯片植入火星登陆车Sojourner Rover内部的计算机系统中。
  1998
  由IBM和美国劳伦斯利弗莫尔国家实验室共同研发的“蓝色太平洋”超级计算机问世。这台计算机采用PowerPC 604处理器主频高达332 MHz系统包含176个节点最高运算速度为每秒3.9万亿次(比一般台式电脑快1.5万倍),存储容量超过 2.6 TB (是普通PC机的8万倍)。“蓝色太平洋”一秒钟内的计算量相当于一个人使用计算器连续计算6万3千年的总和。
  IBM 推出世界上第一组基于**铜的微处理器** PowerPC 740/750工作频率为 400 MHz。由于使用了铜芯片技术处理性能提高了近1/3。
  全新64位POWER3 处理器将**POWER2 架构(P2SC) 与PowerPC 架构相结合**并对技术应用进行了优化。POWER3 的最高运算速度可达每秒200万次比“深蓝”所采用的POWER2 超级芯片快出一倍多。
  IBM 公布了首个基于Power的嵌入式系统芯片(SoC)内核。不久之后PowerPC 405 内核也将同其他IP相结合形成嵌入式SoC微处理器和基于Power的特定应用集成电路(ASIC)解决方案。
  1999
  IBM 研究院投资1亿美金开发一种新型的Power架构超级计算机。这种名为“蓝色基因”的计算机峰值速度超过1 Peta FLOP比当时最快的超级计算机高出500倍。它将被用来模拟复杂蛋白质的折叠。
  自正式推出铜芯片一年后IBM 交付了第一百万个铜技术PowerPC 芯片。
  6月IBM 发布了第一个基于405内核的系统芯片PowerPC 405GP。下半年IBM 即推出了再下一代嵌入式PowerPC内核。
  IBM与任天堂公司共同宣布了一项价值10亿美元的技术协议IBM将为任天堂的下一代家庭游戏机GAMECUBE提供增强版PowerPC 芯片。新产品性能将超出任何其他家庭游戏系统,为玩家呈现更佳的图像效果和更逼真的动作画面。
  2000
  IBM 宣布将高速PowerPC 处理器与电视机顶盒(STB)组件一起整合到一个“__单芯片系统__”上从而在系统性能、价格和设计等方面为机顶盒厂商带来竞争优势。该单芯片系统拥有众多的先进应用并能帮助三星等公司灵活应对不断变化的客户需求。
  IBM 将RS/6000更名为**IBM eServer p**系列。
  2001
  IBM 新一代超机计算机“ASCI White”在美国劳伦斯利弗莫尔国家实验室投入使用运算速度高达每秒12.3万亿次,主要用于模拟核爆炸试验。作为美国国家核安全管理局 (NNSA)提高战略运算能力计划(ASCI)的组成部分该系统强大的运算能力可以在不到1分钟时间内处理地球上每个人发出的一次互联网操作请求。
  在经过5年潜心研发后IBM推出世界上最强大的UNIX服务器—__eServer p690__(“Regatta”)。新系统基于先进的**POWER4**处理器集成了多项主机技术。由多台p690服务器连接而成的超级计算机拥有1000多个 POWER4处理器能够完成最为复杂的运算任务。
  索尼、东芝和IBM宣布合作共同开发一种用于宽带设备的高级芯片架构这款代号为“CELL”的芯片将采用业界最先进的芯片研发和制造技术。应用该产品的设备性能将超过IBM“深蓝”超级计算机并能以更低的功耗实现超高速宽带上网。
  2002
  IBM 推出64位**PowerPC 970**处理器, 这款高性能产品可应用于普通台式机、入门级服务器等多种环境中。64位的PowerPC 970芯片基于POWER4服务器架构采用独特的单指令多数据流(SIMD)单元拥有超强处理性能。此外它还采用了“Elastic I/O”内部总线结构这是业界最快的处理器总线之一。
  IBM 推出速度更快的POWER4+ 。截至2003年POWER4+ 已经应用于全部pSeries产品线。
  IBM 推出32路eServer iSeries 890服务器其处理性能为 i840的两倍采用1.3 GHz POWER4 处理器单个芯片上集成了1亿7400万个晶体管。
  IBM 推出嵌入式__PowerPC 440GP 和PowerPC 440GX 处理器主要运行嵌入式网络和存储应用__。PowerPC 440GX拥有TCP/IP负载加速功能在全部的5项EEMBC基准测试中得分均高于任何其它的“单芯片系统”处理器。
  2003
  IBM 宣布一个有关32位嵌入式PowerPC 内核的公开授权计划。
  IBM和苹果公司联手推出世界上第一款64位台式机处理器—PowerPC G5工作频率达2.0 GHz。苹果公司称新的Power Mac G5电脑是“世界上最快的个人电脑”。
  IBM 宣布推出划时代的“Blue Gene/L”原型机。这款超级计算机尺寸仅相当于30英寸彩电大小它的问世将为科学界和IT业发展带来深远影响。最终版“Blue Gene/L”超级计算机将于2005年诞生占地面积相当于半个网球场总共包含65536个节点(PowerPC)和64个机架预计其峰值速度将达到360 Tera Flops。
  IBM 宣布eServer pSeries 630将采用POWER4+ 处理器。等到eServer pSeriesp615发布后POWER4+ 已经应用于全部pSeries产品线。
  IBM 推出首款采用64位PowerPC技术的刀片服务器BladeCenter JS20扩大了客户的选择范围提高投资回报率实现快速经济的计算性能扩展。
  IBM 推出全新的PowerPC 750GX。与 PowerPC 750相比新产品的二级缓存扩大了一倍由原先的512KB变为1MB。
  2004
  IBM宣布开发出一种制造低功耗、高性能微处理器的新方法首次把绝缘硅(SOI)、应变硅和铜制程三种技术工艺结合在一起。64位PowerPC 970FX成为首款采用新技术生产的处理器产品并在业内评选中荣获大奖。
  IBM 交付第4000台eServer p690服务器该产品基于POWER 架构是世界上最受欢迎的UNIX服务器。
  IBM发布“Power Everywhere”战略围绕POWER架构开展一系列合作计划并建立POWER技术创新社区。从全球最强大的企业系统、超级计算机到普通游戏机、嵌入式设备POWER架构已经广泛应用于各类产品中。
  索尼公司宣布取得IBM Power处理器架构授权。索尼表示POWER产品丰富的功能和低功耗、高性能的特点将使其成为客户设备的首选。
  IBM 推出业界首款基于Power 架构的刀片服务器—eServer BladeCenter JS20。
  IBM 在全球范围内建立Power架构中心为客户设计POWER系统提供支持。
  IBM 推出一项创新的软件技术帮助客户开发先进的Power 架构处理器,并对设计流程进行整合,以实现更快速、更经济的研发目标。
  IBM 正式发布新的eServer i5服务器这是世界上第一台采用**POWER5**处理器的服务器产品。具有划时代意义的POWER5是IBM有史以来最强大的64位处理器。
  IBM推出基于POWER 5处理器的OpenPower 720服务器相对于HP和Sun的入门级 UNIX和Linux 系统而言这款__Linux专用服务器__有着明显的价格优势。
  IBM在其developerWorks 网站上 开辟了__Power架构技术专区__为众多基于POWER平台的芯片设计人员、验证工程师、嵌入式系统及软件研发人员提供丰富的技术资源。
  IBM 推出基于POWER 架构的TotalStorage DS6000 和 DS8000 存储系统。
  IBM 推出三款全新的POWER5服务器树立起高端计算领域的新标准。其中IBM eServer p5 595、eServer i5 595拥有强大的处理性能和虚拟能力而32路的IBM eServer p5 590和eServer pSeries p690相比速度高出45%价格则降低45%。
  __在网络设备市场上Power架构服务器占据了三分之二的市场份额。__
  自2004年4月以来已有超过1400名研发人员加入了Power 架构团队。
  IBM“Blue Gene/L”超越日本NEC公司的地球模拟器成为世界上速度最快的超级计算机。在Linpack基准测试中IBM“Blue Gene/L”系统的性能达到360Tera Flops刷新了地球模拟器在2002年创造的35.86Tflop的世界记录。
 __ 在全球排名前10位的超级计算机中共有5台采用了Power 架构比第二位高出一倍。__
  IBM 预发布新的高密度POWER5服务器系统—IBM eServer p5 575。该产品可以通过简单的集群方式组成高性能超级计算机为未来超级计算机的发展指明了方向。
  IBM宣布基于POWER5处理器、运行DB2通用数据库的IBM eServer服务器在TPC-C基准测试中突破了每分钟300万次的处理极限创造了新的世界纪录。
  2005
  10月IBM发布System p5产品线采用基于POWER5处理器的增强版——POWER5+处理器并提供一系列更优化功能。产品一经推出就打破15项计算领域的世界纪录。
  新的POWER5+处理器被称为“__片上服务器”(server on a chip)__它包括2个处理器一个高带宽系统交换器一个更大高速缓存和I/O界面。最新的POWER5+有1.5和1.9GHz两个主频选择最大72MB板上高速缓存支持逻辑分区技术可使System p5为用户提供更强大性能而占用面积更小。
  发布QCM技术即四处理器内核模块。
  2006
  2月发布破多项记录的System p5中端产品最大限度满足用户对产品不同定位的需求。System p5产品所取得的世界记录已经达到70余项其动力主要来自以全新2.2GHz POWER5+处理器为代表的POWER处理器和显著提高计算密度的QCM(4内核处理器模块)处理器封装技术,后者可使产品在紧凑空间中成倍增加了计算能力。

View File

@@ -0,0 +1,25 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-25T19:49:33+08:00
====== IBM POWER ======
Created Friday 25 November 2011
http://baike.baidu.com/view/66226.htm
**概述**
  POWER是Performance Optimization With Enhanced RISC的缩写它指
  1. 一种由IBM公司设计开发的一种基于RISC架构的__指令集体系构架__ISA)被称为POWER ISA。
  2. 是实现了POWER ISA的处理器系列的名称。POWER系列处理器在不少IBM服务器、超级计算机、小型计算机及工作站中广泛作为主CPU使用。而PowerPC架构也是源自POWER架构并应用在苹果的麦金塔计算机及部份IBM的工作站上。
**POWER处理器历史**
  POWER1。第一代的POWER处理器诞生于1990年2月随着IBM的RS/6000系列计算机系统发布。
  POWER2。于1993年11月发布 并在当时成为性能最高的处理器。
  POWER3。于1998年发布。POWER3以及随后的POWER系列处理器均全部实施了**64-bit** PowerPC架构并都不再支持更早之前的旧POWER指令集架构ISA)包括PowerPC指令集架构或任何POWER2所追加延伸的指令如lfq或stfq等都不再具备与支持。
  POWER4。于2001年发布。POWER4是第一款频率超过1GHz的POWER处理器。POWER4实现了POWER ISA v.2.00。.
  POWER5。于2004年发布。POWER5是一款**双核**处理器,并在逻辑上实现了**4核心**运算。
  POWER6。于2007年5月发布。POWER6采用了65纳米工艺设计。摒弃了乱序运算单元而采用顺序运算的流水线设计。其最高运行频率达到了恐怖的5GHz。对应POWER ISA v.2.03。
  POWER7。于2010年2月发布。POWER7采用了45纳米的SOI工艺设计。运行频率介于3.0 GHz到4.25 GHz之间。每个处理器4、6或者8核心且每核心可以采用4路SMT线程。且由于芯片同时集成了SRAM和DRAM工艺L3缓存最高可达32M多。对应POWER ISA v.2.06。
  POWER8。IBM的下一代POWER处理器。
其它
  IBM通过Power.org网站向其它开发者及制造商推广POWER架构及其它衍生产品。

View File

@@ -0,0 +1,76 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-26T12:13:53+08:00
====== PowerPC-简介 ======
Created Saturday 26 November 2011
http://blog.sina.com.cn/s/blog_6e09b50f0100o2fk.html
PowerPC 是一种精简指令集RISC架构的中央处理器CPU其基本的设计源自IBM国际商用机器公司的 PowerPC
===== IBM PowerPC 601 微处理器 =====
POWERPerformance Optimized With Enhanced RISC《IBM Connect 电子报》2007年8月号译为“增强RISC性能优化”架构。二十世纪九十年代IBM(国际商用机器公司)、Apple苹果公司和Motorola摩托罗拉公司开发PowerPC芯片成功并制造出基于PowerPC的多处理器计算机。PowerPC架构的特点是可伸缩性好、方便灵活。
===== 定义 =====
  PowerPC 体系结构规范PowerPC Architecture Specification发布于 1993 年,它是一个 64 位规范 ( 也包含 32 位子集 )。几乎所有常规可用的 PowerPC除了新型号 IBM RS/6000 和所有 IBM pSeries 高端服务器)都是 32 位的。
===== 家族谱系 =====
  目前主流的PowerPC处理器制造商有IBM、Freescale™ Semiconductor原摩托罗拉半导体部、AMCC、LSI等[1]。其中以IBM和Freescale的PowerPC处理器最为流行。
=== IBM的PowerPC家族 ===
  IBM目前共有3个主要的PowerPC处理系列Power、Power PC和CELL。POWERPOWER PC中间还有一个Star系列。
  POWER系列CPU从1990开始生产、装备到RS/6000即RISC System/6000UNIX工作站和服务器上现在被称为eServer™ pSeries®服务器最新的名称是POWER System p系列主要的型号有POWER 1POWER 2™POWER 3™POWER 4™POWER 4+以及目前的POWER 5POWER 5+,power6和power7。
  Star系列处理器是**Power PC架构的另一种技术实现**与POWER系列非常类似。由于此系列的各种CPU代号都有Star或者用某一颗星的名字来命名因此被称为Star系列。
  Power PC系列是从POWER架构**发展出来的一个分支**最早在1993年发布用于从单板机、电池电源管理到超级计算机和Mainframe主机。Power PC最早登上主角的地位是从作为Power Macintosh 6100的CPU开始的。
  今天Power PC家族有三条产品线分别是嵌入式的Power PC 400系列Power PC 700和Power PC 900系列。Power PC 400系列被IBM转让给**AMCC**发展成为PowerPC 405 Family、**PowerPC 440 Family**、PowerPC 460 Family 3大系列。
=== Freescale PowerPC系列 ===
  Freescale公司提供了数量众多的含**集成化外设**的PowerPC处理器目前在**网络设备市场**取得了非常可观的成功。目前Freescale公司已经调整其PowerPC产品策略将其划分成3个主要市场网络设备、汽车电子(MPC5xx系列)和工业控制。
  Freescale PowerPC在通讯领域的成功很可能要归功于**PowerQUICC**这也是IBM的PowerPC和Freescale 的PowerPC的最重要的区别。1993年摩托罗拉半导体事业部(飞思卡尔半导体前身)在充分理解通信系统应用的基础上生产了第一颗包含QUICC(Quad Integrated Communications Controller)的芯片--MC68360。此时QUICC实际上是一颗独立的处理器。1994年摩托罗拉半导体事业部的工程师开始把MC68360的QUICC和PowerPC内核结合将**集成了QUICC的PowerPC处理器称为PowerQUICC**并将其中的QUICC处理模块称为**CPM**。
  1995年MPC860芯片面市标志着一个通信处理器时代的开始。这颗芯片实现了作为控制中心的PowerPC处理器和作为数据处理中心的CPM的分离采用了数据通路和控制通路分开的思想。
  PowerQUICC系列芯片也一路升级从PowerQUICC I到PowerQUICC II再到PowerQUICC III和PowerQUICC II pro。目前Freescale 将CPM升级为**QE**(QUICC Engine)。
  伴随PowerQUICC的升级Freescale PowerPC内核也在升级。
  603内核系列MPC850、MPC860、MPC875、MPC885等目前是最低端的Freescale PowerPC处理器。这类PowerPC处理器没有包含SDRAM接口用户必须使用MPC860提供的UPMUSER Programmable Machines配置成SDRAM接口。603内核配合PowerQUICC I。
  603E内核系列MPC8250、MPC8260、MPC8272等。从PowerPC内核的角度看603到603E的升级不大主要是MMU上此外包含了SDRAM控制器。603E内核配合PowerQUICC II。
  E300内核系列MPC8349、MPC8347、MPC8360等。E300系列与603E系列结构**基本一致**在处理器内核上的修改不多。QE最先在MPC8360上实现此外支持DDR SDRAM接口。E300内核配合PowerQUICC II pro。
  E500内核系列包括MPC8540、MPC8560、MPC8548等。E500内核共有V1 、V2两个版本。V1版本和V2版本的最大区别在于MMU。**基于E500内核的PowerPC处理器是Freescale高端处理器的发展方向**。E500 内核和603E有很大的不同只有指令系统是兼容的其他内核组件都不相同。E500内核支持DDR SDRAMRapidIO和千兆以太网接口。E500内核配合PowerQUICC III。
  E600内核系列也称为G4包括MPC7410MPC7447MPC7448MPC8641等。与IBM的Power 700系列的最大不同在于G4系列支持AltiVec结构。这类处理器也是Apple用于MAC机的芯片。
  E700系列支持64位的PowerPC结构开发中(最新消息不明,怀疑被放弃).
=== QorIQ系列 ===
  飞思卡尔__ QorIQ__通信平台是飞思卡尔的 PowerQUICC通信处理器的下一代演进产品包含一个或者更多个核一共有5个不同的产品平台。按照功能和性能分为 P1, P2, P3, P4 和P5,同老的PowerPC产品保持软件兼容例如PowerQUICC平台。
  QorIQ 商标和P1、P2、P4产品家族在2008年6月被公布。__所有的QorIQ处理器基于 e500 or e5500 核心__。P10xx 和 P20xx 系列基于e500v2 核心P340xx 和P40xx 系列基于 e500mc 核心P50xx 则基于e5500 核心。
  P1系列
  P1系列被设计用于网关、以太网交换机、无线局域网接入点和通用控制目的。P1系列属于入门级运行在400到800MHz用于替代PowerQUICC II Pro 和PowerQUICC III平台。P1系列封装成689个引脚同P2系列兼容。
  P1011 -包含一个800MHze500核心256 kB L2 cache,4个SerDes lanes3个吉比特以太网控制器以及一个用于老实电话的时分复用引擎(TDM engine) 。
  P2系列
  P2系列设计用于网络、电信、军工的广泛应用。能运行在-40 到 125 °C特别适合苛刻条件下的应用。P2系列属于中端产品运行在800Mhz到1.2GHz用于替代PowerQUICC II Pro 和PowerQUICC III平台。
  P3系列
  P3 系列设计属于中端产品用于交换机和路由器。P3系列提供了一个多核平台支持4个e500mc核心每个核心频率能达到1.5 GHz。P3系列拥有1.3 GHz 64-bit DDR3内存控制器18个SerDes lanes以及用于数据包操作和调度、正则表达式、RAID、安全、加密和RapidIO的硬件加速器。
  P3系列的多个核心能够运行在对称模式和非对称模式意味着多个核心可以一起或者个别引导运行操作系统。
  P4系列
  P4系列属于高端产品用于核心网或者企业级交换机、路由器。提供极限多核平台支持8个e500mc核心每一个核达到1.5 GHz。
  P5系列
  P5系列基于高性能64-bit e5500 核心频率提高到2.5 GHz 。2010年6月介绍可能2010年底可有样片2011年可批量生产。
=== 功能与优势 ===
  PowerPC 处理器有广泛的实现范围包括从诸如RoadRunner 那样的世界上最快的超级计算机, 到次世代3大游戏主机WII、PS3、X360都基于PowerPC。PowerPC 处理器有非常强的嵌入式表现,因为它具有优异的性能、巨大的数据吞吐量、较低的能量损耗以及较低的散热量。
  用于嵌入式的PowerPC 同ARM相比具有以下优势
  
*   优势1 超高的性能
*   最新的QorIQ P4含有8个1.5 GHz的e500mc核计算性能远非最高端的ARM可比。
*   同等条件下的每兆赫兹的MIPS 比ARM高。ARM 大概是1.1 MIPS/MHzPower Architecture 是大于2.3MIPS/MHz
*   优势2 强大的数据吞吐量
*   支持DDR2甚至DDR3内存控制器ARM一般只有SDRAM控制器
*   QUICC Engine技术使得每一个三速以太网控制器达到1.2Gb/s的全双工通信速率
*   8颗UCC(通用通信控制器)能使千兆以太网、HDLC、UTOPIA/Packet over SONET(POS)的数据速率高达OC-12
*   优势3稳定性可靠性
*   设备能可靠稳定运行在: -40℃-105℃
*   Powerpc架构具有很强稳定性能高可靠性
*   更长的产品寿命周期通常10到15年以上
*   苛刻条件下,芯片具有很强健壮性,适合工业级应用

View File

@@ -0,0 +1,151 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-26T20:53:23+08:00
====== PowerPC家族谱系详解 ======
Created Saturday 26 November 2011
http://www.powerpcdev.net/read.php?tid=5
随着PowerPC的发展使用PowerPC构架的处理器已经形成了庞大的家族在通信、工控、航天国防等要求高性能和高可靠性的领域得到广泛应用是一颗“贵族的芯片”。目前几乎没有什么中文资料详细阐述PowerPC家族谱系实在是一件遗憾的事。本文就给初学者简介PowerPC家族。
要阐述清楚PowerPC的发展不是一件容易的事情光是“PowerPC”这个词就很容易被搞混尤其是IBM注册了一系列相关的商标。比如Power 、Power PC、PowerPC 这三个词的含义就不止3种需要工程师聪明的头脑才能区分它们。一般情况下的PowerPC指的是使用PowerPC指令集的处理器。
二十世纪九十年代IBM(国际商用机器公司)、Apple苹果公司和Motorola摩托罗拉公司共同开发PowerPC处理器。
PowerPC最初的含义却不是Power而是Performance Optimized With Enhanced RISCPC指的是Performance Computing。
目前主流的PowerPC处理器制造商有IBM、Freescale™ Semiconductor原摩托罗拉半导体部、AMCC、LSI等。其中以IBM和Freescale的PowerPC处理器最为流行。本文就以这两家公司的PowerPC处理器为基础展开讲述PowerPC家族。
IBM的PowerPC家族
IBM目前共有3个主要的PowerPC处理系列Power、Power PC和CELL。POWERPOWER PC中间还有一个Star系列。
POWER系列CPU从1990开始生产、装备到RS/6000即RISC System/6000UNIX工作站和服务器上现在被称为eServer™ pSeries®服务器最新的名称是POWER System p系列主要的型号有POWER 1POWER 2™POWER 3™POWER 4™POWER 4+以及目前的POWER 5POWER 5+和刚刚推出的POWER 6处理器。
最早的801是POWER系列处理器的前身它的设计非常简单为了实现所有的指令都能在一个时钟周期内完成因此缺乏浮点运算和并行处理能力POWER架构为了解决这个问题或者说超越801的限制增加到了100多条指令成为一种很“复杂”的精简指令集CPU。
1POWER 1
发布于1990年每个芯片大约封装了80万个晶体管。
与当时其他的处理器不同POWER 1进行了功能分区这种设计方案使POWER 1具有非常好的扩展能力它有单独的浮点寄存器可以适用于从低端UNIX工作站到高端UNIX服务器各种环境。最早的POWER 1是安装在同一母板上的几个芯片的组合不过很快就集成到一个芯片中成为单芯片设计总计拥有超过一百万个晶体管的RISC处理器RSCRISC Single Chip即单芯片的RISC处理器。POWER 1最成功的应用是被用于火星探路者宇宙飞船上。
2POWER 2
发布于1993年每个芯片封装了一千五百万个晶体管。
POWER 2增加了第二个浮点单元处理floating-point unitFPU和更多的缓存。被称为P2SCPower 2 Scalable Chip的超级芯片使用CMOS-6S技术用一个芯片实现了POWER2 8个内核的架构从这里你可以看到其实在1993年IBM就已经开始了多核芯片的设计其实如果囊括大型机在20世纪80年代就有了多核的概念就是使用这种处理器的32个节点的DEEP BLUE深蓝超级计算机在1997年战胜了国际象棋冠军卡斯帕罗夫。
3POWER 3
发布于1998年每个芯片封装了一千五百万个晶体管。
这是IBM第一款64位对称多处理器结构SMP与原有的POWER指令集完全兼容也兼容Power PC指令集主要用于科学计算从航空设计、生物制药数据分析到天气预测。它具有一个数据预取引擎非阻塞的内置数据缓存和双浮点处理单元。POWER 3-II采用与POWER 3相同的设计在制造芯片时使用了铜导线技术在几乎相同的价格制造成本下提高了一倍的性能。
4POWER 4
发布于2001年每个芯片封装了一亿七千四百万个晶体管。
这是一款达到GHz主频的处理器0.18微米铜导线硅绝缘技术。它具有POWER 3的全部特性包括与Power PC指令集兼容但它又是全新的设计每个处理器包含两个64位1GHz+ Power PC内核这是业界第一款批量生产的单芯片双核设计又被称为单芯片对称多处理设计multicore design on a single dieSMP on a chip或者system on a chip每个处理器可以同时执行200条指令。POWER 4架构可以制造IBM Regatta即p690大型服务器也被用来设计Power PC 970处理器在苹果公司被称为Apple G5。POWER 4+™又被称为POWER 4-II是POWER 4主频升级的提高版。POWER 4 CPU支持了分区技术可以将芯片切分成多个单元运行不同的操作系统。
5POWER 5 ™
2004年发布与POWER 3和POWER 4类似POWER 5同时使用了POWER和Power PC架构利用了更快的片内通信技术、芯片多处理技术、同时多线程技术simultaneous multithreadingSMT一个物理CPU内核可以模拟两个逻辑CPU如果两个线程的工作内容相差较大则使用SMT技术性能最高可以达到单个CPU方式执行的1.5~1.7倍比POWER 4性能提高了4倍。POWER 5的高端服务器代号为“骑兵队”“Squadrons”IBM希望此CPU能如同骑士马队冲锋一样横扫UNIX服务器市场结果似乎应验了设计者的期望。在POWER 5上支持了微分区Advanced Virtualization的功能可以将一个处理器内核虚拟切分成多个处理器供操作系统使用最小的分配粒度为0.1个CPU共享使用粒度是1/100个CPU。在2006年IBM推出了主频提高封装变化的POWER 5被称为POWER 5+最高主频为2.2GHz。
6POWER 6 ™
在2007年5月发布目前最高主频4.7GHz最高明年将有超过5GHz主频的版本。片内集成度约为7亿5千万个晶体管。POWER 6将一些总线控制和CPU内核之间的数据通道集成进单一芯片与POWER 5相比增加了更多的CPU内核间通信机制和Cache。POWER 6比较有特点的技术是可以直接支持10进制数字处理这是计算机史上的一次回归我们从十进制转到二进制以便于计算机处理而如今计算机芯片设计已经足够先进让我们可以不再去适应机器而是让机器适应我们的需求。
POWER 6其他的技术包括双核128KB的L1 Cache数据、指令各64KB8条两阶流水线支持在一个时钟周期完成两组32位读或一组64位写操作两个内核各有4MB“半共享”的L2 Cache虽然它被一个内核占据但另一个内核也可以快速访问它另外32MB的L3 Cache可被两个内核通过80GB/s的带宽访问POWER 6还通过ViVA-2VirtualVector Architecture技术提高了向量处理性能支持最多1024个虚拟分区也是POWER 6的新特点POWER 5最多支持256个分区。POWER 6特有的10进制运算寄存器、指令可以使它在计算时不会产生2-10进制转换误差同时也提高了运算速度。POWER 6包括一些额外的电路去支持Mainframe的指令开始了整合z系列的实践而POWER 6L则是“简化”版的芯片降低了主频可以用于刀片服务器。
在生产POWER 6的同时POWER 7也处于紧张开发阶段预计2012年面世。
Star系列处理器是Power PC架构的另一种技术实现与POWER系列非常类似。由于此系列的各种CPU代号都有Star或者用某一颗星的名字来命名因此被称为Star系列。
1RS64
1997年发布代号为“Apache”。
这一系列使用Power PC处理器设计继承了大量POWER架构的特点但为了商业运算进行了特别优化与POWER 3相比其中包括指令分支预测、浮点意外处理、硬件预取等功能被取消而取而代之的是整形计算意外处理、复杂的片内/片外缓存算法、更大的缓存容量。 RS64的设计可以支持64位处理在2000年发布的RS64 IV中采用了硬件多线程技术单台服务器最多可以扩展到24颗CPU消耗的功耗也非常少每个处理器只有15瓦。此款CPU开始用于AS/400即后来的iSeries从RS 64 II起才用于RS/6000pSeries
这种设计使得RS64芯片比较适用于在线交易On-Line Transaction ProcessingOLTP、企业资源计划系统Enterprise Resource PlanningERP以及其他大型、混合的多功能、数据库访问、多用户、多进程的业务。不过在实际使用的过程中发现其计算速度稍有欠缺可能是 RS64 CPU的主频都很低典型的几款服务器主频只有100MHz左右对于商业智能Business IntelligenceBI和科学计算一类的应用性能不佳。
2RS64 II
1998年发布代号为“Northstar”北方之星
该CPU拥有8MB L2 Cache256位的数据总线262MHz主频。装配此款CPU的服务器可以支持最多三个CPU板每个CPU板装载4路CPU这样可以使RS/6000服务器具有4路、8路、12路的SMP结构。
3RS64 III
1999年发布代号为“Pulsar”脉冲星
第一款使用硅绝缘的RS64芯片通过6个CPU 卡可以实现24路SMP结构。由于此款CPU主频提高到450MHz使用优化的指令分支预取技术避免了跳转惩罚或只需要额外1个时钟周期5级流水线等技术CPU处理性能大幅度提高。IBM用此款服务器装配了RS/6000的80系列H80M80S80服务器
4RS64 IV
2001发布代号为IstarSStar
第一款支持硬件多线程的商用处理器比以前同系列的CPU更快更小。600-750MHz的主频硬件多线程技术HMT使得此CPU具有不错的市场表现。另外每个CPU仅消耗15W的功率也使得用此CPU装配的服务器无需特别的电源、散热系统。
由于市场对于商业和计算环境的混合需求使得IBM重新整合了POWER系列和Power PC系列处理器最终设计了POWER 4处理器。Star系列也最后完成了历史使命。
Power PC系列是从POWER架构发展出来的一个分支最早在1993年发布用于从单板机、电池电源管理到超级计算机和Mainframe主机。Power PC最早登上主角的地位是从作为Power Macintosh 6100的CPU开始的。
众所周知Power PC开始与苹果、摩托罗拉和IBM联盟被称为AIM联盟是源自于POWER架构的设计但进行了大量的改动。例如Power PC是open-endian设计即同时支持大尾段big-endian和小尾段little-endian内存模式而POWER 是大尾段设计Power PC希望提供更强的浮点处理能力和多线程处理能力。所以这两种类型的CPU并没有太大的差别Power PC保留了绝大部分POWER指令许多应用只要重新编译就可以分别在两个平台上运行。
当IBM和摩托罗拉分别自己设计芯片的时候依然遵循统一的标准。在2000年大家使用的是Book E spec这个设计实现使Power PC能更专注于嵌入式处理系统例如网络、存储和家用设施的处理器。
除了兼容之外Power PC的架构的另一个亮点是开放它公开了指令集允许任何厂商设计Power PC的兼容处理器、Power PC的一些软件的源代码也可以下载到Power PC的内核也非常小可以在同一芯片上安置许多其他的辅助电路例如缓存、协处理器大大增加了芯片的灵活性。
IBM四条服务器产品线中有两条都与Power PC架构有关另外苹果公司的台式机和服务器、任天堂的GameCubeIBM自己的蓝色基因超级计算机都使用了PowerPC芯片。
今天Power PC家族有三条产品线分别是嵌入式的Power PC 400系列Power PC 700和Power PC 900系列。从历史上看还有一款Power PC 600系列最值得关注因为它具有非常好的性能。
1Power PC 600系列
Power PC 601是Power PC 600系列中的第一款它综合了POWER和Power PC架构的特点并且尽量保持与POWER 1和随后的其他Power PC芯片的兼容性即使是同一系列的芯片也存在兼容性问题甚至与摩托罗拉的88110兼容。苹果公司用Power PC 601在1994年制造了Power Mac 610066 MHz CPU主频。此系列下一个芯片是603低端、低功耗的处理器大量使用在汽车上。与Power PC 603®同日登场的还有PowerPC 604®是更强大的处理器随之的是“加强版”的603e和604e。在此之后第一款64位Power PC——Power PC 620®在1995年被发布。
2Power PC 700系列
在1998年出现了Power PC 740和Power PC 750与604e非常相像甚至一些人说600/700两个系列根本就是一回事。Power PC 750是第一款铜导线处理器苹果公司用它生产了G3但很快就被G4所取代使用的是摩托罗拉7400。在2002年发布的32位的Power PC 750FX曾经震惊业界因为它是第一款达到1GHz主频的处理器IBM在2003年紧跟着推出了750GX集成了1MB片上二级缓存也是1GHz 主频大约7瓦功耗。
3Power PC 900系列
64位的Power PC 970实际上是单处理器内核的POWER 4可以同时执行200条指令最高达到2 GHz以上的主频而仅仅消耗十数瓦的电力。低功耗使它被大量用于笔记本电脑和手持设备上还有一些高密度的存储、服务器例如刀片中心也在使用它。 64位处理能力单指令多数据流设计使它更适合于多媒体、图形处理。苹果公司的台式机、Xserve服务器以及其他一些图形、网络设备都在使用这款处理器。例如苹果Xserve G5就使用了Power PC 970FX也是第一款同时使用了应变硅、硅绝缘两项技术的芯片。
4Power PC 400 系列
这一款芯片主要用于嵌入式系统但Power PC灵活的架构使它可以被用于从机顶盒这样的小设备到蓝色基因超级计算机。在产品线的一端Power PC 405EP在200MHz主频仅消耗1瓦的电力而铜导线的Power PC 440在800 MHz主频可以提供同类型嵌入式芯片中最高的性能。这款芯片也有许多旁支例如利用Power PC 440GX的双Gigabit Ethernet和TCP/IP加速功能可以降低网络应用程序50%以上的负载。围绕Power PC 400内核有许多具体实现用于建造蓝色基因超级计算机的处理芯片就是包含了两个Power PC 440处理器内核和两个浮点处理内核。
Power PC 400系列被IBM转让给AMCC发展成为PowerPC 405 Family、PowerPC 440 Family、PowerPC 460 Family 3大系列。
Freescale PowerPC系列
Freescale公司提供了数量众多的含集成化外设的PowerPC处理器目前在网络设备市场取得了非常可观的成功。目前Freescale公司已经调整其PowerPC产品策略将其划分成3个主要市场网络设备、汽车电子(MPC5xx系列)和工业控制。
Freescale PowerPC在通讯领域的成功很可能要归功于PowerQUICC这也是IBM的PowerPC和Freescale 的PowerPC的最重要的区别。1993年摩托罗拉半导体事业部(飞思卡尔半导体前身)在充分理解通信系统应用的基础上生产了第一颗包含QUICC(Quad Integrated Communications Controller)的芯片--MC68360。此时QUICC实际上是一颗独立的处理器。1994年摩托罗拉半导体事业部的工程师开始把MC68360的QUICC和PowerPC内核结合将集成了QUICC的PowerPC处理器称为PowerQUICC并将其中的QUICC处理模块称为CPM。
1995年MPC860芯片面市标志着一个通信处理器时代的开始。这颗芯片实现了作为控制中心的PowerPC处理器和作为数据处理中心的CPM的分离采用了数据通路和控制通路分开的思想。
此后PowerQUICC系列芯片也一路升级从PowerQUICC I到PowerQUICC II再到PowerQUICC III和PowerQUICC II pro。目前Freescale 将CPM升级为QE(QUICC Engine)。
伴随PowerQUICC的升级Freescale PowerPC内核也在升级。
603内核系列MPC850、MPC860、MPC875、MPC885等目前是最低端的Freescale PowerPC处理器。这类PowerPC处理器没有包含SDRAM接口用户必须使用MPC860提供的UPMUSER Programmable Machines配置成SDRAM接口。603内核配合PowerQUICC I。
603E内核系列MPC8250、MPC8260、MPC8272等。从PowerPC内核的角度看603到603E的升级不大主要是MMU上此外包含了SDRAM控制器。603E内核配合PowerQUICC II。
E300内核系列MPC8349、MPC8347、MPC8360等。E300系列与603E系列结构基本一致在处理器内核上的修改不多。QE最先在MPC8360上实现此外支持DDR SDRAM接口。E300内核配合PowerQUICC II pro。
E500内核系列包括MPC8540、MPC8560、MPC8548等。E500内核共有V1 、V2两个版本。V1版本和V2版本的最大区别在于MMU。基于E500内核的PowerPC处理器是Freescale高端处理器的发展方向。E500内核和603E有很大的不同只有指令系统是兼容的其他内核组件都不相同。E500内核支持DDR SDRAMRapidIO和千兆以太网接口。E500内核配合PowerQUICC III。
E600内核系列也称为G4包括MPC7410MPC7447MPC7448MPC8641等。与IBM的Power 700系列的最大不同在于G4系列支持AltiVec结构。这类处理器也是Apple用于MAC机的芯片。
E700系列支持64位的PowerPC结构开发中(最新消息不明,怀疑被放弃).
飞思卡尔 QorIQ通信平台是飞思卡尔的 PowerQUICC通信处理器的下一代演进产品包含一个或者更多个核一共有5个不同的产品平台。按照功能和性能分为 P1, P2, P3, P4 和P5,同老的PowerPC产品保持软件兼容例如PowerQUICC平台。
QorIQ 商标和P1、P2、P4产品家族在2008年6月被公布P3和P5平台的细节尚未公开。所有的QorIQ处理器基于 e500 or e5500 核心。P10xx 和 P20xx 系列基于e500v2 核心P340xx 和P40xx 系列基于 e500mc 核心P50xx 则基于e5500 核心。
P1系列
P1系列被设计用于网关、以太网交换机、无线局域网接入点和通用控制目的。P1系列属于入门级运行在400到800MHz用于替代PowerQUICC II Pro 和PowerQUICC III平台。P1系列封装成689个引脚同P2系列兼容。
P1011 -包含一个800MHze500核心256 kB L2 cache,4个SerDes lanes3个吉比特以太网控制器以及一个用于老实电话的时分复用引擎(TDM engine) 。
P1020 包含2个800 MHz e500 核心256 kB shared L2 cache, 4个SerDes lanes,3个吉比特以太网控制器一个 TDM engine.
P2系列
P2系列设计用于网络、电信、军工的广泛应用。能运行在-40 到 125 °C特别适合苛刻条件下的应用。P2系列属于中端产品运行在800Mhz到1.2GHz用于替代PowerQUICC II Pro 和PowerQUICC III平台。
P2010 包含1个 1.2 GHz 核心
P2020 包含2个 1.2 GHz 核心, shared L2 cache
P3系列
P3系列设计属于中端产品用于交换机和路由器。P3系列提供了一个多核平台支持4个e500mc核心每个核心频率能达到1.5 GHz。P3系列拥有1.3 GHz 64-bit DDR3内存控制器18个SerDes lanes以及用于数据包操作和调度、正则表达式、RAID、安全、加密和RapidIO的硬件加速器。
P3系列的多个核心能够运行在对称模式和非对称模式意味着多个核心可以一起或者非别引导运行操作系统。
P3041 - 4个1.5 GHz 核心每个核心128 kB L2 cache 1个1.3 GHz 64-bit DDR3 内存控制器45纳米技术和仅有12w的功率。
P4系列
P4系列属于高端产品用于核心网或者企业级交换机、路由器。提供极限多核平台支持8个e500mc核心 每一个核达到1.5 GHz。
P4080 包含8个e500mc核心每个核心有32/32kB instruction/data L1 caches以及1个a 128 kB L2 cache。包含2个1 MB L3 caches每一个连接到64-bit DDR2/DDR3 内存控制器。
P5系列
P5系列基于高性能64-bit e5500 核心频率提高到2.5 GHz 。2010年6月介绍可能2010年底可有样片2011年可批量生产。
P5010 - 一个e5500 2.2 GHz核心, 1 MB L3 cache, 1个DDR3 controller,45 nm 工艺功率30W.
P5020 - 两个e5500 2.2 GHz核心, 2个1 MB L3 caches, 2个DDR3 controllers, 45 nm 工艺功率30W.

Some files were not shown because too many files have changed in this diff Show More