Message ID | 4898c1f4dc88caa2b19fd04a57b7d20b53494644.1390723880.git.baruch@tkos.co.il (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
On Sun, Jan 26, 2014 at 10:14:33AM +0200, Baruch Siach wrote: > Cc: Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com> > Signed-off-by: Baruch Siach <baruch@tkos.co.il> > --- > drivers/spi/spi-dw-mmio.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) Any new bindings need to be documented.
Hi Mark, On Mon, Jan 27, 2014 at 06:50:04PM +0000, Mark Brown wrote: > On Sun, Jan 26, 2014 at 10:14:33AM +0200, Baruch Siach wrote: > > Cc: Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com> > > Signed-off-by: Baruch Siach <baruch@tkos.co.il> > > --- > > drivers/spi/spi-dw-mmio.c | 17 ++++++++++++++++- > > 1 file changed, 16 insertions(+), 1 deletion(-) > > Any new bindings need to be documented. It should be all documented in patch 4. Is there anything missing? baruch
On Mon, Jan 27, 2014 at 08:54:44PM +0200, Baruch Siach wrote: > On Mon, Jan 27, 2014 at 06:50:04PM +0000, Mark Brown wrote: > > Any new bindings need to be documented. > It should be all documented in patch 4. Is there anything missing? Gah, please document bindings before adding the code - given that it's a hard requirement I didn't even get past the diffstat here.
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index 1492f5ee9aaa..b694f3f9b901 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -16,6 +16,7 @@ #include <linux/spi/spi.h> #include <linux/scatterlist.h> #include <linux/module.h> +#include <linux/of.h> #include "spi-dw.h" @@ -32,6 +33,7 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) struct dw_spi *dws; struct resource *mem; int ret; + u32 tmp; dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio), GFP_KERNEL); @@ -67,7 +69,11 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) return ret; dws->bus_num = pdev->id; - dws->num_cs = 4; + ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &tmp); + if (ret == 0) + dws->num_cs = tmp; + else + dws->num_cs = 4; dws->max_freq = clk_get_rate(dwsmmio->clk); ret = dw_spi_add_host(&pdev->dev, dws); @@ -92,12 +98,21 @@ static int dw_spi_mmio_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static struct of_device_id dw_spi_dt_ids[] = { + { .compatible = "snps,designware-spi" }, + {} +}; +MODULE_DEVICE_TABLE(of, dw_spi_dt_ids); +#endif + static struct platform_driver dw_spi_mmio_driver = { .probe = dw_spi_mmio_probe, .remove = dw_spi_mmio_remove, .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(dw_spi_dt_ids), }, }; module_platform_driver(dw_spi_mmio_driver);
Cc: Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> --- drivers/spi/spi-dw-mmio.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)