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

stefano babic
2012-04-09T22:31:02Z

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 ?

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.

> 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.

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================