Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1483049

[PATCH 03/51] phy: sun4i: add support for A64 usb phy

From Kishon Vijay Abraham I <kishon@ti.com>
Newsgroups linux.kernel
Subject [PATCH 03/51] phy: sun4i: add support for A64 usb phy
Date 2016-09-14 10:00 +0200
Message-ID <shdgR-6sF-7@gated-at.bofh.it> (permalink)
References <shd7b-6oH-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Icenowy Zheng <icenowy@aosc.xyz>

There's something unknown in the pmu part that shared with H3.
It's renamed as PMU_UNK1 from PMU_UNK_H3.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-sun4i-usb.c |   35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index 8c7eb33..fcf4d95 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -50,7 +50,7 @@
 #define REG_PHYCTL_A33			0x10
 #define REG_PHY_UNK_H3			0x20
 
-#define REG_PMU_UNK_H3			0x10
+#define REG_PMU_UNK1			0x10
 
 #define PHYCTL_DATA			BIT(7)
 
@@ -98,6 +98,7 @@ enum sun4i_usb_phy_type {
 	sun6i_a31_phy,
 	sun8i_a33_phy,
 	sun8i_h3_phy,
+	sun50i_a64_phy,
 };
 
 struct sun4i_usb_phy_cfg {
@@ -106,6 +107,7 @@ struct sun4i_usb_phy_cfg {
 	u32 disc_thresh;
 	u8 phyctl_offset;
 	bool dedicated_clocks;
+	bool enable_pmu_unk1;
 };
 
 struct sun4i_usb_phy_data {
@@ -183,8 +185,9 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data,
 
 	mutex_lock(&phy_data->mutex);
 
-	if (phy_data->cfg->type == sun8i_a33_phy) {
-		/* A33 needs us to set phyctl to 0 explicitly */
+	if (phy_data->cfg->type == sun8i_a33_phy ||
+	    phy_data->cfg->type == sun50i_a64_phy) {
+		/* A33 or A64 needs us to set phyctl to 0 explicitly */
 		writel(0, phyctl);
 	}
 
@@ -258,14 +261,16 @@ static int sun4i_usb_phy_init(struct phy *_phy)
 		return ret;
 	}
 
+	if (data->cfg->enable_pmu_unk1) {
+		val = readl(phy->pmu + REG_PMU_UNK1);
+		writel(val & ~2, phy->pmu + REG_PMU_UNK1);
+	}
+
 	if (data->cfg->type == sun8i_h3_phy) {
 		if (phy->index == 0) {
 			val = readl(data->base + REG_PHY_UNK_H3);
 			writel(val & ~1, data->base + REG_PHY_UNK_H3);
 		}
-
-		val = readl(phy->pmu + REG_PMU_UNK_H3);
-		writel(val & ~2, phy->pmu + REG_PMU_UNK_H3);
 	} else {
 		/* Enable USB 45 Ohm resistor calibration */
 		if (phy->index == 0)
@@ -737,6 +742,7 @@ static const struct sun4i_usb_phy_cfg sun4i_a10_cfg = {
 	.disc_thresh = 3,
 	.phyctl_offset = REG_PHYCTL_A10,
 	.dedicated_clocks = false,
+	.enable_pmu_unk1 = false,
 };
 
 static const struct sun4i_usb_phy_cfg sun5i_a13_cfg = {
@@ -745,6 +751,7 @@ static const struct sun4i_usb_phy_cfg sun5i_a13_cfg = {
 	.disc_thresh = 2,
 	.phyctl_offset = REG_PHYCTL_A10,
 	.dedicated_clocks = false,
+	.enable_pmu_unk1 = false,
 };
 
 static const struct sun4i_usb_phy_cfg sun6i_a31_cfg = {
@@ -753,6 +760,7 @@ static const struct sun4i_usb_phy_cfg sun6i_a31_cfg = {
 	.disc_thresh = 3,
 	.phyctl_offset = REG_PHYCTL_A10,
 	.dedicated_clocks = true,
+	.enable_pmu_unk1 = false,
 };
 
 static const struct sun4i_usb_phy_cfg sun7i_a20_cfg = {
@@ -761,6 +769,7 @@ static const struct sun4i_usb_phy_cfg sun7i_a20_cfg = {
 	.disc_thresh = 2,
 	.phyctl_offset = REG_PHYCTL_A10,
 	.dedicated_clocks = false,
+	.enable_pmu_unk1 = false,
 };
 
 static const struct sun4i_usb_phy_cfg sun8i_a23_cfg = {
@@ -769,6 +778,7 @@ static const struct sun4i_usb_phy_cfg sun8i_a23_cfg = {
 	.disc_thresh = 3,
 	.phyctl_offset = REG_PHYCTL_A10,
 	.dedicated_clocks = true,
+	.enable_pmu_unk1 = false,
 };
 
 static const struct sun4i_usb_phy_cfg sun8i_a33_cfg = {
@@ -777,6 +787,7 @@ static const struct sun4i_usb_phy_cfg sun8i_a33_cfg = {
 	.disc_thresh = 3,
 	.phyctl_offset = REG_PHYCTL_A33,
 	.dedicated_clocks = true,
+	.enable_pmu_unk1 = false,
 };
 
 static const struct sun4i_usb_phy_cfg sun8i_h3_cfg = {
@@ -784,6 +795,16 @@ static const struct sun4i_usb_phy_cfg sun8i_h3_cfg = {
 	.type = sun8i_h3_phy,
 	.disc_thresh = 3,
 	.dedicated_clocks = true,
+	.enable_pmu_unk1 = true,
+};
+
+static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = {
+	.num_phys = 2,
+	.type = sun50i_a64_phy,
+	.disc_thresh = 3,
+	.phyctl_offset = REG_PHYCTL_A33,
+	.dedicated_clocks = true,
+	.enable_pmu_unk1 = true,
 };
 
 static const struct of_device_id sun4i_usb_phy_of_match[] = {
@@ -794,6 +815,8 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = {
 	{ .compatible = "allwinner,sun8i-a23-usb-phy", .data = &sun8i_a23_cfg },
 	{ .compatible = "allwinner,sun8i-a33-usb-phy", .data = &sun8i_a33_cfg },
 	{ .compatible = "allwinner,sun8i-h3-usb-phy", .data = &sun8i_h3_cfg },
+	{ .compatible = "allwinner,sun50i-a64-usb-phy",
+	  .data = &sun50i_a64_cfg},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);
-- 
1.7.9.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL] phy: for 4.9 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 38/51] phy: Add USB Type-C PHY driver for rk3399 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 34/51] extcon: Add new EXTCON_DISP_HMD for Head-mounted Display device Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 48/51] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 14/51] phy: rcar-gen3-usb2: revise the example of device tree doc Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 36/51] extcon: Introduce EXTCON_PROP_USB_SS property for SuperSpeed mode Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 46/51] phy-sun4i-usb: Warn when external vbus is detected Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 43/51] phy-sun4i-usb: Refactor forced session ending Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 10/51] phy: tegra: add missing header dependencies Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 37/51] phy: da8xx-usb: Fix syscon device name Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 05/51] phy: qcom-ufs: use of_property_read_bool Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 32/51] extcon: Add the synchronization extcon APIs to support the notification Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 33/51] extcon: Add EXTCON_DISP_DP and the property for USB Type-C Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 42/51] phy-sun4i-usb: Use bool where appropriate Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 51/51] phy-twl4030-usb: initialize charging-related stuff via pm_runtime Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 39/51] Documentation: bindings: add dt doc for Rockchip USB Type-C PHY Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
  [PATCH 29/51] extcon: Add the support for extcon property according to extcon type Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 08/51] Documentation: bindings: add dt documentation for Rockchip PCIe PHY Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 03/51] phy: sun4i: add support for A64 usb phy Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 31/51] extcon: Rename the extcon_set/get_state() to maintain the function naming pattern Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 23/51] extcon: adc-jack: Remove the usage of extcon_set_state() Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 30/51] extcon: Add the support for the capability of each property Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 01/51] phy: exynos5-usbdrd: Remove "static" from local variable Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 07/51] phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 27/51] extcon: Fix compile time warning Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 18/51] phy: rockchip-inno-usb2: add COMMON_CLK dependency Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 11/51] phy: tegra: mark tegra_xusb_lane_lookup_function() static Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 16/51] phy: omap-usb2: support suspend/resume Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 26/51] extcon: Block the bit masking operation for cable state except for extcon core Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 09/51] phy: add a driver for the Rockchip SoC internal PCIe PHY Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 24/51] extcon: gpio: Remove the usage of extcon_set_state() Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 19/51] extcon: adc-jack: update cable state during boot Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 13/51] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 22/51] extcon: arizona: Remove the usage of extcon_update_state() Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 21/51] extcon: arizona: Remove unneeded semi-colon Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  [PATCH 04/51] phy: bcm-ns-usb3: new driver for USB 3.0 PHY on Northstar Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
  Re: [GIT PULL] phy: for 4.9 Greg KH <gregkh@linuxfoundation.org> - 2016-09-15 10:50 +0200
    Re: [GIT PULL] phy: for 4.9 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-15 12:30 +0200
      Re: [GIT PULL] phy: for 4.9 Greg KH <gregkh@linuxfoundation.org> - 2016-09-15 12:40 +0200
        Re: [GIT PULL] phy: for 4.9 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-15 13:00 +0200
          Re: [GIT PULL] phy: for 4.9 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-15 13:20 +0200

csiph-web