Commit 6134b2cb authored by Sascha Hauer's avatar Sascha Hauer

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: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent fc2a9f0b
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <mach/common.h> #include <mach/common.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/iomux-v3.h>
/*! /*!
* @file mm.c * @file mm.c
...@@ -83,6 +84,7 @@ void __init mx31_map_io(void) ...@@ -83,6 +84,7 @@ void __init mx31_map_io(void)
void __init mx35_map_io(void) void __init mx35_map_io(void)
{ {
mxc_set_cpu_type(MXC_CPU_MX35); 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)); mxc_arch_reset_init(IO_ADDRESS(WDOG_BASE_ADDR));
iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
......
...@@ -113,5 +113,10 @@ void mxc_iomux_v3_release_pad(struct pad_desc *pad); ...@@ -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); 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__*/ #endif /* __MACH_IOMUX_V3_H__*/
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/iomux-v3.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]; 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) ...@@ -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)) if (test_and_set_bit(pad_ofs >> 2, iomux_v3_pad_alloc_map))
return -EBUSY; return -EBUSY;
if (pad->mux_ctrl_ofs) 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) if (pad->select_input_ofs)
__raw_writel(pad->select_input, __raw_writel(pad->select_input,
IOMUX_BASE + pad->select_input_ofs); base + pad->select_input_ofs);
if (!(pad->pad_ctrl & NO_PAD_CTRL)) if (!(pad->pad_ctrl & NO_PAD_CTRL) && pad->pad_ctrl_ofs)
__raw_writel(pad->pad_ctrl, IOMUX_BASE + pad->pad_ctrl_ofs); __raw_writel(pad->pad_ctrl, base + pad->pad_ctrl_ofs);
return 0; return 0;
} }
EXPORT_SYMBOL(mxc_iomux_v3_setup_pad); 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) ...@@ -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); EXPORT_SYMBOL(mxc_iomux_v3_release_multiple_pads);
void mxc_iomux_v3_init(void __iomem *iomux_v3_base)
{
base = iomux_v3_base;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment