diff options
author | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2014-06-23 17:42:08 +0200 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-06-30 17:40:59 +0000 |
commit | 9674d4a3cf4307dda468a0b48e5e43a2fdb56b68 (patch) | |
tree | d126a74cc3792b0c4f91fbf1355f162e308c004d /arch/arm/mach-mvebu/mvebu-soc-id.c | |
parent | 5e80d81acc420fa33b56078f73f38546ab99be6f (diff) | |
download | linux-9674d4a3cf4307dda468a0b48e5e43a2fdb56b68.tar.bz2 |
ARM: mvebu: Use system controller to get the soc id when possible
On Armada 38x it is possible to get the SoC Id and the revision
without using the PCI register. Accessing the PCI registers implies
enabling its clock and, because of the initialization issue, not
keeping them enable. So if possible it is better to avoid it.
Armada 370 and Armada XP provides the SoC ID values from the system
controller but not the revision.
Armada 375 provides both but the SoC ID value looks buggy (0x6660
instead of 0x6720).
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1403538128-27859-1-git-send-email-gregory.clement@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-mvebu/mvebu-soc-id.c')
-rw-r--r-- | arch/arm/mach-mvebu/mvebu-soc-id.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c index 12c66cac967d..a99434bcee84 100644 --- a/arch/arm/mach-mvebu/mvebu-soc-id.c +++ b/arch/arm/mach-mvebu/mvebu-soc-id.c @@ -25,6 +25,7 @@ #include <linux/of_address.h> #include <linux/slab.h> #include <linux/sys_soc.h> +#include "common.h" #include "mvebu-soc-id.h" #define PCIE_DEV_ID_OFF 0x0 @@ -54,7 +55,7 @@ int mvebu_get_soc_id(u32 *dev, u32 *rev) return -ENODEV; } -static int __init mvebu_soc_id_init(void) +static int __init get_soc_id_by_pci(void) { struct device_node *np; int ret = 0; @@ -129,6 +130,22 @@ clk_err: return ret; } + +static int __init mvebu_soc_id_init(void) +{ + + /* + * First try to get the ID and the revision by the system + * register and use PCI registers only if it is not possible + */ + if (!mvebu_system_controller_get_soc_id(&soc_dev_id, &soc_rev)) { + is_id_valid = true; + pr_info("MVEBU SoC ID=0x%X, Rev=0x%X\n", soc_dev_id, soc_rev); + return 0; + } + + return get_soc_id_by_pci(); +} early_initcall(mvebu_soc_id_init); static int __init mvebu_soc_device(void) |