All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Packham <chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
To: andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [RFC PATCH v2 08/12] ARM: ep93xx: add gpiod_lookup_table for spi chip-selects
Date: Fri, 28 Jul 2017 10:03:18 +1200	[thread overview]
Message-ID: <20170727220322.26654-9-chris.packham@alliedtelesis.co.nz> (raw)
In-Reply-To: <20170727220322.26654-1-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>

This is a preparatory step which will allow the conversion of
spi-ep93xx.c to gpiod.

Signed-off-by: Chris Packham <chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
---
 arch/arm/mach-ep93xx/edb93xx.c       | 12 ++++++++++++
 arch/arm/mach-ep93xx/simone.c        | 11 +++++++++++
 arch/arm/mach-ep93xx/vision_ep9307.c | 15 +++++++++++++++
 3 files changed, 38 insertions(+)

diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 0ac176386789..9042adfe03de 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -27,6 +27,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
 #include <linux/i2c.h>
 #include <linux/i2c-gpio.h>
 #include <linux/spi/spi.h>
@@ -116,6 +118,15 @@ static struct spi_board_info edb93xx_spi_board_info[] __initdata = {
 	},
 };
 
+static struct gpiod_lookup_table edb93xx_gpios_table = {
+	.dev_id = "spi.0",
+	.table = {
+		GPIO_LOOKUP("gpio-ep93xx", EP93XX_GPIO_LINE_EGPIO6,
+			    "spi-cs", GPIO_ACTIVE_HIGH),
+		{},
+	},
+};
+
 static int edb93xx_spi_chipselects[] __initdata = {
 	EP93XX_GPIO_LINE_EGPIO6,
 };
@@ -134,6 +145,7 @@ static void __init edb93xx_register_spi(void)
 	else if (machine_is_edb9315a())
 		edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14;
 
+	gpiod_add_lookup_table(&edb93xx_gpios_table);
 	ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info,
 			    ARRAY_SIZE(edb93xx_spi_board_info));
 }
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index c7a40f245892..f297a7a89ed9 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -26,6 +26,7 @@
 #include <linux/platform_data/video-ep93xx.h>
 #include <linux/platform_data/spi-ep93xx.h>
 #include <linux/gpio.h>
+#include <linux/gpio/machine.h>
 
 #include <mach/hardware.h>
 #include <mach/gpio-ep93xx.h>
@@ -119,6 +120,15 @@ static struct spi_board_info simone_spi_devices[] __initdata = {
  * low between multi-message command blocks. From v1.4, it uses a GPIO instead.
  * v1.3 parts will still work, since the signal on SFRMOUT is automatic.
  */
+static struct gpiod_lookup_table simone_gpios_table = {
+	.dev_id = "spi.0",
+	.table = {
+		GPIO_LOOKUP("gpio-ep93xx", EP93XX_GPIO_LINE_EGPIO1,
+			    "spi-cs", GPIO_ACTIVE_HIGH),
+		{},
+	},
+};
+
 static int simone_spi_chipselects[] __initdata = {
 	EP93XX_GPIO_LINE_EGPIO1,
 };
@@ -163,6 +173,7 @@ static void __init simone_init_machine(void)
 	ep93xx_register_fb(&simone_fb_info);
 	ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info,
 			    ARRAY_SIZE(simone_i2c_board_info));
+	gpiod_add_lookup_table(&simone_gpios_table);
 	ep93xx_register_spi(&simone_spi_info, simone_spi_devices,
 			    ARRAY_SIZE(simone_spi_devices));
 	simone_register_audio();
diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c
index 1daf9441058c..3d9c66bbf2af 100644
--- a/arch/arm/mach-ep93xx/vision_ep9307.c
+++ b/arch/arm/mach-ep93xx/vision_ep9307.c
@@ -18,6 +18,7 @@
 #include <linux/platform_device.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
+#include <linux/gpio/machine.h>
 #include <linux/fb.h>
 #include <linux/io.h>
 #include <linux/mtd/partitions.h>
