終於做完usb的移植了,前前後後自己一共做了20幾個zImage,其中也發現了很多問題,所幸的是問題都已得到解決,有很多問題是關於make menuconfig的,有這樣那樣的選項沒有選上就會出現問題,以後要注意,還有就是網上的關於tiny6410的移植很少,還不全!
1、vi arch/arm/mach-s3c64xx/mach-mini6410.c
124行增加
/* 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:\n");
+ 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\n");
+ 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 menuconfig
Device 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盤後寫入東西相當的費勁,基本上是不能寫的,可能低版本的會好一些。