本文主要是介绍usb ohci driver porting,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.kernelDevice Drivers --->
SCSI device support --->
<*> SCSI device support
<*> SCSI disk support
U盘用到了SCSI
USB大容量存储设备利用SCSI(Small Computer System Interface,小型计算机系统接口)协议
和主机系统通信
[*] USB support --->
<*> Support for Host-side USB
<*> USB Monitor
<*> USB Mass Storage support
2.编译后下载
初始化错误
<3>s3c2410-ohci s3c2410-ohci: init err (00000000 0000)
mach-smdk6410.c
+#include <plat/regs-usb-hsotg-phy.h>
+#ifdef CONFIG_USB_SUPPORT
+/* 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 */
+ }
+}
+EXPORT_SYMBOL(s3c_otg_phy_config);
+#endif
+
+
----------------------------------------------------
drivers/usb/host/hoci-s3c2410.c
--- samsung/drivers/usb/host/ohci-s3c2410.c 2012-02-07 11:12:07.893644925 +0800
+++ android2.3_kernel_v1.01/drivers/usb/host/ohci-s3c2410.c 2011-05-23 17:04:07.000000000 +0800
@@ -25,10 +25,12 @@
#define valid_port(idx) ((idx) == 1 || (idx) == 2)
+extern void s3c_otg_phy_config(int enable);
+
/* 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 +49,10 @@
dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
+ clk_enable(otg_clk);
+ s3c_otg_phy_config(1);
+
+
clk_enable(usb_clk);
mdelay(2); /* let the bus clock stabilise */
@@ -79,6 +85,7 @@
clk_disable(clk);
clk_disable(usb_clk);
+ clk_disable(otg_clk);
}
/* ohci_s3c2410_hub_status_data
@@ -354,7 +361,7 @@
hcd->rsrc_start = dev->resource[0].start;
hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
- printk("------------%s----------\n", __func__);
+
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
dev_err(&dev->dev, "request_mem_region failed\n");
retval = -EBUSY;
@@ -375,6 +382,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 +409,10 @@
err_ioremap:
s3c2410_stop_hc(dev);
iounmap(hcd->regs);
+
+ clk_put(otg_clk);
+
+ err_otg:
clk_put(usb_clk);
err_clk:
@@ -415,10 +433,8 @@
{
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
int ret;
-
if ((ret = ohci_init(ohci)) < 0)
return ret;
-
if ((ret = ohci_run (ohci)) < 0) {
err ("can't start %s", hcd->self.bus_name);
ohci_stop (hcd);
3.mknod /dev/sda1 b 8 0
mount -t vfat /dev/sda1 /mnt
4.lsusb
lsusb
Bus 001 Device 001: ID 1d6b:0001
Bus 001 Device 002: ID 8644:800b
5.
[/sys/devices/platform/s3c-hsotg]# cat modalias
platform:s3c-hsotg
---------------------------------------------------------
这篇关于usb ohci driver porting的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!