* [U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro
@ 2013-10-03 11:46 Otavio Salvador
2013-10-03 12:43 ` Benoît Thébaudeau
0 siblings, 1 reply; 6+ messages in thread
From: Otavio Salvador @ 2013-10-03 11:46 UTC (permalink / raw)
To: u-boot
The macro allows easy setting in per-pin, as for example:
,----
| imx_iomux_v3_setup_pad(MX6_PAD_NANDF_D1__GPIO_2_1 | MUX_MODE_SION);
`----
The IOMUX_CONFIG_SION allows for reading PAD value from PSR register.
The following quote from the datasheet:
,----
| ...
| 28.4.2.2 GPIO Write Mode
| The programming sequence for driving output signals should be as follows:
| 1. Configure IOMUX to select GPIO mode (Via IOMUXC), also enable SION if need
| to read loopback pad value through PSR
| 2. Configure GPIO direction register to output (GPIO_GDIR[GDIR] set to 1b).
| 3. Write value to data register (GPIO_DR).
| ...
`----
This fixes the gpio_get_value to properly work when a GPIO is set for
output and has no conflicts.
Thanks for Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>, Fabio
Estevam <fabio.estevam@freescale.com> and Eric B?nard
<eric@eukrea.com> for helping to properly trace this down.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
arch/arm/include/asm/imx-common/iomux-v3.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/include/asm/imx-common/iomux-v3.h b/arch/arm/include/asm/imx-common/iomux-v3.h
index dc2b3ef..b7bdaa5 100644
--- a/arch/arm/include/asm/imx-common/iomux-v3.h
+++ b/arch/arm/include/asm/imx-common/iomux-v3.h
@@ -57,6 +57,7 @@ typedef u64 iomux_v3_cfg_t;
MUX_SEL_INPUT_OFS_SHIFT)
#define MUX_MODE_SHIFT 36
+#define MUX_MODE_SION ((iomux_v3_cfg_t)IOMUX_CONFIG_SION << MUX_MODE_SHIFT)
#define MUX_MODE_MASK ((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT)
#define MUX_PAD_CTRL_SHIFT 41
#define MUX_PAD_CTRL_MASK ((iomux_v3_cfg_t)0x3ffff << MUX_PAD_CTRL_SHIFT)
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro
2013-10-03 11:46 Otavio Salvador
@ 2013-10-03 12:43 ` Benoît Thébaudeau
2013-10-03 13:04 ` Otavio Salvador
0 siblings, 1 reply; 6+ messages in thread
From: Benoît Thébaudeau @ 2013-10-03 12:43 UTC (permalink / raw)
To: u-boot
Hi Otavio,
On Thursday, October 3, 2013 1:46:00 PM, Otavio Salvador wrote:
> The macro allows easy setting in per-pin, as for example:
>
> ,----
> | imx_iomux_v3_setup_pad(MX6_PAD_NANDF_D1__GPIO_2_1 | MUX_MODE_SION);
> `----
>
> The IOMUX_CONFIG_SION allows for reading PAD value from PSR register.
>
> The following quote from the datasheet:
>
> ,----
> | ...
> | 28.4.2.2 GPIO Write Mode
> | The programming sequence for driving output signals should be as follows:
> | 1. Configure IOMUX to select GPIO mode (Via IOMUXC), also enable SION if
> | need
> | to read loopback pad value through PSR
> | 2. Configure GPIO direction register to output (GPIO_GDIR[GDIR] set to 1b).
> | 3. Write value to data register (GPIO_DR).
> | ...
> `----
>
> This fixes the gpio_get_value to properly work when a GPIO is set for
> output and has no conflicts.
>
> Thanks for Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>, Fabio
> Estevam <fabio.estevam@freescale.com> and Eric B?nard
> <eric@eukrea.com> for helping to properly trace this down.
>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
> arch/arm/include/asm/imx-common/iomux-v3.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/include/asm/imx-common/iomux-v3.h
> b/arch/arm/include/asm/imx-common/iomux-v3.h
> index dc2b3ef..b7bdaa5 100644
> --- a/arch/arm/include/asm/imx-common/iomux-v3.h
> +++ b/arch/arm/include/asm/imx-common/iomux-v3.h
> @@ -57,6 +57,7 @@ typedef u64 iomux_v3_cfg_t;
> MUX_SEL_INPUT_OFS_SHIFT)
>
> #define MUX_MODE_SHIFT 36
> +#define MUX_MODE_SION ((iomux_v3_cfg_t)IOMUX_CONFIG_SION << MUX_MODE_SHIFT)
> #define MUX_MODE_MASK ((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT)
> #define MUX_PAD_CTRL_SHIFT 41
> #define MUX_PAD_CTRL_MASK ((iomux_v3_cfg_t)0x3ffff << MUX_PAD_CTRL_SHIFT)
Looks good. Just some nit picking:
- The line seems to be longer that the max allowed 80 chars.
- You could perhaps move this definition to the line right above
"#define MUX_PAD_CTRL(x)" so that macros for configuration options are grouped
together.
Best regards,
Beno?t
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro
2013-10-03 12:43 ` Benoît Thébaudeau
@ 2013-10-03 13:04 ` Otavio Salvador
0 siblings, 0 replies; 6+ messages in thread
From: Otavio Salvador @ 2013-10-03 13:04 UTC (permalink / raw)
To: u-boot
On Thu, Oct 3, 2013 at 9:43 AM, Beno?t Th?baudeau
<benoit.thebaudeau@advansee.com> wrote:
> Hi Otavio,
>
> On Thursday, October 3, 2013 1:46:00 PM, Otavio Salvador wrote:
>> The macro allows easy setting in per-pin, as for example:
>>
>> ,----
>> | imx_iomux_v3_setup_pad(MX6_PAD_NANDF_D1__GPIO_2_1 | MUX_MODE_SION);
>> `----
>>
>> The IOMUX_CONFIG_SION allows for reading PAD value from PSR register.
>>
>> The following quote from the datasheet:
>>
>> ,----
>> | ...
>> | 28.4.2.2 GPIO Write Mode
>> | The programming sequence for driving output signals should be as follows:
>> | 1. Configure IOMUX to select GPIO mode (Via IOMUXC), also enable SION if
>> | need
>> | to read loopback pad value through PSR
>> | 2. Configure GPIO direction register to output (GPIO_GDIR[GDIR] set to 1b).
>> | 3. Write value to data register (GPIO_DR).
>> | ...
>> `----
>>
>> This fixes the gpio_get_value to properly work when a GPIO is set for
>> output and has no conflicts.
>>
>> Thanks for Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>, Fabio
>> Estevam <fabio.estevam@freescale.com> and Eric B?nard
>> <eric@eukrea.com> for helping to properly trace this down.
>>
>> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>> ---
>> arch/arm/include/asm/imx-common/iomux-v3.h | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm/include/asm/imx-common/iomux-v3.h
>> b/arch/arm/include/asm/imx-common/iomux-v3.h
>> index dc2b3ef..b7bdaa5 100644
>> --- a/arch/arm/include/asm/imx-common/iomux-v3.h
>> +++ b/arch/arm/include/asm/imx-common/iomux-v3.h
>> @@ -57,6 +57,7 @@ typedef u64 iomux_v3_cfg_t;
>> MUX_SEL_INPUT_OFS_SHIFT)
>>
>> #define MUX_MODE_SHIFT 36
>> +#define MUX_MODE_SION ((iomux_v3_cfg_t)IOMUX_CONFIG_SION << MUX_MODE_SHIFT)
>> #define MUX_MODE_MASK ((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT)
>> #define MUX_PAD_CTRL_SHIFT 41
>> #define MUX_PAD_CTRL_MASK ((iomux_v3_cfg_t)0x3ffff << MUX_PAD_CTRL_SHIFT)
>
> Looks good. Just some nit picking:
> - The line seems to be longer that the max allowed 80 chars.
Splitting it looks so ugly!
> - You could perhaps move this definition to the line right above
> "#define MUX_PAD_CTRL(x)" so that macros for configuration options are grouped
> together.
Ok.
--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro
@ 2013-10-11 1:31 Otavio Salvador
2013-10-11 2:14 ` Marek Vasut
0 siblings, 1 reply; 6+ messages in thread
From: Otavio Salvador @ 2013-10-11 1:31 UTC (permalink / raw)
To: u-boot
The macro allows easy setting in per-pin, as for example:
,----
| imx_iomux_v3_setup_pad(MX6_PAD_NANDF_D1__GPIO_2_1 | MUX_MODE_SION);
`----
The IOMUX_CONFIG_SION allows for reading PAD value from PSR register.
The following quote from the datasheet:
,----
| ...
| 28.4.2.2 GPIO Write Mode
| The programming sequence for driving output signals should be as follows:
| 1. Configure IOMUX to select GPIO mode (Via IOMUXC), also enable SION if need
| to read loopback pad value through PSR
| 2. Configure GPIO direction register to output (GPIO_GDIR[GDIR] set to 1b).
| 3. Write value to data register (GPIO_DR).
| ...
`----
This fixes the gpio_get_value to properly work when a GPIO is set for
output and has no conflicts.
Thanks for Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>, Fabio
Estevam <fabio.estevam@freescale.com> and Eric B?nard
<eric@eukrea.com> for helping to properly trace this down.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Changes in v2:
- Fix too long line
- Move it just before MUX_PAD_CTRL(x)
arch/arm/include/asm/imx-common/iomux-v3.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/include/asm/imx-common/iomux-v3.h b/arch/arm/include/asm/imx-common/iomux-v3.h
index dc2b3ef..dec11a1 100644
--- a/arch/arm/include/asm/imx-common/iomux-v3.h
+++ b/arch/arm/include/asm/imx-common/iomux-v3.h
@@ -63,6 +63,8 @@ typedef u64 iomux_v3_cfg_t;
#define MUX_SEL_INPUT_SHIFT 59
#define MUX_SEL_INPUT_MASK ((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT)
+#define MUX_MODE_SION ((iomux_v3_cfg_t)IOMUX_CONFIG_SION << \
+ MUX_MODE_SHIFT)
#define MUX_PAD_CTRL(x) ((iomux_v3_cfg_t)(x) << MUX_PAD_CTRL_SHIFT)
#define IOMUX_PAD(pad_ctrl_ofs, mux_ctrl_ofs, mux_mode, sel_input_ofs, \
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro
2013-10-11 1:31 [U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro Otavio Salvador
@ 2013-10-11 2:14 ` Marek Vasut
2013-10-11 2:38 ` Otavio Salvador
0 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2013-10-11 2:14 UTC (permalink / raw)
To: u-boot
Dear Otavio Salvador,
> The macro allows easy setting in per-pin, as for example:
>
> ,----
>
> | imx_iomux_v3_setup_pad(MX6_PAD_NANDF_D1__GPIO_2_1 | MUX_MODE_SION);
>
> `----
>
> The IOMUX_CONFIG_SION allows for reading PAD value from PSR register.
>
> The following quote from the datasheet:
I think I already saw this patch. Is this a V2? Or a repost?
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro
2013-10-11 2:14 ` Marek Vasut
@ 2013-10-11 2:38 ` Otavio Salvador
0 siblings, 0 replies; 6+ messages in thread
From: Otavio Salvador @ 2013-10-11 2:38 UTC (permalink / raw)
To: u-boot
On Thu, Oct 10, 2013 at 11:14 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
>> The macro allows easy setting in per-pin, as for example:
>>
>> ,----
>>
>> | imx_iomux_v3_setup_pad(MX6_PAD_NANDF_D1__GPIO_2_1 | MUX_MODE_SION);
>>
>> `----
>>
>> The IOMUX_CONFIG_SION allows for reading PAD value from PSR register.
>>
>> The following quote from the datasheet:
>
> I think I already saw this patch. Is this a V2? Or a repost?
This is the v2; my fault of bad tagging it.
--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-10-11 2:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11 1:31 [U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro Otavio Salvador
2013-10-11 2:14 ` Marek Vasut
2013-10-11 2:38 ` Otavio Salvador
-- strict thread matches above, loose matches on Subject: below --
2013-10-03 11:46 Otavio Salvador
2013-10-03 12:43 ` Benoît Thébaudeau
2013-10-03 13:04 ` Otavio Salvador
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.