From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/6] usb: musb-new: sunxi: Allocate struct phy in private
Date: Fri, 20 Jul 2018 12:43:57 +0530 [thread overview]
Message-ID: <20180720071401.12952-3-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20180720071401.12952-1-jagan@amarulasolutions.com>
Allocate struct phy in private structure instead of allocating
locally and assign it to a pointer. This eventually fix miss
alignment phy which is used in another functions.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- none
drivers/usb/musb-new/sunxi.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index b846afb094..aa2880eeb9 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -87,7 +87,7 @@ struct sunxi_glue {
struct sunxi_ccm_reg *ccm;
struct sunxi_musb_config *cfg;
struct device dev;
- struct phy *phy;
+ struct phy phy;
};
#define to_sunxi_glue(d) container_of(d, struct sunxi_glue, dev)
@@ -235,19 +235,19 @@ static int sunxi_musb_enable(struct musb *musb)
musb_writeb(musb->mregs, USBC_REG_o_VEND0, 0);
if (is_host_enabled(musb)) {
- ret = sun4i_usb_phy_vbus_detect(glue->phy);
+ ret = sun4i_usb_phy_vbus_detect(&glue->phy);
if (ret == 1) {
printf("A charger is plugged into the OTG: ");
return -ENODEV;
}
- ret = sun4i_usb_phy_id_detect(glue->phy);
+ ret = sun4i_usb_phy_id_detect(&glue->phy);
if (ret == 1) {
printf("No host cable detected: ");
return -ENODEV;
}
- ret = generic_phy_power_on(glue->phy);
+ ret = generic_phy_power_on(&glue->phy);
if (ret) {
pr_err("failed to power on USB PHY\n");
return ret;
@@ -271,7 +271,7 @@ static void sunxi_musb_disable(struct musb *musb)
return;
if (is_host_enabled(musb)) {
- ret = generic_phy_power_off(glue->phy);
+ ret = generic_phy_power_off(&glue->phy);
if (ret) {
pr_err("failed to power off USB PHY\n");
return;
@@ -291,7 +291,7 @@ static int sunxi_musb_init(struct musb *musb)
pr_debug("%s():\n", __func__);
- ret = generic_phy_init(glue->phy);
+ ret = generic_phy_init(&glue->phy);
if (ret) {
pr_err("failed to init USB PHY\n");
return ret;
@@ -330,14 +330,14 @@ static void sunxi_musb_pre_root_reset_end(struct musb *musb)
{
struct sunxi_glue *glue = to_sunxi_glue(musb->controller);
- sun4i_usb_phy_set_squelch_detect(glue->phy, false);
+ sun4i_usb_phy_set_squelch_detect(&glue->phy, false);
}
static void sunxi_musb_post_root_reset_end(struct musb *musb)
{
struct sunxi_glue *glue = to_sunxi_glue(musb->controller);
- sun4i_usb_phy_set_squelch_detect(glue->phy, true);
+ sun4i_usb_phy_set_squelch_detect(&glue->phy, true);
}
static const struct musb_platform_ops sunxi_musb_ops = {
@@ -405,7 +405,6 @@ static int musb_usb_probe(struct udevice *dev)
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
struct musb_hdrc_platform_data pdata;
void *base = dev_read_addr_ptr(dev);
- struct phy phy;
int ret;
if (!base)
@@ -419,13 +418,12 @@ static int musb_usb_probe(struct udevice *dev)
if (IS_ERR(glue->ccm))
return PTR_ERR(glue->ccm);
- ret = generic_phy_get_by_name(dev, "usb", &phy);
+ ret = generic_phy_get_by_name(dev, "usb", &glue->phy);
if (ret) {
pr_err("failed to get usb PHY\n");
return ret;
}
- glue->phy = &phy;
priv->desc_before_addr = true;
memset(&pdata, 0, sizeof(pdata));
@@ -460,8 +458,8 @@ static int musb_usb_remove(struct udevice *dev)
struct musb_host_data *host = &glue->mdata;
int ret;
- if (generic_phy_valid(glue->phy)) {
- ret = generic_phy_exit(glue->phy);
+ if (generic_phy_valid(&glue->phy)) {
+ ret = generic_phy_exit(&glue->phy);
if (ret) {
pr_err("failed to exit %s USB PHY\n", dev->name);
return ret;
--
2.17.1
next prev parent reply other threads:[~2018-07-20 7:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 7:13 [U-Boot] [PATCH v2 0/6] musb-new: Improve shutdown code Jagan Teki
2018-07-20 7:13 ` [U-Boot] [PATCH v2 1/6] usb: musb-new: Fix improper musb host pointer Jagan Teki
2018-07-20 7:13 ` Jagan Teki [this message]
2018-07-20 7:13 ` [U-Boot] [RFC PATCH v2 3/6] dm: usb: Add UCLASS_USB_DEV_GENERIC shutdown Jagan Teki
2018-07-23 23:48 ` Simon Glass
2018-08-07 7:03 ` Jagan Teki
2018-08-17 12:48 ` Simon Glass
2018-08-17 13:37 ` Jagan Teki
2018-08-21 17:31 ` Simon Glass
2018-07-20 7:13 ` [U-Boot] [PATCH v2 4/6] musb-new: sunxi: Access ahb_reset0_cfg via ccm offset Jagan Teki
2018-07-20 7:14 ` [U-Boot] [PATCH v2 5/6] usb: musb-new: sunxi: Add proper musb exit support Jagan Teki
2018-07-20 7:14 ` [U-Boot] [PATCH v2 6/6] usb: musb-new: Call musb_platform_exit from musb_stop Jagan Teki
2018-07-20 9:42 ` [U-Boot] [PATCH v2 0/6] musb-new: Improve shutdown code Marek Vasut
2018-08-13 11:03 ` Chen-Yu Tsai
2018-08-20 17:04 ` Jagan Teki
2018-08-21 13:04 ` Jagan Teki
2018-08-22 2:41 ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2018-08-23 12:05 ` Jagan Teki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180720071401.12952-3-jagan@amarulasolutions.com \
--to=jagan@amarulasolutions.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.