mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 07:31:15 +00:00
ARM: AM57xx: AM43xx: Fix USB host
CONFIG_USB_XHCI_OMAP can be set for host mode without setting
CONFIG_USB_DWC3 which is meant for gadget mode only.
board_usb_init() was not being defined for CONFIG_USB_XHCI_OMAP
resulting in a data abort on usb start.
Define board_usb_init() for CONFIG_USB_XHCI_OMAP case. Move
gadget specific handling to within CONFIG_USB_DWC3.
Fixes: 6f1af1e358
("board: ti: invoke clock API to enable and disable clocks")
Signed-off-by: Roger Quadros <rogerq@ti.com>
This commit is contained in:
parent
383f4a0ec7
commit
55efadde7e
2 changed files with 110 additions and 112 deletions
|
@ -678,60 +678,6 @@ static struct ti_usb_phy_device usb_phy2_device = {
|
|||
.index = 1,
|
||||
};
|
||||
|
||||
int board_usb_init(int index, enum usb_init_type init)
|
||||
{
|
||||
enable_usb_clocks(index);
|
||||
switch (index) {
|
||||
case 0:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
usb_otg_ss1.dr_mode = USB_DR_MODE_PERIPHERAL;
|
||||
usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
|
||||
} else {
|
||||
usb_otg_ss1.dr_mode = USB_DR_MODE_HOST;
|
||||
usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
|
||||
}
|
||||
|
||||
dwc3_omap_uboot_init(&usb_otg_ss1_glue);
|
||||
ti_usb_phy_uboot_init(&usb_phy1_device);
|
||||
dwc3_uboot_init(&usb_otg_ss1);
|
||||
break;
|
||||
case 1:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL;
|
||||
usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
|
||||
} else {
|
||||
usb_otg_ss2.dr_mode = USB_DR_MODE_HOST;
|
||||
usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
|
||||
}
|
||||
|
||||
ti_usb_phy_uboot_init(&usb_phy2_device);
|
||||
dwc3_omap_uboot_init(&usb_otg_ss2_glue);
|
||||
dwc3_uboot_init(&usb_otg_ss2);
|
||||
break;
|
||||
default:
|
||||
printf("Invalid Controller Index\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_usb_cleanup(int index, enum usb_init_type init)
|
||||
{
|
||||
switch (index) {
|
||||
case 0:
|
||||
case 1:
|
||||
ti_usb_phy_uboot_exit(index);
|
||||
dwc3_uboot_exit(index);
|
||||
dwc3_omap_uboot_exit(index);
|
||||
break;
|
||||
default:
|
||||
printf("Invalid Controller Index\n");
|
||||
}
|
||||
disable_usb_clocks(index);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usb_gadget_handle_interrupts(int index)
|
||||
{
|
||||
u32 status;
|
||||
|
@ -742,8 +688,62 @@ int usb_gadget_handle_interrupts(int index)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_USB_DWC3 */
|
||||
|
||||
#if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
|
||||
int board_usb_init(int index, enum usb_init_type init)
|
||||
{
|
||||
enable_usb_clocks(index);
|
||||
#ifdef CONFIG_USB_DWC3
|
||||
switch (index) {
|
||||
case 0:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
usb_otg_ss1.dr_mode = USB_DR_MODE_PERIPHERAL;
|
||||
usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
|
||||
dwc3_omap_uboot_init(&usb_otg_ss1_glue);
|
||||
ti_usb_phy_uboot_init(&usb_phy1_device);
|
||||
dwc3_uboot_init(&usb_otg_ss1);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL;
|
||||
usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
|
||||
ti_usb_phy_uboot_init(&usb_phy2_device);
|
||||
dwc3_omap_uboot_init(&usb_otg_ss2_glue);
|
||||
dwc3_uboot_init(&usb_otg_ss2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("Invalid Controller Index\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_usb_cleanup(int index, enum usb_init_type init)
|
||||
{
|
||||
#ifdef CONFIG_USB_DWC3
|
||||
switch (index) {
|
||||
case 0:
|
||||
case 1:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
ti_usb_phy_uboot_exit(index);
|
||||
dwc3_uboot_exit(index);
|
||||
dwc3_omap_uboot_exit(index);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("Invalid Controller Index\n");
|
||||
}
|
||||
#endif
|
||||
disable_usb_clocks(index);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) */
|
||||
|
||||
#ifdef CONFIG_DRIVER_TI_CPSW
|
||||
|
||||
static void cpsw_control(int enabled)
|
||||
|
|
|
@ -439,64 +439,6 @@ static struct ti_usb_phy_device usb_phy2_device = {
|
|||
.index = 1,
|
||||
};
|
||||
|
||||
int board_usb_init(int index, enum usb_init_type init)
|
||||
{
|
||||
enable_usb_clocks(index);
|
||||
switch (index) {
|
||||
case 0:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
printf("port %d can't be used as device\n", index);
|
||||
disable_usb_clocks(index);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
usb_otg_ss1.dr_mode = USB_DR_MODE_HOST;
|
||||
usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
|
||||
setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
|
||||
OTG_SS_CLKCTRL_MODULEMODE_HW |
|
||||
OPTFCLKEN_REFCLK960M);
|
||||
}
|
||||
|
||||
ti_usb_phy_uboot_init(&usb_phy1_device);
|
||||
dwc3_omap_uboot_init(&usb_otg_ss1_glue);
|
||||
dwc3_uboot_init(&usb_otg_ss1);
|
||||
break;
|
||||
case 1:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL;
|
||||
usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
|
||||
} else {
|
||||
printf("port %d can't be used as host\n", index);
|
||||
disable_usb_clocks(index);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ti_usb_phy_uboot_init(&usb_phy2_device);
|
||||
dwc3_omap_uboot_init(&usb_otg_ss2_glue);
|
||||
dwc3_uboot_init(&usb_otg_ss2);
|
||||
break;
|
||||
default:
|
||||
printf("Invalid Controller Index\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_usb_cleanup(int index, enum usb_init_type init)
|
||||
{
|
||||
switch (index) {
|
||||
case 0:
|
||||
case 1:
|
||||
ti_usb_phy_uboot_exit(index);
|
||||
dwc3_uboot_exit(index);
|
||||
dwc3_omap_uboot_exit(index);
|
||||
break;
|
||||
default:
|
||||
printf("Invalid Controller Index\n");
|
||||
}
|
||||
disable_usb_clocks(index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usb_gadget_handle_interrupts(int index)
|
||||
{
|
||||
u32 status;
|
||||
|
@ -507,7 +449,63 @@ int usb_gadget_handle_interrupts(int index)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_USB_DWC3 */
|
||||
|
||||
#if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
|
||||
int board_usb_init(int index, enum usb_init_type init)
|
||||
{
|
||||
enable_usb_clocks(index);
|
||||
switch (index) {
|
||||
case 0:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
printf("port %d can't be used as device\n", index);
|
||||
disable_usb_clocks(index);
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
#ifdef CONFIG_USB_DWC3
|
||||
usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL;
|
||||
usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
|
||||
ti_usb_phy_uboot_init(&usb_phy2_device);
|
||||
dwc3_omap_uboot_init(&usb_otg_ss2_glue);
|
||||
dwc3_uboot_init(&usb_otg_ss2);
|
||||
#endif
|
||||
} else {
|
||||
printf("port %d can't be used as host\n", index);
|
||||
disable_usb_clocks(index);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
printf("Invalid Controller Index\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_usb_cleanup(int index, enum usb_init_type init)
|
||||
{
|
||||
#ifdef CONFIG_USB_DWC3
|
||||
switch (index) {
|
||||
case 0:
|
||||
case 1:
|
||||
if (init == USB_INIT_DEVICE) {
|
||||
ti_usb_phy_uboot_exit(index);
|
||||
dwc3_uboot_exit(index);
|
||||
dwc3_omap_uboot_exit(index);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("Invalid Controller Index\n");
|
||||
}
|
||||
#endif
|
||||
disable_usb_clocks(index);
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) */
|
||||
|
||||
#ifdef CONFIG_DRIVER_TI_CPSW
|
||||
|
||||
|
|
Loading…
Reference in a new issue