Skip to contentSkip to conversation

ARM: am335x: Add phyCORE AM335x R2 support

PATCH New Niel Fourie 3 participants 5 messages May 8, 2019 – May 25, 2019

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

PATCH v6 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 37624b58542f ("Linux 5.1-rc7")

---

Notes:
Changes for v6:
- RAM initialisation reworked to detect available memory
- Remove memory section from am335x-wega-rdk-u-boot.dtsi

Changes for v5:
- Revert proposed moving of sections to am33xx-u-boot.dtsi
- Remove redundant/incorrect lines from am33xx-u-boot.dtsi
- Add missing changelog

Changes for v4:
- Propose abstracting common sections to am33xx-u-boot.dtsi
- Remove dead Falcon mode code
- Remove non-DM I2C support for TPS65910 I2C

Changes for v3:
- Added kernel revision of upstream Linux dtsi files
- Place TARGET_PHYCORE_AM335X_R2 alphabetically in Kconfig
- Rework TPS65910 I2C init code
- Remove non-DM USB board macros
- Minor tweaks

Changes for v2:
- Remove formatting changes to upstream Linux dtsi files
- Remove incorrectly added MACH_TYPE
- Rename board from phycore_pcl060 to phycore_am335x_r2
- Implement selecting memory size from device tree
- Remove non-DM Ethernet board code
- General clean-up

 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/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     | 259 +++++++++++++++++
 board/phytec/phycore_am335x_r2/board.h     |  24 ++
 board/phytec/phycore_am335x_r2/mux.c       | 117 ++++++++
 configs/phycore-am335x-r2-wega_defconfig   |  79 +++++
 include/configs/phycore_am335x_r2.h        | 130 +++++++++
 15 files changed, 1254 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 8e082f2840..381a64ae13 100644
@@ -264,7 +264,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..76292c43c8
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 DENX Software Engineering GmbH
+ */
+
+/ {
+	chosen {
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		bootargs = "console=ttyO0,115200 earlyprintk";
+		stdout-path = &uart0;
+	};
+
+	ocp {
+		u-boot,dm-pre-reloc;
+	};
+};
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&mmc1 {
+	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/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 +259 -0

259 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 +79 -0

79 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.21.0
#1 lore raw

PATCH v6 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 5 lines

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

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/20190515/d330d03e/attachment.sig>
#2 lore raw

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

In reply to Niel Fourie
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 5 lines

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

Minor nits below...

[...]

board/phytec/phycore_am335x_r2/board.c line 5

Quoted 11 lines
board/phytec/phycore_am335x_r2/board.c new file +5 -0
new file mode 100644
index 0000000000..2f5bca27c2
@@ -0,0 +1,259 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * board.c
+ *
+ * Board functions for Phytec phyCORE-AM335x R2 (pcl060) based boards

PCL060 / PCM060

[...]

board/phytec/phycore_am335x_r2/board.h line 5

Quoted 11 lines
board/phytec/phycore_am335x_r2/board.h new file +5 -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

PCL060 / PCM060

[...]

configs/phycore-am335x-r2-wega_defconfig line 1

Quoted 7 lines
configs/phycore-am335x-r2-wega_defconfig new file +1 -0
new file mode 100644
index 0000000000..8888d8ff60
@@ -0,0 +1,79 @@
+CONFIG_ARM=y

It would be useful to enable CMD_DHCP and CMD_PING

[...]

include/configs/phycore_am335x_r2.h line 5

Quoted 11 lines
include/configs/phycore_am335x_r2.h new file +5 -0
new file mode 100644
index 0000000000..31a07062a0
@@ -0,0 +1,130 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * phycore_am335x_r2.h
+ *
+ * Phytec phyCORE-AM335x R2 (pcl060) boards information header

PCL060 / PCM060

[...]

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

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

In reply to Niel Fourie

On 5/8/19 1:22 PM, Niel Fourie wrote:

[...]

Quoted 73 lines
include/configs/phycore_am335x_r2.h new file +67 -0
new file mode 100644
index 0000000000..31a07062a0
@@ -0,0 +1,130 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * phycore_am335x_r2.h
+ *
+ * Phytec phyCORE-AM335x R2 (pcl060) boards information header
+ *
+ * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
+ * Copyright (C) 2013 Lars Poeschel, Lemonage Software GmbH
+ * Copyright (C) 2019 DENX Software Engineering GmbH
+ */
+
+#ifndef __CONFIG_PHYCORE_AM335x_R2_H
+#define __CONFIG_PHYCORE_AM335x_R2_H
+
+#include <configs/ti_am335x_common.h>
+
+#define CONFIG_ENV_SIZE			SZ_128K
+#define CONFIG_MACH_TYPE		MACH_TYPE_SBC_PHYCORE_AM335X
+#define CONFIG_SYS_MMC_ENV_DEV		0
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
+
+#ifdef CONFIG_NAND
+#define NANDARGS \
+	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
+	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
+	"nandargs=setenv bootargs console=${console} " \
+		"${optargs} " \
+		"root=${nandroot} " \
+		"rootfstype=${nandrootfstype}\0" \
+	"nandroot=ubi0:root ubi.mtd=NAND.UBI\0" \
+	"nandrootfstype=ubifs rootwait rw fsck.repair=yes\0" \
+	"nandboot=echo Booting from nand ...; " \
+		"run nandargs; " \
+		"ubi part NAND.UBI; " \
+		"ubi readvol ${fdtaddr} oftree; " \
+		"ubi readvol ${loadaddr} kernel; " \
+		"bootz ${loadaddr} - ${fdtaddr}\0"
+
+#else
+#define NANDARGS ""
+#endif
+
+/* set to negative value for no autoboot */
+#define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
+	"bootcmd_" #devtypel #instance "=" \
+	"setenv mmcdev " #instance "; "\
+	"setenv bootpart " #instance ":1 ; "\
+	"setenv rootpart " #instance ":2 ; "\
+	"run mmcboot\0"
+
+#define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
+	#devtypel #instance " "
+
+#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
+	"bootcmd_" #devtypel #instance "=" \
+	"run nandboot\0"
+
+#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
+	#devtypel #instance " "
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0) \
+	func(LEGACY_MMC, legacy_mmc, 0) \
+	func(MMC, mmc, 1) \
+	func(LEGACY_MMC, legacy_mmc, 1) \
+	func(NAND, nand, 0)
+

