From 626a96db11698119a67eeda130488e869aa6f14e Mon Sep 17 00:00:00 2001 From: Mika Westerberg Date: Sun, 29 May 2011 13:10:06 +0300 Subject: spi/ep93xx: add DMA support This patch adds DMA support for the EP93xx SPI driver. By default the DMA is not enabled but it can be enabled by setting ep93xx_spi_info.use_dma to true in board configuration file. Note that the SPI driver still uses PIO for small transfers (<= 8 bytes) for performance reasons. Signed-off-by: Mika Westerberg Acked-by: H Hartley Sweeten Acked-by: Vinod Koul Signed-off-by: Grant Likely --- Documentation/spi/ep93xx_spi | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Documentation') diff --git a/Documentation/spi/ep93xx_spi b/Documentation/spi/ep93xx_spi index 6325f5b48635..d8eb01c15db1 100644 --- a/Documentation/spi/ep93xx_spi +++ b/Documentation/spi/ep93xx_spi @@ -88,6 +88,16 @@ static void __init ts72xx_init_machine(void) ARRAY_SIZE(ts72xx_spi_devices)); } +The driver can use DMA for the transfers also. In this case ts72xx_spi_info +becomes: + +static struct ep93xx_spi_info ts72xx_spi_info = { + .num_chipselect = ARRAY_SIZE(ts72xx_spi_devices), + .use_dma = true; +}; + +Note that CONFIG_EP93XX_DMA should be enabled as well. + Thanks to ========= Martin Guy, H. Hartley Sweeten and others who helped me during development of -- cgit v1.2.3 From e892bac102805f905e463a2cc7d0f870358cc1d5 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Wed, 15 Jun 2011 13:18:06 -0600 Subject: gpio/tegra: Move Tegra gpio driver to drivers/gpio As part of the gpio driver consolidation, this patch moves the Tegra driver into drivers/gpio Signed-off-by: Grant Likely --- Documentation/devicetree/bindings/spi/spi_nvidia.txt | 5 +++++ drivers/spi/spi-tegra.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi_nvidia.txt (limited to 'Documentation') diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt new file mode 100644 index 000000000000..bde450b50fcd --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi_nvidia.txt @@ -0,0 +1,5 @@ +NVIDIA Tegra 2 SPI device + +Required properties: +- compatible : should be "nvidia,tegra250-spi". +- gpios : should specify GPIOs used for chipselect. diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c index 8e30727b5221..a43ceeb1063a 100644 --- a/drivers/spi/spi-tegra.c +++ b/drivers/spi/spi-tegra.c @@ -546,6 +546,7 @@ static int __init spi_tegra_probe(struct platform_device *pdev) tspi->rx_dma_req.req_sel = spi_tegra_req_sels[pdev->id]; tspi->rx_dma_req.dev = tspi; + master->dev.of_node = pdev->dev.of_node; ret = spi_register_master(master); if (ret < 0) @@ -595,10 +596,21 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev) MODULE_ALIAS("platform:spi_tegra"); +#ifdef CONFIG_OF +static struct of_device_id spi_tegra_of_match_table[] __devinitdata = { + { .compatible = "nvidia,tegra250-spi", }, + {} +}; +MODULE_DEVICE_TABLE(of, spi_tegra_of_match_table); +#else /* CONFIG_OF */ +#define spi_tegra_of_match_table NULL +#endif /* CONFIG_OF */ + static struct platform_driver spi_tegra_driver = { .driver = { .name = "spi_tegra", .owner = THIS_MODULE, + .of_match_table = spi_tegra_of_match_table, }, .remove = __devexit_p(spi_tegra_remove), }; -- cgit v1.2.3 From a2274cedc4b33a29be6583cd757bdc0b436851ec Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Sat, 18 Jun 2011 20:02:06 +0200 Subject: spi/pxa2xx: Remove unavailable ssp_type from documentation Since commit commit 2f1a74e5a2de0459139b85af95e901448726c375 Author: eric miao Date: Wed Nov 21 18:50:53 2007 +0800 [ARM] pxa: make pxa2xx_spi driver use ssp_request()/ssp_free() the ssp_type field in struct pxa2xx_spi_master is no longer available. Signed-off-by: Stefan Schmidt Signed-off-by: Grant Likely --- Documentation/spi/pxa2xx | 5 ----- 1 file changed, 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/spi/pxa2xx b/Documentation/spi/pxa2xx index 493dada57372..00511e08db78 100644 --- a/Documentation/spi/pxa2xx +++ b/Documentation/spi/pxa2xx @@ -22,15 +22,11 @@ Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a found in include/linux/spi/pxa2xx_spi.h: struct pxa2xx_spi_master { - enum pxa_ssp_type ssp_type; u32 clock_enable; u16 num_chipselect; u8 enable_dma; }; -The "pxa2xx_spi_master.ssp_type" field must have a value between 1 and 3 and -informs the driver which features a particular SSP supports. - The "pxa2xx_spi_master.clock_enable" field is used to enable/disable the corresponding SSP peripheral block in the "Clock Enable Register (CKEN"). See the "PXA2xx Developer Manual" section "Clocks and Power Management". @@ -61,7 +57,6 @@ static struct resource pxa_spi_nssp_resources[] = { }; static struct pxa2xx_spi_master pxa_nssp_master_info = { - .ssp_type = PXA25x_NSSP, /* Type of SSP */ .clock_enable = CKEN_NSSP, /* NSSP Peripheral clock */ .num_chipselect = 1, /* Matches the number of chips attached to NSSP */ .enable_dma = 1, /* Enables NSSP DMA */ -- cgit v1.2.3 From 22032c7774a9619770a1ca92f4f895d69efff386 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 5 Jul 2011 14:18:02 -0600 Subject: spi/tegra: Use engineering names in DT compatible property Engineering names are more stable than marketing names. Hence, use them for Device Tree compatible properties instead. Signed-off-by: Stephen Warren Signed-off-by: Grant Likely --- Documentation/devicetree/bindings/spi/spi_nvidia.txt | 2 +- drivers/spi/spi-tegra.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt index bde450b50fcd..6b9e51896693 100644 --- a/Documentation/devicetree/bindings/spi/spi_nvidia.txt +++ b/Documentation/devicetree/bindings/spi/spi_nvidia.txt @@ -1,5 +1,5 @@ NVIDIA Tegra 2 SPI device Required properties: -- compatible : should be "nvidia,tegra250-spi". +- compatible : should be "nvidia,tegra20-spi". - gpios : should specify GPIOs used for chipselect. diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c index a43ceeb1063a..a5a6302dc8e0 100644 --- a/drivers/spi/spi-tegra.c +++ b/drivers/spi/spi-tegra.c @@ -598,7 +598,7 @@ MODULE_ALIAS("platform:spi_tegra"); #ifdef CONFIG_OF static struct of_device_id spi_tegra_of_match_table[] __devinitdata = { - { .compatible = "nvidia,tegra250-spi", }, + { .compatible = "nvidia,tegra20-spi", }, {} }; MODULE_DEVICE_TABLE(of, spi_tegra_of_match_table); -- cgit v1.2.3 From 22a85e4cd51b49ec99703ddfdff8686d5442a093 Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Sun, 10 Jul 2011 01:16:41 +0800 Subject: spi/imx: add device tree probe support It adds device tree probe support for spi-imx driver. Signed-off-by: Shawn Guo Cc: Grant Likely Signed-off-by: Grant Likely --- .../devicetree/bindings/spi/fsl-imx-cspi.txt | 22 +++++++++++++ drivers/spi/spi-imx.c | 38 ++++++++++++++++++---- 2 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt (limited to 'Documentation') diff --git a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt new file mode 100644 index 000000000000..9841057d112b --- /dev/null +++ b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt @@ -0,0 +1,22 @@ +* Freescale (Enhanced) Configurable Serial Peripheral Interface + (CSPI/eCSPI) for i.MX + +Required properties: +- compatible : Should be "fsl,-cspi" or "fsl,-ecspi" +- reg : Offset and length of the register set for the device +- interrupts : Should contain CSPI/eCSPI interrupt +- fsl,spi-num-chipselects : Contains the number of the chipselect +- cs-gpios : Specifies the gpio pins to be used for chipselects. + +Example: + +ecspi@70010000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,imx51-ecspi"; + reg = <0x70010000 0x4000>; + interrupts = <36>; + fsl,spi-num-chipselects = <2>; + cs-gpios = <&gpio3 24 0>, /* GPIO4_24 */ + <&gpio3 25 0>; /* GPIO4_25 */ +}; diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 591ebc3546d6..8ac6542aedcd 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -34,6 +34,9 @@ #include #include #include +#include +#include +#include #include @@ -604,6 +607,16 @@ static struct platform_device_id spi_imx_devtype[] = { } }; +static const struct of_device_id spi_imx_dt_ids[] = { + { .compatible = "fsl,imx1-cspi", .data = &imx1_cspi_devtype_data, }, + { .compatible = "fsl,imx21-cspi", .data = &imx21_cspi_devtype_data, }, + { .compatible = "fsl,imx27-cspi", .data = &imx27_cspi_devtype_data, }, + { .compatible = "fsl,imx31-cspi", .data = &imx31_cspi_devtype_data, }, + { .compatible = "fsl,imx35-cspi", .data = &imx35_cspi_devtype_data, }, + { .compatible = "fsl,imx51-ecspi", .data = &imx51_ecspi_devtype_data, }, + { /* sentinel */ } +}; + static void spi_imx_chipselect(struct spi_device *spi, int is_active) { struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); @@ -737,19 +750,25 @@ static void spi_imx_cleanup(struct spi_device *spi) static int __devinit spi_imx_probe(struct platform_device *pdev) { - struct spi_imx_master *mxc_platform_info; + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *of_id = + of_match_device(spi_imx_dt_ids, &pdev->dev); + struct spi_imx_master *mxc_platform_info = + dev_get_platdata(&pdev->dev); struct spi_master *master; struct spi_imx_data *spi_imx; struct resource *res; int i, ret, num_cs; - mxc_platform_info = dev_get_platdata(&pdev->dev); - if (!mxc_platform_info) { + if (!np && !mxc_platform_info) { dev_err(&pdev->dev, "can't get the platform data\n"); return -EINVAL; } - num_cs = mxc_platform_info->num_chipselect; + ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs); + if (ret < 0) + num_cs = mxc_platform_info->num_chipselect; + master = spi_alloc_master(&pdev->dev, sizeof(struct spi_imx_data) + sizeof(int) * num_cs); if (!master) @@ -764,9 +783,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) spi_imx->bitbang.master = spi_master_get(master); for (i = 0; i < master->num_chipselect; i++) { - spi_imx->chipselect[i] = mxc_platform_info->chipselect[i]; - if (spi_imx->chipselect[i] < 0) + int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); + if (cs_gpio < 0) + cs_gpio = mxc_platform_info->chipselect[i]; + if (cs_gpio < 0) continue; + spi_imx->chipselect[i] = cs_gpio; ret = gpio_request(spi_imx->chipselect[i], DRIVER_NAME); if (ret) { while (i > 0) { @@ -788,7 +810,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) init_completion(&spi_imx->xfer_done); - spi_imx->devtype_data = + spi_imx->devtype_data = of_id ? of_id->data : (struct spi_imx_devtype_data *) pdev->id_entry->driver_data; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -836,6 +858,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) spi_imx->devtype_data->intctrl(spi_imx, 0); + master->dev.of_node = pdev->dev.of_node; ret = spi_bitbang_start(&spi_imx->bitbang); if (ret) { dev_err(&pdev->dev, "bitbang start failed with %d\n", ret); @@ -898,6 +921,7 @@ static struct platform_driver spi_imx_driver = { .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, + .of_match_table = spi_imx_dt_ids, }, .id_table = spi_imx_devtype, .probe = spi_imx_probe, -- cgit v1.2.3