diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-12-20 17:30:42 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-12-20 17:30:42 -0500 |
commit | 2593f939a5fa7564ba5be0fd5aec4bb1162bd4b2 (patch) | |
tree | e605e977dfb7a03b89ee85ffb643e8645a6752ac /arch/powerpc/sysdev | |
parent | 698cd335a782561b79504d4e98c7df62b08e7abd (diff) | |
parent | c1a676dfa2fa25fb9ec77c92ebe3ff580648b6ac (diff) |
Merge commit 'kumar/next' into merge
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/cpm2_pic.c | 28 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 8 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mpc8xxx_gpio.c | 21 |
3 files changed, 47 insertions, 10 deletions
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c index 971483f0dfac..1709ac5aac7c 100644 --- a/arch/powerpc/sysdev/cpm2_pic.c +++ b/arch/powerpc/sysdev/cpm2_pic.c | |||
@@ -143,13 +143,23 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) | |||
143 | struct irq_desc *desc = irq_to_desc(virq); | 143 | struct irq_desc *desc = irq_to_desc(virq); |
144 | unsigned int vold, vnew, edibit; | 144 | unsigned int vold, vnew, edibit; |
145 | 145 | ||
146 | if (flow_type == IRQ_TYPE_NONE) | 146 | /* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or |
147 | flow_type = IRQ_TYPE_LEVEL_LOW; | 147 | * IRQ_TYPE_EDGE_BOTH (default). All others are IRQ_TYPE_EDGE_FALLING |
148 | 148 | * or IRQ_TYPE_LEVEL_LOW (default) | |
149 | if (flow_type & IRQ_TYPE_EDGE_RISING) { | 149 | */ |
150 | printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n", | 150 | if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) { |
151 | flow_type); | 151 | if (flow_type == IRQ_TYPE_NONE) |
152 | return -EINVAL; | 152 | flow_type = IRQ_TYPE_EDGE_BOTH; |
153 | |||
154 | if (flow_type != IRQ_TYPE_EDGE_BOTH && | ||
155 | flow_type != IRQ_TYPE_EDGE_FALLING) | ||
156 | goto err_sense; | ||
157 | } else { | ||
158 | if (flow_type == IRQ_TYPE_NONE) | ||
159 | flow_type = IRQ_TYPE_LEVEL_LOW; | ||
160 | |||
161 | if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH)) | ||
162 | goto err_sense; | ||
153 | } | 163 | } |
154 | 164 | ||
155 | desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); | 165 | desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); |
@@ -181,6 +191,10 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) | |||
181 | if (vold != vnew) | 191 | if (vold != vnew) |
182 | out_be32(&cpm2_intctl->ic_siexr, vnew); | 192 | out_be32(&cpm2_intctl->ic_siexr, vnew); |
183 | return 0; | 193 | return 0; |
194 | |||
195 | err_sense: | ||
196 | pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type); | ||
197 | return -EINVAL; | ||
184 | } | 198 | } |
185 | 199 | ||
186 | static struct irq_chip cpm2_pic = { | 200 | static struct irq_chip cpm2_pic = { |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 4e3a3e345ab3..e1a028c1f18d 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -464,8 +464,7 @@ static void __iomem *mpc83xx_pcie_remap_cfg(struct pci_bus *bus, | |||
464 | { | 464 | { |
465 | struct pci_controller *hose = pci_bus_to_host(bus); | 465 | struct pci_controller *hose = pci_bus_to_host(bus); |
466 | struct mpc83xx_pcie_priv *pcie = hose->dn->data; | 466 | struct mpc83xx_pcie_priv *pcie = hose->dn->data; |
467 | u8 bus_no = bus->number - hose->first_busno; | 467 | u32 dev_base = bus->number << 24 | devfn << 16; |
468 | u32 dev_base = bus_no << 24 | devfn << 16; | ||
469 | int ret; | 468 | int ret; |
470 | 469 | ||
471 | ret = mpc83xx_pcie_exclude_device(bus, devfn); | 470 | ret = mpc83xx_pcie_exclude_device(bus, devfn); |
@@ -515,12 +514,17 @@ static int mpc83xx_pcie_read_config(struct pci_bus *bus, unsigned int devfn, | |||
515 | static int mpc83xx_pcie_write_config(struct pci_bus *bus, unsigned int devfn, | 514 | static int mpc83xx_pcie_write_config(struct pci_bus *bus, unsigned int devfn, |
516 | int offset, int len, u32 val) | 515 | int offset, int len, u32 val) |
517 | { | 516 | { |
517 | struct pci_controller *hose = pci_bus_to_host(bus); | ||
518 | void __iomem *cfg_addr; | 518 | void __iomem *cfg_addr; |
519 | 519 | ||
520 | cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); | 520 | cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); |
521 | if (!cfg_addr) | 521 | if (!cfg_addr) |
522 | return PCIBIOS_DEVICE_NOT_FOUND; | 522 | return PCIBIOS_DEVICE_NOT_FOUND; |
523 | 523 | ||
524 | /* PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS */ | ||
525 | if (offset == PCI_PRIMARY_BUS && bus->number == hose->first_busno) | ||
526 | val &= 0xffffff00; | ||
527 | |||
524 | switch (len) { | 528 | switch (len) { |
525 | case 1: | 529 | case 1: |
526 | out_8(cfg_addr, val); | 530 | out_8(cfg_addr, val); |
diff --git a/arch/powerpc/sysdev/mpc8xxx_gpio.c b/arch/powerpc/sysdev/mpc8xxx_gpio.c index 103eace36194..ee1c0e1cf4a7 100644 --- a/arch/powerpc/sysdev/mpc8xxx_gpio.c +++ b/arch/powerpc/sysdev/mpc8xxx_gpio.c | |||
@@ -54,6 +54,22 @@ static void mpc8xxx_gpio_save_regs(struct of_mm_gpio_chip *mm) | |||
54 | mpc8xxx_gc->data = in_be32(mm->regs + GPIO_DAT); | 54 | mpc8xxx_gc->data = in_be32(mm->regs + GPIO_DAT); |
55 | } | 55 | } |
56 | 56 | ||
57 | /* Workaround GPIO 1 errata on MPC8572/MPC8536. The status of GPIOs | ||
58 | * defined as output cannot be determined by reading GPDAT register, | ||
59 | * so we use shadow data register instead. The status of input pins | ||
60 | * is determined by reading GPDAT register. | ||
61 | */ | ||
62 | static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio) | ||
63 | { | ||
64 | u32 val; | ||
65 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); | ||
66 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); | ||
67 | |||
68 | val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR); | ||
69 | |||
70 | return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio); | ||
71 | } | ||
72 | |||
57 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) | 73 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) |
58 | { | 74 | { |
59 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); | 75 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); |
@@ -136,7 +152,10 @@ static void __init mpc8xxx_add_controller(struct device_node *np) | |||
136 | gc->ngpio = MPC8XXX_GPIO_PINS; | 152 | gc->ngpio = MPC8XXX_GPIO_PINS; |
137 | gc->direction_input = mpc8xxx_gpio_dir_in; | 153 | gc->direction_input = mpc8xxx_gpio_dir_in; |
138 | gc->direction_output = mpc8xxx_gpio_dir_out; | 154 | gc->direction_output = mpc8xxx_gpio_dir_out; |
139 | gc->get = mpc8xxx_gpio_get; | 155 | if (of_device_is_compatible(np, "fsl,mpc8572-gpio")) |
156 | gc->get = mpc8572_gpio_get; | ||
157 | else | ||
158 | gc->get = mpc8xxx_gpio_get; | ||
140 | gc->set = mpc8xxx_gpio_set; | 159 | gc->set = mpc8xxx_gpio_set; |
141 | 160 | ||
142 | ret = of_mm_gpiochip_add(np, mm_gc); | 161 | ret = of_mm_gpiochip_add(np, mm_gc); |