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 (3):
based on for-next branch of spi.git
spi: s3c64xx: use "cs-gpios" from spi node instead of "cs-gpio"
spi: s3c64xx: remove a compilation warning with an assignment
based on for-next branch of linuxsamsung.git
ARM: DTS: move "cs-gpio" from "controller-data" to under spi node
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 ++++++++++++++++++-----------
4 files changed, 38 insertions(+), 24 deletions(-)
--
1.7.9.5
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 <redacted>
Cc: Javier Martinez Canillas <redacted>
Cc: Doug Anderson <dianders@chromium.org>
---
drivers/spi/spi-s3c64xx.c | 56 ++++++++++++++++++++++++++++-----------------
1 file changed, 35 insertions(+), 21 deletions(-)
@@ -750,47 +750,56 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master,}staticstructs3c64xx_spi_csinfo*s3c64xx_get_slave_ctrldata(-structspi_device*spi)+structspi_device*spi,+structs3c64xx_spi_csinfo*cs){-structs3c64xx_spi_csinfo*cs;-structdevice_node*slave_np,*data_np=NULL;-structs3c64xx_spi_driver_data*sdd;+structdevice_node*data_np=NULL;u32fb_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");returnERR_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);++returncs;+}++staticstructs3c64xx_spi_csinfo*s3c64xx_get_cs_gpios(structspi_device*spi)+{+structdevice_node*parent_np=NULL;+structs3c64xx_spi_driver_data*sdd;+structs3c64xx_spi_csinfo*cs;++parent_np=of_get_parent(spi->dev.of_node);+if(!parent_np){+dev_err(&spi->dev,"Parent node not found\n");returnERR_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);returnERR_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);returnERR_PTR(-EINVAL);}-of_property_read_u32(data_np,"samsung,spi-feedback-delay",&fb_delay);-cs->fb_delay=fb_delay;-of_node_put(data_np);-returncs;+returns3c64xx_get_slave_ctrldata(spi,cs);}/*
@@ -806,9 +815,14 @@ static int s3c64xx_spi_setup(struct spi_device *spi)structs3c64xx_spi_info*sci;interr;+if(!spi->dev.of_node){+dev_err(&spi->dev,"device node not found\n");+returnERR_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");
This patch returns an integer error value instead of the
pointer.
"warning: return makes integer from pointer without a cast"
Signed-off-by: Naveen Krishna Chatradhi <redacted>
Cc: Javier Martinez Canillas <redacted>
Cc: Doug Anderson <dianders@chromium.org>
---
drivers/spi/spi-s3c64xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Hi Naveen,
On Tue, Jun 10, 2014 at 2:30 PM, Naveen Krishna Chatradhi
[off-list ref] wrote:
quoted hunk
This patch returns an integer error value instead of the
pointer.
"warning: return makes integer from pointer without a cast"
Signed-off-by: Naveen Krishna Chatradhi <redacted>
Cc: Javier Martinez Canillas <redacted>
Cc: Doug Anderson <dianders@chromium.org>
---
drivers/spi/spi-s3c64xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Hello All,
On 10 June 2014 14:30, Naveen Krishna Chatradhi [off-list ref] wrote:
quoted hunk
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 <redacted>
Cc: Javier Martinez Canillas <redacted>
Cc: Doug Anderson <dianders@chromium.org>
---
drivers/spi/spi-s3c64xx.c | 56 ++++++++++++++++++++++++++++-----------------
1 file changed, 35 insertions(+), 21 deletions(-)
@@ -750,47 +750,56 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master,}staticstructs3c64xx_spi_csinfo*s3c64xx_get_slave_ctrldata(-structspi_device*spi)+structspi_device*spi,+structs3c64xx_spi_csinfo*cs){-structs3c64xx_spi_csinfo*cs;-structdevice_node*slave_np,*data_np=NULL;-structs3c64xx_spi_driver_data*sdd;+structdevice_node*data_np=NULL;u32fb_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");returnERR_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);++returncs;+}++staticstructs3c64xx_spi_csinfo*s3c64xx_get_cs_gpios(structspi_device*spi)+{+structdevice_node*parent_np=NULL;+structs3c64xx_spi_driver_data*sdd;+structs3c64xx_spi_csinfo*cs;++parent_np=of_get_parent(spi->dev.of_node);+if(!parent_np){+dev_err(&spi->dev,"Parent node not found\n");returnERR_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);returnERR_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);returnERR_PTR(-EINVAL);}-of_property_read_u32(data_np,"samsung,spi-feedback-delay",&fb_delay);-cs->fb_delay=fb_delay;-of_node_put(data_np);-returncs;+returns3c64xx_get_slave_ctrldata(spi,cs);}/*
@@ -806,9 +815,14 @@ static int s3c64xx_spi_setup(struct spi_device *spi)structs3c64xx_spi_info*sci;interr;+if(!spi->dev.of_node){+dev_err(&spi->dev,"device node not found\n");+returnERR_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
Forgot to add the DTS documentation.
Will quickly respin. Thanks.
Hello Sachin,
On 10 June 2014 15:15, Sachin Kamat [off-list ref] wrote:
Hi Naveen,
On Tue, Jun 10, 2014 at 2:30 PM, Naveen Krishna Chatradhi
[off-list ref] wrote:
quoted
This patch returns an integer error value instead of the
pointer.
"warning: return makes integer from pointer without a cast"
Signed-off-by: Naveen Krishna Chatradhi <redacted>
Cc: Javier Martinez Canillas <redacted>
Cc: Doug Anderson <dianders@chromium.org>
---
drivers/spi/spi-s3c64xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)