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

MIPS: cm: Detect CM quirks from device tree

Some information that should be retrieved at runtime for the Coherence
Manager can be either absent or wrong. This patch allows checking if
some of this information is available from the device tree and updates
the internal variable accordingly.

For now, only the compatible string associated with the broken HCI is
being retrieved.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Gregory CLEMENT and committed by
Thomas Bogendoerfer
e27fbe16 57c7110b

+36
+22
arch/mips/include/asm/mips-cm.h
··· 59 59 */ 60 60 extern int mips_cm_is64; 61 61 62 + /* 63 + * mips_cm_is_l2_hci_broken - determine if HCI is broken 64 + * 65 + * Some CM reports show that Hardware Cache Initialization is 66 + * complete, but in reality it's not the case. They also incorrectly 67 + * indicate that Hardware Cache Initialization is supported. This 68 + * flags allows warning about this broken feature. 69 + */ 70 + extern bool mips_cm_is_l2_hci_broken; 71 + 62 72 /** 63 73 * mips_cm_error_report - Report CM cache errors 64 74 */ ··· 106 96 return false; 107 97 #endif 108 98 } 99 + 100 + /** 101 + * mips_cm_update_property - update property from the device tree 102 + * 103 + * Retrieve the properties from the device tree if a CM node exist and 104 + * update the internal variable based on this. 105 + */ 106 + #ifdef CONFIG_MIPS_CM 107 + extern void mips_cm_update_property(void); 108 + #else 109 + static void mips_cm_update_property(void) {} 110 + #endif 109 111 110 112 /** 111 113 * mips_cm_has_l2sync - determine whether an L2-only sync region is present
+14
arch/mips/kernel/mips-cm.c
··· 5 5 */ 6 6 7 7 #include <linux/errno.h> 8 + #include <linux/of.h> 8 9 #include <linux/percpu.h> 9 10 #include <linux/spinlock.h> 10 11 ··· 15 14 void __iomem *mips_gcr_base; 16 15 void __iomem *mips_cm_l2sync_base; 17 16 int mips_cm_is64; 17 + bool mips_cm_is_l2_hci_broken; 18 18 19 19 static char *cm2_tr[8] = { 20 20 "mem", "gcr", "gic", "mmio", ··· 237 235 238 236 /* Map the region */ 239 237 mips_cm_l2sync_base = ioremap(addr, MIPS_CM_L2SYNC_SIZE); 238 + } 239 + 240 + void mips_cm_update_property(void) 241 + { 242 + struct device_node *cm_node; 243 + 244 + cm_node = of_find_compatible_node(of_root, NULL, "mobileye,eyeq6-cm"); 245 + if (!cm_node) 246 + return; 247 + pr_info("HCI (Hardware Cache Init for the L2 cache) in GCR_L2_RAM_CONFIG from the CM3 is broken"); 248 + mips_cm_is_l2_hci_broken = true; 249 + of_node_put(cm_node); 240 250 } 241 251 242 252 int mips_cm_probe(void)