* [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties [not found] <1359103175-26304-1-git-send-email-maxime.ripard@free-electrons.com> @ 2013-01-25 8:39 ` Maxime Ripard 2013-01-26 7:36 ` Mark Brown 0 siblings, 1 reply; 6+ messages in thread From: Maxime Ripard @ 2013-01-25 8:39 UTC (permalink / raw) To: Shawn Guo Cc: Brian Lilly, linux-arm-kernel, Mark Brown, Grant Likely, spi-devel-general, linux-kernel The bindings assumed that the gpios properties were always there, which made the NO_TX and NO_RX mode not usable from device tree. Add extra checks to make sure that the driver can work if either MOSI or MISO is not used. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> --- drivers/spi/spi-gpio.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index c7cf0b7..9ddef55 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c @@ -365,9 +365,26 @@ static int spi_gpio_probe_dt(struct platform_device *pdev) if (!pdata) return -ENOMEM; - pdata->sck = of_get_named_gpio(np, "gpio-sck", 0); - pdata->miso = of_get_named_gpio(np, "gpio-miso", 0); - pdata->mosi = of_get_named_gpio(np, "gpio-mosi", 0); + ret = of_get_named_gpio(np, "gpio-sck", 0); + if (ret < 0) { + dev_err(&pdev->dev, "gpio-sck property not found\n"); + goto error_free; + } + pdata->sck = ret; + + ret = of_get_named_gpio(np, "gpio-miso", 0); + if (ret < 0) { + dev_info(&pdev->dev, "gpio-miso property not found, switching to no-rx mode\n"); + pdata->miso = SPI_GPIO_NO_MISO; + } else + pdata->miso = ret; + + ret = of_get_named_gpio(np, "gpio-mosi", 0); + if (ret < 0) { + dev_info(&pdev->dev, "gpio-mosi property not found, switching to no-tx mode\n"); + pdata->mosi = SPI_GPIO_NO_MOSI; + } else + pdata->mosi = ret; ret = of_property_read_u32(np, "num-chipselects", &tmp); if (ret < 0) { -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties 2013-01-25 8:39 ` [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties Maxime Ripard @ 2013-01-26 7:36 ` Mark Brown 0 siblings, 0 replies; 6+ messages in thread From: Mark Brown @ 2013-01-26 7:36 UTC (permalink / raw) To: Maxime Ripard Cc: Shawn Guo, Brian Lilly, linux-arm-kernel, Grant Likely, spi-devel-general, linux-kernel [-- Attachment #1: Type: text/plain, Size: 311 bytes --] On Fri, Jan 25, 2013 at 09:39:34AM +0100, Maxime Ripard wrote: > The bindings assumed that the gpios properties were always there, which > made the NO_TX and NO_RX mode not usable from device tree. Add extra > checks to make sure that the driver can work if either MOSI or MISO is > not used. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1356645288-10110-1-git-send-email-maxime.ripard@free-electrons.com>]
* [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties [not found] <1356645288-10110-1-git-send-email-maxime.ripard@free-electrons.com> @ 2012-12-27 21:54 ` Maxime Ripard [not found] ` <1356645288-10110-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Maxime Ripard @ 2012-12-27 21:54 UTC (permalink / raw) To: linux-arm-kernel, Shawn Guo; +Cc: Grant Likely, spi-devel-general, Brian Lilly The bindings assumed that the gpios properties were always there, which made the NO_TX and NO_RX mode not usable from device tree. Add extra checks to make sure that the driver can work if either MOSI or MISO is not used. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> --- drivers/spi/spi-gpio.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index c7cf0b7..9ddef55 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c @@ -365,9 +365,26 @@ static int spi_gpio_probe_dt(struct platform_device *pdev) if (!pdata) return -ENOMEM; - pdata->sck = of_get_named_gpio(np, "gpio-sck", 0); - pdata->miso = of_get_named_gpio(np, "gpio-miso", 0); - pdata->mosi = of_get_named_gpio(np, "gpio-mosi", 0); + ret = of_get_named_gpio(np, "gpio-sck", 0); + if (ret < 0) { + dev_err(&pdev->dev, "gpio-sck property not found\n"); + goto error_free; + } + pdata->sck = ret; + + ret = of_get_named_gpio(np, "gpio-miso", 0); + if (ret < 0) { + dev_info(&pdev->dev, "gpio-miso property not found, switching to no-rx mode\n"); + pdata->miso = SPI_GPIO_NO_MISO; + } else + pdata->miso = ret; + + ret = of_get_named_gpio(np, "gpio-mosi", 0); + if (ret < 0) { + dev_info(&pdev->dev, "gpio-mosi property not found, switching to no-tx mode\n"); + pdata->mosi = SPI_GPIO_NO_MOSI; + } else + pdata->mosi = ret; ret = of_property_read_u32(np, "num-chipselects", &tmp); if (ret < 0) { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1356645288-10110-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties [not found] ` <1356645288-10110-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> @ 2013-01-09 8:37 ` Maxime Ripard [not found] ` <50ED2C2D.7030608-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Maxime Ripard @ 2013-01-09 8:37 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Shawn Guo, Grant Likely Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Brian Lilly Hi Grant, On 27/12/2012 22:54, Maxime Ripard wrote: > The bindings assumed that the gpios properties were always there, which > made the NO_TX and NO_RX mode not usable from device tree. Add extra > checks to make sure that the driver can work if either MOSI or MISO is > not used. Can you give me your Acked-by on this, or do you have any comments on this? Thanks, Maxime -- Maxime Ripard, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ------------------------------------------------------------------------------ Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery and much more. Keep your Java skills current with LearnJavaNow - 200+ hours of step-by-step video tutorials by Java experts. SALE $49.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122612 ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <50ED2C2D.7030608-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties [not found] ` <50ED2C2D.7030608-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> @ 2013-01-22 15:50 ` Maxime Ripard [not found] ` <50FEB546.3090504-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Maxime Ripard @ 2013-01-22 15:50 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Shawn Guo, Grant Likely Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Brian Lilly On 09/01/2013 09:37, Maxime Ripard wrote: > On 27/12/2012 22:54, Maxime Ripard wrote: >> The bindings assumed that the gpios properties were always there, which >> made the NO_TX and NO_RX mode not usable from device tree. Add extra >> checks to make sure that the driver can work if either MOSI or MISO is >> not used. > > Can you give me your Acked-by on this, or do you have any comments on this? Ping? -- Maxime Ripard, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <50FEB546.3090504-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties [not found] ` <50FEB546.3090504-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> @ 2013-02-05 13:08 ` Grant Likely 0 siblings, 0 replies; 6+ messages in thread From: Grant Likely @ 2013-02-05 13:08 UTC (permalink / raw) To: Maxime Ripard, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Shawn Guo Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Brian Lilly On Tue, 22 Jan 2013 16:50:30 +0100, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote: > On 09/01/2013 09:37, Maxime Ripard wrote: > > On 27/12/2012 22:54, Maxime Ripard wrote: > >> The bindings assumed that the gpios properties were always there, which > >> made the NO_TX and NO_RX mode not usable from device tree. Add extra > >> checks to make sure that the driver can work if either MOSI or MISO is > >> not used. > > > > Can you give me your Acked-by on this, or do you have any comments on this? > > Ping? Mark has applied it and it is now in my tree. g. ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-02-05 13:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1359103175-26304-1-git-send-email-maxime.ripard@free-electrons.com> 2013-01-25 8:39 ` [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties Maxime Ripard 2013-01-26 7:36 ` Mark Brown [not found] <1356645288-10110-1-git-send-email-maxime.ripard@free-electrons.com> 2012-12-27 21:54 ` Maxime Ripard [not found] ` <1356645288-10110-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 2013-01-09 8:37 ` Maxime Ripard [not found] ` <50ED2C2D.7030608-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 2013-01-22 15:50 ` Maxime Ripard [not found] ` <50FEB546.3090504-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 2013-02-05 13:08 ` Grant Likely
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).