From: Richard Genoud <richard.genoud-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Subject: [PATCH 08/23] spi/atmel: add DT support Date: Tue, 14 Aug 2012 15:49:22 +0200 [thread overview] Message-ID: <1344952177-18385-9-git-send-email-richard.genoud@gmail.com> (raw) In-Reply-To: <1344952177-18385-1-git-send-email-richard.genoud-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org> The atmel_spi use only gpio for chip select. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org --- .../devicetree/bindings/spi/spi_atmel.txt | 6 +++++ drivers/spi/spi-atmel.c | 21 ++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt b/Documentation/devicetree/bindings/spi/spi_atmel.txt new file mode 100644 index 0000000..7ec3d8d --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt @@ -0,0 +1,6 @@ +Atmel SPI device + +Required properties: +- compatible : should be "atmel,at91rm9200-spi". +- reg: Address and length of the register set for the device +- interrupts: Should contain macb interrupt diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 70f7bfa..ad47b6d 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -19,6 +19,7 @@ #include <linux/interrupt.h> #include <linux/spi/spi.h> #include <linux/slab.h> +#include <linux/of.h> #include <asm/io.h> #include <mach/board.h> @@ -711,7 +712,7 @@ static int atmel_spi_setup(struct spi_device *spi) u32 scbr, csr; unsigned int bits = spi->bits_per_word; unsigned long bus_hz; - unsigned int npcs_pin; + int npcs_pin; int ret; as = spi_master_get_devdata(spi->master); @@ -783,7 +784,9 @@ static int atmel_spi_setup(struct spi_device *spi) csr |= SPI_BF(DLYBCT, 0); /* chipselect must have been muxed as GPIO (e.g. in board setup) */ - npcs_pin = (unsigned int)spi->controller_data; + if (!gpio_is_valid(spi->cs_gpio)) + spi->cs_gpio = (int)spi->controller_data; + npcs_pin = spi->cs_gpio; asd = spi->controller_state; if (!asd) { asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL); @@ -900,7 +903,7 @@ static void atmel_spi_cleanup(struct spi_device *spi) { struct atmel_spi *as = spi_master_get_devdata(spi->master); struct atmel_spi_device *asd = spi->controller_state; - unsigned gpio = (unsigned) spi->controller_data; + unsigned gpio = spi->cs_gpio; if (!asd) return; @@ -950,7 +953,8 @@ static int __devinit atmel_spi_probe(struct platform_device *pdev) master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; master->bus_num = pdev->id; - master->num_chipselect = 4; + master->dev.of_node = pdev->dev.of_node; + master->num_chipselect = master->dev.of_node ? 0 : 4; master->setup = atmel_spi_setup; master->transfer = atmel_spi_transfer; master->cleanup = atmel_spi_cleanup; @@ -1079,11 +1083,20 @@ static int atmel_spi_resume(struct platform_device *pdev) #define atmel_spi_resume NULL #endif +#if defined(CONFIG_OF) +static const struct of_device_id atmel_spi_dt_ids[] = { + { .compatible = "atmel,at91rm9200-spi" }, + { /* sentinel */ } +}; + +MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids); +#endif static struct platform_driver atmel_spi_driver = { .driver = { .name = "atmel_spi", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(atmel_spi_dt_ids), }, .suspend = atmel_spi_suspend, .resume = atmel_spi_resume, -- 1.7.2.5 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
WARNING: multiple messages have this Message-ID (diff)
From: richard.genoud@gmail.com (Richard Genoud) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/23] spi/atmel: add DT support Date: Tue, 14 Aug 2012 15:49:22 +0200 [thread overview] Message-ID: <1344952177-18385-9-git-send-email-richard.genoud@gmail.com> (raw) In-Reply-To: <1344952177-18385-1-git-send-email-richard.genoud@gmail.com> From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> The atmel_spi use only gpio for chip select. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: devicetree-discuss at lists.ozlabs.org Cc: spi-devel-general at lists.sourceforge.net --- .../devicetree/bindings/spi/spi_atmel.txt | 6 +++++ drivers/spi/spi-atmel.c | 21 ++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt b/Documentation/devicetree/bindings/spi/spi_atmel.txt new file mode 100644 index 0000000..7ec3d8d --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt @@ -0,0 +1,6 @@ +Atmel SPI device + +Required properties: +- compatible : should be "atmel,at91rm9200-spi". +- reg: Address and length of the register set for the device +- interrupts: Should contain macb interrupt diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 70f7bfa..ad47b6d 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -19,6 +19,7 @@ #include <linux/interrupt.h> #include <linux/spi/spi.h> #include <linux/slab.h> +#include <linux/of.h> #include <asm/io.h> #include <mach/board.h> @@ -711,7 +712,7 @@ static int atmel_spi_setup(struct spi_device *spi) u32 scbr, csr; unsigned int bits = spi->bits_per_word; unsigned long bus_hz; - unsigned int npcs_pin; + int npcs_pin; int ret; as = spi_master_get_devdata(spi->master); @@ -783,7 +784,9 @@ static int atmel_spi_setup(struct spi_device *spi) csr |= SPI_BF(DLYBCT, 0); /* chipselect must have been muxed as GPIO (e.g. in board setup) */ - npcs_pin = (unsigned int)spi->controller_data; + if (!gpio_is_valid(spi->cs_gpio)) + spi->cs_gpio = (int)spi->controller_data; + npcs_pin = spi->cs_gpio; asd = spi->controller_state; if (!asd) { asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL); @@ -900,7 +903,7 @@ static void atmel_spi_cleanup(struct spi_device *spi) { struct atmel_spi *as = spi_master_get_devdata(spi->master); struct atmel_spi_device *asd = spi->controller_state; - unsigned gpio = (unsigned) spi->controller_data; + unsigned gpio = spi->cs_gpio; if (!asd) return; @@ -950,7 +953,8 @@ static int __devinit atmel_spi_probe(struct platform_device *pdev) master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; master->bus_num = pdev->id; - master->num_chipselect = 4; + master->dev.of_node = pdev->dev.of_node; + master->num_chipselect = master->dev.of_node ? 0 : 4; master->setup = atmel_spi_setup; master->transfer = atmel_spi_transfer; master->cleanup = atmel_spi_cleanup; @@ -1079,11 +1083,20 @@ static int atmel_spi_resume(struct platform_device *pdev) #define atmel_spi_resume NULL #endif +#if defined(CONFIG_OF) +static const struct of_device_id atmel_spi_dt_ids[] = { + { .compatible = "atmel,at91rm9200-spi" }, + { /* sentinel */ } +}; + +MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids); +#endif static struct platform_driver atmel_spi_driver = { .driver = { .name = "atmel_spi", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(atmel_spi_dt_ids), }, .suspend = atmel_spi_suspend, .resume = atmel_spi_resume, -- 1.7.2.5
next prev parent reply other threads:[~2012-08-14 13:49 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-08-14 13:49 [PATCH 00/23] work in progress: SPI controller w/DMA SAM9X5 Richard Genoud 2012-08-14 13:49 ` [PATCH 01/23] of: add dma-mask binding Richard Genoud [not found] ` <1344952177-18385-1-git-send-email-richard.genoud-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2012-08-14 13:49 ` [PATCH 02/23] of_spi: add generic binding support to specify cs gpio Richard Genoud 2012-08-14 13:49 ` Richard Genoud 2012-08-14 13:49 ` Richard Genoud [this message] 2012-08-14 13:49 ` [PATCH 08/23] spi/atmel: add DT support Richard Genoud 2012-08-14 13:49 ` [PATCH 03/23] spi/atmel_spi: trivial: change some comments Richard Genoud 2012-08-14 13:49 ` [PATCH 04/23] spi/atmel_spi: add physical base address Richard Genoud 2012-08-14 13:49 ` [PATCH 05/23] spi/atmel_spi: call unmapping on transfers buffers Richard Genoud 2012-08-14 13:49 ` [PATCH 06/23] spi/atmel_spi: status information passed through controller data Richard Genoud 2012-08-14 13:49 ` [PATCH 07/23] spi/atmel_spi: add flag to controller data for lock operations Richard Genoud 2012-08-14 13:49 ` [PATCH 09/23] spi/atmel_spi: add dmaengine support Richard Genoud 2012-08-14 13:49 ` [PATCH 10/23] spi-atmel: update with dmaengine interface Richard Genoud 2012-08-14 13:49 ` [PATCH 11/23] spi-atmel: fix __init/__devinit sections mismatch Richard Genoud 2012-08-14 13:49 ` [PATCH 12/23] spi-atmel: Fix spi-atmel driver to adapt to slave_config changes Richard Genoud 2012-08-14 13:49 ` [PATCH 13/23] AT91 DMA OF support Richard Genoud 2012-08-14 14:47 ` Nicolas Ferre 2012-08-14 13:49 ` [PATCH 14/23] add at91sam9x5 Kconfig ARCH/SOC link Richard Genoud 2012-08-14 13:49 ` [PATCH 15/23] spi-atmel: add DMA OF support Richard Genoud 2012-08-14 13:49 ` [PATCH 16/23] [BUG] SPI: array out of bound => no CS Richard Genoud 2012-08-14 13:49 ` [PATCH 17/23] [BUG] atmel-spi && DMA: OOPS if buffer > 4400 bytes Richard Genoud 2012-08-14 13:49 ` [PATCH 18/23] sam9x5: declare SPI clocks Richard Genoud 2012-08-14 13:49 ` [PATCH 19/23] spi-atmel: add sam9x5 SPI in device tree Richard Genoud 2012-08-14 13:49 ` [PATCH 20/23] spi-atmel: add dma support in sam9x5 " Richard Genoud 2012-08-14 13:49 ` [PATCH 21/23] spi-atmel OF: complete documentation Richard Genoud 2012-08-14 13:49 ` [PATCH 22/23] spi-atmel: complete DMA slave OF documentation Richard Genoud 2012-08-14 13:49 ` [PATCH 23/23] sam9x5ek DTS: enable SPI dataflash Richard Genoud 2012-08-14 14:16 ` [PATCH 00/23] work in progress: SPI controller w/DMA SAM9X5 Richard Genoud 2012-08-14 15:29 ` Nicolas Ferre 2012-08-14 17:44 ` Jean-Christophe PLAGNIOL-VILLARD 2012-08-14 17:48 ` Nicolas Ferre 2012-08-16 7:07 ` Richard Genoud
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1344952177-18385-9-git-send-email-richard.genoud@gmail.com \ --to=richard.genoud-re5jqeeqqe8avxtiumwx3w@public.gmane.org \ --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \ --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org \ --cc=plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org \ --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.