dwc_otg_hcd_linux.c File Reference

This file contains the implementation of the HCD. More...

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/string.h>
#include <linux/dma-mapping.h>
#include <linux/version.h>
#include <asm/io.h>
#include <linux/usb.h>
#include <../drivers/usb/core/hcd.h>
#include "dwc_otg_hcd_if.h"
#include "dwc_otg_dbg.h"
#include "dwc_otg_driver.h"

Go to the source code of this file.

Data Structures

struct  wrapper_priv_data

Linux HC Driver API Functions

static int urb_enqueue (struct usb_hcd *hcd, struct usb_host_endpoint *ep, struct urb *urb, gfp_t mem_flags)
 Starts processing a USB transfer request specified by a USB Request Block (URB).
static int urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
 Aborts/cancels a USB transfer request.
static void endpoint_disable (struct usb_hcd *hcd, struct usb_host_endpoint *ep)
static irqreturn_t dwc_otg_hcd_irq (struct usb_hcd *hcd)
 Handles host mode interrupts for the DWC_otg controller.
int hcd_start (struct usb_hcd *hcd)
 Initializes the DWC_otg controller and its root hub and prepares it for host mode operation.
void hcd_stop (struct usb_hcd *hcd)
 Halts the DWC_otg host mode operations in a clean manner.
static int get_frame_number (struct usb_hcd *hcd)
 Returns the current frame number.
int hub_status_data (struct usb_hcd *hcd, char *buf)
 Creates Status Change bitmap for the root hub and root port.
int hub_control (struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength)
 Handles hub class-specific requests.

Defines

#define dwc_ep_addr_to_endpoint(_bEndpointAddress_)
 Gets the endpoint number from a _bEndpointAddress argument.

Functions

static dwc_otg_hcd_thcd_to_dwc_otg_hcd (struct usb_hcd *hcd)
 Gets the dwc_otg_hcd from a struct usb_hcd.
static struct usb_hcd * dwc_otg_hcd_to_hcd (dwc_otg_hcd_t *dwc_otg_hcd)
 Gets the struct usb_hcd that contains a dwc_otg_hcd_t.
usb_host_endpoint * dwc_urb_to_endpoint (struct urb *urb)
 Gets the usb_host_endpoint associated with an URB.
static int _disconnect (dwc_otg_hcd_t *hcd)
static int _start (dwc_otg_hcd_t *hcd)
static int _hub_info (dwc_otg_hcd_t *hcd, void *urb_handle, uint32_t *hub_addr, uint32_t *port_addr)
static int _speed (dwc_otg_hcd_t *hcd, void *urb_handle)
static int _get_b_hnp_enable (dwc_otg_hcd_t *hcd)
static void allocate_bus_bandwidth (struct usb_hcd *hcd, uint32_t bw, struct urb *urb)
static void free_bus_bandwidth (struct usb_hcd *hcd, uint32_t bw, struct urb *urb)
static int _complete (dwc_otg_hcd_t *hcd, void *urb_handle, dwc_otg_hcd_urb_t *dwc_otg_urb, int32_t status)
 Sets the final status of an URB and returns it to the device driver.
int hcd_init ()
 Initializes the HCD.
void hcd_remove ()
 Removes the HCD.

Variables

static const char dwc_otg_hcd_name [] = "dwc_otg_hcd"
static struct hc_driver dwc_otg_hc_driver
static struct dwc_otg_hcd_function_ops hcd_fops


Detailed Description

This file contains the implementation of the HCD.

In Linux, the HCD implements the hc_driver API.

Definition in file dwc_otg_hcd_linux.c.


Define Documentation

#define dwc_ep_addr_to_endpoint ( _bEndpointAddress_   ) 

Value:

((_bEndpointAddress_ & USB_ENDPOINT_NUMBER_MASK) | \
                                                     ((_bEndpointAddress_ & USB_DIR_IN) != 0) << 4)
Gets the endpoint number from a _bEndpointAddress argument.

The endpoint is qualified with its direction (possible 32 endpoints per device).

Definition at line 71 of file dwc_otg_hcd_linux.c.


Function Documentation

