Skip to contentSkip to conversation

arm: mvf600: Add Freescale Vybrid MVF600 CPU and MVF600TWR board support

PATCH Superseded Alison Wang 5 participants 25 messages May 14, 2013 – May 17, 2013 1 message not in the archive

Subsystems (5)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover arm: mvf600: Add Freescale Vybrid MVF600 CPU and MVF600TWR board support

This series contain the support for Freescale Vybrid MVF600 CPU and MVF600TWR board.

Vybird devices are built on an asymmetrical-multiprocessing architecture using ARM cores. The families in the Vybrid portfolio span entry-level, single core Cortex-A class SoCs all the way to dual heterogeneous core SoCs with multiple communication and connectivity options.

Part of the Vybrid platform, MVF600 is a dual-core eMPU combining the ARM Cortex A5 and Cortex M4 cores.

The u-boot runs on Cortex A5 core.

MVF600 shares some IPs with i.MX family, such as FEC,ESDHC,WATCHDOG,I2C,ASRC and ESAI. MVF600 also shares some IPs with ColdFire family, such as eDMA and DSPI. MVF600 still has its own IPs, such as PIT,SAI,UART,QSPI and DCU.

More documents for this soc can be found at:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=VF6xx&fsrch=1&sr=5
http://www.freescale.com/webapp/sps/site/homepage.jsp?code=VYBRID

Changes in v2:
- Remove vybrid-common directory
- Rename directory name 'vybrid' to 'mvf600'
- Add generic.c file
- Rewrite get_reset_cause() to make it readable
- Remove reset_cpu(), and use the function in imx_watchdog.c
- Rewrite timer.c file
- Use vybrid_get_clock(VYBRID_UART_CLK) instead of vybrid_get_uartclk()
- Remove lowlevel_init.S, and add clock_init() in board_early_init_f()
- Remove useless CONFIG_SYS_ defines
- Move CONFIG_MACH_TYPE to board configuration file
- Define C structures and access C structures to set/read registers
- Remove useless errata
- Remove useless macros
- Rename directory name 'arch-vybrid' to 'arch-mvf600'
- Use common iomux-v3 code
- Use common FEC driver fec_mxc.c
- Add watchdog support
- Add an entry to MAINTAINERS file
- Rename directory name 'vybird' to 'mvf600twr'
- Use standard method to set gd->ram_size
- Rewrite board_mmc_getcd() function
- Remove useless undef
- Remove hardcoded IP addresses and MAC addresses
- Move CONFIG_MACH_TYPE to board configuration file

----------------------------------------------------------------
Alison Wang (6):
arm: mvf600: Add Vybrid MVF600 CPU support
arm: mvf600: Add IOMUX support for Vybrid MVF600
arm: mvf600: Add FEC support for Vybrid MVF600
arm: mvf600: Add watchdog support for Vybrid MVF600
arm: mvf600: Add uart support for Vybrid MVF600
arm: mvf600: Add basic support for Vybrid MVF600TWR board

 MAINTAINERS                                 |   4 ++
 Makefile                                    |   2 +-
 arch/arm/cpu/armv7/mvf600/Makefile          |  42 +++++++++++
 arch/arm/cpu/armv7/mvf600/generic.c         | 309 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/cpu/armv7/mvf600/timer.c           | 144 ++++++++++++++++++++++++++++++++++++++
 arch/arm/imx-common/Makefile                |   2 +-
 arch/arm/imx-common/iomux-v3.c              |   6 ++
 arch/arm/include/asm/arch-mvf600/clock.h    |  38 ++++++++++
 arch/arm/include/asm/arch-mvf600/crm_regs.h | 170 ++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mvf600/imx-regs.h | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mvf600/mvf_pins.h |  92 ++++++++++++++++++++++++
 arch/arm/include/asm/imx-common/iomux-v3.h  |  18 +++++
 board/freescale/mvf600twr/Makefile          |  39 +++++++++++
 board/freescale/mvf600twr/imximage.cfg      |  35 ++++++++++
 board/freescale/mvf600twr/mvf600twr.c       | 403 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 boards.cfg                                  |   1 +
 drivers/net/fec_mxc.c                       |   6 +-
 drivers/serial/Makefile                     |   1 +
 drivers/serial/serial_lpuart.c              | 161 ++++++++++++++++++++++++++++++++++++++++++
 drivers/watchdog/Makefile                   |   2 +-
 include/configs/mvf600twr.h                 | 147 ++++++++++++++++++++++++++++++++++++++
 21 files changed, 1819 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/mvf600/Makefile
 create mode 100644 arch/arm/cpu/armv7/mvf600/generic.c
 create mode 100644 arch/arm/cpu/armv7/mvf600/timer.c
 create mode 100644 arch/arm/include/asm/arch-mvf600/clock.h
 create mode 100644 arch/arm/include/asm/arch-mvf600/crm_regs.h
 create mode 100644 arch/arm/include/asm/arch-mvf600/imx-regs.h
 create mode 100644 arch/arm/include/asm/arch-mvf600/mvf_pins.h
 create mode 100644 board/freescale/mvf600twr/Makefile
 create mode 100644 board/freescale/mvf600twr/imximage.cfg
 create mode 100644 board/freescale/mvf600twr/mvf600twr.c
 create mode 100644 drivers/serial/serial_lpuart.c
 create mode 100644 include/configs/mvf600twr.h
#1 lore raw

PATCH v2 1/6 arm: mvf600: Add Vybrid MVF600 CPU support

This patch adds generic codes to support Freescale's Vybrid MVF600 CPU.

It aligns Vybrid MVF600 platform with i.MX platform. As there are some differences between MVF600 and i.MX platforms, the specific codes are in the arch/arm/cpu/armv7/mvf600 directory.

---
Changes in v2:
- Remove vybrid-common directory
- Rename directory name 'vybrid' to 'mvf600'
- Add generic.c file
- Rewrite get_reset_cause() to make it readable
- Remove reset_cpu(), and use the function in imx_watchdog.c
- Rewrite timer.c file
- Use vybrid_get_clock(VYBRID_UART_CLK) instead of vybrid_get_uartclk()
- Remove lowlevel_init.S, and add clock_init() in board_early_init_f()
- Remove useless CONFIG_SYS_ defines
- Move CONFIG_MACH_TYPE to board configuration file
- Define C structures and access C structures to set/read registers
- Remove useless errata
- Remove useless macros
- Rename directory 'arch-vybrid' to 'arch-mvf600'

 Makefile                                    |   2 +-
 arch/arm/cpu/armv7/mvf600/Makefile          |  42 ++++
 arch/arm/cpu/armv7/mvf600/generic.c         | 309 ++++++++++++++++++++++++++++
 arch/arm/cpu/armv7/mvf600/timer.c           | 144 +++++++++++++
 arch/arm/include/asm/arch-mvf600/clock.h    |  38 ++++
 arch/arm/include/asm/arch-mvf600/crm_regs.h | 170 +++++++++++++++
 arch/arm/include/asm/arch-mvf600/imx-regs.h | 201 ++++++++++++++++++
 arch/arm/include/asm/arch-mvf600/mvf_pins.h |  92 +++++++++
 8 files changed, 997 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/armv7/mvf600/Makefile
 create mode 100644 arch/arm/cpu/armv7/mvf600/generic.c
 create mode 100644 arch/arm/cpu/armv7/mvf600/timer.c
 create mode 100644 arch/arm/include/asm/arch-mvf600/clock.h
 create mode 100644 arch/arm/include/asm/arch-mvf600/crm_regs.h
 create mode 100644 arch/arm/include/asm/arch-mvf600/imx-regs.h
 create mode 100644 arch/arm/include/asm/arch-mvf600/mvf_pins.h
Makefile +1 -1
index c52f0f1..9df2138 100644
@@ -341,7 +341,7 @@ ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(C
 LIBS-y += $(CPUDIR)/omap-common/libomap-common.o
 endif
 
-ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs))
+ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs mvf600))
 LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o
 endif
 
arch/arm/cpu/armv7/mvf600/Makefile new file +42 -0

42 lines not on this page · raw message

arch/arm/cpu/armv7/mvf600/generic.c new file +309 -0

309 lines not on this page · raw message

arch/arm/cpu/armv7/mvf600/timer.c new file +144 -0

144 lines not on this page · raw message

arch/arm/include/asm/arch-mvf600/clock.h new file +38 -0
new file mode 100644
index 0000000..889d4d9
@@ -0,0 +1,38 @@
+/*
+ * Copyright 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 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_ARCH_CLOCK_H
+#define __ASM_ARCH_CLOCK_H
+
+#include <common.h>
+
+enum mvf_clock {
+	MVF_ARM_CLK = 0,
+	MVF_BUS_CLK,
+	MVF_IPG_CLK,
+	MVF_UART_CLK,
+	MVF_ESDHC_CLK,
+	MVF_FEC_CLK,
+};
+
+unsigned int mvf_get_clock(enum mvf_clock clk);
+
+#define imx_get_fecclk() mvf_get_clock(MVF_FEC_CLK)
+
+#endif /* __ASM_ARCH_CLOCK_H */
arch/arm/include/asm/arch-mvf600/crm_regs.h new file +170 -0

170 lines not on this page · raw message

arch/arm/include/asm/arch-mvf600/imx-regs.h new file +201 -0

201 lines not on this page · raw message

arch/arm/include/asm/arch-mvf600/mvf_pins.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
1.8.0
#2 lore raw

PATCH v2 1/6 arm: mvf600: Add Vybrid MVF600 CPU support

Quoted 8 lines · Alison Wang

This patch adds generic codes to support Freescale's Vybrid MVF600 CPU.

It aligns Vybrid MVF600 platform with i.MX platform. As there are some differences between MVF600 and i.MX platforms, the specific codes are in the arch/arm/cpu/armv7/mvf600 directory.

---

Hi Alison,

Quoted 16 lines

Changes in v2:
- Remove vybrid-common directory
- Rename directory name 'vybrid' to 'mvf600'
- Add generic.c file
- Rewrite get_reset_cause() to make it readable
- Remove reset_cpu(), and use the function in imx_watchdog.c
- Rewrite timer.c file
- Use vybrid_get_clock(VYBRID_UART_CLK) instead of vybrid_get_uartclk()
- Remove lowlevel_init.S, and add clock_init() in board_early_init_f()
- Remove useless CONFIG_SYS_ defines
- Move CONFIG_MACH_TYPE to board configuration file
- Define C structures and access C structures to set/read registers
- Remove useless errata
- Remove useless macros
- Rename directory 'arch-vybrid' to 'arch-mvf600'

Quoted 3 lines
 Makefile                                    |   2 +-
 arch/arm/cpu/armv7/mvf600/Makefile          |  42 ++++
 arch/arm/cpu/armv7/mvf600/generic.c         | 309 ++++++++++++++++++++++++++++

Just a minor concern here. The SOC is a ARMv5, but files go into the armv7 directory. Maybe the bigger issue can be with the increasing number of work-around (CONFIG_ERRATA) that flow into start.S for armv7, that are specific only for armv7. I know that for ARMv5 we split differently instead of ARM architecture (ARM926,...).

Albert, what do you think about ? Should these files be moved away from armv7 ?

Quoted 10 lines
arch/arm/cpu/armv7/mvf600/generic.c new file +10 -0
+unsigned int mvf_get_clock(enum mvf_clock clk)
+{
+	switch (clk) {
+	case MVF_ARM_CLK:
+		return get_mcu_main_clk();
+	case MVF_BUS_CLK:
+		return get_bus_clk();
+	case MVF_IPG_CLK:
+		return get_ipg_clk();
+	case MVF_UART_CLK:

arch/arm/cpu/armv7/mvf600/generic.c line 211

Quoted 10 lines
arch/arm/cpu/armv7/mvf600/generic.c new file +10 -0
+		return get_uart_clk();
+	case MVF_ESDHC_CLK:
+		return get_sdhc_clk();
+	case MVF_FEC_CLK:
+		return get_fec_clk();
+	default:
+		break;
+	}
+	return -1;
+}

