Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284804
b: refs/heads/master
c: fda8790
h: refs/heads/master
v: v3
  • Loading branch information
Grant Likely committed Jan 5, 2012
1 parent a09e9c4 commit 893b68b
Show file tree
Hide file tree
Showing 42 changed files with 695 additions and 412 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2de0dbc5f6830e7659083d1929f57cb88b16a3b6
refs/heads/master: fda87903f4e9caf87e02d52768c2611e417b7efb
1 change: 1 addition & 0 deletions trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2920,6 +2920,7 @@ F: include/linux/gigaset_dev.h

GPIO SUBSYSTEM
M: Grant Likely <grant.likely@secretlab.ca>
M: Linus Walleij <linus.walleij@stericsson.com>
S: Maintained
T: git git://git.secretlab.ca/git/linux-2.6.git
F: Documentation/gpio.txt
Expand Down
37 changes: 37 additions & 0 deletions trunk/arch/arm/boot/dts/testcases/tests-phandle.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

/ {
testcase-data {
phandle-tests {
provider0: provider0 {
#phandle-cells = <0>;
};

provider1: provider1 {
#phandle-cells = <1>;
};

provider2: provider2 {
#phandle-cells = <2>;
};

provider3: provider3 {
#phandle-cells = <3>;
};

consumer-a {
phandle-list = <&provider1 1>,
<&provider2 2 0>,
<0>,
<&provider3 4 4 3>,
<&provider2 5 100>,
<&provider0>,
<&provider1 7>;
phandle-list-names = "first", "second", "third";

phandle-list-bad-phandle = <12345678 0 0>;
phandle-list-bad-args = <&provider2 1 0>,
<&provider3 0>;
};
};
};
};
1 change: 1 addition & 0 deletions trunk/arch/arm/boot/dts/testcases/tests.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/include/ "tests-phandle.dtsi"
2 changes: 2 additions & 0 deletions trunk/arch/arm/boot/dts/versatile-pb.dts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@
};
};
};

/include/ "testcases/tests.dtsi"
43 changes: 2 additions & 41 deletions trunk/arch/microblaze/kernel/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,11 @@
static int handle; /* reset pin handle */
static unsigned int reset_val;

static int of_reset_gpio_handle(void)
{
int ret; /* variable which stored handle reset gpio pin */
struct device_node *root; /* root node */
struct device_node *gpio; /* gpio node */
struct gpio_chip *gc;
u32 flags;
const void *gpio_spec;

/* find out root node */
root = of_find_node_by_path("/");

/* give me handle for gpio node to be possible allocate pin */
ret = of_parse_phandles_with_args(root, "hard-reset-gpios",
"#gpio-cells", 0, &gpio, &gpio_spec);
if (ret) {
pr_debug("%s: can't parse gpios property\n", __func__);
goto err0;
}

gc = of_node_to_gpiochip(gpio);
if (!gc) {
pr_debug("%s: gpio controller %s isn't registered\n",
root->full_name, gpio->full_name);
ret = -ENODEV;
goto err1;
}

ret = gc->of_xlate(gc, root, gpio_spec, &flags);
if (ret < 0)
goto err1;

ret += gc->base;
err1:
of_node_put(gpio);
err0:
pr_debug("%s exited with status %d\n", __func__, ret);
return ret;
}

