@@ -1298,6 +1298,8 @@ static const struct clk_ops bcm2835_vpu_clock_clk_ops = {
1298
1298
.debug_init = bcm2835_clock_debug_init ,
1299
1299
};
1300
1300
1301
+ static bool bcm2835_clk_is_claimed (const char * name );
1302
+
1301
1303
static struct clk_hw * bcm2835_register_pll (struct bcm2835_cprman * cprman ,
1302
1304
const struct bcm2835_pll_data * data )
1303
1305
{
@@ -1314,6 +1316,9 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
1314
1316
init .ops = & bcm2835_pll_clk_ops ;
1315
1317
init .flags = CLK_IGNORE_UNUSED ;
1316
1318
1319
+ if (!bcm2835_clk_is_claimed (data -> name ))
1320
+ init .flags |= CLK_IS_CRITICAL ;
1321
+
1317
1322
pll = kzalloc (sizeof (* pll ), GFP_KERNEL );
1318
1323
if (!pll )
1319
1324
return NULL ;
@@ -1367,8 +1372,10 @@ bcm2835_register_pll_divider(struct bcm2835_cprman *cprman,
1367
1372
divider -> div .table = NULL ;
1368
1373
1369
1374
if (!(cprman_read (cprman , data -> cm_reg ) & data -> hold_mask )) {
1370
- init .flags |= CLK_IS_CRITICAL ;
1371
- divider -> div .flags |= CLK_IS_CRITICAL ;
1375
+ if (!bcm2835_clk_is_claimed (data -> source_pll ))
1376
+ init .flags |= CLK_IS_CRITICAL ;
1377
+ if (!bcm2835_clk_is_claimed (data -> name ))
1378
+ divider -> div .flags |= CLK_IS_CRITICAL ;
1372
1379
}
1373
1380
1374
1381
divider -> cprman = cprman ;
@@ -2104,6 +2111,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2104
2111
.ctl_reg = CM_PERIICTL ),
2105
2112
};
2106
2113
2114
+ static bool bcm2835_clk_claimed [ARRAY_SIZE (clk_desc_array )];
2115
+
2107
2116
/*
2108
2117
* Permanently take a reference on the parent of the SDRAM clock.
2109
2118
*
@@ -2123,6 +2132,19 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc)
2123
2132
return clk_prepare_enable (parent );
2124
2133
}
2125
2134
2135
+ static bool bcm2835_clk_is_claimed (const char * name )
2136
+ {
2137
+ int i ;
2138
+
2139
+ for (i = 0 ; i < ARRAY_SIZE (clk_desc_array ); i ++ ) {
2140
+ const char * clk_name = * (const char * * )(clk_desc_array [i ].data );
2141
+ if (!strcmp (name , clk_name ))
2142
+ return bcm2835_clk_claimed [i ];
2143
+ }
2144
+
2145
+ return false;
2146
+ }
2147
+
2126
2148
static int bcm2835_clk_probe (struct platform_device * pdev )
2127
2149
{
2128
2150
struct device * dev = & pdev -> dev ;
@@ -2132,6 +2154,7 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
2132
2154
const struct bcm2835_clk_desc * desc ;
2133
2155
const size_t asize = ARRAY_SIZE (clk_desc_array );
2134
2156
size_t i ;
2157
+ u32 clk_id ;
2135
2158
int ret ;
2136
2159
2137
2160
cprman = devm_kzalloc (dev , sizeof (* cprman ) +
@@ -2147,6 +2170,13 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
2147
2170
if (IS_ERR (cprman -> regs ))
2148
2171
return PTR_ERR (cprman -> regs );
2149
2172
2173
+ memset (bcm2835_clk_claimed , 0 , sizeof (bcm2835_clk_claimed ));
2174
+ for (i = 0 ;
2175
+ !of_property_read_u32_index (pdev -> dev .of_node , "claim-clocks" ,
2176
+ i , & clk_id );
2177
+ i ++ )
2178
+ bcm2835_clk_claimed [clk_id ]= true;
2179
+
2150
2180
memcpy (cprman -> real_parent_names , cprman_parent_names ,
2151
2181
sizeof (cprman_parent_names ));
2152
2182
of_clk_parent_fill (dev -> of_node , cprman -> real_parent_names ,
0 commit comments