Changeset a799708 in mainline


Ignore:
Timestamp:
2015-07-04T01:49:47Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d51ba359
Parents:
8d7552c
Message:

ehci,ohci,uhci: Switch to generic hc drv initialization function

Location:
uspace/drv/bus/usb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/main.c

    r8d7552c ra799708  
    8989
    9090
     91static const ddf_hc_driver_t ehci_hc_driver = {
     92        .claim = disable_legacy,
     93        .hc_speed = USB_SPEED_HIGH,
     94        .irq_code_gen = ehci_hc_gen_irq_code,
     95        .init = ehci_driver_init,
     96        .fini = ehci_driver_fini,
     97        .name = "EHCI-PCI"
     98};
     99
    91100/** Initializes a new ddf driver instance of EHCI hcd.
    92101 *
     
    99108        assert(device);
    100109
    101         int ret = disable_legacy(device);
    102         if (ret != EOK) {
    103                 usb_log_error("Failed to disable EHCI legacy support: %s\n",
    104                     str_error(ret));
    105                 return ret;
    106         }
     110        return hcd_ddf_add_hc(device, &ehci_hc_driver);
    107111
    108         ret = ddf_hcd_device_setup_all(device, USB_SPEED_HIGH,
    109             BANDWIDTH_AVAILABLE_USB20, bandwidth_count_usb11,
    110             ddf_hcd_gen_irq_handler, ehci_hc_gen_irq_code,
    111             ehci_driver_init, ehci_driver_fini);
    112         if (ret != EOK) {
    113                 usb_log_error("Failed to initialize EHCI driver: %s.\n",
    114                     str_error(ret));
    115                 return ret;
    116         }
    117         usb_log_info("Controlling new EHCI device '%s'.\n",
    118             ddf_dev_get_name(device));
    119 
    120         return EOK;
    121112}
    122113
  • uspace/drv/bus/usb/ohci/main.c

    r8d7552c ra799708  
    7474}
    7575
     76static const ddf_hc_driver_t ohci_hc_driver = {
     77        .hc_speed = USB_SPEED_FULL,
     78        .irq_code_gen = ohci_hc_gen_irq_code,
     79        .init = ohci_driver_init,
     80        .fini = ohci_driver_fini,
     81        .name = "OHCI"
     82};
     83
    7684/** Initializes a new ddf driver instance of OHCI hcd.
    7785 *
     
    8391        usb_log_debug("ohci_dev_add() called\n");
    8492        assert(device);
    85 
    86         const int ret = ddf_hcd_device_setup_all(device, USB_SPEED_FULL,
    87             BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11,
    88             ddf_hcd_gen_irq_handler, ohci_hc_gen_irq_code,
    89             ohci_driver_init, ohci_driver_fini);
    90         if (ret != EOK) {
    91                 usb_log_error("Failed to initialize OHCI driver: %s.\n",
    92                     str_error(ret));
    93         }
    94         usb_log_info("Controlling new OHCI device '%s'.\n",
    95             ddf_dev_get_name(device));
    96 
    97         return ret;
     93        return hcd_ddf_add_hc(device, &ohci_hc_driver);
    9894}
    9995
  • uspace/drv/bus/usb/uhci/main.c

    r8d7552c ra799708  
    106106        return rc;
    107107}
     108static const ddf_hc_driver_t uhci_hc_driver = {
     109        .claim = disable_legacy,
     110        .hc_speed = USB_SPEED_FULL,
     111        .irq_code_gen = uhci_hc_gen_irq_code,
     112        .init = uhci_driver_init,
     113        .fini = uhci_driver_fini,
     114        .name = "UHCI"
     115};
     116
    108117
    109118/** Initialize a new ddf driver instance for uhci hc and hub.
     
    116125        usb_log_debug2("uhci_dev_add() called\n");
    117126        assert(device);
    118 
    119         int ret = disable_legacy(device);
    120         if (ret != EOK) {
    121                 usb_log_error("Failed to disable legacy USB: %s.\n",
    122                     str_error(ret));
    123                 return ret;
    124         }
    125 
    126 
    127         ret = ddf_hcd_device_setup_all(device, USB_SPEED_FULL,
    128             BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11,
    129             ddf_hcd_gen_irq_handler, uhci_hc_gen_irq_code,
    130             uhci_driver_init, uhci_driver_fini);
    131         if (ret != EOK) {
    132                 usb_log_error("Failed to initialize UHCI driver: %s.\n",
    133                     str_error(ret));
    134         } else {
    135                 usb_log_info("Controlling new UHCI device '%s'.\n",
    136                     ddf_dev_get_name(device));
    137         }
    138 
    139         return ret;
     127        return hcd_ddf_add_hc(device, &uhci_hc_driver);
    140128}
    141129
Note: See TracChangeset for help on using the changeset viewer.