diff options
Diffstat (limited to 'drivers/spi/spi-fsl-spi.c')
| -rw-r--r-- | drivers/spi/spi-fsl-spi.c | 25 | 
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 4b80ace1d137..fb4159ad6bf6 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -416,8 +416,7 @@ static int fsl_spi_do_one_msg(struct spi_master *master,  		}  		m->actual_length += t->len; -		if (t->delay_usecs) -			udelay(t->delay_usecs); +		spi_transfer_delay_exec(t);  		if (cs_change) {  			ndelay(nsecs); @@ -612,6 +611,7 @@ static struct spi_master * fsl_spi_probe(struct device *dev,  	master->setup = fsl_spi_setup;  	master->cleanup = fsl_spi_cleanup;  	master->transfer_one_message = fsl_spi_do_one_msg; +	master->use_gpio_descriptors = true;  	mpc8xxx_spi = spi_master_get_devdata(master);  	mpc8xxx_spi->max_bits_per_word = 32; @@ -728,17 +728,27 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)  			}  		}  #endif - -		pdata->cs_control = fsl_spi_cs_control; +		/* +		 * Handle the case where we have one hardwired (always selected) +		 * device on the first "chipselect". Else we let the core code +		 * handle any GPIOs or native chip selects and assign the +		 * appropriate callback for dealing with the CS lines. This isn't +		 * supported on the GRLIB variant. +		 */ +		ret = gpiod_count(dev, "cs"); +		if (ret <= 0) +			pdata->max_chipselect = 1; +		else +			pdata->cs_control = fsl_spi_cs_control;  	}  	ret = of_address_to_resource(np, 0, &mem);  	if (ret)  		goto err; -	irq = irq_of_parse_and_map(np, 0); -	if (!irq) { -		ret = -EINVAL; +	irq = platform_get_irq(ofdev, 0); +	if (irq < 0) { +		ret = irq;  		goto err;  	} @@ -751,7 +761,6 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)  	return 0;  err: -	irq_dispose_mapping(irq);  	return ret;  }  |