Merge remote-tracking branch 'spi/for-5.10' into spi-5.11
This commit is contained in:
commit
127a7a95df
|
@ -280,8 +280,10 @@ static int dw_spi_bt1_probe(struct platform_device *pdev)
|
|||
dws->bus_num = pdev->id;
|
||||
dws->reg_io_width = 4;
|
||||
dws->max_freq = clk_get_rate(dwsbt1->clk);
|
||||
if (!dws->max_freq)
|
||||
if (!dws->max_freq) {
|
||||
ret = -EINVAL;
|
||||
goto err_disable_clk;
|
||||
}
|
||||
|
||||
init_func = device_get_match_data(&pdev->dev);
|
||||
ret = init_func(pdev, dwsbt1);
|
||||
|
|
|
@ -1165,7 +1165,7 @@ static int dspi_init(struct fsl_dspi *dspi)
|
|||
unsigned int mcr;
|
||||
|
||||
/* Set idle states for all chip select signals to high */
|
||||
mcr = SPI_MCR_PCSIS(GENMASK(dspi->ctlr->num_chipselect - 1, 0));
|
||||
mcr = SPI_MCR_PCSIS(GENMASK(dspi->ctlr->max_native_cs - 1, 0));
|
||||
|
||||
if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE)
|
||||
mcr |= SPI_MCR_XSPI;
|
||||
|
@ -1250,7 +1250,7 @@ static int dspi_probe(struct platform_device *pdev)
|
|||
|
||||
pdata = dev_get_platdata(&pdev->dev);
|
||||
if (pdata) {
|
||||
ctlr->num_chipselect = pdata->cs_num;
|
||||
ctlr->num_chipselect = ctlr->max_native_cs = pdata->cs_num;
|
||||
ctlr->bus_num = pdata->bus_num;
|
||||
|
||||
/* Only Coldfire uses platform data */
|
||||
|
@ -1263,7 +1263,7 @@ static int dspi_probe(struct platform_device *pdev)
|
|||
dev_err(&pdev->dev, "can't get spi-num-chipselects\n");
|
||||
goto out_ctlr_put;
|
||||
}
|
||||
ctlr->num_chipselect = cs_num;
|
||||
ctlr->num_chipselect = ctlr->max_native_cs = cs_num;
|
||||
|
||||
of_property_read_u32(np, "bus-num", &bus_num);
|
||||
ctlr->bus_num = bus_num;
|
||||
|
|
|
@ -716,10 +716,11 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
|
|||
type = fsl_spi_get_type(&ofdev->dev);
|
||||
if (type == TYPE_FSL) {
|
||||
struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
|
||||
bool spisel_boot = false;
|
||||
#if IS_ENABLED(CONFIG_FSL_SOC)
|
||||
struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
|
||||
bool spisel_boot = of_property_read_bool(np, "fsl,spisel_boot");
|
||||
|
||||
spisel_boot = of_property_read_bool(np, "fsl,spisel_boot");
|
||||
if (spisel_boot) {
|
||||
pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4);
|
||||
if (!pinfo->immr_spi_cs)
|
||||
|
@ -734,10 +735,14 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
|
|||
* supported on the GRLIB variant.
|
||||
*/
|
||||
ret = gpiod_count(dev, "cs");
|
||||
if (ret <= 0)
|
||||
if (ret < 0)
|
||||
ret = 0;
|
||||
if (ret == 0 && !spisel_boot) {
|
||||
pdata->max_chipselect = 1;
|
||||
else
|
||||
} else {
|
||||
pdata->max_chipselect = ret + spisel_boot;
|
||||
pdata->cs_control = fsl_spi_cs_control;
|
||||
}
|
||||
}
|
||||
|
||||
ret = of_address_to_resource(np, 0, &mem);
|
||||
|
|
|
@ -3378,7 +3378,8 @@ int spi_setup(struct spi_device *spi)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
if (!spi->max_speed_hz)
|
||||
if (!spi->max_speed_hz ||
|
||||
spi->max_speed_hz > spi->controller->max_speed_hz)
|
||||
spi->max_speed_hz = spi->controller->max_speed_hz;
|
||||
|
||||
mutex_lock(&spi->controller->io_mutex);
|
||||
|
|
Loading…
Reference in New Issue