Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi/bcm63xx: move message control word description to register offsets

Make the message control word parameters part of the register offsets
array so we have them all in one struct.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jonas Gorski and committed by
Mark Brown
f13a5e8a 682b5280

+12 -31
+2 -18
arch/mips/bcm63xx/dev-spi.c
··· 53 53 }, 54 54 }; 55 55 56 - static struct bcm63xx_spi_pdata spi_pdata = { 57 - .bus_num = 0, 58 - .num_chipselect = 8, 59 - }; 60 - 61 56 static struct platform_device bcm63xx_spi_device = { 62 57 .name = "bcm63xx-spi", 63 58 .id = -1, 64 59 .num_resources = ARRAY_SIZE(spi_resources), 65 60 .resource = spi_resources, 66 - .dev = { 67 - .platform_data = &spi_pdata, 68 - }, 69 61 }; 70 62 71 63 int __init bcm63xx_spi_register(void) ··· 69 77 spi_resources[0].end = spi_resources[0].start; 70 78 spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI); 71 79 72 - if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) { 80 + if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) 73 81 spi_resources[0].end += BCM_6348_RSET_SPI_SIZE - 1; 74 - spi_pdata.fifo_size = SPI_6348_MSG_DATA_SIZE; 75 - spi_pdata.msg_type_shift = SPI_6348_MSG_TYPE_SHIFT; 76 - spi_pdata.msg_ctl_width = SPI_6348_MSG_CTL_WIDTH; 77 - } 78 82 79 83 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() || 80 - BCMCPU_IS_6368()) { 84 + BCMCPU_IS_6368()) 81 85 spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1; 82 - spi_pdata.fifo_size = SPI_6358_MSG_DATA_SIZE; 83 - spi_pdata.msg_type_shift = SPI_6358_MSG_TYPE_SHIFT; 84 - spi_pdata.msg_ctl_width = SPI_6358_MSG_CTL_WIDTH; 85 - } 86 86 87 87 bcm63xx_spi_regs_init(); 88 88
+7 -9
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
··· 7 7 8 8 int __init bcm63xx_spi_register(void); 9 9 10 - struct bcm63xx_spi_pdata { 11 - unsigned int fifo_size; 12 - unsigned int msg_type_shift; 13 - unsigned int msg_ctl_width; 14 - int bus_num; 15 - int num_chipselect; 16 - }; 17 - 18 10 enum bcm63xx_regs_spi { 19 11 SPI_CMD, 20 12 SPI_INT_STATUS, ··· 20 28 SPI_MSG_CTL, 21 29 SPI_MSG_DATA, 22 30 SPI_RX_DATA, 31 + SPI_MSG_TYPE_SHIFT, 32 + SPI_MSG_CTL_WIDTH, 33 + SPI_MSG_DATA_SIZE, 23 34 }; 24 35 25 36 #define __GEN_SPI_REGS_TABLE(__cpu) \ ··· 37 42 [SPI_RX_TAIL] = SPI_## __cpu ##_RX_TAIL, \ 38 43 [SPI_MSG_CTL] = SPI_## __cpu ##_MSG_CTL, \ 39 44 [SPI_MSG_DATA] = SPI_## __cpu ##_MSG_DATA, \ 40 - [SPI_RX_DATA] = SPI_## __cpu ##_RX_DATA, 45 + [SPI_RX_DATA] = SPI_## __cpu ##_RX_DATA, \ 46 + [SPI_MSG_TYPE_SHIFT] = SPI_## __cpu ##_MSG_TYPE_SHIFT, \ 47 + [SPI_MSG_CTL_WIDTH] = SPI_## __cpu ##_MSG_CTL_WIDTH, \ 48 + [SPI_MSG_DATA_SIZE] = SPI_## __cpu ##_MSG_DATA_SIZE, 41 49 42 50 static inline unsigned long bcm63xx_spireg(enum bcm63xx_regs_spi reg) 43 51 {
+3 -4
drivers/spi/spi-bcm63xx.c
··· 329 329 { 330 330 struct resource *r; 331 331 struct device *dev = &pdev->dev; 332 - struct bcm63xx_spi_pdata *pdata = dev_get_platdata(&pdev->dev); 333 332 int irq; 334 333 struct spi_master *master; 335 334 struct clk *clk; ··· 368 369 369 370 bs->irq = irq; 370 371 bs->clk = clk; 371 - bs->fifo_size = pdata->fifo_size; 372 + bs->fifo_size = bcm63xx_spireg(SPI_MSG_DATA_SIZE); 372 373 373 374 ret = devm_request_irq(&pdev->dev, irq, bcm63xx_spi_interrupt, 0, 374 375 pdev->name, master); ··· 383 384 master->mode_bits = MODEBITS; 384 385 master->bits_per_word_mask = SPI_BPW_MASK(8); 385 386 master->auto_runtime_pm = true; 386 - bs->msg_type_shift = pdata->msg_type_shift; 387 - bs->msg_ctl_width = pdata->msg_ctl_width; 387 + bs->msg_type_shift = bcm63xx_spireg(SPI_MSG_TYPE_SHIFT); 388 + bs->msg_ctl_width = bcm63xx_spireg(SPI_MSG_CTL_WIDTH); 388 389 bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); 389 390 bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); 390 391