From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatolij Gustschin Date: Thu, 05 Feb 2009 17:32:27 +0100 Subject: [U-Boot] [PATCH 3/9 v2] i.MX31: support GPIO as a chip-select in the mxc_spi driver In-Reply-To: References: Message-ID: <498B149B.3040203@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Guennadi Liakhovetski wrote: > diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c > index b7bd84b..1341543 100644 > --- a/drivers/spi/mxc_spi.c > +++ b/drivers/spi/mxc_spi.c > @@ -105,6 +112,10 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen) > while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH) > ; > > + if (mxcs->gpio > 0 && (flags & SPI_XFER_END)) > + mx31_gpio_set(mxcs->gpio, > + !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL)); this is a multi-line if statement, I think the preferred coding style is as follows: if (...) { /* * multi-line if statement */ ... } please fix, Thanks! > @@ -146,11 +157,35 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, > { > unsigned int ctrl_reg; > struct mxc_spi_slave *mxcs; > + int ret; > > - if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]) || > - cs > 3) > + if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0])) please use ARRAY_SIZE() here, too. Thanks! Best regards, Anatolij