diff mbox

[1/6] sh: sh7785lcr: add GPIO lookup table for i2c controller reset

Message ID 20170630005408.23968-2-chris.packham@alliedtelesis.co.nz
State Changes Requested
Headers show

Commit Message

Chris Packham June 30, 2017, 12:54 a.m. UTC
Define the GPIO connected to the PCA9564 using a GPIO lookup table. This
will allow the i2c-pca-platform driver to use the device managed APIs to
lookup the gpio instead of using platform_data.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 arch/sh/boards/board-sh7785lcr.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

kernel test robot July 2, 2017, 4:47 p.m. UTC | #1
Hi Chris,

[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on v4.12-rc7 next-20170630]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Packham/sh-sh7785lcr-add-GPIO-lookup-table-for-i2c-controller-reset/20170702-214426
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: sh-sh7785lcr_32bit_defconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sh 

All errors (new ones prefixed by >>):

   arch/sh/boards/board-sh7785lcr.c: In function 'sh7785lcr_devices_setup':
>> arch/sh/boards/board-sh7785lcr.c:295:2: error: implicit declaration of function 'gpiod_add_lookup' [-Werror=implicit-function-declaration]
     gpiod_add_lookup(&i2c_gpio_table);
     ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/gpiod_add_lookup +295 arch/sh/boards/board-sh7785lcr.c

   289	
   290		if (mach_is_sh7785lcr_pt()) {
   291			i2c_device.resource = i2c_proto_resources;
   292			i2c_device.num_resources = ARRAY_SIZE(i2c_proto_resources);
   293		}
   294	
 > 295		gpiod_add_lookup(&i2c_gpio_table);
   296		return platform_add_devices(sh7785lcr_devices,
   297					    ARRAY_SIZE(sh7785lcr_devices));
   298	}

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Geert Uytterhoeven July 2, 2017, 5:15 p.m. UTC | #2
Hi Chris,

On Sun, Jul 2, 2017 at 6:47 PM, kbuild test robot <lkp@intel.com> wrote:
> [auto build test ERROR on wsa/i2c/for-next]
> [also build test ERROR on v4.12-rc7 next-20170630]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Chris-Packham/sh-sh7785lcr-add-GPIO-lookup-table-for-i2c-controller-reset/20170702-214426
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
> config: sh-sh7785lcr_32bit_defconfig (attached as .config)
> compiler: sh4-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=sh
>
> All errors (new ones prefixed by >>):
>
>    arch/sh/boards/board-sh7785lcr.c: In function 'sh7785lcr_devices_setup':
>>> arch/sh/boards/board-sh7785lcr.c:295:2: error: implicit declaration of function 'gpiod_add_lookup' [-Werror=implicit-function-declaration]
>      gpiod_add_lookup(&i2c_gpio_table);

It's called gpiod_add_lookup_table()

https://www.kernel.org/pub/tools/crosstool/ is your friend...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox

Patch

diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c
index 2c4771ee84cd..4c321d0da945 100644
--- a/arch/sh/boards/board-sh7785lcr.c
+++ b/arch/sh/boards/board-sh7785lcr.c
@@ -25,6 +25,7 @@ 
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/errno.h>
+#include <linux/gpio/machine.h>
 #include <mach/sh7785lcr.h>
 #include <cpu/sh7785.h>
 #include <asm/heartbeat.h>
@@ -243,6 +244,14 @@  static struct resource i2c_resources[] = {
 	},
 };
 
+static struct gpiod_lookup_table i2c_gpio_table = {
+	.dev_id = "i2c.0",
+	.table = {
+		GPIO_LOOKUP("pfc-sh7757", 0, "reset-gpios", GPIO_ACTIVE_LOW),
+		{ },
+	},
+};
+
 static struct i2c_pca9564_pf_platform_data i2c_platform_data = {
 	.gpio			= 0,
 	.i2c_clock_speed	= I2C_PCA_CON_330kHz,
@@ -283,6 +292,7 @@  static int __init sh7785lcr_devices_setup(void)
 		i2c_device.num_resources = ARRAY_SIZE(i2c_proto_resources);
 	}
 
+	gpiod_add_lookup(&i2c_gpio_table);
 	return platform_add_devices(sh7785lcr_devices,
 				    ARRAY_SIZE(sh7785lcr_devices));
 }