include/configs/phycore_am335x_r2.h line 77

Quoted 10 lines
include/configs/phycore_am335x_r2.h new file +10 -0
+#include <config_distro_bootcmd.h>
+#include <environment/ti/dfu.h>
+#include <environment/ti/mmc.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	DEFAULT_MMC_TI_ARGS \
+	DEFAULT_LINUX_BOOT_ENV \
+	"bootfile=zImage\0" \
+	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+	"console=ttyO0,115200n8\0" \

console=ttyS0,115200

ttyO0 is deprecated

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

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

In reply to Niel Fourie

On 5/8/19 1:22 PM, Niel Fourie wrote:

[...]

Quoted 15 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +9 -0
new file mode 100644
index 0000000000..76292c43c8
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 DENX Software Engineering GmbH
+ */
+
+/ {
+	chosen {
+		#address-cells = <1>;
+		#size-cells = <1>;

arch/arm/dts/am335x-wega-rdk-u-boot.dtsi line 19

Quoted 10 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +10 -0
+
+		bootargs = "console=ttyO0,115200 earlyprintk";
+		stdout-path = &uart0;
+	};
+
+	ocp {
+		u-boot,dm-pre-reloc;
+	};
+};
+

i2c0 should have dm-pre-reloc here too, see below.

Quoted 8 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +8 -0
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&mmc1 {
+	u-boot,dm-pre-reloc;
+	cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
+};

[...]

Quoted 14 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +14 -0
+const struct dpll_params *get_dpll_mpu_params(void)
+{
+	int ind = get_sys_clk_index();
+	int freq = am335x_get_efuse_mpu_max_freq(cdev);
+
+	switch (freq) {
+	case MPUPLL_M_1000:
+		return &dpll_mpu_opp[ind][5];
+	case MPUPLL_M_800:
+		return &dpll_mpu_opp[ind][4];
+	case MPUPLL_M_720:
+		return &dpll_mpu_opp[ind][3];
+	case MPUPLL_M_600:
+		return &dpll_mpu_opp[ind][2];

arch/arm/dts/am335x-wega-rdk-u-boot.dtsi

Quoted 10 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +10 -0
+	case MPUPLL_M_500:
+		return &dpll_mpu_opp100;
+	case MPUPLL_M_300:
+		return &dpll_mpu_opp[ind][0];
+	}
+
+	return &dpll_mpu_opp[ind][0];
+}
+
+void scale_vcores_generic(int freq)

static void ...

arch/arm/dts/am335x-wega-rdk-u-boot.dtsi

Quoted 10 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +10 -0
+{
+	int sil_rev, mpu_vdd;
+
+	/*
+	 * We use a TPS65910 PMIC. For all  MPU frequencies we support we use a
+	 * CORE voltage of 1.10V. For MPU voltage we need to switch based on
+	 * the frequency we are running at.
+	 */
+	if (power_tps65910_init(0))
+		return;

This will silently fail without patch [1] and without dm-pre-reloc on i2c0 node in the DT. For CPUs with higher core clock speed than 600 MHz, the prcm_init() will set the CPU clock to faster clock frequency without setting the matching PMIC voltage, and the system will become unstable in nasty obscure ways.

Phytec always boots with CPU set to 600 MHz, and my suggestion would be to do the same.

[1] http://patchwork.ozlabs.org/patch/1105418/

Quoted 18 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +18 -0
+	/*
+	 * Depending on MPU clock and PG we will need a different
+	 * VDD to drive at that speed.
+	 */
+	sil_rev = readl(&cdev->deviceid) >> 28;
+	mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev, freq);
+
+	/* Tell the TPS65910 to use i2c */
+	tps65910_set_i2c_control();
+
+	/* First update MPU voltage. */
+	if (tps65910_voltage_update(MPU, mpu_vdd))
+		return;
+
+	/* Second, update the CORE voltage. */
+	if (tps65910_voltage_update(CORE, TPS65910_OP_REG_SEL_1_1_0))
+		return;
+}

[...]

Signature · 2 lines
Best regards,
Marek Vasut