* [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config
@ 2010-08-20 16:17 Mark Brown
2010-08-20 16:17 ` [PATCH 2/2] spi/spi_s3c64xx: Staticise non-exported functions Mark Brown
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Mark Brown @ 2010-08-20 16:17 UTC (permalink / raw)
To: David Brownell, Grant Likely
Cc: Jassi Brar, spi-devel-general, linux-kernel, Mark Brown
The S3C64xx SPI driver requires the machine to call s3c64xx_spi_set_info()
to select a few options, including the clock to use for the SPI controller.
If this is not done then a NULL will be passed as the clock name for
clk_get(), causing an obscure crash. Guard against this and other missing
configuration by validating that the clock name has been filled in in
the platform data that ets passed in.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/spi/spi_s3c64xx.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
index 9736581..a0b63b7 100644
--- a/drivers/spi/spi_s3c64xx.c
+++ b/drivers/spi/spi_s3c64xx.c
@@ -919,6 +919,13 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
return -ENODEV;
}
+ sci = pdev->dev.platform_data;
+ if (!sci->src_clk_name) {
+ dev_err(&pdev->dev,
+ "Board init must call s3c64xx_spi_set_info()\n");
+ return -EINVAL;
+ }
+
/* Check for availability of necessary resource */
dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -946,8 +953,6 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
return -ENOMEM;
}
- sci = pdev->dev.platform_data;
-
platform_set_drvdata(pdev, master);
sdd = spi_master_get_devdata(master);
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] spi/spi_s3c64xx: Staticise non-exported functions
2010-08-20 16:17 [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config Mark Brown
@ 2010-08-20 16:17 ` Mark Brown
[not found] ` <1282321028-32196-2-git-send-email-broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2010-08-20 20:46 ` [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config Grant Likely
2010-08-21 1:45 ` [spi-devel-general] " Jassi Brar
2 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2010-08-20 16:17 UTC (permalink / raw)
To: David Brownell, Grant Likely
Cc: Jassi Brar, spi-devel-general, linux-kernel, Mark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/spi/spi_s3c64xx.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
index a0b63b7..7e627f7 100644
--- a/drivers/spi/spi_s3c64xx.c
+++ b/drivers/spi/spi_s3c64xx.c
@@ -447,8 +447,8 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
writel(val, regs + S3C64XX_SPI_CLK_CFG);
}
-void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id,
- int size, enum s3c2410_dma_buffresult res)
+static void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id,
+ int size, enum s3c2410_dma_buffresult res)
{
struct s3c64xx_spi_driver_data *sdd = buf_id;
unsigned long flags;
@@ -467,8 +467,8 @@ void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id,
spin_unlock_irqrestore(&sdd->lock, flags);
}
-void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id,
- int size, enum s3c2410_dma_buffresult res)
+static void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id,
+ int size, enum s3c2410_dma_buffresult res)
{
struct s3c64xx_spi_driver_data *sdd = buf_id;
unsigned long flags;
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config
2010-08-20 16:17 [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config Mark Brown
2010-08-20 16:17 ` [PATCH 2/2] spi/spi_s3c64xx: Staticise non-exported functions Mark Brown
@ 2010-08-20 20:46 ` Grant Likely
2010-08-21 1:45 ` [spi-devel-general] " Jassi Brar
2 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2010-08-20 20:46 UTC (permalink / raw)
To: Mark Brown; +Cc: David Brownell, Jassi Brar, spi-devel-general, linux-kernel
On Fri, Aug 20, 2010 at 05:17:07PM +0100, Mark Brown wrote:
> The S3C64xx SPI driver requires the machine to call s3c64xx_spi_set_info()
> to select a few options, including the clock to use for the SPI controller.
> If this is not done then a NULL will be passed as the clock name for
> clk_get(), causing an obscure crash. Guard against this and other missing
> configuration by validating that the clock name has been filled in in
> the platform data that ets passed in.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Both patches applied, thanks.
g.
> ---
> drivers/spi/spi_s3c64xx.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
> index 9736581..a0b63b7 100644
> --- a/drivers/spi/spi_s3c64xx.c
> +++ b/drivers/spi/spi_s3c64xx.c
> @@ -919,6 +919,13 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> + sci = pdev->dev.platform_data;
> + if (!sci->src_clk_name) {
> + dev_err(&pdev->dev,
> + "Board init must call s3c64xx_spi_set_info()\n");
> + return -EINVAL;
> + }
> +
> /* Check for availability of necessary resource */
>
> dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> @@ -946,8 +953,6 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
> return -ENOMEM;
> }
>
> - sci = pdev->dev.platform_data;
> -
> platform_set_drvdata(pdev, master);
>
> sdd = spi_master_get_devdata(master);
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [spi-devel-general] [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config
2010-08-20 16:17 [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config Mark Brown
2010-08-20 16:17 ` [PATCH 2/2] spi/spi_s3c64xx: Staticise non-exported functions Mark Brown
2010-08-20 20:46 ` [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config Grant Likely
@ 2010-08-21 1:45 ` Jassi Brar
2010-08-21 10:08 ` Mark Brown
2 siblings, 1 reply; 10+ messages in thread
From: Jassi Brar @ 2010-08-21 1:45 UTC (permalink / raw)
To: Mark Brown; +Cc: David Brownell, Grant Likely, spi-devel-general, linux-kernel
On Sat, Aug 21, 2010 at 1:17 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> The S3C64xx SPI driver requires the machine to call s3c64xx_spi_set_info()
> to select a few options, including the clock to use for the SPI controller.
> If this is not done then a NULL will be passed as the clock name for
> clk_get(), causing an obscure crash. Guard against this and other missing
> configuration by validating that the clock name has been filled in in
> the platform data that ets passed in.
The movement of sci assignment and check doesn't make any
difference because
we already check for presence of platform_data and DMA-Tx,Rx and
IO base is
set irrespective of calling s3c64xx_spi_set_info()
Also, I think !sci->num_cs might be an even better check because
the samsung clock
api might be changed (IIRC Ben was already working it out) to make
it redundant
to pass clock name strings to clk_get. If that is the case, we might end up
adding another foolproof check like !sci->num_cs
what do you guys think?
regards
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] spi/spi_s3c64xx: Staticise non-exported functions
[not found] ` <1282321028-32196-2-git-send-email-broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2010-08-21 1:52 ` Jassi Brar
0 siblings, 0 replies; 10+ messages in thread
From: Jassi Brar @ 2010-08-21 1:52 UTC (permalink / raw)
To: Mark Brown
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
David Brownell, linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Sat, Aug 21, 2010 at 1:17 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> drivers/spi/spi_s3c64xx.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
> index a0b63b7..7e627f7 100644
> --- a/drivers/spi/spi_s3c64xx.c
> +++ b/drivers/spi/spi_s3c64xx.c
> @@ -447,8 +447,8 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
> writel(val, regs + S3C64XX_SPI_CLK_CFG);
> }
>
> -void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id,
> - int size, enum s3c2410_dma_buffresult res)
> +static void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id,
> + int size, enum s3c2410_dma_buffresult res)
> {
> struct s3c64xx_spi_driver_data *sdd = buf_id;
> unsigned long flags;
> @@ -467,8 +467,8 @@ void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id,
> spin_unlock_irqrestore(&sdd->lock, flags);
> }
>
> -void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id,
> - int size, enum s3c2410_dma_buffresult res)
> +static void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id,
> + int size, enum s3c2410_dma_buffresult res)
> {
> struct s3c64xx_spi_driver_data *sdd = buf_id;
> unsigned long flags;
Oh, yes. What was I thinking ?!
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [spi-devel-general] [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config
2010-08-21 1:45 ` [spi-devel-general] " Jassi Brar
@ 2010-08-21 10:08 ` Mark Brown
[not found] ` <20100821100855.GA5545-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2010-08-21 10:08 UTC (permalink / raw)
To: Jassi Brar; +Cc: David Brownell, Grant Likely, spi-devel-general, linux-kernel
On Sat, Aug 21, 2010 at 10:45:56AM +0900, Jassi Brar wrote:
> On Sat, Aug 21, 2010 at 1:17 AM, Mark Brown
> <broonie@opensource.wolfsonmicro.com> wrote:
> > The S3C64xx SPI driver requires the machine to call s3c64xx_spi_set_info()
> > to select a few options, including the clock to use for the SPI controller.
> > If this is not done then a NULL will be passed as the clock name for
> > clk_get(), causing an obscure crash. Guard against this and other missing
> > configuration by validating that the clock name has been filled in in
> > the platform data that ets passed in.
> The movement of sci assignment and check doesn't make any
> difference because
> we already check for presence of platform_data and DMA-Tx,Rx and
> IO base is
> set irrespective of calling s3c64xx_spi_set_info()
While it does check for those things for at least the 6410 they're all
unconditionally set up by dev-spi.c so the tests all pass and we make it
down into to the clk_get() which then falls over horribly.
> Also, I think !sci->num_cs might be an even better check because
> the samsung clock
> api might be changed (IIRC Ben was already working it out) to make
> it redundant
> to pass clock name strings to clk_get. If that is the case, we might end up
> adding another foolproof check like !sci->num_cs
The problem with num_cs is that it gets interpreted by a custom function
provided by the board driver so we really can't say anything about what
it does. If the clock API gets enhanced then we can always cope with
things then, but given the pace of development there I'd expect that
we'd need to continue checking for a while.
TBH I'm a bit surprised that the driver has to do custom stuff to
support gpiolib chip selects - my first thought when I saw that stuff
was that it seemed like something that lots of SPI controllers would be
able to share but I didn't look at the overall SPI code for long enough
to figure out what was going on there.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config
[not found] ` <20100821100855.GA5545-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2010-08-21 13:58 ` Jassi Brar
2010-08-21 19:30 ` [spi-devel-general] " Mark Brown
0 siblings, 1 reply; 10+ messages in thread
From: Jassi Brar @ 2010-08-21 13:58 UTC (permalink / raw)
To: Mark Brown
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
David Brownell, linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Sat, Aug 21, 2010 at 7:08 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Sat, Aug 21, 2010 at 10:45:56AM +0900, Jassi Brar wrote:
>> On Sat, Aug 21, 2010 at 1:17 AM, Mark Brown
>> <broonie@opensource.wolfsonmicro.com> wrote:
>> > The S3C64xx SPI driver requires the machine to call s3c64xx_spi_set_info()
>> > to select a few options, including the clock to use for the SPI controller.
>> > If this is not done then a NULL will be passed as the clock name for
>> > clk_get(), causing an obscure crash. Guard against this and other missing
>> > configuration by validating that the clock name has been filled in in
>> > the platform data that ets passed in.
>
>> The movement of sci assignment and check doesn't make any
>> difference because
>> we already check for presence of platform_data and DMA-Tx,Rx and
>> IO base is
>> set irrespective of calling s3c64xx_spi_set_info()
>
> While it does check for those things for at least the 6410 they're all
> unconditionally set up by dev-spi.c so the tests all pass and we make it
> down into to the clk_get() which then falls over horribly.
Those parameters are SoC specific and hence will be always available to
platform devices.
Clock selection and num_cs(number of slaves attached to the SPI bus) are
machine specific and hence responsibility of the machine developer to
set appropriately via s3c64xx_spi_set_info()
>> Also, I think !sci->num_cs might be an even better check because
>> the samsung clock
>> api might be changed (IIRC Ben was already working it out) to make
>> it redundant
>> to pass clock name strings to clk_get. If that is the case, we might end up
>> adding another foolproof check like !sci->num_cs
>
> The problem with num_cs is that it gets interpreted by a custom function
> provided by the board driver so we really can't say anything about what
> it does.
num_cs is passed on as such to the SPI core to master->num_chipselect
which is strictly checked for before a master is created.
> If the clock API gets enhanced then we can always cope with
> things then, but given the pace of development there I'd expect that
> we'd need to continue checking for a while.
yes, so do i think.
> TBH I'm a bit surprised that the driver has to do custom stuff to
> support gpiolib chip selects - my first thought when I saw that stuff
> was that it seemed like something that lots of SPI controllers would be
> able to share but I didn't look at the overall SPI code for long enough
> to figure out what was going on there.
we have common spi bitbanging driver that takes only four gpio pins
and work like a charm.
In order to enable users use multiple CS per master, in spi_s3c64xx.c
the single CS feature provided by the controller is deliberately left unused
and the driver accepts a gpio per slave and manually controls it. Though
the callbacks and arguments are designed so that a simple gpio number
and gpio_set can be assigned by the machine code.
Anyways, I think we can keep the patch as it is, if it's already
applied in Grant's
tree.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [spi-devel-general] [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config
2010-08-21 13:58 ` Jassi Brar
@ 2010-08-21 19:30 ` Mark Brown
2010-08-22 3:37 ` Jassi Brar
0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2010-08-21 19:30 UTC (permalink / raw)
To: Jassi Brar; +Cc: David Brownell, Grant Likely, spi-devel-general, linux-kernel
On Sat, Aug 21, 2010 at 10:58:36PM +0900, Jassi Brar wrote:
> On Sat, Aug 21, 2010 at 7:08 PM, Mark Brown
> > On Sat, Aug 21, 2010 at 10:45:56AM +0900, Jassi Brar wrote:
> >> The movement of sci assignment and check doesn't make any
> >> difference because
> >> we already check for presence of platform_data and DMA-Tx,Rx and
> >> IO base is
> >> set irrespective of calling s3c64xx_spi_set_info()
> > While it does check for those things for at least the 6410 they're all
> > unconditionally set up by dev-spi.c so the tests all pass and we make it
> > down into to the clk_get() which then falls over horribly.
> Those parameters are SoC specific and hence will be always available to
> platform devices.
> Clock selection and num_cs(number of slaves attached to the SPI bus) are
> machine specific and hence responsibility of the machine developer to
> set appropriately via s3c64xx_spi_set_info()
Sure, the split does make sense - it's just that this means that we need
to do something to make sure that s3c64xx_spi_set_info() got called.
> > The problem with num_cs is that it gets interpreted by a custom function
> > provided by the board driver so we really can't say anything about what
> > it does.
> num_cs is passed on as such to the SPI core to master->num_chipselect
> which is strictly checked for before a master is created.
Ah, too many variables with similar functions.
> > support gpiolib chip selects - my first thought when I saw that stuff
> > was that it seemed like something that lots of SPI controllers would be
> > able to share but I didn't look at the overall SPI code for long enough
> > to figure out what was going on there.
> we have common spi bitbanging driver that takes only four gpio pins
> and work like a charm.
Though it does burn CPU rather a lot which makes them unsuitable for
some applications where SPI is used for bulk data transfers or CPU is
otherwise tight. In general if you've got an actual SPI controller it's
much nicer to use it.
> In order to enable users use multiple CS per master, in spi_s3c64xx.c
> the single CS feature provided by the controller is deliberately left unused
> and the driver accepts a gpio per slave and manually controls it. Though
> the callbacks and arguments are designed so that a simple gpio number
> and gpio_set can be assigned by the machine code.
It did occur to me that a nice way of dealing with this would be to have
the driver default to using the built in chip select (even if driven as
a GPIO for the sake of code simplicity) but leave the current method
there as an override. That way if people are using the IP block in the
"natural" manner they'd have less to set up.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [spi-devel-general] [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config
2010-08-21 19:30 ` [spi-devel-general] " Mark Brown
@ 2010-08-22 3:37 ` Jassi Brar
[not found] ` <AANLkTikDj7YsOQXnFGjZCNRYuQQbLRtKiWw5Sm=vkCuq-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Jassi Brar @ 2010-08-22 3:37 UTC (permalink / raw)
To: Mark Brown; +Cc: David Brownell, Grant Likely, spi-devel-general, linux-kernel
On Sun, Aug 22, 2010 at 4:30 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Sat, Aug 21, 2010 at 10:58:36PM +0900, Jassi Brar wrote:
>> On Sat, Aug 21, 2010 at 7:08 PM, Mark Brown
>> > On Sat, Aug 21, 2010 at 10:45:56AM +0900, Jassi Brar wrote:
>
>> >> The movement of sci assignment and check doesn't make any
>> >> difference because
>> >> we already check for presence of platform_data and DMA-Tx,Rx and
>> >> IO base is
>> >> set irrespective of calling s3c64xx_spi_set_info()
>
>> > While it does check for those things for at least the 6410 they're all
>> > unconditionally set up by dev-spi.c so the tests all pass and we make it
>> > down into to the clk_get() which then falls over horribly.
>
>> Those parameters are SoC specific and hence will be always available to
>> platform devices.
>> Clock selection and num_cs(number of slaves attached to the SPI bus) are
>> machine specific and hence responsibility of the machine developer to
>> set appropriately via s3c64xx_spi_set_info()
>
> Sure, the split does make sense - it's just that this means that we need
> to do something to make sure that s3c64xx_spi_set_info() got called.
An immediate kernel crash ? :)
I mean if the developer didn't even run-check the board init code, he ought
to face a kernel crash.
On a more lenient note, probably a check like yours or !sci->num_cs
could be added.
>> > The problem with num_cs is that it gets interpreted by a custom function
>> > provided by the board driver so we really can't say anything about what
>> > it does.
>
>> num_cs is passed on as such to the SPI core to master->num_chipselect
>> which is strictly checked for before a master is created.
>
> Ah, too many variables with similar functions.
Can't think of a way to go around it.
>> > support gpiolib chip selects - my first thought when I saw that stuff
>> > was that it seemed like something that lots of SPI controllers would be
>> > able to share but I didn't look at the overall SPI code for long enough
>> > to figure out what was going on there.
>
>> we have common spi bitbanging driver that takes only four gpio pins
>> and work like a charm.
>
> Though it does burn CPU rather a lot which makes them unsuitable for
> some applications where SPI is used for bulk data transfers or CPU is
> otherwise tight. In general if you've got an actual SPI controller it's
> much nicer to use it.
of course, and we do use whenever the CLK, MISO and MOSI signals could
be driven by the controller.
>> In order to enable users use multiple CS per master, in spi_s3c64xx.c
>> the single CS feature provided by the controller is deliberately left unused
>> and the driver accepts a gpio per slave and manually controls it. Though
>> the callbacks and arguments are designed so that a simple gpio number
>> and gpio_set can be assigned by the machine code.
>
> It did occur to me that a nice way of dealing with this would be to have
> the driver default to using the built in chip select (even if driven as
> a GPIO for the sake of code simplicity) but leave the current method
> there as an override. That way if people are using the IP block in the
> "natural" manner they'd have less to set up.
I thought about it but decided against it, for that would complicate the
driver by having to switch between two mechanism in runtime and there
are some peculiarities in the controller about clocking and CS'ing.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config
[not found] ` <AANLkTikDj7YsOQXnFGjZCNRYuQQbLRtKiWw5Sm=vkCuq-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-08-23 9:57 ` Mark Brown
0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2010-08-23 9:57 UTC (permalink / raw)
To: Jassi Brar
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
David Brownell, linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Sun, Aug 22, 2010 at 12:37:25PM +0900, Jassi Brar wrote:
> An immediate kernel crash ? :)
> I mean if the developer didn't even run-check the board init code, he ought
> to face a kernel crash.
> On a more lenient note, probably a check like yours or !sci->num_cs
> could be added.
I'd personally not actually be that upset with a BUG_ON(), my main
reason for changing the code was that it was non-obvious what the source
of the error was rather than the fact that things fell over.
> > It did occur to me that a nice way of dealing with this would be to have
> > the driver default to using the built in chip select (even if driven as
> > a GPIO for the sake of code simplicity) but leave the current method
> > there as an override. That way if people are using the IP block in the
> > "natural" manner they'd have less to set up.
> I thought about it but decided against it, for that would complicate the
> driver by having to switch between two mechanism in runtime and there
> are some peculiarities in the controller about clocking and CS'ing.
Yeah, that's why I suggested driving it as a GPIO for simplicity - from
the user point of view it doesn't matter if that's what the controller
does so long as the driver figures out the chip select without external
help.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-08-23 9:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-20 16:17 [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config Mark Brown
2010-08-20 16:17 ` [PATCH 2/2] spi/spi_s3c64xx: Staticise non-exported functions Mark Brown
[not found] ` <1282321028-32196-2-git-send-email-broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2010-08-21 1:52 ` Jassi Brar
2010-08-20 20:46 ` [PATCH 1/2] spi/spi_s3c64xx: Make probe more robust against missing board config Grant Likely
2010-08-21 1:45 ` [spi-devel-general] " Jassi Brar
2010-08-21 10:08 ` Mark Brown
[not found] ` <20100821100855.GA5545-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2010-08-21 13:58 ` Jassi Brar
2010-08-21 19:30 ` [spi-devel-general] " Mark Brown
2010-08-22 3:37 ` Jassi Brar
[not found] ` <AANLkTikDj7YsOQXnFGjZCNRYuQQbLRtKiWw5Sm=vkCuq-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-23 9:57 ` Mark Brown
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).