Lines Matching +full:cpm1 +full:- +full:fsl
1 // SPDX-License-Identifier: GPL-2.0-or-later
15 #include <linux/dma-mapping.h>
28 #include "spi-fsl-lib.h"
33 type *rx = mpc8xxx_spi->rx; \
34 *rx++ = (type)(data >> mpc8xxx_spi->rx_shift); \
35 mpc8xxx_spi->rx = rx; \
43 const type *tx = mpc8xxx_spi->tx; \
46 data = *tx++ << mpc8xxx_spi->tx_shift; \
47 mpc8xxx_spi->tx = tx; \
75 return "CPM1"; in mpc8xxx_spi_strmode()
90 /* the spi->mode bits understood by this driver: */ in mpc8xxx_spi_probe()
91 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH in mpc8xxx_spi_probe()
94 master->dev.of_node = dev->of_node; in mpc8xxx_spi_probe()
97 mpc8xxx_spi->dev = dev; in mpc8xxx_spi_probe()
98 mpc8xxx_spi->get_rx = mpc8xxx_spi_rx_buf_u8; in mpc8xxx_spi_probe()
99 mpc8xxx_spi->get_tx = mpc8xxx_spi_tx_buf_u8; in mpc8xxx_spi_probe()
100 mpc8xxx_spi->flags = pdata->flags; in mpc8xxx_spi_probe()
101 mpc8xxx_spi->spibrg = pdata->sysclk; in mpc8xxx_spi_probe()
102 mpc8xxx_spi->irq = irq; in mpc8xxx_spi_probe()
104 mpc8xxx_spi->rx_shift = 0; in mpc8xxx_spi_probe()
105 mpc8xxx_spi->tx_shift = 0; in mpc8xxx_spi_probe()
107 master->bus_num = pdata->bus_num; in mpc8xxx_spi_probe()
108 master->num_chipselect = pdata->max_chipselect; in mpc8xxx_spi_probe()
110 init_completion(&mpc8xxx_spi->done); in mpc8xxx_spi_probe()
116 struct device *dev = &ofdev->dev; in of_mpc8xxx_spi_probe()
117 struct device_node *np = ofdev->dev.of_node; in of_mpc8xxx_spi_probe()
121 int ret = -ENOMEM; in of_mpc8xxx_spi_probe()
123 pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL); in of_mpc8xxx_spi_probe()
127 pdata = &pinfo->pdata; in of_mpc8xxx_spi_probe()
128 dev->platform_data = pdata; in of_mpc8xxx_spi_probe()
131 pdata->bus_num = -1; in of_mpc8xxx_spi_probe()
135 pdata->sysclk = get_brgfreq(); in of_mpc8xxx_spi_probe()
136 if (pdata->sysclk == -1) { in of_mpc8xxx_spi_probe()
137 pdata->sysclk = fsl_get_sys_freq(); in of_mpc8xxx_spi_probe()
138 if (pdata->sysclk == -1) in of_mpc8xxx_spi_probe()
139 return -ENODEV; in of_mpc8xxx_spi_probe()
142 ret = of_property_read_u32(np, "clock-frequency", &pdata->sysclk); in of_mpc8xxx_spi_probe()
148 if (prop && !strcmp(prop, "cpu-qe")) in of_mpc8xxx_spi_probe()
149 pdata->flags = SPI_QE_CPU_MODE; in of_mpc8xxx_spi_probe()
151 pdata->flags = SPI_CPM_MODE | SPI_QE; in of_mpc8xxx_spi_probe()
152 else if (of_device_is_compatible(np, "fsl,cpm2-spi")) in of_mpc8xxx_spi_probe()
153 pdata->flags = SPI_CPM_MODE | SPI_CPM2; in of_mpc8xxx_spi_probe()
154 else if (of_device_is_compatible(np, "fsl,cpm1-spi")) in of_mpc8xxx_spi_probe()
155 pdata->flags = SPI_CPM_MODE | SPI_CPM1; in of_mpc8xxx_spi_probe()