diff options
Diffstat (limited to 'arch/arm/plat-mxc')
| -rw-r--r-- | arch/arm/plat-mxc/Kconfig | 4 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/Makefile | 1 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/devices/platform-esdhc.c | 56 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/devices/platform-imx-i2c.c | 1 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/board-mx31ads.h | 33 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/devices-common.h | 10 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/eukrea-baseboards.h | 5 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/iomux-mx51.h | 59 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/iram.h | 41 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/mx25.h | 6 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/mx35.h | 6 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/mx51.h | 16 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/system.h | 32 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/uncompress.h | 1 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/iram_alloc.c | 73 |
15 files changed, 294 insertions, 50 deletions
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig index 95f8d614d4fc..64e3a64520e0 100644 --- a/arch/arm/plat-mxc/Kconfig +++ b/arch/arm/plat-mxc/Kconfig | |||
| @@ -122,4 +122,8 @@ config ARCH_MXC_AUDMUX_V1 | |||
| 122 | config ARCH_MXC_AUDMUX_V2 | 122 | config ARCH_MXC_AUDMUX_V2 |
| 123 | bool | 123 | bool |
| 124 | 124 | ||
| 125 | config IRAM_ALLOC | ||
| 126 | bool | ||
| 127 | select GENERIC_ALLOCATOR | ||
| 128 | |||
| 125 | endif | 129 | endif |
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile index bb3443f9751a..06875b4dd70f 100644 --- a/arch/arm/plat-mxc/Makefile +++ b/arch/arm/plat-mxc/Makefile | |||
| @@ -10,6 +10,7 @@ obj-$(CONFIG_MXC_TZIC) += tzic.o | |||
| 10 | 10 | ||
| 11 | obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o | 11 | obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o |
| 12 | obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o | 12 | obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o |
| 13 | obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o | ||
| 13 | obj-$(CONFIG_MXC_PWM) += pwm.o | 14 | obj-$(CONFIG_MXC_PWM) += pwm.o |
| 14 | obj-$(CONFIG_USB_EHCI_MXC) += ehci.o | 15 | obj-$(CONFIG_USB_EHCI_MXC) += ehci.o |
| 15 | obj-$(CONFIG_MXC_ULPI) += ulpi.o | 16 | obj-$(CONFIG_MXC_ULPI) += ulpi.o |
diff --git a/arch/arm/plat-mxc/devices/platform-esdhc.c b/arch/arm/plat-mxc/devices/platform-esdhc.c index 68db2a22d2cd..2605bfa0dfb0 100644 --- a/arch/arm/plat-mxc/devices/platform-esdhc.c +++ b/arch/arm/plat-mxc/devices/platform-esdhc.c | |||
| @@ -6,26 +6,66 @@ | |||
| 6 | * Free Software Foundation. | 6 | * Free Software Foundation. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <mach/hardware.h> | ||
| 9 | #include <mach/devices-common.h> | 10 | #include <mach/devices-common.h> |
| 10 | #include <mach/esdhc.h> | 11 | #include <mach/esdhc.h> |
| 11 | 12 | ||
| 12 | struct platform_device *__init imx_add_esdhc(int id, | 13 | #define imx_esdhc_imx_data_entry_single(soc, _id, hwid) \ |
| 13 | resource_size_t iobase, resource_size_t iosize, | 14 | { \ |
| 14 | resource_size_t irq, | 15 | .id = _id, \ |
| 16 | .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \ | ||
| 17 | .irq = soc ## _INT_ESDHC ## hwid, \ | ||
| 18 | } | ||
| 19 | |||
| 20 | #define imx_esdhc_imx_data_entry(soc, id, hwid) \ | ||
| 21 | [id] = imx_esdhc_imx_data_entry_single(soc, id, hwid) | ||
| 22 | |||
| 23 | #ifdef CONFIG_ARCH_MX25 | ||
| 24 | const struct imx_esdhc_imx_data imx25_esdhc_data[] __initconst = { | ||
| 25 | #define imx25_esdhc_data_entry(_id, _hwid) \ | ||
| 26 | imx_esdhc_imx_data_entry(MX25, _id, _hwid) | ||
| 27 | imx25_esdhc_data_entry(0, 1), | ||
| 28 | imx25_esdhc_data_entry(1, 2), | ||
| 29 | }; | ||
| 30 | #endif /* ifdef CONFIG_ARCH_MX25 */ | ||
| 31 | |||
| 32 | #ifdef CONFIG_ARCH_MX35 | ||
| 33 | const struct imx_esdhc_imx_data imx35_esdhc_data[] __initconst = { | ||
| 34 | #define imx35_esdhc_data_entry(_id, _hwid) \ | ||
| 35 | imx_esdhc_imx_data_entry(MX35, _id, _hwid) | ||
| 36 | imx35_esdhc_data_entry(0, 1), | ||
| 37 | imx35_esdhc_data_entry(1, 2), | ||
| 38 | imx35_esdhc_data_entry(2, 3), | ||
| 39 | }; | ||
| 40 | #endif /* ifdef CONFIG_ARCH_MX35 */ | ||
| 41 | |||
| 42 | #ifdef CONFIG_ARCH_MX51 | ||
| 43 | const struct imx_esdhc_imx_data imx51_esdhc_data[] __initconst = { | ||
| 44 | #define imx51_esdhc_data_entry(_id, _hwid) \ | ||
| 45 | imx_esdhc_imx_data_entry(MX51, _id, _hwid) | ||
| 46 | imx51_esdhc_data_entry(0, 1), | ||
| 47 | imx51_esdhc_data_entry(1, 2), | ||
| 48 | imx51_esdhc_data_entry(2, 3), | ||
| 49 | imx51_esdhc_data_entry(3, 4), | ||
| 50 | }; | ||
| 51 | #endif /* ifdef CONFIG_ARCH_MX51 */ | ||
| 52 | |||
| 53 | struct platform_device *__init imx_add_esdhc( | ||
| 54 | const struct imx_esdhc_imx_data *data, | ||
| 15 | const struct esdhc_platform_data *pdata) | 55 | const struct esdhc_platform_data *pdata) |
| 16 | { | 56 | { |
| 17 | struct resource res[] = { | 57 | struct resource res[] = { |
| 18 | { | 58 | { |
| 19 | .start = iobase, | 59 | .start = data->iobase, |
| 20 | .end = iobase + iosize - 1, | 60 | .end = data->iobase + SZ_16K - 1, |
| 21 | .flags = IORESOURCE_MEM, | 61 | .flags = IORESOURCE_MEM, |
| 22 | }, { | 62 | }, { |
| 23 | .start = irq, | 63 | .start = data->irq, |
| 24 | .end = irq, | 64 | .end = data->irq, |
| 25 | .flags = IORESOURCE_IRQ, | 65 | .flags = IORESOURCE_IRQ, |
| 26 | }, | 66 | }, |
| 27 | }; | 67 | }; |
| 28 | 68 | ||
| 29 | return imx_add_platform_device("sdhci-esdhc-imx", id, res, | 69 | return imx_add_platform_device("sdhci-esdhc-imx", data->id, res, |
| 30 | ARRAY_SIZE(res), pdata, sizeof(*pdata)); | 70 | ARRAY_SIZE(res), pdata, sizeof(*pdata)); |
| 31 | } | 71 | } |
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/plat-mxc/devices/platform-imx-i2c.c index ca988d40a3d7..679588453aad 100644 --- a/arch/arm/plat-mxc/devices/platform-imx-i2c.c +++ b/arch/arm/plat-mxc/devices/platform-imx-i2c.c | |||
| @@ -65,6 +65,7 @@ const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = { | |||
| 65 | imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K) | 65 | imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K) |
| 66 | imx35_imx_i2c_data_entry(0, 1), | 66 | imx35_imx_i2c_data_entry(0, 1), |
| 67 | imx35_imx_i2c_data_entry(1, 2), | 67 | imx35_imx_i2c_data_entry(1, 2), |
| 68 | imx35_imx_i2c_data_entry(2, 3), | ||
| 68 | }; | 69 | }; |
| 69 | #endif /* ifdef CONFIG_ARCH_MX35 */ | 70 | #endif /* ifdef CONFIG_ARCH_MX35 */ |
| 70 | 71 | ||
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h new file mode 100644 index 000000000000..94b60dd47137 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/board-mx31ads.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
| 3 | */ | ||
| 4 | |||
| 5 | /* | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef __ASM_ARCH_MXC_BOARD_MX31ADS_H__ | ||
| 12 | #define __ASM_ARCH_MXC_BOARD_MX31ADS_H__ | ||
| 13 | |||
| 14 | #include <mach/hardware.h> | ||
| 15 | |||
| 16 | /* | ||
| 17 | * These symbols are used by drivers/net/cs89x0.c. | ||
| 18 | * This is ugly as hell, but we have to provide them until | ||
| 19 | * someone fixed the driver. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* Base address of PBC controller */ | ||
| 23 | #define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT | ||
| 24 | /* Offsets for the PBC Controller register */ | ||
| 25 | |||
| 26 | /* Ethernet Controller IO base address */ | ||
| 27 | #define PBC_CS8900A_IOBASE 0x020000 | ||
| 28 | |||
| 29 | #define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START) | ||
| 30 | |||
| 31 | #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8) | ||
| 32 | |||
| 33 | #endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */ | ||
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index 049897880403..86d7575a564d 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
| @@ -108,7 +108,11 @@ struct platform_device *__init imx_add_spi_imx( | |||
| 108 | const struct spi_imx_master *pdata); | 108 | const struct spi_imx_master *pdata); |
| 109 | 109 | ||
| 110 | #include <mach/esdhc.h> | 110 | #include <mach/esdhc.h> |
| 111 | struct platform_device *__init imx_add_esdhc(int id, | 111 | struct imx_esdhc_imx_data { |
| 112 | resource_size_t iobase, resource_size_t iosize, | 112 | int id; |
| 113 | resource_size_t irq, | 113 | resource_size_t iobase; |
| 114 | resource_size_t irq; | ||
| 115 | }; | ||
| 116 | struct platform_device *__init imx_add_esdhc( | ||
| 117 | const struct imx_esdhc_imx_data *data, | ||
| 114 | const struct esdhc_platform_data *pdata); | 118 | const struct esdhc_platform_data *pdata); |
diff --git a/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h b/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h index 656acb45d434..a21d3313f994 100644 --- a/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h +++ b/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h | |||
| @@ -28,19 +28,22 @@ | |||
| 28 | * its own devices, it calls baseboard's init function. | 28 | * its own devices, it calls baseboard's init function. |
| 29 | * TODO: Add your own baseboard init function and call it from | 29 | * TODO: Add your own baseboard init function and call it from |
| 30 | * inside eukrea_cpuimx25_init() eukrea_cpuimx27_init() | 30 | * inside eukrea_cpuimx25_init() eukrea_cpuimx27_init() |
| 31 | * eukrea_cpuimx35_init() or eukrea_cpuimx51_init(). | 31 | * eukrea_cpuimx35_init() eukrea_cpuimx51_init() |
| 32 | * or eukrea_cpuimx51sd_init(). | ||
| 32 | * | 33 | * |
| 33 | * This example here is for the development board. Refer | 34 | * This example here is for the development board. Refer |
| 34 | * mach-mx25/eukrea_mbimxsd-baseboard.c for cpuimx25 | 35 | * mach-mx25/eukrea_mbimxsd-baseboard.c for cpuimx25 |
| 35 | * mach-imx/eukrea_mbimx27-baseboard.c for cpuimx27 | 36 | * mach-imx/eukrea_mbimx27-baseboard.c for cpuimx27 |
| 36 | * mach-mx3/eukrea_mbimxsd-baseboard.c for cpuimx35 | 37 | * mach-mx3/eukrea_mbimxsd-baseboard.c for cpuimx35 |
| 37 | * mach-mx5/eukrea_mbimx51-baseboard.c for cpuimx51 | 38 | * mach-mx5/eukrea_mbimx51-baseboard.c for cpuimx51 |
| 39 | * mach-mx5/eukrea_mbimxsd-baseboard.c for cpuimx51sd | ||
| 38 | */ | 40 | */ |
| 39 | 41 | ||
| 40 | extern void eukrea_mbimxsd25_baseboard_init(void); | 42 | extern void eukrea_mbimxsd25_baseboard_init(void); |
| 41 | extern void eukrea_mbimx27_baseboard_init(void); | 43 | extern void eukrea_mbimx27_baseboard_init(void); |
| 42 | extern void eukrea_mbimxsd35_baseboard_init(void); | 44 | extern void eukrea_mbimxsd35_baseboard_init(void); |
| 43 | extern void eukrea_mbimx51_baseboard_init(void); | 45 | extern void eukrea_mbimx51_baseboard_init(void); |
| 46 | extern void eukrea_mbimxsd51_baseboard_init(void); | ||
| 44 | 47 | ||
| 45 | #endif | 48 | #endif |
| 46 | 49 | ||
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h index 5160f1073ec9..e46b1c2836d4 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h +++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h | |||
| @@ -47,6 +47,9 @@ typedef enum iomux_config { | |||
| 47 | PAD_CTL_SRE_FAST) | 47 | PAD_CTL_SRE_FAST) |
| 48 | #define MX51_ECSPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \ | 48 | #define MX51_ECSPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \ |
| 49 | PAD_CTL_SRE_FAST) | 49 | PAD_CTL_SRE_FAST) |
| 50 | #define MX51_SDHCI_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PUS_47K_UP | \ | ||
| 51 | PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_SRE_FAST | \ | ||
| 52 | PAD_CTL_DVS) | ||
| 50 | 53 | ||
| 51 | #define MX51_PAD_CTRL_1 (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \ | 54 | #define MX51_PAD_CTRL_1 (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \ |
| 52 | PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_HYS) | 55 | PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_HYS) |
| @@ -333,38 +336,50 @@ typedef enum iomux_config { | |||
| 333 | #define MX51_PAD_DISP2_DAT13__DISP2_DAT13 IOMUX_PAD(0x790, 0x388, 0, 0x0, 0, NO_PAD_CTRL) | 336 | #define MX51_PAD_DISP2_DAT13__DISP2_DAT13 IOMUX_PAD(0x790, 0x388, 0, 0x0, 0, NO_PAD_CTRL) |
| 334 | #define MX51_PAD_DISP2_DAT14__DISP2_DAT14 IOMUX_PAD(0x794, 0x38C, 0, 0x0, 0, NO_PAD_CTRL) | 337 | #define MX51_PAD_DISP2_DAT14__DISP2_DAT14 IOMUX_PAD(0x794, 0x38C, 0, 0x0, 0, NO_PAD_CTRL) |
| 335 | #define MX51_PAD_DISP2_DAT15__DISP2_DAT15 IOMUX_PAD(0x798, 0x390, 0, 0x0, 0, NO_PAD_CTRL) | 338 | #define MX51_PAD_DISP2_DAT15__DISP2_DAT15 IOMUX_PAD(0x798, 0x390, 0, 0x0, 0, NO_PAD_CTRL) |
| 336 | #define MX51_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x79C, 0x394, 0, 0x0, 0, NO_PAD_CTRL) | 339 | #define MX51_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x79C, 0x394, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 340 | MX51_SDHCI_PAD_CTRL) | ||
| 337 | #define MX51_PAD_SD1_CMD__AUD5_RXFS IOMUX_PAD(0x79C, 0x394, 1, 0x8e0, 1, NO_PAD_CTRL) | 341 | #define MX51_PAD_SD1_CMD__AUD5_RXFS IOMUX_PAD(0x79C, 0x394, 1, 0x8e0, 1, NO_PAD_CTRL) |
| 338 | #define MX51_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x7A0, 0x398, 0, 0x0, 0, NO_PAD_CTRL) | 342 | #define MX51_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x7A0, 0x398, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 343 | MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS) | ||
| 339 | #define MX51_PAD_SD1_CLK__AUD5_RXC IOMUX_PAD(0x7A0, 0x398, 1, 0x8dc, 1, NO_PAD_CTRL) | 344 | #define MX51_PAD_SD1_CLK__AUD5_RXC IOMUX_PAD(0x7A0, 0x398, 1, 0x8dc, 1, NO_PAD_CTRL) |
| 340 | #define MX51_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x7A4, 0x39C, 0, 0x0, 0, NO_PAD_CTRL) | 345 | #define MX51_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x7A4, 0x39C, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 346 | MX51_SDHCI_PAD_CTRL) | ||
| 341 | #define MX51_PAD_SD1_DATA0__AUD5_TXD IOMUX_PAD(0x7A4, 0x39C, 1, 0x8d8, 2, NO_PAD_CTRL) | 347 | #define MX51_PAD_SD1_DATA0__AUD5_TXD IOMUX_PAD(0x7A4, 0x39C, 1, 0x8d8, 2, NO_PAD_CTRL) |
| 342 | #define MX51_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x7A8, 0x3A0, 0, 0x0, 0, NO_PAD_CTRL) | 348 | #define MX51_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x7A8, 0x3A0, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 349 | MX51_SDHCI_PAD_CTRL) | ||
| 343 | #define MX51_PAD_SD1_DATA1__AUD5_RXD IOMUX_PAD(0x7A8, 0x3A0, 1, 0x8d4, 2, NO_PAD_CTRL) | 350 | #define MX51_PAD_SD1_DATA1__AUD5_RXD IOMUX_PAD(0x7A8, 0x3A0, 1, 0x8d4, 2, NO_PAD_CTRL) |
| 344 | #define MX51_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x7AC, 0x3A4, 0, 0x0, 0, NO_PAD_CTRL) | 351 | #define MX51_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x7AC, 0x3A4, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 352 | MX51_SDHCI_PAD_CTRL) | ||
| 345 | #define MX51_PAD_SD1_DATA2__AUD5_TXC IOMUX_PAD(0x7AC, 0x3A4, 1, 0x8e4, 2, NO_PAD_CTRL) | 353 | #define MX51_PAD_SD1_DATA2__AUD5_TXC IOMUX_PAD(0x7AC, 0x3A4, 1, 0x8e4, 2, NO_PAD_CTRL) |
| 346 | #define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7B0, 0x3A8, 0, 0x0, 0, NO_PAD_CTRL) | 354 | #define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7B0, 0x3A8, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 355 | MX51_SDHCI_PAD_CTRL) | ||
| 347 | #define MX51_PAD_SD1_DATA3__AUD5_TXFS IOMUX_PAD(0x7B0, 0x3A8, 1, 0x8e8, 2, NO_PAD_CTRL) | 356 | #define MX51_PAD_SD1_DATA3__AUD5_TXFS IOMUX_PAD(0x7B0, 0x3A8, 1, 0x8e8, 2, NO_PAD_CTRL) |
| 348 | #define MX51_PAD_GPIO_1_0__GPIO_1_0 IOMUX_PAD(0x7B4, 0x3AC, 1, 0x0, 0, NO_PAD_CTRL) | 357 | #define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7BC, 0x3B4, IOMUX_CONFIG_SION, 0x0, 1, \ |
| 349 | #define MX51_PAD_GPIO_1_1__GPIO_1_1 IOMUX_PAD(0x7B8, 0x3B0, 1, 0x0, 0, NO_PAD_CTRL) | 358 | MX51_SDHCI_PAD_CTRL) |
| 350 | #define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7BC, 0x3B4, 0, 0x0, 0, NO_PAD_CTRL) | 359 | #define MX51_PAD_SD2_CLK__SD2_CLK IOMUX_PAD(0x7C0, 0x3B8, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 351 | #define MX51_PAD_SD2_CLK__SD2_CLK IOMUX_PAD(0x7C0, 0x3B8, 0, 0x0, 0, NO_PAD_CTRL) | 360 | MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS) |
| 352 | #define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7C4, 0x3BC, 0, 0x0, 0, NO_PAD_CTRL) | 361 | #define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7C4, 0x3BC, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 353 | #define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7C8, 0x3C0, 0, 0x0, 0, NO_PAD_CTRL) | 362 | MX51_SDHCI_PAD_CTRL) |
| 354 | #define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7CC, 0x3C4, 0, 0x0, 0, NO_PAD_CTRL) | 363 | #define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7C8, 0x3C0, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 355 | #define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7D0, 0x3C8, 0, 0x0, 0, NO_PAD_CTRL) | 364 | MX51_SDHCI_PAD_CTRL) |
| 356 | #define MX51_PAD_GPIO_1_2__GPIO_1_2 IOMUX_PAD(0x7D4, 0x3CC, 0, 0x0, 0, NO_PAD_CTRL) | 365 | #define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7CC, 0x3C4, IOMUX_CONFIG_SION, 0x0, 0, \ |
| 366 | MX51_SDHCI_PAD_CTRL) | ||
| 367 | #define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7D0, 0x3C8, IOMUX_CONFIG_SION, 0x0, 0, \ | ||
| 368 | MX51_SDHCI_PAD_CTRL) | ||
| 369 | #define MX51_PAD_GPIO_1_0__GPIO_1_0 IOMUX_PAD(0x7B4, 0x3AC, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) | ||
| 370 | #define MX51_PAD_GPIO_1_1__GPIO_1_1 IOMUX_PAD(0x7B8, 0x3B0, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) | ||
| 371 | #define MX51_PAD_GPIO_1_2__GPIO_1_2 IOMUX_PAD(0x7D4, 0x3CC, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) | ||
| 357 | #define MX51_PAD_GPIO_1_2__I2C2_SCL IOMUX_PAD(0x7D4, 0x3CC, (2 | IOMUX_CONFIG_SION), \ | 372 | #define MX51_PAD_GPIO_1_2__I2C2_SCL IOMUX_PAD(0x7D4, 0x3CC, (2 | IOMUX_CONFIG_SION), \ |
| 358 | 0x9b8, 3, MX51_I2C_PAD_CTRL) | 373 | 0x9b8, 3, MX51_I2C_PAD_CTRL) |
| 359 | #define MX51_PAD_GPIO_1_3__GPIO_1_3 IOMUX_PAD(0x7D8, 0x3D0, 0, 0x0, 0, NO_PAD_CTRL) | 374 | #define MX51_PAD_GPIO_1_3__GPIO_1_3 IOMUX_PAD(0x7D8, 0x3D0, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) |
| 360 | #define MX51_PAD_GPIO_1_3__I2C2_SDA IOMUX_PAD(0x7D8, 0x3D0, (2 | IOMUX_CONFIG_SION), \ | 375 | #define MX51_PAD_GPIO_1_3__I2C2_SDA IOMUX_PAD(0x7D8, 0x3D0, (2 | IOMUX_CONFIG_SION), \ |
| 361 | 0x9bc, 3, MX51_I2C_PAD_CTRL) | 376 | 0x9bc, 3, MX51_I2C_PAD_CTRL) |
| 362 | #define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ IOMUX_PAD(0x7FC, 0x3D4, 0, 0x0, 0, NO_PAD_CTRL) | 377 | #define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ IOMUX_PAD(0x7FC, 0x3D4, 0, 0x0, 0, NO_PAD_CTRL) |
| 363 | #define MX51_PAD_GPIO_1_4__GPIO_1_4 IOMUX_PAD(0x804, 0x3D8, 0, 0x0, 0, NO_PAD_CTRL) | 378 | #define MX51_PAD_GPIO_1_4__GPIO_1_4 IOMUX_PAD(0x804, 0x3D8, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) |
| 364 | #define MX51_PAD_GPIO_1_5__GPIO_1_5 IOMUX_PAD(0x808, 0x3DC, 0, 0x0, 0, NO_PAD_CTRL) | 379 | #define MX51_PAD_GPIO_1_5__GPIO_1_5 IOMUX_PAD(0x808, 0x3DC, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) |
| 365 | #define MX51_PAD_GPIO_1_6__GPIO_1_6 IOMUX_PAD(0x80C, 0x3E0, 0, 0x0, 0, MX51_GPIO_PAD_CTRL) | 380 | #define MX51_PAD_GPIO_1_6__GPIO_1_6 IOMUX_PAD(0x80C, 0x3E0, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) |
| 366 | #define MX51_PAD_GPIO_1_7__GPIO_1_7 IOMUX_PAD(0x810, 0x3E4, 0, 0x0, 0, MX51_GPIO_PAD_CTRL) | 381 | #define MX51_PAD_GPIO_1_7__GPIO_1_7 IOMUX_PAD(0x810, 0x3E4, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) |
| 367 | #define MX51_PAD_GPIO_1_8__GPIO_1_8 IOMUX_PAD(0x814, 0x3E8, 0, 0x0, 1, MX51_GPIO_PAD_CTRL) | 382 | #define MX51_PAD_GPIO_1_8__GPIO_1_8 IOMUX_PAD(0x814, 0x3E8, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) |
| 368 | #define MX51_PAD_GPIO_1_9__GPIO_1_9 IOMUX_PAD(0x818, 0x3EC, 0, 0x0, 0, NO_PAD_CTRL) | 383 | #define MX51_PAD_GPIO_1_9__GPIO_1_9 IOMUX_PAD(0x818, 0x3EC, 1, 0x0, 0, MX51_GPIO_PAD_CTRL) |
| 369 | 384 | ||
| 370 | #endif /* __MACH_IOMUX_MX51_H__ */ | 385 | #endif /* __MACH_IOMUX_MX51_H__ */ |
diff --git a/arch/arm/plat-mxc/include/mach/iram.h b/arch/arm/plat-mxc/include/mach/iram.h new file mode 100644 index 000000000000..022690c33702 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/iram.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU General Public License | ||
| 6 | * as published by the Free Software Foundation; either version 2 | ||
| 7 | * of the License, or (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
| 17 | * MA 02110-1301, USA. | ||
| 18 | */ | ||
| 19 | #include <linux/errno.h> | ||
| 20 | |||
| 21 | #ifdef CONFIG_IRAM_ALLOC | ||
| 22 | |||
| 23 | int __init iram_init(unsigned long base, unsigned long size); | ||
| 24 | void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr); | ||
| 25 | void iram_free(unsigned long dma_addr, unsigned int size); | ||
| 26 | |||
| 27 | #else | ||
| 28 | |||
| 29 | static inline int __init iram_init(unsigned long base, unsigned long size) | ||
| 30 | { | ||
| 31 | return -ENOMEM; | ||
| 32 | } | ||
| 33 | |||
| 34 | static inline void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr) | ||
| 35 | { | ||
| 36 | return NULL; | ||
| 37 | } | ||
| 38 | |||
| 39 | static inline void iram_free(unsigned long base, unsigned long size) {} | ||
| 40 | |||
| 41 | #endif | ||
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h index 153dd1b2a473..cf46a45b0d4e 100644 --- a/arch/arm/plat-mxc/include/mach/mx25.h +++ b/arch/arm/plat-mxc/include/mach/mx25.h | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | #define MX25_ESDHC2_BASE_ADDR 0x53fb8000 | 54 | #define MX25_ESDHC2_BASE_ADDR 0x53fb8000 |
| 55 | #define MX25_LCDC_BASE_ADDR 0x53fbc000 | 55 | #define MX25_LCDC_BASE_ADDR 0x53fbc000 |
| 56 | #define MX25_KPP_BASE_ADDR 0x43fa8000 | 56 | #define MX25_KPP_BASE_ADDR 0x43fa8000 |
| 57 | #define MX25_SDMA_BASE_ADDR 0x53fd4000 | ||
| 57 | #define MX25_OTG_BASE_ADDR 0x53ff4000 | 58 | #define MX25_OTG_BASE_ADDR 0x53ff4000 |
| 58 | #define MX25_CSI_BASE_ADDR 0x53ff8000 | 59 | #define MX25_CSI_BASE_ADDR 0x53ff8000 |
| 59 | 60 | ||
| @@ -61,8 +62,8 @@ | |||
| 61 | #define MX25_INT_I2C1 3 | 62 | #define MX25_INT_I2C1 3 |
| 62 | #define MX25_INT_I2C2 4 | 63 | #define MX25_INT_I2C2 4 |
| 63 | #define MX25_INT_UART4 5 | 64 | #define MX25_INT_UART4 5 |
| 64 | #define MX25_INT_MMC_SDHC2 8 | 65 | #define MX25_INT_ESDHC2 8 |
| 65 | #define MX25_INT_MMC_SDHC1 9 | 66 | #define MX25_INT_ESDHC1 9 |
| 66 | #define MX25_INT_I2C3 10 | 67 | #define MX25_INT_I2C3 10 |
| 67 | #define MX25_INT_SSI2 11 | 68 | #define MX25_INT_SSI2 11 |
| 68 | #define MX25_INT_SSI1 12 | 69 | #define MX25_INT_SSI1 12 |
| @@ -74,6 +75,7 @@ | |||
| 74 | #define MX25_INT_DRYICE 25 | 75 | #define MX25_INT_DRYICE 25 |
| 75 | #define MX25_INT_UART2 32 | 76 | #define MX25_INT_UART2 32 |
| 76 | #define MX25_INT_NFC 33 | 77 | #define MX25_INT_NFC 33 |
| 78 | #define MX25_INT_SDMA 34 | ||
| 77 | #define MX25_INT_LCDC 39 | 79 | #define MX25_INT_LCDC 39 |
| 78 | #define MX25_INT_UART5 40 | 80 | #define MX25_INT_UART5 40 |
| 79 | #define MX25_INT_CAN1 43 | 81 | #define MX25_INT_CAN1 43 |
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h index cb071b7b17e5..ff905cb32458 100644 --- a/arch/arm/plat-mxc/include/mach/mx35.h +++ b/arch/arm/plat-mxc/include/mach/mx35.h | |||
| @@ -128,9 +128,9 @@ | |||
| 128 | #define MX35_INT_I2C3 3 | 128 | #define MX35_INT_I2C3 3 |
| 129 | #define MX35_INT_I2C2 4 | 129 | #define MX35_INT_I2C2 4 |
| 130 | #define MX35_INT_RTIC 6 | 130 | #define MX35_INT_RTIC 6 |
| 131 | #define MX35_INT_MMC_SDHC1 7 | 131 | #define MX35_INT_ESDHC1 7 |
| 132 | #define MX35_INT_MMC_SDHC2 8 | 132 | #define MX35_INT_ESDHC2 8 |
| 133 | #define MX35_INT_MMC_SDHC3 9 | 133 | #define MX35_INT_ESDHC3 9 |
| 134 | #define MX35_INT_I2C1 10 | 134 | #define MX35_INT_I2C1 10 |
| 135 | #define MX35_INT_SSI1 11 | 135 | #define MX35_INT_SSI1 11 |
| 136 | #define MX35_INT_SSI2 12 | 136 | #define MX35_INT_SSI2 12 |
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/plat-mxc/include/mach/mx51.h index c54b5c32d82e..2af7a1056fc1 100644 --- a/arch/arm/plat-mxc/include/mach/mx51.h +++ b/arch/arm/plat-mxc/include/mach/mx51.h | |||
| @@ -64,13 +64,13 @@ | |||
| 64 | #define MX51_SPBA0_BASE_ADDR_VIRT 0xfb100000 | 64 | #define MX51_SPBA0_BASE_ADDR_VIRT 0xfb100000 |
| 65 | #define MX51_SPBA0_SIZE SZ_1M | 65 | #define MX51_SPBA0_SIZE SZ_1M |
| 66 | 66 | ||
| 67 | #define MX51_MMC_SDHC1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x04000) | 67 | #define MX51_ESDHC1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x04000) |
| 68 | #define MX51_MMC_SDHC2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x08000) | 68 | #define MX51_ESDHC2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x08000) |
| 69 | #define MX51_UART3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x0c000) | 69 | #define MX51_UART3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x0c000) |
| 70 | #define MX51_ECSPI1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x10000) | 70 | #define MX51_ECSPI1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x10000) |
| 71 | #define MX51_SSI2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x14000) | 71 | #define MX51_SSI2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x14000) |
| 72 | #define MX51_MMC_SDHC3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x20000) | 72 | #define MX51_ESDHC3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x20000) |
| 73 | #define MX51_MMC_SDHC4_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x24000) | 73 | #define MX51_ESDHC4_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x24000) |
| 74 | #define MX51_SPDIF_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x28000) | 74 | #define MX51_SPDIF_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x28000) |
| 75 | #define MX51_ATA_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x30000) | 75 | #define MX51_ATA_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x30000) |
| 76 | #define MX51_SLIM_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x34000) | 76 | #define MX51_SLIM_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x34000) |
| @@ -280,10 +280,10 @@ | |||
| 280 | */ | 280 | */ |
| 281 | #define MX51_MXC_INT_BASE 0 | 281 | #define MX51_MXC_INT_BASE 0 |
| 282 | #define MX51_MXC_INT_RESV0 0 | 282 | #define MX51_MXC_INT_RESV0 0 |
| 283 | #define MX51_MXC_INT_MMC_SDHC1 1 | 283 | #define MX51_INT_ESDHC1 1 |
| 284 | #define MX51_MXC_INT_MMC_SDHC2 2 | 284 | #define MX51_INT_ESDHC2 2 |
| 285 | #define MX51_MXC_INT_MMC_SDHC3 3 | 285 | #define MX51_INT_ESDHC3 3 |
| 286 | #define MX51_MXC_INT_MMC_SDHC4 4 | 286 | #define MX51_INT_ESDHC4 4 |
| 287 | #define MX51_MXC_INT_RESV5 5 | 287 | #define MX51_MXC_INT_RESV5 5 |
| 288 | #define MX51_INT_SDMA 6 | 288 | #define MX51_INT_SDMA 6 |
| 289 | #define MX51_MXC_INT_IOMUX 7 | 289 | #define MX51_MXC_INT_IOMUX 7 |
diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h index 4acd1143a9bd..95be51bfe9a9 100644 --- a/arch/arm/plat-mxc/include/mach/system.h +++ b/arch/arm/plat-mxc/include/mach/system.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 1999 ARM Limited | 2 | * Copyright (C) 1999 ARM Limited |
| 3 | * Copyright (C) 2000 Deep Blue Solutions Ltd | 3 | * Copyright (C) 2000 Deep Blue Solutions Ltd |
| 4 | * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. | 4 | * Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved. |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -28,8 +28,34 @@ static inline void arch_idle(void) | |||
| 28 | mxc91231_prepare_idle(); | 28 | mxc91231_prepare_idle(); |
| 29 | } | 29 | } |
| 30 | #endif | 30 | #endif |
| 31 | 31 | /* fix i.MX31 errata TLSbo65953 and i.MX35 errata ENGcm09472 */ | |
| 32 | cpu_do_idle(); | 32 | if (cpu_is_mx31() || cpu_is_mx35()) { |
| 33 | unsigned long reg = 0; | ||
| 34 | __asm__ __volatile__( | ||
| 35 | /* disable I and D cache */ | ||
| 36 | "mrc p15, 0, %0, c1, c0, 0\n" | ||
| 37 | "bic %0, %0, #0x00001000\n" | ||
| 38 | "bic %0, %0, #0x00000004\n" | ||
| 39 | "mcr p15, 0, %0, c1, c0, 0\n" | ||
| 40 | /* invalidate I cache */ | ||
| 41 | "mov %0, #0\n" | ||
| 42 | "mcr p15, 0, %0, c7, c5, 0\n" | ||
| 43 | /* clear and invalidate D cache */ | ||
| 44 | "mov %0, #0\n" | ||
| 45 | "mcr p15, 0, %0, c7, c14, 0\n" | ||
| 46 | /* WFI */ | ||
| 47 | "mov %0, #0\n" | ||
| 48 | "mcr p15, 0, %0, c7, c0, 4\n" | ||
| 49 | "nop\n" "nop\n" "nop\n" "nop\n" | ||
| 50 | "nop\n" "nop\n" "nop\n" | ||
| 51 | /* enable I and D cache */ | ||
| 52 | "mrc p15, 0, %0, c1, c0, 0\n" | ||
| 53 | "orr %0, %0, #0x00001000\n" | ||
| 54 | "orr %0, %0, #0x00000004\n" | ||
| 55 | "mcr p15, 0, %0, c1, c0, 0\n" | ||
| 56 | : "=r" (reg)); | ||
| 57 | } else | ||
| 58 | cpu_do_idle(); | ||
| 33 | } | 59 | } |
| 34 | 60 | ||
| 35 | void arch_reset(char mode, const char *cmd); | 61 | void arch_reset(char mode, const char *cmd); |
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h index d9bd37e4667a..9dd9c2085aad 100644 --- a/arch/arm/plat-mxc/include/mach/uncompress.h +++ b/arch/arm/plat-mxc/include/mach/uncompress.h | |||
| @@ -99,6 +99,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id) | |||
| 99 | uart_base = MX3X_UART2_BASE_ADDR; | 99 | uart_base = MX3X_UART2_BASE_ADDR; |
| 100 | break; | 100 | break; |
| 101 | case MACH_TYPE_MX51_BABBAGE: | 101 | case MACH_TYPE_MX51_BABBAGE: |
| 102 | case MACH_TYPE_EUKREA_CPUIMX51SD: | ||
| 102 | uart_base = MX51_UART1_BASE_ADDR; | 103 | uart_base = MX51_UART1_BASE_ADDR; |
| 103 | break; | 104 | break; |
| 104 | default: | 105 | default: |
diff --git a/arch/arm/plat-mxc/iram_alloc.c b/arch/arm/plat-mxc/iram_alloc.c new file mode 100644 index 000000000000..074c3869626a --- /dev/null +++ b/arch/arm/plat-mxc/iram_alloc.c | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU General Public License | ||
| 6 | * as published by the Free Software Foundation; either version 2 | ||
| 7 | * of the License, or (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
| 17 | * MA 02110-1301, USA. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/kernel.h> | ||
| 21 | #include <linux/io.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | #include <linux/spinlock.h> | ||
| 24 | #include <linux/genalloc.h> | ||
| 25 | #include <mach/iram.h> | ||
| 26 | |||
| 27 | static unsigned long iram_phys_base; | ||
| 28 | static void __iomem *iram_virt_base; | ||
| 29 | static struct gen_pool *iram_pool; | ||
| 30 | |||
| 31 | static inline void __iomem *iram_phys_to_virt(unsigned long p) | ||
| 32 | { | ||
| 33 | return iram_virt_base + (p - iram_phys_base); | ||
| 34 | } | ||
| 35 | |||
| 36 | void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr) | ||
| 37 | { | ||
| 38 | if (!iram_pool) | ||
| 39 | return NULL; | ||
| 40 | |||
| 41 | *dma_addr = gen_pool_alloc(iram_pool, size); | ||
| 42 | pr_debug("iram alloc - %dB@0x%lX\n", size, *dma_addr); | ||
| 43 | if (!*dma_addr) | ||
| 44 | return NULL; | ||
| 45 | return iram_phys_to_virt(*dma_addr); | ||
| 46 | } | ||
| 47 | EXPORT_SYMBOL(iram_alloc); | ||
| 48 | |||
| 49 | void iram_free(unsigned long addr, unsigned int size) | ||
| 50 | { | ||
| 51 | if (!iram_pool) | ||
| 52 | return; | ||
| 53 | |||
| 54 | gen_pool_free(iram_pool, addr, size); | ||
| 55 | } | ||
| 56 | EXPORT_SYMBOL(iram_free); | ||
| 57 | |||
| 58 | int __init iram_init(unsigned long base, unsigned long size) | ||
| 59 | { | ||
| 60 | iram_phys_base = base; | ||
| 61 | |||
| 62 | iram_pool = gen_pool_create(PAGE_SHIFT, -1); | ||
| 63 | if (!iram_pool) | ||
| 64 | return -ENOMEM; | ||
| 65 | |||
| 66 | gen_pool_add(iram_pool, base, size, -1); | ||
| 67 | iram_virt_base = ioremap(iram_phys_base, size); | ||
| 68 | if (!iram_virt_base) | ||
| 69 | return -EIO; | ||
| 70 | |||
| 71 | pr_debug("i.MX IRAM pool: %ld KB@0x%p\n", size / 1024, iram_virt_base); | ||
| 72 | return 0; | ||
| 73 | } | ||
