public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions
@ 2013-06-26 11:58 Mikko Perttunen
       [not found] ` <1372247927-28470-1-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mikko Perttunen @ 2013-06-26 11:58 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Mikko Perttunen

Signed-off-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 arch/arm/boot/dts/tegra20.dtsi | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 9653fd8..e457083 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -477,13 +477,13 @@
 			 <&tegra_car TEGRA20_CLK_USBD>;
 		clock-names = "reg", "pll_u", "timer", "utmi-pads";
 		nvidia,has-legacy-mode;
-		hssync_start_delay = <9>;
-		idle_wait_delay = <17>;
-		elastic_limit = <16>;
-		term_range_adj = <6>;
-		xcvr_setup = <9>;
-		xcvr_lsfslew = <1>;
-		xcvr_lsrslew = <1>;
+		nvidia,hssync-start-delay = <9>;
+		nvidia,idle-wait-delay = <17>;
+		nvidia,elastic-limit = <16>;
+		nvidia,term-range-adj = <6>;
+		nvidia,xcvr-setup = <9>;
+		nvidia,xcvr-lsfslew = <1>;
+		nvidia,xcvr-lsrslew = <1>;
 		status = "disabled";
 	};
 
@@ -527,13 +527,13 @@
 			 <&tegra_car TEGRA20_CLK_CLK_M>,
 			 <&tegra_car TEGRA20_CLK_USBD>;
 		clock-names = "reg", "pll_u", "timer", "utmi-pads";
-		hssync_start_delay = <9>;
-		idle_wait_delay = <17>;
-		elastic_limit = <16>;
-		term_range_adj = <6>;
-		xcvr_setup = <9>;
-		xcvr_lsfslew = <2>;
-		xcvr_lsrslew = <2>;
+		nvidia,hssync-start-delay = <9>;
+		nvidia,idle-wait-delay = <17>;
+		nvidia,elastic-limit = <16>;
+		nvidia,term-range-adj = <6>;
+		nvidia,xcvr-setup = <9>;
+		nvidia,xcvr-lsfslew = <2>;
+		nvidia,xcvr-lsrslew = <2>;
 		status = "disabled";
 	};
 
-- 
1.8.1.5

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

* [PATCH 2/2] usb: phy: tegra: Read UTMIP parameters from device tree
       [not found] ` <1372247927-28470-1-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2013-06-26 11:58   ` Mikko Perttunen
  2013-06-26 12:14   ` [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions Felipe Balbi
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Mikko Perttunen @ 2013-06-26 11:58 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Mikko Perttunen

UTMIP parameters used to be hardcoded into tables in the
PHY driver. This patch moves them into the device tree
in accordance with the phy-tegra-usb DT documentation.

Signed-off-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/usb/phy/phy-tegra-usb.c | 129 +++++++++++++++++++++++++++-------------
 1 file changed, 87 insertions(+), 42 deletions(-)

diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index b3b4809..0352886c 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -185,27 +185,6 @@ static const struct tegra_xtal_freq tegra_freq_table[] = {
 	},
 };
 
-static struct tegra_utmip_config utmip_default[] = {
-	[0] = {
-		.hssync_start_delay = 9,
-		.idle_wait_delay = 17,
-		.elastic_limit = 16,
-		.term_range_adj = 6,
-		.xcvr_setup = 9,
-		.xcvr_lsfslew = 1,
-		.xcvr_lsrslew = 1,
-	},
-	[2] = {
-		.hssync_start_delay = 9,
-		.idle_wait_delay = 17,
-		.elastic_limit = 16,
-		.term_range_adj = 6,
-		.xcvr_setup = 9,
-		.xcvr_lsfslew = 2,
-		.xcvr_lsrslew = 2,
-	},
-};
-
 static void set_pts(struct tegra_usb_phy *phy, u8 pts_val)
 {
 	void __iomem *base = phy->regs;
@@ -727,13 +706,6 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
 	int i;
 	int err;
 
-	if (!phy->is_ulpi_phy) {
-		if (phy->is_legacy_phy)
-			phy->config = &utmip_default[0];
-		else
-			phy->config = &utmip_default[2];
-	}
-
 	phy->pll_u = devm_clk_get(phy->dev, "pll_u");
 	if (IS_ERR(phy->pll_u)) {
 		pr_err("Can't get pll_u clock\n");
@@ -808,6 +780,88 @@ void tegra_ehci_phy_restore_end(struct usb_phy *x)
 }
 EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end);
 
+static int read_utmi_param(struct platform_device *pdev, const char *param,
+			   u8 *dest)
+{
+	u32 value;
+	int err = of_property_read_u32(pdev->dev.of_node, param, &value);
+	*dest = (u8)value;
+	if (err < 0)
+		dev_err(&pdev->dev, "Failed to read USB UTMI parameter %s: %d\n",
+			param, err);
+	return err;
+}
+
+static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
+			  struct platform_device *pdev)
+{
+	struct resource *res;
+	int err;
+	struct tegra_utmip_config *config;
+
+	tegra_phy->is_ulpi_phy = false;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (!res) {
+		dev_err(&pdev->dev, "Failed to get UTMI Pad regs\n");
+		return  -ENXIO;
+	}
+
+	tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
+		resource_size(res));
+	if (!tegra_phy->regs) {
+		dev_err(&pdev->dev, "Failed to remap UTMI Pad regs\n");
+		return -ENOMEM;
+	}
+
+	tegra_phy->config = devm_kzalloc(&pdev->dev,
+		sizeof(*tegra_phy->config), GFP_KERNEL);
+	if (!tegra_phy->config) {
+		dev_err(&pdev->dev,
+			"unable to allocate memory for USB UTMIP config\n");
+		return -ENOMEM;
+	}
+
+	config = tegra_phy->config;
+
+	err = read_utmi_param(pdev, "nvidia,hssync-start-delay",
+		&config->hssync_start_delay);
+	if (err < 0)
+		return err;
+
+	err = read_utmi_param(pdev, "nvidia,elastic-limit",
+		&config->elastic_limit);
+	if (err < 0)
+		return err;
+
+	err = read_utmi_param(pdev, "nvidia,idle-wait-delay",
+		&config->idle_wait_delay);
+	if (err < 0)
+		return err;
+
+	err = read_utmi_param(pdev, "nvidia,term-range-adj",
+		&config->term_range_adj);
+	if (err < 0)
+		return err;
+
+	err = read_utmi_param(pdev, "nvidia,xcvr-setup",
+		&config->xcvr_setup);
+	if (err < 0)
+		return err;
+
+	err = read_utmi_param(pdev, "nvidia,xcvr-lsfslew",
+		&config->xcvr_lsfslew);
+	if (err < 0)
+		return err;
+
+	err = read_utmi_param(pdev, "nvidia,xcvr-lsrslew",
+		&config->xcvr_lsrslew);
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
 static int tegra_usb_phy_probe(struct platform_device *pdev)
 {
 	struct resource *res;
@@ -839,20 +893,9 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
 
 	err = of_property_match_string(np, "phy_type", "ulpi");
 	if (err < 0) {
-		tegra_phy->is_ulpi_phy = false;
-
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		if (!res) {
-			dev_err(&pdev->dev, "Failed to get UTMI Pad regs\n");
-			return  -ENXIO;
-		}
-
-		tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
-			resource_size(res));
-		if (!tegra_phy->regs) {
-			dev_err(&pdev->dev, "Failed to remap UTMI Pad regs\n");
-			return -ENOMEM;
-		}
+		err = utmi_phy_probe(tegra_phy, pdev);
+		if (err < 0)
+			return err;
 	} else {
 		tegra_phy->is_ulpi_phy = true;
 
@@ -863,6 +906,8 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
 				tegra_phy->reset_gpio);
 			return tegra_phy->reset_gpio;
 		}
+
+		tegra_phy->config = NULL;
 	}
 
 	err = of_property_match_string(np, "dr_mode", "otg");
-- 
1.8.1.5

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

* Re: [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions
       [not found] ` <1372247927-28470-1-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2013-06-26 11:58   ` [PATCH 2/2] usb: phy: tegra: Read UTMIP parameters from device tree Mikko Perttunen
@ 2013-06-26 12:14   ` Felipe Balbi
       [not found]     ` <20130626121442.GB12640-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
  2013-06-26 17:44   ` Stephen Warren
  2013-07-01 20:57   ` Stephen Warren
  3 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2013-06-26 12:14 UTC (permalink / raw)
  To: Mikko Perttunen
  Cc: balbi-l0cyMroinI0, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 216 bytes --]

On Wed, Jun 26, 2013 at 02:58:46PM +0300, Mikko Perttunen wrote:
> Signed-off-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

