MINI2440 USB驱动移植问题

在移植USB鼠标驱动的时候发现了如下问题:

(1)开发板参数:

开发板 : MINI2440

内核: linux - 2.6.32

(2) 插入USB鼠标之后出现如下错误:

# usb 1-1: new low speed USB device using s3c2410-ohci and address 2
usb 1-1: device descriptor read/64, error -62
usb 1-1: device descriptor read/64, error -62
usb 1-1: new low speed USB device using s3c2410-ohci and address 3
usb 1-1: device descriptor read/64, error -62
usb 1-1: device descriptor read/64, error -62
usb 1-1: new low speed USB device using s3c2410-ohci and address 4
usb 1-1: device not accepting address 4, error -62
usb 1-1: new low speed USB device using s3c2410-ohci and address 5
usb 1-1: device not accepting address 5, error -62
hub 1-0:1.0: unable to enumerate USB device on port 1

解决方法:

(1)使用Linux - 2.6.29 内核即可

(2)如果要继续使用Linux - 2.6.32 内核可以做如下修改

        修改drivers/usb/host/ohci-s3c2410.c

#include <linux/platform_device.h>
#include <linux/clk.h>
#include <plat/usb-control.h>

#define valid_port(idx) ((idx) == 1 || (idx) == 2)

#if 1

#include <mach/regs-clock.h>

unsigned long upllvalue = (0x78 << 12)|(0x02 << 4) | (0x03);

#endif

/* clock device associated with the hcd */

static struct clk *clk;
static struct clk *usb_clk;

/* forward definitions */

static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc);

/* conversion functions */

static struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd)
{
        return hcd->self.controller->platform_data;
}

static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
{
        struct s3c2410_hcd_info *info = dev->dev.platform_data;

        dev_dbg(&dev->dev, "s3c2410_start_hc:\n");

        clk_enable(usb_clk);
        mdelay(2);                      /* let the bus clock stabilise */

        clk_enable(clk);

        if (info != NULL) {
                info->hcd       = hcd;
                info->report_oc = s3c2410_hcd_oc;

                if (info->enable_oc != NULL) {
                        (info->enable_oc)(info, 1);
                }
        }

        while(upllvalue != __raw_readl(S3C2410_UPLLCON))
        {
                __raw_writel(upllvalue ,S3C2410_UPLLCON);
                mdelay(1);
        }

}

加上红色的那两行即可

运行结果

插上USB鼠标后:开发板串口输出如下:

[root@FriendlyARM input]# usb 1-1: new low speed USB device using s3c2410-ohci and address 7
usb 1-1: New USB device found, idVendor=15d9, idProduct=0a4c
usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
usb 1-1: Product:  USB OPTICAL MOUSE
usb 1-1: configuration #1 chosen from 1 choice
usb mouse founded!

拔出:

[root@FriendlyARM input]# usb 1-1: USB disconnect, address 9
usb mouse diconnected!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Mini2440是一款嵌入式开发板,拥有较强的计算能力和丰富的硬件接口,可以用于多种应用的开发和测试。以下是我关于Mini2440测试USB的回答: Mini2440开发板具备USB HOST和USB DEVICE两个USB接口,可以通过测试这些接口实现各种USB设备的连接和功能测试。 首先,我们可以使用Mini2440USB HOST接口来连接外部USB设备,比如鼠标、键盘、USB摄像头等。这样我们可以测试Mini2440是否能够正确检测到这些设备,并且能够正常与之通信。通过测试USB HOST接口,我们可以确保Mini2440USB HOST驱动以及硬件电路的正常工作。 其次,我们可以使用Mini2440USB DEVICE接口来连接到PC或其他主机设备,将Mini2440作为一个USB设备进行测试。这样我们可以测试Mini2440是否能够正确被主机设备识别,并且能够与之进行通信。通过测试USB DEVICE接口,我们可以确保Mini2440USB DEVICE驱动以及硬件电路的正常工作。 为了测试USB功能,我们可以编写相关的测试程序来验证Mini2440USB功能是否正常。我们可以使用开发板提供的开发环境,比如Linux、Windows CE等,编写相应的USB设备驱动程序和应用程序来进行测试。 在测试过程中,我们可以通过观察Mini2440开发板上的LED指示灯、打印测试日志等方式来确认USB功能的正常运行情况。 总之,通过测试Mini2440USB功能,我们可以确保其在连接各种USB设备时的正常工作,为后续的应用开发和测试奠定基础。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值