Skip to contentSkip to conversation

IMX: rename mx51 to mx5

PATCH Superseded Jason Liu 2 participants 4 messages Oct 15, 2010 – Oct 17, 2010

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jason Liu

author
#0 lore raw

PATCH v2 1/1 IMX: rename mx51 to mx5

Rename mx51 to mx5 in order to support more mx51
like-style SOCs such as MX53 and the followings.

---
Changes for v2:

Address the comments from Stefano Babic:
- rebase
- remove CONFIG_CPU_TYPE
- remove copyright change
- change vision2 board config

---
 arch/arm/cpu/armv7/{mx51 => mx5}/Makefile          |    0
 arch/arm/cpu/armv7/{mx51 => mx5}/clock.c           |   42 ++++++++++----------
 arch/arm/cpu/armv7/{mx51 => mx5}/iomux.c           |    2 +-
 arch/arm/cpu/armv7/{mx51 => mx5}/lowlevel_init.S   |    0
 arch/arm/cpu/armv7/{mx51 => mx5}/soc.c             |   28 ++++++++-----
 arch/arm/cpu/armv7/{mx51 => mx5}/speed.c           |    0
 arch/arm/cpu/armv7/{mx51 => mx5}/timer.c           |    8 ++--
 arch/arm/cpu/armv7/{mx51 => mx5}/u-boot.lds        |    0
 .../asm/{arch-mx51 => arch-mx5}/asm-offsets.h      |    0
 .../include/asm/{arch-mx51 => arch-mx5}/clock.h    |    0
 .../include/asm/{arch-mx51 => arch-mx5}/crm_regs.h |    0
 .../include/asm/{arch-mx51 => arch-mx5}/imx-regs.h |    0
 .../include/asm/{arch-mx51 => arch-mx5}/iomux.h    |    8 ++--
 .../mx51_pins.h => arch-mx5/mx5x_pins.h}           |    6 +-
 .../asm/{arch-mx51 => arch-mx5}/sys_proto.h        |    4 +-
 board/freescale/mx51evk/mx51evk.c                  |    2 +-
 board/ttcontrol/vision2/vision2.c                  |    2 +-
 boards.cfg                                         |    4 +-
 include/configs/mx51evk.h                          |    4 +-
 include/configs/vision2.h                          |    4 +-
 20 files changed, 61 insertions(+), 53 deletions(-)
arch/arm/cpu/armv7/mx5/Makefile renamed from arch/arm/cpu/armv7/mx51/Makefile +0 -0
similarity index 100%
rename from arch/arm/cpu/armv7/mx51/Makefile
rename to arch/arm/cpu/armv7/mx5/Makefile
arch/arm/cpu/armv7/mx5/clock.c renamed from arch/arm/cpu/armv7/mx51/clock.c +21 -21

111 lines not on this page · raw message

arch/arm/cpu/armv7/mx5/iomux.c renamed from arch/arm/cpu/armv7/mx51/iomux.c +1 -1
similarity index 99%
rename from arch/arm/cpu/armv7/mx51/iomux.c
rename to arch/arm/cpu/armv7/mx5/iomux.c
index 62b2954..e8928d5 100644
@@ -23,7 +23,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/mx51_pins.h>
+#include <asm/arch/mx5x_pins.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/sys_proto.h>
 
arch/arm/cpu/armv7/mx5/lowlevel_init.S renamed from arch/arm/cpu/armv7/mx51/lowlevel_init.S +0 -0
similarity index 100%
rename from arch/arm/cpu/armv7/mx51/lowlevel_init.S
rename to arch/arm/cpu/armv7/mx5/lowlevel_init.S
arch/arm/cpu/armv7/mx5/soc.c renamed from arch/arm/cpu/armv7/mx51/soc.c +17 -11
similarity index 82%
rename from arch/arm/cpu/armv7/mx51/soc.c
rename to arch/arm/cpu/armv7/mx5/soc.c
index f22ebe9..ad14001 100644
@@ -33,28 +33,33 @@
 #include <fsl_esdhc.h>
 #endif
 
