diff options
author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2013-07-26 10:17:44 -0300 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2013-08-06 14:10:22 +0000 |
commit | 6bd6b3cb82d55e3b9f3080b6d2c648ceffc7b08a (patch) | |
tree | cd9b98c21a81351c429a24f534cc6b742523a887 /drivers/bus | |
parent | 89a7fbfb52e2c7337a3e7b37a3b8e1bde30ded78 (diff) |
bus: mvebu-mbus: Factor out initialization details
We introduce a common initialization function mvebu_mbus_common_init()
that will be used by both legacy and device-tree initialization code.
This patch is an intermediate step, which will allow to introduce the
DT binding for this driver in a less intrusive way.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/bus')
-rw-r--r-- | drivers/bus/mvebu-mbus.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c index 827468abb23..1b17954600a 100644 --- a/drivers/bus/mvebu-mbus.c +++ b/drivers/bus/mvebu-mbus.c @@ -847,26 +847,14 @@ static __init int mvebu_mbus_debugfs_init(void) } fs_initcall(mvebu_mbus_debugfs_init); -int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, - size_t mbuswins_size, - phys_addr_t sdramwins_phys_base, - size_t sdramwins_size) +static int __init mvebu_mbus_common_init(struct mvebu_mbus_state *mbus, + phys_addr_t mbuswins_phys_base, + size_t mbuswins_size, + phys_addr_t sdramwins_phys_base, + size_t sdramwins_size) { - struct mvebu_mbus_state *mbus = &mbus_state; - const struct of_device_id *of_id; int win; - for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) - if (!strcmp(of_id->compatible, soc)) - break; - - if (!of_id->compatible) { - pr_err("could not find a matching SoC family\n"); - return -ENODEV; - } - - mbus->soc = of_id->data; - mbus->mbuswins_base = ioremap(mbuswins_phys_base, mbuswins_size); if (!mbus->mbuswins_base) return -ENOMEM; @@ -887,3 +875,28 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, return 0; } + +int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, + size_t mbuswins_size, + phys_addr_t sdramwins_phys_base, + size_t sdramwins_size) +{ + const struct of_device_id *of_id; + + for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) + if (!strcmp(of_id->compatible, soc)) + break; + + if (!of_id->compatible) { + pr_err("could not find a matching SoC family\n"); + return -ENODEV; + } + + mbus_state.soc = of_id->data; + + return mvebu_mbus_common_init(&mbus_state, + mbuswins_phys_base, + mbuswins_size, + sdramwins_phys_base, + sdramwins_size); +} |