Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08ff97b5 authored by Uwe Kleine-König's avatar Uwe Kleine-König
Browse files

ARM: imx: use MXxy_IO_P2V macros to setup static mappings



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: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent f5d7a13b
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -25,12 +25,7 @@
#include <mach/hardware.h>

static struct map_desc imx_io_desc[] __initdata = {
	{
		.virtual = MX1_IO_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX1_IO_BASE_ADDR),
		.length = MX1_IO_SIZE,
		.type = MT_DEVICE
	}
	imx_map_entry(MX1, IO, MT_DEVICE),
};

void __init mx1_map_io(void)
+3 −18
Original line number Diff line number Diff line
@@ -35,33 +35,18 @@ static struct map_desc imx21_io_desc[] __initdata = {
	 * - ROM Patch
	 * - and some reserved space
	 */
	{
		.virtual = MX21_AIPI_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX21_AIPI_BASE_ADDR),
		.length = MX21_AIPI_SIZE,
		.type = MT_DEVICE
	},
	imx_map_entry(MX21, AIPI, MT_DEVICE),
	/*
	 * this fixed mapping covers:
	 * - CSI
	 * - ATA
	 */
	{
		.virtual = MX21_SAHB1_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX21_SAHB1_BASE_ADDR),
		.length = MX21_SAHB1_SIZE,
		.type = MT_DEVICE
	},
	imx_map_entry(MX21, SAHB1, MT_DEVICE),
	/*
	 * this fixed mapping covers:
	 * - EMI
	 */
	{
		.virtual = MX21_X_MEMC_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX21_X_MEMC_BASE_ADDR),
		.length = MX21_X_MEMC_SIZE,
		.type = MT_DEVICE
	},
	imx_map_entry(MX21, X_MEMC, MT_DEVICE),
};

/*
+3 −18
Original line number Diff line number Diff line
@@ -35,33 +35,18 @@ static struct map_desc imx27_io_desc[] __initdata = {
	 * - ROM Patch
	 * - and some reserved space
	 */
	{
		.virtual = MX27_AIPI_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX27_AIPI_BASE_ADDR),
		.length = MX27_AIPI_SIZE,
		.type = MT_DEVICE
	},
	imx_map_entry(MX27, AIPI, MT_DEVICE),
	/*
	 * this fixed mapping covers:
	 * - CSI
	 * - ATA
	 */
	{
		.virtual = MX27_SAHB1_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX27_SAHB1_BASE_ADDR),
		.length = MX27_SAHB1_SIZE,
		.type = MT_DEVICE
	},
	imx_map_entry(MX27, SAHB1, MT_DEVICE),
	/*
	 * this fixed mapping covers:
	 * - EMI
	 */
	{
		.virtual = MX27_X_MEMC_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX27_X_MEMC_BASE_ADDR),
		.length = MX27_X_MEMC_SIZE,
		.type = MT_DEVICE
	},
	imx_map_entry(MX27, X_MEMC, MT_DEVICE),
};

/*
+6 −19
Original line number Diff line number Diff line
@@ -30,25 +30,12 @@

/*
 * This table defines static virtual address mappings for I/O regions.
 * These are the mappings common across all MX3 boards.
 * These are the mappings common across all MX25 boards.
 */
