Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/ti/usb/omap_host.c
Show All 34 Lines | |||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <dev/fdt/simplebus.h> | #include <dev/fdt/simplebus.h> | ||||
#include <dev/ofw/ofw_bus_subr.h> | #include <dev/ofw/ofw_bus_subr.h> | ||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <arm/ti/ti_prcm.h> | #include <arm/ti/ti_sysc.h> | ||||
#include <arm/ti/usb/omap_usb.h> | #include <arm/ti/usb/omap_usb.h> | ||||
/* | /* | ||||
* USB Host Module | * USB Host Module | ||||
*/ | */ | ||||
/* UHH */ | /* UHH */ | ||||
#define OMAP_USBHOST_UHH_REVISION 0x0000 | #define OMAP_USBHOST_UHH_REVISION 0x0000 | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
omap_uhh_init(struct omap_uhh_softc *isc) | omap_uhh_init(struct omap_uhh_softc *isc) | ||||
{ | { | ||||
uint8_t tll_ch_mask; | uint8_t tll_ch_mask; | ||||
uint32_t reg; | uint32_t reg; | ||||
int i; | int i; | ||||
/* Enable Clocks for high speed USBHOST */ | /* Enable Clocks for high speed USBHOST */ | ||||
ti_prcm_clk_enable(USBHSHOST_CLK); | ti_sysc_clock_enable(device_get_parent(isc->sc_dev)); | ||||
/* Read the UHH revision */ | /* Read the UHH revision */ | ||||
isc->uhh_rev = omap_uhh_read_4(isc, OMAP_USBHOST_UHH_REVISION); | isc->uhh_rev = omap_uhh_read_4(isc, OMAP_USBHOST_UHH_REVISION); | ||||
device_printf(isc->sc_dev, "UHH revision 0x%08x\n", isc->uhh_rev); | device_printf(isc->sc_dev, "UHH revision 0x%08x\n", isc->uhh_rev); | ||||
/* FIXME */ | |||||
#if 0 | |||||
if (isc->uhh_rev == OMAP_UHH_REV2) { | if (isc->uhh_rev == OMAP_UHH_REV2) { | ||||
/* For OMAP44xx devices you have to enable the per-port clocks: | /* For OMAP44xx devices you have to enable the per-port clocks: | ||||
* PHY_MODE - External ULPI clock | * PHY_MODE - External ULPI clock | ||||
* TTL_MODE - Internal UTMI clock | * TTL_MODE - Internal UTMI clock | ||||
* HSIC_MODE - Internal 480Mhz and 60Mhz clocks | * HSIC_MODE - Internal 480Mhz and 60Mhz clocks | ||||
*/ | */ | ||||
switch(isc->port_mode[0]) { | switch(isc->port_mode[0]) { | ||||
case EHCI_HCD_OMAP_MODE_UNKNOWN: | case EHCI_HCD_OMAP_MODE_UNKNOWN: | ||||
Show All 39 Lines | case EHCI_HCD_OMAP_MODE_HSIC: | ||||
if (ti_prcm_clk_enable(USBP2_HSIC_CLK)) | if (ti_prcm_clk_enable(USBP2_HSIC_CLK)) | ||||
device_printf(isc->sc_dev, | device_printf(isc->sc_dev, | ||||
"failed to set clock USBP2_HSIC_CLK source for port 1\n"); | "failed to set clock USBP2_HSIC_CLK source for port 1\n"); | ||||
break; | break; | ||||
default: | default: | ||||
device_printf(isc->sc_dev, "unknown port mode %d for port 1\n", isc->port_mode[1]); | device_printf(isc->sc_dev, "unknown port mode %d for port 1\n", isc->port_mode[1]); | ||||
} | } | ||||
} | } | ||||
#endif | |||||
/* Put UHH in SmartIdle/SmartStandby mode */ | /* Put UHH in SmartIdle/SmartStandby mode */ | ||||
reg = omap_uhh_read_4(isc, OMAP_USBHOST_UHH_SYSCONFIG); | reg = omap_uhh_read_4(isc, OMAP_USBHOST_UHH_SYSCONFIG); | ||||
if (isc->uhh_rev == OMAP_UHH_REV1) { | if (isc->uhh_rev == OMAP_UHH_REV1) { | ||||
reg &= ~(UHH_SYSCONFIG_SIDLEMODE_MASK | | reg &= ~(UHH_SYSCONFIG_SIDLEMODE_MASK | | ||||
UHH_SYSCONFIG_MIDLEMODE_MASK); | UHH_SYSCONFIG_MIDLEMODE_MASK); | ||||
reg |= (UHH_SYSCONFIG_ENAWAKEUP | | reg |= (UHH_SYSCONFIG_ENAWAKEUP | | ||||
UHH_SYSCONFIG_AUTOIDLE | | UHH_SYSCONFIG_AUTOIDLE | | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | while ((omap_uhh_read_4(isc, OMAP_USBHOST_UHH_SYSSTATUS) & 0x07) == 0x00) { | ||||
if (timeout-- == 0) { | if (timeout-- == 0) { | ||||
device_printf(isc->sc_dev, "operation timed out\n"); | device_printf(isc->sc_dev, "operation timed out\n"); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
/* Disable functional and interface clocks for the TLL and HOST modules */ | /* Disable functional and interface clocks for the TLL and HOST modules */ | ||||
ti_prcm_clk_disable(USBHSHOST_CLK); | ti_sysc_clock_disable(device_get_parent(isc->sc_dev)); | ||||
device_printf(isc->sc_dev, "Clock to USB host has been disabled\n"); | device_printf(isc->sc_dev, "Clock to USB host has been disabled\n"); | ||||
} | } | ||||
int | int | ||||
omap_usb_port_mode(device_t dev, int port) | omap_usb_port_mode(device_t dev, int port) | ||||
{ | { | ||||
struct omap_uhh_softc *isc; | struct omap_uhh_softc *isc; | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |