summaryrefslogtreecommitdiffstats
path: root/arch/arc/plat-tb10x/tb10x.c
blob: d3567691c7e1259174a9b6db4cf65593c2fb7536 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * Abilis Systems TB10x platform initialisation
 *
 * Copyright (C) Abilis Systems 2012
 *
 * Author: Christian Ruppert <christian.ruppert@abilis.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 */


#include <linux/init.h>
#include <linux/of_platform.h>
#include <linux/clk-provider.h>
#include <linux/pinctrl/consumer.h>

#include <asm/mach_desc.h>


static void __init tb10x_platform_init(void)
{
	of_clk_init(NULL);
	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}

static void __init tb10x_platform_late_init(void)
{
	struct device_node *dn;

	/*
	 * Pinctrl documentation recommends setting up the iomux here for
	 * all modules which don't require control over the pins themselves.
	 * Modules which need this kind of assistance are compatible with
	 * "abilis,simple-pinctrl", i.e. we can easily iterate over them.
	 * TODO: Does this recommended method work cleanly with pins required
	 * by modules?
	 */
	for_each_compatible_node(dn, NULL, "abilis,simple-pinctrl") {
		struct platform_device *pd = of_find_device_by_node(dn);
		struct pinctrl *pctl;

		pctl = pinctrl_get_select(&pd->dev, "abilis,simple-default");
		if (IS_ERR(pctl)) {
			int ret = PTR_ERR(pctl);
			dev_err(&pd->dev, "Could not set up pinctrl: %d\n",
				ret);
		}
	}
}

static const char *tb10x_compat[] __initdata = {
	"abilis,arc-tb10x",
	NULL,
};

MACHINE_START(TB10x, "tb10x")
	.dt_compat	= tb10x_compat,
	.init_machine	= tb10x_platform_init,
	.init_late	= tb10x_platform_late_init,
MACHINE_END
OpenPOWER on IntegriCloud