添加nand flash 的支持给osk5912
2008-11-03 21:28
211 查看
在网上搜索到两篇文章介绍相关内容,可是都不全面,也不详细。下面我件我的步骤列出来供大家参考:
1、查看原理图,发现nand flash对应的是CS2,地址为0x0800:0000-0x0BFF:FFFF 共64M
2、修改drivers/mtd/nand/Kconfig文件,修改如下:
config MTD_NAND_OMAP
tristate "NAND Flash device on OMAP OSK/H3/H2/P2 boards"
depends on ARM && ARCH_OMAP1 && MTD_NAND && (MACH_OMAP_OSK || MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_PERSEUS2)
help
Support for NAND flash on Texas Instruments OSK/H3/H2/P2 platforms.
3、修改arch/arm/mach-omap1/board-osk.c文件,这是最关键的一步,主要修改以下几个地方:
#include <linux/mtd/nand.h>
#include <asm/arch/nand.h>
............................
static struct mtd_partition osk5912_nand_partitions[] = {
{
.name = "nand filesystem",
.size = MTDPART_SIZ_FULL,
.offset = MTDPART_OFS_APPEND,
},
};
static struct omap_nand_platform_data osk5912_nand_data = {
.options = NAND_SAMSUNG_LP_OPTIONS,
.parts = osk5912_nand_partitions,
.nr_parts = ARRAY_SIZE(osk5912_nand_partitions),
};
static struct resource osk5912_nand_resource = {
.flags = IORESOURCE_MEM,
};
static struct platform_device osk5912_nand_device = {
.name = "omapnand",
.id = 0,
.dev = {
.platform_data =&osk5912_nand_data,
},
.num_resources = 1,
.resource = &osk5912_nand_resource,
};
.................................
static struct platform_device *osk5912_devices[] __initdata = {
&osk5912_flash_device,
&osk5912_nand_device,
&osk5912_smc91x_device,
&osk5912_cf_device,
&osk5912_mcbsp1_device,
};
.................................
static void __init osk_init(void)
{
/* Workaround for wrong CS3 (NOR flash) timing
* There are some U-Boot versions out there which configure
* wrong CS3 memory timings. This mainly leads to CRC
* or similar errors if you use NOR flash (e.g. with JFFS2)
* Now, We add NAND flash in the kernel, It used CS2!0x0800:0000-0x0BFF:FFFF
*/
if (EMIFS_CCS(3) != EMIFS_CS3_VAL)
EMIFS_CCS(3) = EMIFS_CS3_VAL;
osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
osk_flash_resource.end += SZ_32M - 1;
osk5912_nand_resource.end = osk5912_nand_resource.start = OMAP_CS2_PHYS;
osk5912_nand_resource.end += SZ_4K - 1;
/*if (!(omap_request_gpio(OSK_NAND_RB_GPIO_PIN)))
osk5912_nand_data.dev_ready = osk_nand_dev_ready;*/
platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
..................................
4、make menuconfig的时候选中对nand的支持,编译内核,测试证明完全可以正常工作!
1、查看原理图,发现nand flash对应的是CS2,地址为0x0800:0000-0x0BFF:FFFF 共64M
2、修改drivers/mtd/nand/Kconfig文件,修改如下:
config MTD_NAND_OMAP
tristate "NAND Flash device on OMAP OSK/H3/H2/P2 boards"
depends on ARM && ARCH_OMAP1 && MTD_NAND && (MACH_OMAP_OSK || MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_PERSEUS2)
help
Support for NAND flash on Texas Instruments OSK/H3/H2/P2 platforms.
3、修改arch/arm/mach-omap1/board-osk.c文件,这是最关键的一步,主要修改以下几个地方:
#include <linux/mtd/nand.h>
#include <asm/arch/nand.h>
............................
static struct mtd_partition osk5912_nand_partitions[] = {
{
.name = "nand filesystem",
.size = MTDPART_SIZ_FULL,
.offset = MTDPART_OFS_APPEND,
},
};
static struct omap_nand_platform_data osk5912_nand_data = {
.options = NAND_SAMSUNG_LP_OPTIONS,
.parts = osk5912_nand_partitions,
.nr_parts = ARRAY_SIZE(osk5912_nand_partitions),
};
static struct resource osk5912_nand_resource = {
.flags = IORESOURCE_MEM,
};
static struct platform_device osk5912_nand_device = {
.name = "omapnand",
.id = 0,
.dev = {
.platform_data =&osk5912_nand_data,
},
.num_resources = 1,
.resource = &osk5912_nand_resource,
};
.................................
static struct platform_device *osk5912_devices[] __initdata = {
&osk5912_flash_device,
&osk5912_nand_device,
&osk5912_smc91x_device,
&osk5912_cf_device,
&osk5912_mcbsp1_device,
};
.................................
static void __init osk_init(void)
{
/* Workaround for wrong CS3 (NOR flash) timing
* There are some U-Boot versions out there which configure
* wrong CS3 memory timings. This mainly leads to CRC
* or similar errors if you use NOR flash (e.g. with JFFS2)
* Now, We add NAND flash in the kernel, It used CS2!0x0800:0000-0x0BFF:FFFF
*/
if (EMIFS_CCS(3) != EMIFS_CS3_VAL)
EMIFS_CCS(3) = EMIFS_CS3_VAL;
osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
osk_flash_resource.end += SZ_32M - 1;
osk5912_nand_resource.end = osk5912_nand_resource.start = OMAP_CS2_PHYS;
osk5912_nand_resource.end += SZ_4K - 1;
/*if (!(omap_request_gpio(OSK_NAND_RB_GPIO_PIN)))
osk5912_nand_data.dev_ready = osk_nand_dev_ready;*/
platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
..................................
4、make menuconfig的时候选中对nand的支持,编译内核,测试证明完全可以正常工作!
相关文章推荐
- Hi3531添加16GByte(128Gbit) NAND Flash支持 分类: HI3531 2013-08-28 10:23 861人阅读 评论(0) 收藏
- Hi3531添加16GByte(128Gbit) NAND Flash支持
- TX2440 ARM开发板Uboot移植(三、添加Nand Flash的有关操作支持)
- Hi3531添加16GByte(128Gbit) NAND Flash支持
- u-boot-2014.10移植第21天----添加nand flash命令支持(三)
- Hi3531添加16GByte(128Gbit) NAND Flash支持
- 使用QEMU模拟搭建ARM开发平台(三)——添加SCSI和MTD以及NAND flash支持
- [置顶] u-boot-2014.10移植第19天----添加nand flash命令支持(一)
- [置顶] u-boot-2014.10移植第20天----添加nand flash命令支持(二)
- u-boot-2014.10移植第22天----添加nand flash命令支持(四)
- 给freestdf添加STR和PSR的支持
- 基于fl2440 内核linux3.0添加dm9000支持
- 配置Citrix Receiver 3.x、4.x支持添加HTTP站点
- 给Cocos2D视图添加手势支持
- 超强PHP集成环境,支持800多个不同PHP版本同时运行,无限自定义添加mysql与php版本
- Spring boot添加对jsp的支持
- 为Apache Ant添加FTP Task支持
- LAMP下添加支持openssl的主机
- Myeclipse中添加XFire插件支持