aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-05 19:15:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-05 19:15:33 -0400
commit2b03adc1911d1c84cb7fad8b424234f589547cb3 (patch)
treeca817632d166046bbfe917894afd99c698d47627 /arch
parenteb3d3ec567e868c8a3bfbfdfc9465ffd52983d11 (diff)
parent225fba216261b0e24273f5f4eee504e3c7bd0255 (diff)
Merge tag 'microblaze-3.16-rc1' of git://git.monstr.eu/linux-2.6-microblaze into next
Pull Microblaze updates from Michal Simek: - cleanup PCI and DMA handling - use generic device.h - some cleanups * tag 'microblaze-3.16-rc1' of git://git.monstr.eu/linux-2.6-microblaze: microblaze: Fix typo in head.S s/substract/subtract/ microblaze: remove check for CONFIG_XILINX_CONSOLE microblaze: Use generic device.h microblaze: Do not setup empty unmap_sg function microblaze: Remove device_to_mask microblaze: Clean device dma_ops structure microblaze: Cleanup PCI_DRAM_OFFSET handling microblaze: Do not setup pci_dma_ops microblaze: Return default dma operations microblaze: Enable SERIAL_OF_PLATFORM
Diffstat (limited to 'arch')
-rw-r--r--arch/microblaze/configs/mmu_defconfig1
-rw-r--r--arch/microblaze/configs/nommu_defconfig1
-rw-r--r--arch/microblaze/include/asm/Kbuild1
-rw-r--r--arch/microblaze/include/asm/device.h26
-rw-r--r--arch/microblaze/include/asm/dma-mapping.h25
-rw-r--r--arch/microblaze/include/asm/io.h3
-rw-r--r--arch/microblaze/include/asm/pci.h8
-rw-r--r--arch/microblaze/kernel/dma.c30
-rw-r--r--arch/microblaze/kernel/head.S2
-rw-r--r--arch/microblaze/kernel/setup.c34
-rw-r--r--arch/microblaze/pci/pci-common.c19
11 files changed, 9 insertions, 141 deletions
diff --git a/arch/microblaze/configs/mmu_defconfig b/arch/microblaze/configs/mmu_defconfig
index deaf45ab6429..e2f6543b91e7 100644
--- a/arch/microblaze/configs/mmu_defconfig
+++ b/arch/microblaze/configs/mmu_defconfig
@@ -49,6 +49,7 @@ CONFIG_SERIAL_8250=y
49CONFIG_SERIAL_8250_CONSOLE=y 49CONFIG_SERIAL_8250_CONSOLE=y
50CONFIG_SERIAL_UARTLITE=y 50CONFIG_SERIAL_UARTLITE=y
51CONFIG_SERIAL_UARTLITE_CONSOLE=y 51CONFIG_SERIAL_UARTLITE_CONSOLE=y
52CONFIG_SERIAL_OF_PLATFORM=y
52# CONFIG_HW_RANDOM is not set 53# CONFIG_HW_RANDOM is not set
53CONFIG_XILINX_HWICAP=y 54CONFIG_XILINX_HWICAP=y
54CONFIG_I2C=y 55CONFIG_I2C=y
diff --git a/arch/microblaze/configs/nommu_defconfig b/arch/microblaze/configs/nommu_defconfig
index 10b5172283d7..a29ebd4a9fcb 100644
--- a/arch/microblaze/configs/nommu_defconfig
+++ b/arch/microblaze/configs/nommu_defconfig
@@ -58,6 +58,7 @@ CONFIG_SERIAL_8250=y
58CONFIG_SERIAL_8250_CONSOLE=y 58CONFIG_SERIAL_8250_CONSOLE=y
59CONFIG_SERIAL_UARTLITE=y 59CONFIG_SERIAL_UARTLITE=y
60CONFIG_SERIAL_UARTLITE_CONSOLE=y 60CONFIG_SERIAL_UARTLITE_CONSOLE=y
61CONFIG_SERIAL_OF_PLATFORM=y
61# CONFIG_HW_RANDOM is not set 62# CONFIG_HW_RANDOM is not set
62CONFIG_XILINX_HWICAP=y 63CONFIG_XILINX_HWICAP=y
63CONFIG_I2C=y 64CONFIG_I2C=y
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index c98ed95c0541..35b3ecaf25d5 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -2,6 +2,7 @@
2generic-y += barrier.h 2generic-y += barrier.h
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += cputime.h 4generic-y += cputime.h
5generic-y += device.h
5generic-y += exec.h 6generic-y += exec.h
6generic-y += hash.h 7generic-y += hash.h
7generic-y += mcs_spinlock.h 8generic-y += mcs_spinlock.h
diff --git a/arch/microblaze/include/asm/device.h b/arch/microblaze/include/asm/device.h
deleted file mode 100644
index 123b2fe72d01..000000000000
--- a/arch/microblaze/include/asm/device.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License v2. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8
9#ifndef _ASM_MICROBLAZE_DEVICE_H
10#define _ASM_MICROBLAZE_DEVICE_H
11
12struct device_node;
13
14struct dev_archdata {
15 /* DMA operations on that device */
16 struct dma_map_ops *dma_ops;
17 void *dma_data;
18};
19
20struct pdev_archdata {
21 u64 dma_mask;
22};
23
24#endif /* _ASM_MICROBLAZE_DEVICE_H */
25
26
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
index 46460f1c49c4..ab353723076a 100644
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ b/arch/microblaze/include/asm/dma-mapping.h
@@ -35,16 +35,6 @@
35#define __dma_alloc_coherent(dev, gfp, size, handle) NULL 35#define __dma_alloc_coherent(dev, gfp, size, handle) NULL
36#define __dma_free_coherent(size, addr) ((void)0) 36#define __dma_free_coherent(size, addr) ((void)0)
37 37
38static inline unsigned long device_to_mask(struct device *dev)
39{
40 if (dev->dma_mask && *dev->dma_mask)
41 return *dev->dma_mask;
42 /* Assume devices without mask can take 32 bit addresses */
43 return 0xfffffffful;
44}
45
46extern struct dma_map_ops *dma_ops;
47
48/* 38/*
49 * Available generic sets of operations 39 * Available generic sets of operations
50 */ 40 */
@@ -52,20 +42,7 @@ extern struct dma_map_ops dma_direct_ops;
52 42
53static inline struct dma_map_ops *get_dma_ops(struct device *dev) 43static inline struct dma_map_ops *get_dma_ops(struct device *dev)
54{ 44{
55 /* We don't handle the NULL dev case for ISA for now. We could 45 return &dma_direct_ops;
56 * do it via an out of line call but it is not needed for now. The
57 * only ISA DMA device we support is the floppy and we have a hack
58 * in the floppy driver directly to get a device for us.
59 */
60 if (unlikely(!dev) || !dev->archdata.dma_ops)
61 return NULL;
62
63 return dev->archdata.dma_ops;
64}
65
66static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
67{
68 dev->archdata.dma_ops = ops;
69} 46}
70 47
71static inline int dma_supported(struct device *dev, u64 mask) 48static inline int dma_supported(struct device *dev, u64 mask)
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 1e4c3329f62e..433751b2a003 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -19,17 +19,14 @@
19#ifndef CONFIG_PCI 19#ifndef CONFIG_PCI
20#define _IO_BASE 0 20#define _IO_BASE 0
21#define _ISA_MEM_BASE 0 21#define _ISA_MEM_BASE 0
22#define PCI_DRAM_OFFSET 0
23#else 22#else
24#define _IO_BASE isa_io_base 23#define _IO_BASE isa_io_base
25#define _ISA_MEM_BASE isa_mem_base 24#define _ISA_MEM_BASE isa_mem_base
26#define PCI_DRAM_OFFSET pci_dram_offset
27struct pci_dev; 25struct pci_dev;
28extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 26extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
29#define pci_iounmap pci_iounmap 27#define pci_iounmap pci_iounmap
30 28
31extern unsigned long isa_io_base; 29extern unsigned long isa_io_base;
32extern unsigned long pci_dram_offset;
33extern resource_size_t isa_mem_base; 30extern resource_size_t isa_mem_base;
34#endif 31#endif
35 32
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index 335524040fff..468aca8cec0d 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -45,14 +45,6 @@ struct pci_dev;
45#define pcibios_assign_all_busses() 0 45#define pcibios_assign_all_busses() 0
46 46
47#ifdef CONFIG_PCI 47#ifdef CONFIG_PCI
48extern void set_pci_dma_ops(struct dma_map_ops *dma_ops);
49extern struct dma_map_ops *get_pci_dma_ops(void);
50#else /* CONFIG_PCI */
51#define set_pci_dma_ops(d)
52#define get_pci_dma_ops() NULL
53#endif
54
55#ifdef CONFIG_PCI
56static inline void pci_dma_burst_advice(struct pci_dev *pdev, 48static inline void pci_dma_burst_advice(struct pci_dev *pdev,
57 enum pci_dma_burst_strategy *strat, 49 enum pci_dma_burst_strategy *strat,
58 unsigned long *strategy_parameter) 50 unsigned long *strategy_parameter)
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index da68d00fd087..4633c36c1b32 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -13,23 +13,6 @@
13#include <linux/export.h> 13#include <linux/export.h>
14#include <linux/bug.h> 14#include <linux/bug.h>
15 15
16/*
17 * Generic direct DMA implementation
18 *
19 * This implementation supports a per-device offset that can be applied if
20 * the address at which memory is visible to devices is not 0. Platform code
21 * can set archdata.dma_data to an unsigned long holding the offset. By
22 * default the offset is PCI_DRAM_OFFSET.
23 */
24
25static unsigned long get_dma_direct_offset(struct device *dev)
26{
27 if (likely(dev))
28 return (unsigned long)dev->archdata.dma_data;
29
30 return PCI_DRAM_OFFSET; /* FIXME Not sure if is correct */
31}
32
33#define NOT_COHERENT_CACHE 16#define NOT_COHERENT_CACHE
34 17
35static void *dma_direct_alloc_coherent(struct device *dev, size_t size, 18static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
@@ -51,7 +34,7 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
51 return NULL; 34 return NULL;
52 ret = page_address(page); 35 ret = page_address(page);
53 memset(ret, 0, size); 36 memset(ret, 0, size);
54 *dma_handle = virt_to_phys(ret) + get_dma_direct_offset(dev); 37 *dma_handle = virt_to_phys(ret);
55 38
56 return ret; 39 return ret;
57#endif 40#endif
@@ -77,7 +60,7 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
77 60
78 /* FIXME this part of code is untested */ 61 /* FIXME this part of code is untested */
79 for_each_sg(sgl, sg, nents, i) { 62 for_each_sg(sgl, sg, nents, i) {
80 sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev); 63 sg->dma_address = sg_phys(sg);
81 __dma_sync(page_to_phys(sg_page(sg)) + sg->offset, 64 __dma_sync(page_to_phys(sg_page(sg)) + sg->offset,
82 sg->length, direction); 65 sg->length, direction);
83 } 66 }
@@ -85,12 +68,6 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
85 return nents; 68 return nents;
86} 69}
87 70
88static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
89 int nents, enum dma_data_direction direction,
90 struct dma_attrs *attrs)
91{
92}
93
94static int dma_direct_dma_supported(struct device *dev, u64 mask) 71static int dma_direct_dma_supported(struct device *dev, u64 mask)
95{ 72{
96 return 1; 73 return 1;
@@ -104,7 +81,7 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
104 struct dma_attrs *attrs) 81 struct dma_attrs *attrs)
105{ 82{
106 __dma_sync(page_to_phys(page) + offset, size, direction); 83 __dma_sync(page_to_phys(page) + offset, size, direction);
107 return page_to_phys(page) + offset + get_dma_direct_offset(dev); 84 return page_to_phys(page) + offset;
108} 85}
109 86
110static inline void dma_direct_unmap_page(struct device *dev, 87static inline void dma_direct_unmap_page(struct device *dev,
@@ -181,7 +158,6 @@ struct dma_map_ops dma_direct_ops = {
181 .alloc = dma_direct_alloc_coherent, 158 .alloc = dma_direct_alloc_coherent,
182 .free = dma_direct_free_coherent, 159 .free = dma_direct_free_coherent,
183 .map_sg = dma_direct_map_sg, 160 .map_sg = dma_direct_map_sg,
184 .unmap_sg = dma_direct_unmap_sg,
185 .dma_supported = dma_direct_dma_supported, 161 .dma_supported = dma_direct_dma_supported,
186 .map_page = dma_direct_map_page, 162 .map_page = dma_direct_map_page,
187 .unmap_page = dma_direct_unmap_page, 163 .unmap_page = dma_direct_unmap_page,
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index 17645b2e2f07..4655ff342c64 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -205,7 +205,7 @@ GT4: /* r11 contains the rest - will be either 1 or 4 */
205GT16: /* TLB0 is 16MB */ 205GT16: /* TLB0 is 16MB */
206 addik r9, r0, 0x1000000 /* means TLB0 is 16MB */ 206 addik r9, r0, 0x1000000 /* means TLB0 is 16MB */
207TLB1: 207TLB1:
208 /* must be used r2 because of substract if failed */ 208 /* must be used r2 because of subtract if failed */
209 addik r2, r11, -0x0400000 209 addik r2, r11, -0x0400000
210 bgei r2, GT20 /* size is greater than 16MB */ 210 bgei r2, GT20 /* size is greater than 16MB */
211 /* size is >16MB and <20MB */ 211 /* size is >16MB and <20MB */
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 67cc4b282cc1..ab5b488e1fde 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -71,13 +71,9 @@ void __init setup_arch(char **cmdline_p)
71 71
72 xilinx_pci_init(); 72 xilinx_pci_init();
73 73
74#ifdef CONFIG_VT 74#if defined(CONFIG_DUMMY_CONSOLE)
75#if defined(CONFIG_XILINX_CONSOLE)
76 conswitchp = &xil_con;
77#elif defined(CONFIG_DUMMY_CONSOLE)
78 conswitchp = &dummy_con; 75 conswitchp = &dummy_con;
79#endif 76#endif
80#endif
81} 77}
82 78
83#ifdef CONFIG_MTD_UCLINUX 79#ifdef CONFIG_MTD_UCLINUX
@@ -229,31 +225,3 @@ static int __init debugfs_tlb(void)
229device_initcall(debugfs_tlb); 225device_initcall(debugfs_tlb);
230# endif 226# endif
231#endif 227#endif
232
233static int dflt_bus_notify(struct notifier_block *nb,
234 unsigned long action, void *data)
235{
236 struct device *dev = data;
237
238 /* We are only intereted in device addition */
239 if (action != BUS_NOTIFY_ADD_DEVICE)
240 return 0;
241
242 set_dma_ops(dev, &dma_direct_ops);
243
244 return NOTIFY_DONE;
245}
246
247static struct notifier_block dflt_plat_bus_notifier = {
248 .notifier_call = dflt_bus_notify,
249 .priority = INT_MAX,
250};
251
252static int __init setup_bus_notifier(void)
253{
254 bus_register_notifier(&platform_bus_type, &dflt_plat_bus_notifier);
255
256 return 0;
257}
258
259arch_initcall(setup_bus_notifier);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index a59de1bc1ce0..9037914f6985 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -47,24 +47,9 @@ static int global_phb_number; /* Global phb counter */
47/* ISA Memory physical address */ 47/* ISA Memory physical address */
48resource_size_t isa_mem_base; 48resource_size_t isa_mem_base;
49 49
50static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
51
52unsigned long isa_io_base; 50unsigned long isa_io_base;
53unsigned long pci_dram_offset;
54static int pci_bus_count; 51static int pci_bus_count;
55 52
56
57void set_pci_dma_ops(struct dma_map_ops *dma_ops)
58{
59 pci_dma_ops = dma_ops;
60}
61
62struct dma_map_ops *get_pci_dma_ops(void)
63{
64 return pci_dma_ops;
65}
66EXPORT_SYMBOL(get_pci_dma_ops);
67
68struct pci_controller *pcibios_alloc_controller(struct device_node *dev) 53struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
69{ 54{
70 struct pci_controller *phb; 55 struct pci_controller *phb;
@@ -866,10 +851,6 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
866 */ 851 */
867 set_dev_node(&dev->dev, pcibus_to_node(dev->bus)); 852 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
868 853
869 /* Hook up default DMA ops */
870 set_dma_ops(&dev->dev, pci_dma_ops);
871 dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET;
872
873 /* Read default IRQs and fixup if necessary */ 854 /* Read default IRQs and fixup if necessary */
874 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); 855 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
875 } 856 }