[U-Boot] [PATCH] imx: Easy enabling of SION per-pin using MUX_MODE_SION helper macro

Otavio Salvador otavio at ossystems.com.br
Thu Oct 3 15:04:52 CEST 2013


On Thu, Oct 3, 2013 at 9:43 AM, Benoît Thébaudeau
<benoit.thebaudeau at 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 at advansee.com>, Fabio
>> Estevam <fabio.estevam at freescale.com> and Eric Bénard
>> <eric at eukrea.com> for helping to properly trace this down.
>>
>> Signed-off-by: Otavio Salvador <otavio at 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


More information about the U-Boot mailing list