mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-29 18:41:30 +00:00
Merge branch 'pr-15052014' of git://git.denx.de/u-boot-usb
This commit is contained in:
commit
8e38128596
7 changed files with 166 additions and 70 deletions
|
@ -349,6 +349,8 @@ struct usb_ctlr {
|
||||||
|
|
||||||
/* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
|
/* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
|
||||||
#define VBUS_VLD_STS (1 << 26)
|
#define VBUS_VLD_STS (1 << 26)
|
||||||
|
#define VBUS_B_SESS_VLD_SW_VALUE (1 << 12)
|
||||||
|
#define VBUS_B_SESS_VLD_SW_EN (1 << 11)
|
||||||
|
|
||||||
/* Setup USB on the board */
|
/* Setup USB on the board */
|
||||||
int usb_process_devicetree(const void *blob);
|
int usb_process_devicetree(const void *blob);
|
||||||
|
|
|
@ -131,6 +131,10 @@ int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
ret = dfu_write_buffer_drain(dfu);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (dfu->flush_medium)
|
if (dfu->flush_medium)
|
||||||
ret = dfu->flush_medium(dfu);
|
ret = dfu->flush_medium(dfu);
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,29 @@ static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE)
|
||||||
dfu_file_buf[CONFIG_SYS_DFU_MAX_FILE_SIZE];
|
dfu_file_buf[CONFIG_SYS_DFU_MAX_FILE_SIZE];
|
||||||
static long dfu_file_buf_len;
|
static long dfu_file_buf_len;
|
||||||
|
|
||||||
|
static int mmc_access_part(struct dfu_entity *dfu, struct mmc *mmc, int part)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (part == mmc->part_num)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ret = mmc_switch_part(dfu->dev_num, part);
|
||||||
|
if (ret) {
|
||||||
|
error("Cannot switch to partition %d\n", part);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
mmc->part_num = part;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
|
static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
|
||||||
u64 offset, void *buf, long *len)
|
u64 offset, void *buf, long *len)
|
||||||
{
|
{
|
||||||
struct mmc *mmc = find_mmc_device(dfu->dev_num);
|
struct mmc *mmc = find_mmc_device(dfu->dev_num);
|
||||||
u32 blk_start, blk_count, n = 0;
|
u32 blk_start, blk_count, n = 0;
|
||||||
|
int ret, part_num_bkp = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must ensure that we work in lba_blk_size chunks, so ALIGN
|
* We must ensure that we work in lba_blk_size chunks, so ALIGN
|
||||||
|
@ -39,6 +57,13 @@ static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dfu->data.mmc.hw_partition >= 0) {
|
||||||
|
part_num_bkp = mmc->part_num;
|
||||||
|
ret = mmc_access_part(dfu, mmc, dfu->data.mmc.hw_partition);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
debug("%s: %s dev: %d start: %d cnt: %d buf: 0x%p\n", __func__,
|
debug("%s: %s dev: %d start: %d cnt: %d buf: 0x%p\n", __func__,
|
||||||
op == DFU_OP_READ ? "MMC READ" : "MMC WRITE", dfu->dev_num,
|
op == DFU_OP_READ ? "MMC READ" : "MMC WRITE", dfu->dev_num,
|
||||||
blk_start, blk_count, buf);
|
blk_start, blk_count, buf);
|
||||||
|
@ -57,9 +82,17 @@ static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
|
||||||
|
|
||||||
if (n != blk_count) {
|
if (n != blk_count) {
|
||||||
error("MMC operation failed");
|
error("MMC operation failed");
|
||||||
|
if (dfu->data.mmc.hw_partition >= 0)
|
||||||
|
mmc_access_part(dfu, mmc, part_num_bkp);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dfu->data.mmc.hw_partition >= 0) {
|
||||||
|
ret = mmc_access_part(dfu, mmc, part_num_bkp);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +227,8 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
|
||||||
* 2nd and 3rd:
|
* 2nd and 3rd:
|
||||||
* lba_start and lba_size, for raw write
|
* lba_start and lba_size, for raw write
|
||||||
* mmc_dev and mmc_part, for filesystems and part
|
* mmc_dev and mmc_part, for filesystems and part
|
||||||
|
* 4th (optional):
|
||||||
|
* mmcpart <num> (access to HW eMMC partitions)
|
||||||
*/
|
*/
|
||||||
int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
|
int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
|
||||||
{
|
{
|
||||||
|
@ -233,11 +268,22 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dfu->data.mmc.hw_partition = -EINVAL;
|
||||||
if (!strcmp(entity_type, "raw")) {
|
if (!strcmp(entity_type, "raw")) {
|
||||||
dfu->layout = DFU_RAW_ADDR;
|
dfu->layout = DFU_RAW_ADDR;
|
||||||
dfu->data.mmc.lba_start = second_arg;
|
dfu->data.mmc.lba_start = second_arg;
|
||||||
dfu->data.mmc.lba_size = third_arg;
|
dfu->data.mmc.lba_size = third_arg;
|
||||||
dfu->data.mmc.lba_blk_size = mmc->read_bl_len;
|
dfu->data.mmc.lba_blk_size = mmc->read_bl_len;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check for an extra entry at dfu_alt_info env variable
|
||||||
|
* specifying the mmc HW defined partition number
|
||||||
|
*/
|
||||||
|
if (s)
|
||||||
|
if (!strcmp(strsep(&s, " "), "mmcpart"))
|
||||||
|
dfu->data.mmc.hw_partition =
|
||||||
|
simple_strtoul(s, NULL, 0);
|
||||||
|
|
||||||
} else if (!strcmp(entity_type, "part")) {
|
} else if (!strcmp(entity_type, "part")) {
|
||||||
disk_partition_t partinfo;
|
disk_partition_t partinfo;
|
||||||
block_dev_desc_t *blk_dev = &mmc->block_dev;
|
block_dev_desc_t *blk_dev = &mmc->block_dev;
|
||||||
|
|
|
@ -424,6 +424,7 @@ static void handle_ep_complete(struct ci_ep *ep)
|
||||||
item = ci_get_qtd(num, in);
|
item = ci_get_qtd(num, in);
|
||||||
ci_invalidate_qtd(num);
|
ci_invalidate_qtd(num);
|
||||||
|
|
||||||
|
len = (item->info >> 16) & 0x7fff;
|
||||||
if (item->info & 0xff)
|
if (item->info & 0xff)
|
||||||
printf("EP%d/%s FAIL info=%x pg0=%x\n",
|
printf("EP%d/%s FAIL info=%x pg0=%x\n",
|
||||||
num, in ? "in" : "out", item->info, item->page0);
|
num, in ? "in" : "out", item->info, item->page0);
|
||||||
|
@ -435,7 +436,6 @@ static void handle_ep_complete(struct ci_ep *ep)
|
||||||
if (!list_empty(&ep->queue))
|
if (!list_empty(&ep->queue))
|
||||||
ci_ep_submit_next_request(ep);
|
ci_ep_submit_next_request(ep);
|
||||||
|
|
||||||
len = (item->info >> 16) & 0x7fff;
|
|
||||||
ci_req->req.actual = ci_req->req.length - len;
|
ci_req->req.actual = ci_req->req.length - len;
|
||||||
ci_debounce(ci_req, in);
|
ci_debounce(ci_req, in);
|
||||||
|
|
||||||
|
|
|
@ -219,21 +219,15 @@ static int download_tail(long long int left, int cnt)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To store last "packet" DFU storage backend requires dfu_write with
|
* To store last "packet" or write file from buffer to filesystem
|
||||||
* size parameter equal to 0
|
* DFU storage backend requires dfu_flush
|
||||||
*
|
*
|
||||||
* This also frees memory malloc'ed by dfu_get_buf(), so no explicit
|
* This also frees memory malloc'ed by dfu_get_buf(), so no explicit
|
||||||
* need fo call dfu_free_buf() is needed.
|
* need fo call dfu_free_buf() is needed.
|
||||||
*/
|
*/
|
||||||
ret = dfu_write(dfu_entity, transfer_buffer, 0, cnt);
|
|
||||||
if (ret)
|
|
||||||
error("DFU write failed [%d] cnt: %d", ret, cnt);
|
|
||||||
|
|
||||||
ret = dfu_flush(dfu_entity, transfer_buffer, 0, cnt);
|
ret = dfu_flush(dfu_entity, transfer_buffer, 0, cnt);
|
||||||
if (ret) {
|
if (ret)
|
||||||
error("DFU flush failed!");
|
error("DFU flush failed!");
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ struct fdt_usb {
|
||||||
unsigned enabled:1; /* 1 to enable, 0 to disable */
|
unsigned enabled:1; /* 1 to enable, 0 to disable */
|
||||||
unsigned has_legacy_mode:1; /* 1 if this port has legacy mode */
|
unsigned has_legacy_mode:1; /* 1 if this port has legacy mode */
|
||||||
unsigned initialized:1; /* has this port already been initialized? */
|
unsigned initialized:1; /* has this port already been initialized? */
|
||||||
|
enum usb_init_type init_type;
|
||||||
enum dr_mode dr_mode; /* dual role mode */
|
enum dr_mode dr_mode; /* dual role mode */
|
||||||
enum periph_id periph_id;/* peripheral id */
|
enum periph_id periph_id;/* peripheral id */
|
||||||
struct fdt_gpio_state vbus_gpio; /* GPIO for vbus enable */
|
struct fdt_gpio_state vbus_gpio; /* GPIO for vbus enable */
|
||||||
|
@ -237,29 +238,31 @@ int ehci_get_port_speed(struct ehci_hcor *hcor, uint32_t reg)
|
||||||
return PORTSC_PSPD(reg);
|
return PORTSC_PSPD(reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the port into host mode */
|
/* Set up VBUS for host/device mode */
|
||||||
static void set_host_mode(struct fdt_usb *config)
|
static void set_up_vbus(struct fdt_usb *config, enum usb_init_type init)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If we are an OTG port, check if remote host is driving VBus and
|
* If we are an OTG port initializing in host mode,
|
||||||
* bail out in this case.
|
* check if remote host is driving VBus and bail out in this case.
|
||||||
*/
|
*/
|
||||||
if (config->dr_mode == DR_MODE_OTG &&
|
if (init == USB_INIT_HOST &&
|
||||||
(readl(&config->reg->phy_vbus_sensors) & VBUS_VLD_STS))
|
config->dr_mode == DR_MODE_OTG &&
|
||||||
|
(readl(&config->reg->phy_vbus_sensors) & VBUS_VLD_STS)) {
|
||||||
|
printf("tegrausb: VBUS input active; not enabling as host\n");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If not driving, we set the GPIO to enable VBUS. We assume
|
|
||||||
* that the pinmux is set up correctly for this.
|
|
||||||
*/
|
|
||||||
if (fdt_gpio_isvalid(&config->vbus_gpio)) {
|
if (fdt_gpio_isvalid(&config->vbus_gpio)) {
|
||||||
|
int vbus_value;
|
||||||
|
|
||||||
fdtdec_setup_gpio(&config->vbus_gpio);
|
fdtdec_setup_gpio(&config->vbus_gpio);
|
||||||
gpio_direction_output(config->vbus_gpio.gpio,
|
|
||||||
(config->vbus_gpio.flags & FDT_GPIO_ACTIVE_LOW) ?
|
vbus_value = (init == USB_INIT_HOST) ^
|
||||||
0 : 1);
|
!!(config->vbus_gpio.flags & FDT_GPIO_ACTIVE_LOW);
|
||||||
debug("set_host_mode: GPIO %d %s\n", config->vbus_gpio.gpio,
|
gpio_direction_output(config->vbus_gpio.gpio, vbus_value);
|
||||||
(config->vbus_gpio.flags & FDT_GPIO_ACTIVE_LOW) ?
|
|
||||||
"low" : "high");
|
debug("set_up_vbus: GPIO %d %d\n", config->vbus_gpio.gpio,
|
||||||
|
vbus_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,10 +296,44 @@ static const unsigned *get_pll_timing(void)
|
||||||
return timing;
|
return timing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up the UTMI USB controller with the parameters provided */
|
/* select the PHY to use with a USB controller */
|
||||||
static int init_utmi_usb_controller(struct fdt_usb *config)
|
static void init_phy_mux(struct fdt_usb *config, uint pts,
|
||||||
|
enum usb_init_type init)
|
||||||
{
|
{
|
||||||
u32 val;
|
struct usb_ctlr *usbctlr = config->reg;
|
||||||
|
|
||||||
|
#if defined(CONFIG_TEGRA20)
|
||||||
|
if (config->periph_id == PERIPH_ID_USBD) {
|
||||||
|
clrsetbits_le32(&usbctlr->port_sc1, PTS1_MASK,
|
||||||
|
PTS_UTMI << PTS1_SHIFT);
|
||||||
|
clrbits_le32(&usbctlr->port_sc1, STS1);
|
||||||
|
} else {
|
||||||
|
clrsetbits_le32(&usbctlr->port_sc1, PTS_MASK,
|
||||||
|
PTS_UTMI << PTS_SHIFT);
|
||||||
|
clrbits_le32(&usbctlr->port_sc1, STS);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* Set to Host mode (if applicable) after Controller Reset was done */
|
||||||
|
clrsetbits_le32(&usbctlr->usb_mode, USBMODE_CM_HC,
|
||||||
|
(init == USB_INIT_HOST) ? USBMODE_CM_HC : 0);
|
||||||
|
/*
|
||||||
|
* Select PHY interface after setting host mode.
|
||||||
|
* For device mode, the ordering requirement is not an issue, since
|
||||||
|
* only the first USB controller supports device mode, and that USB
|
||||||
|
* controller can only talk to a UTMI PHY, so the PHY selection is
|
||||||
|
* already made at reset time, so this write is a no-op.
|
||||||
|
*/
|
||||||
|
clrsetbits_le32(&usbctlr->hostpc1_devlc, PTS_MASK,
|
||||||
|
pts << PTS_SHIFT);
|
||||||
|
clrbits_le32(&usbctlr->hostpc1_devlc, STS);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set up the UTMI USB controller with the parameters provided */
|
||||||
|
static int init_utmi_usb_controller(struct fdt_usb *config,
|
||||||
|
enum usb_init_type init)
|
||||||
|
{
|
||||||
|
u32 b_sess_valid_mask, val;
|
||||||
int loop_count;
|
int loop_count;
|
||||||
const unsigned *timing;
|
const unsigned *timing;
|
||||||
struct usb_ctlr *usbctlr = config->reg;
|
struct usb_ctlr *usbctlr = config->reg;
|
||||||
|
@ -314,6 +351,10 @@ static int init_utmi_usb_controller(struct fdt_usb *config)
|
||||||
/* Follow the crystal clock disable by >100ns delay */
|
/* Follow the crystal clock disable by >100ns delay */
|
||||||
udelay(1);
|
udelay(1);
|
||||||
|
|
||||||
|
b_sess_valid_mask = (VBUS_B_SESS_VLD_SW_VALUE | VBUS_B_SESS_VLD_SW_EN);
|
||||||
|
clrsetbits_le32(&usbctlr->phy_vbus_sensors, b_sess_valid_mask,
|
||||||
|
(init == USB_INIT_DEVICE) ? b_sess_valid_mask : 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To Use the A Session Valid for cable detection logic, VBUS_WAKEUP
|
* To Use the A Session Valid for cable detection logic, VBUS_WAKEUP
|
||||||
* mux must be switched to actually use a_sess_vld threshold.
|
* mux must be switched to actually use a_sess_vld threshold.
|
||||||
|
@ -485,21 +526,7 @@ static int init_utmi_usb_controller(struct fdt_usb *config)
|
||||||
clrbits_le32(&usbctlr->icusb_ctrl, IC_ENB1);
|
clrbits_le32(&usbctlr->icusb_ctrl, IC_ENB1);
|
||||||
|
|
||||||
/* Select UTMI parallel interface */
|
/* Select UTMI parallel interface */
|
||||||
#if defined(CONFIG_TEGRA20)
|
init_phy_mux(config, PTS_UTMI, init);
|
||||||
if (config->periph_id == PERIPH_ID_USBD) {
|
|
||||||
clrsetbits_le32(&usbctlr->port_sc1, PTS1_MASK,
|
|
||||||
PTS_UTMI << PTS1_SHIFT);
|
|
||||||
clrbits_le32(&usbctlr->port_sc1, STS1);
|
|
||||||
} else {
|
|
||||||
clrsetbits_le32(&usbctlr->port_sc1, PTS_MASK,
|
|
||||||
PTS_UTMI << PTS_SHIFT);
|
|
||||||
clrbits_le32(&usbctlr->port_sc1, STS);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
clrsetbits_le32(&usbctlr->hostpc1_devlc, PTS_MASK,
|
|
||||||
PTS_UTMI << PTS_SHIFT);
|
|
||||||
clrbits_le32(&usbctlr->hostpc1_devlc, STS);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Deassert power down state */
|
/* Deassert power down state */
|
||||||
clrbits_le32(&usbctlr->utmip_xcvr_cfg0, UTMIP_FORCE_PD_POWERDOWN |
|
clrbits_le32(&usbctlr->utmip_xcvr_cfg0, UTMIP_FORCE_PD_POWERDOWN |
|
||||||
|
@ -529,7 +556,8 @@ static int init_utmi_usb_controller(struct fdt_usb *config)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* set up the ULPI USB controller with the parameters provided */
|
/* set up the ULPI USB controller with the parameters provided */
|
||||||
static int init_ulpi_usb_controller(struct fdt_usb *config)
|
static int init_ulpi_usb_controller(struct fdt_usb *config,
|
||||||
|
enum usb_init_type init)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
int loop_count;
|
int loop_count;
|
||||||
|
@ -557,13 +585,7 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
|
||||||
ULPI_CLKOUT_PINMUX_BYP | ULPI_OUTPUT_PINMUX_BYP);
|
ULPI_CLKOUT_PINMUX_BYP | ULPI_OUTPUT_PINMUX_BYP);
|
||||||
|
|
||||||
/* Select ULPI parallel interface */
|
/* Select ULPI parallel interface */
|
||||||
#if defined(CONFIG_TEGRA20)
|
init_phy_mux(config, PTS_ULPI, init);
|
||||||
clrsetbits_le32(&usbctlr->port_sc1, PTS_MASK,
|
|
||||||
PTS_ULPI << PTS_SHIFT);
|
|
||||||
#else
|
|
||||||
clrsetbits_le32(&usbctlr->hostpc1_devlc, PTS_MASK,
|
|
||||||
PTS_ULPI << PTS_SHIFT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* enable ULPI transceiver */
|
/* enable ULPI transceiver */
|
||||||
setbits_le32(&usbctlr->susp_ctrl, ULPI_PHY_ENB);
|
setbits_le32(&usbctlr->susp_ctrl, ULPI_PHY_ENB);
|
||||||
|
@ -612,7 +634,8 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static int init_ulpi_usb_controller(struct fdt_usb *config)
|
static int init_ulpi_usb_controller(struct fdt_usb *config,
|
||||||
|
enum usb_init_type init)
|
||||||
{
|
{
|
||||||
printf("No code to set up ULPI controller, please enable"
|
printf("No code to set up ULPI controller, please enable"
|
||||||
"CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT");
|
"CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT");
|
||||||
|
@ -765,42 +788,66 @@ int ehci_hcd_init(int index, enum usb_init_type init,
|
||||||
|
|
||||||
config = &port[index];
|
config = &port[index];
|
||||||
|
|
||||||
|
switch (init) {
|
||||||
|
case USB_INIT_HOST:
|
||||||
|
switch (config->dr_mode) {
|
||||||
|
case DR_MODE_HOST:
|
||||||
|
case DR_MODE_OTG:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("tegrausb: Invalid dr_mode %d for host mode\n",
|
||||||
|
config->dr_mode);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case USB_INIT_DEVICE:
|
||||||
|
if (config->periph_id != PERIPH_ID_USBD) {
|
||||||
|
printf("tegrausb: Device mode only supported on first USB controller\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!config->utmi) {
|
||||||
|
printf("tegrausb: Device mode only supported with UTMI PHY\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
switch (config->dr_mode) {
|
||||||
|
case DR_MODE_DEVICE:
|
||||||
|
case DR_MODE_OTG:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("tegrausb: Invalid dr_mode %d for device mode\n",
|
||||||
|
config->dr_mode);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("tegrausb: Unknown USB_INIT_* %d\n", init);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* skip init, if the port is already initialized */
|
/* skip init, if the port is already initialized */
|
||||||
if (config->initialized)
|
if (config->initialized && config->init_type == init)
|
||||||
goto success;
|
goto success;
|
||||||
|
|
||||||
if (config->utmi && init_utmi_usb_controller(config)) {
|
if (config->utmi && init_utmi_usb_controller(config, init)) {
|
||||||
printf("tegrausb: Cannot init port %d\n", index);
|
printf("tegrausb: Cannot init port %d\n", index);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->ulpi && init_ulpi_usb_controller(config)) {
|
if (config->ulpi && init_ulpi_usb_controller(config, init)) {
|
||||||
printf("tegrausb: Cannot init port %d\n", index);
|
printf("tegrausb: Cannot init port %d\n", index);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_host_mode(config);
|
set_up_vbus(config, init);
|
||||||
|
|
||||||
config->initialized = 1;
|
config->initialized = 1;
|
||||||
|
config->init_type = init;
|
||||||
|
|
||||||
success:
|
success:
|
||||||
usbctlr = config->reg;
|
usbctlr = config->reg;
|
||||||
*hccr = (struct ehci_hccr *)&usbctlr->cap_length;
|
*hccr = (struct ehci_hccr *)&usbctlr->cap_length;
|
||||||
*hcor = (struct ehci_hcor *)&usbctlr->usb_cmd;
|
*hcor = (struct ehci_hcor *)&usbctlr->usb_cmd;
|
||||||
|
|
||||||
if (controller->has_hostpc) {
|
|
||||||
/* Set to Host mode after Controller Reset was done */
|
|
||||||
clrsetbits_le32(&usbctlr->usb_mode, USBMODE_CM_HC,
|
|
||||||
USBMODE_CM_HC);
|
|
||||||
/* Select UTMI parallel interface after setting host mode */
|
|
||||||
if (config->utmi) {
|
|
||||||
clrsetbits_le32((char *)&usbctlr->usb_cmd +
|
|
||||||
HOSTPC1_DEVLC, PTS_MASK,
|
|
||||||
PTS_UTMI << PTS_SHIFT);
|
|
||||||
clrbits_le32((char *)&usbctlr->usb_cmd +
|
|
||||||
HOSTPC1_DEVLC, STS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,9 @@ struct mmc_internal_data {
|
||||||
unsigned int lba_size;
|
unsigned int lba_size;
|
||||||
unsigned int lba_blk_size;
|
unsigned int lba_blk_size;
|
||||||
|
|
||||||
|
/* eMMC HW partition access */
|
||||||
|
int hw_partition;
|
||||||
|
|
||||||
/* FAT/EXT */
|
/* FAT/EXT */
|
||||||
unsigned int dev;
|
unsigned int dev;
|
||||||
unsigned int part;
|
unsigned int part;
|
||||||
|
|
Loading…
Add table
Reference in a new issue