Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+9 -144
+1
arch/microblaze/configs/mmu_defconfig
··· 49 49 CONFIG_SERIAL_8250_CONSOLE=y 50 50 CONFIG_SERIAL_UARTLITE=y 51 51 CONFIG_SERIAL_UARTLITE_CONSOLE=y 52 + CONFIG_SERIAL_OF_PLATFORM=y 52 53 # CONFIG_HW_RANDOM is not set 53 54 CONFIG_XILINX_HWICAP=y 54 55 CONFIG_I2C=y
+1
arch/microblaze/configs/nommu_defconfig
··· 58 58 CONFIG_SERIAL_8250_CONSOLE=y 59 59 CONFIG_SERIAL_UARTLITE=y 60 60 CONFIG_SERIAL_UARTLITE_CONSOLE=y 61 + CONFIG_SERIAL_OF_PLATFORM=y 61 62 # CONFIG_HW_RANDOM is not set 62 63 CONFIG_XILINX_HWICAP=y 63 64 CONFIG_I2C=y
+1
arch/microblaze/include/asm/Kbuild
··· 2 2 generic-y += barrier.h 3 3 generic-y += clkdev.h 4 4 generic-y += cputime.h 5 + generic-y += device.h 5 6 generic-y += exec.h 6 7 generic-y += hash.h 7 8 generic-y += mcs_spinlock.h
-26
arch/microblaze/include/asm/device.h
··· 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 - 12 - struct device_node; 13 - 14 - struct dev_archdata { 15 - /* DMA operations on that device */ 16 - struct dma_map_ops *dma_ops; 17 - void *dma_data; 18 - }; 19 - 20 - struct pdev_archdata { 21 - u64 dma_mask; 22 - }; 23 - 24 - #endif /* _ASM_MICROBLAZE_DEVICE_H */ 25 - 26 -
+1 -24
arch/microblaze/include/asm/dma-mapping.h
··· 35 35 #define __dma_alloc_coherent(dev, gfp, size, handle) NULL 36 36 #define __dma_free_coherent(size, addr) ((void)0) 37 37 38 - static 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 - 46 - extern struct dma_map_ops *dma_ops; 47 - 48 38 /* 49 39 * Available generic sets of operations 50 40 */ ··· 42 52 43 53 static inline struct dma_map_ops *get_dma_ops(struct device *dev) 44 54 { 45 - /* We don't handle the NULL dev case for ISA for now. We could 46 - * do it via an out of line call but it is not needed for now. The 47 - * only ISA DMA device we support is the floppy and we have a hack 48 - * in the floppy driver directly to get a device for us. 49 - */ 50 - if (unlikely(!dev) || !dev->archdata.dma_ops) 51 - return NULL; 52 - 53 - return dev->archdata.dma_ops; 54 - } 55 - 56 - static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) 57 - { 58 - dev->archdata.dma_ops = ops; 55 + return &dma_direct_ops; 59 56 } 60 57 61 58 static inline int dma_supported(struct device *dev, u64 mask)
-3
arch/microblaze/include/asm/io.h
··· 19 19 #ifndef CONFIG_PCI 20 20 #define _IO_BASE 0 21 21 #define _ISA_MEM_BASE 0 22 - #define PCI_DRAM_OFFSET 0 23 22 #else 24 23 #define _IO_BASE isa_io_base 25 24 #define _ISA_MEM_BASE isa_mem_base 26 - #define PCI_DRAM_OFFSET pci_dram_offset 27 25 struct pci_dev; 28 26 extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 29 27 #define pci_iounmap pci_iounmap 30 28 31 29 extern unsigned long isa_io_base; 32 - extern unsigned long pci_dram_offset; 33 30 extern resource_size_t isa_mem_base; 34 31 #endif 35 32
-8
arch/microblaze/include/asm/pci.h
··· 45 45 #define pcibios_assign_all_busses() 0 46 46 47 47 #ifdef CONFIG_PCI 48 - extern void set_pci_dma_ops(struct dma_map_ops *dma_ops); 49 - extern 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 56 48 static inline void pci_dma_burst_advice(struct pci_dev *pdev, 57 49 enum pci_dma_burst_strategy *strat, 58 50 unsigned long *strategy_parameter)
+3 -27
arch/microblaze/kernel/dma.c
··· 13 13 #include <linux/export.h> 14 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 - 25 - static 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 16 #define NOT_COHERENT_CACHE 34 17 35 18 static void *dma_direct_alloc_coherent(struct device *dev, size_t size, ··· 34 51 return NULL; 35 52 ret = page_address(page); 36 53 memset(ret, 0, size); 37 - *dma_handle = virt_to_phys(ret) + get_dma_direct_offset(dev); 54 + *dma_handle = virt_to_phys(ret); 38 55 39 56 return ret; 40 57 #endif ··· 60 77 61 78 /* FIXME this part of code is untested */ 62 79 for_each_sg(sgl, sg, nents, i) { 63 - sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev); 80 + sg->dma_address = sg_phys(sg); 64 81 __dma_sync(page_to_phys(sg_page(sg)) + sg->offset, 65 82 sg->length, direction); 66 83 } 67 84 68 85 return nents; 69 - } 70 - 71 - static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg, 72 - int nents, enum dma_data_direction direction, 73 - struct dma_attrs *attrs) 74 - { 75 86 } 76 87 77 88 static int dma_direct_dma_supported(struct device *dev, u64 mask) ··· 81 104 struct dma_attrs *attrs) 82 105 { 83 106 __dma_sync(page_to_phys(page) + offset, size, direction); 84 - return page_to_phys(page) + offset + get_dma_direct_offset(dev); 107 + return page_to_phys(page) + offset; 85 108 } 86 109 87 110 static inline void dma_direct_unmap_page(struct device *dev, ··· 158 181 .alloc = dma_direct_alloc_coherent, 159 182 .free = dma_direct_free_coherent, 160 183 .map_sg = dma_direct_map_sg, 161 - .unmap_sg = dma_direct_unmap_sg, 162 184 .dma_supported = dma_direct_dma_supported, 163 185 .map_page = dma_direct_map_page, 164 186 .unmap_page = dma_direct_unmap_page,
+1 -1
arch/microblaze/kernel/head.S
··· 205 205 GT16: /* TLB0 is 16MB */ 206 206 addik r9, r0, 0x1000000 /* means TLB0 is 16MB */ 207 207 TLB1: 208 - /* must be used r2 because of substract if failed */ 208 + /* must be used r2 because of subtract if failed */ 209 209 addik r2, r11, -0x0400000 210 210 bgei r2, GT20 /* size is greater than 16MB */ 211 211 /* size is >16MB and <20MB */
+1 -33
arch/microblaze/kernel/setup.c
··· 71 71 72 72 xilinx_pci_init(); 73 73 74 - #ifdef CONFIG_VT 75 - #if defined(CONFIG_XILINX_CONSOLE) 76 - conswitchp = &xil_con; 77 - #elif defined(CONFIG_DUMMY_CONSOLE) 74 + #if defined(CONFIG_DUMMY_CONSOLE) 78 75 conswitchp = &dummy_con; 79 - #endif 80 76 #endif 81 77 } 82 78 ··· 225 229 device_initcall(debugfs_tlb); 226 230 # endif 227 231 #endif 228 - 229 - static int dflt_bus_notify(struct notifier_block *nb, 230 - unsigned long action, void *data) 231 - { 232 - struct device *dev = data; 233 - 234 - /* We are only intereted in device addition */ 235 - if (action != BUS_NOTIFY_ADD_DEVICE) 236 - return 0; 237 - 238 - set_dma_ops(dev, &dma_direct_ops); 239 - 240 - return NOTIFY_DONE; 241 - } 242 - 243 - static struct notifier_block dflt_plat_bus_notifier = { 244 - .notifier_call = dflt_bus_notify, 245 - .priority = INT_MAX, 246 - }; 247 - 248 - static int __init setup_bus_notifier(void) 249 - { 250 - bus_register_notifier(&platform_bus_type, &dflt_plat_bus_notifier); 251 - 252 - return 0; 253 - } 254 - 255 - arch_initcall(setup_bus_notifier);
-19
arch/microblaze/pci/pci-common.c
··· 47 47 /* ISA Memory physical address */ 48 48 resource_size_t isa_mem_base; 49 49 50 - static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; 51 - 52 50 unsigned long isa_io_base; 53 - unsigned long pci_dram_offset; 54 51 static int pci_bus_count; 55 - 56 - 57 - void set_pci_dma_ops(struct dma_map_ops *dma_ops) 58 - { 59 - pci_dma_ops = dma_ops; 60 - } 61 - 62 - struct dma_map_ops *get_pci_dma_ops(void) 63 - { 64 - return pci_dma_ops; 65 - } 66 - EXPORT_SYMBOL(get_pci_dma_ops); 67 52 68 53 struct pci_controller *pcibios_alloc_controller(struct device_node *dev) 69 54 { ··· 850 865 * code and is needed by the DMA init 851 866 */ 852 867 set_dev_node(&dev->dev, pcibus_to_node(dev->bus)); 853 - 854 - /* Hook up default DMA ops */ 855 - set_dma_ops(&dev->dev, pci_dma_ops); 856 - dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET; 857 868 858 869 /* Read default IRQs and fixup if necessary */ 859 870 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
-3
drivers/of/platform.c
··· 138 138 } 139 139 140 140 dev->dev.of_node = of_node_get(np); 141 - #if defined(CONFIG_MICROBLAZE) 142 - dev->dev.dma_mask = &dev->archdata.dma_mask; 143 - #endif 144 141 dev->dev.parent = parent; 145 142 146 143 if (bus_id)