[OpenWrt-Devel] [PATCH 1/3] brcm63xx: add bcm6345-gpio driver
Jonas Gorski
jogo at openwrt.org
Fri Dec 12 09:12:56 EST 2014
On Thu, Dec 11, 2014 at 12:51 AM, Álvaro Fernández Rojas
<noltari at gmail.com> wrote:
> Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
> ---
> diff --git a/target/linux/brcm63xx/config-3.14 b/target/linux/brcm63xx/config-3.14
> index dd27f47..f94c567 100644
> --- a/target/linux/brcm63xx/config-3.14
> +++ b/target/linux/brcm63xx/config-3.14
> @@ -76,6 +76,7 @@ CONFIG_GENERIC_IRQ_SHOW=y
> CONFIG_GENERIC_PCI_IOMAP=y
> CONFIG_GENERIC_SMP_IDLE_THREAD=y
> CONFIG_GPIOLIB=y
> +CONFIG_GPIO_BCM6345=y
> CONFIG_GPIO_DEVRES=y
> CONFIG_GPIO_SYSFS=y
> # CONFIG_HAMRADIO is not set
> diff --git a/target/linux/brcm63xx/config-3.18 b/target/linux/brcm63xx/config-3.18
> index e3cf020..7957d02 100644
> --- a/target/linux/brcm63xx/config-3.18
> +++ b/target/linux/brcm63xx/config-3.18
> @@ -80,6 +80,7 @@ CONFIG_GENERIC_IRQ_SHOW=y
> CONFIG_GENERIC_PCI_IOMAP=y
> CONFIG_GENERIC_SMP_IDLE_THREAD=y
> CONFIG_GPIOLIB=y
> +CONFIG_GPIO_BCM6345=y
> CONFIG_GPIO_DEVRES=y
> CONFIG_GPIO_SYSFS=y
> # CONFIG_HAMRADIO is not set
> diff --git a/target/linux/brcm63xx/patches-3.14/374-GPIO-DT-add-bcm6345-driver.patch b/target/linux/brcm63xx/patches-3.14/374-GPIO-DT-add-bcm6345-driver.patch
> new file mode 100644
> index 0000000..a6c775b
> --- /dev/null
> +++ b/target/linux/brcm63xx/patches-3.14/374-GPIO-DT-add-bcm6345-driver.patch
> @@ -0,0 +1,244 @@
> +--- /dev/null
> ++++ b/drivers/gpio/gpio-bcm6345.c
> +@@ -0,0 +1,216 @@
> ++/*
> ++ * This file is subject to the terms and conditions of the GNU General Public
> ++ * License. See the file "COPYING" in the main directory of this archive
> ++ * for more details.
> ++ *
> ++ * Copyright (C) 2008 Maxime Bizon <mbizon at freebox.fr>
> ++ * Copyright (C) 2008-2011 Florian Fainelli <florian at openwrt.org>
> ++ * Copyright (C) 2014 Álvaro Fernández Rojas <noltari at gmail.com>
> ++ */
> ++
> ++#include <linux/kernel.h>
> ++#include <linux/module.h>
> ++#include <linux/spinlock.h>
> ++#include <linux/platform_device.h>
> ++#include <linux/gpio.h>
> ++
> ++enum bcm6345_gpio_reg {
> ++ GPIO_REG_CTL_HI = 0,
> ++ GPIO_REG_CTL_LO,
> ++ GPIO_REG_DATA_HI,
> ++ GPIO_REG_DATA_LO,
> ++ GPIO_REG_MAX
> ++};
> ++
> ++struct bcm6345_gpio_chip {
> ++ struct gpio_chip chip;
> ++ u8 regs[GPIO_REG_MAX];
I think we could replace the whole driver with
e.g. bcm6345:
gpio0: gpio-controller at fffe0404 {
compatible = "basic-mmio-gpio-be";
regs = <0xfffe0404 0x4 0xfffe0408 0x2>
reg-names = "dirin", "dat";
gpio-controller;
#gpio-cells = <2>;
};
and for the ones with > 32 gpios:
gpio0: gpio-controller at 10000084 {
compatible = "basic-mmio-gpio-be";
regs = <0x10000084 0x4 0x1000008c 0x4>
reg-names = "dirin", "dat";
gpio-controller;
#gpio-cells = <2>;
};
gpio1: gpio-controller at 1000080 {
compatible = "basic-mmio-gpio-be";
regs = <0x10000080 0x4 0x1000008c 0x4>
reg-names = "dirin", "dat";
gpio-controller;
#gpio-cells = <2>;
};
Maybe add support for setting ngpios through DT, or make it a usable-mask or so.
For the gpio-base problem, we should be able to register appropriate
platform data for it as OF_DEV_AUXDATA() in of_platform_populate.
e.g.
struct bgpio_pdata gpio0_pdata = {
.base = 0,
};
struct bgpio_pdata gpio1_pdata = {
.base = 32,
};
struct of_dev_auxdata auxdata[] = {
OF_DEV_AUXDATA("basic-mmio-gpio-be",0xfffe0400, NULL, gpio1_pdata),
OF_DEV_AUXDATA("basic-mmio-gpio-be",0xfffe0404, NULL, gpio0_pdata),
OF_DEV_AUXDATA("basic-mmio-gpio-be",0xfffe0080, NULL, gpio1_pdata),
OF_DEV_AUXDATA("basic-mmio-gpio-be",0xfffe0084, NULL, gpio0_pdata),
OF_DEV_AUXDATA("basic-mmio-gpio-be",0x10000080, NULL, gpio1_pdata),
OF_DEV_AUXDATA("basic-mmio-gpio-be",0x10000084, NULL, gpio0_pdata),
};
...
of_platform_populate(... auxdata, );
Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list