All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] pinctrl: tegra-xusb: Clean-up and fixes
@ 2015-05-27 13:11 Jon Hunter
       [not found] ` <1432732314-372-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2015-05-27 13:11 UTC (permalink / raw)
  To: Linus Walleij, Stephen Warren, Thierry Reding, Alexandre Courbot
  Cc: linux-tegra, linux-gpio, Jon Hunter

Some clean-up and fixes for tegra-xusb driver.

This had been boot tested on tegra20-trimslice, tegra30-beaver,
tegra114-dalmore-a04 and tegra124-jetson-tk1 and no issues seen.
Complete test information can be found below.

http://nvt.pwsan.com/pub/jonathanh-tester/testlogs/test_20150527055028_b031599c28a38c92b745822d702e9b073d49dbaa/20150527055028

Changes since v1:
- Dropped 3rd patch as it was unnecessary
- Simplified implementation of get_group_pins function based upon
  Thierry's feedback.

Jon Hunter (2):
  pinctrl: tegra-xusb: Remove unused structure
  pinctrl: tegra-xusb: Fix allocation of pins

 drivers/pinctrl/pinctrl-tegra-xusb.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

-- 
1.9.1


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

* [PATCH V2 1/2] pinctrl: tegra-xusb: Remove unused structure
       [not found] ` <1432732314-372-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2015-05-27 13:11   ` Jon Hunter
       [not found]     ` <1432732314-372-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2015-05-27 13:11   ` [PATCH V2 2/2] pinctrl: tegra-xusb: Fix allocation of pins Jon Hunter
  1 sibling, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2015-05-27 13:11 UTC (permalink / raw)
  To: Linus Walleij, Stephen Warren, Thierry Reding, Alexandre Courbot
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Jon Hunter

The structure tegra_xusb_padctl_group is defined but never used and so
remove this.

Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/pinctrl/pinctrl-tegra-xusb.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
index 753d747d4261..3e8e4a914fb4 100644
--- a/drivers/pinctrl/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
@@ -59,11 +59,6 @@ struct tegra_xusb_padctl_function {
 	unsigned int num_groups;
 };
 
-struct tegra_xusb_padctl_group {
-	const unsigned int *funcs;
-	unsigned int num_funcs;
-};
-
 struct tegra_xusb_padctl_soc {
 	const struct pinctrl_pin_desc *pins;
 	unsigned int num_pins;
-- 
1.9.1

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

* [PATCH V2 2/2] pinctrl: tegra-xusb: Fix allocation of pins
       [not found] ` <1432732314-372-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2015-05-27 13:11   ` [PATCH V2 1/2] pinctrl: tegra-xusb: Remove unused structure Jon Hunter
@ 2015-05-27 13:11   ` Jon Hunter
       [not found]     ` <1432732314-372-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2015-05-27 13:11 UTC (permalink / raw)
  To: Linus Walleij, Stephen Warren, Thierry Reding, Alexandre Courbot
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Jon Hunter

Commit e5b3b2d9ed20 ("pinctrl: allows not to define the get_group_pins
operation") allows pin controllers not to register the get_group_pins()
function. However, a side-effect of not registering this function is
that pins are not allocated and potentially multiple devices could
attempt to configure the same pins [1]. Although this problem exists in
the pinctrl core, because only a few devices are impacted by this, fix
this for tegra-xusb by adding the get_group_pins() function.

Please note that in addition to adding the get_group_pins() functions
the pins/lanes for the tegra-xusb also need to be registered when
calling pinctrl_register(). This also allows the current pinmux state
to be viewed by the debugfs node "pinmux-pins" for the tegra-xusb pad
controller.

[1] http://www.spinics.net/lists/linux-gpio/msg05810.html

Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/pinctrl/pinctrl-tegra-xusb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
index 3e8e4a914fb4..6a6eebfb2930 100644
--- a/drivers/pinctrl/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
@@ -125,6 +125,21 @@ static const char *tegra_xusb_padctl_get_group_name(struct pinctrl_dev *pinctrl,
 	return padctl->soc->pins[group].name;
 }
 
+static int tegra_xusb_padctl_get_group_pins(struct pinctrl_dev *pinctrl,
+					    unsigned group,
+					    const unsigned **pins,
+					    unsigned *num_pins)
+{
+	/*
+	 * For the tegra-xusb pad controller groups are synonomous
+	 * with lanes/pins and there is always one lane/pin per group.
+	 */
+	*pins = &pinctrl->desc->pins[group].number;
+	*num_pins = 1;
+
+	return 0;
+}
+
 enum tegra_xusb_padctl_param {
 	TEGRA_XUSB_PADCTL_IDDQ,
 };
@@ -248,6 +263,7 @@ static int tegra_xusb_padctl_dt_node_to_map(struct pinctrl_dev *pinctrl,
 static const struct pinctrl_ops tegra_xusb_padctl_pinctrl_ops = {
 	.get_groups_count = tegra_xusb_padctl_get_groups_count,
 	.get_group_name = tegra_xusb_padctl_get_group_name,
+	.get_group_pins = tegra_xusb_padctl_get_group_pins,
 	.dt_node_to_map = tegra_xusb_padctl_dt_node_to_map,
 	.dt_free_map = pinctrl_utils_dt_free_map,
 };
@@ -898,6 +914,8 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
 
 	memset(&padctl->desc, 0, sizeof(padctl->desc));
 	padctl->desc.name = dev_name(padctl->dev);
+	padctl->desc.pins = tegra124_pins;
+	padctl->desc.npins = ARRAY_SIZE(tegra124_pins);
 	padctl->desc.pctlops = &tegra_xusb_padctl_pinctrl_ops;
 	padctl->desc.pmxops = &tegra_xusb_padctl_pinmux_ops;
 	padctl->desc.confops = &tegra_xusb_padctl_pinconf_ops;
-- 
1.9.1

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

* Re: [PATCH V2 1/2] pinctrl: tegra-xusb: Remove unused structure
       [not found]     ` <1432732314-372-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2015-06-01 11:56       ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2015-06-01 11:56 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Stephen Warren, Thierry Reding, Alexandre Courbot,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA

On Wed, May 27, 2015 at 3:11 PM, Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:

> The structure tegra_xusb_padctl_group is defined but never used and so
> remove this.
>
> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH V2 2/2] pinctrl: tegra-xusb: Fix allocation of pins
       [not found]     ` <1432732314-372-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2015-06-01 11:57       ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2015-06-01 11:57 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Stephen Warren, Thierry Reding, Alexandre Courbot,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA

On Wed, May 27, 2015 at 3:11 PM, Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:

> Commit e5b3b2d9ed20 ("pinctrl: allows not to define the get_group_pins
> operation") allows pin controllers not to register the get_group_pins()
> function. However, a side-effect of not registering this function is
> that pins are not allocated and potentially multiple devices could
> attempt to configure the same pins [1]. Although this problem exists in
> the pinctrl core, because only a few devices are impacted by this, fix
> this for tegra-xusb by adding the get_group_pins() function.
>
> Please note that in addition to adding the get_group_pins() functions
> the pins/lanes for the tegra-xusb also need to be registered when
> calling pinctrl_register(). This also allows the current pinmux state
> to be viewed by the debugfs node "pinmux-pins" for the tegra-xusb pad
> controller.
>
> [1] http://www.spinics.net/lists/linux-gpio/msg05810.html
>
> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Patch applied.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-06-01 11:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-27 13:11 [PATCH V2 0/2] pinctrl: tegra-xusb: Clean-up and fixes Jon Hunter
     [not found] ` <1432732314-372-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-27 13:11   ` [PATCH V2 1/2] pinctrl: tegra-xusb: Remove unused structure Jon Hunter
     [not found]     ` <1432732314-372-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-06-01 11:56       ` Linus Walleij
2015-05-27 13:11   ` [PATCH V2 2/2] pinctrl: tegra-xusb: Fix allocation of pins Jon Hunter
     [not found]     ` <1432732314-372-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-06-01 11:57       ` Linus Walleij

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.