转自 http://blog.sina.com.cn/s/blog_4ed5ebd00100jvmz.html
1.源码准备:
2.不使用自带的mach-mini2440.c,重新创建arch/arm/mach-s3c2440/mach-mini2440.c(源自友善)
#include <linux/kernel.h>
#include <linux/types.h>
#include<linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include<linux/serial_core.h>
#include<linux/platform_device.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/sysdev.h>
#include <linux/mtd/mtd.h>
#include<linux/mtd/nand.h>
#include<linux/mtd/nand_ecc.h>
#include<linux/mtd/partitions.h>
#include <linux/dm9000.h>
#include<linux/mmc/host.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/irq.h>
#include<asm/mach-types.h>
#include <mach/hardware.h>
#include<mach/regs-gpio.h>
#include <mach/regs-lcd.h>
#include<mach/leds-gpio.h>
#include <mach/idle.h>
#include <mach/fb.h>
#include<plat/regs-serial.h>
#include <plat/iic.h>
#include <plat/s3c2410.h>
#include <plat/s3c2440.h>
#include <plat/clock.h>
#include <plat/devs.h>
#include <plat/cpu.h>
#include <plat/nand.h>
#include <plat/pm.h>
#include <plat/mci.h>
#include<sound/s3c24xx_uda134x.h>
static struct map_desc mini2440_iodesc[] __initdata = {
};
static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata ={
[0] = {
.hwport
= 0,
.flags
= 0,
.ucon
= 0x3c5,
.ulcon
= 0x03,
.ufcon
= 0x51,
},
[1] = {
.hwport
= 1,
.flags
= 0,
.ucon
= 0x3c5,
.ulcon
= 0x03,
.ufcon
= 0x51,
},
[2] = {
.hwport
= 2,
.flags
= 0,
.ucon
= 0x3c5,
.ulcon
= 0x03,
.ufcon
= 0x51,
}
};
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_PIXCLOCK 170000
#define LCD_RIGHT_MARGIN 25
#define LCD_LEFT_MARGIN 0
#define LCD_HSYNC_LEN 4
#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 4
#define LCD_VSYNC_LEN 1
static struct s3c2410fb_display mini2440_lcd_cfg __initdata ={
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
.type = S3C2410_LCDCON1_TFT,
.width = LCD_WIDTH,
.height = LCD_HEIGHT,
.pixclock = LCD_PIXCLOCK,
.xres = LCD_WIDTH,
.yres = LCD_HEIGHT,
.bpp = 16,
.left_margin = LCD_LEFT_MARGIN + 1,
.right_margin = LCD_RIGHT_MARGIN + 1,
.hsync_len
= LCD_HSYNC_LEN + 1,
.upper_margin = LCD_UPPER_MARGIN + 1,
.lower_margin = LCD_LOWER_MARGIN + 1,
.vsync_len
= LCD_VSYNC_LEN + 1,
};
static struct s3c2410fb_mach_info mini2440_fb_info __initdata= {
.displays = &mini2440_lcd_cfg,
.num_displays = 1,
.default_display = 0,
.gpccon =
0xaa955699,
.gpccon_mask =
0xffc003cc,
.gpcup =
0x0000ffff,
.gpcup_mask =
0xffffffff,
.gpdcon =
0xaa95aaa1,
.gpdcon_mask =
0xffc0fff0,
.gpdup =
0x0000faff,
.gpdup_mask =
0xffffffff,
.lpcsel = 0xf82,
};
static struct s3c24xx_uda134x_platform_datas3c24xx_uda134x_data = {
.l3_clk = S3C2410_GPB(4),
//IO表示方法,定义在mach/regs-gpio.h->mach/gpio-nrs.h中
.l3_data = S3C2410_GPB(3),
.l3_mode = S3C2410_GPB(2),
.model = UDA134X_UDA1341,
};
static struct platform_device s3c24xx_uda134x = {
.name = "s3c24xx_uda134x",
.dev = {
.platform_data
=&s3c24xx_uda134x_data,
}
};
static struct mtd_partition friendly_arm_default_nand_part[] ={
[0] = {
.name = "supervivi",
.size = 0x00040000,
.offset = 0,
},
[1] = {
.name = "param",
.offset = 0x00040000,
.size = 0x00020000,
},
[2] = {
.name = "Kernel",
.offset = 0x00060000,
.size = 0x00500000,
},
[3] = {
.name = "root",
.offset = 0x00560000,
.size = 1024 * 1024 * 1024, //为以后拓展用
},
[4] = {
.name = "nand",
.offset = 0x00000000,
.size = 1024 * 1024 * 1024, //
}
};
static struct s3c2410_nand_set friendly_arm_nand_sets[] ={
[0] = {
.name = "NAND",
.nr_chips = 1,
.nr_partitions =ARRAY_SIZE(friendly_arm_default_nand_part),
.partitions = friendly_arm_default_nand_part,
},
};
static struct s3c2410_platform_nand friendly_arm_nand_info ={
.tacls = 20, // 建立时间
.twrph0 = 60, // 等待时间
.twrph1 = 20, // 保持时间
.nr_sets = ARRAY_SIZE(friendly_arm_nand_sets),
.sets = friendly_arm_nand_sets,
.ignore_unset_ecc = 1,
};
#define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
static struct resource mini2440_dm9k_resource[] = {
};
static struct dm9000_plat_data mini2440_dm9k_pdata = {
};
static struct platform_device mini2440_device_eth = {
};
static struct s3c24xx_mci_pdata mini2440_mmc_cfg = {
};
static struct platform_device *mini2440_devices[] __initdata ={
&s3c_device_usb,
&s3c_device_rtc,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&mini2440_device_eth,
&s3c24xx_uda134x,
&s3c_device_nand,
&s3c_device_sdi,
&s3c_device_usbgadget,
};
static void __init mini2440_map_io(void)
{
s3c24xx_init_io(mini2440_iodesc,ARRAY_SIZE(mini2440_iodesc));
s3c24xx_init_clocks(12000000);
//外部时钟频率为12000000
s3c24xx_init_uarts(mini2440_uartcfgs,ARRAY_SIZE(mini2440_uartcfgs));
}
static void __init mini2440_machine_init(void)
{
s3c24xx_fb_set_platdata(&mini2440_fb_info); //lcd platform device add
s3c_i2c0_set_platdata(NULL); // i2c
s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND); // lcd背光
s3c_device_nand.dev.platform_data =&friendly_arm_nand_info; //nand
s3c_device_sdi.dev.platform_data =&mini2440_mmc_cfg; //SD card
platform_add_devices(mini2440_devices,ARRAY_SIZE(mini2440_devices));
s3c_pm_init();
}
MACHINE_START(MINI2440, "FriendlyARM Mini2440 developmentboard")
.phys_io = S3C2410_PA_UART,
.io_pg_offst = (((u32)S3C24XX_VA_UART)>> 18) &0xfffc,
.boot_params = S3C2410_SDRAM_PA + 0x100,
.init_irq = s3c24xx_init_irq,
.map_io = mini2440_map_io,
.init_machine = mini2440_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END
3.修改arch/arm/mach-s3c2440/Kconfig,在最后加上
config MACH_MINI2440
bool "FriendlyARM Mini2440 development board"
select CPU_S3C2440
select S3C2440_XTAL_12000000
select S3C_DEV_USB_HOST
select S3C_DEV_NAND
help
4.网卡:
5.补充下去掉10分钟关闭LCD的方法
6.内核增加yaffs2支持