Skip to content

Commit 4700a00

Browse files
committed
bus: ti-sysc: Probe for l4_wkup and l4_cfg interconnect devices first
We want to probe l4_wkup and l4_cfg interconnect devices first to avoid issues with missing resources. Otherwise we attempt to probe l4_per devices first causing pointless deferred probe and also annoyingh renumbering of the MMC devices for example. Signed-off-by: Tony Lindgren <tony@atomide.com>
1 parent 7bad5af commit 4700a00

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

‎drivers/bus/ti-sysc.c‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,51 @@ static int sysc_parse_and_check_child_range(struct sysc *ddata)
635635
return 0;
636636
}
637637

638+
/* Interconnect instances to probe before l4_per instances */
639+
static struct resource early_bus_ranges[] = {
640+
/* am3/4 l4_wkup */
641+
{ .start = 0x44c00000, .end = 0x44c00000 + 0x300000, },
642+
/* omap4/5 and dra7 l4_cfg */
643+
{ .start = 0x4a000000, .end = 0x4a000000 + 0x300000, },
644+
/* omap4 l4_wkup */
645+
{ .start = 0x4a300000, .end = 0x4a300000 + 0x30000, },
646+
/* omap5 and dra7 l4_wkup without dra7 dcan segment */
647+
{ .start = 0x4ae00000, .end = 0x4ae00000 + 0x30000, },
648+
};
649+
650+
static atomic_t sysc_defer = ATOMIC_INIT(10);
651+
652+
/**
653+
* sysc_defer_non_critical - defer non_critical interconnect probing
654+
* @ddata: device driver data
655+
*
656+
* We want to probe l4_cfg and l4_wkup interconnect instances before any
657+
* l4_per instances as l4_per instances depend on resources on l4_cfg and
658+
* l4_wkup interconnects.
659+
*/
660+
static int sysc_defer_non_critical(struct sysc *ddata)
661+
{
662+
struct resource *res;
663+
int i;
664+
665+
if (!atomic_read(&sysc_defer))
666+
return 0;
667+
668+
for (i = 0; i < ARRAY_SIZE(early_bus_ranges); i++) {
669+
res = &early_bus_ranges[i];
670+
if (ddata->module_pa >= res->start &&
671+
ddata->module_pa <= res->end) {
672+
atomic_set(&sysc_defer, 0);
673+
674+
return 0;
675+
}
676+
}
677+
678+
atomic_dec_if_positive(&sysc_defer);
679+
680+
return -EPROBE_DEFER;
681+
}
682+
638683
static struct device_node *stdout_path;
639684

640685
static void sysc_init_stdout_path(struct sysc *ddata)
@@ -860,6 +905,10 @@ static int sysc_map_and_check_registers(struct sysc *ddata)
860905
if (error)
861906
return error;
862907

908+
error = sysc_defer_non_critical(ddata);
909+
if (error)
910+
return error;
911+
863912
sysc_check_children(ddata);
864913

865914
if (!of_get_property(np, "reg", NULL))

0 commit comments

Comments
 (0)