static struct map_desc mxc_io_desc[] __initdata = {
	{
		.virtual	= MX25_AVIC_BASE_ADDR_VIRT,
		.pfn		= __phys_to_pfn(MX25_AVIC_BASE_ADDR),
		.length		= MX25_AVIC_SIZE,
		.type		= MT_DEVICE_NONSHARED
	}, {
		.virtual	= MX25_AIPS1_BASE_ADDR_VIRT,
		.pfn		= __phys_to_pfn(MX25_AIPS1_BASE_ADDR),
		.length		= MX25_AIPS1_SIZE,
		.type		= MT_DEVICE_NONSHARED
	}, {
		.virtual	= MX25_AIPS2_BASE_ADDR_VIRT,
		.pfn		= __phys_to_pfn(MX25_AIPS2_BASE_ADDR),
		.length		= MX25_AIPS2_SIZE,
		.type		= MT_DEVICE_NONSHARED
	},
static struct map_desc mx25_io_desc[] __initdata = {
	imx_map_entry(MX25, AVIC, MT_DEVICE_NONSHARED),
	imx_map_entry(MX25, AIPS1, MT_DEVICE_NONSHARED),
	imx_map_entry(MX25, AIPS2, MT_DEVICE_NONSHARED),
};

/*
@@ -62,7 +49,7 @@ void __init mx25_map_io(void)
	mxc_iomux_v3_init(MX25_IO_ADDRESS(MX25_IOMUXC_BASE_ADDR));
	mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR));

	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
	iotable_init(mx25_io_desc, ARRAY_SIZE(mx25_io_desc));
}

int imx25_register_gpios(void);
+19 −34
Original line number Diff line number Diff line
@@ -36,40 +36,16 @@
 * @ingroup Memory
 */

/*!
 * This table defines static virtual address mappings for I/O regions.
 * These are the mappings common across all MX3 boards.
 */
static struct map_desc mxc_io_desc[] __initdata = {
	{
		.virtual = MX3x_X_MEMC_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX3x_X_MEMC_BASE_ADDR),
		.length = MX3x_X_MEMC_SIZE,
		.type = MT_DEVICE
	}, {
		.virtual = MX3x_AVIC_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX3x_AVIC_BASE_ADDR),
		.length = MX3x_AVIC_SIZE,
		.type = MT_DEVICE_NONSHARED
	}, {
		.virtual = MX3x_AIPS1_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX3x_AIPS1_BASE_ADDR),
		.length = MX3x_AIPS1_SIZE,
		.type = MT_DEVICE_NONSHARED
	}, {
		.virtual = MX3x_AIPS2_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX3x_AIPS2_BASE_ADDR),
		.length = MX3x_AIPS2_SIZE,
		.type = MT_DEVICE_NONSHARED
	}, {
		.virtual = MX3x_SPBA0_BASE_ADDR_VIRT,
		.pfn = __phys_to_pfn(MX3x_SPBA0_BASE_ADDR),
		.length = MX3x_SPBA0_SIZE,
		.type = MT_DEVICE_NONSHARED
	},
#ifdef CONFIG_ARCH_MX31
static struct map_desc mx31_io_desc[] __initdata = {
	imx_map_entry(MX31, X_MEMC, MT_DEVICE),
	imx_map_entry(MX31, AVIC, MT_DEVICE_NONSHARED),
	imx_map_entry(MX31, AIPS1, MT_DEVICE_NONSHARED),
	imx_map_entry(MX31, AIPS2, MT_DEVICE_NONSHARED),
	imx_map_entry(MX31, SPBA0, MT_DEVICE_NONSHARED),
};

/*!
/*
 * This function initializes the memory map. It is called during the
 * system startup to create static physical to virtual memory mappings
 * for the IO modules.
@@ -79,17 +55,26 @@ void __init mx31_map_io(void)
	mxc_set_cpu_type(MXC_CPU_MX31);
	mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));

	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
	iotable_init(mx31_io_desc, ARRAY_SIZE(mx31_io_desc));
}
#endif

#ifdef CONFIG_ARCH_MX35
static struct map_desc mx35_io_desc[] __initdata = {
	imx_map_entry(MX35, X_MEMC, MT_DEVICE),
	imx_map_entry(MX35, AVIC, MT_DEVICE_NONSHARED),
	imx_map_entry(MX35, AIPS1, MT_DEVICE_NONSHARED),
	imx_map_entry(MX35, AIPS2, MT_DEVICE_NONSHARED),
	imx_map_entry(MX35, SPBA0, MT_DEVICE_NONSHARED),
};

void __init mx35_map_io(void)
{
	mxc_set_cpu_type(MXC_CPU_MX35);
	mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR));
	mxc_arch_reset_init(MX35_IO_ADDRESS(MX3x_WDOG_BASE_ADDR));

	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
}
#endif

Loading