tegra: implement pinmux_avoid_func()
Subsystems (2)
PATCH 1/1 tegra: implement pinmux_avoid_func()
From: Stephen Warren <[email protected]>
This selects the "safe" (non-conflicting) mux function for a pin group if the current setting matches the specified function.
Many signals can be routed to or from multiple different groups. Each signal must be routed to or from only a single group at a given time. Hence, if we program a particular group for a function, we must ensure no other group is programmed to that same function first. This API makes this easy.
---
This patch will need updating due to the recently added Tegra30 support. However, I'm posting it for Lucas, since his NAND patches can probably benefit from this.
arch/arm/cpu/tegra20-common/pinmux.c | 23 +++++++++++++++++++++++ arch/arm/include/asm/arch-tegra20/pinmux.h | 6 ++++++ 2 files changed, 29 insertions(+)
arch/arm/cpu/tegra20-common/pinmux.c +23 -0
@@ -554,6 +554,29 @@ void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func)writel (reg, muxctl); } +static enum pmux_func pinmux_get_func (enum pmux_pingrp pin) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +enum pmux_ctlid mux_id = tegra_soc_pingroups[pin].ctl_id; +u32 *muxctl = &pmt->pmt_ctl[MUXCTL_REG (mux_id)]; +u32 reg; + + reg =readl (muxctl); + reg >>=MUXCTL_SHIFT (mux_id); + reg &=3 ; + +return tegra_soc_pingroups[pin].funcs[reg]; +} + +void pinmux_avoid_func (enum pmux_pingrp pin,enum pmux_func avoid) +{ +if (pinmux_get_func (pin) != avoid) +return ; + +pinmux_set_func (pin, tegra_soc_pingroups[pin].func_safe); +} +void pinmux_config_pingroup (const struct pingroup_config *config) {enum pmux_pingrp pin = config->pingroup;
arch/arm/include/asm/arch-tegra20/pinmux.h +6 -0
@@ -337,6 +337,12 @@ void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd);/* Set the mux function for a pin group */ void pinmux_set_func (enum pmux_pingrp pin,enum pmux_func func); +/* +* Select the "safe" (non-conflicting) mux function for a pin group if the +* current setting matches the specified function. +*/ +void pinmux_avoid_func (enum pmux_pingrp pin,enum pmux_func func); +/* Set the complete configuration for a pin group */ void pinmux_config_pingroup (const struct pingroup_config *config);
Signature · 1 line
1.7.10.4
PATCH 1/1 tegra: implement pinmux_avoid_func()
Hi Stephen,
Quoted 10 lines · Stephen Warren
From: Stephen Warren <[email protected]>
This selects the "safe" (non-conflicting) mux function for a pin group if the current setting matches the specified function.
Many signals can be routed to or from multiple different groups. Each signal must be routed to or from only a single group at a given time. Hence, if we program a particular group for a function, we must ensure no other group is programmed to that same function first. This API makes this easy.
What is the intended use of this function? (sorry, yes, I am confused :-)
Quoted 28 lines
Signed-off-by Stephen Warren <[email protected]>---
This patch will need updating due to the recently added Tegra30 support. However, I'm posting it for Lucas, since his NAND patches can probably benefit from this.arch/arm/cpu/tegra20-common/pinmux.c | 23 +++++++++++++++++++++++ arch/arm/include/asm/arch-tegra20/pinmux.h | 6 ++++++ 2 files changed, 29 insertions(+)arch/arm/cpu/tegra20-common/pinmux.c +9
-0@@ -554,6 +554,29 @@ void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func)writel (reg, muxctl); } +static enum pmux_func pinmux_get_func (enum pmux_pingrp pin) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +enum pmux_ctlid mux_id = tegra_soc_pingroups[pin].ctl_id; +u32 *muxctl = &pmt->pmt_ctl[MUXCTL_REG (mux_id)]; +u32 reg; + + reg =readl (muxctl);
arch/arm/cpu/tegra20-common/pinmux.c void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func) · line 575
Quoted 10 lines
arch/arm/cpu/tegra20-common/pinmux.c +10
-0+ reg >>=MUXCTL_SHIFT (mux_id); + reg &=3 ; + +return tegra_soc_pingroups[pin].funcs[reg]; +} + +void pinmux_avoid_func (enum pmux_pingrp pin,enum pmux_func avoid) +{ +if (pinmux_get_func (pin) != avoid) +return ;
Is this an error - does the caller need to know?
Quoted 12 lines
arch/arm/cpu/tegra20-common/pinmux.c +4
-0+ +pinmux_set_func (pin, tegra_soc_pingroups[pin].func_safe); +} +void pinmux_config_pingroup (const struct pingroup_config *config) {enum pmux_pingrp pin = config->pingroup;arch/arm/include/asm/arch-tegra20/pinmux.h +0
-0
arch/arm/include/asm/arch-tegra20/pinmux.h void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd); · line 343
Quoted 7 lines
arch/arm/include/asm/arch-tegra20/pinmux.h +4
-0@@ -337,6 +337,12 @@ void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd);/* Set the mux function for a pin group */ void pinmux_set_func (enum pmux_pingrp pin,enum pmux_func func); +/* +* Select the "safe" (non-conflicting) mux function for a pin group if the +* current setting matches the specified function. +*/
What does it do when it doesn't match, and perhaps comment when you might find this function useful?
Quoted 8 lines
arch/arm/include/asm/arch-tegra20/pinmux.h +2
-1+void pinmux_avoid_func (enum pmux_pingrp pin,enum pmux_func func); +/* Set the complete configuration for a pin group */ void pinmux_config_pingroup (const struct pingroup_config *config); --1.7.10.4
Regards,
Simon
PATCH 1/1 tegra: implement pinmux_avoid_func()
Quoted 8 lines · Simon Glass
Hi Stephen,
Quoted 5 lines · Stephen Warren
From: Stephen Warren <[email protected]>
This selects the "safe" (non-conflicting) mux function for a pin group if the current setting matches the specified function.
Quoted 7 lines
Quoted 5 lines
Many signals can be routed to or from multiple different groups. Each signal must be routed to or from only a single group at a given time. Hence, if we program a particular group for a function, we must ensure no other group is programmed to that same function first. This API makes this easy.
What is the intended use of this function? (sorry, yes, I am confused :-)
It's a safer way of doing this:
"tegra: pinmux: fix FUNCMUX_NDFLASH_KBC_8_BIT"
http://lists.denx.de/pipermail/u-boot/2013-January/144612.html
i.e. it address the concerns I raised here:
http://lists.denx.de/pipermail/u-boot/2013-January/144713.html
PATCH 1/1 tegra: implement pinmux_avoid_func()
Hi Stephen,
Quoted 15 lines · Stephen Warren
Quoted 14 lines · Simon Glass
Hi Stephen,
Quoted 10 lines · Stephen Warren
From: Stephen Warren <[email protected]>
This selects the "safe" (non-conflicting) mux function for a pin group if the current setting matches the specified function.
Many signals can be routed to or from multiple different groups. Each signal must be routed to or from only a single group at a given time. Hence, if we program a particular group for a function, we must ensure no other group is programmed to that same function first. This API makes this easy.
Quoted 9 lines
Quoted 1 line
What is the intended use of this function? (sorry, yes, I am confused :-)
It's a safer way of doing this:
"tegra: pinmux: fixFUNCMUX_NDFLASH_KBC_8_BIT"
http://lists.denx.de/pipermail/u-boot/2013-January/144612.htmli.e. it address the concerns I raised here:
http://lists.denx.de/pipermail/u-boot/2013-January/144713.html
OK thank you. So is your function only intended for use with T20?
Regards,
Simon
PATCH 1/1 tegra: implement pinmux_avoid_func()
Quoted 24 lines · Simon Glass
Hi Stephen,
Quoted 21 lines · Stephen Warren
Quoted 8 lines · Simon Glass
Hi Stephen,
Quoted 5 lines · Stephen Warren
From: Stephen Warren <[email protected]>
This selects the "safe" (non-conflicting) mux function for a pin group if the current setting matches the specified function.
Quoted 7 lines
Quoted 5 lines
Many signals can be routed to or from multiple different groups. Each signal must be routed to or from only a single group at a given time. Hence, if we program a particular group for a function, we must ensure no other group is programmed to that same function first. This API makes this easy.
What is the intended use of this function? (sorry, yes, I am confused :-)
It's a safer way of doing this:
"tegra: pinmux: fixFUNCMUX_NDFLASH_KBC_8_BIT"
http://lists.denx.de/pipermail/u-boot/2013-January/144612.html
Quoted 5 lines
Quoted 3 lines
i.e. it address the concerns I raised here:
http://lists.denx.de/pipermail/u-boot/2013-January/144713.htmlOK thank you. So is your function only intended for use with T20?
No, I imagine that it should be used for all Tegras; I just wrote it long enough ago that there was only Tegra20 at the time. I assume that if Lucas wants to use this function as a pre-cursor to his NAND pinmux change, he'll update it for whatever Tegra versions are checked in at the time first.
Sorry, I'm being lazy/over-worked.
PATCH 1/1 tegra: implement pinmux_avoid_func()
Hi Stephen,
Quoted 29 lines · Stephen Warren
Quoted 28 lines · Simon Glass
Hi Stephen,
Quoted 24 lines · Stephen Warren
Quoted 8 lines · Simon Glass
Hi Stephen,
Quoted 5 lines · Stephen Warren
From: Stephen Warren <[email protected]>
This selects the "safe" (non-conflicting) mux function for a pin group if the current setting matches the specified function.
Quoted 7 lines
Quoted 5 lines
Many signals can be routed to or from multiple different groups. Each signal must be routed to or from only a single group at a given time. Hence, if we program a particular group for a function, we must ensure no other group is programmed to that same function first. This API makes this easy.
What is the intended use of this function? (sorry, yes, I am confused :-)
It's a safer way of doing this:
"tegra: pinmux: fixFUNCMUX_NDFLASH_KBC_8_BIT"
http://lists.denx.de/pipermail/u-boot/2013-January/144612.htmli.e. it address the concerns I raised here:
http://lists.denx.de/pipermail/u-boot/2013-January/144713.html
Quoted 8 lines
Quoted 1 line
OK thank you. So is your function only intended for use with T20?
No, I imagine that it should be used for all Tegras; I just wrote it long enough ago that there was only Tegra20 at the time. I assume that if Lucas wants to use this function as a pre-cursor to his NAND pinmux change, he'll update it for whatever Tegra versions are checked in at the time first.
Thanks, I get it.
Should Lucas consider adding a warning or some sort of indication that the function did nothing?
Quoted 2 lines
Sorry, I'm being lazy/over-worked.
:-)
Regards,
Simon
PATCH 1/1 tegra: implement pinmux_avoid_func()
Quoted 40 lines · Simon Glass
Hi Stephen,
Quoted 29 lines · Stephen Warren
Quoted 28 lines · Simon Glass
Hi Stephen,
Quoted 24 lines · Stephen Warren
Quoted 8 lines · Simon Glass
Hi Stephen,
Quoted 5 lines · Stephen Warren
From: Stephen Warren <[email protected]>
This selects the "safe" (non-conflicting) mux function for a pin group if the current setting matches the specified function.
Quoted 7 lines
Quoted 5 lines
Many signals can be routed to or from multiple different groups. Each signal must be routed to or from only a single group at a given time. Hence, if we program a particular group for a function, we must ensure no other group is programmed to that same function first. This API makes this easy.
What is the intended use of this function? (sorry, yes, I am confused :-)
It's a safer way of doing this:
"tegra: pinmux: fixFUNCMUX_NDFLASH_KBC_8_BIT"
http://lists.denx.de/pipermail/u-boot/2013-January/144612.htmli.e. it address the concerns I raised here:
http://lists.denx.de/pipermail/u-boot/2013-January/144713.htmlQuoted 8 lines
Quoted 1 line
OK thank you. So is your function only intended for use with T20?
No, I imagine that it should be used for all Tegras; I just wrote it long enough ago that there was only Tegra20 at the time. I assume that if Lucas wants to use this function as a pre-cursor to his NAND pinmux change, he'll update it for whatever Tegra versions are checked in at the time first.
Quoted 4 lines
Thanks, I get it.
Should Lucas consider adding a warning or some sort of indication that the function did nothing?
Do you mean on Tegra30 where it isn't implemented yet (no - I'd expect to see this implemented instead) or when the current function programmed into HW already doesn't match the value one is trying to avoid (no - I'd expect this to be quite common).
PATCH 1/1 tegra: implement pinmux_avoid_func()
Hi Stephen,
Quoted 43 lines · Stephen Warren
Quoted 42 lines · Simon Glass
Hi Stephen,
Quoted 29 lines · Stephen Warren
Quoted 28 lines · Simon Glass
Hi Stephen,
Quoted 24 lines · Stephen Warren
Quoted 8 lines · Simon Glass
Hi Stephen,
Quoted 5 lines · Stephen Warren
From: Stephen Warren <[email protected]>
This selects the "safe" (non-conflicting) mux function for a pin group if the current setting matches the specified function.
Quoted 7 lines
Quoted 5 lines
Many signals can be routed to or from multiple different groups. Each signal must be routed to or from only a single group at a given time. Hence, if we program a particular group for a function, we must ensure no other group is programmed to that same function first. This API makes this easy.
What is the intended use of this function? (sorry, yes, I am confused :-)
It's a safer way of doing this:
"tegra: pinmux: fixFUNCMUX_NDFLASH_KBC_8_BIT"
http://lists.denx.de/pipermail/u-boot/2013-January/144612.htmli.e. it address the concerns I raised here:
http://lists.denx.de/pipermail/u-boot/2013-January/144713.htmlQuoted 8 lines
Quoted 1 line
OK thank you. So is your function only intended for use with T20?
No, I imagine that it should be used for all Tegras; I just wrote it long enough ago that there was only Tegra20 at the time. I assume that if Lucas wants to use this function as a pre-cursor to his NAND pinmux change, he'll update it for whatever Tegra versions are checked in at the time first.
Thanks, I get it.
Quoted 8 lines
Quoted 2 lines
Should Lucas consider adding a warning or some sort of indication that the function did nothing?
Do you mean on Tegra30 where it isn't implemented yet (no - I'd expect to see this implemented instead) or when the current function programmed into HW already doesn't match the value one is trying to avoid (no - I'd expect this to be quite common).
The latter - ok that's fine.
Regards,
Simon