首先下載nand flash驅動 s3c_nand.c ,此文件包含著nand flash驅動具體的實現,將其復制到drivers/mtd/nand下;
在s3c_nand.c中添加nand flash分區信息,分區內容可以自由設定。
#if defined(CONFIG_ARCH_S5PV210)
struct mtd_partition s3c_partition_info[] = {
{
.name= 'misc',
.offset= (768*SZ_1K), /* for bootloader */
.size= (256*SZ_1K),
.mask_flags= MTD_CAP_NANDFLASH,
},
{
.name= 'recovery',
.offset= MTDPART_OFS_APPEND,
.size= (5*SZ_1M),
},
{
.name= 'kernel',
.offset= MTDPART_OFS_APPEND,
.size= (5*SZ_1M),
},
{
.name= 'ramdisk',
.offset= MTDPART_OFS_APPEND,
.size= (3*SZ_1M),
},
{
.name= 'system',
.offset= MTDPART_OFS_APPEND,
.size= MTDPART_SIZ_FULL,
}
{
.name= 'system',
.offset= MTDPART_OFS_APPEND,
.size= (110*SZ_1M),
},
{
.name= 'cache',
.offset= MTDPART_OFS_APPEND,
.size= (80*SZ_1M),
},
{
.name= 'userdata',
.offset= MTDPART_OFS_APPEND,
.size= MTDPART_SIZ_FULL,
}
#endif
};
struct s3c_nand_mtd_info s3c_nand_mtd_part_info = {
.chip_nr = 1,
.mtd_part_nr = ARRAY_SIZE(s3c_partition_info),
.partition = s3c_partition_info,
};
結構體s3c_nand_mtd_info在源代碼是沒有的,所以要將其添加進去;
修改 arch/arm/plat-samsung/include/plat/nand.h 添加如下內容:
struct s3c_nand_mtd_info {
uint chip_nr;
uint mtd_part_nr;
struct matd_partition *partition;
};
為了能使s3c_nand.c正確編譯,還要修改該目錄下,也就是的drivers/mtd/nand的Makefile和Kconfig:
修改driver/mtd/nand/Kconfig添加如下內容:
config MTD_NAND_S3C
tristate 'NAND Flash support for S3C Soc'
depends on ARCH_S5PV210 && MTD_NAND
help
This enables the NAND flash controller on the S3C.
No board specfic support is done by this driver , each board
must advertise a platform_device for the driver to attach.
config MTD_NAND_S3C_DEBUG
bool 'S3C NAND driver debug'
depends on MTD_NAND_S3C
help
Enable debugging of the S3C NAND driver
config MTD_NAND_S3C_HWECC
bool 'S3C NAND Hardware ECC'
depends on MTD_NAND_S3C
help www.2cto.com
Enable the use of the S3C's internal ECC generator when
using NAND. Early versons of the chip have had problems with
incorrect ECC generation, and if using these, the default of
software ECC is preferable
If you lay down a device with the hardware ECC, the you will
currently not be able to switch to software, as there is no
implementation for ECC method used by the S3C
修改drivers/mtd/nand/Makefile添加如下內容:
obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o
在Mach-smdkv210.c (archarmmach-s5pv210) 中添加nand flash source,platform_device,需要頭文件map.h map.h下載,下載將其放在(archarmmach-s5pv210includemach),在Mach-smdkv210.c中加入#include 添加nand flash source /* NAND Controller */ static struct resource s3c_nand_resource[] = { [0] = { .start= S5PV210_PA_NAND, .end= S5PV210_PA_NAND + S5PV210_SZ_NAND - 1, .flags= IORESOURCE_MEM, } }; struct platform_device s3c_device_nand = { .name= 's5pv210-nand', .id= -1, .num_resources= ARRAY_SIZE(s3c_nand_resource), .resource= s3c_nand_resource, }; 添加platform_device 找到static struct platform_device *smdkv210_devices[] __initdata 添加 #if defined(CONFIG_MTD_NAND_S3C) &s3c_device_nand, #endif 添加時鐘信息 在Clock.c (archarmmach-s5pv210) 中找到static struct clk init_clocks_off[],添加 { 添加之后,nand flash驅動才能正確獲取時鐘。 以上操作完成后,開始配置內核 根目錄下make menuconfig Device Drivers ---> <*> Memory Technology Device (MTD) support ---> <*> Caching block device access to MTD devices <*> NAND Device Support ---> <*> NAND Flash support for S3C SoCs [*] S3C NAND Hardware ECC 到了這里,開發板已經支持nand flash驅動。 接下來 配置后保存,make clean ,make zImage 將zImage下載進開發板。從串口信息可以看出nand flash驅動是否完成: S3C NAND Driver, (c) 2008 Samsung Electronics
.name = 'nand',
.id = -1,
.parent = &clk_hclk_psys.clk,
.enable = s5pv210_clk_ip1_ctrl,
.ctrlbit = ((1 << 28) | (1 << 24)),
},
S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Creating 5 MTD partitions on 's5pv210-nand':
0x0000000c0000-0x000000100000 : 'misc'
0x000000100000-0x000000600000 : 'recovery'
0x000000600000-0x000000b00000 : 'kernel'
0x000000b00000-0x000000e00000 : 'ramdisk'
0x000000e00000-0x000010000000 : 'system'
上一篇:修改 Linux 內核 DM9000 支持 tiny210 開發板
下一篇:tiny210V2 Uboot kernel filesystem 燒寫和啟動
- 熱門資源推薦
- 熱門放大器推薦
設計資源 培訓 開發板 精華推薦
- AM6TW-2409DH35Z ±9V 6 瓦單路輸出 DC-DC 轉換器的典型應用
- 基于A6985F5V的38 V,0.5 A同步降壓型開關穩壓器評估板
- LT4276BHUFD 25.5W(類型 2)PoE+ 電源在反激模式下的典型應用電路,具有 12V、1.9A 輸出
- 【訓練營】ESP8266時鐘+548151A
- 【涂鴉智能】涂鴉&立創EDA物聯網溫濕度傳感器
- LT1021DCN8-10 電壓基準的典型應用,將 10V 單元調整為 10.24V
- 具有 5V 輸出的 LT1074CT 正負轉換器的典型應用
- LT6656BCDC-2.048、2.048V 低功率 ADC 電壓基準的典型應用
- SC1117 0.8 安培正固定穩壓器的典型應用
- 電路DIY驅動板DRSSTC
- 芯原超低能耗NPU可為移動端大語言模型推理提供超40 TOPS算力
- 芯原AI-ISP芯片定制方案助力客戶智能手機量產出貨
- AI加持,安森美一站式服務推動助聽器市場持續進步
- 意法半導體推出用于匹配遠距離無線微控制器STM32WL33的集成的匹配濾波芯片
- 如何為您的應用選擇光傳感器
- Samtec新型農業漫談系列二 | 垂直農業案列分享
- Samtec應用科普 | C-V2X技術在汽車領域的應用
- 尼得科運動&能源事業本部在印度卡納塔克邦胡布利舉行新工廠竣工儀式
- 貿澤開售Qorvo適用于5G和mMIMO應用的新型QPA9822線性5G高增益/高驅動放大器
- 邊緣計算網關工業物聯網應用:空壓機遠程運維監控管理