you need a commit log, sorry. Even if obvious

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions
       [not found]     ` <20130626121442.GB12640-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
@ 2013-06-26 12:17       ` Mikko Perttunen
  0 siblings, 0 replies; 7+ messages in thread
From: Mikko Perttunen @ 2013-06-26 12:17 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Wed, 26 Jun 2013 15:14:42 +0300, Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> wrote:

> * PGP Signed by an unknown key
>
> On Wed, Jun 26, 2013 at 02:58:46PM +0300, Mikko Perttunen wrote:
>> Signed-off-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> you need a commit log, sorry. Even if obvious
>

Ok, I'll send V2

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

* Re: [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions
       [not found] ` <1372247927-28470-1-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2013-06-26 11:58   ` [PATCH 2/2] usb: phy: tegra: Read UTMIP parameters from device tree Mikko Perttunen
  2013-06-26 12:14   ` [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions Felipe Balbi
@ 2013-06-26 17:44   ` Stephen Warren
       [not found]     ` <51CB289A.2070506-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
  2013-07-01 20:57   ` Stephen Warren
  3 siblings, 1 reply; 7+ messages in thread
From: Stephen Warren @ 2013-06-26 17:44 UTC (permalink / raw)
  To: Mikko Perttunen
  Cc: balbi-l0cyMroinI0, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Venu Byravarasu

On 06/26/2013 05:58 AM, Mikko Perttunen wrote:
> Signed-off-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Damn. I thought that Venu had converted the *.dts files completely to
match the new binding definition in the last series he sent. I guess he
missed these because the driver doesn't use them yet and he wasn't
paying attention. Grrr.

So, this change is fine (modulo missing description as Felipe pointed
out), but will again mean that the USB tree needs to take some Tegra
*.dts changes:-( I don't expect this will cause any conflicts, so it
probably won't require any cross-subsystem merge, but it'd be best to
apply all these Tegra changes in a separate topic branch just in case...

Felipe, let me know if you want me to actually do the patch application
for that topic branch to save you the hassle.

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

* Re: [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions
       [not found]     ` <51CB289A.2070506-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
@ 2013-06-27  6:50       ` Felipe Balbi
  0 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2013-06-27  6:50 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Mikko Perttunen, balbi-l0cyMroinI0,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Venu Byravarasu

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

On Wed, Jun 26, 2013 at 11:44:58AM -0600, Stephen Warren wrote:
> On 06/26/2013 05:58 AM, Mikko Perttunen wrote:
> > Signed-off-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> Damn. I thought that Venu had converted the *.dts files completely to
> match the new binding definition in the last series he sent. I guess he
> missed these because the driver doesn't use them yet and he wasn't
> paying attention. Grrr.
> 
> So, this change is fine (modulo missing description as Felipe pointed
> out), but will again mean that the USB tree needs to take some Tegra
> *.dts changes:-( I don't expect this will cause any conflicts, so it
> probably won't require any cross-subsystem merge, but it'd be best to
> apply all these Tegra changes in a separate topic branch just in case...
> 
> Felipe, let me know if you want me to actually do the patch application
> for that topic branch to save you the hassle.

if it works for you, then I just merge your branch, cheers.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions
       [not found] ` <1372247927-28470-1-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2013-06-26 17:44   ` Stephen Warren
@ 2013-07-01 20:57   ` Stephen Warren
  3 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2013-07-01 20:57 UTC (permalink / raw)
  To: Mikko Perttunen
  Cc: balbi-l0cyMroinI0, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On 06/26/2013 05:58 AM, Mikko Perttunen wrote:
> Signed-off-by: Mikko Perttunen <mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

The series,
Tested-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

I'll at least apply the *.dtsi changes once the merge window is over,
and prepare a branch so they can be pulled into the USB tree as a basis
for the code changes.

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

end of thread, other threads:[~2013-07-01 20:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-26 11:58 [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions Mikko Perttunen
     [not found] ` <1372247927-28470-1-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-06-26 11:58   ` [PATCH 2/2] usb: phy: tegra: Read UTMIP parameters from device tree Mikko Perttunen
2013-06-26 12:14   ` [PATCH 1/2] ARM: dts: tegra20: Rename USB UTMI parameters according to new definitions Felipe Balbi
     [not found]     ` <20130626121442.GB12640-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-06-26 12:17       ` Mikko Perttunen
2013-06-26 17:44   ` Stephen Warren
     [not found]     ` <51CB289A.2070506-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-06-27  6:50       ` Felipe Balbi
2013-07-01 20:57   ` Stephen Warren

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