diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-12-30 00:20:30 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-12-30 00:21:47 -0500 |
commit | d392da5207352f09030e95d9ea335a4225667ec0 (patch) | |
tree | 7d6cd1932afcad0a5619a5c504a6d93ca318187c /arch/powerpc/sysdev | |
parent | e39d5ef678045d61812c1401f04fe8edb14d6359 (diff) | |
parent | 387c31c7e5c9805b0aef8833d1731a5fe7bdea14 (diff) |
Merge v2.6.37-rc8 into powerpc/next
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/Makefile | 5 | ||||
-rw-r--r-- | arch/powerpc/sysdev/dart_iommu.c | 74 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h | 101 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 159 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 231 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_lbc.c | 244 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_msi.c | 13 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 62 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.h | 1 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_rio.c | 149 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 181 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mpc8xxx_gpio.c | 3 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mpic_pasemi_msi.c | 22 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mpic_u3msi.c | 18 | ||||
-rw-r--r-- | arch/powerpc/sysdev/pmi.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 1 |
16 files changed, 963 insertions, 303 deletions
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index 5642924fb9fb..0bef9dacb64e 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile | |||
@@ -1,8 +1,6 @@ | |||
1 | subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror | 1 | subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror |
2 | 2 | ||
3 | ifeq ($(CONFIG_PPC64),y) | 3 | ccflags-$(CONFIG_PPC64) := -mno-minimal-toc |
4 | EXTRA_CFLAGS += -mno-minimal-toc | ||
5 | endif | ||
6 | 4 | ||
7 | mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o | 5 | mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o |
8 | obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) | 6 | obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) |
@@ -20,6 +18,7 @@ obj-$(CONFIG_FSL_PMC) += fsl_pmc.o | |||
20 | obj-$(CONFIG_FSL_LBC) += fsl_lbc.o | 18 | obj-$(CONFIG_FSL_LBC) += fsl_lbc.o |
21 | obj-$(CONFIG_FSL_GTM) += fsl_gtm.o | 19 | obj-$(CONFIG_FSL_GTM) += fsl_gtm.o |
22 | obj-$(CONFIG_MPC8xxx_GPIO) += mpc8xxx_gpio.o | 20 | obj-$(CONFIG_MPC8xxx_GPIO) += mpc8xxx_gpio.o |
21 | obj-$(CONFIG_FSL_85XX_CACHE_SRAM) += fsl_85xx_l2ctlr.o fsl_85xx_cache_sram.o | ||
23 | obj-$(CONFIG_SIMPLE_GPIO) += simple_gpio.o | 22 | obj-$(CONFIG_SIMPLE_GPIO) += simple_gpio.o |
24 | obj-$(CONFIG_RAPIDIO) += fsl_rio.o | 23 | obj-$(CONFIG_RAPIDIO) += fsl_rio.o |
25 | obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o | 24 | obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o |
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 559db2b846a9..17cf15ec38be 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
@@ -70,6 +70,8 @@ static int iommu_table_dart_inited; | |||
70 | static int dart_dirty; | 70 | static int dart_dirty; |
71 | static int dart_is_u4; | 71 | static int dart_is_u4; |
72 | 72 | ||
73 | #define DART_U4_BYPASS_BASE 0x8000000000ull | ||
74 | |||
73 | #define DBG(...) | 75 | #define DBG(...) |
74 | 76 | ||
75 | static inline void dart_tlb_invalidate_all(void) | 77 | static inline void dart_tlb_invalidate_all(void) |
@@ -292,12 +294,20 @@ static void iommu_table_dart_setup(void) | |||
292 | set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map); | 294 | set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map); |
293 | } | 295 | } |
294 | 296 | ||
295 | static void pci_dma_dev_setup_dart(struct pci_dev *dev) | 297 | static void dma_dev_setup_dart(struct device *dev) |
296 | { | 298 | { |
297 | /* We only have one iommu table on the mac for now, which makes | 299 | /* We only have one iommu table on the mac for now, which makes |
298 | * things simple. Setup all PCI devices to point to this table | 300 | * things simple. Setup all PCI devices to point to this table |
299 | */ | 301 | */ |
300 | set_iommu_table_base(&dev->dev, &iommu_table_dart); | 302 | if (get_dma_ops(dev) == &dma_direct_ops) |
303 | set_dma_offset(dev, DART_U4_BYPASS_BASE); | ||
304 | else | ||
305 | set_iommu_table_base(dev, &iommu_table_dart); | ||
306 | } | ||
307 | |||
308 | static void pci_dma_dev_setup_dart(struct pci_dev *dev) | ||
309 | { | ||
310 | dma_dev_setup_dart(&dev->dev); | ||
301 | } | 311 | } |
302 | 312 | ||
303 | static void pci_dma_bus_setup_dart(struct pci_bus *bus) | 313 | static void pci_dma_bus_setup_dart(struct pci_bus *bus) |
@@ -315,6 +325,45 @@ static void pci_dma_bus_setup_dart(struct pci_bus *bus) | |||
315 | PCI_DN(dn)->iommu_table = &iommu_table_dart; | 325 | PCI_DN(dn)->iommu_table = &iommu_table_dart; |
316 | } | 326 | } |
317 | 327 | ||
328 | static bool dart_device_on_pcie(struct device *dev) | ||
329 | { | ||
330 | struct device_node *np = of_node_get(dev->of_node); | ||
331 | |||
332 | while(np) { | ||
333 | if (of_device_is_compatible(np, "U4-pcie") || | ||
334 | of_device_is_compatible(np, "u4-pcie")) { | ||
335 | of_node_put(np); | ||
336 | return true; | ||
337 | } | ||
338 | np = of_get_next_parent(np); | ||
339 | } | ||
340 | return false; | ||
341 | } | ||
342 | |||
343 | static int dart_dma_set_mask(struct device *dev, u64 dma_mask) | ||
344 | { | ||
345 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | ||
346 | return -EIO; | ||
347 | |||
348 | /* U4 supports a DART bypass, we use it for 64-bit capable | ||
349 | * devices to improve performances. However, that only works | ||
350 | * for devices connected to U4 own PCIe interface, not bridged | ||
351 | * through hypertransport. We need the device to support at | ||
352 | * least 40 bits of addresses. | ||
353 | */ | ||
354 | if (dart_device_on_pcie(dev) && dma_mask >= DMA_BIT_MASK(40)) { | ||
355 | dev_info(dev, "Using 64-bit DMA iommu bypass\n"); | ||
356 | set_dma_ops(dev, &dma_direct_ops); | ||
357 | } else { | ||
358 | dev_info(dev, "Using 32-bit DMA via iommu\n"); | ||
359 | set_dma_ops(dev, &dma_iommu_ops); | ||
360 | } | ||
361 | dma_dev_setup_dart(dev); | ||
362 | |||
363 | *dev->dma_mask = dma_mask; | ||
364 | return 0; | ||
365 | } | ||
366 | |||
318 | void __init iommu_init_early_dart(void) | 367 | void __init iommu_init_early_dart(void) |
319 | { | 368 | { |
320 | struct device_node *dn; | 369 | struct device_node *dn; |
@@ -328,20 +377,25 @@ void __init iommu_init_early_dart(void) | |||
328 | dart_is_u4 = 1; | 377 | dart_is_u4 = 1; |
329 | } | 378 | } |
330 | 379 | ||
380 | /* Initialize the DART HW */ | ||
381 | if (dart_init(dn) != 0) | ||
382 | goto bail; | ||
383 | |||
331 | /* Setup low level TCE operations for the core IOMMU code */ | 384 | /* Setup low level TCE operations for the core IOMMU code */ |
332 | ppc_md.tce_build = dart_build; | 385 | ppc_md.tce_build = dart_build; |
333 | ppc_md.tce_free = dart_free; | 386 | ppc_md.tce_free = dart_free; |
334 | ppc_md.tce_flush = dart_flush; | 387 | ppc_md.tce_flush = dart_flush; |
335 | 388 | ||
336 | /* Initialize the DART HW */ | 389 | /* Setup bypass if supported */ |
337 | if (dart_init(dn) == 0) { | 390 | if (dart_is_u4) |
338 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart; | 391 | ppc_md.dma_set_mask = dart_dma_set_mask; |
339 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; | ||
340 | 392 | ||
341 | /* Setup pci_dma ops */ | 393 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart; |
342 | set_pci_dma_ops(&dma_iommu_ops); | 394 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; |
343 | return; | 395 | |
344 | } | 396 | /* Setup pci_dma ops */ |
397 | set_pci_dma_ops(&dma_iommu_ops); | ||
398 | return; | ||
345 | 399 | ||
346 | bail: | 400 | bail: |
347 | /* If init failed, use direct iommu and null setup functions */ | 401 | /* If init failed, use direct iommu and null setup functions */ |
diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h b/arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h new file mode 100644 index 000000000000..60c9c0bd5ba2 --- /dev/null +++ b/arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Copyright 2009-2010 Freescale Semiconductor, Inc | ||
3 | * | ||
4 | * QorIQ based Cache Controller Memory Mapped Registers | ||
5 | * | ||
6 | * Author: Vivek Mahajan <vivek.mahajan@freescale.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef __FSL_85XX_CACHE_CTLR_H__ | ||
24 | #define __FSL_85XX_CACHE_CTLR_H__ | ||
25 | |||
26 | #define L2CR_L2FI 0x40000000 /* L2 flash invalidate */ | ||
27 | #define L2CR_L2IO 0x00200000 /* L2 instruction only */ | ||
28 | #define L2CR_SRAM_ZERO 0x00000000 /* L2SRAM zero size */ | ||
29 | #define L2CR_SRAM_FULL 0x00010000 /* L2SRAM full size */ | ||
30 | #define L2CR_SRAM_HALF 0x00020000 /* L2SRAM half size */ | ||
31 | #define L2CR_SRAM_TWO_HALFS 0x00030000 /* L2SRAM two half sizes */ | ||
32 | #define L2CR_SRAM_QUART 0x00040000 /* L2SRAM one quarter size */ | ||
33 | #define L2CR_SRAM_TWO_QUARTS 0x00050000 /* L2SRAM two quarter size */ | ||
34 | #define L2CR_SRAM_EIGHTH 0x00060000 /* L2SRAM one eighth size */ | ||
35 | #define L2CR_SRAM_TWO_EIGHTH 0x00070000 /* L2SRAM two eighth size */ | ||
36 | |||
37 | #define L2SRAM_OPTIMAL_SZ_SHIFT 0x00000003 /* Optimum size for L2SRAM */ | ||
38 | |||
39 | #define L2SRAM_BAR_MSK_LO18 0xFFFFC000 /* Lower 18 bits */ | ||
40 | #define L2SRAM_BARE_MSK_HI4 0x0000000F /* Upper 4 bits */ | ||
41 | |||
42 | enum cache_sram_lock_ways { | ||
43 | LOCK_WAYS_ZERO, | ||
44 | LOCK_WAYS_EIGHTH, | ||
45 | LOCK_WAYS_TWO_EIGHTH, | ||
46 | LOCK_WAYS_HALF = 4, | ||
47 | LOCK_WAYS_FULL = 8, | ||
48 | }; | ||
49 | |||
50 | struct mpc85xx_l2ctlr { | ||
51 | u32 ctl; /* 0x000 - L2 control */ | ||
52 | u8 res1[0xC]; | ||
53 | u32 ewar0; /* 0x010 - External write address 0 */ | ||
54 | u32 ewarea0; /* 0x014 - External write address extended 0 */ | ||
55 | u32 ewcr0; /* 0x018 - External write ctrl */ | ||
56 | u8 res2[4]; | ||
57 | u32 ewar1; /* 0x020 - External write address 1 */ | ||
58 | u32 ewarea1; /* 0x024 - External write address extended 1 */ | ||
59 | u32 ewcr1; /* 0x028 - External write ctrl 1 */ | ||
60 | u8 res3[4]; | ||
61 | u32 ewar2; /* 0x030 - External write address 2 */ | ||
62 | u32 ewarea2; /* 0x034 - External write address extended 2 */ | ||
63 | u32 ewcr2; /* 0x038 - External write ctrl 2 */ | ||
64 | u8 res4[4]; | ||
65 | u32 ewar3; /* 0x040 - External write address 3 */ | ||
66 | u32 ewarea3; /* 0x044 - External write address extended 3 */ | ||
67 | u32 ewcr3; /* 0x048 - External write ctrl 3 */ | ||
68 | u8 res5[0xB4]; | ||
69 | u32 srbar0; /* 0x100 - SRAM base address 0 */ | ||
70 | u32 srbarea0; /* 0x104 - SRAM base addr reg ext address 0 */ | ||
71 | u32 srbar1; /* 0x108 - SRAM base address 1 */ | ||
72 | u32 srbarea1; /* 0x10C - SRAM base addr reg ext address 1 */ | ||
73 | u8 res6[0xCF0]; | ||
74 | u32 errinjhi; /* 0xE00 - Error injection mask high */ | ||
75 | u32 errinjlo; /* 0xE04 - Error injection mask low */ | ||
76 | u32 errinjctl; /* 0xE08 - Error injection tag/ecc control */ | ||
77 | u8 res7[0x14]; | ||
78 | u32 captdatahi; /* 0xE20 - Error data high capture */ | ||
79 | u32 captdatalo; /* 0xE24 - Error data low capture */ | ||
80 | u32 captecc; /* 0xE28 - Error syndrome */ | ||
81 | u8 res8[0x14]; | ||
82 | u32 errdet; /* 0xE40 - Error detect */ | ||
83 | u32 errdis; /* 0xE44 - Error disable */ | ||
84 | u32 errinten; /* 0xE48 - Error interrupt enable */ | ||
85 | u32 errattr; /* 0xE4c - Error attribute capture */ | ||
86 | u32 erradrrl; /* 0xE50 - Error address capture low */ | ||
87 | u32 erradrrh; /* 0xE54 - Error address capture high */ | ||
88 | u32 errctl; /* 0xE58 - Error control */ | ||
89 | u8 res9[0x1A4]; | ||
90 | }; | ||
91 | |||
92 | struct sram_parameters { | ||
93 | unsigned int sram_size; | ||
94 | uint64_t sram_offset; | ||
95 | }; | ||
96 | |||
97 | extern int instantiate_cache_sram(struct platform_device *dev, | ||
98 | struct sram_parameters sram_params); | ||
99 | extern void remove_cache_sram(struct platform_device *dev); | ||
100 | |||
101 | #endif /* __FSL_85XX_CACHE_CTLR_H__ */ | ||
diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c new file mode 100644 index 000000000000..54fb1922fe30 --- /dev/null +++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * Copyright 2009-2010 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * Simple memory allocator abstraction for QorIQ (P1/P2) based Cache-SRAM | ||
5 | * | ||
6 | * Author: Vivek Mahajan <vivek.mahajan@freescale.com> | ||
7 | * | ||
8 | * This file is derived from the original work done | ||
9 | * by Sylvain Munaut for the Bestcomm SRAM allocator. | ||
10 | * | ||
11 | * 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 | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | ||
25 | |||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/err.h> | ||
29 | #include <linux/of_platform.h> | ||
30 | #include <asm/pgtable.h> | ||
31 | #include <asm/fsl_85xx_cache_sram.h> | ||
32 | |||
33 | #include "fsl_85xx_cache_ctlr.h" | ||
34 | |||
35 | struct mpc85xx_cache_sram *cache_sram; | ||
36 | |||
37 | void *mpc85xx_cache_sram_alloc(unsigned int size, | ||
38 | phys_addr_t *phys, unsigned int align) | ||
39 | { | ||
40 | unsigned long offset; | ||
41 | unsigned long flags; | ||
42 | |||
43 | if (unlikely(cache_sram == NULL)) | ||
44 | return NULL; | ||
45 | |||
46 | if (!size || (size > cache_sram->size) || (align > cache_sram->size)) { | ||
47 | pr_err("%s(): size(=%x) or align(=%x) zero or too big\n", | ||
48 | __func__, size, align); | ||
49 | return NULL; | ||
50 | } | ||
51 | |||
52 | if ((align & (align - 1)) || align <= 1) { | ||
53 | pr_err("%s(): align(=%x) must be power of two and >1\n", | ||
54 | __func__, align); | ||
55 | return NULL; | ||
56 | } | ||
57 | |||
58 | spin_lock_irqsave(&cache_sram->lock, flags); | ||
59 | offset = rh_alloc_align(cache_sram->rh, size, align, NULL); | ||
60 | spin_unlock_irqrestore(&cache_sram->lock, flags); | ||
61 | |||
62 | if (IS_ERR_VALUE(offset)) | ||
63 | return NULL; | ||
64 | |||
65 | *phys = cache_sram->base_phys + offset; | ||
66 | |||
67 | return (unsigned char *)cache_sram->base_virt + offset; | ||
68 | } | ||
69 | EXPORT_SYMBOL(mpc85xx_cache_sram_alloc); | ||
70 | |||
71 | void mpc85xx_cache_sram_free(void *ptr) | ||
72 | { | ||
73 | unsigned long flags; | ||
74 | BUG_ON(!ptr); | ||
75 | |||
76 | spin_lock_irqsave(&cache_sram->lock, flags); | ||
77 | rh_free(cache_sram->rh, ptr - cache_sram->base_virt); | ||
78 | spin_unlock_irqrestore(&cache_sram->lock, flags); | ||
79 | } | ||
80 | EXPORT_SYMBOL(mpc85xx_cache_sram_free); | ||
81 | |||
82 | int __init instantiate_cache_sram(struct platform_device *dev, | ||
83 | struct sram_parameters sram_params) | ||
84 | { | ||
85 | int ret = 0; | ||
86 | |||
87 | if (cache_sram) { | ||
88 | dev_err(&dev->dev, "Already initialized cache-sram\n"); | ||
89 | return -EBUSY; | ||
90 | } | ||
91 | |||
92 | cache_sram = kzalloc(sizeof(struct mpc85xx_cache_sram), GFP_KERNEL); | ||
93 | if (!cache_sram) { | ||
94 | dev_err(&dev->dev, "Out of memory for cache_sram structure\n"); | ||
95 | return -ENOMEM; | ||
96 | } | ||
97 | |||
98 | cache_sram->base_phys = sram_params.sram_offset; | ||
99 | cache_sram->size = sram_params.sram_size; | ||
100 | |||
101 | if (!request_mem_region(cache_sram->base_phys, cache_sram->size, | ||
102 | "fsl_85xx_cache_sram")) { | ||
103 | dev_err(&dev->dev, "%s: request memory failed\n", | ||
104 | dev->dev.of_node->full_name); | ||
105 | ret = -ENXIO; | ||
106 | goto out_free; | ||
107 | } | ||
108 | |||
109 | cache_sram->base_virt = ioremap_flags(cache_sram->base_phys, | ||
110 | cache_sram->size, _PAGE_COHERENT | PAGE_KERNEL); | ||
111 | if (!cache_sram->base_virt) { | ||
112 | dev_err(&dev->dev, "%s: ioremap_flags failed\n", | ||
113 | dev->dev.of_node->full_name); | ||
114 | ret = -ENOMEM; | ||
115 | goto out_release; | ||
116 | } | ||
117 | |||
118 | cache_sram->rh = rh_create(sizeof(unsigned int)); | ||
119 | if (IS_ERR(cache_sram->rh)) { | ||
120 | dev_err(&dev->dev, "%s: Unable to create remote heap\n", | ||
121 | dev->dev.of_node->full_name); | ||
122 | ret = PTR_ERR(cache_sram->rh); | ||
123 | goto out_unmap; | ||
124 | } | ||
125 | |||
126 | rh_attach_region(cache_sram->rh, 0, cache_sram->size); | ||
127 | spin_lock_init(&cache_sram->lock); | ||
128 | |||
129 | dev_info(&dev->dev, "[base:0x%llx, size:0x%x] configured and loaded\n", | ||
130 | (unsigned long long)cache_sram->base_phys, cache_sram->size); | ||
131 | |||
132 | return 0; | ||
133 | |||
134 | out_unmap: | ||
135 | iounmap(cache_sram->base_virt); | ||
136 | |||
137 | out_release: | ||
138 | release_mem_region(cache_sram->base_phys, cache_sram->size); | ||
139 | |||
140 | out_free: | ||
141 | kfree(cache_sram); | ||
142 | return ret; | ||
143 | } | ||
144 | |||
145 | void remove_cache_sram(struct platform_device *dev) | ||
146 | { | ||
147 | BUG_ON(!cache_sram); | ||
148 | |||
149 | rh_detach_region(cache_sram->rh, 0, cache_sram->size); | ||
150 | rh_destroy(cache_sram->rh); | ||
151 | |||
152 | iounmap(cache_sram->base_virt); | ||
153 | release_mem_region(cache_sram->base_phys, cache_sram->size); | ||
154 | |||
155 | kfree(cache_sram); | ||
156 | cache_sram = NULL; | ||
157 | |||
158 | dev_info(&dev->dev, "MPC85xx Cache-SRAM driver unloaded\n"); | ||
159 | } | ||
diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c new file mode 100644 index 000000000000..cc8d6556d799 --- /dev/null +++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | |||
@@ -0,0 +1,231 @@ | |||
1 | /* | ||
2 | * Copyright 2009-2010 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * QorIQ (P1/P2) L2 controller init for Cache-SRAM instantiation | ||
5 | * | ||
6 | * Author: Vivek Mahajan <vivek.mahajan@freescale.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/of_platform.h> | ||
25 | #include <asm/io.h> | ||
26 | |||
27 | #include "fsl_85xx_cache_ctlr.h" | ||
28 | |||
29 | static char *sram_size; | ||
30 | static char *sram_offset; | ||
31 | struct mpc85xx_l2ctlr __iomem *l2ctlr; | ||
32 | |||
33 | static long get_cache_sram_size(void) | ||
34 | { | ||
35 | unsigned long val; | ||
36 | |||
37 | if (!sram_size || (strict_strtoul(sram_size, 0, &val) < 0)) | ||
38 | return -EINVAL; | ||
39 | |||
40 | return val; | ||
41 | } | ||
42 | |||
43 | static long get_cache_sram_offset(void) | ||
44 | { | ||
45 | unsigned long val; | ||
46 | |||
47 | if (!sram_offset || (strict_strtoul(sram_offset, 0, &val) < 0)) | ||
48 | return -EINVAL; | ||
49 | |||
50 | return val; | ||
51 | } | ||
52 | |||
53 | static int __init get_size_from_cmdline(char *str) | ||
54 | { | ||
55 | if (!str) | ||
56 | return 0; | ||
57 | |||
58 | sram_size = str; | ||
59 | return 1; | ||
60 | } | ||
61 | |||
62 | static int __init get_offset_from_cmdline(char *str) | ||
63 | { | ||
64 | if (!str) | ||
65 | return 0; | ||
66 | |||
67 | sram_offset = str; | ||
68 | return 1; | ||
69 | } | ||
70 | |||
71 | __setup("cache-sram-size=", get_size_from_cmdline); | ||
72 | __setup("cache-sram-offset=", get_offset_from_cmdline); | ||
73 | |||
74 | static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev, | ||
75 | const struct of_device_id *match) | ||
76 | { | ||
77 | long rval; | ||
78 | unsigned int rem; | ||
79 | unsigned char ways; | ||
80 | const unsigned int *prop; | ||
81 | unsigned int l2cache_size; | ||
82 | struct sram_parameters sram_params; | ||
83 | |||
84 | if (!dev->dev.of_node) { | ||
85 | dev_err(&dev->dev, "Device's OF-node is NULL\n"); | ||
86 | return -EINVAL; | ||
87 | } | ||
88 | |||
89 | prop = of_get_property(dev->dev.of_node, "cache-size", NULL); | ||
90 | if (!prop) { | ||
91 | dev_err(&dev->dev, "Missing L2 cache-size\n"); | ||
92 | return -EINVAL; | ||
93 | } | ||
94 | l2cache_size = *prop; | ||
95 | |||
96 | sram_params.sram_size = get_cache_sram_size(); | ||
97 | if (sram_params.sram_size <= 0) { | ||
98 | dev_err(&dev->dev, | ||
99 | "Entire L2 as cache, Aborting Cache-SRAM stuff\n"); | ||
100 | return -EINVAL; | ||
101 | } | ||
102 | |||
103 | sram_params.sram_offset = get_cache_sram_offset(); | ||
104 | if (sram_params.sram_offset <= 0) { | ||
105 | dev_err(&dev->dev, | ||
106 | "Entire L2 as cache, provide a valid sram offset\n"); | ||
107 | return -EINVAL; | ||
108 | } | ||
109 | |||
110 | |||
111 | rem = l2cache_size % sram_params.sram_size; | ||
112 | ways = LOCK_WAYS_FULL * sram_params.sram_size / l2cache_size; | ||
113 | if (rem || (ways & (ways - 1))) { | ||
114 | dev_err(&dev->dev, "Illegal cache-sram-size in command line\n"); | ||
115 | return -EINVAL; | ||
116 | } | ||
117 | |||
118 | l2ctlr = of_iomap(dev->dev.of_node, 0); | ||
119 | if (!l2ctlr) { | ||
120 | dev_err(&dev->dev, "Can't map L2 controller\n"); | ||
121 | return -EINVAL; | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * Write bits[0-17] to srbar0 | ||
126 | */ | ||
127 | out_be32(&l2ctlr->srbar0, | ||
128 | sram_params.sram_offset & L2SRAM_BAR_MSK_LO18); | ||
129 | |||
130 | /* | ||
131 | * Write bits[18-21] to srbare0 | ||
132 | */ | ||
133 | #ifdef CONFIG_PHYS_64BIT | ||
134 | out_be32(&l2ctlr->srbarea0, | ||
135 | (sram_params.sram_offset >> 32) & L2SRAM_BARE_MSK_HI4); | ||
136 | #endif | ||
137 | |||
138 | clrsetbits_be32(&l2ctlr->ctl, L2CR_L2E, L2CR_L2FI); | ||
139 | |||
140 | switch (ways) { | ||
141 | case LOCK_WAYS_EIGHTH: | ||
142 | setbits32(&l2ctlr->ctl, | ||
143 | L2CR_L2E | L2CR_L2FI | L2CR_SRAM_EIGHTH); | ||
144 | break; | ||
145 | |||
146 | case LOCK_WAYS_TWO_EIGHTH: | ||
147 | setbits32(&l2ctlr->ctl, | ||
148 | L2CR_L2E | L2CR_L2FI | L2CR_SRAM_QUART); | ||
149 | break; | ||
150 | |||
151 | case LOCK_WAYS_HALF: | ||
152 | setbits32(&l2ctlr->ctl, | ||
153 | L2CR_L2E | L2CR_L2FI | L2CR_SRAM_HALF); | ||
154 | break; | ||
155 | |||
156 | case LOCK_WAYS_FULL: | ||
157 | default: | ||
158 | setbits32(&l2ctlr->ctl, | ||
159 | L2CR_L2E | L2CR_L2FI | L2CR_SRAM_FULL); | ||
160 | break; | ||
161 | } | ||
162 | eieio(); | ||
163 | |||
164 | rval = instantiate_cache_sram(dev, sram_params); | ||
165 | if (rval < 0) { | ||
166 | dev_err(&dev->dev, "Can't instantiate Cache-SRAM\n"); | ||
167 | iounmap(l2ctlr); | ||
168 | return -EINVAL; | ||
169 | } | ||
170 | |||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static int __devexit mpc85xx_l2ctlr_of_remove(struct platform_device *dev) | ||
175 | { | ||
176 | BUG_ON(!l2ctlr); | ||
177 | |||
178 | iounmap(l2ctlr); | ||
179 | remove_cache_sram(dev); | ||
180 | dev_info(&dev->dev, "MPC85xx L2 controller unloaded\n"); | ||
181 | |||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | static struct of_device_id mpc85xx_l2ctlr_of_match[] = { | ||
186 | { | ||
187 | .compatible = "fsl,p2020-l2-cache-controller", | ||
188 | }, | ||
189 | { | ||
190 | .compatible = "fsl,p2010-l2-cache-controller", | ||
191 | }, | ||
192 | { | ||
193 | .compatible = "fsl,p1020-l2-cache-controller", | ||
194 | }, | ||
195 | { | ||
196 | .compatible = "fsl,p1011-l2-cache-controller", | ||
197 | }, | ||
198 | { | ||
199 | .compatible = "fsl,p1013-l2-cache-controller", | ||
200 | }, | ||
201 | { | ||
202 | .compatible = "fsl,p1022-l2-cache-controller", | ||
203 | }, | ||
204 | {}, | ||
205 | }; | ||
206 | |||
207 | static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = { | ||
208 | .driver = { | ||
209 | .name = "fsl-l2ctlr", | ||
210 | .owner = THIS_MODULE, | ||
211 | .of_match_table = mpc85xx_l2ctlr_of_match, | ||
212 | }, | ||
213 | .probe = mpc85xx_l2ctlr_of_probe, | ||
214 | .remove = __devexit_p(mpc85xx_l2ctlr_of_remove), | ||
215 | }; | ||
216 | |||
217 | static __init int mpc85xx_l2ctlr_of_init(void) | ||
218 | { | ||
219 | return of_register_platform_driver(&mpc85xx_l2ctlr_of_platform_driver); | ||
220 | } | ||
221 | |||
222 | static void __exit mpc85xx_l2ctlr_of_exit(void) | ||
223 | { | ||
224 | of_unregister_platform_driver(&mpc85xx_l2ctlr_of_platform_driver); | ||
225 | } | ||
226 | |||
227 | subsys_initcall(mpc85xx_l2ctlr_of_init); | ||
228 | module_exit(mpc85xx_l2ctlr_of_exit); | ||
229 | |||
230 | MODULE_DESCRIPTION("Freescale MPC85xx L2 controller init"); | ||
231 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index dceb8d1a843d..4fcb5a4e60dd 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c | |||
@@ -1,9 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Freescale LBC and UPM routines. | 2 | * Freescale LBC and UPM routines. |
3 | * | 3 | * |
4 | * Copyright (c) 2007-2008 MontaVista Software, Inc. | 4 | * Copyright © 2007-2008 MontaVista Software, Inc. |
5 | * Copyright © 2010 Freescale Semiconductor | ||
5 | * | 6 | * |
6 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> | 7 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> |
8 | * Author: Jack Lan <Jack.Lan@freescale.com> | ||
9 | * Author: Roy Zang <tie-fei.zang@freescale.com> | ||
7 | * | 10 | * |
8 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
@@ -19,39 +22,37 @@ | |||
19 | #include <linux/types.h> | 22 | #include <linux/types.h> |
20 | #include <linux/io.h> | 23 | #include <linux/io.h> |
21 | #include <linux/of.h> | 24 | #include <linux/of.h> |
25 | #include <linux/slab.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/mod_devicetable.h> | ||
22 | #include <asm/prom.h> | 29 | #include <asm/prom.h> |
23 | #include <asm/fsl_lbc.h> | 30 | #include <asm/fsl_lbc.h> |
24 | 31 | ||
25 | static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock); | 32 | static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock); |
26 | static struct fsl_lbc_regs __iomem *fsl_lbc_regs; | 33 | struct fsl_lbc_ctrl *fsl_lbc_ctrl_dev; |
34 | EXPORT_SYMBOL(fsl_lbc_ctrl_dev); | ||
27 | 35 | ||
28 | static char __initdata *compat_lbc[] = { | 36 | /** |
29 | "fsl,pq2-localbus", | 37 | * fsl_lbc_addr - convert the base address |
30 | "fsl,pq2pro-localbus", | 38 | * @addr_base: base address of the memory bank |
31 | "fsl,pq3-localbus", | 39 | * |
32 | "fsl,elbc", | 40 | * This function converts a base address of lbc into the right format for the |
33 | }; | 41 | * BR register. If the SOC has eLBC then it returns 32bit physical address |
34 | 42 | * else it convers a 34bit local bus physical address to correct format of | |
35 | static int __init fsl_lbc_init(void) | 43 | * 32bit address for BR register (Example: MPC8641). |
44 | */ | ||
45 | u32 fsl_lbc_addr(phys_addr_t addr_base) | ||
36 | { | 46 | { |
37 | struct device_node *lbus; | 47 | struct device_node *np = fsl_lbc_ctrl_dev->dev->of_node; |
38 | int i; | 48 | u32 addr = addr_base & 0xffff8000; |
39 | 49 | ||
40 | for (i = 0; i < ARRAY_SIZE(compat_lbc); i++) { | 50 | if (of_device_is_compatible(np, "fsl,elbc")) |
41 | lbus = of_find_compatible_node(NULL, NULL, compat_lbc[i]); | 51 | return addr; |
42 | if (lbus) | ||
43 | goto found; | ||
44 | } | ||
45 | return -ENODEV; | ||
46 | 52 | ||
47 | found: | 53 | return addr | ((addr_base & 0x300000000ull) >> 19); |
48 | fsl_lbc_regs = of_iomap(lbus, 0); | ||
49 | of_node_put(lbus); | ||
50 | if (!fsl_lbc_regs) | ||
51 | return -ENOMEM; | ||
52 | return 0; | ||
53 | } | 54 | } |
54 | arch_initcall(fsl_lbc_init); | 55 | EXPORT_SYMBOL(fsl_lbc_addr); |
55 | 56 | ||
56 | /** | 57 | /** |
57 | * fsl_lbc_find - find Localbus bank | 58 | * fsl_lbc_find - find Localbus bank |
@@ -65,15 +66,17 @@ arch_initcall(fsl_lbc_init); | |||
65 | int fsl_lbc_find(phys_addr_t addr_base) | 66 | int fsl_lbc_find(phys_addr_t addr_base) |
66 | { | 67 | { |
67 | int i; | 68 | int i; |
69 | struct fsl_lbc_regs __iomem *lbc; | ||
68 | 70 | ||
69 | if (!fsl_lbc_regs) | 71 | if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs) |
70 | return -ENODEV; | 72 | return -ENODEV; |
71 | 73 | ||
72 | for (i = 0; i < ARRAY_SIZE(fsl_lbc_regs->bank); i++) { | 74 | lbc = fsl_lbc_ctrl_dev->regs; |
73 | __be32 br = in_be32(&fsl_lbc_regs->bank[i].br); | 75 | for (i = 0; i < ARRAY_SIZE(lbc->bank); i++) { |
74 | __be32 or = in_be32(&fsl_lbc_regs->bank[i].or); | 76 | __be32 br = in_be32(&lbc->bank[i].br); |
77 | __be32 or = in_be32(&lbc->bank[i].or); | ||
75 | 78 | ||
76 | if (br & BR_V && (br & or & BR_BA) == addr_base) | 79 | if (br & BR_V && (br & or & BR_BA) == fsl_lbc_addr(addr_base)) |
77 | return i; | 80 | return i; |
78 | } | 81 | } |
79 | 82 | ||
@@ -94,22 +97,27 @@ int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm) | |||
94 | { | 97 | { |
95 | int bank; | 98 | int bank; |
96 | __be32 br; | 99 | __be32 br; |
100 | struct fsl_lbc_regs __iomem *lbc; | ||
97 | 101 | ||
98 | bank = fsl_lbc_find(addr_base); | 102 | bank = fsl_lbc_find(addr_base); |
99 | if (bank < 0) | 103 | if (bank < 0) |
100 | return bank; | 104 | return bank; |
101 | 105 | ||
102 | br = in_be32(&fsl_lbc_regs->bank[bank].br); | 106 | if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs) |
107 | return -ENODEV; | ||
108 | |||
109 | lbc = fsl_lbc_ctrl_dev->regs; | ||
110 | br = in_be32(&lbc->bank[bank].br); | ||
103 | 111 | ||
104 | switch (br & BR_MSEL) { | 112 | switch (br & BR_MSEL) { |
105 | case BR_MS_UPMA: | 113 | case BR_MS_UPMA: |
106 | upm->mxmr = &fsl_lbc_regs->mamr; | 114 | upm->mxmr = &lbc->mamr; |
107 | break; | 115 | break; |
108 | case BR_MS_UPMB: | 116 | case BR_MS_UPMB: |
109 | upm->mxmr = &fsl_lbc_regs->mbmr; | 117 | upm->mxmr = &lbc->mbmr; |
110 | break; | 118 | break; |
111 | case BR_MS_UPMC: | 119 | case BR_MS_UPMC: |
112 | upm->mxmr = &fsl_lbc_regs->mcmr; | 120 | upm->mxmr = &lbc->mcmr; |
113 | break; | 121 | break; |
114 | default: | 122 | default: |
115 | return -EINVAL; | 123 | return -EINVAL; |
@@ -148,9 +156,12 @@ int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar) | |||
148 | int ret = 0; | 156 | int ret = 0; |
149 | unsigned long flags; | 157 | unsigned long flags; |
150 | 158 | ||
159 | if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs) | ||
160 | return -ENODEV; | ||
161 | |||
151 | spin_lock_irqsave(&fsl_lbc_lock, flags); | 162 | spin_lock_irqsave(&fsl_lbc_lock, flags); |
152 | 163 | ||
153 | out_be32(&fsl_lbc_regs->mar, mar); | 164 | out_be32(&fsl_lbc_ctrl_dev->regs->mar, mar); |
154 | 165 | ||
155 | switch (upm->width) { | 166 | switch (upm->width) { |
156 | case 8: | 167 | case 8: |
@@ -172,3 +183,166 @@ int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar) | |||
172 | return ret; | 183 | return ret; |
173 | } | 184 | } |
174 | EXPORT_SYMBOL(fsl_upm_run_pattern); | 185 | EXPORT_SYMBOL(fsl_upm_run_pattern); |
186 | |||
187 | static int __devinit fsl_lbc_ctrl_init(struct fsl_lbc_ctrl *ctrl) | ||
188 | { | ||
189 | struct fsl_lbc_regs __iomem *lbc = ctrl->regs; | ||
190 | |||
191 | /* clear event registers */ | ||
192 | setbits32(&lbc->ltesr, LTESR_CLEAR); | ||
193 | out_be32(&lbc->lteatr, 0); | ||
194 | out_be32(&lbc->ltear, 0); | ||
195 | out_be32(&lbc->lteccr, LTECCR_CLEAR); | ||
196 | out_be32(&lbc->ltedr, LTEDR_ENABLE); | ||
197 | |||
198 | /* Enable interrupts for any detected events */ | ||
199 | out_be32(&lbc->lteir, LTEIR_ENABLE); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | /* | ||
205 | * NOTE: This interrupt is used to report localbus events of various kinds, | ||
206 | * such as transaction errors on the chipselects. | ||
207 | */ | ||
208 | |||
209 | static irqreturn_t fsl_lbc_ctrl_irq(int irqno, void *data) | ||
210 | { | ||
211 | struct fsl_lbc_ctrl *ctrl = data; | ||
212 | struct fsl_lbc_regs __iomem *lbc = ctrl->regs; | ||
213 | u32 status; | ||
214 | |||
215 | status = in_be32(&lbc->ltesr); | ||
216 | if (!status) | ||
217 | return IRQ_NONE; | ||
218 | |||
219 | out_be32(&lbc->ltesr, LTESR_CLEAR); | ||
220 | out_be32(&lbc->lteatr, 0); | ||
221 | out_be32(&lbc->ltear, 0); | ||
222 | ctrl->irq_status = status; | ||
223 | |||
224 | if (status & LTESR_BM) | ||
225 | dev_err(ctrl->dev, "Local bus monitor time-out: " | ||
226 | "LTESR 0x%08X\n", status); | ||
227 | if (status & LTESR_WP) | ||
228 | dev_err(ctrl->dev, "Write protect error: " | ||
229 | "LTESR 0x%08X\n", status); | ||
230 | if (status & LTESR_ATMW) | ||
231 | dev_err(ctrl->dev, "Atomic write error: " | ||
232 | "LTESR 0x%08X\n", status); | ||
233 | if (status & LTESR_ATMR) | ||
234 | dev_err(ctrl->dev, "Atomic read error: " | ||
235 | "LTESR 0x%08X\n", status); | ||
236 | if (status & LTESR_CS) | ||
237 | dev_err(ctrl->dev, "Chip select error: " | ||
238 | "LTESR 0x%08X\n", status); | ||
239 | if (status & LTESR_UPM) | ||
240 | ; | ||
241 | if (status & LTESR_FCT) { | ||
242 | dev_err(ctrl->dev, "FCM command time-out: " | ||
243 | "LTESR 0x%08X\n", status); | ||
244 | smp_wmb(); | ||
245 | wake_up(&ctrl->irq_wait); | ||
246 | } | ||
247 | if (status & LTESR_PAR) { | ||
248 | dev_err(ctrl->dev, "Parity or Uncorrectable ECC error: " | ||
249 | "LTESR 0x%08X\n", status); | ||
250 | smp_wmb(); | ||
251 | wake_up(&ctrl->irq_wait); | ||
252 | } | ||
253 | if (status & LTESR_CC) { | ||
254 | smp_wmb(); | ||
255 | wake_up(&ctrl->irq_wait); | ||
256 | } | ||
257 | if (status & ~LTESR_MASK) | ||
258 | dev_err(ctrl->dev, "Unknown error: " | ||
259 | "LTESR 0x%08X\n", status); | ||
260 | return IRQ_HANDLED; | ||
261 | } | ||
262 | |||
263 | /* | ||
264 | * fsl_lbc_ctrl_probe | ||
265 | * | ||
266 | * called by device layer when it finds a device matching | ||
267 | * one our driver can handled. This code allocates all of | ||
268 | * the resources needed for the controller only. The | ||
269 | * resources for the NAND banks themselves are allocated | ||
270 | * in the chip probe function. | ||
271 | */ | ||
272 | |||
273 | static int __devinit fsl_lbc_ctrl_probe(struct platform_device *dev) | ||
274 | { | ||
275 | int ret; | ||
276 | |||
277 | if (!dev->dev.of_node) { | ||
278 | dev_err(&dev->dev, "Device OF-Node is NULL"); | ||
279 | return -EFAULT; | ||
280 | } | ||
281 | |||
282 | fsl_lbc_ctrl_dev = kzalloc(sizeof(*fsl_lbc_ctrl_dev), GFP_KERNEL); | ||
283 | if (!fsl_lbc_ctrl_dev) | ||
284 | return -ENOMEM; | ||
285 | |||
286 | dev_set_drvdata(&dev->dev, fsl_lbc_ctrl_dev); | ||
287 | |||
288 | spin_lock_init(&fsl_lbc_ctrl_dev->lock); | ||
289 | init_waitqueue_head(&fsl_lbc_ctrl_dev->irq_wait); | ||
290 | |||
291 | fsl_lbc_ctrl_dev->regs = of_iomap(dev->dev.of_node, 0); | ||
292 | if (!fsl_lbc_ctrl_dev->regs) { | ||
293 | dev_err(&dev->dev, "failed to get memory region\n"); | ||
294 | ret = -ENODEV; | ||
295 | goto err; | ||
296 | } | ||
297 | |||
298 | fsl_lbc_ctrl_dev->irq = irq_of_parse_and_map(dev->dev.of_node, 0); | ||
299 | if (fsl_lbc_ctrl_dev->irq == NO_IRQ) { | ||
300 | dev_err(&dev->dev, "failed to get irq resource\n"); | ||
301 | ret = -ENODEV; | ||
302 | goto err; | ||
303 | } | ||
304 | |||
305 | fsl_lbc_ctrl_dev->dev = &dev->dev; | ||
306 | |||
307 | ret = fsl_lbc_ctrl_init(fsl_lbc_ctrl_dev); | ||
308 | if (ret < 0) | ||
309 | goto err; | ||
310 | |||
311 | ret = request_irq(fsl_lbc_ctrl_dev->irq, fsl_lbc_ctrl_irq, 0, | ||
312 | "fsl-lbc", fsl_lbc_ctrl_dev); | ||
313 | if (ret != 0) { | ||
314 | dev_err(&dev->dev, "failed to install irq (%d)\n", | ||
315 | fsl_lbc_ctrl_dev->irq); | ||
316 | ret = fsl_lbc_ctrl_dev->irq; | ||
317 | goto err; | ||
318 | } | ||
319 | |||
320 | return 0; | ||
321 | |||
322 | err: | ||
323 | iounmap(fsl_lbc_ctrl_dev->regs); | ||
324 | kfree(fsl_lbc_ctrl_dev); | ||
325 | return ret; | ||
326 | } | ||
327 | |||
328 | static const struct of_device_id fsl_lbc_match[] = { | ||
329 | { .compatible = "fsl,elbc", }, | ||
330 | { .compatible = "fsl,pq3-localbus", }, | ||
331 | { .compatible = "fsl,pq2-localbus", }, | ||
332 | { .compatible = "fsl,pq2pro-localbus", }, | ||
333 | {}, | ||
334 | }; | ||
335 | |||
336 | static struct platform_driver fsl_lbc_ctrl_driver = { | ||
337 | .driver = { | ||
338 | .name = "fsl-lbc", | ||
339 | .of_match_table = fsl_lbc_match, | ||
340 | }, | ||
341 | .probe = fsl_lbc_ctrl_probe, | ||
342 | }; | ||
343 | |||
344 | static int __init fsl_lbc_init(void) | ||
345 | { | ||
346 | return platform_driver_register(&fsl_lbc_ctrl_driver); | ||
347 | } | ||
348 | module_init(fsl_lbc_init); | ||
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index 87991d3abbab..108d76fa8f1c 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/ppc-pci.h> | 24 | #include <asm/ppc-pci.h> |
25 | #include <asm/mpic.h> | 25 | #include <asm/mpic.h> |
26 | #include "fsl_msi.h" | 26 | #include "fsl_msi.h" |
27 | #include "fsl_pci.h" | ||
27 | 28 | ||
28 | LIST_HEAD(msi_head); | 29 | LIST_HEAD(msi_head); |
29 | 30 | ||
@@ -51,8 +52,8 @@ static void fsl_msi_end_irq(unsigned int virq) | |||
51 | } | 52 | } |
52 | 53 | ||
53 | static struct irq_chip fsl_msi_chip = { | 54 | static struct irq_chip fsl_msi_chip = { |
54 | .mask = mask_msi_irq, | 55 | .irq_mask = mask_msi_irq, |
55 | .unmask = unmask_msi_irq, | 56 | .irq_unmask = unmask_msi_irq, |
56 | .ack = fsl_msi_end_irq, | 57 | .ack = fsl_msi_end_irq, |
57 | .name = "FSL-MSI", | 58 | .name = "FSL-MSI", |
58 | }; | 59 | }; |
@@ -125,13 +126,11 @@ static void fsl_compose_msi_msg(struct pci_dev *pdev, int hwirq, | |||
125 | { | 126 | { |
126 | struct fsl_msi *msi_data = fsl_msi_data; | 127 | struct fsl_msi *msi_data = fsl_msi_data; |
127 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); | 128 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); |
128 | u32 base = 0; | 129 | u64 base = fsl_pci_immrbar_base(hose); |
129 | 130 | ||
130 | pci_bus_read_config_dword(hose->bus, | 131 | msg->address_lo = msi_data->msi_addr_lo + lower_32_bits(base); |
131 | PCI_DEVFN(0, 0), PCI_BASE_ADDRESS_0, &base); | 132 | msg->address_hi = msi_data->msi_addr_hi + upper_32_bits(base); |
132 | 133 | ||
133 | msg->address_lo = msi_data->msi_addr_lo + base; | ||
134 | msg->address_hi = msi_data->msi_addr_hi; | ||
135 | msg->data = hwirq; | 134 | msg->data = hwirq; |
136 | 135 | ||
137 | pr_debug("%s: allocated srs: %d, ibs: %d\n", | 136 | pr_debug("%s: allocated srs: %d, ibs: %d\n", |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 209384b6e039..818f7c6c8fa1 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * MPC83xx/85xx/86xx PCI/PCIE support routing. | 2 | * MPC83xx/85xx/86xx PCI/PCIE support routing. |
3 | * | 3 | * |
4 | * Copyright 2007-2009 Freescale Semiconductor, Inc. | 4 | * Copyright 2007-2010 Freescale Semiconductor, Inc. |
5 | * Copyright 2008-2009 MontaVista Software, Inc. | 5 | * Copyright 2008-2009 MontaVista Software, Inc. |
6 | * | 6 | * |
7 | * Initial author: Xianghua Xiao <x.xiao@freescale.com> | 7 | * Initial author: Xianghua Xiao <x.xiao@freescale.com> |
@@ -34,7 +34,7 @@ | |||
34 | #include <sysdev/fsl_soc.h> | 34 | #include <sysdev/fsl_soc.h> |
35 | #include <sysdev/fsl_pci.h> | 35 | #include <sysdev/fsl_pci.h> |
36 | 36 | ||
37 | static int fsl_pcie_bus_fixup; | 37 | static int fsl_pcie_bus_fixup, is_mpc83xx_pci; |
38 | 38 | ||
39 | static void __init quirk_fsl_pcie_header(struct pci_dev *dev) | 39 | static void __init quirk_fsl_pcie_header(struct pci_dev *dev) |
40 | { | 40 | { |
@@ -399,16 +399,26 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013E, quirk_fsl_pcie_header); | |||
399 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013, quirk_fsl_pcie_header); | 399 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013, quirk_fsl_pcie_header); |
400 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020E, quirk_fsl_pcie_header); | 400 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020E, quirk_fsl_pcie_header); |
401 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020, quirk_fsl_pcie_header); | 401 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020, quirk_fsl_pcie_header); |
402 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1021E, quirk_fsl_pcie_header); | ||
403 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1021, quirk_fsl_pcie_header); | ||
402 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022E, quirk_fsl_pcie_header); | 404 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022E, quirk_fsl_pcie_header); |
403 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022, quirk_fsl_pcie_header); | 405 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022, quirk_fsl_pcie_header); |
404 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010E, quirk_fsl_pcie_header); | 406 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010E, quirk_fsl_pcie_header); |
405 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010, quirk_fsl_pcie_header); | 407 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010, quirk_fsl_pcie_header); |
406 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020E, quirk_fsl_pcie_header); | 408 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020E, quirk_fsl_pcie_header); |
407 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020, quirk_fsl_pcie_header); | 409 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020, quirk_fsl_pcie_header); |
410 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2040E, quirk_fsl_pcie_header); | ||
411 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2040, quirk_fsl_pcie_header); | ||
412 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P3041E, quirk_fsl_pcie_header); | ||
413 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P3041, quirk_fsl_pcie_header); | ||
408 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4040E, quirk_fsl_pcie_header); | 414 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4040E, quirk_fsl_pcie_header); |
409 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4040, quirk_fsl_pcie_header); | 415 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4040, quirk_fsl_pcie_header); |
410 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080E, quirk_fsl_pcie_header); | 416 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080E, quirk_fsl_pcie_header); |
411 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080, quirk_fsl_pcie_header); | 417 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080, quirk_fsl_pcie_header); |
418 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P5010E, quirk_fsl_pcie_header); | ||
419 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P5010, quirk_fsl_pcie_header); | ||
420 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P5020E, quirk_fsl_pcie_header); | ||
421 | DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P5020, quirk_fsl_pcie_header); | ||
412 | #endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */ | 422 | #endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */ |
413 | 423 | ||
414 | #if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x) | 424 | #if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x) |
@@ -428,6 +438,13 @@ struct mpc83xx_pcie_priv { | |||
428 | u32 dev_base; | 438 | u32 dev_base; |
429 | }; | 439 | }; |
430 | 440 | ||
441 | struct pex_inbound_window { | ||
442 | u32 ar; | ||
443 | u32 tar; | ||
444 | u32 barl; | ||
445 | u32 barh; | ||
446 | }; | ||
447 | |||
431 | /* | 448 | /* |
432 | * With the convention of u-boot, the PCIE outbound window 0 serves | 449 | * With the convention of u-boot, the PCIE outbound window 0 serves |
433 | * as configuration transactions outbound. | 450 | * as configuration transactions outbound. |
@@ -435,6 +452,8 @@ struct mpc83xx_pcie_priv { | |||
435 | #define PEX_OUTWIN0_BAR 0xCA4 | 452 | #define PEX_OUTWIN0_BAR 0xCA4 |
436 | #define PEX_OUTWIN0_TAL 0xCA8 | 453 | #define PEX_OUTWIN0_TAL 0xCA8 |
437 | #define PEX_OUTWIN0_TAH 0xCAC | 454 | #define PEX_OUTWIN0_TAH 0xCAC |
455 | #define PEX_RC_INWIN_BASE 0xE60 | ||
456 | #define PEX_RCIWARn_EN 0x1 | ||
438 | 457 | ||
439 | static int mpc83xx_pcie_exclude_device(struct pci_bus *bus, unsigned int devfn) | 458 | static int mpc83xx_pcie_exclude_device(struct pci_bus *bus, unsigned int devfn) |
440 | { | 459 | { |
@@ -602,6 +621,8 @@ int __init mpc83xx_add_bridge(struct device_node *dev) | |||
602 | const int *bus_range; | 621 | const int *bus_range; |
603 | int primary; | 622 | int primary; |
604 | 623 | ||
624 | is_mpc83xx_pci = 1; | ||
625 | |||
605 | if (!of_device_is_available(dev)) { | 626 | if (!of_device_is_available(dev)) { |
606 | pr_warning("%s: disabled by the firmware.\n", | 627 | pr_warning("%s: disabled by the firmware.\n", |
607 | dev->full_name); | 628 | dev->full_name); |
@@ -681,3 +702,40 @@ err0: | |||
681 | return ret; | 702 | return ret; |
682 | } | 703 | } |
683 | #endif /* CONFIG_PPC_83xx */ | 704 | #endif /* CONFIG_PPC_83xx */ |
705 | |||
706 | u64 fsl_pci_immrbar_base(struct pci_controller *hose) | ||
707 | { | ||
708 | #ifdef CONFIG_PPC_83xx | ||
709 | if (is_mpc83xx_pci) { | ||
710 | struct mpc83xx_pcie_priv *pcie = hose->dn->data; | ||
711 | struct pex_inbound_window *in; | ||
712 | int i; | ||
713 | |||
714 | /* Walk the Root Complex Inbound windows to match IMMR base */ | ||
715 | in = pcie->cfg_type0 + PEX_RC_INWIN_BASE; | ||
716 | for (i = 0; i < 4; i++) { | ||
717 | /* not enabled, skip */ | ||
718 | if (!in_le32(&in[i].ar) & PEX_RCIWARn_EN) | ||
719 | continue; | ||
720 | |||
721 | if (get_immrbase() == in_le32(&in[i].tar)) | ||
722 | return (u64)in_le32(&in[i].barh) << 32 | | ||
723 | in_le32(&in[i].barl); | ||
724 | } | ||
725 | |||
726 | printk(KERN_WARNING "could not find PCI BAR matching IMMR\n"); | ||
727 | } | ||
728 | #endif | ||
729 | |||
730 | #if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx) | ||
731 | if (!is_mpc83xx_pci) { | ||
732 | u32 base; | ||
733 | |||
734 | pci_bus_read_config_dword(hose->bus, | ||
735 | PCI_DEVFN(0, 0), PCI_BASE_ADDRESS_0, &base); | ||
736 | return base; | ||
737 | } | ||
738 | #endif | ||
739 | |||
740 | return 0; | ||
741 | } | ||
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h index a9d8bbebed80..8ad72a11f77b 100644 --- a/arch/powerpc/sysdev/fsl_pci.h +++ b/arch/powerpc/sysdev/fsl_pci.h | |||
@@ -88,6 +88,7 @@ struct ccsr_pci { | |||
88 | extern int fsl_add_bridge(struct device_node *dev, int is_primary); | 88 | extern int fsl_add_bridge(struct device_node *dev, int is_primary); |
89 | extern void fsl_pcibios_fixup_bus(struct pci_bus *bus); | 89 | extern void fsl_pcibios_fixup_bus(struct pci_bus *bus); |
90 | extern int mpc83xx_add_bridge(struct device_node *dev); | 90 | extern int mpc83xx_add_bridge(struct device_node *dev); |
91 | u64 fsl_pci_immrbar_base(struct pci_controller *hose); | ||
91 | 92 | ||
92 | #endif /* __POWERPC_FSL_PCI_H */ | 93 | #endif /* __POWERPC_FSL_PCI_H */ |
93 | #endif /* __KERNEL__ */ | 94 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c index 8bd86530ee25..9725369d432a 100644 --- a/arch/powerpc/sysdev/fsl_rio.c +++ b/arch/powerpc/sysdev/fsl_rio.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #define RIO_ATMU_REGS_OFFSET 0x10c00 | 50 | #define RIO_ATMU_REGS_OFFSET 0x10c00 |
51 | #define RIO_P_MSG_REGS_OFFSET 0x11000 | 51 | #define RIO_P_MSG_REGS_OFFSET 0x11000 |
52 | #define RIO_S_MSG_REGS_OFFSET 0x13000 | 52 | #define RIO_S_MSG_REGS_OFFSET 0x13000 |
53 | #define RIO_GCCSR 0x13c | ||
53 | #define RIO_ESCSR 0x158 | 54 | #define RIO_ESCSR 0x158 |
54 | #define RIO_CCSR 0x15c | 55 | #define RIO_CCSR 0x15c |
55 | #define RIO_LTLEDCSR 0x0608 | 56 | #define RIO_LTLEDCSR 0x0608 |
@@ -87,6 +88,9 @@ | |||
87 | #define RIO_IPWSR_PWD 0x00000008 | 88 | #define RIO_IPWSR_PWD 0x00000008 |
88 | #define RIO_IPWSR_PWB 0x00000004 | 89 | #define RIO_IPWSR_PWB 0x00000004 |
89 | 90 | ||
91 | #define RIO_EPWISR_PINT 0x80000000 | ||
92 | #define RIO_EPWISR_PW 0x00000001 | ||
93 | |||
90 | #define RIO_MSG_DESC_SIZE 32 | 94 | #define RIO_MSG_DESC_SIZE 32 |
91 | #define RIO_MSG_BUFFER_SIZE 4096 | 95 | #define RIO_MSG_BUFFER_SIZE 4096 |
92 | #define RIO_MIN_TX_RING_SIZE 2 | 96 | #define RIO_MIN_TX_RING_SIZE 2 |
@@ -117,44 +121,59 @@ struct rio_atmu_regs { | |||
117 | }; | 121 | }; |
118 | 122 | ||
119 | struct rio_msg_regs { | 123 | struct rio_msg_regs { |
120 | u32 omr; | 124 | u32 omr; /* 0xD_3000 - Outbound message 0 mode register */ |
121 | u32 osr; | 125 | u32 osr; /* 0xD_3004 - Outbound message 0 status register */ |
122 | u32 pad1; | 126 | u32 pad1; |
123 | u32 odqdpar; | 127 | u32 odqdpar; /* 0xD_300C - Outbound message 0 descriptor queue |
128 | dequeue pointer address register */ | ||
124 | u32 pad2; | 129 | u32 pad2; |
125 | u32 osar; | 130 | u32 osar; /* 0xD_3014 - Outbound message 0 source address |
126 | u32 odpr; | 131 | register */ |
127 | u32 odatr; | 132 | u32 odpr; /* 0xD_3018 - Outbound message 0 destination port |
128 | u32 odcr; | 133 | register */ |
134 | u32 odatr; /* 0xD_301C - Outbound message 0 destination attributes | ||
135 | Register*/ | ||
136 | u32 odcr; /* 0xD_3020 - Outbound message 0 double-word count | ||
137 | register */ | ||
129 | u32 pad3; | 138 | u32 pad3; |
130 | u32 odqepar; | 139 | u32 odqepar; /* 0xD_3028 - Outbound message 0 descriptor queue |
140 | enqueue pointer address register */ | ||
131 | u32 pad4[13]; | 141 | u32 pad4[13]; |
132 | u32 imr; | 142 | u32 imr; /* 0xD_3060 - Inbound message 0 mode register */ |
133 | u32 isr; | 143 | u32 isr; /* 0xD_3064 - Inbound message 0 status register */ |
134 | u32 pad5; | 144 | u32 pad5; |
135 | u32 ifqdpar; | 145 | u32 ifqdpar; /* 0xD_306C - Inbound message 0 frame queue dequeue |
146 | pointer address register*/ | ||
136 | u32 pad6; | 147 | u32 pad6; |
137 | u32 ifqepar; | 148 | u32 ifqepar; /* 0xD_3074 - Inbound message 0 frame queue enqueue |
149 | pointer address register */ | ||
138 | u32 pad7[226]; | 150 | u32 pad7[226]; |
139 | u32 odmr; | 151 | u32 odmr; /* 0xD_3400 - Outbound doorbell mode register */ |
140 | u32 odsr; | 152 | u32 odsr; /* 0xD_3404 - Outbound doorbell status register */ |
141 | u32 res0[4]; | 153 | u32 res0[4]; |
142 | u32 oddpr; | 154 | u32 oddpr; /* 0xD_3418 - Outbound doorbell destination port |
143 | u32 oddatr; | 155 | register */ |
156 | u32 oddatr; /* 0xD_341c - Outbound doorbell destination attributes | ||
157 | register */ | ||
144 | u32 res1[3]; | 158 | u32 res1[3]; |
145 | u32 odretcr; | 159 | u32 odretcr; /* 0xD_342C - Outbound doorbell retry error threshold |
160 | configuration register */ | ||
146 | u32 res2[12]; | 161 | u32 res2[12]; |
147 | u32 dmr; | 162 | u32 dmr; /* 0xD_3460 - Inbound doorbell mode register */ |
148 | u32 dsr; | 163 | u32 dsr; /* 0xD_3464 - Inbound doorbell status register */ |
149 | u32 pad8; | 164 | u32 pad8; |
150 | u32 dqdpar; | 165 | u32 dqdpar; /* 0xD_346C - Inbound doorbell queue dequeue Pointer |
166 | address register */ | ||
151 | u32 pad9; | 167 | u32 pad9; |
152 | u32 dqepar; | 168 | u32 dqepar; /* 0xD_3474 - Inbound doorbell Queue enqueue pointer |
169 | address register */ | ||
153 | u32 pad10[26]; | 170 | u32 pad10[26]; |
154 | u32 pwmr; | 171 | u32 pwmr; /* 0xD_34E0 - Inbound port-write mode register */ |
155 | u32 pwsr; | 172 | u32 pwsr; /* 0xD_34E4 - Inbound port-write status register */ |
156 | u32 epwqbar; | 173 | u32 epwqbar; /* 0xD_34E8 - Extended Port-Write Queue Base Address |
157 | u32 pwqbar; | 174 | register */ |
175 | u32 pwqbar; /* 0xD_34EC - Inbound port-write queue base address | ||
176 | register */ | ||
158 | }; | 177 | }; |
159 | 178 | ||
160 | struct rio_tx_desc { | 179 | struct rio_tx_desc { |
@@ -240,12 +259,13 @@ struct rio_priv { | |||
240 | 259 | ||
241 | static void __iomem *rio_regs_win; | 260 | static void __iomem *rio_regs_win; |
242 | 261 | ||
262 | #ifdef CONFIG_E500 | ||
243 | static int (*saved_mcheck_exception)(struct pt_regs *regs); | 263 | static int (*saved_mcheck_exception)(struct pt_regs *regs); |
244 | 264 | ||
245 | static int fsl_rio_mcheck_exception(struct pt_regs *regs) | 265 | static int fsl_rio_mcheck_exception(struct pt_regs *regs) |
246 | { | 266 | { |
247 | const struct exception_table_entry *entry = NULL; | 267 | const struct exception_table_entry *entry = NULL; |
248 | unsigned long reason = (mfspr(SPRN_MCSR) & MCSR_MASK); | 268 | unsigned long reason = mfspr(SPRN_MCSR); |
249 | 269 | ||
250 | if (reason & MCSR_BUS_RBERR) { | 270 | if (reason & MCSR_BUS_RBERR) { |
251 | reason = in_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR)); | 271 | reason = in_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR)); |
@@ -269,6 +289,7 @@ static int fsl_rio_mcheck_exception(struct pt_regs *regs) | |||
269 | else | 289 | else |
270 | return cur_cpu_spec->machine_check(regs); | 290 | return cur_cpu_spec->machine_check(regs); |
271 | } | 291 | } |
292 | #endif | ||
272 | 293 | ||
273 | /** | 294 | /** |
274 | * fsl_rio_doorbell_send - Send a MPC85xx doorbell message | 295 | * fsl_rio_doorbell_send - Send a MPC85xx doorbell message |
@@ -1065,18 +1086,12 @@ fsl_rio_port_write_handler(int irq, void *dev_instance) | |||
1065 | struct rio_priv *priv = port->priv; | 1086 | struct rio_priv *priv = port->priv; |
1066 | u32 epwisr, tmp; | 1087 | u32 epwisr, tmp; |
1067 | 1088 | ||
1068 | ipwmr = in_be32(&priv->msg_regs->pwmr); | ||
1069 | ipwsr = in_be32(&priv->msg_regs->pwsr); | ||
1070 | |||
1071 | epwisr = in_be32(priv->regs_win + RIO_EPWISR); | 1089 | epwisr = in_be32(priv->regs_win + RIO_EPWISR); |
1072 | if (epwisr & 0x80000000) { | 1090 | if (!(epwisr & RIO_EPWISR_PW)) |
1073 | tmp = in_be32(priv->regs_win + RIO_LTLEDCSR); | 1091 | goto pw_done; |
1074 | pr_info("RIO_LTLEDCSR = 0x%x\n", tmp); | ||
1075 | out_be32(priv->regs_win + RIO_LTLEDCSR, 0); | ||
1076 | } | ||
1077 | 1092 | ||
1078 | if (!(epwisr & 0x00000001)) | 1093 | ipwmr = in_be32(&priv->msg_regs->pwmr); |
1079 | return IRQ_HANDLED; | 1094 | ipwsr = in_be32(&priv->msg_regs->pwsr); |
1080 | 1095 | ||
1081 | #ifdef DEBUG_PW | 1096 | #ifdef DEBUG_PW |
1082 | pr_debug("PW Int->IPWMR: 0x%08x IPWSR: 0x%08x (", ipwmr, ipwsr); | 1097 | pr_debug("PW Int->IPWMR: 0x%08x IPWSR: 0x%08x (", ipwmr, ipwsr); |
@@ -1092,20 +1107,6 @@ fsl_rio_port_write_handler(int irq, void *dev_instance) | |||
1092 | pr_debug(" PWB"); | 1107 | pr_debug(" PWB"); |
1093 | pr_debug(" )\n"); | 1108 | pr_debug(" )\n"); |
1094 | #endif | 1109 | #endif |
1095 | out_be32(&priv->msg_regs->pwsr, | ||
1096 | ipwsr & (RIO_IPWSR_TE | RIO_IPWSR_QFI | RIO_IPWSR_PWD)); | ||
1097 | |||
1098 | if ((ipwmr & RIO_IPWMR_EIE) && (ipwsr & RIO_IPWSR_TE)) { | ||
1099 | priv->port_write_msg.err_count++; | ||
1100 | pr_info("RIO: Port-Write Transaction Err (%d)\n", | ||
1101 | priv->port_write_msg.err_count); | ||
1102 | } | ||
1103 | if (ipwsr & RIO_IPWSR_PWD) { | ||
1104 | priv->port_write_msg.discard_count++; | ||
1105 | pr_info("RIO: Port Discarded Port-Write Msg(s) (%d)\n", | ||
1106 | priv->port_write_msg.discard_count); | ||
1107 | } | ||
1108 | |||
1109 | /* Schedule deferred processing if PW was received */ | 1110 | /* Schedule deferred processing if PW was received */ |
1110 | if (ipwsr & RIO_IPWSR_QFI) { | 1111 | if (ipwsr & RIO_IPWSR_QFI) { |
1111 | /* Save PW message (if there is room in FIFO), | 1112 | /* Save PW message (if there is room in FIFO), |
@@ -1117,16 +1118,43 @@ fsl_rio_port_write_handler(int irq, void *dev_instance) | |||
1117 | RIO_PW_MSG_SIZE); | 1118 | RIO_PW_MSG_SIZE); |
1118 | } else { | 1119 | } else { |
1119 | priv->port_write_msg.discard_count++; | 1120 | priv->port_write_msg.discard_count++; |
1120 | pr_info("RIO: ISR Discarded Port-Write Msg(s) (%d)\n", | 1121 | pr_debug("RIO: ISR Discarded Port-Write Msg(s) (%d)\n", |
1121 | priv->port_write_msg.discard_count); | 1122 | priv->port_write_msg.discard_count); |
1122 | } | 1123 | } |
1124 | /* Clear interrupt and issue Clear Queue command. This allows | ||
1125 | * another port-write to be received. | ||
1126 | */ | ||
1127 | out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_QFI); | ||
1128 | out_be32(&priv->msg_regs->pwmr, ipwmr | RIO_IPWMR_CQ); | ||
1129 | |||
1123 | schedule_work(&priv->pw_work); | 1130 | schedule_work(&priv->pw_work); |
1124 | } | 1131 | } |
1125 | 1132 | ||
1126 | /* Issue Clear Queue command. This allows another | 1133 | if ((ipwmr & RIO_IPWMR_EIE) && (ipwsr & RIO_IPWSR_TE)) { |
1127 | * port-write to be received. | 1134 | priv->port_write_msg.err_count++; |
1128 | */ | 1135 | pr_debug("RIO: Port-Write Transaction Err (%d)\n", |
1129 | out_be32(&priv->msg_regs->pwmr, ipwmr | RIO_IPWMR_CQ); | 1136 | priv->port_write_msg.err_count); |
1137 | /* Clear Transaction Error: port-write controller should be | ||
1138 | * disabled when clearing this error | ||
1139 | */ | ||
1140 | out_be32(&priv->msg_regs->pwmr, ipwmr & ~RIO_IPWMR_PWE); | ||
1141 | out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_TE); | ||
1142 | out_be32(&priv->msg_regs->pwmr, ipwmr); | ||
1143 | } | ||
1144 | |||
1145 | if (ipwsr & RIO_IPWSR_PWD) { | ||
1146 | priv->port_write_msg.discard_count++; | ||
1147 | pr_debug("RIO: Port Discarded Port-Write Msg(s) (%d)\n", | ||
1148 | priv->port_write_msg.discard_count); | ||
1149 | out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_PWD); | ||
1150 | } | ||
1151 | |||
1152 | pw_done: | ||
1153 | if (epwisr & RIO_EPWISR_PINT) { | ||
1154 | tmp = in_be32(priv->regs_win + RIO_LTLEDCSR); | ||
1155 | pr_debug("RIO_LTLEDCSR = 0x%x\n", tmp); | ||
1156 | out_be32(priv->regs_win + RIO_LTLEDCSR, 0); | ||
1157 | } | ||
1130 | 1158 | ||
1131 | return IRQ_HANDLED; | 1159 | return IRQ_HANDLED; |
1132 | } | 1160 | } |
@@ -1332,7 +1360,7 @@ static inline void fsl_rio_info(struct device *dev, u32 ccsr) | |||
1332 | 1360 | ||
1333 | /** | 1361 | /** |
1334 | * fsl_rio_setup - Setup Freescale PowerPC RapidIO interface | 1362 | * fsl_rio_setup - Setup Freescale PowerPC RapidIO interface |
1335 | * @dev: of_device pointer | 1363 | * @dev: platform_device pointer |
1336 | * | 1364 | * |
1337 | * Initializes MPC85xx RapidIO hardware interface, configures | 1365 | * Initializes MPC85xx RapidIO hardware interface, configures |
1338 | * master port with system-specific info, and registers the | 1366 | * master port with system-specific info, and registers the |
@@ -1444,6 +1472,7 @@ int fsl_rio_setup(struct platform_device *dev) | |||
1444 | port->host_deviceid = fsl_rio_get_hdid(port->id); | 1472 | port->host_deviceid = fsl_rio_get_hdid(port->id); |
1445 | 1473 | ||
1446 | port->priv = priv; | 1474 | port->priv = priv; |
1475 | port->phys_efptr = 0x100; | ||
1447 | rio_register_mport(port); | 1476 | rio_register_mport(port); |
1448 | 1477 | ||
1449 | priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1); | 1478 | priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1); |
@@ -1491,6 +1520,12 @@ int fsl_rio_setup(struct platform_device *dev) | |||
1491 | dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n", | 1520 | dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n", |
1492 | port->sys_size ? 65536 : 256); | 1521 | port->sys_size ? 65536 : 256); |
1493 | 1522 | ||
1523 | if (port->host_deviceid >= 0) | ||
1524 | out_be32(priv->regs_win + RIO_GCCSR, RIO_PORT_GEN_HOST | | ||
1525 | RIO_PORT_GEN_MASTER | RIO_PORT_GEN_DISCOVERED); | ||
1526 | else | ||
1527 | out_be32(priv->regs_win + RIO_GCCSR, 0x00000000); | ||
1528 | |||
1494 | priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win | 1529 | priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win |
1495 | + RIO_ATMU_REGS_OFFSET); | 1530 | + RIO_ATMU_REGS_OFFSET); |
1496 | priv->maint_atmu_regs = priv->atmu_regs + 1; | 1531 | priv->maint_atmu_regs = priv->atmu_regs + 1; |
@@ -1517,8 +1552,10 @@ int fsl_rio_setup(struct platform_device *dev) | |||
1517 | fsl_rio_doorbell_init(port); | 1552 | fsl_rio_doorbell_init(port); |
1518 | fsl_rio_port_write_init(port); | 1553 | fsl_rio_port_write_init(port); |
1519 | 1554 | ||
1555 | #ifdef CONFIG_E500 | ||
1520 | saved_mcheck_exception = ppc_md.machine_check_exception; | 1556 | saved_mcheck_exception = ppc_md.machine_check_exception; |
1521 | ppc_md.machine_check_exception = fsl_rio_mcheck_exception; | 1557 | ppc_md.machine_check_exception = fsl_rio_mcheck_exception; |
1558 | #endif | ||
1522 | /* Ensure that RFXE is set */ | 1559 | /* Ensure that RFXE is set */ |
1523 | mtspr(SPRN_HID1, (mfspr(SPRN_HID1) | 0x20000)); | 1560 | mtspr(SPRN_HID1, (mfspr(SPRN_HID1) | 0x20000)); |
1524 | 1561 | ||
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index b91f7acdda6f..19e5015e039b 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -209,186 +209,29 @@ static int __init of_add_fixed_phys(void) | |||
209 | arch_initcall(of_add_fixed_phys); | 209 | arch_initcall(of_add_fixed_phys); |
210 | #endif /* CONFIG_FIXED_PHY */ | 210 | #endif /* CONFIG_FIXED_PHY */ |
211 | 211 | ||
212 | static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type) | 212 | #if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx) |
213 | { | 213 | static __be32 __iomem *rstcr; |
214 | if (!phy_type) | ||
215 | return FSL_USB2_PHY_NONE; | ||
216 | if (!strcasecmp(phy_type, "ulpi")) | ||
217 | return FSL_USB2_PHY_ULPI; | ||
218 | if (!strcasecmp(phy_type, "utmi")) | ||
219 | return FSL_USB2_PHY_UTMI; | ||
220 | if (!strcasecmp(phy_type, "utmi_wide")) | ||
221 | return FSL_USB2_PHY_UTMI_WIDE; | ||
222 | if (!strcasecmp(phy_type, "serial")) | ||
223 | return FSL_USB2_PHY_SERIAL; | ||
224 | |||
225 | return FSL_USB2_PHY_NONE; | ||
226 | } | ||
227 | 214 | ||
228 | static int __init fsl_usb_of_init(void) | 215 | static int __init setup_rstcr(void) |
229 | { | 216 | { |
230 | struct device_node *np; | 217 | struct device_node *np; |
231 | unsigned int i = 0; | ||
232 | struct platform_device *usb_dev_mph = NULL, *usb_dev_dr_host = NULL, | ||
233 | *usb_dev_dr_client = NULL; | ||
234 | int ret; | ||
235 | |||
236 | for_each_compatible_node(np, NULL, "fsl-usb2-mph") { | ||
237 | struct resource r[2]; | ||
238 | struct fsl_usb2_platform_data usb_data; | ||
239 | const unsigned char *prop = NULL; | ||
240 | |||
241 | memset(&r, 0, sizeof(r)); | ||
242 | memset(&usb_data, 0, sizeof(usb_data)); | ||
243 | |||
244 | ret = of_address_to_resource(np, 0, &r[0]); | ||
245 | if (ret) | ||
246 | goto err; | ||
247 | |||
248 | of_irq_to_resource(np, 0, &r[1]); | ||
249 | |||
250 | usb_dev_mph = | ||
251 | platform_device_register_simple("fsl-ehci", i, r, 2); | ||
252 | if (IS_ERR(usb_dev_mph)) { | ||
253 | ret = PTR_ERR(usb_dev_mph); | ||
254 | goto err; | ||
255 | } | ||
256 | |||
257 | usb_dev_mph->dev.coherent_dma_mask = 0xffffffffUL; | ||
258 | usb_dev_mph->dev.dma_mask = &usb_dev_mph->dev.coherent_dma_mask; | ||
259 | |||
260 | usb_data.operating_mode = FSL_USB2_MPH_HOST; | ||
261 | |||
262 | prop = of_get_property(np, "port0", NULL); | ||
263 | if (prop) | ||
264 | usb_data.port_enables |= FSL_USB2_PORT0_ENABLED; | ||
265 | |||
266 | prop = of_get_property(np, "port1", NULL); | ||
267 | if (prop) | ||
268 | usb_data.port_enables |= FSL_USB2_PORT1_ENABLED; | ||
269 | |||
270 | prop = of_get_property(np, "phy_type", NULL); | ||
271 | usb_data.phy_mode = determine_usb_phy(prop); | ||
272 | |||
273 | ret = | ||
274 | platform_device_add_data(usb_dev_mph, &usb_data, | ||
275 | sizeof(struct | ||
276 | fsl_usb2_platform_data)); | ||
277 | if (ret) | ||
278 | goto unreg_mph; | ||
279 | i++; | ||
280 | } | ||
281 | |||
282 | for_each_compatible_node(np, NULL, "fsl-usb2-dr") { | ||
283 | struct resource r[2]; | ||
284 | struct fsl_usb2_platform_data usb_data; | ||
285 | const unsigned char *prop = NULL; | ||
286 | 218 | ||
287 | if (!of_device_is_available(np)) | 219 | for_each_node_by_name(np, "global-utilities") { |
288 | continue; | 220 | if ((of_get_property(np, "fsl,has-rstcr", NULL))) { |
289 | 221 | rstcr = of_iomap(np, 0) + 0xb0; | |
290 | memset(&r, 0, sizeof(r)); | 222 | if (!rstcr) |
291 | memset(&usb_data, 0, sizeof(usb_data)); | 223 | printk (KERN_ERR "Error: reset control " |
292 | 224 | "register not mapped!\n"); | |
293 | ret = of_address_to_resource(np, 0, &r[0]); | 225 | break; |
294 | if (ret) | ||
295 | goto unreg_mph; | ||
296 | |||
297 | of_irq_to_resource(np, 0, &r[1]); | ||
298 | |||
299 | prop = of_get_property(np, "dr_mode", NULL); | ||
300 | |||
301 | if (!prop || !strcmp(prop, "host")) { | ||
302 | usb_data.operating_mode = FSL_USB2_DR_HOST; | ||
303 | usb_dev_dr_host = platform_device_register_simple( | ||
304 | "fsl-ehci", i, r, 2); | ||
305 | if (IS_ERR(usb_dev_dr_host)) { | ||
306 | ret = PTR_ERR(usb_dev_dr_host); | ||
307 | goto err; | ||
308 | } | ||
309 | } else if (prop && !strcmp(prop, "peripheral")) { | ||
310 | usb_data.operating_mode = FSL_USB2_DR_DEVICE; | ||
311 | usb_dev_dr_client = platform_device_register_simple( | ||
312 | "fsl-usb2-udc", i, r, 2); | ||
313 | if (IS_ERR(usb_dev_dr_client)) { | ||
314 | ret = PTR_ERR(usb_dev_dr_client); | ||
315 | goto err; | ||
316 | } | ||
317 | } else if (prop && !strcmp(prop, "otg")) { | ||
318 | usb_data.operating_mode = FSL_USB2_DR_OTG; | ||
319 | usb_dev_dr_host = platform_device_register_simple( | ||
320 | "fsl-ehci", i, r, 2); | ||
321 | if (IS_ERR(usb_dev_dr_host)) { | ||
322 | ret = PTR_ERR(usb_dev_dr_host); | ||
323 | goto err; | ||
324 | } | ||
325 | usb_dev_dr_client = platform_device_register_simple( | ||
326 | "fsl-usb2-udc", i, r, 2); | ||
327 | if (IS_ERR(usb_dev_dr_client)) { | ||
328 | ret = PTR_ERR(usb_dev_dr_client); | ||
329 | goto err; | ||
330 | } | ||
331 | } else { | ||
332 | ret = -EINVAL; | ||
333 | goto err; | ||
334 | } | 226 | } |
335 | |||
336 | prop = of_get_property(np, "phy_type", NULL); | ||
337 | usb_data.phy_mode = determine_usb_phy(prop); | ||
338 | |||
339 | if (usb_dev_dr_host) { | ||
340 | usb_dev_dr_host->dev.coherent_dma_mask = 0xffffffffUL; | ||
341 | usb_dev_dr_host->dev.dma_mask = &usb_dev_dr_host-> | ||
342 | dev.coherent_dma_mask; | ||
343 | if ((ret = platform_device_add_data(usb_dev_dr_host, | ||
344 | &usb_data, sizeof(struct | ||
345 | fsl_usb2_platform_data)))) | ||
346 | goto unreg_dr; | ||
347 | } | ||
348 | if (usb_dev_dr_client) { | ||
349 | usb_dev_dr_client->dev.coherent_dma_mask = 0xffffffffUL; | ||
350 | usb_dev_dr_client->dev.dma_mask = &usb_dev_dr_client-> | ||
351 | dev.coherent_dma_mask; | ||
352 | if ((ret = platform_device_add_data(usb_dev_dr_client, | ||
353 | &usb_data, sizeof(struct | ||
354 | fsl_usb2_platform_data)))) | ||
355 | goto unreg_dr; | ||
356 | } | ||
357 | i++; | ||
358 | } | 227 | } |
359 | return 0; | ||
360 | |||
361 | unreg_dr: | ||
362 | if (usb_dev_dr_host) | ||
363 | platform_device_unregister(usb_dev_dr_host); | ||
364 | if (usb_dev_dr_client) | ||
365 | platform_device_unregister(usb_dev_dr_client); | ||
366 | unreg_mph: | ||
367 | if (usb_dev_mph) | ||
368 | platform_device_unregister(usb_dev_mph); | ||
369 | err: | ||
370 | return ret; | ||
371 | } | ||
372 | |||
373 | arch_initcall(fsl_usb_of_init); | ||
374 | |||
375 | #if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx) | ||
376 | static __be32 __iomem *rstcr; | ||
377 | 228 | ||
378 | static int __init setup_rstcr(void) | 229 | if (!rstcr && ppc_md.restart == fsl_rstcr_restart) |
379 | { | ||
380 | struct device_node *np; | ||
381 | np = of_find_node_by_name(NULL, "global-utilities"); | ||
382 | if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) { | ||
383 | rstcr = of_iomap(np, 0) + 0xb0; | ||
384 | if (!rstcr) | ||
385 | printk (KERN_EMERG "Error: reset control register " | ||
386 | "not mapped!\n"); | ||
387 | } else if (ppc_md.restart == fsl_rstcr_restart) | ||
388 | printk(KERN_ERR "No RSTCR register, warm reboot won't work\n"); | 230 | printk(KERN_ERR "No RSTCR register, warm reboot won't work\n"); |
389 | 231 | ||
390 | if (np) | 232 | if (np) |
391 | of_node_put(np); | 233 | of_node_put(np); |
234 | |||
392 | return 0; | 235 | return 0; |
393 | } | 236 | } |
394 | 237 | ||
diff --git a/arch/powerpc/sysdev/mpc8xxx_gpio.c b/arch/powerpc/sysdev/mpc8xxx_gpio.c index 36499394a161..c48cd8178079 100644 --- a/arch/powerpc/sysdev/mpc8xxx_gpio.c +++ b/arch/powerpc/sysdev/mpc8xxx_gpio.c | |||
@@ -389,6 +389,9 @@ static int __init mpc8xxx_add_gpiochips(void) | |||
389 | for_each_matching_node(np, mpc8xxx_gpio_ids) | 389 | for_each_matching_node(np, mpc8xxx_gpio_ids) |
390 | mpc8xxx_add_controller(np); | 390 | mpc8xxx_add_controller(np); |
391 | 391 | ||
392 | for_each_compatible_node(np, NULL, "fsl,qoriq-gpio") | ||
393 | mpc8xxx_add_controller(np); | ||
394 | |||
392 | return 0; | 395 | return 0; |
393 | } | 396 | } |
394 | arch_initcall(mpc8xxx_add_gpiochips); | 397 | arch_initcall(mpc8xxx_add_gpiochips); |
diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c index 3b6a9a43718f..320ad5a9a25d 100644 --- a/arch/powerpc/sysdev/mpic_pasemi_msi.c +++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c | |||
@@ -39,24 +39,24 @@ | |||
39 | static struct mpic *msi_mpic; | 39 | static struct mpic *msi_mpic; |
40 | 40 | ||
41 | 41 | ||
42 | static void mpic_pasemi_msi_mask_irq(unsigned int irq) | 42 | static void mpic_pasemi_msi_mask_irq(struct irq_data *data) |
43 | { | 43 | { |
44 | pr_debug("mpic_pasemi_msi_mask_irq %d\n", irq); | 44 | pr_debug("mpic_pasemi_msi_mask_irq %d\n", data->irq); |
45 | mask_msi_irq(irq); | 45 | mask_msi_irq(data); |
46 | mpic_mask_irq(irq); | 46 | mpic_mask_irq(data->irq); |
47 | } | 47 | } |
48 | 48 | ||
49 | static void mpic_pasemi_msi_unmask_irq(unsigned int irq) | 49 | static void mpic_pasemi_msi_unmask_irq(struct irq_data *data) |
50 | { | 50 | { |
51 | pr_debug("mpic_pasemi_msi_unmask_irq %d\n", irq); | 51 | pr_debug("mpic_pasemi_msi_unmask_irq %d\n", data->irq); |
52 | mpic_unmask_irq(irq); | 52 | mpic_unmask_irq(data->irq); |
53 | unmask_msi_irq(irq); | 53 | unmask_msi_irq(data); |
54 | } | 54 | } |
55 | 55 | ||
56 | static struct irq_chip mpic_pasemi_msi_chip = { | 56 | static struct irq_chip mpic_pasemi_msi_chip = { |
57 | .shutdown = mpic_pasemi_msi_mask_irq, | 57 | .irq_shutdown = mpic_pasemi_msi_mask_irq, |
58 | .mask = mpic_pasemi_msi_mask_irq, | 58 | .irq_mask = mpic_pasemi_msi_mask_irq, |
59 | .unmask = mpic_pasemi_msi_unmask_irq, | 59 | .irq_unmask = mpic_pasemi_msi_unmask_irq, |
60 | .eoi = mpic_end_irq, | 60 | .eoi = mpic_end_irq, |
61 | .set_type = mpic_set_irq_type, | 61 | .set_type = mpic_set_irq_type, |
62 | .set_affinity = mpic_set_affinity, | 62 | .set_affinity = mpic_set_affinity, |
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c index bcbfe79c704b..a2b028b4a202 100644 --- a/arch/powerpc/sysdev/mpic_u3msi.c +++ b/arch/powerpc/sysdev/mpic_u3msi.c | |||
@@ -23,22 +23,22 @@ | |||
23 | /* A bit ugly, can we get this from the pci_dev somehow? */ | 23 | /* A bit ugly, can we get this from the pci_dev somehow? */ |
24 | static struct mpic *msi_mpic; | 24 | static struct mpic *msi_mpic; |
25 | 25 | ||
26 | static void mpic_u3msi_mask_irq(unsigned int irq) | 26 | static void mpic_u3msi_mask_irq(struct irq_data *data) |
27 | { | 27 | { |
28 | mask_msi_irq(irq); | 28 | mask_msi_irq(data); |
29 | mpic_mask_irq(irq); | 29 | mpic_mask_irq(data->irq); |
30 | } | 30 | } |
31 | 31 | ||
32 | static void mpic_u3msi_unmask_irq(unsigned int irq) | 32 | static void mpic_u3msi_unmask_irq(struct irq_data *data) |
33 | { | 33 | { |
34 | mpic_unmask_irq(irq); | 34 | mpic_unmask_irq(data->irq); |
35 | unmask_msi_irq(irq); | 35 | unmask_msi_irq(data); |
36 | } | 36 | } |
37 | 37 | ||
38 | static struct irq_chip mpic_u3msi_chip = { | 38 | static struct irq_chip mpic_u3msi_chip = { |
39 | .shutdown = mpic_u3msi_mask_irq, | 39 | .irq_shutdown = mpic_u3msi_mask_irq, |
40 | .mask = mpic_u3msi_mask_irq, | 40 | .irq_mask = mpic_u3msi_mask_irq, |
41 | .unmask = mpic_u3msi_unmask_irq, | 41 | .irq_unmask = mpic_u3msi_unmask_irq, |
42 | .eoi = mpic_end_irq, | 42 | .eoi = mpic_end_irq, |
43 | .set_type = mpic_set_irq_type, | 43 | .set_type = mpic_set_irq_type, |
44 | .set_affinity = mpic_set_affinity, | 44 | .set_affinity = mpic_set_affinity, |
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c index 24a0bb955b18..4260f368db52 100644 --- a/arch/powerpc/sysdev/pmi.c +++ b/arch/powerpc/sysdev/pmi.c | |||
@@ -114,7 +114,7 @@ static void pmi_notify_handlers(struct work_struct *work) | |||
114 | 114 | ||
115 | spin_lock(&data->handler_spinlock); | 115 | spin_lock(&data->handler_spinlock); |
116 | list_for_each_entry(handler, &data->handler, node) { | 116 | list_for_each_entry(handler, &data->handler, node) { |
117 | pr_debug(KERN_INFO "pmi: notifying handler %p\n", handler); | 117 | pr_debug("pmi: notifying handler %p\n", handler); |
118 | if (handler->type == data->msg.type) | 118 | if (handler->type == data->msg.type) |
119 | handler->handle_pmi_message(data->msg); | 119 | handler->handle_pmi_message(data->msg); |
120 | } | 120 | } |
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 3da8014931c9..90020de4dcf2 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -640,6 +640,7 @@ unsigned int qe_get_num_of_snums(void) | |||
640 | if ((num_of_snums < 28) || (num_of_snums > QE_NUM_OF_SNUM)) { | 640 | if ((num_of_snums < 28) || (num_of_snums > QE_NUM_OF_SNUM)) { |
641 | /* No QE ever has fewer than 28 SNUMs */ | 641 | /* No QE ever has fewer than 28 SNUMs */ |
642 | pr_err("QE: number of snum is invalid\n"); | 642 | pr_err("QE: number of snum is invalid\n"); |
643 | of_node_put(qe); | ||
643 | return -EINVAL; | 644 | return -EINVAL; |
644 | } | 645 | } |
645 | } | 646 | } |