在2410上使用2路USB HOST

从网上找了点资料,发现可以。

修改linux-2.6.20.3/drivers/usb/host/Kconfig,添加:

config MAX_ROOT_PORTS
    int "Maximum port(s) of RootHub"
    depends on USB_OHCI_HCD && ARCH_S3C2410
    default 1
    ---help---
    pls select usb host number,default one host and one     device.so We select one normally

修改/linux-2.6.20.3/drivers/usb/host/ohci-s3c2410.c
static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
                  struct platform_device *dev)
{
    struct usb_hcd *hcd = NULL;
    int retval;
     //add by hiboy
    unsigned long tmp;
    #if CONFIG_MAX_ROOT_PORTS < 2
        /* 1 host port, 1 slave port*/
        tmp = __raw_readl(S3C2410_MISCCR);
        tmp &= ~S3C2410_MISCCR_USBHOST;
        __raw_writel(tmp, S3C2410_MISCCR);
        s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
    #else
    /* 2 host port */
        tmp = __raw_readl(S3C2410_MISCCR);
        tmp |= S3C2410_MISCCR_USBHOST;
        __raw_writel(tmp, S3C2410_MISCCR);
        s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
        s3c2410_usb_set_power(dev->dev.platform_data, 2, 1);
    #endif


    //s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
    //s3c2410_usb_set_power(dev->dev.platform_data, 2, 1);
。。。。
修改/linux-2.6.20.3/drivers/usb/core/hub.c
static int hub_configure(struct usb_hub *hub,
    struct usb_endpoint_descriptor *endpoint)
{
    struct usb_device *hdev = hub->hdev;
    struct device *hub_dev = hub->intfdev;
    u16 hubstatus, hubchange;
    u16 wHubCharacteristics;
    unsigned int pipe;
    int maxp, ret;
    char *message;

    hub->buffer = usb_buffer_alloc(hdev, sizeof(*hub->buffer), GFP_KERNEL,
            &hub->buffer_dma);
    if (!hub->buffer) {
        message = "can't allocate hub irq buffer";
        ret = -ENOMEM;
        goto fail;
    }

    hub->status = kmalloc(sizeof(*hub->status), GFP_KERNEL);
    if (!hub->status) {
        message = "can't kmalloc hub status buffer";
        ret = -ENOMEM;
        goto fail;
    }
    mutex_init(&hub->status_mutex);

    hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL);
    if (!hub->descriptor) {
        message = "can't kmalloc hub descriptor";
        ret = -ENOMEM;
        goto fail;
    }

    /* Request the entire hub descriptor.
     * hub->descriptor can handle USB_MAXCHILDREN ports,
     * but the hub can/will return fewer bytes here.
     */
    ret = get_hub_descriptor(hdev, hub->descriptor,
            sizeof(*hub->descriptor));
    if (ret < 0) {
        message = "can't read hub descriptor";
        goto fail;
    } else if (hub->descriptor->bNbrPorts > USB_MAXCHILDREN) {
        message = "hub has too many ports!";
        ret = -ENODEV;
        goto fail;
    }

    /********************************************/
    /*add by hiboy */
    #ifdef CONFIG_ARCH_S3C2410
    if ((hdev->devnum == 1)  // Root Hub
    && hub->descriptor->bNbrPorts > CONFIG_MAX_ROOT_PORTS) {
    int j;
    for (j=hub->descriptor->bNbrPorts-1; j>=0; j--) {
        printk("port #%d ", j);
        if (j > CONFIG_MAX_ROOT_PORTS-1) {
        printk("suspened!/n");
        } else {
        printk("alived!/n");
        }
    }
    hub->descriptor->bNbrPorts = CONFIG_MAX_ROOT_PORTS;
    }
    #endif
    /*********************************************/

。。。。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值