static int urb_enqueue ( struct usb_hcd *  hcd,
struct usb_host_endpoint *  ep,
struct urb *  urb,
gfp_t  mem_flags 
) [static]

Starts processing a USB transfer request specified by a USB Request Block (URB).

mem_flags indicates the type of memory allocation to use while processing this URB.

Definition at line 562 of file dwc_otg_hcd_linux.c.

static int urb_dequeue ( struct usb_hcd *  hcd,
struct urb *  urb 
) [static]

Aborts/cancels a USB transfer request.

Always returns 0 to indicate success.

Definition at line 667 of file dwc_otg_hcd_linux.c.

static irqreturn_t dwc_otg_hcd_irq ( struct usb_hcd *  hcd  )  [static]

Handles host mode interrupts for the DWC_otg controller.

Returns IRQ_NONE if there was no interrupt to handle. Returns IRQ_HANDLED if there was a valid interrupt.

This function is called by the USB core when an interrupt occurs

Definition at line 714 of file dwc_otg_hcd_linux.c.

int hcd_start ( struct usb_hcd *  hcd  ) 

Initializes the DWC_otg controller and its root hub and prepares it for host mode operation.

Activates the root port. Returns 0 on success and a negative error code on failure.

Definition at line 469 of file dwc_otg_hcd_linux.c.

void hcd_stop ( struct usb_hcd *  hcd  ) 

Halts the DWC_otg host mode operations in a clean manner.

USB transfers are stopped.

Definition at line 496 of file dwc_otg_hcd_linux.c.

int hub_status_data ( struct usb_hcd *  hcd,
char *  buf 
)

Creates Status Change bitmap for the root hub and root port.

The bitmap is returned in buf. Bit 0 is the status change indicator for the root hub. Bit 1 is the status change indicator for the single root port. Returns 1 if either change indicator is 1, otherwise returns 0.

Definition at line 728 of file dwc_otg_hcd_linux.c.

static int _complete ( dwc_otg_hcd_t hcd,
void *  urb_handle,
dwc_otg_hcd_urb_t dwc_otg_urb,
int32_t  status 
) [static]

Sets the final status of an URB and returns it to the device driver.

Any required cleanup of the URB is performed.

Definition at line 224 of file dwc_otg_hcd_linux.c.

int hcd_init (  ) 

Initializes the HCD.

This function allocates memory for and initializes the static parts of the usb_hcd and dwc_otg_hcd structures. It also registers the USB bus with the core and calls the hc_driver->start() function. It returns a negative error on failure.

Definition at line 327 of file dwc_otg_hcd_linux.c.

void hcd_remove (  ) 

Removes the HCD.

Frees memory and resources associated with the HCD and deregisters the bus.

Definition at line 417 of file dwc_otg_hcd_linux.c.


Variable Documentation

struct hc_driver dwc_otg_hc_driver [static]

Initial value:

 {

        .description = dwc_otg_hcd_name,
        .product_desc = "DWC OTG Controller",
        .hcd_priv_size = sizeof(struct wrapper_priv_data),

        .irq = dwc_otg_hcd_irq,

        .flags = HCD_MEMORY | HCD_USB2,

        
        .start = hcd_start,
        
        
        .stop = hcd_stop,

        .urb_enqueue = urb_enqueue,
        .urb_dequeue = urb_dequeue,
        .endpoint_disable = endpoint_disable,

        .get_frame_number = get_frame_number,

        .hub_status_data = hub_status_data,
        .hub_control = hub_control,
        
        
}

Definition at line 101 of file dwc_otg_hcd_linux.c.

struct dwc_otg_hcd_function_ops hcd_fops [static]

Initial value:

 {
        .start = _start,
        .disconnect = _disconnect,
        .hub_info = _hub_info,
        .speed = _speed,
        .complete = _complete,
        .get_b_hnp_enable = _get_b_hnp_enable,
}

Definition at line 312 of file dwc_otg_hcd_linux.c.


Generated on Tue May 5 02:22:49 2009 for DesignWare USB 2.0 OTG Controller (DWC_otg) Device Driver by  doxygen 1.4.7