Skip to content

Commit

Permalink
ARM: at91: standard device init only if DT is not populated.
Browse files Browse the repository at this point in the history
This will avoid the CONFIG_OF on the *_devices.c as this file is deprecated
for DT support.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
  • Loading branch information
Jean-Christophe PLAGNIOL-VILLARD committed Apr 20, 2012
1 parent 4e114c9 commit 8cf93b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 43 deletions.
20 changes: 3 additions & 17 deletions arch/arm/mach-at91/at91sam9260_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,25 +702,8 @@ static struct platform_device at91sam9260_tcb1_device = {
.num_resources = ARRAY_SIZE(tcb1_resources),
};

#if defined(CONFIG_OF)
static struct of_device_id tcb_ids[] = {
{ .compatible = "atmel,at91rm9200-tcb" },
{ /*sentinel*/ }
};
#endif

static void __init at91_add_device_tc(void)
{
#if defined(CONFIG_OF)
struct device_node *np;

np = of_find_matching_node(NULL, tcb_ids);
if (np) {
of_node_put(np);
return;
}
#endif

platform_device_register(&at91sam9260_tcb0_device);
platform_device_register(&at91sam9260_tcb1_device);
}
Expand Down Expand Up @@ -1364,6 +1347,9 @@ void __init at91_add_device_cf(struct at91_cf_data * data) {}
*/
static int __init at91_add_standard_devices(void)
{
if (of_have_populated_dt())
return 0;

at91_add_device_rtt();
at91_add_device_watchdog();
at91_add_device_tc();
Expand Down
30 changes: 4 additions & 26 deletions arch/arm/mach-at91/at91sam9g45_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ static struct platform_device at_hdmac_device = {

void __init at91_add_device_hdmac(void)
{
#if defined(CONFIG_OF)
struct device_node *of_node =
of_find_node_by_name(NULL, "dma-controller");

if (of_node)
of_node_put(of_node);
else
#endif
platform_device_register(&at_hdmac_device);
platform_device_register(&at_hdmac_device);
}
#else
void __init at91_add_device_hdmac(void) {}
Expand Down Expand Up @@ -1094,25 +1086,8 @@ static struct platform_device at91sam9g45_tcb1_device = {
.num_resources = ARRAY_SIZE(tcb1_resources),
};

#if defined(CONFIG_OF)
static struct of_device_id tcb_ids[] = {
{ .compatible = "atmel,at91rm9200-tcb" },
{ /*sentinel*/ }
};
#endif

static void __init at91_add_device_tc(void)
{
#if defined(CONFIG_OF)
struct device_node *np;

np = of_find_matching_node(NULL, tcb_ids);
if (np) {
of_node_put(np);
return;
}
#endif

platform_device_register(&at91sam9g45_tcb0_device);
platform_device_register(&at91sam9g45_tcb1_device);
}
Expand Down Expand Up @@ -1763,6 +1738,9 @@ void __init at91_add_device_serial(void) {}
*/
static int __init at91_add_standard_devices(void)
{
if (of_have_populated_dt())
return 0;

at91_add_device_hdmac();
at91_add_device_rtc();
at91_add_device_rtt();
Expand Down

0 comments on commit 8cf93b9

Please sign in to comment.