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

[PATCH] arm-versatile iomem annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Al Viro and committed by
Linus Torvalds
399ad77b fc048b5b

+20 -20
+2 -2
arch/arm/mach-versatile/core.c
··· 188 188 .length = SZ_4K, 189 189 .type = MT_DEVICE 190 190 }, { 191 - .virtual = VERSATILE_PCI_VIRT_BASE, 191 + .virtual = (unsigned long)VERSATILE_PCI_VIRT_BASE, 192 192 .pfn = __phys_to_pfn(VERSATILE_PCI_BASE), 193 193 .length = VERSATILE_PCI_BASE_SIZE, 194 194 .type = MT_DEVICE 195 195 }, { 196 - .virtual = VERSATILE_PCI_CFG_VIRT_BASE, 196 + .virtual = (unsigned long)VERSATILE_PCI_CFG_VIRT_BASE, 197 197 .pfn = __phys_to_pfn(VERSATILE_PCI_CFG_BASE), 198 198 .length = VERSATILE_PCI_CFG_BASE_SIZE, 199 199 .type = MT_DEVICE
+16 -16
arch/arm/mach-versatile/pci.c
··· 40 40 * Cfg 42000000 - 42FFFFFF PCI config 41 41 * 42 42 */ 43 - #define SYS_PCICTL IO_ADDRESS(VERSATILE_SYS_PCICTL) 44 - #define PCI_IMAP0 IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x0) 45 - #define PCI_IMAP1 IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x4) 46 - #define PCI_IMAP2 IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x8) 47 - #define PCI_SMAP0 IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x10) 48 - #define PCI_SMAP1 IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x14) 49 - #define PCI_SMAP2 IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x18) 50 - #define PCI_SELFID IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0xc) 43 + #define __IO_ADDRESS(n) ((void __iomem *)(unsigned long)IO_ADDRESS(n)) 44 + #define SYS_PCICTL __IO_ADDRESS(VERSATILE_SYS_PCICTL) 45 + #define PCI_IMAP0 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x0) 46 + #define PCI_IMAP1 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x4) 47 + #define PCI_IMAP2 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x8) 48 + #define PCI_SMAP0 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x10) 49 + #define PCI_SMAP1 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x14) 50 + #define PCI_SMAP2 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x18) 51 + #define PCI_SELFID __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0xc) 51 52 52 53 #define DEVICE_ID_OFFSET 0x00 53 54 #define CSR_OFFSET 0x04 ··· 77 76 __setup("pci_slot_ignore=", versatile_pci_slot_ignore); 78 77 79 78 80 - static unsigned long __pci_addr(struct pci_bus *bus, 79 + static void __iomem *__pci_addr(struct pci_bus *bus, 81 80 unsigned int devfn, int offset) 82 81 { 83 82 unsigned int busnr = bus->number; ··· 92 91 if (devfn > 255) 93 92 BUG(); 94 93 95 - return (VERSATILE_PCI_CFG_VIRT_BASE | (busnr << 16) | 94 + return VERSATILE_PCI_CFG_VIRT_BASE + ((busnr << 16) | 96 95 (PCI_SLOT(devfn) << 11) | (PCI_FUNC(devfn) << 8) | offset); 97 96 } 98 97 99 98 static int versatile_read_config(struct pci_bus *bus, unsigned int devfn, int where, 100 99 int size, u32 *val) 101 100 { 102 - unsigned long addr = __pci_addr(bus, devfn, where); 101 + void __iomem *addr = __pci_addr(bus, devfn, where & ~3); 103 102 u32 v; 104 103 int slot = PCI_SLOT(devfn); 105 104 ··· 122 121 break; 123 122 124 123 case 2: 125 - v = __raw_readl(addr & ~3); 126 - if (addr & 2) v >>= 16; 124 + v = __raw_readl(addr); 125 + if (where & 2) v >>= 16; 127 126 v &= 0xffff; 128 127 break; 129 128 130 129 default: 131 - addr &= ~3; 132 130 v = __raw_readl(addr); 133 131 break; 134 132 } ··· 140 140 static int versatile_write_config(struct pci_bus *bus, unsigned int devfn, int where, 141 141 int size, u32 val) 142 142 { 143 - unsigned long addr = __pci_addr(bus, devfn, where); 143 + void __iomem *addr = __pci_addr(bus, devfn, where); 144 144 int slot = PCI_SLOT(devfn); 145 145 146 146 if (pci_slot_ignore & (1 << slot)) { ··· 279 279 printk("PCI core found (slot %d)\n",myslot); 280 280 281 281 __raw_writel(myslot, PCI_SELFID); 282 - local_pci_cfg_base = (void *) VERSATILE_PCI_CFG_VIRT_BASE + (myslot << 11); 282 + local_pci_cfg_base = VERSATILE_PCI_CFG_VIRT_BASE + (myslot << 11); 283 283 284 284 val = __raw_readl(local_pci_cfg_base + CSR_OFFSET); 285 285 val |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE;
+2 -2
include/asm-arm/arch-versatile/hardware.h
··· 28 28 /* 29 29 * PCI space virtual addresses 30 30 */ 31 - #define VERSATILE_PCI_VIRT_BASE 0xe8000000 32 - #define VERSATILE_PCI_CFG_VIRT_BASE 0xe9000000 31 + #define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul 32 + #define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul 33 33 34 34 #if 0 35 35 #define VERSATILE_PCI_VIRT_MEM_BASE0 0xf4000000