@@ -348,9 +348,17 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id
348
348
349
349
static const u8 atmel_tcb_divisors [] = { 2 , 8 , 32 , 128 };
350
350
351
+ static struct atmel_tcb_config tcb_rm9200_config = {
352
+ .counter_width = 16 ,
353
+ };
354
+
355
+ static struct atmel_tcb_config tcb_sam9x5_config = {
356
+ .counter_width = 32 ,
357
+ };
358
+
351
359
static const struct of_device_id atmel_tcb_of_match [] = {
352
- { .compatible = "atmel,at91rm9200-tcb" , .data = ( void * ) 16 , },
353
- { .compatible = "atmel,at91sam9x5-tcb" , .data = ( void * ) 32 , },
360
+ { .compatible = "atmel,at91rm9200-tcb" , .data = & tcb_rm9200_config , },
361
+ { .compatible = "atmel,at91sam9x5-tcb" , .data = & tcb_sam9x5_config , },
354
362
{ /* sentinel */ }
355
363
};
356
364
@@ -398,7 +406,11 @@ static int __init tcb_clksrc_init(struct device_node *node)
398
406
}
399
407
400
408
match = of_match_node (atmel_tcb_of_match , node -> parent );
401
- bits = (uintptr_t )match -> data ;
409
+ if (!match )
410
+ return - ENODEV ;
411
+
412
+ tc .tcb_config = match -> data ;
413
+ bits = tc .tcb_config -> counter_width ;
402
414
403
415
for (i = 0 ; i < ARRAY_SIZE (tc .irq ); i ++ )
404
416
writel (ATMEL_TC_ALL_IRQ , tc .regs + ATMEL_TC_REG (i , IDR ));
0 commit comments