spi: Fixes for v4.19
As well as one driver fix there's a couple of fixes here which address issues with the use of IDRs for allocation of dynamic bus numbers, ensuring that dynamic bus numbers interact well with static bus numbers assigned via DT and otherwise. -----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluf2foTHGJyb29uaWVA a2VybmVsLm9yZwAKCRAk1otyXVSH0DooB/4/c+c9nX31WeKh5EUFS3WJUQ4quHC+ ZPS0rqliJm0KQxdSCU6ig2+xbobZWAs9T4ZXPlE7PNk6DmqdtATS5jlzbwmoLvdA PvxsBwz3dRdIGR/BNbDYEZCb0WGtMHO6BR5c//lBCy+ea5oNENi0w0mFnY+AVeUt ivM55i/nNmV4DReT3rl5mRz/TQgfI9zc11DPpqDnlQML3emYHmJ+hZa8/1g68d8C lQHLIQMo6hGyOd3p6uPODGt98cDKIuYl9+fcYVzYFScNshwuMsxTDUXpkhv85Frb QV6LGlikaEQBh9X9BHjzTHMBqbTFVLX/I+jRC/vK2G21862rfOt3R6vh =rRj7 -----END PGP SIGNATURE----- Merge tag 'spi-fix-v4.19-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Mark writes: "spi: Fixes for v4.19 As well as one driver fix there's a couple of fixes here which address issues with the use of IDRs for allocation of dynamic bus numbers, ensuring that dynamic bus numbers interact well with static bus numbers assigned via DT and otherwise." * tag 'spi-fix-v4.19-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: spi-fsl-dspi: fix broken DSPI_EOQ_MODE spi: Fix double IDR allocation with DT aliases spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers
This commit is contained in:
commit
3918c21eac
|
@ -30,7 +30,11 @@
|
|||
|
||||
#define DRIVER_NAME "fsl-dspi"
|
||||
|
||||
#ifdef CONFIG_M5441x
|
||||
#define DSPI_FIFO_SIZE 16
|
||||
#else
|
||||
#define DSPI_FIFO_SIZE 4
|
||||
#endif
|
||||
#define DSPI_DMA_BUFSIZE (DSPI_FIFO_SIZE * 1024)
|
||||
|
||||
#define SPI_MCR 0x00
|
||||
|
@ -623,9 +627,11 @@ static void dspi_tcfq_read(struct fsl_dspi *dspi)
|
|||
static void dspi_eoq_write(struct fsl_dspi *dspi)
|
||||
{
|
||||
int fifo_size = DSPI_FIFO_SIZE;
|
||||
u16 xfer_cmd = dspi->tx_cmd;
|
||||
|
||||
/* Fill TX FIFO with as many transfers as possible */
|
||||
while (dspi->len && fifo_size--) {
|
||||
dspi->tx_cmd = xfer_cmd;
|
||||
/* Request EOQF for last transfer in FIFO */
|
||||
if (dspi->len == dspi->bytes_per_word || fifo_size == 0)
|
||||
dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ;
|
||||
|
|
|
@ -2143,8 +2143,17 @@ int spi_register_controller(struct spi_controller *ctlr)
|
|||
*/
|
||||
if (ctlr->num_chipselect == 0)
|
||||
return -EINVAL;
|
||||
if (ctlr->bus_num >= 0) {
|
||||
/* devices with a fixed bus num must check-in with the num */
|
||||
mutex_lock(&board_lock);
|
||||
id = idr_alloc(&spi_master_idr, ctlr, ctlr->bus_num,
|
||||
ctlr->bus_num + 1, GFP_KERNEL);
|
||||
mutex_unlock(&board_lock);
|
||||
if (WARN(id < 0, "couldn't get idr"))
|
||||
return id == -ENOSPC ? -EBUSY : id;
|
||||
ctlr->bus_num = id;
|
||||
} else if (ctlr->dev.of_node) {
|
||||
/* allocate dynamic bus number using Linux idr */
|
||||
if ((ctlr->bus_num < 0) && ctlr->dev.of_node) {
|
||||
id = of_alias_get_id(ctlr->dev.of_node, "spi");
|
||||
if (id >= 0) {
|
||||
ctlr->bus_num = id;
|
||||
|
|
Loading…
Reference in New Issue