Skip to contentSkip to conversation

mach-mxs header files cleanup

PATCH New Shawn Guo 4 participants 16 messages Mar 29, 2013 – Apr 1, 2013

Subsystems (12)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

cover mach-mxs header files cleanup

The series cleans up mach-mxs headers files in order to support multiplatform build on mxs.

Andrew, Jonathan, Mark,

Can you please give your ACK on the patch you are copied, so that the series can go via arm-soc as a whole? Thanks.

Shawn

Shawn Guo (13):
rtc: stmp3xxx: use stmp_reset_block() instead
iio: mxs-lradc: remove unneeded mach header inclusion
ASoC: mxs-saif: remove mach header inclusion
ARM: mxs: remove empty hardware.h
ARM: mxs: get reset address from device tree
ARM: mxs: remove system.c
ARM: mxs: get ocotp base address from device tree
ARM: mxs: use debug_ll_io_init for low-level debug
ARM: mxs: remove mm.c
ARM: mxs: move mxs_get_ocotp() into mach-mxs.c
ARM: mxs: remove common.h
ARM: mxs: merge imx23 and imx28 into one machine_desc
ARM: mxs: remove unused headers

 arch/arm/boot/dts/imx23.dtsi                 |    3 +-
 arch/arm/boot/dts/imx28.dtsi                 |    3 +-
 arch/arm/mach-mxs/Makefile                   |    4 -
 arch/arm/mach-mxs/include/mach/common.h      |   25 ---
 arch/arm/mach-mxs/include/mach/debug-macro.S |    9 +-
 arch/arm/mach-mxs/include/mach/digctl.h      |   22 ---
 arch/arm/mach-mxs/include/mach/hardware.h    |   23 ---
 arch/arm/mach-mxs/include/mach/mx23.h        |  169 -------------------
 arch/arm/mach-mxs/include/mach/mx28.h        |  225 --------------------------
 arch/arm/mach-mxs/include/mach/mxs.h         |  116 -------------
 arch/arm/mach-mxs/mach-mxs.c                 |  182 +++++++++++++++++----
 arch/arm/mach-mxs/mm.c                       |   52 ------
 arch/arm/mach-mxs/ocotp.c                    |   93 -----------
 arch/arm/mach-mxs/system.c                   |  139 ----------------
 drivers/rtc/rtc-stmp3xxx.c                   |    6 +-
 drivers/staging/iio/adc/mxs-lradc.c          |    3 -
 include/linux/clk/mxs.h                      |   16 ++
 sound/soc/mxs/mxs-saif.c                     |    5 +-
 18 files changed, 180 insertions(+), 915 deletions(-)
 delete mode 100644 arch/arm/mach-mxs/include/mach/common.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/digctl.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/hardware.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/mx23.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/mx28.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/mxs.h
 delete mode 100644 arch/arm/mach-mxs/mm.c
 delete mode 100644 arch/arm/mach-mxs/ocotp.c
 delete mode 100644 arch/arm/mach-mxs/system.c
 create mode 100644 include/linux/clk/mxs.h
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/13 rtc: stmp3xxx: use stmp_reset_block() instead

The function stmp_reset_block() provides the exactly same functionality as mxs_reset_block(). So use stmp_reset_block() instead, so that <mach/common.h> inclusion can be removed.

Cc Andrew Morton <[email protected]>
Cc rtc-linux at googlegroups.com
---
 drivers/rtc/rtc-stmp3xxx.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/rtc/rtc-stmp3xxx.c +2 -4
index 98f0d3c..67d2612 100644
@@ -30,8 +30,6 @@
 #include <linux/stmp_device.h>
 #include <linux/stmp3xxx_rtc_wdt.h>
 
-#include <mach/common.h>
-
 #define STMP3XXX_RTC_CTRL			0x0
 #define STMP3XXX_RTC_CTRL_SET			0x4
 #define STMP3XXX_RTC_CTRL_CLR			0x8
@@ -271,7 +269,7 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, rtc_data);
 
