Skip to contentSkip to conversation

some more imx patches for 2.6.38

PATCH In review Uwe Kleine-König 9 participants 77 messages Nov 17, 2010 – Dec 2, 2010 2 messages not in the archive Page 1 of 2

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover some more imx patches for 2.6.38

Hello,

Some of the patches in this series are already in Sascha's tree, I resend them because several of them got minor fixes.

The highlights are that for most devices for i.MX1, i.MX21, i.MX25 and i.MX27 are allocated dynamically which reduces the memory footprint of the kernel. Moreover I moved support for i.MX25 to mach-imx targeting a multi-SoC-kernel for i.MX.

Later I want to do the same for mx3. I'm not sure about mx5 though. The discussion about integrating support for i.MX28 into mach-imx made me questioning if this is sensible. Well, we'll see.

Note that this series is hardly runtime tested, I only compile tested using the available imx defconfigs and two random defconfigs for i.MX25 and mxc91231. (I had to cherry-pick the usb build fixes already in the usb-tree and I marked SND_IMX_SOC as broken because I was to lazy to look for Sascha's fixes.)

The following changes since commit be6786ac738801d39cfd264ec88c352efd029578:

Merge branch 'l2x0-pull-rmk' of git://dev.omapzoom.org/pub/scm/santosh/kernel-omap4-base into devel-stable (2010-10-28 14:42:06 +0100)

are available in the git repository at:

git://git.pengutronix.de/git/ukl/linux-2.6.git imx-for-2.6.38

Alberto Panizzo (1):
ARM: mx3/mach-pcm037_eet: Fix section mismatch for eet_init_devices()

Uwe Kleine-K?nig (50):
ARM: mx3: fix the last users of IMX_NEEDS_DEPRECATED_SYMBOLS
ARM: imx: refactor the io mapping macro
ARM: imx: use MXxy_IO_P2V macros to setup static mappings
ARM: imx: remove last explicit users of virtual base address defines
ARM: imx: change static io mapping to use a function
ARM: imx/debug-macro: rework using the new io mapping macro
ARM: imx: remove deprecated symbols as all users are gone now
ARM: imx: dynamically allocate mxc_w1 devices
ARM: imx: remove unused devices
ARM: imx: dynamically allocate imx_udc device
ARM: imx: allow specifying a dma mask when creating a platform device
ARM: imx: dynamically allocate mx1-camera device
ARM: imx/gpio: remove some useless casts
ARM: imx: dynamically allocate mx2-camera device
ARM: imx: dynamically allocate imx2-wdt devices
ARM: imx: change the way flexcan devices are registered
ARM: imx: dynamically register imx-fb devices
ARM: mx3: enable SPI_IMX for better compile coverage
ARM: imx: dynamically allocate mxc_pwm devices
ARM: imx: dynamically register mxc-mmc devices
ARM: imx: dynamically allocate mxc-ehci devices
ARM: imx: dynamically allocate fsl-usb2-udc devices
ARM: imx: dynamically allocate imx-keypad devices
ARM: imx: dynamically allocate imx21-hcd devices
ARM: imx: remove now empty devices.h
ARM: imx: move registration of gpios to plat-mxc/gpio.c
ARM: mx25: dynamically allocate mxc-ehci devices
ARM: mx25: dynamically allocate fsl-usb2-udc devices
ARM: mx25: dynamically allocate mxc_pwm devices
ARM: mx25: move registration of gpios to plat-mxc/gpio.c
ARM: mx25: dynamically allocate imx-keypad devices
ARM: mx25: dynamically allocate imxdi_rtc devices
ARM: mx25: dynamically allocatate imx-fb devices
ARM: mx25: dynamically allocate imx2-wdt devices
ARM: mx25: dynamically allocate mx2-camera devices
ARM: mx25: remove now empty devices.h
ARM: imx: move mx25 support to mach-imx
ARM: imx: let IMX_HAVE_PLATFORM_IMX_FB select HAVE_FB_IMX
ARM: imx: let the machines select SOC_IMX{21,27}
ARM: imx: use SOC_IMX25 instead of ARCH_MX25 for multi-SoC
ARM: mx3: move registration of gpios to plat-mxc/gpio.c
ARM: mx3: use an MX35 constant in imx35 only code
ARM: mx3: introduce SOC_IMX31 and SOC_IMX35
ARM: mx3: dynamically register mxc-mmc devices
ARM: mx3: dynamically allocate mxc_rnga devices
ARM: mx3: dynamically allocate fsl-usb2-udc devices
ARM: mx3: dynamically allocate mxc-ehci devices
ARM: mx3: dynamically allocate imx2-wdt devices
ARM: mx3: dynamically allocate imx-keypad devices
ARM: mx3/mx35_3ds: Add watchdog support

 arch/arm/Makefile                                  |    2 +-
 arch/arm/configs/mx3_defconfig                     |    1 +
 arch/arm/mach-imx/Kconfig                          |  128 ++++-
 arch/arm/mach-imx/Makefile                         |    8 +-
 arch/arm/mach-imx/Makefile.boot                    |    4 +
 .../{mach-mx25/clock.c => mach-imx/clock-imx25.c}  |    0
 arch/arm/mach-imx/devices-imx21.h                  |   24 +
 arch/arm/mach-imx/devices-imx25.h                  |   86 +++
 arch/arm/mach-imx/devices-imx27.h                  |   35 ++
 arch/arm/mach-imx/devices.c                        |  553 --------------------
 arch/arm/mach-imx/devices.h                        |   29 -
 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c       |   17 +-
 .../eukrea_mbimxsd25-baseboard.c}                  |    6 +-
 arch/arm/mach-imx/mach-cpuimx27.c                  |   21 +-
 .../mach-eukrea_cpuimx25.c}                        |   17 +-
 arch/arm/mach-imx/mach-imx27_visstrim_m10.c        |   12 +-
 arch/arm/mach-imx/mach-imx27lite.c                 |    1 -
 arch/arm/mach-imx/mach-mx1ads.c                    |    1 -
 arch/arm/mach-imx/mach-mx21ads.c                   |   20 +-
 arch/arm/{mach-mx25 => mach-imx}/mach-mx25_3ds.c   |   16 +-
 arch/arm/mach-imx/mach-mx27_3ds.c                  |   11 +-
 arch/arm/mach-imx/mach-mx27ads.c                   |   17 +-
 arch/arm/mach-imx/mach-mxt_td60.c                  |   11 +-
 arch/arm/mach-imx/mach-pca100.c                    |   33 +-
 arch/arm/mach-imx/mach-pcm038.c                    |   12 +-
 arch/arm/mach-imx/mach-scb9328.c                   |    1 -
 arch/arm/mach-imx/mm-imx1.c                        |    7 +-
 arch/arm/mach-imx/mm-imx21.c                       |   21 +-
 arch/arm/{mach-mx25/mm.c => mach-imx/mm-imx25.c}   |   27 +-
 arch/arm/mach-imx/mm-imx27.c                       |   21 +-
 arch/arm/mach-imx/pcm970-baseboard.c               |   12 +-
 arch/arm/mach-mx25/Kconfig                         |   34 --
 arch/arm/mach-mx25/Makefile                        |    5 -
 arch/arm/mach-mx25/Makefile.boot                   |    3 -
 arch/arm/mach-mx25/devices-imx25.h                 |   54 --
 arch/arm/mach-mx25/devices.c                       |  308 -----------
 arch/arm/mach-mx25/devices.h                       |   13 -
 arch/arm/mach-mx3/Kconfig                          |   69 ++-
 arch/arm/mach-mx3/Makefile                         |    7 +-
 arch/arm/mach-mx3/devices-imx31.h                  |   27 +
 arch/arm/mach-mx3/devices-imx35.h                  |   32 +-
 arch/arm/mach-mx3/devices.c                        |  271 +---------
 arch/arm/mach-mx3/devices.h                        |   10 -
 arch/arm/mach-mx3/mach-armadillo5x0.c              |   14 +-
 arch/arm/mach-mx3/mach-cpuimx35.c                  |   20 +-
 arch/arm/mach-mx3/mach-kzm_arm11_01.c              |    6 +-
 arch/arm/mach-mx3/mach-mx31_3ds.c                  |   10 +-
 arch/arm/mach-mx3/mach-mx31lilly.c                 |    9 +-
 arch/arm/mach-mx3/mach-mx31lite.c                  |    5 +-
 arch/arm/mach-mx3/mach-mx31moboard.c               |   20 +-
 arch/arm/mach-mx3/mach-mx35_3ds.c                  |   11 +-
 arch/arm/mach-mx3/mach-pcm037.c                    |   23 +-
 arch/arm/mach-mx3/mach-pcm037_eet.c                |    2 +-
 arch/arm/mach-mx3/mach-pcm043.c                    |   16 +-
 arch/arm/mach-mx3/mm.c                             |   84 ++--
 arch/arm/mach-mx3/mx31lilly-db.c                   |    5 +-
 arch/arm/mach-mx3/mx31lite-db.c                    |    8 +-
 arch/arm/mach-mx3/mx31moboard-devboard.c           |   20 +-
 arch/arm/mach-mx3/mx31moboard-marxbot.c            |   21 +-
 arch/arm/mach-mx3/mx31moboard-smartbot.c           |   16 +-
 arch/arm/mach-mx5/mm.c                             |   35 +-
 arch/arm/mach-mxc91231/mm.c                        |   53 +--
 arch/arm/plat-mxc/Kconfig                          |    5 -
 arch/arm/plat-mxc/audmux-v2.c                      |    4 +-
 arch/arm/plat-mxc/devices.c                        |   23 +-
 arch/arm/plat-mxc/devices/Kconfig                  |   46 ++-
 arch/arm/plat-mxc/devices/Makefile                 |   14 +
 arch/arm/plat-mxc/devices/platform-esdhc.c         |    8 +-
 arch/arm/plat-mxc/devices/platform-fec.c           |    6 +-
 arch/arm/plat-mxc/devices/platform-flexcan.c       |   48 ++-
 arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c  |   56 ++
 arch/arm/plat-mxc/devices/platform-imx-dma.c       |   18 +-
 arch/arm/plat-mxc/devices/platform-imx-fb.c        |   52 ++
 arch/arm/plat-mxc/devices/platform-imx-i2c.c       |   12 +-
 arch/arm/plat-mxc/devices/platform-imx-keypad.c    |   62 +++
 arch/arm/plat-mxc/devices/platform-imx-ssi.c       |   12 +-
 arch/arm/plat-mxc/devices/platform-imx-uart.c      |   12 +-
 arch/arm/plat-mxc/devices/platform-imx2-wdt.c      |   56 ++
 arch/arm/plat-mxc/devices/platform-imx21-hcd.c     |   41 ++
 arch/arm/plat-mxc/devices/platform-imx_udc.c       |   75 +++
 arch/arm/plat-mxc/devices/platform-imxdi_rtc.c     |   41 ++
 arch/arm/plat-mxc/devices/platform-mx1-camera.c    |   42 ++
 arch/arm/plat-mxc/devices/platform-mx2-camera.c    |   64 +++
 arch/arm/plat-mxc/devices/platform-mxc-ehci.c      |   69 +++
 arch/arm/plat-mxc/devices/platform-mxc-mmc.c       |   72 +++
 arch/arm/plat-mxc/devices/platform-mxc_nand.c      |    8 +-
 arch/arm/plat-mxc/devices/platform-mxc_pwm.c       |   60 +++
 arch/arm/plat-mxc/devices/platform-mxc_rnga.c      |   56 ++
 arch/arm/plat-mxc/devices/platform-mxc_w1.c        |   50 ++
 arch/arm/plat-mxc/devices/platform-spi_imx.c       |   12 +-
 arch/arm/plat-mxc/ehci.c                           |    8 +-
 arch/arm/plat-mxc/gpio.c                           |   97 ++++-
 arch/arm/plat-mxc/include/mach/debug-macro.S       |   23 +-
 arch/arm/plat-mxc/include/mach/devices-common.h    |  153 ++++++-
 arch/arm/plat-mxc/include/mach/hardware.h          |   87 +++-
 arch/arm/plat-mxc/include/mach/imxfb.h             |    3 +
 arch/arm/plat-mxc/include/mach/mx1.h               |  155 +-----
 arch/arm/plat-mxc/include/mach/mx21.h              |   50 +--
 arch/arm/plat-mxc/include/mach/mx25.h              |   41 +-
 arch/arm/plat-mxc/include/mach/mx27.h              |  101 +---
 arch/arm/plat-mxc/include/mach/mx2x.h              |  149 ------
 arch/arm/plat-mxc/include/mach/mx31.h              |   71 +--
 arch/arm/plat-mxc/include/mach/mx35.h              |   48 +--
 arch/arm/plat-mxc/include/mach/mx3x.h              |  182 +-------
 arch/arm/plat-mxc/include/mach/mx51.h              |   42 +--
 arch/arm/plat-mxc/include/mach/mxc91231.h          |   23 +-
 106 files changed, 2033 insertions(+), 2589 deletions(-)
 rename arch/arm/{mach-mx25/clock.c => mach-imx/clock-imx25.c} (100%)
 create mode 100644 arch/arm/mach-imx/devices-imx25.h
 delete mode 100644 arch/arm/mach-imx/devices.c
 delete mode 100644 arch/arm/mach-imx/devices.h
 rename arch/arm/{mach-mx25/eukrea_mbimxsd-baseboard.c => mach-imx/eukrea_mbimxsd25-baseboard.c} (97%)
 rename arch/arm/{mach-mx25/mach-cpuimx25.c => mach-imx/mach-eukrea_cpuimx25.c} (90%)
 rename arch/arm/{mach-mx25 => mach-imx}/mach-mx25_3ds.c (92%)
 rename arch/arm/{mach-mx25/mm.c => mach-imx/mm-imx25.c} (69%)
 delete mode 100644 arch/arm/mach-mx25/Kconfig
 delete mode 100644 arch/arm/mach-mx25/Makefile
 delete mode 100644 arch/arm/mach-mx25/Makefile.boot
 delete mode 100644 arch/arm/mach-mx25/devices-imx25.h
 delete mode 100644 arch/arm/mach-mx25/devices.c
 delete mode 100644 arch/arm/mach-mx25/devices.h
 create mode 100644 arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx-fb.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx-keypad.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx2-wdt.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx21-hcd.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx_udc.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-imxdi_rtc.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-mx1-camera.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-mx2-camera.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc-ehci.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc-mmc.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc_pwm.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc_rnga.c
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc_w1.c
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#1 lore raw

PATCH 1/51 ARM: mx3: fix the last users of IMX_NEEDS_DEPRECATED_SYMBOLS

---
 arch/arm/mach-mx3/Makefile  |    3 --
 arch/arm/mach-mx3/devices.c |   69 +++++++++++++++++++++++--------------------
 arch/arm/mach-mx3/mm.c      |   48 +++++++++++++++---------------
 3 files changed, 61 insertions(+), 59 deletions(-)
arch/arm/mach-mx3/Makefile +0 -3
index 8a182d0a..7feb6c4 100644
@@ -5,8 +5,6 @@
 # Object file lists.
 
 obj-y				:= mm.o devices.o cpu.o
-CFLAGS_mm.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
-CFLAGS_devices.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
 obj-$(CONFIG_ARCH_MX31)		+= clock-imx31.o iomux-imx31.o
 obj-$(CONFIG_ARCH_MX35)		+= clock-imx35.o
 obj-$(CONFIG_MACH_MX31ADS)	+= mach-mx31ads.o
@@ -15,7 +13,6 @@ obj-$(CONFIG_MACH_MX31LITE)	+= mach-mx31lite.o mx31lite-db.o
 obj-$(CONFIG_MACH_PCM037)	+= mach-pcm037.o
 obj-$(CONFIG_MACH_PCM037_EET)	+= mach-pcm037_eet.o
 obj-$(CONFIG_MACH_MX31_3DS)	+= mach-mx31_3ds.o
-CFLAGS_mach-mx31_3ds.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
 obj-$(CONFIG_MACH_MX31MOBOARD)	+= mach-mx31moboard.o mx31moboard-devboard.o \
 				   mx31moboard-marxbot.o mx31moboard-smartbot.o
 obj-$(CONFIG_MACH_QONG)		+= mach-qong.o
arch/arm/mach-mx3/devices.c +37 -32

157 lines not on this page · raw message

arch/arm/mach-mx3/mm.c +24 -24

82 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/51 ARM: imx: refactor the io mapping macro

In reply to Uwe Kleine-König

This makes it more assembler friendly and allows it to be used in situation that need an unsigned long and not a pointer. Also the naming is clearer. IOMEM is introduced without IMX_ prefix as it is used this way in more than one ARM subarch and it might become globally available soon.

---
 arch/arm/mach-mx3/mach-kzm_arm11_01.c     |    6 +++---
 arch/arm/plat-mxc/include/mach/hardware.h |   13 +++++++++----
 arch/arm/plat-mxc/include/mach/mx1.h      |    5 +++--
 arch/arm/plat-mxc/include/mach/mx21.h     |    9 +++++----
 arch/arm/plat-mxc/include/mach/mx25.h     |    9 +++++----
 arch/arm/plat-mxc/include/mach/mx27.h     |    9 +++++----
 arch/arm/plat-mxc/include/mach/mx31.h     |   13 +++++++------
 arch/arm/plat-mxc/include/mach/mx35.h     |   13 +++++++------
 arch/arm/plat-mxc/include/mach/mx51.h     |   13 +++++++------
 arch/arm/plat-mxc/include/mach/mxc91231.h |   19 ++++++++++---------
 10 files changed, 61 insertions(+), 48 deletions(-)
arch/arm/mach-mx3/mach-kzm_arm11_01.c +3 -3
index 042cd56..a5f3eb2 100644
@@ -41,9 +41,9 @@
 #include "devices-imx31.h"
 #include "devices.h"
 
-#define KZM_ARM11_IO_ADDRESS(x) (					\
-	IMX_IO_ADDRESS(x, MX31_CS4) ?:					\
-	IMX_IO_ADDRESS(x, MX31_CS5) ?:					\
+#define KZM_ARM11_IO_ADDRESS(x) (IOMEM(					\
+	IMX_IO_P2V_MODULE(x, MX31_CS4) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_CS5)) ?:				\
 	MX31_IO_ADDRESS(x))
 
 /*
arch/arm/plat-mxc/include/mach/hardware.h +9 -4
index ebadf4a..4bbe506 100644
@@ -22,10 +22,15 @@
 
 #include <asm/sizes.h>
 
-#define IMX_IO_ADDRESS(addr, module)					\
-	((void __force __iomem *)					\
-	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
-	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
+#ifdef __ASSEMBLER__
+#define IOMEM(addr)	(addr)
+#else
+#define IOMEM(addr)	((void __force __iomem *)(addr))
+#endif
+
+#define IMX_IO_P2V_MODULE(addr, module)					\
+	(((addr) - module ## _BASE_ADDR) < module ## _SIZE ?		\
+	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0)
 
 #ifdef CONFIG_ARCH_MX5
 #include <mach/mx51.h>
arch/arm/plat-mxc/include/mach/mx1.h +3 -2
index 641b246..b41c288 100644
@@ -73,8 +73,9 @@
 #define MX1_CSI_BASE_ADDR		(0x24000 + MX1_IO_BASE_ADDR)
 
 /* macro to get at IO space when running virtually */
-#define MX1_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX1_IO))
+#define MX1_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX1_IO))
+#define MX1_IO_ADDRESS(x)		IOMEM(MX1_IO_P2V(x))
 
 /* fixed interrput numbers */
 #define MX1_INT_SOFTINT		0
arch/arm/plat-mxc/include/mach/mx21.h +5 -4
index 8bc5972..aed0277 100644
@@ -92,10 +92,11 @@
 
 #define MX21_IRAM_BASE_ADDR		0xffffe800	/* internal ram */
 
-#define MX21_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX21_AIPI) ?:					\
-	IMX_IO_ADDRESS(x, MX21_SAHB1) ?:				\
-	IMX_IO_ADDRESS(x, MX21_X_MEMC))
+#define MX21_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX21_AIPI) ?:				\
+	IMX_IO_P2V_MODULE(x, MX21_SAHB1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX21_X_MEMC))
+#define MX21_IO_ADDRESS(x)		IOMEM(MX21_IO_P2V(x))
 
 /* fixed interrupt numbers */
 #define MX21_INT_CSPI3		6
arch/arm/plat-mxc/include/mach/mx25.h +5 -4
index cf46a45..6f9e1d4 100644
@@ -28,10 +28,11 @@
 #define MX25_GPIO3_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xa4000)
 #define MX25_GPIO4_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0x9c000)
 
-#define MX25_IO_ADDRESS(x) (					\
-	IMX_IO_ADDRESS(x, MX25_AIPS1) ?:			\
-	IMX_IO_ADDRESS(x, MX25_AIPS2) ?:			\
-	IMX_IO_ADDRESS(x, MX25_AVIC))
+#define MX25_IO_P2V(x)	(					\
+	IMX_IO_P2V_MODULE(x, MX25_AIPS1) ?:			\
+	IMX_IO_P2V_MODULE(x, MX25_AIPS2) ?:			\
+	IMX_IO_P2V_MODULE(x, MX25_AVIC))
+#define MX25_IO_ADDRESS(x)		IOMEM(MX25_IO_P2V(x))
 
 #define MX25_AIPS1_IO_ADDRESS(x) \
 	(((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
arch/arm/plat-mxc/include/mach/mx27.h +5 -4
index 2237ba2..c769cc8 100644
@@ -123,10 +123,11 @@
 /* IRAM */
 #define MX27_IRAM_BASE_ADDR		0xffff4c00	/* internal ram */
 
-#define MX27_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX27_AIPI) ?:					\
-	IMX_IO_ADDRESS(x, MX27_SAHB1) ?:				\
-	IMX_IO_ADDRESS(x, MX27_X_MEMC))
+#define MX27_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX27_AIPI) ?:				\
+	IMX_IO_P2V_MODULE(x, MX27_SAHB1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX27_X_MEMC))
+#define MX27_IO_ADDRESS(x)		IOMEM(MX27_IO_P2V(x))
 
 #ifndef __ASSEMBLER__
 static inline void mx27_setup_weimcs(size_t cs,
arch/arm/plat-mxc/include/mach/mx31.h +7 -6
index 61cfe82..eb4a28d 100644
@@ -121,12 +121,13 @@
 
 #define MX31_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define MX31_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX31_AIPS1) ?:				\
-	IMX_IO_ADDRESS(x, MX31_AIPS2) ?:				\
-	IMX_IO_ADDRESS(x, MX31_AVIC) ?:					\
-	IMX_IO_ADDRESS(x, MX31_X_MEMC) ?:				\
-	IMX_IO_ADDRESS(x, MX31_SPBA0))
+#define MX31_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX31_AIPS1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_AIPS2) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_AVIC) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_X_MEMC) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_SPBA0))
+#define MX31_IO_ADDRESS(x)		IOMEM(MX31_IO_P2V(x))
 
 #ifndef __ASSEMBLER__
 static inline void mx31_setup_weimcs(size_t cs,
arch/arm/plat-mxc/include/mach/mx35.h +7 -6
index 6267cff..ce1a24b 100644
@@ -114,12 +114,13 @@
 #define MX35_NFC_BASE_ADDR		0xbb000000
 #define MX35_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define MX35_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX35_AIPS1) ?:				\
-	IMX_IO_ADDRESS(x, MX35_AIPS2) ?:				\
-	IMX_IO_ADDRESS(x, MX35_AVIC) ?:					\
-	IMX_IO_ADDRESS(x, MX35_X_MEMC) ?:				\
-	IMX_IO_ADDRESS(x, MX35_SPBA0))
+#define MX35_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX35_AIPS1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX35_AIPS2) ?:				\
+	IMX_IO_P2V_MODULE(x, MX35_AVIC) ?:				\
+	IMX_IO_P2V_MODULE(x, MX35_X_MEMC) ?:				\
+	IMX_IO_P2V_MODULE(x, MX35_SPBA0))
+#define MX35_IO_ADDRESS(x)		IOMEM(MX35_IO_P2V(x))
 
 /*
  * Interrupt numbers
arch/arm/plat-mxc/include/mach/mx51.h +7 -6
index 2af7a10..e93cf5b 100644
@@ -163,12 +163,13 @@
 #define MX51_GPU2D_BASE_ADDR		0xd0000000
 #define MX51_TZIC_BASE_ADDR		0xe0000000
 
-#define MX51_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX51_IRAM) ?:					\
-	IMX_IO_ADDRESS(x, MX51_DEBUG) ?:				\
-	IMX_IO_ADDRESS(x, MX51_SPBA0) ?:				\
-	IMX_IO_ADDRESS(x, MX51_AIPS1) ?:				\
-	IMX_IO_ADDRESS(x, MX51_AIPS2))
+#define MX51_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX51_IRAM) ?:				\
+	IMX_IO_P2V_MODULE(x, MX51_DEBUG) ?:				\
+	IMX_IO_P2V_MODULE(x, MX51_SPBA0) ?:				\
+	IMX_IO_P2V_MODULE(x, MX51_AIPS1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX51_AIPS2))
+#define MX51_IO_ADDRESS(x)		IOMEM(MX51_IO_P2V(x))
 
 /* This is currently used in <mach/debug-macro.S>, but should go away */
 #define MX51_AIPS1_IO_ADDRESS(x)  \
arch/arm/plat-mxc/include/mach/mxc91231.h +10 -9
index 0ca3101..49e5e25 100644
@@ -187,15 +187,16 @@
  * it returns 0.
  */
 
-#define MXC91231_IO_ADDRESS(x) (					\
-	IMX_IO_ADDRESS(x, MXC91231_L2CC) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_X_MEMC) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_ROMP) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_AVIC) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_AIPS1) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_SPBA0) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_SPBA1) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_AIPS2))
+#define MXC91231_IO_P2V(x)	(					\
+	IMX_IO_P2V_MODULE(x, MXC91231_L2CC) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_X_MEMC) ?:			\
+	IMX_IO_P2V_MODULE(x, MXC91231_ROMP) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_AVIC) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_AIPS1) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_SPBA0) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_SPBA1) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_AIPS2))
+#define MXC91231_IO_ADDRESS(x)		IOMEM(MXC91231_IO_P2V(x))
 
 /*
  * Interrupt numbers
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 3/51 ARM: imx: use MXxy_IO_P2V macros to setup static mappings

In reply to Uwe Kleine-König

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.

---
 arch/arm/mach-imx/mm-imx1.c               |    7 +---
 arch/arm/mach-imx/mm-imx21.c              |   21 ++----------
 arch/arm/mach-imx/mm-imx27.c              |   21 ++----------
 arch/arm/mach-mx25/mm.c                   |   25 +++----------
 arch/arm/mach-mx3/mm.c                    |   53 ++++++++++------------------
 arch/arm/mach-mx5/mm.c                    |   35 ++++---------------
 arch/arm/mach-mxc91231/mm.c               |   53 +++++-----------------------
 arch/arm/plat-mxc/include/mach/hardware.h |    7 ++++
 8 files changed, 56 insertions(+), 166 deletions(-)
arch/arm/mach-imx/mm-imx1.c +1 -6
index 9be92b9..729ae09 100644
@@ -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)
arch/arm/mach-imx/mm-imx21.c +3 -18
index 12faeeaa..e728af8 100644
@@ -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),
 };
 
 /*
arch/arm/mach-imx/mm-imx27.c +3 -18
index a246229..374e48b 100644
@@ -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),
 };
 
 /*
arch/arm/mach-mx25/mm.c +6 -19
index bb67711..11cd335 100644
@@ -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);
arch/arm/mach-mx3/mm.c +19 -34

76 lines not on this page · raw message

arch/arm/mach-mx5/mm.c +7 -28
index bc3f30d..01dff26 100644
@@ -23,33 +23,12 @@
 /*
  * Define the MX51 memory map.
  */
-static struct map_desc mxc_io_desc[] __initdata = {
-	{
-		.virtual = MX51_IRAM_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_IRAM_BASE_ADDR),
-		.length = MX51_IRAM_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_DEBUG_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_DEBUG_BASE_ADDR),
-		.length = MX51_DEBUG_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_AIPS1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_AIPS1_BASE_ADDR),
-		.length = MX51_AIPS1_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_SPBA0_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_SPBA0_BASE_ADDR),
-		.length = MX51_SPBA0_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_AIPS2_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_AIPS2_BASE_ADDR),
-		.length = MX51_AIPS2_SIZE,
-		.type = MT_DEVICE
-	},
+static struct map_desc mx51_io_desc[] __initdata = {
+	imx_map_entry(MX51, IRAM, MT_DEVICE),
+	imx_map_entry(MX51, DEBUG, MT_DEVICE),
+	imx_map_entry(MX51, AIPS1, MT_DEVICE),
+	imx_map_entry(MX51, SPBA0, MT_DEVICE),
+	imx_map_entry(MX51, AIPS2, MT_DEVICE),
 };
 
 /*
@@ -62,7 +41,7 @@ void __init mx51_map_io(void)
 	mxc_set_cpu_type(MXC_CPU_MX51);
 	mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
 	mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG_BASE_ADDR));
-	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
+	iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
 }
 
 int imx51_register_gpios(void);
arch/arm/mach-mxc91231/mm.c +10 -43

65 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/hardware.h +7 -0
index 4bbe506..409cec6 100644
@@ -66,4 +66,11 @@
 
 #include <mach/mxc.h>
 
+#define imx_map_entry(soc, name, _type)	{				\
+	.virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR),	\
+	.pfn = __phys_to_pfn(soc ## _ ## name ## _BASE_ADDR),		\
+	.length = soc ## _ ## name ## _SIZE,				\
+	.type = _type,							\
+}
+
 #endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 4/51 ARM: imx: remove last explicit users of virtual base address defines

In reply to Uwe Kleine-König

This allows changing the mapping without the need to adapt all users.

While at it remove some unneeded casts to void __iomem *, this is already taken care for in the IO_ADDRESS macros

---
 arch/arm/mach-imx/devices.c           |    8 ++++----
 arch/arm/mach-mx25/devices.c          |    8 ++++----
 arch/arm/mach-mx25/mm.c               |    2 +-
 arch/arm/plat-mxc/include/mach/mx25.h |    9 ++++-----
 4 files changed, 13 insertions(+), 14 deletions(-)
arch/arm/mach-imx/devices.c +4 -4
index fba5047..e69e46e 100644
@@ -159,22 +159,22 @@ struct platform_device imx_usb_device = {
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
 		.chip.label = "gpio-0",
-		.base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
+		.base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
 		.irq = MX1_GPIO_INT_PORTA,
 		.virtual_irq_start = MXC_GPIO_IRQ_START,
 	}, {
 		.chip.label = "gpio-1",
-		.base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
+		.base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
 		.irq = MX1_GPIO_INT_PORTB,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 32,
 	}, {
 		.chip.label = "gpio-2",
-		.base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
+		.base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
 		.irq = MX1_GPIO_INT_PORTC,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 64,
 	}, {
 		.chip.label = "gpio-3",
-		.base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
+		.base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
 		.irq = MX1_GPIO_INT_PORTD,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 96,
 	}
arch/arm/mach-mx25/devices.c +4 -4
index 1d0eb3e..92eb1a9 100644
@@ -182,22 +182,22 @@ struct platform_device mxc_pwm_device3 = {
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
 		.chip.label = "gpio-0",
-		.base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
+		.base = MX25_IO_ADDRESS(MX25_GPIO1_BASE_ADDR),
 		.irq = 52,
 		.virtual_irq_start = MXC_GPIO_IRQ_START,
 	}, {
 		.chip.label = "gpio-1",
-		.base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
+		.base = MX25_IO_ADDRESS(MX25_GPIO2_BASE_ADDR),
 		.irq = 51,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 32,
 	}, {
 		.chip.label = "gpio-2",
-		.base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
+		.base = MX25_IO_ADDRESS(MX25_GPIO3_BASE_ADDR),
 		.irq = 16,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 64,
 	}, {
 		.chip.label = "gpio-3",
-		.base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
+		.base = MX25_IO_ADDRESS(MX25_GPIO4_BASE_ADDR),
 		.irq = 23,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 96,
 	}
arch/arm/mach-mx25/mm.c +1 -1
index 11cd335..2edec6c 100644
@@ -56,7 +56,7 @@ int imx25_register_gpios(void);
 
 void __init mx25_init_irq(void)
 {
-	mxc_init_irq((void __iomem *)MX25_AVIC_BASE_ADDR_VIRT);
+	mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR));
 	imx25_register_gpios();
 }
 
arch/arm/plat-mxc/include/mach/mx25.h +4 -5
index 6f9e1d4..08b5a3a 100644
@@ -21,13 +21,12 @@
 
 #define MX25_CRM_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x80000)
 #define MX25_GPT1_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x90000)
+#define MX25_GPIO4_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x9c000)
+#define MX25_GPIO3_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xa4000)
+#define MX25_GPIO1_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xcc000)
+#define MX25_GPIO2_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xd0000)
 #define MX25_WDOG_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xdc000)
 
-#define MX25_GPIO1_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xcc000)
-#define MX25_GPIO2_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xd0000)
-#define MX25_GPIO3_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xa4000)
-#define MX25_GPIO4_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0x9c000)
-
 #define MX25_IO_P2V(x)	(					\
 	IMX_IO_P2V_MODULE(x, MX25_AIPS1) ?:			\
 	IMX_IO_P2V_MODULE(x, MX25_AIPS2) ?:			\
Signature · 1 line
1.7.2.3
#5 lore raw

PATCH 5/51 ARM: imx: change static io mapping to use a function

In reply to Uwe Kleine-König

Now only the virtual addresses [0xf4000000, 0xf5ffffff] are used for static per-SoC mappings. The few mappings of whole chip selects are moved accordingly.

The now wrong defines for virtual base addresses are removed.

---
 arch/arm/plat-mxc/include/mach/hardware.h |   67 +++++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/mx1.h      |    5 +--
 arch/arm/plat-mxc/include/mach/mx21.h     |    9 +---
 arch/arm/plat-mxc/include/mach/mx25.h     |   13 ++----
 arch/arm/plat-mxc/include/mach/mx27.h     |    9 +---
 arch/arm/plat-mxc/include/mach/mx2x.h     |   36 +---------------
 arch/arm/plat-mxc/include/mach/mx31.h     |   16 +------
 arch/arm/plat-mxc/include/mach/mx35.h     |   17 +------
 arch/arm/plat-mxc/include/mach/mx3x.h     |   65 +--------------------------
 arch/arm/plat-mxc/include/mach/mx51.h     |   38 +---------------
 arch/arm/plat-mxc/include/mach/mxc91231.h |   22 +---------
 11 files changed, 89 insertions(+), 208 deletions(-)
arch/arm/plat-mxc/include/mach/hardware.h +67 -0
index 409cec6..dde777c 100644
@@ -32,6 +32,73 @@
 	(((addr) - module ## _BASE_ADDR) < module ## _SIZE ?		\
 	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0)
 
+/*
+ * This is rather complicated for humans and ugly to verify, but for a machine
+ * it's OK.  Still more as it is usually only applied to constants.  The upsides
+ * on using this approach are:
+ *
+ *  - same mapping on all i.MX machines
+ *  - works for assembler, too
+ *  - no need to nurture #defines for virtual addresses
+ *
+ * The downside it, it's hard to verify (but I have a script for that).
+ *
+ * Obviously this needs to be injective for each SoC.  In general it maps the
+ * whole address space to [0xf4000000, 0xf5ffffff].  So [0xf6000000,0xfeffffff]
+ * is free for per-machine use (e.g. KZM_ARM11_01 uses 64MiB there).
+ *
+ * It applies the following mappings for the different SoCs:
+ *
+ * mx1:
+ *	IO	0x00200000+0x100000	->	0xf4000000+0x100000
+ * mx21:
+ *	AIPI	0x10000000+0x100000	->	0xf4400000+0x100000
+ *	SAHB1	0x80000000+0x100000	->	0xf4000000+0x100000
+ *	X_MEMC	0xdf000000+0x004000	->	0xf5f00000+0x004000
+ * mx25:
+ *	AIPS1	0x43f00000+0x100000	->	0xf5300000+0x100000
+ *	AIPS2	0x53f00000+0x100000	->	0xf5700000+0x100000
+ *	AVIC	0x68000000+0x100000	->	0xf5800000+0x100000
+ * mx27:
+ *	AIPI	0x10000000+0x100000	->	0xf4400000+0x100000
+ *	SAHB1	0x80000000+0x100000	->	0xf4000000+0x100000
+ *	X_MEMC	0xd8000000+0x100000	->	0xf5c00000+0x100000
+ * mx31:
+ *	AIPS1	0x43f00000+0x100000	->	0xf5300000+0x100000
+ *	AIPS2	0x53f00000+0x100000	->	0xf5700000+0x100000
+ *	AVIC	0x68000000+0x100000	->	0xf5800000+0x100000
+ *	X_MEMC	0xb8000000+0x010000	->	0xf4c00000+0x010000
+ *	SPBA0	0x50000000+0x100000	->	0xf5400000+0x100000
+ * mx35:
+ *	AIPS1	0x43f00000+0x100000	->	0xf5300000+0x100000
+ *	AIPS2	0x53f00000+0x100000	->	0xf5700000+0x100000
+ *	AVIC	0x68000000+0x100000	->	0xf5800000+0x100000
+ *	X_MEMC	0xb8000000+0x010000	->	0xf4c00000+0x010000
+ *	SPBA0	0x50000000+0x100000	->	0xf5400000+0x100000
+ * mx51:
+ *	IRAM	0x1ffe0000+0x020000	->	0xf4fe0000+0x020000
+ *	DEBUG	0x60000000+0x100000	->	0xf5000000+0x100000
+ *	SPBA0	0x70000000+0x100000	->	0xf5400000+0x100000
+ *	AIPS1	0x73f00000+0x100000	->	0xf5700000+0x100000
+ *	AIPS2	0x83f00000+0x100000	->	0xf4300000+0x100000
+ * mxc91231:
+ *	L2CC	0x30000000+0x010000	->	0xf4400000+0x010000
+ *	X_MEMC	0xb8000000+0x010000	->	0xf4c00000+0x010000
+ *	ROMP	0x60000000+0x010000	->	0xf5000000+0x010000
+ *	AVIC	0x68000000+0x010000	->	0xf5800000+0x010000
+ *	AIPS1	0x43f00000+0x100000	->	0xf5300000+0x100000
+ *	SPBA0	0x50000000+0x100000	->	0xf5400000+0x100000
+ *	SPBA1	0x52000000+0x100000	->	0xf5600000+0x100000
+ *	AIPS2	0x53f00000+0x100000	->	0xf5700000+0x100000
+ */
+#define IMX_IO_P2V(x)	(						\
+			0xf4000000 +					\
+			(((x) & 0x50000000) >> 6) +			\
+			(((x) & 0x0b000000) >> 4) +			\
+			(((x) & 0x000fffff)))
+
+#define IMX_IO_ADDRESS(x)	IOMEM(IMX_IO_P2V(x))
+
 #ifdef CONFIG_ARCH_MX5
 #include <mach/mx51.h>
 #endif
arch/arm/plat-mxc/include/mach/mx1.h +1 -4
index b41c288..b786ae7 100644
@@ -19,7 +19,6 @@
  */
 #define MX1_IO_BASE_ADDR	0x00200000
 #define MX1_IO_SIZE		SZ_1M
-#define MX1_IO_BASE_ADDR_VIRT	VMALLOC_END
 
 #define MX1_CS0_PHYS		0x10000000
 #define MX1_CS0_SIZE		0x02000000
@@ -73,8 +72,7 @@
 #define MX1_CSI_BASE_ADDR		(0x24000 + MX1_IO_BASE_ADDR)
 
 /* macro to get at IO space when running virtually */
-#define MX1_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX1_IO))
+#define MX1_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX1_IO_ADDRESS(x)		IOMEM(MX1_IO_P2V(x))
 
 /* fixed interrput numbers */
@@ -171,7 +169,6 @@
 /* these should go away */
 #define IMX_IO_PHYS MX1_IO_BASE_ADDR
 #define IMX_IO_SIZE MX1_IO_SIZE
-#define IMX_IO_BASE MX1_IO_BASE_ADDR_VIRT
 #define IMX_CS0_PHYS MX1_CS0_PHYS
 #define IMX_CS0_SIZE MX1_CS0_SIZE
 #define IMX_CS1_PHYS MX1_CS1_PHYS
arch/arm/plat-mxc/include/mach/mx21.h +1 -8
index aed0277..b417e32 100644
@@ -26,7 +26,6 @@
 #define __MACH_MX21_H__
 
 #define MX21_AIPI_BASE_ADDR		0x10000000
-#define MX21_AIPI_BASE_ADDR_VIRT	0xf4000000
 #define MX21_AIPI_SIZE			SZ_1M
 #define MX21_DMA_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x01000)
 #define MX21_WDOG_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x02000)
@@ -64,7 +63,6 @@
 #define MX21_AVIC_BASE_ADDR		0x10040000
 
 #define MX21_SAHB1_BASE_ADDR		0x80000000
-#define MX21_SAHB1_BASE_ADDR_VIRT	0xf4100000
 #define MX21_SAHB1_SIZE			SZ_1M
 #define MX21_CSI_BASE_ADDR			(MX2x_SAHB1_BASE_ADDR + 0x0000)
 
@@ -82,7 +80,6 @@
 
 /* NAND, SDRAM, WEIM etc controllers */
 #define MX21_X_MEMC_BASE_ADDR		0xdf000000
-#define MX21_X_MEMC_BASE_ADDR_VIRT	0xf4200000
 #define MX21_X_MEMC_SIZE		SZ_256K
 
 #define MX21_SDRAMC_BASE_ADDR		(MX21_X_MEMC_BASE_ADDR + 0x0000)
@@ -92,10 +89,7 @@
 
 #define MX21_IRAM_BASE_ADDR		0xffffe800	/* internal ram */
 
-#define MX21_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX21_AIPI) ?:				\
-	IMX_IO_P2V_MODULE(x, MX21_SAHB1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX21_X_MEMC))
+#define MX21_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX21_IO_ADDRESS(x)		IOMEM(MX21_IO_P2V(x))
 
 /* fixed interrupt numbers */
@@ -197,7 +191,6 @@
 #define PCMCIA_MEM_BASE_ADDR MX21_PCMCIA_MEM_BASE_ADDR
 #define CS5_BASE_ADDR MX21_CS5_BASE_ADDR
 #define X_MEMC_BASE_ADDR MX21_X_MEMC_BASE_ADDR
-#define X_MEMC_BASE_ADDR_VIRT MX21_X_MEMC_BASE_ADDR_VIRT
 #define X_MEMC_SIZE MX21_X_MEMC_SIZE
 #define SDRAMC_BASE_ADDR MX21_SDRAMC_BASE_ADDR
 #define EIM_BASE_ADDR MX21_EIM_BASE_ADDR
arch/arm/plat-mxc/include/mach/mx25.h +4 -9
index 08b5a3a..aac6a9c 100644
@@ -2,13 +2,11 @@
 #define __MACH_MX25_H__
 
 #define MX25_AIPS1_BASE_ADDR		0x43f00000
-#define MX25_AIPS1_BASE_ADDR_VIRT	0xfc000000
+#define MX25_AIPS1_BASE_ADDR_VIRT	0xf5300000
 #define MX25_AIPS1_SIZE			SZ_1M
 #define MX25_AIPS2_BASE_ADDR		0x53f00000
-#define MX25_AIPS2_BASE_ADDR_VIRT	0xfc200000
 #define MX25_AIPS2_SIZE			SZ_1M
 #define MX25_AVIC_BASE_ADDR		0x68000000
-#define MX25_AVIC_BASE_ADDR_VIRT	0xfc400000
 #define MX25_AVIC_SIZE			SZ_1M
 
 #define MX25_I2C1_BASE_ADDR		(MX25_AIPS1_BASE_ADDR + 0x80000)
@@ -27,12 +25,6 @@
 #define MX25_GPIO2_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xd0000)
 #define MX25_WDOG_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xdc000)
 
-#define MX25_IO_P2V(x)	(					\
-	IMX_IO_P2V_MODULE(x, MX25_AIPS1) ?:			\
-	IMX_IO_P2V_MODULE(x, MX25_AIPS2) ?:			\
-	IMX_IO_P2V_MODULE(x, MX25_AVIC))
-#define MX25_IO_ADDRESS(x)		IOMEM(MX25_IO_P2V(x))
-
 #define MX25_AIPS1_IO_ADDRESS(x) \
 	(((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
 
@@ -58,6 +50,9 @@
 #define MX25_OTG_BASE_ADDR		0x53ff4000
 #define MX25_CSI_BASE_ADDR		0x53ff8000
 
+#define MX25_IO_P2V(x)			IMX_IO_P2V(x)
+#define MX25_IO_ADDRESS(x)		IOMEM(MX25_IO_P2V(x))
+
 #define MX25_INT_CSPI3		0
 #define MX25_INT_I2C1		3
 #define MX25_INT_I2C2		4
arch/arm/plat-mxc/include/mach/mx27.h +1 -8
index c769cc8..e817289 100644
@@ -29,7 +29,6 @@
 #endif
 
 #define MX27_AIPI_BASE_ADDR		0x10000000
-#define MX27_AIPI_BASE_ADDR_VIRT	0xf4000000
 #define MX27_AIPI_SIZE			SZ_1M
 #define MX27_DMA_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x01000)
 #define MX27_WDOG_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x02000)
@@ -87,7 +86,6 @@
 #define MX27_ROMP_BASE_ADDR		0x10041000
 
 #define MX27_SAHB1_BASE_ADDR		0x80000000
-#define MX27_SAHB1_BASE_ADDR_VIRT	0xf4100000
 #define MX27_SAHB1_SIZE			SZ_1M
 #define MX27_CSI_BASE_ADDR			(MX27_SAHB1_BASE_ADDR + 0x0000)
 #define MX27_ATA_BASE_ADDR			(MX27_SAHB1_BASE_ADDR + 0x1000)
@@ -105,7 +103,6 @@
 
 /* NAND, SDRAM, WEIM, M3IF, EMI controllers */
 #define MX27_X_MEMC_BASE_ADDR		0xd8000000
-#define MX27_X_MEMC_BASE_ADDR_VIRT	0xf4200000
 #define MX27_X_MEMC_SIZE		SZ_1M
 #define MX27_NFC_BASE_ADDR			(MX27_X_MEMC_BASE_ADDR)
 #define MX27_SDRAMC_BASE_ADDR			(MX27_X_MEMC_BASE_ADDR + 0x1000)
@@ -123,10 +120,7 @@
 /* IRAM */
 #define MX27_IRAM_BASE_ADDR		0xffff4c00	/* internal ram */
 
-#define MX27_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX27_AIPI) ?:				\
-	IMX_IO_P2V_MODULE(x, MX27_SAHB1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX27_X_MEMC))
+#define MX27_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX27_IO_ADDRESS(x)		IOMEM(MX27_IO_P2V(x))
 
 #ifndef __ASSEMBLER__
@@ -280,7 +274,6 @@ extern int mx27_revision(void);
 #define CS4_BASE_ADDR MX27_CS4_BASE_ADDR
 #define CS5_BASE_ADDR MX27_CS5_BASE_ADDR
 #define X_MEMC_BASE_ADDR MX27_X_MEMC_BASE_ADDR
-#define X_MEMC_BASE_ADDR_VIRT MX27_X_MEMC_BASE_ADDR_VIRT
 #define X_MEMC_SIZE MX27_X_MEMC_SIZE
 #define NFC_BASE_ADDR MX27_NFC_BASE_ADDR
 #define SDRAMC_BASE_ADDR MX27_SDRAMC_BASE_ADDR
arch/arm/plat-mxc/include/mach/mx2x.h +2 -34
index afb895a..46eeeb2 100644
@@ -27,7 +27,7 @@
 
 /* Register offsets */
 #define MX2x_AIPI_BASE_ADDR		0x10000000
-#define MX2x_AIPI_BASE_ADDR_VIRT	0xf4000000
+#define MX2x_AIPI_BASE_ADDR_VIRT	0xf4400000
 #define MX2x_AIPI_SIZE			SZ_1M
 #define MX2x_DMA_BASE_ADDR			(MX2x_AIPI_BASE_ADDR + 0x01000)
 #define MX2x_WDOG_BASE_ADDR			(MX2x_AIPI_BASE_ADDR + 0x02000)
@@ -65,43 +65,12 @@
 #define MX2x_AVIC_BASE_ADDR		0x10040000
 
 #define MX2x_SAHB1_BASE_ADDR		0x80000000
-#define MX2x_SAHB1_BASE_ADDR_VIRT	0xf4100000
 #define MX2x_SAHB1_SIZE			SZ_1M
 #define MX2x_CSI_BASE_ADDR			(MX2x_SAHB1_BASE_ADDR + 0x0000)
 
-/*
- * This macro defines the physical to virtual address mapping for all the
- * peripheral modules. It is used by passing in the physical address as x
- * and returning the virtual address. If the physical address is not mapped,
- * it returns 0xDEADBEEF
- */
-#define IO_ADDRESS(x)   \
-	(void __force __iomem *) \
-	(((x >= AIPI_BASE_ADDR) && (x < (AIPI_BASE_ADDR + AIPI_SIZE))) ? \
-		AIPI_IO_ADDRESS(x) : \
-	((x >= SAHB1_BASE_ADDR) && (x < (SAHB1_BASE_ADDR + SAHB1_SIZE))) ? \
-		SAHB1_IO_ADDRESS(x) : \
-	((x >= X_MEMC_BASE_ADDR) && (x < (X_MEMC_BASE_ADDR + X_MEMC_SIZE))) ? \
-		X_MEMC_IO_ADDRESS(x) : 0xDEADBEEF)
-
-/* define the address mapping macros: in physical address order */
-#define AIPI_IO_ADDRESS(x)  \
+#define AIPI_IO_ADDRESS(x)	\
 	(((x) - AIPI_BASE_ADDR) + AIPI_BASE_ADDR_VIRT)
 
-#define AVIC_IO_ADDRESS(x)	AIPI_IO_ADDRESS(x)
-
-#define SAHB1_IO_ADDRESS(x)  \
-	(((x) - SAHB1_BASE_ADDR) + SAHB1_BASE_ADDR_VIRT)
-
-#define CS4_IO_ADDRESS(x)  \
-	(((x) - CS4_BASE_ADDR) + CS4_BASE_ADDR_VIRT)
-
-#define X_MEMC_IO_ADDRESS(x)  \
-	(((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
-
-#define PCMCIA_IO_ADDRESS(x) \
-	(((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
-
 /* fixed interrupt numbers */
 #define MX2x_INT_CSPI3		6
 #define MX2x_INT_GPIO		8
@@ -215,7 +184,6 @@
 #define MAX_BASE_ADDR MX2x_MAX_BASE_ADDR
 #define AVIC_BASE_ADDR MX2x_AVIC_BASE_ADDR
 #define SAHB1_BASE_ADDR MX2x_SAHB1_BASE_ADDR
-#define SAHB1_BASE_ADDR_VIRT MX2x_SAHB1_BASE_ADDR_VIRT
 #define SAHB1_SIZE MX2x_SAHB1_SIZE
 #define CSI_BASE_ADDR MX2x_CSI_BASE_ADDR
 #define MXC_INT_CSPI3 MX2x_INT_CSPI3
arch/arm/plat-mxc/include/mach/mx31.h +3 -13
index eb4a28d..9ed9975 100644
@@ -15,7 +15,6 @@
 #define MX31_L2CC_SIZE			SZ_1M
 
 #define MX31_AIPS1_BASE_ADDR		0x43f00000
-#define MX31_AIPS1_BASE_ADDR_VIRT	0xfc000000
 #define MX31_AIPS1_SIZE			SZ_1M
 #define MX31_MAX_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x04000)
 #define MX31_EVTMON_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x08000)
@@ -41,7 +40,6 @@
 #define MX31_ECT_IP2_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0xbc000)
 
 #define MX31_SPBA0_BASE_ADDR		0x50000000
-#define MX31_SPBA0_BASE_ADDR_VIRT	0xfc100000
 #define MX31_SPBA0_SIZE			SZ_1M
 #define MX31_MMC_SDHC1_BASE_ADDR		(MX31_SPBA0_BASE_ADDR + 0x04000)
 #define MX31_MMC_SDHC2_BASE_ADDR		(MX31_SPBA0_BASE_ADDR + 0x08000)
@@ -55,7 +53,6 @@
 #define MX31_SPBA_CTRL_BASE_ADDR		(MX31_SPBA0_BASE_ADDR + 0x3c000)
 
 #define MX31_AIPS2_BASE_ADDR		0x53f00000
-#define MX31_AIPS2_BASE_ADDR_VIRT	0xfc200000
 #define MX31_AIPS2_SIZE			SZ_1M
 #define MX31_CCM_BASE_ADDR			(MX31_AIPS2_BASE_ADDR + 0x80000)
 #define MX31_CSPI3_BASE_ADDR			(MX31_AIPS2_BASE_ADDR + 0x84000)
@@ -84,7 +81,6 @@
 #define MX31_ROMP_SIZE			SZ_1M
 
 #define MX31_AVIC_BASE_ADDR		0x68000000
-#define MX31_AVIC_BASE_ADDR_VIRT	0xfc400000
 #define MX31_AVIC_SIZE			SZ_1M
 
 #define MX31_IPU_MEM_BASE_ADDR		0x70000000
@@ -97,15 +93,14 @@
 #define MX31_CS3_BASE_ADDR		0xb2000000
 
 #define MX31_CS4_BASE_ADDR		0xb4000000
-#define MX31_CS4_BASE_ADDR_VIRT		0xf4000000
+#define MX31_CS4_BASE_ADDR_VIRT		0xf6000000
 #define MX31_CS4_SIZE			SZ_32M
 
 #define MX31_CS5_BASE_ADDR		0xb6000000
-#define MX31_CS5_BASE_ADDR_VIRT		0xf6000000
+#define MX31_CS5_BASE_ADDR_VIRT		0xf8000000
 #define MX31_CS5_SIZE			SZ_32M
 
 #define MX31_X_MEMC_BASE_ADDR		0xb8000000
-#define MX31_X_MEMC_BASE_ADDR_VIRT	0xfc320000
 #define MX31_X_MEMC_SIZE		SZ_64K
 #define MX31_NFC_BASE_ADDR			(MX31_X_MEMC_BASE_ADDR + 0x0000)
 #define MX31_ESDCTL_BASE_ADDR			(MX31_X_MEMC_BASE_ADDR + 0x1000)
@@ -121,12 +116,7 @@
 
 #define MX31_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define MX31_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX31_AIPS1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX31_AIPS2) ?:				\
-	IMX_IO_P2V_MODULE(x, MX31_AVIC) ?:				\
-	IMX_IO_P2V_MODULE(x, MX31_X_MEMC) ?:				\
-	IMX_IO_P2V_MODULE(x, MX31_SPBA0))
+#define MX31_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX31_IO_ADDRESS(x)		IOMEM(MX31_IO_P2V(x))
 
 #ifndef __ASSEMBLER__
arch/arm/plat-mxc/include/mach/mx35.h +3 -14
index ce1a24b..3678ca3 100644
@@ -11,7 +11,6 @@
 #define MX35_L2CC_SIZE			SZ_1M
 
 #define MX35_AIPS1_BASE_ADDR		0x43f00000
-#define MX35_AIPS1_BASE_ADDR_VIRT	0xfc000000
 #define MX35_AIPS1_SIZE			SZ_1M
 #define MX35_MAX_BASE_ADDR			(MX35_AIPS1_BASE_ADDR + 0x04000)
 #define MX35_EVTMON_BASE_ADDR			(MX35_AIPS1_BASE_ADDR + 0x08000)
@@ -33,7 +32,6 @@
 #define MX35_ECT_IP2_BASE_ADDR			(MX35_AIPS1_BASE_ADDR + 0xbc000)
 
 #define MX35_SPBA0_BASE_ADDR		0x50000000
-#define MX35_SPBA0_BASE_ADDR_VIRT	0xfc100000
 #define MX35_SPBA0_SIZE			SZ_1M
 #define MX35_UART3_BASE_ADDR			(MX35_SPBA0_BASE_ADDR + 0x0c000)
 #define MX35_CSPI2_BASE_ADDR			(MX35_SPBA0_BASE_ADDR + 0x10000)
@@ -44,7 +42,6 @@
 #define MX35_SPBA_CTRL_BASE_ADDR		(MX35_SPBA0_BASE_ADDR + 0x3c000)
 
 #define MX35_AIPS2_BASE_ADDR		0x53f00000
-#define MX35_AIPS2_BASE_ADDR_VIRT	0xfc200000
 #define MX35_AIPS2_SIZE			SZ_1M
 #define MX35_CCM_BASE_ADDR			(MX35_AIPS2_BASE_ADDR + 0x80000)
 #define MX35_GPT1_BASE_ADDR			(MX35_AIPS2_BASE_ADDR + 0x90000)
@@ -72,11 +69,9 @@
 #define MX35_OTG_BASE_ADDR		0x53ff4000
 
 #define MX35_ROMP_BASE_ADDR		0x60000000
-#define MX35_ROMP_BASE_ADDR_VIRT	0xfc500000
 #define MX35_ROMP_SIZE			SZ_1M
 
 #define MX35_AVIC_BASE_ADDR		0x68000000
-#define MX35_AVIC_BASE_ADDR_VIRT	0xfc400000
 #define MX35_AVIC_SIZE			SZ_1M
 
 /*
@@ -92,18 +87,17 @@
 #define MX35_CS3_BASE_ADDR		0xb2000000
 
 #define MX35_CS4_BASE_ADDR		0xb4000000
-#define MX35_CS4_BASE_ADDR_VIRT		0xf4000000
+#define MX35_CS4_BASE_ADDR_VIRT		0xf6000000
 #define MX35_CS4_SIZE			SZ_32M
 
 #define MX35_CS5_BASE_ADDR		0xb6000000
-#define MX35_CS5_BASE_ADDR_VIRT		0xf6000000
+#define MX35_CS5_BASE_ADDR_VIRT		0xf8000000
 #define MX35_CS5_SIZE			SZ_32M
 
 /*
  * NAND, SDRAM, WEIM, M3IF, EMI controllers
  */
 #define MX35_X_MEMC_BASE_ADDR		0xb8000000
-#define MX35_X_MEMC_BASE_ADDR_VIRT	0xfc320000
 #define MX35_X_MEMC_SIZE		SZ_64K
 #define MX35_ESDCTL_BASE_ADDR			(MX35_X_MEMC_BASE_ADDR + 0x1000)
 #define MX35_WEIM_BASE_ADDR			(MX35_X_MEMC_BASE_ADDR + 0x2000)
@@ -114,12 +108,7 @@
 #define MX35_NFC_BASE_ADDR		0xbb000000
 #define MX35_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define MX35_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX35_AIPS1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX35_AIPS2) ?:				\
-	IMX_IO_P2V_MODULE(x, MX35_AVIC) ?:				\
-	IMX_IO_P2V_MODULE(x, MX35_X_MEMC) ?:				\
-	IMX_IO_P2V_MODULE(x, MX35_SPBA0))
+#define MX35_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX35_IO_ADDRESS(x)		IOMEM(MX35_IO_P2V(x))
 
 /*
arch/arm/plat-mxc/include/mach/mx3x.h +3 -62

146 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mx51.h +2 -36
index e93cf5b..1b8715f 100644
@@ -2,31 +2,6 @@
 #define __MACH_MX51_H__
 
 /*
- * MX51 memory map:
- *
- *
- * Virt		Phys		Size	What
- * ---------------------------------------------------------------------------
- * fa3e0000	1ffe0000	128K	IRAM (SCCv2 RAM)
- *         	30000000	256M	GPU
- *         	40000000	512M	IPU
- * fa200000	60000000	1M	DEBUG
- * fb100000	70000000	1M	SPBA 0
- * fb000000	73f00000	1M	AIPS 1
- * fb200000	83f00000	1M	AIPS 2
- *		8fffc000	16K	TZIC (interrupt controller)
- *         	90000000	256M	CSD0 SDRAM/DDR
- *         	a0000000	256M	CSD1 SDRAM/DDR
- *         	b0000000	128M	CS0 Flash
- *         	b8000000	128M	CS1 Flash
- *         	c0000000	128M	CS2 Flash
- *         	c8000000	64M	CS3 Flash
- *         	cc000000	32M	CS4 SRAM
- *         	ce000000	32M	CS5 SRAM
- *		cfff0000	64K	NFC (NAND Flash AXI)
- */
-
-/*
  * IROM
  */
 #define MX51_IROM_BASE_ADDR		0x0
@@ -36,7 +11,6 @@
  * IRAM
  */
 #define MX51_IRAM_BASE_ADDR		0x1ffe0000	/* internal ram */
-#define MX51_IRAM_BASE_ADDR_VIRT	0xfa3e0000
 #define MX51_IRAM_PARTITIONS		16
 #define MX51_IRAM_SIZE		(MX51_IRAM_PARTITIONS * SZ_8K)	/* 128KB */
 
@@ -45,7 +19,6 @@
 #define MX51_IPU_CTRL_BASE_ADDR		0x40000000
 
 #define MX51_DEBUG_BASE_ADDR		0x60000000
-#define MX51_DEBUG_BASE_ADDR_VIRT	0xfa200000
 #define MX51_DEBUG_SIZE			SZ_1M
 
 #define MX51_ETB_BASE_ADDR		(MX51_DEBUG_BASE_ADDR + 0x01000)
@@ -61,7 +34,6 @@
  * SPBA global module enabled #0
  */
 #define MX51_SPBA0_BASE_ADDR		0x70000000
-#define MX51_SPBA0_BASE_ADDR_VIRT	0xfb100000
 #define MX51_SPBA0_SIZE			SZ_1M
 
 #define MX51_ESDHC1_BASE_ADDR		(MX51_SPBA0_BASE_ADDR + 0x04000)
@@ -81,7 +53,7 @@
  * AIPS 1
  */
 #define MX51_AIPS1_BASE_ADDR		0x73f00000
-#define MX51_AIPS1_BASE_ADDR_VIRT	0xfb000000
+#define MX51_AIPS1_BASE_ADDR_VIRT	0xf5700000
 #define MX51_AIPS1_SIZE			SZ_1M
 
 #define MX51_OTG_BASE_ADDR		(MX51_AIPS1_BASE_ADDR + 0x80000)
@@ -109,7 +81,6 @@
  * AIPS 2
  */
 #define MX51_AIPS2_BASE_ADDR		0x83f00000
-#define MX51_AIPS2_BASE_ADDR_VIRT	0xfb200000
 #define MX51_AIPS2_SIZE			SZ_1M
 
 #define MX51_PLL1_BASE_ADDR		(MX51_AIPS2_BASE_ADDR + 0x80000)
@@ -163,12 +134,7 @@
 #define MX51_GPU2D_BASE_ADDR		0xd0000000
 #define MX51_TZIC_BASE_ADDR		0xe0000000
 
-#define MX51_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX51_IRAM) ?:				\
-	IMX_IO_P2V_MODULE(x, MX51_DEBUG) ?:				\
-	IMX_IO_P2V_MODULE(x, MX51_SPBA0) ?:				\
-	IMX_IO_P2V_MODULE(x, MX51_AIPS1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX51_AIPS2))
+#define MX51_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX51_IO_ADDRESS(x)		IOMEM(MX51_IO_P2V(x))
 
 /* This is currently used in <mach/debug-macro.S>, but should go away */
arch/arm/plat-mxc/include/mach/mxc91231.h +2 -20
index 49e5e25..765190f 100644
@@ -21,14 +21,12 @@
  * L2CC
  */
 #define MXC91231_L2CC_BASE_ADDR		0x30000000
-#define MXC91231_L2CC_BASE_ADDR_VIRT	0xF9000000
 #define MXC91231_L2CC_SIZE		SZ_64K
 
 /*
  * AIPS 1
  */
 #define MXC91231_AIPS1_BASE_ADDR	0x43F00000
-#define MXC91231_AIPS1_BASE_ADDR_VIRT	0xFC000000
 #define MXC91231_AIPS1_SIZE		SZ_1M
 
 #define MXC91231_AIPS1_CTRL_BASE_ADDR	MXC91231_AIPS1_BASE_ADDR
@@ -53,7 +51,6 @@
  * AIPS 2
  */
 #define MXC91231_AIPS2_BASE_ADDR	0x53F00000
-#define MXC91231_AIPS2_BASE_ADDR_VIRT	0xFC100000
 #define MXC91231_AIPS2_SIZE		SZ_1M
 
 #define MXC91231_GEMK_BASE_ADDR		(MXC91231_AIPS2_BASE_ADDR + 0x8C000)
@@ -79,7 +76,6 @@
  * SPBA global module 0
  */
 #define MXC91231_SPBA0_BASE_ADDR	0x50000000
-#define MXC91231_SPBA0_BASE_ADDR_VIRT	0xFC200000
 #define MXC91231_SPBA0_SIZE		SZ_1M
 
 #define MXC91231_MMC_SDHC1_BASE_ADDR	(MXC91231_SPBA0_BASE_ADDR + 0x04000)
@@ -109,7 +105,6 @@
  * SPBA global module 1
  */
 #define MXC91231_SPBA1_BASE_ADDR	0x52000000
-#define MXC91231_SPBA1_BASE_ADDR_VIRT	0xFC300000
 #define MXC91231_SPBA1_SIZE		SZ_1M
 
 #define MXC91231_MQSPI_BASE_ADDR	(MXC91231_SPBA1_BASE_ADDR + 0x34000)
@@ -144,18 +139,15 @@
  * ROMP and AVIC
  */
 #define MXC91231_ROMP_BASE_ADDR		0x60000000
-#define MXC91231_ROMP_BASE_ADDR_VIRT	0xFC400000
 #define MXC91231_ROMP_SIZE		SZ_64K
 
 #define MXC91231_AVIC_BASE_ADDR		0x68000000
-#define MXC91231_AVIC_BASE_ADDR_VIRT	0xFC410000
 #define MXC91231_AVIC_SIZE		SZ_64K
 
 /*
  * NAND, SDRAM, WEIM, M3IF, EMI controllers
  */
 #define MXC91231_X_MEMC_BASE_ADDR	0xB8000000
-#define MXC91231_X_MEMC_BASE_ADDR_VIRT	0xFC420000
 #define MXC91231_X_MEMC_SIZE		SZ_64K
 
 #define MXC91231_NFC_BASE_ADDR		(MXC91231_X_MEMC_BASE_ADDR + 0x0000)
@@ -183,19 +175,9 @@
 /*
  * This macro defines the physical to virtual address mapping for all the
  * peripheral modules. It is used by passing in the physical address as x
- * and returning the virtual address. If the physical address is not mapped,
- * it returns 0.
+ * and returning the virtual address.
  */
-
-#define MXC91231_IO_P2V(x)	(					\
-	IMX_IO_P2V_MODULE(x, MXC91231_L2CC) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_X_MEMC) ?:			\
-	IMX_IO_P2V_MODULE(x, MXC91231_ROMP) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_AVIC) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_AIPS1) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_SPBA0) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_SPBA1) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_AIPS2))
+#define MXC91231_IO_P2V(x)		IMX_IO_P2V(x)
 #define MXC91231_IO_ADDRESS(x)		IOMEM(MXC91231_IO_P2V(x))
 
 /*
Signature · 1 line
1.7.2.3
#6 lore raw

PATCH 6/51 ARM: imx/debug-macro: rework using the new io mapping macro

In reply to Uwe Kleine-König

This gets rid of the last user of IMX_NEEDS_DEPRECATED_SYMBOLS.

---
 arch/arm/plat-mxc/include/mach/debug-macro.S |   23 +++++++----------------
 arch/arm/plat-mxc/include/mach/mx25.h        |    4 ----
 arch/arm/plat-mxc/include/mach/mx2x.h        |    5 -----
 arch/arm/plat-mxc/include/mach/mx3x.h        |    5 -----
 arch/arm/plat-mxc/include/mach/mx51.h        |    5 -----
 5 files changed, 7 insertions(+), 35 deletions(-)
arch/arm/plat-mxc/include/mach/debug-macro.S +7 -16
index d56213f..3b3a37c 100644
@@ -10,58 +10,49 @@
  * published by the Free Software Foundation.
  *
  */
-#define IMX_NEEDS_DEPRECATED_SYMBOLS
+#include <mach/hardware.h>
 
 #ifdef CONFIG_ARCH_MX1
-#include <mach/mx1.h>
-#define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_PADDR	MX1_UART1_BASE_ADDR
 #endif
 
 #ifdef CONFIG_ARCH_MX25
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx25.h>
 #define UART_PADDR	MX25_UART1_BASE_ADDR
-#define UART_VADDR	MX25_AIPS1_IO_ADDRESS(MX25_UART1_BASE_ADDR)
 #endif
 
 #ifdef CONFIG_ARCH_MX2
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx2x.h>
-#define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	AIPI_IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_PADDR	MX2x_UART1_BASE_ADDR
 #endif
 
 #ifdef CONFIG_ARCH_MX3
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx3x.h>
-#define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_PADDR	MX3x_UART1_BASE_ADDR
 #endif
 
 #ifdef CONFIG_ARCH_MX5
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx51.h>
 #define UART_PADDR	MX51_UART1_BASE_ADDR
-#define UART_VADDR	MX51_AIPS1_IO_ADDRESS(MX51_UART1_BASE_ADDR)
 #endif
 
 #ifdef CONFIG_ARCH_MXC91231
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mxc91231.h>
 #define UART_PADDR	MXC91231_UART2_BASE_ADDR
-#define UART_VADDR	MXC91231_IO_ADDRESS(MXC91231_UART2_BASE_ADDR)
 #endif
+
+#define UART_VADDR	IMX_IO_ADDRESS(UART_PADDR)
+
 		.macro	addruart, rp, rv
 		ldr	\rp, =UART_PADDR	@ physical
 		ldr	\rv, =UART_VADDR	@ virtual
arch/arm/plat-mxc/include/mach/mx25.h +0 -4
index aac6a9c..a2404b0 100644
@@ -2,7 +2,6 @@
 #define __MACH_MX25_H__
 
 #define MX25_AIPS1_BASE_ADDR		0x43f00000
-#define MX25_AIPS1_BASE_ADDR_VIRT	0xf5300000
 #define MX25_AIPS1_SIZE			SZ_1M
 #define MX25_AIPS2_BASE_ADDR		0x53f00000
 #define MX25_AIPS2_SIZE			SZ_1M
@@ -25,9 +24,6 @@
 #define MX25_GPIO2_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xd0000)
 #define MX25_WDOG_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xdc000)
 
-#define MX25_AIPS1_IO_ADDRESS(x) \
-	(((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
-
 #define MX25_UART1_BASE_ADDR		0x43f90000
 #define MX25_UART2_BASE_ADDR		0x43f94000
 #define MX25_AUDMUX_BASE_ADDR		0x43fb0000
arch/arm/plat-mxc/include/mach/mx2x.h +0 -5
index 46eeeb2..a056948 100644
@@ -27,7 +27,6 @@
 
 /* Register offsets */
 #define MX2x_AIPI_BASE_ADDR		0x10000000
-#define MX2x_AIPI_BASE_ADDR_VIRT	0xf4400000
 #define MX2x_AIPI_SIZE			SZ_1M
 #define MX2x_DMA_BASE_ADDR			(MX2x_AIPI_BASE_ADDR + 0x01000)
 #define MX2x_WDOG_BASE_ADDR			(MX2x_AIPI_BASE_ADDR + 0x02000)
@@ -68,9 +67,6 @@
 #define MX2x_SAHB1_SIZE			SZ_1M
 #define MX2x_CSI_BASE_ADDR			(MX2x_SAHB1_BASE_ADDR + 0x0000)
 
-#define AIPI_IO_ADDRESS(x)	\
-	(((x) - AIPI_BASE_ADDR) + AIPI_BASE_ADDR_VIRT)
-
 /* fixed interrupt numbers */
 #define MX2x_INT_CSPI3		6
 #define MX2x_INT_GPIO		8
@@ -148,7 +144,6 @@
 #ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
 /* these should go away */
 #define AIPI_BASE_ADDR MX2x_AIPI_BASE_ADDR
-#define AIPI_BASE_ADDR_VIRT MX2x_AIPI_BASE_ADDR_VIRT
 #define AIPI_SIZE MX2x_AIPI_SIZE
 #define DMA_BASE_ADDR MX2x_DMA_BASE_ADDR
 #define WDOG_BASE_ADDR MX2x_WDOG_BASE_ADDR
arch/arm/plat-mxc/include/mach/mx3x.h +0 -5
index da22cd4..3d6cc45 100644
@@ -44,7 +44,6 @@
  * AIPS 1
  */
 #define MX3x_AIPS1_BASE_ADDR		0x43f00000
-#define MX3x_AIPS1_BASE_ADDR_VIRT	0xf5300000
 #define MX3x_AIPS1_SIZE			SZ_1M
 #define MX3x_MAX_BASE_ADDR			(MX3x_AIPS1_BASE_ADDR + 0x04000)
 #define MX3x_EVTMON_BASE_ADDR			(MX3x_AIPS1_BASE_ADDR + 0x08000)
@@ -141,9 +140,6 @@
 
 #define MX3x_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define AIPS1_IO_ADDRESS(x)  \
-	(((x) - AIPS1_BASE_ADDR) + AIPS1_BASE_ADDR_VIRT)
-
 /*
  * Interrupt numbers
  */
@@ -230,7 +226,6 @@ static inline int mx35_revision(void)
 #define L2CC_BASE_ADDR MX3x_L2CC_BASE_ADDR
 #define L2CC_SIZE MX3x_L2CC_SIZE
 #define AIPS1_BASE_ADDR MX3x_AIPS1_BASE_ADDR
-#define AIPS1_BASE_ADDR_VIRT MX3x_AIPS1_BASE_ADDR_VIRT
 #define AIPS1_SIZE MX3x_AIPS1_SIZE
 #define MAX_BASE_ADDR MX3x_MAX_BASE_ADDR
 #define EVTMON_BASE_ADDR MX3x_EVTMON_BASE_ADDR
arch/arm/plat-mxc/include/mach/mx51.h +0 -5
index 1b8715f..636347c 100644
@@ -53,7 +53,6 @@
  * AIPS 1
  */
 #define MX51_AIPS1_BASE_ADDR		0x73f00000
-#define MX51_AIPS1_BASE_ADDR_VIRT	0xf5700000
 #define MX51_AIPS1_SIZE			SZ_1M
 
 #define MX51_OTG_BASE_ADDR		(MX51_AIPS1_BASE_ADDR + 0x80000)
@@ -137,10 +136,6 @@
 #define MX51_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX51_IO_ADDRESS(x)		IOMEM(MX51_IO_P2V(x))
 
-/* This is currently used in <mach/debug-macro.S>, but should go away */
-#define MX51_AIPS1_IO_ADDRESS(x)  \
-	(((x) - MX51_AIPS1_BASE_ADDR) + MX51_AIPS1_BASE_ADDR_VIRT)
-
 /*
  * defines for SPBA modules
  */
Signature · 1 line
1.7.2.3
#7 lore raw

PATCH 7/51 ARM: imx: remove deprecated symbols as all users are gone now

In reply to Uwe Kleine-König
---
 arch/arm/plat-mxc/include/mach/mx1.h  |  127 ---------------------------------
 arch/arm/plat-mxc/include/mach/mx21.h |   34 ---------
 arch/arm/plat-mxc/include/mach/mx27.h |   69 ------------------
 arch/arm/plat-mxc/include/mach/mx2x.h |  112 -----------------------------
 arch/arm/plat-mxc/include/mach/mx31.h |   32 --------
 arch/arm/plat-mxc/include/mach/mx35.h |   16 ----
 arch/arm/plat-mxc/include/mach/mx3x.h |  114 -----------------------------
 7 files changed, 0 insertions(+), 504 deletions(-)
arch/arm/plat-mxc/include/mach/mx1.h +0 -127
index b786ae7..b6771f4 100644
@@ -165,131 +165,4 @@
  */
 #define USBD_INT0		MX1_USBD_INT0
 
-#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
-/* these should go away */
-#define IMX_IO_PHYS MX1_IO_BASE_ADDR
-#define IMX_IO_SIZE MX1_IO_SIZE
-#define IMX_CS0_PHYS MX1_CS0_PHYS
-#define IMX_CS0_SIZE MX1_CS0_SIZE
-#define IMX_CS1_PHYS MX1_CS1_PHYS
-#define IMX_CS1_SIZE MX1_CS1_SIZE
-#define IMX_CS2_PHYS MX1_CS2_PHYS
-#define IMX_CS2_SIZE MX1_CS2_SIZE
-#define IMX_CS3_PHYS MX1_CS3_PHYS
-#define IMX_CS3_SIZE MX1_CS3_SIZE
-#define IMX_CS4_PHYS MX1_CS4_PHYS
-#define IMX_CS4_SIZE MX1_CS4_SIZE
-#define IMX_CS5_PHYS MX1_CS5_PHYS
-#define IMX_CS5_SIZE MX1_CS5_SIZE
-#define AIPI1_BASE_ADDR MX1_AIPI1_BASE_ADDR
-#define WDT_BASE_ADDR MX1_WDT_BASE_ADDR
-#define TIM1_BASE_ADDR MX1_TIM1_BASE_ADDR
-#define TIM2_BASE_ADDR MX1_TIM2_BASE_ADDR
-#define RTC_BASE_ADDR MX1_RTC_BASE_ADDR
-#define LCDC_BASE_ADDR MX1_LCDC_BASE_ADDR
-#define UART1_BASE_ADDR MX1_UART1_BASE_ADDR
-#define UART2_BASE_ADDR MX1_UART2_BASE_ADDR
-#define PWM_BASE_ADDR MX1_PWM_BASE_ADDR
-#define DMA_BASE_ADDR MX1_DMA_BASE_ADDR
-#define AIPI2_BASE_ADDR MX1_AIPI2_BASE_ADDR
-#define SIM_BASE_ADDR MX1_SIM_BASE_ADDR
-#define USBD_BASE_ADDR MX1_USBD_BASE_ADDR
-#define SPI1_BASE_ADDR MX1_SPI1_BASE_ADDR
-#define MMC_BASE_ADDR MX1_MMC_BASE_ADDR
-#define ASP_BASE_ADDR MX1_ASP_BASE_ADDR
-#define BTA_BASE_ADDR MX1_BTA_BASE_ADDR
-#define I2C_BASE_ADDR MX1_I2C_BASE_ADDR
-#define SSI_BASE_ADDR MX1_SSI_BASE_ADDR
-#define SPI2_BASE_ADDR MX1_SPI2_BASE_ADDR
-#define MSHC_BASE_ADDR MX1_MSHC_BASE_ADDR
-#define CCM_BASE_ADDR MX1_CCM_BASE_ADDR
-#define SCM_BASE_ADDR MX1_SCM_BASE_ADDR
-#define GPIO_BASE_ADDR MX1_GPIO_BASE_ADDR
-#define EIM_BASE_ADDR MX1_EIM_BASE_ADDR
-#define SDRAMC_BASE_ADDR MX1_SDRAMC_BASE_ADDR
-#define MMA_BASE_ADDR MX1_MMA_BASE_ADDR
-#define AVIC_BASE_ADDR MX1_AVIC_BASE_ADDR
-#define CSI_BASE_ADDR MX1_CSI_BASE_ADDR
-#define IO_ADDRESS(x) MX1_IO_ADDRESS(x)
-#define AVIC_IO_ADDRESS(x) IO_ADDRESS(x)
-#define INT_SOFTINT MX1_INT_SOFTINT
-#define CSI_INT MX1_CSI_INT
-#define DSPA_MAC_INT MX1_DSPA_MAC_INT
-#define DSPA_INT MX1_DSPA_INT
-#define COMP_INT MX1_COMP_INT
-#define MSHC_XINT MX1_MSHC_XINT
-#define GPIO_INT_PORTA MX1_GPIO_INT_PORTA
-#define GPIO_INT_PORTB MX1_GPIO_INT_PORTB
-#define GPIO_INT_PORTC MX1_GPIO_INT_PORTC
-#define LCDC_INT MX1_LCDC_INT
-#define SIM_INT MX1_SIM_INT
-#define SIM_DATA_INT MX1_SIM_DATA_INT
-#define RTC_INT MX1_RTC_INT
-#define RTC_SAMINT MX1_RTC_SAMINT
-#define UART2_MINT_PFERR MX1_UART2_MINT_PFERR
-#define UART2_MINT_RTS MX1_UART2_MINT_RTS
-#define UART2_MINT_DTR MX1_UART2_MINT_DTR
-#define UART2_MINT_UARTC MX1_UART2_MINT_UARTC
-#define UART2_MINT_TX MX1_UART2_MINT_TX
-#define UART2_MINT_RX MX1_UART2_MINT_RX
-#define UART1_MINT_PFERR MX1_UART1_MINT_PFERR
-#define UART1_MINT_RTS MX1_UART1_MINT_RTS
-#define UART1_MINT_DTR MX1_UART1_MINT_DTR
-#define UART1_MINT_UARTC MX1_UART1_MINT_UARTC
-#define UART1_MINT_TX MX1_UART1_MINT_TX
-#define UART1_MINT_RX MX1_UART1_MINT_RX
-#define VOICE_DAC_INT MX1_VOICE_DAC_INT
-#define VOICE_ADC_INT MX1_VOICE_ADC_INT
-#define PEN_DATA_INT MX1_PEN_DATA_INT
-#define PWM_INT MX1_PWM_INT
-#define SDHC_INT MX1_SDHC_INT
-#define I2C_INT MX1_INT_I2C
-#define CSPI_INT MX1_CSPI_INT
-#define SSI_TX_INT MX1_SSI_TX_INT
-#define SSI_TX_ERR_INT MX1_SSI_TX_ERR_INT
-#define SSI_RX_INT MX1_SSI_RX_INT
-#define SSI_RX_ERR_INT MX1_SSI_RX_ERR_INT
-#define TOUCH_INT MX1_TOUCH_INT
-#define USBD_INT1 MX1_USBD_INT1
-#define USBD_INT2 MX1_USBD_INT2
-#define USBD_INT3 MX1_USBD_INT3
-#define USBD_INT4 MX1_USBD_INT4
-#define USBD_INT5 MX1_USBD_INT5
-#define USBD_INT6 MX1_USBD_INT6
-#define BTSYS_INT MX1_BTSYS_INT
-#define BTTIM_INT MX1_BTTIM_INT
-#define BTWUI_INT MX1_BTWUI_INT
-#define TIM2_INT MX1_TIM2_INT
-#define TIM1_INT MX1_TIM1_INT
-#define DMA_ERR MX1_DMA_ERR
-#define DMA_INT MX1_DMA_INT
-#define GPIO_INT_PORTD MX1_GPIO_INT_PORTD
-#define WDT_INT MX1_WDT_INT
-#define DMA_REQ_UART3_T MX1_DMA_REQ_UART3_T
-#define DMA_REQ_UART3_R MX1_DMA_REQ_UART3_R
-#define DMA_REQ_SSI2_T MX1_DMA_REQ_SSI2_T
-#define DMA_REQ_SSI2_R MX1_DMA_REQ_SSI2_R
-#define DMA_REQ_CSI_STAT MX1_DMA_REQ_CSI_STAT
-#define DMA_REQ_CSI_R MX1_DMA_REQ_CSI_R
-#define DMA_REQ_MSHC MX1_DMA_REQ_MSHC
-#define DMA_REQ_DSPA_DCT_DOUT MX1_DMA_REQ_DSPA_DCT_DOUT
-#define DMA_REQ_DSPA_DCT_DIN MX1_DMA_REQ_DSPA_DCT_DIN
-#define DMA_REQ_DSPA_MAC MX1_DMA_REQ_DSPA_MAC
-#define DMA_REQ_EXT MX1_DMA_REQ_EXT
-#define DMA_REQ_SDHC MX1_DMA_REQ_SDHC
-#define DMA_REQ_SPI1_R MX1_DMA_REQ_SPI1_R
-#define DMA_REQ_SPI1_T MX1_DMA_REQ_SPI1_T
-#define DMA_REQ_SSI_T MX1_DMA_REQ_SSI_T
-#define DMA_REQ_SSI_R MX1_DMA_REQ_SSI_R
-#define DMA_REQ_ASP_DAC MX1_DMA_REQ_ASP_DAC
-#define DMA_REQ_ASP_ADC MX1_DMA_REQ_ASP_ADC
-#define DMA_REQ_USP_EP(x) MX1_DMA_REQ_USP_EP(x)
-#define DMA_REQ_SPI2_R MX1_DMA_REQ_SPI2_R
-#define DMA_REQ_SPI2_T MX1_DMA_REQ_SPI2_T
-#define DMA_REQ_UART2_T MX1_DMA_REQ_UART2_T
-#define DMA_REQ_UART2_R MX1_DMA_REQ_UART2_R
-#define DMA_REQ_UART1_T MX1_DMA_REQ_UART1_T
-#define DMA_REQ_UART1_R MX1_DMA_REQ_UART1_R
-#endif /* ifdef IMX_NEEDS_DEPRECATED_SYMBOLS */
-
 #endif /* ifndef __MACH_MX1_H__ */
arch/arm/plat-mxc/include/mach/mx21.h +0 -34
index b417e32..a82f590 100644
@@ -179,38 +179,4 @@
 #define MX21_DMA_REQ_CSI_STAT	30
 #define MX21_DMA_REQ_CSI_RX	31
 
-#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
-/* these should go away */
-#define SDRAM_BASE_ADDR MX21_SDRAM_BASE_ADDR
-#define CSD1_BASE_ADDR MX21_CSD1_BASE_ADDR
-#define CS0_BASE_ADDR MX21_CS0_BASE_ADDR
-#define CS1_BASE_ADDR MX21_CS1_BASE_ADDR
-#define CS2_BASE_ADDR MX21_CS2_BASE_ADDR
-#define CS3_BASE_ADDR MX21_CS3_BASE_ADDR
-#define CS4_BASE_ADDR MX21_CS4_BASE_ADDR
-#define PCMCIA_MEM_BASE_ADDR MX21_PCMCIA_MEM_BASE_ADDR
-#define CS5_BASE_ADDR MX21_CS5_BASE_ADDR
-#define X_MEMC_BASE_ADDR MX21_X_MEMC_BASE_ADDR
-#define X_MEMC_SIZE MX21_X_MEMC_SIZE
-#define SDRAMC_BASE_ADDR MX21_SDRAMC_BASE_ADDR
-#define EIM_BASE_ADDR MX21_EIM_BASE_ADDR
-#define PCMCIA_CTL_BASE_ADDR MX21_PCMCIA_CTL_BASE_ADDR
-#define NFC_BASE_ADDR MX21_NFC_BASE_ADDR
-#define IRAM_BASE_ADDR MX21_IRAM_BASE_ADDR
-#define MXC_INT_FIRI MX21_INT_FIRI
-#define MXC_INT_BMI MX21_INT_BMI
-#define MXC_INT_EMMAENC MX21_INT_EMMAENC
-#define MXC_INT_EMMADEC MX21_INT_EMMADEC
-#define MXC_INT_USBWKUP MX21_INT_USBWKUP
-#define MXC_INT_USBDMA MX21_INT_USBDMA
-#define MXC_INT_USBHOST MX21_INT_USBHOST
-#define MXC_INT_USBFUNC MX21_INT_USBFUNC
-#define MXC_INT_USBMNP MX21_INT_USBMNP
-#define MXC_INT_USBCTRL MX21_INT_USBCTRL
-#define MXC_INT_USBCTRL MX21_INT_USBCTRL
-#define DMA_REQ_FIRI_RX MX21_DMA_REQ_FIRI_RX
-#define DMA_REQ_BMI_TX MX21_DMA_REQ_BMI_TX
-#define DMA_REQ_BMI_RX MX21_DMA_REQ_BMI_RX
-#endif
-
 #endif /* ifndef __MACH_MX21_H__ */
arch/arm/plat-mxc/include/mach/mx27.h +0 -69

73 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mx2x.h +0 -112

116 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mx31.h +0 -32
index 9ed9975..6d4b98f 100644
@@ -215,36 +215,4 @@ static inline void mx31_setup_weimcs(size_t cs,
 #define MX31_SYSTEM_REV_MIN		MX31_CHIP_REV_1_0
 #define MX31_SYSTEM_REV_NUM		3
 
-#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
-/* these should go away */
-#define ATA_BASE_ADDR MX31_ATA_BASE_ADDR
-#define UART4_BASE_ADDR MX31_UART4_BASE_ADDR
-#define UART5_BASE_ADDR MX31_UART5_BASE_ADDR
-#define MMC_SDHC1_BASE_ADDR MX31_MMC_SDHC1_BASE_ADDR
-#define MMC_SDHC2_BASE_ADDR MX31_MMC_SDHC2_BASE_ADDR
-#define SIM1_BASE_ADDR MX31_SIM1_BASE_ADDR
-#define IIM_BASE_ADDR MX31_IIM_BASE_ADDR
-#define CSPI3_BASE_ADDR MX31_CSPI3_BASE_ADDR
-#define FIRI_BASE_ADDR MX31_FIRI_BASE_ADDR
-#define SCM_BASE_ADDR MX31_SCM_BASE_ADDR
-#define SMN_BASE_ADDR MX31_SMN_BASE_ADDR
-#define MPEG4_ENC_BASE_ADDR MX31_MPEG4_ENC_BASE_ADDR
-#define MXC_INT_MPEG4_ENCODER MX31_INT_MPEG4_ENCODER
-#define MXC_INT_FIRI MX31_INT_FIRI
-#define MXC_INT_MBX MX31_INT_MBX
-#define MXC_INT_CSPI3 MX31_INT_CSPI3
-#define MXC_INT_SIM2 MX31_INT_SIM2
-#define MXC_INT_SIM1 MX31_INT_SIM1
-#define MXC_INT_CCM_DVFS MX31_INT_CCM_DVFS
-#define MXC_INT_USB1 MX31_INT_USB1
-#define MXC_INT_USB2 MX31_INT_USB2
-#define MXC_INT_USB3 MX31_INT_USB3
-#define MXC_INT_USB4 MX31_INT_USB4
-#define MXC_INT_MSHC2 MX31_INT_MSHC2
-#define MXC_INT_UART4 MX31_INT_UART4
-#define MXC_INT_UART5 MX31_INT_UART5
-#define MXC_INT_CCM MX31_INT_CCM
-#define MXC_INT_PCMCIA MX31_INT_PCMCIA
-#endif
-
 #endif /* ifndef __MACH_MX31_H__ */
arch/arm/plat-mxc/include/mach/mx35.h +0 -16
index 3678ca3..9067225 100644
@@ -183,20 +183,4 @@
 #define MX35_SYSTEM_REV_MIN		MX3x_CHIP_REV_1_0
 #define MX35_SYSTEM_REV_NUM		3
 
-#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
-/* these should go away */
-#define MXC_FEC_BASE_ADDR MX35_FEC_BASE_ADDR
-#define MXC_INT_OWIRE MX35_INT_OWIRE
-#define MXC_INT_GPU2D MX35_INT_GPU2D
-#define MXC_INT_ASRC MX35_INT_ASRC
-#define MXC_INT_USBHS MX35_INT_USBHS
-#define MXC_INT_USBOTG MX35_INT_USBOTG
-#define MXC_INT_ESAI MX35_INT_ESAI
-#define MXC_INT_CAN1 MX35_INT_CAN1
-#define MXC_INT_CAN2 MX35_INT_CAN2
-#define MXC_INT_MLB MX35_INT_MLB
-#define MXC_INT_SPDIF MX35_INT_SPDIF
-#define MXC_INT_FEC MX35_INT_FEC
-#endif
-
 #endif /* ifndef __MACH_MX35_H__ */
arch/arm/plat-mxc/include/mach/mx3x.h +0 -114

118 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#8 lore raw

PATCH 8/51 ARM: imx: dynamically allocate mxc_w1 devices

In reply to Uwe Kleine-König

Currently there is no platform data used in the driver. In case this changes NULL is passed unused to the soc specific functions.

---
 arch/arm/mach-imx/Kconfig                       |    4 ++
 arch/arm/mach-imx/devices-imx21.h               |    4 ++
 arch/arm/mach-imx/devices-imx27.h               |    4 ++
 arch/arm/mach-imx/devices.c                     |   15 -------
 arch/arm/mach-imx/devices.h                     |    1 -
 arch/arm/mach-imx/mach-cpuimx27.c               |    2 +-
 arch/arm/mach-imx/mach-mx27ads.c                |    2 +-
 arch/arm/mach-imx/mach-pca100.c                 |    2 +-
 arch/arm/mach-imx/mach-pcm038.c                 |    2 +-
 arch/arm/mach-mx3/Kconfig                       |    1 +
 arch/arm/mach-mx3/devices-imx31.h               |    4 ++
 arch/arm/mach-mx3/devices-imx35.h               |    4 ++
 arch/arm/mach-mx3/devices.c                     |   15 -------
 arch/arm/mach-mx3/devices.h                     |    1 -
 arch/arm/mach-mx3/mach-pcm037.c                 |    2 +-
 arch/arm/plat-mxc/devices/Kconfig               |    3 +
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-mxc_w1.c     |   50 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |    6 +++
 19 files changed, 86 insertions(+), 37 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc_w1.c
arch/arm/mach-imx/Kconfig +4 -0
index 197f9e2..edf0182 100644
@@ -88,6 +88,7 @@ config MACH_MX27ADS
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
+	select IMX_HAVE_PLATFORM_MXC_W1
 	help
 	  Include support for MX27ADS platform. This includes specific
 	  configurations for the board and its peripherals.
@@ -97,6 +98,7 @@ config MACH_PCM038
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
+	select IMX_HAVE_PLATFORM_MXC_W1
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	select MXC_ULPI if USB_ULPI
 	help
@@ -122,6 +124,7 @@ config MACH_CPUIMX27
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
+	select IMX_HAVE_PLATFORM_MXC_W1
 	select MXC_ULPI if USB_ULPI
 	help
 	  Include support for Eukrea CPUIMX27 platform. This includes
@@ -186,6 +189,7 @@ config MACH_PCA100
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
+	select IMX_HAVE_PLATFORM_MXC_W1
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	select MXC_ULPI if USB_ULPI
 	help
arch/arm/mach-imx/devices-imx21.h +4 -0
index d189039..61b0aa7 100644
@@ -29,6 +29,10 @@ extern const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst;
 #define imx21_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx21_mxc_nand_data, pdata)
 
+extern const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst;
+#define imx21_add_mxc_w1(pdata)	\
+	imx_add_mxc_w1(&imx21_mxc_w1_data)
+
 extern const struct imx_spi_imx_data imx21_cspi_data[] __initconst;
 #define imx21_add_cspi(id, pdata)	\
 	imx_add_spi_imx(&imx21_cspi_data[id], pdata)
arch/arm/mach-imx/devices-imx27.h +4 -0
index 7011690..b957e78 100644
@@ -35,6 +35,10 @@ extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst;
 #define imx27_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
 
+extern const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst;
+#define imx27_add_mxc_w1(pdata)	\
+	imx_add_mxc_w1(&imx27_mxc_w1_data)
+
 extern const struct imx_spi_imx_data imx27_cspi_data[] __initconst;
 #define imx27_add_cspi(id, pdata)	\
 	imx_add_spi_imx(&imx27_cspi_data[id], pdata)
arch/arm/mach-imx/devices.c +0 -15
index e69e46e..6fbd624 100644
@@ -270,21 +270,6 @@ struct platform_device mxc_wdt = {
 	.resource = mxc_wdt_resources,
 };
 
-static struct resource mxc_w1_master_resources[] = {
-	{
-		.start = MX2x_OWIRE_BASE_ADDR,
-		.end = MX2x_OWIRE_BASE_ADDR + SZ_4K - 1,
-		.flags = IORESOURCE_MEM,
-	},
-};
-
-struct platform_device mxc_w1_master_device = {
-	.name = "mxc_w1",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mxc_w1_master_resources),
-	.resource = mxc_w1_master_resources,
-};
-
 /*
  * lcdc:
  * - i.MX1: the basic controller
arch/arm/mach-imx/devices.h +0 -1
index 807f02a..48d2c5b 100644
@@ -14,7 +14,6 @@ extern struct platform_device mxc_gpt4;
 extern struct platform_device mxc_gpt5;
 #endif
 extern struct platform_device mxc_wdt;
-extern struct platform_device mxc_w1_master_device;
 extern struct platform_device mxc_fb_device;
 extern struct platform_device mxc_pwm_device;
 extern struct platform_device mxc_sdhc_device0;
arch/arm/mach-imx/mach-cpuimx27.c +1 -1
index 745ee60..9baaf3d 100644
@@ -158,7 +158,6 @@ cpuimx27_nand_board_info __initconst = {
 static struct platform_device *platform_devices[] __initdata = {
 	&eukrea_cpuimx27_nor_mtd_device,
 	&mxc_wdt,
-	&mxc_w1_master_device,
 };
 
 static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
@@ -262,6 +261,7 @@ static void __init eukrea_cpuimx27_init(void)
 
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+	imx27_add_mxc_w1(NULL);
 
 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
 	/* SDHC2 can be used for Wifi */
arch/arm/mach-imx/mach-mx27ads.c +1 -1
index a1e4bc5..219899a 100644
@@ -284,7 +284,6 @@ static struct imxmmc_platform_data sdhc2_pdata = {
 
 static struct platform_device *platform_devices[] __initdata = {
 	&mx27ads_nor_mtd_device,
-	&mxc_w1_master_device,
 };
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -314,6 +313,7 @@ static void __init mx27ads_board_init(void)
 
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+	imx27_add_mxc_w1(NULL);
 }
 
 static void __init mx27ads_timer_init(void)
arch/arm/mach-imx/mach-pca100.c +1 -1
index 8c720d4..39c580b 100644
@@ -172,7 +172,6 @@ pca100_nand_board_info __initconst = {
 };
 
 static struct platform_device *platform_devices[] __initdata = {
-	&mxc_w1_master_device,
 	&mxc_wdt,
 };
 
@@ -434,6 +433,7 @@ static void __init pca100_init(void)
 
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+	imx27_add_mxc_w1(NULL);
 }
 
 static void __init pca100_timer_init(void)
arch/arm/mach-imx/mach-pcm038.c +1 -1
index 49a97ce..2cfc4b9 100644
@@ -172,7 +172,6 @@ pcm038_nand_board_info __initconst = {
 
 static struct platform_device *platform_devices[] __initdata = {
 	&pcm038_nor_mtd_device,
-	&mxc_w1_master_device,
 	&pcm038_sram_mtd_device,
 	&mxc_wdt,
 };
@@ -326,6 +325,7 @@ static void __init pcm038_init(void)
 
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+	imx27_add_mxc_w1(NULL);
 
 #ifdef CONFIG_MACH_PCM970_BASEBOARD
 	pcm970_baseboard_init();
arch/arm/mach-mx3/Kconfig +1 -0
index 5000ac1..3f83fd5 100644
@@ -41,6 +41,7 @@ config MACH_PCM037
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
+	select IMX_HAVE_PLATFORM_MXC_W1
 	select MXC_ULPI if USB_ULPI
 	help
 	  Include support for Phytec pcm037 platform. This includes
arch/arm/mach-mx3/devices-imx31.h +4 -0
index de95985..a88f243 100644
@@ -33,6 +33,10 @@ extern const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst;
 #define imx31_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
 
+extern const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst;
+#define imx31_add_mxc_w1(pdata)	\
+	imx_add_mxc_w1(&imx31_mxc_w1_data)
+
 extern const struct imx_spi_imx_data imx31_cspi_data[] __initconst;
 #define imx31_add_cspi(id, pdata)	\
 	imx_add_spi_imx(&imx31_cspi_data[id], pdata)
arch/arm/mach-mx3/devices-imx35.h +4 -0
index 5eb917b..7602cb4 100644
@@ -40,6 +40,10 @@ extern const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst;
 #define imx35_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx35_mxc_nand_data, pdata)
 
+extern const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst;
+#define imx35_add_mxc_w1(pdata)	\
+	imx_add_mxc_w1(&imx35_mxc_w1_data)
+
 extern const struct imx_spi_imx_data imx35_cspi_data[] __initconst;
 #define imx35_add_cspi(id, pdata)	\
 	imx_add_spi_imx(&imx35_cspi_data[id], pdata)
arch/arm/mach-mx3/devices.c +0 -15
index 74f74f4..5808ce1 100644
@@ -54,21 +54,6 @@ int __init imx3x_register_gpios(void)
 	return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
 }
 
-static struct resource mxc_w1_master_resources[] = {
-	{
-		.start = MX3x_OWIRE_BASE_ADDR,
-		.end = MX3x_OWIRE_BASE_ADDR + SZ_4K - 1,
-		.flags = IORESOURCE_MEM,
-	},
-};
-
-struct platform_device mxc_w1_master_device = {
-	.name = "mxc_w1",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mxc_w1_master_resources),
-	.resource = mxc_w1_master_resources,
-};
-
 #ifdef CONFIG_ARCH_MX31
 static struct resource mxcsdhc0_resources[] = {
 	{
arch/arm/mach-mx3/devices.h +0 -1
index 585f814..a649772 100644
@@ -1,4 +1,3 @@
-extern struct platform_device mxc_w1_master_device;
 extern struct platform_device mx3_ipu;
 extern struct platform_device mx3_fb;
 extern struct platform_device mx3_camera;
arch/arm/mach-mx3/mach-pcm037.c +1 -1
index 86e86c1..bc5d3a1 100644
@@ -614,7 +614,7 @@ static void __init mxc_board_init(void)
 	imx31_add_imx_uart1(&uart_pdata);
 	imx31_add_imx_uart2(&uart_pdata);
 
-	mxc_register_device(&mxc_w1_master_device, NULL);
+	imx31_add_mxc_w1(NULL);
 
 	/* LAN9217 IRQ pin */
 	ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 9aa6f3e..fb66467 100644
@@ -25,5 +25,8 @@ config IMX_HAVE_PLATFORM_IMX_UART
 config IMX_HAVE_PLATFORM_MXC_NAND
 	bool
 
+config IMX_HAVE_PLATFORM_MXC_W1
+	bool
+
 config IMX_HAVE_PLATFORM_SPI_IMX
 	bool
arch/arm/plat-mxc/devices/Makefile +1 -0
index 45aefeb..1d7d392 100644
@@ -7,4 +7,5 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
arch/arm/plat-mxc/devices/platform-mxc_w1.c new file +50 -0

50 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +6 -0
index 8c6896f..431e0ef 100644
@@ -99,6 +99,12 @@ struct platform_device *__init imx_add_mxc_nand(
 		const struct imx_mxc_nand_data *data,
 		const struct mxc_nand_platform_data *pdata);
 
+struct imx_mxc_w1_data {
+	resource_size_t iobase;
+};
+struct platform_device *__init imx_add_mxc_w1(
+		const struct imx_mxc_w1_data *data);
+
 #include <mach/spi.h>
 struct imx_spi_imx_data {
 	const char *devid;
Signature · 1 line
1.7.2.3
#9 lore raw

PATCH 9/51 ARM: imx: remove unused devices

In reply to Uwe Kleine-König

all these don't have a driver and are not added in any machine file.

---
 arch/arm/mach-imx/devices.c |   77 -------------------------------------------
 arch/arm/mach-imx/devices.h |    9 -----
 2 files changed, 0 insertions(+), 86 deletions(-)
arch/arm/mach-imx/devices.c +0 -77
index 6fbd624..cdc6f32 100644
@@ -70,48 +70,6 @@ struct platform_device imx1_camera_device = {
 	.num_resources  = ARRAY_SIZE(imx1_camera_resources),
 };
 
-static struct resource imx_rtc_resources[] = {
-	{
-		.start  = 0x00204000,
-		.end    = 0x00204024,
-		.flags  = IORESOURCE_MEM,
-	}, {
-		.start  = MX1_RTC_INT,
-		.end    = MX1_RTC_INT,
-		.flags  = IORESOURCE_IRQ,
-	}, {
-		.start  = MX1_RTC_SAMINT,
-		.end    = MX1_RTC_SAMINT,
-		.flags  = IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device imx_rtc_device = {
-	.name           = "rtc-imx",
-	.id             = 0,
-	.resource       = imx_rtc_resources,
-	.num_resources  = ARRAY_SIZE(imx_rtc_resources),
-};
-
-static struct resource imx_wdt_resources[] = {
-	{
-		.start  = 0x00201000,
-		.end    = 0x00201008,
-		.flags  = IORESOURCE_MEM,
-	}, {
-		.start  = MX1_WDT_INT,
-		.end    = MX1_WDT_INT,
-		.flags  = IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device imx_wdt_device = {
-	.name           = "imx-wdt",
-	.id             = 0,
-	.resource       = imx_wdt_resources,
-	.num_resources  = ARRAY_SIZE(imx_wdt_resources),
-};
-
 static struct resource imx_usb_resources[] = {
 	{
 		.start	= 0x00212000,
@@ -219,41 +177,6 @@ struct platform_device mx27_camera_device = {
 };
 #endif
 
-/*
- * General Purpose Timer
- * - i.MX21: 3 timers
- * - i.MX27: 6 timers
- */
-#define DEFINE_IMX_GPT_DEVICE(n, baseaddr, irq)				\
-	static struct resource timer ## n ##_resources[] = {		\
-		{							\
-			.start = baseaddr,				\
-			.end = baseaddr + SZ_4K - 1,			\
-			.flags = IORESOURCE_MEM,			\
-		}, {							\
-			.start = irq,					\
-			.end = irq,					\
-			.flags = IORESOURCE_IRQ,			\
-		}							\
-	};								\
-									\
-	struct platform_device mxc_gpt ## n = {				\
-		.name = "imx_gpt",					\
-		.id = n,						\
-		.num_resources = ARRAY_SIZE(timer ## n ## _resources),	\
-		.resource = timer ## n ## _resources,			\
-	}
-
-/* We use gpt1 as system timer, so do not add a device for this one */
-DEFINE_IMX_GPT_DEVICE(1, MX2x_GPT2_BASE_ADDR, MX2x_INT_GPT2);
-DEFINE_IMX_GPT_DEVICE(2, MX2x_GPT3_BASE_ADDR, MX2x_INT_GPT3);
-
-#ifdef CONFIG_MACH_MX27
-DEFINE_IMX_GPT_DEVICE(3, MX27_GPT4_BASE_ADDR, MX27_INT_GPT4);
-DEFINE_IMX_GPT_DEVICE(4, MX27_GPT5_BASE_ADDR, MX27_INT_GPT5);
-DEFINE_IMX_GPT_DEVICE(5, MX27_GPT6_BASE_ADDR, MX27_INT_GPT6);
-#endif
-
 /* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */
 static struct resource mxc_wdt_resources[] = {
 	{
arch/arm/mach-imx/devices.h +0 -9
index 48d2c5b..a7e47f4 100644
@@ -1,18 +1,9 @@
 #ifdef CONFIG_ARCH_MX1
 extern struct platform_device imx1_camera_device;
-extern struct platform_device imx_rtc_device;
-extern struct platform_device imx_wdt_device;
 extern struct platform_device imx_usb_device;
 #endif
 
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-extern struct platform_device mxc_gpt1;
-extern struct platform_device mxc_gpt2;
-#ifdef CONFIG_MACH_MX27
-extern struct platform_device mxc_gpt3;
-extern struct platform_device mxc_gpt4;
-extern struct platform_device mxc_gpt5;
-#endif
 extern struct platform_device mxc_wdt;
 extern struct platform_device mxc_fb_device;
 extern struct platform_device mxc_pwm_device;
Signature · 1 line
1.7.2.3
#10 lore raw

PATCH 10/51 ARM: imx: dynamically allocate imx_udc device

In reply to Uwe Kleine-König

This is only available for mx1 machines with no in-tree user.

---
 arch/arm/mach-imx/devices.c                     |   43 -------------
 arch/arm/mach-imx/devices.h                     |    1 -
 arch/arm/plat-mxc/devices/Kconfig               |    3 +
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-imx_udc.c    |   75 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |   16 +++++
 arch/arm/plat-mxc/include/mach/mx1.h            |   16 +++---
 7 files changed, 103 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx_udc.c
arch/arm/mach-imx/devices.c +0 -43
index cdc6f32..fba6285 100644
@@ -70,49 +70,6 @@ struct platform_device imx1_camera_device = {
 	.num_resources  = ARRAY_SIZE(imx1_camera_resources),
 };
 
-static struct resource imx_usb_resources[] = {
-	{
-		.start	= 0x00212000,
-		.end	= 0x00212148,
-		.flags	= IORESOURCE_MEM,
-	}, {
-		.start	= MX1_USBD_INT0,
-		.end	= MX1_USBD_INT0,
-		.flags	= IORESOURCE_IRQ,
-	}, {
-		.start	= MX1_USBD_INT1,
-		.end	= MX1_USBD_INT1,
-		.flags	= IORESOURCE_IRQ,
-	}, {
-		.start	= MX1_USBD_INT2,
-		.end	= MX1_USBD_INT2,
-		.flags	= IORESOURCE_IRQ,
-	}, {
-		.start	= MX1_USBD_INT3,
-		.end	= MX1_USBD_INT3,
-		.flags	= IORESOURCE_IRQ,
-	}, {
-		.start	= MX1_USBD_INT4,
-		.end	= MX1_USBD_INT4,
-		.flags	= IORESOURCE_IRQ,
-	}, {
-		.start	= MX1_USBD_INT5,
-		.end	= MX1_USBD_INT5,
-		.flags	= IORESOURCE_IRQ,
-	}, {
-		.start	= MX1_USBD_INT6,
-		.end	= MX1_USBD_INT6,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device imx_usb_device = {
-	.name		= "imx_udc",
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(imx_usb_resources),
-	.resource	= imx_usb_resources,
-};
-
 /* GPIO port description */
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
arch/arm/mach-imx/devices.h +0 -1
index a7e47f4..91906ce 100644
@@ -1,6 +1,5 @@
 #ifdef CONFIG_ARCH_MX1
 extern struct platform_device imx1_camera_device;
-extern struct platform_device imx_usb_device;
 #endif
 
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
arch/arm/plat-mxc/devices/Kconfig +3 -0
index fb66467..2703f5a 100644
@@ -22,6 +22,9 @@ config IMX_HAVE_PLATFORM_IMX_SSI
 config IMX_HAVE_PLATFORM_IMX_UART
 	bool
 
+config IMX_HAVE_PLATFORM_IMX_UDC
+	bool
+
 config IMX_HAVE_PLATFORM_MXC_NAND
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index 1d7d392..7c3eaf1 100644
@@ -6,6 +6,7 @@ obj-y += platform-imx-dma.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
arch/arm/plat-mxc/devices/platform-imx_udc.c new file +75 -0

75 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +16 -0
index 431e0ef..4eb45fa 100644
@@ -82,6 +82,22 @@ struct platform_device *__init imx_add_imx_uart_1irq(
 		const struct imx_imx_uart_1irq_data *data,
 		const struct imxuart_platform_data *pdata);
 
+#include <mach/usb.h>
+struct imx_imx_udc_data {
+	resource_size_t iobase;
+	resource_size_t iosize;
+	resource_size_t irq0;
+	resource_size_t irq1;
+	resource_size_t irq2;
+	resource_size_t irq3;
+	resource_size_t irq4;
+	resource_size_t irq5;
+	resource_size_t irq6;
+};
+struct platform_device *__init imx_add_imx_udc(
+		const struct imx_imx_udc_data *data,
+		const struct imxusb_platform_data *pdata);
+
 #include <mach/mxc_nand.h>
 struct imx_mxc_nand_data {
 	/*
arch/arm/plat-mxc/include/mach/mx1.h +8 -8
index b6771f4..2cd3fcd 100644
@@ -114,13 +114,13 @@
 #define MX1_SSI_RX_INT		44
 #define MX1_SSI_RX_ERR_INT	45
 #define MX1_TOUCH_INT		46
-#define MX1_USBD_INT0		47
-#define MX1_USBD_INT1		48
-#define MX1_USBD_INT2		49
-#define MX1_USBD_INT3		50
-#define MX1_USBD_INT4		51
-#define MX1_USBD_INT5		52
-#define MX1_USBD_INT6		53
+#define MX1_INT_USBD0		47
+#define MX1_INT_USBD1		48
+#define MX1_INT_USBD2		49
+#define MX1_INT_USBD3		50
+#define MX1_INT_USBD4		51
+#define MX1_INT_USBD5		52
+#define MX1_INT_USBD6		53
 #define MX1_BTSYS_INT		55
 #define MX1_BTTIM_INT		56
 #define MX1_BTWUI_INT		57
@@ -163,6 +163,6 @@
  * to not break drivers/usb/gadget/imx_udc.  Should go
  * away after this driver uses the new name.
  */
-#define USBD_INT0		MX1_USBD_INT0
+#define USBD_INT0		MX1_INT_USBD0
 
 #endif /* ifndef __MACH_MX1_H__ */
Signature · 1 line
1.7.2.3
#11 lore raw

PATCH 11/51 ARM: imx: allow specifying a dma mask when creating a platform device

In reply to Uwe Kleine-König
---
 arch/arm/plat-mxc/devices.c                     |   23 +++++++++++++++++++++--
 arch/arm/plat-mxc/include/mach/devices-common.h |   14 ++++++++++++--
 2 files changed, 33 insertions(+), 4 deletions(-)
arch/arm/plat-mxc/devices.c +21 -2
index 735776d..e9bcefe 100644
@@ -17,6 +17,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
@@ -36,9 +37,10 @@ int __init mxc_register_device(struct platform_device *pdev, void *data)
 	return ret;
 }
 
-struct platform_device *__init imx_add_platform_device(const char *name, int id,
+struct platform_device *__init imx_add_platform_device_dmamask(
+		const char *name, int id,
 		const struct resource *res, unsigned int num_resources,
-		const void *data, size_t size_data)
+		const void *data, size_t size_data, u64 dmamask)
 {
 	int ret = -ENOMEM;
 	struct platform_device *pdev;
@@ -47,6 +49,23 @@ struct platform_device *__init imx_add_platform_device(const char *name, int id,
 	if (!pdev)
 		goto err;
 
+	if (dmamask) {
+		/*
+		 * This memory isn't freed when the device is put,
+		 * I don't have a nice idea for that though.  Conceptually
+		 * dma_mask in struct device should not be a pointer.
+		 * See http://thread.gmane.org/gmane.linux.kernel.pci/9081
+		 */
+		pdev->dev.dma_mask =
+			kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
+		if (!pdev->dev.dma_mask)
+			/* ret is still -ENOMEM; */
+			goto err;
+
+		*pdev->dev.dma_mask = dmamask;
+		pdev->dev.coherent_dma_mask = dmamask;
+	}
+
 	if (res) {
 		ret = platform_device_add_resources(pdev, res, num_resources);
 		if (ret)
arch/arm/plat-mxc/include/mach/devices-common.h +12 -2
index 4eb45fa..a5e97b8 100644
@@ -10,9 +10,19 @@
 #include <linux/platform_device.h>
 #include <linux/init.h>
 
-struct platform_device *imx_add_platform_device(const char *name, int id,
+struct platform_device *imx_add_platform_device_dmamask(
+		const char *name, int id,
 		const struct resource *res, unsigned int num_resources,
-		const void *data, size_t size_data);
+		const void *data, size_t size_data, u64 dmamask);
+
+static inline struct platform_device *imx_add_platform_device(
+		const char *name, int id,
+		const struct resource *res, unsigned int num_resources,
+		const void *data, size_t size_data)
+{
+	return imx_add_platform_device_dmamask(
+			name, id, res, num_resources, data, size_data, 0);
+}
 
 #include <linux/fec.h>
 struct imx_fec_data {
Signature · 1 line
1.7.2.3
#12 lore raw

PATCH 12/51 ARM: imx: dynamically allocate mx1-camera device

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/devices.c                     |   25 -------------
 arch/arm/mach-imx/devices.h                     |    4 --
 arch/arm/plat-mxc/devices/Kconfig               |    3 ++
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-mx1-camera.c |   42 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |   10 +++++
 arch/arm/plat-mxc/include/mach/mx1.h            |    2 +-
 7 files changed, 57 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-mx1-camera.c
arch/arm/mach-imx/devices.c +0 -25
index fba6285..31c9d6c 100644
@@ -45,31 +45,6 @@
 #include "devices.h"
 
 #if defined(CONFIG_ARCH_MX1)
-static struct resource imx1_camera_resources[] = {
-	{
-		.start  = 0x00224000,
-		.end    = 0x00224010,
-		.flags  = IORESOURCE_MEM,
-	}, {
-		.start  = MX1_CSI_INT,
-		.end    = MX1_CSI_INT,
-		.flags  = IORESOURCE_IRQ,
-	},
-};
-
-static u64 imx1_camera_dmamask = DMA_BIT_MASK(32);
-
-struct platform_device imx1_camera_device = {
-	.name           = "mx1-camera",
-	.id             = 0, /* This is used to put cameras on this interface */
-	.dev		= {
-		.dma_mask = &imx1_camera_dmamask,
-		.coherent_dma_mask = DMA_BIT_MASK(32),
-	},
-	.resource       = imx1_camera_resources,
-	.num_resources  = ARRAY_SIZE(imx1_camera_resources),
-};
-
 /* GPIO port description */
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
arch/arm/mach-imx/devices.h +0 -4
index 91906ce..8f14452 100644
@@ -1,7 +1,3 @@
-#ifdef CONFIG_ARCH_MX1
-extern struct platform_device imx1_camera_device;
-#endif
-
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
 extern struct platform_device mxc_wdt;
 extern struct platform_device mxc_fb_device;
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 2703f5a..61a3e25 100644
@@ -25,6 +25,9 @@ config IMX_HAVE_PLATFORM_IMX_UART
 config IMX_HAVE_PLATFORM_IMX_UDC
 	bool
 
+config IMX_HAVE_PLATFORM_MX1_CAMERA
+	bool
+
 config IMX_HAVE_PLATFORM_MXC_NAND
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index 7c3eaf1..86b47f2 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
arch/arm/plat-mxc/devices/platform-mx1-camera.c new file +42 -0

42 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +10 -0
index a5e97b8..ab0500a 100644
@@ -108,6 +108,16 @@ struct platform_device *__init imx_add_imx_udc(
 		const struct imx_imx_udc_data *data,
 		const struct imxusb_platform_data *pdata);
 
+#include <mach/mx1_camera.h>
+struct imx_mx1_camera_data {
+	resource_size_t iobase;
+	resource_size_t iosize;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_mx1_camera(
+		const struct imx_mx1_camera_data *data,
+		const struct mx1_camera_pdata *pdata);
+
 #include <mach/mxc_nand.h>
 struct imx_mxc_nand_data {
 	/*
arch/arm/plat-mxc/include/mach/mx1.h +1 -1
index 2cd3fcd..f1e336e 100644
@@ -77,7 +77,7 @@
 
 /* fixed interrput numbers */
 #define MX1_INT_SOFTINT		0
-#define MX1_CSI_INT		6
+#define MX1_INT_CSI		6
 #define MX1_DSPA_MAC_INT	7
 #define MX1_DSPA_INT		8
 #define MX1_COMP_INT		9
Signature · 1 line
1.7.2.3
#13 lore raw

PATCH 13/51 ARM: imx/gpio: remove some useless casts

In reply to Uwe Kleine-König
---
 arch/arm/plat-mxc/gpio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-mxc/gpio.c +2 -2
index 9c3e362..a43d9cc 100644
@@ -175,7 +175,7 @@ static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat)
 static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc)
 {
 	u32 irq_stat;
-	struct mxc_gpio_port *port = (struct mxc_gpio_port *)get_irq_data(irq);
+	struct mxc_gpio_port *port = get_irq_data(irq);
 
 	irq_stat = __raw_readl(port->base + GPIO_ISR) &
 			__raw_readl(port->base + GPIO_IMR);
@@ -188,7 +188,7 @@ static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc)
 {
 	int i;
 	u32 irq_msk, irq_stat;
-	struct mxc_gpio_port *port = (struct mxc_gpio_port *)get_irq_data(irq);
+	struct mxc_gpio_port *port = get_irq_data(irq);
 
 	/* walk through all interrupt status registers */
 	for (i = 0; i < gpio_table_size; i++) {
Signature · 1 line
1.7.2.3
#14 lore raw

PATCH 14/51 ARM: imx: dynamically allocate mx2-camera device

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/devices-imx27.h               |    4 ++
 arch/arm/mach-imx/devices.c                     |   32 --------------
 arch/arm/mach-imx/devices.h                     |    1 -
 arch/arm/plat-mxc/devices/Kconfig               |    3 +
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-mx2-camera.c |   53 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |   13 ++++++
 arch/arm/plat-mxc/include/mach/mx27.h           |    4 +-
 8 files changed, 76 insertions(+), 35 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-mx2-camera.c
arch/arm/mach-imx/devices-imx27.h +4 -0
index b957e78..84b3405 100644
@@ -31,6 +31,10 @@ extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst;
 #define imx27_add_imx_uart4(pdata)	imx27_add_imx_uart(4, pdata)
 #define imx27_add_imx_uart5(pdata)	imx27_add_imx_uart(5, pdata)
 
+extern const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst;
+#define imx27_add_mx2_camera(pdata)	\
+	imx_add_mx2_camera(&imx27_mx2_camera_data, pdata)
+
 extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst;
 #define imx27_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
arch/arm/mach-imx/devices.c +0 -32
index 31c9d6c..0c5ade4 100644
@@ -77,38 +77,6 @@ int __init imx1_register_gpios(void)
 #endif
 
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-
-#ifdef CONFIG_MACH_MX27
-static struct resource mx27_camera_resources[] = {
-	{
-	       .start = MX27_CSI_BASE_ADDR,
-	       .end = MX27_CSI_BASE_ADDR + 0x1f,
-	       .flags = IORESOURCE_MEM,
-	}, {
-	       .start = MX27_EMMA_PRP_BASE_ADDR,
-	       .end = MX27_EMMA_PRP_BASE_ADDR + 0x1f,
-	       .flags = IORESOURCE_MEM,
-	}, {
-	       .start = MX27_INT_CSI,
-	       .end = MX27_INT_CSI,
-	       .flags = IORESOURCE_IRQ,
-	},{
-	       .start = MX27_INT_EMMAPRP,
-	       .end = MX27_INT_EMMAPRP,
-	       .flags = IORESOURCE_IRQ,
-	},
-};
-struct platform_device mx27_camera_device = {
-	.name = "mx2-camera",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mx27_camera_resources),
-	.resource = mx27_camera_resources,
-	.dev = {
-		.coherent_dma_mask = 0xffffffff,
-	},
-};
-#endif
-
 /* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */
 static struct resource mxc_wdt_resources[] = {
 	{
arch/arm/mach-imx/devices.h +0 -1
index 8f14452..3d020b9 100644
@@ -5,7 +5,6 @@ extern struct platform_device mxc_pwm_device;
 extern struct platform_device mxc_sdhc_device0;
 extern struct platform_device mxc_sdhc_device1;
 extern struct platform_device mxc_otg_udc_device;
-extern struct platform_device mx27_camera_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 61a3e25..37d7e00 100644
@@ -28,6 +28,9 @@ config IMX_HAVE_PLATFORM_IMX_UDC
 config IMX_HAVE_PLATFORM_MX1_CAMERA
 	bool
 
+config IMX_HAVE_PLATFORM_MX2_CAMERA
+	bool
+
 config IMX_HAVE_PLATFORM_MXC_NAND
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index 86b47f2..88392fc 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
arch/arm/plat-mxc/devices/platform-mx2-camera.c new file +53 -0

53 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +13 -0
index ab0500a..e31fc50 100644
@@ -118,6 +118,19 @@ struct platform_device *__init imx_add_mx1_camera(
 		const struct imx_mx1_camera_data *data,
 		const struct mx1_camera_pdata *pdata);
 
+#include <mach/mx2_cam.h>
+struct imx_mx2_camera_data {
+	resource_size_t iobasecsi;
+	resource_size_t iosizecsi;
+	resource_size_t irqcsi;
+	resource_size_t iobaseemmaprp;
+	resource_size_t iosizeemmaprp;
+	resource_size_t irqemmaprp;
+};
+struct platform_device *__init imx_add_mx2_camera(
+		const struct imx_mx2_camera_data *data,
+		const struct mx2_camera_platform_data *pdata);
+
 #include <mach/mxc_nand.h>
 struct imx_mxc_nand_data {
 	/*
arch/arm/plat-mxc/include/mach/mx27.h +2 -2
index 3116b3b..2734d24 100644
@@ -67,8 +67,8 @@
 #define MX27_USBOTG_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x24000)
 #define MX27_OTG_BASE_ADDR			MX27_USBOTG_BASE_ADDR
 #define MX27_SAHARA_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x25000)
-#define MX27_EMMA_PP_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x26000)
-#define MX27_EMMA_PRP_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x26400)
+#define MX27_EMMAPP_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x26000)
+#define MX27_EMMAPRP_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x26400)
 #define MX27_CCM_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x27000)
 #define MX27_SYSCTRL_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x27800)
 #define MX27_IIM_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x28000)
Signature · 1 line
1.7.2.3
#15 lore raw

PATCH 15/51 ARM: imx: dynamically allocate imx2-wdt devices

In reply to Uwe Kleine-König

Currently there is no platform data used in the driver. In case this changes and for consistency NULL is passed unused to the soc specific functions.

---
 arch/arm/mach-imx/Kconfig                       |    3 ++
 arch/arm/mach-imx/devices-imx21.h               |    4 ++
 arch/arm/mach-imx/devices-imx27.h               |    4 ++
 arch/arm/mach-imx/devices.c                     |   16 ---------
 arch/arm/mach-imx/devices.h                     |    1 -
 arch/arm/mach-imx/mach-cpuimx27.c               |    2 +-
 arch/arm/mach-imx/mach-pca100.c                 |    6 +---
 arch/arm/mach-imx/mach-pcm038.c                 |    2 +-
 arch/arm/plat-mxc/devices/Kconfig               |    3 ++
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-imx2-wdt.c   |   40 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |    6 +++
 12 files changed, 64 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx2-wdt.c
arch/arm/mach-imx/Kconfig +3 -0
index edf0182..6b1662c 100644
@@ -95,6 +95,7 @@ config MACH_MX27ADS
 
 config MACH_PCM038
 	bool "Phytec phyCORE-i.MX27 CPU module (pcm038)"
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -121,6 +122,7 @@ endchoice
 
 config MACH_CPUIMX27
 	bool "Eukrea CPUIMX27 module"
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -185,6 +187,7 @@ config MACH_IMX27LITE
 
 config MACH_PCA100
 	bool "Phytec phyCARD-s (pca100)"
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
arch/arm/mach-imx/devices-imx21.h +4 -0
index 61b0aa7..738dbba 100644
@@ -9,6 +9,10 @@
 #include <mach/mx21.h>
 #include <mach/devices-common.h>
 
+extern const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst;
+#define imx21_add_imx2_wdt(pdata)	\
+	imx_add_imx2_wdt(&imx21_imx2_wdt_data)
+
 extern const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst;
 #define imx21_add_imx_i2c(pdata)	\
 	imx_add_imx_i2c(&imx21_imx_i2c_data, pdata)
arch/arm/mach-imx/devices-imx27.h +4 -0
index 84b3405..b2d4c51 100644
@@ -13,6 +13,10 @@ extern const struct imx_fec_data imx27_fec_data __initconst;
 #define imx27_add_fec(pdata)	\
 	imx_add_fec(&imx27_fec_data, pdata)
 
+extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst;
+#define imx27_add_imx2_wdt(pdata)	\
+	imx_add_imx2_wdt(&imx27_imx2_wdt_data)
+
 extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst;
 #define imx27_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata)
arch/arm/mach-imx/devices.c +0 -16
index 0c5ade4..20655fb 100644
@@ -77,22 +77,6 @@ int __init imx1_register_gpios(void)
 #endif
 
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-/* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */
-static struct resource mxc_wdt_resources[] = {
-	{
-		.start = MX2x_WDOG_BASE_ADDR,
-		.end = MX2x_WDOG_BASE_ADDR + SZ_4K - 1,
-		.flags = IORESOURCE_MEM,
-	},
-};
-
-struct platform_device mxc_wdt = {
-	.name = "imx2-wdt",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mxc_wdt_resources),
-	.resource = mxc_wdt_resources,
-};
-
 /*
  * lcdc:
  * - i.MX1: the basic controller
arch/arm/mach-imx/devices.h +0 -1
index 3d020b9..f441b02 100644
@@ -1,5 +1,4 @@
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-extern struct platform_device mxc_wdt;
 extern struct platform_device mxc_fb_device;
 extern struct platform_device mxc_pwm_device;
 extern struct platform_device mxc_sdhc_device0;
arch/arm/mach-imx/mach-cpuimx27.c +1 -1
index 9baaf3d..5771d4e 100644
@@ -157,7 +157,6 @@ cpuimx27_nand_board_info __initconst = {
 
 static struct platform_device *platform_devices[] __initdata = {
 	&eukrea_cpuimx27_nor_mtd_device,
-	&mxc_wdt,
 };
 
 static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
@@ -261,6 +260,7 @@ static void __init eukrea_cpuimx27_init(void)
 
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+	imx27_add_imx2_wdt(NULL);
 	imx27_add_mxc_w1(NULL);
 
 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
arch/arm/mach-imx/mach-pca100.c +1 -5
index 39c580b..11da9c2 100644
@@ -171,10 +171,6 @@ pca100_nand_board_info __initconst = {
 	.hw_ecc = 1,
 };
 
-static struct platform_device *platform_devices[] __initdata = {
-	&mxc_wdt,
-};
-
 static const struct imxi2c_platform_data pca100_i2c1_data __initconst = {
 	.bitrate = 100000,
 };
@@ -432,7 +428,7 @@ static void __init pca100_init(void)
 	mxc_register_device(&mxc_fb_device, &pca100_fb_data);
 
 	imx27_add_fec(NULL);
-	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+	imx27_add_imx2_wdt(NULL);
 	imx27_add_mxc_w1(NULL);
 }
 
arch/arm/mach-imx/mach-pcm038.c +1 -1
index 2cfc4b9..3c9f2df 100644
@@ -173,7 +173,6 @@ pcm038_nand_board_info __initconst = {
 static struct platform_device *platform_devices[] __initdata = {
 	&pcm038_nor_mtd_device,
 	&pcm038_sram_mtd_device,
-	&mxc_wdt,
 };
 
 /* On pcm038 there's a sram attached to CS1, we enable the chipselect here and
@@ -325,6 +324,7 @@ static void __init pcm038_init(void)
 
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+	imx27_add_imx2_wdt(NULL);
 	imx27_add_mxc_w1(NULL);
 
 #ifdef CONFIG_MACH_PCM970_BASEBOARD
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 37d7e00..01b0d0c 100644
@@ -13,6 +13,9 @@ config IMX_HAVE_PLATFORM_GPIO_KEYS
 	bool
 	default y if ARCH_MX51
 	
+config IMX_HAVE_PLATFORM_IMX2_WDT
+	bool
+
 config IMX_HAVE_PLATFORM_IMX_I2C
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index 88392fc..224f665 100644
@@ -2,6 +2,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
 obj-y += platform-imx-dma.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
arch/arm/plat-mxc/devices/platform-imx2-wdt.c new file +40 -0
new file mode 100644
index 0000000..86eb7f1
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 Pengutronix
+ * Uwe Kleine-Koenig <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+#include <asm/sizes.h>
+#include <mach/hardware.h>
+#include <mach/devices-common.h>
+
+#define imx_imx2_wdt_data_entry_single(soc)				\
+	{								\
+		.iobase = soc ## _WDOG_BASE_ADDR,			\
+	}
+
+#ifdef CONFIG_SOC_IMX21
+const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
+	imx_imx2_wdt_data_entry_single(MX21);
+#endif /* ifdef CONFIG_SOC_IMX21 */
+
+#ifdef CONFIG_SOC_IMX27
+const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
+	imx_imx2_wdt_data_entry_single(MX27);
+#endif /* ifdef CONFIG_SOC_IMX27 */
+
+struct platform_device *__init imx_add_imx2_wdt(
+		const struct imx_imx2_wdt_data *data)
+{
+	struct resource res[] = {
+		{
+			.start = data->iobase,
+			.end = data->iobase + SZ_4K - 1,
+			.flags = IORESOURCE_MEM,
+		},
+	};
+	return imx_add_platform_device("imx2-wdt", 0,
+			res, ARRAY_SIZE(res), NULL, 0);
+}
arch/arm/plat-mxc/include/mach/devices-common.h +6 -0
index e31fc50..a0ac8454 100644
@@ -43,6 +43,12 @@ struct platform_device *__init imx_add_flexcan(int id,
 struct platform_device *__init imx_add_gpio_keys(
 		const struct gpio_keys_platform_data *pdata);
 
+struct imx_imx2_wdt_data {
+	resource_size_t iobase;
+};
+struct platform_device *__init imx_add_imx2_wdt(
+		const struct imx_imx2_wdt_data *data);
+
 #include <mach/i2c.h>
 struct imx_imx_i2c_data {
 	int id;
Signature · 1 line
1.7.2.3
#16 lore raw

PATCH 16/51 ARM: imx: change the way flexcan devices are registered

In reply to Uwe Kleine-König

Group soc specific data in a global struct instead of repeating it for each call to imxXX_add_flexcanX. The structs holding the actual data are placed in .init.constdata and so don't do much harm. Compared to the previous approach this reduces code size to call imx_add_flexcan.

---
 arch/arm/mach-mx25/devices-imx25.h              |    9 ++--
 arch/arm/mach-mx3/devices-imx35.h               |    9 ++--
 arch/arm/plat-mxc/devices/platform-flexcan.c    |   48 ++++++++++++++++++-----
 arch/arm/plat-mxc/include/mach/devices-common.h |   11 ++++-
 4 files changed, 56 insertions(+), 21 deletions(-)
arch/arm/mach-mx25/devices-imx25.h +5 -4
index 93afa10..f62ce93 100644
@@ -13,10 +13,11 @@ extern const struct imx_fec_data imx25_fec_data __initconst;
 #define imx25_add_fec(pdata)	\
 	imx_add_fec(&imx25_fec_data, pdata)
 
-#define imx25_add_flexcan0(pdata)	\
-	imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata)
-#define imx25_add_flexcan1(pdata)	\
-	imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata)
+extern const struct imx_flexcan_data imx25_flexcan_data[] __initconst;
+#define imx25_add_flexcan(id, pdata)	\
+	imx_add_flexcan(&imx25_flexcan_data[id], pdata)
+#define imx25_add_flexcan0(pdata)	imx25_add_flexcan(0, pdata)
+#define imx25_add_flexcan1(pdata)	imx25_add_flexcan(1, pdata)
 
 extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst;
 #define imx25_add_imx_i2c(id, pdata)	\
arch/arm/mach-mx3/devices-imx35.h +5 -4
index 7602cb4..a71ce68 100644
@@ -13,10 +13,11 @@ extern const struct imx_fec_data imx35_fec_data __initconst;
 #define imx35_add_fec(pdata)	\
 	imx_add_fec(&imx35_fec_data, pdata)
 
-#define imx35_add_flexcan0(pdata)	\
-	imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata)
-#define imx35_add_flexcan1(pdata)	\
-	imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata)
+extern const struct imx_flexcan_data imx35_flexcan_data[] __initconst;
+#define imx35_add_flexcan(id, pdata)	\
+	imx_add_flexcan(&imx35_flexcan_data[id], pdata)
+#define imx35_add_flexcan0(pdata)	imx35_add_flexcan(0, pdata)
+#define imx35_add_flexcan1(pdata)	imx35_add_flexcan(1, pdata)
 
 extern const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst;
 #define imx35_add_imx_i2c(id, pdata)	\
arch/arm/plat-mxc/devices/platform-flexcan.c +38 -10

64 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +8 -3
index a0ac8454..830369e 100644
@@ -34,9 +34,14 @@ struct platform_device *__init imx_add_fec(
 		const struct fec_platform_data *pdata);
 
 #include <linux/can/platform/flexcan.h>
-struct platform_device *__init imx_add_flexcan(int id,
-		resource_size_t iobase, resource_size_t iosize,
-		resource_size_t irq,
+struct imx_flexcan_data {
+	int id;
+	resource_size_t iobase;
+	resource_size_t iosize;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_flexcan(
+		const struct imx_flexcan_data *data,
 		const struct flexcan_platform_data *pdata);
 
 #include <linux/gpio_keys.h>
Signature · 1 line
1.7.2.3
#17 lore raw

PATCH 17/51 ARM: imx: dynamically register imx-fb devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/Kconfig                       |    9 +++-
 arch/arm/mach-imx/devices-imx21.h               |    4 ++
 arch/arm/mach-imx/devices-imx27.h               |    4 ++
 arch/arm/mach-imx/devices.c                     |   29 --------------
 arch/arm/mach-imx/devices.h                     |    1 -
 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c    |    5 +-
 arch/arm/mach-imx/mach-mx21ads.c                |    5 +-
 arch/arm/mach-imx/mach-mx27ads.c                |    5 +-
 arch/arm/mach-imx/mach-mxt_td60.c               |    5 +-
 arch/arm/mach-imx/mach-pca100.c                 |    5 +-
 arch/arm/mach-imx/pcm970-baseboard.c            |    6 +-
 arch/arm/plat-mxc/devices/Kconfig               |    3 +
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-imx-fb.c     |   46 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |    9 ++++
 arch/arm/plat-mxc/include/mach/imxfb.h          |    3 +
 16 files changed, 90 insertions(+), 50 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx-fb.c
arch/arm/mach-imx/Kconfig +7 -2
index 6b1662c..d3e983e 100644
@@ -71,6 +71,7 @@ comment "MX21 platforms:"
 
 config MACH_MX21ADS
 	bool "MX21ADS platform"
+	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	help
@@ -85,6 +86,7 @@ comment "MX27 platforms:"
 
 config MACH_MX27ADS
 	bool "MX27ADS platform"
+	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -112,8 +114,8 @@ choice
 	default MACH_PCM970_BASEBOARD
 
 config MACH_PCM970_BASEBOARD
-	prompt "PHYTEC PCM970 development board"
-	bool
+	bool "PHYTEC PCM970 development board"
+	select IMX_HAVE_PLATFORM_IMX_FB
 	help
 	  This adds board specific devices that can be found on Phytec's
 	  PCM970 evaluation board.
@@ -153,6 +155,7 @@ choice
 
 config MACH_EUKREA_MBIMX27_BASEBOARD
 	bool "Eukrea MBIMX27 development board"
+	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_SPI_IMX
@@ -188,6 +191,7 @@ config MACH_IMX27LITE
 config MACH_PCA100
 	bool "Phytec phyCARD-s (pca100)"
 	select IMX_HAVE_PLATFORM_IMX2_WDT
+	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -201,6 +205,7 @@ config MACH_PCA100
 
 config MACH_MXT_TD60
 	bool "Maxtrack i-MXT TD60"
+	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
arch/arm/mach-imx/devices-imx21.h +4 -0
index 738dbba..0f782b6 100644
@@ -13,6 +13,10 @@ extern const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst;
 #define imx21_add_imx2_wdt(pdata)	\
 	imx_add_imx2_wdt(&imx21_imx2_wdt_data)
 
+extern const struct imx_imx_fb_data imx21_imx_fb_data __initconst;
+#define imx21_add_imx_fb(pdata)	\
+	imx_add_imx_fb(&imx21_imx_fb_data, pdata)
+
 extern const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst;
 #define imx21_add_imx_i2c(pdata)	\
 	imx_add_imx_i2c(&imx21_imx_i2c_data, pdata)
arch/arm/mach-imx/devices-imx27.h +4 -0
index b2d4c51..6e11bef 100644
@@ -17,6 +17,10 @@ extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst;
 #define imx27_add_imx2_wdt(pdata)	\
 	imx_add_imx2_wdt(&imx27_imx2_wdt_data)
 
+extern const struct imx_imx_fb_data imx27_imx_fb_data __initconst;
+#define imx27_add_imx_fb(pdata)	\
+	imx_add_imx_fb(&imx27_imx_fb_data, pdata)
+
 extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst;
 #define imx27_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata)
arch/arm/mach-imx/devices.c +0 -29
index 20655fb..d784564 100644
@@ -77,35 +77,6 @@ int __init imx1_register_gpios(void)
 #endif
 
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-/*
- * lcdc:
- * - i.MX1: the basic controller
- * - i.MX21: to be checked
- * - i.MX27: like i.MX1, with slightly variations
- */
-static struct resource mxc_fb[] = {
-	{
-		.start = MX2x_LCDC_BASE_ADDR,
-		.end = MX2x_LCDC_BASE_ADDR + SZ_4K - 1,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = MX2x_INT_LCDC,
-		.end = MX2x_INT_LCDC,
-		.flags = IORESOURCE_IRQ,
-	}
-};
-
-/* mxc lcd driver */
-struct platform_device mxc_fb_device = {
-	.name = "imx-fb",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mxc_fb),
-	.resource = mxc_fb,
-	.dev = {
-		.coherent_dma_mask = DMA_BIT_MASK(32),
-	},
-};
-
 static struct resource mxc_pwm_resources[] = {
 	{
 		.start = MX2x_PWM_BASE_ADDR,
arch/arm/mach-imx/devices.h +0 -1
index f441b02..407e90a 100644
@@ -1,5 +1,4 @@
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-extern struct platform_device mxc_fb_device;
 extern struct platform_device mxc_pwm_device;
 extern struct platform_device mxc_sdhc_device0;
 extern struct platform_device mxc_sdhc_device1;
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +2 -3
index 026263c6..a226e25 100644
@@ -32,7 +32,6 @@
 
 #include <mach/common.h>
 #include <mach/iomux-mx27.h>
-#include <mach/imxfb.h>
 #include <mach/hardware.h>
 #include <mach/mmc.h>
 #include <mach/spi.h>
@@ -196,7 +195,7 @@ static struct imx_fb_videomode eukrea_mbimx27_modes[] = {
 	},
 };
 
-static struct imx_fb_platform_data eukrea_mbimx27_fb_data = {
+static const struct imx_fb_platform_data eukrea_mbimx27_fb_data __initconst = {
 	.mode = eukrea_mbimx27_modes,
 	.num_modes = ARRAY_SIZE(eukrea_mbimx27_modes),
 
@@ -351,7 +350,7 @@ void __init eukrea_mbimx27_baseboard_init(void)
 	imx27_add_imx_uart3(&uart_pdata);
 #endif
 
-	mxc_register_device(&mxc_fb_device, &eukrea_mbimx27_fb_data);
+	imx27_add_imx_fb(&eukrea_mbimx27_fb_data);
 	mxc_register_device(&mxc_sdhc_device0, &sdhc_pdata);
 
 	i2c_register_board_info(0, eukrea_mbimx27_i2c_devices,
arch/arm/mach-imx/mach-mx21ads.c +2 -3
index e1282e9..4820a67 100644
@@ -24,7 +24,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <mach/imxfb.h>
 #include <mach/iomux-mx21.h>
 #include <mach/mxc_nand.h>
 #include <mach/mmc.h>
@@ -213,7 +212,7 @@ static struct imx_fb_videomode mx21ads_modes[] = {
 	},
 };
 
-static struct imx_fb_platform_data mx21ads_fb_data = {
+static const struct imx_fb_platform_data mx21ads_fb_data __initconst = {
 	.mode = mx21ads_modes,
 	.num_modes = ARRAY_SIZE(mx21ads_modes),
 
@@ -296,7 +295,7 @@ static void __init mx21ads_board_init(void)
 	imx21_add_imx_uart0(&uart_pdata_rts);
 	imx21_add_imx_uart2(&uart_pdata_norts);
 	imx21_add_imx_uart3(&uart_pdata_rts);
-	mxc_register_device(&mxc_fb_device, &mx21ads_fb_data);
+	imx21_add_imx_fb(&mx21ads_fb_data);
 	mxc_register_device(&mxc_sdhc_device0, &mx21ads_sdhc_pdata);
 	imx21_add_mxc_nand(&mx21ads_nand_board_info);
 
arch/arm/mach-imx/mach-mx27ads.c +2 -3
index 219899a..d97b25b 100644
@@ -30,7 +30,6 @@
 #include <mach/gpio.h>
 #include <mach/iomux-mx27.h>
 #include <mach/mxc_nand.h>
-#include <mach/imxfb.h>
 #include <mach/mmc.h>
 
 #include "devices-imx27.h"
@@ -228,7 +227,7 @@ static struct imx_fb_videomode mx27ads_modes[] = {
 	},
 };
 
-static struct imx_fb_platform_data mx27ads_fb_data = {
+static const struct imx_fb_platform_data mx27ads_fb_data __initconst = {
 	.mode = mx27ads_modes,
 	.num_modes = ARRAY_SIZE(mx27ads_modes),
 
@@ -307,7 +306,7 @@ static void __init mx27ads_board_init(void)
 	i2c_register_board_info(1, mx27ads_i2c_devices,
 				ARRAY_SIZE(mx27ads_i2c_devices));
 	imx27_add_imx_i2c(1, &mx27ads_i2c1_data);
-	mxc_register_device(&mxc_fb_device, &mx27ads_fb_data);
+	imx27_add_imx_fb(&mx27ads_fb_data);
 	mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
 	mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata);
 
arch/arm/mach-imx/mach-mxt_td60.c +2 -3
index 38d3a4a..0c94485 100644
@@ -31,7 +31,6 @@
 #include <mach/iomux-mx27.h>
 #include <mach/mxc_nand.h>
 #include <linux/i2c/pca953x.h>
-#include <mach/imxfb.h>
 #include <mach/mmc.h>
 
 #include "devices-imx27.h"
@@ -196,7 +195,7 @@ static struct imx_fb_videomode mxt_td60_modes[] = {
 	},
 };
 
-static struct imx_fb_platform_data mxt_td60_fb_data = {
+static const struct imx_fb_platform_data mxt_td60_fb_data __initconst = {
 	.mode = mxt_td60_modes,
 	.num_modes = ARRAY_SIZE(mxt_td60_modes),
 
@@ -253,7 +252,7 @@ static void __init mxt_td60_board_init(void)
 
 	imx27_add_imx_i2c(0, &mxt_td60_i2c0_data);
 	imx27_add_imx_i2c(1, &mxt_td60_i2c1_data);
-	mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data);
+	imx27_add_imx_fb(&mxt_td60_fb_data);
 	mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
 	imx27_add_fec(NULL);
 }
arch/arm/mach-imx/mach-pca100.c +2 -3
index 11da9c2..30490c3 100644
@@ -43,7 +43,6 @@
 #include <mach/mmc.h>
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
-#include <mach/imxfb.h>
 
 #include "devices-imx27.h"
 #include "devices.h"
@@ -350,7 +349,7 @@ static struct imx_fb_videomode pca100_fb_modes[] = {
 	},
 };
 
-static struct imx_fb_platform_data pca100_fb_data = {
+static const struct imx_fb_platform_data pca100_fb_data __initconst = {
 	.mode = pca100_fb_modes,
 	.num_modes = ARRAY_SIZE(pca100_fb_modes),
 
@@ -425,7 +424,7 @@ static void __init pca100_init(void)
 		mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
 	}
 
-	mxc_register_device(&mxc_fb_device, &pca100_fb_data);
+	imx27_add_imx_fb(&pca100_fb_data);
 
 	imx27_add_fec(NULL);
 	imx27_add_imx2_wdt(NULL);
arch/arm/mach-imx/pcm970-baseboard.c +3 -3
index 9110d9c..9cf9460 100644
@@ -25,10 +25,10 @@
 
 #include <mach/common.h>
 #include <mach/iomux-mx27.h>
-#include <mach/imxfb.h>
 #include <mach/hardware.h>
 #include <mach/mmc.h>
 
+#include "devices-imx27.h"
 #include "devices.h"
 
 static const int pcm970_pins[] __initconst = {
@@ -179,7 +179,7 @@ static struct imx_fb_videomode pcm970_modes[] = {
 	},
 };
 
-static struct imx_fb_platform_data pcm038_fb_data = {
+static const struct imx_fb_platform_data pcm038_fb_data __initconst = {
 	.mode = pcm970_modes,
 	.num_modes = ARRAY_SIZE(pcm970_modes),
 
@@ -226,7 +226,7 @@ void __init pcm970_baseboard_init(void)
 	mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins),
 			"PCM970");
 
-	mxc_register_device(&mxc_fb_device, &pcm038_fb_data);
+	imx27_add_imx_fb(&pcm038_fb_data);
 	mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN);
 	mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
 	platform_device_register(&pcm970_sja1000);
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 01b0d0c..2542371 100644
@@ -16,6 +16,9 @@ config IMX_HAVE_PLATFORM_GPIO_KEYS
 config IMX_HAVE_PLATFORM_IMX2_WDT
 	bool
 
+config IMX_HAVE_PLATFORM_IMX_FB
+	bool
+
 config IMX_HAVE_PLATFORM_IMX_I2C
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index 224f665..d3f845e 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
 obj-y += platform-imx-dma.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
arch/arm/plat-mxc/devices/platform-imx-fb.c new file +46 -0

46 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +9 -0
index 830369e..b1d7656 100644
@@ -54,6 +54,15 @@ struct imx_imx2_wdt_data {
 struct platform_device *__init imx_add_imx2_wdt(
 		const struct imx_imx2_wdt_data *data);
 
+#include <mach/imxfb.h>
+struct imx_imx_fb_data {
+	resource_size_t iobase;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_imx_fb(
+		const struct imx_imx_fb_data *data,
+		const struct imx_fb_platform_data *pdata);
+
 #include <mach/i2c.h>
 struct imx_imx_i2c_data {
 	int id;
arch/arm/plat-mxc/include/mach/imxfb.h +3 -0
index 5263506..9de8f06 100644
@@ -1,6 +1,8 @@
 /*
  * This structure describes the machine which we are running on.
  */
+#ifndef __MACH_IMXFB_H__
+#define __MACH_IMXFB_H__
 
 #include <linux/fb.h>
 
@@ -79,3 +81,4 @@ struct imx_fb_platform_data {
 };
 
 void set_imx_fb_info(struct imx_fb_platform_data *);
+#endif /* ifndef __MACH_IMXFB_H__ */
Signature · 1 line
1.7.2.3
#18 lore raw

PATCH 18/51 ARM: mx3: enable SPI_IMX for better compile coverage

In reply to Uwe Kleine-König

SPI_IMX defaults to m for i.MX machines. So enabling SPI is enough.

---
 arch/arm/configs/mx3_defconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/configs/mx3_defconfig +1 -0
index f0c339f..e648ea3 100644
@@ -84,6 +84,7 @@ CONFIG_SERIAL_IMX_CONSOLE=y
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_IMX=y
+CONFIG_SPI=y
 CONFIG_W1=y
 CONFIG_W1_MASTER_MXC=y
 CONFIG_W1_SLAVE_THERM=y
Signature · 1 line
1.7.2.3
#19 lore raw

PATCH 19/51 ARM: imx: dynamically allocate mxc_pwm devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/devices.c                     |   19 ----------
 arch/arm/mach-imx/devices.h                     |    1 -
 arch/arm/plat-mxc/devices/Kconfig               |    3 ++
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-mxc_pwm.c    |   45 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |    7 ++++
 6 files changed, 56 insertions(+), 20 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc_pwm.c
arch/arm/mach-imx/devices.c +0 -19
index d784564..9ee0e09 100644
@@ -77,25 +77,6 @@ int __init imx1_register_gpios(void)
 #endif
 
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-static struct resource mxc_pwm_resources[] = {
-	{
-		.start = MX2x_PWM_BASE_ADDR,
-		.end = MX2x_PWM_BASE_ADDR + SZ_4K - 1,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = MX2x_INT_PWM,
-		.end = MX2x_INT_PWM,
-		.flags = IORESOURCE_IRQ,
-	}
-};
-
-struct platform_device mxc_pwm_device = {
-	.name = "mxc_pwm",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mxc_pwm_resources),
-	.resource = mxc_pwm_resources,
-};
-
 #define DEFINE_MXC_MMC_DEVICE(n, baseaddr, irq, dmareq)			\
 	static struct resource mxc_sdhc_resources ## n[] = {		\
 		{							\
arch/arm/mach-imx/devices.h +0 -1
index 407e90a..1ba5042 100644
@@ -1,5 +1,4 @@
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-extern struct platform_device mxc_pwm_device;
 extern struct platform_device mxc_sdhc_device0;
 extern struct platform_device mxc_sdhc_device1;
 extern struct platform_device mxc_otg_udc_device;
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 2542371..2ded17b 100644
@@ -40,6 +40,9 @@ config IMX_HAVE_PLATFORM_MX2_CAMERA
 config IMX_HAVE_PLATFORM_MXC_NAND
 	bool
 
+config IMX_HAVE_PLATFORM_MXC_PWM
+	bool
+
 config IMX_HAVE_PLATFORM_MXC_W1
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index d3f845e..8ecd974 100644
@@ -12,5 +12,6 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
arch/arm/plat-mxc/devices/platform-mxc_pwm.c new file +45 -0

45 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +7 -0
index b1d7656..e241e41 100644
@@ -168,6 +168,13 @@ struct platform_device *__init imx_add_mxc_nand(
 		const struct imx_mxc_nand_data *data,
 		const struct mxc_nand_platform_data *pdata);
 
+struct imx_mxc_pwm_data {
+	resource_size_t iobase;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_mxc_pwm(
+		const struct imx_mxc_pwm_data *data);
+
 struct imx_mxc_w1_data {
 	resource_size_t iobase;
 };
Signature · 1 line
1.7.2.3
#20 lore raw

PATCH 20/51 ARM: mx3/mach-pcm037_eet: Fix section mismatch for eet_init_devices()

In reply to Uwe Kleine-König

From: Alberto Panizzo <[email protected]>

This function should be marked as __init because it is used only in the init phase.

This fix the compiler warning:
LD arch/arm/mach-mx3/built-in.o
WARNING: arch/arm/mach-mx3/built-in.o(.text+0x1328): Section mismatch in reference from the function eet_init_devices() to the (unknown reference) .init.rodata:(unknown) The function eet_init_devices() references
the (unknown reference) __initconst (unknown).
This is often because eet_init_devices lacks a __initconst
annotation or the annotation of (unknown) is wrong.

---
 arch/arm/mach-mx3/mach-pcm037_eet.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-mx3/mach-pcm037_eet.c +1 -1
index 99e0894..3392812 100644
@@ -171,7 +171,7 @@ static struct platform_device pcm037_gpio_keys_device = {
 	},
 };
 
-static int eet_init_devices(void)
+static int __init eet_init_devices(void)
 {
 	if (!machine_is_pcm037() || pcm037_variant() != PCM037_EET)
 		return 0;
Signature · 1 line
1.7.2.3
#21 lore raw

PATCH 21/51 ARM: imx: dynamically register mxc-mmc devices

In reply to Uwe Kleine-König

... plus a trivial simplification of mx21ads_sdhc_init()

---
 arch/arm/mach-imx/Kconfig                       |    9 +++
 arch/arm/mach-imx/devices-imx21.h               |    4 ++
 arch/arm/mach-imx/devices-imx27.h               |    4 ++
 arch/arm/mach-imx/devices.c                     |   35 +------------
 arch/arm/mach-imx/devices.h                     |    2 -
 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c    |    5 +-
 arch/arm/mach-imx/mach-cpuimx27.c               |    2 +-
 arch/arm/mach-imx/mach-imx27_visstrim_m10.c     |    5 +-
 arch/arm/mach-imx/mach-mx21ads.c                |   14 +----
 arch/arm/mach-imx/mach-mx27_3ds.c               |    5 +-
 arch/arm/mach-imx/mach-mx27ads.c                |    9 ++--
 arch/arm/mach-imx/mach-mxt_td60.c               |    5 +-
 arch/arm/mach-imx/mach-pca100.c                 |    5 +-
 arch/arm/mach-imx/mach-pcm038.c                 |    2 +-
 arch/arm/mach-imx/pcm970-baseboard.c            |    5 +-
 arch/arm/plat-mxc/devices/Kconfig               |    3 +
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-mxc-mmc.c    |   62 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |   11 ++++
 19 files changed, 116 insertions(+), 72 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc-mmc.c
arch/arm/mach-imx/Kconfig +9 -0
index d3e983e..8e9297b 100644
@@ -73,6 +73,7 @@ config MACH_MX21ADS
 	bool "MX21ADS platform"
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	help
 	  Include support for MX21ADS platform. This includes specific
@@ -89,6 +90,7 @@ config MACH_MX27ADS
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_MXC_W1
 	help
@@ -116,6 +118,7 @@ choice
 config MACH_PCM970_BASEBOARD
 	bool "PHYTEC PCM970 development board"
 	select IMX_HAVE_PLATFORM_IMX_FB
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	help
 	  This adds board specific devices that can be found on Phytec's
 	  PCM970 evaluation board.
@@ -137,6 +140,7 @@ config MACH_CPUIMX27
 config MACH_EUKREA_CPUIMX27_USESDHC2
 	bool "CPUIMX27 integrates SDHC2 module"
 	depends on MACH_CPUIMX27
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	help
 	  This adds support for the internal SDHC2 used on CPUIMX27
 	  for wifi or eMMC.
@@ -158,6 +162,7 @@ config MACH_EUKREA_MBIMX27_BASEBOARD
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	help
 	  This adds board specific devices that can be found on Eukrea's
@@ -168,6 +173,7 @@ endchoice
 config MACH_MX27_3DS
 	bool "MX27PDK platform"
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	help
 	  Include support for MX27PDK platform. This includes specific
 	  configurations for the board and its peripherals.
@@ -176,6 +182,7 @@ config MACH_IMX27_VISSTRIM_M10
 	bool "Vista Silicon i.MX27 Visstrim_m10"
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	help
 	  Include support for Visstrim_m10 platform and its different variants.
 	  This includes specific configurations for the board and its
@@ -195,6 +202,7 @@ config MACH_PCA100
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_MXC_W1
 	select IMX_HAVE_PLATFORM_SPI_IMX
@@ -208,6 +216,7 @@ config MACH_MXT_TD60
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	help
 	  Include support for i-MXT (aka td60) platform. This
arch/arm/mach-imx/devices-imx21.h +4 -0
index 0f782b6..a97e921 100644
@@ -33,6 +33,10 @@ extern const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst;
 #define imx21_add_imx_uart2(pdata)	imx21_add_imx_uart(2, pdata)
 #define imx21_add_imx_uart3(pdata)	imx21_add_imx_uart(3, pdata)
 
+extern const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst;
+#define imx21_add_mxc_mmc(id, pdata)	\
+	imx_add_mxc_mmc(&imx21_mxc_mmc_data[id], pdata)
+
 extern const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst;
 #define imx21_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx21_mxc_nand_data, pdata)
arch/arm/mach-imx/devices-imx27.h +4 -0
index 6e11bef..6466744 100644
@@ -43,6 +43,10 @@ extern const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst;
 #define imx27_add_mx2_camera(pdata)	\
 	imx_add_mx2_camera(&imx27_mx2_camera_data, pdata)
 
+extern const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst;
+#define imx27_add_mxc_mmc(id, pdata)	\
+	imx_add_mxc_mmc(&imx27_mxc_mmc_data[id], pdata)
+
 extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst;
 #define imx27_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
arch/arm/mach-imx/devices.c +1 -34
index 9ee0e09..7609e8a 100644
@@ -76,40 +76,6 @@ int __init imx1_register_gpios(void)
 }
 #endif
 
-#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-#define DEFINE_MXC_MMC_DEVICE(n, baseaddr, irq, dmareq)			\
-	static struct resource mxc_sdhc_resources ## n[] = {		\
-		{							\
-			.start = baseaddr,				\
-			.end = baseaddr + SZ_4K - 1,			\
-			.flags = IORESOURCE_MEM,			\
-		}, {							\
-			.start = irq,					\
-			.end = irq,					\
-			.flags = IORESOURCE_IRQ,			\
-		}, {							\
-			.start = dmareq,				\
-			.end = dmareq,					\
-			.flags = IORESOURCE_DMA,			\
-		},							\
-	};								\
-									\
-	static u64 mxc_sdhc ## n ## _dmamask = DMA_BIT_MASK(32);	\
-									\
-	struct platform_device mxc_sdhc_device ## n = {			\
-		.name = "mxc-mmc",					\
-		.id = n,						\
-		.dev = {						\
-			.dma_mask = &mxc_sdhc ## n ## _dmamask,		\
-			.coherent_dma_mask = DMA_BIT_MASK(32),		\
-		},							\
-		.num_resources = ARRAY_SIZE(mxc_sdhc_resources ## n),	\
-		.resource = mxc_sdhc_resources ## n,		\
-	}
-
-DEFINE_MXC_MMC_DEVICE(0, MX2x_SDHC1_BASE_ADDR, MX2x_INT_SDHC1, MX2x_DMA_REQ_SDHC1);
-DEFINE_MXC_MMC_DEVICE(1, MX2x_SDHC2_BASE_ADDR, MX2x_INT_SDHC2, MX2x_DMA_REQ_SDHC2);
-
 #ifdef CONFIG_MACH_MX27
 static struct resource otg_resources[] = {
 	{
@@ -203,6 +169,7 @@ struct platform_device mxc_usbh2 = {
 };
 #endif
 
+#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
 /* GPIO port description */
 #define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq)				\
 	{								\
arch/arm/mach-imx/devices.h +0 -2
index 1ba5042..a45d760 100644
@@ -1,6 +1,4 @@
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-extern struct platform_device mxc_sdhc_device0;
-extern struct platform_device mxc_sdhc_device1;
 extern struct platform_device mxc_otg_udc_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +2 -3
index a226e25..fa5aade 100644
@@ -33,7 +33,6 @@
 #include <mach/common.h>
 #include <mach/iomux-mx27.h>
 #include <mach/hardware.h>
-#include <mach/mmc.h>
 #include <mach/spi.h>
 #include <mach/audmux.h>
 
@@ -305,7 +304,7 @@ static struct platform_device *platform_devices[] __initdata = {
 	&leds_gpio,
 };
 
-static struct imxmmc_platform_data sdhc_pdata = {
+static const struct imxmmc_platform_data sdhc_pdata __initconst = {
 	.dat3_card_detect = 1,
 };
 
@@ -351,7 +350,7 @@ void __init eukrea_mbimx27_baseboard_init(void)
 #endif
 
 	imx27_add_imx_fb(&eukrea_mbimx27_fb_data);
-	mxc_register_device(&mxc_sdhc_device0, &sdhc_pdata);
+	imx27_add_mxc_mmc(0, &sdhc_pdata);
 
 	i2c_register_board_info(0, eukrea_mbimx27_i2c_devices,
 				ARRAY_SIZE(eukrea_mbimx27_i2c_devices));
arch/arm/mach-imx/mach-cpuimx27.c +1 -1
index 5771d4e..06ff79a 100644
@@ -265,7 +265,7 @@ static void __init eukrea_cpuimx27_init(void)
 
 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
 	/* SDHC2 can be used for Wifi */
-	mxc_register_device(&mxc_sdhc_device1, NULL);
+	imx27_add_mxc_mmc(1, NULL);
 #endif
 #if defined(MACH_EUKREA_CPUIMX27_USEUART4)
 	/* in which case UART4 is also used for Bluetooth */
arch/arm/mach-imx/mach-imx27_visstrim_m10.c +2 -3
index 59716fa..deef1fa 100644
@@ -34,7 +34,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <mach/common.h>
-#include <mach/mmc.h>
 #include <mach/iomux.h>
 #include <mach/mxc_ehci.h>
 
@@ -156,7 +155,7 @@ static void visstrim_m10_sdhc1_exit(struct device *dev, void *data)
 	free_irq(SDHC1_IRQ, data);
 }
 
-static struct imxmmc_platform_data visstrim_m10_sdhc_pdata = {
+static const struct imxmmc_platform_data visstrim_m10_sdhc_pdata __initconst = {
 	.init = visstrim_m10_sdhc1_init,
 	.exit = visstrim_m10_sdhc1_exit,
 };
@@ -237,7 +236,7 @@ static void __init visstrim_m10_board_init(void)
 				ARRAY_SIZE(visstrim_m10_i2c_devices));
 	imx27_add_imx_i2c(0, &visstrim_m10_i2c_data);
 	imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
-	mxc_register_device(&mxc_sdhc_device0, &visstrim_m10_sdhc_pdata);
+	imx27_add_mxc_mmc(0, &visstrim_m10_sdhc_pdata);
 	mxc_register_device(&mxc_otg_host, &visstrim_m10_usbotg_pdata);
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
arch/arm/mach-imx/mach-mx21ads.c +3 -11
index 4820a67..83c064a 100644
@@ -26,7 +26,6 @@
 #include <asm/mach/map.h>
 #include <mach/iomux-mx21.h>
 #include <mach/mxc_nand.h>
-#include <mach/mmc.h>
 
 #include "devices-imx21.h"
 #include "devices.h"
@@ -232,15 +231,8 @@ static int mx21ads_sdhc_get_ro(struct device *dev)
 static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq,
 	void *data)
 {
-	int ret;
-
-	ret = request_irq(IRQ_GPIOD(25), detect_irq,
+	return request_irq(IRQ_GPIOD(25), detect_irq,
 		IRQF_TRIGGER_FALLING, "mmc-detect", data);
-	if (ret)
-		goto out;
-	return 0;
-out:
-	return ret;
 }
 
 static void mx21ads_sdhc_exit(struct device *dev, void *data)
@@ -248,7 +240,7 @@ static void mx21ads_sdhc_exit(struct device *dev, void *data)
 	free_irq(IRQ_GPIOD(25), data);
 }
 
-static struct imxmmc_platform_data mx21ads_sdhc_pdata = {
+static const struct imxmmc_platform_data mx21ads_sdhc_pdata __initconst = {
 	.ocr_avail = MMC_VDD_29_30 | MMC_VDD_30_31, /* 3.0V */
 	.get_ro = mx21ads_sdhc_get_ro,
 	.init = mx21ads_sdhc_init,
@@ -296,7 +288,7 @@ static void __init mx21ads_board_init(void)
 	imx21_add_imx_uart2(&uart_pdata_norts);
 	imx21_add_imx_uart3(&uart_pdata_rts);
 	imx21_add_imx_fb(&mx21ads_fb_data);
-	mxc_register_device(&mxc_sdhc_device0, &mx21ads_sdhc_pdata);
+	imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata);
 	imx21_add_mxc_nand(&mx21ads_nand_board_info);
 
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
arch/arm/mach-imx/mach-mx27_3ds.c +2 -3
index 84a5ba0..e6212c3 100644
@@ -30,7 +30,6 @@
 #include <mach/hardware.h>
 #include <mach/common.h>
 #include <mach/iomux-mx27.h>
-#include <mach/mmc.h>
 
 #include "devices-imx27.h"
 #include "devices.h"
@@ -109,7 +108,7 @@ static void mx27_3ds_sdhc1_exit(struct device *dev, void *data)
 	free_irq(IRQ_GPIOB(26), data);
 }
 
-static struct imxmmc_platform_data sdhc1_pdata = {
+static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
 	.init = mx27_3ds_sdhc1_init,
 	.exit = mx27_3ds_sdhc1_exit,
 };
@@ -129,7 +128,7 @@ static void __init mx27pdk_init(void)
 	imx27_add_imx_uart0(&uart_pdata);
 	imx27_add_fec(NULL);
 	mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
-	mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
+	imx27_add_mxc_mmc(0, &sdhc1_pdata);
 }
 
 static void __init mx27pdk_timer_init(void)
arch/arm/mach-imx/mach-mx27ads.c +4 -5
index d97b25b..370481b 100644
@@ -30,7 +30,6 @@
 #include <mach/gpio.h>
 #include <mach/iomux-mx27.h>
 #include <mach/mxc_nand.h>
-#include <mach/mmc.h>
 
 #include "devices-imx27.h"
 #include "devices.h"
@@ -271,12 +270,12 @@ static void mx27ads_sdhc2_exit(struct device *dev, void *data)
 	free_irq(IRQ_GPIOB(7), data);
 }
 
-static struct imxmmc_platform_data sdhc1_pdata = {
+static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
 	.init = mx27ads_sdhc1_init,
 	.exit = mx27ads_sdhc1_exit,
 };
 
-static struct imxmmc_platform_data sdhc2_pdata = {
+static const struct imxmmc_platform_data sdhc2_pdata __initconst = {
 	.init = mx27ads_sdhc2_init,
 	.exit = mx27ads_sdhc2_exit,
 };
@@ -307,8 +306,8 @@ static void __init mx27ads_board_init(void)
 				ARRAY_SIZE(mx27ads_i2c_devices));
 	imx27_add_imx_i2c(1, &mx27ads_i2c1_data);
 	imx27_add_imx_fb(&mx27ads_fb_data);
-	mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
-	mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata);
+	imx27_add_mxc_mmc(0, &sdhc1_pdata);
+	imx27_add_mxc_mmc(1, &sdhc2_pdata);
 
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
arch/arm/mach-imx/mach-mxt_td60.c +2 -3
index 0c94485..d1a3158 100644
@@ -31,7 +31,6 @@
 #include <mach/iomux-mx27.h>
 #include <mach/mxc_nand.h>
 #include <linux/i2c/pca953x.h>
-#include <mach/mmc.h>
 
 #include "devices-imx27.h"
 #include "devices.h"
@@ -225,7 +224,7 @@ static void mxt_td60_sdhc1_exit(struct device *dev, void *data)
 	free_irq(IRQ_GPIOF(8), data);
 }
 
-static struct imxmmc_platform_data sdhc1_pdata = {
+static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
 	.init = mxt_td60_sdhc1_init,
 	.exit = mxt_td60_sdhc1_exit,
 };
@@ -253,7 +252,7 @@ static void __init mxt_td60_board_init(void)
 	imx27_add_imx_i2c(0, &mxt_td60_i2c0_data);
 	imx27_add_imx_i2c(1, &mxt_td60_i2c1_data);
 	imx27_add_imx_fb(&mxt_td60_fb_data);
-	mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
+	imx27_add_mxc_mmc(0, &sdhc1_pdata);
 	imx27_add_fec(NULL);
 }
 
arch/arm/mach-imx/mach-pca100.c +2 -3
index 30490c3..b05f528 100644
@@ -40,7 +40,6 @@
 #include <mach/audmux.h>
 #include <mach/mxc_nand.h>
 #include <mach/irqs.h>
-#include <mach/mmc.h>
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
@@ -268,7 +267,7 @@ static void pca100_sdhc2_exit(struct device *dev, void *data)
 	free_irq(IRQ_GPIOC(29), data);
 }
 
-static struct imxmmc_platform_data sdhc_pdata = {
+static const struct imxmmc_platform_data sdhc_pdata __initconst = {
 	.init = pca100_sdhc2_init,
 	.exit = pca100_sdhc2_exit,
 };
@@ -383,7 +382,7 @@ static void __init pca100_init(void)
 
 	imx27_add_imx_uart0(&uart_pdata);
 
-	mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
+	imx27_add_mxc_mmc(1, &sdhc_pdata);
 
 	imx27_add_mxc_nand(&pca100_nand_board_info);
 
arch/arm/mach-imx/mach-pcm038.c +1 -1
index 3c9f2df..b3340cd 100644
@@ -212,7 +212,7 @@ static const struct spi_imx_master pcm038_spi0_data __initconst = {
 
 static struct regulator_consumer_supply sdhc1_consumers[] = {
 	{
-		.dev	= &mxc_sdhc_device1.dev,
+		.dev_name = "mxc-mmc.1",
 		.supply	= "sdhc_vcc",
 	},
 };
arch/arm/mach-imx/pcm970-baseboard.c +2 -3
index 9cf9460..1297f1b 100644
@@ -26,7 +26,6 @@
 #include <mach/common.h>
 #include <mach/iomux-mx27.h>
 #include <mach/hardware.h>
-#include <mach/mmc.h>
 
 #include "devices-imx27.h"
 #include "devices.h"
@@ -119,7 +118,7 @@ static void pcm970_sdhc2_exit(struct device *dev, void *data)
 	gpio_free(GPIO_PORTC + 28);
 }
 
-static struct imxmmc_platform_data sdhc_pdata = {
+static const struct imxmmc_platform_data sdhc_pdata __initconst = {
 	.get_ro = pcm970_sdhc2_get_ro,
 	.init = pcm970_sdhc2_init,
 	.exit = pcm970_sdhc2_exit,
@@ -228,6 +227,6 @@ void __init pcm970_baseboard_init(void)
 
 	imx27_add_imx_fb(&pcm038_fb_data);
 	mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN);
-	mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
+	imx27_add_mxc_mmc(1, &sdhc_pdata);
 	platform_device_register(&pcm970_sja1000);
 }
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 2ded17b..6560cf5 100644
@@ -37,6 +37,9 @@ config IMX_HAVE_PLATFORM_MX1_CAMERA
 config IMX_HAVE_PLATFORM_MX2_CAMERA
 	bool
 
+config IMX_HAVE_PLATFORM_MXC_MMC
+	bool
+
 config IMX_HAVE_PLATFORM_MXC_NAND
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index 8ecd974..d2b7a91 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
arch/arm/plat-mxc/devices/platform-mxc-mmc.c new file +62 -0

62 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +11 -0
index e241e41..bb3b29c 100644
@@ -151,6 +151,17 @@ struct platform_device *__init imx_add_mx2_camera(
 		const struct imx_mx2_camera_data *data,
 		const struct mx2_camera_platform_data *pdata);
 
+#include <mach/mmc.h>
+struct imx_mxc_mmc_data {
+	int id;
+	resource_size_t iobase;
+	resource_size_t irq;
+	resource_size_t dmareq;
+};
+struct platform_device *__init imx_add_mxc_mmc(
+		const struct imx_mxc_mmc_data *data,
+		const struct imxmmc_platform_data *pdata);
+
 #include <mach/mxc_nand.h>
 struct imx_mxc_nand_data {
 	/*
Signature · 1 line
1.7.2.3
#22 lore raw

PATCH 22/51 ARM: imx: dynamically allocate mxc-ehci devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/Kconfig                       |    4 +
 arch/arm/mach-imx/devices-imx27.h               |    7 ++
 arch/arm/mach-imx/devices.c                     |   73 +---------------------
 arch/arm/mach-imx/devices.h                     |    3 -
 arch/arm/mach-imx/mach-cpuimx27.c               |    9 +--
 arch/arm/mach-imx/mach-imx27_visstrim_m10.c     |    6 +-
 arch/arm/mach-imx/mach-pca100.c                 |    9 +--
 arch/arm/mach-imx/mach-pcm038.c                 |    5 +-
 arch/arm/plat-mxc/devices/Kconfig               |    3 +
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-mxc-ehci.c   |   46 ++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |   10 +++
 arch/arm/plat-mxc/include/mach/mx27.h           |   12 ++--
 13 files changed, 95 insertions(+), 93 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc-ehci.c
arch/arm/mach-imx/Kconfig +4 -0
index 8e9297b..025e969 100644
@@ -102,6 +102,7 @@ config MACH_PCM038
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_MXC_W1
 	select IMX_HAVE_PLATFORM_SPI_IMX
@@ -130,6 +131,7 @@ config MACH_CPUIMX27
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_MXC_W1
 	select MXC_ULPI if USB_ULPI
@@ -183,6 +185,7 @@ config MACH_IMX27_VISSTRIM_M10
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	help
 	  Include support for Visstrim_m10 platform and its different variants.
 	  This includes specific configurations for the board and its
@@ -202,6 +205,7 @@ config MACH_PCA100
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_MXC_W1
arch/arm/mach-imx/devices-imx27.h +7 -0
index 6466744..51b9155 100644
@@ -43,6 +43,13 @@ extern const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst;
 #define imx27_add_mx2_camera(pdata)	\
 	imx_add_mx2_camera(&imx27_mx2_camera_data, pdata)
 
+extern const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst;
+#define imx27_add_mxc_ehci_otg(pdata)	\
+	imx_add_mxc_ehci(&imx27_mxc_ehci_otg_data, pdata)
+extern const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst;
+#define imx27_add_mxc_ehci_hs(id, pdata)	\
+	imx_add_mxc_ehci(&imx27_mxc_ehci_hs_data[id - 1], pdata)
+
 extern const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst;
 #define imx27_add_mxc_mmc(id, pdata)	\
 	imx_add_mxc_mmc(&imx27_mxc_mmc_data[id], pdata)
arch/arm/mach-imx/devices.c +4 -69

87 lines not on this page · raw message

arch/arm/mach-imx/devices.h +0 -3
index a45d760..7a00bba 100644
@@ -1,8 +1,5 @@
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
 extern struct platform_device mxc_otg_udc_device;
-extern struct platform_device mxc_otg_host;
-extern struct platform_device mxc_usbh1;
-extern struct platform_device mxc_usbh2;
 extern struct platform_device mx21_usbhc_device;
 extern struct platform_device imx_kpp_device;
 #endif
arch/arm/mach-imx/mach-cpuimx27.c +4 -5
index 06ff79a..c70b038 100644
@@ -40,7 +40,6 @@
 #include <mach/hardware.h>
 #include <mach/iomux-mx27.h>
 #include <mach/mxc_nand.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include "devices-imx27.h"
@@ -213,12 +212,12 @@ static struct platform_device serial_device = {
 #endif
 
 #if defined(CONFIG_USB_ULPI)
-static struct mxc_usbh_platform_data otg_pdata = {
+static struct mxc_usbh_platform_data otg_pdata __initdata = {
 	.portsc	= MXC_EHCI_MODE_ULPI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
 };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 	.portsc	= MXC_EHCI_MODE_ULPI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
 };
@@ -281,13 +280,13 @@ static void __init eukrea_cpuimx27_init(void)
 		otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-		mxc_register_device(&mxc_otg_host, &otg_pdata);
+		imx27_add_mxc_ehci_otg(&otg_pdata);
 	}
 
 	usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
 #endif
 	if (!otg_mode_host)
 		mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
arch/arm/mach-imx/mach-imx27_visstrim_m10.c +3 -3
index deef1fa..c9f12e4 100644
@@ -35,7 +35,6 @@
 #include <asm/mach/time.h>
 #include <mach/common.h>
 #include <mach/iomux.h>
-#include <mach/mxc_ehci.h>
 
 #include "devices-imx27.h"
 #include "devices.h"
@@ -215,7 +214,8 @@ static int otg_phy_init(struct platform_device *pdev)
 	return 0;
 }
 
-static struct mxc_usbh_platform_data visstrim_m10_usbotg_pdata = {
+static const struct mxc_usbh_platform_data
+visstrim_m10_usbotg_pdata __initconst = {
 	.init = otg_phy_init,
 	.portsc	= MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED,
@@ -237,7 +237,7 @@ static void __init visstrim_m10_board_init(void)
 	imx27_add_imx_i2c(0, &visstrim_m10_i2c_data);
 	imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
 	imx27_add_mxc_mmc(0, &visstrim_m10_sdhc_pdata);
-	mxc_register_device(&mxc_otg_host, &visstrim_m10_usbotg_pdata);
+	imx27_add_mxc_ehci_otg(&visstrim_m10_usbotg_pdata);
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 }
arch/arm/mach-imx/mach-pca100.c +4 -5
index b05f528..683374d 100644
@@ -40,7 +40,6 @@
 #include <mach/audmux.h>
 #include <mach/mxc_nand.h>
 #include <mach/irqs.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include "devices-imx27.h"
@@ -279,7 +278,7 @@ static int otg_phy_init(struct platform_device *pdev)
 	return 0;
 }
 
-static struct mxc_usbh_platform_data otg_pdata = {
+static struct mxc_usbh_platform_data otg_pdata __initdata = {
 	.init	= otg_phy_init,
 	.portsc	= MXC_EHCI_MODE_ULPI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
@@ -291,7 +290,7 @@ static int usbh2_phy_init(struct platform_device *pdev)
 	return 0;
 }
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 	.init	= usbh2_phy_init,
 	.portsc	= MXC_EHCI_MODE_ULPI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
@@ -410,13 +409,13 @@ static void __init pca100_init(void)
 		otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-		mxc_register_device(&mxc_otg_host, &otg_pdata);
+		imx27_add_mxc_ehci_otg(&otg_pdata);
 	}
 
 	usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
 #endif
 	if (!otg_mode_host) {
 		gpio_set_value(OTG_PHY_CS_GPIO, 0);
arch/arm/mach-imx/mach-pcm038.c +2 -3
index b3340cd..e209b28 100644
@@ -37,7 +37,6 @@
 #include <mach/hardware.h>
 #include <mach/iomux-mx27.h>
 #include <mach/mxc_nand.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include "devices-imx27.h"
@@ -283,7 +282,7 @@ static struct spi_board_info pcm038_spi_board_info[] __initdata = {
 	}
 };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
 	.portsc	= MXC_EHCI_MODE_ULPI,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_DIFF_UNI,
 };
@@ -320,7 +319,7 @@ static void __init pcm038_init(void)
 	spi_register_board_info(pcm038_spi_board_info,
 				ARRAY_SIZE(pcm038_spi_board_info));
 
-	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
 
 	imx27_add_fec(NULL);
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 6560cf5..d2d096c 100644
@@ -37,6 +37,9 @@ config IMX_HAVE_PLATFORM_MX1_CAMERA
 config IMX_HAVE_PLATFORM_MX2_CAMERA
 	bool
 
+config IMX_HAVE_PLATFORM_MXC_EHCI
+	bool
+
 config IMX_HAVE_PLATFORM_MXC_MMC
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index d2b7a91..c8734bd 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
arch/arm/plat-mxc/devices/platform-mxc-ehci.c new file +46 -0

46 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +10 -0
index bb3b29c..7df7a9f 100644
@@ -151,6 +151,16 @@ struct platform_device *__init imx_add_mx2_camera(
 		const struct imx_mx2_camera_data *data,
 		const struct mx2_camera_platform_data *pdata);
 
+#include <mach/mxc_ehci.h>
+struct imx_mxc_ehci_data {
+	int id;
+	resource_size_t iobase;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_mxc_ehci(
+		const struct imx_mxc_ehci_data *data,
+		const struct mxc_usbh_platform_data *pdata);
+
 #include <mach/mmc.h>
 struct imx_mxc_mmc_data {
 	int id;
arch/arm/plat-mxc/include/mach/mx27.h +7 -5
index 2734d24..45419b3 100644
@@ -64,8 +64,10 @@
 #define MX27_LCDC_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x21000)
 #define MX27_SLCDC_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x22000)
 #define MX27_VPU_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x23000)
-#define MX27_USBOTG_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x24000)
-#define MX27_OTG_BASE_ADDR			MX27_USBOTG_BASE_ADDR
+#define MX27_USB_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x24000)
+#define MX27_USB_OTG_BASE_ADDR			(MX27_USB_BASE_ADDR + 0x0000)
+#define MX27_USB_HS1_BASE_ADDR			(MX27_USB_BASE_ADDR + 0x0200)
+#define MX27_USB_HS2_BASE_ADDR			(MX27_USB_BASE_ADDR + 0x0400)
 #define MX27_SAHARA_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x25000)
 #define MX27_EMMAPP_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x26000)
 #define MX27_EMMAPRP_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x26400)
@@ -187,9 +189,9 @@ static inline void mx27_setup_weimcs(size_t cs,
 #define MX27_INT_EMMAPRP	51
 #define MX27_INT_EMMAPP		52
 #define MX27_INT_VPU		53
-#define MX27_INT_USB1		54
-#define MX27_INT_USB2		55
-#define MX27_INT_USB3		56
+#define MX27_INT_USB_HS1	54
+#define MX27_INT_USB_HS2	55
+#define MX27_INT_USB_OTG	56
 #define MX27_INT_SCC_SMN	57
 #define MX27_INT_SCC_SCM	58
 #define MX27_INT_SAHARA		59
Signature · 1 line
1.7.2.3
#23 lore raw

PATCH 23/51 ARM: imx: dynamically allocate fsl-usb2-udc devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/Kconfig                         |    2 +
 arch/arm/mach-imx/devices-imx27.h                 |    4 ++
 arch/arm/mach-imx/devices.c                       |   28 --------------
 arch/arm/mach-imx/devices.h                       |    1 -
 arch/arm/mach-imx/mach-cpuimx27.c                 |    5 +--
 arch/arm/mach-imx/mach-pca100.c                   |    5 +--
 arch/arm/plat-mxc/devices/Kconfig                 |    3 ++
 arch/arm/plat-mxc/devices/Makefile                |    1 +
 arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c |   41 +++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h   |    9 +++++
 10 files changed, 64 insertions(+), 35 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c
arch/arm/mach-imx/Kconfig +2 -0
index 025e969..e50a164 100644
@@ -128,6 +128,7 @@ endchoice
 
 config MACH_CPUIMX27
 	bool "Eukrea CPUIMX27 module"
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -200,6 +201,7 @@ config MACH_IMX27LITE
 
 config MACH_PCA100
 	bool "Phytec phyCARD-s (pca100)"
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
arch/arm/mach-imx/devices-imx27.h +4 -0
index 51b9155..51bb42d 100644
@@ -13,6 +13,10 @@ extern const struct imx_fec_data imx27_fec_data __initconst;
 #define imx27_add_fec(pdata)	\
 	imx_add_fec(&imx27_fec_data, pdata)
 
+extern const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst;
+#define imx27_add_fsl_usb2_udc(pdata)	\
+	imx_add_fsl_usb2_udc(&imx27_fsl_usb2_udc_data, pdata)
+
 extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst;
 #define imx27_add_imx2_wdt(pdata)	\
 	imx_add_imx2_wdt(&imx27_imx2_wdt_data)
arch/arm/mach-imx/devices.c +0 -28
index 2a6d707..d026cfb 100644
@@ -76,34 +76,6 @@ int __init imx1_register_gpios(void)
 }
 #endif
 
-#ifdef CONFIG_MACH_MX27
-static struct resource otg_resources[] = {
-	{
-		.start = MX27_USB_OTG_BASE_ADDR,
-		.end = MX27_USB_OTG_BASE_ADDR + 0x1ff,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = MX27_INT_USB_OTG,
-		.end = MX27_INT_USB_OTG,
-		.flags = IORESOURCE_IRQ,
-	},
-};
-
-static u64 otg_dmamask = DMA_BIT_MASK(32);
-
-/* OTG gadget device */
-struct platform_device mxc_otg_udc_device = {
-	.name		= "fsl-usb2-udc",
-	.id		= -1,
-	.dev		= {
-		.dma_mask		= &otg_dmamask,
-		.coherent_dma_mask	= DMA_BIT_MASK(32),
-	},
-	.resource	= otg_resources,
-	.num_resources	= ARRAY_SIZE(otg_resources),
-};
-#endif
-
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
 /* GPIO port description */
 #define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq)				\
arch/arm/mach-imx/devices.h +0 -1
index 7a00bba..a788566 100644
@@ -1,5 +1,4 @@
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-extern struct platform_device mxc_otg_udc_device;
 extern struct platform_device mx21_usbhc_device;
 extern struct platform_device imx_kpp_device;
 #endif
arch/arm/mach-imx/mach-cpuimx27.c +2 -3
index c70b038..9ae5bed 100644
@@ -28,7 +28,6 @@
 #include <linux/serial_8250.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
-#include <linux/fsl_devices.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -223,7 +222,7 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 };
 #endif
 
-static struct fsl_usb2_platform_data otg_device_pdata = {
+static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
 	.operating_mode = FSL_USB2_DR_DEVICE,
 	.phy_mode       = FSL_USB2_PHY_ULPI,
 };
@@ -289,7 +288,7 @@ static void __init eukrea_cpuimx27_init(void)
 	imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
 #endif
 	if (!otg_mode_host)
-		mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
+		imx27_add_fsl_usb2_udc(&otg_device_pdata);
 
 #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
 	eukrea_mbimx27_baseboard_init();
arch/arm/mach-imx/mach-pca100.c +2 -3
index 683374d..d9e2dda 100644
@@ -29,7 +29,6 @@
 #include <linux/gpio.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
-#include <linux/fsl_devices.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
@@ -297,7 +296,7 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 };
 #endif
 
-static struct fsl_usb2_platform_data otg_device_pdata = {
+static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
 	.operating_mode = FSL_USB2_DR_DEVICE,
 	.phy_mode       = FSL_USB2_PHY_ULPI,
 };
@@ -419,7 +418,7 @@ static void __init pca100_init(void)
 #endif
 	if (!otg_mode_host) {
 		gpio_set_value(OTG_PHY_CS_GPIO, 0);
-		mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
+		imx27_add_fsl_usb2_udc(&otg_device_pdata);
 	}
 
 	imx27_add_imx_fb(&pca100_fb_data);
arch/arm/plat-mxc/devices/Kconfig +3 -0
index d2d096c..26196d9 100644
@@ -9,6 +9,9 @@ config IMX_HAVE_PLATFORM_FLEXCAN
 	select HAVE_CAN_FLEXCAN if CAN
 	bool
 
+config IMX_HAVE_PLATFORM_FSL_USB2_UDC
+	bool
+
 config IMX_HAVE_PLATFORM_GPIO_KEYS
 	bool
 	default y if ARCH_MX51
arch/arm/plat-mxc/devices/Makefile +1 -0
index c8734bd..e40897e 100644
@@ -1,6 +1,7 @@
 obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
 obj-y += platform-imx-dma.o
arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c new file +41 -0

41 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +9 -0
index 7df7a9f..f01fd28 100644
@@ -44,6 +44,15 @@ struct platform_device *__init imx_add_flexcan(
 		const struct imx_flexcan_data *data,
 		const struct flexcan_platform_data *pdata);
 
+#include <linux/fsl_devices.h>
+struct imx_fsl_usb2_udc_data {
+	resource_size_t iobase;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_fsl_usb2_udc(
+		const struct imx_fsl_usb2_udc_data *data,
+		const struct fsl_usb2_platform_data *pdata);
+
 #include <linux/gpio_keys.h>
 struct platform_device *__init imx_add_gpio_keys(
 		const struct gpio_keys_platform_data *pdata);
Signature · 1 line
1.7.2.3
#24 lore raw

PATCH 24/51 ARM: imx: dynamically allocate imx-keypad devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/Kconfig                       |    2 +
 arch/arm/mach-imx/devices-imx21.h               |    4 ++
 arch/arm/mach-imx/devices-imx27.h               |    4 ++
 arch/arm/mach-imx/devices.c                     |   19 ---------
 arch/arm/mach-imx/devices.h                     |    1 -
 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c    |    6 +-
 arch/arm/mach-imx/mach-mx27_3ds.c               |    5 +-
 arch/arm/plat-mxc/devices/Kconfig               |    3 +
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-imx-keypad.c |   46 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |    9 ++++
 11 files changed, 74 insertions(+), 26 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx-keypad.c
arch/arm/mach-imx/Kconfig +2 -0
index e50a164..86bab49 100644
@@ -163,6 +163,7 @@ choice
 config MACH_EUKREA_MBIMX27_BASEBOARD
 	bool "Eukrea MBIMX27 development board"
 	select IMX_HAVE_PLATFORM_IMX_FB
+	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -175,6 +176,7 @@ endchoice
 
 config MACH_MX27_3DS
 	bool "MX27PDK platform"
+	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	help
arch/arm/mach-imx/devices-imx21.h +4 -0
index a97e921..0c0eab1 100644
@@ -21,6 +21,10 @@ extern const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst;
 #define imx21_add_imx_i2c(pdata)	\
 	imx_add_imx_i2c(&imx21_imx_i2c_data, pdata)
 
+extern const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst;
+#define imx21_add_imx_keypad(pdata)	\
+	imx_add_imx_keypad(&imx21_imx_keypad_data, pdata)
+
 extern const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst;
 #define imx21_add_imx_ssi(id, pdata)	\
 	imx_add_imx_ssi(&imx21_imx_ssi_data[id], pdata)
arch/arm/mach-imx/devices-imx27.h +4 -0
index 51bb42d..f1272d4 100644
@@ -29,6 +29,10 @@ extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst;
 #define imx27_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata)
 
+extern const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst;
+#define imx27_add_imx_keypad(pdata)	\
+	imx_add_imx_keypad(&imx27_imx_keypad_data, pdata)
+
 extern const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst;
 #define imx27_add_imx_ssi(id, pdata)    \
 	imx_add_imx_ssi(&imx27_imx_ssi_data[id], pdata)
arch/arm/mach-imx/devices.c +0 -19
index d026cfb..4360b9c 100644
@@ -149,23 +149,4 @@ struct platform_device mx21_usbhc_device = {
 };
 #endif
 
-static struct resource imx_kpp_resources[] = {
-	{
-		.start  = MX2x_KPP_BASE_ADDR,
-		.end    = MX2x_KPP_BASE_ADDR + 0xf,
-		.flags  = IORESOURCE_MEM
-	}, {
-		.start  = MX2x_INT_KPP,
-		.end    = MX2x_INT_KPP,
-		.flags  = IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device imx_kpp_device = {
-	.name = "imx-keypad",
-	.id = -1,
-	.num_resources = ARRAY_SIZE(imx_kpp_resources),
-	.resource = imx_kpp_resources,
-};
-
 #endif
arch/arm/mach-imx/devices.h +0 -1
index a788566..d1e7f48 100644
@@ -1,4 +1,3 @@
 #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
 extern struct platform_device mx21_usbhc_device;
-extern struct platform_device imx_kpp_device;
 #endif
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +3 -3
index fa5aade..3aaa3b9 100644
@@ -26,7 +26,6 @@
 #include <linux/spi/ads7846.h>
 #include <linux/backlight.h>
 #include <video/platform_lcd.h>
-#include <linux/input/matrix_keypad.h>
 
 #include <asm/mach/arch.h>
 
@@ -109,7 +108,8 @@ static const uint32_t eukrea_mbimx27_keymap[] = {
 	KEY(1, 1, KEY_LEFT),
 };
 
-static struct matrix_keymap_data eukrea_mbimx27_keymap_data = {
+static const struct matrix_keymap_data
+eukrea_mbimx27_keymap_data __initconst = {
 	.keymap         = eukrea_mbimx27_keymap,
 	.keymap_size    = ARRAY_SIZE(eukrea_mbimx27_keymap),
 };
@@ -384,7 +384,7 @@ void __init eukrea_mbimx27_baseboard_init(void)
 	gpio_request(GPIO_PORTA | 25, "lcd_enable");
 	platform_device_register(&eukrea_mbimx27_lcd_powerdev);
 
-	mxc_register_device(&imx_kpp_device, &eukrea_mbimx27_keymap_data);
+	imx27_add_imx_keypad(&eukrea_mbimx27_keymap_data);
 
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 }
arch/arm/mach-imx/mach-mx27_3ds.c +2 -3
index e6212c3..80399b2 100644
@@ -22,7 +22,6 @@
 
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
-#include <linux/input/matrix_keypad.h>
 #include <linux/irq.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -91,7 +90,7 @@ static const uint32_t mx27_3ds_keymap[] = {
 	KEY(2, 3, KEY_F10),
 };
 
-static struct matrix_keymap_data mx27_3ds_keymap_data = {
+static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = {
 	.keymap		= mx27_3ds_keymap,
 	.keymap_size	= ARRAY_SIZE(mx27_3ds_keymap),
 };
@@ -127,7 +126,7 @@ static void __init mx27pdk_init(void)
 	mx27_3ds_sdhc1_enable_level_translator();
 	imx27_add_imx_uart0(&uart_pdata);
 	imx27_add_fec(NULL);
-	mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
+	imx27_add_imx_keypad(&mx27_3ds_keymap_data);
 	imx27_add_mxc_mmc(0, &sdhc1_pdata);
 }
 
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 26196d9..212f380 100644
@@ -25,6 +25,9 @@ config IMX_HAVE_PLATFORM_IMX_FB
 config IMX_HAVE_PLATFORM_IMX_I2C
 	bool
 
+config IMX_HAVE_PLATFORM_IMX_KEYPAD
+	bool
+
 config IMX_HAVE_PLATFORM_IMX_SSI
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index e40897e..dd23bab 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
 obj-y += platform-imx-dma.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
arch/arm/plat-mxc/devices/platform-imx-keypad.c new file +46 -0

46 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +9 -0
index f01fd28..1a67299 100644
@@ -83,6 +83,15 @@ struct platform_device *__init imx_add_imx_i2c(
 		const struct imx_imx_i2c_data *data,
 		const struct imxi2c_platform_data *pdata);
 
+#include <linux/input/matrix_keypad.h>
+struct imx_imx_keypad_data {
+	resource_size_t iobase;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_imx_keypad(
+		const struct imx_imx_keypad_data *data,
+		const struct matrix_keymap_data *pdata);
+
 #include <mach/ssi.h>
 struct imx_imx_ssi_data {
 	int id;
Signature · 1 line
1.7.2.3
#25 lore raw

PATCH 25/51 ARM: imx: dynamically allocate imx21-hcd devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/devices-imx21.h               |    4 ++
 arch/arm/mach-imx/devices.c                     |   26 --------------
 arch/arm/mach-imx/devices.h                     |    3 --
 arch/arm/plat-mxc/devices/Kconfig               |    3 ++
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-imx21-hcd.c  |   41 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |    9 +++++
 7 files changed, 58 insertions(+), 29 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx21-hcd.c
arch/arm/mach-imx/devices-imx21.h +4 -0
index 0c0eab1..16744d2 100644
@@ -9,6 +9,10 @@
 #include <mach/mx21.h>
 #include <mach/devices-common.h>
 
+extern const struct imx_imx21_hcd_data imx21_imx21_hcd_data __initconst;
+#define imx21_add_imx21_hcd(pdata)	\
+	imx_add_imx21_hcd(&imx21_imx21_hcd_data, pdata)
+
 extern const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst;
 #define imx21_add_imx2_wdt(pdata)	\
 	imx_add_imx2_wdt(&imx21_imx2_wdt_data)
arch/arm/mach-imx/devices.c +0 -26
index 4360b9c..8fd2545 100644
@@ -123,30 +123,4 @@ int __init imx27_register_gpios(void)
 }
 #endif
 
-#ifdef CONFIG_MACH_MX21
-static struct resource mx21_usbhc_resources[] = {
-	{
-		.start	= MX21_USBOTG_BASE_ADDR,
-		.end	= MX21_USBOTG_BASE_ADDR + SZ_8K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start		= MX21_INT_USBHOST,
-		.end		= MX21_INT_USBHOST,
-		.flags		= IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device mx21_usbhc_device = {
-	.name		= "imx21-hcd",
-	.id		= 0,
-	.dev		= {
-		.dma_mask = &mx21_usbhc_device.dev.coherent_dma_mask,
-		.coherent_dma_mask = DMA_BIT_MASK(32),
-	},
-	.num_resources	= ARRAY_SIZE(mx21_usbhc_resources),
-	.resource	= mx21_usbhc_resources,
-};
-#endif
-
 #endif
arch/arm/mach-imx/devices.h +0 -3
index d1e7f48..e69de29 100644
@@ -1,3 +0,0 @@
-#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
-extern struct platform_device mx21_usbhc_device;
-#endif
arch/arm/plat-mxc/devices/Kconfig +3 -0
index 212f380..a0be2df 100644
@@ -15,6 +15,9 @@ config IMX_HAVE_PLATFORM_FSL_USB2_UDC
 config IMX_HAVE_PLATFORM_GPIO_KEYS
 	bool
 	default y if ARCH_MX51
+
+config IMX_HAVE_PLATFORM_IMX21_HCD
+	bool
 	
 config IMX_HAVE_PLATFORM_IMX2_WDT
 	bool
arch/arm/plat-mxc/devices/Makefile +1 -0
index dd23bab..14b228e 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
 obj-y += platform-imx-dma.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
arch/arm/plat-mxc/devices/platform-imx21-hcd.c new file +41 -0

41 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +9 -0
index 1a67299..f5d0000 100644
@@ -57,6 +57,15 @@ struct platform_device *__init imx_add_fsl_usb2_udc(
 struct platform_device *__init imx_add_gpio_keys(
 		const struct gpio_keys_platform_data *pdata);
 
+#include <mach/mx21-usbhost.h>
+struct imx_imx21_hcd_data {
+	resource_size_t iobase;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_imx21_hcd(
+		const struct imx_imx21_hcd_data *data,
+		const struct mx21_usbh_platform_data *pdata);
+
 struct imx_imx2_wdt_data {
 	resource_size_t iobase;
 };
Signature · 1 line
1.7.2.3
#26 lore raw

PATCH 26/51 ARM: imx: remove now empty devices.h

In reply to Uwe Kleine-König
---
 arch/arm/mach-imx/devices.c                  |    2 --
 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c |    1 -
 arch/arm/mach-imx/mach-cpuimx27.c            |    1 -
 arch/arm/mach-imx/mach-imx27_visstrim_m10.c  |    1 -
 arch/arm/mach-imx/mach-imx27lite.c           |    1 -
 arch/arm/mach-imx/mach-mx1ads.c              |    1 -
 arch/arm/mach-imx/mach-mx21ads.c             |    1 -
 arch/arm/mach-imx/mach-mx27_3ds.c            |    1 -
 arch/arm/mach-imx/mach-mx27ads.c             |    1 -
 arch/arm/mach-imx/mach-mxt_td60.c            |    1 -
 arch/arm/mach-imx/mach-pca100.c              |    1 -
 arch/arm/mach-imx/mach-pcm038.c              |    1 -
 arch/arm/mach-imx/mach-scb9328.c             |    1 -
 arch/arm/mach-imx/pcm970-baseboard.c         |    1 -
 14 files changed, 0 insertions(+), 15 deletions(-)
 delete mode 100644 arch/arm/mach-imx/devices.h
arch/arm/mach-imx/devices.c +0 -2
index 8fd2545..cfc6891 100644
@@ -42,8 +42,6 @@
 #include <mach/common.h>
 #include <mach/mmc.h>
 
-#include "devices.h"
-
 #if defined(CONFIG_ARCH_MX1)
 /* GPIO port description */
 static struct mxc_gpio_port imx_gpio_ports[] = {
arch/arm/mach-imx/devices.h deleted +0 -0
deleted file mode 100644
index e69de29..0000000
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +0 -1
index 3aaa3b9..7dce251 100644
@@ -36,7 +36,6 @@
 #include <mach/audmux.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 static const int eukrea_mbimx27_pins[] __initconst = {
 	/* UART2 */
arch/arm/mach-imx/mach-cpuimx27.c +0 -1
index 9ae5bed..6cf04da 100644
@@ -42,7 +42,6 @@
 #include <mach/ulpi.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 static const int eukrea_cpuimx27_pins[] __initconst = {
 	/* UART1 */
arch/arm/mach-imx/mach-imx27_visstrim_m10.c +0 -1
index c9f12e4..40a3666 100644
@@ -37,7 +37,6 @@
 #include <mach/iomux.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 #define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
 #define SDHC1_IRQ IRQ_GPIOB(25)
arch/arm/mach-imx/mach-imx27lite.c +0 -1
index bbdbc75..3a1202e 100644
@@ -25,7 +25,6 @@
 #include <mach/iomux-mx27.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 static const int mx27lite_pins[] __initconst = {
 	/* UART1 */
arch/arm/mach-imx/mach-mx1ads.c +0 -1
index 6187ce9..1f446e5 100644
@@ -30,7 +30,6 @@
 #include <mach/irqs.h>
 
 #include "devices-imx1.h"
-#include "devices.h"
 
 static const int mx1ads_pins[] __initconst = {
 	/* UART1 */
arch/arm/mach-imx/mach-mx21ads.c +0 -1
index 83c064a..0a37257 100644
@@ -28,7 +28,6 @@
 #include <mach/mxc_nand.h>
 
 #include "devices-imx21.h"
-#include "devices.h"
 
 /*
  * Memory-mapped I/O on MX21ADS base board
arch/arm/mach-imx/mach-mx27_3ds.c +0 -1
index 80399b2..3614e33 100644
@@ -31,7 +31,6 @@
 #include <mach/iomux-mx27.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 #define SD1_EN_GPIO (GPIO_PORTB + 25)
 
arch/arm/mach-imx/mach-mx27ads.c +0 -1
index 370481b..b832f96 100644
@@ -32,7 +32,6 @@
 #include <mach/mxc_nand.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 /*
  * Base address of PBC controller, CS4
arch/arm/mach-imx/mach-mxt_td60.c +0 -1
index d1a3158..4ce71b0 100644
@@ -33,7 +33,6 @@
 #include <linux/i2c/pca953x.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 static const int mxt_td60_pins[] __initconst = {
 	/* UART0 */
arch/arm/mach-imx/mach-pca100.c +0 -1
index d9e2dda..cccc0a0 100644
@@ -42,7 +42,6 @@
 #include <mach/ulpi.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 #define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
 #define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24)
arch/arm/mach-imx/mach-pcm038.c +0 -1
index e209b28..f667a26 100644
@@ -40,7 +40,6 @@
 #include <mach/ulpi.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 static const int pcm038_pins[] __initconst = {
 	/* UART1 */
arch/arm/mach-imx/mach-scb9328.c +0 -1
index 1fbdd3f..eae878f 100644
@@ -25,7 +25,6 @@
 #include <mach/iomux-mx1.h>
 
 #include "devices-imx1.h"
-#include "devices.h"
 
 /*
  * This scb9328 has a 32MiB flash
arch/arm/mach-imx/pcm970-baseboard.c +0 -1
index 1297f1b..99afbc3 100644
@@ -28,7 +28,6 @@
 #include <mach/hardware.h>
 
 #include "devices-imx27.h"
-#include "devices.h"
 
 static const int pcm970_pins[] __initconst = {
 	/* SDHC */
Signature · 1 line
1.7.2.3
#27 lore raw

PATCH 27/51 ARM: imx: move registration of gpios to plat-mxc/gpio.c

In reply to Uwe Kleine-König

This finally gets rid of mach-imx/devices.c.

---
 arch/arm/mach-imx/Makefile  |    2 -
 arch/arm/mach-imx/devices.c |  124 -------------------------------------------
 arch/arm/plat-mxc/gpio.c    |   59 ++++++++++++++++++++
 3 files changed, 59 insertions(+), 126 deletions(-)
 delete mode 100644 arch/arm/mach-imx/devices.c
arch/arm/mach-imx/Makefile +0 -2
index 5582692..d099c4a 100644
@@ -4,8 +4,6 @@
 
 # Object file lists.
 
-obj-y	:=  devices.o
-
 obj-$(CONFIG_IMX_HAVE_DMA_V1) += dma-v1.o
 
 obj-$(CONFIG_ARCH_MX1) += clock-imx1.o mm-imx1.o
arch/arm/mach-imx/devices.c deleted +0 -124

124 lines not on this page · raw message

arch/arm/plat-mxc/gpio.c +59 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#28 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

In reply to Uwe Kleine-König

According to the reference manual of the i.MX25 the host controller uses an offset of 0x200 not 0x400 as was specified in the resources for mxc_usbh2.

Needs-Testing: yes

---
 arch/arm/mach-mx25/Kconfig                    |    6 ++-
 arch/arm/mach-mx25/devices-imx25.h            |    7 ++++
 arch/arm/mach-mx25/devices.c                  |   44 ++----------------------
 arch/arm/mach-mx25/devices.h                  |    2 -
 arch/arm/mach-mx25/mach-cpuimx25.c            |    9 ++---
 arch/arm/mach-mx25/mach-mx25_3ds.c            |    2 +-
 arch/arm/plat-mxc/devices/platform-mxc-ehci.c |    7 ++++
 arch/arm/plat-mxc/ehci.c                      |    4 +-
 arch/arm/plat-mxc/include/mach/mx25.h         |    6 +++-
 9 files changed, 34 insertions(+), 53 deletions(-)
arch/arm/mach-mx25/Kconfig +4 -2
index 38ca09a..b55585b 100644
@@ -5,16 +5,18 @@ comment "MX25 platforms:"
 config MACH_MX25_3DS
 	bool "Support MX25PDK (3DS) Platform"
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_ESDHC
 
 config MACH_EUKREA_CPUIMX25
 	bool "Support Eukrea CPUIMX25 Platform"
+	select IMX_HAVE_PLATFORM_ESDHC
+	select IMX_HAVE_PLATFORM_FLEXCAN
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
-	select IMX_HAVE_PLATFORM_FLEXCAN
-	select IMX_HAVE_PLATFORM_ESDHC
 	select MXC_ULPI if USB_ULPI
 
 choice
arch/arm/mach-mx25/devices-imx25.h +7 -0
index f62ce93..ac343ae 100644
@@ -39,6 +39,13 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
 #define imx25_add_imx_uart3(pdata)	imx25_add_imx_uart(3, pdata)
 #define imx25_add_imx_uart4(pdata)	imx25_add_imx_uart(4, pdata)
 
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst;
+#define imx25_add_mxc_ehci_otg(pdata)	\
+	imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata)
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst;
+#define imx25_add_mxc_ehci_hs(pdata)	\
+	imx_add_mxc_ehci(&imx25_mxc_ehci_hs_data, pdata)
+
 extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst;
 #define imx25_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx25_mxc_nand_data, pdata)
arch/arm/mach-mx25/devices.c +4 -40

62 lines not on this page · raw message

arch/arm/mach-mx25/devices.h +0 -2
index 7b70a43..e6ad640 100644
@@ -1,6 +1,4 @@
-extern struct platform_device mxc_otg;
 extern struct platform_device otg_udc_device;
-extern struct platform_device mxc_usbh2;
 extern struct platform_device mxc_pwm_device0;
 extern struct platform_device mxc_pwm_device1;
 extern struct platform_device mxc_pwm_device2;
arch/arm/mach-mx25/mach-cpuimx25.c +4 -5
index f6f9ad6..0ee0fe7 100644
@@ -39,7 +39,6 @@
 #include <mach/mx25.h>
 #include <mach/mxc_nand.h>
 #include <mach/imxfb.h>
-#include <mach/mxc_ehci.h>
 #include <mach/iomux-mx25.h>
 
 #include "devices-imx25.h"
@@ -87,12 +86,12 @@ static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
 	},
 };
 
-static struct mxc_usbh_platform_data otg_pdata = {
+static const struct mxc_usbh_platform_data otg_pdata __initconst = {
 	.portsc	= MXC_EHCI_MODE_UTMI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
 };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
 	.portsc	= MXC_EHCI_MODE_SERIAL,
 	.flags	= MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
 		  MXC_EHCI_IPPUE_DOWN,
@@ -134,11 +133,11 @@ static void __init eukrea_cpuimx25_init(void)
 	imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
 
 	if (otg_mode_host)
-		mxc_register_device(&mxc_otg, &otg_pdata);
+		imx25_add_mxc_ehci_otg(&otg_pdata);
 	else
 		mxc_register_device(&otg_udc_device, &otg_device_pdata);
 
-	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	imx25_add_mxc_ehci_hs(&usbh2_pdata);
 
 #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
 	eukrea_mbimxsd25_baseboard_init();
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
index f8be1eb..574c41f 100644
@@ -192,7 +192,7 @@ static void __init mx25pdk_init(void)
 			ARRAY_SIZE(mx25pdk_pads));
 
 	imx25_add_imx_uart0(&uart_pdata);
-	mxc_register_device(&mxc_usbh2, NULL);
+	imx25_add_mxc_ehci_hs(NULL);
 	imx25_add_mxc_nand(&mx25pdk_nand_board_info);
 	mxc_register_device(&mx25_rtc_device, NULL);
 	mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
arch/arm/plat-mxc/devices/platform-mxc-ehci.c +7 -0
index 0cb67bb..825a048ca 100644
@@ -16,6 +16,13 @@
 		.irq = soc ## _INT_USB_ ## hs,				\
 	}
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
+const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX25, 1, HS);
+#endif /* ifdef CONFIG_ARCH_MX25 */
+
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
 	imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
arch/arm/plat-mxc/ehci.c +2 -2
index 9915607..f699235 100644
@@ -71,7 +71,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
 	unsigned int v;
 #if defined(CONFIG_ARCH_MX25)
 	if (cpu_is_mx25()) {
-		v = readl(MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+		v = readl(MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
 				     USBCTRL_OTGBASE_OFFSET));
 
 		switch (port) {
@@ -108,7 +108,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
 			return -EINVAL;
 		}
 
-		writel(v, MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+		writel(v, MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
 				     USBCTRL_OTGBASE_OFFSET));
 		return 0;
 	}
arch/arm/plat-mxc/include/mach/mx25.h +5 -1
index a2404b0..0d31f82 100644
@@ -43,7 +43,9 @@
 #define MX25_LCDC_BASE_ADDR		0x53fbc000
 #define MX25_KPP_BASE_ADDR		0x43fa8000
 #define MX25_SDMA_BASE_ADDR		0x53fd4000
-#define MX25_OTG_BASE_ADDR		0x53ff4000
+#define MX25_USB_BASE_ADDR		0x53ff4000
+#define MX25_USB_OTG_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0000)
+#define MX25_USB_HS_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0200)
 #define MX25_CSI_BASE_ADDR		0x53ff8000
 
 #define MX25_IO_P2V(x)			IMX_IO_P2V(x)
@@ -67,6 +69,8 @@
 #define MX25_INT_UART2		32
 #define MX25_INT_NFC		33
 #define MX25_INT_SDMA		34
+#define MX25_INT_USB_HS		35
+#define MX25_INT_USB_OTG	37
 #define MX25_INT_LCDC		39
 #define MX25_INT_UART5		40
 #define MX25_INT_CAN1		43
Signature · 1 line
1.7.2.3
#29 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

Dear Uwe,

I think there is an error in the Freescale documentation, as new 0x200 offset (as it might be according reference manual) makes usbh2 stops working.

Other users have experienced simmilar issues:
http://forums.freescale.com/t5/i-MX-Microprocessors/i-MX25-USBOH-host-core-port-on-chip-serial-PHY-Control/m-p/59365

I think old 0x400 offset value were correct.
Anyone can confirm?

Quoted 257 lines · Uwe Kleine-K?nig

According to the reference manual of the i.MX25 the host controller uses an offset of 0x200 not 0x400 as was specified in the resources for mxc_usbh2.

Needs-Testing: yes

---
  arch/arm/mach-mx25/Kconfig                    |    6 ++-
  arch/arm/mach-mx25/devices-imx25.h            |    7 ++++
  arch/arm/mach-mx25/devices.c                  |   44 ++----------------------
  arch/arm/mach-mx25/devices.h                  |    2 -
  arch/arm/mach-mx25/mach-cpuimx25.c            |    9 ++---
  arch/arm/mach-mx25/mach-mx25_3ds.c            |    2 +-
  arch/arm/plat-mxc/devices/platform-mxc-ehci.c |    7 ++++
  arch/arm/plat-mxc/ehci.c                      |    4 +-
  arch/arm/plat-mxc/include/mach/mx25.h         |    6 +++-
  9 files changed, 34 insertions(+), 53 deletions(-)
arch/arm/mach-mx25/Kconfig +4 -2
index 38ca09a..b55585b 100644
@@ -5,16 +5,18 @@ comment "MX25 platforms:"
  config MACH_MX25_3DS
  	bool "Support MX25PDK (3DS) Platform"
  	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
  	select IMX_HAVE_PLATFORM_MXC_NAND
  	select IMX_HAVE_PLATFORM_ESDHC
 
  config MACH_EUKREA_CPUIMX25
  	bool "Support Eukrea CPUIMX25 Platform"
+	select IMX_HAVE_PLATFORM_ESDHC
+	select IMX_HAVE_PLATFORM_FLEXCAN
  	select IMX_HAVE_PLATFORM_IMX_I2C
  	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
  	select IMX_HAVE_PLATFORM_MXC_NAND
-	select IMX_HAVE_PLATFORM_FLEXCAN
-	select IMX_HAVE_PLATFORM_ESDHC
  	select MXC_ULPI if USB_ULPI
 
  choice
arch/arm/mach-mx25/devices-imx25.h +7 -0
index f62ce93..ac343ae 100644
@@ -39,6 +39,13 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
  #define imx25_add_imx_uart3(pdata)	imx25_add_imx_uart(3, pdata)
  #define imx25_add_imx_uart4(pdata)	imx25_add_imx_uart(4, pdata)
 
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst;
+#define imx25_add_mxc_ehci_otg(pdata)	\
+	imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata)
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst;
+#define imx25_add_mxc_ehci_hs(pdata)	\
+	imx_add_mxc_ehci(&imx25_mxc_ehci_hs_data, pdata)
+
  extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst;
  #define imx25_add_mxc_nand(pdata)	\
  	imx_add_mxc_nand(&imx25_mxc_nand_data, pdata)
arch/arm/mach-mx25/devices.c +4 -40
index 92eb1a9..4611c76 100644
@@ -26,27 +26,16 @@ static u64 otg_dmamask = DMA_BIT_MASK(32);
 
  static struct resource mxc_otg_resources[] = {
  	{
-		.start = MX25_OTG_BASE_ADDR,
-		.end = MX25_OTG_BASE_ADDR + 0x1ff,
+		.start = MX25_USB_OTG_BASE_ADDR,
+		.end = MX25_USB_OTG_BASE_ADDR + 0x1ff,
  		.flags = IORESOURCE_MEM,
  	}, {
-		.start = 37,
-		.end = 37,
+		.start = MX25_INT_USB_OTG,
+		.end = MX25_INT_USB_OTG,
  		.flags = IORESOURCE_IRQ,
  	},
  };
 
-struct platform_device mxc_otg = {
-	.name = "mxc-ehci",
-	.id = 0,
-	.dev = {
-		.coherent_dma_mask = 0xffffffff,
-		.dma_mask =&otg_dmamask,
-	},
-	.resource = mxc_otg_resources,
-	.num_resources = ARRAY_SIZE(mxc_otg_resources),
-};
-
  /* OTG gadget device */
  struct platform_device otg_udc_device = {
  	.name = "fsl-usb2-udc",
@@ -59,31 +48,6 @@ struct platform_device otg_udc_device = {
  	.num_resources = ARRAY_SIZE(mxc_otg_resources),
  };
 
-static u64 usbh2_dmamask = DMA_BIT_MASK(32);
-
-static struct resource mxc_usbh2_resources[] = {
-	{
-		.start = MX25_OTG_BASE_ADDR + 0x400,
-		.end = MX25_OTG_BASE_ADDR + 0x5ff,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = 35,
-		.end = 35,
-		.flags = IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device mxc_usbh2 = {
-	.name = "mxc-ehci",
-	.id = 1,
-	.dev = {
-		.coherent_dma_mask = 0xffffffff,
-		.dma_mask =&usbh2_dmamask,
-	},
-	.resource = mxc_usbh2_resources,
-	.num_resources = ARRAY_SIZE(mxc_usbh2_resources),
-};
-
  static struct resource mxc_pwm_resources0[] = {
  	{
  		.start	= 0x53fe0000,
arch/arm/mach-mx25/devices.h +0 -2
index 7b70a43..e6ad640 100644
@@ -1,6 +1,4 @@
-extern struct platform_device mxc_otg;
  extern struct platform_device otg_udc_device;
-extern struct platform_device mxc_usbh2;
  extern struct platform_device mxc_pwm_device0;
  extern struct platform_device mxc_pwm_device1;
  extern struct platform_device mxc_pwm_device2;
arch/arm/mach-mx25/mach-cpuimx25.c +4 -5
index f6f9ad6..0ee0fe7 100644
@@ -39,7 +39,6 @@
  #include<mach/mx25.h>
  #include<mach/mxc_nand.h>
  #include<mach/imxfb.h>
-#include<mach/mxc_ehci.h>
  #include<mach/iomux-mx25.h>
 
  #include "devices-imx25.h"
@@ -87,12 +86,12 @@ static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
  	},
  };
 
-static struct mxc_usbh_platform_data otg_pdata = {
+static const struct mxc_usbh_platform_data otg_pdata __initconst = {
  	.portsc	= MXC_EHCI_MODE_UTMI,
  	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
  };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
  	.portsc	= MXC_EHCI_MODE_SERIAL,
  	.flags	= MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
  		  MXC_EHCI_IPPUE_DOWN,
@@ -134,11 +133,11 @@ static void __init eukrea_cpuimx25_init(void)
  	imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
 
  	if (otg_mode_host)
-		mxc_register_device(&mxc_otg,&otg_pdata);
+		imx25_add_mxc_ehci_otg(&otg_pdata);
  	else
  		mxc_register_device(&otg_udc_device,&otg_device_pdata);
 
-	mxc_register_device(&mxc_usbh2,&usbh2_pdata);
+	imx25_add_mxc_ehci_hs(&usbh2_pdata);
 
  #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
  	eukrea_mbimxsd25_baseboard_init();
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
index f8be1eb..574c41f 100644
@@ -192,7 +192,7 @@ static void __init mx25pdk_init(void)
  			ARRAY_SIZE(mx25pdk_pads));
 
  	imx25_add_imx_uart0(&uart_pdata);
-	mxc_register_device(&mxc_usbh2, NULL);
+	imx25_add_mxc_ehci_hs(NULL);
  	imx25_add_mxc_nand(&mx25pdk_nand_board_info);
  	mxc_register_device(&mx25_rtc_device, NULL);
  	mxc_register_device(&mx25_fb_device,&mx25pdk_fb_pdata);
arch/arm/plat-mxc/devices/platform-mxc-ehci.c +7 -0
index 0cb67bb..825a048ca 100644
@@ -16,6 +16,13 @@
  		.irq = soc ## _INT_USB_ ## hs,				\
  	}
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
+const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX25, 1, HS);
+#endif /* ifdef CONFIG_ARCH_MX25 */
+
  #ifdef CONFIG_SOC_IMX27
  const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
  	imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
arch/arm/plat-mxc/ehci.c +2 -2
index 9915607..f699235 100644
@@ -71,7 +71,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
  	unsigned int v;
  #if defined(CONFIG_ARCH_MX25)
  	if (cpu_is_mx25()) {
-		v = readl(MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+		v = readl(MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
  				     USBCTRL_OTGBASE_OFFSET));
 
  		switch (port) {
@@ -108,7 +108,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
  			return -EINVAL;
  		}
 
-		writel(v, MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+		writel(v, MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
  				     USBCTRL_OTGBASE_OFFSET));
  		return 0;
  	}
arch/arm/plat-mxc/include/mach/mx25.h +5 -1
index a2404b0..0d31f82 100644
@@ -43,7 +43,9 @@
  #define MX25_LCDC_BASE_ADDR		0x53fbc000
  #define MX25_KPP_BASE_ADDR		0x43fa8000
  #define MX25_SDMA_BASE_ADDR		0x53fd4000
-#define MX25_OTG_BASE_ADDR		0x53ff4000
+#define MX25_USB_BASE_ADDR		0x53ff4000
+#define MX25_USB_OTG_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0000)
+#define MX25_USB_HS_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0200)
  #define MX25_CSI_BASE_ADDR		0x53ff8000
 
  #define MX25_IO_P2V(x)			IMX_IO_P2V(x)
@@ -67,6 +69,8 @@
  #define MX25_INT_UART2		32
  #define MX25_INT_NFC		33
  #define MX25_INT_SDMA		34
+#define MX25_INT_USB_HS		35
+#define MX25_INT_USB_OTG	37
  #define MX25_INT_LCDC		39
  #define MX25_INT_UART5		40
  #define MX25_INT_CAN1		43
Signature · 12 lines
Jaume Ribot Caner
R&D Engineer

FQ Ingenier?a Electr?nica, SA
Avda. de les Roquetes, 9
Pol. Industrial Vilanoveta
08812 Sant Pere de Ribes ( SPAIN )
www.fqingenieria.es

Tf  + 34 93 208 02 58
Fx  + 34 93 459 28 93
E-mail: jaume at fqingenieria.es
#30 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

Hi

Quoted 9 lines · Jaume Ribot

Dear Uwe,

I think there is an error in the Freescale documentation, as new 0x200 offset (as it might be according reference manual) makes usbh2 stops working.

Other users have experienced simmilar issues:
http://forums.freescale.com/t5/i-MX-Microprocessors/i-MX25-USBOH-host-core-port-on-chip-serial-PHY-Control/m-p/59365

I think old 0x400 offset value were correct.
Anyone can confirm?

I can say that I'm using the mainline (814ce2521121c2459e16cea8c7221e157edbeddd) without this patch and the usbhost work on my mx25 board.

These are my settings:

static struct mxc_usbh_platform_data usbh2_pdata = {
.portsc = MXC_EHCI_MODE_SERIAL,
.flags = MXC_EHCI_INTERFACE_DIFF_UNI | MXC_EHCI_INTERNAL_PHY |
MXC_EHCI_PP_HST | MXC_EHCI_XCSH | MXC_EHCI_IPPUE_DOWN | MXC_EHCI_POWER_PINS_ENABLED,
};

/* USB */
MX25_PAD_PWM__USBH2_OC,
MX25_PAD_CONTRAST__USBH2_PWR,

I have done some test with an usb pendrive

Michael

Quoted 249 lines · Uwe Kleine-K?nig
Quoted 247 lines

According to the reference manual of the i.MX25 the host controller uses an offset of 0x200 not 0x400 as was specified in the resources for mxc_usbh2.

Needs-Testing: yes

---
  arch/arm/mach-mx25/Kconfig                    |    6 ++-
  arch/arm/mach-mx25/devices-imx25.h            |    7 ++++
  arch/arm/mach-mx25/devices.c                  |   44 ++----------------------
  arch/arm/mach-mx25/devices.h                  |    2 -
  arch/arm/mach-mx25/mach-cpuimx25.c            |    9 ++---
  arch/arm/mach-mx25/mach-mx25_3ds.c            |    2 +-
  arch/arm/plat-mxc/devices/platform-mxc-ehci.c |    7 ++++
  arch/arm/plat-mxc/ehci.c                      |    4 +-
  arch/arm/plat-mxc/include/mach/mx25.h         |    6 +++-
  9 files changed, 34 insertions(+), 53 deletions(-)
arch/arm/mach-mx25/Kconfig +4 -2
index 38ca09a..b55585b 100644
@@ -5,16 +5,18 @@ comment "MX25 platforms:"
  config MACH_MX25_3DS
      bool "Support MX25PDK (3DS) Platform"
      select IMX_HAVE_PLATFORM_IMX_UART
+    select IMX_HAVE_PLATFORM_MXC_EHCI
      select IMX_HAVE_PLATFORM_MXC_NAND
      select IMX_HAVE_PLATFORM_ESDHC
 
  config MACH_EUKREA_CPUIMX25
      bool "Support Eukrea CPUIMX25 Platform"
+    select IMX_HAVE_PLATFORM_ESDHC
+    select IMX_HAVE_PLATFORM_FLEXCAN
      select IMX_HAVE_PLATFORM_IMX_I2C
      select IMX_HAVE_PLATFORM_IMX_UART
+    select IMX_HAVE_PLATFORM_MXC_EHCI
      select IMX_HAVE_PLATFORM_MXC_NAND
-    select IMX_HAVE_PLATFORM_FLEXCAN
-    select IMX_HAVE_PLATFORM_ESDHC
      select MXC_ULPI if USB_ULPI
 
  choice
arch/arm/mach-mx25/devices-imx25.h +7 -0
index f62ce93..ac343ae 100644
@@ -39,6 +39,13 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
  #define imx25_add_imx_uart3(pdata)    imx25_add_imx_uart(3, pdata)
  #define imx25_add_imx_uart4(pdata)    imx25_add_imx_uart(4, pdata)
 
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst;
+#define imx25_add_mxc_ehci_otg(pdata)    \
+    imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata)
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst;
+#define imx25_add_mxc_ehci_hs(pdata)    \
+    imx_add_mxc_ehci(&imx25_mxc_ehci_hs_data, pdata)
+
  extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst;
  #define imx25_add_mxc_nand(pdata)    \
      imx_add_mxc_nand(&imx25_mxc_nand_data, pdata)
arch/arm/mach-mx25/devices.c +4 -40
index 92eb1a9..4611c76 100644
@@ -26,27 +26,16 @@ static u64 otg_dmamask = DMA_BIT_MASK(32);
 
  static struct resource mxc_otg_resources[] = {
      {
-        .start = MX25_OTG_BASE_ADDR,
-        .end = MX25_OTG_BASE_ADDR + 0x1ff,
+        .start = MX25_USB_OTG_BASE_ADDR,
+        .end = MX25_USB_OTG_BASE_ADDR + 0x1ff,
          .flags = IORESOURCE_MEM,
      }, {
-        .start = 37,
-        .end = 37,
+        .start = MX25_INT_USB_OTG,
+        .end = MX25_INT_USB_OTG,
          .flags = IORESOURCE_IRQ,
      },
  };
 
-struct platform_device mxc_otg = {
-    .name = "mxc-ehci",
-    .id = 0,
-    .dev = {
-        .coherent_dma_mask = 0xffffffff,
-        .dma_mask =&otg_dmamask,
-    },
-    .resource = mxc_otg_resources,
-    .num_resources = ARRAY_SIZE(mxc_otg_resources),
-};
-
  /* OTG gadget device */
  struct platform_device otg_udc_device = {
      .name = "fsl-usb2-udc",
@@ -59,31 +48,6 @@ struct platform_device otg_udc_device = {
      .num_resources = ARRAY_SIZE(mxc_otg_resources),
  };
 
-static u64 usbh2_dmamask = DMA_BIT_MASK(32);
-
-static struct resource mxc_usbh2_resources[] = {
-    {
-        .start = MX25_OTG_BASE_ADDR + 0x400,
-        .end = MX25_OTG_BASE_ADDR + 0x5ff,
-        .flags = IORESOURCE_MEM,
-    }, {
-        .start = 35,
-        .end = 35,
-        .flags = IORESOURCE_IRQ,
-    },
-};
-
-struct platform_device mxc_usbh2 = {
-    .name = "mxc-ehci",
-    .id = 1,
-    .dev = {
-        .coherent_dma_mask = 0xffffffff,
-        .dma_mask =&usbh2_dmamask,
-    },
-    .resource = mxc_usbh2_resources,
-    .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
-};
-
  static struct resource mxc_pwm_resources0[] = {
      {
          .start    = 0x53fe0000,
arch/arm/mach-mx25/devices.h +0 -2
index 7b70a43..e6ad640 100644
@@ -1,6 +1,4 @@
-extern struct platform_device mxc_otg;
  extern struct platform_device otg_udc_device;
-extern struct platform_device mxc_usbh2;
  extern struct platform_device mxc_pwm_device0;
  extern struct platform_device mxc_pwm_device1;
  extern struct platform_device mxc_pwm_device2;
arch/arm/mach-mx25/mach-cpuimx25.c +4 -5
index f6f9ad6..0ee0fe7 100644
@@ -39,7 +39,6 @@
  #include<mach/mx25.h>
  #include<mach/mxc_nand.h>
  #include<mach/imxfb.h>
-#include<mach/mxc_ehci.h>
  #include<mach/iomux-mx25.h>
 
  #include "devices-imx25.h"
@@ -87,12 +86,12 @@ static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
      },
  };
 
-static struct mxc_usbh_platform_data otg_pdata = {
+static const struct mxc_usbh_platform_data otg_pdata __initconst = {
      .portsc    = MXC_EHCI_MODE_UTMI,
      .flags    = MXC_EHCI_INTERFACE_DIFF_UNI,
  };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
      .portsc    = MXC_EHCI_MODE_SERIAL,
      .flags    = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
            MXC_EHCI_IPPUE_DOWN,
@@ -134,11 +133,11 @@ static void __init eukrea_cpuimx25_init(void)
      imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
 
      if (otg_mode_host)
-        mxc_register_device(&mxc_otg,&otg_pdata);
+        imx25_add_mxc_ehci_otg(&otg_pdata);
      else
          mxc_register_device(&otg_udc_device,&otg_device_pdata);
 
-    mxc_register_device(&mxc_usbh2,&usbh2_pdata);
+    imx25_add_mxc_ehci_hs(&usbh2_pdata);
 
  #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
      eukrea_mbimxsd25_baseboard_init();
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
index f8be1eb..574c41f 100644
@@ -192,7 +192,7 @@ static void __init mx25pdk_init(void)
              ARRAY_SIZE(mx25pdk_pads));
 
      imx25_add_imx_uart0(&uart_pdata);
-    mxc_register_device(&mxc_usbh2, NULL);
+    imx25_add_mxc_ehci_hs(NULL);
      imx25_add_mxc_nand(&mx25pdk_nand_board_info);
      mxc_register_device(&mx25_rtc_device, NULL);
      mxc_register_device(&mx25_fb_device,&mx25pdk_fb_pdata);
arch/arm/plat-mxc/devices/platform-mxc-ehci.c +7 -0
index 0cb67bb..825a048ca 100644
@@ -16,6 +16,13 @@
          .irq = soc ## _INT_USB_ ## hs,                \
      }
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
+    imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
+const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
+    imx_mxc_ehci_data_entry_single(MX25, 1, HS);
+#endif /* ifdef CONFIG_ARCH_MX25 */
+
  #ifdef CONFIG_SOC_IMX27
  const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
      imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
arch/arm/plat-mxc/ehci.c +2 -2
index 9915607..f699235 100644
@@ -71,7 +71,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
      unsigned int v;
  #if defined(CONFIG_ARCH_MX25)
      if (cpu_is_mx25()) {
-        v = readl(MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+        v = readl(MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
                       USBCTRL_OTGBASE_OFFSET));
 
          switch (port) {
@@ -108,7 +108,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
              return -EINVAL;
          }
 
-        writel(v, MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+        writel(v, MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
                       USBCTRL_OTGBASE_OFFSET));
          return 0;
      }
arch/arm/plat-mxc/include/mach/mx25.h +3 -1
index a2404b0..0d31f82 100644
@@ -43,7 +43,9 @@
  #define MX25_LCDC_BASE_ADDR        0x53fbc000
  #define MX25_KPP_BASE_ADDR        0x43fa8000
  #define MX25_SDMA_BASE_ADDR        0x53fd4000
-#define MX25_OTG_BASE_ADDR        0x53ff4000
+#define MX25_USB_BASE_ADDR        0x53ff4000
+#define MX25_USB_OTG_BASE_ADDR            (MX25_USB_BASE_ADDR + 0x0000)
+#define MX25_USB_HS_BASE_ADDR            (MX25_USB_BASE_ADDR + 0x0200)
  #define MX25_CSI_BASE_ADDR        0x53ff8000
 
Quoted 12 lines

arch/arm/plat-mxc/include/mach/mx25.h line 76

Quoted 10 lines
arch/arm/plat-mxc/include/mach/mx25.h +2 -0
  #define MX25_IO_P2V(x)            IMX_IO_P2V(x)
@@ -67,6 +69,8 @@
  #define MX25_INT_UART2        32
  #define MX25_INT_NFC        33
  #define MX25_INT_SDMA        34
+#define MX25_INT_USB_HS        35
+#define MX25_INT_USB_OTG    37
  #define MX25_INT_LCDC        39
  #define MX25_INT_UART5        40
  #define MX25_INT_CAN1        43

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mx25_usbh2.patch
Type: text/x-patch
Size: 3001 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20101126/a1cd8200/attachment-0001.bin>

#31 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

Hi Michael,

Quoted 5 lines · Michael Trimarchi
Quoted 4 lines · Jaume Ribot

Dear Uwe,

I think there is an error in the Freescale documentation, as new 0x200 offset (as it might be according reference manual) makes usbh2 stops working.

Quoted 7 lines
Quoted 5 lines

Other users have experienced simmilar issues:
http://forums.freescale.com/t5/i-MX-Microprocessors/i-MX25-USBOH-host-core-port-on-chip-serial-PHY-Control/m-p/59365

I think old 0x400 offset value were correct.
Anyone can confirm?

I can say that I'm using the mainline (814ce2521121c2459e16cea8c7221e157edbeddd) without this patch and the usbhost work on my mx25 board.

And I assume applying the patch breaks USB for you?

Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#35 lore raw

RFC PATCH 1/1 mxc_timer1 patch on imx25

Hi Michael,

Quoted 8 lines · Michael Trimarchi

sleep 1 was around 2 seconds
and so on

Michael

GPT clock source select can be selected from:

Quoted 8 lines

000 No clock
001 ipg_clk
010 ipg_clk_highfreq
011 ipp_ind_clkin (external clock from pad)
1xx ipg_clk_32k

The clock is gated by ipg_clk so the reference value must be computed using the get_rate_ipg.

See the discussion at
http://thread.gmane.org/gmane.linux.ports.arm.kernel/72944.

baruch

Quoted 15 lines
arch/arm/mach-mx25/clock.c +1 -1
index 9e4a557..0af06d4 100644
@@ -131,7 +131,7 @@ static unsigned long get_rate_nfc(struct clk *clk)
 
 static unsigned long get_rate_gpt(struct clk *clk)
 {
-	return get_rate_per(5);
+	return get_rate_ipg(NULL);
 }
 
 static unsigned long get_rate_lcdc(struct clk *clk)
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#36 lore raw

RFC PATCH 1/1 mxc_timer1 patch on imx25

Hi

Quoted 16 lines · Baruch Siach

Hi Michael,

Quoted 13 lines · Michael Trimarchi

sleep 1 was around 2 seconds
and so on

Michael

GPT clock source select can be selected from:

000 No clock
001 ipg_clk
010 ipg_clk_highfreq
011 ipp_ind_clkin (external clock from pad)
1xx ipg_clk_32k

Quoted 5 lines
Quoted 2 lines

The clock is gated by ipg_clk so the reference value must be computed using the get_rate_ipg.

See the discussion at
http://thread.gmane.org/gmane.linux.ports.arm.kernel/72944.

After this discussion is there a proper fix?
If the get_rate_ipg is taken from the par you need to set it in plat-mxc timer code. If you want to use the ipg clock for gpg yuu need to take the rate from the ipg_clk. Both works on my board:

- 001 ipg_clk get_rate_ipg
- 010 ipg_clk_high_freq get_rate_par(5)

Michael Trimarchi

Quoted 17 lines

baruch

Quoted 15 lines
arch/arm/mach-mx25/clock.c +1 -1
index 9e4a557..0af06d4 100644
@@ -131,7 +131,7 @@ static unsigned long get_rate_nfc(struct clk *clk)
 
  static unsigned long get_rate_gpt(struct clk *clk)
  {
-	return get_rate_per(5);
+	return get_rate_ipg(NULL);
  }
 
  static unsigned long get_rate_lcdc(struct clk *clk)
#37 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

In reply to Jaume Ribot

Hello Jaume,

Quoted 11 lines · Jaume Ribot

Dear Uwe,

I think there is an error in the Freescale documentation, as new 0x200 offset (as it might be according reference manual) makes usbh2 stops working.

Other users have experienced simmilar issues:
http://forums.freescale.com/t5/i-MX-Microprocessors/i-MX25-USBOH-host-core-port-on-chip-serial-PHY-Control/m-p/59365

I think old 0x400 offset value were correct.
Anyone can confirm?

Maybe one of the Freescale guys? (Added to Cc:)

If we don't hear any authoritive feed-back, I'd suggest to change it back to 0x400 and add a comment like:

	The reference manual (number bla blub) specifies 0x200, but only
	0x400 seems to work.
Quoted 5 lines · Uwe Kleine-K?nig
Quoted 4 lines

According to the reference manual of the i.MX25 the host controller uses an offset of 0x200 not 0x400 as was specified in the resources for mxc_usbh2.

Needs-Testing: yes

Actually I wanted that tag to make me stop sending this patch out. Well, not too bad IMHO.

Quoted 270 lines
Quoted 253 lines
---
  arch/arm/mach-mx25/Kconfig                    |    6 ++-
  arch/arm/mach-mx25/devices-imx25.h            |    7 ++++
  arch/arm/mach-mx25/devices.c                  |   44 ++----------------------
  arch/arm/mach-mx25/devices.h                  |    2 -
  arch/arm/mach-mx25/mach-cpuimx25.c            |    9 ++---
  arch/arm/mach-mx25/mach-mx25_3ds.c            |    2 +-
  arch/arm/plat-mxc/devices/platform-mxc-ehci.c |    7 ++++
  arch/arm/plat-mxc/ehci.c                      |    4 +-
  arch/arm/plat-mxc/include/mach/mx25.h         |    6 +++-
  9 files changed, 34 insertions(+), 53 deletions(-)
arch/arm/mach-mx25/Kconfig +4 -2
index 38ca09a..b55585b 100644
@@ -5,16 +5,18 @@ comment "MX25 platforms:"
  config MACH_MX25_3DS
  	bool "Support MX25PDK (3DS) Platform"
  	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
  	select IMX_HAVE_PLATFORM_MXC_NAND
  	select IMX_HAVE_PLATFORM_ESDHC
 
  config MACH_EUKREA_CPUIMX25
  	bool "Support Eukrea CPUIMX25 Platform"
+	select IMX_HAVE_PLATFORM_ESDHC
+	select IMX_HAVE_PLATFORM_FLEXCAN
  	select IMX_HAVE_PLATFORM_IMX_I2C
  	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
  	select IMX_HAVE_PLATFORM_MXC_NAND
-	select IMX_HAVE_PLATFORM_FLEXCAN
-	select IMX_HAVE_PLATFORM_ESDHC
  	select MXC_ULPI if USB_ULPI
 
  choice
arch/arm/mach-mx25/devices-imx25.h +7 -0
index f62ce93..ac343ae 100644
@@ -39,6 +39,13 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
  #define imx25_add_imx_uart3(pdata)	imx25_add_imx_uart(3, pdata)
  #define imx25_add_imx_uart4(pdata)	imx25_add_imx_uart(4, pdata)
 
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst;
+#define imx25_add_mxc_ehci_otg(pdata)	\
+	imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata)
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst;
+#define imx25_add_mxc_ehci_hs(pdata)	\
+	imx_add_mxc_ehci(&imx25_mxc_ehci_hs_data, pdata)
+
  extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst;
  #define imx25_add_mxc_nand(pdata)	\
  	imx_add_mxc_nand(&imx25_mxc_nand_data, pdata)
arch/arm/mach-mx25/devices.c +4 -40
index 92eb1a9..4611c76 100644
@@ -26,27 +26,16 @@ static u64 otg_dmamask = DMA_BIT_MASK(32);
 
  static struct resource mxc_otg_resources[] = {
  	{
-		.start = MX25_OTG_BASE_ADDR,
-		.end = MX25_OTG_BASE_ADDR + 0x1ff,
+		.start = MX25_USB_OTG_BASE_ADDR,
+		.end = MX25_USB_OTG_BASE_ADDR + 0x1ff,
  		.flags = IORESOURCE_MEM,
  	}, {
-		.start = 37,
-		.end = 37,
+		.start = MX25_INT_USB_OTG,
+		.end = MX25_INT_USB_OTG,
  		.flags = IORESOURCE_IRQ,
  	},
  };
 
-struct platform_device mxc_otg = {
-	.name = "mxc-ehci",
-	.id = 0,
-	.dev = {
-		.coherent_dma_mask = 0xffffffff,
-		.dma_mask =&otg_dmamask,
-	},
-	.resource = mxc_otg_resources,
-	.num_resources = ARRAY_SIZE(mxc_otg_resources),
-};
-
  /* OTG gadget device */
  struct platform_device otg_udc_device = {
  	.name = "fsl-usb2-udc",
@@ -59,31 +48,6 @@ struct platform_device otg_udc_device = {
  	.num_resources = ARRAY_SIZE(mxc_otg_resources),
  };
 
-static u64 usbh2_dmamask = DMA_BIT_MASK(32);
-
-static struct resource mxc_usbh2_resources[] = {
-	{
-		.start = MX25_OTG_BASE_ADDR + 0x400,
-		.end = MX25_OTG_BASE_ADDR + 0x5ff,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = 35,
-		.end = 35,
-		.flags = IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device mxc_usbh2 = {
-	.name = "mxc-ehci",
-	.id = 1,
-	.dev = {
-		.coherent_dma_mask = 0xffffffff,
-		.dma_mask =&usbh2_dmamask,
-	},
-	.resource = mxc_usbh2_resources,
-	.num_resources = ARRAY_SIZE(mxc_usbh2_resources),
-};
-
  static struct resource mxc_pwm_resources0[] = {
  	{
  		.start	= 0x53fe0000,
arch/arm/mach-mx25/devices.h +0 -2
index 7b70a43..e6ad640 100644
@@ -1,6 +1,4 @@
-extern struct platform_device mxc_otg;
  extern struct platform_device otg_udc_device;
-extern struct platform_device mxc_usbh2;
  extern struct platform_device mxc_pwm_device0;
  extern struct platform_device mxc_pwm_device1;
  extern struct platform_device mxc_pwm_device2;
arch/arm/mach-mx25/mach-cpuimx25.c +4 -5
index f6f9ad6..0ee0fe7 100644
@@ -39,7 +39,6 @@
  #include<mach/mx25.h>
  #include<mach/mxc_nand.h>
  #include<mach/imxfb.h>
-#include<mach/mxc_ehci.h>
  #include<mach/iomux-mx25.h>
 
  #include "devices-imx25.h"
@@ -87,12 +86,12 @@ static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
  	},
  };
 
-static struct mxc_usbh_platform_data otg_pdata = {
+static const struct mxc_usbh_platform_data otg_pdata __initconst = {
  	.portsc	= MXC_EHCI_MODE_UTMI,
  	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
  };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
  	.portsc	= MXC_EHCI_MODE_SERIAL,
  	.flags	= MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
  		  MXC_EHCI_IPPUE_DOWN,
@@ -134,11 +133,11 @@ static void __init eukrea_cpuimx25_init(void)
  	imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
 
  	if (otg_mode_host)
-		mxc_register_device(&mxc_otg,&otg_pdata);
+		imx25_add_mxc_ehci_otg(&otg_pdata);
  	else
  		mxc_register_device(&otg_udc_device,&otg_device_pdata);
 
-	mxc_register_device(&mxc_usbh2,&usbh2_pdata);
+	imx25_add_mxc_ehci_hs(&usbh2_pdata);
 
  #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
  	eukrea_mbimxsd25_baseboard_init();
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
index f8be1eb..574c41f 100644
@@ -192,7 +192,7 @@ static void __init mx25pdk_init(void)
  			ARRAY_SIZE(mx25pdk_pads));
 
  	imx25_add_imx_uart0(&uart_pdata);
-	mxc_register_device(&mxc_usbh2, NULL);
+	imx25_add_mxc_ehci_hs(NULL);
  	imx25_add_mxc_nand(&mx25pdk_nand_board_info);
  	mxc_register_device(&mx25_rtc_device, NULL);
  	mxc_register_device(&mx25_fb_device,&mx25pdk_fb_pdata);
arch/arm/plat-mxc/devices/platform-mxc-ehci.c +7 -0
index 0cb67bb..825a048ca 100644
@@ -16,6 +16,13 @@
  		.irq = soc ## _INT_USB_ ## hs,				\
  	}
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
+const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX25, 1, HS);
+#endif /* ifdef CONFIG_ARCH_MX25 */
+
  #ifdef CONFIG_SOC_IMX27
  const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
  	imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
arch/arm/plat-mxc/ehci.c +2 -2
index 9915607..f699235 100644
@@ -71,7 +71,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
  	unsigned int v;
  #if defined(CONFIG_ARCH_MX25)
  	if (cpu_is_mx25()) {
-		v = readl(MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+		v = readl(MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
  				     USBCTRL_OTGBASE_OFFSET));
 
  		switch (port) {
@@ -108,7 +108,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
  			return -EINVAL;
  		}
 
-		writel(v, MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+		writel(v, MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
  				     USBCTRL_OTGBASE_OFFSET));
  		return 0;
  	}
arch/arm/plat-mxc/include/mach/mx25.h +5 -1
index a2404b0..0d31f82 100644
@@ -43,7 +43,9 @@
  #define MX25_LCDC_BASE_ADDR		0x53fbc000
  #define MX25_KPP_BASE_ADDR		0x43fa8000
  #define MX25_SDMA_BASE_ADDR		0x53fd4000
-#define MX25_OTG_BASE_ADDR		0x53ff4000
+#define MX25_USB_BASE_ADDR		0x53ff4000
+#define MX25_USB_OTG_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0000)
+#define MX25_USB_HS_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0200)
  #define MX25_CSI_BASE_ADDR		0x53ff8000
 
  #define MX25_IO_P2V(x)			IMX_IO_P2V(x)
@@ -67,6 +69,8 @@
  #define MX25_INT_UART2		32
  #define MX25_INT_NFC		33
  #define MX25_INT_SDMA		34
+#define MX25_INT_USB_HS		35
+#define MX25_INT_USB_OTG	37
  #define MX25_INT_LCDC		39
  #define MX25_INT_UART5		40
  #define MX25_INT_CAN1		43
Signature · 12 lines
Jaume Ribot Caner
R&D Engineer

FQ Ingenier?a Electr?nica, SA
Avda. de les Roquetes, 9
Pol. Industrial Vilanoveta
08812 Sant Pere de Ribes ( SPAIN )
www.fqingenieria.es

Tf  + 34 93 208 02 58
Fx  + 34 93 459 28 93
E-mail: jaume at fqingenieria.es
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#38 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

Hi Uwe,

2010/11/27 Uwe Kleine-K?nig <[email protected]>:

Quoted 9 lines

Hello Jaume,

Quoted 6 lines · Jaume Ribot

Dear Uwe,

I think there is an error in the Freescale documentation, as new 0x200 offset (as it might be according reference manual) makes usbh2 stops working.

Quoted 7 lines
Quoted 5 lines

Other users have experienced simmilar issues:
http://forums.freescale.com/t5/i-MX-Microprocessors/i-MX25-USBOH-host-core-port-on-chip-serial-PHY-Control/m-p/59365

I think old 0x400 offset value were correct.
Anyone can confirm?

Maybe one of the Freescale guys? ?(Added to Cc:)

I confirmed it with i.MX25 design team that offset 0x400 is the correct one, and 0x200 will not work. I will ping documentation team to get this document error fixed.

Signature · 2 lines
Regards,
Shawn
#39 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

Hi,

Sorry for previous email. I have missed reading this response. Now this point it's clear.

Regards.

Quoted 27 lines

Hi Uwe,

2010/11/27 Uwe Kleine-K?nig <[email protected]>:

Quoted 9 lines

Hello Jaume,

Quoted 6 lines · Jaume Ribot

Dear Uwe,

I think there is an error in the Freescale documentation, as new 0x200 offset (as it might be according reference manual) makes usbh2 stops working.

Quoted 7 lines
Quoted 5 lines

Other users have experienced simmilar issues:
http://forums.freescale.com/t5/i-MX-Microprocessors/i-MX25-USBOH-host-core-port-on-chip-serial-PHY-Control/m-p/59365

I think old 0x400 offset value were correct.
Anyone can confirm?

Maybe one of the Freescale guys? ?(Added to Cc:)

I confirmed it with i.MX25 design team that offset 0x400 is the correct one, and 0x200 will not work. I will ping documentation team to get this document error fixed.

--
Regards,
Shawn

#40 lore raw

PATCH 1/1 ARM: mx25: fix offset for usb host controller

In reply to Shawn Guo

In commit 2c20b9f (ARM: mx25: dynamically allocate mxc-ehci devices) I changed the offset to the value specified in the reference manual intending to test this change on hardware. This slipped through and now prooved to be wrong. So fix it and add a comment about the documentation being wrong.

---
 arch/arm/plat-mxc/include/mach/mx25.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/plat-mxc/include/mach/mx25.h +6 -1
index 024bebe..087cd7a 100644
@@ -49,7 +49,12 @@
 #define MX25_SDMA_BASE_ADDR		0x53fd4000
 #define MX25_USB_BASE_ADDR		0x53ff4000
 #define MX25_USB_OTG_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0000)
-#define MX25_USB_HS_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0200)
+/*
+ * The reference manual (IMX25RM, Rev. 1, 06/2009) specifies an offset of 0x200
+ * for the host controller.  Early documentation drafts specified 0x400 and
+ * Freescale internal sources confirm only the latter value to work.
+ */
+#define MX25_USB_HS_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0400)
 #define MX25_CSI_BASE_ADDR		0x53ff8000
 
 #define MX25_IO_P2V(x)			IMX_IO_P2V(x)
Signature · 1 line
1.7.2.3
#41 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

In reply to Shawn Guo
Quoted 3 lines · Shawn Guo

I confirmed it with i.MX25 design team that offset 0x400 is the correct one, and 0x200 will not work. I will ping documentation team to get this document error fixed.

You have a documentation team that fixes *documentation errors*? Wow, I didn't think so :-) Let's see what else we have around ...

rsc

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#42 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

Quoted 7 lines · Robert Schwebel
Quoted 3 lines · Shawn Guo

I confirmed it with i.MX25 design team that offset 0x400 is the correct one, and 0x200 will not work. I will ping documentation team to get this document error fixed.

You have a documentation team that fixes *documentation errors*? Wow, I didn't think so :-) Let's see what else we have around ...

Sorry, this wasn't serious. But it's good to know that somebody is caring about the documentation - we have seen many, many cut-and-paste bugs in different processor manuals so far and didn't find a good way to provide you with that feedback.

Best regards,
Robert

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#43 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

In reply to Uwe Kleine-König

Hello Uwe,

Quoted 14 lines

Hello Jaume,

Quoted 11 lines · Jaume Ribot

Dear Uwe,

I think there is an error in the Freescale documentation, as new 0x200 offset (as it might be according reference manual) makes usbh2 stops working.

Other users have experienced simmilar issues:
http://forums.freescale.com/t5/i-MX-Microprocessors/i-MX25-USBOH-host-core-port-on-chip-serial-PHY-Control/m-p/59365

I think old 0x400 offset value were correct.
Anyone can confirm?

Quoted 8 lines

Maybe one of the Freescale guys? (Added to Cc:)

If we don't hear any authoritive feed-back, I'd suggest to change it back to 0x400 and add a comment like:

	The reference manual (number bla blub) specifies 0x200, but only
	0x400 seems to work.

It seems a good workaround until a confirmation of Freescale guys is given. I will also try to get an "official" response via our local FAE.

Quoted 9 lines
Quoted 7 lines · Uwe Kleine-K?nig
Quoted 6 lines

According to the reference manual of the i.MX25 the host controller uses an
offset of 0x200 not 0x400 as was specified in the resources for mxc_usbh2.

Needs-Testing: yes

Actually I wanted that tag to make me stop sending this patch out. Well, not too bad IMHO.

Did you mean a way of testing/marking the patches? Please clarify.

Quoted 291 lines
Quoted 281 lines
Quoted 261 lines
---
  arch/arm/mach-mx25/Kconfig                    |    6 ++-
  arch/arm/mach-mx25/devices-imx25.h            |    7 ++++
  arch/arm/mach-mx25/devices.c                  |   44
++----------------------
  arch/arm/mach-mx25/devices.h                  |    2 -
  arch/arm/mach-mx25/mach-cpuimx25.c            |    9 ++---
  arch/arm/mach-mx25/mach-mx25_3ds.c            |    2 +-
  arch/arm/plat-mxc/devices/platform-mxc-ehci.c |    7 ++++
  arch/arm/plat-mxc/ehci.c                      |    4 +-
  arch/arm/plat-mxc/include/mach/mx25.h         |    6 +++-
  9 files changed, 34 insertions(+), 53 deletions(-)
arch/arm/mach-mx25/Kconfig +4 -2
index 38ca09a..b55585b 100644
@@ -5,16 +5,18 @@ comment "MX25 platforms:"
  config MACH_MX25_3DS
  	bool "Support MX25PDK (3DS) Platform"
  	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
  	select IMX_HAVE_PLATFORM_MXC_NAND
  	select IMX_HAVE_PLATFORM_ESDHC
 
  config MACH_EUKREA_CPUIMX25
  	bool "Support Eukrea CPUIMX25 Platform"
+	select IMX_HAVE_PLATFORM_ESDHC
+	select IMX_HAVE_PLATFORM_FLEXCAN
  	select IMX_HAVE_PLATFORM_IMX_I2C
  	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
  	select IMX_HAVE_PLATFORM_MXC_NAND
-	select IMX_HAVE_PLATFORM_FLEXCAN
-	select IMX_HAVE_PLATFORM_ESDHC
  	select MXC_ULPI if USB_ULPI
 
  choice
arch/arm/mach-mx25/devices-imx25.h +7 -0
index f62ce93..ac343ae 100644
@@ -39,6 +39,13 @@ extern const struct imx_imx_uart_1irq_data
 imx25_imx_uart_data[] __initconst;
  #define imx25_add_imx_uart3(pdata)	imx25_add_imx_uart(3, pdata)
  #define imx25_add_imx_uart4(pdata)	imx25_add_imx_uart(4, pdata)
 
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data
 __initconst;
+#define imx25_add_mxc_ehci_otg(pdata)	\
+	imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata)
+extern const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data
 __initconst;
+#define imx25_add_mxc_ehci_hs(pdata)	\
+	imx_add_mxc_ehci(&imx25_mxc_ehci_hs_data, pdata)
+

extern const struct imx_mxc_nand_data imx25_mxc_nand_data
__initconst;
#define imx25_add_mxc_nand(pdata) \
imx_add_mxc_nand(&imx25_mxc_nand_data, pdata)

arch/arm/mach-mx25/devices.c +4 -40
index 92eb1a9..4611c76 100644
@@ -26,27 +26,16 @@ static u64 otg_dmamask = DMA_BIT_MASK(32);
 
  static struct resource mxc_otg_resources[] = {
  	{
-		.start = MX25_OTG_BASE_ADDR,
-		.end = MX25_OTG_BASE_ADDR + 0x1ff,
+		.start = MX25_USB_OTG_BASE_ADDR,
+		.end = MX25_USB_OTG_BASE_ADDR + 0x1ff,
  		.flags = IORESOURCE_MEM,
  	}, {
-		.start = 37,
-		.end = 37,
+		.start = MX25_INT_USB_OTG,
+		.end = MX25_INT_USB_OTG,
  		.flags = IORESOURCE_IRQ,
  	},
  };
 
-struct platform_device mxc_otg = {
-	.name = "mxc-ehci",
-	.id = 0,
-	.dev = {
-		.coherent_dma_mask = 0xffffffff,
-		.dma_mask =&otg_dmamask,
-	},
-	.resource = mxc_otg_resources,
-	.num_resources = ARRAY_SIZE(mxc_otg_resources),
-};
-
  /* OTG gadget device */
  struct platform_device otg_udc_device = {
  	.name = "fsl-usb2-udc",
@@ -59,31 +48,6 @@ struct platform_device otg_udc_device = {
  	.num_resources = ARRAY_SIZE(mxc_otg_resources),
  };
 
-static u64 usbh2_dmamask = DMA_BIT_MASK(32);
-
-static struct resource mxc_usbh2_resources[] = {
-	{
-		.start = MX25_OTG_BASE_ADDR + 0x400,
-		.end = MX25_OTG_BASE_ADDR + 0x5ff,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = 35,
-		.end = 35,
-		.flags = IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device mxc_usbh2 = {
-	.name = "mxc-ehci",
-	.id = 1,
-	.dev = {
-		.coherent_dma_mask = 0xffffffff,
-		.dma_mask =&usbh2_dmamask,
-	},
-	.resource = mxc_usbh2_resources,
-	.num_resources = ARRAY_SIZE(mxc_usbh2_resources),
-};
-
  static struct resource mxc_pwm_resources0[] = {
  	{
  		.start	= 0x53fe0000,
arch/arm/mach-mx25/devices.h +0 -2
index 7b70a43..e6ad640 100644
@@ -1,6 +1,4 @@
-extern struct platform_device mxc_otg;
  extern struct platform_device otg_udc_device;
-extern struct platform_device mxc_usbh2;
  extern struct platform_device mxc_pwm_device0;
  extern struct platform_device mxc_pwm_device1;
  extern struct platform_device mxc_pwm_device2;
arch/arm/mach-mx25/mach-cpuimx25.c +2 -3
index f6f9ad6..0ee0fe7 100644
@@ -39,7 +39,6 @@
  #include<mach/mx25.h>
  #include<mach/mxc_nand.h>
  #include<mach/imxfb.h>
-#include<mach/mxc_ehci.h>
  #include<mach/iomux-mx25.h>
 
  #include "devices-imx25.h"
@@ -87,12 +86,12 @@ static struct i2c_board_info
 eukrea_cpuimx25_i2c_devices[] = {
  	},
  };
 
-static struct mxc_usbh_platform_data otg_pdata = {
+static const struct mxc_usbh_platform_data otg_pdata __initconst = {
  	.portsc	= MXC_EHCI_MODE_UTMI,
  	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
  };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
  	.portsc	= MXC_EHCI_MODE_SERIAL,
  	.flags	= MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |

MXC_EHCI_IPPUE_DOWN,

arch/arm/mach-mx25/mach-cpuimx25.c +2 -2
@@ -134,11 +133,11 @@ static void __init eukrea_cpuimx25_init(void)
  	imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
 
  	if (otg_mode_host)
-		mxc_register_device(&mxc_otg,&otg_pdata);
+		imx25_add_mxc_ehci_otg(&otg_pdata);
  	else
  		mxc_register_device(&otg_udc_device,&otg_device_pdata);
 
-	mxc_register_device(&mxc_usbh2,&usbh2_pdata);
+	imx25_add_mxc_ehci_hs(&usbh2_pdata);
 
  #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
  	eukrea_mbimxsd25_baseboard_init();
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
index f8be1eb..574c41f 100644
@@ -192,7 +192,7 @@ static void __init mx25pdk_init(void)
  			ARRAY_SIZE(mx25pdk_pads));
 
  	imx25_add_imx_uart0(&uart_pdata);
-	mxc_register_device(&mxc_usbh2, NULL);
+	imx25_add_mxc_ehci_hs(NULL);
  	imx25_add_mxc_nand(&mx25pdk_nand_board_info);
  	mxc_register_device(&mx25_rtc_device, NULL);
  	mxc_register_device(&mx25_fb_device,&mx25pdk_fb_pdata);
arch/arm/plat-mxc/devices/platform-mxc-ehci.c +7 -0
index 0cb67bb..825a048ca 100644
@@ -16,6 +16,13 @@
  		.irq = soc ## _INT_USB_ ## hs,				\
  	}
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
+const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX25, 1, HS);
+#endif /* ifdef CONFIG_ARCH_MX25 */
+
  #ifdef CONFIG_SOC_IMX27
  const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
  	imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
arch/arm/plat-mxc/ehci.c +1 -1
index 9915607..f699235 100644
@@ -71,7 +71,7 @@ int mxc_initialize_usb_hw(int port, unsigned int
 flags)
  	unsigned int v;
  #if defined(CONFIG_ARCH_MX25)
  	if (cpu_is_mx25()) {
-		v = readl(MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+		v = readl(MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
  				     USBCTRL_OTGBASE_OFFSET));
 
  		switch (port) {
arch/arm/plat-mxc/ehci.c +1 -1
@@ -108,7 +108,7 @@ int mxc_initialize_usb_hw(int port, unsigned int
 flags)
  			return -EINVAL;
  		}
 
-		writel(v, MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
+		writel(v, MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
  				     USBCTRL_OTGBASE_OFFSET));
  		return 0;
  	}
arch/arm/plat-mxc/include/mach/mx25.h +3 -1
index a2404b0..0d31f82 100644
@@ -43,7 +43,9 @@
  #define MX25_LCDC_BASE_ADDR		0x53fbc000
  #define MX25_KPP_BASE_ADDR		0x43fa8000
  #define MX25_SDMA_BASE_ADDR		0x53fd4000
-#define MX25_OTG_BASE_ADDR		0x53ff4000
+#define MX25_USB_BASE_ADDR		0x53ff4000
+#define MX25_USB_OTG_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0000)
+#define MX25_USB_HS_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0200)
  #define MX25_CSI_BASE_ADDR		0x53ff8000
 
  #define MX25_IO_P2V(x)			IMX_IO_P2V(x)

arch/arm/plat-mxc/include/mach/mx25.h line 76

Quoted 8 lines
arch/arm/plat-mxc/include/mach/mx25.h +2 -0
@@ -67,6 +69,8 @@
  #define MX25_INT_UART2		32
  #define MX25_INT_NFC		33
  #define MX25_INT_SDMA		34
+#define MX25_INT_USB_HS		35
+#define MX25_INT_USB_OTG	37
  #define MX25_INT_LCDC		39
  #define MX25_INT_UART5		40
  #define MX25_INT_CAN1		43

--
Jaume Ribot Caner
R&D Engineer

FQ Ingenier?a Electr?nica, SA
Avda. de les Roquetes, 9
Pol. Industrial Vilanoveta
08812 Sant Pere de Ribes ( SPAIN )
www.fqingenieria.es

Quoted 5 lines

Tf + 34 93 208 02 58
Fx + 34 93 459 28 93
E-mail: jaume at fqingenieria.es

--

Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#44 lore raw

PATCH 28/51 ARM: mx25: dynamically allocate mxc-ehci devices

Hello Jaume,

Quoted 11 lines · jaume at fqingenieria.es
Quoted 9 lines
Quoted 7 lines · Uwe Kleine-K?nig
Quoted 6 lines

According to the reference manual of the i.MX25 the host controller uses an
offset of 0x200 not 0x400 as was specified in the resources for mxc_usbh2.

Needs-Testing: yes

Actually I wanted that tag to make me stop sending this patch out. Well, not too bad IMHO.

Did you mean a way of testing/marking the patches? Please clarify.

I intended to test this change before sending it out. That's why I wrote "Needs-Testing: yes" into the commit log. I somehow thought I'd see that before sending the patch out. The upside of my failure here is that we now know the definitive offset and hopefully in the next revision of the documentation the value is fixes. So the world became a bit better :-)

Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#45 lore raw

PATCH 29/51 ARM: mx25: dynamically allocate fsl-usb2-udc devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx25/Kconfig                        |    1 +
 arch/arm/mach-mx25/devices-imx25.h                |    4 +++
 arch/arm/mach-mx25/devices.c                      |   26 ---------------------
 arch/arm/mach-mx25/devices.h                      |    1 -
 arch/arm/mach-mx25/mach-cpuimx25.c                |    5 +--
 arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c |    5 ++++
 6 files changed, 12 insertions(+), 30 deletions(-)
arch/arm/mach-mx25/Kconfig +1 -0
index b55585b..2944bb7 100644
@@ -13,6 +13,7 @@ config MACH_EUKREA_CPUIMX25
 	bool "Support Eukrea CPUIMX25 Platform"
 	select IMX_HAVE_PLATFORM_ESDHC
 	select IMX_HAVE_PLATFORM_FLEXCAN
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
arch/arm/mach-mx25/devices-imx25.h +4 -0
index ac343ae..448939a 100644
@@ -19,6 +19,10 @@ extern const struct imx_flexcan_data imx25_flexcan_data[] __initconst;
 #define imx25_add_flexcan0(pdata)	imx25_add_flexcan(0, pdata)
 #define imx25_add_flexcan1(pdata)	imx25_add_flexcan(1, pdata)
 
+extern const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst;
+#define imx25_add_fsl_usb2_udc(pdata)	\
+	imx_add_fsl_usb2_udc(&imx25_fsl_usb2_udc_data, pdata)
+
 extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst;
 #define imx25_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx25_imx_i2c_data[id], pdata)
arch/arm/mach-mx25/devices.c +0 -26
index 4611c76..27d07ce 100644
@@ -22,32 +22,6 @@
 #include <mach/mx25.h>
 #include <mach/irqs.h>
 
-static u64 otg_dmamask = DMA_BIT_MASK(32);
-
-static struct resource mxc_otg_resources[] = {
-	{
-		.start = MX25_USB_OTG_BASE_ADDR,
-		.end = MX25_USB_OTG_BASE_ADDR + 0x1ff,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = MX25_INT_USB_OTG,
-		.end = MX25_INT_USB_OTG,
-		.flags = IORESOURCE_IRQ,
-	},
-};
-
-/* OTG gadget device */
-struct platform_device otg_udc_device = {
-	.name = "fsl-usb2-udc",
-	.id   = -1,
-	.dev  = {
-		.dma_mask          = &otg_dmamask,
-		.coherent_dma_mask = 0xffffffff,
-	},
-	.resource = mxc_otg_resources,
-	.num_resources = ARRAY_SIZE(mxc_otg_resources),
-};
-
 static struct resource mxc_pwm_resources0[] = {
 	{
 		.start	= 0x53fe0000,
arch/arm/mach-mx25/devices.h +0 -1
index e6ad640..266c305 100644
@@ -1,4 +1,3 @@
-extern struct platform_device otg_udc_device;
 extern struct platform_device mxc_pwm_device0;
 extern struct platform_device mxc_pwm_device1;
 extern struct platform_device mxc_pwm_device2;
arch/arm/mach-mx25/mach-cpuimx25.c +2 -3
index 0ee0fe7..2094bdd 100644
@@ -26,7 +26,6 @@
 #include <linux/platform_device.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
-#include <linux/fsl_devices.h>
 
 #include <mach/eukrea-baseboards.h>
 #include <mach/hardware.h>
@@ -97,7 +96,7 @@ static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
 		  MXC_EHCI_IPPUE_DOWN,
 };
 
-static struct fsl_usb2_platform_data otg_device_pdata = {
+static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
 	.operating_mode = FSL_USB2_DR_DEVICE,
 	.phy_mode       = FSL_USB2_PHY_UTMI,
 };
@@ -135,7 +134,7 @@ static void __init eukrea_cpuimx25_init(void)
 	if (otg_mode_host)
 		imx25_add_mxc_ehci_otg(&otg_pdata);
 	else
-		mxc_register_device(&otg_udc_device, &otg_device_pdata);
+		imx25_add_fsl_usb2_udc(&otg_device_pdata);
 
 	imx25_add_mxc_ehci_hs(&usbh2_pdata);
 
arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c +5 -0
index 3116f9a..cb5fb71 100644
@@ -15,6 +15,11 @@
 		.irq = soc ## _INT_USB_OTG,				\
 	}
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst =
+	imx_fsl_usb2_udc_data_entry_single(MX25);
+#endif
+
 #ifdef CONFIG_SOC_IMX27
 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
 	imx_fsl_usb2_udc_data_entry_single(MX27);
Signature · 1 line
1.7.2.3
#46 lore raw

PATCH 30/51 ARM: mx25: dynamically allocate mxc_pwm devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx25/devices.c                    |   76 -----------------------
 arch/arm/mach-mx25/devices.h                    |    4 -
 arch/arm/plat-mxc/devices/platform-mxc_pwm.c    |   29 +++++++--
 arch/arm/plat-mxc/include/mach/devices-common.h |    2 +
 arch/arm/plat-mxc/include/mach/mx25.h           |    8 +++
 5 files changed, 32 insertions(+), 87 deletions(-)
arch/arm/mach-mx25/devices.c +0 -76
index 27d07ce..13a3c280 100644
@@ -22,63 +22,6 @@
 #include <mach/mx25.h>
 #include <mach/irqs.h>
 
-static struct resource mxc_pwm_resources0[] = {
-	{
-		.start	= 0x53fe0000,
-		.end	= 0x53fe3fff,
-		.flags	= IORESOURCE_MEM,
-	}, {
-		.start   = 26,
-		.end     = 26,
-		.flags   = IORESOURCE_IRQ,
-	}
-};
-
-struct platform_device mxc_pwm_device0 = {
-	.name = "mxc_pwm",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mxc_pwm_resources0),
-	.resource = mxc_pwm_resources0,
-};
-
-static struct resource mxc_pwm_resources1[] = {
-	{
-		.start	= 0x53fa0000,
-		.end	= 0x53fa3fff,
-		.flags	= IORESOURCE_MEM,
-	}, {
-		.start   = 36,
-		.end     = 36,
-		.flags   = IORESOURCE_IRQ,
-	}
-};
-
-struct platform_device mxc_pwm_device1 = {
-	.name = "mxc_pwm",
-	.id = 1,
-	.num_resources = ARRAY_SIZE(mxc_pwm_resources1),
-	.resource = mxc_pwm_resources1,
-};
-
-static struct resource mxc_pwm_resources2[] = {
-	{
-		.start	= 0x53fa8000,
-		.end	= 0x53fabfff,
-		.flags	= IORESOURCE_MEM,
-	}, {
-		.start   = 41,
-		.end     = 41,
-		.flags   = IORESOURCE_IRQ,
-	}
-};
-
-struct platform_device mxc_pwm_device2 = {
-	.name = "mxc_pwm",
-	.id = 2,
-	.num_resources = ARRAY_SIZE(mxc_pwm_resources2),
-	.resource = mxc_pwm_resources2,
-};
-
 static struct resource mxc_keypad_resources[] = {
 	{
 		.start	= 0x43fa8000,
@@ -98,25 +41,6 @@ struct platform_device mxc_keypad_device = {
 	.resource = mxc_keypad_resources,
 };
 
-static struct resource mxc_pwm_resources3[] = {
-	{
-		.start	= 0x53fc8000,
-		.end	= 0x53fcbfff,
-		.flags	= IORESOURCE_MEM,
-	}, {
-		.start   = 42,
-		.end     = 42,
-		.flags   = IORESOURCE_IRQ,
-	}
-};
-
-struct platform_device mxc_pwm_device3 = {
-	.name = "mxc_pwm",
-	.id = 3,
-	.num_resources = ARRAY_SIZE(mxc_pwm_resources3),
-	.resource = mxc_pwm_resources3,
-};
-
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
 		.chip.label = "gpio-0",
arch/arm/mach-mx25/devices.h +0 -4
index 266c305..afc60dd 100644
@@ -1,7 +1,3 @@
-extern struct platform_device mxc_pwm_device0;
-extern struct platform_device mxc_pwm_device1;
-extern struct platform_device mxc_pwm_device2;
-extern struct platform_device mxc_pwm_device3;
 extern struct platform_device mxc_keypad_device;
 extern struct platform_device mx25_rtc_device;
 extern struct platform_device mx25_fb_device;
arch/arm/plat-mxc/devices/platform-mxc_pwm.c +22 -7
index 3ebbc67..5a47d1e 100644
@@ -9,20 +9,35 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_mxc_pwm_data_entry_single(soc)				\
+#define imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size)		\
 	{								\
-		.iobase = soc ## _PWM_BASE_ADDR,			\
-		.irq = soc ## _INT_PWM,					\
+		.id = _id,						\
+		.iobase = soc ## _PWM ## _hwid ## _BASE_ADDR,		\
+		.iosize = _size,					\
+		.irq = soc ## _INT_PWM ## _hwid,			\
 	}
+#define imx_mxc_pwm_data_entry(soc, _id, _hwid, _size)			\
+	[_id] = imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size)
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_mxc_pwm_data imx21_mxc_pwm_data __initconst =
-	imx_mxc_pwm_data_entry_single(MX21);
+	imx_mxc_pwm_data_entry_single(MX21, 0, , SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_mxc_pwm_data imx25_mxc_pwm_data[] __initconst = {
+#define imx25_mxc_pwm_data_entry(_id, _hwid)				\
+	imx_mxc_pwm_data_entry(MX25, _id, _hwid, SZ_16K)
+	imx25_mxc_pwm_data_entry(0, 1),
+	imx25_mxc_pwm_data_entry(1, 2),
+	imx25_mxc_pwm_data_entry(2, 3),
+	imx25_mxc_pwm_data_entry(3, 4),
+};
+#endif
+
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst =
-	imx_mxc_pwm_data_entry_single(MX27);
+	imx_mxc_pwm_data_entry_single(MX27, 0, , SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 struct platform_device *__init imx_add_mxc_pwm(
@@ -31,7 +46,7 @@ struct platform_device *__init imx_add_mxc_pwm(
 	struct resource res[] = {
 		{
 			.start = data->iobase,
-			.end = data->iobase + SZ_4K - 1,
+			.end = data->iobase + data->iosize - 1,
 			.flags = IORESOURCE_MEM,
 		}, {
 			.start = data->irq,
@@ -40,6 +55,6 @@ struct platform_device *__init imx_add_mxc_pwm(
 		},
 	};
 
-	return imx_add_platform_device("mxc_pwm", 0,
+	return imx_add_platform_device("mxc_pwm", data->id,
 			res, ARRAY_SIZE(res), NULL, 0);
 }
arch/arm/plat-mxc/include/mach/devices-common.h +2 -0
index f5d0000..07223b2 100644
@@ -217,7 +217,9 @@ struct platform_device *__init imx_add_mxc_nand(
 		const struct mxc_nand_platform_data *pdata);
 
 struct imx_mxc_pwm_data {
+	int id;
 	resource_size_t iobase;
+	resource_size_t iosize;
 	resource_size_t irq;
 };
 struct platform_device *__init imx_add_mxc_pwm(
arch/arm/plat-mxc/include/mach/mx25.h +8 -0
index 0d31f82..cea851f 100644
@@ -19,10 +19,14 @@
 #define MX25_CRM_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x80000)
 #define MX25_GPT1_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x90000)
 #define MX25_GPIO4_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x9c000)
+#define MX25_PWM2_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xa0000)
 #define MX25_GPIO3_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xa4000)
+#define MX25_PWM3_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xa8000)
+#define MX25_PWM4_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xc8000)
 #define MX25_GPIO1_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xcc000)
 #define MX25_GPIO2_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xd0000)
 #define MX25_WDOG_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xdc000)
+#define MX25_PWM1_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xe0000)
 
 #define MX25_UART1_BASE_ADDR		0x43f90000
 #define MX25_UART2_BASE_ADDR		0x43f94000
@@ -66,13 +70,17 @@
 #define MX25_INT_UART3		18
 #define MX25_INT_KPP		24
 #define MX25_INT_DRYICE		25
+#define MX25_INT_PWM1		26
 #define MX25_INT_UART2		32
 #define MX25_INT_NFC		33
 #define MX25_INT_SDMA		34
 #define MX25_INT_USB_HS		35
+#define MX25_INT_PWM2		36
 #define MX25_INT_USB_OTG	37
 #define MX25_INT_LCDC		39
 #define MX25_INT_UART5		40
+#define MX25_INT_PWM3		41
+#define MX25_INT_PWM4		42
 #define MX25_INT_CAN1		43
 #define MX25_INT_CAN2		44
 #define MX25_INT_UART1		45
Signature · 1 line
1.7.2.3
#47 lore raw

PATCH 31/51 ARM: mx25: move registration of gpios to plat-mxc/gpio.c

In reply to Uwe Kleine-König

To use common macros to define the gpio ports for imx{1,21,25,27} the existing ones had to made more general and a few more base address defines were necessary.

---
 arch/arm/mach-mx25/devices.c          |   29 ----------------
 arch/arm/plat-mxc/gpio.c              |   58 ++++++++++++++++++++-------------
 arch/arm/plat-mxc/include/mach/mx1.h  |    4 ++
 arch/arm/plat-mxc/include/mach/mx21.h |    6 +++
 arch/arm/plat-mxc/include/mach/mx25.h |    4 ++
 arch/arm/plat-mxc/include/mach/mx27.h |    6 +++
 6 files changed, 55 insertions(+), 52 deletions(-)
arch/arm/mach-mx25/devices.c +0 -29
index 13a3c280..1798be9 100644
@@ -41,35 +41,6 @@ struct platform_device mxc_keypad_device = {
 	.resource = mxc_keypad_resources,
 };
 
-static struct mxc_gpio_port imx_gpio_ports[] = {
-	{
-		.chip.label = "gpio-0",
-		.base = MX25_IO_ADDRESS(MX25_GPIO1_BASE_ADDR),
-		.irq = 52,
-		.virtual_irq_start = MXC_GPIO_IRQ_START,
-	}, {
-		.chip.label = "gpio-1",
-		.base = MX25_IO_ADDRESS(MX25_GPIO2_BASE_ADDR),
-		.irq = 51,
-		.virtual_irq_start = MXC_GPIO_IRQ_START + 32,
-	}, {
-		.chip.label = "gpio-2",
-		.base = MX25_IO_ADDRESS(MX25_GPIO3_BASE_ADDR),
-		.irq = 16,
-		.virtual_irq_start = MXC_GPIO_IRQ_START + 64,
-	}, {
-		.chip.label = "gpio-3",
-		.base = MX25_IO_ADDRESS(MX25_GPIO4_BASE_ADDR),
-		.irq = 23,
-		.virtual_irq_start = MXC_GPIO_IRQ_START + 96,
-	}
-};
-
-int __init imx25_register_gpios(void)
-{
-	return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
-}
-
 static struct resource mx25_rtc_resources[] = {
 	{
 		.start	= MX25_DRYICE_BASE_ADDR,
arch/arm/plat-mxc/gpio.c +35 -23

88 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mx1.h +4 -0
index f1e336e..75d9621 100644
@@ -65,6 +65,10 @@
 #define MX1_CCM_BASE_ADDR		(0x1B000 + MX1_IO_BASE_ADDR)
 #define MX1_SCM_BASE_ADDR		(0x1B804 + MX1_IO_BASE_ADDR)
 #define MX1_GPIO_BASE_ADDR		(0x1C000 + MX1_IO_BASE_ADDR)
+#define MX1_GPIO1_BASE_ADDR		(0x1C000 + MX1_IO_BASE_ADDR)
+#define MX1_GPIO2_BASE_ADDR		(0x1C100 + MX1_IO_BASE_ADDR)
+#define MX1_GPIO3_BASE_ADDR		(0x1C200 + MX1_IO_BASE_ADDR)
+#define MX1_GPIO4_BASE_ADDR		(0x1C300 + MX1_IO_BASE_ADDR)
 #define MX1_EIM_BASE_ADDR		(0x20000 + MX1_IO_BASE_ADDR)
 #define MX1_SDRAMC_BASE_ADDR		(0x21000 + MX1_IO_BASE_ADDR)
 #define MX1_MMA_BASE_ADDR		(0x22000 + MX1_IO_BASE_ADDR)
arch/arm/plat-mxc/include/mach/mx21.h +6 -0
index a82f590..6cd049e 100644
@@ -48,6 +48,12 @@
 #define MX21_SDHC1_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x13000)
 #define MX21_SDHC2_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x14000)
 #define MX21_GPIO_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x15000)
+#define MX21_GPIO1_BASE_ADDR			(MX21_GPIO_BASE_ADDR + 0x000)
+#define MX21_GPIO2_BASE_ADDR			(MX21_GPIO_BASE_ADDR + 0x100)
+#define MX21_GPIO3_BASE_ADDR			(MX21_GPIO_BASE_ADDR + 0x200)
+#define MX21_GPIO4_BASE_ADDR			(MX21_GPIO_BASE_ADDR + 0x300)
+#define MX21_GPIO5_BASE_ADDR			(MX21_GPIO_BASE_ADDR + 0x400)
+#define MX21_GPIO6_BASE_ADDR			(MX21_GPIO_BASE_ADDR + 0x500)
 #define MX21_AUDMUX_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x16000)
 #define MX21_CSPI3_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x17000)
 #define MX21_LCDC_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x21000)
arch/arm/plat-mxc/include/mach/mx25.h +4 -0
index cea851f..024bebe 100644
@@ -66,8 +66,10 @@
 #define MX25_INT_SSI1		12
 #define MX25_INT_CSPI2		13
 #define MX25_INT_CSPI1		14
+#define MX25_INT_GPIO3		16
 #define MX25_INT_CSI		17
 #define MX25_INT_UART3		18
+#define MX25_INT_GPIO4		23
 #define MX25_INT_KPP		24
 #define MX25_INT_DRYICE		25
 #define MX25_INT_PWM1		26
@@ -84,6 +86,8 @@
 #define MX25_INT_CAN1		43
 #define MX25_INT_CAN2		44
 #define MX25_INT_UART1		45
+#define MX25_INT_GPIO2		51
+#define MX25_INT_GPIO1		52
 #define MX25_INT_FEC		57
 
 #define MX25_DMA_REQ_SSI2_RX1	22
arch/arm/plat-mxc/include/mach/mx27.h +6 -0
index 45419b3..eb09ec0 100644
@@ -51,6 +51,12 @@
 #define MX27_SDHC1_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x13000)
 #define MX27_SDHC2_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x14000)
 #define MX27_GPIO_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x15000)
+#define MX27_GPIO1_BASE_ADDR			(MX27_GPIO_BASE_ADDR + 0x000)
+#define MX27_GPIO2_BASE_ADDR			(MX27_GPIO_BASE_ADDR + 0x100)
+#define MX27_GPIO3_BASE_ADDR			(MX27_GPIO_BASE_ADDR + 0x200)
+#define MX27_GPIO4_BASE_ADDR			(MX27_GPIO_BASE_ADDR + 0x300)
+#define MX27_GPIO5_BASE_ADDR			(MX27_GPIO_BASE_ADDR + 0x400)
+#define MX27_GPIO6_BASE_ADDR			(MX27_GPIO_BASE_ADDR + 0x500)
 #define MX27_AUDMUX_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x16000)
 #define MX27_CSPI3_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x17000)
 #define MX27_MSHC_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x18000)
Signature · 1 line
1.7.2.3
#48 lore raw

PATCH 32/51 ARM: mx25: dynamically allocate imx-keypad devices

In reply to Uwe Kleine-König

The mxc-keypad device seems to be the result of an early and partial merge of the keypad driver. It's unused and there is no corresponding driver available, so just remove it.

---
 arch/arm/mach-mx25/Kconfig                      |    3 +-
 arch/arm/mach-mx25/devices-imx25.h              |    4 ++
 arch/arm/mach-mx25/devices.c                    |   39 -----------------------
 arch/arm/mach-mx25/devices.h                    |    2 -
 arch/arm/mach-mx25/mach-mx25_3ds.c              |    4 +-
 arch/arm/plat-mxc/devices/platform-imx-keypad.c |   14 ++++++--
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 7 files changed, 19 insertions(+), 48 deletions(-)
arch/arm/mach-mx25/Kconfig +2 -1
index 2944bb7..e9d4456 100644
@@ -4,10 +4,11 @@ comment "MX25 platforms:"
 
 config MACH_MX25_3DS
 	bool "Support MX25PDK (3DS) Platform"
+	select IMX_HAVE_PLATFORM_ESDHC
+	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
-	select IMX_HAVE_PLATFORM_ESDHC
 
 config MACH_EUKREA_CPUIMX25
 	bool "Support Eukrea CPUIMX25 Platform"
arch/arm/mach-mx25/devices-imx25.h +4 -0
index 448939a..a35123f 100644
@@ -30,6 +30,10 @@ extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst;
 #define imx25_add_imx_i2c1(pdata)	imx25_add_imx_i2c(1, pdata)
 #define imx25_add_imx_i2c2(pdata)	imx25_add_imx_i2c(2, pdata)
 
+extern const struct imx_imx_keypad_data imx25_imx_keypad_data __initconst;
+#define imx25_add_imx_keypad(pdata)	\
+	imx_add_imx_keypad(&imx25_imx_keypad_data, pdata)
+
 extern const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst;
 #define imx25_add_imx_ssi(id, pdata)	\
 	imx_add_imx_ssi(&imx25_imx_ssi_data[id], pdata)
arch/arm/mach-mx25/devices.c +0 -39
index 1798be9..052adbb 100644
@@ -22,25 +22,6 @@
 #include <mach/mx25.h>
 #include <mach/irqs.h>
 
-static struct resource mxc_keypad_resources[] = {
-	{
-		.start	= 0x43fa8000,
-		.end	= 0x43fabfff,
-		.flags	= IORESOURCE_MEM,
-	}, {
-		.start   = 24,
-		.end     = 24,
-		.flags   = IORESOURCE_IRQ,
-	}
-};
-
-struct platform_device mxc_keypad_device = {
-	.name = "mxc-keypad",
-	.id = -1,
-	.num_resources = ARRAY_SIZE(mxc_keypad_resources),
-	.resource = mxc_keypad_resources,
-};
-
 static struct resource mx25_rtc_resources[] = {
 	{
 		.start	= MX25_DRYICE_BASE_ADDR,
@@ -98,26 +79,6 @@ struct platform_device mxc_wdt = {
 	.resource = mxc_wdt_resources,
 };
 
-static struct resource mx25_kpp_resources[] = {
-	{
-		.start	= MX25_KPP_BASE_ADDR,
-		.end	= MX25_KPP_BASE_ADDR + 0xf,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= MX25_INT_KPP,
-		.end	= MX25_INT_KPP,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device mx25_kpp_device = {
-	.name	= "imx-keypad",
-	.id	= -1,
-	.num_resources	= ARRAY_SIZE(mx25_kpp_resources),
-	.resource	= mx25_kpp_resources,
-};
-
 static struct resource mx25_csi_resources[] = {
 	{
 		.start	= MX25_CSI_BASE_ADDR,
arch/arm/mach-mx25/devices.h +0 -2
index afc60dd..dd1fded 100644
@@ -1,6 +1,4 @@
-extern struct platform_device mxc_keypad_device;
 extern struct platform_device mx25_rtc_device;
 extern struct platform_device mx25_fb_device;
 extern struct platform_device mxc_wdt;
-extern struct platform_device mx25_kpp_device;
 extern struct platform_device mx25_csi_device;
arch/arm/mach-mx25/mach-mx25_3ds.c +2 -2
index 574c41f..1d07cfb 100644
@@ -181,7 +181,7 @@ static const uint32_t mx25pdk_keymap[] = {
 	KEY(3, 3, KEY_POWER),
 };
 
-static struct matrix_keymap_data mx25pdk_keymap_data = {
+static const struct matrix_keymap_data mx25pdk_keymap_data __initdata = {
 	.keymap		= mx25pdk_keymap,
 	.keymap_size	= ARRAY_SIZE(mx25pdk_keymap),
 };
@@ -200,7 +200,7 @@ static void __init mx25pdk_init(void)
 
 	mx25pdk_fec_reset();
 	imx25_add_fec(&mx25_fec_pdata);
-	mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data);
+	imx25_add_imx_keypad(&mx25pdk_keymap_data);
 
 	imx25_add_esdhc(0, NULL);
 }
arch/arm/plat-mxc/devices/platform-imx-keypad.c +10 -4
index fdfee55..5995e81 100644
@@ -9,20 +9,26 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_imx_keypad_data_entry_single(soc)				\
+#define imx_imx_keypad_data_entry_single(soc, _size)			\
 	{								\
 		.iobase = soc ## _KPP_BASE_ADDR,			\
+		.iosize = _size,					\
 		.irq = soc ## _INT_KPP,					\
 	}
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst =
-	imx_imx_keypad_data_entry_single(MX21);
+	imx_imx_keypad_data_entry_single(MX21, SZ_16);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_imx_keypad_data imx25_imx_keypad_data __initconst =
+	imx_imx_keypad_data_entry_single(MX25, SZ_16K);
+#endif
+
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
-	imx_imx_keypad_data_entry_single(MX27);
+	imx_imx_keypad_data_entry_single(MX27, SZ_16);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 struct platform_device *__init imx_add_imx_keypad(
@@ -32,7 +38,7 @@ struct platform_device *__init imx_add_imx_keypad(
 	struct resource res[] = {
 		{
 			.start = data->iobase,
-			.end = data->iobase + SZ_16 - 1,
+			.end = data->iobase + data->iosize - 1,
 			.flags = IORESOURCE_MEM,
 		}, {
 			.start = data->irq,
arch/arm/plat-mxc/include/mach/devices-common.h +1 -0
index 07223b2..8482613 100644
@@ -95,6 +95,7 @@ struct platform_device *__init imx_add_imx_i2c(
 #include <linux/input/matrix_keypad.h>
 struct imx_imx_keypad_data {
 	resource_size_t iobase;
+	resource_size_t iosize;
 	resource_size_t irq;
 };
 struct platform_device *__init imx_add_imx_keypad(
Signature · 1 line
1.7.2.3
#49 lore raw

PATCH 33/51 ARM: mx25: dynamically allocate imxdi_rtc devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx25/Kconfig                      |    2 +
 arch/arm/mach-mx25/devices-imx25.h              |    4 ++
 arch/arm/mach-mx25/devices.c                    |   19 ----------
 arch/arm/mach-mx25/devices.h                    |    1 -
 arch/arm/mach-mx25/mach-cpuimx25.c              |    2 +-
 arch/arm/mach-mx25/mach-mx25_3ds.c              |    2 +-
 arch/arm/plat-mxc/devices/Kconfig               |    3 ++
 arch/arm/plat-mxc/devices/Makefile              |    1 +
 arch/arm/plat-mxc/devices/platform-imxdi_rtc.c  |   41 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/devices-common.h |    7 ++++
 10 files changed, 60 insertions(+), 22 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-imxdi_rtc.c
arch/arm/mach-mx25/Kconfig +2 -0
index e9d4456..baa75fe 100644
@@ -5,6 +5,7 @@ comment "MX25 platforms:"
 config MACH_MX25_3DS
 	bool "Support MX25PDK (3DS) Platform"
 	select IMX_HAVE_PLATFORM_ESDHC
+	select IMX_HAVE_PLATFORM_IMXDI_RTC
 	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
@@ -15,6 +16,7 @@ config MACH_EUKREA_CPUIMX25
 	select IMX_HAVE_PLATFORM_ESDHC
 	select IMX_HAVE_PLATFORM_FLEXCAN
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
+	select IMX_HAVE_PLATFORM_IMXDI_RTC
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
arch/arm/mach-mx25/devices-imx25.h +4 -0
index a35123f..a4980ec 100644
@@ -23,6 +23,10 @@ extern const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst;
 #define imx25_add_fsl_usb2_udc(pdata)	\
 	imx_add_fsl_usb2_udc(&imx25_fsl_usb2_udc_data, pdata)
 
+extern struct imx_imxdi_rtc_data imx25_imxdi_rtc_data __initconst;
+#define imx25_add_imxdi_rtc(pdata)	\
+	imx_add_imxdi_rtc(&imx25_imxdi_rtc_data)
+
 extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst;
 #define imx25_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx25_imx_i2c_data[id], pdata)
arch/arm/mach-mx25/devices.c +0 -19
index 052adbb..1274396 100644
@@ -22,25 +22,6 @@
 #include <mach/mx25.h>
 #include <mach/irqs.h>
 
-static struct resource mx25_rtc_resources[] = {
-	{
-		.start	= MX25_DRYICE_BASE_ADDR,
-		.end	= MX25_DRYICE_BASE_ADDR + 0x40,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= MX25_INT_DRYICE,
-		.flags	= IORESOURCE_IRQ
-	},
-};
-
-struct platform_device mx25_rtc_device = {
-	.name	= "imxdi_rtc",
-	.id	= 0,
-	.num_resources	= ARRAY_SIZE(mx25_rtc_resources),
-	.resource	= mx25_rtc_resources,
-};
-
 static struct resource mx25_fb_resources[] = {
 	{
 		.start	= MX25_LCDC_BASE_ADDR,
arch/arm/mach-mx25/devices.h +0 -1
index dd1fded..f37f9a2 100644
@@ -1,4 +1,3 @@
-extern struct platform_device mx25_rtc_device;
 extern struct platform_device mx25_fb_device;
 extern struct platform_device mxc_wdt;
 extern struct platform_device mx25_csi_device;
arch/arm/mach-mx25/mach-cpuimx25.c +1 -1
index 2094bdd..d1a04ba 100644
@@ -124,7 +124,7 @@ static void __init eukrea_cpuimx25_init(void)
 
 	imx25_add_imx_uart0(&uart_pdata);
 	imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
-	mxc_register_device(&mx25_rtc_device, NULL);
+	imx25_add_imxdi_rtc(NULL);
 	imx25_add_fec(&mx25_fec_pdata);
 
 	i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
index 1d07cfb..0566d3c 100644
@@ -194,7 +194,7 @@ static void __init mx25pdk_init(void)
 	imx25_add_imx_uart0(&uart_pdata);
 	imx25_add_mxc_ehci_hs(NULL);
 	imx25_add_mxc_nand(&mx25pdk_nand_board_info);
-	mxc_register_device(&mx25_rtc_device, NULL);
+	imx25_add_imxdi_rtc(NULL);
 	mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
 	mxc_register_device(&mxc_wdt, NULL);
 
arch/arm/plat-mxc/devices/Kconfig +3 -0
index a0be2df..81d7a54 100644
@@ -22,6 +22,9 @@ config IMX_HAVE_PLATFORM_IMX21_HCD
 config IMX_HAVE_PLATFORM_IMX2_WDT
 	bool
 
+config IMX_HAVE_PLATFORM_IMXDI_RTC
+	bool
+
 config IMX_HAVE_PLATFORM_IMX_FB
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index 14b228e..f1c3767 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o
 obj-y += platform-imx-dma.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
arch/arm/plat-mxc/devices/platform-imxdi_rtc.c new file +41 -0

41 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/devices-common.h +7 -0
index 8482613..4d4b28b 100644
@@ -72,6 +72,13 @@ struct imx_imx2_wdt_data {
 struct platform_device *__init imx_add_imx2_wdt(
 		const struct imx_imx2_wdt_data *data);
 
+struct imx_imxdi_rtc_data {
+	resource_size_t iobase;
+	resource_size_t irq;
+};
+struct platform_device *__init imx_add_imxdi_rtc(
+		const struct imx_imxdi_rtc_data *data);
+
 #include <mach/imxfb.h>
 struct imx_imx_fb_data {
 	resource_size_t iobase;
Signature · 1 line
1.7.2.3
#50 lore raw

PATCH 34/51 ARM: mx25: dynamically allocatate imx-fb devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx25/Kconfig                      |    2 ++
 arch/arm/mach-mx25/devices-imx25.h              |    4 ++++
 arch/arm/mach-mx25/devices.c                    |   23 -----------------------
 arch/arm/mach-mx25/devices.h                    |    1 -
 arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c   |    5 ++---
 arch/arm/mach-mx25/mach-mx25_3ds.c              |    5 ++---
 arch/arm/plat-mxc/devices/platform-imx-fb.c     |   14 ++++++++++----
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 8 files changed, 21 insertions(+), 34 deletions(-)
arch/arm/mach-mx25/Kconfig +2 -0
index baa75fe..10c0f60 100644
@@ -6,6 +6,7 @@ config MACH_MX25_3DS
 	bool "Support MX25PDK (3DS) Platform"
 	select IMX_HAVE_PLATFORM_ESDHC
 	select IMX_HAVE_PLATFORM_IMXDI_RTC
+	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
@@ -17,6 +18,7 @@ config MACH_EUKREA_CPUIMX25
 	select IMX_HAVE_PLATFORM_FLEXCAN
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMXDI_RTC
+	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
arch/arm/mach-mx25/devices-imx25.h +4 -0
index a4980ec..d80cce0 100644
@@ -27,6 +27,10 @@ extern struct imx_imxdi_rtc_data imx25_imxdi_rtc_data __initconst;
 #define imx25_add_imxdi_rtc(pdata)	\
 	imx_add_imxdi_rtc(&imx25_imxdi_rtc_data)
 
+extern const struct imx_imx_fb_data imx25_imx_fb_data __initconst;
+#define imx25_add_imx_fb(pdata)	\
+	imx_add_imx_fb(&imx25_imx_fb_data, pdata)
+
 extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst;
 #define imx25_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx25_imx_i2c_data[id], pdata)
arch/arm/mach-mx25/devices.c +0 -23
index 1274396..09095e0 100644
@@ -22,29 +22,6 @@
 #include <mach/mx25.h>
 #include <mach/irqs.h>
 
-static struct resource mx25_fb_resources[] = {
-	{
-		.start	= MX25_LCDC_BASE_ADDR,
-		.end	= MX25_LCDC_BASE_ADDR + 0xfff,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= MX25_INT_LCDC,
-		.end	= MX25_INT_LCDC,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device mx25_fb_device = {
-	.name		= "imx-fb",
-	.id		= 0,
-	.resource	= mx25_fb_resources,
-	.num_resources	= ARRAY_SIZE(mx25_fb_resources),
-	.dev		= {
-		.coherent_dma_mask = 0xFFFFFFFF,
-	},
-};
-
 static struct resource mxc_wdt_resources[] = {
 	{
 		.start = MX25_WDOG_BASE_ADDR,
arch/arm/mach-mx25/devices.h +0 -1
index f37f9a2..11997e2 100644
@@ -1,3 +1,2 @@
-extern struct platform_device mx25_fb_device;
 extern struct platform_device mxc_wdt;
 extern struct platform_device mx25_csi_device;
arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c +2 -3
index e765ac5..d6058e0 100644
@@ -33,7 +33,6 @@
 #include <asm/mach/arch.h>
 #include <mach/mx25.h>
 #include <mach/imx-uart.h>
-#include <mach/imxfb.h>
 #include <mach/audmux.h>
 
 #include "devices-imx25.h"
@@ -151,7 +150,7 @@ static struct imx_fb_videomode eukrea_mximxsd_modes[] = {
 	},
 };
 
-static struct imx_fb_platform_data eukrea_mximxsd_fb_pdata = {
+static const struct imx_fb_platform_data eukrea_mximxsd_fb_pdata __initconst = {
 	.mode		= eukrea_mximxsd_modes,
 	.num_modes	= ARRAY_SIZE(eukrea_mximxsd_modes),
 	.pwmr		= 0x00A903FF,
@@ -273,7 +272,7 @@ void __init eukrea_mbimxsd25_baseboard_init(void)
 #endif
 
 	imx25_add_imx_uart1(&uart_pdata);
-	mxc_register_device(&mx25_fb_device, &eukrea_mximxsd_fb_pdata);
+	imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata);
 	imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
 
 	imx25_add_flexcan1(NULL);
arch/arm/mach-mx25/mach-mx25_3ds.c +2 -3
index 0566d3c..34492aa 100644
@@ -39,7 +39,6 @@
 #include <asm/mach/map.h>
 #include <mach/common.h>
 #include <mach/mx25.h>
-#include <mach/imxfb.h>
 #include <mach/iomux-mx25.h>
 
 #include "devices-imx25.h"
@@ -154,7 +153,7 @@ static struct imx_fb_videomode mx25pdk_modes[] = {
 	},
 };
 
-static struct imx_fb_platform_data mx25pdk_fb_pdata = {
+static const struct imx_fb_platform_data mx25pdk_fb_pdata __initconst = {
 	.mode		= mx25pdk_modes,
 	.num_modes	= ARRAY_SIZE(mx25pdk_modes),
 	.pwmr		= 0x00A903FF,
@@ -195,7 +194,7 @@ static void __init mx25pdk_init(void)
 	imx25_add_mxc_ehci_hs(NULL);
 	imx25_add_mxc_nand(&mx25pdk_nand_board_info);
 	imx25_add_imxdi_rtc(NULL);
-	mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
+	imx25_add_imx_fb(&mx25pdk_fb_pdata);
 	mxc_register_device(&mxc_wdt, NULL);
 
 	mx25pdk_fec_reset();
arch/arm/plat-mxc/devices/platform-imx-fb.c +10 -4
index 42ed3be..f228ba6 100644
@@ -9,20 +9,26 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_imx_fb_data_entry_single(soc)				\
+#define imx_imx_fb_data_entry_single(soc, _size)			\
 	{								\
 		.iobase = soc ## _LCDC_BASE_ADDR,			\
+		.iosize = _size,					\
 		.irq = soc ## _INT_LCDC,				\
 	}
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
-	imx_imx_fb_data_entry_single(MX21);
+	imx_imx_fb_data_entry_single(MX21, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_imx_fb_data imx25_imx_fb_data __initconst =
+	imx_imx_fb_data_entry_single(MX25, SZ_16K);
+#endif
+
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
-	imx_imx_fb_data_entry_single(MX27);
+	imx_imx_fb_data_entry_single(MX27, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 struct platform_device *__init imx_add_imx_fb(
@@ -32,7 +38,7 @@ struct platform_device *__init imx_add_imx_fb(
 	struct resource res[] = {
 		{
 			.start = data->iobase,
-			.end = data->iobase + SZ_4K - 1,
+			.end = data->iobase + data->iosize - 1,
 			.flags = IORESOURCE_MEM,
 		}, {
 			.start = data->irq,
arch/arm/plat-mxc/include/mach/devices-common.h +1 -0
index 4d4b28b..e28453e 100644
@@ -82,6 +82,7 @@ struct platform_device *__init imx_add_imxdi_rtc(
 #include <mach/imxfb.h>
 struct imx_imx_fb_data {
 	resource_size_t iobase;
+	resource_size_t iosize;
 	resource_size_t irq;
 };
 struct platform_device *__init imx_add_imx_fb(
Signature · 1 line
1.7.2.3
#51 lore raw

PATCH 35/51 ARM: mx25: dynamically allocate imx2-wdt devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx25/Kconfig                      |    1 +
 arch/arm/mach-mx25/devices-imx25.h              |    4 ++++
 arch/arm/mach-mx25/devices.c                    |   15 ---------------
 arch/arm/mach-mx25/devices.h                    |    1 -
 arch/arm/mach-mx25/mach-mx25_3ds.c              |    2 +-
 arch/arm/plat-mxc/devices/platform-imx2-wdt.c   |   14 ++++++++++----
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 7 files changed, 17 insertions(+), 21 deletions(-)
arch/arm/mach-mx25/Kconfig +1 -0
index 10c0f60..d152af2 100644
@@ -6,6 +6,7 @@ config MACH_MX25_3DS
 	bool "Support MX25PDK (3DS) Platform"
 	select IMX_HAVE_PLATFORM_ESDHC
 	select IMX_HAVE_PLATFORM_IMXDI_RTC
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_UART
arch/arm/mach-mx25/devices-imx25.h +4 -0
index d80cce0..bf70548 100644
@@ -27,6 +27,10 @@ extern struct imx_imxdi_rtc_data imx25_imxdi_rtc_data __initconst;
 #define imx25_add_imxdi_rtc(pdata)	\
 	imx_add_imxdi_rtc(&imx25_imxdi_rtc_data)
 
+extern const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst;
+#define imx25_add_imx2_wdt(pdata)	\
+	imx_add_imx2_wdt(&imx25_imx2_wdt_data)
+
 extern const struct imx_imx_fb_data imx25_imx_fb_data __initconst;
 #define imx25_add_imx_fb(pdata)	\
 	imx_add_imx_fb(&imx25_imx_fb_data, pdata)
arch/arm/mach-mx25/devices.c +0 -15
index 09095e0..12f31ef 100644
@@ -22,21 +22,6 @@
 #include <mach/mx25.h>
 #include <mach/irqs.h>
 
-static struct resource mxc_wdt_resources[] = {
-	{
-		.start = MX25_WDOG_BASE_ADDR,
-		.end = MX25_WDOG_BASE_ADDR + SZ_16K - 1,
-		.flags = IORESOURCE_MEM,
-	},
-};
-
-struct platform_device mxc_wdt = {
-	.name = "imx2-wdt",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mxc_wdt_resources),
-	.resource = mxc_wdt_resources,
-};
-
 static struct resource mx25_csi_resources[] = {
 	{
 		.start	= MX25_CSI_BASE_ADDR,
arch/arm/mach-mx25/devices.h +0 -1
index 11997e2..fbb75ff 100644
@@ -1,2 +1 @@
-extern struct platform_device mxc_wdt;
 extern struct platform_device mx25_csi_device;
arch/arm/mach-mx25/mach-mx25_3ds.c +1 -1
index 34492aa..7e72df7 100644
@@ -195,7 +195,7 @@ static void __init mx25pdk_init(void)
 	imx25_add_mxc_nand(&mx25pdk_nand_board_info);
 	imx25_add_imxdi_rtc(NULL);
 	imx25_add_imx_fb(&mx25pdk_fb_pdata);
-	mxc_register_device(&mxc_wdt, NULL);
+	imx25_add_imx2_wdt(NULL);
 
 	mx25pdk_fec_reset();
 	imx25_add_fec(&mx25_fec_pdata);
arch/arm/plat-mxc/devices/platform-imx2-wdt.c +10 -4
index 86eb7f1..7508281 100644
@@ -10,19 +10,25 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_imx2_wdt_data_entry_single(soc)				\
+#define imx_imx2_wdt_data_entry_single(soc, _size)			\
 	{								\
 		.iobase = soc ## _WDOG_BASE_ADDR,			\
+		.iosize = _size,					\
 	}
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
-	imx_imx2_wdt_data_entry_single(MX21);
+	imx_imx2_wdt_data_entry_single(MX21, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
+#ifdef CONFIG_ARCH_MX25
+const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst =
+        imx_imx2_wdt_data_entry_single(MX25, SZ_16K);
+#endif /* ifdef CONFIG_ARCH_MX25 */
+
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
-	imx_imx2_wdt_data_entry_single(MX27);
+	imx_imx2_wdt_data_entry_single(MX27, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 struct platform_device *__init imx_add_imx2_wdt(
@@ -31,7 +37,7 @@ struct platform_device *__init imx_add_imx2_wdt(
 	struct resource res[] = {
 		{
 			.start = data->iobase,
-			.end = data->iobase + SZ_4K - 1,
+			.end = data->iobase + data->iosize - 1,
 			.flags = IORESOURCE_MEM,
 		},
 	};
arch/arm/plat-mxc/include/mach/devices-common.h +1 -0
index e28453e..95331ae 100644
@@ -68,6 +68,7 @@ struct platform_device *__init imx_add_imx21_hcd(
 
 struct imx_imx2_wdt_data {
 	resource_size_t iobase;
+	resource_size_t iosize;
 };
 struct platform_device *__init imx_add_imx2_wdt(
 		const struct imx_imx2_wdt_data *data);
Signature · 1 line
1.7.2.3
#52 lore raw

PATCH 35/51 ARM: mx25: dynamically allocate imx2-wdt devices

Hello,

just a minor nit I'm going to fix in my tree

Quoted 16 lines · Uwe Kleine-K?nig
---
 arch/arm/mach-mx25/Kconfig                      |    1 +
 arch/arm/mach-mx25/devices-imx25.h              |    4 ++++
 arch/arm/mach-mx25/devices.c                    |   15 ---------------
 arch/arm/mach-mx25/devices.h                    |    1 -
 arch/arm/mach-mx25/mach-mx25_3ds.c              |    2 +-
 arch/arm/plat-mxc/devices/platform-imx2-wdt.c   |   14 ++++++++++----
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 7 files changed, 17 insertions(+), 21 deletions(-)
arch/arm/mach-mx25/Kconfig +0 -0
index 10c0f60..d152af2 100644

arch/arm/mach-mx25/Kconfig config MACH_MX25_3DS · line 9

Quoted 4 lines
arch/arm/mach-mx25/Kconfig +1 -0
@@ -6,6 +6,7 @@ config MACH_MX25_3DS
 	bool "Support MX25PDK (3DS) Platform"
 	select IMX_HAVE_PLATFORM_ESDHC
 	select IMX_HAVE_PLATFORM_IMXDI_RTC
+	select IMX_HAVE_PLATFORM_IMX2_WDT

IMX_HAVE_PLATFORM_IMX2_WDT sorts before IMX_HAVE_PLATFORM_IMXDI_RTC.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#53 lore raw

PATCH 36/51 ARM: mx25: dynamically allocate mx2-camera devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx25/Makefile                     |    2 +-
 arch/arm/mach-mx25/devices-imx25.h              |    4 ++
 arch/arm/mach-mx25/devices.c                    |   45 -----------------------
 arch/arm/mach-mx25/devices.h                    |    1 -
 arch/arm/plat-mxc/devices/platform-mx2-camera.c |   23 +++++++++---
 5 files changed, 22 insertions(+), 53 deletions(-)
 delete mode 100644 arch/arm/mach-mx25/devices.c
arch/arm/mach-mx25/Makefile +1 -1
index d9e46ce..f7f7648 100644
@@ -1,4 +1,4 @@
-obj-y				:= mm.o devices.o
+obj-y				:= mm.o
 obj-$(CONFIG_ARCH_MX25)		+= clock.o
 obj-$(CONFIG_MACH_MX25_3DS)	+= mach-mx25_3ds.o
 obj-$(CONFIG_MACH_EUKREA_CPUIMX25)		+= mach-cpuimx25.o
arch/arm/mach-mx25/devices-imx25.h +4 -0
index bf70548..953e1ce 100644
@@ -59,6 +59,10 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
 #define imx25_add_imx_uart3(pdata)	imx25_add_imx_uart(3, pdata)
 #define imx25_add_imx_uart4(pdata)	imx25_add_imx_uart(4, pdata)
 
+extern const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst;
+#define imx25_add_mx2_camera(pdata)	\
+	imx_add_mx2_camera(&imx25_mx2_camera_data, pdata)
+
 extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst;
 #define imx25_add_mxc_ehci_otg(pdata)	\
 	imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata)
arch/arm/mach-mx25/devices.c deleted +0 -45

45 lines not on this page · raw message

arch/arm/mach-mx25/devices.h +0 -1
index fbb75ff..e69de29 100644
@@ -1 +0,0 @@
-extern struct platform_device mx25_csi_device;
arch/arm/plat-mxc/devices/platform-mx2-camera.c +17 -6
index a18c803..b3f4828 100644
@@ -12,6 +12,12 @@
 #define imx_mx2_camera_data_entry_single(soc)				\
 	{								\
 		.iobasecsi = soc ## _CSI_BASE_ADDR,			\
+		.iosizecsi = SZ_4K,					\
+		.irqcsi = soc ## _INT_CSI,				\
+	}
+#define imx_mx2_camera_data_entry_single_emma(soc)			\
+	{								\
+		.iobasecsi = soc ## _CSI_BASE_ADDR,			\
 		.iosizecsi = SZ_32,					\
 		.irqcsi = soc ## _INT_CSI,				\
 		.iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR,		\
@@ -19,9 +25,14 @@
 		.irqemmaprp = soc ## _INT_EMMAPRP,			\
 	}
 
+#ifdef CONFIG_SOC_IMX25
+const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst =
+	imx_mx2_camera_data_entry_single(MX25);
+#endif /* ifdef CONFIG_SOC_IMX25 */
+
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst =
-	imx_mx2_camera_data_entry_single(MX27);
+	imx_mx2_camera_data_entry_single_emma(MX27);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 struct platform_device *__init imx_add_mx2_camera(
@@ -34,20 +45,20 @@ struct platform_device *__init imx_add_mx2_camera(
 			.end = data->iobasecsi + data->iosizecsi - 1,
 			.flags = IORESOURCE_MEM,
 		}, {
-			.start = data->iobaseemmaprp,
-			.end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
-			.flags = IORESOURCE_MEM,
-		}, {
 			.start = data->irqcsi,
 			.end = data->irqcsi,
 			.flags = IORESOURCE_IRQ,
 		}, {
+			.start = data->iobaseemmaprp,
+			.end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
+			.flags = IORESOURCE_MEM,
+		}, {
 			.start = data->irqemmaprp,
 			.end = data->irqemmaprp,
 			.flags = IORESOURCE_IRQ,
 		},
 	};
 	return imx_add_platform_device_dmamask("mx2-camera", 0,
-			res, ARRAY_SIZE(res),
+			res, data->iobaseemmaprp ? 4 : 2,
 			pdata, sizeof(*pdata), DMA_BIT_MASK(32));
 }
Signature · 1 line
1.7.2.3
#54 lore raw

PATCH 37/51 ARM: mx25: remove now empty devices.h

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c |    1 -
 arch/arm/mach-mx25/mach-cpuimx25.c            |    1 -
 arch/arm/mach-mx25/mach-mx25_3ds.c            |    1 -
 3 files changed, 0 insertions(+), 3 deletions(-)
 delete mode 100644 arch/arm/mach-mx25/devices.h
arch/arm/mach-mx25/devices.h deleted +0 -0
deleted file mode 100644
index e69de29..0000000
arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c +0 -1
index d6058e0..75a5db5 100644
@@ -36,7 +36,6 @@
 #include <mach/audmux.h>
 
 #include "devices-imx25.h"
-#include "devices.h"
 
 static struct pad_desc eukrea_mbimxsd_pads[] = {
 	/* LCD */
arch/arm/mach-mx25/mach-cpuimx25.c +0 -1
index d1a04ba..67a7d55 100644
@@ -41,7 +41,6 @@
 #include <mach/iomux-mx25.h>
 
 #include "devices-imx25.h"
-#include "devices.h"
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
 	.flags = IMXUART_HAVE_RTSCTS,
arch/arm/mach-mx25/mach-mx25_3ds.c +0 -1
index 7e72df7..328e1af 100644
@@ -42,7 +42,6 @@
 #include <mach/iomux-mx25.h>
 
 #include "devices-imx25.h"
-#include "devices.h"
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
 	.flags = IMXUART_HAVE_RTSCTS,
Signature · 1 line
1.7.2.3
#55 lore raw

PATCH 38/51 ARM: imx: move mx25 support to mach-imx

In reply to Uwe Kleine-König
---
 arch/arm/Makefile                              |    2 +-
 arch/arm/mach-imx/Kconfig                      |   85 +++++--
 arch/arm/mach-imx/Makefile                     |    6 +
 arch/arm/mach-imx/Makefile.boot                |    4 +
 arch/arm/mach-imx/clock-imx25.c                |  332 ++++++++++++++++++++++++
 arch/arm/mach-imx/devices-imx25.h              |   86 ++++++
 arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c |  296 +++++++++++++++++++++
 arch/arm/mach-imx/mach-eukrea_cpuimx25.c       |  161 ++++++++++++
 arch/arm/mach-imx/mach-mx25_3ds.c              |  223 ++++++++++++++++
 arch/arm/mach-imx/mm-imx25.c                   |   62 +++++
 arch/arm/mach-mx25/Kconfig                     |   43 ---
 arch/arm/mach-mx25/Makefile                    |    5 -
 arch/arm/mach-mx25/Makefile.boot               |    3 -
 arch/arm/mach-mx25/clock.c                     |  332 ------------------------
 arch/arm/mach-mx25/devices-imx25.h             |   86 ------
 arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c  |  296 ---------------------
 arch/arm/mach-mx25/mach-cpuimx25.c             |  161 ------------
 arch/arm/mach-mx25/mach-mx25_3ds.c             |  223 ----------------
 arch/arm/mach-mx25/mm.c                        |   62 -----
 arch/arm/plat-mxc/Kconfig                      |    5 -
 20 files changed, 1240 insertions(+), 1233 deletions(-)
 create mode 100644 arch/arm/mach-imx/clock-imx25.c
 create mode 100644 arch/arm/mach-imx/devices-imx25.h
 create mode 100644 arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
 create mode 100644 arch/arm/mach-imx/mach-eukrea_cpuimx25.c
 create mode 100644 arch/arm/mach-imx/mach-mx25_3ds.c
 create mode 100644 arch/arm/mach-imx/mm-imx25.c
 delete mode 100644 arch/arm/mach-mx25/Kconfig
 delete mode 100644 arch/arm/mach-mx25/Makefile
 delete mode 100644 arch/arm/mach-mx25/Makefile.boot
 delete mode 100644 arch/arm/mach-mx25/clock.c
 delete mode 100644 arch/arm/mach-mx25/devices-imx25.h
 delete mode 100644 arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
 delete mode 100644 arch/arm/mach-mx25/mach-cpuimx25.c
 delete mode 100644 arch/arm/mach-mx25/mach-mx25_3ds.c
 delete mode 100644 arch/arm/mach-mx25/mm.c
arch/arm/Makefile +1 -1
index b87aed0..057beb8 100644
@@ -154,7 +154,7 @@ machine-$(CONFIG_ARCH_MSM)		:= msm
 machine-$(CONFIG_ARCH_MV78XX0)		:= mv78xx0
 machine-$(CONFIG_ARCH_MX1)		:= imx
 machine-$(CONFIG_ARCH_MX2)		:= imx
-machine-$(CONFIG_ARCH_MX25)		:= mx25
+machine-$(CONFIG_ARCH_MX25)		:= imx
 machine-$(CONFIG_ARCH_MX3)		:= mx3
 machine-$(CONFIG_ARCH_MX5)		:= mx5
 machine-$(CONFIG_ARCH_MXC91231)		:= mxc91231
arch/arm/mach-imx/Kconfig +69 -16

108 lines not on this page · raw message

arch/arm/mach-imx/Makefile +6 -0
index d099c4a..77100bf 100644
@@ -9,6 +9,8 @@ obj-$(CONFIG_IMX_HAVE_DMA_V1) += dma-v1.o
 obj-$(CONFIG_ARCH_MX1) += clock-imx1.o mm-imx1.o
 obj-$(CONFIG_MACH_MX21) += clock-imx21.o mm-imx21.o
 
+obj-$(CONFIG_ARCH_MX25) += clock-imx25.o mm-imx25.o
+
 obj-$(CONFIG_MACH_MX27) += cpu-imx27.o pm-imx27.o
 obj-$(CONFIG_MACH_MX27) += clock-imx27.o mm-imx27.o
 
@@ -20,6 +22,10 @@ obj-$(CONFIG_MACH_SCB9328) += mach-scb9328.o
 
 obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
 
+obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o
+obj-$(CONFIG_MACH_EUKREA_CPUIMX25) += mach-eukrea_cpuimx25.o
+obj-$(CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD) += eukrea_mbimxsd25-baseboard.o
+
 obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o
 obj-$(CONFIG_MACH_PCM038) += mach-pcm038.o
 obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o
arch/arm/mach-imx/Makefile.boot +4 -0
index 7988a85..3953d60 100644
@@ -6,6 +6,10 @@ zreladdr-$(CONFIG_MACH_MX21)	:= 0xC0008000
 params_phys-$(CONFIG_MACH_MX21)	:= 0xC0000100
 initrd_phys-$(CONFIG_MACH_MX21)	:= 0xC0800000
 
+zreladdr-$(CONFIG_ARCH_MX25)	:= 0x80008000
+params_phys-$(CONFIG_ARCH_MX25)	:= 0x80000100
+initrd_phys-$(CONFIG_ARCH_MX25)	:= 0x80800000
+
 zreladdr-$(CONFIG_MACH_MX27)	:= 0xA0008000
 params_phys-$(CONFIG_MACH_MX27)	:= 0xA0000100
 initrd_phys-$(CONFIG_MACH_MX27)	:= 0xA0800000
arch/arm/mach-imx/clock-imx25.c new file +332 -0

332 lines not on this page · raw message

arch/arm/mach-imx/devices-imx25.h new file +86 -0

86 lines not on this page · raw message

arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c new file +296 -0

296 lines not on this page · raw message

arch/arm/mach-imx/mach-eukrea_cpuimx25.c new file +161 -0

161 lines not on this page · raw message

arch/arm/mach-imx/mach-mx25_3ds.c new file +223 -0

223 lines not on this page · raw message

arch/arm/mach-imx/mm-imx25.c new file +62 -0

62 lines not on this page · raw message

arch/arm/mach-mx25/Kconfig deleted +0 -43

43 lines not on this page · raw message

arch/arm/mach-mx25/Makefile deleted +0 -5
deleted file mode 100644
index f7f7648..0000000
@@ -1,5 +0,0 @@
-obj-y				:= mm.o
-obj-$(CONFIG_ARCH_MX25)		+= clock.o
-obj-$(CONFIG_MACH_MX25_3DS)	+= mach-mx25_3ds.o
-obj-$(CONFIG_MACH_EUKREA_CPUIMX25)		+= mach-cpuimx25.o
-obj-$(CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD)	+= eukrea_mbimxsd-baseboard.o
arch/arm/mach-mx25/Makefile.boot deleted +0 -3
deleted file mode 100644
index e1dd366..0000000
@@ -1,3 +0,0 @@
-   zreladdr-y	:= 0x80008000
-params_phys-y	:= 0x80000100
-initrd_phys-y	:= 0x80800000
arch/arm/mach-mx25/clock.c deleted +0 -332

332 lines not on this page · raw message

arch/arm/mach-mx25/devices-imx25.h deleted +0 -86

86 lines not on this page · raw message

arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c deleted +0 -296

296 lines not on this page · raw message

arch/arm/mach-mx25/mach-cpuimx25.c deleted +0 -161

161 lines not on this page · raw message

arch/arm/mach-mx25/mach-mx25_3ds.c deleted +0 -223

223 lines not on this page · raw message

arch/arm/mach-mx25/mm.c deleted +0 -62

62 lines not on this page · raw message

arch/arm/plat-mxc/Kconfig +0 -5
index 64e3a64..a31fa16 100644
@@ -21,10 +21,6 @@ config ARCH_MX2
 
 config ARCH_MX25
 	bool "MX25-based"
-	select CPU_ARM926T
-	select ARCH_MXC_IOMUX_V3
-	select HAVE_FB_IMX
-	select ARCH_MXC_AUDMUX_V2
 	help
 	  This enables support for systems based on the Freescale i.MX25 family
 
@@ -51,7 +47,6 @@ endchoice
 
 source "arch/arm/mach-imx/Kconfig"
 source "arch/arm/mach-mx3/Kconfig"
-source "arch/arm/mach-mx25/Kconfig"
 source "arch/arm/mach-mxc91231/Kconfig"
 source "arch/arm/mach-mx5/Kconfig"
 
Signature · 1 line
1.7.2.3
#56 lore raw

PATCH 38/51 ARM: imx: move mx25 support to mach-imx

Hi Uwe,

Tanks for all this work.

Once this get merged we can get rid of the ugly '#ifdef CONFIG_MACH_MX27' in drivers/media/video/mx2_camera.c. Should such a patch go via Sascha's tree or the V4L tree?

baruch

Quoted 38 lines · Uwe Kleine-K?nig
---
 arch/arm/Makefile                              |    2 +-
 arch/arm/mach-imx/Kconfig                      |   85 +++++--
 arch/arm/mach-imx/Makefile                     |    6 +
 arch/arm/mach-imx/Makefile.boot                |    4 +
 arch/arm/mach-imx/clock-imx25.c                |  332 ++++++++++++++++++++++++
 arch/arm/mach-imx/devices-imx25.h              |   86 ++++++
 arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c |  296 +++++++++++++++++++++
 arch/arm/mach-imx/mach-eukrea_cpuimx25.c       |  161 ++++++++++++
 arch/arm/mach-imx/mach-mx25_3ds.c              |  223 ++++++++++++++++
 arch/arm/mach-imx/mm-imx25.c                   |   62 +++++
 arch/arm/mach-mx25/Kconfig                     |   43 ---
 arch/arm/mach-mx25/Makefile                    |    5 -
 arch/arm/mach-mx25/Makefile.boot               |    3 -
 arch/arm/mach-mx25/clock.c                     |  332 ------------------------
 arch/arm/mach-mx25/devices-imx25.h             |   86 ------
 arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c  |  296 ---------------------
 arch/arm/mach-mx25/mach-cpuimx25.c             |  161 ------------
 arch/arm/mach-mx25/mach-mx25_3ds.c             |  223 ----------------
 arch/arm/mach-mx25/mm.c                        |   62 -----
 arch/arm/plat-mxc/Kconfig                      |    5 -
 20 files changed, 1240 insertions(+), 1233 deletions(-)
 create mode 100644 arch/arm/mach-imx/clock-imx25.c
 create mode 100644 arch/arm/mach-imx/devices-imx25.h
 create mode 100644 arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
 create mode 100644 arch/arm/mach-imx/mach-eukrea_cpuimx25.c
 create mode 100644 arch/arm/mach-imx/mach-mx25_3ds.c
 create mode 100644 arch/arm/mach-imx/mm-imx25.c
 delete mode 100644 arch/arm/mach-mx25/Kconfig
 delete mode 100644 arch/arm/mach-mx25/Makefile
 delete mode 100644 arch/arm/mach-mx25/Makefile.boot
 delete mode 100644 arch/arm/mach-mx25/clock.c
 delete mode 100644 arch/arm/mach-mx25/devices-imx25.h
 delete mode 100644 arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
 delete mode 100644 arch/arm/mach-mx25/mach-cpuimx25.c
 delete mode 100644 arch/arm/mach-mx25/mach-mx25_3ds.c
 delete mode 100644 arch/arm/mach-mx25/mm.c

[snip]

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#57 lore raw

PATCH 39/51 ARM: imx: let IMX_HAVE_PLATFORM_IMX_FB select HAVE_FB_IMX

In reply to Uwe Kleine-König

This way FB_IMX can just depend on HAVE_FB_IMX and machines just need to select IMX_HAVE_PLATFORM_IMX_FB without bothering about HAVE_FB_IMX.

---
 arch/arm/mach-imx/Kconfig         |    3 +--
 arch/arm/plat-mxc/devices/Kconfig |    1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/Kconfig +1 -2
index 4423df6..9e6093d 100644
@@ -17,9 +17,8 @@ config SOC_IMX21
 config SOC_IMX25
 	bool
 	select CPU_ARM926T
-	select ARCH_MXC_IOMUX_V3
-	select HAVE_FB_IMX
 	select ARCH_MXC_AUDMUX_V2
+	select ARCH_MXC_IOMUX_V3
 
 config SOC_IMX27
 	bool
arch/arm/plat-mxc/devices/Kconfig +1 -0
index 81d7a54..dbb2078 100644
@@ -27,6 +27,7 @@ config IMX_HAVE_PLATFORM_IMXDI_RTC
 
 config IMX_HAVE_PLATFORM_IMX_FB
 	bool
+	select HAVE_FB_IMX
 
 config IMX_HAVE_PLATFORM_IMX_I2C
 	bool
Signature · 1 line
1.7.2.3
#58 lore raw

PATCH 40/51 ARM: imx: let the machines select SOC_IMX{21,27}

In reply to Uwe Kleine-König

This prepares multi-SoC kernel support.

---
 arch/arm/mach-imx/Kconfig |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
arch/arm/mach-imx/Kconfig +9 -2
index 9e6093d..ecb65ba0 100644
@@ -57,13 +57,11 @@ choice
 
 config MACH_MX21
 	bool "i.MX21 support"
-	select SOC_IMX21
 	help
 	  This enables support for Freescale's MX2 based i.MX21 processor.
 
 config MACH_MX27
 	bool "i.MX27 support"
-	select SOC_IMX27
 	help
 	  This enables support for Freescale's MX2 based i.MX27 processor.
 
@@ -77,6 +75,7 @@ comment "MX21 platforms:"
 
 config MACH_MX21ADS
 	bool "MX21ADS platform"
+	select SOC_IMX21
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -139,6 +138,7 @@ comment "MX27 platforms:"
 
 config MACH_MX27ADS
 	bool "MX27ADS platform"
+	select SOC_IMX27
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -151,6 +151,7 @@ config MACH_MX27ADS
 
 config MACH_PCM038
 	bool "Phytec phyCORE-i.MX27 CPU module (pcm038)"
+	select SOC_IMX27
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -180,6 +181,7 @@ endchoice
 
 config MACH_CPUIMX27
 	bool "Eukrea CPUIMX27 module"
+	select SOC_IMX27
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
@@ -228,6 +230,7 @@ endchoice
 
 config MACH_MX27_3DS
 	bool "MX27PDK platform"
+	select SOC_IMX27
 	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -237,6 +240,7 @@ config MACH_MX27_3DS
 
 config MACH_IMX27_VISSTRIM_M10
 	bool "Vista Silicon i.MX27 Visstrim_m10"
+	select SOC_IMX27
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -248,6 +252,7 @@ config MACH_IMX27_VISSTRIM_M10
 
 config MACH_IMX27LITE
 	bool "LogicPD MX27 LITEKIT platform"
+	select SOC_IMX27
 	select IMX_HAVE_PLATFORM_IMX_UART
 	help
 	  Include support for MX27 LITEKIT platform. This includes specific
@@ -255,6 +260,7 @@ config MACH_IMX27LITE
 
 config MACH_PCA100
 	bool "Phytec phyCARD-s (pca100)"
+	select SOC_IMX27
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_FB
@@ -273,6 +279,7 @@ config MACH_PCA100
 
 config MACH_MXT_TD60
 	bool "Maxtrack i-MXT TD60"
+	select SOC_IMX27
 	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
Signature · 1 line
1.7.2.3
#59 lore raw

PATCH 41/51 ARM: imx: use SOC_IMX25 instead of ARCH_MX25 for multi-SoC

In reply to Uwe Kleine-König

Some usages of ARCH_MX25 are assuming that if it is defined the other SoCs are undefined. Use SOC_IMX25 for the save places.

---
 arch/arm/plat-mxc/audmux-v2.c                     |    4 ++--
 arch/arm/plat-mxc/devices/platform-esdhc.c        |    4 ++--
 arch/arm/plat-mxc/devices/platform-fec.c          |    4 ++--
 arch/arm/plat-mxc/devices/platform-flexcan.c      |    4 ++--
 arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c |    4 ++--
 arch/arm/plat-mxc/devices/platform-imx-dma.c      |    6 +++---
 arch/arm/plat-mxc/devices/platform-imx-fb.c       |    4 ++--
 arch/arm/plat-mxc/devices/platform-imx-i2c.c      |    4 ++--
 arch/arm/plat-mxc/devices/platform-imx-keypad.c   |    4 ++--
 arch/arm/plat-mxc/devices/platform-imx-ssi.c      |    4 ++--
 arch/arm/plat-mxc/devices/platform-imx-uart.c     |    4 ++--
 arch/arm/plat-mxc/devices/platform-imx2-wdt.c     |    4 ++--
 arch/arm/plat-mxc/devices/platform-imxdi_rtc.c    |    4 ++--
 arch/arm/plat-mxc/devices/platform-mxc-ehci.c     |    4 ++--
 arch/arm/plat-mxc/devices/platform-mxc_nand.c     |    4 ++--
 arch/arm/plat-mxc/devices/platform-mxc_pwm.c      |    4 ++--
 arch/arm/plat-mxc/devices/platform-spi_imx.c      |    4 ++--
 arch/arm/plat-mxc/ehci.c                          |    4 ++--
 arch/arm/plat-mxc/gpio.c                          |    4 ++--
 19 files changed, 39 insertions(+), 39 deletions(-)
arch/arm/plat-mxc/audmux-v2.c +2 -2
index 0be1ac7..175e364 100644
@@ -209,7 +209,7 @@ static int mxc_audmux_v2_init(void)
 		audmux_base = MX35_IO_ADDRESS(MX35_AUDMUX_BASE_ADDR);
 	}
 #endif
-#if defined(CONFIG_ARCH_MX25)
+#if defined(CONFIG_SOC_IMX25)
 	if (cpu_is_mx25()) {
 		audmux_clk = clk_get(NULL, "audmux");
 		if (IS_ERR(audmux_clk)) {
@@ -220,7 +220,7 @@ static int mxc_audmux_v2_init(void)
 		}
 		audmux_base = MX25_IO_ADDRESS(MX25_AUDMUX_BASE_ADDR);
 	}
-#endif
+#endif /* if defined(CONFIG_SOC_IMX25) */
 	audmux_debugfs_init();
 
 	return 0;
arch/arm/plat-mxc/devices/platform-esdhc.c +2 -2
index 2605bfa..87df70b 100644
@@ -20,14 +20,14 @@
 #define imx_esdhc_imx_data_entry(soc, id, hwid)	\
 	[id] = imx_esdhc_imx_data_entry_single(soc, id, hwid)
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_esdhc_imx_data imx25_esdhc_data[] __initconst = {
 #define imx25_esdhc_data_entry(_id, _hwid)				\
 	imx_esdhc_imx_data_entry(MX25, _id, _hwid)
 	imx25_esdhc_data_entry(0, 1),
 	imx25_esdhc_data_entry(1, 2),
 };
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_ARCH_MX35
 const struct imx_esdhc_imx_data imx35_esdhc_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-fec.c +2 -2
index 11d087f..e6a365e 100644
@@ -16,10 +16,10 @@
 		.irq = soc ## _INT_FEC,					\
 	}
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_fec_data imx25_fec_data __initconst =
 	imx_fec_data_entry_single(MX25);
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_fec_data imx27_fec_data __initconst =
arch/arm/plat-mxc/devices/platform-flexcan.c +2 -2
index 5189017..f10db6f 100644
@@ -19,14 +19,14 @@
 #define imx_flexcan_data_entry(soc, _id, _hwid, _size)			\
 	[_id] = imx_flexcan_data_entry_single(soc, _id, _hwid, _size)
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_flexcan_data imx25_flexcan_data[] __initconst = {
 #define imx25_flexcan_data_entry(_id, _hwid)				\
 	imx_flexcan_data_entry(MX25, _id, _hwid, SZ_16K)
 	imx25_flexcan_data_entry(0, 1),
 	imx25_flexcan_data_entry(1, 2),
 };
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_ARCH_MX35
 const struct imx_flexcan_data imx35_flexcan_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c +2 -2
index cb5fb71..42c3923 100644
@@ -15,10 +15,10 @@
 		.irq = soc ## _INT_USB_OTG,				\
 	}
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst =
 	imx_fsl_usb2_udc_data_entry_single(MX25);
-#endif
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
arch/arm/plat-mxc/devices/platform-imx-dma.c +3 -3
index 02d9890..cbafd93 100644
@@ -39,10 +39,10 @@ struct imx_imx_sdma_data {
 		},							\
 	}
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_imx_sdma_data imx25_imx_sdma_data __initconst =
 	imx_imx_sdma_data_entry_single(MX25, 1, "imx25", 0);
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_ARCH_MX31
 struct imx_imx_sdma_data imx31_imx_sdma_data __initdata =
@@ -94,7 +94,7 @@ static int __init imxXX_add_imx_dma(void)
 	else
 #endif
 
-#if defined(CONFIG_ARCH_MX25)
+#if defined(CONFIG_SOC_IMX25)
 	if (cpu_is_mx25())
 		ret = imx_add_imx_sdma(&imx25_imx_sdma_data);
 	else
arch/arm/plat-mxc/devices/platform-imx-fb.c +2 -2
index f228ba6..6100a7d 100644
@@ -21,10 +21,10 @@ const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
 	imx_imx_fb_data_entry_single(MX21, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_imx_fb_data imx25_imx_fb_data __initconst =
 	imx_imx_fb_data_entry_single(MX25, SZ_16K);
-#endif
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
arch/arm/plat-mxc/devices/platform-imx-i2c.c +2 -2
index 6795884..2cb0232 100644
@@ -30,7 +30,7 @@ const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
 	imx_imx_i2c_data_entry_single(MX21, 0, , SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
 #define imx25_imx_i2c_data_entry(_id, _hwid)				\
 	imx_imx_i2c_data_entry(MX25, _id, _hwid, SZ_16K)
@@ -38,7 +38,7 @@ const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
 	imx25_imx_i2c_data_entry(1, 2),
 	imx25_imx_i2c_data_entry(2, 3),
 };
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-imx-keypad.c +2 -2
index 5995e81..5f3b367 100644
@@ -21,10 +21,10 @@ const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst =
 	imx_imx_keypad_data_entry_single(MX21, SZ_16);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_imx_keypad_data imx25_imx_keypad_data __initconst =
 	imx_imx_keypad_data_entry_single(MX25, SZ_16K);
-#endif
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
arch/arm/plat-mxc/devices/platform-imx-ssi.c +2 -2
index 38a7a0b..d6410e1 100644
@@ -30,14 +30,14 @@ const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst = {
 #define imx25_imx_ssi_data_entry(_id, _hwid)				\
 	imx_imx_ssi_data_entry(MX25, _id, _hwid, SZ_4K)
 	imx25_imx_ssi_data_entry(0, 1),
 	imx25_imx_ssi_data_entry(1, 2),
 };
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-imx-uart.c +2 -2
index 2039640..b10c736 100644
@@ -47,7 +47,7 @@ const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst = {
 };
 #endif
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst = {
 #define imx25_imx_uart_data_entry(_id, _hwid)				\
 	imx_imx_uart_1irq_data_entry(MX25, _id, _hwid, SZ_16K)
@@ -57,7 +57,7 @@ const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst = {
 	imx25_imx_uart_data_entry(3, 4),
 	imx25_imx_uart_data_entry(4, 5),
 };
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-imx2-wdt.c +2 -2
index 7508281..bd9c546 100644
@@ -21,10 +21,10 @@ const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
 	imx_imx2_wdt_data_entry_single(MX21, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst =
         imx_imx2_wdt_data_entry_single(MX25, SZ_16K);
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
arch/arm/plat-mxc/devices/platform-imxdi_rtc.c +2 -2
index 387f650..10653cc 100644
@@ -16,10 +16,10 @@
 		.irq = soc ## _INT_DRYICE,				\
 	}
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_imxdi_rtc_data imx25_imxdi_rtc_data __initconst =
 	imx_imxdi_rtc_data_entry_single(MX25);
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 struct platform_device *__init imx_add_imxdi_rtc(
 		const struct imx_imxdi_rtc_data *data)
arch/arm/plat-mxc/devices/platform-mxc-ehci.c +2 -2
index 825a048ca..9bec63f 100644
@@ -16,12 +16,12 @@
 		.irq = soc ## _INT_USB_ ## hs,				\
 	}
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
 	imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
 const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
 	imx_mxc_ehci_data_entry_single(MX25, 1, HS);
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
arch/arm/plat-mxc/devices/platform-mxc_nand.c +2 -2
index 3fdcc32e..967d847 100644
@@ -31,10 +31,10 @@ const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
 	imx_mxc_nand_data_entry_single(MX21, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
 	imx_mxc_nand_data_entry_single(MX25, SZ_8K);
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
arch/arm/plat-mxc/devices/platform-mxc_pwm.c +2 -2
index 5a47d1e..3d8ebdb 100644
@@ -24,7 +24,7 @@ const struct imx_mxc_pwm_data imx21_mxc_pwm_data __initconst =
 	imx_mxc_pwm_data_entry_single(MX21, 0, , SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX21 */
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_mxc_pwm_data imx25_mxc_pwm_data[] __initconst = {
 #define imx25_mxc_pwm_data_entry(_id, _hwid)				\
 	imx_mxc_pwm_data_entry(MX25, _id, _hwid, SZ_16K)
@@ -33,7 +33,7 @@ const struct imx_mxc_pwm_data imx25_mxc_pwm_data[] __initconst = {
 	imx25_mxc_pwm_data_entry(2, 3),
 	imx25_mxc_pwm_data_entry(3, 4),
 };
-#endif
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst =
arch/arm/plat-mxc/devices/platform-spi_imx.c +2 -2
index e48340e..bf2cb47 100644
@@ -29,7 +29,7 @@ const struct imx_spi_imx_data imx21_cspi_data[] __initconst = {
 	imx21_cspi_data_entry(1, 2),
 #endif
 
-#ifdef CONFIG_ARCH_MX25
+#ifdef CONFIG_SOC_IMX25
 const struct imx_spi_imx_data imx25_cspi_data[] __initconst = {
 #define imx25_cspi_data_entry(_id, _hwid)				\
 	imx_spi_imx_data_entry(MX25, CSPI, "imx25-cspi", _id, _hwid, SZ_16K)
@@ -37,7 +37,7 @@ const struct imx_spi_imx_data imx25_cspi_data[] __initconst = {
 	imx25_cspi_data_entry(1, 2),
 	imx25_cspi_data_entry(2, 3),
 };
-#endif /* ifdef CONFIG_ARCH_MX25 */
+#endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_spi_imx_data imx27_cspi_data[] __initconst = {
arch/arm/plat-mxc/ehci.c +2 -2
index f699235..4bac3d5 100644
@@ -69,7 +69,7 @@
 int mxc_initialize_usb_hw(int port, unsigned int flags)
 {
 	unsigned int v;
-#if defined(CONFIG_ARCH_MX25)
+#if defined(CONFIG_SOC_IMX25)
 	if (cpu_is_mx25()) {
 		v = readl(MX25_IO_ADDRESS(MX25_USB_BASE_ADDR +
 				     USBCTRL_OTGBASE_OFFSET));
@@ -112,7 +112,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
 				     USBCTRL_OTGBASE_OFFSET));
 		return 0;
 	}
-#endif /* CONFIG_ARCH_MX25 */
+#endif /* if defined(CONFIG_SOC_IMX25) */
 #if defined(CONFIG_ARCH_MX3)
 	if (cpu_is_mx31()) {
 		v = readl(MX31_IO_ADDRESS(MX31_OTG_BASE_ADDR +
arch/arm/plat-mxc/gpio.c +2 -2
index e59fb97..c853bfa 100644
@@ -395,7 +395,7 @@ DEFINE_REGISTER_FUNCTION(imx21)
 
 #endif /* if defined(CONFIG_SOC_IMX21) */
 
-#if defined(CONFIG_ARCH_MX25)
+#if defined(CONFIG_SOC_IMX25)
 static struct mxc_gpio_port imx25_gpio_ports[] = {
 	DEFINE_IMX_GPIO_PORT_IRQ(MX25, 0, 1, MX25_INT_GPIO1),
 	DEFINE_IMX_GPIO_PORT_IRQ(MX25, 1, 2, MX25_INT_GPIO2),
@@ -405,7 +405,7 @@ static struct mxc_gpio_port imx25_gpio_ports[] = {
 
 DEFINE_REGISTER_FUNCTION(imx25)
 
-#endif /* if defined(CONFIG_ARCH_MX25) */
+#endif /* if defined(CONFIG_SOC_IMX25) */
 
 #if defined(CONFIG_SOC_IMX27)
 static struct mxc_gpio_port imx27_gpio_ports[] = {
Signature · 1 line
1.7.2.3
#60 lore raw

PATCH 42/51 ARM: mx3: move registration of gpios to plat-mxc/gpio.c

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx3/devices.c |   28 ----------------------------
 arch/arm/mach-mx3/mm.c      |   23 ++++++++++++-----------
 arch/arm/plat-mxc/gpio.c    |   22 ++++++++++++++++++++++
 3 files changed, 34 insertions(+), 39 deletions(-)
arch/arm/mach-mx3/devices.c +0 -28
index 5808ce1..b179f70 100644
@@ -29,31 +29,6 @@
 
 #include "devices.h"
 
-/* GPIO port description */
-static struct mxc_gpio_port imx_gpio_ports[] = {
-	{
-		.chip.label = "gpio-0",
-		.base = MX31_IO_ADDRESS(MX31_GPIO1_BASE_ADDR),
-		.irq = MX3x_INT_GPIO1,
-		.virtual_irq_start = MXC_GPIO_IRQ_START,
-	}, {
-		.chip.label = "gpio-1",
-		.base = MX31_IO_ADDRESS(MX31_GPIO2_BASE_ADDR),
-		.irq = MX3x_INT_GPIO2,
-		.virtual_irq_start = MXC_GPIO_IRQ_START + 32,
-	}, {
-		.chip.label = "gpio-2",
-		.base = MX31_IO_ADDRESS(MX31_GPIO3_BASE_ADDR),
-		.irq = MX3x_INT_GPIO3,
-		.virtual_irq_start = MXC_GPIO_IRQ_START + 64,
-	}
-};
-
-int __init imx3x_register_gpios(void)
-{
-	return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
-}
-
 #ifdef CONFIG_ARCH_MX31
 static struct resource mxcsdhc0_resources[] = {
 	{
@@ -330,9 +305,6 @@ static int __init mx3_devices_init(void)
 #endif
 #if defined(CONFIG_ARCH_MX35)
 	if (cpu_is_mx35()) {
-		imx_gpio_ports[0].base = MX35_IO_ADDRESS(MX35_GPIO1_BASE_ADDR),
-		imx_gpio_ports[1].base = MX35_IO_ADDRESS(MX35_GPIO2_BASE_ADDR),
-		imx_gpio_ports[2].base = MX35_IO_ADDRESS(MX35_GPIO3_BASE_ADDR),
 		otg_resources[0].start = MX35_OTG_BASE_ADDR;
 		otg_resources[0].end = MX35_OTG_BASE_ADDR + 0x1ff;
 		otg_resources[1].start = MX35_INT_USBOTG;
arch/arm/mach-mx3/mm.c +12 -11
index 193c18c..998c3d7 100644
@@ -57,7 +57,14 @@ void __init mx31_map_io(void)
 
 	iotable_init(mx31_io_desc, ARRAY_SIZE(mx31_io_desc));
 }
-#endif
+
+int imx31_register_gpios(void);
+void __init mx31_init_irq(void)
+{
+	mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR));
+	imx31_register_gpios();
+}
+#endif /* ifdef CONFIG_ARCH_MX31 */
 
 #ifdef CONFIG_ARCH_MX35
 static struct map_desc mx35_io_desc[] __initdata = {
@@ -76,20 +83,14 @@ void __init mx35_map_io(void)
 
 	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
 }
-#endif
-
-int imx3x_register_gpios(void);
-
-void __init mx31_init_irq(void)
-{
-	mxc_init_irq(MX31_IO_ADDRESS(MX3x_AVIC_BASE_ADDR));
-	imx3x_register_gpios();
-}
 
+int imx35_register_gpios(void);
 void __init mx35_init_irq(void)
 {
-	mx31_init_irq();
+	mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR));
+	imx35_register_gpios();
 }
+#endif /* ifdef CONFIG_ARCH_MX35 */
 
 #ifdef CONFIG_CACHE_L2X0
 static int mxc_init_l2x0(void)
arch/arm/plat-mxc/gpio.c +22 -0
index c853bfa..2fb1efa 100644
@@ -420,3 +420,25 @@ static struct mxc_gpio_port imx27_gpio_ports[] = {
 DEFINE_REGISTER_FUNCTION(imx27)
 
 #endif /* if defined(CONFIG_SOC_IMX27) */
+
+#if defined(CONFIG_ARCH_MX31)
+static struct mxc_gpio_port imx31_gpio_ports[] = {
+	DEFINE_IMX_GPIO_PORT_IRQ(MX31, 0, 1, MX31_INT_GPIO1),
+	DEFINE_IMX_GPIO_PORT_IRQ(MX31, 1, 2, MX31_INT_GPIO2),
+	DEFINE_IMX_GPIO_PORT_IRQ(MX31, 2, 3, MX31_INT_GPIO3),
+};
+
+DEFINE_REGISTER_FUNCTION(imx31)
+
+#endif /* if defined(CONFIG_ARCH_MX31) */
+
+#if defined(CONFIG_ARCH_MX35)
+static struct mxc_gpio_port imx35_gpio_ports[] = {
+	DEFINE_IMX_GPIO_PORT_IRQ(MX35, 0, 1, MX35_INT_GPIO1),
+	DEFINE_IMX_GPIO_PORT_IRQ(MX35, 1, 2, MX35_INT_GPIO2),
+	DEFINE_IMX_GPIO_PORT_IRQ(MX35, 2, 3, MX35_INT_GPIO3),
+};
+
+DEFINE_REGISTER_FUNCTION(imx35)
+
+#endif /* if defined(CONFIG_ARCH_MX35) */
Signature · 1 line
1.7.2.3
#61 lore raw

PATCH 43/51 ARM: mx3: use an MX35 constant in imx35 only code

In reply to Uwe Kleine-König

... instead of MX3x

---
 arch/arm/mach-mx3/mm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-mx3/mm.c +1 -1
index 998c3d7..2e81271 100644
@@ -79,7 +79,7 @@ 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));
+	mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
 
 	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
 }
Signature · 1 line
1.7.2.3
#62 lore raw

PATCH 44/51 ARM: mx3: introduce SOC_IMX31 and SOC_IMX35

In reply to Uwe Kleine-König

Additionally convert some known to be good usages to the new names.

---
 arch/arm/mach-mx3/Kconfig                     |   40 ++++++++++++++++---------
 arch/arm/mach-mx3/Makefile                    |    4 +-
 arch/arm/mach-mx3/mm.c                        |    8 ++--
 arch/arm/plat-mxc/devices/Kconfig             |    2 +-
 arch/arm/plat-mxc/devices/platform-esdhc.c    |    4 +-
 arch/arm/plat-mxc/devices/platform-fec.c      |    2 +-
 arch/arm/plat-mxc/devices/platform-flexcan.c  |    4 +-
 arch/arm/plat-mxc/devices/platform-imx-dma.c  |   12 ++++----
 arch/arm/plat-mxc/devices/platform-imx-i2c.c  |    8 ++--
 arch/arm/plat-mxc/devices/platform-imx-ssi.c  |    8 ++--
 arch/arm/plat-mxc/devices/platform-imx-uart.c |    8 ++--
 arch/arm/plat-mxc/devices/platform-mxc_nand.c |    4 +-
 arch/arm/plat-mxc/devices/platform-mxc_w1.c   |    8 ++--
 arch/arm/plat-mxc/devices/platform-spi_imx.c  |    8 ++--
 arch/arm/plat-mxc/gpio.c                      |    8 ++--
 15 files changed, 70 insertions(+), 58 deletions(-)
arch/arm/mach-mx3/Kconfig +26 -14
index 3f83fd5..29ec5ad 100644
@@ -1,21 +1,33 @@
 if ARCH_MX3
 
+# ARCH_MX31 and ARCH_MX35 are left for compatibility
+# Some usages assume that having one of them implies not having (e.g.) ARCH_MX2.
+# To easily distinguish good and reviewed from unreviewed usages new (and IMHO
+# more sensible) names are used: SOC_IMX31 and SOC_IMX35
 config ARCH_MX31
-	select ARCH_HAS_RNGA
-	select ARCH_MXC_AUDMUX_V2
 	bool
 
 config ARCH_MX35
 	bool
+
+config SOC_IMX31
+	bool
+	select ARCH_HAS_RNGA
+	select ARCH_MXC_AUDMUX_V2
+	select ARCH_MX31
+
+config SOC_IMX35
+	bool
 	select ARCH_MXC_IOMUX_V3
 	select ARCH_MXC_AUDMUX_V2
 	select HAVE_EPIT
+	select ARCH_MX35
 
 comment "MX3 platforms:"
 
 config MACH_MX31ADS
 	bool "Support MX31ADS platforms"
-	select ARCH_MX31
+	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -37,7 +49,7 @@ config MACH_MX31ADS_WM1133_EV1
 
 config MACH_PCM037
 	bool "Support Phytec pcm037 (i.MX31) platforms"
-	select ARCH_MX31
+	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -58,7 +70,7 @@ config MACH_PCM037_EET
 
 config MACH_MX31LITE
 	bool "Support MX31 LITEKIT (LogicPD)"
-	select ARCH_MX31
+	select SOC_IMX31
 	select MXC_ULPI if USB_ULPI
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -69,7 +81,7 @@ config MACH_MX31LITE
 
 config MACH_MX31_3DS
 	bool "Support MX31PDK (3DS)"
-	select ARCH_MX31
+	select SOC_IMX31
 	select MXC_DEBUG_BOARD
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -89,7 +101,7 @@ config MACH_MX31_3DS_MXC_NAND_USE_BBT
 
 config MACH_MX31MOBOARD
 	bool "Support mx31moboard platforms (EPFL Mobots group)"
-	select ARCH_MX31
+	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_SPI_IMX
@@ -100,7 +112,7 @@ config MACH_MX31MOBOARD
 
 config MACH_MX31LILLY
 	bool "Support MX31 LILLY-1131 platforms (INCO startec)"
-	select ARCH_MX31
+	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	select MXC_ULPI if USB_ULPI
@@ -110,7 +122,7 @@ config MACH_MX31LILLY
 
 config MACH_QONG
 	bool "Support Dave/DENX QongEVB-LITE platform"
-	select ARCH_MX31
+	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_UART
 	help
 	  Include support for Dave/DENX QongEVB-LITE platform. This includes
@@ -118,7 +130,7 @@ config MACH_QONG
 
 config MACH_PCM043
 	bool "Support Phytec pcm043 (i.MX35) platforms"
-	select ARCH_MX35
+	select SOC_IMX35
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -132,7 +144,7 @@ config MACH_PCM043
 
 config MACH_ARMADILLO5X0
 	bool "Support Atmark Armadillo-500 Development Base Board"
-	select ARCH_MX31
+	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -143,7 +155,7 @@ config MACH_ARMADILLO5X0
 
 config MACH_MX35_3DS
 	bool "Support MX35PDK platform"
-	select ARCH_MX35
+	select SOC_IMX35
 	select MXC_DEBUG_BOARD
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -155,7 +167,7 @@ config MACH_MX35_3DS
 
 config MACH_KZM_ARM11_01
 	bool "Support KZM-ARM11-01(Kyoto Microcomputer)"
-	select ARCH_MX31
+	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_UART
 	help
 	  Include support for KZM-ARM11-01. This includes specific
@@ -163,7 +175,7 @@ config MACH_KZM_ARM11_01
 
 config MACH_EUKREA_CPUIMX35
 	bool "Support Eukrea CPUIMX35 Platform"
-	select ARCH_MX35
+	select SOC_IMX35
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_MXC_NAND
arch/arm/mach-mx3/Makefile +2 -2
index 7feb6c4..8db1329 100644
@@ -5,8 +5,8 @@
 # Object file lists.
 
 obj-y				:= mm.o devices.o cpu.o
-obj-$(CONFIG_ARCH_MX31)		+= clock-imx31.o iomux-imx31.o
-obj-$(CONFIG_ARCH_MX35)		+= clock-imx35.o
+obj-$(CONFIG_SOC_IMX31)		+= clock-imx31.o iomux-imx31.o
+obj-$(CONFIG_SOC_IMX35)		+= clock-imx35.o
 obj-$(CONFIG_MACH_MX31ADS)	+= mach-mx31ads.o
 obj-$(CONFIG_MACH_MX31LILLY)	+= mach-mx31lilly.o mx31lilly-db.o
 obj-$(CONFIG_MACH_MX31LITE)	+= mach-mx31lite.o mx31lite-db.o
arch/arm/mach-mx3/mm.c +4 -4
index 2e81271..47118f7 100644
@@ -36,7 +36,7 @@
  * @ingroup Memory
  */
 
-#ifdef CONFIG_ARCH_MX31
+#ifdef CONFIG_SOC_IMX31
 static struct map_desc mx31_io_desc[] __initdata = {
 	imx_map_entry(MX31, X_MEMC, MT_DEVICE),
 	imx_map_entry(MX31, AVIC, MT_DEVICE_NONSHARED),
@@ -64,9 +64,9 @@ void __init mx31_init_irq(void)
 	mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR));
 	imx31_register_gpios();
 }
-#endif /* ifdef CONFIG_ARCH_MX31 */
+#endif /* ifdef CONFIG_SOC_IMX31 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 static struct map_desc mx35_io_desc[] __initdata = {
 	imx_map_entry(MX35, X_MEMC, MT_DEVICE),
 	imx_map_entry(MX35, AVIC, MT_DEVICE_NONSHARED),
@@ -90,7 +90,7 @@ void __init mx35_init_irq(void)
 	mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR));
 	imx35_register_gpios();
 }
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 #ifdef CONFIG_CACHE_L2X0
 static int mxc_init_l2x0(void)
arch/arm/plat-mxc/devices/Kconfig +1 -1
index dbb2078..1be4476 100644
@@ -3,7 +3,7 @@ config IMX_HAVE_PLATFORM_ESDHC
 
 config IMX_HAVE_PLATFORM_FEC
 	bool
-	default y if ARCH_MX25 || SOC_IMX27 || ARCH_MX35 || ARCH_MX51
+	default y if ARCH_MX25 || SOC_IMX27 || SOC_IMX35 || ARCH_MX51
 
 config IMX_HAVE_PLATFORM_FLEXCAN
 	select HAVE_CAN_FLEXCAN if CAN
arch/arm/plat-mxc/devices/platform-esdhc.c +2 -2
index 87df70b..013e92f 100644
@@ -29,7 +29,7 @@ const struct imx_esdhc_imx_data imx25_esdhc_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_esdhc_imx_data imx35_esdhc_data[] __initconst = {
 #define imx35_esdhc_data_entry(_id, _hwid)                           \
 	imx_esdhc_imx_data_entry(MX35, _id, _hwid)
@@ -37,7 +37,7 @@ const struct imx_esdhc_imx_data imx35_esdhc_data[] __initconst = {
 	imx35_esdhc_data_entry(1, 2),
 	imx35_esdhc_data_entry(2, 3),
 };
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 #ifdef CONFIG_ARCH_MX51
 const struct imx_esdhc_imx_data imx51_esdhc_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-fec.c +1 -1
index e6a365e..8d78aed 100644
@@ -26,7 +26,7 @@ const struct imx_fec_data imx27_fec_data __initconst =
 	imx_fec_data_entry_single(MX27);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_fec_data imx35_fec_data __initconst =
 	imx_fec_data_entry_single(MX35);
 #endif
arch/arm/plat-mxc/devices/platform-flexcan.c +2 -2
index f10db6f..4e8497a 100644
@@ -28,14 +28,14 @@ const struct imx_flexcan_data imx25_flexcan_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_flexcan_data imx35_flexcan_data[] __initconst = {
 #define imx35_flexcan_data_entry(_id, _hwid)				\
 	imx_flexcan_data_entry(MX35, _id, _hwid, SZ_16K)
 	imx35_flexcan_data_entry(0, 1),
 	imx35_flexcan_data_entry(1, 2),
 };
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 struct platform_device *__init imx_add_flexcan(
 		const struct imx_flexcan_data *data,
arch/arm/plat-mxc/devices/platform-imx-dma.c +6 -6
index cbafd93..10f41cc 100644
@@ -44,15 +44,15 @@ const struct imx_imx_sdma_data imx25_imx_sdma_data __initconst =
 	imx_imx_sdma_data_entry_single(MX25, 1, "imx25", 0);
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
-#ifdef CONFIG_ARCH_MX31
+#ifdef CONFIG_SOC_IMX31
 struct imx_imx_sdma_data imx31_imx_sdma_data __initdata =
 	imx_imx_sdma_data_entry_single(MX31, 1, "imx31", 0);
-#endif /* ifdef CONFIG_ARCH_MX31 */
+#endif /* ifdef CONFIG_SOC_IMX31 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 struct imx_imx_sdma_data imx35_imx_sdma_data __initdata =
 	imx_imx_sdma_data_entry_single(MX35, 2, "imx35", 0);
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 #ifdef CONFIG_ARCH_MX51
 const struct imx_imx_sdma_data imx51_imx_sdma_data __initconst =
@@ -100,14 +100,14 @@ static int __init imxXX_add_imx_dma(void)
 	else
 #endif
 
-#if defined(CONFIG_ARCH_MX31)
+#if defined(CONFIG_SOC_IMX31)
 	if (cpu_is_mx31()) {
 		imx31_imx_sdma_data.pdata.to_version = mx31_revision() >> 4;
 		ret = imx_add_imx_sdma(&imx31_imx_sdma_data);
 	} else
 #endif
 
-#if defined(CONFIG_ARCH_MX35)
+#if defined(CONFIG_SOC_IMX35)
 	if (cpu_is_mx35()) {
 		imx35_imx_sdma_data.pdata.to_version = mx35_revision() >> 4;
 		ret = imx_add_imx_sdma(&imx35_imx_sdma_data);
arch/arm/plat-mxc/devices/platform-imx-i2c.c +4 -4
index 2cb0232..075bd8e 100644
@@ -49,7 +49,7 @@ const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
-#ifdef CONFIG_ARCH_MX31
+#ifdef CONFIG_SOC_IMX31
 const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
 #define imx31_imx_i2c_data_entry(_id, _hwid)				\
 	imx_imx_i2c_data_entry(MX31, _id, _hwid, SZ_4K)
@@ -57,9 +57,9 @@ const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
 	imx31_imx_i2c_data_entry(1, 2),
 	imx31_imx_i2c_data_entry(2, 3),
 };
-#endif /* ifdef CONFIG_ARCH_MX31 */
+#endif /* ifdef CONFIG_SOC_IMX31 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
 #define imx35_imx_i2c_data_entry(_id, _hwid)				\
 	imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K)
@@ -67,7 +67,7 @@ const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
 	imx35_imx_i2c_data_entry(1, 2),
 	imx35_imx_i2c_data_entry(2, 3),
 };
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 #ifdef CONFIG_ARCH_MX51
 const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-imx-ssi.c +4 -4
index d6410e1..02002fc 100644
@@ -48,23 +48,23 @@ const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
-#ifdef CONFIG_ARCH_MX31
+#ifdef CONFIG_SOC_IMX31
 const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst = {
 #define imx31_imx_ssi_data_entry(_id, _hwid)				\
 	imx_imx_ssi_data_entry(MX31, _id, _hwid, SZ_4K)
 	imx31_imx_ssi_data_entry(0, 1),
 	imx31_imx_ssi_data_entry(1, 2),
 };
-#endif /* ifdef CONFIG_ARCH_MX31 */
+#endif /* ifdef CONFIG_SOC_IMX31 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
 #define imx35_imx_ssi_data_entry(_id, _hwid)				\
 	imx_imx_ssi_data_entry(MX35, _id, _hwid, SZ_4K)
 	imx35_imx_ssi_data_entry(0, 1),
 	imx35_imx_ssi_data_entry(1, 2),
 };
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 #ifdef CONFIG_ARCH_MX51
 const struct imx_imx_ssi_data imx51_imx_ssi_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-imx-uart.c +4 -4
index b10c736..08bbd65 100644
@@ -72,7 +72,7 @@ const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
-#ifdef CONFIG_ARCH_MX31
+#ifdef CONFIG_SOC_IMX31
 const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst = {
 #define imx31_imx_uart_data_entry(_id, _hwid)				\
 	imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_4K)
@@ -82,9 +82,9 @@ const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst = {
 	imx31_imx_uart_data_entry(3, 4),
 	imx31_imx_uart_data_entry(4, 5),
 };
-#endif /* ifdef CONFIG_ARCH_MX31 */
+#endif /* ifdef CONFIG_SOC_IMX31 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
 #define imx35_imx_uart_data_entry(_id, _hwid)				\
 	imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_16K)
@@ -92,7 +92,7 @@ const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
 	imx35_imx_uart_data_entry(1, 2),
 	imx35_imx_uart_data_entry(2, 3),
 };
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 #ifdef CONFIG_ARCH_MX51
 const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst = {
arch/arm/plat-mxc/devices/platform-mxc_nand.c +2 -2
index 967d847..f5beac0 100644
@@ -41,12 +41,12 @@ const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
 	imx_mxc_nand_data_entry_single(MX27, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
-#ifdef CONFIG_ARCH_MX31
+#ifdef CONFIG_SOC_IMX31
 const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
 	imx_mxc_nand_data_entry_single(MX31, SZ_4K);
 #endif
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
 	imx_mxc_nand_data_entry_single(MX35, SZ_8K);
 #endif
arch/arm/plat-mxc/devices/platform-mxc_w1.c +4 -4
index 1355237..96fa5ea 100644
@@ -24,15 +24,15 @@ const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst =
 	imx_mxc_w1_data_entry_single(MX27);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
-#ifdef CONFIG_ARCH_MX31
+#ifdef CONFIG_SOC_IMX31
 const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst =
 	imx_mxc_w1_data_entry_single(MX31);
-#endif /* ifdef CONFIG_ARCH_MX31 */
+#endif /* ifdef CONFIG_SOC_IMX31 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst =
 	imx_mxc_w1_data_entry_single(MX35);
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 struct platform_device *__init imx_add_mxc_w1(
 		const struct imx_mxc_w1_data *data)
arch/arm/plat-mxc/devices/platform-spi_imx.c +4 -4
index bf2cb47..8f2b60a 100644
@@ -49,7 +49,7 @@ const struct imx_spi_imx_data imx27_cspi_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
-#ifdef CONFIG_ARCH_MX31
+#ifdef CONFIG_SOC_IMX31
 const struct imx_spi_imx_data imx31_cspi_data[] __initconst = {
 #define imx31_cspi_data_entry(_id, _hwid)				\
 	imx_spi_imx_data_entry(MX31, CSPI, "imx31-cspi", _id, _hwid, SZ_4K)
@@ -57,16 +57,16 @@ const struct imx_spi_imx_data imx31_cspi_data[] __initconst = {
 	imx31_cspi_data_entry(1, 2),
 	imx31_cspi_data_entry(2, 3),
 };
-#endif /* ifdef CONFIG_ARCH_MX31 */
+#endif /* ifdef CONFIG_SOC_IMX31 */
 
-#ifdef CONFIG_ARCH_MX35
+#ifdef CONFIG_SOC_IMX35
 const struct imx_spi_imx_data imx35_cspi_data[] __initconst = {
 #define imx35_cspi_data_entry(_id, _hwid)                           \
 	imx_spi_imx_data_entry(MX35, CSPI, "imx35-cspi", _id, _hwid, SZ_4K)
 	imx35_cspi_data_entry(0, 1),
 	imx35_cspi_data_entry(1, 2),
 };
-#endif /* ifdef CONFIG_ARCH_MX35 */
+#endif /* ifdef CONFIG_SOC_IMX35 */
 
 #ifdef CONFIG_ARCH_MX51
 const struct imx_spi_imx_data imx51_cspi_data __initconst =
arch/arm/plat-mxc/gpio.c +4 -4
index 2fb1efa..93a8d93 100644
@@ -421,7 +421,7 @@ DEFINE_REGISTER_FUNCTION(imx27)
 
 #endif /* if defined(CONFIG_SOC_IMX27) */
 
-#if defined(CONFIG_ARCH_MX31)
+#if defined(CONFIG_SOC_IMX31)
 static struct mxc_gpio_port imx31_gpio_ports[] = {
 	DEFINE_IMX_GPIO_PORT_IRQ(MX31, 0, 1, MX31_INT_GPIO1),
 	DEFINE_IMX_GPIO_PORT_IRQ(MX31, 1, 2, MX31_INT_GPIO2),
@@ -430,9 +430,9 @@ static struct mxc_gpio_port imx31_gpio_ports[] = {
 
 DEFINE_REGISTER_FUNCTION(imx31)
 
-#endif /* if defined(CONFIG_ARCH_MX31) */
+#endif /* if defined(CONFIG_SOC_IMX31) */
 
-#if defined(CONFIG_ARCH_MX35)
+#if defined(CONFIG_SOC_IMX35)
 static struct mxc_gpio_port imx35_gpio_ports[] = {
 	DEFINE_IMX_GPIO_PORT_IRQ(MX35, 0, 1, MX35_INT_GPIO1),
 	DEFINE_IMX_GPIO_PORT_IRQ(MX35, 1, 2, MX35_INT_GPIO2),
@@ -441,4 +441,4 @@ static struct mxc_gpio_port imx35_gpio_ports[] = {
 
 DEFINE_REGISTER_FUNCTION(imx35)
 
-#endif /* if defined(CONFIG_ARCH_MX35) */
+#endif /* if defined(CONFIG_SOC_IMX35) */
Signature · 1 line
1.7.2.3
#63 lore raw

PATCH 45/51 ARM: mx3: dynamically register mxc-mmc devices

In reply to Uwe Kleine-König

Compared to the static devices the dynamic have a DMA resource. This should be save as it seems unused in the driver.

---
 arch/arm/mach-mx3/Kconfig                       |    5 +++
 arch/arm/mach-mx3/devices-imx31.h               |    4 ++
 arch/arm/mach-mx3/devices.c                     |   38 -----------------------
 arch/arm/mach-mx3/devices.h                     |    2 -
 arch/arm/mach-mx3/mach-armadillo5x0.c           |    5 +--
 arch/arm/mach-mx3/mach-mx31moboard.c            |    9 ++---
 arch/arm/mach-mx3/mach-pcm037.c                 |    5 +--
 arch/arm/mach-mx3/mx31lilly-db.c                |    5 +--
 arch/arm/mach-mx3/mx31lite-db.c                 |    6 +--
 arch/arm/mach-mx3/mx31moboard-devboard.c        |    5 +--
 arch/arm/mach-mx3/mx31moboard-marxbot.c         |    6 ++--
 arch/arm/plat-mxc/devices/platform-mxc-mmc.c    |   20 +++++++++---
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 arch/arm/plat-mxc/include/mach/mx31.h           |   10 +++--
 14 files changed, 48 insertions(+), 73 deletions(-)
arch/arm/mach-mx3/Kconfig +5 -0
index 29ec5ad..46fffa5 100644
@@ -52,6 +52,7 @@ config MACH_PCM037
 	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_MXC_W1
 	select MXC_ULPI if USB_ULPI
@@ -73,6 +74,7 @@ config MACH_MX31LITE
 	select SOC_IMX31
 	select MXC_ULPI if USB_ULPI
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	help
@@ -104,6 +106,7 @@ config MACH_MX31MOBOARD
 	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	select MXC_ULPI if USB_ULPI
 	help
@@ -114,6 +117,7 @@ config MACH_MX31LILLY
 	bool "Support MX31 LILLY-1131 platforms (INCO startec)"
 	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	select MXC_ULPI if USB_ULPI
 	help
@@ -147,6 +151,7 @@ config MACH_ARMADILLO5X0
 	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select MXC_ULPI if USB_ULPI
 	help
arch/arm/mach-mx3/devices-imx31.h +4 -0
index a88f243..875e26f 100644
@@ -29,6 +29,10 @@ extern const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst;
 #define imx31_add_imx_uart3(pdata)	imx31_add_imx_uart(3, pdata)
 #define imx31_add_imx_uart4(pdata)	imx31_add_imx_uart(4, pdata)
 
+extern const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst;
+#define imx31_add_mxc_mmc(id, pdata)	\
+	imx_add_mxc_mmc(&imx31_mxc_mmc_data[id], pdata)
+
 extern const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst;
 #define imx31_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
arch/arm/mach-mx3/devices.c +0 -38
index b179f70..079b98e 100644
@@ -30,44 +30,6 @@
 #include "devices.h"
 
 #ifdef CONFIG_ARCH_MX31
-static struct resource mxcsdhc0_resources[] = {
-	{
-		.start = MX31_MMC_SDHC1_BASE_ADDR,
-		.end = MX31_MMC_SDHC1_BASE_ADDR + SZ_16K - 1,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = MX31_INT_MMC_SDHC1,
-		.end = MX31_INT_MMC_SDHC1,
-		.flags = IORESOURCE_IRQ,
-	},
-};
-
-static struct resource mxcsdhc1_resources[] = {
-	{
-		.start = MX31_MMC_SDHC2_BASE_ADDR,
-		.end = MX31_MMC_SDHC2_BASE_ADDR + SZ_16K - 1,
-		.flags = IORESOURCE_MEM,
-	}, {
-		.start = MX31_INT_MMC_SDHC2,
-		.end = MX31_INT_MMC_SDHC2,
-		.flags = IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device mxcsdhc_device0 = {
-	.name = "mxc-mmc",
-	.id = 0,
-	.num_resources = ARRAY_SIZE(mxcsdhc0_resources),
-	.resource = mxcsdhc0_resources,
-};
-
-struct platform_device mxcsdhc_device1 = {
-	.name = "mxc-mmc",
-	.id = 1,
-	.num_resources = ARRAY_SIZE(mxcsdhc1_resources),
-	.resource = mxcsdhc1_resources,
-};
-
 static struct resource rnga_resources[] = {
 	{
 		.start = MX3x_RNGA_BASE_ADDR,
arch/arm/mach-mx3/devices.h +0 -2
index a649772..2020474 100644
@@ -1,8 +1,6 @@
 extern struct platform_device mx3_ipu;
 extern struct platform_device mx3_fb;
 extern struct platform_device mx3_camera;
-extern struct platform_device mxcsdhc_device0;
-extern struct platform_device mxcsdhc_device1;
 extern struct platform_device mxc_otg_udc_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
arch/arm/mach-mx3/mach-armadillo5x0.c +2 -3
index aaa30fe..e48072c 100644
@@ -49,7 +49,6 @@
 
 #include <mach/common.h>
 #include <mach/iomux-mx3.h>
-#include <mach/mmc.h>
 #include <mach/ipu.h>
 #include <mach/mx3fb.h>
 #include <mach/mxc_ehci.h>
@@ -453,7 +452,7 @@ static void armadillo5x0_sdhc1_exit(struct device *dev, void *data)
 	gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B));
 }
 
-static struct imxmmc_platform_data sdhc_pdata = {
+static const struct imxmmc_platform_data sdhc_pdata __initconst = {
 	.get_ro = armadillo5x0_sdhc1_get_ro,
 	.init = armadillo5x0_sdhc1_init,
 	.exit = armadillo5x0_sdhc1_exit,
@@ -520,7 +519,7 @@ static void __init armadillo5x0_init(void)
 	gpio_direction_input(MX31_PIN_GPIO1_0);
 
 	/* Register SDHC */
-	mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
+	imx31_add_mxc_mmc(0, &sdhc_pdata);
 
 	/* Register FB */
 	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
arch/arm/mach-mx3/mach-mx31moboard.c +4 -5
index eb5f426..5e2ee85 100644
@@ -40,7 +40,6 @@
 #include <mach/hardware.h>
 #include <mach/iomux-mx3.h>
 #include <mach/ipu.h>
-#include <mach/mmc.h>
 #include <mach/mxc_ehci.h>
 #include <mach/mx3_camera.h>
 #include <mach/spi.h>
@@ -170,11 +169,11 @@ static const struct spi_imx_master moboard_spi1_pdata __initconst = {
 
 static struct regulator_consumer_supply sdhc_consumers[] = {
 	{
-		.dev	= &mxcsdhc_device0.dev,
+		.dev_name = "mxc-mmc.0",
 		.supply	= "sdhc0_vcc",
 	},
 	{
-		.dev	= &mxcsdhc_device1.dev,
+		.dev_name = "mxc-mmc.1",
 		.supply	= "sdhc1_vcc",
 	},
 };
@@ -345,7 +344,7 @@ static void moboard_sdhc1_exit(struct device *dev, void *data)
 	gpio_free(SDHC1_CD);
 }
 
-static struct imxmmc_platform_data sdhc1_pdata = {
+static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
 	.get_ro	= moboard_sdhc1_get_ro,
 	.init	= moboard_sdhc1_init,
 	.exit	= moboard_sdhc1_exit,
@@ -520,7 +519,7 @@ static void __init mxc_board_init(void)
 	spi_register_board_info(moboard_spi_board_info,
 		ARRAY_SIZE(moboard_spi_board_info));
 
-	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
+	imx31_add_mxc_mmc(0, &sdhc1_pdata);
 
 	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
 	if (!mx31moboard_cam_alloc_dma(CAMERA_BUF_SIZE))
arch/arm/mach-mx3/mach-pcm037.c +2 -3
index bc5d3a1..2ba4f2b 100644
@@ -43,7 +43,6 @@
 #include <mach/hardware.h>
 #include <mach/iomux-mx3.h>
 #include <mach/ipu.h>
-#include <mach/mmc.h>
 #include <mach/mx3_camera.h>
 #include <mach/mx3fb.h>
 #include <mach/mxc_ehci.h>
@@ -401,7 +400,7 @@ static void pcm970_sdhc1_exit(struct device *dev, void *data)
 	gpio_free(SDHC1_GPIO_WP);
 }
 
-static struct imxmmc_platform_data sdhc_pdata = {
+static const struct imxmmc_platform_data sdhc_pdata __initconst = {
 #ifdef PCM970_SDHC_RW_SWITCH
 	.get_ro = pcm970_sdhc1_get_ro,
 #endif
@@ -634,7 +633,7 @@ static void __init mxc_board_init(void)
 	imx31_add_imx_i2c2(&pcm037_i2c2_data);
 
 	imx31_add_mxc_nand(&pcm037_nand_board_info);
-	mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
+	imx31_add_mxc_mmc(0, &sdhc_pdata);
 	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
 	mxc_register_device(&mx3_fb, &mx3fb_pdata);
 
arch/arm/mach-mx3/mx31lilly-db.c +2 -3
index 827fd3c..8f1a38e 100644
@@ -34,7 +34,6 @@
 #include <mach/common.h>
 #include <mach/iomux-mx3.h>
 #include <mach/board-mx31lilly.h>
-#include <mach/mmc.h>
 #include <mach/mx3fb.h>
 #include <mach/ipu.h>
 
@@ -158,7 +157,7 @@ static void mxc_mmc1_exit(struct device *dev, void *data)
 	free_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO1_1), data);
 }
 
-static struct imxmmc_platform_data mmc_pdata = {
+static const struct imxmmc_platform_data mmc_pdata __initconst = {
 	.get_ro	= mxc_mmc1_get_ro,
 	.init	= mxc_mmc1_init,
 	.exit	= mxc_mmc1_exit,
@@ -216,7 +215,7 @@ void __init mx31lilly_db_init(void)
 	imx31_add_imx_uart0(&uart_pdata);
 	imx31_add_imx_uart1(&uart_pdata);
 	imx31_add_imx_uart2(&uart_pdata);
-	mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
+	imx31_add_mxc_mmc(0, &mmc_pdata);
 	mx31lilly_init_fb();
 }
 
arch/arm/mach-mx3/mx31lite-db.c +2 -4
index 7b0e74e..a06161e 100644
@@ -35,7 +35,6 @@
 #include <mach/common.h>
 #include <mach/iomux-mx3.h>
 #include <mach/board-mx31lite.h>
-#include <mach/mmc.h>
 
 #include "devices-imx31.h"
 #include "devices.h"
@@ -142,7 +141,7 @@ static void mxc_mmc1_exit(struct device *dev, void *data)
 	free_irq(IOMUX_TO_IRQ(MX31_PIN_DCD_DCE1), data);
 }
 
-static struct imxmmc_platform_data mmc_pdata = {
+static const struct imxmmc_platform_data mmc_pdata __initconst = {
 	.get_ro	 = mxc_mmc1_get_ro,
 	.init	   = mxc_mmc1_init,
 	.exit	   = mxc_mmc1_exit,
@@ -197,10 +196,9 @@ void __init mx31lite_db_init(void)
 					ARRAY_SIZE(litekit_db_board_pins),
 					"development board pins");
 	imx31_add_imx_uart0(&uart_pdata);
-	mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
+	imx31_add_mxc_mmc(0, &mmc_pdata);
 	imx31_add_spi_imx0(&spi0_pdata);
 	platform_device_register(&litekit_led_device);
 	mxc_register_device(&imx_wdt_device0, NULL);
 	mxc_register_device(&imx_rtc_device0, NULL);
 }
-
arch/arm/mach-mx3/mx31moboard-devboard.c +2 -3
index fc395a7..3b75929 100644
@@ -25,7 +25,6 @@
 #include <mach/common.h>
 #include <mach/iomux-mx3.h>
 #include <mach/hardware.h>
-#include <mach/mmc.h>
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
@@ -103,7 +102,7 @@ static void devboard_sdhc2_exit(struct device *dev, void *data)
 	gpio_free(SDHC2_CD);
 }
 
-static struct imxmmc_platform_data sdhc2_pdata = {
+static const struct imxmmc_platform_data sdhc2_pdata __initconst = {
 	.get_ro	= devboard_sdhc2_get_ro,
 	.init	= devboard_sdhc2_init,
 	.exit	= devboard_sdhc2_exit,
@@ -228,7 +227,7 @@ void __init mx31moboard_devboard_init(void)
 
 	imx31_add_imx_uart1(&uart_pdata);
 
-	mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
+	imx31_add_mxc_mmc(1, &sdhc2_pdata);
 
 	devboard_init_sel_gpios();
 
arch/arm/mach-mx3/mx31moboard-marxbot.c +3 -3
index 0551eb3..075c4fb 100644
@@ -29,12 +29,12 @@
 #include <mach/hardware.h>
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
-#include <mach/mmc.h>
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include <media/soc_camera.h>
 
+#include "devices-imx31.h"
 #include "devices.h"
 
 static unsigned int marxbot_pins[] = {
@@ -116,7 +116,7 @@ static void marxbot_sdhc2_exit(struct device *dev, void *data)
 	gpio_free(SDHC2_CD);
 }
 
-static struct imxmmc_platform_data sdhc2_pdata = {
+static const struct imxmmc_platform_data sdhc2_pdata __initconst = {
 	.get_ro	= marxbot_sdhc2_get_ro,
 	.init	= marxbot_sdhc2_init,
 	.exit	= marxbot_sdhc2_exit,
@@ -345,7 +345,7 @@ void __init mx31moboard_marxbot_init(void)
 
 	dspics_resets_init();
 
-	mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
+	imx31_add_mxc_mmc(1, &sdhc2_pdata);
 
 	spi_register_board_info(marxbot_spi_board_info,
 		ARRAY_SIZE(marxbot_spi_board_info));
arch/arm/plat-mxc/devices/platform-mxc-mmc.c +15 -5
index 953319e..90d762f 100644
@@ -9,20 +9,21 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_mxc_mmc_data_entry_single(soc, _id, _hwid)			\
+#define imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size)		\
 	{								\
 		.id = _id,						\
 		.iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR,		\
+		.iosize = _size,					\
 		.irq = soc ## _INT_SDHC ## _hwid,			\
 		.dmareq = soc ## _DMA_REQ_SDHC ## _hwid,		\
 	}
-#define imx_mxc_mmc_data_entry(soc, _id, _hwid)				\
-	[_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid)
+#define imx_mxc_mmc_data_entry(soc, _id, _hwid, _size)			\
+	[_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size)
 
 #ifdef CONFIG_SOC_IMX21
 const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
 #define imx21_mxc_mmc_data_entry(_id, _hwid)				\
-	imx_mxc_mmc_data_entry(MX21, _id, _hwid)
+	imx_mxc_mmc_data_entry(MX21, _id, _hwid, SZ_4K)
 	imx21_mxc_mmc_data_entry(0, 1),
 	imx21_mxc_mmc_data_entry(1, 2),
 };
@@ -31,12 +32,21 @@ const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
 #ifdef CONFIG_SOC_IMX27
 const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
 #define imx27_mxc_mmc_data_entry(_id, _hwid)				\
-	imx_mxc_mmc_data_entry(MX27, _id, _hwid)
+	imx_mxc_mmc_data_entry(MX27, _id, _hwid, SZ_4K)
 	imx27_mxc_mmc_data_entry(0, 1),
 	imx27_mxc_mmc_data_entry(1, 2),
 };
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
+#ifdef CONFIG_SOC_IMX31
+const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = {
+#define imx31_mxc_mmc_data_entry(_id, _hwid)				\
+	imx_mxc_mmc_data_entry(MX31, _id, _hwid, SZ_16K)
+	imx31_mxc_mmc_data_entry(0, 1),
+	imx31_mxc_mmc_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_SOC_IMX31 */
+
 struct platform_device *__init imx_add_mxc_mmc(
 		const struct imx_mxc_mmc_data *data,
 		const struct imxmmc_platform_data *pdata)
arch/arm/plat-mxc/include/mach/devices-common.h +1 -0
index 95331ae..5a62dc4 100644
@@ -202,6 +202,7 @@ struct platform_device *__init imx_add_mxc_ehci(
 struct imx_mxc_mmc_data {
 	int id;
 	resource_size_t iobase;
+	resource_size_t iosize;
 	resource_size_t irq;
 	resource_size_t dmareq;
 };
arch/arm/plat-mxc/include/mach/mx31.h +6 -4
index 6d4b98f..d024c9c 100644
@@ -41,8 +41,8 @@
 
 #define MX31_SPBA0_BASE_ADDR		0x50000000
 #define MX31_SPBA0_SIZE			SZ_1M
-#define MX31_MMC_SDHC1_BASE_ADDR		(MX31_SPBA0_BASE_ADDR + 0x04000)
-#define MX31_MMC_SDHC2_BASE_ADDR		(MX31_SPBA0_BASE_ADDR + 0x08000)
+#define MX31_SDHC1_BASE_ADDR			(MX31_SPBA0_BASE_ADDR + 0x04000)
+#define MX31_SDHC2_BASE_ADDR			(MX31_SPBA0_BASE_ADDR + 0x08000)
 #define MX31_UART3_BASE_ADDR			(MX31_SPBA0_BASE_ADDR + 0x0c000)
 #define MX31_CSPI2_BASE_ADDR			(MX31_SPBA0_BASE_ADDR + 0x10000)
 #define MX31_SSI2_BASE_ADDR			(MX31_SPBA0_BASE_ADDR + 0x14000)
@@ -134,8 +134,8 @@ static inline void mx31_setup_weimcs(size_t cs,
 #define MX31_INT_MPEG4_ENCODER	5
 #define MX31_INT_RTIC		6
 #define MX31_INT_FIRI		7
-#define MX31_INT_MMC_SDHC2	8
-#define MX31_INT_MMC_SDHC1	9
+#define MX31_INT_SDHC2		8
+#define MX31_INT_SDHC1		9
 #define MX31_INT_I2C1		10
 #define MX31_INT_SSI2		11
 #define MX31_INT_SSI1		12
@@ -188,6 +188,8 @@ static inline void mx31_setup_weimcs(size_t cs,
 #define MX31_INT_EXT_WDOG	62
 #define MX31_INT_EXT_TV		63
 
+#define MX31_DMA_REQ_SDHC1	20
+#define MX31_DMA_REQ_SDHC2	21
 #define MX31_DMA_REQ_SSI2_RX1	22
 #define MX31_DMA_REQ_SSI2_TX1	23
 #define MX31_DMA_REQ_SSI2_RX0	24
Signature · 1 line
1.7.2.3
#64 lore raw

PATCH 46/51 ARM: mx3: dynamically allocate mxc_rnga devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx3/Kconfig                     |    2 +-
 arch/arm/mach-mx3/devices.c                   |   18 --------
 arch/arm/mach-mx3/devices.h                   |    1 -
 arch/arm/plat-mxc/devices/Kconfig             |    4 ++
 arch/arm/plat-mxc/devices/Makefile            |    1 +
 arch/arm/plat-mxc/devices/platform-mxc_rnga.c |   56 +++++++++++++++++++++++++
 6 files changed, 62 insertions(+), 20 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc_rnga.c
arch/arm/mach-mx3/Kconfig +1 -1
index 46fffa5..17ae7d3 100644
@@ -12,7 +12,7 @@ config ARCH_MX35
 
 config SOC_IMX31
 	bool
-	select ARCH_HAS_RNGA
+	select IMX_HAVE_PLATFORM_MXC_RNGA
 	select ARCH_MXC_AUDMUX_V2
 	select ARCH_MX31
 
arch/arm/mach-mx3/devices.c +0 -18
index 079b98e..202c06c 100644
@@ -29,23 +29,6 @@
 
 #include "devices.h"
 
-#ifdef CONFIG_ARCH_MX31
-static struct resource rnga_resources[] = {
-	{
-		.start = MX3x_RNGA_BASE_ADDR,
-		.end = MX3x_RNGA_BASE_ADDR + 0x28,
-		.flags = IORESOURCE_MEM,
-	},
-};
-
-struct platform_device mxc_rnga_device = {
-	.name = "mxc_rnga",
-	.id = -1,
-	.num_resources = 1,
-	.resource = rnga_resources,
-};
-#endif /* CONFIG_ARCH_MX31 */
-
 /* i.MX31 Image Processing Unit */
 
 /* The resource order is important! */
@@ -262,7 +245,6 @@ static int __init mx3_devices_init(void)
 	if (cpu_is_mx31()) {
 		imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
 		imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
-		mxc_register_device(&mxc_rnga_device, NULL);
 	}
 #endif
 #if defined(CONFIG_ARCH_MX35)
arch/arm/mach-mx3/devices.h +0 -1
index 2020474..d472c45 100644
@@ -5,7 +5,6 @@ extern struct platform_device mxc_otg_udc_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
-extern struct platform_device mxc_rnga_device;
 extern struct platform_device imx_wdt_device0;
 extern struct platform_device imx_rtc_device0;
 extern struct platform_device imx_kpp_device;
arch/arm/plat-mxc/devices/Kconfig +4 -0
index 1be4476..f34c139 100644
@@ -62,6 +62,10 @@ config IMX_HAVE_PLATFORM_MXC_NAND
 config IMX_HAVE_PLATFORM_MXC_PWM
 	bool
 
+config IMX_HAVE_PLATFORM_MXC_RNGA
+	bool
+	select ARCH_HAS_RNGA
+
 config IMX_HAVE_PLATFORM_MXC_W1
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index f1c3767..91fdd6c 100644
@@ -19,5 +19,6 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
arch/arm/plat-mxc/devices/platform-mxc_rnga.c new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.7.2.3
reviewer
#65 lore raw

PATCH 46/51 ARM: mx3: dynamically allocate mxc_rnga devices

Hi Uwe,

2010/11/17 Uwe Kleine-K?nig <[email protected]>:

Quoted 4 lines

+#define imx_mxc_rnga_data_entry_single(soc, _size) ? ? ? ? ? ? ? ? ? ? \
+ ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
+ ? ? ? ? ? ? ? .iobase = soc ## _RNGA_BASE_ADDR, ? ? ? ? ? ? ? ? ? ? ? \
+ ? ? ? }

_size is not used here. I think you should add .iosize = _size

arch/arm/plat-mxc/devices/platform-mxc_rnga.c

Quoted 3 lines
arch/arm/plat-mxc/devices/platform-mxc_rnga.c new file +3 -0
+#ifdef CONFIG_SOC_IMX31
+static const struct imx_mxc_rnga_data imx31_mxc_rnga_data __initconst =
+ ? ? ? imx_mxc_rnga_data_entry_single(MX31, SZ_4K);

This should be SZ_16K,

Review

Quoted 9 lines
(quoted diff) +9 -0
+#endif /* ifdef CONFIG_SOC_IMX31 */
+
+static struct platform_device *__init imx_add_mxc_rnga(
+ ? ? ? ? ? ? ? const struct imx_mxc_rnga_data *data)
+{
+ ? ? ? struct resource res[] = {
+ ? ? ? ? ? ? ? {
+ ? ? ? ? ? ? ? ? ? ? ? .start = data->iobase,
+ ? ? ? ? ? ? ? ? ? ? ? .end = data->iobase + SZ_16K - 1,

Then here you should do:

.end = data->iobase + data->iosize - 1,

Regards,

Fabio Estevam

#66 lore raw

PATCH v2 46/51 ARM: mx3: dynamically allocate mxc_rnga devices

---
Hello Fabio,

Quoted 7 lines

2010/11/17 Uwe Kleine-K?nig <[email protected]>:

Quoted 4 lines

+#define imx_mxc_rnga_data_entry_single(soc, _size) ? ? ? ? ? ? ? ? ? ? \
+ ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
+ ? ? ? ? ? ? ? .iobase = soc ## _RNGA_BASE_ADDR, ? ? ? ? ? ? ? ? ? ? ? \
+ ? ? ? }

_size is not used here. I think you should add .iosize = _size

As (at least for now) all mxc_rnga devices have the same size, I prefer hardcoding that value as done below. (hhmm, I could do the same for the base address ...) So I just removed the _size parameter.

Thanks for catching this.

I already updated my tree with this patch.

Thanks
Uwe

 arch/arm/mach-mx3/Kconfig                     |    2 +-
 arch/arm/mach-mx3/devices.c                   |   18 --------
 arch/arm/mach-mx3/devices.h                   |    1 -
 arch/arm/plat-mxc/devices/Kconfig             |    4 ++
 arch/arm/plat-mxc/devices/Makefile            |    1 +
 arch/arm/plat-mxc/devices/platform-mxc_rnga.c |   56 +++++++++++++++++++++++++
 6 files changed, 62 insertions(+), 20 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-mxc_rnga.c
arch/arm/mach-mx3/Kconfig +1 -1
index 46fffa5..17ae7d3 100644
@@ -12,7 +12,7 @@ config ARCH_MX35
 
 config SOC_IMX31
 	bool
-	select ARCH_HAS_RNGA
+	select IMX_HAVE_PLATFORM_MXC_RNGA
 	select ARCH_MXC_AUDMUX_V2
 	select ARCH_MX31
 
arch/arm/mach-mx3/devices.c +0 -18
index 079b98e..202c06c 100644
@@ -29,23 +29,6 @@
 
 #include "devices.h"
 
-#ifdef CONFIG_ARCH_MX31
-static struct resource rnga_resources[] = {
-	{
-		.start = MX3x_RNGA_BASE_ADDR,
-		.end = MX3x_RNGA_BASE_ADDR + 0x28,
-		.flags = IORESOURCE_MEM,
-	},
-};
-
-struct platform_device mxc_rnga_device = {
-	.name = "mxc_rnga",
-	.id = -1,
-	.num_resources = 1,
-	.resource = rnga_resources,
-};
-#endif /* CONFIG_ARCH_MX31 */
-
 /* i.MX31 Image Processing Unit */
 
 /* The resource order is important! */
@@ -262,7 +245,6 @@ static int __init mx3_devices_init(void)
 	if (cpu_is_mx31()) {
 		imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
 		imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
-		mxc_register_device(&mxc_rnga_device, NULL);
 	}
 #endif
 #if defined(CONFIG_ARCH_MX35)
arch/arm/mach-mx3/devices.h +0 -1
index 2020474..d472c45 100644
@@ -5,7 +5,6 @@ extern struct platform_device mxc_otg_udc_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
-extern struct platform_device mxc_rnga_device;
 extern struct platform_device imx_wdt_device0;
 extern struct platform_device imx_rtc_device0;
 extern struct platform_device imx_kpp_device;
arch/arm/plat-mxc/devices/Kconfig +4 -0
index 1be4476..f34c139 100644
@@ -62,6 +62,10 @@ config IMX_HAVE_PLATFORM_MXC_NAND
 config IMX_HAVE_PLATFORM_MXC_PWM
 	bool
 
+config IMX_HAVE_PLATFORM_MXC_RNGA
+	bool
+	select ARCH_HAS_RNGA
+
 config IMX_HAVE_PLATFORM_MXC_W1
 	bool
 
arch/arm/plat-mxc/devices/Makefile +1 -0
index f1c3767..91fdd6c 100644
@@ -19,5 +19,6 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
arch/arm/plat-mxc/devices/platform-mxc_rnga.c new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#67 lore raw

PATCH 47/51 ARM: mx3: dynamically allocate fsl-usb2-udc devices

In reply to Uwe Kleine-König

While adapting the #defines for this I noticed that the offset used for USB HS on i.MX35 differs from the documented offset. I kept the working offset and commented that the documentation differs.

---
 arch/arm/mach-mx3/Kconfig                         |    9 +++-
 arch/arm/mach-mx3/devices-imx31.h                 |    4 ++
 arch/arm/mach-mx3/devices-imx35.h                 |    4 ++
 arch/arm/mach-mx3/devices.c                       |   52 ++++++++-------------
 arch/arm/mach-mx3/devices.h                       |    1 -
 arch/arm/mach-mx3/mach-cpuimx35.c                 |    5 +-
 arch/arm/mach-mx3/mach-mx31_3ds.c                 |    5 +-
 arch/arm/mach-mx3/mach-mx35_3ds.c                 |    5 +-
 arch/arm/mach-mx3/mach-pcm037.c                   |    5 +-
 arch/arm/mach-mx3/mach-pcm043.c                   |    5 +-
 arch/arm/mach-mx3/mx31moboard-devboard.c          |    5 +-
 arch/arm/mach-mx3/mx31moboard-marxbot.c           |    5 +-
 arch/arm/mach-mx3/mx31moboard-smartbot.c          |    5 +-
 arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c |   10 ++++
 arch/arm/plat-mxc/include/mach/mx31.h             |   12 +++--
 arch/arm/plat-mxc/include/mach/mx35.h             |   14 ++++--
 16 files changed, 78 insertions(+), 68 deletions(-)
arch/arm/mach-mx3/Kconfig +7 -2
index 17ae7d3..120add4 100644
@@ -50,6 +50,7 @@ config MACH_MX31ADS_WM1133_EV1
 config MACH_PCM037
 	bool "Support Phytec pcm037 (i.MX31) platforms"
 	select SOC_IMX31
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -85,6 +86,7 @@ config MACH_MX31_3DS
 	bool "Support MX31PDK (3DS)"
 	select SOC_IMX31
 	select MXC_DEBUG_BOARD
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_SPI_IMX
@@ -104,6 +106,7 @@ config MACH_MX31_3DS_MXC_NAND_USE_BBT
 config MACH_MX31MOBOARD
 	bool "Support mx31moboard platforms (EPFL Mobots group)"
 	select SOC_IMX31
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -135,6 +138,7 @@ config MACH_QONG
 config MACH_PCM043
 	bool "Support Phytec pcm043 (i.MX35) platforms"
 	select SOC_IMX35
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -162,10 +166,10 @@ config MACH_MX35_3DS
 	bool "Support MX35PDK platform"
 	select SOC_IMX35
 	select MXC_DEBUG_BOARD
+	select IMX_HAVE_PLATFORM_ESDHC
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
-	select IMX_HAVE_PLATFORM_ESDHC
-	default n
 	help
 	  Include support for MX35PDK platform. This includes specific
 	  configurations for the board and its peripherals.
@@ -181,6 +185,7 @@ config MACH_KZM_ARM11_01
 config MACH_EUKREA_CPUIMX35
 	bool "Support Eukrea CPUIMX35 Platform"
 	select SOC_IMX35
+	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_MXC_NAND
arch/arm/mach-mx3/devices-imx31.h +4 -0
index 875e26f..0cefaca 100644
@@ -9,6 +9,10 @@
 #include <mach/mx31.h>
 #include <mach/devices-common.h>
 
+extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst;
+#define imx31_add_fsl_usb2_udc(pdata)	\
+	imx_add_fsl_usb2_udc(&imx31_fsl_usb2_udc_data, pdata)
+
 extern const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst;
 #define imx31_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx31_imx_i2c_data[id], pdata)
arch/arm/mach-mx3/devices-imx35.h +4 -0
index a71ce68..36561cc 100644
@@ -13,6 +13,10 @@ extern const struct imx_fec_data imx35_fec_data __initconst;
 #define imx35_add_fec(pdata)	\
 	imx_add_fec(&imx35_fec_data, pdata)
 
+extern const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst;
+#define imx35_add_fsl_usb2_udc(pdata)	\
+	imx_add_fsl_usb2_udc(&imx35_fsl_usb2_udc_data, pdata)
+
 extern const struct imx_flexcan_data imx35_flexcan_data[] __initconst;
 #define imx35_add_flexcan(id, pdata)	\
 	imx_add_flexcan(&imx35_flexcan_data[id], pdata)
arch/arm/mach-mx3/devices.c +20 -32

88 lines not on this page · raw message

arch/arm/mach-mx3/devices.h +0 -1
index d472c45..eb3b990f 100644
@@ -1,7 +1,6 @@
 extern struct platform_device mx3_ipu;
 extern struct platform_device mx3_fb;
 extern struct platform_device mx3_camera;
-extern struct platform_device mxc_otg_udc_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
arch/arm/mach-mx3/mach-cpuimx35.c +2 -3
index 9fde873..b8b619a 100644
@@ -30,7 +30,6 @@
 #include <linux/i2c/tsc2007.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
-#include <linux/fsl_devices.h>
 #include <linux/i2c-gpio.h>
 
 #include <asm/mach-types.h>
@@ -128,7 +127,7 @@ static struct mxc_usbh_platform_data __maybe_unused usbh1_pdata = {
 		  MXC_EHCI_IPPUE_DOWN,
 };
 
-static struct fsl_usb2_platform_data otg_device_pdata = {
+static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
 	.operating_mode	= FSL_USB2_DR_DEVICE,
 	.phy_mode	= FSL_USB2_PHY_UTMI,
 	.workaround	= FLS_USB2_WORKAROUND_ENGCM09152,
@@ -170,7 +169,7 @@ static void __init mxc_board_init(void)
 	if (otg_mode_host)
 		mxc_register_device(&mxc_otg_host, &otg_pdata);
 	else
-		mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
+		imx35_add_fsl_usb2_udc(&otg_device_pdata);
 
 	mxc_register_device(&mxc_usbh1, &usbh1_pdata);
 
arch/arm/mach-mx3/mach-mx31_3ds.c +2 -3
index 0ad9e78..1b46f73 100644
@@ -22,7 +22,6 @@
 #include <linux/mfd/mc13783.h>
 #include <linux/spi/spi.h>
 #include <linux/regulator/machine.h>
-#include <linux/fsl_devices.h>
 #include <linux/input/matrix_keypad.h>
 
 #include <mach/hardware.h>
@@ -214,7 +213,7 @@ usbotg_free_reset:
 	return err;
 }
 
-static struct fsl_usb2_platform_data usbotg_pdata = {
+static const struct fsl_usb2_platform_data usbotg_pdata __initconst = {
 	.operating_mode = FSL_USB2_DR_DEVICE,
 	.phy_mode	= FSL_USB2_PHY_ULPI,
 };
@@ -249,7 +248,7 @@ static void __init mxc_board_init(void)
 	mxc_register_device(&imx_kpp_device, &mx31_3ds_keymap_data);
 
 	mx31_3ds_usbotg_init();
-	mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata);
+	imx31_add_fsl_usb2_udc(&usbotg_pdata);
 
 	if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT))
 		printk(KERN_WARNING "Init of the debug board failed, all "
arch/arm/mach-mx3/mach-mx35_3ds.c +2 -3
index b66a75a..6dfdf17 100644
@@ -26,7 +26,6 @@
 #include <linux/platform_device.h>
 #include <linux/memory.h>
 #include <linux/gpio.h>
-#include <linux/fsl_devices.h>
 
 #include <linux/mtd/physmap.h>
 
@@ -122,7 +121,7 @@ static struct pad_desc mx35pdk_pads[] = {
 };
 
 /* OTG config */
-static struct fsl_usb2_platform_data usb_otg_pdata = {
+static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = {
 	.operating_mode	= FSL_USB2_DR_DEVICE,
 	.phy_mode	= FSL_USB2_PHY_UTMI_WIDE,
 };
@@ -146,7 +145,7 @@ static void __init mxc_board_init(void)
 
 	imx35_add_imx_uart0(&uart_pdata);
 
-	mxc_register_device(&mxc_otg_udc_device, &usb_otg_pdata);
+	imx35_add_fsl_usb2_udc(&usb_otg_pdata);
 
 	mxc_register_device(&mxc_usbh1, &usb_host_pdata);
 
arch/arm/mach-mx3/mach-pcm037.c +2 -3
index 2ba4f2b..20f7f94 100644
@@ -27,7 +27,6 @@
 #include <linux/delay.h>
 #include <linux/spi/spi.h>
 #include <linux/irq.h>
-#include <linux/fsl_devices.h>
 #include <linux/can/platform/sja1000.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
@@ -550,7 +549,7 @@ static struct mxc_usbh_platform_data usbh2_pdata = {
 };
 #endif
 
-static struct fsl_usb2_platform_data otg_device_pdata = {
+static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
 	.operating_mode = FSL_USB2_DR_DEVICE,
 	.phy_mode       = FSL_USB2_PHY_ULPI,
 };
@@ -664,7 +663,7 @@ static void __init mxc_board_init(void)
 	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
 #endif
 	if (!otg_mode_host)
-		mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
+		imx31_add_fsl_usb2_udc(&otg_device_pdata);
 
 }
 
arch/arm/mach-mx3/mach-pcm043.c +2 -3
index 4e1de87..78159f0 100644
@@ -27,7 +27,6 @@
 #include <linux/i2c/at24.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
-#include <linux/fsl_devices.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -323,7 +322,7 @@ static struct mxc_usbh_platform_data usbh1_pdata = {
 };
 #endif
 
-static struct fsl_usb2_platform_data otg_device_pdata = {
+static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
 	.operating_mode = FSL_USB2_DR_DEVICE,
 	.phy_mode       = FSL_USB2_PHY_UTMI,
 };
@@ -392,7 +391,7 @@ static void __init mxc_board_init(void)
 	mxc_register_device(&mxc_usbh1, &usbh1_pdata);
 #endif
 	if (!otg_mode_host)
-		mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
+		imx35_add_fsl_usb2_udc(&otg_device_pdata);
 
 	imx35_add_flexcan1(NULL);
 	imx35_add_esdhc(0, NULL);
arch/arm/mach-mx3/mx31moboard-devboard.c +2 -3
index 3b75929..331b595 100644
@@ -18,7 +18,6 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/types.h>
-#include <linux/fsl_devices.h>
 
 #include <linux/usb/otg.h>
 
@@ -210,7 +209,7 @@ static int __init devboard_usbh1_init(void)
 }
 
 
-static struct fsl_usb2_platform_data usb_pdata = {
+static const struct fsl_usb2_platform_data usb_pdata __initconst = {
 	.operating_mode	= FSL_USB2_DR_DEVICE,
 	.phy_mode	= FSL_USB2_PHY_ULPI,
 };
@@ -231,7 +230,7 @@ void __init mx31moboard_devboard_init(void)
 
 	devboard_init_sel_gpios();
 
-	mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
+	imx31_add_fsl_usb2_udc(&usb_pdata);
 
 	devboard_usbh1_init();
 }
arch/arm/mach-mx3/mx31moboard-marxbot.c +2 -3
index 075c4fb..db79f74 100644
@@ -21,7 +21,6 @@
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
-#include <linux/fsl_devices.h>
 
 #include <linux/usb/otg.h>
 
@@ -326,7 +325,7 @@ static int __init marxbot_usbh1_init(void)
 	return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
 }
 
-static struct fsl_usb2_platform_data usb_pdata = {
+static const struct fsl_usb2_platform_data usb_pdata __initconst = {
 	.operating_mode	= FSL_USB2_DR_DEVICE,
 	.phy_mode	= FSL_USB2_PHY_ULPI,
 };
@@ -358,7 +357,7 @@ void __init mx31moboard_marxbot_init(void)
 	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
 	gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
 
-	mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
+	imx31_add_fsl_usb2_udc(&usb_pdata);
 
 	marxbot_usbh1_init();
 }
arch/arm/mach-mx3/mx31moboard-smartbot.c +2 -3
index 417757e..68e8ab5 100644
@@ -19,7 +19,6 @@
 #include <linux/i2c.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
-#include <linux/fsl_devices.h>
 
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
@@ -119,7 +118,7 @@ static int __init smartbot_cam_init(void)
 	return 0;
 }
 
-static struct fsl_usb2_platform_data usb_pdata = {
+static const struct fsl_usb2_platform_data usb_pdata __initconst = {
 	.operating_mode	= FSL_USB2_DR_DEVICE,
 	.phy_mode	= FSL_USB2_PHY_ULPI,
 };
@@ -183,7 +182,7 @@ void __init mx31moboard_smartbot_init(int board)
 
 	switch (board) {
 	case MX31SMARTBOT:
-		mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
+		imx31_add_fsl_usb2_udc(&usb_pdata);
 		break;
 	case MX31EYEBOT:
 		smartbot_otg_host_init();
arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c +10 -0
index 42c3923..59c33f6 100644
@@ -25,6 +25,16 @@ const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
 	imx_fsl_usb2_udc_data_entry_single(MX27);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
+#ifdef CONFIG_SOC_IMX31
+const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
+	imx_fsl_usb2_udc_data_entry_single(MX31);
+#endif /* ifdef CONFIG_SOC_IMX31 */
+
+#ifdef CONFIG_SOC_IMX35
+const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
+	imx_fsl_usb2_udc_data_entry_single(MX35);
+#endif /* ifdef CONFIG_SOC_IMX35 */
+
 struct platform_device *__init imx_add_fsl_usb2_udc(
 		const struct imx_fsl_usb2_udc_data *data,
 		const struct fsl_usb2_platform_data *pdata)
arch/arm/plat-mxc/include/mach/mx31.h +7 -5
index d024c9c..0923231 100644
@@ -24,7 +24,10 @@
 #define MX31_ECT_CTIO_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x18000)
 #define MX31_I2C1_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x80000)
 #define MX31_I2C3_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x84000)
-#define MX31_OTG_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x88000)
+#define MX31_USB_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x88000)
+#define MX31_USB_OTG_BASE_ADDR			(MX31_USB_BASE_ADDR + 0x0000)
+#define MX31_USB_HS1_BASE_ADDR			(MX31_USB_BASE_ADDR + 0x0200)
+#define MX31_USB_HS2_BASE_ADDR			(MX31_USB_BASE_ADDR + 0x0400)
 #define MX31_ATA_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x8c000)
 #define MX31_UART1_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x90000)
 #define MX31_UART2_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x94000)
@@ -161,10 +164,9 @@ static inline void mx31_setup_weimcs(size_t cs,
 #define MX31_INT_UART2		32
 #define MX31_INT_NFC		33
 #define MX31_INT_SDMA		34
-#define MX31_INT_USB1		35
-#define MX31_INT_USB2		36
-#define MX31_INT_USB3		37
-#define MX31_INT_USB4		38
+#define MX31_INT_USB_HS1	35
+#define MX31_INT_USB_HS2	36
+#define MX31_INT_USB_OTG	37
 #define MX31_INT_MSHC1		39
 #define MX31_INT_MSHC2		40
 #define MX31_INT_IPU_ERR	41
arch/arm/plat-mxc/include/mach/mx35.h +10 -4
index 9067225..0fa3f68 100644
@@ -65,8 +65,14 @@
 #define MX35_CAN2_BASE_ADDR			(MX35_AIPS2_BASE_ADDR + 0xe8000)
 #define MX35_RTIC_BASE_ADDR			(MX35_AIPS2_BASE_ADDR + 0xec000)
 #define MX35_IIM_BASE_ADDR			(MX35_AIPS2_BASE_ADDR + 0xf0000)
-
-#define MX35_OTG_BASE_ADDR		0x53ff4000
+#define MX35_USB_BASE_ADDR			(MX35_AIPS2_BASE_ADDR + 0xf4000)
+#define MX35_USB_OTG_BASE_ADDR			(MX35_USB_BASE_ADDR + 0x0000)
+/*
+ * The Reference Manual (IMX35RM, Rev. 2, 3/2009) claims an offset of 0x200 for
+ * HS.  When host support was implemented only a preliminary document was
+ * available, which told 0x400.  This works fine.
+ */
+#define MX35_USB_HS_BASE_ADDR			(MX35_USB_BASE_ADDR + 0x0400)
 
 #define MX35_ROMP_BASE_ADDR		0x60000000
 #define MX35_ROMP_SIZE			SZ_1M
@@ -143,8 +149,8 @@
 #define MX35_INT_UART2		32
 #define MX35_INT_NFC		33
 #define MX35_INT_SDMA		34
-#define MX35_INT_USBHS		35
-#define MX35_INT_USBOTG		37
+#define MX35_INT_USB_HS		35
+#define MX35_INT_USB_OTG	37
 #define MX35_INT_MSHC1		39
 #define MX35_INT_ESAI		40
 #define MX35_INT_IPU_ERR	41
Signature · 1 line
1.7.2.3
#68 lore raw

PATCH 48/51 ARM: mx3: dynamically allocate mxc-ehci devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx3/Kconfig                     |    8 ++
 arch/arm/mach-mx3/devices-imx31.h             |    7 ++
 arch/arm/mach-mx3/devices-imx35.h             |    7 ++
 arch/arm/mach-mx3/devices.c                   |   89 -------------------------
 arch/arm/mach-mx3/devices.h                   |    3 -
 arch/arm/mach-mx3/mach-armadillo5x0.c         |    9 +--
 arch/arm/mach-mx3/mach-cpuimx35.c             |    9 +--
 arch/arm/mach-mx3/mach-mx31lilly.c            |    9 +--
 arch/arm/mach-mx3/mach-mx31lite.c             |    5 +-
 arch/arm/mach-mx3/mach-mx31moboard.c          |   11 ++-
 arch/arm/mach-mx3/mach-mx35_3ds.c             |    5 +-
 arch/arm/mach-mx3/mach-pcm037.c               |    9 +--
 arch/arm/mach-mx3/mach-pcm043.c               |    9 +--
 arch/arm/mach-mx3/mx31moboard-devboard.c      |   10 ++-
 arch/arm/mach-mx3/mx31moboard-marxbot.c       |   10 ++-
 arch/arm/mach-mx3/mx31moboard-smartbot.c      |   11 ++-
 arch/arm/plat-mxc/devices/platform-mxc-ehci.c |   16 +++++
 17 files changed, 92 insertions(+), 135 deletions(-)
arch/arm/mach-mx3/Kconfig +8 -0
index 120add4..1573483 100644
@@ -53,6 +53,7 @@ config MACH_PCM037
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_MXC_W1
@@ -75,6 +76,7 @@ config MACH_MX31LITE
 	select SOC_IMX31
 	select MXC_ULPI if USB_ULPI
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_SPI_IMX
@@ -109,6 +111,7 @@ config MACH_MX31MOBOARD
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	select MXC_ULPI if USB_ULPI
@@ -120,6 +123,7 @@ config MACH_MX31LILLY
 	bool "Support MX31 LILLY-1131 platforms (INCO startec)"
 	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_SPI_IMX
 	select MXC_ULPI if USB_ULPI
@@ -142,6 +146,7 @@ config MACH_PCM043
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_FLEXCAN
 	select IMX_HAVE_PLATFORM_ESDHC
@@ -155,6 +160,7 @@ config MACH_ARMADILLO5X0
 	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select MXC_ULPI if USB_ULPI
@@ -169,6 +175,7 @@ config MACH_MX35_3DS
 	select IMX_HAVE_PLATFORM_ESDHC
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	help
 	  Include support for MX35PDK platform. This includes specific
@@ -188,6 +195,7 @@ config MACH_EUKREA_CPUIMX35
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_IMX_I2C
+	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_FLEXCAN
 	select IMX_HAVE_PLATFORM_ESDHC
arch/arm/mach-mx3/devices-imx31.h +7 -0
index 0cefaca..6571dd7 100644
@@ -33,6 +33,13 @@ extern const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst;
 #define imx31_add_imx_uart3(pdata)	imx31_add_imx_uart(3, pdata)
 #define imx31_add_imx_uart4(pdata)	imx31_add_imx_uart(4, pdata)
 
+extern const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst;
+#define imx31_add_mxc_ehci_otg(pdata)	\
+	imx_add_mxc_ehci(&imx31_mxc_ehci_otg_data, pdata)
+extern const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst;
+#define imx31_add_mxc_ehci_hs(id, pdata)	\
+	imx_add_mxc_ehci(&imx31_mxc_ehci_hs_data[id - 1], pdata)
+
 extern const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst;
 #define imx31_add_mxc_mmc(id, pdata)	\
 	imx_add_mxc_mmc(&imx31_mxc_mmc_data[id], pdata)
arch/arm/mach-mx3/devices-imx35.h +7 -0
index 36561cc..849c48a 100644
@@ -41,6 +41,13 @@ extern const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst;
 #define imx35_add_imx_uart1(pdata)	imx35_add_imx_uart(1, pdata)
 #define imx35_add_imx_uart2(pdata)	imx35_add_imx_uart(2, pdata)
 
+extern const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst;
+#define imx35_add_mxc_ehci_otg(pdata)	\
+	imx_add_mxc_ehci(&imx35_mxc_ehci_otg_data, pdata)
+extern const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst;
+#define imx35_add_mxc_ehci_hs(pdata)	\
+	imx_add_mxc_ehci(&imx35_mxc_ehci_hs_data, pdata)
+
 extern const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst;
 #define imx35_add_mxc_nand(pdata)	\
 	imx_add_mxc_nand(&imx35_mxc_nand_data, pdata)
arch/arm/mach-mx3/devices.c +0 -89

101 lines not on this page · raw message

arch/arm/mach-mx3/devices.h +0 -3
index eb3b990f..1bc2918 100644
@@ -1,9 +1,6 @@
 extern struct platform_device mx3_ipu;
 extern struct platform_device mx3_fb;
 extern struct platform_device mx3_camera;
-extern struct platform_device mxc_otg_host;
-extern struct platform_device mxc_usbh1;
-extern struct platform_device mxc_usbh2;
 extern struct platform_device imx_wdt_device0;
 extern struct platform_device imx_rtc_device0;
 extern struct platform_device imx_kpp_device;
arch/arm/mach-mx3/mach-armadillo5x0.c +4 -5
index e48072c..28b6f41 100644
@@ -51,7 +51,6 @@
 #include <mach/iomux-mx3.h>
 #include <mach/ipu.h>
 #include <mach/mx3fb.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include "devices-imx31.h"
@@ -244,13 +243,13 @@ h2_free_cs:
 	return err;
 }
 
-static struct mxc_usbh_platform_data usbotg_pdata = {
+static struct mxc_usbh_platform_data usbotg_pdata __initdata = {
 	.init	= usbotg_init,
 	.portsc	= MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_DIFF_UNI,
 };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 	.init	= usbh2_init,
 	.portsc	= MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_DIFF_UNI,
@@ -554,8 +553,8 @@ static void __init armadillo5x0_init(void)
 	usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 			ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-	mxc_register_device(&mxc_otg_host, &usbotg_pdata);
-	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	imx31_add_mxc_ehci_otg(&usbotg_pdata);
+	imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
 #endif
 }
 
arch/arm/mach-mx3/mach-cpuimx35.c +4 -5
index b8b619a..0af1e84 100644
@@ -42,7 +42,6 @@
 #include <mach/common.h>
 #include <mach/iomux-mx35.h>
 #include <mach/mxc_nand.h>
-#include <mach/mxc_ehci.h>
 
 #include "devices-imx35.h"
 #include "devices.h"
@@ -116,12 +115,12 @@ static const struct mxc_nand_platform_data
 	.flash_bbt	= 1,
 };
 
-static struct mxc_usbh_platform_data __maybe_unused otg_pdata = {
+static const struct mxc_usbh_platform_data otg_pdata __initconst = {
 	.portsc	= MXC_EHCI_MODE_UTMI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
 };
 
-static struct mxc_usbh_platform_data __maybe_unused usbh1_pdata = {
+static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
 	.portsc	= MXC_EHCI_MODE_SERIAL,
 	.flags	= MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
 		  MXC_EHCI_IPPUE_DOWN,
@@ -167,11 +166,11 @@ static void __init mxc_board_init(void)
 	imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
 
 	if (otg_mode_host)
-		mxc_register_device(&mxc_otg_host, &otg_pdata);
+		imx35_add_mxc_ehci_otg(&otg_pdata);
 	else
 		imx35_add_fsl_usb2_udc(&otg_device_pdata);
 
-	mxc_register_device(&mxc_usbh1, &usbh1_pdata);
+	imx35_add_mxc_ehci_hs(&usbh1_pdata);
 
 #ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD
 	eukrea_mbimxsd35_baseboard_init();
arch/arm/mach-mx3/mach-mx31lilly.c +4 -5
index 42f47fa..2c59548 100644
@@ -42,7 +42,6 @@
 #include <mach/common.h>
 #include <mach/iomux-mx3.h>
 #include <mach/board-mx31lilly.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include "devices-imx31.h"
@@ -230,13 +229,13 @@ static struct mxc_usbh_platform_data usbotg_pdata = {
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED,
 };
 
-static struct mxc_usbh_platform_data usbh1_pdata = {
+static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
 	.init	= usbh1_init,
 	.portsc	= MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_SINGLE_UNI,
 };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 	.init	= usbh2_init,
 	.portsc	= MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED,
@@ -249,8 +248,8 @@ static void lilly1131_usb_init(void)
 	usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-	mxc_register_device(&mxc_usbh1, &usbh1_pdata);
-	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
+	imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
 }
 
 #else
arch/arm/mach-mx3/mach-mx31lite.c +2 -3
index b938958..9e64c66 100644
@@ -40,7 +40,6 @@
 #include <mach/board-mx31lite.h>
 #include <mach/iomux-mx3.h>
 #include <mach/irqs.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include "devices-imx31.h"
@@ -171,7 +170,7 @@ static int usbh2_init(struct platform_device *pdev)
 	return 0;
 }
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 	.init   = usbh2_init,
 	.portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
 	.flags  = MXC_EHCI_POWER_PINS_ENABLED,
@@ -258,7 +257,7 @@ static void __init mxc_board_init(void)
 	usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
 #endif
 
 	/* SMSC9117 IRQ pin */
arch/arm/mach-mx3/mach-mx31moboard.c +8 -3
index 5e2ee85..203d21a 100644
@@ -40,7 +40,6 @@
 #include <mach/hardware.h>
 #include <mach/iomux-mx3.h>
 #include <mach/ipu.h>
-#include <mach/mxc_ehci.h>
 #include <mach/mx3_camera.h>
 #include <mach/spi.h>
 #include <mach/ulpi.h>
@@ -403,17 +402,23 @@ static void usb_xcvr_reset(void)
 
 #if defined(CONFIG_USB_ULPI)
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 	.portsc	= MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED,
 };
 
 static int __init moboard_usbh2_init(void)
 {
+	struct platform_device *pdev;
+
 	usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 			ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-	return mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
 }
 #else
 static inline int moboard_usbh2_init(void) { return 0; }
arch/arm/mach-mx3/mach-mx35_3ds.c +2 -3
index 6dfdf17..73fb115 100644
@@ -39,7 +39,6 @@
 #include <mach/iomux-mx35.h>
 #include <mach/irqs.h>
 #include <mach/3ds_debugboard.h>
-#include <mach/mxc_ehci.h>
 
 #include "devices-imx35.h"
 #include "devices.h"
@@ -127,7 +126,7 @@ static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = {
 };
 
 /* USB HOST config */
-static struct mxc_usbh_platform_data usb_host_pdata = {
+static const struct mxc_usbh_platform_data usb_host_pdata __initconst = {
 	.portsc		= MXC_EHCI_MODE_SERIAL,
 	.flags		= MXC_EHCI_INTERFACE_SINGLE_UNI |
 			  MXC_EHCI_INTERNAL_PHY,
@@ -147,7 +146,7 @@ static void __init mxc_board_init(void)
 
 	imx35_add_fsl_usb2_udc(&usb_otg_pdata);
 
-	mxc_register_device(&mxc_usbh1, &usb_host_pdata);
+	imx35_add_mxc_ehci_hs(&usb_host_pdata);
 
 	imx35_add_mxc_nand(&mx35pdk_nand_board_info);
 	imx35_add_esdhc(0, NULL);
arch/arm/mach-mx3/mach-pcm037.c +4 -5
index 20f7f94..2d29743 100644
@@ -44,7 +44,6 @@
 #include <mach/ipu.h>
 #include <mach/mx3_camera.h>
 #include <mach/mx3fb.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include "devices-imx31.h"
@@ -538,12 +537,12 @@ static struct platform_device pcm970_sja1000 = {
 };
 
 #if defined(CONFIG_USB_ULPI)
-static struct mxc_usbh_platform_data otg_pdata = {
+static struct mxc_usbh_platform_data otg_pdata __initdata = {
 	.portsc	= MXC_EHCI_MODE_ULPI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
 };
 
-static struct mxc_usbh_platform_data usbh2_pdata = {
+static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
 	.portsc	= MXC_EHCI_MODE_ULPI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
 };
@@ -654,13 +653,13 @@ static void __init mxc_board_init(void)
 		otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-		mxc_register_device(&mxc_otg_host, &otg_pdata);
+		imx31_add_mxc_ehci_otg(&otg_pdata);
 	}
 
 	usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+	imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
 #endif
 	if (!otg_mode_host)
 		imx31_add_fsl_usb2_udc(&otg_device_pdata);
arch/arm/mach-mx3/mach-pcm043.c +4 -5
index 78159f0..f9e7da9 100644
@@ -38,7 +38,6 @@
 #include <mach/iomux-mx35.h>
 #include <mach/ipu.h>
 #include <mach/mx3fb.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 #include <mach/audmux.h>
 
@@ -310,12 +309,12 @@ pcm037_nand_board_info __initconst = {
 };
 
 #if defined(CONFIG_USB_ULPI)
-static struct mxc_usbh_platform_data otg_pdata = {
+static struct mxc_usbh_platform_data otg_pdata __initdata = {
 	.portsc	= MXC_EHCI_MODE_UTMI,
 	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
 };
 
-static struct mxc_usbh_platform_data usbh1_pdata = {
+static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
 	.portsc	= MXC_EHCI_MODE_SERIAL,
 	.flags	= MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
 		  MXC_EHCI_IPPUE_DOWN,
@@ -385,10 +384,10 @@ static void __init mxc_board_init(void)
 		otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 				ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-		mxc_register_device(&mxc_otg_host, &otg_pdata);
+		imx35_add_mxc_ehci_otg(&otg_pdata);
 	}
 
-	mxc_register_device(&mxc_usbh1, &usbh1_pdata);
+	imx35_add_mxc_ehci_hs(&usbh1_pdata);
 #endif
 	if (!otg_mode_host)
 		imx35_add_fsl_usb2_udc(&otg_device_pdata);
arch/arm/mach-mx3/mx31moboard-devboard.c +7 -3
index 331b595..94a0b9e 100644
@@ -24,7 +24,6 @@
 #include <mach/common.h>
 #include <mach/iomux-mx3.h>
 #include <mach/hardware.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include "devices-imx31.h"
@@ -185,7 +184,7 @@ static int devboard_isp1105_set_vbus(struct otg_transceiver *otg, bool on)
 	return 0;
 }
 
-static struct mxc_usbh_platform_data usbh1_pdata = {
+static struct mxc_usbh_platform_data usbh1_pdata __initdata = {
 	.init	= devboard_usbh1_hw_init,
 	.portsc	= MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_SINGLE_UNI,
@@ -194,6 +193,7 @@ static struct mxc_usbh_platform_data usbh1_pdata = {
 static int __init devboard_usbh1_init(void)
 {
 	struct otg_transceiver *otg;
+	struct platform_device *pdev;
 
 	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
 	if (!otg)
@@ -205,7 +205,11 @@ static int __init devboard_usbh1_init(void)
 
 	usbh1_pdata.otg = otg;
 
-	return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
+	pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
 }
 
 
arch/arm/mach-mx3/mx31moboard-marxbot.c +7 -3
index db79f74..a35e8c9 100644
@@ -28,7 +28,6 @@
 #include <mach/hardware.h>
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include <media/soc_camera.h>
@@ -302,7 +301,7 @@ static int marxbot_isp1105_set_vbus(struct otg_transceiver *otg, bool on)
 	return 0;
 }
 
-static struct mxc_usbh_platform_data usbh1_pdata = {
+static struct mxc_usbh_platform_data usbh1_pdata __initdata = {
 	.init	= marxbot_usbh1_hw_init,
 	.portsc	= MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_SINGLE_UNI,
@@ -311,6 +310,7 @@ static struct mxc_usbh_platform_data usbh1_pdata = {
 static int __init marxbot_usbh1_init(void)
 {
 	struct otg_transceiver *otg;
+	struct platform_device *pdev;
 
 	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
 	if (!otg)
@@ -322,7 +322,11 @@ static int __init marxbot_usbh1_init(void)
 
 	usbh1_pdata.otg = otg;
 
-	return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
+	pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
 }
 
 static const struct fsl_usb2_platform_data usb_pdata __initconst = {
arch/arm/mach-mx3/mx31moboard-smartbot.c +8 -3
index 68e8ab5..8e989e5 100644
@@ -27,7 +27,6 @@
 #include <mach/hardware.h>
 #include <mach/iomux-mx3.h>
 #include <mach/board-mx31moboard.h>
-#include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
 #include <media/soc_camera.h>
@@ -125,17 +124,23 @@ static const struct fsl_usb2_platform_data usb_pdata __initconst = {
 
 #if defined(CONFIG_USB_ULPI)
 
-static struct mxc_usbh_platform_data otg_host_pdata = {
+static struct mxc_usbh_platform_data otg_host_pdata __initdata = {
 	.portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
 	.flags	= MXC_EHCI_POWER_PINS_ENABLED,
 };
 
 static int __init smartbot_otg_host_init(void)
 {
+	struct platform_device *pdev;
+
 	otg_host_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
 			ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
-	return mxc_register_device(&mxc_otg_host, &otg_host_pdata);
+	pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
 }
 #else
 static inline int smartbot_otg_host_init(void) { return 0; }
arch/arm/plat-mxc/devices/platform-mxc-ehci.c +16 -0
index 9bec63f..cc488f4 100644
@@ -32,6 +32,22 @@ const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
 };
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
+#ifdef CONFIG_SOC_IMX31
+const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
+const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
+	imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
+	imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
+};
+#endif /* ifdef CONFIG_SOC_IMX31 */
+
+#ifdef CONFIG_SOC_IMX35
+const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
+const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
+	imx_mxc_ehci_data_entry_single(MX35, 1, HS);
+#endif /* ifdef CONFIG_SOC_IMX35 */
+
 struct platform_device *__init imx_add_mxc_ehci(
 		const struct imx_mxc_ehci_data *data,
 		const struct mxc_usbh_platform_data *pdata)
Signature · 1 line
1.7.2.3
#69 lore raw

PATCH 49/51 ARM: mx3: dynamically allocate imx2-wdt devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx3/Kconfig                     |    4 +++
 arch/arm/mach-mx3/devices-imx31.h             |    4 +++
 arch/arm/mach-mx3/devices-imx35.h             |    4 +++
 arch/arm/mach-mx3/devices.c                   |   33 -------------------------
 arch/arm/mach-mx3/devices.h                   |    1 -
 arch/arm/mach-mx3/mach-cpuimx35.c             |    6 +----
 arch/arm/mach-mx3/mach-pcm037.c               |    2 +-
 arch/arm/mach-mx3/mach-pcm043.c               |    2 +-
 arch/arm/mach-mx3/mx31lite-db.c               |    2 +-
 arch/arm/plat-mxc/devices/platform-imx2-wdt.c |   10 +++++++
 10 files changed, 26 insertions(+), 42 deletions(-)
arch/arm/mach-mx3/Kconfig +4 -0
index 1573483..bcfcf9a 100644
@@ -51,6 +51,7 @@ config MACH_PCM037
 	bool "Support Phytec pcm037 (i.MX31) platforms"
 	select SOC_IMX31
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
@@ -75,6 +76,7 @@ config MACH_MX31LITE
 	bool "Support MX31 LITEKIT (LogicPD)"
 	select SOC_IMX31
 	select MXC_ULPI if USB_ULPI
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -143,6 +145,7 @@ config MACH_PCM043
 	bool "Support Phytec pcm043 (i.MX35) platforms"
 	select SOC_IMX35
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -193,6 +196,7 @@ config MACH_EUKREA_CPUIMX35
 	bool "Support Eukrea CPUIMX35 Platform"
 	select SOC_IMX35
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_MXC_EHCI
arch/arm/mach-mx3/devices-imx31.h +4 -0
index 6571dd7..109f0bc 100644
@@ -13,6 +13,10 @@ extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst;
 #define imx31_add_fsl_usb2_udc(pdata)	\
 	imx_add_fsl_usb2_udc(&imx31_fsl_usb2_udc_data, pdata)
 
+extern const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst;
+#define imx31_add_imx2_wdt(pdata)       \
+	imx_add_imx2_wdt(&imx31_imx2_wdt_data)
+
 extern const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst;
 #define imx31_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx31_imx_i2c_data[id], pdata)
arch/arm/mach-mx3/devices-imx35.h +4 -0
index 849c48a..763ee97 100644
@@ -23,6 +23,10 @@ extern const struct imx_flexcan_data imx35_flexcan_data[] __initconst;
 #define imx35_add_flexcan0(pdata)	imx35_add_flexcan(0, pdata)
 #define imx35_add_flexcan1(pdata)	imx35_add_flexcan(1, pdata)
 
+extern const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst;
+#define imx35_add_imx2_wdt(pdata)       \
+	imx_add_imx2_wdt(&imx35_imx2_wdt_data)
+
 extern const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst;
 #define imx35_add_imx_i2c(id, pdata)	\
 	imx_add_imx_i2c(&imx35_imx_i2c_data[id], pdata)
arch/arm/mach-mx3/devices.c +0 -33
index c122c0f..448fe56 100644
@@ -95,19 +95,6 @@ struct platform_device mx3_camera = {
 	},
 };
 
-static struct resource imx_wdt_resources[] = {
-	{
-		.flags = IORESOURCE_MEM,
-	},
-};
-
-struct platform_device imx_wdt_device0 = {
-	.name           = "imx2-wdt",
-	.id             = 0,
-	.num_resources  = ARRAY_SIZE(imx_wdt_resources),
-	.resource       = imx_wdt_resources,
-};
-
 static struct resource imx_rtc_resources[] = {
 	{
 		.start  = MX31_RTC_BASE_ADDR,
@@ -145,23 +132,3 @@ struct platform_device imx_kpp_device = {
 	.num_resources = ARRAY_SIZE(imx_kpp_resources),
 	.resource = imx_kpp_resources,
 };
-
-static int __init mx3_devices_init(void)
-{
-#if defined(CONFIG_ARCH_MX31)
-	if (cpu_is_mx31()) {
-		imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
-		imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
-	}
-#endif
-#if defined(CONFIG_ARCH_MX35)
-	if (cpu_is_mx35()) {
-		imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
-		imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
-	}
-#endif
-
-	return 0;
-}
-
-subsys_initcall(mx3_devices_init);
arch/arm/mach-mx3/devices.h +0 -1
index 1bc2918..2f9f877 100644
@@ -1,6 +1,5 @@
 extern struct platform_device mx3_ipu;
 extern struct platform_device mx3_fb;
 extern struct platform_device mx3_camera;
-extern struct platform_device imx_wdt_device0;
 extern struct platform_device imx_rtc_device0;
 extern struct platform_device imx_kpp_device;
arch/arm/mach-mx3/mach-cpuimx35.c +1 -5
index 0af1e84..dda1988 100644
@@ -72,10 +72,6 @@ static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
 	},
 };
 
-static struct platform_device *devices[] __initdata = {
-	&imx_wdt_device0,
-};
-
 static struct pad_desc eukrea_cpuimx35_pads[] = {
 	/* UART1 */
 	MX35_PAD_CTS1__UART1_CTS,
@@ -156,7 +152,7 @@ static void __init mxc_board_init(void)
 			ARRAY_SIZE(eukrea_cpuimx35_pads));
 
 	imx35_add_fec(NULL);
-	platform_add_devices(devices, ARRAY_SIZE(devices));
+	imx35_add_imx2_wdt(NULL);
 
 	imx35_add_imx_uart0(&uart_pdata);
 	imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info);
arch/arm/mach-mx3/mach-pcm037.c +1 -1
index 2d29743..cb65769 100644
@@ -440,7 +440,6 @@ static int __init pcm037_camera_alloc_dma(const size_t buf_size)
 static struct platform_device *devices[] __initdata = {
 	&pcm037_flash,
 	&pcm037_sram_device,
-	&imx_wdt_device0,
 	&pcm037_mt9t031,
 	&pcm037_mt9v022,
 };
@@ -606,6 +605,7 @@ static void __init mxc_board_init(void)
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
+	imx31_add_imx2_wdt(NULL);
 	imx31_add_imx_uart0(&uart_pdata);
 	/* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */
 	imx31_add_imx_uart1(&uart_pdata);
arch/arm/mach-mx3/mach-pcm043.c +1 -1
index f9e7da9..f2f2fd0 100644
@@ -138,7 +138,6 @@ static struct i2c_board_info pcm043_i2c_devices[] = {
 
 static struct platform_device *devices[] __initdata = {
 	&pcm043_flash,
-	&imx_wdt_device0,
 };
 
 static struct pad_desc pcm043_pads[] = {
@@ -362,6 +361,7 @@ static void __init mxc_board_init(void)
 
 	imx35_add_fec(NULL);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
+	imx35_add_imx2_wdt(NULL);
 
 	imx35_add_imx_uart0(&uart_pdata);
 	imx35_add_mxc_nand(&pcm037_nand_board_info);
arch/arm/mach-mx3/mx31lite-db.c +1 -1
index a06161e..3124ea8 100644
@@ -199,6 +199,6 @@ void __init mx31lite_db_init(void)
 	imx31_add_mxc_mmc(0, &mmc_pdata);
 	imx31_add_spi_imx0(&spi0_pdata);
 	platform_device_register(&litekit_led_device);
-	mxc_register_device(&imx_wdt_device0, NULL);
+	imx31_add_imx2_wdt(NULL);
 	mxc_register_device(&imx_rtc_device0, NULL);
 }
arch/arm/plat-mxc/devices/platform-imx2-wdt.c +10 -0
index bd9c546..e64d474 100644
@@ -31,6 +31,16 @@ const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
 	imx_imx2_wdt_data_entry_single(MX27, SZ_4K);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
+#ifdef CONFIG_SOC_IMX31
+const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst =
+	imx_imx2_wdt_data_entry_single(MX31, SZ_16K);
+#endif /* ifdef CONFIG_SOC_IMX31 */
+
+#ifdef CONFIG_SOC_IMX35
+const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst =
+	imx_imx2_wdt_data_entry_single(MX35, SZ_16K);
+#endif /* ifdef CONFIG_SOC_IMX35 */
+
 struct platform_device *__init imx_add_imx2_wdt(
 		const struct imx_imx2_wdt_data *data)
 {
Signature · 1 line
1.7.2.3
#70 lore raw

PATCH 50/51 ARM: mx3: dynamically allocate imx-keypad devices

In reply to Uwe Kleine-König
---
 arch/arm/mach-mx3/Kconfig                       |    1 +
 arch/arm/mach-mx3/devices-imx31.h               |    4 ++++
 arch/arm/mach-mx3/devices-imx35.h               |    4 ++++
 arch/arm/mach-mx3/devices.c                     |   19 -------------------
 arch/arm/mach-mx3/devices.h                     |    1 -
 arch/arm/mach-mx3/mach-mx31_3ds.c               |    5 ++---
 arch/arm/plat-mxc/devices/platform-imx-keypad.c |   10 ++++++++++
 7 files changed, 21 insertions(+), 23 deletions(-)
arch/arm/mach-mx3/Kconfig +1 -0
index bcfcf9a..84e4788 100644
@@ -91,6 +91,7 @@ config MACH_MX31_3DS
 	select SOC_IMX31
 	select MXC_DEBUG_BOARD
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
+	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_SPI_IMX
arch/arm/mach-mx3/devices-imx31.h +4 -0
index 109f0bc..40f4e84 100644
@@ -24,6 +24,10 @@ extern const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst;
 #define imx31_add_imx_i2c1(pdata)	imx31_add_imx_i2c(1, pdata)
 #define imx31_add_imx_i2c2(pdata)	imx31_add_imx_i2c(2, pdata)
 
+extern const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst;
+#define imx31_add_imx_keypad(pdata)	\
+	imx_add_imx_keypad(&imx31_imx_keypad_data, pdata)
+
 extern const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst;
 #define imx31_add_imx_ssi(id, pdata)    \
 	imx_add_imx_ssi(&imx31_imx_ssi_data[id], pdata)
arch/arm/mach-mx3/devices-imx35.h +4 -0
index 763ee97..c9fdded 100644
@@ -34,6 +34,10 @@ extern const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst;
 #define imx35_add_imx_i2c1(pdata)	imx35_add_imx_i2c(1, pdata)
 #define imx35_add_imx_i2c2(pdata)	imx35_add_imx_i2c(2, pdata)
 
+extern const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst;
+#define imx31_add_imx_keypad(pdata)	\
+	imx_add_imx_keypad(&imx35_imx_keypad_data, pdata)
+
 extern const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst;
 #define imx35_add_imx_ssi(id, pdata)    \
 	imx_add_imx_ssi(&imx35_imx_ssi_data[id], pdata)
arch/arm/mach-mx3/devices.c +0 -19
index 448fe56..b6672db 100644
@@ -113,22 +113,3 @@ struct platform_device imx_rtc_device0 = {
 	.num_resources  = ARRAY_SIZE(imx_rtc_resources),
 	.resource       = imx_rtc_resources,
 };
-
-static struct resource imx_kpp_resources[] = {
-	{
-		.start	= MX3x_KPP_BASE_ADDR,
-		.end	= MX3x_KPP_BASE_ADDR + 0xf,
-		.flags	= IORESOURCE_MEM
-	}, {
-		.start	= MX3x_INT_KPP,
-		.end	= MX3x_INT_KPP,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-struct platform_device imx_kpp_device = {
-	.name = "imx-keypad",
-	.id = -1,
-	.num_resources = ARRAY_SIZE(imx_kpp_resources),
-	.resource = imx_kpp_resources,
-};
arch/arm/mach-mx3/devices.h +0 -1
index 2f9f877..121962c 100644
@@ -2,4 +2,3 @@ extern struct platform_device mx3_ipu;
 extern struct platform_device mx3_fb;
 extern struct platform_device mx3_camera;
 extern struct platform_device imx_rtc_device0;
-extern struct platform_device imx_kpp_device;
arch/arm/mach-mx3/mach-mx31_3ds.c +2 -3
index 1b46f73..3dea407 100644
@@ -22,7 +22,6 @@
 #include <linux/mfd/mc13783.h>
 #include <linux/spi/spi.h>
 #include <linux/regulator/machine.h>
-#include <linux/input/matrix_keypad.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -101,7 +100,7 @@ static const uint32_t mx31_3ds_keymap[] = {
 	KEY(2, 3, KEY_F10),
 };
 
-static struct matrix_keymap_data mx31_3ds_keymap_data = {
+static const struct matrix_keymap_data mx31_3ds_keymap_data __initconst = {
 	.keymap		= mx31_3ds_keymap,
 	.keymap_size	= ARRAY_SIZE(mx31_3ds_keymap),
 };
@@ -245,7 +244,7 @@ static void __init mxc_board_init(void)
 	spi_register_board_info(mx31_3ds_spi_devs,
 						ARRAY_SIZE(mx31_3ds_spi_devs));
 
-	mxc_register_device(&imx_kpp_device, &mx31_3ds_keymap_data);
+	imx31_add_imx_keypad(&mx31_3ds_keymap_data);
 
 	mx31_3ds_usbotg_init();
 	imx31_add_fsl_usb2_udc(&usbotg_pdata);
arch/arm/plat-mxc/devices/platform-imx-keypad.c +10 -0
index 5f3b367..40238f0 100644
@@ -31,6 +31,16 @@ const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
 	imx_imx_keypad_data_entry_single(MX27, SZ_16);
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
+#ifdef CONFIG_SOC_IMX31
+const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst =
+	imx_imx_keypad_data_entry_single(MX31, SZ_16);
+#endif /* ifdef CONFIG_SOC_IMX31 */
+
+#ifdef CONFIG_SOC_IMX35
+const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
+	imx_imx_keypad_data_entry_single(MX35, SZ_16);
+#endif /* ifdef CONFIG_SOC_IMX35 */
+
 struct platform_device *__init imx_add_imx_keypad(
 		const struct imx_imx_keypad_data *data,
 		const struct matrix_keymap_data *pdata)
Signature · 1 line
1.7.2.3
#71 lore raw

PATCH 51/51 ARM: mx3/mx35_3ds: Add watchdog support

In reply to Uwe Kleine-König

This bases on a patch by Fabio Estevam who added the device before it was allocated dynamically.

---
 arch/arm/mach-mx3/Kconfig         |    1 +
 arch/arm/mach-mx3/mach-mx35_3ds.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/Kconfig +1 -0
index 84e4788..8df139f 100644
@@ -178,6 +178,7 @@ config MACH_MX35_3DS
 	select MXC_DEBUG_BOARD
 	select IMX_HAVE_PLATFORM_ESDHC
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
 	select IMX_HAVE_PLATFORM_MXC_NAND
arch/arm/mach-mx3/mach-mx35_3ds.c +1 -0
index 73fb115..d5ca7ea 100644
@@ -140,6 +140,7 @@ static void __init mxc_board_init(void)
 	mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
 
 	imx35_add_fec(NULL);
+	imx35_add_imx2_wdt(NULL);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
 	imx35_add_imx_uart0(&uart_pdata);
Signature · 1 line
1.7.2.3
#72 lore raw

cover some more imx patches for 2.6.38

In reply to Uwe Kleine-König

Hi Uwe,

2010/11/18 Uwe Kleine-K?nig <[email protected]>:

Quoted 5 lines

Hello,

Some of the patches in this series are already in Sascha's tree, I resend them because several of them got minor fixes.

Quoted 9 lines

The highlights are that for most devices for i.MX1, i.MX21, i.MX25 and i.MX27 are allocated dynamically which reduces the memory footprint of the kernel. ?Moreover I moved support for i.MX25 to mach-imx targeting a multi-SoC-kernel for i.MX.

Later I want to do the same for mx3. ?I'm not sure about mx5 though. The discussion about integrating support for i.MX28 into mach-imx made me questioning if this is sensible. ?Well, we'll see.

You are moving mach-mx25 into mach-imx, will do the same for mx3, and thinking about the same for mx5. But you are asking me to move mx28 out of mach-imx. This only makes sense for me if you think mx28 will not go into mach-imx forever. Are you sure about this? Otherwise we are doing something really bothering ourselves.

Signature · 2 lines
Regards,
Shawn
#73 lore raw

cover some more imx patches for 2.6.38

Hello Shawn,

Quoted 17 lines · Shawn Guo

Hi Uwe,

2010/11/18 Uwe Kleine-K?nig <[email protected]>:

Quoted 5 lines

Hello,

Some of the patches in this series are already in Sascha's tree, I resend them because several of them got minor fixes.

Quoted 9 lines

The highlights are that for most devices for i.MX1, i.MX21, i.MX25 and i.MX27 are allocated dynamically which reduces the memory footprint of the kernel. ?Moreover I moved support for i.MX25 to mach-imx targeting a multi-SoC-kernel for i.MX.

Later I want to do the same for mx3. ?I'm not sure about mx5 though. The discussion about integrating support for i.MX28 into mach-imx made me questioning if this is sensible. ?Well, we'll see.

Quoted 5 lines

You are moving mach-mx25 into mach-imx, will do the same for mx3, and thinking about the same for mx5. But you are asking me to move mx28 out of mach-imx. This only makes sense for me if you think mx28 will not go into mach-imx forever. Are you sure about this? Otherwise we are doing something really bothering ourselves.

Yes, I think i.MX28 will never fit into mach-imx.

Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
maintainer
#74 lore raw

cover some more imx patches for 2.6.38

In reply to Shawn Guo
Quoted 17 lines · Shawn Guo

Hi Uwe,

2010/11/18 Uwe Kleine-K?nig <[email protected]>:

Quoted 5 lines

Hello,

Some of the patches in this series are already in Sascha's tree, I resend them because several of them got minor fixes.

Quoted 9 lines

The highlights are that for most devices for i.MX1, i.MX21, i.MX25 and i.MX27 are allocated dynamically which reduces the memory footprint of the kernel. ?Moreover I moved support for i.MX25 to mach-imx targeting a multi-SoC-kernel for i.MX.

Later I want to do the same for mx3. ?I'm not sure about mx5 though. The discussion about integrating support for i.MX28 into mach-imx made me questioning if this is sensible. ?Well, we'll see.

Quoted 5 lines

You are moving mach-mx25 into mach-imx, will do the same for mx3, and thinking about the same for mx5. But you are asking me to move mx28 out of mach-imx. This only makes sense for me if you think mx28 will not go into mach-imx forever. Are you sure about this? Otherwise we are doing something really bothering ourselves.

All i.MX (not i.MX23/28) share the same irq code, timer code, gpio code, iomuxer code and audio muxer code; admittedly in different variants. So it makes sense to put them together. All the i.MX28 has in common with the other i.MX is the fec, which is under drivers/net anyway. If we start to put i.MX23/28 into mach-imx we could equally well start to put mach-s3c or whatever there, too.
I know that it's technically possible to do this, and I also think that it's possible in a performance friendly way, but at this point it starts to get an architecture wide ARM problem and not a mach-* problem anymore.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#75 lore raw

cover some more imx patches for 2.6.38

In reply to Uwe Kleine-König

Hi Uwe,

Quoted 5 lines · Uwe Kleine-K?nig

The highlights are that for most devices for i.MX1, i.MX21, i.MX25 and i.MX27 are allocated dynamically which reduces the memory footprint of the kernel. Moreover I moved support for i.MX25 to mach-imx targeting a multi-SoC-kernel for i.MX.

do you have numbers concerning the memory footprint savings ?

Thanks
Eric

#76 lore raw

cover some more imx patches for 2.6.38

Quoted 7 lines · Eric B?nard
Quoted 5 lines · Uwe Kleine-K?nig

The highlights are that for most devices for i.MX1, i.MX21, i.MX25 and i.MX27 are allocated dynamically which reduces the memory footprint of the kernel. Moreover I moved support for i.MX25 to mach-imx targeting a multi-SoC-kernel for i.MX.

do you have numbers concerning the memory footprint savings ?

I didn't recently and didn't save the results. Taking commit "ARM: mx3:
dynamically allocate imx-keypad devices" (which is very low impact because it only removes a single static device with just one user (arch/arm/mach-mx3/mach-mx31_3ds.c) bloat-o-meter reports:

add/remove: 3/2 grow/shrink: 0/0 up/down: 164/-264 (-100)
function old new delta
imx_add_imx_keypad - 140 +140
imx35_imx_keypad_data - 12 +12
imx31_imx_keypad_data - 12 +12
imx_kpp_resources 56 - -56
imx_kpp_device 208 - -208

And there are some more things bloat-o-meter doesn't catch:

- imx_add_imx_keypad, imx35_imx_keypad_data and imx31_imx_keypad_data all live in .init.text and .init.rodata, so after boot another 164 bytes are freed.
- platform data (here mx31_3ds_keymap_data) can be moved to .init.data (or .init.rodata) This saves in general at least (#machines_using_the_device - 1) * sizeof(platform data) when the init data is discarded.
- Of course when booting an mx31_3ds machine imx_kpp_device and imx_kpp_resources reappear in memory, so the main benefit is for devices that are not used on many machines. So for mx31_3ds this patch yields +/-0.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#77 lore raw

cover some more imx patches for 2.6.38

In reply to Uwe Kleine-König

Hello,

Quoted 2 lines · Uwe Kleine-K?nig

Some of the patches in this series are already in Sascha's tree, I resend them because several of them got minor fixes.

I fixed a few things found by checkpatch.

In total the changes are:

arch/arm/mach-imx/mach-mx25_3ds.c +1 -1
index f07d3d7..328e1af 100644
@@ -105,7 +105,7 @@ static struct pad_desc mx25pdk_pads[] = {
 };
 
 static const struct fec_platform_data mx25_fec_pdata __initconst = {
-	.phy    = PHY_INTERFACE_MODE_RMII,
+        .phy    = PHY_INTERFACE_MODE_RMII,
 };
 
 #define FEC_ENABLE_GPIO		35
arch/arm/plat-mxc/devices/platform-imx2-wdt.c +1 -1
index c61bd4e..e64d474 100644
@@ -23,7 +23,7 @@ const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst =
-	imx_imx2_wdt_data_entry_single(MX25, SZ_16K);
+        imx_imx2_wdt_data_entry_single(MX25, SZ_16K);
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
arch/arm/plat-mxc/devices/platform-mxc_rnga.c +1 -1
index b4b7612..7363ad7 100644
@@ -42,7 +42,7 @@ static int __init imxXX_add_mxc_rnga(void)
 	struct platform_device *ret;
 
 #if defined(CONFIG_SOC_IMX31)
-	if (cpu_is_mx31())
+	if (cpu_is_mx31()) 
 		ret = imx_add_mxc_rnga(&imx31_mxc_rnga_data);
 	else
 #endif /* if defined(CONFIG_SOC_IMX31) */

I folded it in the introducing patches. I think it's not worth to resend the new patches, but I can do if you really want.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |