diff options
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/bestcomm/Kconfig | 4 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm1.c | 1 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm2.c | 4 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_lbc.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 244 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 113 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.h | 7 | ||||
-rw-r--r-- | arch/powerpc/sysdev/ipic.c | 6 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 34 | ||||
-rw-r--r-- | arch/powerpc/sysdev/msi_bitmap.c | 6 | ||||
-rw-r--r-- | arch/powerpc/sysdev/pmi.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/ppc4xx_pci.c | 2 |
13 files changed, 275 insertions, 152 deletions
diff --git a/arch/powerpc/sysdev/bestcomm/Kconfig b/arch/powerpc/sysdev/bestcomm/Kconfig index 0b192a1c429d..29e427085efb 100644 --- a/arch/powerpc/sysdev/bestcomm/Kconfig +++ b/arch/powerpc/sysdev/bestcomm/Kconfig | |||
@@ -9,8 +9,8 @@ config PPC_BESTCOMM | |||
9 | select PPC_LIB_RHEAP | 9 | select PPC_LIB_RHEAP |
10 | help | 10 | help |
11 | BestComm is the name of the communication coprocessor found | 11 | BestComm is the name of the communication coprocessor found |
12 | on the Freescale MPC5200 family of processor. It's usage is | 12 | on the Freescale MPC5200 family of processor. Its usage is |
13 | optionnal for some drivers (like ATA), but required for | 13 | optional for some drivers (like ATA), but required for |
14 | others (like FEC). | 14 | others (like FEC). |
15 | 15 | ||
16 | If you want to use drivers that require DMA operations, | 16 | If you want to use drivers that require DMA operations, |
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c index 490473ce8103..82424cd7e128 100644 --- a/arch/powerpc/sysdev/cpm1.c +++ b/arch/powerpc/sysdev/cpm1.c | |||
@@ -119,7 +119,6 @@ static irqreturn_t cpm_error_interrupt(int irq, void *dev) | |||
119 | 119 | ||
120 | static struct irqaction cpm_error_irqaction = { | 120 | static struct irqaction cpm_error_irqaction = { |
121 | .handler = cpm_error_interrupt, | 121 | .handler = cpm_error_interrupt, |
122 | .mask = CPU_MASK_NONE, | ||
123 | .name = "error", | 122 | .name = "error", |
124 | }; | 123 | }; |
125 | 124 | ||
diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c index f1c3395633b9..fd969f0e3121 100644 --- a/arch/powerpc/sysdev/cpm2.c +++ b/arch/powerpc/sysdev/cpm2.c | |||
@@ -52,6 +52,7 @@ cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor space */ | |||
52 | * the communication processor devices. | 52 | * the communication processor devices. |
53 | */ | 53 | */ |
54 | cpm2_map_t __iomem *cpm2_immr; | 54 | cpm2_map_t __iomem *cpm2_immr; |
55 | EXPORT_SYMBOL(cpm2_immr); | ||
55 | 56 | ||
56 | #define CPM_MAP_SIZE (0x40000) /* 256k - the PQ3 reserve this amount | 57 | #define CPM_MAP_SIZE (0x40000) /* 256k - the PQ3 reserve this amount |
57 | of space for CPM as it is larger | 58 | of space for CPM as it is larger |
@@ -129,7 +130,8 @@ void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src) | |||
129 | brg -= 4; | 130 | brg -= 4; |
130 | } | 131 | } |
131 | bp += brg; | 132 | bp += brg; |
132 | val = (((clk / rate) - 1) << 1) | CPM_BRG_EN | src; | 133 | /* Round the clock divider to the nearest integer. */ |
134 | val = (((clk * 2 / rate) - 1) & ~1) | CPM_BRG_EN | src; | ||
133 | if (div16) | 135 | if (div16) |
134 | val |= CPM_BRG_DIV16; | 136 | val |= CPM_BRG_DIV16; |
135 | 137 | ||
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c index 00d3d17c84a3..e4b6d66d93de 100644 --- a/arch/powerpc/sysdev/cpm_common.c +++ b/arch/powerpc/sysdev/cpm_common.c | |||
@@ -56,7 +56,7 @@ void __init udbg_init_cpm(void) | |||
56 | { | 56 | { |
57 | if (cpm_udbg_txdesc) { | 57 | if (cpm_udbg_txdesc) { |
58 | #ifdef CONFIG_CPM2 | 58 | #ifdef CONFIG_CPM2 |
59 | setbat(1, 0xf0000000, 0xf0000000, 1024*1024, _PAGE_IO); | 59 | setbat(1, 0xf0000000, 0xf0000000, 1024*1024, PAGE_KERNEL_NCG); |
60 | #endif | 60 | #endif |
61 | udbg_putc = udbg_putc_cpm; | 61 | udbg_putc = udbg_putc_cpm; |
62 | } | 62 | } |
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index 0494ee55920f..dceb8d1a843d 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c | |||
@@ -150,7 +150,7 @@ int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar) | |||
150 | 150 | ||
151 | spin_lock_irqsave(&fsl_lbc_lock, flags); | 151 | spin_lock_irqsave(&fsl_lbc_lock, flags); |
152 | 152 | ||
153 | out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width)); | 153 | out_be32(&fsl_lbc_regs->mar, mar); |
154 | 154 | ||
155 | switch (upm->width) { | 155 | switch (upm->width) { |
156 | case 8: | 156 | case 8: |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 9817f63723dd..78021d8afc53 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -1,12 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * MPC83xx/85xx/86xx PCI/PCIE support routing. | 2 | * MPC83xx/85xx/86xx PCI/PCIE support routing. |
3 | * | 3 | * |
4 | * Copyright 2007,2008 Freescale Semiconductor, Inc | 4 | * Copyright 2007-2009 Freescale Semiconductor, Inc. |
5 | * Copyright 2008-2009 MontaVista Software, Inc. | ||
5 | * | 6 | * |
6 | * Initial author: Xianghua Xiao <x.xiao@freescale.com> | 7 | * Initial author: Xianghua Xiao <x.xiao@freescale.com> |
7 | * Recode: ZHANG WEI <wei.zhang@freescale.com> | 8 | * Recode: ZHANG WEI <wei.zhang@freescale.com> |
8 | * Rewrite the routing for Frescale PCI and PCI Express | 9 | * Rewrite the routing for Frescale PCI and PCI Express |
9 | * Roy Zang <tie-fei.zang@freescale.com> | 10 | * Roy Zang <tie-fei.zang@freescale.com> |
11 | * MPC83xx PCI-Express support: | ||
12 | * Tony Li <tony.li@freescale.com> | ||
13 | * Anton Vorontsov <avorontsov@ru.mvista.com> | ||
10 | * | 14 | * |
11 | * This program is free software; you can redistribute it and/or modify it | 15 | * This program is free software; you can redistribute it and/or modify it |
12 | * under the terms of the GNU General Public License as published by the | 16 | * under the terms of the GNU General Public License as published by the |
@@ -27,6 +31,29 @@ | |||
27 | #include <sysdev/fsl_soc.h> | 31 | #include <sysdev/fsl_soc.h> |
28 | #include <sysdev/fsl_pci.h> | 32 | #include <sysdev/fsl_pci.h> |
29 | 33 | ||
34 | static int fsl_pcie_bus_fixup; | ||
35 | |||
36 | static void __init quirk_fsl_pcie_header(struct pci_dev *dev) | ||
37 | { | ||
38 | /* if we aren't a PCIe don't bother */ | ||
39 | if (!pci_find_capability(dev, PCI_CAP_ID_EXP)) | ||
40 | return; | ||
41 | |||
42 | dev->class = PCI_CLASS_BRIDGE_PCI << 8; | ||
43 | fsl_pcie_bus_fixup = 1; | ||
44 | return; | ||
45 | } | ||
46 | |||
47 | static int __init fsl_pcie_check_link(struct pci_controller *hose) | ||
48 | { | ||
49 | u32 val; | ||
50 | |||
51 | early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val); | ||
52 | if (val < PCIE_LTSSM_L0) | ||
53 | return 1; | ||
54 | return 0; | ||
55 | } | ||
56 | |||
30 | #if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) | 57 | #if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) |
31 | static int __init setup_one_atmu(struct ccsr_pci __iomem *pci, | 58 | static int __init setup_one_atmu(struct ccsr_pci __iomem *pci, |
32 | unsigned int index, const struct resource *res, | 59 | unsigned int index, const struct resource *res, |
@@ -159,28 +186,6 @@ static void __init setup_pci_pcsrbar(struct pci_controller *hose) | |||
159 | #endif | 186 | #endif |
160 | } | 187 | } |
161 | 188 | ||
162 | static int fsl_pcie_bus_fixup; | ||
163 | |||
164 | static void __init quirk_fsl_pcie_header(struct pci_dev *dev) | ||
165 | { | ||
166 | /* if we aren't a PCIe don't bother */ | ||
167 | if (!pci_find_capability(dev, PCI_CAP_ID_EXP)) | ||
168 | return ; | ||
169 | |||
170 | dev->class = PCI_CLASS_BRIDGE_PCI << 8; | ||
171 | fsl_pcie_bus_fixup = 1; | ||
172 | return ; | ||
173 | } | ||
174 | |||
175 | static int __init fsl_pcie_check_link(struct pci_controller *hose) | ||
176 | { | ||
177 | u32 val; | ||
178 | early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val); | ||
179 | if (val < PCIE_LTSSM_L0) | ||
180 | return 1; | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | void fsl_pcibios_fixup_bus(struct pci_bus *bus) | 189 | void fsl_pcibios_fixup_bus(struct pci_bus *bus) |
185 | { | 190 | { |
186 | struct pci_controller *hose = (struct pci_controller *) bus->sysdata; | 191 | struct pci_controller *hose = (struct pci_controller *) bus->sysdata; |
@@ -294,8 +299,184 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header); | |||
294 | #endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */ | 299 | #endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */ |
295 | 300 | ||
296 | #if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x) | 301 | #if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x) |
302 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8314E, quirk_fsl_pcie_header); | ||
303 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8314, quirk_fsl_pcie_header); | ||
304 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8315E, quirk_fsl_pcie_header); | ||
305 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8315, quirk_fsl_pcie_header); | ||
306 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8377E, quirk_fsl_pcie_header); | ||
307 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8377, quirk_fsl_pcie_header); | ||
308 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8378E, quirk_fsl_pcie_header); | ||
309 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8378, quirk_fsl_pcie_header); | ||
310 | |||
311 | struct mpc83xx_pcie_priv { | ||
312 | void __iomem *cfg_type0; | ||
313 | void __iomem *cfg_type1; | ||
314 | u32 dev_base; | ||
315 | }; | ||
316 | |||
317 | /* | ||
318 | * With the convention of u-boot, the PCIE outbound window 0 serves | ||
319 | * as configuration transactions outbound. | ||
320 | */ | ||
321 | #define PEX_OUTWIN0_BAR 0xCA4 | ||
322 | #define PEX_OUTWIN0_TAL 0xCA8 | ||
323 | #define PEX_OUTWIN0_TAH 0xCAC | ||
324 | |||
325 | static int mpc83xx_pcie_exclude_device(struct pci_bus *bus, unsigned int devfn) | ||
326 | { | ||
327 | struct pci_controller *hose = bus->sysdata; | ||
328 | |||
329 | if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) | ||
330 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
331 | /* | ||
332 | * Workaround for the HW bug: for Type 0 configure transactions the | ||
333 | * PCI-E controller does not check the device number bits and just | ||
334 | * assumes that the device number bits are 0. | ||
335 | */ | ||
336 | if (bus->number == hose->first_busno || | ||
337 | bus->primary == hose->first_busno) { | ||
338 | if (devfn & 0xf8) | ||
339 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
340 | } | ||
341 | |||
342 | if (ppc_md.pci_exclude_device) { | ||
343 | if (ppc_md.pci_exclude_device(hose, bus->number, devfn)) | ||
344 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
345 | } | ||
346 | |||
347 | return PCIBIOS_SUCCESSFUL; | ||
348 | } | ||
349 | |||
350 | static void __iomem *mpc83xx_pcie_remap_cfg(struct pci_bus *bus, | ||
351 | unsigned int devfn, int offset) | ||
352 | { | ||
353 | struct pci_controller *hose = bus->sysdata; | ||
354 | struct mpc83xx_pcie_priv *pcie = hose->dn->data; | ||
355 | u8 bus_no = bus->number - hose->first_busno; | ||
356 | u32 dev_base = bus_no << 24 | devfn << 16; | ||
357 | int ret; | ||
358 | |||
359 | ret = mpc83xx_pcie_exclude_device(bus, devfn); | ||
360 | if (ret) | ||
361 | return NULL; | ||
362 | |||
363 | offset &= 0xfff; | ||
364 | |||
365 | /* Type 0 */ | ||
366 | if (bus->number == hose->first_busno) | ||
367 | return pcie->cfg_type0 + offset; | ||
368 | |||
369 | if (pcie->dev_base == dev_base) | ||
370 | goto mapped; | ||
371 | |||
372 | out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAL, dev_base); | ||
373 | |||
374 | pcie->dev_base = dev_base; | ||
375 | mapped: | ||
376 | return pcie->cfg_type1 + offset; | ||
377 | } | ||
378 | |||
379 | static int mpc83xx_pcie_read_config(struct pci_bus *bus, unsigned int devfn, | ||
380 | int offset, int len, u32 *val) | ||
381 | { | ||
382 | void __iomem *cfg_addr; | ||
383 | |||
384 | cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); | ||
385 | if (!cfg_addr) | ||
386 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
387 | |||
388 | switch (len) { | ||
389 | case 1: | ||
390 | *val = in_8(cfg_addr); | ||
391 | break; | ||
392 | case 2: | ||
393 | *val = in_le16(cfg_addr); | ||
394 | break; | ||
395 | default: | ||
396 | *val = in_le32(cfg_addr); | ||
397 | break; | ||
398 | } | ||
399 | |||
400 | return PCIBIOS_SUCCESSFUL; | ||
401 | } | ||
402 | |||
403 | static int mpc83xx_pcie_write_config(struct pci_bus *bus, unsigned int devfn, | ||
404 | int offset, int len, u32 val) | ||
405 | { | ||
406 | void __iomem *cfg_addr; | ||
407 | |||
408 | cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); | ||
409 | if (!cfg_addr) | ||
410 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
411 | |||
412 | switch (len) { | ||
413 | case 1: | ||
414 | out_8(cfg_addr, val); | ||
415 | break; | ||
416 | case 2: | ||
417 | out_le16(cfg_addr, val); | ||
418 | break; | ||
419 | default: | ||
420 | out_le32(cfg_addr, val); | ||
421 | break; | ||
422 | } | ||
423 | |||
424 | return PCIBIOS_SUCCESSFUL; | ||
425 | } | ||
426 | |||
427 | static struct pci_ops mpc83xx_pcie_ops = { | ||
428 | .read = mpc83xx_pcie_read_config, | ||
429 | .write = mpc83xx_pcie_write_config, | ||
430 | }; | ||
431 | |||
432 | static int __init mpc83xx_pcie_setup(struct pci_controller *hose, | ||
433 | struct resource *reg) | ||
434 | { | ||
435 | struct mpc83xx_pcie_priv *pcie; | ||
436 | u32 cfg_bar; | ||
437 | int ret = -ENOMEM; | ||
438 | |||
439 | pcie = zalloc_maybe_bootmem(sizeof(*pcie), GFP_KERNEL); | ||
440 | if (!pcie) | ||
441 | return ret; | ||
442 | |||
443 | pcie->cfg_type0 = ioremap(reg->start, resource_size(reg)); | ||
444 | if (!pcie->cfg_type0) | ||
445 | goto err0; | ||
446 | |||
447 | cfg_bar = in_le32(pcie->cfg_type0 + PEX_OUTWIN0_BAR); | ||
448 | if (!cfg_bar) { | ||
449 | /* PCI-E isn't configured. */ | ||
450 | ret = -ENODEV; | ||
451 | goto err1; | ||
452 | } | ||
453 | |||
454 | pcie->cfg_type1 = ioremap(cfg_bar, 0x1000); | ||
455 | if (!pcie->cfg_type1) | ||
456 | goto err1; | ||
457 | |||
458 | WARN_ON(hose->dn->data); | ||
459 | hose->dn->data = pcie; | ||
460 | hose->ops = &mpc83xx_pcie_ops; | ||
461 | |||
462 | out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAH, 0); | ||
463 | out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAL, 0); | ||
464 | |||
465 | if (fsl_pcie_check_link(hose)) | ||
466 | hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK; | ||
467 | |||
468 | return 0; | ||
469 | err1: | ||
470 | iounmap(pcie->cfg_type0); | ||
471 | err0: | ||
472 | kfree(pcie); | ||
473 | return ret; | ||
474 | |||
475 | } | ||
476 | |||
297 | int __init mpc83xx_add_bridge(struct device_node *dev) | 477 | int __init mpc83xx_add_bridge(struct device_node *dev) |
298 | { | 478 | { |
479 | int ret; | ||
299 | int len; | 480 | int len; |
300 | struct pci_controller *hose; | 481 | struct pci_controller *hose; |
301 | struct resource rsrc_reg; | 482 | struct resource rsrc_reg; |
@@ -303,6 +484,11 @@ int __init mpc83xx_add_bridge(struct device_node *dev) | |||
303 | const int *bus_range; | 484 | const int *bus_range; |
304 | int primary; | 485 | int primary; |
305 | 486 | ||
487 | if (!of_device_is_available(dev)) { | ||
488 | pr_warning("%s: disabled by the firmware.\n", | ||
489 | dev->full_name); | ||
490 | return -ENODEV; | ||
491 | } | ||
306 | pr_debug("Adding PCI host bridge %s\n", dev->full_name); | 492 | pr_debug("Adding PCI host bridge %s\n", dev->full_name); |
307 | 493 | ||
308 | /* Fetch host bridge registers address */ | 494 | /* Fetch host bridge registers address */ |
@@ -350,7 +536,14 @@ int __init mpc83xx_add_bridge(struct device_node *dev) | |||
350 | hose->first_busno = bus_range ? bus_range[0] : 0; | 536 | hose->first_busno = bus_range ? bus_range[0] : 0; |
351 | hose->last_busno = bus_range ? bus_range[1] : 0xff; | 537 | hose->last_busno = bus_range ? bus_range[1] : 0xff; |
352 | 538 | ||
353 | setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 4, 0); | 539 | if (of_device_is_compatible(dev, "fsl,mpc8314-pcie")) { |
540 | ret = mpc83xx_pcie_setup(hose, &rsrc_reg); | ||
541 | if (ret) | ||
542 | goto err0; | ||
543 | } else { | ||
544 | setup_indirect_pci(hose, rsrc_cfg.start, | ||
545 | rsrc_cfg.start + 4, 0); | ||
546 | } | ||
354 | 547 | ||
355 | printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx. " | 548 | printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx. " |
356 | "Firmware bus number: %d->%d\n", | 549 | "Firmware bus number: %d->%d\n", |
@@ -365,5 +558,8 @@ int __init mpc83xx_add_bridge(struct device_node *dev) | |||
365 | pci_process_bridge_OF_ranges(hose, dev, primary); | 558 | pci_process_bridge_OF_ranges(hose, dev, primary); |
366 | 559 | ||
367 | return 0; | 560 | return 0; |
561 | err0: | ||
562 | pcibios_free_controller(hose); | ||
563 | return ret; | ||
368 | } | 564 | } |
369 | #endif /* CONFIG_PPC_83xx */ | 565 | #endif /* CONFIG_PPC_83xx */ |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 115cb16351fd..afe8dbc964aa 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/device.h> | 23 | #include <linux/device.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/of.h> | ||
25 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
26 | #include <linux/phy.h> | 27 | #include <linux/phy.h> |
27 | #include <linux/phy_fixed.h> | 28 | #include <linux/phy_fixed.h> |
@@ -328,6 +329,9 @@ static int __init fsl_usb_of_init(void) | |||
328 | struct fsl_usb2_platform_data usb_data; | 329 | struct fsl_usb2_platform_data usb_data; |
329 | const unsigned char *prop = NULL; | 330 | const unsigned char *prop = NULL; |
330 | 331 | ||
332 | if (!of_device_is_available(np)) | ||
333 | continue; | ||
334 | |||
331 | memset(&r, 0, sizeof(r)); | 335 | memset(&r, 0, sizeof(r)); |
332 | memset(&usb_data, 0, sizeof(usb_data)); | 336 | memset(&usb_data, 0, sizeof(usb_data)); |
333 | 337 | ||
@@ -413,115 +417,6 @@ err: | |||
413 | 417 | ||
414 | arch_initcall(fsl_usb_of_init); | 418 | arch_initcall(fsl_usb_of_init); |
415 | 419 | ||
416 | static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk, | ||
417 | struct spi_board_info *board_infos, | ||
418 | unsigned int num_board_infos, | ||
419 | void (*activate_cs)(u8 cs, u8 polarity), | ||
420 | void (*deactivate_cs)(u8 cs, u8 polarity)) | ||
421 | { | ||
422 | struct device_node *np; | ||
423 | unsigned int i = 0; | ||
424 | |||
425 | for_each_compatible_node(np, type, compatible) { | ||
426 | int ret; | ||
427 | unsigned int j; | ||
428 | const void *prop; | ||
429 | struct resource res[2]; | ||
430 | struct platform_device *pdev; | ||
431 | struct fsl_spi_platform_data pdata = { | ||
432 | .activate_cs = activate_cs, | ||
433 | .deactivate_cs = deactivate_cs, | ||
434 | }; | ||
435 | |||
436 | memset(res, 0, sizeof(res)); | ||
437 | |||
438 | pdata.sysclk = sysclk; | ||
439 | |||
440 | prop = of_get_property(np, "reg", NULL); | ||
441 | if (!prop) | ||
442 | goto err; | ||
443 | pdata.bus_num = *(u32 *)prop; | ||
444 | |||
445 | prop = of_get_property(np, "cell-index", NULL); | ||
446 | if (prop) | ||
447 | i = *(u32 *)prop; | ||
448 | |||
449 | prop = of_get_property(np, "mode", NULL); | ||
450 | if (prop && !strcmp(prop, "cpu-qe")) | ||
451 | pdata.qe_mode = 1; | ||
452 | |||
453 | for (j = 0; j < num_board_infos; j++) { | ||
454 | if (board_infos[j].bus_num == pdata.bus_num) | ||
455 | pdata.max_chipselect++; | ||
456 | } | ||
457 | |||
458 | if (!pdata.max_chipselect) | ||
459 | continue; | ||
460 | |||
461 | ret = of_address_to_resource(np, 0, &res[0]); | ||
462 | if (ret) | ||
463 | goto err; | ||
464 | |||
465 | ret = of_irq_to_resource(np, 0, &res[1]); | ||
466 | if (ret == NO_IRQ) | ||
467 | goto err; | ||
468 | |||
469 | pdev = platform_device_alloc("mpc83xx_spi", i); | ||
470 | if (!pdev) | ||
471 | goto err; | ||
472 | |||
473 | ret = platform_device_add_data(pdev, &pdata, sizeof(pdata)); | ||
474 | if (ret) | ||
475 | goto unreg; | ||
476 | |||
477 | ret = platform_device_add_resources(pdev, res, | ||
478 | ARRAY_SIZE(res)); | ||
479 | if (ret) | ||
480 | goto unreg; | ||
481 | |||
482 | ret = platform_device_add(pdev); | ||
483 | if (ret) | ||
484 | goto unreg; | ||
485 | |||
486 | goto next; | ||
487 | unreg: | ||
488 | platform_device_del(pdev); | ||
489 | err: | ||
490 | pr_err("%s: registration failed\n", np->full_name); | ||
491 | next: | ||
492 | i++; | ||
493 | } | ||
494 | |||
495 | return i; | ||
496 | } | ||
497 | |||
498 | int __init fsl_spi_init(struct spi_board_info *board_infos, | ||
499 | unsigned int num_board_infos, | ||
500 | void (*activate_cs)(u8 cs, u8 polarity), | ||
501 | void (*deactivate_cs)(u8 cs, u8 polarity)) | ||
502 | { | ||
503 | u32 sysclk = -1; | ||
504 | int ret; | ||
505 | |||
506 | #ifdef CONFIG_QUICC_ENGINE | ||
507 | /* SPI controller is either clocked from QE or SoC clock */ | ||
508 | sysclk = get_brgfreq(); | ||
509 | #endif | ||
510 | if (sysclk == -1) { | ||
511 | sysclk = fsl_get_sys_freq(); | ||
512 | if (sysclk == -1) | ||
513 | return -ENODEV; | ||
514 | } | ||
515 | |||
516 | ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos, | ||
517 | num_board_infos, activate_cs, deactivate_cs); | ||
518 | if (!ret) | ||
519 | of_fsl_spi_probe("spi", "fsl_spi", sysclk, board_infos, | ||
520 | num_board_infos, activate_cs, deactivate_cs); | ||
521 | |||
522 | return spi_register_board_info(board_infos, num_board_infos); | ||
523 | } | ||
524 | |||
525 | #if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) | 420 | #if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) |
526 | static __be32 __iomem *rstcr; | 421 | static __be32 __iomem *rstcr; |
527 | 422 | ||
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h index 9c744e4285a0..42381bb6cd51 100644 --- a/arch/powerpc/sysdev/fsl_soc.h +++ b/arch/powerpc/sysdev/fsl_soc.h | |||
@@ -4,6 +4,8 @@ | |||
4 | 4 | ||
5 | #include <asm/mmu.h> | 5 | #include <asm/mmu.h> |
6 | 6 | ||
7 | struct spi_device; | ||
8 | |||
7 | extern phys_addr_t get_immrbase(void); | 9 | extern phys_addr_t get_immrbase(void); |
8 | #if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx) | 10 | #if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx) |
9 | extern u32 get_brgfreq(void); | 11 | extern u32 get_brgfreq(void); |
@@ -17,11 +19,6 @@ extern u32 fsl_get_sys_freq(void); | |||
17 | struct spi_board_info; | 19 | struct spi_board_info; |
18 | struct device_node; | 20 | struct device_node; |
19 | 21 | ||
20 | extern int fsl_spi_init(struct spi_board_info *board_infos, | ||
21 | unsigned int num_board_infos, | ||
22 | void (*activate_cs)(u8 cs, u8 polarity), | ||
23 | void (*deactivate_cs)(u8 cs, u8 polarity)); | ||
24 | |||
25 | extern void fsl_rstcr_restart(char *cmd); | 22 | extern void fsl_rstcr_restart(char *cmd); |
26 | 23 | ||
27 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) | 24 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) |
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c index 9a89cd3e80a2..a86d3ce01ead 100644 --- a/arch/powerpc/sysdev/ipic.c +++ b/arch/powerpc/sysdev/ipic.c | |||
@@ -568,8 +568,7 @@ static void ipic_ack_irq(unsigned int virq) | |||
568 | 568 | ||
569 | spin_lock_irqsave(&ipic_lock, flags); | 569 | spin_lock_irqsave(&ipic_lock, flags); |
570 | 570 | ||
571 | temp = ipic_read(ipic->regs, ipic_info[src].ack); | 571 | temp = 1 << (31 - ipic_info[src].bit); |
572 | temp |= (1 << (31 - ipic_info[src].bit)); | ||
573 | ipic_write(ipic->regs, ipic_info[src].ack, temp); | 572 | ipic_write(ipic->regs, ipic_info[src].ack, temp); |
574 | 573 | ||
575 | /* mb() can't guarantee that ack is finished. But it does finish | 574 | /* mb() can't guarantee that ack is finished. But it does finish |
@@ -592,8 +591,7 @@ static void ipic_mask_irq_and_ack(unsigned int virq) | |||
592 | temp &= ~(1 << (31 - ipic_info[src].bit)); | 591 | temp &= ~(1 << (31 - ipic_info[src].bit)); |
593 | ipic_write(ipic->regs, ipic_info[src].mask, temp); | 592 | ipic_write(ipic->regs, ipic_info[src].mask, temp); |
594 | 593 | ||
595 | temp = ipic_read(ipic->regs, ipic_info[src].ack); | 594 | temp = 1 << (31 - ipic_info[src].bit); |
596 | temp |= (1 << (31 - ipic_info[src].bit)); | ||
597 | ipic_write(ipic->regs, ipic_info[src].ack, temp); | 595 | ipic_write(ipic->regs, ipic_info[src].ack, temp); |
598 | 596 | ||
599 | /* mb() can't guarantee that ack is finished. But it does finish | 597 | /* mb() can't guarantee that ack is finished. But it does finish |
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 532e205303a2..21b956701596 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -1170,6 +1170,12 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1170 | mb(); | 1170 | mb(); |
1171 | } | 1171 | } |
1172 | 1172 | ||
1173 | /* CoreInt */ | ||
1174 | if (flags & MPIC_ENABLE_COREINT) | ||
1175 | mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), | ||
1176 | mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) | ||
1177 | | MPIC_GREG_GCONF_COREINT); | ||
1178 | |||
1173 | if (flags & MPIC_ENABLE_MCK) | 1179 | if (flags & MPIC_ENABLE_MCK) |
1174 | mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), | 1180 | mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), |
1175 | mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) | 1181 | mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) |
@@ -1525,6 +1531,34 @@ unsigned int mpic_get_irq(void) | |||
1525 | return mpic_get_one_irq(mpic); | 1531 | return mpic_get_one_irq(mpic); |
1526 | } | 1532 | } |
1527 | 1533 | ||
1534 | unsigned int mpic_get_coreint_irq(void) | ||
1535 | { | ||
1536 | #ifdef CONFIG_BOOKE | ||
1537 | struct mpic *mpic = mpic_primary; | ||
1538 | u32 src; | ||
1539 | |||
1540 | BUG_ON(mpic == NULL); | ||
1541 | |||
1542 | src = mfspr(SPRN_EPR); | ||
1543 | |||
1544 | if (unlikely(src == mpic->spurious_vec)) { | ||
1545 | if (mpic->flags & MPIC_SPV_EOI) | ||
1546 | mpic_eoi(mpic); | ||
1547 | return NO_IRQ; | ||
1548 | } | ||
1549 | if (unlikely(mpic->protected && test_bit(src, mpic->protected))) { | ||
1550 | if (printk_ratelimit()) | ||
1551 | printk(KERN_WARNING "%s: Got protected source %d !\n", | ||
1552 | mpic->name, (int)src); | ||
1553 | return NO_IRQ; | ||
1554 | } | ||
1555 | |||
1556 | return irq_linear_revmap(mpic->irqhost, src); | ||
1557 | #else | ||
1558 | return NO_IRQ; | ||
1559 | #endif | ||
1560 | } | ||
1561 | |||
1528 | unsigned int mpic_get_mcirq(void) | 1562 | unsigned int mpic_get_mcirq(void) |
1529 | { | 1563 | { |
1530 | struct mpic *mpic = mpic_primary; | 1564 | struct mpic *mpic = mpic_primary; |
diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c index f84217b8863a..5a32cbef9b6c 100644 --- a/arch/powerpc/sysdev/msi_bitmap.c +++ b/arch/powerpc/sysdev/msi_bitmap.c | |||
@@ -141,7 +141,7 @@ void msi_bitmap_free(struct msi_bitmap *bmp) | |||
141 | #define check(x) \ | 141 | #define check(x) \ |
142 | if (!(x)) printk("msi_bitmap: test failed at line %d\n", __LINE__); | 142 | if (!(x)) printk("msi_bitmap: test failed at line %d\n", __LINE__); |
143 | 143 | ||
144 | void test_basics(void) | 144 | void __init test_basics(void) |
145 | { | 145 | { |
146 | struct msi_bitmap bmp; | 146 | struct msi_bitmap bmp; |
147 | int i, size = 512; | 147 | int i, size = 512; |
@@ -186,7 +186,7 @@ void test_basics(void) | |||
186 | kfree(bmp.bitmap); | 186 | kfree(bmp.bitmap); |
187 | } | 187 | } |
188 | 188 | ||
189 | void test_of_node(void) | 189 | void __init test_of_node(void) |
190 | { | 190 | { |
191 | u32 prop_data[] = { 10, 10, 25, 3, 40, 1, 100, 100, 200, 20 }; | 191 | u32 prop_data[] = { 10, 10, 25, 3, 40, 1, 100, 100, 200, 20 }; |
192 | const char *expected_str = "0-9,20-24,28-39,41-99,220-255"; | 192 | const char *expected_str = "0-9,20-24,28-39,41-99,220-255"; |
@@ -234,7 +234,7 @@ void test_of_node(void) | |||
234 | kfree(bmp.bitmap); | 234 | kfree(bmp.bitmap); |
235 | } | 235 | } |
236 | 236 | ||
237 | int msi_bitmap_selftest(void) | 237 | int __init msi_bitmap_selftest(void) |
238 | { | 238 | { |
239 | printk(KERN_DEBUG "Running MSI bitmap self-tests ...\n"); | 239 | printk(KERN_DEBUG "Running MSI bitmap self-tests ...\n"); |
240 | 240 | ||
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c index c858749263e0..aaa915998eb6 100644 --- a/arch/powerpc/sysdev/pmi.c +++ b/arch/powerpc/sysdev/pmi.c | |||
@@ -50,7 +50,7 @@ struct pmi_data { | |||
50 | 50 | ||
51 | static struct pmi_data *data; | 51 | static struct pmi_data *data; |
52 | 52 | ||
53 | static int pmi_irq_handler(int irq, void *dev_id) | 53 | static irqreturn_t pmi_irq_handler(int irq, void *dev_id) |
54 | { | 54 | { |
55 | u8 type; | 55 | u8 type; |
56 | int rc; | 56 | int rc; |
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c index 5558d932b4d5..6a2d473c345a 100644 --- a/arch/powerpc/sysdev/ppc4xx_pci.c +++ b/arch/powerpc/sysdev/ppc4xx_pci.c | |||
@@ -1839,6 +1839,8 @@ static int __init ppc4xx_pci_find_bridges(void) | |||
1839 | { | 1839 | { |
1840 | struct device_node *np; | 1840 | struct device_node *np; |
1841 | 1841 | ||
1842 | ppc_pci_flags |= PPC_PCI_ENABLE_PROC_DOMAINS | PPC_PCI_COMPAT_DOMAIN_0; | ||
1843 | |||
1842 | #ifdef CONFIG_PPC4xx_PCI_EXPRESS | 1844 | #ifdef CONFIG_PPC4xx_PCI_EXPRESS |
1843 | for_each_compatible_node(np, NULL, "ibm,plb-pciex") | 1845 | for_each_compatible_node(np, NULL, "ibm,plb-pciex") |
1844 | ppc4xx_probe_pciex_bridge(np); | 1846 | ppc4xx_probe_pciex_bridge(np); |