内核linux-3.0移植到fl2440-----添加U盘,MMC和LCD驱动

来源:互联网 发布:北京握奇数据 编辑:程序博客网 时间:2024/05/20 16:33

一、添加U盘支持   

     FL2440添加u盘的挂载比较简单,大部分的内容都是在内核里面做make menuconfig,配置内核。

 Device Drivers  ---> 

     Generic Driver Options  --->

                  (/sbin/hotplug) path to uevent helper                  //配置u盘的热插拔

      [*] Block devices  --->

                   <*>   Low Performance USB Block driver

     SCSI device support  ---> 

                  <*> SCSI device support 

                  <*> SCSI generic support

                  [*] Probe all LUNs on each SCSI device 

     [*] USB support  ---> 

                 <*>   Support for Host-side USB

                 [*]     USB device filesystem (DEPRECATED)

                 [*]     USB device class-devices (DEPRECATED)

                 <*>   USB Monitor

                 <*>   OHCI HCD support

                 <*>   USB Mass Storage support

File systems  --->                                              //配置u盘的文件系统

       DOS/FAT/NT Filesystems  --->

                  <*> MSDOS fs support

                  <*> VFAT (Windows-95) fs support

                   (936) Default codepage for FAT 

                   (cp936) Default iocharset for FAT 

      -*- Native language support  --->                                      //配置u盘的语言格式支持,不过感觉着个配置没什么用,中文也支持不了,也许是因为linux对中文的支持并不好吧

                    <*>   Simplified Chinese charset (CP936, GB2312)

                     <*>   ASCII (United States) 

                     <*>   NLS UTF-8

 

配置好之后,重新编译,烧写到板子上面运行,(现在板子上面有u盘)就可以看到以下信息了

usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb

usbcore: registered new interface driver ub
Uniform Multi-Platform E-IDE driver

usbcore: registered new interface driver uas
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
NET: Registered protocol family 17
Freeing init memory: 13188K
usb 1-1: new full speed USB device number 2 using s3c2410-ohci
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
usb 1-1.2: new full speed USB device number 3 using s3c2410-ohci
 uba: uba1
usb 1-1.2: USB disconnect, device number 3
usb 1-1.1: new full speed USB device number 4 using s3c2410-ohci
 uba: uba1

这时候就可以看到我们的u盘已经挂载好了。

 

后记:

        有时候,我们可能发现我们配置好了内核,但是我们的u盘无论如何也发现不了,这时候就出现了一个问题,这个问题不是在于我的内核配置有错误,而是在于我们的u-boot设置usb的时钟不对引起的。这样,我就不得不重新回到u-boot,配置好usb的时钟。

修改u-boot中:board/fl2440/fl2440.c文件中关于usb的时钟的内容,将如下三个宏的值改为如下

#define U_M_MDIV 0x38
#define U_M_PDIV 0x2
#define U_M_SDIV    0x2

重新编译u-boot和内核,烧写,重启之后,我们的内核就能支持u盘了。


添加MMC支持

mmc支持很简单,linux内核中提供了,所以直接选上这些选项,重新编译就行了。

 Device Drivers  --->

<*> MMC/SD/SDIO card support  --->

 <*>   MMC block device driver

 <*>   Samsung S3C SD/MMC Card Interface support

 

三、添加LCD支持

make menuconfig  如下

Device Drivers  --->

 Graphics support  --->

<*> Support for frame buffer devices  --->

 [*] Backlight & LCD device support  --->

 <*>   S3C2410 LCD framebuffer support

 [*] Bootup logo  --->

[*]   Standard black and white Linux logo

[*]   Standard 16-color Linux logo

[*]   Standard 224-color Linux logo

修改arch/arm/mach-s3c2440/mach-smdk2440.c中的结构体smdk2440_devices[] __initdata,添加为如下:

static struct platform_device *smdk2440_devices[] __initdata = {
    &s3c_device_ohci,
    &s3c_device_lcd,
    &s3c_device_wdt,
    &s3c_device_i2c0,
    &s3c_device_iis,
    &s3c_device_dm9000,
    &s3c_device_adc,    /* modify by liuchengdeng */
    &s3c_device_ts,     /*  add end*/
};

修改smdk2440_lcd_cfg__initdata 结构体为下面的内容

static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {

    .lcdcon5    = S3C2410_LCDCON5_FRM565 |
              S3C2410_LCDCON5_INVVLINE |
              S3C2410_LCDCON5_INVVFRAME |
              S3C2410_LCDCON5_PWREN |
              S3C2410_LCDCON5_HWSWP,

    .type       = S3C2410_LCDCON1_TFT,

    .width      = 320,
    .height     = 240,

    .pixclock   = 111111, /* HCLK 60 MHz, divisor 10 */
    .xres       = 480,
    .yres       = 272,
    .bpp        = 16,
    .left_margin    = 38,
    .right_margin   = 20,
    .hsync_len  = 30,
    .upper_margin   = 15,
    .lower_margin   = 12,
    .vsync_len  = 3,
};

smdk2440_fb_info__initdata 结构体也要改,修改为如下

static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
    .displays   = &smdk2440_lcd_cfg,
    .num_displays   = 1,
    .default_display = 0,

    .lpcsel     = ((0xCE6) & ~7) | 1<<1,
};

修改完了之后,编译,烧写到nandflash中,启动开发板,这个时候,可以把u-boot的中的bootargs修改一下,添加如下

console=tty1 console=ttyS0,115200 

这时候,我们的开发板启动就能够看到久违的小企鹅了,而且由于我们的console是指定的tty1 和ttyS0,这时候我们启动的信息也将会打印到我们的LCD屏上。

0 0