public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
* [PATCH 0/3] phy-sun4i-usb: 3 misc. fixes
@ 2015-07-31  8:01 Hans de Goede
  2015-07-31  8:01 ` [PATCH 1/3] phy-sun4i-usb: Add missing EXPORT_SYMBOL for sun4i_usb_phy_set_squelch_detect Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hans de Goede @ 2015-07-31  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kishon,

Here are 3 small patches for the phy-sun4i-usb code.

The first patch is a small bugfix for building the sun4i musb code as
module which seems to have fallen through the cracks.

The second patch is a preparation patch for the third patch which
fixes the case of boards with a working VBus regulator, but broken
VBus detection support, yes unfortunately such boards exist.

Can you please merge these 3 into linux-phy/next ?

Thanks & Regards,

Hans

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] phy-sun4i-usb: Add missing EXPORT_SYMBOL for sun4i_usb_phy_set_squelch_detect
  2015-07-31  8:01 [PATCH 0/3] phy-sun4i-usb: 3 misc. fixes Hans de Goede
@ 2015-07-31  8:01 ` Hans de Goede
  2015-08-01 10:24   ` Kishon Vijay Abraham I
  2015-07-31  8:01 ` [PATCH 2/3] phy-sun4i-sub: Move vbus-detect helper functions up in the file Hans de Goede
  2015-07-31  8:01 ` [PATCH 3/3] phy-sun4i-usb: Only check vbus-det on power-on on boards with vbus-det Hans de Goede
  2 siblings, 1 reply; 5+ messages in thread
From: Hans de Goede @ 2015-07-31  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

sun4i_usb_phy_set_squelch_detect is used by other code, which may be built
as a module, so it should be exported.

Signed-off-by: Hans de Goede <hdegoede@redhat•com>
---
Changes in v6:
-New patch in v6 of the sunxi musb support series
---
 drivers/phy/phy-sun4i-usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index 5138843..d514a9b 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -347,6 +347,7 @@ void sun4i_usb_phy_set_squelch_detect(struct phy *_phy, bool enabled)
 
 	sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2);
 }
+EXPORT_SYMBOL(sun4i_usb_phy_set_squelch_detect);
 
 static struct phy_ops sun4i_usb_phy_ops = {
 	.init		= sun4i_usb_phy_init,
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] phy-sun4i-sub: Move vbus-detect helper functions up in the file
  2015-07-31  8:01 [PATCH 0/3] phy-sun4i-usb: 3 misc. fixes Hans de Goede
  2015-07-31  8:01 ` [PATCH 1/3] phy-sun4i-usb: Add missing EXPORT_SYMBOL for sun4i_usb_phy_set_squelch_detect Hans de Goede
@ 2015-07-31  8:01 ` Hans de Goede
  2015-07-31  8:01 ` [PATCH 3/3] phy-sun4i-usb: Only check vbus-det on power-on on boards with vbus-det Hans de Goede
  2 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2015-07-31  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

Move vbus-detect helper functions up in the file, just moving some code
around, no functional changes what so ever.

Signed-off-by: Hans de Goede <hdegoede@redhat•com>
---
 drivers/phy/phy-sun4i-usb.c | 48 ++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index d514a9b..ddb9fd2 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -294,6 +294,30 @@ static int sun4i_usb_phy_exit(struct phy *_phy)
 	return 0;
 }
 
