Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204902
b: refs/heads/master
c: a19e3da
h: refs/heads/master
v: v3
  • Loading branch information
Anton Vorontsov authored and Grant Likely committed Jul 5, 2010
1 parent 1fdd6d4 commit b2022ea
Show file tree
Hide file tree
Showing 16 changed files with 130 additions and 159 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: cedb1881ba32f7e9cd49250bd79debccbe52b094
refs/heads/master: a19e3da5bc5fc6c10ab73f310bea80f3845b4531
12 changes: 6 additions & 6 deletions trunk/arch/microblaze/kernel/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ 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 of_gpio_chip *of_gc = NULL;
enum of_gpio_flags flags ;
struct gpio_chip *gc;
u32 flags;
const void *gpio_spec;

/* find out root node */
Expand All @@ -39,19 +39,19 @@ static int of_reset_gpio_handle(void)
goto err0;
}

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

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

ret += of_gc->gc.base;
ret += gc->base;
err1:
of_node_put(gpio);
err0:
Expand Down
32 changes: 16 additions & 16 deletions trunk/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,21 @@ static int __devinit mpc52xx_wkup_gpiochip_probe(struct of_device *ofdev,
{
struct mpc52xx_gpiochip *chip;
struct mpc52xx_gpio_wkup __iomem *regs;
struct of_gpio_chip *ofchip;
struct gpio_chip *gc;
int ret;

chip = kzalloc(sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;

ofchip = &chip->mmchip.of_gc;
gc = &chip->mmchip.gc;

ofchip->gpio_cells = 2;
ofchip->gc.ngpio = 8;
ofchip->gc.direction_input = mpc52xx_wkup_gpio_dir_in;
ofchip->gc.direction_output = mpc52xx_wkup_gpio_dir_out;
ofchip->gc.get = mpc52xx_wkup_gpio_get;
ofchip->gc.set = mpc52xx_wkup_gpio_set;
gc->of_gpio_n_cells = 2;
gc->ngpio = 8;
gc->direction_input = mpc52xx_wkup_gpio_dir_in;
gc->direction_output = mpc52xx_wkup_gpio_dir_out;
gc->get = mpc52xx_wkup_gpio_get;
gc->set = mpc52xx_wkup_gpio_set;

ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
if (ret)
Expand Down Expand Up @@ -315,22 +315,22 @@ static int __devinit mpc52xx_simple_gpiochip_probe(struct of_device *ofdev,
const struct of_device_id *match)
{
struct mpc52xx_gpiochip *chip;
struct of_gpio_chip *ofchip;
struct gpio_chip *gc;
struct mpc52xx_gpio __iomem *regs;
int ret;

chip = kzalloc(sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;

ofchip = &chip->mmchip.of_gc;
gc = &chip->mmchip.gc;

ofchip->gpio_cells = 2;
ofchip->gc.ngpio = 32;
ofchip->gc.direction_input = mpc52xx_simple_gpio_dir_in;
ofchip->gc.direction_output = mpc52xx_simple_gpio_dir_out;
ofchip->gc.get = mpc52xx_simple_gpio_get;
ofchip->gc.set = mpc52xx_simple_gpio_set;
gc->of_gpio_n_cells = 2;
gc->ngpio = 32;
gc->direction_input = mpc52xx_simple_gpio_dir_in;
gc->direction_output = mpc52xx_simple_gpio_dir_out;
gc->get = mpc52xx_simple_gpio_get;
gc->set = mpc52xx_simple_gpio_set;

ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
if (ret)
Expand Down
29 changes: 14 additions & 15 deletions trunk/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MODULE_LICENSE("GPL");
* @dev: pointer to device structure
* @regs: virtual address of GPT registers
* @lock: spinlock to coordinate between different functions.
* @of_gc: of_gpio_chip instance structure; used when GPIO is enabled
* @gc: gpio_chip instance structure; used when GPIO is enabled
* @irqhost: Pointer to irq_host instance; used when IRQ mode is supported
* @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicates
* if the gpt may be used as wdt, bit 1 (MPC52xx_GPT_IS_WDT) indicates
Expand All @@ -94,7 +94,7 @@ struct mpc52xx_gpt_priv {
u8 wdt_mode;

#if defined(CONFIG_GPIOLIB)
struct of_gpio_chip of_gc;
struct gpio_chip gc;
#endif
};

Expand Down Expand Up @@ -280,7 +280,7 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
#if defined(CONFIG_GPIOLIB)
static inline struct mpc52xx_gpt_priv *gc_to_mpc52xx_gpt(struct gpio_chip *gc)
{
return container_of(to_of_gpio_chip(gc), struct mpc52xx_gpt_priv,of_gc);
return container_of(gc, struct mpc52xx_gpt_priv, gc);
}

static int mpc52xx_gpt_gpio_get(struct gpio_chip *gc, unsigned int gpio)
Expand Down Expand Up @@ -336,28 +336,27 @@ mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
if (!of_find_property(node, "gpio-controller", NULL))
return;

gpt->of_gc.gc.label = kstrdup(node->full_name, GFP_KERNEL);
if (!gpt->of_gc.gc.label) {
gpt->gc.label = kstrdup(node->full_name, GFP_KERNEL);
if (!gpt->gc.label) {
dev_err(gpt->dev, "out of memory\n");
return;
}

gpt->of_gc.gpio_cells = 2;
gpt->of_gc.gc.ngpio = 1;
gpt->of_gc.gc.direction_input = mpc52xx_gpt_gpio_dir_in;
gpt->of_gc.gc.direction_output = mpc52xx_gpt_gpio_dir_out;
gpt->of_gc.gc.get = mpc52xx_gpt_gpio_get;
gpt->of_gc.gc.set = mpc52xx_gpt_gpio_set;
gpt->of_gc.gc.base = -1;
gpt->of_gc.xlate = of_gpio_simple_xlate;
node->data = &gpt->of_gc;
gpt->gc.ngpio = 1;
gpt->gc.direction_input = mpc52xx_gpt_gpio_dir_in;
gpt->gc.direction_output = mpc52xx_gpt_gpio_dir_out;
gpt->gc.get = mpc52xx_gpt_gpio_get;
gpt->gc.set = mpc52xx_gpt_gpio_set;
gpt->gc.base = -1;
gpt->gc.of_gpio_n_cells = 2;
gpt->gc.of_xlate = of_gpio_simple_xlate;
of_node_get(node);

/* Setup external pin in GPIO mode */
clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK,
MPC52xx_GPT_MODE_MS_GPIO);

rc = gpiochip_add(&gpt->of_gc.gc);
rc = gpiochip_add(&gpt->gc);
if (rc)
dev_err(gpt->dev, "gpiochip_add() failed; rc=%i\n", rc);

Expand Down
15 changes: 6 additions & 9 deletions trunk/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct mcu {
struct mutex lock;
struct device_node *np;
struct i2c_client *client;
struct of_gpio_chip of_gc;
struct gpio_chip gc;
u8 reg_ctrl;
};

Expand All @@ -56,8 +56,7 @@ static void mcu_power_off(void)

static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
{
struct of_gpio_chip *of_gc = to_of_gpio_chip(gc);
struct mcu *mcu = container_of(of_gc, struct mcu, of_gc);
struct mcu *mcu = container_of(gc, struct mcu, gc);
u8 bit = 1 << (4 + gpio);

mutex_lock(&mcu->lock);
Expand All @@ -79,8 +78,7 @@ static int mcu_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
static int mcu_gpiochip_add(struct mcu *mcu)
{
struct device_node *np;
struct of_gpio_chip *of_gc = &mcu->of_gc;
struct gpio_chip *gc = &of_gc->gc;
struct gpio_chip *gc = &mcu->gc;
int ret;

np = of_find_compatible_node(NULL, NULL, "fsl,mcu-mpc8349emitx");
Expand All @@ -94,10 +92,9 @@ static int mcu_gpiochip_add(struct mcu *mcu)
gc->base = -1;
gc->set = mcu_gpio_set;
gc->direction_output = mcu_gpio_dir_out;
of_gc->gpio_cells = 2;
of_gc->xlate = of_gpio_simple_xlate;
gc->of_gpio_n_cells = 2;
gc->of_xlate = of_gpio_simple_xlate;

np->data = of_gc;
mcu->np = np;

/*
Expand All @@ -114,7 +111,7 @@ static int mcu_gpiochip_remove(struct mcu *mcu)
{
int ret;

ret = gpiochip_remove(&mcu->of_gc.gc);
ret = gpiochip_remove(&mcu->gc);
if (ret)
return ret;
of_node_put(mcu->np);
Expand Down
24 changes: 12 additions & 12 deletions trunk/arch/powerpc/platforms/86xx/gef_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ static int __init gef_gpio_init(void)
}

/* Setup pointers to chip functions */
gef_gpio_chip->of_gc.gpio_cells = 2;
gef_gpio_chip->of_gc.gc.ngpio = 19;
gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in;
gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out;
gef_gpio_chip->of_gc.gc.get = gef_gpio_get;
gef_gpio_chip->of_gc.gc.set = gef_gpio_set;
gef_gpio_chip->gc.of_gpio_n_cells = 2;
gef_gpio_chip->gc.ngpio = 19;
gef_gpio_chip->gc.direction_input = gef_gpio_dir_in;
gef_gpio_chip->gc.direction_output = gef_gpio_dir_out;
gef_gpio_chip->gc.get = gef_gpio_get;
gef_gpio_chip->gc.set = gef_gpio_set;

/* This function adds a memory mapped GPIO chip */
retval = of_mm_gpiochip_add(np, gef_gpio_chip);
Expand All @@ -146,12 +146,12 @@ static int __init gef_gpio_init(void)
}

/* Setup pointers to chip functions */
gef_gpio_chip->of_gc.gpio_cells = 2;
gef_gpio_chip->of_gc.gc.ngpio = 6;
gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in;
gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out;
gef_gpio_chip->of_gc.gc.get = gef_gpio_get;
gef_gpio_chip->of_gc.gc.set = gef_gpio_set;
gef_gpio_chip->gc.of_gpio_n_cells = 2;
gef_gpio_chip->gc.ngpio = 6;
gef_gpio_chip->gc.direction_input = gef_gpio_dir_in;
gef_gpio_chip->gc.direction_output = gef_gpio_dir_out;
gef_gpio_chip->gc.get = gef_gpio_get;
gef_gpio_chip->gc.set = gef_gpio_set;

/* This function adds a memory mapped GPIO chip */
retval = of_mm_gpiochip_add(np, gef_gpio_chip);
Expand Down
12 changes: 4 additions & 8 deletions trunk/arch/powerpc/sysdev/cpm1.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ int cpm1_gpiochip_add16(struct device_node *np)
{
struct cpm1_gpio16_chip *cpm1_gc;
struct of_mm_gpio_chip *mm_gc;
struct of_gpio_chip *of_gc;
struct gpio_chip *gc;

cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
Expand All @@ -631,11 +630,10 @@ int cpm1_gpiochip_add16(struct device_node *np)
spin_lock_init(&cpm1_gc->lock);

mm_gc = &cpm1_gc->mm_gc;
of_gc = &mm_gc->of_gc;
gc = &of_gc->gc;
gc = &mm_gc->gc;

mm_gc->save_regs = cpm1_gpio16_save_regs;
of_gc->gpio_cells = 2;
gc->of_gpio_n_cells = 2;
gc->ngpio = 16;
gc->direction_input = cpm1_gpio16_dir_in;
gc->direction_output = cpm1_gpio16_dir_out;
Expand Down Expand Up @@ -745,7 +743,6 @@ int cpm1_gpiochip_add32(struct device_node *np)
{
struct cpm1_gpio32_chip *cpm1_gc;
struct of_mm_gpio_chip *mm_gc;
struct of_gpio_chip *of_gc;
struct gpio_chip *gc;

cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
Expand All @@ -755,11 +752,10 @@ int cpm1_gpiochip_add32(struct device_node *np)
spin_lock_init(&cpm1_gc->lock);

mm_gc = &cpm1_gc->mm_gc;
of_gc = &mm_gc->of_gc;
gc = &of_gc->gc;
gc = &mm_gc->gc;

mm_gc->save_regs = cpm1_gpio32_save_regs;
of_gc->gpio_cells = 2;
gc->of_gpio_n_cells = 2;
gc->ngpio = 32;
gc->direction_input = cpm1_gpio32_dir_in;
gc->direction_output = cpm1_gpio32_dir_out;
Expand Down
6 changes: 2 additions & 4 deletions trunk/arch/powerpc/sysdev/cpm_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ int cpm2_gpiochip_add32(struct device_node *np)
{
struct cpm2_gpio32_chip *cpm2_gc;
struct of_mm_gpio_chip *mm_gc;
struct of_gpio_chip *of_gc;
struct gpio_chip *gc;

cpm2_gc = kzalloc(sizeof(*cpm2_gc), GFP_KERNEL);
Expand All @@ -335,11 +334,10 @@ int cpm2_gpiochip_add32(struct device_node *np)
spin_lock_init(&cpm2_gc->lock);

mm_gc = &cpm2_gc->mm_gc;
of_gc = &mm_gc->of_gc;
gc = &of_gc->gc;
gc = &mm_gc->gc;

mm_gc->save_regs = cpm2_gpio32_save_regs;
of_gc->gpio_cells = 2;
gc->of_gpio_n_cells = 2;
gc->ngpio = 32;
gc->direction_input = cpm2_gpio32_dir_in;
gc->direction_output = cpm2_gpio32_dir_out;
Expand Down
6 changes: 2 additions & 4 deletions trunk/arch/powerpc/sysdev/mpc8xxx_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
{
struct mpc8xxx_gpio_chip *mpc8xxx_gc;
struct of_mm_gpio_chip *mm_gc;
struct of_gpio_chip *of_gc;
struct gpio_chip *gc;
unsigned hwirq;
int ret;
Expand All @@ -271,11 +270,10 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
spin_lock_init(&mpc8xxx_gc->lock);

mm_gc = &mpc8xxx_gc->mm_gc;
of_gc = &mm_gc->of_gc;
gc = &of_gc->gc;
gc = &mm_gc->gc;

mm_gc->save_regs = mpc8xxx_gpio_save_regs;
of_gc->gpio_cells = 2;
gc->of_gpio_n_cells = 2;
gc->ngpio = MPC8XXX_GPIO_PINS;
gc->direction_input = mpc8xxx_gpio_dir_in;
gc->direction_output = mpc8xxx_gpio_dir_out;
Expand Down
6 changes: 2 additions & 4 deletions trunk/arch/powerpc/sysdev/ppc4xx_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ static int __init ppc4xx_add_gpiochips(void)
int ret;
struct ppc4xx_gpio_chip *ppc4xx_gc;
struct of_mm_gpio_chip *mm_gc;
struct of_gpio_chip *of_gc;
struct gpio_chip *gc;

ppc4xx_gc = kzalloc(sizeof(*ppc4xx_gc), GFP_KERNEL);
Expand All @@ -193,10 +192,9 @@ static int __init ppc4xx_add_gpiochips(void)
spin_lock_init(&ppc4xx_gc->lock);

mm_gc = &ppc4xx_gc->mm_gc;
of_gc = &mm_gc->of_gc;
gc = &of_gc->gc;
gc = &mm_gc->gc;

of_gc->gpio_cells = 2;
gc->of_gpio_n_cells = 2;
gc->ngpio = 32;
gc->direction_input = ppc4xx_gpio_dir_in;
gc->direction_output = ppc4xx_gpio_dir_out;
Expand Down
Loading

0 comments on commit b2022ea

Please sign in to comment.