[PATCH 0/3] spi: s3c64xx: fix the driver to use cs-gpios property
Current SPI core has generic implementation for configuring the Chip select gpios during .setup() .cleanup(). By modifying the spi-s3c64xx.c driver to expect the cs-gpios property in SPI device node instead of the subnode controller-data. This way we can avoid parsing the cs-gpios in the driver. This patch set also does the following 1. Validate the struct s3c64xx_spi_csinfo *cs object and the CS gpio for both DT and NON-DT before using them. 2. Correct the dt-bindings for exynos4210-smdkv310.dts, exynos4412-trats2.dts and exynos5250-smdk5250.dts 3. Updates the DT bindings. Note: This patchset is a rework of the changes under review @ http://www.mail-archive.com/devicetree@vger.kernel.org/msg34501.html Tested on Exynos5420 and Exynos5250 based Peach PIT, PI and Snow boards respectively using the flashrom utility to access SPI flash. This patchset is needed by the changes http://www.gossamer-threads.com/lists/linux/kernel/1951607 Tested-by on boards based on Exynos4, S5P, S3C series SoCs would be appreciated. Naveen Krishna Chatradhi (3): spi: s3c64xx: move property cs-gpio from controller_data subnode to SPI DT node spi: s3c64xx: validate s3c64xx_spi_csinfo before using ARM: DTS: fix the chip select gpios definition in the SPI nodes .../devicetree/bindings/spi/spi-samsung.txt| 10 arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts|2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- drivers/spi/spi-s3c64xx.c | 27 +++- 5 files changed, 17 insertions(+), 26 deletions(-) -- 1.7.9.5 -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 2/3] spi: s3c64xx: validate s3c64xx_spi_csinfo before using
This patch validates the cs-line (Chip select gpio) and struct s3c64xx_spi_csinfo *cs object for both DT and NON-DT platforms before using in .setup(). Also, check gpio_is_valid(spi-cs_gpio) in cleanup() before freeing up. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org --- drivers/spi/spi-s3c64xx.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 72bfba6..8971076 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -773,12 +773,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( /* The CS line is asserted/deasserted by the gpio pin */ cs-line = spi-cs_gpio; - if (!gpio_is_valid(cs-line)) { - dev_err(spi-dev, chip select gpio is not specified or invalid\n); - kfree(cs); - return ERR_PTR(-EINVAL); - } - data_np = of_get_child_by_name(slave_np, controller-data); if (!data_np) { dev_err(spi-dev, child node 'controller-data' not found\n); @@ -805,15 +799,14 @@ static int s3c64xx_spi_setup(struct spi_device *spi) int err; sdd = spi_master_get_devdata(spi-master); - if (!cs spi-dev.of_node) { + if (spi-dev.of_node) cs = s3c64xx_get_slave_ctrldata(spi); - spi-controller_data = cs; - } - if (IS_ERR_OR_NULL(cs)) { + if (IS_ERR_OR_NULL(cs) || !gpio_is_valid(cs-line)) { dev_err(spi-dev, No CS for SPI(%d)\n, spi-chip_select); return -ENODEV; } + spi-controller_data = cs; if (!spi_get_ctldata(spi)) { /* Request gpio only if cs line is asserted by gpio pins */ @@ -898,7 +891,7 @@ static void s3c64xx_spi_cleanup(struct spi_device *spi) struct s3c64xx_spi_driver_data *sdd; sdd = spi_master_get_devdata(spi-master); - if (spi-cs_gpio) { + if (gpio_is_valid(spi-cs_gpio)) { gpio_free(spi-cs_gpio); if (spi-dev.of_node) kfree(cs); -- 1.7.9.5 -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 1/3] spi: s3c64xx: move cs-gpio from subnode to SPI DT node
This patch modifies the spi-s3c64xx.c driver to fetch the Chip select or Slave select gpio line property cs-gpios from SPI node instead of controller_data subnode. Rename the property cs-gpio to cs-gpios in accordance with the SPI core. Such that s3c64xx.c can use spi-cs_gpio instead of parsing the property in the driver. Update the dt-bindings ion spi/spi-samsung.txt Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- This patch is a rework of the change @ http://www.mail-archive.com/devicetree@vger.kernel.org/msg34500.html I'm not sure if i can carry forward the other Signed-offs and Tested-bys .../devicetree/bindings/spi/spi-samsung.txt| 10 +- drivers/spi/spi-s3c64xx.c | 18 -- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt index 655b665..ff3c4c9 100644 --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt @@ -39,15 +39,15 @@ Optional Board Specific Properties: - num-cs: Specifies the number of chip select lines supported. If not specified, the default number of chip select lines is set to 1. +- cs-gpios: A gpio specifier that specifies the gpio line used as + the slave select line by the spi controller. The format of the gpio + specifier depends on the gpio controller (Also read spi-bus.txt). + SPI Controller specific data in SPI slave nodes: - The spi slave nodes should provide the following information which is required by the spi controller. - - cs-gpio: A gpio specifier that specifies the gpio line used as -the slave select line by the spi controller. The format of the gpio -specifier depends on the gpio controller. - - samsung,spi-feedback-delay: The sampling phase shift to be applied on the miso line (to account for any lag in the miso line). The following are the valid values. @@ -85,6 +85,7 @@ Example: #size-cells = 0; pinctrl-names = default; pinctrl-0 = spi0_bus; + cs-gpios = gpa2 5 1 0 3; w25q80bw@0 { #address-cells = 1; @@ -94,7 +95,6 @@ Example: spi-max-frequency = 1; controller-data { - cs-gpio = gpa2 5 1 0 3; samsung,spi-feedback-delay = 0; }; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 75a5696..72bfba6 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -764,12 +764,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( return ERR_PTR(-EINVAL); } - data_np = of_get_child_by_name(slave_np, controller-data); - if (!data_np) { - dev_err(spi-dev, child node 'controller-data' not found\n); - return ERR_PTR(-EINVAL); - } - cs = kzalloc(sizeof(*cs), GFP_KERNEL); if (!cs) { of_node_put(data_np); @@ -777,13 +771,17 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( } /* The CS line is asserted/deasserted by the gpio pin */ - if (sdd-cs_gpio) - cs-line = of_get_named_gpio(data_np, cs-gpio, 0); + cs-line = spi-cs_gpio; if (!gpio_is_valid(cs-line)) { dev_err(spi-dev, chip select gpio is not specified or invalid\n); kfree(cs); - of_node_put(data_np); + return ERR_PTR(-EINVAL); + } + + data_np = of_get_child_by_name(slave_np, controller-data); + if (!data_np) { + dev_err(spi-dev, child node 'controller-data' not found\n); return ERR_PTR(-EINVAL); } @@ -1077,7 +1075,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd-sfr_start = mem_res-start; sdd-cs_gpio = true; if (pdev-dev.of_node) { - if (!of_find_property(pdev-dev.of_node, cs-gpio, NULL)) + if (!of_find_property(pdev-dev.of_node, cs-gpios, NULL)) sdd-cs_gpio = false; ret = of_alias_get_id(pdev-dev.of_node, spi); -- 1.7.9.5 -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds ___ spi-devel-general mailing list spi
[PATCH 3/3] ARM: DTS: fix the chip select gpios definition in the SPI nodes
This patch replaces the cs-gpio from controller-data node as was specified in the old binding and use the standard cs-gpios property expected by the SPI core as is defined in the new binding. Respective changes are preposed to spi-s3c64xx.c driver. @ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Reviewed-by: Javier Martinez Canillas javier.marti...@collabora.co.uk Reviewed-by: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- This change is being reviewed @ http://www.mail-archive.com/devicetree@vger.kernel.org/msg34498.html arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts |2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index 636d166..676e6e0 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts @@ -168,6 +168,7 @@ }; spi_2: spi@1394 { + cs-gpios = gpc1 2 0; status = okay; w25x80@0 { @@ -178,7 +179,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpc1 2 0; samsung,spi-feedback-delay = 0; }; diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 7787844..11967f4 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -589,6 +589,7 @@ spi_1: spi@1393 { pinctrl-names = default; pinctrl-0 = spi1_bus; + cs-gpios = gpb 5 0; status = okay; s5c73m3_spi: s5c73m3 { @@ -596,7 +597,6 @@ spi-max-frequency = 5000; reg = 0; controller-data { - cs-gpio = gpb 5 0; samsung,spi-feedback-delay = 2; }; }; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a794a70..0c6433a 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -316,6 +316,7 @@ }; spi_1: spi@12d3 { + cs-gpios = gpa2 5 0; status = okay; w25q80bw@0 { @@ -326,7 +327,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpa2 5 0; samsung,spi-feedback-delay = 0; }; -- 1.7.9.5 -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 1/3 v6] spi: s3c64xx: fix broken cs_gpios usage in the driver
Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin) spi-s3c64xx.c driver expects 1. chip select gpios from cs-gpio(singular) under the controller-data node of the client/slave device of the SPI. 2. cs-gpio(singular) entry to be present in the SPI device node. Eg of current broken usage: spi_1 { cs-gpio ; /* this entry is checked during probe */ ... slave_node { controller-data { cs-gpio gpioa2 5 0; /* This field is parsed during .setup() */ } }; }; The following dts files which were using this driver. But, din't have the cs-gpio entry under SPI node. -- arch/arm/boot/dts/exynos4210-smdkv310.dts -- arch/arm/boot/dts/exynos4412-trats2.dts -- arch/arm/boot/dts/exynos5250-smdk5250.dts Also, the SPI core and many drivers moved on to using cs-gpios from SPI node and removed the gpio handling code from drivers (including spi-s3c64xx.c). Hence, spi-s3c64xx.c is broken since Jun 21 11:26:12 2013 and considering the time with no compliants about the breakage. We are assuming it is safe to remove the cs-gpio(singular) usage from device tree binding of spi-samsung.txt and makes appropriate changes in the driver to use cs-gpios(plural) from SPI device node. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Reviewed-by: Javier Martinez Canillas javier.marti...@collabora.co.uk Tested-by: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- Changes since v5: Fixed the making a GPIO chip select mandatory bug. Changes since v4: 1. Added reviewed by from Javier and Tested by from Doug Changes since v3: 1. Remove the sdd-cs_gpio and use gpio_is_valid(spi-cs_gpio) instead 2. Keep cs-line only for Non-DT platforms and use spi-cs_gpio for DT platforms .../devicetree/bindings/spi/spi-samsung.txt|8 ++--- drivers/spi/spi-s3c64xx.c | 38 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt index 655b665..792efba 100644 --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt @@ -39,15 +39,13 @@ Optional Board Specific Properties: - num-cs: Specifies the number of chip select lines supported. If not specified, the default number of chip select lines is set to 1. +- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt) + SPI Controller specific data in SPI slave nodes: - The spi slave nodes should provide the following information which is required by the spi controller. - - cs-gpio: A gpio specifier that specifies the gpio line used as -the slave select line by the spi controller. The format of the gpio -specifier depends on the gpio controller. - - samsung,spi-feedback-delay: The sampling phase shift to be applied on the miso line (to account for any lag in the miso line). The following are the valid values. @@ -85,6 +83,7 @@ Example: #size-cells = 0; pinctrl-names = default; pinctrl-0 = spi0_bus; + cs-gpios = gpa2 5 0; w25q80bw@0 { #address-cells = 1; @@ -94,7 +93,6 @@ Example: spi-max-frequency = 1; controller-data { - cs-gpio = gpa2 5 1 0 3; samsung,spi-feedback-delay = 0; }; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 75a5696..b61ff3d 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data { struct s3c64xx_spi_dma_data tx_dma; struct s3c64xx_spi_port_config *port_conf; unsigned intport_id; - boolcs_gpio; }; static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) @@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( return ERR_PTR(-ENOMEM); } - /* The CS line is asserted/deasserted by the gpio pin */ - if (sdd-cs_gpio) - cs-line = of_get_named_gpio(data_np, cs-gpio, 0); - - if (!gpio_is_valid(cs-line)) { - dev_err(spi-dev, chip select gpio is not specified or invalid\n); - kfree(cs); - of_node_put(data_np); - return ERR_PTR(-EINVAL); - } - of_property_read_u32(data_np, samsung,spi-feedback-delay, fb_delay); cs-fb_delay = fb_delay; of_node_put(data_np); @@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi) spi-controller_data = cs; } + /* For the non-DT platforms derive
[PATCH 0/3 v6] spi: s3c64xx: use cs-gpios in spi node instead of cs-gpio
Currently, spi-s3c64xx.c needs cs-gpio chip select GPIO to be defined under controller-data node under each slave node. spi_x { cs-gpios ; ... slave_node { controller-data { cs-gpio = ; ... }; ... }; ... }; Where as, SPI core and many other drivers uses cs-gpios for from device tree node. Hence, make changes in spi-s3c64xx.c driver to make use of cs-gpios from SPI node(parent) instead of cs-gpio defined in slaves controller-data(child) node. Also, fixes a compilation warning and corrects the DTS nodes for Exynos4210 based SMDKv310, Exynos4412 based Trats2, Exynos5250 based SMDK5250 boards. Changes since v5: 1. Fixed the making a GPIO chip select mandatory bug. Naveen Krishna Chatradhi (3): spi: s3c64xx: fix broken cs_gpios usage in the driver spi: s3c64xx: for DT platofrms always get the chipselect info from DT node ARM: DTS: fix the chip select gpios definition in the SPI nodes .../devicetree/bindings/spi/spi-samsung.txt|8 ++-- arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts|2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- drivers/spi/spi-s3c64xx.c | 41 5 files changed, 22 insertions(+), 33 deletions(-) -- 1.7.9.5 -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck#174; Code Sight#153; - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 2/3 v6] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
Use controller_data structure only for the Non Device tree platforms. For Device tree platforms, always derive the chipselect info from DT node. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Reviewed-by: Javier Martinez Canillas javier.marti...@collabora.co.uk Tested-by: Doug Anderson diand...@chromium.org --- Changes since v5: None Changes since v4: 1. Added reviewed by from Javier and Tested by from Doug Changes since v3: New change drivers/spi/spi-s3c64xx.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index b61ff3d..a4b1af0 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi) int err; sdd = spi_master_get_devdata(spi-master); - if (!cs spi-dev.of_node) { + if (spi-dev.of_node) { cs = s3c64xx_get_slave_ctrldata(spi); spi-controller_data = cs; - } - - /* For the non-DT platforms derive chip selects from controller data */ - if (!spi-dev.of_node) + } else { + /* For the non-DT platforms derive chip +* selects from controller data +*/ spi-cs_gpio = cs-line; + } if (IS_ERR_OR_NULL(cs)) { dev_err(spi-dev, No CS for SPI(%d)\n, spi-chip_select); -- 1.7.9.5 -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck#174; Code Sight#153; - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 3/3 v6] ARM: DTS: fix the chip select gpios definition in the SPI nodes
This patch replaces the cs-gpio from controller-data node as was specified in the old binding and use the standard cs-gpios property expected by the SPI core as is defined in the new binding. Respective changes are preposed to spi-s3c64xx.c driver. @ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Reviewed-by: Javier Martinez Canillas javier.marti...@collabora.co.uk Reviewed-by: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- Changes since v5: None Changes since v4: 1. Added reviewed by from Javier and Doug. 2. Maintained the status and cs-gpios ordering Changes since v3: None arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts |2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index 636d166..676e6e0 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts @@ -168,6 +168,7 @@ }; spi_2: spi@1394 { + cs-gpios = gpc1 2 0; status = okay; w25x80@0 { @@ -178,7 +179,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpc1 2 0; samsung,spi-feedback-delay = 0; }; diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 7787844..11967f4 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -589,6 +589,7 @@ spi_1: spi@1393 { pinctrl-names = default; pinctrl-0 = spi1_bus; + cs-gpios = gpb 5 0; status = okay; s5c73m3_spi: s5c73m3 { @@ -596,7 +597,6 @@ spi-max-frequency = 5000; reg = 0; controller-data { - cs-gpio = gpb 5 0; samsung,spi-feedback-delay = 2; }; }; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a794a70..0c6433a 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -316,6 +316,7 @@ }; spi_1: spi@12d3 { + cs-gpios = gpa2 5 0; status = okay; w25q80bw@0 { @@ -326,7 +327,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpa2 5 0; samsung,spi-feedback-delay = 0; }; -- 1.7.9.5 -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck#174; Code Sight#153; - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 1/3 v4] spi: s3c64xx: fix broken cs_gpios usage in the driver
Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin) spi-s3c64xx.c driver expects 1. chip select gpios from cs-gpio(singular) under the controller-data node of the client/slave device of the SPI. 2. cs-gpio(singular) entry to be present in the SPI device node. Eg of current broken usage: spi_1 { cs-gpio ; /* this entry is checked during probe */ ... slave_node { controller-data { cs-gpio gpioa2 5 0; /* This field is parsed during .setup() */ } }; }; The following dts files which were using this driver. But, din't have the cs-gpio entry under SPI node. -- arch/arm/boot/dts/exynos4210-smdkv310.dts -- arch/arm/boot/dts/exynos4412-trats2.dts -- arch/arm/boot/dts/exynos5250-smdk5250.dts Also, the SPI core and many drivers moved on to using cs-gpios from SPI node and removed the gpio handling code from drivers (including spi-s3c64xx.c). Hence, spi-s3c64xx.c is broken since Jun 21 11:26:12 2013 and considering the time with no compliants about the breakage. We are assuming it is safe to remove the cs-gpio(singular) usage from device tree binding of spi-samsung.txt and makes appropriate changes in the driver to use cs-gpios(plural) from SPI device node. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- .../devicetree/bindings/spi/spi-samsung.txt|8 ++-- drivers/spi/spi-s3c64xx.c | 41 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt index 86aa061..2d29dac 100644 --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt @@ -42,15 +42,13 @@ Optional Board Specific Properties: - num-cs: Specifies the number of chip select lines supported. If not specified, the default number of chip select lines is set to 1. +- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt) + SPI Controller specific data in SPI slave nodes: - The spi slave nodes should provide the following information which is required by the spi controller. - - cs-gpio: A gpio specifier that specifies the gpio line used as -the slave select line by the spi controller. The format of the gpio -specifier depends on the gpio controller. - - samsung,spi-feedback-delay: The sampling phase shift to be applied on the miso line (to account for any lag in the miso line). The following are the valid values. @@ -85,6 +83,7 @@ Example: #size-cells = 0; pinctrl-names = default; pinctrl-0 = spi0_bus; + cs-gpios = gpa2 5 0; w25q80bw@0 { #address-cells = 1; @@ -94,7 +93,6 @@ Example: spi-max-frequency = 1; controller-data { - cs-gpio = gpa2 5 1 0 3; samsung,spi-feedback-delay = 0; }; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 75a5696..b888c66 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data { struct s3c64xx_spi_dma_data tx_dma; struct s3c64xx_spi_port_config *port_conf; unsigned intport_id; - boolcs_gpio; }; static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) @@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( return ERR_PTR(-ENOMEM); } - /* The CS line is asserted/deasserted by the gpio pin */ - if (sdd-cs_gpio) - cs-line = of_get_named_gpio(data_np, cs-gpio, 0); - - if (!gpio_is_valid(cs-line)) { - dev_err(spi-dev, chip select gpio is not specified or invalid\n); - kfree(cs); - of_node_put(data_np); - return ERR_PTR(-EINVAL); - } - of_property_read_u32(data_np, samsung,spi-feedback-delay, fb_delay); cs-fb_delay = fb_delay; of_node_put(data_np); @@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi) spi-controller_data = cs; } + /* For the non-DT platforms derive chip selects from controller data */ + if (!spi-dev.of_node) + spi-cs_gpio = cs-line; + if (IS_ERR_OR_NULL(cs)) { dev_err(spi-dev, No CS for SPI(%d)\n, spi-chip_select); return -ENODEV; @@ -819,17 +811,19 @@ static int s3c64xx_spi_setup(struct spi_device *spi
[PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
Use controller_data structure only for the Non Device tree platforms. For Device tree platforms, always derive the chipselect info from DT node. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- drivers/spi/spi-s3c64xx.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index b888c66..f27e15d 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi) int err; sdd = spi_master_get_devdata(spi-master); - if (!cs spi-dev.of_node) { + if (spi-dev.of_node) { cs = s3c64xx_get_slave_ctrldata(spi); spi-controller_data = cs; - } - - /* For the non-DT platforms derive chip selects from controller data */ - if (!spi-dev.of_node) + } else { + /* For the non-DT platforms derive chip +* selects from controller data +*/ spi-cs_gpio = cs-line; + } if (IS_ERR_OR_NULL(cs)) { dev_err(spi-dev, No CS for SPI(%d)\n, spi-chip_select); -- 1.7.9.5 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 3/3 v4] ARM: DTS: fix the chip select gpios definition in the SPI nodes
This patch replaces the cs-gpio from controller-data node as was specified in the old binding and use the standard cs-gpios property expected by the SPI core as is defined in the new binding. Respective changes are preposed to spi-s3c64xx.c driver. @ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts |2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index 636d166..9191491 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts @@ -169,6 +169,7 @@ spi_2: spi@1394 { status = okay; + cs-gpios = gpc1 2 0; w25x80@0 { #address-cells = 1; @@ -178,7 +179,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpc1 2 0; samsung,spi-feedback-delay = 0; }; diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 8a558b7..204b0de 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -512,6 +512,7 @@ spi_1: spi@1393 { pinctrl-names = default; pinctrl-0 = spi1_bus; + cs-gpios = gpb 5 0; status = okay; s5c73m3_spi: s5c73m3 { @@ -519,7 +520,6 @@ spi-max-frequency = 5000; reg = 0; controller-data { - cs-gpio = gpb 5 0; samsung,spi-feedback-delay = 2; }; }; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a794a70..0c6433a 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -316,6 +316,7 @@ }; spi_1: spi@12d3 { + cs-gpios = gpa2 5 0; status = okay; w25q80bw@0 { @@ -326,7 +327,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpa2 5 0; samsung,spi-feedback-delay = 0; }; -- 1.7.9.5 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 3/3 v5] ARM: DTS: fix the chip select gpios definition in the SPI nodes
This patch replaces the cs-gpio from controller-data node as was specified in the old binding and use the standard cs-gpios property expected by the SPI core as is defined in the new binding. Respective changes are preposed to spi-s3c64xx.c driver. @ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Reviewed-by: Javier Martinez Canillas javier.marti...@collabora.co.uk Reviewed-by: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- Changes since v4: 1. Added reviewed by from Javier and Doug. 2. Maintained the status and cs-gpios ordering Changes since v3: None arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts |2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index 636d166..676e6e0 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts @@ -168,6 +168,7 @@ }; spi_2: spi@1394 { + cs-gpios = gpc1 2 0; status = okay; w25x80@0 { @@ -178,7 +179,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpc1 2 0; samsung,spi-feedback-delay = 0; }; diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 8a558b7..204b0de 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -512,6 +512,7 @@ spi_1: spi@1393 { pinctrl-names = default; pinctrl-0 = spi1_bus; + cs-gpios = gpb 5 0; status = okay; s5c73m3_spi: s5c73m3 { @@ -519,7 +520,6 @@ spi-max-frequency = 5000; reg = 0; controller-data { - cs-gpio = gpb 5 0; samsung,spi-feedback-delay = 2; }; }; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a794a70..0c6433a 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -316,6 +316,7 @@ }; spi_1: spi@12d3 { + cs-gpios = gpa2 5 0; status = okay; w25q80bw@0 { @@ -326,7 +327,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpa2 5 0; samsung,spi-feedback-delay = 0; }; -- 1.7.9.5 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 1/3 v5] spi: s3c64xx: fix broken cs_gpios usage in the driver
Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin) spi-s3c64xx.c driver expects 1. chip select gpios from cs-gpio(singular) under the controller-data node of the client/slave device of the SPI. 2. cs-gpio(singular) entry to be present in the SPI device node. Eg of current broken usage: spi_1 { cs-gpio ; /* this entry is checked during probe */ ... slave_node { controller-data { cs-gpio gpioa2 5 0; /* This field is parsed during .setup() */ } }; }; The following dts files which were using this driver. But, din't have the cs-gpio entry under SPI node. -- arch/arm/boot/dts/exynos4210-smdkv310.dts -- arch/arm/boot/dts/exynos4412-trats2.dts -- arch/arm/boot/dts/exynos5250-smdk5250.dts Also, the SPI core and many drivers moved on to using cs-gpios from SPI node and removed the gpio handling code from drivers (including spi-s3c64xx.c). Hence, spi-s3c64xx.c is broken since Jun 21 11:26:12 2013 and considering the time with no compliants about the breakage. We are assuming it is safe to remove the cs-gpio(singular) usage from device tree binding of spi-samsung.txt and makes appropriate changes in the driver to use cs-gpios(plural) from SPI device node. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Reviewed-by: Javier Martinez Canillas javier.marti...@collabora.co.uk Tested-by: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- Changes since v4: 1. Added reviewed by from Javier and Tested by from Doug Changes since v3: 1. Remove the sdd-cs_gpio and use gpio_is_valid(spi-cs_gpio) instead 2. Keep cs-line only for Non-DT platforms and use spi-cs_gpio for DT platforms .../devicetree/bindings/spi/spi-samsung.txt|8 ++-- drivers/spi/spi-s3c64xx.c | 41 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt index 86aa061..2d29dac 100644 --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt @@ -42,15 +42,13 @@ Optional Board Specific Properties: - num-cs: Specifies the number of chip select lines supported. If not specified, the default number of chip select lines is set to 1. +- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt) + SPI Controller specific data in SPI slave nodes: - The spi slave nodes should provide the following information which is required by the spi controller. - - cs-gpio: A gpio specifier that specifies the gpio line used as -the slave select line by the spi controller. The format of the gpio -specifier depends on the gpio controller. - - samsung,spi-feedback-delay: The sampling phase shift to be applied on the miso line (to account for any lag in the miso line). The following are the valid values. @@ -85,6 +83,7 @@ Example: #size-cells = 0; pinctrl-names = default; pinctrl-0 = spi0_bus; + cs-gpios = gpa2 5 0; w25q80bw@0 { #address-cells = 1; @@ -94,7 +93,6 @@ Example: spi-max-frequency = 1; controller-data { - cs-gpio = gpa2 5 1 0 3; samsung,spi-feedback-delay = 0; }; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 75a5696..b888c66 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data { struct s3c64xx_spi_dma_data tx_dma; struct s3c64xx_spi_port_config *port_conf; unsigned intport_id; - boolcs_gpio; }; static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) @@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( return ERR_PTR(-ENOMEM); } - /* The CS line is asserted/deasserted by the gpio pin */ - if (sdd-cs_gpio) - cs-line = of_get_named_gpio(data_np, cs-gpio, 0); - - if (!gpio_is_valid(cs-line)) { - dev_err(spi-dev, chip select gpio is not specified or invalid\n); - kfree(cs); - of_node_put(data_np); - return ERR_PTR(-EINVAL); - } - of_property_read_u32(data_np, samsung,spi-feedback-delay, fb_delay); cs-fb_delay = fb_delay; of_node_put(data_np); @@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi) spi-controller_data = cs; } + /* For the non-DT platforms derive chip selects from controller data */ + if (!spi-dev.of_node
[PATCH 1/2 v3] spi: s3c64xx: use cs-gpios from spi node instead of cs-gpio
Currently, spi-s3c64xx.c needs cs-gpio chip select GPIO to be defined under controller-data node under each slave node. spi_x { cs-gpios ; ... slave_node { controller-data { cs-gpio = ; ... }; ... }; ... }; Where as, SPI core and many other drivers uses cs-gpios for from device tree node. Hence, make changes in spi-s3c64xx.c driver to make use of cs-gpios from SPI node(parent) instead of cs-gpio defined in slaves controller-data(child) node. Also updates the Device tree Documentation. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- Changes since v2: 1. updated the gpios usage in Documentation 2. use the spi-cs_gpio in the driver, instead of parsing the node again. 3. Corrected error check of the of.node and during gpio_free .../devicetree/bindings/spi/spi-samsung.txt|8 +++- drivers/spi/spi-s3c64xx.c | 18 ++ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt index 86aa061..2d29dac 100644 --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt @@ -42,15 +42,13 @@ Optional Board Specific Properties: - num-cs: Specifies the number of chip select lines supported. If not specified, the default number of chip select lines is set to 1. +- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt) + SPI Controller specific data in SPI slave nodes: - The spi slave nodes should provide the following information which is required by the spi controller. - - cs-gpio: A gpio specifier that specifies the gpio line used as -the slave select line by the spi controller. The format of the gpio -specifier depends on the gpio controller. - - samsung,spi-feedback-delay: The sampling phase shift to be applied on the miso line (to account for any lag in the miso line). The following are the valid values. @@ -85,6 +83,7 @@ Example: #size-cells = 0; pinctrl-names = default; pinctrl-0 = spi0_bus; + cs-gpios = gpa2 5 0; w25q80bw@0 { #address-cells = 1; @@ -94,7 +93,6 @@ Example: spi-max-frequency = 1; controller-data { - cs-gpio = gpa2 5 1 0 3; samsung,spi-feedback-delay = 0; }; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 75a5696..842b148 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -772,24 +772,19 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( cs = kzalloc(sizeof(*cs), GFP_KERNEL); if (!cs) { - of_node_put(data_np); return ERR_PTR(-ENOMEM); } - /* The CS line is asserted/deasserted by the gpio pin */ - if (sdd-cs_gpio) - cs-line = of_get_named_gpio(data_np, cs-gpio, 0); - - if (!gpio_is_valid(cs-line)) { + if (!gpio_is_valid(spi-cs_gpio)) { dev_err(spi-dev, chip select gpio is not specified or invalid\n); - kfree(cs); - of_node_put(data_np); return ERR_PTR(-EINVAL); } + cs-line = spi-cs_gpio; of_property_read_u32(data_np, samsung,spi-feedback-delay, fb_delay); cs-fb_delay = fb_delay; of_node_put(data_np); + return cs; } @@ -828,8 +823,6 @@ static int s3c64xx_spi_setup(struct spi_device *spi) cs-line, err); goto err_gpio_req; } - - spi-cs_gpio = cs-line; } spi_set_ctldata(spi, cs); @@ -884,7 +877,8 @@ setup_exit: /* setup() returns with device de-selected */ writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd-regs + S3C64XX_SPI_SLAVE_SEL); - gpio_free(cs-line); + if (cs-line) + gpio_free(cs-line); spi_set_ctldata(spi, NULL); err_gpio_req: @@ -1077,7 +1071,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd-sfr_start = mem_res-start; sdd-cs_gpio = true; if (pdev-dev.of_node) { - if (!of_find_property(pdev-dev.of_node, cs-gpio, NULL)) + if (!of_find_property(pdev-dev.of_node, cs-gpios, NULL)) sdd-cs_gpio = false; ret = of_alias_get_id(pdev-dev.of_node, spi); -- 1.7.9.5
[PATCH 2/2 v3] ARM: DTS: move cs-gpio from controller-data to under spi node
This patch moves the cs-gpio field from controller-data child node to under the spi device node. Respective changes are preposed to spi-s3c64xx.c driver. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Acked-by: Rob Herring r...@kernel.org Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org Cc: Tomasz Figa t.f...@samsung.com --- Changes since v2: None arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts |2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index 636d166..9191491 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts @@ -169,6 +169,7 @@ spi_2: spi@1394 { status = okay; + cs-gpios = gpc1 2 0; w25x80@0 { #address-cells = 1; @@ -178,7 +179,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpc1 2 0; samsung,spi-feedback-delay = 0; }; diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 8a558b7..204b0de 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -512,6 +512,7 @@ spi_1: spi@1393 { pinctrl-names = default; pinctrl-0 = spi1_bus; + cs-gpios = gpb 5 0; status = okay; s5c73m3_spi: s5c73m3 { @@ -519,7 +520,6 @@ spi-max-frequency = 5000; reg = 0; controller-data { - cs-gpio = gpb 5 0; samsung,spi-feedback-delay = 2; }; }; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a794a70..0c6433a 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -316,6 +316,7 @@ }; spi_1: spi@12d3 { + cs-gpios = gpa2 5 0; status = okay; w25q80bw@0 { @@ -326,7 +327,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpa2 5 0; samsung,spi-feedback-delay = 0; }; -- 1.7.9.5 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 3/3] ARM: DTS: move cs-gpio from controller-data to under spi node
This patch moves the cs-gpio field from controller-data child node to under the spi device node. Respective changes are preposed to spi-s3c64xx.c driver. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org --- arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts |2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index 636d166..9191491 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts @@ -169,6 +169,7 @@ spi_2: spi@1394 { status = okay; + cs-gpios = gpc1 2 0; w25x80@0 { #address-cells = 1; @@ -178,7 +179,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpc1 2 0; samsung,spi-feedback-delay = 0; }; diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 8a558b7..204b0de 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -512,6 +512,7 @@ spi_1: spi@1393 { pinctrl-names = default; pinctrl-0 = spi1_bus; + cs-gpios = gpb 5 0; status = okay; s5c73m3_spi: s5c73m3 { @@ -519,7 +520,6 @@ spi-max-frequency = 5000; reg = 0; controller-data { - cs-gpio = gpb 5 0; samsung,spi-feedback-delay = 2; }; }; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a794a70..0c6433a 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -316,6 +316,7 @@ }; spi_1: spi@12d3 { + cs-gpios = gpa2 5 0; status = okay; w25q80bw@0 { @@ -326,7 +327,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpa2 5 0; samsung,spi-feedback-delay = 0; }; -- 1.7.9.5 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 1/3] spi: s3c64xx: use cs-gpios from spi node instead of cs-gpio
This patch makes the changes in spi-s3c64xx.c driver to make use of cs-gpios from SPI node(parent) instead of cs-gpio defined in slaves controller-data(child) node. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org --- drivers/spi/spi-s3c64xx.c | 56 - 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 75a5696..0c6013f 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -750,47 +750,56 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, } static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( - struct spi_device *spi) + struct spi_device *spi, + struct s3c64xx_spi_csinfo *cs) { - struct s3c64xx_spi_csinfo *cs; - struct device_node *slave_np, *data_np = NULL; - struct s3c64xx_spi_driver_data *sdd; + struct device_node *data_np = NULL; u32 fb_delay = 0; - sdd = spi_master_get_devdata(spi-master); - slave_np = spi-dev.of_node; - if (!slave_np) { - dev_err(spi-dev, device node not found\n); + data_np = of_get_child_by_name(spi-dev.of_node, controller-data); + if (!data_np) { + dev_err(spi-dev, child node 'controller-data' not found\n); return ERR_PTR(-EINVAL); } - data_np = of_get_child_by_name(slave_np, controller-data); - if (!data_np) { - dev_err(spi-dev, child node 'controller-data' not found\n); + of_property_read_u32(data_np, samsung,spi-feedback-delay, fb_delay); + cs-fb_delay = fb_delay; + of_node_put(data_np); + + return cs; +} + +static struct s3c64xx_spi_csinfo *s3c64xx_get_cs_gpios(struct spi_device *spi) +{ + struct device_node *parent_np = NULL; + struct s3c64xx_spi_driver_data *sdd; + struct s3c64xx_spi_csinfo *cs; + + parent_np = of_get_parent(spi-dev.of_node); + if (!parent_np) { + dev_err(spi-dev, Parent node not found\n); return ERR_PTR(-EINVAL); } + sdd = spi_master_get_devdata(spi-master); + cs = kzalloc(sizeof(*cs), GFP_KERNEL); if (!cs) { - of_node_put(data_np); + of_node_put(parent_np); return ERR_PTR(-ENOMEM); } /* The CS line is asserted/deasserted by the gpio pin */ if (sdd-cs_gpio) - cs-line = of_get_named_gpio(data_np, cs-gpio, 0); + cs-line = of_get_named_gpio(parent_np, cs-gpios, 0); if (!gpio_is_valid(cs-line)) { dev_err(spi-dev, chip select gpio is not specified or invalid\n); - kfree(cs); - of_node_put(data_np); + of_node_put(parent_np); return ERR_PTR(-EINVAL); } - of_property_read_u32(data_np, samsung,spi-feedback-delay, fb_delay); - cs-fb_delay = fb_delay; - of_node_put(data_np); - return cs; + return s3c64xx_get_slave_ctrldata(spi, cs); } /* @@ -806,9 +815,14 @@ static int s3c64xx_spi_setup(struct spi_device *spi) struct s3c64xx_spi_info *sci; int err; + if (!spi-dev.of_node) { + dev_err(spi-dev, device node not found\n); + return ERR_PTR(-EINVAL); + } + sdd = spi_master_get_devdata(spi-master); if (!cs spi-dev.of_node) { - cs = s3c64xx_get_slave_ctrldata(spi); + cs = s3c64xx_get_cs_gpios(spi); spi-controller_data = cs; } @@ -1077,7 +1091,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd-sfr_start = mem_res-start; sdd-cs_gpio = true; if (pdev-dev.of_node) { - if (!of_find_property(pdev-dev.of_node, cs-gpio, NULL)) + if (!of_find_property(pdev-dev.of_node, cs-gpios, NULL)) sdd-cs_gpio = false; ret = of_alias_get_id(pdev-dev.of_node, spi); -- 1.7.9.5 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 0/2 v2] spi: s3c64xx: use cs-gpios in spi node instead of cs-gpio
Currently, spi-s3c64xx.c needs cs-gpio chip select GPIO to be defined under controller-data node under each slave node. spi_x { cs-gpios ; ... slave_node { controller-data { cs-gpio = ; ... }; ... }; ... }; Where as, SPI core and many other drivers uses cs-gpios for from device tree node. Hence, make changes in spi-s3c64xx.c driver to make use of cs-gpios from SPI node(parent) instead of cs-gpio defined in slaves controller-data(child) node. Also, fixes a compilation warning and corrects the DTS nodes for Exynos4210 based SMDKv310, Exynos4412 based Trats2, Exynos5250 based SMDK5250 boards. Naveen Krishna Chatradhi (2): based on for-next branch of spi.git spi: s3c64xx: use cs-gpios from spi node instead of cs-gpio based on for-next branch of linuxsamsung.git ARM: DTS: move cs-gpio from controller-data to under spi node .../devicetree/bindings/spi/spi-samsung.txt|8 ++- arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts|2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- drivers/spi/spi-s3c64xx.c | 56 5 files changed, 41 insertions(+), 29 deletions(-) -- 1.7.9.5 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 2/2 v2] ARM: DTS: move cs-gpio from controller-data to under spi node
This patch moves the cs-gpio field from controller-data child node to under the spi device node. Respective changes are preposed to spi-s3c64xx.c driver. Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com Cc: Javier Martinez Canillas javier.marti...@collabora.co.uk Cc: Doug Anderson diand...@chromium.org --- Changes since v1: None arch/arm/boot/dts/exynos4210-smdkv310.dts |2 +- arch/arm/boot/dts/exynos4412-trats2.dts |2 +- arch/arm/boot/dts/exynos5250-smdk5250.dts |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index 636d166..9191491 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts @@ -169,6 +169,7 @@ spi_2: spi@1394 { status = okay; + cs-gpios = gpc1 2 0; w25x80@0 { #address-cells = 1; @@ -178,7 +179,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpc1 2 0; samsung,spi-feedback-delay = 0; }; diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 8a558b7..204b0de 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -512,6 +512,7 @@ spi_1: spi@1393 { pinctrl-names = default; pinctrl-0 = spi1_bus; + cs-gpios = gpb 5 0; status = okay; s5c73m3_spi: s5c73m3 { @@ -519,7 +520,6 @@ spi-max-frequency = 5000; reg = 0; controller-data { - cs-gpio = gpb 5 0; samsung,spi-feedback-delay = 2; }; }; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a794a70..0c6433a 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -316,6 +316,7 @@ }; spi_1: spi@12d3 { + cs-gpios = gpa2 5 0; status = okay; w25q80bw@0 { @@ -326,7 +327,6 @@ spi-max-frequency = 100; controller-data { - cs-gpio = gpa2 5 0; samsung,spi-feedback-delay = 0; }; -- 1.7.9.5 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH] spi: s3c64xx: Add fix for crash in spi suspend/resume
From: Abhilash Kesavan a.kesa...@samsung.com The SPI driver makes a gpio_request during initialization. The requested gpios need to be populated as part of the s3c64xx_spi_driver_data so that they can be released during suspend and requested again during resume. Add the missing code to save the requested gpios as part of the driver data. This fixes a SPI driver suspend crash. Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com --- This was tested on spi-next branch http://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git With S2R patches submitted on mailing list. http://www.spinics.net/lists/arm-kernel/msg205244.html drivers/spi/spi-s3c64xx.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 01b2f56..57900a8 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1112,7 +1112,7 @@ static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd) dev_err(dev, invalid gpio[%d]: %d\n, idx, gpio); goto free_gpio; } - + sdd-gpios[idx] = gpio; ret = gpio_request(gpio, spi-bus); if (ret) { dev_err(dev, gpio [%d] request failed: %d\n, -- 1.7.9.5 -- LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general