Ok - we have the same structure as for i.MX. I agree with you that the name of the function mxc_get_clock() is not anymore correct, after some other Freescale's SOC families were introduced. However, it is still important to have a common API to expone a SOC to a board maintainer.

If you see, the mxs family (MX23 / MX28) has a mxc_get_clock(), even if most internal functions are marked as mxs_. I think we can later change the name for this function (maybe this is not the only one) to make the name clearer and not specific to i.MX, but then it is will be easier if all SOCs use the same names. For this reason, it is better to rename this function to mxc_get_clock() and please take the same enums that are already set for the other Freescale's SOCs.

arch/arm/cpu/armv7/mvf600/generic.c line 241

Quoted 12 lines
arch/arm/cpu/armv7/mvf600/generic.c new file +12 -0
+
+#ifdef CONFIG_FEC_MXC
+void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
+{
+	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+	struct fuse_bank *bank = &ocotp->bank[4];
+	struct fuse_bank4_regs *fuse =
+		(struct fuse_bank4_regs *)bank->fuse_regs;
+
+	u32 value = readl(&fuse->mac_addr0);
+	mac[0] = (value >> 8);
+	mac[1] = value;

To my knowledge : is the whole MAC stored in the ocotp ? No need to add the first bytes (vendor-id) as we had for MX28 ?

Quoted 62 lines
arch/arm/cpu/armv7/mvf600/timer.c new file +56 -0
new file mode 100644
index 0000000..99ca57d
@@ -0,0 +1,144 @@
+/*
+ * Copyright 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 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <div64.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/clock.h>
+
+/* Periodic interrupt timer registers */
+struct pit_reg {
+	u32 mcr;
+	u32 recv0[55];
+	u32 ltmr64h;
+	u32 ltmr64l;
+	u32 recv1[6];
+	u32 ldval0;
+	u32 cval0;
+	u32 tctrl0;
+	u32 tflg0;
+	u32 ldval1;
+	u32 cval1;
+	u32 tctrl1;
+	u32 tflg1;
+	u32 ldval2;
+	u32 cval2;
+	u32 tctrl2;
+	u32 tflg2;
+	u32 ldval3;
+	u32 cval3;
+	u32 tctrl3;
+	u32 tflg3;
+	u32 ldval4;
+	u32 cval4;
+	u32 tctrl4;
+	u32 tflg4;
+	u32 ldval5;
+	u32 cval5;
+	u32 tctrl5;
+	u32 tflg5;

arch/arm/cpu/armv7/mvf600/timer.c line 66

Quoted 10 lines
arch/arm/cpu/armv7/mvf600/timer.c new file +10 -0
+	u32 ldval6;
+	u32 cval6;
+	u32 tctrl6;
+	u32 tflg6;
+	u32 ldval7;
+	u32 cval7;
+	u32 tctrl7;
+	u32 tflg7;
+};
+

I had put these structure in imx-regs.h - no block from my side, but there is also no big reason to let it here.

Quoted 32 lines
arch/arm/include/asm/arch-mvf600/clock.h new file +26 -0
new file mode 100644
index 0000000..889d4d9
@@ -0,0 +1,38 @@
+/*
+ * Copyright 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 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_ARCH_CLOCK_H
+#define __ASM_ARCH_CLOCK_H
+
+#include <common.h>
+
+enum mvf_clock {
+	MVF_ARM_CLK = 0,

arch/arm/include/asm/arch-mvf600/clock.h line 36

Quoted 10 lines
arch/arm/include/asm/arch-mvf600/clock.h new file +10 -0
+	MVF_BUS_CLK,
+	MVF_IPG_CLK,
+	MVF_UART_CLK,
+	MVF_ESDHC_CLK,
+	MVF_FEC_CLK,
+};
+
+unsigned int mvf_get_clock(enum mvf_clock clk);
+
+#define imx_get_fecclk() mvf_get_clock(MVF_FEC_CLK)

See my previous comment. Agree the names are not anymore correct, but we can fix them later with a separate patch for all Freescale's SOCs.

Quoted 40 lines
arch/arm/include/asm/arch-mvf600/clock.h new file +40 -0
+/* On-Chip One Time Programmable Controller (OCOTP) */
+struct ocotp_regs {
+	u32 ctrl;
+	u32 ctrl_set;
+	u32 ctrl_clr;
+	u32 ctrl_tog;
+	u32 timing;
+	u32 rsvd0[3];
+	u32 data;
+	u32 rsvd1[3];
+	u32 read_ctr;
+	u32 rsvd2[3];
+	u32 read_fuse_data;
+	u32 rsvd3[7];
+	u32 scs;
+	u32 scs_set;
+	u32 scs_clr;
+	u32 scs_tog;
+	u32 crc_addr;
+	u32 rsvd4[3];
+	u32 crc_value;
+	u32 rsvd5[3];
+	u32 version;
+	u32 rsvd6[0xdb];
+
+	struct fuse_bank {
+		u32 fuse_regs[0x20];
+	} bank[16];
+};
+
+/* OTP Bank 4 */
+struct fuse_bank4_regs {
+	u32 sjc_resp0;
+	u32 rsvd0[3];
+	u32 sjc_resp1;
+	u32 rsvd1[3];
+	u32 mac_addr0;
+	u32 rsvd2[3];
+	u32 mac_addr1;
+	u32 rsvd3[3];

arch/arm/include/asm/arch-mvf600/clock.h

Quoted 10 lines
arch/arm/include/asm/arch-mvf600/clock.h new file +10 -0
+	u32 mac_addr2;
+	u32 rsvd4[3];
+	u32 mac_addr3;
+	u32 rsvd5[3];
+	u32 gp1;
+	u32 rsvd6[3];
+	u32 gp2;
+	u32 rsvd7[3];
+};
+

Have you seen that a driver for fuse / ocotp was recently added to mainline ? Have you tested on your platform ?

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH v2 1/6 arm: mvf600: Add Vybrid MVF600 CPU support

Hi Stefano,

Quoted 32 lines · Stefano Babic
Quoted 8 lines · Alison Wang

This patch adds generic codes to support Freescale's Vybrid MVF600 CPU.

It aligns Vybrid MVF600 platform with i.MX platform. As there are some differences between MVF600 and i.MX platforms, the specific codes are in the arch/arm/cpu/armv7/mvf600 directory.

---

Hi Alison,

Quoted 16 lines

Changes in v2:
- Remove vybrid-common directory
- Rename directory name 'vybrid' to 'mvf600'
- Add generic.c file
- Rewrite get_reset_cause() to make it readable
- Remove reset_cpu(), and use the function in imx_watchdog.c
- Rewrite timer.c file
- Use vybrid_get_clock(VYBRID_UART_CLK) instead of vybrid_get_uartclk()
- Remove lowlevel_init.S, and add clock_init() in board_early_init_f()
- Remove useless CONFIG_SYS_ defines
- Move CONFIG_MACH_TYPE to board configuration file
- Define C structures and access C structures to set/read registers
- Remove useless errata
- Remove useless macros
- Rename directory 'arch-vybrid' to 'arch-mvf600'

Quoted 3 lines
 Makefile                                    |   2 +-
 arch/arm/cpu/armv7/mvf600/Makefile          |  42 ++++
 arch/arm/cpu/armv7/mvf600/generic.c         | 309 ++++++++++++++++++++++++++++
Quoted 8 lines

Just a minor concern here. The SOC is a ARMv5, but files go into the armv7 directory. Maybe the bigger issue can be with the increasing number of work-around (CONFIG_ERRATA) that flow into start.S for armv7, that are specific only for armv7. I know that for ARMv5 we split differently instead of ARM architecture (ARM926,...).

Albert, what do you think about ? Should these files be moved away from armv7 ?

If the SoC is ARMv5, then yes, its arch/arm/cpu files should not go in armv7 -- and then, we may have to discuss whether, and how, to factorize ISA-level code. Maybe we need an arch/arm/isa/armv{4,5,6,7...} beside arch/cpu, and move wherever is isa-specific there.

Regarding errata, I don't understand your point: if they are specific to armv7, then arch/arm/cpu/armv7/start.S seems to be the place to put them (assuming they affect execution before board_init_f() of course).

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH v2 1/6 arm: mvf600: Add Vybrid MVF600 CPU support

Quoted 8 lines · Albert ARIBAUD
Quoted 3 lines

Albert, what do you think about ? Should these files be moved away from armv7 ?

If the SoC is ARMv5, then yes, its arch/arm/cpu files should not go in armv7 -- and then, we may have to discuss whether, and how, to factorize ISA-level code. Maybe we need an arch/arm/isa/armv{4,5,6,7...} beside arch/cpu, and move wherever is isa-specific there.

Agree. I think adding armv{4,5,6,7...} is the most clean solution.

Quoted 4 lines

Regarding errata, I don't understand your point: if they are specific to armv7, then arch/arm/cpu/armv7/start.S seems to be the place to put them (assuming they affect execution before board_init_f() of course).

I was not able to express my point, sorry. Of course, the right place for them is arch/arm/cpu/armv7/start.S. My concern was related to this SOC, as it seems it steals armv7 code but it is not armv7. Then changes in start.S, that fixes real problems for armv7, can break this Vybrid. But the reason is that Vybrid initialization should not be taken from arch/arm/cpu/armv7/start.S.

Best regards,
Stefano

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH v2 1/6 arm: mvf600: Add Vybrid MVF600 CPU support

Hi Stefano,

Quoted 11 lines · Stefano Babic
Quoted 8 lines · Albert ARIBAUD
Quoted 3 lines

Albert, what do you think about ? Should these files be moved away from armv7 ?

If the SoC is ARMv5, then yes, its arch/arm/cpu files should not go in armv7 -- and then, we may have to discuss whether, and how, to factorize ISA-level code. Maybe we need an arch/arm/isa/armv{4,5,6,7...} beside arch/cpu, and move wherever is isa-specific there.

Agree. I think adding armv{4,5,6,7...} is the most clean solution.

This is a clean solution, but do we have the problem? IOW, do we have a substantial quantity of code that is common to a given ISA but neither generic to ARM (if it were, it would go to arch/arm or arch/arm/lib) nor specific to a CPU (if it were, then it should stay under arch/arm/cpu/)? If we do then moving this code under an isa tree makes sense; if we don't, then arch/arm/cpu/<cpu>/<soc> is enough, and mvf600 just jas to move under arch/arm/cpu/ and copy the few ARMv5 snippets it needs from another ARMv5-based cpu.

IMO, the proof is in the pudding: if I see a patch that creates e.g. arch/arm/isa/armv5 and factorizes isa code there from cpu subdirs, and if this results in a smaller codebase (apart from doc) and no binary size increase, then I'll ack it and apply it [albeit on next as the merge window is now closed].

Quoted 10 lines
Quoted 3 lines

Regarding errata, I don't understand your point: if they are specific to armv7, then arch/arm/cpu/armv7/start.S seems to be the place to put them (assuming they affect execution before board_init_f() of course).

I was not able to express my point, sorry. Of course, the right place for them is arch/arm/cpu/armv7/start.S. My concern was related to this SOC, as it seems it steals armv7 code but it is not armv7. Then changes in start.S, that fixes real problems for armv7, can break this Vybrid. But the reason is that Vybrid initialization should not be taken from arch/arm/cpu/armv7/start.S.

I understand now, and this is a valid point -- all the more a reason to move mvf600 under arch/cpu/, with or without factorizing armv5 code.

Quoted 2 lines

Best regards,
Stefano

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH v2 1/6 arm: mvf600: Add Vybrid MVF600 CPU support

Quoted 2 lines · Albert ARIBAUD

Hi Stefano,

Hi Albert, hi Alison,

Quoted 10 lines
Quoted 1 line

Agree. I think adding armv{4,5,6,7...} is the most clean solution.

This is a clean solution, but do we have the problem? IOW, do we have a substantial quantity of code that is common to a given ISA but neither generic to ARM (if it were, it would go to arch/arm or arch/arm/lib) nor specific to a CPU (if it were, then it should stay under arch/arm/cpu/)? If we do then moving this code under an isa tree makes sense; if we don't, then arch/arm/cpu/<cpu>/<soc> is enough, and mvf600 just jas to move under arch/arm/cpu/ and copy the few ARMv5 snippets it needs from another ARMv5-based cpu.

Roght - this is also a clean solution, because we have already arm926 and so on. Alison, please check how you can move your initialization code as Alber suggested.

Best regards,
Stefano

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

A message that is not in the archive (sent off-list or not yet received): 81BA6E5E0BC2344391CABCEE22D1B6D8322144@039-SN1MPN1-002.039d.mgd.msft.net

#8 lore raw

[U-Boot] 答复: [PATCH v2 1/6] arm: mvf600: Add Vybrid MVF600 CPU support

Quoted 6 lines · On 15/05/2013 15:55, Wang Huan-B18965 wrote:

Hi, Stefano,

Vybrid MVF600 is a dual-core eMPU combining the ARM Cortex A5 and Cortex M4 cores.
Cortex A5 is a processor core designed by implementing the ARM v7 instruction set architecture. So I put the codes in the armv7 directory.

Ok, got it. Then it is fine to have in armv7 directory.

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#9 lore raw

PATCH v2 1/6 arm: mvf600: Add Vybrid MVF600 CPU support

In reply to Stefano Babic

Hi, Stefano,

Quoted 69 lines · Alison Wang
Quoted 8 lines

This patch adds generic codes to support Freescale's Vybrid MVF600 CPU.

It aligns Vybrid MVF600 platform with i.MX platform. As there are some differences between MVF600 and i.MX platforms, the specific codes are in the arch/arm/cpu/armv7/mvf600 directory.

---

Hi Alison,

Quoted 17 lines

Changes in v2:
- Remove vybrid-common directory
- Rename directory name 'vybrid' to 'mvf600'
- Add generic.c file
- Rewrite get_reset_cause() to make it readable
- Remove reset_cpu(), and use the function in imx_watchdog.c
- Rewrite timer.c file
- Use vybrid_get_clock(VYBRID_UART_CLK) instead of vybrid_get_uartclk()
- Remove lowlevel_init.S, and add clock_init() in board_early_init_f()
- Remove useless CONFIG_SYS_ defines
- Move CONFIG_MACH_TYPE to board configuration file
- Define C structures and access C structures to set/read registers
- Remove useless errata
- Remove useless macros
- Rename directory 'arch-vybrid' to 'arch-mvf600'

Quoted 3 lines
 Makefile                                    |   2 +-
 arch/arm/cpu/armv7/mvf600/Makefile          |  42 ++++
 arch/arm/cpu/armv7/mvf600/generic.c         | 309

++++++++++++++++++++++++++++

Just a minor concern here. The SOC is a ARMv5, but files go into the armv7 directory. Maybe the bigger issue can be with the increasing number of work-around (CONFIG_ERRATA) that flow into start.S for armv7, that are specific only for armv7. I know that for ARMv5 we split differently instead of ARM architecture (ARM926,...).

Albert, what do you think about ? Should these files be moved away from armv7 ?

Quoted 9 lines
arch/arm/cpu/armv7/mvf600/generic.c new file +9 -0
+unsigned int mvf_get_clock(enum mvf_clock clk) {
+	switch (clk) {
+	case MVF_ARM_CLK:
+		return get_mcu_main_clk();
+	case MVF_BUS_CLK:
+		return get_bus_clk();
+	case MVF_IPG_CLK:
+		return get_ipg_clk();
+	case MVF_UART_CLK:

arch/arm/cpu/armv7/mvf600/generic.c line 211

Quoted 10 lines
arch/arm/cpu/armv7/mvf600/generic.c new file +10 -0
+		return get_uart_clk();
+	case MVF_ESDHC_CLK:
+		return get_sdhc_clk();
+	case MVF_FEC_CLK:
+		return get_fec_clk();
+	default:
+		break;
+	}
+	return -1;
+}

Ok - we have the same structure as for i.MX. I agree with you that the name of the function mxc_get_clock() is not anymore correct, after some other Freescale's SOC families were introduced. However, it is still important to have a common API to expone a SOC to a board maintainer.

Quoted 7 lines

If you see, the mxs family (MX23 / MX28) has a mxc_get_clock(), even if most internal functions are marked as mxs_. I think we can later change the name for this function (maybe this is not the only one) to make the name clearer and not specific to i.MX, but then it is will be easier if all SOCs use the same names. For this reason, it is better to rename this function to mxc_get_clock() and please take the same enums that are already set for the other Freescale's SOCs.

[Alison Wang] Agree. I will rename this function to mxc_get_clock() and take the same enums. Thanks.

Quoted 15 lines

arch/arm/cpu/armv7/mvf600/generic.c line 241

Quoted 12 lines
arch/arm/cpu/armv7/mvf600/generic.c new file +11 -0
+
+#ifdef CONFIG_FEC_MXC
+void imx_get_mac_from_fuse(int dev_id, unsigned char *mac) {
+	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+	struct fuse_bank *bank = &ocotp->bank[4];
+	struct fuse_bank4_regs *fuse =
+		(struct fuse_bank4_regs *)bank->fuse_regs;
+
+	u32 value = readl(&fuse->mac_addr0);
+	mac[0] = (value >> 8);
+	mac[1] = value;

To my knowledge : is the whole MAC stored in the ocotp ? No need to add the first bytes (vendor-id) as we had for MX28 ?

[Alison Wang] Yes, the whole MAC is stored in the ocotp for Vybrid.

Quoted 68 lines
Quoted 68 lines
arch/arm/cpu/armv7/mvf600/timer.c new file +60 -0
new file mode 100644
index 0000000..99ca57d
@@ -0,0 +1,144 @@
+/*
+ * Copyright 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 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <div64.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/clock.h>
+
+/* Periodic interrupt timer registers */ struct pit_reg {
+	u32 mcr;
+	u32 recv0[55];
+	u32 ltmr64h;
+	u32 ltmr64l;
+	u32 recv1[6];
+	u32 ldval0;
+	u32 cval0;
+	u32 tctrl0;
+	u32 tflg0;
+	u32 ldval1;
+	u32 cval1;
+	u32 tctrl1;
+	u32 tflg1;
+	u32 ldval2;
+	u32 cval2;
+	u32 tctrl2;
+	u32 tflg2;
+	u32 ldval3;
+	u32 cval3;
+	u32 tctrl3;
+	u32 tflg3;
+	u32 ldval4;
+	u32 cval4;
+	u32 tctrl4;
+	u32 tflg4;
+	u32 ldval5;
+	u32 cval5;
+	u32 tctrl5;
+	u32 tflg5;
+	u32 ldval6;
+	u32 cval6;
+	u32 tctrl6;
+	u32 tflg6;
+	u32 ldval7;
Quoted 8 lines

arch/arm/cpu/armv7/mvf600/timer.c line 66

Quoted 5 lines
arch/arm/cpu/armv7/mvf600/timer.c new file +5 -0
+	u32 cval7;
+	u32 tctrl7;
+	u32 tflg7;
+};
+

I had put these structure in imx-regs.h - no block from my side, but there is also no big reason to let it here.

[Alison Wang] Agree. I will put these structures to imx-regs.h. Thanks.

Quoted 40 lines
Quoted 40 lines
arch/arm/include/asm/arch-mvf600/clock.h new file +31 -0
new file mode 100644
index 0000000..889d4d9
@@ -0,0 +1,38 @@
+/*
+ * Copyright 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 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_ARCH_CLOCK_H
+#define __ASM_ARCH_CLOCK_H
+
+#include <common.h>
+
+enum mvf_clock {
+	MVF_ARM_CLK = 0,
+	MVF_BUS_CLK,
+	MVF_IPG_CLK,
+	MVF_UART_CLK,
+	MVF_ESDHC_CLK,
+	MVF_FEC_CLK,
Quoted 8 lines

arch/arm/include/asm/arch-mvf600/clock.h line 36

Quoted 5 lines
arch/arm/include/asm/arch-mvf600/clock.h new file +5 -0
+};
+
+unsigned int mvf_get_clock(enum mvf_clock clk);
+
+#define imx_get_fecclk() mvf_get_clock(MVF_FEC_CLK)

See my previous comment. Agree the names are not anymore correct, but we can fix them later with a separate patch for all Freescale's SOCs.

[Alison Wang] Agree. I will change the names. Thanks.

Quoted 47 lines
Quoted 47 lines
arch/arm/include/asm/arch-mvf600/clock.h new file +45 -0
+/* On-Chip One Time Programmable Controller (OCOTP) */ struct
+ocotp_regs {
+	u32 ctrl;
+	u32 ctrl_set;
+	u32 ctrl_clr;
+	u32 ctrl_tog;
+	u32 timing;
+	u32 rsvd0[3];
+	u32 data;
+	u32 rsvd1[3];
+	u32 read_ctr;
+	u32 rsvd2[3];
+	u32 read_fuse_data;
+	u32 rsvd3[7];
+	u32 scs;
+	u32 scs_set;
+	u32 scs_clr;
+	u32 scs_tog;
+	u32 crc_addr;
+	u32 rsvd4[3];
+	u32 crc_value;
+	u32 rsvd5[3];
+	u32 version;
+	u32 rsvd6[0xdb];
+
+	struct fuse_bank {
+		u32 fuse_regs[0x20];
+	} bank[16];
+};
+
+/* OTP Bank 4 */
+struct fuse_bank4_regs {
+	u32 sjc_resp0;
+	u32 rsvd0[3];
+	u32 sjc_resp1;
+	u32 rsvd1[3];
+	u32 mac_addr0;
+	u32 rsvd2[3];
+	u32 mac_addr1;
+	u32 rsvd3[3];
+	u32 mac_addr2;
+	u32 rsvd4[3];
+	u32 mac_addr3;
+	u32 rsvd5[3];
+	u32 gp1;
Quoted 8 lines

arch/arm/include/asm/arch-mvf600/clock.h

Quoted 5 lines
arch/arm/include/asm/arch-mvf600/clock.h new file +5 -0
+	u32 rsvd6[3];
+	u32 gp2;
+	u32 rsvd7[3];
+};
+

Have you seen that a driver for fuse / ocotp was recently added to mainline ? Have you tested on your platform ?

[Alison Wang] Yes, I saw the driver and tested it on my platform just now. It worked fine. I could enable ocotp support in the next version patch.

Thanks!

Best Regards,
Alison Wang

#10 lore raw

PATCH v2 2/6 arm: mvf600: Add IOMUX support for Vybrid MVF600

In reply to Alison Wang

This patch adds the IOMUX support for Vybrid MVF600 platform.

There is a little difference for IOMUXC module between MVF600 and i.MX platform, the muxmode and pad configuration share one 32bit register on MVF600, but they are two independent registers on I.MX platform. A CONFIG_IOMUX_SHARE_CONFIG_REG was introduced to fit this difference.

---
Changes in v2:
- Use common iomux-v3 code

 arch/arm/imx-common/Makefile               |  2 +-
 arch/arm/imx-common/iomux-v3.c             |  6 ++++++
 arch/arm/include/asm/imx-common/iomux-v3.h | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
arch/arm/imx-common/Makefile +1 -1
index 8bba8a5..3378931 100644
@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
 
 LIB     = $(obj)libimx-common.o
 
-ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6))
+ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mvf600))
 COBJS-y	= iomux-v3.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
arch/arm/imx-common/iomux-v3.c +6 -0
index 7fe5ce7..35880c7 100644
@@ -48,8 +48,14 @@ void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
 	if (sel_input_ofs)
 		__raw_writel(sel_input, base + sel_input_ofs);
 
+#ifdef CONFIG_IOMUX_SHARE_CONF_REG
+	if (!(pad_ctrl & NO_PAD_CTRL))
+		__raw_writel((mux_mode << PAD_MUX_MODE_SHIFT) | pad_ctrl,
+			base + pad_ctrl_ofs);
+#else
 	if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs)
 		__raw_writel(pad_ctrl, base + pad_ctrl_ofs);
+#endif
 }
 
 void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
arch/arm/include/asm/imx-common/iomux-v3.h +18 -0
index 0b4e763..7005fde 100644
@@ -121,6 +121,24 @@ typedef u64 iomux_v3_cfg_t;
 #define PAD_CTL_DSE_40ohm	(6 << 3)
 #define PAD_CTL_DSE_34ohm	(7 << 3)
 
+#elif defined(CONFIG_MVF600)
+
+#define PAD_MUX_MODE_SHIFT      20
+
+#define	PAD_CTL_PUS_47K_UP	(1 << 4)
+#define	PAD_CTL_PUS_100K_UP	(2 << 4)
+#define PAD_CTL_PUE		(1 << 2)
+#define PAD_CTL_PKE		(1 << 3)
+
+#define PAD_CTL_SPEED_HIGH	(3 << 12)
+#define PAD_CTL_SPEED_MED	(1 << 12)
+
+#define PAD_CTL_DSE_20ohm	(7 << 6)
+#define PAD_CTL_DSE_25ohm	(6 << 6)
+#define PAD_CTL_DSE_50ohm	(3 << 6)
+
+#define PAD_CTL_OBE_IBE_ENABLE	(3 << 0)
+
 #else
 
 #define PAD_CTL_DVS		(1 << 13)
Signature · 1 line
1.8.0
#11 lore raw

PATCH v2 2/6 arm: mvf600: Add IOMUX support for Vybrid MVF600

Quoted 69 lines · Alison Wang

This patch adds the IOMUX support for Vybrid MVF600 platform.

There is a little difference for IOMUXC module between MVF600 and i.MX platform, the muxmode and pad configuration share one 32bit register on MVF600, but they are two independent registers on I.MX platform. A CONFIG_IOMUX_SHARE_CONFIG_REG was introduced to fit this difference.

---
Changes in v2:
- Use common iomux-v3 code

 arch/arm/imx-common/Makefile               |  2 +-
 arch/arm/imx-common/iomux-v3.c             |  6 ++++++
 arch/arm/include/asm/imx-common/iomux-v3.h | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
arch/arm/imx-common/Makefile +1 -1
index 8bba8a5..3378931 100644
@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
 
 LIB     = $(obj)libimx-common.o
 
-ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6))
+ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mvf600))
 COBJS-y	= iomux-v3.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
arch/arm/imx-common/iomux-v3.c +6 -0
index 7fe5ce7..35880c7 100644
@@ -48,8 +48,14 @@ void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
 	if (sel_input_ofs)
 		__raw_writel(sel_input, base + sel_input_ofs);
 
+#ifdef CONFIG_IOMUX_SHARE_CONF_REG
+	if (!(pad_ctrl & NO_PAD_CTRL))
+		__raw_writel((mux_mode << PAD_MUX_MODE_SHIFT) | pad_ctrl,
+			base + pad_ctrl_ofs);
+#else
 	if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs)
 		__raw_writel(pad_ctrl, base + pad_ctrl_ofs);
+#endif
 }
 
 void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
arch/arm/include/asm/imx-common/iomux-v3.h +11 -0
index 0b4e763..7005fde 100644
@@ -121,6 +121,24 @@ typedef u64 iomux_v3_cfg_t;
 #define PAD_CTL_DSE_40ohm	(6 << 3)
 #define PAD_CTL_DSE_34ohm	(7 << 3)
 
+#elif defined(CONFIG_MVF600)
+
+#define PAD_MUX_MODE_SHIFT      20
+
+#define	PAD_CTL_PUS_47K_UP	(1 << 4)
+#define	PAD_CTL_PUS_100K_UP	(2 << 4)
+#define PAD_CTL_PUE		(1 << 2)
+#define PAD_CTL_PKE		(1 << 3)
+
+#define PAD_CTL_SPEED_HIGH	(3 << 12)
+#define PAD_CTL_SPEED_MED	(1 << 12)

arch/arm/include/asm/imx-common/iomux-v3.h typedef u64 iomux_v3_cfg_t; · line 144

Quoted 10 lines
arch/arm/include/asm/imx-common/iomux-v3.h +7 -0
+
+#define PAD_CTL_DSE_20ohm	(7 << 6)
+#define PAD_CTL_DSE_25ohm	(6 << 6)
+#define PAD_CTL_DSE_50ohm	(3 << 6)
+
+#define PAD_CTL_OBE_IBE_ENABLE	(3 << 0)
+
 #else
 
 #define PAD_CTL_DVS		(1 << 13)

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#12 lore raw

PATCH v2 2/6 arm: mvf600: Add IOMUX support for Vybrid MVF600

Hi Stefano, Alison,

Quoted 80 lines · Stefano Babic
Quoted 79 lines · Alison Wang

This patch adds the IOMUX support for Vybrid MVF600 platform.

There is a little difference for IOMUXC module between MVF600 and i.MX platform, the muxmode and pad configuration share one 32bit register on MVF600, but they are two independent registers on I.MX platform. A CONFIG_IOMUX_SHARE_CONFIG_REG was introduced to fit this difference.

---
Changes in v2:
- Use common iomux-v3 code

 arch/arm/imx-common/Makefile               |  2 +-
 arch/arm/imx-common/iomux-v3.c             |  6 ++++++
 arch/arm/include/asm/imx-common/iomux-v3.h | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
arch/arm/imx-common/Makefile +1 -1
index 8bba8a5..3378931 100644
@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
 
 LIB     = $(obj)libimx-common.o
 
-ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6))
+ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mvf600))
 COBJS-y	= iomux-v3.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
arch/arm/imx-common/iomux-v3.c +6 -0
index 7fe5ce7..35880c7 100644
@@ -48,8 +48,14 @@ void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
 	if (sel_input_ofs)
 		__raw_writel(sel_input, base + sel_input_ofs);
 
+#ifdef CONFIG_IOMUX_SHARE_CONF_REG
+	if (!(pad_ctrl & NO_PAD_CTRL))
+		__raw_writel((mux_mode << PAD_MUX_MODE_SHIFT) | pad_ctrl,
+			base + pad_ctrl_ofs);
+#else
 	if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs)
 		__raw_writel(pad_ctrl, base + pad_ctrl_ofs);
+#endif
 }
 
 void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
arch/arm/include/asm/imx-common/iomux-v3.h +18 -0
index 0b4e763..7005fde 100644
@@ -121,6 +121,24 @@ typedef u64 iomux_v3_cfg_t;
 #define PAD_CTL_DSE_40ohm	(6 << 3)
 #define PAD_CTL_DSE_34ohm	(7 << 3)
 
+#elif defined(CONFIG_MVF600)
+
+#define PAD_MUX_MODE_SHIFT      20
+
+#define	PAD_CTL_PUS_47K_UP	(1 << 4)
+#define	PAD_CTL_PUS_100K_UP	(2 << 4)
+#define PAD_CTL_PUE		(1 << 2)
+#define PAD_CTL_PKE		(1 << 3)
+
+#define PAD_CTL_SPEED_HIGH	(3 << 12)
+#define PAD_CTL_SPEED_MED	(1 << 12)
+
+#define PAD_CTL_DSE_20ohm	(7 << 6)
+#define PAD_CTL_DSE_25ohm	(6 << 6)
+#define PAD_CTL_DSE_50ohm	(3 << 6)
+
+#define PAD_CTL_OBE_IBE_ENABLE	(3 << 0)
+
 #else
 
Quoted 4 lines

arch/arm/include/asm/imx-common/iomux-v3.h typedef u64 iomux_v3_cfg_t; · line 144

Quoted 2 lines
arch/arm/include/asm/imx-common/iomux-v3.h +0 -0
 #define PAD_CTL_DVS		(1 << 13)

Could you please just fix the spaces/tabs mess in the #define-s?

Thanks.

Best regards,
Beno?t

#13 lore raw

PATCH v2 3/6 arm: mvf600: Add FEC support for Vybrid MVF600

In reply to Alison Wang

This patch adds FEC support for Vybrid MVF600 platform. Add code to use RMII for MVF600.

---
Changes in v2:
- Use common FEC driver fec_mxc.c

 drivers/net/fec_mxc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/fec_mxc.c +5 -1
index 4dbcdca..21e58f4 100644
@@ -518,7 +518,11 @@ static int fec_open(struct eth_device *edev)
 		u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED;
 		u32 rcr = (readl(&fec->eth->r_cntrl) &
 				~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) |
-				FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE;
+				FEC_RCNTRL_MII_MODE;
+		if (fec->xcv_type == RGMII)
+			rcr |= FEC_RCNTRL_RGMII;
+		else if (fec->xcv_type == RMII)
+			rcr |= FEC_RCNTRL_RMII;
 		if (speed == _1000BASET)
 			ecr |= FEC_ECNTRL_SPEED;
 		else if (speed != _100BASET)
Signature · 1 line
1.8.0
#14 lore raw

PATCH v2 3/6 arm: mvf600: Add FEC support for Vybrid MVF600

Quoted 19 lines · Alison Wang

This patch adds FEC support for Vybrid MVF600 platform. Add code to use RMII for MVF600.

---
Changes in v2:
- Use common FEC driver fec_mxc.c

 drivers/net/fec_mxc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/fec_mxc.c +0 -0
index 4dbcdca..21e58f4 100644
@@ -518,7 +518,11 @@ static int fec_open(struct eth_device *edev)
 		u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED;
 		u32 rcr = (readl(&fec->eth->r_cntrl) &

drivers/net/fec_mxc.c static int fec_open(struct eth_device *edev) · line 528

Quoted 10 lines
drivers/net/fec_mxc.c +5 -1
 				~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) |
-				FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE;
+				FEC_RCNTRL_MII_MODE;
+		if (fec->xcv_type == RGMII)
+			rcr |= FEC_RCNTRL_RGMII;
+		else if (fec->xcv_type == RMII)
+			rcr |= FEC_RCNTRL_RMII;
 		if (speed == _1000BASET)
 			ecr |= FEC_ECNTRL_SPEED;
 		else if (speed != _100BASET)

This can generally be applied, it is not only related to the new SOC.

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#15 lore raw

PATCH v2 3/6 arm: mvf600: Add FEC support for Vybrid MVF600

Hi Stefano, Alison,

Quoted 33 lines · Stefano Babic
Quoted 19 lines · Alison Wang

This patch adds FEC support for Vybrid MVF600 platform. Add code to use RMII for MVF600.

---
Changes in v2:
- Use common FEC driver fec_mxc.c

 drivers/net/fec_mxc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/fec_mxc.c +0 -0
index 4dbcdca..21e58f4 100644
@@ -518,7 +518,11 @@ static int fec_open(struct eth_device *edev)
 		u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED;
 		u32 rcr = (readl(&fec->eth->r_cntrl) &

drivers/net/fec_mxc.c static int fec_open(struct eth_device *edev) · line 528

Quoted 10 lines
drivers/net/fec_mxc.c +5 -1
 				~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) |
-				FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE;
+				FEC_RCNTRL_MII_MODE;
+		if (fec->xcv_type == RGMII)
+			rcr |= FEC_RCNTRL_RGMII;
+		else if (fec->xcv_type == RMII)
+			rcr |= FEC_RCNTRL_RMII;
 		if (speed == _1000BASET)
 			ecr |= FEC_ECNTRL_SPEED;
 		else if (speed != _100BASET)

This can generally be applied, it is not only related to the new SOC.

Quoted 1 line

This is already done in fec_reg_setup(), so the piece of code above could perhaps just leave untouched the FEC_RCNTRL_RGMII / FEC_RCNTRL_RMII / FEC_RCNTRL_MII_MODE bits, i.e.:

---

#ifdef FEC_QUIRK_ENET_MAC
	{
		u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED;
-		u32 rcr = (readl(&fec->eth->r_cntrl) &
-				~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) |
-				FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE;
+		u32 rcr = readl(&fec->eth->r_cntrl) & ~FEC_RCNTRL_RMII_10T;
		if (speed == _1000BASET)
			ecr |= FEC_ECNTRL_SPEED;
		else if (speed != _100BASET)

---

Best regards,
Beno?t

#16 lore raw

PATCH v2 4/6 arm: mvf600: Add watchdog support for Vybrid MVF600

In reply to Alison Wang

This patch adds watchdog support for Vybrid MVF600 platform.

---
Changes in v2:
- Add watchdog support
- Use reset_cpu() in imx_watchdog.c

 drivers/watchdog/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Makefile +1 -1
index 13e7c37..40946df 100644
@@ -27,7 +27,7 @@ LIB	:= $(obj)libwatchdog.o
 
 COBJS-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
 COBJS-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
-ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6))
+ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mvf600))
 COBJS-y += imx_watchdog.o
 endif
 COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o
Signature · 1 line
1.8.0
#17 lore raw

PATCH v2 5/6 arm: mvf600: Add uart support for Vybrid MVF600

In reply to Alison Wang

This patch adds lpuart support for Vybrid MVF600 platform.

---
Changes in v2:
- Define C structures and access C structures to set/read registers
- Change the names to reuse this driver on other platforms

 drivers/serial/Makefile        |   1 +
 drivers/serial/serial_lpuart.c | 161 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 162 insertions(+)
 create mode 100644 drivers/serial/serial_lpuart.c
drivers/serial/Makefile +1 -0
index fbc4e97..bb6559b 100644
@@ -52,6 +52,7 @@ COBJS-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o
 COBJS-$(CONFIG_SANDBOX_SERIAL) += sandbox.o
 COBJS-$(CONFIG_SCIF_CONSOLE) += serial_sh.o
 COBJS-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o
+COBJS-$(CONFIG_FSL_LPUART) += serial_lpuart.o
 
 ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_USB_TTY) += usbtty.o
drivers/serial/serial_lpuart.c new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
1.8.0
#18 lore raw

PATCH v2 6/6 arm: mvf600: Add basic support for Vybrid MVF600TWR board

In reply to Alison Wang

MVF600TWR is a board based on Vybrid MVF600 SoC.

This patch adds basic support for Vybrid MVF600TWR board.

---
Changes in v2:
- Add an entry to MAINTAINERS file
- Rename directory name 'vybird' to 'mvf600twr'
- Use standard method to set gd->ram_size
- Rewrite board_mmc_getcd() function
- Remove useless undef
- Remove hardcoded IP addresses and MAC addresses
- Remove useless CONFIG_SYS_ defines
- Define C structures and access C structures to set/read registers
- Move CONFIG_MACH_TYPE to board configuration file
- Use common iomux-v3 code

 MAINTAINERS                            |   4 +
 board/freescale/mvf600twr/Makefile     |  39 ++++
 board/freescale/mvf600twr/imximage.cfg |  35 +++
 board/freescale/mvf600twr/mvf600twr.c  | 403 +++++++++++++++++++++++++++++++++
 boards.cfg                             |   1 +
 include/configs/mvf600twr.h            | 147 ++++++++++++
 6 files changed, 629 insertions(+)
 create mode 100644 board/freescale/mvf600twr/Makefile
 create mode 100644 board/freescale/mvf600twr/imximage.cfg
 create mode 100644 board/freescale/mvf600twr/mvf600twr.c
 create mode 100644 include/configs/mvf600twr.h
MAINTAINERS +4 -0
index c05433a..d32ac66 100644
@@ -1057,6 +1057,10 @@ Eric Nelson <[email protected]>
 	nitrogen6s		i.MX6S		512MB
 	nitrogen6s1g		i.MX6S		1GB
 
+Alison Wang <[email protected]>
+
+	mvf600twr	MVF600
+
 -------------------------------------------------------------------------
 
 Unknown / orphaned boards:
board/freescale/mvf600twr/Makefile new file +39 -0
new file mode 100644
index 0000000..7416228
@@ -0,0 +1,39 @@
+#
+# Copyright 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 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., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	:= $(BOARD).o
+
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/freescale/mvf600twr/imximage.cfg new file +35 -0
new file mode 100644
index 0000000..33ead0f
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ *
+ * Refer docs/README.imxmage for more details about how-to configure
+ * and create imximage boot image
+ *
+ * The syntax is taken as close as possible with the kwbimage
+ */
+
+/* image version */
+IMAGE_VERSION 2
+
+/*
+ * Boot Device : one of
+ * spi, sd (the board has no nand neither onenand)
+ */
+BOOT_FROM	sd
board/freescale/mvf600twr/mvf600twr.c new file +403 -0

403 lines not on this page · raw message

boards.cfg +1 -0
index 2f39f26..60c1920 100644
@@ -262,6 +262,7 @@ mx6qsabrelite                arm         armv7       mx6qsabrelite       freesca
 mx6qsabresd                  arm         armv7       mx6qsabresd         freescale      mx6		mx6qsabresd:IMX_CONFIG=board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
 mx6slevk                     arm         armv7       mx6slevk            freescale      mx6		mx6slevk:IMX_CONFIG=board/freescale/mx6slevk/imximage.cfg,MX6SL
 titanium                     arm         armv7       titanium            freescale      mx6		titanium:IMX_CONFIG=board/freescale/titanium/imximage.cfg
+mvf600twr                    arm         armv7       mvf600twr           freescale      mvf600          mvf600twr:IMX_CONFIG=board/freescale/mvf600twr/imximage.cfg
 eco5pk                       arm         armv7       eco5pk              8dtech         omap3
 nitrogen6dl                  arm         armv7       nitrogen6x          boundary       mx6		nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024
 nitrogen6dl2g                arm         armv7       nitrogen6x          boundary       mx6		nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl2g.cfg,MX6DL,DDR_MB=2048
include/configs/mvf600twr.h new file +147 -0

147 lines not on this page · raw message

Signature · 1 line
1.8.0
#19 lore raw

PATCH v2 6/6 arm: mvf600: Add basic support for Vybrid MVF600TWR board

include/configs/mvf600twr.h

Quoted 5 lines · Alison Wang
include/configs/mvf600twr.h new file +0 -0
new file mode 100644
index 0000000..bb1f3ef

To make it friendly to the mainline kernel, I would suggest we enable the following two options.

CONFIG_OF_LIBFDT
CONFIG_CMD_BOOTZ

Shawn

#20 lore raw

PATCH v2 6/6 arm: mvf600: Add basic support for Vybrid MVF600TWR board

Quoted 20 lines

-----Original Message-----
From: Shawn Guo [mailto:shawn.guo at linaro.org]
Sent: Wednesday, May 15, 2013 12:15 PM
To: Wang Huan-B18965
Cc: sbabic at denx.de; u-boot at lists.denx.de; TsiChung Liew; Jin Zhengxiong- R64188; Estevam Fabio-R49496
Subject: Re: [U-Boot] [PATCH v2 6/6] arm: mvf600: Add basic support for Vybrid MVF600TWR board

include/configs/mvf600twr.h

Quoted 4 lines · Alison Wang
include/configs/mvf600twr.h new file +0 -0
new file mode 100644 index 0000000..bb1f3ef

To make it friendly to the mainline kernel, I would suggest we enable the following two options.

Quoted 3 lines

CONFIG_OF_LIBFDT
CONFIG_CMD_BOOTZ

[Alison Wang] Yes, I will enable them. Thanks.

#21 lore raw

PATCH v2 6/6 arm: mvf600: Add basic support for Vybrid MVF600TWR board

In reply to Alison Wang
Quoted 8 lines · Alison Wang

MVF600TWR is a board based on Vybrid MVF600 SoC.

This patch adds basic support for Vybrid MVF600TWR board.

---

Hi Alison,

Quoted 31 lines
board/freescale/mvf600twr/imximage.cfg new file +25 -0
new file mode 100644
index 0000000..33ead0f
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ *
+ * Refer docs/README.imxmage for more details about how-to configure
+ * and create imximage boot image
+ *
+ * The syntax is taken as close as possible with the kwbimage

board/freescale/mvf600twr/imximage.cfg line 35

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+ */
+
+/* image version */
+IMAGE_VERSION 2
+
+/*
+ * Boot Device : one of
+ * spi, sd (the board has no nand neither onenand)
+ */
+BOOT_FROM	sd

Ok, verstanden (I hope). This SOC has plenty of internal IRAM. It still uses the imximage mechanism, but you decided to start from internal RAM instead of DDR and to set up the RAM controller in the board initialization function.

We recently discussed about the wrongness of BOOT_FROM command. It makes no sense, and it was replaced by BOOT_OFFSET. If the SOC uses the main common offset (0x400), you can put

BOOT_OFFSET FLASH_OFFSET_STANDARD

board/freescale/mvf600twr/imximage.cfg

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+#include <netdev.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define UART_PAD_CTRL	(PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
+			PAD_CTL_DSE_25ohm | PAD_CTL_OBE_IBE_ENABLE)
+
+#define ESDHC_PAD_CTRL	(PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP | \
+			PAD_CTL_SPEED_HIGH | PAD_CTL_DSE_20ohm | \
+			PAD_CTL_OBE_IBE_ENABLE)

Please see commit 7e2173cf82d0bc235b695460c56d46927febdf36 and adjust this SOC consequently. PUE requires that PKE is enabled, that means that setting PKE alone does nothing. Then it is better to define PAD_CTL_PUE so that PKE is enabled, so in your 2/6 (that I have too fast acked):

PAD_CTL_PUE (1 << 2 | PAD_CTL_PKE)

and drop PAD_CTL_PKE here. This must fixed globally.

Quoted 50 lines
board/freescale/mvf600twr/imximage.cfg new file +50 -0
+#define ENET_PAD_CTRL	(PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_HIGH | \
+			PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE)
+
+#define DDR_PAD_CTRL	PAD_CTL_DSE_25ohm
+
+#define PHY_DQ_TIMING		0x00002613
+#define PHY_DQS_TIMING		0x00002615
+#define PHY_CTRL		0x01210080
+#define PHY_MASTER_CTRL		0x0001012a
+#define PHY_SLAVE_CTRL		0x00012020
+
+iomux_v3_cfg_t const ddr_pads[] = {
+	MVF600_PAD_DDR_A15__DDR_A_15 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A14__DDR_A_14 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A13__DDR_A_13 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A12__DDR_A_12 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A11__DDR_A_11 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A10__DDR_A_10 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A9__DDR_A_9 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A8__DDR_A_8 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A7__DDR_A_7 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A6__DDR_A_6 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A5__DDR_A_5 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A4__DDR_A_4 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A3__DDR_A_3 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A2__DDR_A_2 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A1__DDR_A_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_BA2__DDR_BA_2 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_BA1__DDR_BA_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_BA0__DDR_BA_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_CAS__DDR_CAS_B | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_CKE__DDR_CKE_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_CLK__DDR_CLK_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_CS__DDR_CS_B_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D15__DDR_D_15 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D14__DDR_D_14 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D13__DDR_D_13 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D12__DDR_D_12 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D11__DDR_D_11 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D10__DDR_D_10 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D9__DDR_D_9 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D8__DDR_D_8 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D7__DDR_D_7 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D6__DDR_D_6 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D5__DDR_D_5 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D4__DDR_D_4 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D3__DDR_D_3 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D2__DDR_D_2 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D1__DDR_D_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D0__DDR_D_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),

board/freescale/mvf600twr/imximage.cfg

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+	MVF600_PAD_DDR_DQM1__DDR_DQM_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_DQM0__DDR_DQM_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_DQS1__DDR_DQS_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_DQS0__DDR_DQS_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_RAS__DDR_RAS_B | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_WE__DDR_WE_B | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_ODT1__DDR_ODT_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_ODT0__DDR_ODT_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+};
+

As this is the first board with this SOC, it can be ok. But is this setup valid only for this board ? Maybe the pads for RAM should be the same. Then this part should be factorize elsewhere.

Quoted 24 lines
board/freescale/mvf600twr/imximage.cfg new file +24 -0
+void setup_iomux_ddr(void)
+{
+	imx_iomux_v3_setup_multiple_pads(ddr_pads, ARRAY_SIZE(ddr_pads));
+}
+
+void ddr_phy_init(void)
+{
+	struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR;
+
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[0]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[16]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[32]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[48]);
+
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[1]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[17]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[33]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[49]);
+
+	__raw_writel(PHY_CTRL, &ddrmr->phy[2]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[18]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[34]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[50]);
+

board/freescale/mvf600twr/imximage.cfg

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[3]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[19]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[35]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[51]);
+
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[4]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[20]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[36]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[52]);
+

Without reference manual, it is difficult to judge. But it is surely difficult to read. What does hide under the magic index of the ddrmr stucture ?

board/freescale/mvf600twr/imximage.cfg

Quoted 2 lines
board/freescale/mvf600twr/imximage.cfg new file +2 -0
+	__raw_writel(0x00001105, &ddrmr->phy[50]);
+}

And can you add useful define instead of raw number ?

Quoted 110 lines
board/freescale/mvf600twr/imximage.cfg new file +110 -0
+
+void ddr_ctrl_init(void)
+{
+	struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR;
+
+	__raw_writel(0x00000600, &ddrmr->cr[0]);	/* LPDDR2 or DDR3 */
+	__raw_writel(0x00000020, &ddrmr->cr[2]);	/* TINIT */
+	__raw_writel(0x0000007c, &ddrmr->cr[10]);
+
+	__raw_writel(0x00013880, &ddrmr->cr[11]);
+	__raw_writel(0x0000050c, &ddrmr->cr[12]);
+	__raw_writel(0x15040404, &ddrmr->cr[13]);
+	__raw_writel(0x1406040F, &ddrmr->cr[14]);
+	__raw_writel(0x04040000, &ddrmr->cr[16]);
+	__raw_writel(0x006DB00C, &ddrmr->cr[17]);
+	__raw_writel(0x00000403, &ddrmr->cr[18]);
+
+	__raw_writel(0x01000000, &ddrmr->cr[20]);
+	__raw_writel(0x06060101, &ddrmr->cr[21]);
+
+	__raw_writel(0x000B0000, &ddrmr->cr[22]);
+	__raw_writel(0x03000200, &ddrmr->cr[23]);
+	__raw_writel(0x00000006, &ddrmr->cr[24]);
+
+	__raw_writel(0x00010000, &ddrmr->cr[25]);
+	__raw_writel(0x0C28002C, &ddrmr->cr[26]);
+	__raw_writel(0x00000005, &ddrmr->cr[28]);
+	__raw_writel(0x00000003, &ddrmr->cr[29]);
+
+	__raw_writel(0x0000000A, &ddrmr->cr[30]);
+	__raw_writel(0x00440200, &ddrmr->cr[31]);
+	__raw_writel(0x00010000, &ddrmr->cr[33]);
+	__raw_writel(0x00050500, &ddrmr->cr[34]);
+
+	/* Frequency change */
+	__raw_writel(0x00000100, &ddrmr->cr[38]);
+	__raw_writel(0x04001002, &ddrmr->cr[39]);
+
+	__raw_writel(0x00000001, &ddrmr->cr[41]);
+	__raw_writel(0x00000000, &ddrmr->cr[45]);
+	__raw_writel(0x00000000, &ddrmr->cr[46]);
+	__raw_writel(0x00000000, &ddrmr->cr[47]);
+
+	/* DRAM device Mode registers */
+	__raw_writel(0x00460420, &ddrmr->cr[48]);
+	__raw_writel(0x00000000, &ddrmr->cr[49]);
+	__raw_writel(0x00000000, &ddrmr->cr[51]);
+	__raw_writel(0x00000000, &ddrmr->cr[57]);
+
+	/* ZQ stuff */
+	__raw_writel(0x01000200, &ddrmr->cr[66]);
+	__raw_writel(0x02000040, &ddrmr->cr[67]);
+	__raw_writel(0x00000200, &ddrmr->cr[69]);
+
+	__raw_writel(0x00000040, &ddrmr->cr[70]);
+	__raw_writel(0x00000000, &ddrmr->cr[71]);
+	__raw_writel(0x01000000, &ddrmr->cr[72]);
+
+	/* DRAM controller misc */
+	__raw_writel(0x0a010300, &ddrmr->cr[73]);
+	__raw_writel(0x0101ffff, &ddrmr->cr[74]);
+	__raw_writel(0x01010101, &ddrmr->cr[75]);
+	__raw_writel(0x03030101, &ddrmr->cr[76]);
+	__raw_writel(0x01000101, &ddrmr->cr[77]);
+	__raw_writel(0x0000000C, &ddrmr->cr[78]);
+	__raw_writel(0x01000000, &ddrmr->cr[79]);
+
+	/* Disable interrupts */
+	__raw_writel(0x1FFFFFFF, &ddrmr->cr[82]);
+
+	/* ODT */
+	__raw_writel(0x01010000, &ddrmr->cr[87]);
+	__raw_writel(0x00040000, &ddrmr->cr[88]);
+	__raw_writel(0x00000002, &ddrmr->cr[89]);
+
+	__raw_writel(0x00020000, &ddrmr->cr[91]);
+	__raw_writel(0x00000000, &ddrmr->cr[92]);
+
+	__raw_writel(0x00002819, &ddrmr->cr[96]);
+
+	/* AXI ports */
+	__raw_writel(0x00202000, &ddrmr->cr[105]);
+	__raw_writel(0x20200000, &ddrmr->cr[106]);
+	__raw_writel(0x00002020, &ddrmr->cr[110]);
+	__raw_writel(0x00202000, &ddrmr->cr[114]);
+	__raw_writel(0x20200000, &ddrmr->cr[115]);
+
+	__raw_writel(0x00000101, &ddrmr->cr[117]);
+	__raw_writel(0x01010000, &ddrmr->cr[118]);
+	__raw_writel(0x00000000, &ddrmr->cr[119]);
+
+	__raw_writel(0x02020000, &ddrmr->cr[120]);
+	__raw_writel(0x00000202, &ddrmr->cr[121]);
+	__raw_writel(0x01010064, &ddrmr->cr[122]);
+	__raw_writel(0x00000101, &ddrmr->cr[123]);
+	__raw_writel(0x00000064, &ddrmr->cr[124]);
+
+	/* TDFI */
+	__raw_writel(0x00000000, &ddrmr->cr[125]);
+	__raw_writel(0x00000B00, &ddrmr->cr[126]);
+	__raw_writel(0x00000000, &ddrmr->cr[127]);
+
+	__raw_writel(0x00000000, &ddrmr->cr[131]);
+	__raw_writel(0x00000506, &ddrmr->cr[132]);
+	__raw_writel(0x02000000, &ddrmr->cr[137]);
+	__raw_writel(0x04070303, &ddrmr->cr[139]);
+
+	__raw_writel(0x00000000, &ddrmr->cr[136]);
+
+	__raw_writel(0x68200000, &ddrmr->cr[154]);

board/freescale/mvf600twr/imximage.cfg

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+	__raw_writel(0x00000202, &ddrmr->cr[155]);
+	__raw_writel(0x00000006, &ddrmr->cr[158]);
+	__raw_writel(0x00000006, &ddrmr->cr[159]);
+
+	ddr_phy_init();
+
+	__raw_writel(0x00000601, &ddrmr->cr[0]);
+
+	udelay(200);
+}

Ditto. There are a lot of magical numbers here associated to magic indexes.

Quoted 20 lines
board/freescale/mvf600twr/imximage.cfg new file +20 -0
+
+static void clock_init(void)
+{
+	struct ccm_reg *ccm = (struct ccm_reg *)CCM_BASE_ADDR;
+	struct anadig_reg *anadig = (struct anadig_reg *)ANADIG_BASE_ADDR;
+
+	__raw_writel(0x00000078, &ccm->clpcr);
+	__raw_writel(0x000fc000, &ccm->ccgr0);
+	__raw_writel(0xf00fc0c0, &ccm->ccgr1);
+	__raw_writel(0x0fff0303, &ccm->ccgr2);
+	__raw_writel(0x00000033, &ccm->ccgr3);
+	__raw_writel(0x33f0f003, &ccm->ccgr4);
+	__raw_writel(0x3003cc00, &ccm->ccgr6);
+	__raw_writel(0x0000033c, &ccm->ccgr7);
+	__raw_writel(0x0000000f, &ccm->ccgr9);
+
+	__raw_writel(0x00002001, &anadig->pll2_ctrl);
+	__raw_writel(0x00011001, &anadig->pll5_ctrl);
+	__raw_writel(0x00002001, &anadig->pll1_ctrl);
+

board/freescale/mvf600twr/imximage.cfg

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+	__raw_writel(0x00010005, &ccm->ccr);
+	__raw_writel(0x0003ff64, &ccm->ccsr);
+	__raw_writel(0x00000810, &ccm->cacrr);
+	__raw_writel(0x03cf0000, &ccm->cscmr1);
+	__raw_writel(0x01000000, &ccm->cscdr1);
+	__raw_writel(0x30004240, &ccm->cscdr2);
+	__raw_writel(0x00003f1f, &ccm->cscdr3);
+	__raw_writel(0, &ccm->cscmr2);
+	__raw_writel(0, &ccm->cscdr4);
+}

The same here. Note that in most boards we use clrsetbits_le32() to set the single bits and all bits are defined in the crm_regs.h.

board/freescale/mvf600twr/imximage.cfg

Quoted 12 lines
board/freescale/mvf600twr/imximage.cfg new file +12 -0
+int board_eth_init(bd_t *bis)
+{
+	int ret;
+
+	setup_iomux_enet();
+
+	ret = cpu_eth_init(bis);
+	if (ret)
+		printf("FEC MXC: %s:failed\n", __func__);
+
+	return 0;
+}

Maybe not useful ? I mean, if you move setup_iomux_enet() into board_early_init_f(), you can drop this function, because it simply calls cpu_eth_init()

Quoted 30 lines
include/configs/mvf600twr.h new file +24 -0
new file mode 100644
index 0000000..bb1f3ef
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the Freescale Vybrid mvf600twr board.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+

include/configs/mvf600twr.h line 34

Quoted 10 lines
include/configs/mvf600twr.h new file +10 -0
+#include <asm/arch/imx-regs.h>
+#include <config_cmd_default.h>
+
+#define CONFIG_MVF600
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define MACH_TYPE_VYBRID_VF6XX		4146
+#define CONFIG_MACH_TYPE		MACH_TYPE_VYBRID_VF6XX

Your choice, but maybe you could drop MACH_TYPE_VYBRID_VF6XX, because it is not used in any file.

include/configs/mvf600twr.h line 39

Quoted 5 lines
include/configs/mvf600twr.h new file +5 -0
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#define CONFIG_SYS_ICACHE_OFF
+#define CONFIG_SYS_CACHELINE_SIZE	64

On the website, cache is marked "optional" in the figure. Does it mean that some SOC have instruction cache and other ones not ?

Is this setup related to the fact that you use start.S inside armv7 and something is not compatible ?

Quoted 14 lines
include/configs/mvf600twr.h new file +14 -0
+
+/* Enable passing of ATAGs */
+#define CONFIG_CMDLINE_TAG
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+#define CONFIG_FSL_LPUART
+
+/* Allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_SYS_UART_PORT		(1)

include/configs/mvf600twr.h line 63

Quoted 10 lines
include/configs/mvf600twr.h new file +10 -0
+#define CONFIG_BAUDRATE			115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{9600, 19200, 38400, 57600, 115200}
+
+#define CONFIG_CMD_BDI		/* bdinfo */
+#define CONFIG_CMD_BOOTD
+#define CONFIG_CMD_CONSOLE	/* coninfo */
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_MEMORY	/* md mm nm mw cp cmp crc base loop mtest */
+#define CONFIG_CMD_MISC
+#undef CONFIG_CMD_IMLS

You do not include cmd_default.h. Is it wanted ?

include/configs/mvf600twr.h line 66

Quoted 3 lines
include/configs/mvf600twr.h new file +3 -0
+
+/* MUX mode and PAD ctrl are in one register */
+#define CONFIG_IOMUX_SHARE_CONF_REG

NAK. This is not a board configuration, it is related to the SOC. This setup should flow into the related imx-regs.h for this SOC. When you set CONFIG_MVF600, this value should be set automatically.

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#22 lore raw

PATCH v2 6/6 arm: mvf600: Add basic support for Vybrid MVF600TWR board

Hi, Stefano,

Quoted 59 lines · Alison Wang
Quoted 8 lines

MVF600TWR is a board based on Vybrid MVF600 SoC.

This patch adds basic support for Vybrid MVF600TWR board.

---

Hi Alison,

Quoted 30 lines
board/freescale/mvf600twr/imximage.cfg new file +23 -0
new file mode 100644
index 0000000..33ead0f
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ *
+ * Refer docs/README.imxmage for more details about how-to configure
+ * and create imximage boot image

board/freescale/mvf600twr/imximage.cfg line 33

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+ *
+ * The syntax is taken as close as possible with the kwbimage  */
+
+/* image version */
+IMAGE_VERSION 2
+
+/*
+ * Boot Device : one of
+ * spi, sd (the board has no nand neither onenand)  */
+BOOT_FROM	sd

Ok, verstanden (I hope). This SOC has plenty of internal IRAM. It still uses the imximage mechanism, but you decided to start from internal RAM instead of DDR and to set up the RAM controller in the board initialization function.

Quoted 6 lines

We recently discussed about the wrongness of BOOT_FROM command. It makes no sense, and it was replaced by BOOT_OFFSET. If the SOC uses the main common offset (0x400), you can put

BOOT_OFFSET FLASH_OFFSET_STANDARD

[Alison Wang] I will use BOOT_OFFSET. Thanks.

Quoted 19 lines

board/freescale/mvf600twr/imximage.cfg

Quoted 6 lines
board/freescale/mvf600twr/imximage.cfg new file +5 -0
+#include <netdev.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define UART_PAD_CTRL	(PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |

\

board/freescale/mvf600twr/imximage.cfg

Quoted 3 lines
board/freescale/mvf600twr/imximage.cfg new file +3 -0
+			PAD_CTL_DSE_25ohm | PAD_CTL_OBE_IBE_ENABLE)
+
+#define ESDHC_PAD_CTRL	(PAD_CTL_PKE | PAD_CTL_PUE |

PAD_CTL_PUS_100K_UP | \

board/freescale/mvf600twr/imximage.cfg

Quoted 2 lines
board/freescale/mvf600twr/imximage.cfg new file +2 -0
+			PAD_CTL_SPEED_HIGH | PAD_CTL_DSE_20ohm | \
+			PAD_CTL_OBE_IBE_ENABLE)

Please see commit 7e2173cf82d0bc235b695460c56d46927febdf36 and adjust this SOC consequently. PUE requires that PKE is enabled, that means that setting PKE alone does nothing. Then it is better to define PAD_CTL_PUE so that PKE is enabled, so in your 2/6 (that I have too fast acked):

Quoted 3 lines

PAD_CTL_PUE (1 << 2 | PAD_CTL_PKE)

and drop PAD_CTL_PKE here. This must fixed globally.

[Alison Wang] Agree, I will change as above. Thanks.

Quoted 95 lines
Quoted 2 lines

+#define ENET_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_HIGH |

\

Quoted 48 lines
board/freescale/mvf600twr/imximage.cfg new file +48 -0
+			PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE)
+
+#define DDR_PAD_CTRL	PAD_CTL_DSE_25ohm
+
+#define PHY_DQ_TIMING		0x00002613
+#define PHY_DQS_TIMING		0x00002615
+#define PHY_CTRL		0x01210080
+#define PHY_MASTER_CTRL		0x0001012a
+#define PHY_SLAVE_CTRL		0x00012020
+
+iomux_v3_cfg_t const ddr_pads[] = {
+	MVF600_PAD_DDR_A15__DDR_A_15 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A14__DDR_A_14 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A13__DDR_A_13 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A12__DDR_A_12 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A11__DDR_A_11 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A10__DDR_A_10 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A9__DDR_A_9 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A8__DDR_A_8 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A7__DDR_A_7 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A6__DDR_A_6 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A5__DDR_A_5 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A4__DDR_A_4 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A3__DDR_A_3 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A2__DDR_A_2 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_A1__DDR_A_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_BA2__DDR_BA_2 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_BA1__DDR_BA_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_BA0__DDR_BA_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_CAS__DDR_CAS_B | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_CKE__DDR_CKE_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_CLK__DDR_CLK_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_CS__DDR_CS_B_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D15__DDR_D_15 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D14__DDR_D_14 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D13__DDR_D_13 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D12__DDR_D_12 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D11__DDR_D_11 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D10__DDR_D_10 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D9__DDR_D_9 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D8__DDR_D_8 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D7__DDR_D_7 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D6__DDR_D_6 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D5__DDR_D_5 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D4__DDR_D_4 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D3__DDR_D_3 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D2__DDR_D_2 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_D1__DDR_D_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),

board/freescale/mvf600twr/imximage.cfg

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+	MVF600_PAD_DDR_D0__DDR_D_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_DQM1__DDR_DQM_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_DQM0__DDR_DQM_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_DQS1__DDR_DQS_1 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_DQS0__DDR_DQS_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_RAS__DDR_RAS_B | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_WE__DDR_WE_B | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_ODT1__DDR_ODT_0 | MUX_PAD_CTRL(DDR_PAD_CTRL),
+	MVF600_PAD_DDR_ODT0__DDR_ODT_1 | MUX_PAD_CTRL(DDR_PAD_CTRL), };
+

As this is the first board with this SOC, it can be ok. But is this setup valid only for this board ? Maybe the pads for RAM should be the same. Then this part should be factorize elsewhere.

Quoted 29 lines
board/freescale/mvf600twr/imximage.cfg new file +29 -0
+void setup_iomux_ddr(void)
+{
+	imx_iomux_v3_setup_multiple_pads(ddr_pads, ARRAY_SIZE(ddr_pads)); }
+
+void ddr_phy_init(void)
+{
+	struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR;
+
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[0]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[16]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[32]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[48]);
+
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[1]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[17]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[33]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[49]);
+
+	__raw_writel(PHY_CTRL, &ddrmr->phy[2]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[18]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[34]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[50]);
+
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[3]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[19]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[35]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[51]);
+
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[4]);
Quoted 8 lines

board/freescale/mvf600twr/imximage.cfg

Quoted 4 lines
board/freescale/mvf600twr/imximage.cfg new file +4 -0
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[20]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[36]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[52]);
+

Without reference manual, it is difficult to judge. But it is surely difficult to read. What does hide under the magic index of the ddrmr stucture ?

[Alison Wang] In the reference manual, the registers are named as phy00, phy01, phy02.... cr00, cr01, cr02.... I think there may be some confusion if I rename the registers.

Quoted 5 lines

board/freescale/mvf600twr/imximage.cfg

Quoted 3 lines
board/freescale/mvf600twr/imximage.cfg new file +1 -0
+	__raw_writel(0x00001105, &ddrmr->phy[50]); }

And can you add useful define instead of raw number ?

[Alison Wang] Yes, I will add useful define.

Quoted 151 lines
Quoted 111 lines
board/freescale/mvf600twr/imximage.cfg new file +110 -0
+
+void ddr_ctrl_init(void)
+{
+	struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR;
+
+	__raw_writel(0x00000600, &ddrmr->cr[0]);	/* LPDDR2 or DDR3 */
+	__raw_writel(0x00000020, &ddrmr->cr[2]);	/* TINIT */
+	__raw_writel(0x0000007c, &ddrmr->cr[10]);
+
+	__raw_writel(0x00013880, &ddrmr->cr[11]);
+	__raw_writel(0x0000050c, &ddrmr->cr[12]);
+	__raw_writel(0x15040404, &ddrmr->cr[13]);
+	__raw_writel(0x1406040F, &ddrmr->cr[14]);
+	__raw_writel(0x04040000, &ddrmr->cr[16]);
+	__raw_writel(0x006DB00C, &ddrmr->cr[17]);
+	__raw_writel(0x00000403, &ddrmr->cr[18]);
+
+	__raw_writel(0x01000000, &ddrmr->cr[20]);
+	__raw_writel(0x06060101, &ddrmr->cr[21]);
+
+	__raw_writel(0x000B0000, &ddrmr->cr[22]);
+	__raw_writel(0x03000200, &ddrmr->cr[23]);
+	__raw_writel(0x00000006, &ddrmr->cr[24]);
+
+	__raw_writel(0x00010000, &ddrmr->cr[25]);
+	__raw_writel(0x0C28002C, &ddrmr->cr[26]);
+	__raw_writel(0x00000005, &ddrmr->cr[28]);
+	__raw_writel(0x00000003, &ddrmr->cr[29]);
+
+	__raw_writel(0x0000000A, &ddrmr->cr[30]);
+	__raw_writel(0x00440200, &ddrmr->cr[31]);
+	__raw_writel(0x00010000, &ddrmr->cr[33]);
+	__raw_writel(0x00050500, &ddrmr->cr[34]);
+
+	/* Frequency change */
+	__raw_writel(0x00000100, &ddrmr->cr[38]);
+	__raw_writel(0x04001002, &ddrmr->cr[39]);
+
+	__raw_writel(0x00000001, &ddrmr->cr[41]);
+	__raw_writel(0x00000000, &ddrmr->cr[45]);
+	__raw_writel(0x00000000, &ddrmr->cr[46]);
+	__raw_writel(0x00000000, &ddrmr->cr[47]);
+
+	/* DRAM device Mode registers */
+	__raw_writel(0x00460420, &ddrmr->cr[48]);
+	__raw_writel(0x00000000, &ddrmr->cr[49]);
+	__raw_writel(0x00000000, &ddrmr->cr[51]);
+	__raw_writel(0x00000000, &ddrmr->cr[57]);
+
+	/* ZQ stuff */
+	__raw_writel(0x01000200, &ddrmr->cr[66]);
+	__raw_writel(0x02000040, &ddrmr->cr[67]);
+	__raw_writel(0x00000200, &ddrmr->cr[69]);
+
+	__raw_writel(0x00000040, &ddrmr->cr[70]);
+	__raw_writel(0x00000000, &ddrmr->cr[71]);
+	__raw_writel(0x01000000, &ddrmr->cr[72]);
+
+	/* DRAM controller misc */
+	__raw_writel(0x0a010300, &ddrmr->cr[73]);
+	__raw_writel(0x0101ffff, &ddrmr->cr[74]);
+	__raw_writel(0x01010101, &ddrmr->cr[75]);
+	__raw_writel(0x03030101, &ddrmr->cr[76]);
+	__raw_writel(0x01000101, &ddrmr->cr[77]);
+	__raw_writel(0x0000000C, &ddrmr->cr[78]);
+	__raw_writel(0x01000000, &ddrmr->cr[79]);
+
+	/* Disable interrupts */
+	__raw_writel(0x1FFFFFFF, &ddrmr->cr[82]);
+
+	/* ODT */
+	__raw_writel(0x01010000, &ddrmr->cr[87]);
+	__raw_writel(0x00040000, &ddrmr->cr[88]);
+	__raw_writel(0x00000002, &ddrmr->cr[89]);
+
+	__raw_writel(0x00020000, &ddrmr->cr[91]);
+	__raw_writel(0x00000000, &ddrmr->cr[92]);
+
+	__raw_writel(0x00002819, &ddrmr->cr[96]);
+
+	/* AXI ports */
+	__raw_writel(0x00202000, &ddrmr->cr[105]);
+	__raw_writel(0x20200000, &ddrmr->cr[106]);
+	__raw_writel(0x00002020, &ddrmr->cr[110]);
+	__raw_writel(0x00202000, &ddrmr->cr[114]);
+	__raw_writel(0x20200000, &ddrmr->cr[115]);
+
+	__raw_writel(0x00000101, &ddrmr->cr[117]);
+	__raw_writel(0x01010000, &ddrmr->cr[118]);
+	__raw_writel(0x00000000, &ddrmr->cr[119]);
+
+	__raw_writel(0x02020000, &ddrmr->cr[120]);
+	__raw_writel(0x00000202, &ddrmr->cr[121]);
+	__raw_writel(0x01010064, &ddrmr->cr[122]);
+	__raw_writel(0x00000101, &ddrmr->cr[123]);
+	__raw_writel(0x00000064, &ddrmr->cr[124]);
+
+	/* TDFI */
+	__raw_writel(0x00000000, &ddrmr->cr[125]);
+	__raw_writel(0x00000B00, &ddrmr->cr[126]);
+	__raw_writel(0x00000000, &ddrmr->cr[127]);
+
+	__raw_writel(0x00000000, &ddrmr->cr[131]);
+	__raw_writel(0x00000506, &ddrmr->cr[132]);
+	__raw_writel(0x02000000, &ddrmr->cr[137]);
+	__raw_writel(0x04070303, &ddrmr->cr[139]);
+
+	__raw_writel(0x00000000, &ddrmr->cr[136]);
+
+	__raw_writel(0x68200000, &ddrmr->cr[154]);

board/freescale/mvf600twr/imximage.cfg

Quoted 10 lines
board/freescale/mvf600twr/imximage.cfg new file +10 -0
+	__raw_writel(0x00000202, &ddrmr->cr[155]);
+	__raw_writel(0x00000006, &ddrmr->cr[158]);
+	__raw_writel(0x00000006, &ddrmr->cr[159]);
+
+	ddr_phy_init();
+
+	__raw_writel(0x00000601, &ddrmr->cr[0]);
+
+	udelay(200);
+}

Ditto. There are a lot of magical numbers here associated to magic indexes.

Quoted 25 lines
board/freescale/mvf600twr/imximage.cfg new file +25 -0
+
+static void clock_init(void)
+{
+	struct ccm_reg *ccm = (struct ccm_reg *)CCM_BASE_ADDR;
+	struct anadig_reg *anadig = (struct anadig_reg *)ANADIG_BASE_ADDR;
+
+	__raw_writel(0x00000078, &ccm->clpcr);
+	__raw_writel(0x000fc000, &ccm->ccgr0);
+	__raw_writel(0xf00fc0c0, &ccm->ccgr1);
+	__raw_writel(0x0fff0303, &ccm->ccgr2);
+	__raw_writel(0x00000033, &ccm->ccgr3);
+	__raw_writel(0x33f0f003, &ccm->ccgr4);
+	__raw_writel(0x3003cc00, &ccm->ccgr6);
+	__raw_writel(0x0000033c, &ccm->ccgr7);
+	__raw_writel(0x0000000f, &ccm->ccgr9);
+
+	__raw_writel(0x00002001, &anadig->pll2_ctrl);
+	__raw_writel(0x00011001, &anadig->pll5_ctrl);
+	__raw_writel(0x00002001, &anadig->pll1_ctrl);
+
+	__raw_writel(0x00010005, &ccm->ccr);
+	__raw_writel(0x0003ff64, &ccm->ccsr);
+	__raw_writel(0x00000810, &ccm->cacrr);
+	__raw_writel(0x03cf0000, &ccm->cscmr1);
+	__raw_writel(0x01000000, &ccm->cscdr1);
Quoted 8 lines

board/freescale/mvf600twr/imximage.cfg

Quoted 5 lines
board/freescale/mvf600twr/imximage.cfg new file +5 -0
+	__raw_writel(0x30004240, &ccm->cscdr2);
+	__raw_writel(0x00003f1f, &ccm->cscdr3);
+	__raw_writel(0, &ccm->cscmr2);
+	__raw_writel(0, &ccm->cscdr4);
+}

The same here. Note that in most boards we use clrsetbits_le32() to set the single bits and all bits are defined in the crm_regs.h.

[Alison Wang] Agree, I will change them. Thanks.

Quoted 17 lines

board/freescale/mvf600twr/imximage.cfg

Quoted 13 lines
board/freescale/mvf600twr/imximage.cfg new file +12 -0
+int board_eth_init(bd_t *bis)
+{
+	int ret;
+
+	setup_iomux_enet();
+
+	ret = cpu_eth_init(bis);
+	if (ret)
+		printf("FEC MXC: %s:failed\n", __func__);
+
+	return 0;
+}

Maybe not useful ? I mean, if you move setup_iomux_enet() into board_early_init_f(), you can drop this function, because it simply calls cpu_eth_init()

[Alison Wang] Agree, I will drop this funtion, and move setup_iomux_enet() into board_early_init_f(). Thanks.

Quoted 35 lines
Quoted 35 lines
include/configs/mvf600twr.h new file +29 -0
new file mode 100644 index 0000000..bb1f3ef
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Configuration settings for the Freescale Vybrid mvf600twr board.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/arch/imx-regs.h>
+#include <config_cmd_default.h>
+
+#define CONFIG_MVF600
+
Quoted 8 lines

include/configs/mvf600twr.h line 34

Quoted 5 lines
include/configs/mvf600twr.h new file +5 -0
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define MACH_TYPE_VYBRID_VF6XX		4146
+#define CONFIG_MACH_TYPE		MACH_TYPE_VYBRID_VF6XX

Your choice, but maybe you could drop MACH_TYPE_VYBRID_VF6XX, because it is not used in any file.

[Alison Wang] Agree. I will drop it.

Quoted 9 lines

include/configs/mvf600twr.h line 39

Quoted 6 lines
include/configs/mvf600twr.h new file +5 -0
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#define CONFIG_SYS_ICACHE_OFF
+#define CONFIG_SYS_CACHELINE_SIZE	64

On the website, cache is marked "optional" in the figure. Does it mean that some SOC have instruction cache and other ones not ?

[Alison Wang] There is instruction cache on MVF600.

Quoted 3 lines

Is this setup related to the fact that you use start.S inside armv7 and something is not compatible ?

[Alison Wang] No, I will drop it.

Quoted 26 lines

include/configs/mvf600twr.h

Quoted 7 lines
include/configs/mvf600twr.h new file +6 -0
+
+/* Enable passing of ATAGs */
+#define CONFIG_CMDLINE_TAG
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 2 * 1024 *

1024)

include/configs/mvf600twr.h

Quoted 10 lines
include/configs/mvf600twr.h new file +10 -0
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+#define CONFIG_FSL_LPUART
+
+/* Allow to overwrite serial and ethaddr */ #define
+CONFIG_ENV_OVERWRITE
+#define CONFIG_SYS_UART_PORT		(1)
+#define CONFIG_BAUDRATE			115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{9600, 19200, 38400, 57600,

115200}

include/configs/mvf600twr.h

Quoted 6 lines
include/configs/mvf600twr.h new file +6 -0
+
+#define CONFIG_CMD_BDI		/* bdinfo */
+#define CONFIG_CMD_BOOTD
+#define CONFIG_CMD_CONSOLE	/* coninfo */
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_MEMORY	/* md mm nm mw cp cmp crc base loop mtest

*/

Quoted 4 lines

include/configs/mvf600twr.h line 63

Quoted 2 lines
include/configs/mvf600twr.h new file +2 -0
+#define CONFIG_CMD_MISC
+#undef CONFIG_CMD_IMLS

You do not include cmd_default.h. Is it wanted ?

[Alison Wang] As I include config_cmd_default.h at the start of this file, I will drop these redundant options.

Quoted 8 lines

include/configs/mvf600twr.h line 66

Quoted 4 lines
include/configs/mvf600twr.h new file +3 -0
+
+/* MUX mode and PAD ctrl are in one register */ #define
+CONFIG_IOMUX_SHARE_CONF_REG

NAK. This is not a board configuration, it is related to the SOC. This setup should flow into the related imx-regs.h for this SOC. When you set CONFIG_MVF600, this value should be set automatically.

[Alison Wang] Agree, I will move it to imx-regs.h. Thanks.

BTW, what's your suggestions about the other two patches, [PATCH v2 4/6] and [PATCH v2 5/6]? Thanks.

Best regards,
Alison Wang

#23 lore raw

PATCH v2 6/6 arm: mvf600: Add basic support for Vybrid MVF600TWR board

Quoted 2 lines · On 17/05/2013 17:20, Wang Huan-B18965 wrote:

Hi, Stefano,

Hi Alison,

Quoted 37 lines
Quoted 29 lines
Quoted 29 lines
board/freescale/mvf600twr/mvf600twr.c new file +29 -0
+void setup_iomux_ddr(void)
+{
+	imx_iomux_v3_setup_multiple_pads(ddr_pads, ARRAY_SIZE(ddr_pads)); }
+
+void ddr_phy_init(void)
+{
+	struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR;
+
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[0]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[16]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[32]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[48]);
+
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[1]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[17]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[33]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[49]);
+
+	__raw_writel(PHY_CTRL, &ddrmr->phy[2]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[18]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[34]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[50]);
+
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[3]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[19]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[35]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[51]);
+
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[4]);
Quoted 8 lines

board/freescale/mvf600twr/mvf600twr.c line 160

Quoted 4 lines
board/freescale/mvf600twr/mvf600twr.c new file +4 -0
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[20]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[36]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[52]);
+

Without reference manual, it is difficult to judge. But it is surely difficult to read. What does hide under the magic index of the ddrmr stucture ?

Quoted 2 lines

[Alison Wang] In the reference manual, the registers are named as phy00, phy01, phy02.... cr00, cr01, cr02.... I think there may be some confusion if I rename the registers.

Then the names of the registers are ok - I wanted only to be sure that what we read here is what we can find in the RM.

Quoted 4 lines

BTW, what's your suggestions about the other two patches, [PATCH v2 4/6] and [PATCH v2 5/6]? Thanks.

Patches 4/6 and 5/6 are ok for me.

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#24 lore raw

PATCH v2 6/6 arm: mvf600: Add basic support for Vybrid MVF600TWR board

Hi Stefano, Alison,

Quoted 53 lines · Stefano Babic
Quoted 2 lines · On 17/05/2013 17:20, Wang Huan-B18965 wrote:

Hi, Stefano,

Hi Alison,

Quoted 37 lines
Quoted 29 lines
Quoted 29 lines
board/freescale/mvf600twr/mvf600twr.c new file +29 -0
+void setup_iomux_ddr(void)
+{
+	imx_iomux_v3_setup_multiple_pads(ddr_pads, ARRAY_SIZE(ddr_pads)); }
+
+void ddr_phy_init(void)
+{
+	struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR;
+
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[0]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[16]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[32]);
+	__raw_writel(PHY_DQ_TIMING, &ddrmr->phy[48]);
+
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[1]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[17]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[33]);
+	__raw_writel(PHY_DQS_TIMING, &ddrmr->phy[49]);
+
+	__raw_writel(PHY_CTRL, &ddrmr->phy[2]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[18]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[34]);
+	__raw_writel(PHY_CTRL, &ddrmr->phy[50]);
+
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[3]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[19]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[35]);
+	__raw_writel(PHY_MASTER_CTRL, &ddrmr->phy[51]);
+
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[4]);
Quoted 8 lines

board/freescale/mvf600twr/mvf600twr.c line 160

Quoted 4 lines
board/freescale/mvf600twr/mvf600twr.c new file +4 -0
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[20]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[36]);
+	__raw_writel(PHY_SLAVE_CTRL, &ddrmr->phy[52]);
+

Without reference manual, it is difficult to judge. But it is surely difficult to read. What does hide under the magic index of the ddrmr stucture ?

Quoted 3 lines

[Alison Wang] In the reference manual, the registers are named as phy00, phy01, phy02.... cr00, cr01, cr02....
I think there may be some confusion if I rename the registers.

Then the names of the registers are ok - I wanted only to be sure that what we read here is what we can find in the RM.

Quoted 2 lines
Quoted 5 lines
Quoted 3 lines

BTW, what's your suggestions about the other two patches, [PATCH v2 4/6] and [PATCH v2 5/6]?
Thanks.

Patches 4/6 and 5/6 are ok for me.

And what about my comments regarding 2/6 and 3/6? There has been no reply for that so far.

Best regards,
Beno?t

#25 lore raw

PATCH v2 6/6 arm: mvf600: Add basic support for Vybrid MVF600TWR board

Quoted 1 line · Beno?t Th?baudeau

Hi Stefano, Alison,

Hi Benoit,

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

BTW, what's your suggestions about the other two patches, [PATCH v2 4/6] and [PATCH v2 5/6]?
Thanks.

Patches 4/6 and 5/6 are ok for me.

And what about my comments regarding 2/6 and 3/6? There has been no reply for that so far.

Of course, the issues you mentioned must be fixed as well !

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================