aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel
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/microblaze/kernel
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/microblaze/kernel')
-rw-r--r--arch/microblaze/kernel/dma.c30
-rw-r--r--arch/microblaze/kernel/head.S2
-rw-r--r--arch/microblaze/kernel/setup.c34
3 files changed, 5 insertions, 61 deletions
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);