-	mxs_reset_block(rtc_data->io);
+	stmp_reset_block(rtc_data->io);
 	writel(STMP3XXX_RTC_PERSISTENT0_ALARM_EN |
 			STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE_EN |
 			STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE,
@@ -319,7 +317,7 @@ static int stmp3xxx_rtc_resume(struct platform_device *dev)
 {
 	struct stmp3xxx_rtc_data *rtc_data = platform_get_drvdata(dev);
 
-	mxs_reset_block(rtc_data->io);
+	stmp_reset_block(rtc_data->io);
 	writel(STMP3XXX_RTC_PERSISTENT0_ALARM_EN |
 			STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE_EN |
 			STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE,
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/13 iio: mxs-lradc: remove unneeded mach header inclusion

In reply to Shawn Guo

Headers <mach/mxs.h> and <mach/common.h> are not used in the driver at all. Removed the inclusions.

Cc Jonathan Cameron <[email protected]>
Cc linux-iio at vger.kernel.org
---
 drivers/staging/iio/adc/mxs-lradc.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +0 -3
index 55a459b..0eb5b4d 100644
@@ -36,9 +36,6 @@
 #include <linux/delay.h>
 #include <linux/input.h>
 
-#include <mach/mxs.h>
-#include <mach/common.h>
-
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/trigger.h>
Signature · 1 line
1.7.9.5
maintainer
#3 lore raw

PATCH 2/13 iio: mxs-lradc: remove unneeded mach header inclusion

Quoted 6 lines · Shawn Guo

Headers <mach/mxs.h> and <mach/common.h> are not used in the driver at all. Removed the inclusions.

Thanks

Quoted 19 lines
---
 drivers/staging/iio/adc/mxs-lradc.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +0 -3
index 55a459b..0eb5b4d 100644
@@ -36,9 +36,6 @@
 #include <linux/delay.h>
 #include <linux/input.h>
 
-#include <mach/mxs.h>
-#include <mach/common.h>
-
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/trigger.h>
#4 lore raw

PATCH 3/13 ASoC: mxs-saif: remove mach header inclusion

In reply to Shawn Guo

The header <mach/hardware.h> is not needed at all, and <mach/mxs.h> is needed only for macros MXS_SET_ADDR and MXS_CLR_ADDR. Define the macros and remove the mach header inclusions.

---
 sound/soc/mxs/mxs-saif.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/mxs/mxs-saif.c +3 -2
index 3a2aa1d..41a6136 100644
@@ -33,11 +33,12 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
-#include <mach/mxs.h>
 
 #include "mxs-saif.h"
 
+#define MXS_SET_ADDR	0x4
+#define MXS_CLR_ADDR	0x8
+
 static struct mxs_saif *mxs_saif[2];
 
 /*
Signature · 1 line
1.7.9.5
Acked-by on v1 3/13
#5 lore raw

Re: [PATCH 03/13] ASoC: mxs-saif: remove mach header inclusion

Quoted 3 lines · Shawn Guo

The header <mach/hardware.h> is not needed at all, and <mach/mxs.h> is needed only for macros MXS_SET_ADDR and MXS_CLR_ADDR. Define the macros and remove the mach header inclusions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130401/d2f41cdb/attachment-0001.sig>

#6 lore raw

PATCH 4/13 ARM: mxs: remove empty hardware.h

In reply to Shawn Guo

The hardware.h is an empty header and used nowhere now. Remmove it.

---
 arch/arm/mach-mxs/include/mach/hardware.h |   23 -----------------------
 arch/arm/mach-mxs/include/mach/mxs.h      |    1 -
 2 files changed, 24 deletions(-)
 delete mode 100644 arch/arm/mach-mxs/include/mach/hardware.h
arch/arm/mach-mxs/include/mach/hardware.h deleted +0 -23
deleted file mode 100644
index 4c0e8a6..0000000
@@ -1,23 +0,0 @@
-/*
- * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2008 Juergen Beisert, kernel at pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-
-#ifndef __MACH_MXS_HARDWARE_H__
-#define __MACH_MXS_HARDWARE_H__
-
-#endif /* __MACH_MXS_HARDWARE_H__ */
arch/arm/mach-mxs/include/mach/mxs.h +0 -1
index a9be80a..5820b04 100644
@@ -23,7 +23,6 @@
 #include <linux/io.h>
 #endif
 #include <mach/digctl.h>
-#include <mach/hardware.h>
 
 /*
  * IO addresses common to MXS-based
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 5/13 ARM: mxs: get reset address from device tree

In reply to Shawn Guo

Instead of using static address definition, get reset address from device tree with mapping, so that core_initcall mxs_arch_reset_init() can be killed.

The "rtc" clock code in mxs_arch_reset_init() seems to be zombie, since there is no clk lookup defined in clock driver at all. Remove it together.

---
 arch/arm/boot/dts/imx23.dtsi |    2 +-
 arch/arm/boot/dts/imx28.dtsi |    2 +-
 arch/arm/mach-mxs/system.c   |   36 +++++++++++++++++-------------------
 3 files changed, 19 insertions(+), 21 deletions(-)
arch/arm/boot/dts/imx23.dtsi +1 -1
index 8d37aa7..30b410b 100644
@@ -361,7 +361,7 @@
 			ranges;
 
 			clks: clkctrl at 80040000 {
-				compatible = "fsl,imx23-clkctrl";
+				compatible = "fsl,imx23-clkctrl", "fsl,clkctrl";
 				reg = <0x80040000 0x2000>;
 				#clock-cells = <1>;
 			};
arch/arm/boot/dts/imx28.dtsi +1 -1
index d306ff5..56d84bf 100644
@@ -756,7 +756,7 @@
 			ranges;
 
 			clks: clkctrl at 80040000 {
-				compatible = "fsl,imx28-clkctrl";
+				compatible = "fsl,imx28-clkctrl", "fsl,clkctrl";
 				reg = <0x80040000 0x2000>;
 				#clock-cells = <1>;
 			};
arch/arm/mach-mxs/system.c +17 -19
index 30042e2..2d64ee9 100644
@@ -23,6 +23,8 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 
 #include <asm/proc-fns.h>
 #include <asm/system_misc.h>
@@ -37,41 +39,37 @@
 #define MXS_MODULE_CLKGATE		(1 << 30)
 #define MXS_MODULE_SFTRST		(1 << 31)
 
-static void __iomem *mxs_clkctrl_reset_addr;
-
 /*
  * Reset the system. It is called by machine_restart().
  */
 void mxs_restart(char mode, const char *cmd)
 {
+	struct device_node *np;
+	void __iomem *reset_addr;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,clkctrl");
+	reset_addr = of_iomap(np, 0);
+	if (!reset_addr)
+		goto soft;
+
+	if (of_device_is_compatible(np, "fsl,imx23-clkctrl"))
+		reset_addr += MX23_CLKCTRL_RESET_OFFSET;
+	else
+		reset_addr += MX28_CLKCTRL_RESET_OFFSET;
+
 	/* reset the chip */
-	__mxs_setl(MXS_CLKCTRL_RESET_CHIP, mxs_clkctrl_reset_addr);
+	__mxs_setl(MXS_CLKCTRL_RESET_CHIP, reset_addr);
 
 	pr_err("Failed to assert the chip reset\n");
 
 	/* Delay to allow the serial port to show the message */
 	mdelay(50);
 
+soft:
 	/* We'll take a jump through zero as a poor second */
 	soft_restart(0);
 }
 
-static int __init mxs_arch_reset_init(void)
-{
-	struct clk *clk;
-
-	mxs_clkctrl_reset_addr = MXS_IO_ADDRESS(MXS_CLKCTRL_BASE_ADDR) +
-				(cpu_is_mx23() ? MX23_CLKCTRL_RESET_OFFSET :
-						 MX28_CLKCTRL_RESET_OFFSET);
-
-	clk = clk_get_sys("rtc", NULL);
-	if (!IS_ERR(clk))
-		clk_prepare_enable(clk);
-
-	return 0;
-}
-core_initcall(mxs_arch_reset_init);
-
 /*
  * Clear the bit and poll it cleared.  This is usually called with
  * a reset address and mask being either SFTRST(bit 31) or CLKGATE
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 6/13 ARM: mxs: remove system.c

In reply to Shawn Guo

There is no user of function mxs_reset_block() now. Let's move mxs_restart() into mach-mxs.c as a static function and remove system.c completely.

---
 arch/arm/mach-mxs/Makefile              |    2 +-
 arch/arm/mach-mxs/include/mach/common.h |    2 -
 arch/arm/mach-mxs/mach-mxs.c            |   37 +++++++++
 arch/arm/mach-mxs/system.c              |  137 -------------------------------
 4 files changed, 38 insertions(+), 140 deletions(-)
 delete mode 100644 arch/arm/mach-mxs/system.c
arch/arm/mach-mxs/Makefile +1 -1
index b934603..5339973 100644
@@ -1,5 +1,5 @@
 # Common support
-obj-y := ocotp.o system.o mm.o
+obj-y := ocotp.o mm.o
 
 obj-$(CONFIG_PM) += pm.o
 
arch/arm/mach-mxs/include/mach/common.h +0 -2
index df2a4ef..b7946a6 100644
@@ -12,8 +12,6 @@
 #define __MACH_MXS_COMMON_H__
 
 extern const u32 *mxs_get_ocotp(void);
-extern int mxs_reset_block(void __iomem *);
-extern void mxs_restart(char, const char *);
 extern int mxs_saif_clkmux_select(unsigned int clkmux);
 
 extern int mx23_clocks_init(void);
arch/arm/mach-mxs/mach-mxs.c +37 -0
index 79a5ce4..a8fe453 100644
@@ -22,11 +22,13 @@
 #include <linux/irqchip/mxs.h>
 #include <linux/micrel_phy.h>
 #include <linux/mxsfb.h>
+#include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/phy.h>
 #include <linux/pinctrl/consumer.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
+#include <asm/system_misc.h>
 #include <mach/common.h>
 #include <mach/digctl.h>
 #include <mach/mxs.h>
@@ -459,6 +461,41 @@ static void __init mxs_machine_init(void)
 		imx28_evk_post_init();
 }
 
+#define MX23_CLKCTRL_RESET_OFFSET	0x120
+#define MX28_CLKCTRL_RESET_OFFSET	0x1e0
+#define MXS_CLKCTRL_RESET_CHIP		(1 << 1)
+
+/*
+ * Reset the system. It is called by machine_restart().
+ */
+static void mxs_restart(char mode, const char *cmd)
+{
+	struct device_node *np;
+	void __iomem *reset_addr;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,clkctrl");
+	reset_addr = of_iomap(np, 0);
+	if (!reset_addr)
+		goto soft;
+
+	if (of_device_is_compatible(np, "fsl,imx23-clkctrl"))
+		reset_addr += MX23_CLKCTRL_RESET_OFFSET;
+	else
+		reset_addr += MX28_CLKCTRL_RESET_OFFSET;
+
+	/* reset the chip */
+	__mxs_setl(MXS_CLKCTRL_RESET_CHIP, reset_addr);
+
+	pr_err("Failed to assert the chip reset\n");
+
+	/* Delay to allow the serial port to show the message */
+	mdelay(50);
+
+soft:
+	/* We'll take a jump through zero as a poor second */
+	soft_restart(0);
+}
+
 static const char *imx23_dt_compat[] __initdata = {
 	"fsl,imx23",
 	NULL,
arch/arm/mach-mxs/system.c deleted +0 -137

137 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 7/13 ARM: mxs: get ocotp base address from device tree

In reply to Shawn Guo

Instead of using the static definitions, get ocotp base address from device tree with mapping.

---
 arch/arm/boot/dts/imx23.dtsi |    1 +
 arch/arm/boot/dts/imx28.dtsi |    1 +
 arch/arm/mach-mxs/ocotp.c    |    9 ++++++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx23.dtsi +1 -0
index 30b410b..ad2d793 100644
@@ -322,6 +322,7 @@
 			};
 
 			ocotp at 8002c000 {
+				compatible = "fsl,ocotp";
 				reg = <0x8002c000 0x2000>;
 				status = "disabled";
 			};
arch/arm/boot/dts/imx28.dtsi +1 -0
index 56d84bf..64af238 100644
@@ -677,6 +677,7 @@
 			};
 
 			ocotp at 8002c000 {
+				compatible = "fsl,ocotp";
 				reg = <0x8002c000 0x2000>;
 				status = "disabled";
 			};
arch/arm/mach-mxs/ocotp.c +8 -1
index 1dff467..c2002eb 100644
@@ -15,6 +15,8 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 
 #include <asm/processor.h>	/* for cpu_relax() */
 
@@ -33,7 +35,8 @@ static u32 ocotp_words[OCOTP_WORD_COUNT];
 
 const u32 *mxs_get_ocotp(void)
 {
-	void __iomem *ocotp_base = MXS_IO_ADDRESS(MXS_OCOTP_BASE_ADDR);
+	struct device_node *np;
+	void __iomem *ocotp_base;
 	int timeout = 0x400;
 	size_t i;
 	static int once = 0;
@@ -41,6 +44,10 @@ const u32 *mxs_get_ocotp(void)
 	if (once)
 		return ocotp_words;
 
+	np = of_find_compatible_node(NULL, NULL, "fsl,ocotp");
+	ocotp_base = of_iomap(np, 0);
+	WARN_ON(!ocotp_base);
+
 	mutex_lock(&ocotp_mutex);
 
 	/*
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 8/13 ARM: mxs: use debug_ll_io_init for low-level debug

In reply to Shawn Guo

The only user of the static mapping done in mx23_map_io and mx28_map_io is low-level debug now. Use debug_ll_io_init() instead, so that the static mapping is used nowhere and can be removed completely later.

---
 arch/arm/mach-mxs/include/mach/debug-macro.S |    9 +++------
 arch/arm/mach-mxs/mach-mxs.c                 |    5 +++--
 2 files changed, 6 insertions(+), 8 deletions(-)
arch/arm/mach-mxs/include/mach/debug-macro.S +3 -6
index 90c6b78..d869515 100644
@@ -11,16 +11,13 @@
  *
  */
 
-#include <mach/mx23.h>
-#include <mach/mx28.h>
-
 #ifdef CONFIG_DEBUG_IMX23_UART
-#define UART_PADDR	MX23_DUART_BASE_ADDR
+#define UART_PADDR	0x80070000
 #elif defined (CONFIG_DEBUG_IMX28_UART)
-#define UART_PADDR	MX28_DUART_BASE_ADDR
+#define UART_PADDR	0x80074000
 #endif
 
-#define UART_VADDR	MXS_IO_ADDRESS(UART_PADDR)
+#define UART_VADDR	0xfe100000
 
 		.macro	addruart, rp, rv, tmp
 		ldr	\rp, =UART_PADDR	@ physical
arch/arm/mach-mxs/mach-mxs.c +3 -2
index a8fe453..cf73976 100644
@@ -27,6 +27,7 @@
 #include <linux/phy.h>
 #include <linux/pinctrl/consumer.h>
 #include <asm/mach/arch.h>
+#include <asm/mach/map.h>
 #include <asm/mach/time.h>
 #include <asm/system_misc.h>
 #include <mach/common.h>
@@ -507,7 +508,7 @@ static const char *imx28_dt_compat[] __initdata = {
 };
 
 DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)")
-	.map_io		= mx23_map_io,
+	.map_io		= debug_ll_io_init,
 	.init_irq	= irqchip_init,
 	.handle_irq	= icoll_handle_irq,
 	.init_time	= imx23_timer_init,
@@ -517,7 +518,7 @@ DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)")
 MACHINE_END
 
 DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
-	.map_io		= mx28_map_io,
+	.map_io		= debug_ll_io_init,
 	.init_irq	= irqchip_init,
 	.handle_irq	= icoll_handle_irq,
 	.init_time	= imx28_timer_init,
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 9/13 ARM: mxs: remove mm.c

In reply to Shawn Guo

The static mapping is used nowhere now. Hence mm.c can be removed completely.

---
 arch/arm/mach-mxs/Makefile              |    2 +-
 arch/arm/mach-mxs/include/mach/common.h |    2 --
 arch/arm/mach-mxs/mm.c                  |   52 -------------------------------
 3 files changed, 1 insertion(+), 55 deletions(-)
 delete mode 100644 arch/arm/mach-mxs/mm.c
arch/arm/mach-mxs/Makefile +1 -1
index 5339973..2568d24 100644
@@ -1,5 +1,5 @@
 # Common support
-obj-y := ocotp.o mm.o
+obj-y := ocotp.o
 
 obj-$(CONFIG_PM) += pm.o
 
arch/arm/mach-mxs/include/mach/common.h +0 -2
index b7946a6..79cb572 100644
@@ -15,9 +15,7 @@ extern const u32 *mxs_get_ocotp(void);
 extern int mxs_saif_clkmux_select(unsigned int clkmux);
 
 extern int mx23_clocks_init(void);
-extern void mx23_map_io(void);
 
 extern int mx28_clocks_init(void);
-extern void mx28_map_io(void);
 
 #endif /* __MACH_MXS_COMMON_H__ */
arch/arm/mach-mxs/mm.c deleted +0 -52

52 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 10/13 ARM: mxs: move mxs_get_ocotp() into mach-mxs.c

In reply to Shawn Guo

All the users of mxs_get_ocotp() are in mach-mxs.c. Move the function into mach-mxs.c, make it a static function, and then remove ocotp.c.

---
 arch/arm/mach-mxs/Makefile              |    4 --
 arch/arm/mach-mxs/include/mach/common.h |    1 -
 arch/arm/mach-mxs/mach-mxs.c            |   76 +++++++++++++++++++++++
 arch/arm/mach-mxs/ocotp.c               |  100 -------------------------------
 4 files changed, 76 insertions(+), 105 deletions(-)
 delete mode 100644 arch/arm/mach-mxs/ocotp.c
arch/arm/mach-mxs/Makefile +0 -4
index 2568d24..80db726 100644
@@ -1,6 +1,2 @@
-# Common support
-obj-y := ocotp.o
-
 obj-$(CONFIG_PM) += pm.o
-
 obj-$(CONFIG_MACH_MXS_DT) += mach-mxs.o
arch/arm/mach-mxs/include/mach/common.h +0 -1
index 79cb572..aca982c 100644
@@ -11,7 +11,6 @@
 #ifndef __MACH_MXS_COMMON_H__
 #define __MACH_MXS_COMMON_H__
 
-extern const u32 *mxs_get_ocotp(void);
 extern int mxs_saif_clkmux_select(unsigned int clkmux);
 
 extern int mx23_clocks_init(void);
arch/arm/mach-mxs/mach-mxs.c +76 -0

82 lines not on this page · raw message

arch/arm/mach-mxs/ocotp.c deleted +0 -100

100 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#13 lore raw

PATCH 11/13 ARM: mxs: remove common.h

In reply to Shawn Guo

All three remaining functions declared in common.h are implemented by clock driver. Create header include/linux/clk/mxs.h to contain them and remove common.h.

---
 arch/arm/mach-mxs/include/mach/common.h |   20 --------------------
 arch/arm/mach-mxs/mach-mxs.c            |    2 +-
 include/linux/clk/mxs.h                 |   16 ++++++++++++++++
 3 files changed, 17 insertions(+), 21 deletions(-)
 delete mode 100644 arch/arm/mach-mxs/include/mach/common.h
 create mode 100644 include/linux/clk/mxs.h
arch/arm/mach-mxs/include/mach/common.h deleted +0 -20
deleted file mode 100644
index aca982c..0000000
@@ -1,20 +0,0 @@
-/*
- * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-
-/*
- * 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.
- */
-
-#ifndef __MACH_MXS_COMMON_H__
-#define __MACH_MXS_COMMON_H__
-
-extern int mxs_saif_clkmux_select(unsigned int clkmux);
-
-extern int mx23_clocks_init(void);
-
-extern int mx28_clocks_init(void);
-
-#endif /* __MACH_MXS_COMMON_H__ */
arch/arm/mach-mxs/mach-mxs.c +1 -1
index f442b39..19f732f 100644
@@ -11,6 +11,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/clk/mxs.h>
 #include <linux/clkdev.h>
 #include <linux/clocksource.h>
 #include <linux/can/platform/flexcan.h>
@@ -30,7 +31,6 @@
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 #include <asm/system_misc.h>
-#include <mach/common.h>
 #include <mach/digctl.h>
 #include <mach/mxs.h>
 
include/linux/clk/mxs.h new file +16 -0
new file mode 100644
index 0000000..90c30dc
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __LINUX_CLK_MXS_H
+#define __LINUX_CLK_MXS_H
+
+int mx23_clocks_init(void);
+int mx28_clocks_init(void);
+int mxs_saif_clkmux_select(unsigned int clkmux);
+
+#endif
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH 12/13 ARM: mxs: merge imx23 and imx28 into one machine_desc

In reply to Shawn Guo

Most of the function hooks are same between imx23 and imx28 machine_desc, so merge them into one.

---
 arch/arm/mach-mxs/mach-mxs.c |   43 +++++++++++++-----------------------------
 1 file changed, 13 insertions(+), 30 deletions(-)
arch/arm/mach-mxs/mach-mxs.c +13 -30
index 19f732f..b74f450 100644
@@ -181,18 +181,6 @@ static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = {
 	{ /* sentinel */ }
 };
 
-static void __init imx23_timer_init(void)
-{
-	mx23_clocks_init();
-	clocksource_of_init();
-}
-
-static void __init imx28_timer_init(void)
-{
-	mx28_clocks_init();
-	clocksource_of_init();
-}
-
 #define OCOTP_WORD_OFFSET		0x20
 #define OCOTP_WORD_COUNT		0x20
 
@@ -573,32 +561,27 @@ soft:
 	soft_restart(0);
 }
 
-static const char *imx23_dt_compat[] __initdata = {
-	"fsl,imx23",
-	NULL,
-};
+static void __init mxs_timer_init(void)
+{
+	if (of_machine_is_compatible("fsl,imx23"))
+		mx23_clocks_init();
+	else
+		mx28_clocks_init();
+	clocksource_of_init();
+}
 
-static const char *imx28_dt_compat[] __initdata = {
+static const char *mxs_dt_compat[] __initdata = {
 	"fsl,imx28",
+	"fsl,imx23",
 	NULL,
 };
 
-DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)")
-	.map_io		= debug_ll_io_init,
-	.init_irq	= irqchip_init,
-	.handle_irq	= icoll_handle_irq,
-	.init_time	= imx23_timer_init,
-	.init_machine	= mxs_machine_init,
-	.dt_compat	= imx23_dt_compat,
-	.restart	= mxs_restart,
-MACHINE_END
-
-DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
+DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)")
 	.map_io		= debug_ll_io_init,
 	.init_irq	= irqchip_init,
 	.handle_irq	= icoll_handle_irq,
-	.init_time	= imx28_timer_init,
+	.init_time	= mxs_timer_init,
 	.init_machine	= mxs_machine_init,
-	.dt_compat	= imx28_dt_compat,
+	.dt_compat	= mxs_dt_compat,
 	.restart	= mxs_restart,
 MACHINE_END
Signature · 1 line
1.7.9.5
#15 lore raw

PATCH 13/13 ARM: mxs: remove unused headers

In reply to Shawn Guo

Most of the stuff in the headers are used nowhere now. Move a few things that are useful for mach-mxs.c into there and remove the headers.

---
 arch/arm/mach-mxs/include/mach/digctl.h |   22 ---
 arch/arm/mach-mxs/include/mach/mx23.h   |  169 -----------------------
 arch/arm/mach-mxs/include/mach/mx28.h   |  225 -------------------------------
 arch/arm/mach-mxs/include/mach/mxs.h    |  115 ----------------
 arch/arm/mach-mxs/mach-mxs.c            |   29 +++-
 5 files changed, 27 insertions(+), 533 deletions(-)
 delete mode 100644 arch/arm/mach-mxs/include/mach/digctl.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/mx23.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/mx28.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/mxs.h
arch/arm/mach-mxs/include/mach/digctl.h deleted +0 -22
deleted file mode 100644
index 1796406..0000000
@@ -1,22 +0,0 @@
-/*
- * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * 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.
- */
-
-#ifndef __MACH_DIGCTL_H__
-#define __MACH_DIGCTL_H__
-
-/* MXS DIGCTL SAIF CLKMUX */
-#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
-#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
-#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
-#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
-
-#define HW_DIGCTL_CTRL			0x0
-#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	10
-#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
-#define HW_DIGCTL_CHIPID		0x310
-#endif
arch/arm/mach-mxs/include/mach/mx23.h deleted +0 -169

169 lines not on this page · raw message

arch/arm/mach-mxs/include/mach/mx28.h deleted +0 -225

225 lines not on this page · raw message

arch/arm/mach-mxs/include/mach/mxs.h deleted +0 -115

115 lines not on this page · raw message

arch/arm/mach-mxs/mach-mxs.c +27 -2
index b74f450..2d93376 100644
@@ -31,8 +31,33 @@
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 #include <asm/system_misc.h>
-#include <mach/digctl.h>
-#include <mach/mxs.h>
+
+/* MXS DIGCTL SAIF CLKMUX */
+#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
+#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
+
+#define MXS_GPIO_NR(bank, nr)	((bank) * 32 + (nr))
+
+#define MXS_SET_ADDR		0x4
+#define MXS_CLR_ADDR		0x8
+#define MXS_TOG_ADDR		0xc
+
+static inline void __mxs_setl(u32 mask, void __iomem *reg)
+{
+	__raw_writel(mask, reg + MXS_SET_ADDR);
+}
+
+static inline void __mxs_clrl(u32 mask, void __iomem *reg)
+{
+	__raw_writel(mask, reg + MXS_CLR_ADDR);
+}
+
+static inline void __mxs_togl(u32 mask, void __iomem *reg)
+{
+	__raw_writel(mask, reg + MXS_TOG_ADDR);
+}
 
 static struct fb_videomode mx23evk_video_modes[] = {
 	{
Signature · 1 line
1.7.9.5