From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vikram Narayanan Date: Tue, 10 Apr 2012 08:17:44 +0530 Subject: [U-Boot] [PATCH 1/3] imx: Add GPIO_TO_PORT macro In-Reply-To: <4F836326.2000700@denx.de> References: <4F7C7153.3040601@gmail.com> <4F7EAFAA.9020502@denx.de> <4F8309B8.7050002@gmail.com> <4F836326.2000700@denx.de> Message-ID: <4F839F50.2020006@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 >> #elif defined(CONFIG_MX6) >> #include >> #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 >