From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Jander Date: Fri, 20 Aug 2010 12:07:44 +0200 Subject: [U-Boot] [PATCH] Use common function to set GPIOs for MX3 and MX5 In-Reply-To: <4C6E525C.3090205@denx.de> References: <1282292411-6087-1-git-send-email-sbabic@denx.de> <201008201129.25980.david.jander@protonic.nl> <4C6E525C.3090205@denx.de> Message-ID: <201008201207.44578.david.jander@protonic.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Stefano, On Friday 20 August 2010 12:01:00 pm Stefano Babic wrote: > > After this change, it seems something else is missing: > > GCC somehow removed the following code for i.MX51 without actually > > compiling the arguments to the functions (???), but now it becomes > > evident this only compiles for i.MX31: > > Understood, in SPI driver. Really I had another patch in my private > tree, but I have not yet sent. However, as you note, it makes no sense > to split changes in two patches. > > I will rebase my tree and send V2 version of the pacth, inclusive the > changes for mxc_spi.c Ok, thanks! > > void spi_cs_activate(struct spi_slave *slave) > > { > > struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave); > > if (mxcs->gpio > 0) > > mxc_gpio_set(mxcs->gpio, mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL); > > I know, I had already change this code...I store ss_pol in the priivate > structure to be independent from the processor register. > > I will send the compound patch soon. Great. I'll wait. In the meantime I have just done this to get it working: #ifdef CONFIG_MX31 void spi_cs_activate(struct spi_slave *slave) { struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave); if (mxcs->gpio > 0) mxc_gpio_set(mxcs->gpio, mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL); } void spi_cs_deactivate(struct spi_slave *slave) { struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave); if (mxcs->gpio > 0) mxc_gpio_set(mxcs->gpio, !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL)); } #elif defined (CONFIG_MX51) void spi_cs_activate(struct spi_slave *slave) { struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave); unsigned int val = mxcs->cfg_reg & (1 << (slave->cs + MXC_CSPICON_SSPOL)); if (mxcs->gpio > 0) mxc_gpio_set(mxcs->gpio, val); } void spi_cs_deactivate(struct spi_slave *slave) { struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave); unsigned int val = !(mxcs->cfg_reg & (1 << (slave->cs + MXC_CSPICON_SSPOL))); if (mxcs->gpio > 0) mxc_gpio_set(mxcs->gpio, val); } #endif Seems to work, but never mind... Best regards, -- David Jander Protonic Holland.