Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arch/sh: add sh7786_mm_sel() function

The SH7786 has different physical memory layout configurations,
configurable through the MMSELR register. The configuration is
typically defined by the bootloader, so Linux generally doesn't care.

Except that depending on the configuration, some PCI MEM areas may or
may not be available. This commit adds a helper function that allows
to retrieve the current physical memory layout configuration. It will
be used in a following patch to exclude unusable PCI MEM areas during
the PCI initialization.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Rich Felker <dalias@libc.org>

authored by

Thomas Petazzoni and committed by
Rich Felker
bc05aa6e 96a59899

+7
+7
arch/sh/include/cpu-sh4/cpu/sh7786.h
··· 14 14 #ifndef __CPU_SH7786_H__ 15 15 #define __CPU_SH7786_H__ 16 16 17 + #include <linux/io.h> 18 + 17 19 enum { 18 20 /* PA */ 19 21 GPIO_PA7, GPIO_PA6, GPIO_PA5, GPIO_PA4, ··· 132 130 /* INTC */ 133 131 GPIO_FN_IRL7, GPIO_FN_IRL6, GPIO_FN_IRL5, GPIO_FN_IRL4, 134 132 }; 133 + 134 + static inline u32 sh7786_mm_sel(void) 135 + { 136 + return __raw_readl(0xFC400020) & 0x7; 137 + } 135 138 136 139 #endif /* __CPU_SH7786_H__ */