阳初2440 超值版只能使用一个 USB Host 问题的解决

    记得刚买回来板子的时候,上面自带的系统是 WinCE,试运行了一下,发现一个USB接口不能用(插U盘或鼠标时只闪一下灯就没反应了,刚开始以为是电压低...汗)。今天逛论坛时正好碰到了解决方法,转帖过来,以备以后参考。
    阳初论坛帖子的地址: 关于阳初2440超值版只能使用一个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
    /*********************************************/

    第二篇:  原文网址
    是由于MISCCR寄存器没有正确设置的缘故,我在mach-2410.c中增加了设置MISCCR寄存器的内容,HOST0就可以正常使用了
    /*add by seigpao*/
    int usb_seigpao_init(void)
    {
      unsigned long upllvalue;
      unsigned long misccr;

      //设置UPLLCON
      upllvalue = (0x78<<12)|(0x02<<4)|(0x03);
      __raw_writel(upllvalue,S3C2410_UPLLCON);

      //设置MISCCR
      misccr = __raw_readl(S3C2410_MISCCR);
      misccr |= S3C2410_MISCCR_USBHOST;
      misccr &= ~(S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1);
      __raw_writel(misccr,S3C2410_MISCCR);

      return 1;
    }
    /* end by seigpao */

    static void __init smdk2410_map_io(void)
    {
        s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
        s3c24xx_init_clocks(0);
        s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
        s3c24xx_set_board(&smdk2410_board);

        /*add by seigpao*/
        //设置2410触摸屏
        set_s3c2410ts_info(&sbc2410_ts_cfg);

        //设置USB相关寄存器
        usb_seigpao_init();
        /* end by seigpao */
     }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值