void of_platform_reset_gpio_probe(void)
{
int ret;
handle = of_reset_gpio_handle();
handle = of_get_named_gpio(of_find_node_by_path("/"),
"hard-reset-gpios", 0);

if (!gpio_is_valid(handle)) {
printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n",
Expand Down
42 changes: 8 additions & 34 deletions trunk/arch/powerpc/sysdev/qe_lib/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,10 @@ struct qe_pin {
struct qe_pin *qe_pin_request(struct device_node *np, int index)
{
struct qe_pin *qe_pin;
struct device_node *gpio_np;
struct gpio_chip *gc;
struct of_mm_gpio_chip *mm_gc;
struct qe_gpio_chip *qe_gc;
int err;
int size;
const void *gpio_spec;
const u32 *gpio_cells;
unsigned long flags;

qe_pin = kzalloc(sizeof(*qe_pin), GFP_KERNEL);
Expand All @@ -155,45 +151,25 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
return ERR_PTR(-ENOMEM);
}

err = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index,
&gpio_np, &gpio_spec);
if (err) {
pr_debug("%s: can't parse gpios property\n", __func__);
err = of_get_gpio(np, index);
if (err < 0)
goto err0;
gc = gpio_to_chip(err);
if (WARN_ON(!gc))
goto err0;
}

if (!of_device_is_compatible(gpio_np, "fsl,mpc8323-qe-pario-bank")) {
if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) {
pr_debug("%s: tried to get a non-qe pin\n", __func__);
err = -EINVAL;
goto err1;
}

gc = of_node_to_gpiochip(gpio_np);
if (!gc) {
pr_debug("%s: gpio controller %s isn't registered\n",
np->full_name, gpio_np->full_name);
err = -ENODEV;
goto err1;
}

gpio_cells = of_get_property(gpio_np, "#gpio-cells", &size);
if (!gpio_cells || size != sizeof(*gpio_cells) ||
*gpio_cells != gc->of_gpio_n_cells) {
pr_debug("%s: wrong #gpio-cells for %s\n",
np->full_name, gpio_np->full_name);
err = -EINVAL;
goto err1;
goto err0;
}

err = gc->of_xlate(gc, np, gpio_spec, NULL);
if (err < 0)
goto err1;

mm_gc = to_of_mm_gpio_chip(gc);
qe_gc = to_qe_gpio_chip(mm_gc);

spin_lock_irqsave(&qe_gc->lock, flags);

err -= gc->base;
if (test_and_set_bit(QE_PIN_REQUESTED, &qe_gc->pin_flags[err]) == 0) {
qe_pin->controller = qe_gc;
qe_pin->num = err;
Expand All @@ -206,8 +182,6 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)

if (!err)
return qe_pin;
err1:
of_node_put(gpio_np);
err0:
kfree(qe_pin);
pr_debug("%s failed with status %d\n", __func__, err);
Expand Down
11 changes: 6 additions & 5 deletions trunk/drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -388,19 +388,20 @@ config GPIO_LANGWELL
Say Y here to support Intel Langwell/Penwell GPIO.

config GPIO_PCH
tristate "Intel EG20T PCH / OKI SEMICONDUCTOR ML7223 IOH GPIO"
tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7223/ML7831) GPIO"
depends on PCI && X86
select GENERIC_IRQ_CHIP
help
This driver is for PCH(Platform controller Hub) GPIO of Intel Topcliff
which is an IOH(Input/Output Hub) for x86 embedded processor.
This driver can access PCH GPIO device.

This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
Output Hub), ML7223.
This driver also can be used for LAPIS Semiconductor IOH(Input/
Output Hub), ML7223 and ML7831.
ML7223 IOH is for MP(Media Phone) use.
ML7223 is companion chip for Intel Atom E6xx series.
ML7223 is completely compatible for Intel EG20T PCH.
ML7831 IOH is for general purpose use.
ML7223/ML7831 is companion chip for Intel Atom E6xx series.
ML7223/ML7831 is completely compatible for Intel EG20T PCH.

config GPIO_ML_IOH
tristate "OKI SEMICONDUCTOR ML7213 IOH GPIO support"
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG

obj-$(CONFIG_GPIOLIB) += gpiolib.o
obj-$(CONFIG_GPIOLIB) += gpiolib.o devres.o

# Device drivers. Generally keep list sorted alphabetically
obj-$(CONFIG_GPIO_GENERIC) += gpio-generic.o
Expand Down
90 changes: 90 additions & 0 deletions trunk/drivers/gpio/devres.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* drivers/gpio/devres.c - managed gpio resources
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* This file is based on kernel/irq/devres.c
*
* Copyright (c) 2011 John Crispin <blogic@openwrt.org>
*/

#include <linux/module.h>
#include <linux/gpio.h>
#include <linux/device.h>
#include <linux/gfp.h>

static void devm_gpio_release(struct device *dev, void *res)
{
unsigned *gpio = res;

gpio_free(*gpio);
}

static int devm_gpio_match(struct device *dev, void *res, void *data)
{
unsigned *this = res, *gpio = data;

return *this == *gpio;
}

