/* Some SPI devices require active chip-select over multiple transactions, we achieve this using a GPIO. Still, the SPI controller has to be configured to use one of its own chipselects. To use this feature you have to implement board_spi_cs_gpio() to assign a gpio value for each cs (-1 if cs doesn't need to use gpio). You must use some unused on this SPI controller cs between 0 and 3.  */
static int setup_cs_gpio(struct mxc_spi_slave *mxcs, unsigned int bus, unsigned int cs)
/* Some SPI devices require active chip-select over multiple transactions, we achieve this using a GPIO. Still, the SPI controller has to be configured to use one of its own chipselects. To use this feature you have to implement board_spi_cs_gpio() to assign a gpio value for each cs (-1 if cs doesn't need to use gpio). You must use some unused on this SPI controller cs between 0 and 3.  */
static int setup_cs_gpio(struct mxc_spi_slave *mxcs, unsigned int bus, unsigned int cs)
{
	int ret;
	mxcs->gpio = board_spi_cs_gpio(bus, cs);
	if (mxcs->gpio == -1)
		return 0;
	gpio_request(mxcs->gpio, "spi-cs");
	ret = gpio_direction_output(mxcs->gpio, !(mxcs->ss_pol));
	if (ret) {
		printf("mxc_spi: cannot setup gpio %d\n", mxcs->gpio);
		return -EINVAL;
	}
	return 0;
}