[U-Boot] [PATCH 1/3] imx: Add GPIO_TO_PORT macro

Vikram Narayanan vikram186 at gmail.com
Tue Apr 10 04:47:44 CEST 2012


Hi Stefano,

On 4/10/2012 4:01 AM, stefano babic wrote:
> Am 09/04/2012 18:09, schrieb Vikram Narayanan:
>> Hi,
>>
>
> Hi,
>
>>
>> Yes. You are right.
>> So, instead of defining all the headers this way,
>>
>> #if defined(CONFIG_MX53) || defined(CONFIG_MX51)
>> #include<asm/arch/mx5x_pins.h>
>> #elif defined(CONFIG_MX6)
>> #include<asm/arch/imx-regs.h>
>> #endif
>> ..... etc
>
>
> We have not this code - I cannot find in u-boot, and wedo not want to
> introduce it. As you say, it is nasty. Where have you find it ?

I don't find it anyway. If I want to use the existing macro, it would 
result in this.

> There is no driver including mx*_pins.h. At the moment, only board
> specific code includes the SOC specific pin header.
>
>>
>> Why not define the GPIO_TO_PORT macro in the driver?
>
> Maybe there was some use of the macro outside the driver in the past. I
> think before i.MX code was adapted to use common gpio_ functions, boards
> are used to write directly into the registers of the GPIO controller.
>
> I do not see any track of the macro in the current tree. So yes, we can
> move GPIO_ macros inside the driver.

Sure. I'll just do that.

>> Anyways for all its
>> the same 32 pins. Any suggestions/flames?
>
> It seems to me also that the defined GPIO_PORT for MX6 is wrong.
>
> arch/arm/include/asm/arch-mx6/imx-regs.h:
>
> #define GPIO_TO_PORT(number)		(((number)/32)+1)
>
> Why is the port starting from 1 ? It is wrong, but really GPIO_TO_PORT()
> is not used anymore.

Yes. You are right. I'll send the v2 for this.

Thanks for your response,
Vikram

> Best regards,
> Stefano Babic
>



More information about the U-Boot mailing list