@@ -242,6 +243,19 @@ static struct spi_board_info vision_spi_board_info[] __initdata = {
 	},
 };
 
+static struct gpiod_lookup_table vision_gpios_table = {
+	.dev_id = "spi.0",
+	.table = {
+		GPIO_LOOKUP_IDX("gpio-ep93xx", EP93XX_GPIO_LINE_EGPIO6,
+				"spi-cs", 0, GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP_IDX("gpio-ep93xx", EP93XX_GPIO_LINE_EGPIO7,
+				"spi-cs", 1, GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP_IDX("gpio-ep93xx", EP93XX_GPIO_LINE_G(2),
+				"spi-cs", 2, GPIO_ACTIVE_HIGH),
+		{},
+	},
+};
+
 static int vision_spi_chipselects[] __initdata = {
 	EP93XX_GPIO_LINE_EGPIO6,
 	EP93XX_GPIO_LINE_EGPIO7,
@@ -291,6 +305,7 @@ static void __init vision_init_machine(void)
 
 	ep93xx_register_i2c(&vision_i2c_gpio_data, vision_i2c_info,
 				ARRAY_SIZE(vision_i2c_info));
+	gpiod_add_lookup_table(&vision_gpios_table);
 	ep93xx_register_spi(&vision_spi_master, vision_spi_board_info,
 				ARRAY_SIZE(vision_spi_board_info));
 	vision_register_i2s();
-- 
2.13.0

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-07-27 22:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27 22:03 [RFC PATCH v2 00/12] spi: moving to struct gpio_desc Chris Packham
     [not found] ` <20170727220322.26654-1-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
2017-07-27 22:03   ` [RFC PATCH v2 01/12] spi: spi-ep93xx: use 32-bit read/write for all registers Chris Packham
2017-07-27 22:03   ` [RFC PATCH v2 02/12] spi: spi-ep93xx: add spi master prepare_transfer_hardware() Chris Packham
2017-07-27 22:03   ` [RFC PATCH v2 03/12] spi: spi-ep93xx: absorb the interrupt enable/disable helpers Chris Packham
2017-07-27 22:03   ` [RFC PATCH v2 04/12] spi: spi-ep93xx: pass the spi_master pointer around Chris Packham
2017-07-27 22:03   ` [RFC PATCH v2 05/12] spi: spi-ep93xx: remove private data 'current_msg' Chris Packham
2017-07-27 22:03   ` [RFC PATCH v2 06/12] spi: spi-ep93xx: use the default master transfer queueing mechanism Chris Packham
2017-07-27 22:03   ` [RFC PATCH v2 07/12] spi: use gpio_desc instead of numeric gpio Chris Packham
2017-07-27 22:03   ` Chris Packham [this message]
2017-07-27 22:03   ` [RFC PATCH v2 09/12] ARM: imx: add gpiod_lookup_table for spi chip-selects Chris Packham
2017-07-27 22:03   ` [RFC PATCH v2 10/12] spi: core: convert spi_master to use gpio_desc Chris Packham
     [not found]     ` <20170727220322.26654-11-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
2017-11-24 12:59       ` Geert Uytterhoeven
2017-07-27 22:03   ` [RFC PATCH v2 11/12] ARM: ep93xx: remove chipselect from ep93xx_spi_info Chris Packham
2017-07-27 22:03   ` [RFC PATCH v2 12/12] wip: convert struct spi_device to gpio_desc Chris Packham
     [not found]     ` <20170727220322.26654-13-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
2017-11-24 13:03       ` Geert Uytterhoeven
2017-07-29 13:15   ` [RFC PATCH v2 00/12] spi: moving to struct gpio_desc Andy Shevchenko
     [not found]     ` <CAHp75VeVijF13AO=SqkxtAaiYhss92gwrtCZ2WnxkkKtvjVS3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-29 13:23       ` Andy Shevchenko

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=20170727220322.26654-9-chris.packham@alliedtelesis.co.nz \
    --to=chris.packham-6g8wrflrtwxfdca3tkvle6u/zskkhjvu@public.gmane.org \
    --cc=andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@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: link
Be 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.