@@ -100,6 +100,57 @@ static const struct of_device_id arm_ccree_dev_of_match[] = {
100100};
101101MODULE_DEVICE_TABLE (of , arm_ccree_dev_of_match );
102102
103+ static void init_cc_cache_params (struct cc_drvdata * drvdata )
104+ {
105+ struct device * dev = drvdata_to_dev (drvdata );
106+ u32 cache_params , ace_const , val , mask ;
107+
108+ /* compute CC_AXIM_CACHE_PARAMS */
109+ cache_params = cc_ioread (drvdata , CC_REG (AXIM_CACHE_PARAMS ));
110+ dev_dbg (dev , "Cache params previous: 0x%08X\n" , cache_params );
111+
112+ /* non cached or write-back, write allocate */
113+ val = drvdata -> coherent ? 0xb : 0x2 ;
114+
115+ mask = CC_GENMASK (CC_AXIM_CACHE_PARAMS_AWCACHE );
116+ cache_params &= ~mask ;
117+ cache_params |= FIELD_PREP (mask , val );
118+
119+ mask = CC_GENMASK (CC_AXIM_CACHE_PARAMS_AWCACHE_LAST );
120+ cache_params &= ~mask ;
121+ cache_params |= FIELD_PREP (mask , val );
122+
123+ mask = CC_GENMASK (CC_AXIM_CACHE_PARAMS_ARCACHE );
124+ cache_params &= ~mask ;
125+ cache_params |= FIELD_PREP (mask , val );
126+
127+ drvdata -> cache_params = cache_params ;
128+
129+ dev_dbg (dev , "Cache params current: 0x%08X\n" , cache_params );
130+
131+ if (drvdata -> hw_rev <= CC_HW_REV_710 )
132+ return ;
133+
134+ /* compute CC_AXIM_ACE_CONST */
135+ ace_const = cc_ioread (drvdata , CC_REG (AXIM_ACE_CONST ));
136+ dev_dbg (dev , "ACE-const previous: 0x%08X\n" , ace_const );
137+
138+ /* system or outer-sharable */
139+ val = drvdata -> coherent ? 0x2 : 0x3 ;
140+
141+ mask = CC_GENMASK (CC_AXIM_ACE_CONST_ARDOMAIN );
142+ ace_const &= ~mask ;
143+ ace_const |= FIELD_PREP (mask , val );
144+
145+ mask = CC_GENMASK (CC_AXIM_ACE_CONST_AWDOMAIN );
146+ ace_const &= ~mask ;
147+ ace_const |= FIELD_PREP (mask , val );
148+
149+ dev_dbg (dev , "ACE-const current: 0x%08X\n" , ace_const );
150+
151+ drvdata -> ace_const = ace_const ;
152+ }
153+
103154static u32 cc_read_idr (struct cc_drvdata * drvdata , const u32 * idr_offsets )
104155{
105156 int i ;
@@ -218,9 +269,9 @@ bool cc_wait_for_reset_completion(struct cc_drvdata *drvdata)
218269 return false;
219270}
220271
221- int init_cc_regs (struct cc_drvdata * drvdata , bool is_probe )
272+ int init_cc_regs (struct cc_drvdata * drvdata )
222273{
223- unsigned int val , cache_params ;
274+ unsigned int val ;
224275 struct device * dev = drvdata_to_dev (drvdata );
225276
226277 /* Unmask all AXI interrupt sources AXI_CFG1 register */
@@ -245,19 +296,9 @@ int init_cc_regs(struct cc_drvdata *drvdata, bool is_probe)
245296
246297 cc_iowrite (drvdata , CC_REG (HOST_IMR ), ~val );
247298
248- cache_params = (drvdata -> coherent ? CC_COHERENT_CACHE_PARAMS : 0x0 );
249-
250- val = cc_ioread (drvdata , CC_REG (AXIM_CACHE_PARAMS ));
251-
252- if (is_probe )
253- dev_dbg (dev , "Cache params previous: 0x%08X\n" , val );
254-
255- cc_iowrite (drvdata , CC_REG (AXIM_CACHE_PARAMS ), cache_params );
256- val = cc_ioread (drvdata , CC_REG (AXIM_CACHE_PARAMS ));
257-
258- if (is_probe )
259- dev_dbg (dev , "Cache params current: 0x%08X (expect: 0x%08X)\n" ,
260- val , cache_params );
299+ cc_iowrite (drvdata , CC_REG (AXIM_CACHE_PARAMS ), drvdata -> cache_params );
300+ if (drvdata -> hw_rev >= CC_HW_REV_712 )
301+ cc_iowrite (drvdata , CC_REG (AXIM_ACE_CONST ), drvdata -> ace_const );
261302
262303 return 0 ;
263304}
@@ -445,7 +486,9 @@ static int init_cc_resources(struct platform_device *plat_dev)
445486 }
446487 dev_dbg (dev , "Registered to IRQ: %d\n" , irq );
447488
448- rc = init_cc_regs (new_drvdata , true);
489+ init_cc_cache_params (new_drvdata );
490+
491+ rc = init_cc_regs (new_drvdata );
449492 if (rc ) {
450493 dev_err (dev , "init_cc_regs failed\n" );
451494 goto post_pm_err ;
0 commit comments