Skip to contentSkip to conversation

ARM: am335x: Add phyCORE AM335x R2 support

PATCH Superseded Niel Fourie 3 participants 3 messages May 2, 2019

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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 revision 37624b58542fb9f2d9a70e6ea006ef8a5f66c30b

---
 arch/arm/dts/Makefile                      |   3 +-
 arch/arm/dts/am335x-phycore-som.dtsi       | 322 +++++++++++++++++++++
 arch/arm/dts/am335x-wega-rdk-u-boot.dtsi   |  40 +++
 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     | 263 +++++++++++++++++
 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, 1271 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 b4dc57edbd..611be64314 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 +40 -0
new file mode 100644
index 0000000000..b7678e98ff
@@ -0,0 +1,40 @@
+// 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-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;
+};
+
+&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/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 +263 -0

263 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.17.2
#1 lore raw

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

Hello Niel,

Am 02.05.2019 um 11:52 schrieb Niel Fourie:

Quoted 51 lines

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 revision 37624b58542fb9f2d9a70e6ea006ef8a5f66c30b

---
  arch/arm/dts/Makefile                      |   3 +-
  arch/arm/dts/am335x-phycore-som.dtsi       | 322 +++++++++++++++++++++
  arch/arm/dts/am335x-wega-rdk-u-boot.dtsi   |  40 +++
  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     | 263 +++++++++++++++++
  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, 1271 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

[...]

Quoted 20 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +14 -0
new file mode 100644
index 0000000000..b7678e98ff
@@ -0,0 +1,40 @@
+// 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;
+	};
+

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

Quoted 10 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +10 -0
+	ocp {
+		u-boot,dm-spl;
+		u-boot,dm-pre-reloc;
+	};
+
+	memory at 80000000 {
+		u-boot,dm-spl;
+		u-boot,dm-pre-reloc;
+	};
+};

could we move the entries for "ocp" and "memory" to

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

I think, this values are so common, that other am33xx based boards needs them too ...

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

Quoted 4 lines
arch/arm/dts/am335x-wega-rdk-u-boot.dtsi new file +4 -0
+&scm {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
+};

May this one too?

Beside of this nitpick:

bye,
Heiko

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-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#2 lore raw

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

In reply to Niel Fourie

On 5/2/19 11:52 AM, Niel Fourie wrote:
[...]

Quoted 27 lines

+++ b/board/phytec/phycore_am335x_r2/board.c

board/phytec/phycore_am335x_r2/board.c new file +25 -0
@@ -0,0 +1,263 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * board.c
+ *
+ * Board functions for Phytec phyCORE-AM335x R2 (pcl060) based boards
+ *
+ * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
+ * Copyright (C) 2013 Lars Poeschel, Lemonage Software GmbH
+ * Copyright (C) 2015 Wadim Egorov, PHYTEC Messtechnik GmbH
+ * Copyright (C) 2019 DENX Software Engineering GmbH
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/ddr_defs.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <fdtdec.h>
+#include <power/tps65910.h>
+#include <jffs2/load_kernel.h>
+#include <mtd_node.h>
+#include <fdt_support.h>
+#include "board.h"
+

board/phytec/phycore_am335x_r2/board.c line 35

Quoted 10 lines
board/phytec/phycore_am335x_r2/board.c new file +10 -0
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_SPL_BUILD
+
+static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
+
+#if CONFIG_IS_ENABLED(OS_BOOT)
+int spl_start_uboot(void)
+{
+	return 1;

Can this be removed completely ?

Quoted 46 lines
board/phytec/phycore_am335x_r2/board.c new file +46 -0
+}
+#endif
+
+/* DDR RAM defines */
+#define DDR_CLK_MHZ		400 /* DDR_DPLL_MULT value */
+
+#define OSC	(V_OSCK / 1000000)
+const struct dpll_params dpll_ddr = {
+		DDR_CLK_MHZ, OSC - 1, 1, -1, -1, -1, -1};
+
+const struct dpll_params *get_dpll_ddr_params(void)
+{
+	return &dpll_ddr;
+}
+
+const struct ctrl_ioregs ioregs = {
+	.cm0ioctl		= 0x18B,
+	.cm1ioctl		= 0x18B,
+	.cm2ioctl		= 0x18B,
+	.dt0ioctl		= 0x18B,
+	.dt1ioctl		= 0x18B,
+};
+
+static const struct cmd_control ddr3_cmd_ctrl_data = {
+	.cmd0csratio = 0x80,
+	.cmd0iclkout = 0x0,
+
+	.cmd1csratio = 0x80,
+	.cmd1iclkout = 0x0,
+
+	.cmd2csratio = 0x80,
+	.cmd2iclkout = 0x0,
+};
+
+enum {
+	PHYCORE_R2_MT41K128M16JT_256MB,
+	PHYCORE_R2_MT41K256M16TW107IT_512MB,
+	PHYCORE_R2_MT41K512M16HA125IT_1024MB,
+};
+
+struct am335x_sdram_timings {
+	struct emif_regs ddr3_emif_reg_data;
+	struct ddr_data ddr3_data;
+};
+
+static struct am335x_sdram_timings physom_timings[] = {

board/phytec/phycore_am335x_r2/board.c line 91

Quoted 10 lines
board/phytec/phycore_am335x_r2/board.c new file +10 -0
+	[PHYCORE_R2_MT41K128M16JT_256MB] = {
+		.ddr3_emif_reg_data = {
+				.sdram_config = 0x61C052B2,
+				.ref_ctrl = 0x00000C30,
+				.sdram_tim1 = 0x0AAAD4DB,
+				.sdram_tim2 = 0x26437FDA,
+				.sdram_tim3 = 0x501F83FF,
+				.zq_config = 0x50074BE4,
+				.emif_ddr_phy_ctlr_1 = 0x7,
+				.ocp_config = 0x003d3d3d,

There's one tab too many .

Quoted 8 lines
board/phytec/phycore_am335x_r2/board.c new file +8 -0
+			},
+		.ddr3_data = {
+			.datardsratio0 = 0x36,
+			.datawdsratio0 = 0x38,
+			.datafwsratio0 = 0x99,
+			.datawrsratio0 = 0x73,
+		},
+	},

[...]

board/phytec/phycore_am335x_r2/board.c line 196

Quoted 10 lines
board/phytec/phycore_am335x_r2/board.c new file +10 -0
+void scale_vcores_generic(int freq)
+{
+	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 defined(CONFIG_DM_I2C)

Can we not support non-DM i2c ?

board/phytec/phycore_am335x_r2/board.c line 199

Quoted 3 lines
board/phytec/phycore_am335x_r2/board.c new file +3 -0
+	if (power_tps65910_init(0))
+			return;
+#else

And drop this part ?

Quoted 3 lines
board/phytec/phycore_am335x_r2/board.c new file +3 -0
+	if (i2c_probe(TPS65910_CTRL_I2C_ADDR))
+		return;
+#endif

[...]

Signature · 2 lines
Best regards,
Marek Vasut