您的位置:首页 > 运维架构 > Linux

Linux-2.6.38在mini6410上的移植

2015-12-08 23:32 561 查看

1.修改Makefile

CROSS_COMPILE :=arm-linux-

ARCH:=arm

2.make s3c6410_defconfig

make menuconfig,进入配置菜单进行修改:

进入菜单之后,将SystemType下面不需要用到的其他单板支持删除掉,只保留MINI6410

make uImage编译

3.nand驱动移植:

①拷贝文件:

arch/arm/plat-samsung/include /plat/regs-nand.h(覆盖)

drivers/mtd/nand/s3c_nand.c

drivers/mtd/nand/s3c_nand_mlc.fo

drivers/mtd/nand/nand_base.c (覆盖)

drivers/mtd/nand/Kconfig

195行添加:

config MTD_NAND_S3C
tristate "Nand Flash support for FriendlyARM"
depends on (ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX) && 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
Enable the use of the S3C internal ECC generator when
using NAND. Early versions 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, then 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

19行添加:

obj-$(CONFIG_MTD_NAND_S3C)         += s3c_nand.o


文件末尾添加:

nand-objs := nand_base.o nand_bbt.o
S3C_NAND_MLC_SRC = $(shell ls drivers/mtd/nand/s3c_nand_mlc.c 2>/dev/null)
ifeq ($(S3C_NAND_MLC_SRC),)
obj-$(CONFIG_MTD_NAND_S3C)         += s3c_nand_mlc.fo
else
obj-$(CONFIG_MTD_NAND_S3C)         += s3c_nand_mlc.o
endif


②make menuconfig进行配置:

Device Drivers  --->
<*> Memory Technology Device (MTD) support  --->
[*]   MTD partitioning support
<*>   Command line partition table parsing
<*>   Direct char device access to MTD devices
<*>   Caching block device access to MTD devices
<*>   NAND Device Support  --->
< >   NAND Flash support for Samsung S3C SoCs(去掉不选)
<*>   NAND Flash support for FriendlyARM
[*]     S3C NAND Hardware ECC
[*]     S3C NAND driver debug
<*>   Enable UBI - Unsorted block images  --->

File systems  --->
[*] Miscellaneous filesystems  --->
<*>   UBIFS file system support


4.网卡移植

[*] Networking support  --->
Networking options  --->
<*> Packet socket
<*> Unix domain sockets
[*] TCP/IP networking
[*]   IP: kernel level autoconfiguration
[*]     IP: DHCP support
[*]     IP: BOOTP support
[*]     IP: RARP support
Device Drivers  --->
[*] Network device support  --->
[*]   Ethernet (10 or 100Mbit)  --->
<*>   DM9000 support
[ ]   Ethernet (1000 Mbit)  --->
[ ]   Ethernet (10000 Mbit)  --->
File systems  --->
[*] Network File Systems   --->
<*>   NFS client support
[*]   Root file system on NFS
<*>   NFS server support


5.USB驱动移植



如上图所示,S3C6410一共有两组6410有两组USB引脚:XuhDP、XuhDN(仅可用作Host),XusbDP、XusbDN(OTG功能,可以动态切换作为主机或者从机)。而在Tiny6410的开发板上面,XuhDP、XuhDN这组引脚并没有引出来,只是用了OTG这一组引脚,且通过HUB芯片,扩展出3主1从接口:



从USB的结构框图可以知道,当使用Host主机的时候,需要初始化好OTG PHY,并且为Host控制器提供48MHz时钟,因此,先修改:

/arch/arm/mach-s3c64xx/Kconfig,在107行添加:

select S3C_DEV_USB_HSOTG

在/arch/arm/mach-s3c64xx/mach-mini6410.c,在mini6410_devices的&s3c_device_ohci前面(必须在ohci初始化之前打开otg时钟)添加:

&s3c_device_usb_hsotg,

最后,修改/drivers/usb/host/ohci-s3c2410.c添加:

#include <linux/io.h>
#include <mach/map.h>
#include <plat/regs-usb-hsotg-phy.h>

/* Initializes OTG Phy. to output 48M clock */
static void s3c_otg_phy_config(int enable) {
u32 val;

if (enable) {
__raw_writel(0x0, S3C_PHYPWR);  /* Power up */

val = __raw_readl(S3C_PHYCLK);
val &= ~S3C_PHYCLK_CLKSEL_MASK;
__raw_writel(val, S3C_PHYCLK);

__raw_writel(0x1, S3C_RSTCON);
udelay(5);
__raw_writel(0x0, S3C_RSTCON);  /* Finish the reset */
udelay(5);
} else {
__raw_writel(0x19, S3C_PHYPWR); /* Power down */
}
}


在s3c2410_start_hc函数中添加:

s3c_otg_phy_config(1);


6.I2C驱动

如果可以自行实现i2c适配器驱动则可以直接进入内核,去掉以下配置后装载自己写的adapter即可,不需要其他更改:

Device Drivers  --->
<*> I2C support  --->
I2C Hardware Bus support  --->
< > S3C2410 I2C Driver(去掉内核里面的adapter驱动)


如果希望直接使用三星自己提供适配器,可以这样操作:

将上面去掉的选项重新选回来,随后修改:

/arch/arm/mach-s3c64xx/mach-mini6410.c,添加头文件:

#include <plat/iic.h>


在设备链表里面添加:

&s3c_device_i2c0,


在init函数里面添加:

s3c_i2c0_set_platdata(NULL);


完成上述配置之后重新编译内核,在dev下面就会出现/dev/i2c-0设备节点,可以通过用户层的调用直接操作适配器发出命令。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: