diff options
author | Paul Burton <paul.burton@imgtec.com> | 2016-10-15 18:03:43 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-11-03 19:17:46 -0400 |
commit | 682c1e52215da4a3e89c14aad60bfc0d400b025f (patch) | |
tree | 8095bdbf29583d18a585d9d21417533804be3e1c | |
parent | a909d3e636995ba7c349e2ca5dbb528154d4ac30 (diff) |
MIPS: CPC: Provide default mips_cpc_default_phys_base to ignore CPC
Provide a default implementation of mips_cpc_default_phys_base() which
simply returns 0, and adjust mips_cpc_phys_base() to allow for
mips_cpc_default_phys_base() returning 0. This allows kernels which
include CPC support to be built without platform code & simply ignore
the CPC if it wasn't already enabled by the bootloader.
This fixes link failures such as the following from generic defconfigs:
arch/mips/built-in.o: In function `mips_cpc_phys_base':
arch/mips/kernel/mips-cpc.c:47: undefined reference to `mips_cpc_default_phys_base'
[ralf@linux-mips.org: changed prototype for coding style compliance.]
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14401/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/kernel/mips-cpc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c index 2a45867d3b4f..a4964c334cab 100644 --- a/arch/mips/kernel/mips-cpc.c +++ b/arch/mips/kernel/mips-cpc.c | |||
@@ -21,6 +21,11 @@ static DEFINE_PER_CPU_ALIGNED(spinlock_t, cpc_core_lock); | |||
21 | 21 | ||
22 | static DEFINE_PER_CPU_ALIGNED(unsigned long, cpc_core_lock_flags); | 22 | static DEFINE_PER_CPU_ALIGNED(unsigned long, cpc_core_lock_flags); |
23 | 23 | ||
24 | phys_addr_t __weak mips_cpc_default_phys_base(void) | ||
25 | { | ||
26 | return 0; | ||
27 | } | ||
28 | |||
24 | /** | 29 | /** |
25 | * mips_cpc_phys_base - retrieve the physical base address of the CPC | 30 | * mips_cpc_phys_base - retrieve the physical base address of the CPC |
26 | * | 31 | * |
@@ -43,8 +48,12 @@ static phys_addr_t mips_cpc_phys_base(void) | |||
43 | if (cpc_base & CM_GCR_CPC_BASE_CPCEN_MSK) | 48 | if (cpc_base & CM_GCR_CPC_BASE_CPCEN_MSK) |
44 | return cpc_base & CM_GCR_CPC_BASE_CPCBASE_MSK; | 49 | return cpc_base & CM_GCR_CPC_BASE_CPCBASE_MSK; |
45 | 50 | ||
46 | /* Otherwise, give it the default address & enable it */ | 51 | /* Otherwise, use the default address */ |
47 | cpc_base = mips_cpc_default_phys_base(); | 52 | cpc_base = mips_cpc_default_phys_base(); |
53 | if (!cpc_base) | ||
54 | return cpc_base; | ||
55 | |||
56 | /* Enable the CPC, mapped at the default address */ | ||
48 | write_gcr_cpc_base(cpc_base | CM_GCR_CPC_BASE_CPCEN_MSK); | 57 | write_gcr_cpc_base(cpc_base | CM_GCR_CPC_BASE_CPCEN_MSK); |
49 | return cpc_base; | 58 | return cpc_base; |
50 | } | 59 | } |