ENDIAN issue fix and one query controller role API is introduced.

-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEDaZUZmFxRG/wNThrSFkpgVDWcbsFAl8g2ksACgkQSFkpgVDW
 cbtAMwf/dkrCfmE2HpvAsZqL68WOC1yTaN9f3v7bzXc2oD2WRsk3aKGZGLeXvMtN
 aruD3ctxOVEom5FHrff8x3G1CBw8wsbl+yjT6aTlbcFY/Yzmww7RABUO5Xp1F9aB
 aTuDcLeoY22UHkzNdeNrixEuOR9xeyhZjFybW0cZ6FddP0mj4SUNNczxfaGvmLLI
 DOJ7oc8KC9pIwhoF9065GH0p5PrXVnZvcBUXWs5PASjj4lWb3DiMGxhZRPBLbB6l
 YifzRa+C90BP4AjTptS03fD/3knciZCM8Z1GsVYdKLuO4NOPlcZeEJEeUGmkCr0L
 QmOpk5Sh8nACisOCqn3gQDo7jAI6Mg==
 =JnWY
 -----END PGP SIGNATURE-----

Merge tag 'usb-ci-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next

Peter writes:

ENDIAN issue fix and one query controller role API is introduced.

* tag 'usb-ci-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb:
  usb: chipidea: imx: get available runtime dr mode for wakeup setting
  usb: chipidea: add query_available_role interface
  Documentation: ABI: usb: chipidea: Update Li Jun's e-mail
  usb: chipidea: udc: fix the ENDIAN issue
This commit is contained in:
Greg Kroah-Hartman 2020-07-29 13:57:09 +02:00
commit 107c894975
6 changed files with 39 additions and 4 deletions

View File

@ -462,6 +462,10 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
if (!IS_ERR(pdata.vbus_extcon.edev) ||
of_property_read_bool(np, "usb-role-switch"))
data->usbmisc_data->ext_vbus = 1;
/* usbmisc needs to know dr mode to choose wakeup setting */
data->usbmisc_data->available_role =
ci_hdrc_query_available_role(data->ci_pdev);
}
ret = imx_usbmisc_init_post(data->usbmisc_data);

View File

@ -25,6 +25,7 @@ struct imx_usbmisc_data {
unsigned int ext_id:1; /* ID from exteranl event */
unsigned int ext_vbus:1; /* Vbus from exteranl event */
struct usb_phy *usb_phy;
enum usb_dr_mode available_role; /* runtime usb dr mode */
};
int imx_usbmisc_init(struct imx_usbmisc_data *data);

View File

@ -878,6 +878,33 @@ void ci_hdrc_remove_device(struct platform_device *pdev)
}
EXPORT_SYMBOL_GPL(ci_hdrc_remove_device);
/**
* ci_hdrc_query_available_role: get runtime available operation mode
*
* The glue layer can get current operation mode (host/peripheral/otg)
* This function should be called after ci core device has created.
*
* @pdev: the platform device of ci core.
*
* Return runtime usb_dr_mode.
*/
enum usb_dr_mode ci_hdrc_query_available_role(struct platform_device *pdev)
{
struct ci_hdrc *ci = platform_get_drvdata(pdev);
if (!ci)
return USB_DR_MODE_UNKNOWN;
if (ci->roles[CI_ROLE_HOST] && ci->roles[CI_ROLE_GADGET])
return USB_DR_MODE_OTG;
else if (ci->roles[CI_ROLE_HOST])
return USB_DR_MODE_HOST;
else if (ci->roles[CI_ROLE_GADGET])
return USB_DR_MODE_PERIPHERAL;
else
return USB_DR_MODE_UNKNOWN;
}
EXPORT_SYMBOL_GPL(ci_hdrc_query_available_role);
static inline void ci_role_destroy(struct ci_hdrc *ci)
{
ci_hdrc_gadget_destroy(ci);

View File

@ -487,9 +487,10 @@ static void ci_add_buffer_entry(struct td_node *node, struct scatterlist *s)
int empty_td_slot_index = (CI_MAX_BUF_SIZE - node->td_remaining_size)
/ CI_HDRC_PAGE_SIZE;
int i;
u32 token;
node->ptr->token +=
cpu_to_le32(sg_dma_len(s) << __ffs(TD_TOTAL_BYTES));
token = le32_to_cpu(node->ptr->token) + (sg_dma_len(s) << __ffs(TD_TOTAL_BYTES));
node->ptr->token = cpu_to_le32(token);
for (i = empty_td_slot_index; i < TD_PAGE_COUNT; i++) {
u32 page = (u32) sg_dma_address(s) +

View File

@ -367,10 +367,10 @@ static u32 usbmisc_wakeup_setting(struct imx_usbmisc_data *data)
{
u32 wakeup_setting = MX6_USB_OTG_WAKEUP_BITS;
if (data->ext_id)
if (data->ext_id || data->available_role != USB_DR_MODE_OTG)
wakeup_setting &= ~MX6_BM_ID_WAKEUP;
if (data->ext_vbus)
if (data->ext_vbus || data->available_role == USB_DR_MODE_HOST)
wakeup_setting &= ~MX6_BM_VBUS_WAKEUP;
return wakeup_setting;

View File

@ -99,5 +99,7 @@ struct platform_device *ci_hdrc_add_device(struct device *dev,
struct ci_hdrc_platform_data *platdata);
/* Remove ci hdrc device */
void ci_hdrc_remove_device(struct platform_device *pdev);
/* Get current available role */
enum usb_dr_mode ci_hdrc_query_available_role(struct platform_device *pdev);
#endif