+static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
+{
+	if (data->vbus_det_gpio)
+		return gpiod_get_value_cansleep(data->vbus_det_gpio);
+
+	if (data->vbus_power_supply) {
+		union power_supply_propval val;
+		int r;
+
+		r = power_supply_get_property(data->vbus_power_supply,
+					      POWER_SUPPLY_PROP_PRESENT, &val);
+		if (r == 0)
+			return val.intval;
+	}
+
+	/* Fallback: report vbus as high */
+	return 1;
+}
+
+static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
+{
+	return data->vbus_det_gpio || data->vbus_power_supply;
+}
+
 static int sun4i_usb_phy_power_on(struct phy *_phy)
 {
 	struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
@@ -357,30 +381,6 @@ static struct phy_ops sun4i_usb_phy_ops = {
 	.owner		= THIS_MODULE,
 };
 
-static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
-{
-	if (data->vbus_det_gpio)
-		return gpiod_get_value_cansleep(data->vbus_det_gpio);
-
-	if (data->vbus_power_supply) {
-		union power_supply_propval val;
-		int r;
-
-		r = power_supply_get_property(data->vbus_power_supply,
-					      POWER_SUPPLY_PROP_PRESENT, &val);
-		if (r == 0)
-			return val.intval;
-	}
-
-	/* Fallback: report vbus as high */
-	return 1;
-}
-
-static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
-{
-	return data->vbus_det_gpio || data->vbus_power_supply;
-}
-
 static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 {
 	struct sun4i_usb_phy_data *data =
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] phy-sun4i-usb: Only check vbus-det on power-on on boards with vbus-det
  2015-07-31  8:01 [PATCH 0/3] phy-sun4i-usb: 3 misc. fixes Hans de Goede
  2015-07-31  8:01 ` [PATCH 1/3] phy-sun4i-usb: Add missing EXPORT_SYMBOL for sun4i_usb_phy_set_squelch_detect Hans de Goede
  2015-07-31  8:01 ` [PATCH 2/3] phy-sun4i-sub: Move vbus-detect helper functions up in the file Hans de Goede
@ 2015-07-31  8:01 ` Hans de Goede
  2 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2015-07-31  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

data->vbus_det is always 1 on boards without a (working) vbus-det, skip
the vbus_det test on such boards.

This fixes the sun4i usb phy code never turning on Vbus on such boards.

Signed-off-by: Hans de Goede <hdegoede@redhat•com>
---
 drivers/phy/phy-sun4i-usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index ddb9fd2..12c5e4eb 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -328,7 +328,8 @@ static int sun4i_usb_phy_power_on(struct phy *_phy)
 		return 0;
 
 	/* For phy0 only turn on Vbus if we don't have an ext. Vbus */
-	if (phy->index == 0 && data->vbus_det)
+	if (phy->index == 0 && sun4i_usb_phy0_have_vbus_det(data) &&
+				data->vbus_det)
 		return 0;
 
 	ret = regulator_enable(phy->vbus);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/3] phy-sun4i-usb: Add missing EXPORT_SYMBOL for sun4i_usb_phy_set_squelch_detect
  2015-07-31  8:01 ` [PATCH 1/3] phy-sun4i-usb: Add missing EXPORT_SYMBOL for sun4i_usb_phy_set_squelch_detect Hans de Goede
@ 2015-08-01 10:24   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2015-08-01 10:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Friday 31 July 2015 01:31 PM, Hans de Goede wrote:
> sun4i_usb_phy_set_squelch_detect is used by other code, which may be built
> as a module, so it should be exported.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat•com>
> ---
> Changes in v6:
> -New patch in v6 of the sunxi musb support series
> ---
>  drivers/phy/phy-sun4i-usb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
> index 5138843..d514a9b 100644
> --- a/drivers/phy/phy-sun4i-usb.c
> +++ b/drivers/phy/phy-sun4i-usb.c
> @@ -347,6 +347,7 @@ void sun4i_usb_phy_set_squelch_detect(struct phy *_phy, bool enabled)
>  
>  	sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2);
>  }
> +EXPORT_SYMBOL(sun4i_usb_phy_set_squelch_detect);

changed it to EXPORT_SYMBOL_GPL and merged it.

Thanks
Kishon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-01 10:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-31  8:01 [PATCH 0/3] phy-sun4i-usb: 3 misc. fixes Hans de Goede
2015-07-31  8:01 ` [PATCH 1/3] phy-sun4i-usb: Add missing EXPORT_SYMBOL for sun4i_usb_phy_set_squelch_detect Hans de Goede
2015-08-01 10:24   ` Kishon Vijay Abraham I
2015-07-31  8:01 ` [PATCH 2/3] phy-sun4i-sub: Move vbus-detect helper functions up in the file Hans de Goede
2015-07-31  8:01 ` [PATCH 3/3] phy-sun4i-usb: Only check vbus-det on power-on on boards with vbus-det Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox