mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 16:54:20 +08:00
pinctrl: mvebu: dove: use remapped mpp base registers
Now that we have ioremapped mpp base registers, get rid of hardcoded physical addresses. While at it, also remove DOVE_ prefix from those macros. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
e91f7916ea
commit
00202b013e
@ -31,9 +31,6 @@
|
|||||||
#define GC_REGS_OFFS 0xe802c
|
#define GC_REGS_OFFS 0xe802c
|
||||||
|
|
||||||
#define DOVE_SB_REGS_VIRT_BASE IOMEM(0xfde00000)
|
#define DOVE_SB_REGS_VIRT_BASE IOMEM(0xfde00000)
|
||||||
#define DOVE_MPP_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0200)
|
|
||||||
#define DOVE_PMU_MPP_GENERAL_CTRL (DOVE_MPP_VIRT_BASE + 0x10)
|
|
||||||
#define DOVE_AU0_AC97_SEL BIT(16)
|
|
||||||
#define DOVE_PMU_SIGNAL_SELECT_0 (DOVE_SB_REGS_VIRT_BASE + 0xd802C)
|
#define DOVE_PMU_SIGNAL_SELECT_0 (DOVE_SB_REGS_VIRT_BASE + 0xd802C)
|
||||||
#define DOVE_PMU_SIGNAL_SELECT_1 (DOVE_SB_REGS_VIRT_BASE + 0xd8030)
|
#define DOVE_PMU_SIGNAL_SELECT_1 (DOVE_SB_REGS_VIRT_BASE + 0xd8030)
|
||||||
#define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C)
|
#define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C)
|
||||||
@ -57,6 +54,10 @@
|
|||||||
#define DOVE_SD1_GPIO_SEL BIT(1)
|
#define DOVE_SD1_GPIO_SEL BIT(1)
|
||||||
#define DOVE_SD0_GPIO_SEL BIT(0)
|
#define DOVE_SD0_GPIO_SEL BIT(0)
|
||||||
|
|
||||||
|
/* MPP Base registers */
|
||||||
|
#define PMU_MPP_GENERAL_CTRL 0x10
|
||||||
|
#define AU0_AC97_SEL BIT(16)
|
||||||
|
|
||||||
#define CONFIG_PMU BIT(4)
|
#define CONFIG_PMU BIT(4)
|
||||||
|
|
||||||
static void __iomem *mpp_base;
|
static void __iomem *mpp_base;
|
||||||
@ -78,7 +79,7 @@ static int dove_pmu_mpp_ctrl_get(unsigned pid, unsigned long *config)
|
|||||||
{
|
{
|
||||||
unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS;
|
unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS;
|
||||||
unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS;
|
unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS;
|
||||||
unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL);
|
unsigned long pmu = readl(mpp_base + PMU_MPP_GENERAL_CTRL);
|
||||||
unsigned long func;
|
unsigned long func;
|
||||||
|
|
||||||
if ((pmu & BIT(pid)) == 0)
|
if ((pmu & BIT(pid)) == 0)
|
||||||
@ -95,15 +96,15 @@ static int dove_pmu_mpp_ctrl_set(unsigned pid, unsigned long config)
|
|||||||
{
|
{
|
||||||
unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS;
|
unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS;
|
||||||
unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS;
|
unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS;
|
||||||
unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL);
|
unsigned long pmu = readl(mpp_base + PMU_MPP_GENERAL_CTRL);
|
||||||
unsigned long func;
|
unsigned long func;
|
||||||
|
|
||||||
if ((config & CONFIG_PMU) == 0) {
|
if ((config & CONFIG_PMU) == 0) {
|
||||||
writel(pmu & ~BIT(pid), DOVE_PMU_MPP_GENERAL_CTRL);
|
writel(pmu & ~BIT(pid), mpp_base + PMU_MPP_GENERAL_CTRL);
|
||||||
return default_mpp_ctrl_set(mpp_base, pid, config);
|
return default_mpp_ctrl_set(mpp_base, pid, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
writel(pmu | BIT(pid), DOVE_PMU_MPP_GENERAL_CTRL);
|
writel(pmu | BIT(pid), mpp_base + PMU_MPP_GENERAL_CTRL);
|
||||||
func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off);
|
func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off);
|
||||||
func &= ~(MVEBU_MPP_MASK << shift);
|
func &= ~(MVEBU_MPP_MASK << shift);
|
||||||
func |= (config & MVEBU_MPP_MASK) << shift;
|
func |= (config & MVEBU_MPP_MASK) << shift;
|
||||||
@ -200,21 +201,21 @@ static int dove_nand_ctrl_set(unsigned pid, unsigned long config)
|
|||||||
|
|
||||||
static int dove_audio0_ctrl_get(unsigned pid, unsigned long *config)
|
static int dove_audio0_ctrl_get(unsigned pid, unsigned long *config)
|
||||||
{
|
{
|
||||||
unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL);
|
unsigned long pmu = readl(mpp_base + PMU_MPP_GENERAL_CTRL);
|
||||||
|
|
||||||
*config = ((pmu & DOVE_AU0_AC97_SEL) != 0);
|
*config = ((pmu & AU0_AC97_SEL) != 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dove_audio0_ctrl_set(unsigned pid, unsigned long config)
|
static int dove_audio0_ctrl_set(unsigned pid, unsigned long config)
|
||||||
{
|
{
|
||||||
unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL);
|
unsigned long pmu = readl(mpp_base + PMU_MPP_GENERAL_CTRL);
|
||||||
|
|
||||||
pmu &= ~DOVE_AU0_AC97_SEL;
|
pmu &= ~AU0_AC97_SEL;
|
||||||
if (config)
|
if (config)
|
||||||
pmu |= DOVE_AU0_AC97_SEL;
|
pmu |= AU0_AC97_SEL;
|
||||||
writel(pmu, DOVE_PMU_MPP_GENERAL_CTRL);
|
writel(pmu, mpp_base + PMU_MPP_GENERAL_CTRL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user