mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6
* 'next-spi' of git://git.secretlab.ca/git/linux-2.6: spi/xilinx: Fix compile error spi/davinci: Fix clock prescale factor computation spi: move bitbang txrx utility functions to private header spi/mpc5121: Add SPI master driver for MPC5121 PSC powerpc/mpc5121: move PSC FIFO memory init to platform code spi/ep93xx: implemented driver for Cirrus EP93xx SPI controller Documentation/spi/* compile warning fix spi/omap2_mcspi: Check params before dereference or use spi/omap2_mcspi: add turbo mode support spi/omap2_mcspi: change default DMA_MIN_BYTES value to 160 spi/pl022: fix stop queue procedure spi/pl022: add support for the PL023 derivate spi/pl022: fix up differences between ARM and ST versions spi/spi_mpc8xxx: Do not use map_tx_dma to unmap rx_dma spi/spi_mpc8xxx: Fix QE mode Litte Endian spi/spi_mpc8xxx: fix potential memory corruption.
This commit is contained in:
commit
702c0b0497
23 changed files with 2262 additions and 319 deletions
|
|
@ -397,34 +397,10 @@ static unsigned long mpc512x_getuartclk(void *p)
|
|||
return mpc5xxx_get_bus_frequency(p);
|
||||
}
|
||||
|
||||
#define DEFAULT_FIFO_SIZE 16
|
||||
|
||||
static unsigned int __init get_fifo_size(struct device_node *np,
|
||||
char *fifo_name)
|
||||
{
|
||||
const unsigned int *fp;
|
||||
|
||||
fp = of_get_property(np, fifo_name, NULL);
|
||||
if (fp)
|
||||
return *fp;
|
||||
|
||||
pr_warning("no %s property in %s node, defaulting to %d\n",
|
||||
fifo_name, np->full_name, DEFAULT_FIFO_SIZE);
|
||||
|
||||
return DEFAULT_FIFO_SIZE;
|
||||
}
|
||||
|
||||
#define FIFOC(_base) ((struct mpc512x_psc_fifo __iomem *) \
|
||||
((u32)(_base) + sizeof(struct mpc52xx_psc)))
|
||||
|
||||
/* Init PSC FIFO Controller */
|
||||
static int __init mpc512x_psc_fifoc_init(void)
|
||||
{
|
||||
struct device_node *np;
|
||||
void __iomem *psc;
|
||||
unsigned int tx_fifo_size;
|
||||
unsigned int rx_fifo_size;
|
||||
int fifobase = 0; /* current fifo address in 32 bit words */
|
||||
|
||||
np = of_find_compatible_node(NULL, NULL,
|
||||
"fsl,mpc5121-psc-fifo");
|
||||
|
|
@ -447,51 +423,6 @@ static int __init mpc512x_psc_fifoc_init(void)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
for_each_compatible_node(np, NULL, "fsl,mpc5121-psc-uart") {
|
||||
tx_fifo_size = get_fifo_size(np, "fsl,tx-fifo-size");
|
||||
rx_fifo_size = get_fifo_size(np, "fsl,rx-fifo-size");
|
||||
|
||||
/* size in register is in 4 byte units */
|
||||
tx_fifo_size /= 4;
|
||||
rx_fifo_size /= 4;
|
||||
if (!tx_fifo_size)
|
||||
tx_fifo_size = 1;
|
||||
if (!rx_fifo_size)
|
||||
rx_fifo_size = 1;
|
||||
|
||||
psc = of_iomap(np, 0);
|
||||
if (!psc) {
|
||||
pr_err("%s: Can't map %s device\n",
|
||||
__func__, np->full_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* FIFO space is 4KiB, check if requested size is available */
|
||||
if ((fifobase + tx_fifo_size + rx_fifo_size) > 0x1000) {
|
||||
pr_err("%s: no fifo space available for %s\n",
|
||||
__func__, np->full_name);
|
||||
iounmap(psc);
|
||||
/*
|
||||
* chances are that another device requests less
|
||||
* fifo space, so we continue.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
/* set tx and rx fifo size registers */
|
||||
out_be32(&FIFOC(psc)->txsz, (fifobase << 16) | tx_fifo_size);
|
||||
fifobase += tx_fifo_size;
|
||||
out_be32(&FIFOC(psc)->rxsz, (fifobase << 16) | rx_fifo_size);
|
||||
fifobase += rx_fifo_size;
|
||||
|
||||
/* reset and enable the slices */
|
||||
out_be32(&FIFOC(psc)->txcmd, 0x80);
|
||||
out_be32(&FIFOC(psc)->txcmd, 0x01);
|
||||
out_be32(&FIFOC(psc)->rxcmd, 0x80);
|
||||
out_be32(&FIFOC(psc)->rxcmd, 0x01);
|
||||
|
||||
iounmap(psc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue