It's inappropriate to call clk_prepare() in mxc_restart(), because the
restart routine could be called in atomic context. Move clk_get() and
clk_prepare() into mxc_arch_reset_init() and only have the atomic part
clk_enable() be called in mxc_restart().
As a result, mxc_arch_reset_init() needs to be called after clk gets
initialized.
While there, it also changes printk(KERN_ERR ...) to pr_err() and adds
__init annotation for mxc_arch_reset_init().
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
mxc_device_init() is a core_initcall function used to register devices
for mxc_aips_bus and mxc_ahb_bus, which are needed by gpio and dma
device registration.
Instead of being a core_initcall function, we have it called in soc
specific initialization function before gpio and dma devices get
registered, so that it will not be called for other platforms when
we enable multi-platform support for imx.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
It moves a bunch of header files included in hardware.h and itself
from mach-imx/include/mach to mach-imx, and updates users to include
hardware.h rather than mach/hardware.h. The files in mach-imx/devices
will need to include "../hardware.h".
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
It changes the driver to use platform_device_id rather than cpu_is_xxx
to determine the controller type, and updates the platform code
accordingly.
As the result, mach/hardware.h inclusion gets removed from the driver.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Javier Martin <javier.martin@vista-silicon.com>
Cc: Vinod Koul <vinod.koul@linux.intel.com>
Retrieve MEM and IRQ from resources rather than directly using the
value by including machine header.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Vinod Koul <vinod.koul@linux.intel.com>
Rename mach-imx/include/mach/common.h to mach-imx/common.h and update
all users to include common.h rather than mach/common.h.
It also removes an unneeded inclusion to common.h in
mach-imx/devices/devices.c.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
It moves platform device code from plat-mxc into mach-imx. Along with
that, header devices-common.h gets moved from plat-mxc/include/mach/
into mach-imx/devices/.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
The board files in mach-imx are the only users of iomux drivers and
headers. Move them into mach-imx from plat-mxc.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
It coverts audmux to a platform driver, so that it can be moved into
sound/soc/imx and adopt device tree support later.
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The patch removes all the uses of cpu_is_mx(). Instead, it utilizes
platform_device_id to distinguish the different gpio types, IMX1_GPIO
on i.mx1, IMX21_GPIO on i.mx21 and i.mx27, IMX31_GPIO on all other
i.mx SoCs.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
The patch follows the implementation of gpio-mxc device registration
to break the concentrated imx-dma device registration into soc
specific setup function. Then we can avoid the churn of "#ifdef"
and the cpu_is_mx checking on such a long list, which makes no sense,
considering more soc supports need to be added and we need to support
single image for multiple socs in the long run.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
On MX1, MX21 and MX27 each GPIO port has an address space of 256 bytes.
Fix the iosize for these platforms.
Tested on a mx27_3ds board that can boot fine after this change.
Cc: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The patch makes necessary changes on gpio-mxc as below to turn it
into an upstanding gpio driver.
* Add a list to save all mx2 ports references, so that
mx2_gpio_irq_handler can walk through all interrupt status
registers
* Use readl/writel to replace mach-specific accessors
__raw_readl/__raw_writel
* Change mxc_gpio_init into mxc_gpio_probe function
* Move "struct mxc_gpio_port" into gpio-mxc.c, as it needs not to
be public at all, and also make some other cleanup on
plat-mxc/include/mach/gpio.h at the same time
And the patch then migrates mach-imx and mach-mx5 to the updated
driver by adding corresponding platform devices.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This used to be done in .map_io which is supposed to only setup the
memory mapping.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This makes less code rely on the virtual constants.
To further simplify code and reduce the needed boilerplate when
defining the static mappings a new helper macro is defined in
mach/hardware.h.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
The commit 9a763bf "get rid of mxc_gpio_init" changed gpio_init
and irq_init sequence. Usually we will call set_irq_chained_handler
in gpio_init functions, this should be called after the irq_init
called, otherwise the chained irq can't get propoer irq_chip and this
irq will remain masked even we called set_irq_chained_handler.
Signed-off-by: Jason Wang <jason77.wang@gmail.com>
Tested-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This function is defined once for each imx family and so is in the way
when compiling a kernel for more than one SoC.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Finally all imx code should end up there, start with mach-mx2. While
touching all files rename some files to use a hyphen instead of an
underscore.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>