aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-03-11 10:32:44 +0000
committerFlorian Fainelli <florian@openwrt.org>2009-03-11 10:32:44 +0000
commit4b5f21833cb090fe7893e7604823ef3676a11ee6 (patch)
treed2346dc184af170e0d750edad50c83619b1a2945
parent6ee24eaca75534ebb98802820e6ef170dd72d0c5 (diff)
downloadupstream-4b5f21833cb090fe7893e7604823ef3676a11ee6.tar.gz
upstream-4b5f21833cb090fe7893e7604823ef3676a11ee6.tar.bz2
upstream-4b5f21833cb090fe7893e7604823ef3676a11ee6.zip
[brcm63xx] do not duplicate fifo_size, since RX and TX fifo sizes are the same, request_mem_region on the registers
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14848 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-spi.c12
-rw-r--r--target/linux/brcm63xx/files/drivers/spi/bcm63xx_spi.c19
-rw-r--r--target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm63xx_dev_spi.h3
3 files changed, 17 insertions, 17 deletions
diff --git a/target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-spi.c b/target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-spi.c
index bfbda2b17f..1ba4aded3a 100644
--- a/target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-spi.c
+++ b/target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-spi.c
@@ -50,15 +50,11 @@ int __init bcm63xx_spi_register(void)
spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
/* Fill in platform data */
- if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
- spi_pdata.msg_fifo_size = SPI_BCM_6338_SPI_MSG_DATA_SIZE;
- spi_pdata.rx_fifo_size = SPI_BCM_6338_SPI_RX_DATA_SIZE;
- }
+ if (BCMCPU_IS_6338() || BCMCPU_IS_6348())
+ spi_pdata.fifo_size = SPI_BCM_6338_SPI_MSG_DATA_SIZE;
- if (BCMCPU_IS_6358()) {
- spi_pdata.msg_fifo_size = SPI_BCM_6358_SPI_MSG_DATA_SIZE;
- spi_pdata.rx_fifo_size = SPI_BCM_6358_SPI_RX_DATA_SIZE;
- }
+ if (BCMCPU_IS_6358())
+ spi_pdata.fifo_size = SPI_BCM_6358_SPI_MSG_DATA_SIZE;
return platform_device_register(&bcm63xx_spi_device);
}
diff --git a/target/linux/brcm63xx/files/drivers/spi/bcm63xx_spi.c b/target/linux/brcm63xx/files/drivers/spi/bcm63xx_spi.c
index d12ae99ce6..598196197e 100644
--- a/target/linux/brcm63xx/files/drivers/spi/bcm63xx_spi.c
+++ b/target/linux/brcm63xx/files/drivers/spi/bcm63xx_spi.c
@@ -48,8 +48,7 @@ struct bcm63xx_spi {
/* Platform data */
u32 speed_hz;
- unsigned msg_fifo_size;
- unsigned rx_fifo_size;
+ unsigned fifo_size;
/* Data buffers */
const unsigned char *tx_ptr;
@@ -70,6 +69,7 @@ static void bcm63xx_spi_chipselect(struct spi_device *spi, int is_on)
val |= SPI_CMD_NOOP;
else if (is_on == BITBANG_CS_ACTIVE)
val |= (1 << spi->chip_select << SPI_CMD_DEVICE_ID_SHIFT);
+
bcm_spi_writew(val, SPI_CMD);
}
@@ -173,7 +173,7 @@ static void bcm63xx_spi_fill_tx_fifo(struct bcm63xx_spi *bs)
/* Fill the Tx FIFO with as many bytes as possible */
tail = bcm_spi_readb(SPI_MSG_TAIL);
- while ((tail < bs->msg_fifo_size) && (bs->remaining_bytes > 0)) {
+ while ((tail < bs->fifo_size) && (bs->remaining_bytes > 0)) {
if (bs->tx_ptr)
bcm_spi_writeb(*bs->tx_ptr++, SPI_MSG_DATA);
else
@@ -317,6 +317,12 @@ static int __init bcm63xx_spi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, master);
bs->pdev = pdev;
+ if (!request_mem_region(r->start,
+ r->end - r->start, PFX)) {
+ ret = -ENXIO;
+ goto out_free;
+ }
+
bs->regs = ioremap_nocache(r->start, r->end - r->start);
if (!bs->regs) {
printk(KERN_ERR PFX " unable to ioremap regs\n");
@@ -325,8 +331,7 @@ static int __init bcm63xx_spi_probe(struct platform_device *pdev)
}
bs->irq = irq;
bs->clk = clk;
- bs->msg_fifo_size = pdata->msg_fifo_size;
- bs->rx_fifo_size = pdata->rx_fifo_size;
+ bs->fifo_size = pdata->fifo_size;
ret = request_irq(irq, bcm63xx_spi_interrupt, 0,
pdev->dev.bus_id, master);
@@ -344,8 +349,8 @@ static int __init bcm63xx_spi_probe(struct platform_device *pdev)
bcm_spi_writew(SPI_CMD_HARD_RESET, SPI_CMD);
bcm_spi_writeb(SPI_INTR_CLEAR_ALL, SPI_INT_MASK);
- dev_info(&pdev->dev, PFX " at 0x%08x (irq %d) %s\n",
- r->start, irq, DRV_VER);
+ dev_info(&pdev->dev, PFX " at 0x%08x (irq %d, FIFOs size %d) v%s\n",
+ r->start, irq, bs->fifo_size, DRV_VER);
ret = spi_bitbang_start(&bs->bitbang);
if (ret) {
diff --git a/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm63xx_dev_spi.h b/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm63xx_dev_spi.h
index 879580fc9d..cfa79bf94b 100644
--- a/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm63xx_dev_spi.h
+++ b/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm63xx_dev_spi.h
@@ -6,8 +6,7 @@
int __init bcm63xx_spi_register(void);
struct bcm63xx_spi_pdata {
- unsigned int msg_fifo_size;
- unsigned int rx_fifo_size;
+ unsigned int fifo_size;
int bus_num;
int num_chipselect;
u32 speed_hz;