mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: Barebox Mailing List <barebox@lists.infradead.org>
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [PATCH 1/2] ARM: omap: support for WAGO PFC200v3 750-821x
Date: Wed, 11 Dec 2019 21:02:43 +0100	[thread overview]
Message-ID: <20191211200243.21164-1-rhi@pengutronix.de> (raw)

Based on the downstream patch series in the WAGO PFC firmware SDK [1].
Downstream has support for other boards too, which we leave out for now
because no devices are available for testing. The upstream device trees
have been used as-is except that uart0 was set to "okay" so barebox can
enable the console on startup.

[1]: https://github.com/WAGO/pfc-firmware-sdk/tree/V03.02.02-FW14/configs/wago-pfcXXX/patches/barebox-2018.10.0

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 Documentation/boards/am335x.rst               |   2 +
 Documentation/boards/am335x/wago-pfc.rst      |  90 +++++++
 arch/arm/boards/Makefile                      |   1 +
 arch/arm/boards/wago-pfc-am335x/Makefile      |   3 +
 arch/arm/boards/wago-pfc-am335x/board.c       |  86 +++++++
 .../defaultenv-pfc-am335x/boot/emmc           |   4 +
 .../defaultenv-pfc-am335x/boot/mmc            |   4 +
 .../defaultenv-pfc-am335x/init/bootsource     |  12 +
 arch/arm/boards/wago-pfc-am335x/lowlevel.c    |  98 ++++++++
 arch/arm/boards/wago-pfc-am335x/ram-timings.h |  94 ++++++++
 arch/arm/configs/am335x_mlo_defconfig         |   1 +
 arch/arm/configs/omap_defconfig               |   1 +
 arch/arm/dts/Makefile                         |   2 +
 arch/arm/dts/am335x-pfc-750_821x-mlo.dts      |  31 +++
 arch/arm/dts/am335x-pfc-750_821x.dts          |  66 +++++
 arch/arm/dts/am335x-pfc-emmc.dtsi             |  29 +++
 arch/arm/dts/am335x-pfc-leds.dtsi             | 203 ++++++++++++++++
 arch/arm/dts/am335x-pfc-nand.dtsi             |  89 +++++++
 arch/arm/dts/am335x-pfc-rmii12.dtsi           |  62 +++++
 arch/arm/dts/am335x-pfc-rmii2.dtsi            |  40 +++
 arch/arm/dts/am335x-pfc-strip.dtsi            |  48 ++++
 arch/arm/dts/am335x-pfc.dtsi                  | 228 ++++++++++++++++++
 arch/arm/mach-omap/Kconfig                    |   7 +
 images/Makefile.am33xx                        |   8 +
 24 files changed, 1209 insertions(+)
 create mode 100644 Documentation/boards/am335x/wago-pfc.rst
 create mode 100644 arch/arm/boards/wago-pfc-am335x/Makefile
 create mode 100644 arch/arm/boards/wago-pfc-am335x/board.c
 create mode 100644 arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/boot/emmc
 create mode 100644 arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/boot/mmc
 create mode 100644 arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/init/bootsource
 create mode 100644 arch/arm/boards/wago-pfc-am335x/lowlevel.c
 create mode 100644 arch/arm/boards/wago-pfc-am335x/ram-timings.h
 create mode 100644 arch/arm/dts/am335x-pfc-750_821x-mlo.dts
 create mode 100644 arch/arm/dts/am335x-pfc-750_821x.dts
 create mode 100644 arch/arm/dts/am335x-pfc-emmc.dtsi
 create mode 100644 arch/arm/dts/am335x-pfc-leds.dtsi
 create mode 100644 arch/arm/dts/am335x-pfc-nand.dtsi
 create mode 100644 arch/arm/dts/am335x-pfc-rmii12.dtsi
 create mode 100644 arch/arm/dts/am335x-pfc-rmii2.dtsi
 create mode 100644 arch/arm/dts/am335x-pfc-strip.dtsi
 create mode 100644 arch/arm/dts/am335x-pfc.dtsi

diff --git a/Documentation/boards/am335x.rst b/Documentation/boards/am335x.rst
index f54611428bb3..0da479a1c3f0 100644
--- a/Documentation/boards/am335x.rst
+++ b/Documentation/boards/am335x.rst
@@ -30,6 +30,8 @@ resulting images will be placed under ``images/``:
 
 Some boards come in different variants, make sure to pick the correct one.
 
+.. _am335x_starting_barebox:
+
 Starting and updating barebox
 -----------------------------
 
