Skip to content

Commit e27fbe1

Browse files
gclementtsbogend
authored andcommitted
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 <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 57c7110 commit e27fbe1

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

arch/mips/include/asm/mips-cm.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ extern phys_addr_t mips_cm_l2sync_phys_base(void);
5959
*/
6060
extern int mips_cm_is64;
6161

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+
6272
/**
6373
* mips_cm_error_report - Report CM cache errors
6474
*/
@@ -97,6 +107,18 @@ static inline bool mips_cm_present(void)
97107
#endif
98108
}
99109

110+
/**
111+
* mips_cm_update_property - update property from the device tree
112+
*
113+
* Retrieve the properties from the device tree if a CM node exist and
114+
* update the internal variable based on this.
115+
*/
116+
#ifdef CONFIG_MIPS_CM
117+
extern void mips_cm_update_property(void);
118+
#else
119+
static void mips_cm_update_property(void) {}
120+
#endif
121+
100122
/**
101123
* mips_cm_has_l2sync - determine whether an L2-only sync region is present
102124
*

arch/mips/kernel/mips-cm.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <linux/errno.h>
8+
#include <linux/of.h>
89
#include <linux/percpu.h>
910
#include <linux/spinlock.h>
1011

@@ -14,6 +15,7 @@
1415
void __iomem *mips_gcr_base;
1516
void __iomem *mips_cm_l2sync_base;
1617
int mips_cm_is64;
18+
bool mips_cm_is_l2_hci_broken;
1719

1820
static char *cm2_tr[8] = {
1921
"mem", "gcr", "gic", "mmio",
@@ -237,6 +239,18 @@ static void mips_cm_probe_l2sync(void)
237239
mips_cm_l2sync_base = ioremap(addr, MIPS_CM_L2SYNC_SIZE);
238240
}
239241

242+
void mips_cm_update_property(void)
243+
{
244+
struct device_node *cm_node;
245+
246+
cm_node = of_find_compatible_node(of_root, NULL, "mobileye,eyeq6-cm");
247+
if (!cm_node)
248+
return;
249+
pr_info("HCI (Hardware Cache Init for the L2 cache) in GCR_L2_RAM_CONFIG from the CM3 is broken");
250+
mips_cm_is_l2_hci_broken = true;
251+
of_node_put(cm_node);
252+
}
253+
240254
int mips_cm_probe(void)
241255
{
242256
phys_addr_t addr;

0 commit comments

Comments
 (0)