/**
* devm_gpio_request - request a gpio for a managed device
* @dev: device to request the gpio for
* @gpio: gpio to allocate
* @label: the name of the requested gpio
*
* Except for the extra @dev argument, this function takes the
* same arguments and performs the same function as
* gpio_request(). GPIOs requested with this function will be
* automatically freed on driver detach.
*
* If an GPIO allocated with this function needs to be freed
* separately, devm_gpio_free() must be used.
*/

int devm_gpio_request(struct device *dev, unsigned gpio, const char *label)
{
unsigned *dr;
int rc;

dr = devres_alloc(devm_gpio_release, sizeof(unsigned), GFP_KERNEL);
if (!dr)
return -ENOMEM;

rc = gpio_request(gpio, label);
if (rc) {
devres_free(dr);
return rc;
}

*dr = gpio;
devres_add(dev, dr);

return 0;
}
EXPORT_SYMBOL(devm_gpio_request);

/**
* devm_gpio_free - free an interrupt
* @dev: device to free gpio for
* @gpio: gpio to free
*
* Except for the extra @dev argument, this function takes the
* same arguments and performs the same function as gpio_free().
* This function instead of gpio_free() should be used to manually
* free GPIOs allocated with devm_gpio_request().
*/
void devm_gpio_free(struct device *dev, unsigned int gpio)
{

WARN_ON(devres_destroy(dev, devm_gpio_release, devm_gpio_match,
&gpio));
gpio_free(gpio);
}
EXPORT_SYMBOL(devm_gpio_free);
12 changes: 1 addition & 11 deletions trunk/drivers/gpio/gpio-adp5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,7 @@ static struct platform_driver adp5520_gpio_driver = {
.remove = __devexit_p(adp5520_gpio_remove),
};

static int __init adp5520_gpio_init(void)
{
return platform_driver_register(&adp5520_gpio_driver);
}
module_init(adp5520_gpio_init);

static void __exit adp5520_gpio_exit(void)
{
platform_driver_unregister(&adp5520_gpio_driver);
}
module_exit(adp5520_gpio_exit);
module_platform_driver(adp5520_gpio_driver);

MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
MODULE_DESCRIPTION("GPIO ADP5520 Driver");
Expand Down
5 changes: 2 additions & 3 deletions trunk/drivers/gpio/gpio-adp5588.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,8 @@ static int __devinit adp5588_gpio_probe(struct i2c_client *client,
if (ret)
goto err_irq;

dev_info(&client->dev, "gpios %d..%d (IRQ Base %d) on a %s Rev. %d\n",
gc->base, gc->base + gc->ngpio - 1,
pdata->irq_base, client->name, revid);
dev_info(&client->dev, "IRQ Base: %d Rev.: %d\n",
pdata->irq_base, revid);

if (pdata->setup) {
ret = pdata->setup(client, gc->base, gc->ngpio, pdata->context);
Expand Down
3 changes: 0 additions & 3 deletions trunk/drivers/gpio/gpio-bt8xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ static int bt8xxgpio_probe(struct pci_dev *dev,
goto err_release_mem;
}

printk(KERN_INFO "bt8xxgpio: Abusing BT8xx card for GPIOs %d to %d\n",
bg->gpio.base, bg->gpio.base + BT8XXGPIO_NR_GPIOS - 1);

return 0;

err_release_mem:
Expand Down
14 changes: 1 addition & 13 deletions trunk/drivers/gpio/gpio-cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ static int __devinit cs5535_gpio_probe(struct platform_device *pdev)
if (err)
goto release_region;

dev_info(&pdev->dev, "GPIO support successfully loaded.\n");
return 0;

release_region:
Expand Down Expand Up @@ -382,18 +381,7 @@ static struct platform_driver cs5535_gpio_driver = {
.remove = __devexit_p(cs5535_gpio_remove),
};

static int __init cs5535_gpio_init(void)
{
return platform_driver_register(&cs5535_gpio_driver);
}

static void __exit cs5535_gpio_exit(void)
{
platform_driver_unregister(&cs5535_gpio_driver);
}

module_init(cs5535_gpio_init);
module_exit(cs5535_gpio_exit);
module_platform_driver(cs5535_gpio_driver);

MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver");
Expand Down
Loading

0 comments on commit 893b68b

Please sign in to comment.