Merge remote-tracking branches 'spi/topic/loopback', 'spi/topic/omap2-mcspi', 'spi/topic/orion', 'spi/topic/pl022' and 'spi/topic/sc18is602' into spi-next
This commit is contained in:
commit
fbdd1b2aff
|
@ -30,7 +30,10 @@ contain the following properties.
|
|||
0: SPI
|
||||
1: Texas Instruments Synchronous Serial Frame Format
|
||||
2: Microwire (Half Duplex)
|
||||
- pl022,com-mode : polling, interrupt or dma
|
||||
- pl022,com-mode : specifies the transfer mode:
|
||||
0: interrupt mode
|
||||
1: polling mode (default mode if property not present)
|
||||
2: DMA mode
|
||||
- pl022,rx-level-trig : Rx FIFO watermark level
|
||||
- pl022,tx-level-trig : Tx FIFO watermark level
|
||||
- pl022,ctrl-len : Microwire interface: Control length
|
||||
|
@ -56,9 +59,7 @@ Example:
|
|||
spi-max-frequency = <12000000>;
|
||||
spi-cpol;
|
||||
spi-cpha;
|
||||
pl022,hierarchy = <0>;
|
||||
pl022,interface = <0>;
|
||||
pl022,slave-tx-disable;
|
||||
pl022,com-mode = <0x2>;
|
||||
pl022,rx-level-trig = <0>;
|
||||
pl022,tx-level-trig = <0>;
|
||||
|
@ -67,4 +68,3 @@ Example:
|
|||
pl022,duplex = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
#include "spi-test.h"
|
||||
|
@ -55,6 +56,18 @@ module_param(run_only_test, int, 0);
|
|||
MODULE_PARM_DESC(run_only_test,
|
||||
"only run the test with this number (0-based !)");
|
||||
|
||||
/* use vmalloc'ed buffers */
|
||||
int use_vmalloc;
|
||||
module_param(use_vmalloc, int, 0644);
|
||||
MODULE_PARM_DESC(use_vmalloc,
|
||||
"use vmalloc'ed buffers instead of kmalloc'ed");
|
||||
|
||||
/* check rx ranges */
|
||||
int check_ranges = 1;
|
||||
module_param(check_ranges, int, 0644);
|
||||
MODULE_PARM_DESC(check_ranges,
|
||||
"checks rx_buffer pattern are valid");
|
||||
|
||||
/* the actual tests to execute */
|
||||
static struct spi_test spi_tests[] = {
|
||||
{
|
||||
|
@ -492,9 +505,11 @@ static int spi_test_check_loopback_result(struct spi_device *spi,
|
|||
int ret;
|
||||
|
||||
/* checks rx_buffer pattern are valid with loopback or without */
|
||||
ret = spi_check_rx_ranges(spi, msg, rx);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (check_ranges) {
|
||||
ret = spi_check_rx_ranges(spi, msg, rx);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* if we run without loopback, then return now */
|
||||
if (!loopback)
|
||||
|
@ -965,13 +980,19 @@ int spi_test_run_tests(struct spi_device *spi,
|
|||
/* allocate rx/tx buffers of 128kB size without devm
|
||||
* in the hope that is on a page boundary
|
||||
*/
|
||||
rx = kzalloc(SPI_TEST_MAX_SIZE_PLUS, GFP_KERNEL);
|
||||
if (use_vmalloc)
|
||||
rx = vmalloc(SPI_TEST_MAX_SIZE_PLUS);
|
||||
else
|
||||
rx = kzalloc(SPI_TEST_MAX_SIZE_PLUS, GFP_KERNEL);
|
||||
if (!rx) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
tx = kzalloc(SPI_TEST_MAX_SIZE_PLUS, GFP_KERNEL);
|
||||
if (use_vmalloc)
|
||||
tx = vmalloc(SPI_TEST_MAX_SIZE_PLUS);
|
||||
else
|
||||
tx = kzalloc(SPI_TEST_MAX_SIZE_PLUS, GFP_KERNEL);
|
||||
if (!tx) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
|
@ -999,8 +1020,8 @@ int spi_test_run_tests(struct spi_device *spi,
|
|||
}
|
||||
|
||||
out:
|
||||
kfree(rx);
|
||||
kfree(tx);
|
||||
kvfree(rx);
|
||||
kvfree(tx);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(spi_test_run_tests);
|
||||
|
|
|
@ -454,6 +454,8 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
|
|||
int elements = 0;
|
||||
int word_len, element_count;
|
||||
struct omap2_mcspi_cs *cs = spi->controller_state;
|
||||
void __iomem *chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
|
||||
|
||||
mcspi = spi_master_get_devdata(spi->master);
|
||||
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
|
||||
count = xfer->len;
|
||||
|
@ -549,8 +551,8 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
|
|||
if (l & OMAP2_MCSPI_CHCONF_TURBO) {
|
||||
elements--;
|
||||
|
||||
if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0)
|
||||
& OMAP2_MCSPI_CHSTAT_RXS)) {
|
||||
if (!mcspi_wait_for_reg_bit(chstat_reg,
|
||||
OMAP2_MCSPI_CHSTAT_RXS)) {
|
||||
u32 w;
|
||||
|
||||
w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0);
|
||||
|
@ -568,8 +570,7 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
|
|||
return count;
|
||||
}
|
||||
}
|
||||
if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0)
|
||||
& OMAP2_MCSPI_CHSTAT_RXS)) {
|
||||
if (!mcspi_wait_for_reg_bit(chstat_reg, OMAP2_MCSPI_CHSTAT_RXS)) {
|
||||
u32 w;
|
||||
|
||||
w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0);
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
|
||||
#define ORION_SPI_IF_CTRL_REG 0x00
|
||||
#define ORION_SPI_IF_CONFIG_REG 0x04
|
||||
#define ORION_SPI_IF_RXLSBF BIT(14)
|
||||
#define ORION_SPI_IF_TXLSBF BIT(13)
|
||||
#define ORION_SPI_DATA_OUT_REG 0x08
|
||||
#define ORION_SPI_DATA_IN_REG 0x0c
|
||||
#define ORION_SPI_INT_CAUSE_REG 0x10
|
||||
|
@ -234,6 +236,11 @@ orion_spi_mode_set(struct spi_device *spi)
|
|||
reg |= ORION_SPI_MODE_CPOL;
|
||||
if (spi->mode & SPI_CPHA)
|
||||
reg |= ORION_SPI_MODE_CPHA;
|
||||
if (spi->mode & SPI_LSB_FIRST)
|
||||
reg |= ORION_SPI_IF_RXLSBF | ORION_SPI_IF_TXLSBF;
|
||||
else
|
||||
reg &= ~(ORION_SPI_IF_RXLSBF | ORION_SPI_IF_TXLSBF);
|
||||
|
||||
writel(reg, spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
|
||||
}
|
||||
|
||||
|
@ -591,8 +598,8 @@ static int orion_spi_probe(struct platform_device *pdev)
|
|||
master->bus_num = cell_index;
|
||||
}
|
||||
|
||||
/* we support only mode 0, and no options */
|
||||
master->mode_bits = SPI_CPHA | SPI_CPOL;
|
||||
/* we support all 4 SPI modes and LSB first option */
|
||||
master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST;
|
||||
master->set_cs = orion_spi_set_cs;
|
||||
master->transfer_one = orion_spi_transfer_one;
|
||||
master->num_chipselect = ORION_NUM_CHIPSELECTS;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <linux/i2c.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_data/sc18is602.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
|
@ -271,7 +272,10 @@ static int sc18is602_probe(struct i2c_client *client,
|
|||
hw->dev = dev;
|
||||
hw->ctrl = 0xff;
|
||||
|
||||
hw->id = id->driver_data;
|
||||
if (client->dev.of_node)
|
||||
hw->id = (enum chips)of_device_get_match_data(&client->dev);
|
||||
else
|
||||
hw->id = id->driver_data;
|
||||
|
||||
switch (hw->id) {
|
||||
case sc18is602:
|
||||
|
@ -323,9 +327,27 @@ static const struct i2c_device_id sc18is602_id[] = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(i2c, sc18is602_id);
|
||||
|
||||
static const struct of_device_id sc18is602_of_match[] = {
|
||||
{
|
||||
.compatible = "nxp,sc18is602",
|
||||
.data = (void *)sc18is602
|
||||
},
|
||||
{
|
||||
.compatible = "nxp,sc18is602b",
|
||||
.data = (void *)sc18is602b
|
||||
},
|
||||
{
|
||||
.compatible = "nxp,sc18is603",
|
||||
.data = (void *)sc18is603
|
||||
},
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sc18is602_of_match);
|
||||
|
||||
static struct i2c_driver sc18is602_driver = {
|
||||
.driver = {
|
||||
.name = "sc18is602",
|
||||
.of_match_table = of_match_ptr(sc18is602_of_match),
|
||||
},
|
||||
.probe = sc18is602_probe,
|
||||
.id_table = sc18is602_id,
|
||||
|
|
Loading…
Reference in New Issue