+#if defined(CONFIG_MX51)
+#define CPU_TYPE 0x51000
+#else
+#error "CPU_TYPE not defined"
+#endif
+
 u32 get_cpu_rev(void)
 {
-	int reg;
-	int system_rev;
+	int system_rev = CPU_TYPE;
+	int reg = __raw_readl(ROM_SI_REV);
 
-	reg = __raw_readl(ROM_SI_REV);
 	switch (reg) {
 	case 0x02:
-		system_rev = 0x51000 | CHIP_REV_1_1;
+		system_rev |= CHIP_REV_1_1;
 		break;
 	case 0x10:
 		if ((__raw_readl(GPIO1_BASE_ADDR + 0x0) & (0x1 << 22)) == 0)
-			system_rev = 0x51000 | CHIP_REV_2_5;
+			system_rev |= CHIP_REV_2_5;
 		else
-			system_rev = 0x51000 | CHIP_REV_2_0;
+			system_rev |= CHIP_REV_2_0;
 		break;
 	case 0x20:
-		system_rev = 0x51000 | CHIP_REV_3_0;
+		system_rev |= CHIP_REV_3_0;
 		break;
 	return system_rev;
 	default:
-		system_rev = 0x51000 | CHIP_REV_1_0;
+		system_rev |= CHIP_REV_1_0;
 		break;
 	}
 	return system_rev;
@@ -67,9 +72,10 @@ int print_cpuinfo(void)
 	u32 cpurev;
 
 	cpurev = get_cpu_rev();
-	printf("CPU:   Freescale i.MX51 family rev%d.%d@%d MHz\n",
-		(cpurev & 0xF0) >> 4,
-		(cpurev & 0x0F) >> 4,
+	printf("CPU:   Freescale i.MX%x family rev%d.%d at %d MHz\n",
+		(cpurev & 0xFF00) >> 12,
+		(cpurev & 0x00F0) >> 4,
+		(cpurev & 0x000F) >> 4,
 		mxc_get_clock(MXC_ARM_CLK) / 1000000);
 	return 0;
 }
arch/arm/cpu/armv7/mx5/speed.c renamed from arch/arm/cpu/armv7/mx51/speed.c +0 -0
similarity index 100%
rename from arch/arm/cpu/armv7/mx51/speed.c
rename to arch/arm/cpu/armv7/mx5/speed.c
arch/arm/cpu/armv7/mx5/timer.c renamed from arch/arm/cpu/armv7/mx51/timer.c +4 -4
similarity index 92%
rename from arch/arm/cpu/armv7/mx51/timer.c
rename to arch/arm/cpu/armv7/mx5/timer.c
index 110edbf..8cb7ca2 100644
@@ -75,18 +75,18 @@ void reset_timer(void)
 void reset_timer_masked(void)
 {
 	ulong val = __raw_readl(&cur_gpt->counter);
-	lastinc = val / (CONFIG_MX51_CLK32 / CONFIG_SYS_HZ);
+	lastinc = val / (CONFIG_CLK32 / CONFIG_SYS_HZ);
 	timestamp = 0;
 }
 
 ulong get_timer_masked(void)
 {
 	ulong val = __raw_readl(&cur_gpt->counter);
-	val /= (CONFIG_MX51_CLK32 / CONFIG_SYS_HZ);
+	val /= (CONFIG_CLK32 / CONFIG_SYS_HZ);
 	if (val >= lastinc)
 		timestamp += (val - lastinc);
 	else
-		timestamp += ((0xFFFFFFFF / (CONFIG_MX51_CLK32 / CONFIG_SYS_HZ))
+		timestamp += ((0xFFFFFFFF / (CONFIG_CLK32 / CONFIG_SYS_HZ))
 				- lastinc) + val;
 	lastinc = val;
 	return timestamp;
@@ -106,7 +106,7 @@ void set_timer(ulong t)
 void __udelay(unsigned long usec)
 {
 	unsigned long now, start, tmo;
-	tmo = usec * (CONFIG_MX51_CLK32 / 1000) / 1000;
+	tmo = usec * (CONFIG_CLK32 / 1000) / 1000;
 
 	if (!tmo)
 		tmo = 1;
arch/arm/cpu/armv7/mx5/u-boot.lds renamed from arch/arm/cpu/armv7/mx51/u-boot.lds +0 -0
similarity index 100%
rename from arch/arm/cpu/armv7/mx51/u-boot.lds
rename to arch/arm/cpu/armv7/mx5/u-boot.lds
arch/arm/include/asm/arch-mx5/asm-offsets.h renamed from arch/arm/include/asm/arch-mx51/asm-offsets.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/arch-mx51/asm-offsets.h
rename to arch/arm/include/asm/arch-mx5/asm-offsets.h
arch/arm/include/asm/arch-mx5/clock.h renamed from arch/arm/include/asm/arch-mx51/clock.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/arch-mx51/clock.h
rename to arch/arm/include/asm/arch-mx5/clock.h
arch/arm/include/asm/arch-mx5/crm_regs.h renamed from arch/arm/include/asm/arch-mx51/crm_regs.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/arch-mx51/crm_regs.h
rename to arch/arm/include/asm/arch-mx5/crm_regs.h
arch/arm/include/asm/arch-mx5/imx-regs.h renamed from arch/arm/include/asm/arch-mx51/imx-regs.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/arch-mx51/imx-regs.h
rename to arch/arm/include/asm/arch-mx5/imx-regs.h
arch/arm/include/asm/arch-mx5/iomux.h renamed from arch/arm/include/asm/arch-mx51/iomux.h +4 -4
similarity index 98%
rename from arch/arm/include/asm/arch-mx51/iomux.h
rename to arch/arm/include/asm/arch-mx5/iomux.h
index a41c387..0d91a24 100644
@@ -20,13 +20,13 @@
  * MA 02111-1307 USA
  */
 
-#ifndef __MACH_MX51_IOMUX_H__
-#define __MACH_MX51_IOMUX_H__
+#ifndef __MACH_MX5_IOMUX_H__
+#define __MACH_MX5_IOMUX_H__
 
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/mx51_pins.h>
+#include <asm/arch/mx5x_pins.h>
 
 typedef unsigned int iomux_pin_name_t;
 
@@ -190,4 +190,4 @@ void mxc_iomux_set_pad(iomux_pin_name_t pin, u32 config);
 unsigned int mxc_iomux_get_pad(iomux_pin_name_t pin);
 void mxc_iomux_set_input(iomux_input_select_t input, u32 config);
 
-#endif				/*  __MACH_MX51_IOMUX_H__ */
+#endif				/*  __MACH_MX5_IOMUX_H__ */
arch/arm/include/asm/arch-mx5/mx5x_pins.h renamed from arch/arm/include/asm/arch-mx51/mx51_pins.h +3 -3
similarity index 99%
rename from arch/arm/include/asm/arch-mx51/mx51_pins.h
rename to arch/arm/include/asm/arch-mx5/mx5x_pins.h
index b44ff25..a564fce 100644
@@ -20,8 +20,8 @@
  * MA 02111-1307 USA
  */
 
-#ifndef __ASM_ARCH_MXC_MX51_PINS_H__
-#define __ASM_ARCH_MXC_MX51_PINS_H__
+#ifndef __ASM_ARCH_MX5_MX5X_PINS_H__
+#define __ASM_ARCH_MX5_MX5X_PINS_H__
 
 #ifndef __ASSEMBLY__
 
@@ -415,4 +415,4 @@ enum iomux_pins {
 };
 
 #endif				/* __ASSEMBLY__ */
-#endif				/* __ASM_ARCH_MXC_MX51_PINS_H__ */
+#endif				/* __ASM_ARCH_MX5_MX5X_PINS_H__ */
arch/arm/include/asm/arch-mx5/sys_proto.h renamed from arch/arm/include/asm/arch-mx51/sys_proto.h +3 -1
similarity index 93%
rename from arch/arm/include/asm/arch-mx51/sys_proto.h
rename to arch/arm/include/asm/arch-mx5/sys_proto.h
index f687503..83613ab 100644
@@ -24,8 +24,10 @@
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-u32 get_cpu_rev(void);
 #define is_soc_rev(rev)	((get_cpu_rev() & 0xFF) - rev)
+#define is_soc_type(rev)((((get_cpu_rev() & 0xFF00)) >> 8) - rev)
+
 void sdelay(unsigned long);
+u32 get_cpu_rev(void);
 
 #endif
board/freescale/mx51evk/mx51evk.c +1 -1
index 84386e6..c8d7d39 100644
@@ -23,7 +23,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/mx51_pins.h>
+#include <asm/arch/mx5x_pins.h>
 #include <asm/arch/iomux.h>
 #include <asm/errno.h>
 #include <asm/arch/sys_proto.h>
board/ttcontrol/vision2/vision2.c +1 -1
index c991ee2..ce4cb78 100644
@@ -26,7 +26,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/mx51_pins.h>
+#include <asm/arch/mx5x_pins.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
 #include <mxc_gpio.h>
boards.cfg +2 -2
index 132d178..9afba88 100644
@@ -46,8 +46,8 @@ pm9263		arm	arm926ejs	-		ronetix		at91
 jadecpu		arm	arm926ejs	jadecpu		syteco		mb86r0x
 suen3		arm	arm926ejs	km_arm		keymile		kirkwood
 rd6281a		arm	arm926ejs	-		Marvell		kirkwood
-mx51evk		arm	armv7		mx51evk		freescale	mx51
-vision2		arm	armv7		vision2		ttcontrol	mx51
+mx51evk		arm	armv7		mx51evk		freescale	mx5
+vision2		arm	armv7		vision2		ttcontrol	mx5
 actux1		arm	ixp
 actux2		arm	ixp
 actux3		arm	ixp
include/configs/mx51evk.h +2 -2
index 8864f3a..87d376a 100644
@@ -30,8 +30,8 @@
 #define CONFIG_MX51	/* in a mx51 */
 #define CONFIG_SKIP_RELOCATE_UBOOT
 
-#define CONFIG_MX51_HCLK_FREQ		24000000	/* RedBoot says 26MHz */
-#define CONFIG_MX51_CLK32		32768
+#define CONFIG_HCLK_FREQ	24000000
+#define CONFIG_CLK32		32768
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
include/configs/vision2.h +2 -2
index 44a6f8b..43616cf 100644
@@ -29,8 +29,8 @@
 #define CONFIG_MX51	/* in a mx51 */
 #define CONFIG_L2_OFF
 
-#define CONFIG_MX51_HCLK_FREQ		24000000
-#define CONFIG_MX51_CLK32		32768
+#define CONFIG_HCLK_FREQ	24000000
+#define CONFIG_CLK32		32768
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 1/1 IMX: rename mx51 to mx5

Dear Jason Liu,

In message <[email protected]> you wrote:
...

Quoted 2 lines
(quoted diff) +1 -1
-	freq = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_MX51_HCLK_FREQ);
+	freq = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_HCLK_FREQ);

...

Quoted 4 lines
arch/arm/cpu/armv7/mx5/clock.c renamed from arch/arm/cpu/armv7/mx51/clock.c +2 -2
-	clockinfo,	CONFIG_SYS_MAXARGS,	1,	do_mx51_showclocks,
-	"display mx51 clocks\n",
+	clockinfo,	CONFIG_SYS_MAXARGS,	1,	do_showclocks,
+	"display clocks\n",

...

arch/arm/cpu/armv7/mx5/timer.c void reset_timer(void) · line 78

Quoted 2 lines
arch/arm/cpu/armv7/mx5/timer.c renamed from arch/arm/cpu/armv7/mx51/timer.c +1 -1
-	lastinc = val / (CONFIG_MX51_CLK32 / CONFIG_SYS_HZ);
+	lastinc = val / (CONFIG_CLK32 / CONFIG_SYS_HZ);

I'm not happy about these changes.

The old names, containing "MX51" may have been too narrow in their naming; but the new names are now way too general.

"CONFIG_CLK32" or "CONFIG_HCLK_FREQ" look like generic config options that apply to any processor or board, or at least potentially to a wider range. This is kind of name space pollution.

I understand that all these names are specific to the mx5 family of processors only, right?

Recent submissions to the Linux kernel seem to use a "MX5" string when referring to these processors, like in:

- commit messages:

ARM: mx5: Add Nand clock support
ARM: mx5: dynamically register mxc-nand device
ARM: mx5: dynamically register imx-i2c devices

- directory names:

	arch/arm/mach-mx5/

- preprocessor variables:

MX5_USBOTHER_REGS_OFFSET
MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK

etc.

I suggest we do the same. Please add a "mx5" resp. "MX5" to the new identifier names.

Please also keep in mind that CONFIG_* options should be documented in the README.

Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"May your future be limited only by your dreams."
- Christa McAuliffe
#2 lore raw

PATCH v2 1/1 IMX: rename mx51 to mx5

Hi, Wolfgang,

Quoted 10 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Saturday, October 16, 2010 3:08 AM
To: Liu Hui-R64343
Cc: sbabic at denx.de; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH V2 1/1] IMX: rename mx51 to mx5

Dear Jason Liu,

In message <[email protected]>

you

Quoted 6 lines

wrote:
...

Quoted 2 lines
(quoted diff) +1 -1
-	freq = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_MX51_HCLK_FREQ);
+	freq = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_HCLK_FREQ);

...

Review

Quoted 1 line
(quoted diff) +0 -1
-	clockinfo,	CONFIG_SYS_MAXARGS,	1,

do_mx51_showclocks,

Quoted 12 lines
Quoted 3 lines
arch/arm/cpu/armv7/mx5/clock.c renamed from arch/arm/cpu/armv7/mx51/clock.c +2 -1
-	"display mx51 clocks\n",
+	clockinfo,	CONFIG_SYS_MAXARGS,	1,	do_showclocks,
+	"display clocks\n",

...

arch/arm/cpu/armv7/mx5/timer.c void reset_timer(void) · line 78

Quoted 2 lines
arch/arm/cpu/armv7/mx5/timer.c renamed from arch/arm/cpu/armv7/mx51/timer.c +1 -1
-	lastinc = val / (CONFIG_MX51_CLK32 / CONFIG_SYS_HZ);
+	lastinc = val / (CONFIG_CLK32 / CONFIG_SYS_HZ);

I'm not happy about these changes.

The old names, containing "MX51" may have been too narrow in their naming; but the new names are now way too general.

Quoted 6 lines

"CONFIG_CLK32" or "CONFIG_HCLK_FREQ" look like generic config options that apply to any processor or board, or at least potentially to a wider range. This is kind of name space pollution.

I understand that all these names are specific to the mx5 family of processors only, right?

Yes, specific to mx5 family,

Quoted 16 lines

Recent submissions to the Linux kernel seem to use a "MX5" string when referring to these processors, like in:

- commit messages:

ARM: mx5: Add Nand clock support
ARM: mx5: dynamically register mxc-nand device
ARM: mx5: dynamically register imx-i2c devices

- directory names:

	arch/arm/mach-mx5/

- preprocessor variables:

Quoted 7 lines

MX5_USBOTHER_REGS_OFFSET
MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK

etc.

I suggest we do the same. Please add a "mx5" resp. "MX5" to the new identifier names.

Yes, agree.

Quoted 3 lines

Please also keep in mind that CONFIG_* options should be documented in the README.

Do you mean all the specific CONFIG_* options in include/configs/boardname.h should be documented? I found lots of that is not doing what you called for? :(

BTW, which definition is better?

CONFIG_SYS_MX5_HCLK_FREQ 24000000
CONFIG_MX5_HCLK_FREQ 24000000

According to the REAME, I prefer to the former, what do you think.

Quoted 13 lines

Thanks.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "May your future be limited only by your dreams."
- Christa McAuliffe

#3 lore raw

PATCH v2 1/1 IMX: rename mx51 to mx5

Dear Liu Hui-R64343,

Quoted 5 lines · In message <3850A844E6A3854C827AC5C0BEC7B60A2B0596@zch01exm23.fsl.freescale.net…
Quoted 3 lines

I suggest we do the same. Please add a "mx5" resp. "MX5" to the new identifier names.

Yes, agree.

Thanks.

Quoted 6 lines
Quoted 2 lines

Please also keep in mind that CONFIG_* options should be documented in the README.

Do you mean all the specific CONFIG_* options in include/configs/boardname.h should be documented? I found lots of that is not doing what you called for? :(

Yes, we have not always been that strict, but we try to improve.

Quoted 6 lines

BTW, which definition is better?

CONFIG_SYS_MX5_HCLK_FREQ 24000000
CONFIG_MX5_HCLK_FREQ 24000000

According to the REAME, I prefer to the former, what do you think.

Indeed CONFIG_SYS_* seems more appropriate here. I would probably call this "CONFIG_SYS_MX5_HCLK" ("CLK" and "FREQ" seem a bit redundant here).

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Some programming languages manage to  absorb  change,  but  withstand
progress.          -- Epigrams in Programming, ACM SIGPLAN Sept. 1982