diff --git a/Documentation/boards/am335x/wago-pfc.rst b/Documentation/boards/am335x/wago-pfc.rst
new file mode 100644
index 000000000000..bec2a7c1f05a
--- /dev/null
+++ b/Documentation/boards/am335x/wago-pfc.rst
@@ -0,0 +1,90 @@
+.. SPDX-License-Identifier: GPL-2.0-only
+
+WAGO PFC200 Fieldbus Controllers (AM335x based)
+================================================
+
+These devices already run a version of Barebox out of the box,
+although the debug console is disabled in the factory settings.
+
+Currently supported devices:
+
+* WAGO PFC200v3 750-8214
+
+Initial Device Preparation
+--------------------------
+
+The factory firmware looks for an MLO on the eMMC first.
+If nothing bootable is found there, the ROM code searches for a loader on the
+SD card instead.
+This means we have to erase the internal MLO in order to boot from the SD card.
+
+#. If you haven't set up your device yet,
+   grab a current `firmware <https://github.com/WAGO/pfc-firmware/releases>`_,
+   write it to an SD card, and boot the device with it.
+   You also need a DHCP server to connect to the device over ethernet.
+
+#. Connect to the web interface and log in with admin privileges.
+   (The default user is ``admin``, password ``wago``).
+
+#. Make sure that SSH is enabled and root login is allowed in
+   *Ports and Services* → *SSH*.
+
+#. Connect to the device over SSH, using user ``root`` and password ``wago``.
+
+#. The eMMC boot partition is */dev/mmcblk1p1*, which contains boot loaders
+   for several PFC variants (probably as a backup?),
+   but only the file named ``mlo`` is loaded by the AM335x ROM loader.
+
+   .. code-block:: console
+
+      root@PFC200V3-433502:~ mount /dev/mmcblk1p1 /mnt
+
+      root@PFC200V3-433502:~ ls -l /mnt
+      -rwxr-xr-x    1 root     root        485406 Sep 19 03:53 barebox.bin.pfc100
+      -rwxr-xr-x    1 root     root        460218 Sep 19 03:53 barebox.bin.pfc200
+      -rwxr-xr-x    1 root     root        485534 Sep 19 03:53 barebox.bin.pfc200v2
+      -rwxr-xr-x    1 root     root        485150 Sep 19 03:53 barebox.bin.pfc200v3
+      -rwxr-xr-x    1 root     root         91200 Sep 19 03:53 mlo
+      -rwxr-xr-x    1 root     root         91648 Sep 19 03:53 mlo.pfc100
+      -rwxr-xr-x    1 root     root         61393 Sep 19 03:53 mlo.pfc200
+      -rwxr-xr-x    1 root     root         91648 Sep 19 03:53 mlo.pfc200v2
+      -rwxr-xr-x    1 root     root         91200 Sep 19 03:53 mlo.pfc200v3
+
+   .. note::
+
+      The following step makes your device unbootable without an SD card.
+      If something goes wrong, and the device can no longer boot,
+      write one of the firmware images referenced above to the SD card,
+      and go through the setup process again.
+      If you want to make the recovery process easier, make a copy of the
+      partition (e.g. using sftp or writing it onto a spare SD card.)
+
+   Remove the file ``mlo`` so the ROM loader tries to boot from the SD card.
+   You can always replace it later with one of the backup copies.
+
+Now Barebox can be booted from the SD card.
+
+Building Barebox
+----------------
+
+All necessary settings are part of *omap_defconfig* and *am335x_mlo_defconfig*.
+Build both configs to get an MLO in ``images/barebox-am33xx-pfc-750-821x-mlo.img``
+and a second-stage Barebox image in ``images/barebox-am33xx-pfc-750-821x.img``.
+
+Booting from the SD card
+------------------------
+
+With these two images, prepare an SD card according to :ref:`am335x_starting_barebox`,
+and boot the device with it.
+
+A serial console is available on the debug port on the front of the machine
+(behind the cover next to the "RUN/STOP/RESET" switch and the SD card port).
+Use a WAGO serial cable (750-920 or 750-923) to connect to the serial console
+with 115200 Baud, 8N1.
+
+Writing Barebox to the Internal eMMC
+------------------------------------
+
+The SD card is available in Barebox as */dev/mmc0*, and the eMMC is */dev/mmc1*.
+You can copy ``mlo`` and ``barebox.bin`` from */mnt/mmc0.0/* to */mnt/mmc1.0/*,
+and then boot from the eMMC without the SD card.
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 6cb40d084b3d..6b3a63f80b49 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -166,6 +166,7 @@ obj-$(CONFIG_MACH_ZII_RDU2)			+= zii-imx6q-rdu2/
 obj-$(CONFIG_MACH_ZII_IMX8MQ_DEV)		+= zii-imx8mq-dev/
 obj-$(CONFIG_MACH_ZII_VF610_DEV)		+= zii-vf610-dev/
 obj-$(CONFIG_MACH_ZII_IMX7D_DEV)		+= zii-imx7d-dev/
+obj-$(CONFIG_MACH_WAGO_PFC_AM335X)		+= wago-pfc-am335x/
 obj-$(CONFIG_MACH_WAGO_PFC_AM35XX)		+= wago-pfc-am35xx/
 obj-$(CONFIG_MACH_LS1046ARDB)			+= ls1046ardb/
 obj-$(CONFIG_MACH_TQMLS1046A)			+= tqmls1046a/
diff --git a/arch/arm/boards/wago-pfc-am335x/Makefile b/arch/arm/boards/wago-pfc-am335x/Makefile
new file mode 100644
index 000000000000..1355b5faaddf
--- /dev/null
+++ b/arch/arm/boards/wago-pfc-am335x/Makefile
@@ -0,0 +1,3 @@
+lwl-y += lowlevel.o
+obj-y += board.o
+bbenv-y += defaultenv-pfc-am335x
diff --git a/arch/arm/boards/wago-pfc-am335x/board.c b/arch/arm/boards/wago-pfc-am335x/board.c
new file mode 100644
index 000000000000..41219ebe51e1
--- /dev/null
+++ b/arch/arm/boards/wago-pfc-am335x/board.c
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2015 Wadim Egorov, PHYTEC Messtechnik GmbH
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+#include <bootsource.h>
+#include <common.h>
+#include <nand.h>
+#include <net.h>
+#include <init.h>
+#include <io.h>
+#include <linux/sizes.h>
+#include <envfs.h>
+#include <asm/armlinux.h>
+#include <mach/am33xx-generic.h>
+#include <mach/am33xx-silicon.h>
+#include <mach/bbu.h>
+
+static int pfc_coredevice_init(void)
+{
+	if (!of_machine_is_compatible("wago,am335x-pfc"))
+		return 0;
+
+	am33xx_register_ethaddr(0, 0);
+
+	return 0;
+}
+coredevice_initcall(pfc_coredevice_init);
+
+#define ETH_DEVICE		0
+#define ETHADDR_EEPROM_OFFSET	512
+#define ETHADDR_EEPROM_LENGTH	6
+static int pfc_set_ethaddr(void)
+{
+	struct cdev *cdev;
+	u8 mac[6];
+	int ret;
+
+	cdev = cdev_by_name("eeprom0");
+	if (!cdev)
+		return -ENODEV;
+
+	ret = cdev_read(cdev, mac, ETHADDR_EEPROM_LENGTH, ETHADDR_EEPROM_OFFSET, 0);
+	if (ret < 0)
+		return ret;
+
+	eth_register_ethaddr(ETH_DEVICE, mac);
+
+	return 0;
+}
+
+static int pfc_devices_init(void)
+{
+	int ret;
+
+	if (!of_machine_is_compatible("wago,am335x-pfc"))
+		return 0;
+
+	if (bootsource_get() == BOOTSOURCE_MMC) {
+		if (bootsource_get_instance() == 0) {
+			omap_set_bootmmc_devname("mmc0");
+		} else {
+			omap_set_bootmmc_devname("mmc1");
+			am33xx_bbu_emmc_mlo_register_handler("mlo.emmc",
+								"/dev/mmc1");
+		}
+	}
+
+	of_device_enable_path("/chosen/environment-sd");
+	defaultenv_append_directory(defaultenv_pfc_am335x);
+
+	ret = pfc_set_ethaddr();
+	if (ret < 0) {
+		pr_info("no valid ethaddr in eeprom found. Using randomized "
+			"MAC address\n");
+	}
+
+	if (IS_ENABLED(CONFIG_SHELL_NONE))
+		return am33xx_of_register_bootdevice();
+
+	return 0;
+}
+device_initcall(pfc_devices_init);
diff --git a/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/boot/emmc b/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/boot/emmc
new file mode 100644
index 000000000000..9affcbe2ec18
--- /dev/null
+++ b/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/boot/emmc
@@ -0,0 +1,4 @@
+#!/bin/sh
+global.bootm.image=/mnt/mmc1.0/linuximage
+global.bootm.oftree=/mnt/mmc1.0/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rw rootwait"
diff --git a/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/boot/mmc b/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/boot/mmc
new file mode 100644
index 000000000000..1430a0f76614
--- /dev/null
+++ b/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/boot/mmc
@@ -0,0 +1,4 @@
+#!/bin/sh
+global.bootm.image=/mnt/mmc0.0/linuximage
+global.bootm.oftree=/mnt/mmc0.0/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rw rootwait"
diff --git a/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/init/bootsource b/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/init/bootsource
new file mode 100644
index 000000000000..f35c7df46e03
--- /dev/null
+++ b/arch/arm/boards/wago-pfc-am335x/defaultenv-pfc-am335x/init/bootsource
@@ -0,0 +1,12 @@
+#!/bin/sh
+if [ -n "$nv.boot.default" ]; then
+	exit
+fi
+
+if [ $bootsource = mmc -a $bootsource_instance = 1 ]; then
+	global.boot.default="emmc mmc net"
+elif [ $bootsource = mmc -a $bootsource_instance = 0 ]; then
+	global.boot.default="mmc emmc net"
+elif [ $bootsource = net ]; then
+	global.boot.default="net emmc mmc"
+fi
diff --git a/arch/arm/boards/wago-pfc-am335x/lowlevel.c b/arch/arm/boards/wago-pfc-am335x/lowlevel.c
new file mode 100644
index 000000000000..78112cb03cd6
--- /dev/null
+++ b/arch/arm/boards/wago-pfc-am335x/lowlevel.c
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2015 Wadim Egorov, PHYTEC Messtechnik GmbH
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+#include <common.h>
+#include <linux/sizes.h>
+#include <io.h>
+#include <init.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/am33xx-silicon.h>
+#include <mach/am33xx-clock.h>
+#include <mach/generic.h>
+#include <mach/sdrc.h>
+#include <mach/sys_info.h>
+#include <mach/syslib.h>
+#include <mach/am33xx-mux.h>
+#include <mach/am33xx-generic.h>
+#include <mach/wdt.h>
+#include <debug_ll.h>
+
+#include "ram-timings.h"
+
+/**
+ * @brief The basic entry point for board initialization.
+ *
+ * This is called as part of machine init (after arch init).
+ * This is again called with stack in SRAM, so not too many
+ * constructs possible here.
+ *
+ * @return void
+ */
+static noinline void am33xx_pfc_sram_init(void *fdt, int sdram)
+{
+	/*
+	 * WDT1 is already running when the bootloader gets control
+	 * Disable it to avoid "random" resets
+	 */
+	writel(WDT_DISABLE_CODE1, AM33XX_WDT_REG(WSPR));
+	while (readl(AM33XX_WDT_REG(WWPS)) != 0x0);
+
+	writel(WDT_DISABLE_CODE2, AM33XX_WDT_REG(WSPR));
+	while (readl(AM33XX_WDT_REG(WWPS)) != 0x0);
+
+	am33xx_pll_init(MPUPLL_M_600, DDRPLL_M_400);
+
+	am335x_sdram_init(DDR_IOCTRL, &pfc_timings[sdram].cmd_ctrl,
+			&pfc_timings[sdram].regs,
+			&pfc_timings[sdram].data);
+
+	am33xx_uart_soft_reset((void *)AM33XX_UART0_BASE);
+	am33xx_enable_uart0_pin_mux();
+	omap_uart_lowlevel_init((void *)AM33XX_UART0_BASE);
+	putc_ll('>');
+
+	am335x_barebox_entry(fdt);
+}
+
+static noinline void am33xx_pfc_board_entry(unsigned long bootinfo, int sdram,
+					void *fdt)
+{
+	am33xx_save_bootinfo((void *)bootinfo);
+
+	arm_cpu_lowlevel_init();
+
+	/*
+	 * Setup C environment, the board init code uses global variables.
+	 * Stackpointer has already been initialized by the ROM code.
+	 */
+	relocate_to_current_adr();
+	setup_c();
+	am33xx_pfc_sram_init(fdt, sdram);
+}
+
+#define PFC_ENTRY_MLO(name, fdt_name, mem_size)				\
+	ENTRY_FUNCTION(name, bootinfo, r1, r2)				\
+	{								\
+		extern char __dtb_z_##fdt_name##_start[];		\
+		void *fdt = __dtb_z_##fdt_name##_start +		\
+			get_runtime_offset();				\
+		am33xx_pfc_board_entry(bootinfo, mem_size, fdt);	\
+	}
+
+#define PFC_ENTRY(name, fdt_name, mem_size)				\
+	ENTRY_FUNCTION(name, r0, r1, r2)				\
+	{								\
+		extern char __dtb_z_##fdt_name##_start[];		\
+		void *fdt = __dtb_z_##fdt_name##_start +		\
+			get_runtime_offset();				\
+		barebox_arm_entry(0x80000000, mem_size, fdt);		\
+	}
+
+PFC_ENTRY_MLO(start_am33xx_pfc_750_821x_sram_512mb, am335x_pfc_750_821x_mlo, PFC_DDR3_512MB);
+PFC_ENTRY(start_am33xx_pfc_750_821x_sdram, am335x_pfc_750_821x, SZ_512M);
diff --git a/arch/arm/boards/wago-pfc-am335x/ram-timings.h b/arch/arm/boards/wago-pfc-am335x/ram-timings.h
new file mode 100644
index 000000000000..cc3d518f0c27
--- /dev/null
+++ b/arch/arm/boards/wago-pfc-am335x/ram-timings.h
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2015 Wadim Egorov, PHYTEC Messtechnik GmbH
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+#ifndef __RAM_TIMINGS_H
+#define __RAM_TIMINGS_H
+
+#define DDR_IOCTRL	0x18B
+
+struct am335x_sdram_timings {
+	struct am33xx_emif_regs regs;
+	struct am33xx_ddr_data data;
+	struct am33xx_cmd_control cmd_ctrl;
+};
+
+enum {
+	PFC_DDR3_256MB,
+	PFC_DDR3_512MB,
+};
+
+struct am335x_sdram_timings pfc_timings[] = {
+	[PFC_DDR3_256MB] = {
+		.regs = {
+			.emif_read_latency	= 0x100007,
+			.emif_tim1		= 0x888A39A,
+			.emif_tim2		= 0x223F7FDA,
+			.emif_tim3		= 0x501F843F,
+			.sdram_config		= 0x61C04AB2,
+			.sdram_ref_ctrl		= 0x93B,
+			.ocp_config		= 0x00141414,
+			.zq_config		= 0x50074BE4,
+			.sdram_config2		= 0x0,
+		},
+		.data = {
+			.rd_slave_ratio0        = 0x38,
+			.wr_dqs_slave_ratio0    = 0x44,
+			.fifo_we_slave_ratio0	= 0x94,
+			.wr_slave_ratio0        = 0x7D,
+			.use_rank0_delay	= 0x01,
+			.dll_lock_diff0		= 0x0,
+		},
+		.cmd_ctrl = {
+			.slave_ratio0	= 0x80,
+			.dll_lock_diff0	= 0x1,
+			.invert_clkout0	= 0x0,
+			.slave_ratio1	= 0x80,
+			.dll_lock_diff1	= 0x1,
+			.invert_clkout1	= 0x0,
+			.slave_ratio2	= 0x80,
+			.dll_lock_diff2	= 0x1,
+			.invert_clkout2	= 0x0,
+		},
+	},
+
+	[PFC_DDR3_512MB] = {
+		.regs = {
+			.emif_read_latency	= 0x100007,
+			.emif_tim1		= 0x0AAAD4DB,
+			.emif_tim2		= 0x226B7FDA,
+			.emif_tim3		= 0x501F867F,
+			.sdram_config		= 0x61C04B32,
+			.sdram_ref_ctrl		= 0x20000064,
+			.ocp_config		= 0x00141414,
+			.zq_config		= 0x50074BE4,
+			.sdram_config2		= 0x0,
+		},
+		.data = {
+			.rd_slave_ratio0        = 0x38,
+			.wr_dqs_slave_ratio0    = 0x44,
+			.fifo_we_slave_ratio0	= 0x94,
+			.wr_slave_ratio0        = 0x7D,
+			.use_rank0_delay	= 0x01,
+			.dll_lock_diff0		= 0x0,
+		},
+		.cmd_ctrl = {
+			.slave_ratio0	= 0x80,
+			.dll_lock_diff0	= 0x1,
+			.invert_clkout0	= 0x0,
+			.slave_ratio1	= 0x80,
+			.dll_lock_diff1	= 0x1,
+			.invert_clkout1	= 0x0,
+			.slave_ratio2	= 0x80,
+			.dll_lock_diff2	= 0x1,
+			.invert_clkout2	= 0x0,
+		},
+
+	},
+};
+
+#endif
diff --git a/arch/arm/configs/am335x_mlo_defconfig b/arch/arm/configs/am335x_mlo_defconfig
index efe991105085..6870c7ea0310 100644
--- a/arch/arm/configs/am335x_mlo_defconfig
+++ b/arch/arm/configs/am335x_mlo_defconfig
@@ -6,6 +6,7 @@ CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_AFI_GF=y
 CONFIG_MACH_BEAGLEBONE=y
 CONFIG_MACH_PHYTEC_SOM_AM335X=y
+CONFIG_MACH_WAGO_PFC_AM335X=y
 CONFIG_THUMB2_BAREBOX=y
 # CONFIG_MEMINFO is not set
 CONFIG_MMU=y
diff --git a/arch/arm/configs/omap_defconfig b/arch/arm/configs/omap_defconfig
index ba9015825264..58ffdec8853b 100644
--- a/arch/arm/configs/omap_defconfig
+++ b/arch/arm/configs/omap_defconfig
@@ -8,6 +8,7 @@ CONFIG_MACH_BEAGLE=y
 CONFIG_MACH_BEAGLEBONE=y
 CONFIG_MACH_PHYTEC_SOM_AM335X=y
 CONFIG_MACH_VSCOM_BALTOS=y
+CONFIG_MACH_WAGO_PFC_AM335X=y
 CONFIG_MACH_WAGO_PFC_AM35XX=y
 CONFIG_THUMB2_BAREBOX=y
 CONFIG_ARM_BOARD_APPEND_ATAG=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 294a0bfa5525..1788e698c1c6 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -140,6 +140,8 @@ lwl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
 lwl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
 
 lwl-dtb-$(CONFIG_MACH_ZII_IMX7D_DEV) += imx7d-zii-rpu2.dtb.o imx7d-zii-rmu2.dtb.o
