Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91549
b: refs/heads/master
c: b7ce341
h: refs/heads/master
i:
  91547: 92b9b28
v: v3
  • Loading branch information
Anton Vorontsov authored and Paul Mackerras committed Apr 16, 2008
1 parent c7485a7 commit 1515a29
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 863fbf4966a7ac301a4077e4a04d73e8abfdd7b2
refs/heads/master: b7ce341585a51a6d65c7a77b6918132a3b360b81
52 changes: 52 additions & 0 deletions trunk/Documentation/powerpc/booting-without-of.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ Table of Contents
3) OpenPIC Interrupt Controllers
4) ISA Interrupt Controllers

VIII - Specifying GPIO information for devices
1) gpios property
2) gpio-controller nodes

Appendix A - Sample SOC node for MPC8540


Expand Down Expand Up @@ -3431,6 +3435,54 @@ encodings listed below:
2 = high to low edge sensitive type enabled
3 = low to high edge sensitive type enabled

VIII - Specifying GPIO information for devices
==============================================

1) gpios property
-----------------

Nodes that makes use of GPIOs should define them using `gpios' property,
format of which is: <&gpio-controller1-phandle gpio1-specifier
&gpio-controller2-phandle gpio2-specifier
0 /* holes are permitted, means no GPIO 3 */
&gpio-controller4-phandle gpio4-specifier
...>;

Note that gpio-specifier length is controller dependent.

gpio-specifier may encode: bank, pin position inside the bank,
whether pin is open-drain and whether pin is logically inverted.

Example of the node using GPIOs:

node {
gpios = <&qe_pio_e 18 0>;
};

In this example gpio-specifier is "18 0" and encodes GPIO pin number,
and empty GPIO flags as accepted by the "qe_pio_e" gpio-controller.

2) gpio-controller nodes
------------------------

Every GPIO controller node must have #gpio-cells property defined,
this information will be used to translate gpio-specifiers.

Example of two SOC GPIO banks defined as gpio-controller nodes:

qe_pio_a: gpio-controller@1400 {
#gpio-cells = <2>;
compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank";
reg = <0x1400 0x18>;
gpio-controller;
};

qe_pio_e: gpio-controller@1460 {
#gpio-cells = <2>;
compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
reg = <0x1460 0x18>;
gpio-controller;
};

Appendix A - Sample SOC node for MPC8540
========================================
Expand Down
5 changes: 5 additions & 0 deletions trunk/arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ config GENERIC_FIND_NEXT_BIT
bool
default y

config GENERIC_GPIO
bool
help
Generic GPIO API support

config ARCH_NO_VIRT_TO_BUS
def_bool PPC64

Expand Down
56 changes: 56 additions & 0 deletions trunk/include/asm-powerpc/gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Generic GPIO API implementation for PowerPC.
*
* Copyright (c) 2007-2008 MontaVista Software, Inc.
*
* Author: Anton Vorontsov <avorontsov@ru.mvista.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/

#ifndef __ASM_POWERPC_GPIO_H
#define __ASM_POWERPC_GPIO_H

#include <linux/errno.h>
#include <asm-generic/gpio.h>

#ifdef CONFIG_HAVE_GPIO_LIB

/*
* We don't (yet) implement inlined/rapid versions for on-chip gpios.
* Just call gpiolib.
*/
static inline int gpio_get_value(unsigned int gpio)
{
return __gpio_get_value(gpio);
}

static inline void gpio_set_value(unsigned int gpio, int value)
{
__gpio_set_value(gpio, value);
}

static inline int gpio_cansleep(unsigned int gpio)
{
return __gpio_cansleep(gpio);
}

/*
* Not implemented, yet.
*/
static inline int gpio_to_irq(unsigned int gpio)
{
return -ENOSYS;
}

static inline int irq_to_gpio(unsigned int irq)
{
return -EINVAL;
}

#endif /* CONFIG_HAVE_GPIO_LIB */

#endif /* __ASM_POWERPC_GPIO_H */

0 comments on commit 1515a29

Please sign in to comment.