Skip to contentSkip to conversation

ARM: am335x: Add phyCORE AM335x R2 support

PATCH Superseded Niel Fourie 3 participants 4 messages May 3, 2019 – May 6, 2019

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 ARM: am335x: Add phyCORE AM335x R2 support

Support for Phytech phyCORE AM335x R2 SOM (PCL060) on the Phytec phyBOARD-Wega AM335x.

CPU  : AM335X-GP rev 2.1
Model: Phytec AM335x phyBOARD-WEGA
DRAM:  256 MiB
NAND:  256 MiB
MMC:   OMAP SD/MMC: 0
eth0: ethernet at 4a100000

Working:
- Eth0
- i2C
- MMC/SD
- NAND
- UART
- USB (host)

Device trees were taken from Linux mainline:
commit 37624b58542fb9f2 ("Linux 5.1-rc7")

---
 arch/arm/dts/Makefile                      |   3 +-
 arch/arm/dts/am335x-phycore-som.dtsi       | 322 +++++++++++++++++++++
 arch/arm/dts/am335x-wega-rdk-u-boot.dtsi   |  27 ++
 arch/arm/dts/am335x-wega-rdk.dts           |  23 ++
 arch/arm/dts/am335x-wega.dtsi              | 230 +++++++++++++++
 arch/arm/dts/am33xx-u-boot.dtsi            |  11 +
 arch/arm/mach-omap2/Kconfig                |   1 +
 arch/arm/mach-omap2/am33xx/Kconfig         |   7 +
 board/phytec/phycore_am335x_r2/Kconfig     |  15 +
 board/phytec/phycore_am335x_r2/MAINTAINERS |   7 +
 board/phytec/phycore_am335x_r2/Makefile    |  11 +
 board/phytec/phycore_am335x_r2/board.c     | 252 ++++++++++++++++
 board/phytec/phycore_am335x_r2/board.h     |  24 ++
 board/phytec/phycore_am335x_r2/mux.c       | 117 ++++++++
 configs/phycore-am335x-r2-wega_defconfig   |  78 +++++
 include/configs/phycore_am335x_r2.h        | 130 +++++++++
 16 files changed, 1257 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/am335x-phycore-som.dtsi
 create mode 100644 arch/arm/dts/am335x-wega-rdk-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-wega-rdk.dts
 create mode 100644 arch/arm/dts/am335x-wega.dtsi
 create mode 100644 board/phytec/phycore_am335x_r2/Kconfig
 create mode 100644 board/phytec/phycore_am335x_r2/MAINTAINERS
 create mode 100644 board/phytec/phycore_am335x_r2/Makefile
 create mode 100644 board/phytec/phycore_am335x_r2/board.c
 create mode 100644 board/phytec/phycore_am335x_r2/board.h
 create mode 100644 board/phytec/phycore_am335x_r2/mux.c
 create mode 100644 configs/phycore-am335x-r2-wega_defconfig
 create mode 100644 include/configs/phycore_am335x_r2.h
arch/arm/dts/Makefile +2 -1
index dfa5b02958..4736980468 100644
@@ -262,7 +262,8 @@ dtb-$(CONFIG_AM33XX) += \
 	am335x-chiliboard.dtb \
 	am335x-sl50.dtb \
 	am335x-base0033.dtb \
-	am335x-guardian.dtb
+	am335x-guardian.dtb \
+	am335x-wega-rdk.dtb
 dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb	\
 	am43x-epos-evm.dtb \
 	am437x-idk-evm.dtb \
arch/arm/dts/am335x-phycore-som.dtsi new file +322 -0

322 lines not on this page · raw message

arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +27 -0
new file mode 100644
index 0000000000..4e55d7e0df
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 DENX Software Engineering GmbH
+ */
+
+#include "am33xx-u-boot.dtsi"
+
+/ {
+	chosen {
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		bootargs = "console=ttyO0,115200 earlyprintk";
+		stdout-path = &uart0;
+	};
+};
+
+&uart0 {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
+};
+
+&mmc1 {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
+	cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
+};
arch/arm/dts/am335x-wega-rdk.dts new file +23 -0
new file mode 100644
index 0000000000..fe50f3041a
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2015 Phytec Messtechnik GmbH
+ * Author: Teresa Remmet <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/dts-v1/;
+
+#include "am335x-phycore-som.dtsi"
+#include "am335x-wega.dtsi"
+
+/* SoM */
+&i2c_eeprom {
+	status = "okay";
+};
+
+&i2c_rtc {
+	status = "okay";
+};
arch/arm/dts/am335x-wega.dtsi new file +230 -0

230 lines not on this page · raw message

arch/arm/dts/am33xx-u-boot.dtsi +11 -0
index 78f5e2c4d3..a58734e441 100644
@@ -6,6 +6,17 @@
 
 / {
 	ocp {
+		u-boot,dm-spl;
 		u-boot,dm-pre-reloc;
 	};
+
+	memory at 80000000 {
+		u-boot,dm-spl;
+		u-boot,dm-pre-reloc;
+	};
+};
+
+&scm {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
 };