+lwl-dtb-$(CONFIG_MACH_WAGO_PFC_AM335X) += am335x-pfc-750_821x.dtb.o \
+	am335x-pfc-750_821x-mlo.dtb.o
 lwl-dtb-$(CONFIG_MACH_WAGO_PFC_AM35XX) += am35xx-pfc-750_820x.dtb.o
 lwl-dtb-$(CONFIG_MACH_LS1046ARDB) += fsl-ls1046a-rdb.dtb.o
 lwl-dtb-$(CONFIG_MACH_TQMLS1046A) += fsl-tqmls1046a-mbls10xxa.dtb.o
diff --git a/arch/arm/dts/am335x-pfc-750_821x-mlo.dts b/arch/arm/dts/am335x-pfc-750_821x-mlo.dts
new file mode 100644
index 000000000000..ae16ce1452de
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc-750_821x-mlo.dts
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2017 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Heinrich Toews <heinrich.toews@wago.com>
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+/dts-v1/;
+
+#include "am335x-pfc.dtsi"
+#include "am335x-pfc-emmc.dtsi"
+#include "am335x-pfc-strip.dtsi"
+#include "am33xx-strip.dtsi"
+#include "am33xx-clocks-strip.dtsi"
+
+/ {
+	model = "PFC-750-821x MLO";
+	compatible = "wago,am335x-pfc-750_821x", "wago,am335x-pfc", "ti,am33xx";
+	board-variant = "pfc200v3";
+
+	memory {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>; /* 512 MB */
+	};
+};
+
+&mmc2 {
+	status = "okay";
+};
diff --git a/arch/arm/dts/am335x-pfc-750_821x.dts b/arch/arm/dts/am335x-pfc-750_821x.dts
new file mode 100644
index 000000000000..5ad53c878848
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc-750_821x.dts
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2017 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Heinrich Toews <heinrich.toews@wago.com>
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+/dts-v1/;
+
+#include "am335x-pfc.dtsi"
+#include "am335x-pfc-emmc.dtsi"
+#include "am335x-pfc-leds.dtsi"
+#include "am335x-pfc-rmii12.dtsi"
+
+/ {
+	model = "PFC-750-821x";
+	compatible = "wago,am335x-pfc-750_821x", "wago,am335x-pfc", "ti,am33xx";
+	board-variant = "pfc200v3";
+
+	memory {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>; /* 512 MB */
+	};
+};
+
+&i2c0 {
+	pca953x: pca953x@70 {
+		compatible = "nxp,pca9538";
+		reg = <0x70>;
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		switch_reset {
+			gpio-hog;
+			gpios = <4 GPIO_ACTIVE_HIGH>;
+			output-high;
+			line-name = "switch-reset";
+		};
+	};
+};
+
+&mmc1 {
+	cd-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
+};
+
+&mmc2 {
+	status = "okay";
+};
+
+&pca9552_60 {
+	status = "okay";
+};
+
+&pca9552_61 {
+	status = "okay";
+};
+
+&mac {
+	status = "okay";
+};
+
+&uart0 {
+	status = "okay";
+};
diff --git a/arch/arm/dts/am335x-pfc-emmc.dtsi b/arch/arm/dts/am335x-pfc-emmc.dtsi
new file mode 100644
index 000000000000..67a54f8a0ad5
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc-emmc.dtsi
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+&am33xx_pinmux {
+	emmc_pins: pinmux_emmc_pins {
+		pinctrl-single,pins = <
+			0x080 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
+			0x084 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
+			0x000 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE1) /* gpmc_ad0.gpmc_ad0  */
+			0x004 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE1) /* gpmc_ad0.gpmc_ad1  */
+			0x008 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE1) /* gpmc_ad0.gpmc_ad2  */
+			0x00c (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE1) /* gpmc_ad0.gpmc_ad3  */
+		>;
+	};
+};
+
+&mmc2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&emmc_pins>;
+	vmmc-supply = <&vmmcsd_fixed>;
+	bus-width = <4>;
+	non-removable;
+	status = "disabled";
+};
diff --git a/arch/arm/dts/am335x-pfc-leds.dtsi b/arch/arm/dts/am335x-pfc-leds.dtsi
new file mode 100644
index 000000000000..94ce7b7067e3
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc-leds.dtsi
@@ -0,0 +1,203 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Copyright (C) 2015 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Heinrich Toews <heinrich.toews@wago.com>
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+&i2c0 {
+	/*
+	 * Note:
+	 * The predefined order here determines
+	 * the order how leds are enabled.
+	 *
+	 * Note: BUG in barebox-led trigger code.
+	 * triggers are assuming, that leds-max
+	 * value is 1. this is correct for gpio-leds but
+	 * not for brightness driven leds like the
+	 * pca 9552 chip.
+	 *
+	 * for pca-chips use custom brightness values for
+	 * triggering:
+	 *
+	 * 		1 Blink  1 HZ
+	 * 		2 Blink  4 HZ
+	 * 		3 Blink 10 HZ
+	 */
+
+	pca9552_61: pca9552@61 {
+		compatible = "pca9552";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x61>;
+
+		mask-off,color = <0x55>;
+
+		mask-on,red-all = <0x44>;
+		mask-on,green-all = <0x11>;
+
+		status = "disabled";
+
+		u1-green@11 {
+		      label = "u1-green";
+		      reg = <11>;
+		      linux,default-trigger = "none";
+		};
+
+		u1-red@10 {
+		      label = "u1-red";
+		      reg = <10>;
+		      linux,default-trigger = "none";
+		};
+
+		u2-green@9 {
+		      label = "u2-green";
+		      reg = <9>;
+		      linux,default-trigger = "none";
+		};
+
+		u2-red@8 {
+		      label = "u2-red";
+		      reg = <8>;
+		      linux,default-trigger = "none";
+		};
+
+		u3-green@7 {
+		      label = "u3-green";
+		      reg = <7>;
+		      linux,default-trigger = "none";
+		};
+
+		u3-red@6 {
+		      label = "u3-red";
+		      reg = <6>;
+		      linux,default-trigger = "none";
+		};
+
+		u4-green@5 {
+		      label = "u4-green";
+		      reg = <5>;
+		      linux,default-trigger = "none";
+		};
+
+		u4-red@4 {
+		      label = "u4-red";
+		      reg = <4>;
+		      linux,default-trigger = "none";
+		};
+
+		u5-green@3 {
+		      label = "u5-green";
+		      reg = <3>;
+		      linux,default-trigger = "none";
+		};
+
+		u5-red@2 {
+		      label = "u5-red";
+		      reg = <2>;
+		      linux,default-trigger = "none";
+		};
+
+		u6-green@1 {
+		      label = "u6-green";
+		      reg = <1>;
+		      linux,default-trigger = "none";
+		};
+
+		u6-red@0 {
+		      label = "u6-red";
+		      reg = <0>;
+		      linux,default-trigger = "none";
+		};
+        };
+
+	pca9552_60: pca9552@60 {
+		compatible = "pca9552";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x60>;
+
+		mask-off,color = <0x55>;
+
+		mask-on,red-all = <0x44>;
+		mask-on,green-all = <0x11>;
+
+		status = "disabled";
+
+		sys-red@0 {
+			label = "sys-red";
+			reg = <0>;
+			linux,default-trigger = "none";
+		};
+
+		sys-green@1 {
+			label = "sys-green";
+			reg = <1>;
+			linux,default-trigger = "none";
+		};
+
+		run-red@2 {
+			label = "run-red";
+			reg = <2>;
+			linux,default-trigger = "none";
+		};
+
+		run-green@3 {
+		      label = "run-green";
+		      reg = <3>;
+		      linux,default-trigger = "none";
+		};
+
+		io-red@4 {
+		      label = "io-red";
+		      reg = <4>;
+		      linux,default-trigger = "none";
+		};
+
+		io-green@5 {
+		      label = "io-green";
+		      reg = <5>;
+		      linux,default-trigger = "none";
+		};
+
+		ms-red@6 {
+		      label = "ms-red";
+		      reg = <6>;
+		      linux,default-trigger = "none";
+		};
+
+		ms-green@7 {
+		      label = "ms-green";
+		      reg = <7>;
+		      linux,default-trigger = "none";
+		};
+
+		ns-red@8 {
+		      label = "ns-red";
+		      reg = <8>;
+		      linux,default-trigger = "none";
+		};
+
+		ns-green@9 {
+		      label = "ns-green";
+		      reg = <9>;
+		      linux,default-trigger = "none";
+		};
+
+		u7-red@10 {
+		      label = "u7-red";
+		      reg = <10>;
+		      linux,default-trigger = "none";
+		};
+
+		u7-green@11 {
+		      label = "u7-green";
+		      reg = <11>;
+		      linux,default-trigger = "none";
+		};
+	};
+};
diff --git a/arch/arm/dts/am335x-pfc-nand.dtsi b/arch/arm/dts/am335x-pfc-nand.dtsi
new file mode 100644
index 000000000000..a9e7d8f723c4
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc-nand.dtsi
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Copyright (C) 2014 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Heinrich Toews <heinrich.toews@wago.com>
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+&am33xx_pinmux {
+	gpmc_pins: pinmux_gpmc_pins {
+		pinctrl-single,pins = <
+			0x000 0x20	/* gpmc_ad0, INPUT_PULLDOWN | MODE0 */
+			0x004 0x20	/* gpmc_ad1, INPUT_PULLDOWN | MODE0 */
+			0x008 0x20	/* gpmc_ad2, INPUT_PULLDOWN | MODE0 */
+			0x00c 0x20	/* gpmc_ad3, INPUT_PULLDOWN | MODE0 */
+			0x010 0x20	/* gpmc_ad4, INPUT_PULLDOWN | MODE0 */
+			0x014 0x20	/* gpmc_ad5, INPUT_PULLDOWN | MODE0 */
+			0x018 0x20	/* gpmc_ad6, INPUT_PULLDOWN | MODE0 */
+			0x01c 0x20	/* gpmc_ad7, INPUT_PULLDOWN | MODE0 */
+			0x020 0x20	/* gpmc_ad8, INPUT_PULLDOWN | MODE0 */
+			0x024 0x20	/* gpmc_ad9, INPUT_PULLDOWN | MODE0 */
+			0x028 0x20	/* gpmc_ad10, INPUT_PULLDOWN | MODE0 */
+			0x02c 0x20	/* gpmc_ad11, INPUT_PULLDOWN | MODE0 */
+			0x030 0x20	/* gpmc_ad12, INPUT_PULLDOWN | MODE0 */
+			0x034 0x20	/* gpmc_ad13, INPUT_PULLDOWN | MODE0 */
+			0x038 0x20	/* gpmc_ad14, INPUT_PULLDOWN | MODE0 */
+			0x03c 0x20	/* gpmc_ad15, INPUT_PULLDOWN | MODE0 */
+			0x070 0x30	/* gpmc_wait0, INPUT_PULLUP | MODE0 */
+			0x07c 0x10	/* gpmc_csn0, OUTPUT_PULLUP | MODE0 */
+			0x080 0x10	/* gpmc_csn1, OUTPUT_PULLUP | MODE0 */
+			0x084 0x11	/* gpmc_csn2, OUTPUT_PULLUP | MODE1 (gpmc_be1n_mux1) */
+			0x090 0x08	/* gpmc_advn_ale, MODE0 */
+			0x094 0x08	/* gpmc_oen_ren,  MODE0 */
+			0x098 0x08	/* gpmc_wen, OUTPUT_PULLUP | MODE0 */
+			0x09c 0x08	/* gpmc_ben0_cle.gpmc_be0n_cle, OUTPUT_PULLUP | MODE0 */
+		>;
+	};
+};
+
+
+&gpmc {
+	status = "disabled";
+	pinctrl-names = "default";
+	pinctrl-0 = <&gpmc_pins>;
+	num-cs = <3>;
+	num-waitpins = <1>;
+	ranges = <
+		0 0 0x08000000 0x01000000 /* CS0: NAND */
+	>;
+
+ 	nand: nand@0,0 {
+		reg = <0 0 0>; /* CS0, offset 0 */
+		nand-bus-width = <8>;
+		ti,nand-ecc-opt = "bch8";
+		gpmc,device-nand = "true";
+		gpmc,device-width = <1>;
+		gpmc,sync-clk-ps = <0>;
+		gpmc,cs-on-ns = <0>;
+		gpmc,cs-rd-off-ns = <44>;
+		gpmc,cs-wr-off-ns = <44>;
+		gpmc,adv-on-ns = <6>;
+		gpmc,adv-rd-off-ns = <34>;
+		gpmc,adv-wr-off-ns = <44>;
+		gpmc,we-on-ns = <0>;
+		gpmc,we-off-ns = <40>;
+		gpmc,oe-on-ns = <0>;
+		gpmc,oe-off-ns = <54>;
+		gpmc,access-ns = <64>;
+		gpmc,rd-cycle-ns = <82>;
+		gpmc,wr-cycle-ns = <82>;
+		gpmc,wait-on-read = "true";
+		gpmc,wait-on-write = "true";
+		gpmc,bus-turnaround-ns = <0>;
+		gpmc,cycle2cycle-delay-ns = <0>;
+		gpmc,clk-activation-ns = <0>;
+		gpmc,wait-monitoring-ns = <0>;
+		gpmc,wr-access-ns = <40>;
+		gpmc,wr-data-mux-bus-ns = <0>;
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+		elm_id = <&elm>;
+	};
+};
+
+/include/ "am3xxx-pfc-nandparts.dtsi"
diff --git a/arch/arm/dts/am335x-pfc-rmii12.dtsi b/arch/arm/dts/am335x-pfc-rmii12.dtsi
new file mode 100644
index 000000000000..6c15f248a90d
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc-rmii12.dtsi
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+&am33xx_pinmux {
+	cpsw_rmmi12_default: cpsw_rmmi12_default {
+		pinctrl-single,pins = <
+			/* RMMI2 */
+			0x040 (PIN_OUTPUT | SLEWCTRL_FAST | MUX_MODE3) /* gpmc_a0.rmii2_txen     */
+			0x050 (PIN_OUTPUT | SLEWCTRL_FAST | MUX_MODE3) /* gpmc_a4.rmii2_txd1     */
+			0x054 (PIN_OUTPUT | SLEWCTRL_FAST | MUX_MODE3) /* gpmc_a5.rmii2_txd0     */
+			0x068 (PIN_INPUT                  | MUX_MODE3) /* gpmc_a10.rmii2_rxd1    */
+			0x06C (PIN_INPUT                  | MUX_MODE3) /* gpmc_a11.rmii2_rxd0    */
+			0x108 (PIN_INPUT                  | MUX_MODE1) /* mii1_col.rmii2_refclk  */
+			0x088 (PIN_INPUT                  | MUX_MODE2) /* gpmc_csn3.rmii2_crs_dv */
+			0x074 (PIN_INPUT 		  | MUX_MODE7) /* gpmc_wpn.gpio0_31      */
+
+			/* RMMI1 only used on Marvell based devices; default off */
+			0x144 (PIN_INPUT                  | MUX_MODE7) /* rmii1_ref_clk.rmii1_refclk */
+			0x114 (PIN_INPUT                  | MUX_MODE7) /* mii1_txen.rmii1_txen       */
+			0x128 (PIN_INPUT                  | MUX_MODE7) /* mii1_txd0.rmii1_txd0       */
+			0x124 (PIN_INPUT                  | MUX_MODE7) /* mii1_txd1.rmii1_txd1       */
+			0x140 (PIN_INPUT                  | MUX_MODE7) /* mii1_rxd0.rmii1_rxd0       */
+			0x13c (PIN_INPUT                  | MUX_MODE7) /* mii1_rxd1.rmii1_rxd1       */
+			0x10c (PIN_INPUT                  | MUX_MODE7) /* mii1_crs.rmii1_crs_dv      */
+		>;
+	};
+
+	cpsw_rmmi12_sleep: cpsw_rmmi12_sleep {
+		pinctrl-single,pins = <
+			/* RMMI2 */
+			0x040 (PIN_INPUT | MUX_MODE7) /* gpmc_a0.rmii2_txen     */
+			0x050 (PIN_INPUT | MUX_MODE7) /* gpmc_a4.rmii2_txd1     */
+			0x054 (PIN_INPUT | MUX_MODE7) /* gpmc_a5.rmii2_txd0     */
+			0x068 (PIN_INPUT | MUX_MODE7) /* gpmc_a10.rmii2_rxd1    */
+			0x06C (PIN_INPUT | MUX_MODE7) /* gpmc_a11.rmii2_rxd0    */
+			0x108 (PIN_INPUT | MUX_MODE7) /* mii1_col.rmii2_refclk  */
+			0x088 (PIN_INPUT | MUX_MODE7) /* gpmc_csn3.rmii2_crs_dv */
+			0x074 (PIN_INPUT | MUX_MODE7) /* gpmc_wpn.gpio0_31      */
+
+			/* RMMI1 only used on Marvell based devices; default off to not brick
+			 * the bootstrap option of marvell based devices
+			 */
+			0x144 (PIN_INPUT | MUX_MODE7) /* rmii1_ref_clk.rmii1_refclk      */
+			0x114 (PIN_INPUT | MUX_MODE7) /* mii1_txen.rmii1_txen (gpio3_3)  */
+			0x128 (PIN_INPUT | MUX_MODE7) /* mii1_txd0.rmii1_txd0 (gpio0_28) */
+			0x124 (PIN_INPUT | MUX_MODE7) /* mii1_txd1.rmii1_txd1 (gpio0_21) */
+			0x140 (PIN_INPUT | MUX_MODE7) /* mii1_rxd0.rmii1_rxd0 (gpio2_21) */
+			0x13c (PIN_INPUT | MUX_MODE7) /* mii1_rxd1.rmii1_rxd1 (gpio2_20) */
+			0x10c (PIN_INPUT | MUX_MODE7) /* mii1_crs.rmii1_crs_dv (gpio3_1) */
+	       >;
+	};
+};
+
+&mac {
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&cpsw_rmmi12_default>;
+	pinctrl-1 = <&cpsw_rmmi12_sleep>;
+	status = "disabled";
+};
diff --git a/arch/arm/dts/am335x-pfc-rmii2.dtsi b/arch/arm/dts/am335x-pfc-rmii2.dtsi
new file mode 100644
index 000000000000..1cee99302a34
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc-rmii2.dtsi
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+&am33xx_pinmux {
+	cpsw_rmmi2_default: cpsw_rmmi2_default {
+		pinctrl-single,pins = <
+                        0x040 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gpmc_a0.rmii2_txen */
+                        0x050 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gpmc_a4.rmii2_txd1 */
+                        0x054 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gpmc_a5.rmii2_txd0 */
+                        0x068 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* gpmc_a10.rmii2_rxd1 */
+                        0x06C (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* gpmc_a11.rmii2_rxd0 */
+                        0x074 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* gpmc_wpn.rmii2_rxer */
+                        0x108 (PIN_INPUT_PULLDOWN | MUX_MODE1)  /* mii1_col.rmii2_refclk */
+                        0x088 (PIN_INPUT          | MUX_MODE2)  /* gpmc_csn3.rmii2_crs_dv */
+		>;
+	};
+
+	cpsw_rmmi2_sleep: cpsw_rmmi2_sleep {
+		pinctrl-single,pins = <
+                        0x040 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                        0x050 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                        0x054 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                        0x068 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                        0x06C (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                        0x074 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                        0x108 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                        0x088 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+		>;
+	};
+};
+
+&mac {
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&cpsw_rmmi2_default>;
+	pinctrl-1 = <&cpsw_rmmi2_sleep>;
+	status = "disabled";
+};
diff --git a/arch/arm/dts/am335x-pfc-strip.dtsi b/arch/arm/dts/am335x-pfc-strip.dtsi
new file mode 100644
index 000000000000..e3af0ae3ec81
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc-strip.dtsi
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2014 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Heinrich Toews <heinrich.toews@wago.com>
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+/ {
+	aliases {
+		/delete-property/ serial1;
+		/delete-property/ serial2;
+		/delete-property/ serial3;
+		/delete-property/ serial4;
+		/delete-property/ serial5;
+		/delete-property/ usb0;
+		/delete-property/ usb1;
+		/delete-property/ phy0;
+		/delete-property/ phy1;
+		/delete-property/ i2c0;
+		/delete-property/ ethernet0;
+		/delete-property/ ethernet1;
+		/delete-property/ spi0;
+		/delete-property/ bootstate;
+	};
+};
+
+/delete-node/ &environment_sd;
+/delete-node/ &uart1_pins;
+/delete-node/ &uart1;
+/delete-node/ &uart2;
+/delete-node/ &uart3;
+/delete-node/ &uart4;
+/delete-node/ &uart5;
+/delete-node/ &i2c0_pins;
+/delete-node/ &davinci_mdio_default;
+/delete-node/ &davinci_mdio_sleep;
+/delete-node/ &bas_pins;
+/delete-node/ &usb;
+/delete-node/ &i2c0;
+/delete-node/ &davinci_mdio;
+/delete-node/ &cpsw_emac0;
+/delete-node/ &cpsw_emac1;
+/delete-node/ &phy_gmii_sel;
+/delete-node/ &mac;
+/delete-node/ &spi0;
+/delete-node/ &bootstate;
diff --git a/arch/arm/dts/am335x-pfc.dtsi b/arch/arm/dts/am335x-pfc.dtsi
new file mode 100644
index 000000000000..d064bda542bb
--- /dev/null
+++ b/arch/arm/dts/am335x-pfc.dtsi
@@ -0,0 +1,228 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2015 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Heinrich Toews <heinrich.toews@wago.com>
+ *
+ * Copyright (C) 2018 WAGO Kontakttechnik GmbH & Co. KG <http://global.wago.com>
+ * Author: Oleg Karfich <oleg.karfich@wago.com>
+ */
+
+#include "am33xx.dtsi"
+
+/ {
+	aliases {
+		ethernet0 = &cpsw_emac1;
+		ethernet1 = &cpsw_emac0;
+		bootstate = &bootstate;
+	};
+
+	chosen {
+		stdout-path = &uart0;
+
+		environment_sd: environment-sd {
+			compatible = "barebox,environment";
+			device-path = &mmc1, "partname:0";
+			file-path = "barebox.env";
+			status = "disabled";
+		};
+	};
+
+	bootstate: bootstate {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		magic = <0x3f45620e>;
+		compatible = "barebox,state";
+		backend-type = "raw";
+		backend = <&backend_state_eeprom>;
+		backend-storage-type = "direct";
+		backend-stridesize = <0x40>;
+
+		last_chosen@0 {
+			reg = <0x0 0x4>;
+			type = "uint32";
+		};
+
+		system0 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			remaining_attempts@4 {
+				reg = <0x4 0x4>;
+				type = "uint32";
+				default = <3>;
+			};
+
+			priority@8 {
+				reg = <0x8 0x4>;
+				type = "uint32";
+				default = <20>;
+			};
+		};
+
+		system1 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			remaining_attempts@C {
+				reg = <0xC 0x4>;
+				type = "uint32";
+				default = <3>;
+			};
+
+			priority@10 {
+				reg = <0x10 0x4>;
+				type = "uint32";
+				default = <20>;
+			};
+		};
+	};
+
+	vmmcsd_fixed: fixedregulator@0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vmmcsd_fixed";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+};
+
+&am33xx_pinmux {
+	uart0_pins: pinmux_uart0_pins {
+		pinctrl-single,pins = <
+			0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
+			0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart0_txd.uart0_txd */
+		>;
+	};
+
+	uart1_pins: pinmux_uart1_pins {
+		pinctrl-single,pins = <
+			0x178 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart1_cts.uart1_cts */
+			0x17C (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart1_rts.uart1_rts */
+			0x180 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart1_rxd.uart1_rxd */
+			0x184 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart1_txd.uart1_txd */
+			0x1A4 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* mcasp0_fsr.gpio3_19 */
+		>;
+	};
+
+	i2c0_pins: pinmux_i2c0_pins {
+		pinctrl-single,pins = <
+			0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
+			0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
+		>;
+	};
+
+	davinci_mdio_default: davinci_mdio_default {
+		pinctrl-single,pins = <
+			0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
+			0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)		     /* mdio_clk.mdio_clk */
+		>;
+	};
+
+	davinci_mdio_sleep: davinci_mdio_sleep {
+		pinctrl-single,pins = <
+			0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+			0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+		>;
+	};
+
+	mmc1_pins: pinmux_mmc1_pins {
+		pinctrl-single,pins = <
+                        0x0F0 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat3.mmc0_dat3 */
+                        0x0F4 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat2.mmc0_dat2 */
+                        0x0F8 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat1.mmc0_dat1 */
+                        0x0FC (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat0.mmc0_dat0 */
+                        0x100 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_clk.mmc0_clk   */
+                        0x104 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_cmd.mmc0_cmd   */
+			0x190 (PIN_INPUT_PULLDOWN | MUX_MODE7)  /* mcasp0_aclkx.gpio3_14 */
+		>;
+	};
+
+	bas_pins: pinmux_bas_pins {
+		pinctrl-single,pins = <
+			0x194 (PIN_INPUT | MUX_MODE7)    /* mcasp0_fsx.gpio3_15    */    //b13   RESET-ALL-BUT
+			0x198 (PIN_INPUT | MUX_MODE7)    /* mcasp0_axr0.gpio3_16   */    //d12   nRST-BAS
+			0x19c (PIN_INPUT | MUX_MODE7)    /* mcasp0_ahclkr.gpio3_17 */    //c12   nSTOP-BAS
+			0x1A0 (PIN_INPUT | MUX_MODE7)    /* mcasp0_aclkr.gpio3_18  */    //b12   nRUN-BAS
+		>;
+	};
+};
+
+&cppi41dma  {
+	status = "okay";
+};
+
+&mmc1 {
+	status = "okay";
+	vmmc-supply = <&vmmcsd_fixed>;
+	bus-width = <0x4>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins>;
+	cd-gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
+	cd-inverted;
+};
+
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins>;
+	status = "disabled";
+};
+
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins>;
+	status = "disabled";
+};
+
+&cpsw_emac0 {
+	phy-mode = "rmii";
+	fixed-link {
+		speed = <100>;
+		full-duplex;
+	};
+};
+
+&cpsw_emac1 {
+	phy-mode = "rmii";
+	fixed-link {
+		speed = <100>;
+		full-duplex;
+	};
+};
+
+&phy_gmii_sel {
+	rmii-clock-ext;
+	status = "okay";
+};
+
+&davinci_mdio {
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&davinci_mdio_default>;
+	pinctrl-1 = <&davinci_mdio_sleep>;
+	status = "okay";
+};
+
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_pins>;
+
+	clock-frequency = <400000>;
+	status = "okay";
+
+	eeprom: eeprom@54 {
+		status = "okay";
+		compatible = "atmel,24c512";
+		pagesize = <128>;
+		reg = <0x54>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#size-cells = <1>;
+			#address-cells = <1>;
+
+			backend_state_eeprom: state@8000 {
+				reg = <0x8000 0x120>;
+				label = "state-eeprom";
+			};
+		};
+	};
+};
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index e9228809f067..6f8f4473a36f 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -183,6 +183,13 @@ config MACH_VSCOM_BALTOS
 	help
 	  Say Y here if you are using a am335x based VScom Baltos devices
 
