summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-02-25 18:23:40 +0100
committerMark Brown <broonie@kernel.org>2022-02-28 13:10:17 +0100
commit78e27f970f73a4ee57dc050a6233e09a56963391 (patch)
tree65e6c083f3b55e35de74b103da60dd7021a365e2 /drivers/spi
parentspi: dt-bindings: remove unused required property (diff)
downloadlinux-78e27f970f73a4ee57dc050a6233e09a56963391.tar.xz
linux-78e27f970f73a4ee57dc050a6233e09a56963391.zip
spi: pxa2xx-pci: Refactor CE4100 to use ->setup()
Refactor CE4100 handling code to use ->setup() instead of spreading potentially confusing conditional. Besides that, it will allow to refactor further to avoid intermediate storage for the used configuration parameters. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220225172350.69797-1-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-pxa2xx-pci.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 6d60972e4e20..bd20379d9342 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -30,7 +30,7 @@ enum {
struct pxa_spi_info {
enum pxa_ssp_type type;
int port_id;
- int num_chipselect;
+ unsigned int num_chipselect;
unsigned long max_clk_rate;
/* DMA channel request parameters */
@@ -114,6 +114,14 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)
return 0;
}
+static int ce4100_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)
+{
+ c->num_chipselect = dev->devfn;
+ c->max_clk_rate = 3686400;
+
+ return 0;
+}
+
static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)
{
struct dw_dma_slave *tx, *rx;
@@ -163,8 +171,7 @@ static struct pxa_spi_info spi_info_configs[] = {
[PORT_CE4100] = {
.type = PXA25x_SSP,
.port_id = -1,
- .num_chipselect = -1,
- .max_clk_rate = 3686400,
+ .setup = ce4100_spi_setup,
},
[PORT_BYT] = {
.type = LPSS_BYT_SSP,
@@ -248,7 +255,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
}
memset(&spi_pdata, 0, sizeof(spi_pdata));
- spi_pdata.num_chipselect = (c->num_chipselect > 0) ? c->num_chipselect : dev->devfn;
+ spi_pdata.num_chipselect = c->num_chipselect;
spi_pdata.dma_filter = c->dma_filter;
spi_pdata.tx_param = c->tx_param;
spi_pdata.rx_param = c->rx_param;