arch/arm/mach-omap2/Kconfig +1 -0
index d29f1ca0b5..3fa9dc89b8 100644
@@ -186,6 +186,7 @@ source "board/ti/am43xx/Kconfig"
 source "board/ti/am335x/Kconfig"
 source "board/compulab/cm_t335/Kconfig"
 source "board/compulab/cm_t43/Kconfig"
+source "board/phytec/phycore_am335x_r2/Kconfig"
 
 config SPL_LDSCRIPT
         default "arch/arm/mach-omap2/u-boot-spl.lds"
arch/arm/mach-omap2/am33xx/Kconfig +7 -0
index 500df1aa11..9da2a16a99 100644
@@ -177,6 +177,13 @@ config TARGET_PEPPER
 	select DM_SERIAL
 	imply CMD_DM
 
+config TARGET_PHYCORE_AM335X_R2
+	bool "Support phyCORE AM335X R2"
+	select DM
+	select DM_GPIO
+	select DM_SERIAL
+	imply CMD_DM
+
 config TARGET_PXM2
 	bool "Support pxm2"
 	select BOARD_LATE_INIT
board/phytec/phycore_am335x_r2/Kconfig new file +15 -0
new file mode 100644
index 0000000000..77055e043c
@@ -0,0 +1,15 @@
+if TARGET_PHYCORE_AM335X_R2
+
+config SYS_BOARD
+	default "phycore_am335x_r2"
+
+config SYS_VENDOR
+	default "phytec"
+
+config SYS_SOC
+	default "am33xx"
+
+config SYS_CONFIG_NAME
+	default "phycore_am335x_r2"
+
+endif
board/phytec/phycore_am335x_r2/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000000..e56f30fdc0
@@ -0,0 +1,7 @@
+phyCORE AM335x R2 WEGA BOARD
+M:	Niel Fourie <[email protected]>
+M:	Parthiban Nallathambi <[email protected]>
+S:	Maintained
+F:	board/phytec/phycore_am335x_r2
+F:	include/configs/phycore_am335x_r2.h
+F:	configs/phycore-am335x-r2-wega_defconfig
board/phytec/phycore_am335x_r2/Makefile new file +11 -0
new file mode 100644
index 0000000000..ff6f8b4221
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Makefile
+#
+# Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+
+ifdef CONFIG_SPL_BUILD
+obj-y	+= mux.o
+endif
+
+obj-y	+= board.o
board/phytec/phycore_am335x_r2/board.c new file +252 -0

252 lines not on this page · raw message

board/phytec/phycore_am335x_r2/board.h new file +24 -0
new file mode 100644
index 0000000000..68c3d56aa5
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * board.h
+ *
+ * Phytec phyCORE-AM335x (pcl060) boards information header
+ *
+ * Copyright (C) 2013 Lars Poeschel, Lemonage Software GmbH
+ * Copyright (C) 2019 DENX Software Engineering GmbH
+ */
+
+#ifndef _BOARD_H_
+#define _BOARD_H_
+
+/*
+ * We have three pin mux functions that must exist.  We must be able to enable
+ * uart0, for initial output and i2c0 to access the PMIC. We then have a main
+ * pinmux function that can be overridden to enable all other pinmux that
+ * is required on the board.
+ */
+void enable_uart0_pin_mux(void);
+void enable_i2c0_pin_mux(void);
+void enable_board_pin_mux(void);
+void enable_cbmux_pin_mux(void);
+#endif
board/phytec/phycore_am335x_r2/mux.c new file +117 -0

117 lines not on this page · raw message

configs/phycore-am335x-r2-wega_defconfig new file +78 -0

78 lines not on this page · raw message

include/configs/phycore_am335x_r2.h new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
2.17.2
#1 lore raw

PATCH v4 1/1 ARM: am335x: Add phyCORE AM335x R2 support

Quoted 18 lines · Niel Fourie

Support for Phytech phyCORE AM335x R2 SOM (PCL060) on the Phytec phyBOARD-Wega AM335x.

CPU  : AM335X-GP rev 2.1
Model: Phytec AM335x phyBOARD-WEGA
DRAM:  256 MiB
NAND:  256 MiB
MMC:   OMAP SD/MMC: 0
eth0: ethernet at 4a100000

Working:
- Eth0
- i2C
- MMC/SD
- NAND
- UART
- USB (host)

Quoted 4 lines

Device trees were taken from Linux mainline:
commit 37624b58542fb9f2 ("Linux 5.1-rc7")

Changelog is missing.

[...]

