//--------------------------------------------------------------------------------------------
// 作者:longtian635241([email protected])
// 论坛ID:idea6410
// 版权:idea6410
// 平台:友坚idea6410开发板
// 发布日期:2012-11-19
// 最后修改:2012-11-19
//http://www.urbetter.com/main.asp
//----------------------------------------------------------------------------------------------
前面介绍了基于mini6410来移植,这次完全由自己从头移植,以mach-smdk6410.c为基础!
1、nand flash MTD分区移植(拿来主义不是mini6410可以,模仿它的)
a、
static struct mtd_partition smdk6410_nand_part[] = {
[0] = {
.name = "uboot",
.size = SZ_1M,
.offset = 0,
},
[1] = {
.name = "kernel",
.size = SZ_2M,
.offset = SZ_1M,
},
[2] = {
.name = "rootfs",
.size = MTDPART_SIZ_FULL,
.offset = SZ_1M + SZ_2M,
},
};
static struct s3c2410_nand_set smdk6410_nand_sets[] = {
[0] = {
.name = "nand",
.nr_chips = 1,
.nr_partitions = ARRAY_SIZE(smdk6410_nand_part),
.partitions = smdk6410_nand_part,
},
};
static struct s3c2410_platform_nand smdk6410_nand_info = {
.tacls = 25,
.twrph0 = 55,
.twrph1 = 40,
.nr_sets = ARRAY_SIZE(smdk6410_nand_sets),
.sets = smdk6410_nand_sets,
};
b、
static struct platform_device *smdk6410_devices[] __initdata = {
。。。。。。。。。。。。。
//add by hcm
&s3c_device_nand,
};
static void __init smdk6410_machine_init(void)
{
u32 cs1;
s3c_i2c0_set_platdata(NULL);
s3c_i2c1_set_platdata(NULL);
s3c_fb_set_platdata(&smdk6410_lcd_pdata);
s3c_hsotg_set_platdata(&smdk6410_hsotg_pdata);
samsung_keypad_set_platdata(&smdk6410_keypad_data);
//add by hcm
s3c_nand_set_platdata(&smdk6410_nand_info);
到这我想直接去编译,然后发现少哪些头文件可是不加头文件就出现:
arch/arm/mach-s3c64xx/mach-smdk6410.c:137: error: array type has incomplete element type
arch/arm/mach-s3c64xx/mach-smdk6410.c:138: error: array index in non-array initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:138: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:139: error: field name not in record or union initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:139: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:140: error: field name not in record or union initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:140: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:141: error: field name not in record or union initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:141: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:142: error: field name not in record or union initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:142: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:146: error: variable 'smdk6410_nand_info' has initializer but incomplete type
arch/arm/mach-s3c64xx/mach-smdk6410.c:147: error: unknown field 'tacls' specified in initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:147: warning: excess elements in struct initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:147: warning: (near initialization for 'smdk6410_nand_info')
arch/arm/mach-s3c64xx/mach-smdk6410.c:148: error: unknown field 'twrph0' specified in initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:148: warning: excess elements in struct initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:148: warning: (near initialization for 'smdk6410_nand_info')
arch/arm/mach-s3c64xx/mach-smdk6410.c:149: error: unknown field 'twrph1' specified in initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:149: warning: excess elements in struct initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:149: warning: (near initialization for 'smdk6410_nand_info')
arch/arm/mach-s3c64xx/mach-smdk6410.c:150: error: unknown field 'nr_sets' specified in initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:150: warning: type defaults to 'int' in declaration of 'type name'
arch/arm/mach-s3c64xx/mach-smdk6410.c:150: warning: type defaults to 'int' in declaration of 'type name'
arch/arm/mach-s3c64xx/mach-smdk6410.c:150: error: negative width in bit-field '<anonymous>'
arch/arm/mach-s3c64xx/mach-smdk6410.c:150: warning: excess elements in struct initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:150: warning: (near initialization for 'smdk6410_nand_info')
arch/arm/mach-s3c64xx/mach-smdk6410.c:151: error: unknown field 'sets' specified in initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:151: warning: excess elements in struct initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:151: warning: (near initialization for 'smdk6410_nand_info')
arch/arm/mach-s3c64xx/mach-smdk6410.c: In function 'smdk6410_machine_init':
arch/arm/mach-s3c64xx/mach-smdk6410.c:713: error: implicit declaration of function 's3c_nand_set_platdata'
make[1]: *** [arch/arm/mach-s3c64xx/mach-smdk6410.o] 错误 1
make: *** [arch/arm/mach-s3c64xx] 错误 2
c、不得已只能对照mini6410加入相关头文件
//add by hcm
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <plat/nand.h>
编译ok!
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c6400-nand: Tacls=4, 30ns Twrph0=8 60ns, Twrph1=6 45ns
s3c24xx-nand s3c6400-nand: System booted from NAND
s3c24xx-nand s3c6400-nand: NAND hardware ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit), page size: 2048, OOB size: 64
Scanning device for bad blocks
Bad eraseblock 151 at 0x0000012e0000
Creating 3 MTD partitions on "nand":
0x000000000000-0x000000100000 : "uboot"
0x000000100000-0x000000300000 : "kernel"
0x000000300000-0x000010000000 : "rootfs"
2、DM9000移植
a、
/* DM9000AEP 10/100 ethernet controller */
static struct resource mini6410_dm9k_resource[] = {
[0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, 2),
[1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1 + 4, 2),
[2] = DEFINE_RES_NAMED(S3C_EINT(7), 1, NULL, IORESOURCE_IRQ \
| IORESOURCE_IRQ_HIGHLEVEL),
};
static struct dm9000_plat_data mini6410_dm9k_pdata = {
.flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};
static struct platform_device mini6410_device_eth = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(mini6410_dm9k_resource),
.resource = mini6410_dm9k_resource,
.dev = {
.platform_data = &mini6410_dm9k_pdata,
},
};
b、
&smdk6410_device_eth,
c、
#include <linux/dm9000.h>
3、简单的lcd支持
static struct s3c_fb_pd_win smdk6410_fb_win0 = {
.max_bpp = 32,
.default_bpp = 16,
.xres = 800,
.yres = 480,
.virtual_y = 480 * 2,
.virtual_x = 800,
};
static struct fb_videomode smdk6410_lcd_timing = {
.left_margin = 8,
.right_margin = 13,
.upper_margin = 7,
.lower_margin = 5,
.hsync_len = 3,
.vsync_len = 1,
.xres = 800,
.yres = 480,
};
改为4.3寸lcd
static struct s3c_fb_pd_win smdk6410_fb_win0 = {
.max_bpp = 32,
.default_bpp = 16,
.xres = 480,
.yres = 272,
.virtual_y = 272 * 2,
.virtual_x = 480,
};
static struct fb_videomode smdk6410_lcd_timing = {
.left_margin = 2,
.right_margin = 2,
.upper_margin = 2,
.lower_margin = 2,
.hsync_len = 41,
.vsync_len = 10,
.xres = 480,
.yres = 272,
};
lcd参数设置参考:http://www.cnblogs.com/zuobaozhu/archive/2012/05/13/2498092.html
MTD分区配置:请看前文