Welcome 微信登录

首页 / 操作系统 / Linux / Tiny6410 下的USB移植

终于做完usb的移植了,前前后后自己一共做了20几个zImage,其中也发现了很多问题,所幸的是问题都已得到解决,有很多问题是关于make menuconfig的,有这样那样的选项没有选上就会出现问题,以后要注意,还有就是网上的关于tiny6410的移植很少,还不全!1、vi arch/arm/mach-s3c64xx/mach-mini6410.c124行增加/* Initializes OTG Phy. to output 48M clock */
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 */
        }
}2、vi drivers/usb/host/ohci-s3c2410.c
修改方法
@@ -25,10 +25,14 @@#define valid_port(idx) ((idx) == 1 || (idx) == 2)+#ifdef CONFIG_MACH_MINI6410
+extern void s3c_otg_phy_config(int enable);
+#endif
+
/* clock device associated with the hcd */static struct clk *clk;
-static struct clk *usb_clk;
+static struct clk *otg_clk, *usb_clk;/* forward definitions */@@ -47,6 +51,11 @@     dev_dbg(&dev->dev, "s3c2410_start_hc: ");+    clk_enable(otg_clk);
+#ifdef CONFIG_MACH_MINI6410
+    s3c_otg_phy_config(1);
+#endif
+
     clk_enable(usb_clk);
     mdelay(2);            /* let the bus clock stabilise */@@ -79,6 +88,7 @@     clk_disable(clk);
     clk_disable(usb_clk);
+    clk_disable(otg_clk);
}/* ohci_s3c2410_hub_status_data
@@ -375,6 +385,13 @@
         goto err_clk;
     }+    otg_clk = clk_get(&dev->dev, "otg");
+    if (IS_ERR(otg_clk)) {
+        dev_err(&dev->dev, "cannot get otg clock ");
+        retval = -ENOENT;
+        goto err_otg;
+    }
+
     s3c2410_start_hc(dev, hcd);     hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
@@ -395,6 +412,10 @@
  err_ioremap:
     s3c2410_stop_hc(dev);
     iounmap(hcd->regs);
+
+    clk_put(otg_clk);
+
+ err_otg:
     clk_put(usb_clk);  err_clk:3、make menuconfigDevice Drivers  --->     SCSI device support  --->
         <*> SCSI device support
         <*> SCSI disk support
         <*> SCSI generic support    USB support
         <*>   Support for Host-side USB
         [*]     USB device filesystem (DEPRECATED)
        <*>   USB Monitor
        <*>   OHCI HCD support
        <*>   USB Mass Storage support File systems  --->
    DOS/FAT/NT Filesystems  --->
           <*> MSDOS fs support                                               
            <*> VFAT (Windows-95) fs support                                  
          (936) Default codepage for FAT                                                 (cp936) Default iocharset for FAT   问题1:"usb device descriptor read/64, error -71"linux-kernel/include/asm-generic/erron.h 可以发现是:#define EPROTO   71 /* Protocol error 协议错误*/内核配置中添加:CONFIG_USB_EHCI_ROOT_HUB_TT=y 就可以了。问题2:U盘可以挂载但是只读:解决:--- SCSI device support                                                                     │ │
│ │                      [*]   legacy /proc/scsi/ support                             
问题3:
不支持U盘里面的中文名称:
提示:NTFS-fs error (device uba1): ntfs_ucstonls(): Unicode name contains characters that cannot be converted to character set default. You might want to try to use the mount option nls=utf8.
解决:--- Base native language support                                                            │ │
│ │                      (utf8) Default NLS Option     问题4:Linux Ubuntu 2.6.38-12-generic   对NTFS支持不好,导致挂载U盘后写入东西相当的费劲,基本上是不能写的,可能低版本的会好一些。