Quoted 12 lines
arch/arm/dts/am33xx-u-boot.dtsi +2 -0
index 78f5e2c4d3..a58734e441 100644
@@ -6,6 +6,17 @@
 
 / {
 	ocp {
+		u-boot,dm-spl;
 		u-boot,dm-pre-reloc;
 	};
+

arch/arm/dts/am33xx-u-boot.dtsi line 22

Quoted 10 lines
arch/arm/dts/am33xx-u-boot.dtsi +9 -0
+	memory at 80000000 {
+		u-boot,dm-spl;
+		u-boot,dm-pre-reloc;
+	};
+};
+
+&scm {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
 };

Since this affects other boards, shouldn't this be a separate patch ? And then clean up arch/arm/dts/am335x-shc-u-boot.dtsi and others, so we won't have duplicate nodes there.

[...]

Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH v4 1/1 ARM: am335x: Add phyCORE AM335x R2 support

In reply to Niel Fourie
Quoted 22 lines · Niel Fourie

Support for Phytech phyCORE AM335x R2 SOM (PCL060) on the Phytec phyBOARD-Wega AM335x.

CPU  : AM335X-GP rev 2.1
Model: Phytec AM335x phyBOARD-WEGA
DRAM:  256 MiB
NAND:  256 MiB
MMC:   OMAP SD/MMC: 0
eth0: ethernet at 4a100000

Working:
- Eth0
- i2C
- MMC/SD
- NAND
- UART
- USB (host)

Device trees were taken from Linux mainline:
commit 37624b58542fb9f2 ("Linux 5.1-rc7")

[snip]

arch/arm/dts/am33xx-u-boot.dtsi line 10

Quoted 10 lines
arch/arm/dts/am33xx-u-boot.dtsi +1 -0
index 78f5e2c4d3..a58734e441 100644
@@ -6,6 +6,17 @@
 
 / {
 	ocp {
+		u-boot,dm-spl;
 		u-boot,dm-pre-reloc;

First off, this is wrong. In the code (see drivers/core/ofnode.c and drivers/core/util.c) everywhere we check for u-boot,dm-spl we've already checked for u-boot,dm-pre-reloc and returned true. So all of these kind of changes above need to be fixed.

arch/arm/dts/am33xx-u-boot.dtsi line 22

Quoted 12 lines
arch/arm/dts/am33xx-u-boot.dtsi +10 -0
 	};
+
+	memory at 80000000 {
+		u-boot,dm-spl;
+		u-boot,dm-pre-reloc;
+	};
+};
+
+&scm {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
 };

Second, where are you seeing that we need these nodes to be moved to be available earlier? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190503/fc068bd1/attachment.sig>
#3 lore raw

PATCH v4 1/1 ARM: am335x: Add phyCORE AM335x R2 support

Hi Tom,

Quoted 6 lines · Tom Rini

On Fri, May 03, 2019 at 01:28:02PM +0200, Niel Fourie wrote:
[snip]

arch/arm/dts/am33xx-u-boot.dtsi

Quoted 4 lines
arch/arm/dts/am33xx-u-boot.dtsi +0 -0
index 78f5e2c4d3..a58734e441 100644

Sorry, I had not fully understood the implications of moving these changes to am33xx-u-boot.dtsi, so will move them back to am335x-wega-rdk-u-boot.dtsi where they belong. As Marek also pointed out, they belong in a seperate patch from this one anyways.

Quoted 12 lines

arch/arm/dts/am33xx-u-boot.dtsi line 10

Quoted 6 lines
arch/arm/dts/am33xx-u-boot.dtsi +1 -0
@@ -6,6 +6,17 @@
 
  / {
  	ocp {
+		u-boot,dm-spl;
  		u-boot,dm-pre-reloc;

First off, this is wrong. In the code (see drivers/core/ofnode.c and drivers/core/util.c) everywhere we check for u-boot,dm-spl we've already checked for u-boot,dm-pre-reloc and returned true. So all of these kind of changes above need to be fixed.

Thanks, now I understand the mechanism. Will fix!

Quoted 7 lines
Quoted 7 lines
arch/arm/dts/am33xx-u-boot.dtsi +6 -0
  	};
+
+	memory at 80000000 {
+		u-boot,dm-spl;
+		u-boot,dm-pre-reloc;
+	};
+};
Quoted 8 lines

arch/arm/dts/am33xx-u-boot.dtsi line 22

Quoted 5 lines
arch/arm/dts/am33xx-u-boot.dtsi +4 -0
+
+&scm {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
  };

Second, where are you seeing that we need these nodes to be moved to be available earlier? Thanks!

In my case, I needed "ocp" because it is the parent of mmc1, and I used DM wherever I could, including for MMC in the SPL. I needed "memory" because the RAM size is specified in the device tree for RAM initialisation. After double checking, it appears that scm is in fact redundant (I included it for DDR3 and pin muxing). But, as this is likely not the case for everyone, I will move them back to am335x-wega-rdk-u-boot.dtsi as mentioned before.

Thanks for your feedback.

Best regards,
Niel Fourie

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-21 Fax: +49-8142-66989-80  Email: lusus at denx.de