mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 18:04:48 +00:00
- Switch meson dwc3/usb PHY to set_mode callback for switching USB mode
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPVPGJshWBf4d9CyLd9zb2sjISdEFAmaCbQMACgkQd9zb2sjI SdFSuRAAvOs5zGTZ9PQoO2oSwDYCjNBAYvmpquktaqm6zk0p4wF3ujHF8sYpqBM6 2Anwdmfxeaim8+5b3KJ0BYrRkrnnJPOz/nHeRfs36K7qliUsHfcyi1aaoShZGs4f Z5gpUfS1KCoD6wGQuwLcxqhW7qwFEG2HV4IMEUshrSkGhTDSaiC19xdesAC16wzt /j9tuuDBM07F0vXRU0FrGazwyCR7lSr3y713jXXV0TKO/JzRZmzbuTAOz1lJD5+d ThSBtVqWllG7FpadYGZAvwJIIuVwmMP5nheUe1ZMRAGOo0RuLwY0CrA7q/APHhPK t7yMYgBJE90Sh/nMmQJ1mm72H83S7fqYae5CkEwOiYdM3Mc0hsX89tgTiln9aKOJ L3QPMpMBowSsfAS8unRfg2f064Qu2rPIFZVG/S0QOmSLoy0fF+zlQMunFGlvdMXg aSPnEFeZmiZ/ArePeBELrKpyp0EnrPzLYDcgklHESpoSNXEwHrR6PARBPAe0REeY sM/KbSIMJd51EpjiRbzxjHvgnTLmplkAxVoDE3L31lxIVDiZMtAct2ykwxeZF1Aq iOZZY9/kYpnfQ9X1XHmGEWBterkzvpgrsu81Rg/3ai3Q4Ehrbn0/vx9SFaky+ZjU 6rj9cMhErSLXxoGY2tnFAKfBR2xz668LaxQOafc6B4zGyjao+1U= =XB5L -----END PGP SIGNATURE----- Merge tag 'u-boot-amlogic-20240701' of https://source.denx.de/u-boot/custodians/u-boot-amlogic into next - Switch meson dwc3/usb PHY to set_mode callback for switching USB mode
This commit is contained in:
commit
b4cbd1a257
9 changed files with 35 additions and 56 deletions
|
@ -1,17 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/*
|
||||
* Copyright 2019 BayLibre SAS
|
||||
* Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
*/
|
||||
#ifndef _ARCH_MESON_USB_GX_H_
|
||||
#define _ARCH_MESON_USB_GX_H_
|
||||
|
||||
#include <generic-phy.h>
|
||||
#include <linux/usb/otg.h>
|
||||
|
||||
/* TOFIX add set_mode to struct phy_ops */
|
||||
void phy_meson_gxl_usb2_set_mode(struct phy *phy, enum usb_dr_mode mode);
|
||||
|
||||
int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode);
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/*
|
||||
* Copyright (C) 2019 BayLibre, SAS
|
||||
* Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
*/
|
||||
|
||||
#ifndef __MESON_USB_H__
|
||||
#define __MESON_USB_H__
|
||||
|
||||
int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode);
|
||||
|
||||
#endif /* __MESON_USB_H__ */
|
|
@ -19,8 +19,6 @@
|
|||
#include <linux/printk.h>
|
||||
#include <linux/usb/otg.h>
|
||||
|
||||
#include <asm/arch/usb-gx.h>
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/compat.h>
|
||||
|
||||
|
@ -121,33 +119,40 @@ static void phy_meson_gxl_usb2_reset(struct phy_meson_gxl_usb2_priv *priv)
|
|||
udelay(RESET_COMPLETE_TIME);
|
||||
}
|
||||
|
||||
void phy_meson_gxl_usb2_set_mode(struct phy *phy, enum usb_dr_mode mode)
|
||||
static int phy_meson_gxl_usb2_set_mode(struct phy *phy, enum phy_mode mode, int submode)
|
||||
{
|
||||
struct udevice *dev = phy->dev;
|
||||
struct phy_meson_gxl_usb2_priv *priv = dev_get_priv(dev);
|
||||
uint val;
|
||||
|
||||
if (submode)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
regmap_read(priv->regmap, U2P_R0, &val);
|
||||
|
||||
switch (mode) {
|
||||
case USB_DR_MODE_UNKNOWN:
|
||||
case USB_DR_MODE_HOST:
|
||||
case USB_DR_MODE_OTG:
|
||||
case PHY_MODE_USB_DEVICE:
|
||||
val &= ~U2P_R0_DM_PULLDOWN;
|
||||
val &= ~U2P_R0_DP_PULLDOWN;
|
||||
val |= U2P_R0_ID_PULLUP;
|
||||
break;
|
||||
|
||||
case PHY_MODE_USB_HOST:
|
||||
case PHY_MODE_USB_OTG:
|
||||
val |= U2P_R0_DM_PULLDOWN;
|
||||
val |= U2P_R0_DP_PULLDOWN;
|
||||
val &= ~U2P_R0_ID_PULLUP;
|
||||
break;
|
||||
|
||||
case USB_DR_MODE_PERIPHERAL:
|
||||
val &= ~U2P_R0_DM_PULLDOWN;
|
||||
val &= ~U2P_R0_DP_PULLDOWN;
|
||||
val |= U2P_R0_ID_PULLUP;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
regmap_write(priv->regmap, U2P_R0, val);
|
||||
|
||||
phy_meson_gxl_usb2_reset(priv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int phy_meson_gxl_usb2_power_on(struct phy *phy)
|
||||
|
@ -161,7 +166,7 @@ static int phy_meson_gxl_usb2_power_on(struct phy *phy)
|
|||
val &= ~U2P_R0_POWER_ON_RESET;
|
||||
regmap_write(priv->regmap, U2P_R0, val);
|
||||
|
||||
phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_HOST);
|
||||
phy_meson_gxl_usb2_set_mode(phy, PHY_MODE_USB_HOST, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -183,6 +188,7 @@ static int phy_meson_gxl_usb2_power_off(struct phy *phy)
|
|||
struct phy_ops meson_gxl_usb2_phy_ops = {
|
||||
.power_on = phy_meson_gxl_usb2_power_on,
|
||||
.power_off = phy_meson_gxl_usb2_power_off,
|
||||
.set_mode = phy_meson_gxl_usb2_set_mode,
|
||||
};
|
||||
|
||||
int meson_gxl_usb2_phy_probe(struct udevice *dev)
|
||||
|
|
|
@ -179,7 +179,7 @@ static const struct dm_gpio_ops meson_axg_gpio_ops = {
|
|||
.direction_output = meson_gpio_direction_output,
|
||||
};
|
||||
|
||||
const struct driver meson_axg_gpio_driver = {
|
||||
U_BOOT_DRIVER(meson_axg_gpio) = {
|
||||
.name = "meson-axg-gpio",
|
||||
.id = UCLASS_GPIO,
|
||||
.probe = meson_gpio_probe,
|
||||
|
|
|
@ -939,7 +939,7 @@ struct meson_pinctrl_data meson_axg_periphs_pinctrl_data = {
|
|||
.num_groups = ARRAY_SIZE(meson_axg_periphs_groups),
|
||||
.num_funcs = ARRAY_SIZE(meson_axg_periphs_functions),
|
||||
.num_banks = ARRAY_SIZE(meson_axg_periphs_banks),
|
||||
.gpio_driver = &meson_axg_gpio_driver,
|
||||
.gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
|
||||
.pmx_data = &meson_axg_periphs_pmx_banks_data,
|
||||
};
|
||||
|
||||
|
@ -953,7 +953,7 @@ struct meson_pinctrl_data meson_axg_aobus_pinctrl_data = {
|
|||
.num_groups = ARRAY_SIZE(meson_axg_aobus_groups),
|
||||
.num_funcs = ARRAY_SIZE(meson_axg_aobus_functions),
|
||||
.num_banks = ARRAY_SIZE(meson_axg_aobus_banks),
|
||||
.gpio_driver = &meson_axg_gpio_driver,
|
||||
.gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
|
||||
.pmx_data = &meson_axg_aobus_pmx_banks_data,
|
||||
};
|
||||
|
||||
|
|
|
@ -61,6 +61,6 @@ struct meson_pmx_axg_data {
|
|||
}
|
||||
|
||||
extern const struct pinctrl_ops meson_axg_pinctrl_ops;
|
||||
extern const struct driver meson_axg_gpio_driver;
|
||||
extern U_BOOT_DRIVER(meson_axg_gpio);
|
||||
|
||||
#endif /* __PINCTRL_MESON_AXG_H__ */
|
||||
|
|
|
@ -1253,7 +1253,7 @@ static struct meson_pinctrl_data meson_g12a_periphs_pinctrl_data = {
|
|||
.num_groups = ARRAY_SIZE(meson_g12a_periphs_groups),
|
||||
.num_funcs = ARRAY_SIZE(meson_g12a_periphs_functions),
|
||||
.num_banks = ARRAY_SIZE(meson_g12a_periphs_banks),
|
||||
.gpio_driver = &meson_axg_gpio_driver,
|
||||
.gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
|
||||
.pmx_data = &meson_g12a_periphs_pmx_banks_data,
|
||||
};
|
||||
|
||||
|
@ -1267,7 +1267,7 @@ static struct meson_pinctrl_data meson_g12a_aobus_pinctrl_data = {
|
|||
.num_groups = ARRAY_SIZE(meson_g12a_aobus_groups),
|
||||
.num_funcs = ARRAY_SIZE(meson_g12a_aobus_functions),
|
||||
.num_banks = ARRAY_SIZE(meson_g12a_aobus_banks),
|
||||
.gpio_driver = &meson_axg_gpio_driver,
|
||||
.gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
|
||||
.pmx_data = &meson_g12a_aobus_pmx_banks_data,
|
||||
};
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ static int dwc3_meson_g12a_usb_init(struct dwc3_meson_g12a *priv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
|
||||
static int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
|
||||
{
|
||||
struct dwc3_meson_g12a *priv = dev_get_plat(dev);
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <linux/bitfield.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/compat.h>
|
||||
#include <asm/arch/usb-gx.h>
|
||||
|
||||
/* USB Glue Control Registers */
|
||||
|
||||
|
@ -158,9 +157,9 @@ static int dwc3_meson_gxl_usb2_init(struct dwc3_meson_gxl *priv)
|
|||
if (!priv->phys[i].dev)
|
||||
continue;
|
||||
|
||||
phy_meson_gxl_usb2_set_mode(&priv->phys[i],
|
||||
(i == USB2_OTG_PHY) ? USB_DR_MODE_PERIPHERAL
|
||||
: USB_DR_MODE_HOST);
|
||||
generic_phy_set_mode(&priv->phys[i],
|
||||
(i == USB2_OTG_PHY) ? PHY_MODE_USB_DEVICE
|
||||
: PHY_MODE_USB_HOST, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -193,7 +192,7 @@ static int dwc3_meson_gxl_usb_init(struct dwc3_meson_gxl *priv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
|
||||
static int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
|
||||
{
|
||||
struct dwc3_meson_gxl *priv = dev_get_plat(dev);
|
||||
|
||||
|
@ -224,7 +223,9 @@ int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
|
|||
#endif
|
||||
priv->otg_phy_mode = mode;
|
||||
|
||||
phy_meson_gxl_usb2_set_mode(&priv->phys[USB2_OTG_PHY], mode);
|
||||
generic_phy_set_mode(&priv->phys[USB2_OTG_PHY],
|
||||
mode == USB_DR_MODE_PERIPHERAL ? PHY_MODE_USB_DEVICE
|
||||
: PHY_MODE_USB_HOST, 0);
|
||||
|
||||
dwc3_meson_gxl_usb2_set_mode(priv, mode);
|
||||
|
||||
|
@ -361,8 +362,9 @@ static int dwc3_meson_gxl_probe(struct udevice *dev)
|
|||
}
|
||||
|
||||
if (priv->phys[USB2_OTG_PHY].dev)
|
||||
phy_meson_gxl_usb2_set_mode(&priv->phys[USB2_OTG_PHY],
|
||||
priv->otg_phy_mode);
|
||||
generic_phy_set_mode(&priv->phys[USB2_OTG_PHY],
|
||||
priv->otg_phy_mode == USB_DR_MODE_PERIPHERAL ? PHY_MODE_USB_DEVICE
|
||||
: PHY_MODE_USB_HOST, 0);
|
||||
|
||||
dwc3_meson_gxl_usb2_set_mode(priv, priv->otg_phy_mode);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue