FreeBSD kernel usb device Code
ehci_fsl.c File Reference
#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/queue.h>
#include <sys/lock.h>
#include <sys/lockmgr.h>
#include <sys/condvar.h>
#include <sys/rman.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usb_core.h>
#include <dev/usb/usb_busdma.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_util.h>
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/ehci.h>
#include <dev/usb/controller/ehcireg.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <machine/resource.h>
#include <powerpc/include/tlb.h>
#include "opt_platform.h"
Include dependency graph for ehci_fsl.c:

Go to the source code of this file.

Macros

#define FSL_EHCI_REG_OFF   0x100
 
#define FSL_EHCI_REG_SIZE   0x300
 
#define SNOOP_RANGE_2GB   0x1E
 
#define PORT_POWER_MASK   0x00001000
 

Enumerations

enum  internal_reg {
  SNOOP1 = 0x400 , SNOOP2 = 0x404 , AGE_CNT_THRESH = 0x408 , SI_CTRL = 0x410 ,
  CONTROL = 0x500
}
 
enum  control_flags { USB_EN = 0x00000004 , UTMI_PHY_EN = 0x00000200 , ULPI_INT_EN = 0x00000001 }
 
enum  si_ctrl_flags { FETCH_32 = 1 , FETCH_64 = 0 }
 
enum  special_op_reg { USBMODE = 0x0A8 , PORTSC = 0x084 , ULPI_VIEWPORT = 0x70 }
 
enum  usbmode_flags { HOST_MODE = 0x3 , DEVICE_MODE = 0x2 }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int fsl_ehci_attach (device_t self)
 
static int fsl_ehci_detach (device_t self)
 
static int fsl_ehci_probe (device_t self)
 
 DRIVER_MODULE (ehci, simplebus, ehci_driver, ehci_devclass, 0, 0)
 
 MODULE_DEPEND (ehci, usb, 1, 1, 1)
 
static void set_to_host_mode (ehci_softc_t *sc)
 
static void enable_usb (device_t dev, bus_space_tag_t iot, bus_space_handle_t ioh)
 
static void set_32b_prefetch (bus_space_tag_t iot, bus_space_handle_t ioh)
 
static void set_snooping (bus_space_tag_t iot, bus_space_handle_t ioh)
 
static void clear_port_power (ehci_softc_t *sc)
 

Variables

static device_method_t ehci_methods []
 
static driver_t ehci_driver
 
static devclass_t ehci_devclass
 

Macro Definition Documentation

◆ FSL_EHCI_REG_OFF

#define FSL_EHCI_REG_OFF   0x100

Definition at line 104 of file ehci_fsl.c.

◆ FSL_EHCI_REG_SIZE

#define FSL_EHCI_REG_SIZE   0x300

Definition at line 105 of file ehci_fsl.c.

◆ PORT_POWER_MASK

#define PORT_POWER_MASK   0x00001000

Definition at line 150 of file ehci_fsl.c.

◆ SNOOP_RANGE_2GB

#define SNOOP_RANGE_2GB   0x1E

Definition at line 132 of file ehci_fsl.c.

Enumeration Type Documentation

◆ control_flags

Enumerator
USB_EN 
UTMI_PHY_EN 
ULPI_INT_EN 

Definition at line 120 of file ehci_fsl.c.

◆ internal_reg

Enumerator
SNOOP1 
SNOOP2 
AGE_CNT_THRESH 
SI_CTRL 
CONTROL 

Definition at line 111 of file ehci_fsl.c.

◆ si_ctrl_flags

Enumerator
FETCH_32 
FETCH_64 

Definition at line 127 of file ehci_fsl.c.

◆ special_op_reg

Enumerator
USBMODE 
PORTSC 
ULPI_VIEWPORT 

Definition at line 138 of file ehci_fsl.c.

◆ usbmode_flags

Enumerator
HOST_MODE 
DEVICE_MODE 

Definition at line 145 of file ehci_fsl.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ clear_port_power()

static void clear_port_power ( ehci_softc_t sc)
static

Definition at line 201 of file ehci_fsl.c.

References PORT_POWER_MASK, PORTSC, ehci_softc::sc_io_hdl, and ehci_softc::sc_io_tag.

Referenced by fsl_ehci_attach().

Here is the caller graph for this function:

◆ DRIVER_MODULE()

DRIVER_MODULE ( ehci  ,
simplebus  ,
ehci_driver  ,
ehci_devclass  ,
,
 
)

◆ enable_usb()

static void enable_usb ( device_t  dev,
bus_space_tag_t  iot,
bus_space_handle_t  ioh 
)
static

Definition at line 166 of file ehci_fsl.c.

References CONTROL, dev, USB_EN, and UTMI_PHY_EN.

Referenced by fsl_ehci_attach().

Here is the caller graph for this function:

◆ fsl_ehci_attach()

◆ fsl_ehci_detach()

static int fsl_ehci_detach ( device_t  self)
static

Definition at line 377 of file ehci_fsl.c.

References usb_bus::bdev, ehci_detach(), EHCI_SCFLG_DONEINIT, EHCI_USBINTR, ehci_softc::sc_bus, ehci_softc::sc_flags, ehci_softc::sc_intr_hdl, ehci_softc::sc_io_hdl, ehci_softc::sc_io_res, ehci_softc::sc_io_tag, and ehci_softc::sc_irq_res.

Referenced by fsl_ehci_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fsl_ehci_probe()

static int fsl_ehci_probe ( device_t  self)
static

Definition at line 213 of file ehci_fsl.c.

References dev.

◆ MODULE_DEPEND()

MODULE_DEPEND ( ehci  ,
usb  ,
,
,
 
)

◆ set_32b_prefetch()

static void set_32b_prefetch ( bus_space_tag_t  iot,
bus_space_handle_t  ioh 
)
static

Definition at line 186 of file ehci_fsl.c.

References FETCH_32, and SI_CTRL.

Referenced by fsl_ehci_attach().

Here is the caller graph for this function:

◆ set_snooping()

static void set_snooping ( bus_space_tag_t  iot,
bus_space_handle_t  ioh 
)
static

Definition at line 193 of file ehci_fsl.c.

References SNOOP1, SNOOP2, and SNOOP_RANGE_2GB.

Referenced by fsl_ehci_attach().

Here is the caller graph for this function:

◆ set_to_host_mode()

static void set_to_host_mode ( ehci_softc_t sc)
static

Definition at line 157 of file ehci_fsl.c.

References HOST_MODE, ehci_softc::sc_io_hdl, ehci_softc::sc_io_tag, and USBMODE.

Referenced by fsl_ehci_attach().

Here is the caller graph for this function:

Variable Documentation

◆ ehci_devclass

devclass_t ehci_devclass
static

Definition at line 96 of file ehci_fsl.c.

◆ ehci_driver

driver_t ehci_driver
static
Initial value:
= {
"ehci",
sizeof(struct ehci_softc)
}
static device_method_t ehci_methods[]
Definition: ehci_fsl.c:75

Definition at line 90 of file ehci_fsl.c.

◆ ehci_methods

device_method_t ehci_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, fsl_ehci_probe),
DEVMETHOD(device_attach, fsl_ehci_attach),
DEVMETHOD(device_detach, fsl_ehci_detach),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(bus_print_child, bus_generic_print_child),
{ 0, 0 }
}
static int fsl_ehci_attach(device_t self)
Definition: ehci_fsl.c:229
static int fsl_ehci_probe(device_t self)
Definition: ehci_fsl.c:213
static int fsl_ehci_detach(device_t self)
Definition: ehci_fsl.c:377

Definition at line 75 of file ehci_fsl.c.