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

mfd: vexpress: Remove non-DT code

Now, as all VE platforms have to be booted with DT,
the code handling non-DT case can be removed.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Pawel Moll and committed by
Lee Jones
f0bd7ccc fb358e43

+20 -61
+20 -61
drivers/mfd/vexpress-sysreg.c
··· 47 47 #define SYS_HBI_MASK 0xfff 48 48 #define SYS_PROCIDx_HBI_SHIFT 0 49 49 50 - #define SYS_MCI_CARDIN (1 << 0) 51 - #define SYS_MCI_WPROT (1 << 1) 52 - 53 50 #define SYS_MISC_MASTERSITE (1 << 14) 54 - 55 - 56 - static void __iomem *__vexpress_sysreg_base; 57 - 58 - static void __iomem *vexpress_sysreg_base(void) 59 - { 60 - if (!__vexpress_sysreg_base) { 61 - struct device_node *node = of_find_compatible_node(NULL, NULL, 62 - "arm,vexpress-sysreg"); 63 - 64 - __vexpress_sysreg_base = of_iomap(node, 0); 65 - } 66 - 67 - WARN_ON(!__vexpress_sysreg_base); 68 - 69 - return __vexpress_sysreg_base; 70 - } 71 - 72 - 73 - static int vexpress_sysreg_get_master(void) 74 - { 75 - if (readl(vexpress_sysreg_base() + SYS_MISC) & SYS_MISC_MASTERSITE) 76 - return VEXPRESS_SITE_DB2; 77 - 78 - return VEXPRESS_SITE_DB1; 79 - } 80 51 81 52 void vexpress_flags_set(u32 data) 82 53 { 83 - writel(~0, vexpress_sysreg_base() + SYS_FLAGSCLR); 84 - writel(data, vexpress_sysreg_base() + SYS_FLAGSSET); 54 + static void __iomem *base; 55 + 56 + if (!base) { 57 + struct device_node *node = of_find_compatible_node(NULL, NULL, 58 + "arm,vexpress-sysreg"); 59 + 60 + base = of_iomap(node, 0); 61 + } 62 + 63 + if (WARN_ON(!base)) 64 + return; 65 + 66 + writel(~0, base + SYS_FLAGSCLR); 67 + writel(data, base + SYS_FLAGSSET); 85 68 } 86 - 87 - unsigned int vexpress_get_mci_cardin(struct device *dev) 88 - { 89 - return readl(vexpress_sysreg_base() + SYS_MCI) & SYS_MCI_CARDIN; 90 - } 91 - 92 - u32 vexpress_get_procid(int site) 93 - { 94 - if (site == VEXPRESS_SITE_MASTER) 95 - site = vexpress_sysreg_get_master(); 96 - 97 - return readl(vexpress_sysreg_base() + (site == VEXPRESS_SITE_DB1 ? 98 - SYS_PROCID0 : SYS_PROCID1)); 99 - } 100 - 101 - void __iomem *vexpress_get_24mhz_clock_base(void) 102 - { 103 - return vexpress_sysreg_base() + SYS_24MHZ; 104 - } 105 - 106 - 107 - void __init vexpress_sysreg_early_init(void __iomem *base) 108 - { 109 - __vexpress_sysreg_base = base; 110 - 111 - vexpress_config_set_master(vexpress_sysreg_get_master()); 112 - } 113 - 114 69 115 70 /* The sysreg block is just a random collection of various functions... */ 116 71 ··· 165 210 struct resource *mem; 166 211 void __iomem *base; 167 212 struct bgpio_chip *mmc_gpio_chip; 213 + int master; 168 214 u32 dt_hbi; 169 215 170 216 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 176 220 if (!base) 177 221 return -ENOMEM; 178 222 179 - vexpress_config_set_master(vexpress_sysreg_get_master()); 223 + master = readl(base + SYS_MISC) & SYS_MISC_MASTERSITE ? 224 + VEXPRESS_SITE_DB2 : VEXPRESS_SITE_DB1; 225 + vexpress_config_set_master(master); 180 226 181 227 /* Confirm board type against DT property, if available */ 182 228 if (of_property_read_u32(of_root, "arm,hbi", &dt_hbi) == 0) { 183 - u32 id = vexpress_get_procid(VEXPRESS_SITE_MASTER); 229 + u32 id = readl(base + (master == VEXPRESS_SITE_DB1 ? 230 + SYS_PROCID0 : SYS_PROCID1)); 184 231 u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK; 185 232 186 233 if (WARN_ON(dt_hbi != hbi))