感謝 http://digiland.tw/viewtopic.php?id=1942&p=1 hippo 大 跟一卡車的開源大神 我盡量把大神的東西講化成好消化的
GPIO,通用型之輸入輸出(General Purpose I/O),功能類似8051的P0—P3,其接腳可以供使用者由程式控制自由使用,PIN腳依現實考量可作為通用輸入(GPI)或通用輸出(GPO)或通用輸入與輸出(GPIO),如當clk generator, chip select等。
現行的Soc 都有含GPIO 腳位 ,Maravell Orion soc 有 26 根針腳 ,可自行定義用於開關,燈號 風扇控制等.而不需再靠額外單片機輔助這些訊號.
沒有正確 GPIO資訊.編譯後後果是 類比訊號電路 會不正常.比如說 各種開關, LED ,風扇等.
當遇到沒有完整原始碼的embedded system ,像本案例只能用nh233-setup.c 再做修改
如何取得GPIO 資訊? 某些Soc 廠商有Open Sources Program guide.
88F5182-based Storage Networking Platforms Open Source Community Programmer’s User Guide
第384頁開始 敘述MPP暫存器. 由U-Boot查看
>> md f1010000
f1010000: 00000003 55550000 03ff0000 00000000 ......UU........
f1010010: 00638636 00000000 00000000 00000000 6.c.............
f1010020: ff000000 00000000 00000000 00000000 ................
f1010030: 00b80000 00000000 00000000 00000000 ................
f1010040: 00000f08 00001020 00000000 00000000 .... ...........
f1010050: 00000000 00000000 00000000 00000000 ................
比照arch/arm/mach-orion5x/mpp.h
0xf1010000=0x03
3: MPPSel0=MPP0_UNUSED或MPP0_GPIO
0: MPPSel1=MPP1_UNUSED或MPP1_GPIO
...
0xf1010006=0x55
5: MPPSel12=MPP12_SATA_LED
5: MPPSel13=MPP13_SATA_LED
...
0xf1010050=0x00
0: MPPSel16=MPP16_UNUSED或MPP16_UART
0: MPPSel17=MPP17_UNUSED或MPP17_UART
然後修改arch/arm/mach-orion5x/nh233-setup.c
static unsigned int nh233_mpp_modes[] __initdata = {
MPP0_GPIO,
MPP1_GPIO,
...
MPP12_SATA_LED,
...
MPP16_UART,
...
MTD分割表, 參照開機訊息與/proc/mtd來設定.
Creating 5 MTD partitions on "phys_mapped_flash":
0x00000000-0x00200000 : "Kernel"
0x00200000-0x00770000 : "File-System"
0x00770000-0x00780000 : "System-config"
0x00780000-0x00790000 : "bootloader-config"
0x00790000-0x00800000 : "Boot-loader"$ cat /proc/mtd
dev: size erasesize name
mtd0: 00200000 00010000 "Kernel"
mtd1: 00570000 00010000 "File-System"
mtd2: 00010000 00010000 "System-config"
mtd3: 00010000 00010000 "bootloader-config"
mtd4: 00070000 00010000 "Boot-loader"
未完
1. 88F5182-based Storage Networking Platforms Open Source Community Programmer’s User Guide
2. 88F5182 Feroceon Storage Networking SoC User Manual
3. 88F5182 Feroceon Storage Networking SoC Datasheet
4.http://www.nas-central.org/wiki/Orion_NAS_customisation_guide
Images 0 | ||
---|---|---|
No images to display in the gallery. |