+config MACH_WAGO_PFC_AM335X
+	bool "Wago PFC200 Fieldbus Controllers (AM335X based)"
+	select ARCH_AM33XX
+	help
+	  Say Y here if you are using a AM335x based Wago PFC controller, like
+	  PFC200 750-821x
+
 config MACH_WAGO_PFC_AM35XX
         bool "Wago PFC200 Fieldbus Controller"
         select ARCH_AM35XX
diff --git a/images/Makefile.am33xx b/images/Makefile.am33xx
index 1de2474df5c9..e61dc36e9fb4 100644
--- a/images/Makefile.am33xx
+++ b/images/Makefile.am33xx
@@ -135,6 +135,14 @@ pblb-$(CONFIG_MACH_VSCOM_BALTOS) += start_am33xx_baltos_sram
 FILE_barebox-am33xx-baltos-mlo.img = start_am33xx_baltos_sram.pblb.mlo
 am33xx-mlo-$(CONFIG_MACH_VSCOM_BALTOS) += barebox-am33xx-baltos-mlo.img
 
+pblb-$(CONFIG_MACH_WAGO_PFC_AM335X) += start_am33xx_pfc_750_821x_sdram
+FILE_barebox-am33xx-pfc-750-821x.img = start_am33xx_pfc_750_821x_sdram.pblb
+am33xx-barebox-$(CONFIG_MACH_WAGO_PFC_AM335X) += barebox-am33xx-pfc-750-821x.img
+
+pblb-$(CONFIG_MACH_WAGO_PFC_AM335X) += start_am33xx_pfc_750_821x_sram_512mb
+FILE_barebox-am33xx-pfc-750-821x-mlo.img = start_am33xx_pfc_750_821x_sram_512mb.pblb.mlo
+am33xx-mlo-$(CONFIG_MACH_WAGO_PFC_AM335X) += barebox-am33xx-pfc-750-821x-mlo.img
+
 ifdef CONFIG_OMAP_BUILD_IFT
 image-y += $(am33xx-mlo-y)
 else
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2019-12-11 20:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 20:02 Roland Hieber [this message]
2019-12-11 20:02 ` [PATCH 2/2] ARM: omap: reword MACH_WAGO_PFC_AM35XX kconfig help text Roland Hieber
2019-12-13  9:24 ` [PATCH 1/2] ARM: omap: support for WAGO PFC200v3 750-821x Sascha Hauer
2019-12-13  9:39 ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191211200243.21164-1-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox