iomux-v3: Allow for a runtime base address
also, check for a valid pad_ctrl_ofs before changing the pad control register. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
fc2a9f0bc7
commit
6134b2cbb0
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <mach/common.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/iomux-v3.h>
|
||||
|
||||
/*!
|
||||
* @file mm.c
|
||||
|
@ -83,6 +84,7 @@ void __init mx31_map_io(void)
|
|||
void __init mx35_map_io(void)
|
||||
{
|
||||
mxc_set_cpu_type(MXC_CPU_MX35);
|
||||
mxc_iomux_v3_init(IO_ADDRESS(IOMUXC_BASE_ADDR));
|
||||
mxc_arch_reset_init(IO_ADDRESS(WDOG_BASE_ADDR));
|
||||
|
||||
iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
|
||||
|
|
|
@ -113,5 +113,10 @@ void mxc_iomux_v3_release_pad(struct pad_desc *pad);
|
|||
*/
|
||||
void mxc_iomux_v3_release_multiple_pads(struct pad_desc *pad_list, int count);
|
||||
|
||||
/*
|
||||
* Initialise the iomux controller
|
||||
*/
|
||||
void mxc_iomux_v3_init(void __iomem *iomux_v3_base);
|
||||
|
||||
#endif /* __MACH_IOMUX_V3_H__*/
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <asm/mach/map.h>
|
||||
#include <mach/iomux-v3.h>
|
||||
|
||||
#define IOMUX_BASE IO_ADDRESS(IOMUXC_BASE_ADDR)
|
||||
static void __iomem *base;
|
||||
|
||||
static unsigned long iomux_v3_pad_alloc_map[0x200 / BITS_PER_LONG];
|
||||
|
||||
|
@ -45,14 +45,14 @@ int mxc_iomux_v3_setup_pad(struct pad_desc *pad)
|
|||
if (test_and_set_bit(pad_ofs >> 2, iomux_v3_pad_alloc_map))
|
||||
return -EBUSY;
|
||||
if (pad->mux_ctrl_ofs)
|
||||
__raw_writel(pad->mux_mode, IOMUX_BASE + pad->mux_ctrl_ofs);
|
||||
__raw_writel(pad->mux_mode, base + pad->mux_ctrl_ofs);
|
||||
|
||||
if (pad->select_input_ofs)
|
||||
__raw_writel(pad->select_input,
|
||||
IOMUX_BASE + pad->select_input_ofs);
|
||||
base + pad->select_input_ofs);
|
||||
|
||||
if (!(pad->pad_ctrl & NO_PAD_CTRL))
|
||||
__raw_writel(pad->pad_ctrl, IOMUX_BASE + pad->pad_ctrl_ofs);
|
||||
if (!(pad->pad_ctrl & NO_PAD_CTRL) && pad->pad_ctrl_ofs)
|
||||
__raw_writel(pad->pad_ctrl, base + pad->pad_ctrl_ofs);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_iomux_v3_setup_pad);
|
||||
|
@ -96,3 +96,8 @@ void mxc_iomux_v3_release_multiple_pads(struct pad_desc *pad_list, int count)
|
|||
}
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_iomux_v3_release_multiple_pads);
|
||||
|
||||
void mxc_iomux_v3_init(void __iomem *iomux_v3_base)
|
||||
{
|
||||
base = iomux_v3_base;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue