[PATCH 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

STALE3152d

Revision v1 of 5 in this series.

80 messages, 5 authors, 2017-12-20 · page 1 of 2 · open the first message on its own page

[PATCH 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-16 23:23:19

This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Move the common code for ts72xx and BK3 to ts72xx-common.c - this
  code can be reused by other designs build around ts72xx
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c

Lukasz Majewski (4):
  ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Exclude reusable part of the ts72xx board
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 arch/arm/mach-ep93xx/Kconfig         |  11 +++
 arch/arm/mach-ep93xx/Makefile        |   2 +
 arch/arm/mach-ep93xx/bk3.c           |  88 +++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx-common.c | 158 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx.c        | 136 ++----------------------------
 arch/arm/mach-ep93xx/ts72xx.h        |  14 ++++
 arch/arm/tools/mach-types            |   1 +
 7 files changed, 279 insertions(+), 131 deletions(-)
 create mode 100644 arch/arm/mach-ep93xx/bk3.c
 create mode 100644 arch/arm/mach-ep93xx/ts72xx-common.c

-- 
2.11.0

[PATCH 1/4] ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-16 23:23:11

This commit cleans up the code by using dedicated macros instead of
full definitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 arch/arm/mach-ep93xx/ts72xx.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 8745162ec05d..06345b85f27c 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -187,16 +187,8 @@ static struct platform_device ts72xx_rtc_device = {
 };
 
 static struct resource ts72xx_wdt_resources[] = {
-	{
-		.start	= TS72XX_WDT_CONTROL_PHYS_BASE,
-		.end	= TS72XX_WDT_CONTROL_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= TS72XX_WDT_FEED_PHYS_BASE,
-		.end	= TS72XX_WDT_FEED_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
+	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
 };
 
 static struct platform_device ts72xx_wdt_device = {
@@ -216,11 +208,7 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 #define TS73XX_FPGA_LOADER_BASE		0x03c00000
 
 static struct resource ts73xx_fpga_resources[] = {
-	{
-		.start	= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE,
-		.end	= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE, 0x01),
 };
 
 static struct platform_device ts73xx_fpga_device = {
-- 
2.11.0

[PATCH 4/4] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-16 23:23:38

The BK3 board is a derivative of the ts72xx reference design. Hence, it
can re-use code from the ts72xx-common.c file.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 arch/arm/mach-ep93xx/Kconfig  |  7 ++++
 arch/arm/mach-ep93xx/Makefile |  1 +
 arch/arm/mach-ep93xx/bk3.c    | 88 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx.h |  5 +++
 arch/arm/tools/mach-types     |  1 +
 5 files changed, 102 insertions(+)
 create mode 100644 arch/arm/mach-ep93xx/bk3.c
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 16c5d6eedf45..18a93b404d5e 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
 	  Say 'Y' here if you want your kernel to support the ADS
 	  Sphere board.
 
+config MACH_BK3
+	bool "Support Liebherr BK3.1"
+	select TS72XX_COMMON
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Liebherr controller BK3.1.
+
 config MACH_EDB93XX
 	bool
 
diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile
index f2692a072864..fb5bdb7cb944 100644
--- a/arch/arm/mach-ep93xx/Makefile
+++ b/arch/arm/mach-ep93xx/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_CRUNCH)		+= crunch.o crunch-bits.o
 AFLAGS_crunch-bits.o		:= -Wa,-mcpu=ep9312
 
 obj-$(CONFIG_MACH_ADSSPHERE)	+= adssphere.o
+obj-$(CONFIG_MACH_BK3)          += bk3.o
 obj-$(CONFIG_MACH_EDB93XX)	+= edb93xx.o
 obj-$(CONFIG_MACH_GESBC9312)	+= gesbc9312.o
 obj-$(CONFIG_MACH_MICRO9)	+= micro9.o
diff --git a/arch/arm/mach-ep93xx/bk3.c b/arch/arm/mach-ep93xx/bk3.c
new file mode 100644
index 000000000000..6fb4b72500ee
--- /dev/null
+++ b/arch/arm/mach-ep93xx/bk3.c
@@ -0,0 +1,88 @@
+/*
+ * arch/arm/mach-ep93xx/bk3.c
+ * Liebherr HVAC controller bk3.1
+ *
+ * based on arch/arm/mach-ep93xx/ts72xx.c
+ *
+ * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
+ * Copyright (C) 2017
+ * Lukasz Majewski, DENX Software Engineering, lukma at denx.de
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <asm/io.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/partitions.h>
+#include <linux/amba/bus.h>
+
+#include <mach/hardware.h>
+#include <mach/irqs.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/map.h>
+#include <asm/mach/arch.h>
+
+#include "soc.h"
+#include "ts72xx.h"
+
+/* NAND definition */
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,
+		.size		= 0x01e00000,
+	}, {
+		.name		= "Data",
+		.offset	= 0x01e00000,
+		.size		= 0x05f20000
+	}, {
+		.name		= "RedBoot",
+		.offset	= 0x07d20000,
+		.size		= 0x002e0000,
+		.mask_flags	= MTD_WRITEABLE,	/* force RO */
+	},
+};
+
+static AMBA_APB_DEVICE(i2s1, "apb:i2s", 1, EP93XX_I2S_PHYS_BASE,
+		       { IRQ_EP93XX_SAI }, NULL);
+
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		= __phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+static void __init bk3_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(bk3_io_desc, ARRAY_SIZE(bk3_io_desc));
+}
+
+static void __init bk3_init_machine(void)
+{
+	ep93xx_init_devices();
+
+	ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts));
+	ts72xx_register_watchdog();
+	ts72xx_register_eth();
+
+	amba_device_register(&i2s1_device, &iomem_resource);
+}
+
+MACHINE_START(BK3, "Liebherr controller BK3.1")
+	/* Maintainer: Lukasz Majewski <lukma@denx.de> */
+	.atag_offset	= 0x100,
+	.map_io	= bk3_map_io,
+	.init_irq	= ep93xx_init_irq,
+	.init_time	= ep93xx_timer_init,
+	.init_machine	= bk3_init_machine,
+	.init_late	= ep93xx_init_late,
+	.restart	= ep93xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index a9d3bb49f666..07f6491f35ea 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -44,6 +44,11 @@
 #define TS72XX_WDT_CONTROL_PHYS_BASE	0x23800000
 #define TS72XX_WDT_FEED_PHYS_BASE	0x23c00000
 
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+
 #ifndef __ASSEMBLY__
 
 static inline int ts72xx_model(void)
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index a9313b66f770..4eac94c1eb6f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -345,6 +345,7 @@ mxlads			MACH_MXLADS		MXLADS			1851
 linkstation_mini	MACH_LINKSTATION_MINI	LINKSTATION_MINI	1858
 afeb9260		MACH_AFEB9260		AFEB9260		1859
 imx27ipcam		MACH_IMX27IPCAM		IMX27IPCAM		1871
+bk3			MACH_BK3		BK3			1880
 rd88f6183ap_ge		MACH_RD88F6183AP_GE	RD88F6183AP_GE		1894
 realview_pba8		MACH_REALVIEW_PBA8	REALVIEW_PBA8		1897
 realview_pbx		MACH_REALVIEW_PBX	REALVIEW_PBX		1901
-- 
2.11.0

[PATCH 3/4] ARM: ep93xx: ts72xx: Exclude reusable part of the ts72xx board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-16 23:23:49

This commit creates a new file ts72xx-common.c [1], which consists
of code being potentially re-usable by other clones of reference
ts72xx design.

To achieve this goal, a new symbol - TS72XX_COMMON has been introduced.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 arch/arm/mach-ep93xx/Kconfig         |   4 +
 arch/arm/mach-ep93xx/Makefile        |   1 +
 arch/arm/mach-ep93xx/ts72xx-common.c | 158 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx.c        | 122 +--------------------------
 arch/arm/mach-ep93xx/ts72xx.h        |   5 ++
 5 files changed, 172 insertions(+), 118 deletions(-)
 create mode 100644 arch/arm/mach-ep93xx/ts72xx-common.c
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 61a75ca3684e..16c5d6eedf45 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -131,10 +131,14 @@ config MACH_SNAPPER_CL15
 
 config MACH_TS72XX
 	bool "Support Technologic Systems TS-72xx SBC"
+	select TS72XX_COMMON
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Technologic Systems TS-72xx board.
 
+config TS72XX_COMMON
+	bool
+
 config MACH_VISION_EP9307
 	bool "Support Vision Engraving Systems EP9307 SoM"
 	help
diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile
index b7ae4345ac08..f2692a072864 100644
--- a/arch/arm/mach-ep93xx/Makefile
+++ b/arch/arm/mach-ep93xx/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_MACH_SIM_ONE)	+= simone.o
 obj-$(CONFIG_MACH_SNAPPER_CL15)	+= snappercl15.o
 obj-$(CONFIG_MACH_TS72XX)	+= ts72xx.o
 obj-$(CONFIG_MACH_VISION_EP9307)+= vision_ep9307.o
+obj-$(CONFIG_TS72XX_COMMON)	+= ts72xx-common.o
diff --git a/arch/arm/mach-ep93xx/ts72xx-common.c b/arch/arm/mach-ep93xx/ts72xx-common.c
new file mode 100644
index 000000000000..6d8b3896a75b
--- /dev/null
+++ b/arch/arm/mach-ep93xx/ts72xx-common.c
@@ -0,0 +1,158 @@
+/*
+ * ts72xx - common platform code (like NAND access)
+ *
+ * Copyright (C) 2017
+ * Lukasz Majewski, DENX Software Engineering, lukma at denx.de
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/partitions.h>
+
+#include <mach/hardware.h>
+
+#include <asm/mach/map.h>
+
+#include "soc.h"
+#include "ts72xx.h"
+
+/*************************************************************************
+ * IO map
+ *************************************************************************/
+static struct map_desc ts72xx_common_io_desc[] __initdata = {
+	{
+		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
+		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
+		.length		= TS72XX_MODEL_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+void __init ts72xx_common_map_io(void)
+{
+	ep93xx_map_io();
+	iotable_init(ts72xx_common_io_desc, ARRAY_SIZE(ts72xx_common_io_desc));
+}
+
+/*************************************************************************
+ * NAND flash
+ *************************************************************************/
+#define TS72XX_NAND_CONTROL_ADDR_LINE	22	/* 0xN0400000 */
+#define TS72XX_NAND_BUSY_ADDR_LINE	23	/* 0xN0800000 */
+
+static void ts72xx_nand_hwcontrol(struct mtd_info *mtd,
+				  int cmd, unsigned int ctrl)
+{
+	struct nand_chip *chip = mtd_to_nand(mtd);
+
+	if (ctrl & NAND_CTRL_CHANGE) {
+		void __iomem *addr = chip->IO_ADDR_R;
+		unsigned char bits;
+
+		addr += (1 << TS72XX_NAND_CONTROL_ADDR_LINE);
+
+		bits = __raw_readb(addr) & ~0x07;
+		bits |= (ctrl & NAND_NCE) << 2;	/* bit 0 -> bit 2 */
+		bits |= (ctrl & NAND_CLE);	/* bit 1 -> bit 1 */
+		bits |= (ctrl & NAND_ALE) >> 2;	/* bit 2 -> bit 0 */
+
+		__raw_writeb(bits, addr);
+	}
+
+	if (cmd != NAND_CMD_NONE)
+		__raw_writeb(cmd, chip->IO_ADDR_W);
+}
+
+static int ts72xx_nand_device_ready(struct mtd_info *mtd)
+{
+	struct nand_chip *chip = mtd_to_nand(mtd);
+	void __iomem *addr = chip->IO_ADDR_R;
+
+	addr += (1 << TS72XX_NAND_BUSY_ADDR_LINE);
+
+	return !!(__raw_readb(addr) & 0x20);
+}
+
+static struct platform_nand_data ts72xx_nand_data = {
+	.chip = {
+		.nr_chips	= 1,
+		.chip_offset	= 0,
+		.chip_delay	= 15,
+	},
+	.ctrl = {
+		.cmd_ctrl	= ts72xx_nand_hwcontrol,
+		.dev_ready	= ts72xx_nand_device_ready,
+	},
+};
+
+static struct resource ts72xx_nand_resource[] = {
+	DEFINE_RES_MEM(EP93XX_CS6_PHYS_BASE, SZ_16M),
+};
+
+static struct platform_device ts72xx_nand_flash = {
+	.name			= "gen_nand",
+	.id			= -1,
+	.dev.platform_data	= &ts72xx_nand_data,
+	.resource		= ts72xx_nand_resource,
+	.num_resources		= ARRAY_SIZE(ts72xx_nand_resource),
+};
+
+void __init ts72xx_register_flash(struct mtd_partition *parts, int n)
+{
+	/*
+	 * TS7200 has NOR flash all other TS72xx board have NAND flash.
+	 */
+	if (board_is_ts7200()) {
+		ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
+	} else {
+		resource_size_t start;
+
+		if (is_ts9420_installed())
+			start = EP93XX_CS7_PHYS_BASE;
+		else
+			start = EP93XX_CS6_PHYS_BASE;
+
+		ts72xx_nand_resource[0].start = start;
+		ts72xx_nand_resource[0].end = start + SZ_16M - 1;
+
+		ts72xx_nand_data.chip.partitions = parts;
+		ts72xx_nand_data.chip.nr_partitions = n;
+
+		platform_device_register(&ts72xx_nand_flash);
+	}
+}
+
+/*************************************************************************
+ * WATCHDOG
+ *************************************************************************/
+static struct resource ts72xx_wdt_resources[] = {
+	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
+	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
+};
+
+static struct platform_device ts72xx_wdt_device = {
+	.name		= "ts72xx-wdt",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(ts72xx_wdt_resources),
+	.resource	= ts72xx_wdt_resources,
+};
+
+void __init ts72xx_register_watchdog(void)
+{
+	platform_device_register(&ts72xx_wdt_device);
+}
+
+/*************************************************************************
+ * ETH
+ *************************************************************************/
+static struct ep93xx_eth_data ts72xx_eth_data = {
+	.phy_id		= 1,
+};
+
+void __init ts72xx_register_eth(void)
+{
+	ep93xx_register_eth(&ts72xx_eth_data, 1);
+}
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 06345b85f27c..d8bb352a5422 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -30,11 +30,6 @@
 
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
-		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
-		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
-		.length		= TS72XX_MODEL_SIZE,
-		.type		= MT_DEVICE,
-	}, {
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
 		.pfn		= __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE),
 		.length		= TS72XX_OPTIONS_SIZE,
@@ -49,50 +44,10 @@ static struct map_desc ts72xx_io_desc[] __initdata = {
 
 static void __init ts72xx_map_io(void)
 {
-	ep93xx_map_io();
+	ts72xx_common_map_io();
 	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
 }
 
-
-/*************************************************************************
- * NAND flash
- *************************************************************************/
-#define TS72XX_NAND_CONTROL_ADDR_LINE	22	/* 0xN0400000 */
-#define TS72XX_NAND_BUSY_ADDR_LINE	23	/* 0xN0800000 */
-
-static void ts72xx_nand_hwcontrol(struct mtd_info *mtd,
-				  int cmd, unsigned int ctrl)
-{
-	struct nand_chip *chip = mtd_to_nand(mtd);
-
-	if (ctrl & NAND_CTRL_CHANGE) {
-		void __iomem *addr = chip->IO_ADDR_R;
-		unsigned char bits;
-
-		addr += (1 << TS72XX_NAND_CONTROL_ADDR_LINE);
-
-		bits = __raw_readb(addr) & ~0x07;
-		bits |= (ctrl & NAND_NCE) << 2;	/* bit 0 -> bit 2 */
-		bits |= (ctrl & NAND_CLE);	/* bit 1 -> bit 1 */
-		bits |= (ctrl & NAND_ALE) >> 2;	/* bit 2 -> bit 0 */
-
-		__raw_writeb(bits, addr);
-	}
-
-	if (cmd != NAND_CMD_NONE)
-		__raw_writeb(cmd, chip->IO_ADDR_W);
-}
-
-static int ts72xx_nand_device_ready(struct mtd_info *mtd)
-{
-	struct nand_chip *chip = mtd_to_nand(mtd);
-	void __iomem *addr = chip->IO_ADDR_R;
-
-	addr += (1 << TS72XX_NAND_BUSY_ADDR_LINE);
-
-	return !!(__raw_readb(addr) & 0x20);
-}
-
 #define TS72XX_BOOTROM_PART_SIZE	(SZ_16K)
 #define TS72XX_REDBOOT_PART_SIZE	(SZ_2M + SZ_1M)
 
@@ -115,59 +70,6 @@ static struct mtd_partition ts72xx_nand_parts[] = {
 	},
 };
 
-static struct platform_nand_data ts72xx_nand_data = {
-	.chip = {
-		.nr_chips	= 1,
-		.chip_offset	= 0,
-		.chip_delay	= 15,
-		.partitions	= ts72xx_nand_parts,
-		.nr_partitions	= ARRAY_SIZE(ts72xx_nand_parts),
-	},
-	.ctrl = {
-		.cmd_ctrl	= ts72xx_nand_hwcontrol,
-		.dev_ready	= ts72xx_nand_device_ready,
-	},
-};
-
-static struct resource ts72xx_nand_resource[] = {
-	{
-		.start		= 0,			/* filled in later */
-		.end		= 0,			/* filled in later */
-		.flags		= IORESOURCE_MEM,
-	},
-};
-
-static struct platform_device ts72xx_nand_flash = {
-	.name			= "gen_nand",
-	.id			= -1,
-	.dev.platform_data	= &ts72xx_nand_data,
-	.resource		= ts72xx_nand_resource,
-	.num_resources		= ARRAY_SIZE(ts72xx_nand_resource),
-};
-
-
-static void __init ts72xx_register_flash(void)
-{
-	/*
-	 * TS7200 has NOR flash all other TS72xx board have NAND flash.
-	 */
-	if (board_is_ts7200()) {
-		ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
-	} else {
-		resource_size_t start;
-
-		if (is_ts9420_installed())
-			start = EP93XX_CS7_PHYS_BASE;
-		else
-			start = EP93XX_CS6_PHYS_BASE;
-
-		ts72xx_nand_resource[0].start = start;
-		ts72xx_nand_resource[0].end = start + SZ_16M - 1;
-
-		platform_device_register(&ts72xx_nand_flash);
-	}
-}
-
 /*************************************************************************
  * RTC M48T86
  *************************************************************************/
@@ -186,22 +88,6 @@ static struct platform_device ts72xx_rtc_device = {
 	.num_resources 	= ARRAY_SIZE(ts72xx_rtc_resources),
 };
 
-static struct resource ts72xx_wdt_resources[] = {
-	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
-	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
-};
-
-static struct platform_device ts72xx_wdt_device = {
-	.name		= "ts72xx-wdt",
-	.id		= -1,
-	.num_resources 	= ARRAY_SIZE(ts72xx_wdt_resources),
-	.resource	= ts72xx_wdt_resources,
-};
-
-static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
-	.phy_id		= 1,
-};
-
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
 
 /* Relative to EP93XX_CS1_PHYS_BASE */
@@ -223,11 +109,11 @@ static struct platform_device ts73xx_fpga_device = {
 static void __init ts72xx_init_machine(void)
 {
 	ep93xx_init_devices();
-	ts72xx_register_flash();
+	ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts));
 	platform_device_register(&ts72xx_rtc_device);
-	platform_device_register(&ts72xx_wdt_device);
+	ts72xx_register_watchdog();
+	ts72xx_register_eth();
 
-	ep93xx_register_eth(&ts72xx_eth_data, 1);
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
 	if (board_is_ts7300())
 		platform_device_register(&ts73xx_fpga_device);
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index d67f203f769a..a9d3bb49f666 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -87,5 +87,10 @@ static inline int is_ts9420_installed(void)
 	return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) &
 					TS72XX_OPTIONS2_TS9420);
 }
+
+void __init ts72xx_register_flash(struct mtd_partition *parts, int n);
+void __init ts72xx_register_watchdog(void);
+void __init ts72xx_common_map_io(void);
+void __init ts72xx_register_eth(void);
 #endif
 #endif /* __TS72XX_H_ */
-- 
2.11.0

[PATCH 2/4] ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-16 23:23:56

This commit adds include file guards to ts72xx.h

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 arch/arm/mach-ep93xx/ts72xx.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index 2255ba29fdd6..d67f203f769a 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -11,6 +11,9 @@
  * febfd000	22800000	4K	options register #2
  */
 
+#ifndef __TS72XX_H_
+#define __TS72XX_H_
+
 #define TS72XX_MODEL_PHYS_BASE		0x22000000
 #define TS72XX_MODEL_VIRT_BASE		IOMEM(0xfebff000)
 #define TS72XX_MODEL_SIZE		0x00001000
@@ -85,3 +88,4 @@ static inline int is_ts9420_installed(void)
 					TS72XX_OPTIONS2_TS9420);
 }
 #endif
+#endif /* __TS72XX_H_ */
-- 
2.11.0

Re: [PATCH 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-11-19 21:28:10

Hello Lukasz!

On 17/11/17 00:22, Lukasz Majewski wrote:
This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Move the common code for ts72xx and BK3 to ts72xx-common.c - this
  code can be reused by other designs build around ts72xx
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c

Lukasz Majewski (4):
  ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable
The patch 3/4 deletes everything added by patch 1/4, so I don't really see the point of it.
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Exclude reusable part of the ts72xx board
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative
I tend to agree with Hartley, if you'd just add all BK3-related extras to ts72xx.c it would
be less than 60 LoCs, you probably even do not need new Kconfig options.

Alex.

Re: [PATCH 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-19 23:23:22

Hi Alexander,
Hello Lukasz!

On 17/11/17 00:22, Lukasz Majewski wrote:
quoted
This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Move the common code for ts72xx and BK3 to ts72xx-common.c - this
  code can be reused by other designs build around ts72xx
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c

Lukasz Majewski (4):
  ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable  
The patch 3/4 deletes everything added by patch 1/4, so I don't
really see the point of it.
I wanted to first clean up things.
quoted
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Exclude reusable part of the ts72xx board
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx
derivative  
I tend to agree with Hartley, if you'd just add all BK3-related
extras to ts72xx.c it would be less than 60 LoCs, you probably even
do not need new Kconfig options.
Some Kconfig option would be welcome (MACH_BK3 ?) if it turns out that I
do need to adjust some things later (like change HAMMING NAND ECC to BCH
for plat_nand driver).

The separate bk3.c file is more appealing (for me) in terms of extending
the code latter.

Alex.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171120/d0ce35fc/attachment.sig>

Re: [PATCH 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-11-20 13:23:08

On Mon, Nov 20, 2017 at 12:23 AM, Lukasz Majewski [off-list ref] wrote:
Hi Alexander,
quoted
Hello Lukasz!

On 17/11/17 00:22, Lukasz Majewski wrote:
quoted
This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Move the common code for ts72xx and BK3 to ts72xx-common.c - this
  code can be reused by other designs build around ts72xx
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c

Lukasz Majewski (4):
  ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable
The patch 3/4 deletes everything added by patch 1/4, so I don't
really see the point of it.
I wanted to first clean up things.
Cleaning it up first is the right approach, a patch that moves code around
should not contain any other changes.
quoted
quoted
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Exclude reusable part of the ts72xx board
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx
derivative
I tend to agree with Hartley, if you'd just add all BK3-related
extras to ts72xx.c it would be less than 60 LoCs, you probably even
do not need new Kconfig options.
Some Kconfig option would be welcome (MACH_BK3 ?) if it turns out that I
do need to adjust some things later (like change HAMMING NAND ECC to BCH
for plat_nand driver).

The separate bk3.c file is more appealing (for me) in terms of extending
the code latter.
I think keeping everything in one file, but adding a new Kconfig option that
uses 'select MACH_TS72XX' to enable the existing board would be simpler,
we can split it out later once we think it gets too big.

      Arnd

Re: [PATCH 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-20 14:44:36

Hi Arnd,
On Mon, Nov 20, 2017 at 12:23 AM, Lukasz Majewski [off-list ref]
wrote:
quoted
Hi Alexander,
 
quoted
Hello Lukasz!

On 17/11/17 00:22, Lukasz Majewski wrote:  
quoted
This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Move the common code for ts72xx and BK3 to ts72xx-common.c -
this code can be reused by other designs build around ts72xx
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c

Lukasz Majewski (4):
  ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where
applicable  
The patch 3/4 deletes everything added by patch 1/4, so I don't
really see the point of it.  
I wanted to first clean up things.  
Cleaning it up first is the right approach, a patch that moves code
around should not contain any other changes.
quoted
quoted
quoted
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Exclude reusable part of the ts72xx board
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx
derivative  
I tend to agree with Hartley, if you'd just add all BK3-related
extras to ts72xx.c it would be less than 60 LoCs, you probably even
do not need new Kconfig options.  
Some Kconfig option would be welcome (MACH_BK3 ?) if it turns out
that I do need to adjust some things later (like change HAMMING
NAND ECC to BCH for plat_nand driver).

The separate bk3.c file is more appealing (for me) in terms of
extending the code latter.  
I think keeping everything in one file, but adding a new Kconfig
option that uses 'select MACH_TS72XX' to enable the existing board
would be simpler, we can split it out later once we think it gets too
big.
Ok. Thanks for the suggestion. I will prepare v2.
      Arnd


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171120/aceeacbd/attachment.sig>

[PATCH v2 1/6] ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-21 14:32:30

This commit cleans up the code by using dedicated macros instead of
full definitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 8745162ec05d..06345b85f27c 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -187,16 +187,8 @@ static struct platform_device ts72xx_rtc_device = {
 };
 
 static struct resource ts72xx_wdt_resources[] = {
-	{
-		.start	= TS72XX_WDT_CONTROL_PHYS_BASE,
-		.end	= TS72XX_WDT_CONTROL_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= TS72XX_WDT_FEED_PHYS_BASE,
-		.end	= TS72XX_WDT_FEED_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
+	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
 };
 
 static struct platform_device ts72xx_wdt_device = {
@@ -216,11 +208,7 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 #define TS73XX_FPGA_LOADER_BASE		0x03c00000
 
 static struct resource ts73xx_fpga_resources[] = {
-	{
-		.start	= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE,
-		.end	= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE, 0x01),
 };
 
 static struct platform_device ts73xx_fpga_device = {
-- 
2.11.0

[PATCH v2 0/6] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-21 14:32:31

This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c

This series applies on top of v4.14

Lukasz Majewski (6):
  ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept
    parameters
  ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable
  ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 arch/arm/mach-ep93xx/Kconfig  |   7 +++
 arch/arm/mach-ep93xx/ts72xx.c | 137 +++++++++++++++++++++++++++++++-----------
 arch/arm/mach-ep93xx/ts72xx.h |   9 +++
 arch/arm/tools/mach-types     |   1 +
 4 files changed, 120 insertions(+), 34 deletions(-)

-- 
2.11.0

[PATCH v2 3/6] ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept parameters

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-21 14:32:37

This commit extend the ts72xx_register_flash() to accept passed parameters,
which makes it more reusable.

Now it is possible to accept ep93xx flash start address and partitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---
Changes for v2:
- New patch
---
 arch/arm/mach-ep93xx/ts72xx.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 06345b85f27c..00e0e5b8babf 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -120,8 +120,6 @@ static struct platform_nand_data ts72xx_nand_data = {
 		.nr_chips	= 1,
 		.chip_offset	= 0,
 		.chip_delay	= 15,
-		.partitions	= ts72xx_nand_parts,
-		.nr_partitions	= ARRAY_SIZE(ts72xx_nand_parts),
 	},
 	.ctrl = {
 		.cmd_ctrl	= ts72xx_nand_hwcontrol,
@@ -145,8 +143,8 @@ static struct platform_device ts72xx_nand_flash = {
 	.num_resources		= ARRAY_SIZE(ts72xx_nand_resource),
 };
 
-
-static void __init ts72xx_register_flash(void)
+void __init ts72xx_register_flash(struct mtd_partition *parts, int n,
+				  resource_size_t start)
 {
 	/*
 	 * TS7200 has NOR flash all other TS72xx board have NAND flash.
@@ -154,16 +152,12 @@ static void __init ts72xx_register_flash(void)
 	if (board_is_ts7200()) {
 		ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
 	} else {
-		resource_size_t start;
-
-		if (is_ts9420_installed())
-			start = EP93XX_CS7_PHYS_BASE;
-		else
-			start = EP93XX_CS6_PHYS_BASE;
-
 		ts72xx_nand_resource[0].start = start;
 		ts72xx_nand_resource[0].end = start + SZ_16M - 1;
 
+		ts72xx_nand_data.chip.partitions = parts;
+		ts72xx_nand_data.chip.nr_partitions = n;
+
 		platform_device_register(&ts72xx_nand_flash);
 	}
 }
@@ -223,7 +217,9 @@ static struct platform_device ts73xx_fpga_device = {
 static void __init ts72xx_init_machine(void)
 {
 	ep93xx_init_devices();
-	ts72xx_register_flash();
+	ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts),
+			      is_ts9420_installed() ?
+			      EP93XX_CS7_PHYS_BASE : EP93XX_CS6_PHYS_BASE);
 	platform_device_register(&ts72xx_rtc_device);
 	platform_device_register(&ts72xx_wdt_device);
 
-- 
2.11.0

[PATCH v2 4/6] ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-21 14:32:42

The map IO common code has been excluded to be reused by other ts72xx
clones.

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---
Changes for v2:
- New patch
---
 arch/arm/mach-ep93xx/ts72xx.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 00e0e5b8babf..a6e473b3dcf6 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -30,11 +30,6 @@
 
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
-		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
-		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
-		.length		= TS72XX_MODEL_SIZE,
-		.type		= MT_DEVICE,
-	}, {
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
 		.pfn		= __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE),
 		.length		= TS72XX_OPTIONS_SIZE,
@@ -47,12 +42,26 @@ static struct map_desc ts72xx_io_desc[] __initdata = {
 	}
 };
 
-static void __init ts72xx_map_io(void)
+static struct map_desc ts72xx_common_io_desc[] __initdata = {
+	{
+		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
+		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
+		.length		= TS72XX_MODEL_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+void __init ts72xx_common_map_io(void)
 {
 	ep93xx_map_io();
-	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+	iotable_init(ts72xx_common_io_desc, ARRAY_SIZE(ts72xx_common_io_desc));
 }
 
+static void __init ts72xx_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+}
 
 /*************************************************************************
  * NAND flash
-- 
2.11.0

[PATCH v2 6/6] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-21 14:32:46

The BK3 board is a derivative of the ts72xx reference design.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Place bk3 support code to the ts72xx.c file
---
 arch/arm/mach-ep93xx/Kconfig  |  7 +++++
 arch/arm/mach-ep93xx/ts72xx.c | 64 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx.h |  5 ++++
 arch/arm/tools/mach-types     |  1 +
 4 files changed, 77 insertions(+)
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 61a75ca3684e..c095236d7ff8 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
 	  Say 'Y' here if you want your kernel to support the ADS
 	  Sphere board.
 
+config MACH_BK3
+	bool "Support Liebherr BK3.1"
+	select MACH_TS72XX
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Liebherr controller BK3.1.
+
 config MACH_EDB93XX
 	bool
 
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 2e8fcc6e87b6..0de19b136ad0 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -18,8 +18,10 @@
 #include <linux/io.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/amba/bus.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -261,3 +263,65 @@ MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
 	.init_late	= ep93xx_init_late,
 	.restart	= ep93xx_restart,
 MACHINE_END
+
+/*************************************************************************
+ * BK3 support code
+ *************************************************************************/
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,
+		.size		= 0x01e00000,
+	}, {
+		.name		= "Data",
+		.offset	= 0x01e00000,
+		.size		= 0x05f20000
+	}, {
+		.name		= "RedBoot",
+		.offset	= 0x07d20000,
+		.size		= 0x002e0000,
+		.mask_flags	= MTD_WRITEABLE,	/* force RO */
+	},
+};
+
+static AMBA_APB_DEVICE(i2s1, "apb:i2s", 1, EP93XX_I2S_PHYS_BASE,
+		       { IRQ_EP93XX_SAI }, NULL);
+
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		= __phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+static void __init bk3_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(bk3_io_desc, ARRAY_SIZE(bk3_io_desc));
+}
+
+static void __init bk3_init_machine(void)
+{
+	ep93xx_init_devices();
+
+	ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts),
+			      EP93XX_CS6_PHYS_BASE);
+
+	platform_device_register(&ts72xx_wdt_device);
+	ep93xx_register_eth(&ts72xx_eth_data, 1);
+
+	amba_device_register(&i2s1_device, &iomem_resource);
+}
+
+MACHINE_START(BK3, "Liebherr controller BK3.1")
+	/* Maintainer: Lukasz Majewski <lukma@denx.de> */
+	.atag_offset	= 0x100,
+	.map_io	= bk3_map_io,
+	.init_irq	= ep93xx_init_irq,
+	.init_time	= ep93xx_timer_init,
+	.init_machine	= bk3_init_machine,
+	.init_late	= ep93xx_init_late,
+	.restart	= ep93xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index d9ff04db3221..d3165bb9ee78 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -45,6 +45,11 @@
 #define TS72XX_WDT_CONTROL_PHYS_BASE	0x23800000
 #define TS72XX_WDT_FEED_PHYS_BASE	0x23c00000
 
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+
 #ifndef __ASSEMBLY__
 
 static inline int ts72xx_model(void)
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index a9313b66f770..4eac94c1eb6f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -345,6 +345,7 @@ mxlads			MACH_MXLADS		MXLADS			1851
 linkstation_mini	MACH_LINKSTATION_MINI	LINKSTATION_MINI	1858
 afeb9260		MACH_AFEB9260		AFEB9260		1859
 imx27ipcam		MACH_IMX27IPCAM		IMX27IPCAM		1871
+bk3			MACH_BK3		BK3			1880
 rd88f6183ap_ge		MACH_RD88F6183AP_GE	RD88F6183AP_GE		1894
 realview_pba8		MACH_REALVIEW_PBA8	REALVIEW_PBA8		1897
 realview_pbx		MACH_REALVIEW_PBX	REALVIEW_PBX		1901
-- 
2.11.0

[PATCH v2 5/6] ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-21 14:33:05

This patch extends readability of ts72xx.c code.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- New patch
---
 arch/arm/mach-ep93xx/ts72xx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index a6e473b3dcf6..2e8fcc6e87b6 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -28,6 +28,9 @@
 #include "soc.h"
 #include "ts72xx.h"
 
+/*************************************************************************
+ * IO map
+ *************************************************************************/
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
@@ -189,6 +192,9 @@ static struct platform_device ts72xx_rtc_device = {
 	.num_resources 	= ARRAY_SIZE(ts72xx_rtc_resources),
 };
 
+/*************************************************************************
+ * WATCHDOG
+ *************************************************************************/
 static struct resource ts72xx_wdt_resources[] = {
 	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
 	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
@@ -201,10 +207,16 @@ static struct platform_device ts72xx_wdt_device = {
 	.resource	= ts72xx_wdt_resources,
 };
 
+/*************************************************************************
+ * ETH
+ *************************************************************************/
 static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 	.phy_id		= 1,
 };
 
+/*************************************************************************
+ * TS72XX support code
+ *************************************************************************/
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
 
 /* Relative to EP93XX_CS1_PHYS_BASE */
-- 
2.11.0

[PATCH v2 2/6] ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-21 14:33:45

This commit adds include file guards to ts72xx.h

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- None
---
 arch/arm/mach-ep93xx/ts72xx.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index b89850f1a965..d9ff04db3221 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -12,6 +12,9 @@
  * febfd000	22800000	4K	options register #2
  */
 
+#ifndef __TS72XX_H_
+#define __TS72XX_H_
+
 #define TS72XX_MODEL_PHYS_BASE		0x22000000
 #define TS72XX_MODEL_VIRT_BASE		IOMEM(0xfebff000)
 #define TS72XX_MODEL_SIZE		0x00001000
@@ -86,3 +89,4 @@ static inline int is_ts9420_installed(void)
 					TS72XX_OPTIONS2_TS9420);
 }
 #endif
+#endif /* __TS72XX_H_ */
-- 
2.11.0

Re: [PATCH v2 0/6] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-29 09:45:53

Dear All,
This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c

This series applies on top of v4.14
Do you have any comments regarding this patch series?
Lukasz Majewski (6):
  ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept
    parameters
  ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable
  ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 arch/arm/mach-ep93xx/Kconfig  |   7 +++
 arch/arm/mach-ep93xx/ts72xx.c | 137
+++++++++++++++++++++++++++++++-----------
arch/arm/mach-ep93xx/ts72xx.h |   9 +++ arch/arm/tools/mach-types
|   1 + 4 files changed, 120 insertions(+), 34 deletions(-)


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171129/72d37d17/attachment.sig>

Re: [PATCH v2 0/6] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-11-29 12:48:55

On Wed, Nov 29, 2017 at 10:45 AM, Lukasz Majewski [off-list ref] wrote:
Dear All,
quoted
This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c

This series applies on top of v4.14
Do you have any comments regarding this patch series?
Looks all good to me.

      Arnd

Re: [PATCH v2 1/6] ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-11-29 20:33:31

Hi!

On 21/11/17 15:31, Lukasz Majewski wrote:
This commit cleans up the code by using dedicated macros instead of
full definitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
quoted hunk
---
Changes for v2:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 8745162ec05d..06345b85f27c 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -187,16 +187,8 @@ static struct platform_device ts72xx_rtc_device = {
 };
 
 static struct resource ts72xx_wdt_resources[] = {
-	{
-		.start	= TS72XX_WDT_CONTROL_PHYS_BASE,
-		.end	= TS72XX_WDT_CONTROL_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= TS72XX_WDT_FEED_PHYS_BASE,
-		.end	= TS72XX_WDT_FEED_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
+	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
 };
 
 static struct platform_device ts72xx_wdt_device = {
@@ -216,11 +208,7 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 #define TS73XX_FPGA_LOADER_BASE		0x03c00000
 
 static struct resource ts73xx_fpga_resources[] = {
-	{
-		.start	= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE,
-		.end	= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE, 0x01),
 };
 
 static struct platform_device ts73xx_fpga_device = {

Re: [PATCH v2 2/6] ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-11-29 20:34:08

Hi!

On 21/11/17 15:32, Lukasz Majewski wrote:
This commit adds include file guards to ts72xx.h

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
quoted hunk
---
Changes for v2:
- None
---
 arch/arm/mach-ep93xx/ts72xx.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index b89850f1a965..d9ff04db3221 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -12,6 +12,9 @@
  * febfd000	22800000	4K	options register #2
  */
 
+#ifndef __TS72XX_H_
+#define __TS72XX_H_
+
 #define TS72XX_MODEL_PHYS_BASE		0x22000000
 #define TS72XX_MODEL_VIRT_BASE		IOMEM(0xfebff000)
 #define TS72XX_MODEL_SIZE		0x00001000
@@ -86,3 +89,4 @@ static inline int is_ts9420_installed(void)
 					TS72XX_OPTIONS2_TS9420);
 }
 #endif
+#endif /* __TS72XX_H_ */

Re: [PATCH v2 4/6] ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-11-29 20:36:54

Hi!

On 21/11/17 15:32, Lukasz Majewski wrote:
The map IO common code has been excluded to be reused by other ts72xx
clones.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
quoted hunk
---
Changes for v2:
- New patch
---
 arch/arm/mach-ep93xx/ts72xx.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 00e0e5b8babf..a6e473b3dcf6 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -30,11 +30,6 @@
 
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
-		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
-		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
-		.length		= TS72XX_MODEL_SIZE,
-		.type		= MT_DEVICE,
-	}, {
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
 		.pfn		= __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE),
 		.length		= TS72XX_OPTIONS_SIZE,
@@ -47,12 +42,26 @@ static struct map_desc ts72xx_io_desc[] __initdata = {
 	}
 };
 
-static void __init ts72xx_map_io(void)
+static struct map_desc ts72xx_common_io_desc[] __initdata = {
+	{
+		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
+		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
+		.length		= TS72XX_MODEL_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+void __init ts72xx_common_map_io(void)
 {
 	ep93xx_map_io();
-	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+	iotable_init(ts72xx_common_io_desc, ARRAY_SIZE(ts72xx_common_io_desc));
 }
 
+static void __init ts72xx_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+}
 
 /*************************************************************************
  * NAND flash

Re: [PATCH v2 6/6] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-11-29 20:48:27

Hello Lukasz,

some nitpicking below...

On 21/11/17 15:32, Lukasz Majewski wrote:
quoted hunk
The BK3 board is a derivative of the ts72xx reference design.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Place bk3 support code to the ts72xx.c file
---
 arch/arm/mach-ep93xx/Kconfig  |  7 +++++
 arch/arm/mach-ep93xx/ts72xx.c | 64 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx.h |  5 ++++
 arch/arm/tools/mach-types     |  1 +
 4 files changed, 77 insertions(+)
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 61a75ca3684e..c095236d7ff8 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
 	  Say 'Y' here if you want your kernel to support the ADS
 	  Sphere board.
 
+config MACH_BK3
+	bool "Support Liebherr BK3.1"
+	select MACH_TS72XX
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Liebherr controller BK3.1.
+
 config MACH_EDB93XX
 	bool
 
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 2e8fcc6e87b6..0de19b136ad0 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -18,8 +18,10 @@
 #include <linux/io.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/amba/bus.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -261,3 +263,65 @@ MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
 	.init_late	= ep93xx_init_late,
 	.restart	= ep93xx_restart,
 MACHINE_END
+
+/*************************************************************************
+ * BK3 support code
+ *************************************************************************/
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,
I see the above and below lines as unaligned
+		.size		= 0x01e00000,
+	}, {
+		.name		= "Data",
+		.offset	= 0x01e00000,
same here
+		.size		= 0x05f20000
+	}, {
+		.name		= "RedBoot",
+		.offset	= 0x07d20000,
same here
+		.size		= 0x002e0000,
+		.mask_flags	= MTD_WRITEABLE,	/* force RO */
+	},
+};
+
+static AMBA_APB_DEVICE(i2s1, "apb:i2s", 1, EP93XX_I2S_PHYS_BASE,
+		       { IRQ_EP93XX_SAI }, NULL);
+
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		= __phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
same here
+		.type		= MT_DEVICE,
+	}
+};
+
+static void __init bk3_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(bk3_io_desc, ARRAY_SIZE(bk3_io_desc));
+}
+
+static void __init bk3_init_machine(void)
+{
+	ep93xx_init_devices();
+
+	ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts),
+			      EP93XX_CS6_PHYS_BASE);
+
+	platform_device_register(&ts72xx_wdt_device);
+	ep93xx_register_eth(&ts72xx_eth_data, 1);
+
+	amba_device_register(&i2s1_device, &iomem_resource);
+}
+
+MACHINE_START(BK3, "Liebherr controller BK3.1")
+	/* Maintainer: Lukasz Majewski [off-list ref] */
Don't you want to add an entry to the MAINTAINERS file instead?
Then get_maintainer.pl would be able to suggest your email.
+	.atag_offset	= 0x100,
+	.map_io	= bk3_map_io,
again, inconsistent alignment...
quoted hunk
+	.init_irq	= ep93xx_init_irq,
+	.init_time	= ep93xx_timer_init,
+	.init_machine	= bk3_init_machine,
+	.init_late	= ep93xx_init_late,
+	.restart	= ep93xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index d9ff04db3221..d3165bb9ee78 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -45,6 +45,11 @@
 #define TS72XX_WDT_CONTROL_PHYS_BASE	0x23800000
 #define TS72XX_WDT_FEED_PHYS_BASE	0x23c00000
 
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+
 #ifndef __ASSEMBLY__
 
 static inline int ts72xx_model(void)
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index a9313b66f770..4eac94c1eb6f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -345,6 +345,7 @@ mxlads			MACH_MXLADS		MXLADS			1851
 linkstation_mini	MACH_LINKSTATION_MINI	LINKSTATION_MINI	1858
 afeb9260		MACH_AFEB9260		AFEB9260		1859
 imx27ipcam		MACH_IMX27IPCAM		IMX27IPCAM		1871
+bk3			MACH_BK3		BK3			1880
 rd88f6183ap_ge		MACH_RD88F6183AP_GE	RD88F6183AP_GE		1894
 realview_pba8		MACH_REALVIEW_PBA8	REALVIEW_PBA8		1897
 realview_pbx		MACH_REALVIEW_PBX	REALVIEW_PBX		1901

Re: [PATCH v2 3/6] ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept parameters

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-11-29 20:54:43

Hi!

On 21/11/17 15:32, Lukasz Majewski wrote:
This commit extend the ts72xx_register_flash() to accept passed parameters,
which makes it more reusable.

Now it is possible to accept ep93xx flash start address and partitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
quoted hunk
---
Changes for v2:
- New patch
---
 arch/arm/mach-ep93xx/ts72xx.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 06345b85f27c..00e0e5b8babf 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -120,8 +120,6 @@ static struct platform_nand_data ts72xx_nand_data = {
 		.nr_chips	= 1,
 		.chip_offset	= 0,
 		.chip_delay	= 15,
-		.partitions	= ts72xx_nand_parts,
-		.nr_partitions	= ARRAY_SIZE(ts72xx_nand_parts),
 	},
 	.ctrl = {
 		.cmd_ctrl	= ts72xx_nand_hwcontrol,
@@ -145,8 +143,8 @@ static struct platform_device ts72xx_nand_flash = {
 	.num_resources		= ARRAY_SIZE(ts72xx_nand_resource),
 };
 
-
-static void __init ts72xx_register_flash(void)
+void __init ts72xx_register_flash(struct mtd_partition *parts, int n,
+				  resource_size_t start)
 {
 	/*
 	 * TS7200 has NOR flash all other TS72xx board have NAND flash.
@@ -154,16 +152,12 @@ static void __init ts72xx_register_flash(void)
 	if (board_is_ts7200()) {
 		ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
 	} else {
-		resource_size_t start;
-
-		if (is_ts9420_installed())
-			start = EP93XX_CS7_PHYS_BASE;
-		else
-			start = EP93XX_CS6_PHYS_BASE;
-
 		ts72xx_nand_resource[0].start = start;
 		ts72xx_nand_resource[0].end = start + SZ_16M - 1;
 
+		ts72xx_nand_data.chip.partitions = parts;
+		ts72xx_nand_data.chip.nr_partitions = n;
+
 		platform_device_register(&ts72xx_nand_flash);
 	}
 }
@@ -223,7 +217,9 @@ static struct platform_device ts73xx_fpga_device = {
 static void __init ts72xx_init_machine(void)
 {
 	ep93xx_init_devices();
-	ts72xx_register_flash();
+	ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts),
+			      is_ts9420_installed() ?
+			      EP93XX_CS7_PHYS_BASE : EP93XX_CS6_PHYS_BASE);
 	platform_device_register(&ts72xx_rtc_device);
 	platform_device_register(&ts72xx_wdt_device);
 

Re: [PATCH v2 6/6] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-29 22:07:19

Hi Alexander,
Hello Lukasz,

some nitpicking below...

On 21/11/17 15:32, Lukasz Majewski wrote:
quoted
The BK3 board is a derivative of the ts72xx reference design.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Place bk3 support code to the ts72xx.c file
---
 arch/arm/mach-ep93xx/Kconfig  |  7 +++++
 arch/arm/mach-ep93xx/ts72xx.c | 64
+++++++++++++++++++++++++++++++++++++++++++
arch/arm/mach-ep93xx/ts72xx.h |  5 ++++
arch/arm/tools/mach-types     |  1 + 4 files changed, 77
insertions(+)
diff --git a/arch/arm/mach-ep93xx/Kconfig
b/arch/arm/mach-ep93xx/Kconfig index 61a75ca3684e..c095236d7ff8
100644 --- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
 	  Say 'Y' here if you want your kernel to support the ADS
 	  Sphere board.
 
+config MACH_BK3
+	bool "Support Liebherr BK3.1"
+	select MACH_TS72XX
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Liebherr controller BK3.1.
+
 config MACH_EDB93XX
 	bool
 
diff --git a/arch/arm/mach-ep93xx/ts72xx.c
b/arch/arm/mach-ep93xx/ts72xx.c index 2e8fcc6e87b6..0de19b136ad0
100644 --- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -18,8 +18,10 @@
 #include <linux/io.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/amba/bus.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -261,3 +263,65 @@ MACHINE_START(TS72XX, "Technologic Systems
TS-72xx SBC") .init_late	= ep93xx_init_late,
 	.restart	= ep93xx_restart,
 MACHINE_END
+
+/*************************************************************************
+ * BK3 support code
+
*************************************************************************/
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,  
I see the above and below lines as unaligned
This is strange.... I'm using emacs with extension to have coding style
for kernel.

Probably tabs get unaligned...
quoted
+		.size		= 0x01e00000,
+	}, {
+		.name		= "Data",
+		.offset	= 0x01e00000,  
same here
quoted
+		.size		= 0x05f20000
+	}, {
+		.name		= "RedBoot",
+		.offset	= 0x07d20000,  
same here
quoted
+		.size		= 0x002e0000,
+		.mask_flags	= MTD_WRITEABLE,	/*
force RO */
+	},
+};
+
+static AMBA_APB_DEVICE(i2s1, "apb:i2s", 1, EP93XX_I2S_PHYS_BASE,
+		       { IRQ_EP93XX_SAI }, NULL);
+
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		=
__phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,  
same here
quoted
+		.type		= MT_DEVICE,
+	}
+};
+
+static void __init bk3_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(bk3_io_desc, ARRAY_SIZE(bk3_io_desc));
+}
+
+static void __init bk3_init_machine(void)
+{
+	ep93xx_init_devices();
+
+	ts72xx_register_flash(bk3_nand_parts,
ARRAY_SIZE(bk3_nand_parts),
+			      EP93XX_CS6_PHYS_BASE);
+
+	platform_device_register(&ts72xx_wdt_device);
+	ep93xx_register_eth(&ts72xx_eth_data, 1);
+
+	amba_device_register(&i2s1_device, &iomem_resource);
+}
+
+MACHINE_START(BK3, "Liebherr controller BK3.1")
+	/* Maintainer: Lukasz Majewski [off-list ref] */  
Don't you want to add an entry to the MAINTAINERS file instead?
Then get_maintainer.pl would be able to suggest your email.
Yes. This would be a good idea (I've followed the "style" of other
boards in the mach-ep93xx directory).

I will fix that ....... and send v3 with included some extra code - as
I've found and fixed several issues since last posting.

Anyway, many thanks for review. 
quoted
+	.atag_offset	= 0x100,
+	.map_io	= bk3_map_io,  
again, inconsistent alignment...
Even more..... checkpatch.pl did not complained....
quoted
+	.init_irq	= ep93xx_init_irq,
+	.init_time	= ep93xx_timer_init,
+	.init_machine	= bk3_init_machine,
+	.init_late	= ep93xx_init_late,
+	.restart	= ep93xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-ep93xx/ts72xx.h
b/arch/arm/mach-ep93xx/ts72xx.h index d9ff04db3221..d3165bb9ee78
100644 --- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -45,6 +45,11 @@
 #define TS72XX_WDT_CONTROL_PHYS_BASE	0x23800000
 #define TS72XX_WDT_FEED_PHYS_BASE	0x23c00000
 
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+
 #ifndef __ASSEMBLY__
 
 static inline int ts72xx_model(void)
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index a9313b66f770..4eac94c1eb6f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -345,6 +345,7 @@ mxlads
MACH_MXLADS		MXLADS			1851
linkstation_mini	MACH_LINKSTATION_MINI
LINKSTATION_MINI	1858 afeb9260
MACH_AFEB9260		AFEB9260		1859
imx27ipcam		MACH_IMX27IPCAM
IMX27IPCAM		1871 +bk3
MACH_BK3		BK3			1880
rd88f6183ap_ge		MACH_RD88F6183AP_GE
RD88F6183AP_GE		1894 realview_pba8
MACH_REALVIEW_PBA8	REALVIEW_PBA8		1897
realview_pbx		MACH_REALVIEW_PBX
REALVIEW_PBX		1901  


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171129/1e13ddbe/attachment.sig>

Re: [PATCH v2 6/6] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 00:26:33

On Wed, 29 Nov 2017 23:07:04 +0100
Lukasz Majewski [off-list ref] wrote:
Hi Alexander,
quoted
Hello Lukasz,

some nitpicking below...

On 21/11/17 15:32, Lukasz Majewski wrote:  
quoted
The BK3 board is a derivative of the ts72xx reference design.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Place bk3 support code to the ts72xx.c file
---
 arch/arm/mach-ep93xx/Kconfig  |  7 +++++
 arch/arm/mach-ep93xx/ts72xx.c | 64
+++++++++++++++++++++++++++++++++++++++++++
arch/arm/mach-ep93xx/ts72xx.h |  5 ++++
arch/arm/tools/mach-types     |  1 + 4 files changed, 77
insertions(+)
diff --git a/arch/arm/mach-ep93xx/Kconfig
b/arch/arm/mach-ep93xx/Kconfig index 61a75ca3684e..c095236d7ff8
100644 --- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
 	  Say 'Y' here if you want your kernel to support the ADS
 	  Sphere board.
 
+config MACH_BK3
+	bool "Support Liebherr BK3.1"
+	select MACH_TS72XX
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Liebherr controller BK3.1.
+
 config MACH_EDB93XX
 	bool
 
diff --git a/arch/arm/mach-ep93xx/ts72xx.c
b/arch/arm/mach-ep93xx/ts72xx.c index 2e8fcc6e87b6..0de19b136ad0
100644 --- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -18,8 +18,10 @@
 #include <linux/io.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/amba/bus.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -261,3 +263,65 @@ MACHINE_START(TS72XX, "Technologic Systems
TS-72xx SBC") .init_late	= ep93xx_init_late,
 	.restart	= ep93xx_restart,
 MACHINE_END
+
+/*************************************************************************
+ * BK3 support code
+
*************************************************************************/
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,    
I see the above and below lines as unaligned  
This is strange.... I'm using emacs with extension to have coding
style for kernel.

Probably tabs get unaligned...
quoted
  
quoted
+		.size		= 0x01e00000,
+	}, {
+		.name		= "Data",
+		.offset	= 0x01e00000,    
same here
  
quoted
+		.size		= 0x05f20000
+	}, {
+		.name		= "RedBoot",
+		.offset	= 0x07d20000,    
same here
  
quoted
+		.size		= 0x002e0000,
+		.mask_flags	= MTD_WRITEABLE,	/*
force RO */
+	},
+};
+
+static AMBA_APB_DEVICE(i2s1, "apb:i2s", 1, EP93XX_I2S_PHYS_BASE,
+		       { IRQ_EP93XX_SAI }, NULL);
+
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		=
__phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,    
same here
  
quoted
+		.type		= MT_DEVICE,
+	}
+};
+
+static void __init bk3_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(bk3_io_desc, ARRAY_SIZE(bk3_io_desc));
+}
+
+static void __init bk3_init_machine(void)
+{
+	ep93xx_init_devices();
+
+	ts72xx_register_flash(bk3_nand_parts,
ARRAY_SIZE(bk3_nand_parts),
+			      EP93XX_CS6_PHYS_BASE);
+
+	platform_device_register(&ts72xx_wdt_device);
+	ep93xx_register_eth(&ts72xx_eth_data, 1);
+
+	amba_device_register(&i2s1_device, &iomem_resource);
+}
+
+MACHINE_START(BK3, "Liebherr controller BK3.1")
+	/* Maintainer: Lukasz Majewski [off-list ref] */    
Don't you want to add an entry to the MAINTAINERS file instead?
Then get_maintainer.pl would be able to suggest your email.  
Yes. This would be a good idea (I've followed the "style" of other
boards in the mach-ep93xx directory).

I will fix that ....... and send v3 with included some extra code - as
I've found and fixed several issues since last posting.

Anyway, many thanks for review. 
quoted
  
quoted
+	.atag_offset	= 0x100,
+	.map_io	= bk3_map_io,    
again, inconsistent alignment...  
Even more..... checkpatch.pl did not complained....
I've double checked - this misalignment seems to be only in e-mail.

In the ts72xx.c file it is all "tabifi'ed".

(and no checkpatch errors).
quoted
  
quoted
+	.init_irq	= ep93xx_init_irq,
+	.init_time	= ep93xx_timer_init,
+	.init_machine	= bk3_init_machine,
+	.init_late	= ep93xx_init_late,
+	.restart	= ep93xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-ep93xx/ts72xx.h
b/arch/arm/mach-ep93xx/ts72xx.h index d9ff04db3221..d3165bb9ee78
100644 --- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -45,6 +45,11 @@
 #define TS72XX_WDT_CONTROL_PHYS_BASE	0x23800000
 #define TS72XX_WDT_FEED_PHYS_BASE	0x23c00000
 
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+
 #ifndef __ASSEMBLY__
 
 static inline int ts72xx_model(void)
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index a9313b66f770..4eac94c1eb6f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -345,6 +345,7 @@ mxlads
MACH_MXLADS		MXLADS			1851
linkstation_mini	MACH_LINKSTATION_MINI
LINKSTATION_MINI	1858 afeb9260
MACH_AFEB9260		AFEB9260		1859
imx27ipcam		MACH_IMX27IPCAM
IMX27IPCAM		1871 +bk3
MACH_BK3		BK3			1880
rd88f6183ap_ge		MACH_RD88F6183AP_GE
RD88F6183AP_GE		1894 realview_pba8
MACH_REALVIEW_PBA8	REALVIEW_PBA8		1897
realview_pbx		MACH_REALVIEW_PBX
REALVIEW_PBX		1901    


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171130/1b620095/attachment.sig>

[PATCH v3 0/6] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 00:45:33

This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c (detalied list of changes can be found in patch 6/6)

This series applies on top of v4.14

Lukasz Majewski (6):
  ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept
    parameters
  ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable
  ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 ++
 arch/arm/mach-ep93xx/ts72xx.c | 222 +++++++++++++++++++++++++++++++++++-------
 arch/arm/mach-ep93xx/ts72xx.h |   9 ++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 211 insertions(+), 34 deletions(-)

-- 
2.11.0

[PATCH v3 1/6] ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 00:45:35

This commit cleans up the code by using dedicated macros instead of
full definitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- None
Changes for v3:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 8745162ec05d..06345b85f27c 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -187,16 +187,8 @@ static struct platform_device ts72xx_rtc_device = {
 };
 
 static struct resource ts72xx_wdt_resources[] = {
-	{
-		.start	= TS72XX_WDT_CONTROL_PHYS_BASE,
-		.end	= TS72XX_WDT_CONTROL_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= TS72XX_WDT_FEED_PHYS_BASE,
-		.end	= TS72XX_WDT_FEED_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
+	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
 };
 
 static struct platform_device ts72xx_wdt_device = {
@@ -216,11 +208,7 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 #define TS73XX_FPGA_LOADER_BASE		0x03c00000
 
 static struct resource ts73xx_fpga_resources[] = {
-	{
-		.start	= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE,
-		.end	= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE, 0x01),
 };
 
 static struct platform_device ts73xx_fpga_device = {
-- 
2.11.0

[PATCH v3 4/6] ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 00:45:38

The map IO common code has been excluded to be reused by other ts72xx
clones.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- New patch
Changes for v3:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 00e0e5b8babf..a6e473b3dcf6 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -30,11 +30,6 @@
 
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
-		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
-		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
-		.length		= TS72XX_MODEL_SIZE,
-		.type		= MT_DEVICE,
-	}, {
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
 		.pfn		= __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE),
 		.length		= TS72XX_OPTIONS_SIZE,
@@ -47,12 +42,26 @@ static struct map_desc ts72xx_io_desc[] __initdata = {
 	}
 };
 
-static void __init ts72xx_map_io(void)
+static struct map_desc ts72xx_common_io_desc[] __initdata = {
+	{
+		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
+		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
+		.length		= TS72XX_MODEL_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+void __init ts72xx_common_map_io(void)
 {
 	ep93xx_map_io();
-	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+	iotable_init(ts72xx_common_io_desc, ARRAY_SIZE(ts72xx_common_io_desc));
 }
 
+static void __init ts72xx_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+}
 
 /*************************************************************************
  * NAND flash
-- 
2.11.0

[PATCH v3 6/6] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 00:45:43

The BK3 board is a derivative of the ts72xx reference design.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Place bk3 support code to the ts72xx.c file

Changes for v3:
- Add SD card support (via SPI) for BK3
- Remove definition of apb:i2s bus
- Remove board registration of CPLD WDT device
- Add I2S platform device to BK3
- Add MAINTAINERS entry for BK3 maintainer
---
 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 ++
 arch/arm/mach-ep93xx/ts72xx.c | 149 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx.h |   5 ++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 168 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 2811a211632c..470856b74832 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1255,6 +1255,12 @@ L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
 S:	Supported
 F:	drivers/net/ethernet/cavium/thunder/
 
+ARM/CIRRUS LOGIC BK3 MACHINE SUPPORT
+M:	Lukasz Majewski <lukma@denx.de>
+L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
+S:	Maintained
+F:	arch/arm/mach-ep93xx/ts72xx.c
+
 ARM/CIRRUS LOGIC CLPS711X ARM ARCHITECTURE
 M:	Alexander Shiyan <shc_work@mail.ru>
 L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 61a75ca3684e..c095236d7ff8 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
 	  Say 'Y' here if you want your kernel to support the ADS
 	  Sphere board.
 
+config MACH_BK3
+	bool "Support Liebherr BK3.1"
+	select MACH_TS72XX
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Liebherr controller BK3.1.
+
 config MACH_EDB93XX
 	bool
 
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 2e8fcc6e87b6..54704858a072 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -18,8 +18,16 @@
 #include <linux/io.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/amba/bus.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/mmc_spi.h>
+#include <linux/mmc/host.h>
+#include <linux/platform_data/spi-ep93xx.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -215,6 +223,69 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 };
 
 /*************************************************************************
+ * SPI SD/MMC host
+ *************************************************************************/
+#define BK3_EN_SDCARD_PHYS_BASE         0x12400000
+#define BK3_EN_SDCARD_PWR 0x0
+#define BK3_DIS_SDCARD_PWR 0x0C
+static void bk3_mmc_spi_setpower(struct device *dev, unsigned int vdd)
+{
+	void __iomem *pwr_sd = ioremap(BK3_EN_SDCARD_PHYS_BASE, SZ_4K);
+
+	if (!pwr_sd) {
+		pr_err("Failed to enable SD card power!");
+		return;
+	}
+
+	pr_debug("%s: SD card pwr %s VDD:0x%x\n", __func__,
+		 !!vdd ? "ON" : "OFF", vdd);
+
+	if (!!vdd)
+		__raw_writeb(BK3_EN_SDCARD_PWR, pwr_sd);
+	else
+		__raw_writeb(BK3_DIS_SDCARD_PWR, pwr_sd);
+
+	iounmap(pwr_sd);
+}
+
+static struct mmc_spi_platform_data bk3_spi_mmc_data = {
+	.detect_delay	= 500,
+	.powerup_msecs	= 100,
+	.ocr_mask	= MMC_VDD_32_33 | MMC_VDD_33_34,
+	.caps		= MMC_CAP_NONREMOVABLE,
+	.setpower       = bk3_mmc_spi_setpower,
+};
+
+/*************************************************************************
+ * SPI Bus - SD card access
+ *************************************************************************/
+static struct spi_board_info bk3_spi_board_info[] __initdata = {
+	{
+		.modalias		= "mmc_spi",
+		.platform_data		= &bk3_spi_mmc_data,
+		.max_speed_hz		= 7.4E6,
+		.bus_num		= 0,
+		.chip_select		= 0,
+		.mode			= SPI_MODE_0,
+	},
+};
+
+/*
+ * This is a stub -> the FGPIO[3] pin is not connected on the schematic
+ * The all work is performed automatically by !SPI_FRAME (SFRM1) and
+ * goes through CPLD
+ */
+static int bk3_spi_chipselects[] __initdata = {
+	EP93XX_GPIO_LINE_F(3),
+};
+
+static struct ep93xx_spi_info bk3_spi_master __initdata = {
+	.chipselect	= bk3_spi_chipselects,
+	.num_chipselect = ARRAY_SIZE(bk3_spi_chipselects),
+	.use_dma	= 1,
+};
+
+/*************************************************************************
  * TS72XX support code
  *************************************************************************/
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
@@ -261,3 +332,81 @@ MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
 	.init_late	= ep93xx_init_late,
 	.restart	= ep93xx_restart,
 MACHINE_END
+
+/*************************************************************************
+ * EP93xx I2S audio peripheral handling
+ *************************************************************************/
+static struct resource ep93xx_i2s_resource[] = {
+	DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100),
+	DEFINE_RES_IRQ_NAMED(IRQ_EP93XX_SAI, "spilink i2s slave"),
+};
+
+static struct platform_device ep93xx_i2s_device = {
+	.name		= "ep93xx-spilink-i2s",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(ep93xx_i2s_resource),
+	.resource	= ep93xx_i2s_resource,
+};
+
+/*************************************************************************
+ * BK3 support code
+ *************************************************************************/
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,
+		.size		= 0x01e00000,
+	}, {
+		.name		= "Data",
+		.offset	= 0x01e00000,
+		.size		= 0x05f20000
+	}, {
+		.name		= "RedBoot",
+		.offset	= 0x07d20000,
+		.size		= 0x002e0000,
+		.mask_flags	= MTD_WRITEABLE,	/* force RO */
+	},
+};
+
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		= __phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+static void __init bk3_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(bk3_io_desc, ARRAY_SIZE(bk3_io_desc));
+}
+
+static void __init bk3_init_machine(void)
+{
+	ep93xx_init_devices();
+
+	ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts),
+			      EP93XX_CS6_PHYS_BASE);
+
+	ep93xx_register_eth(&ts72xx_eth_data, 1);
+
+	ep93xx_register_spi(&bk3_spi_master, bk3_spi_board_info,
+				ARRAY_SIZE(bk3_spi_board_info));
+
+	/* Configure ep93xx's I2S to use AC97 pins */
+	ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97);
+	platform_device_register(&ep93xx_i2s_device);
+}
+
+MACHINE_START(BK3, "Liebherr controller BK3.1")
+	/* Maintainer: Lukasz Majewski <lukma@denx.de> */
+	.atag_offset	= 0x100,
+	.map_io	= bk3_map_io,
+	.init_irq	= ep93xx_init_irq,
+	.init_time	= ep93xx_timer_init,
+	.init_machine	= bk3_init_machine,
+	.init_late	= ep93xx_init_late,
+	.restart	= ep93xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index d9ff04db3221..d3165bb9ee78 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -45,6 +45,11 @@
 #define TS72XX_WDT_CONTROL_PHYS_BASE	0x23800000
 #define TS72XX_WDT_FEED_PHYS_BASE	0x23c00000
 
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+
 #ifndef __ASSEMBLY__
 
 static inline int ts72xx_model(void)
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index a9313b66f770..4eac94c1eb6f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -345,6 +345,7 @@ mxlads			MACH_MXLADS		MXLADS			1851
 linkstation_mini	MACH_LINKSTATION_MINI	LINKSTATION_MINI	1858
 afeb9260		MACH_AFEB9260		AFEB9260		1859
 imx27ipcam		MACH_IMX27IPCAM		IMX27IPCAM		1871
+bk3			MACH_BK3		BK3			1880
 rd88f6183ap_ge		MACH_RD88F6183AP_GE	RD88F6183AP_GE		1894
 realview_pba8		MACH_REALVIEW_PBA8	REALVIEW_PBA8		1897
 realview_pbx		MACH_REALVIEW_PBX	REALVIEW_PBX		1901
-- 
2.11.0

[PATCH v3 5/6] ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 00:46:12

This patch extends readability of ts72xx.c code.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- New patch
---
 arch/arm/mach-ep93xx/ts72xx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index a6e473b3dcf6..2e8fcc6e87b6 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -28,6 +28,9 @@
 #include "soc.h"
 #include "ts72xx.h"
 
+/*************************************************************************
+ * IO map
+ *************************************************************************/
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
@@ -189,6 +192,9 @@ static struct platform_device ts72xx_rtc_device = {
 	.num_resources 	= ARRAY_SIZE(ts72xx_rtc_resources),
 };
 
+/*************************************************************************
+ * WATCHDOG
+ *************************************************************************/
 static struct resource ts72xx_wdt_resources[] = {
 	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
 	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
@@ -201,10 +207,16 @@ static struct platform_device ts72xx_wdt_device = {
 	.resource	= ts72xx_wdt_resources,
 };
 
+/*************************************************************************
+ * ETH
+ *************************************************************************/
 static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 	.phy_id		= 1,
 };
 
+/*************************************************************************
+ * TS72XX support code
+ *************************************************************************/
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
 
 /* Relative to EP93XX_CS1_PHYS_BASE */
-- 
2.11.0

[PATCH v3 3/6] ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept parameters

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 00:46:31

This commit extend the ts72xx_register_flash() to accept passed parameters,
which makes it more reusable.

Now it is possible to accept ep93xx flash start address and partitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- New patch
Changes for v3:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 06345b85f27c..00e0e5b8babf 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -120,8 +120,6 @@ static struct platform_nand_data ts72xx_nand_data = {
 		.nr_chips	= 1,
 		.chip_offset	= 0,
 		.chip_delay	= 15,
-		.partitions	= ts72xx_nand_parts,
-		.nr_partitions	= ARRAY_SIZE(ts72xx_nand_parts),
 	},
 	.ctrl = {
 		.cmd_ctrl	= ts72xx_nand_hwcontrol,
@@ -145,8 +143,8 @@ static struct platform_device ts72xx_nand_flash = {
 	.num_resources		= ARRAY_SIZE(ts72xx_nand_resource),
 };
 
-
-static void __init ts72xx_register_flash(void)
+void __init ts72xx_register_flash(struct mtd_partition *parts, int n,
+				  resource_size_t start)
 {
 	/*
 	 * TS7200 has NOR flash all other TS72xx board have NAND flash.
@@ -154,16 +152,12 @@ static void __init ts72xx_register_flash(void)
 	if (board_is_ts7200()) {
 		ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
 	} else {
-		resource_size_t start;
-
-		if (is_ts9420_installed())
-			start = EP93XX_CS7_PHYS_BASE;
-		else
-			start = EP93XX_CS6_PHYS_BASE;
-
 		ts72xx_nand_resource[0].start = start;
 		ts72xx_nand_resource[0].end = start + SZ_16M - 1;
 
+		ts72xx_nand_data.chip.partitions = parts;
+		ts72xx_nand_data.chip.nr_partitions = n;
+
 		platform_device_register(&ts72xx_nand_flash);
 	}
 }
@@ -223,7 +217,9 @@ static struct platform_device ts73xx_fpga_device = {
 static void __init ts72xx_init_machine(void)
 {
 	ep93xx_init_devices();
-	ts72xx_register_flash();
+	ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts),
+			      is_ts9420_installed() ?
+			      EP93XX_CS7_PHYS_BASE : EP93XX_CS6_PHYS_BASE);
 	platform_device_register(&ts72xx_rtc_device);
 	platform_device_register(&ts72xx_wdt_device);
 
-- 
2.11.0

[PATCH v3 2/6] ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 00:46:46

This commit adds include file guards to ts72xx.h

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- None
Changes for v3:
- None
---
 arch/arm/mach-ep93xx/ts72xx.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index b89850f1a965..d9ff04db3221 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -12,6 +12,9 @@
  * febfd000	22800000	4K	options register #2
  */
 
+#ifndef __TS72XX_H_
+#define __TS72XX_H_
+
 #define TS72XX_MODEL_PHYS_BASE		0x22000000
 #define TS72XX_MODEL_VIRT_BASE		IOMEM(0xfebff000)
 #define TS72XX_MODEL_SIZE		0x00001000
@@ -86,3 +89,4 @@ static inline int is_ts9420_installed(void)
 					TS72XX_OPTIONS2_TS9420);
 }
 #endif
+#endif /* __TS72XX_H_ */
-- 
2.11.0

Re: [PATCH v2 6/6] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-11-30 07:08:01

Hello Lukasz,

On Wed, 29 Nov 2017 23:07:04 +0100
Lukasz Majewski [off-list ref] wrote:
quoted
quoted
+/*************************************************************************
+ * BK3 support code
+
*************************************************************************/
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,  
I see the above and below lines as unaligned
This is strange.... I'm using emacs with extension to have coding style
for kernel.

Probably tabs get unaligned...
Yes, seems that they are.

[...]
quoted
quoted
+	.atag_offset	= 0x100,
+	.map_io	= bk3_map_io,  
again, inconsistent alignment...
Even more..... checkpatch.pl did not complained....
checkpatch.pl wouldn't complain, as there are basically two styles,
some people do not align the individual assignments in the structures at all.
But I was quite confident in the beginning and now even applied your v3 to
the code. And indeed it's unaligned... I even checked with emacs. Still
unaligned.

-- 
Alexander Sverdlin.

Re: [PATCH v3 0/6] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-11-30 09:02:30

On Thu, Nov 30, 2017 at 1:45 AM, Lukasz Majewski [off-list ref] wrote:
This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c (detalied list of changes can be found in patch 6/6)

This series applies on top of v4.14
Can we clarify who is picking up ep93xx patches these days? The
last time I think Linus Walleij offered to do it for the 4.14 merge window,
as neither Hartley nor Alexander had a git tree.

I don't care too much who does it in the end, between Hartley, Alexander,
Linus and even Lukasz directly, but I'd like whoever feels responsible
for the platform to be listed in the MAINTAINERS file and pick up
the patches from everyone else to forward them to me as either
pull requests or separate patches to arm at kernel.org when the
patches are ready, so I don't have to make a decision about when to
pick them up from the list.

        Arnd

[PATCH v3 0/6] ARM: ep93xx: ts72xx: Add support for BK3 board

From: alexander.sverdlin@gmail.com (Alexander Sverdlin)
Date: 2017-11-30 09:57:20

Hello Arnd!

On Thu Nov 30 10:02:26 2017 Arnd Bergmann [off-list ref] wrote:
Can we clarify who is picking up ep93xx patches these days? The
last time I think Linus Walleij offered to do it for the 4.14 merge
window, as neither Hartley nor Alexander had a git tree.

I don't care too much who does it in the end, between Hartley, Alexander,
Linus and even Lukasz directly, but I'd like whoever feels responsible
for the platform to be listed in the MAINTAINERS file and pick up
the patches from everyone else to forward them to me as either
pull requests or separate patches to arm at kernel.org when the
patches are ready, so I don't have to make a decision about when to
pick them up from the list.
As I stepped in as a maintainer there was a common understanding, that ep93xx is so inactive these days, that is doesn't deserve a separate tree. But I feel also that we will benefit from one, so let me create one this evening and I'll send you pull request when we agree with Lukasz. Just let me know if you'd be fine with github or should I care about kernel.org?

--
Regards,
Alexander.

Re: [PATCH v3 0/6] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-11-30 10:44:42

On Thu, Nov 30, 2017 at 10:57 AM, Alexander Sverdlin
[off-list ref] wrote:
Hello Arnd!

On Thu Nov 30 10:02:26 2017 Arnd Bergmann [off-list ref] wrote:
quoted
Can we clarify who is picking up ep93xx patches these days? The
last time I think Linus Walleij offered to do it for the 4.14 merge
window, as neither Hartley nor Alexander had a git tree.

I don't care too much who does it in the end, between Hartley, Alexander,
Linus and even Lukasz directly, but I'd like whoever feels responsible
for the platform to be listed in the MAINTAINERS file and pick up
the patches from everyone else to forward them to me as either
pull requests or separate patches to arm at kernel.org when the
patches are ready, so I don't have to make a decision about when to
pick them up from the list.
As I stepped in as a maintainer there was a common understanding, that
ep93xx is so inactive these days, that is doesn't deserve a separate tree.
But I feel also that we will benefit from one, so let me create one this
evening and I'll send you pull request when we agree with Lukasz.
Just let me know if you'd be fine with github or should I care about
kernel.org?
Up to you. Normally I try to avoid github for more active trees, but
if you don't already have kernel.org account, it's probably not worth
the effort of getting one just for the few ep93xx patches. As I said,
we're probably also fine with picking up the patches individually,
as long as the process is clear to everyone, i.e. you pick up the
patches from any other contributors and notify them about the
status of their patches, and then you send them to arm at kernel.org
in whatever way makes most sense for you.

       Arnd

RE: [PATCH v3 1/6] ARM: ep93xx: ts72xx: Use DEFINE_RES_MEM macros where applicable

From: Hartley Sweeten <hidden>
Date: 2017-11-30 16:59:19

On Wednesday, November 29, 2017 5:45 PM, Lukasz Majewski wrote:
This commit cleans up the code by using dedicated macros instead of full definitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
<snip>
quoted hunk
@@ -187,16 +187,8 @@ static struct platform_device ts72xx_rtc_device = {  };
 >
 static struct resource ts72xx_wdt_resources[] = {
-	{
-		.start	= TS72XX_WDT_CONTROL_PHYS_BASE,
-		.end	= TS72XX_WDT_CONTROL_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= TS72XX_WDT_FEED_PHYS_BASE,
-		.end	= TS72XX_WDT_FEED_PHYS_BASE + SZ_4K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, SZ_4K),
+	DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, SZ_4K),
 };
 
Lukasz,

The chunk above is already cleaned up in linux-next by:

commit 97c3bca922468996c864917c9a8ea6a410233985
ARM: ep93xx: tidy up TS-72xx Watchdog resources

Can you please rebase this series against linux-next?

I'm reviewing the rest of the series now and will reply with any other issues.

Thanks,
Hartley

RE: [PATCH v3 3/6] ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept parameters

From: Hartley Sweeten <hidden>
Date: 2017-11-30 17:08:03

On Wednesday, November 29, 2017 5:45 PM, Lukasz Majewski wrote:
This commit extend the ts72xx_register_flash() to accept passed parameters, which makes it more reusable.

Now it is possible to accept ep93xx flash start address and partitions.
<snip>
@@ -223,7 +217,9 @@ static struct platform_device ts73xx_fpga_device = {  static void __init ts72xx_init_machine(void)  {
Lukasz,

The line above is corrupted in the patch and will not apply. Not sure what happened...
 	ep93xx_init_devices();
-	ts72xx_register_flash();
+	ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts),
+			      is_ts9420_installed() ?
+			      EP93XX_CS7_PHYS_BASE : EP93XX_CS6_PHYS_BASE);
 	platform_device_register(&ts72xx_rtc_device);
 	platform_device_register(&ts72xx_wdt_device);
Regards,
Hartley

RE: [PATCH v3 4/6] ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable

From: Hartley Sweeten <hidden>
Date: 2017-11-30 17:11:09

On Wednesday, November 29, 2017 5:45 PM, Lukasz Majewski wrote:
The map IO common code has been excluded to be reused by other ts72xx clones.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
<snip>
quoted hunk
arch/arm/mach-ep93xx/ts72xx.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c index 00e0e5b8babf..a6e473b3dcf6 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -30,11 +30,6 @@
 
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
-		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
-		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
-		.length		= TS72XX_MODEL_SIZE,
-		.type		= MT_DEVICE,
-	}, {
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
 		.pfn		= __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE),
 		.length		= TS72XX_OPTIONS_SIZE,
@@ -47,12 +42,26 @@ static struct map_desc ts72xx_io_desc[] __initdata = {
 	}
 };
 
-static void __init ts72xx_map_io(void)
+static struct map_desc ts72xx_common_io_desc[] __initdata = {
+	{
+		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
+		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
+		.length		= TS72XX_MODEL_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+void __init ts72xx_common_map_io(void)
 {
 	ep93xx_map_io();
-	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+	iotable_init(ts72xx_common_io_desc, 
There is a trailing whitespace on the line above.
+ARRAY_SIZE(ts72xx_common_io_desc));
This line is missing an indent.
 }
 >
+static void __init ts72xx_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc)); }
 
 /*************************************************************************
  * NAND flash
Hartley

RE: [PATCH v3 5/6] ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code

From: Hartley Sweeten <hidden>
Date: 2017-11-30 17:23:05

On Wednesday, November 29, 2017 5:45 PM, Lukasz Majewski wrote:
This patch extends readability of ts72xx.c code.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- New patch
---
 arch/arm/mach-ep93xx/ts72xx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
This patch does not apply to linux-next.
quoted hunk
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c index a6e473b3dcf6..2e8fcc6e87b6 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -28,6 +28,9 @@
 #include "soc.h"
 #include "ts72xx.h"
 
+/**********************************************************************
+***
+ * IO map
+ 
+***********************************************************************
+**/
There is also something funny with the patch. The lines above appear to be getting split incorrectly.

The same thing is seen in PATCH 6/6.

Please rebase the series against linux-next and I'll take another look at is.

Thanks,
Hartley

Re: [PATCH v3 5/6] ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-11-30 20:01:41

Hello Hartley!

On Thu, 30 Nov 2017 17:23:02 +0000
Hartley Sweeten [off-list ref] wrote:
quoted
+/**********************************************************************
+***
+ * IO map
+ 
+***********************************************************************
+**/
There is also something funny with the patch. The lines above appear to be getting split incorrectly.
That's definitely not the case, I can apply the patch to 4.14 just fine and
there is no funny wrapping. But you are right about the rest, it should be
re-based.

-- 
Alexander Sverdlin.

[PATCH v4 0/5] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 23:52:01

This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c (detalied list of changes can be found in patch 6/6)

This series applies on top of linux-next/master (next-20171130)

Lukasz Majewski (5):
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept
    parameters
  ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable
  ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 ++
 arch/arm/mach-ep93xx/ts72xx.c | 198 ++++++++++++++++++++++++++++++++++++++----
 arch/arm/mach-ep93xx/ts72xx.h |   9 ++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 202 insertions(+), 19 deletions(-)

-- 
2.11.0

[PATCH v4 3/5] ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 23:52:04

The map IO common code has been excluded to be reused by other ts72xx
clones.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- New patch
Changes for v3:
- None
Changes for v4:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 141ae4c65a81..19b23c9a2efa 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -33,11 +33,6 @@
 
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
-		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
-		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
-		.length		= TS72XX_MODEL_SIZE,
-		.type		= MT_DEVICE,
-	}, {
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
 		.pfn		= __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE),
 		.length		= TS72XX_OPTIONS_SIZE,
@@ -50,12 +45,26 @@ static struct map_desc ts72xx_io_desc[] __initdata = {
 	}
 };
 
-static void __init ts72xx_map_io(void)
+static struct map_desc ts72xx_common_io_desc[] __initdata = {
+	{
+		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
+		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),
+		.length		= TS72XX_MODEL_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+void __init ts72xx_common_map_io(void)
 {
 	ep93xx_map_io();
-	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+	iotable_init(ts72xx_common_io_desc, ARRAY_SIZE(ts72xx_common_io_desc));
 }
 
+static void __init ts72xx_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc));
+}
 
 /*************************************************************************
  * NAND flash
-- 
2.11.0

[PATCH v4 5/5] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 23:52:09

The BK3 board is a derivative of the ts72xx reference design.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Place bk3 support code to the ts72xx.c file
Changes for v3:
- Add SD card support (via SPI) for BK3
- Remove definition of apb:i2s bus
- Remove board registration of CPLD WDT device
- Add I2S platform device to BK3
- Add MAINTAINERS entry for BK3 maintainer
Changes for v4:
- Adjust the code to be applicable on top of linux-next/master
---
 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 ++
 arch/arm/mach-ep93xx/ts72xx.c | 146 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx.h |   5 ++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 165 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 4149cd992825..2fc98b40268d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1254,6 +1254,12 @@ L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
 S:	Supported
 F:	drivers/net/ethernet/cavium/thunder/
 
+ARM/CIRRUS LOGIC BK3 MACHINE SUPPORT
+M:	Lukasz Majewski <lukma@denx.de>
+L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
+S:	Maintained
+F:	arch/arm/mach-ep93xx/ts72xx.c
+
 ARM/CIRRUS LOGIC CLPS711X ARM ARCHITECTURE
 M:	Alexander Shiyan <shc_work@mail.ru>
 L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 61a75ca3684e..c095236d7ff8 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
 	  Say 'Y' here if you want your kernel to support the ADS
 	  Sphere board.
 
+config MACH_BK3
+	bool "Support Liebherr BK3.1"
+	select MACH_TS72XX
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Liebherr controller BK3.1.
+
 config MACH_EDB93XX
 	bool
 
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index cf269b5397e5..de3be5e3bee7 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -19,10 +19,15 @@
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/mmc_spi.h>
+#include <linux/mmc/host.h>
 #include <linux/platform_data/spi-ep93xx.h>
 
 #include <mach/gpio-ep93xx.h>
 #include <mach/hardware.h>
+#include <mach/irqs.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -221,6 +226,69 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 };
 
 /*************************************************************************
+ * SPI SD/MMC host
+ *************************************************************************/
+#define BK3_EN_SDCARD_PHYS_BASE         0x12400000
+#define BK3_EN_SDCARD_PWR 0x0
+#define BK3_DIS_SDCARD_PWR 0x0C
+static void bk3_mmc_spi_setpower(struct device *dev, unsigned int vdd)
+{
+	void __iomem *pwr_sd = ioremap(BK3_EN_SDCARD_PHYS_BASE, SZ_4K);
+
+	if (!pwr_sd) {
+		pr_err("Failed to enable SD card power!");
+		return;
+	}
+
+	pr_debug("%s: SD card pwr %s VDD:0x%x\n", __func__,
+		 !!vdd ? "ON" : "OFF", vdd);
+
+	if (!!vdd)
+		__raw_writeb(BK3_EN_SDCARD_PWR, pwr_sd);
+	else
+		__raw_writeb(BK3_DIS_SDCARD_PWR, pwr_sd);
+
+	iounmap(pwr_sd);
+}
+
+static struct mmc_spi_platform_data bk3_spi_mmc_data = {
+	.detect_delay	= 500,
+	.powerup_msecs	= 100,
+	.ocr_mask	= MMC_VDD_32_33 | MMC_VDD_33_34,
+	.caps		= MMC_CAP_NONREMOVABLE,
+	.setpower       = bk3_mmc_spi_setpower,
+};
+
+/*************************************************************************
+ * SPI Bus - SD card access
+ *************************************************************************/
+static struct spi_board_info bk3_spi_board_info[] __initdata = {
+	{
+		.modalias		= "mmc_spi",
+		.platform_data		= &bk3_spi_mmc_data,
+		.max_speed_hz		= 7.4E6,
+		.bus_num		= 0,
+		.chip_select		= 0,
+		.mode			= SPI_MODE_0,
+	},
+};
+
+/*
+ * This is a stub -> the FGPIO[3] pin is not connected on the schematic
+ * The all work is performed automatically by !SPI_FRAME (SFRM1) and
+ * goes through CPLD
+ */
+static int bk3_spi_chipselects[] __initdata = {
+	EP93XX_GPIO_LINE_F(3),
+};
+
+static struct ep93xx_spi_info bk3_spi_master __initdata = {
+	.chipselect	= bk3_spi_chipselects,
+	.num_chipselect = ARRAY_SIZE(bk3_spi_chipselects),
+	.use_dma	= 1,
+};
+
+/*************************************************************************
  * TS72XX support code
  *************************************************************************/
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
@@ -294,3 +362,81 @@ MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
 	.init_late	= ep93xx_init_late,
 	.restart	= ep93xx_restart,
 MACHINE_END
+
+/*************************************************************************
+ * EP93xx I2S audio peripheral handling
+ *************************************************************************/
+static struct resource ep93xx_i2s_resource[] = {
+	DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100),
+	DEFINE_RES_IRQ_NAMED(IRQ_EP93XX_SAI, "spilink i2s slave"),
+};
+
+static struct platform_device ep93xx_i2s_device = {
+	.name		= "ep93xx-spilink-i2s",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(ep93xx_i2s_resource),
+	.resource	= ep93xx_i2s_resource,
+};
+
+/*************************************************************************
+ * BK3 support code
+ *************************************************************************/
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,
+		.size		= 0x01e00000,
+	}, {
+		.name		= "Data",
+		.offset	= 0x01e00000,
+		.size		= 0x05f20000
+	}, {
+		.name		= "RedBoot",
+		.offset	= 0x07d20000,
+		.size		= 0x002e0000,
+		.mask_flags	= MTD_WRITEABLE,	/* force RO */
+	},
+};
+
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		= __phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
+static void __init bk3_map_io(void)
+{
+	ts72xx_common_map_io();
+	iotable_init(bk3_io_desc, ARRAY_SIZE(bk3_io_desc));
+}
+
+static void __init bk3_init_machine(void)
+{
+	ep93xx_init_devices();
+
+	ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts),
+			      EP93XX_CS6_PHYS_BASE);
+
+	ep93xx_register_eth(&ts72xx_eth_data, 1);
+
+	ep93xx_register_spi(&bk3_spi_master, bk3_spi_board_info,
+			    ARRAY_SIZE(bk3_spi_board_info));
+
+	/* Configure ep93xx's I2S to use AC97 pins */
+	ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97);
+	platform_device_register(&ep93xx_i2s_device);
+}
+
+MACHINE_START(BK3, "Liebherr controller BK3.1")
+	/* Maintainer: Lukasz Majewski <lukma@denx.de> */
+	.atag_offset	= 0x100,
+	.map_io	= bk3_map_io,
+	.init_irq	= ep93xx_init_irq,
+	.init_time	= ep93xx_timer_init,
+	.init_machine	= bk3_init_machine,
+	.init_late	= ep93xx_init_late,
+	.restart	= ep93xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index 7b7490f10fa9..61410faa3785 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -42,6 +42,11 @@
 #define TS72XX_OPTIONS2_TS9420		0x04
 #define TS72XX_OPTIONS2_TS9420_BOOT	0x02
 
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+
 #ifndef __ASSEMBLY__
 
 static inline int ts72xx_model(void)
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index a9313b66f770..4eac94c1eb6f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -345,6 +345,7 @@ mxlads			MACH_MXLADS		MXLADS			1851
 linkstation_mini	MACH_LINKSTATION_MINI	LINKSTATION_MINI	1858
 afeb9260		MACH_AFEB9260		AFEB9260		1859
 imx27ipcam		MACH_IMX27IPCAM		IMX27IPCAM		1871
+bk3			MACH_BK3		BK3			1880
 rd88f6183ap_ge		MACH_RD88F6183AP_GE	RD88F6183AP_GE		1894
 realview_pba8		MACH_REALVIEW_PBA8	REALVIEW_PBA8		1897
 realview_pbx		MACH_REALVIEW_PBX	REALVIEW_PBX		1901
-- 
2.11.0

[PATCH v4 4/5] ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 23:52:29

This patch extends readability of ts72xx.c code.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- New patch
Changes for v3:
- None
Changes to v4:
- Adjust the code to be applicable to linux-next/master
---
 arch/arm/mach-ep93xx/ts72xx.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 19b23c9a2efa..cf269b5397e5 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -31,6 +31,9 @@
 #include "soc.h"
 #include "ts72xx.h"
 
+/*************************************************************************
+ * IO map
+ *************************************************************************/
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
 		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,
@@ -210,10 +213,16 @@ static struct platform_device ts72xx_wdt_device = {
 	.num_resources	= ARRAY_SIZE(ts72xx_wdt_resources),
 };
 
+/*************************************************************************
+ * ETH
+ *************************************************************************/
 static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 	.phy_id		= 1,
 };
 
+/*************************************************************************
+ * TS72XX support code
+ *************************************************************************/
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
 
 /* Relative to EP93XX_CS1_PHYS_BASE */
-- 
2.11.0

[PATCH v4 2/5] ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept parameters

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 23:52:50

This commit extend the ts72xx_register_flash() to accept passed parameters,
which makes it more reusable.

Now it is possible to accept ep93xx flash start address and partitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- New patch
Changes for v3:
- None
Changes for v4:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index f386ebae0163..141ae4c65a81 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -123,8 +123,6 @@ static struct platform_nand_data ts72xx_nand_data = {
 		.nr_chips	= 1,
 		.chip_offset	= 0,
 		.chip_delay	= 15,
-		.partitions	= ts72xx_nand_parts,
-		.nr_partitions	= ARRAY_SIZE(ts72xx_nand_parts),
 	},
 	.ctrl = {
 		.cmd_ctrl	= ts72xx_nand_hwcontrol,
@@ -148,8 +146,8 @@ static struct platform_device ts72xx_nand_flash = {
 	.num_resources		= ARRAY_SIZE(ts72xx_nand_resource),
 };
 
-
-static void __init ts72xx_register_flash(void)
+void __init ts72xx_register_flash(struct mtd_partition *parts, int n,
+				  resource_size_t start)
 {
 	/*
 	 * TS7200 has NOR flash all other TS72xx board have NAND flash.
@@ -157,16 +155,12 @@ static void __init ts72xx_register_flash(void)
 	if (board_is_ts7200()) {
 		ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
 	} else {
-		resource_size_t start;
-
-		if (is_ts9420_installed())
-			start = EP93XX_CS7_PHYS_BASE;
-		else
-			start = EP93XX_CS6_PHYS_BASE;
-
 		ts72xx_nand_resource[0].start = start;
 		ts72xx_nand_resource[0].end = start + SZ_16M - 1;
 
+		ts72xx_nand_data.chip.partitions = parts;
+		ts72xx_nand_data.chip.nr_partitions = n;
+
 		platform_device_register(&ts72xx_nand_flash);
 	}
 }
@@ -257,7 +251,9 @@ static struct ep93xx_spi_info ts72xx_spi_info __initdata = {
 static void __init ts72xx_init_machine(void)
 {
 	ep93xx_init_devices();
-	ts72xx_register_flash();
+	ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts),
+			      is_ts9420_installed() ?
+			      EP93XX_CS7_PHYS_BASE : EP93XX_CS6_PHYS_BASE);
 	platform_device_register(&ts72xx_rtc_device);
 	platform_device_register(&ts72xx_wdt_device);
 
-- 
2.11.0

[PATCH v4 1/5] ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-11-30 23:53:06

This commit adds include file guards to ts72xx.h

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
 arch/arm/mach-ep93xx/ts72xx.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index 8a3206a54b39..7b7490f10fa9 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -12,6 +12,9 @@
  * febfd000	22800000	4K	options register #2
  */
 
+#ifndef __TS72XX_H_
+#define __TS72XX_H_
+
 #define TS72XX_MODEL_PHYS_BASE		0x22000000
 #define TS72XX_MODEL_VIRT_BASE		IOMEM(0xfebff000)
 #define TS72XX_MODEL_SIZE		0x00001000
@@ -83,3 +86,4 @@ static inline int is_ts9420_installed(void)
 					TS72XX_OPTIONS2_TS9420);
 }
 #endif
+#endif /* __TS72XX_H_ */
-- 
2.11.0

RE: [PATCH v4 0/5] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Hartley Sweeten <hidden>
Date: 2017-12-05 18:14:09

On Thursday, November 30, 2017 4:52 PM, Lukasz Majewski wrote:
This patch series adds support for Liebherr's BK3 board, being a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c (detalied list of changes can be found in patch 6/6)

This series applies on top of linux-next/master (next-20171130)

Lukasz Majewski (5):
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept
    parameters
  ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable
  ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 ++
 arch/arm/mach-ep93xx/ts72xx.c | 198 ++++++++++++++++++++++++++++++++++++++----
 arch/arm/mach-ep93xx/ts72xx.h |   9 ++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 202 insertions(+), 19 deletions(-)
Looks good.

Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>

Linus,

Would you mind picking this series up?

Thanks,
Hartley

Re: [PATCH v4 0/5] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-12-06 17:46:29

Hello Hartley,

On 05/12/17 19:14, Hartley Sweeten wrote:
quoted
This patch series adds support for Liebherr's BK3 board, being a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c (detalied list of changes can be found in patch 6/6)

This series applies on top of linux-next/master (next-20171130)

Lukasz Majewski (5):
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept
    parameters
  ARM: ep93xx: ts72xx: Rewrite map IO code to be reusable
  ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 ++
 arch/arm/mach-ep93xx/ts72xx.c | 198 ++++++++++++++++++++++++++++++++++++++----
 arch/arm/mach-ep93xx/ts72xx.h |   9 ++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 202 insertions(+), 19 deletions(-)
Looks good.

Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
I can prepare pull request to Arnd, as we discussed previously, just
waited for your review.

Regards,
Alexander.

RE: [PATCH v4 5/5] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Hartley Sweeten <hidden>
Date: 2017-12-11 17:17:43

On Thursday, November 30, 2017 4:52 PM, Lukasz Majewski wrote:
The BK3 board is a derivative of the ts72xx reference design.
Lukasz,

I was just reviewing the other TS-72xx boards and noticed this:

<snip>
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+
<snip>
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		= __phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+
This register appears to be common to all the TS-72xx boards.

I don't think Arnd has pulled the series yet. Would you mind renaming the
defines and rebasing this patch? The BK3 board and other TS-72xx boards
can then have a common .map_io.

Thanks,
Hartley

Re: [PATCH v4 5/5] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-11 21:39:58

Hi Hartley,
On Thursday, November 30, 2017 4:52 PM, Lukasz Majewski wrote:
quoted
The BK3 board is a derivative of the ts72xx reference design.  
Lukasz,

I was just reviewing the other TS-72xx boards and noticed this:

<snip>
quoted
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+  
<snip>
quoted
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		=
__phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+  
This register appears to be common to all the TS-72xx boards.
The CPLD was used on the reference ts-72xx boards, but support for it
seems to not be present in the mainline kernel.

Do you have a ts72xx board with CPLD embedded? Is any of your design
using it?


My another concern - is it safe to perform IO mapping on memory regions
which are not used / specified? When I do a single ts72xx mapping - for
all boards - then we may end up with some mappings which are not needed.

With the code as it is - I only map regions which are already used on
relevant boards.
I don't think Arnd has pulled the series yet. Would you mind renaming
the defines and rebasing this patch? 
If needed I can resend the patch series, or prepare a single fix patch.
No problem.
The BK3 board and other TS-72xx
boards can then have a common .map_io.

Thanks,
Hartley


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171211/0cfc9f29/attachment.sig>

RE: [PATCH v4 5/5] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Hartley Sweeten <hidden>
Date: 2017-12-11 22:28:17

On Monday, December 11, 2017 2:40 PM, Lukasz Majewski wrote:
Hi Hartley,
quoted
On Thursday, November 30, 2017 4:52 PM, Lukasz Majewski wrote:
quoted
The BK3 board is a derivative of the ts72xx reference design.  
Lukasz,

I was just reviewing the other TS-72xx boards and noticed this:

<snip>
quoted
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+  
<snip>
quoted
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		=
__phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+  
This register appears to be common to all the TS-72xx boards.
The CPLD was used on the reference ts-72xx boards, but support for it seems
to not be present in the mainline kernel.
The CPLD is not directly called out but some parts of it are supported in the mainline
kernel.

The RTC index and data registers are chip selected by the CPLD and Watchdog is in
the CPLD. Also, the model number, options, and options2 registers are in the CPLD.

There are a couple other registers in the CPLD that are not currently present in
mainline. Some aren't because I haven't figured a good way to utilize them (the
COM2 RS485 registers and the PC/104 memory/IO spaces) or they simply have not
been necessary yet (the two status registers). There are a couple listed in the manuals
that are specific to the TS-7260 that also have not been added.

Basically, anything in the EP93xx CS1 or CS2 memory region is in or controlled by the CPLD.
Do you have a ts72xx board with CPLD embedded? Is any of your design using it?
I have a stock TS-7300 board.
My another concern - is it safe to perform IO mapping on memory regions which are
not used / specified?
The mapping is safe. If there is nothing at the address you just read back the static state
(noise) of the bus and writing doesn't do anything.
 When I do a single ts72xx mapping - for all boards - then we may end up with some
mappings which are not needed.
True, but it's harmless and it keeps the platform init code cleaner.
With the code as it is - I only map regions which are already used on relevant boards.
Yes, but this register in particular exists in the CPLD on all the TS-72xx boards.
quoted
I don't think Arnd has pulled the series yet. Would you mind renaming 
the defines and rebasing this patch?
If needed I can resend the patch series, or prepare a single fix patch.
No problem.
Fixing it after Arnd merges your series is fine. I just wanted to make sure it was
pointed out.

BTW, is there a reason the BK3 board needs this register mapped? It was mapped
in the Technologic Systems 2.4, 2.6, and 3.x kernels but I never found anything that
used it. Of course the stock boards probably always had the same revision in the CPLD,
the BK3 board might have multiple revisions...

Hartley

Re: [PATCH v4 5/5] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-11 22:47:10

Hi Hartley,
On Monday, December 11, 2017 2:40 PM, Lukasz Majewski wrote:
quoted
Hi Hartley,
 
quoted
On Thursday, November 30, 2017 4:52 PM, Lukasz Majewski wrote:  
quoted
The BK3 board is a derivative of the ts72xx reference design.    
Lukasz,

I was just reviewing the other TS-72xx boards and noticed this:

<snip>
  
quoted
+/* BK3 specific defines */
+#define BK3_CPLDVER_PHYS_BASE		0x23400000
+#define BK3_CPLDVER_VIRT_BASE		0xfebfd000
+#define BK3_CPLDVER_SIZE		0x00001000
+    
<snip>
  
quoted
+static struct map_desc bk3_io_desc[] __initdata = {
+	{
+		.virtual	= BK3_CPLDVER_VIRT_BASE,
+		.pfn		=
__phys_to_pfn(BK3_CPLDVER_PHYS_BASE),
+		.length	= BK3_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
+	}
+};
+    
This register appears to be common to all the TS-72xx boards.  
The CPLD was used on the reference ts-72xx boards, but support for
it seems to not be present in the mainline kernel.  
The CPLD is not directly called out but some parts of it are
supported in the mainline kernel.

The RTC index and data registers are chip selected by the CPLD and
Watchdog is in the CPLD. Also, the model number, options, and
options2 registers are in the CPLD.

There are a couple other registers in the CPLD that are not currently
present in mainline. Some aren't because I haven't figured a good way
to utilize them (the COM2 RS485 registers and the PC/104 memory/IO
spaces) or they simply have not been necessary yet (the two status
registers). There are a couple listed in the manuals that are
specific to the TS-7260 that also have not been added.

Basically, anything in the EP93xx CS1 or CS2 memory region is in or
controlled by the CPLD.
quoted
Do you have a ts72xx board with CPLD embedded? Is any of your
design using it?  
I have a stock TS-7300 board.
quoted
My another concern - is it safe to perform IO mapping on memory
regions which are not used / specified?  
The mapping is safe. If there is nothing at the address you just read
back the static state (noise) of the bus and writing doesn't do
anything.
Ok.
quoted
 When I do a single ts72xx mapping - for all boards - then we may
end up with some mappings which are not needed.  
True, but it's harmless and it keeps the platform init code cleaner.
I will add all the mappings.
quoted
With the code as it is - I only map regions which are already used
on relevant boards.  
Yes, but this register in particular exists in the CPLD on all the
TS-72xx boards.
quoted
quoted
I don't think Arnd has pulled the series yet. Would you mind
renaming the defines and rebasing this patch?  
If needed I can resend the patch series, or prepare a single fix
patch. No problem.  
Fixing it after Arnd merges your series is fine. I just wanted to
make sure it was pointed out.
I've checked a few minutes ago and it seems like arm-soc hasn't been
pulled to for-next.

I may resend the whole series.
BTW, is there a reason the BK3 board needs this register mapped? It
was mapped in the Technologic Systems 2.4, 2.6, and 3.x kernels but I
never found anything that used it.
It is used to check the version. BK3 has some CPLD modifications and
it is important to know which version we do have as the board is
already deployed for some time in the field.
Of course the stock boards
probably always had the same revision in the CPLD, the BK3 board
might have multiple revisions...
Yes, correct.
Hartley


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171211/4003dd39/attachment-0001.sig>

[PATCH v5 1/4] ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-11 23:36:49

This commit adds include file guards to ts72xx.h

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
Changes for v5:
- None
---
 arch/arm/mach-ep93xx/ts72xx.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index 8a3206a54b39..7b7490f10fa9 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -12,6 +12,9 @@
  * febfd000	22800000	4K	options register #2
  */
 
+#ifndef __TS72XX_H_
+#define __TS72XX_H_
+
 #define TS72XX_MODEL_PHYS_BASE		0x22000000
 #define TS72XX_MODEL_VIRT_BASE		IOMEM(0xfebff000)
 #define TS72XX_MODEL_SIZE		0x00001000
@@ -83,3 +86,4 @@ static inline int is_ts9420_installed(void)
 					TS72XX_OPTIONS2_TS9420);
 }
 #endif
+#endif /* __TS72XX_H_ */
-- 
2.11.0

[PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-11 23:36:52

This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c (detalied list of changes can be found in patch 4/4)

This series applies on top of linux-next/master (next-20171211)

Lukasz Majewski (4):
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept
    parameters
  ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 ++
 arch/arm/mach-ep93xx/ts72xx.c | 165 +++++++++++++++++++++++++++++++++++++++---
 arch/arm/mach-ep93xx/ts72xx.h |   9 +++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 176 insertions(+), 12 deletions(-)

-- 
2.11.0

[PATCH v5 3/4] ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-11 23:37:03

This patch extends readability of ts72xx.c code.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- New patch
Changes for v3:
- None
Changes to v4:
- Adjust the code to be applicable to linux-next/master
Changes for v5:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 141ae4c65a81..17af9d834b51 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -31,6 +31,9 @@
 #include "soc.h"
 #include "ts72xx.h"
 
+/*************************************************************************
+ * IO map
+ *************************************************************************/
 static struct map_desc ts72xx_io_desc[] __initdata = {
 	{
 		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,
@@ -201,10 +204,16 @@ static struct platform_device ts72xx_wdt_device = {
 	.num_resources	= ARRAY_SIZE(ts72xx_wdt_resources),
 };
 
+/*************************************************************************
+ * ETH
+ *************************************************************************/
 static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 	.phy_id		= 1,
 };
 
+/*************************************************************************
+ * TS72XX support code
+ *************************************************************************/
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
 
 /* Relative to EP93XX_CS1_PHYS_BASE */
-- 
2.11.0

[PATCH v5 4/4] ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-11 23:37:05

The BK3 board is a derivative of the ts72xx reference design.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Place bk3 support code to the ts72xx.c file
Changes for v3:
- Add SD card support (via SPI) for BK3
- Remove definition of apb:i2s bus
- Remove board registration of CPLD WDT device
- Add I2S platform device to BK3
- Add MAINTAINERS entry for BK3 maintainer
Changes for v4:
- Adjust the code to be applicable on top of linux-next/master
Changes for v5:
- Combine map_io to be reused across all ts72xx boards
---
 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 +++
 arch/arm/mach-ep93xx/ts72xx.c | 136 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-ep93xx/ts72xx.h |   5 ++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 155 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 7d195739f892..17e1263b085d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1258,6 +1258,12 @@ L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
 S:	Supported
 F:	drivers/net/ethernet/cavium/thunder/
 
+ARM/CIRRUS LOGIC BK3 MACHINE SUPPORT
+M:	Lukasz Majewski <lukma@denx.de>
+L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
+S:	Maintained
+F:	arch/arm/mach-ep93xx/ts72xx.c
+
 ARM/CIRRUS LOGIC CLPS711X ARM ARCHITECTURE
 M:	Alexander Shiyan <shc_work@mail.ru>
 L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 61a75ca3684e..c095236d7ff8 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
 	  Say 'Y' here if you want your kernel to support the ADS
 	  Sphere board.
 
+config MACH_BK3
+	bool "Support Liebherr BK3.1"
+	select MACH_TS72XX
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Liebherr controller BK3.1.
+
 config MACH_EDB93XX
 	bool
 
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 17af9d834b51..c089a2a4fe30 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -19,10 +19,15 @@
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/mmc_spi.h>
+#include <linux/mmc/host.h>
 #include <linux/platform_data/spi-ep93xx.h>
 
 #include <mach/gpio-ep93xx.h>
 #include <mach/hardware.h>
+#include <mach/irqs.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -50,6 +55,11 @@ static struct map_desc ts72xx_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE),
 		.length		= TS72XX_OPTIONS2_SIZE,
 		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)TS72XX_CPLDVER_VIRT_BASE,
+		.pfn		= __phys_to_pfn(TS72XX_CPLDVER_PHYS_BASE),
+		.length		= TS72XX_CPLDVER_SIZE,
+		.type		= MT_DEVICE,
 	}
 };
 
@@ -212,6 +222,69 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
 };
 
 /*************************************************************************
+ * SPI SD/MMC host
+ *************************************************************************/
+#define BK3_EN_SDCARD_PHYS_BASE         0x12400000
+#define BK3_EN_SDCARD_PWR 0x0
+#define BK3_DIS_SDCARD_PWR 0x0C
+static void bk3_mmc_spi_setpower(struct device *dev, unsigned int vdd)
+{
+	void __iomem *pwr_sd = ioremap(BK3_EN_SDCARD_PHYS_BASE, SZ_4K);
+
+	if (!pwr_sd) {
+		pr_err("Failed to enable SD card power!");
+		return;
+	}
+
+	pr_debug("%s: SD card pwr %s VDD:0x%x\n", __func__,
+		 !!vdd ? "ON" : "OFF", vdd);
+
+	if (!!vdd)
+		__raw_writeb(BK3_EN_SDCARD_PWR, pwr_sd);
+	else
+		__raw_writeb(BK3_DIS_SDCARD_PWR, pwr_sd);
+
+	iounmap(pwr_sd);
+}
+
+static struct mmc_spi_platform_data bk3_spi_mmc_data = {
+	.detect_delay	= 500,
+	.powerup_msecs	= 100,
+	.ocr_mask	= MMC_VDD_32_33 | MMC_VDD_33_34,
+	.caps		= MMC_CAP_NONREMOVABLE,
+	.setpower       = bk3_mmc_spi_setpower,
+};
+
+/*************************************************************************
+ * SPI Bus - SD card access
+ *************************************************************************/
+static struct spi_board_info bk3_spi_board_info[] __initdata = {
+	{
+		.modalias		= "mmc_spi",
+		.platform_data		= &bk3_spi_mmc_data,
+		.max_speed_hz		= 7.4E6,
+		.bus_num		= 0,
+		.chip_select		= 0,
+		.mode			= SPI_MODE_0,
+	},
+};
+
+/*
+ * This is a stub -> the FGPIO[3] pin is not connected on the schematic
+ * The all work is performed automatically by !SPI_FRAME (SFRM1) and
+ * goes through CPLD
+ */
+static int bk3_spi_chipselects[] __initdata = {
+	EP93XX_GPIO_LINE_F(3),
+};
+
+static struct ep93xx_spi_info bk3_spi_master __initdata = {
+	.chipselect	= bk3_spi_chipselects,
+	.num_chipselect = ARRAY_SIZE(bk3_spi_chipselects),
+	.use_dma	= 1,
+};
+
+/*************************************************************************
  * TS72XX support code
  *************************************************************************/
 #if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
@@ -285,3 +358,66 @@ MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
 	.init_late	= ep93xx_init_late,
 	.restart	= ep93xx_restart,
 MACHINE_END
+
+/*************************************************************************
+ * EP93xx I2S audio peripheral handling
+ *************************************************************************/
+static struct resource ep93xx_i2s_resource[] = {
+	DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100),
+	DEFINE_RES_IRQ_NAMED(IRQ_EP93XX_SAI, "spilink i2s slave"),
+};
+
+static struct platform_device ep93xx_i2s_device = {
+	.name		= "ep93xx-spilink-i2s",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(ep93xx_i2s_resource),
+	.resource	= ep93xx_i2s_resource,
+};
+
+/*************************************************************************
+ * BK3 support code
+ *************************************************************************/
+static struct mtd_partition bk3_nand_parts[] = {
+	{
+		.name		= "System",
+		.offset	= 0x00000000,
+		.size		= 0x01e00000,
+	}, {
+		.name		= "Data",
+		.offset	= 0x01e00000,
+		.size		= 0x05f20000
+	}, {
+		.name		= "RedBoot",
+		.offset	= 0x07d20000,
+		.size		= 0x002e0000,
+		.mask_flags	= MTD_WRITEABLE,	/* force RO */
+	},
+};
+
+static void __init bk3_init_machine(void)
+{
+	ep93xx_init_devices();
+
+	ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts),
+			      EP93XX_CS6_PHYS_BASE);
+
+	ep93xx_register_eth(&ts72xx_eth_data, 1);
+
+	ep93xx_register_spi(&bk3_spi_master, bk3_spi_board_info,
+			    ARRAY_SIZE(bk3_spi_board_info));
+
+	/* Configure ep93xx's I2S to use AC97 pins */
+	ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97);
+	platform_device_register(&ep93xx_i2s_device);
+}
+
+MACHINE_START(BK3, "Liebherr controller BK3.1")
+	/* Maintainer: Lukasz Majewski <lukma@denx.de> */
+	.atag_offset	= 0x100,
+	.map_io		= ts72xx_map_io,
+	.init_irq	= ep93xx_init_irq,
+	.init_time	= ep93xx_timer_init,
+	.init_machine	= bk3_init_machine,
+	.init_late	= ep93xx_init_late,
+	.restart	= ep93xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-ep93xx/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h
index 7b7490f10fa9..00b4941d29c9 100644
--- a/arch/arm/mach-ep93xx/ts72xx.h
+++ b/arch/arm/mach-ep93xx/ts72xx.h
@@ -10,6 +10,7 @@
  * febff000	22000000	4K	model number register (bits 0-2)
  * febfe000	22400000	4K	options register
  * febfd000	22800000	4K	options register #2
+ * febfc000     23400000        4K      CPLD version register
  */
 
 #ifndef __TS72XX_H_
@@ -42,6 +43,10 @@
 #define TS72XX_OPTIONS2_TS9420		0x04
 #define TS72XX_OPTIONS2_TS9420_BOOT	0x02
 
+#define TS72XX_CPLDVER_PHYS_BASE	0x23400000
+#define TS72XX_CPLDVER_VIRT_BASE	IOMEM(0xfebfc000)
+#define TS72XX_CPLDVER_SIZE		0x00001000
+
 #ifndef __ASSEMBLY__
 
 static inline int ts72xx_model(void)
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index a9313b66f770..4eac94c1eb6f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -345,6 +345,7 @@ mxlads			MACH_MXLADS		MXLADS			1851
 linkstation_mini	MACH_LINKSTATION_MINI	LINKSTATION_MINI	1858
 afeb9260		MACH_AFEB9260		AFEB9260		1859
 imx27ipcam		MACH_IMX27IPCAM		IMX27IPCAM		1871
+bk3			MACH_BK3		BK3			1880
 rd88f6183ap_ge		MACH_RD88F6183AP_GE	RD88F6183AP_GE		1894
 realview_pba8		MACH_REALVIEW_PBA8	REALVIEW_PBA8		1897
 realview_pbx		MACH_REALVIEW_PBX	REALVIEW_PBX		1901
-- 
2.11.0

[PATCH v5 2/4] ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept parameters

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-11 23:37:55

This commit extend the ts72xx_register_flash() to accept passed parameters,
which makes it more reusable.

Now it is possible to accept ep93xx flash start address and partitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changes for v2:
- New patch
Changes for v3:
- None
Changes for v4:
- None
Changes for v5:
- None
---
 arch/arm/mach-ep93xx/ts72xx.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index f386ebae0163..141ae4c65a81 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -123,8 +123,6 @@ static struct platform_nand_data ts72xx_nand_data = {
 		.nr_chips	= 1,
 		.chip_offset	= 0,
 		.chip_delay	= 15,
-		.partitions	= ts72xx_nand_parts,
-		.nr_partitions	= ARRAY_SIZE(ts72xx_nand_parts),
 	},
 	.ctrl = {
 		.cmd_ctrl	= ts72xx_nand_hwcontrol,
@@ -148,8 +146,8 @@ static struct platform_device ts72xx_nand_flash = {
 	.num_resources		= ARRAY_SIZE(ts72xx_nand_resource),
 };
 
-
-static void __init ts72xx_register_flash(void)
+void __init ts72xx_register_flash(struct mtd_partition *parts, int n,
+				  resource_size_t start)
 {
 	/*
 	 * TS7200 has NOR flash all other TS72xx board have NAND flash.
@@ -157,16 +155,12 @@ static void __init ts72xx_register_flash(void)
 	if (board_is_ts7200()) {
 		ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
 	} else {
-		resource_size_t start;
-
-		if (is_ts9420_installed())
-			start = EP93XX_CS7_PHYS_BASE;
-		else
-			start = EP93XX_CS6_PHYS_BASE;
-
 		ts72xx_nand_resource[0].start = start;
 		ts72xx_nand_resource[0].end = start + SZ_16M - 1;
 
+		ts72xx_nand_data.chip.partitions = parts;
+		ts72xx_nand_data.chip.nr_partitions = n;
+
 		platform_device_register(&ts72xx_nand_flash);
 	}
 }
@@ -257,7 +251,9 @@ static struct ep93xx_spi_info ts72xx_spi_info __initdata = {
 static void __init ts72xx_init_machine(void)
 {
 	ep93xx_init_devices();
-	ts72xx_register_flash();
+	ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts),
+			      is_ts9420_installed() ?
+			      EP93XX_CS7_PHYS_BASE : EP93XX_CS6_PHYS_BASE);
 	platform_device_register(&ts72xx_rtc_device);
 	platform_device_register(&ts72xx_wdt_device);
 
-- 
2.11.0

RE: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Hartley Sweeten <hidden>
Date: 2017-12-11 23:43:14

On Monday, December 11, 2017 4:36 PM, Lukasz Majewski wrote:
This patch series adds support for Liebherr's BK3 board, being a derivative of TS72XX design.

This patchset consists of following patches:

- ts72xx.[c|h] cosmetic cleanup/improvement
- Rewrite ts72xx.c to be reusable by bk3
- The Liebherr's BK3 board has been added with re-using code of
  ts72xx.c (detalied list of changes can be found in patch 4/4)

This series applies on top of linux-next/master (next-20171211)

Lukasz Majewski (4):
  ARM: ep93xx: ts72xx: Provide include guards for ts72xx.h file
  ARM: ep93xx: ts72xx: Rewrite ts72xx_register_flash() to accept
    parameters
  ARM: ep93xx: ts72xx: cosmetic: Add some description to ts72xx code
  ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative

 MAINTAINERS                   |   6 ++
 arch/arm/mach-ep93xx/Kconfig  |   7 ++
 arch/arm/mach-ep93xx/ts72xx.c | 165 +++++++++++++++++++++++++++++++++++++++---
 arch/arm/mach-ep93xx/ts72xx.h |   9 +++
 arch/arm/tools/mach-types     |   1 +
 5 files changed, 176 insertions(+), 12 deletions(-)
Looks good. Thanks!

Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Linus Walleij <hidden>
Date: 2017-12-13 07:34:26

On Tue, Dec 12, 2017 at 12:36 AM, Lukasz Majewski [off-list ref] wrote:
This patch series adds support for Liebherr's BK3 board, being
a derivative of TS72XX design.
All looks good.
Acked-by: Linus Walleij <redacted>

Out of curiosity: Liebherr is obviously doing heavy-duty industrial
control systems. Likewise Hartley is doing similar business over
at Vision Engravings.

Is the situation such that there is a whole bunch of industrial
systems out there, in active use and needing future upgrades,
that use the EP93xx?

Arnd has been nudging me to do DT conversion for EP93xx
so if there are many active industrial users of these
I should prioritize it, because these things have 20+ years
support cycles.

We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.

Yours,
Linus Walleij

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-12-13 08:26:18

Hello Linus!

On Wed Dec 13 08:34:22 2017 Linus Walleij [off-list ref] wrote:
On Tue, Dec 12, 2017 at 12:36 AM, Lukasz Majewski [off-list ref] wrote:
Out of curiosity: Liebherr is obviously doing heavy-duty industrial
control systems. Likewise Hartley is doing similar business over
at Vision Engravings.

Is the situation such that there is a whole bunch of industrial
systems out there, in active use and needing future upgrades,
that use the EP93xx?
That's definitely the case. I'm as well aware of several thousands of industrial devices which are expected to run 24/7 for the next 5 years at least. And they are updated from time to time.
Arnd has been nudging me to do DT conversion for EP93xx
so if there are many active industrial users of these
I should prioritize it, because these things have 20+ years
support cycles.
I'm not sure how important or necessary at all is to change anything in these legacy platforms.
We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.
But we should definitely preserve at least what we have.

--
Alexander.

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-13 08:53:13

Hi Alexander, Linus
Hello Linus!

On Wed Dec 13 08:34:22 2017 Linus Walleij [off-list ref]
wrote:
quoted
On Tue, Dec 12, 2017 at 12:36 AM, Lukasz Majewski [off-list ref]
wrote: Out of curiosity: Liebherr is obviously doing heavy-duty
industrial control systems. Likewise Hartley is doing similar
business over at Vision Engravings.

Is the situation such that there is a whole bunch of industrial
systems out there, in active use and needing future upgrades,
that use the EP93xx?  
That's definitely the case. I'm as well aware of several thousands of
industrial devices which are expected to run 24/7 for the next 5
years at least. And they are updated from time to time.
I can agree with this statement. 
quoted
Arnd has been nudging me to do DT conversion for EP93xx
so if there are many active industrial users of these
I should prioritize it, because these things have 20+ years
support cycles.  
I'm not sure how important or necessary at all is to change anything
in these legacy platforms.
+1
quoted
We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.  
But we should definitely preserve at least what we have.
I'm using OE to build toolchain (SDK). I can confirm that gcc 7.2 works
with it.

And yes, armv4 support shall be preserved in GCC ....
--
Alexander.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171213/d6dfd68c/attachment-0001.sig>

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-12-13 10:11:45

On Wed, Dec 13, 2017 at 9:26 AM, Alexander Sverdlin
[off-list ref] wrote:
On Wed Dec 13 08:34:22 2017 Linus Walleij [off-list ref] wrote:
quoted
Arnd has been nudging me to do DT conversion for EP93xx
so if there are many active industrial users of these
I should prioritize it, because these things have 20+ years
support cycles.
I'm not sure how important or necessary at all is to change anything in these legacy platforms.
I suspect that at several points in the next 5 to 10 years, we will remove
additional platforms or CPU types, as we tend to do when a platform
becomes a maintenance burden and is clearly not used by anyone.

It's hard to predict in advance what triggers the removal, but as the
number of platforms that are not using DT or ARCH_MULTIPLATFORM
goes down to a small number, there will be increased interested in either
removing or converting the remaining ones. This is not an immediate
danger at the moment, since we still have 14 platforms that are not
using ARCH_MULTIPLATFORM, and 23 that have remaining
board files, but you don't want to be the last user of the last platform
after the other ones are done ;-)
quoted
We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.
But we should definitely preserve at least what we have.
Plain ARMv4 (and earlier) support in gcc is already marked 'deprecated'
and will likely be gone in gcc-8 (it's still there as of last week). ARMv4T
is going to be around for a while, and you can even keep building for
ARMv4 using "-march=armv4t -marm" when linking with 'ld --fix-v4bx'.

Debian recently did a survey to find out whether there were still users
on ARMv4 or ARMv4T, and the result was that probably everyone is
on ARMv5E or ARMv6 for the ARM port (which is separate from the
ARMHF port that is ARMv7+). See also
https://lists.debian.org/debian-user/2017/11/msg00379.html
and let them know quickly if you use Debian stable releases and
plan to update to Debian 10 (Buster) in the future.

     Arnd

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-17 19:41:36

Hi Arnd,
On Wed, Dec 13, 2017 at 9:26 AM, Alexander Sverdlin
[off-list ref] wrote:
quoted
On Wed Dec 13 08:34:22 2017 Linus Walleij
[off-list ref] wrote:  
quoted
Arnd has been nudging me to do DT conversion for EP93xx
so if there are many active industrial users of these
I should prioritize it, because these things have 20+ years
support cycles.  
I'm not sure how important or necessary at all is to change
anything in these legacy platforms.  
I suspect that at several points in the next 5 to 10 years, we will
remove additional platforms or CPU types, as we tend to do when a
platform becomes a maintenance burden and is clearly not used by
anyone.
I suppose that at least the last argument is not the case here :-).
It's hard to predict in advance what triggers the removal, but as the
number of platforms that are not using DT or ARCH_MULTIPLATFORM
goes down to a small number, there will be increased interested in
either removing or converting the remaining ones. This is not an
immediate danger at the moment, since we still have 14 platforms that
are not using ARCH_MULTIPLATFORM, and 23 that have remaining
board files, but you don't want to be the last user of the last
platform after the other ones are done ;-)
:-)
quoted
quoted
We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.  
But we should definitely preserve at least what we have.  
Plain ARMv4 (and earlier) support in gcc is already marked
'deprecated' and will likely be gone in gcc-8 (it's still there as of
last week). ARMv4T is going to be around for a while, and you can
even keep building for ARMv4 using "-march=armv4t -marm" when linking
with 'ld --fix-v4bx'.
I think that we shall start complaining on the gcc-devel mailing list
now.

I would be hard to wake up in 2 years time and realise that we don't
have a modern compiler.
Debian recently did a survey to find out whether there were still
users on ARMv4 or ARMv4T, and the result was that probably everyone is
on ARMv5E or ARMv6 for the ARM port (which is separate from the
ARMHF port that is ARMv7+). See also
https://lists.debian.org/debian-user/2017/11/msg00379.html
and let them know quickly if you use Debian stable releases and
plan to update to Debian 10 (Buster) in the future.

     Arnd


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171217/56d4973a/attachment.sig>

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-12-17 20:07:09

On Sun, Dec 17, 2017 at 8:41 PM, Lukasz Majewski [off-list ref] wrote:
quoted
quoted
quoted
We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.
But we should definitely preserve at least what we have.
Plain ARMv4 (and earlier) support in gcc is already marked
'deprecated' and will likely be gone in gcc-8 (it's still there as of
last week). ARMv4T is going to be around for a while, and you can
even keep building for ARMv4 using "-march=armv4t -marm" when linking
with 'ld --fix-v4bx'.
I think that we shall start complaining on the gcc-devel mailing list
now.

I would be hard to wake up in 2 years time and realise that we don't
have a modern compiler.
What distro or build system are you using? It would also be helpful
to test whether the -march=armv4t/--fix-v4bx workaround produces
working binaries for you, in that case you could report to the gcc
developers that the removal of armv4 can continue but that
the --fix-v4bx option in ld needs to stay around.

       Arnd

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-17 21:29:02

Hi Arnd,
On Sun, Dec 17, 2017 at 8:41 PM, Lukasz Majewski [off-list ref]
wrote:
quoted
quoted
quoted
quoted
We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.  
But we should definitely preserve at least what we have.  
Plain ARMv4 (and earlier) support in gcc is already marked
'deprecated' and will likely be gone in gcc-8 (it's still there as
of last week). ARMv4T is going to be around for a while, and you
can even keep building for ARMv4 using "-march=armv4t -marm" when
linking with 'ld --fix-v4bx'.  
I think that we shall start complaining on the gcc-devel mailing
list now.

I would be hard to wake up in 2 years time and realise that we don't
have a modern compiler.  
What distro or build system are you using?
I'm using OE with the "include conf/machine/include/tune-arm920t.inc"

GCC 7.2 is working 
It would also be helpful
to test whether the -march=armv4t/--fix-v4bx workaround produces
working binaries for you, in that case you could report to the gcc
developers that the removal of armv4 can continue but that
the --fix-v4bx option in ld needs to stay around.
I may ask this issue on OE/Yocto mailing list as well....

Thanks for hint.
       Arnd


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171217/bec5a31a/attachment-0001.sig>

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-12-18 11:55:57

On Sun, Dec 17, 2017 at 10:28 PM, Lukasz Majewski [off-list ref] wrote:
Hi Arnd,
quoted
On Sun, Dec 17, 2017 at 8:41 PM, Lukasz Majewski [off-list ref]
wrote:
quoted
quoted
quoted
quoted
We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.
But we should definitely preserve at least what we have.
Plain ARMv4 (and earlier) support in gcc is already marked
'deprecated' and will likely be gone in gcc-8 (it's still there as
of last week). ARMv4T is going to be around for a while, and you
can even keep building for ARMv4 using "-march=armv4t -marm" when
linking with 'ld --fix-v4bx'.
I think that we shall start complaining on the gcc-devel mailing
list now.

I would be hard to wake up in 2 years time and realise that we don't
have a modern compiler.
What distro or build system are you using?
I'm using OE with the "include conf/machine/include/tune-arm920t.inc"

GCC 7.2 is working
Ah wait, this is still for ep93xx, which is always at least armv4t, right?
So it won't have a problem with the armv4 deprecation anyway, even
the older ep72xx/73xx were ARM720T based and don't have a problem.
I'm not entirely sure about their clps711x predecessors, which were some
earlier arm7 variant, but Linux doesn't support them any more anyway,
and the ARM710T would already be fine without --fix-v4bx.
quoted
It would also be helpful
to test whether the -march=armv4t/--fix-v4bx workaround produces
working binaries for you, in that case you could report to the gcc
developers that the removal of armv4 can continue but that
the --fix-v4bx option in ld needs to stay around.
I may ask this issue on OE/Yocto mailing list as well....
To clarify, the only  affected platforms are those based on either
DEC/Intel StrongARM or Faraday FA526, i.e. EBSA-110,
FootBridge, RPC, SA1100, Moxart and Gemini.

       Arnd

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date: 2017-12-18 12:03:44

Hi!

On Mon Dec 18 12:55:40 2017 Arnd Bergmann [off-list ref] wrote:
quoted
GCC 7.2 is working
Ah wait, this is still for ep93xx, which is always at least armv4t,
right? So it won't have a problem with the armv4 deprecation anyway, even
Correct.

--
Alex.

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-19 21:36:33

Hi Arnd,
Hi!

On Mon Dec 18 12:55:40 2017 Arnd Bergmann [off-list ref] wrote:
quoted
quoted
GCC 7.2 is working  
Ah wait, this is still for ep93xx, which is always at least armv4t,
right? So it won't have a problem with the armv4 deprecation
anyway, even  
Correct.
Maybe a bit off topic :-)

Are there any more comments regarding this patch series? Are those
patches eligible for applying them to -next?
--
Alex.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171219/bc84a3eb/attachment.sig>

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-12-20 08:11:07

On Tue, Dec 19, 2017 at 10:36 PM, Lukasz Majewski [off-list ref] wrote:
Hi Arnd,
quoted
Hi!

On Mon Dec 18 12:55:40 2017 Arnd Bergmann [off-list ref] wrote:
quoted
quoted
GCC 7.2 is working
Ah wait, this is still for ep93xx, which is always at least armv4t,
right? So it won't have a problem with the armv4 deprecation
anyway, even
Correct.
Maybe a bit off topic :-)

Are there any more comments regarding this patch series? Are those
patches eligible for applying them to -next?
Alexander already sent a pull request, I just haven't pulled them. If there
are any other comments or additional patches, they should be done
on top of the first pull request, unless there is a major regression in
the original pull (which is unlikely).

        Arnd

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Lukasz Majewski <lukma@denx.de>
Date: 2017-12-20 08:53:28

Hi Arnd,
On Tue, Dec 19, 2017 at 10:36 PM, Lukasz Majewski [off-list ref]
wrote:
quoted
Hi Arnd,
 
quoted
Hi!

On Mon Dec 18 12:55:40 2017 Arnd Bergmann [off-list ref] wrote:  
quoted
quoted
GCC 7.2 is working  
Ah wait, this is still for ep93xx, which is always at least
armv4t, right? So it won't have a problem with the armv4
deprecation anyway, even  
Correct.  
Maybe a bit off topic :-)

Are there any more comments regarding this patch series? Are those
patches eligible for applying them to -next?  
Alexander already sent a pull request, I just haven't pulled them. If
there are any other comments or additional patches, they should be
done on top of the first pull request, unless there is a major
regression in the original pull (which is unlikely).
Thanks for reply.
        Arnd


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171220/391d72da/attachment-0001.sig>

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Linus Walleij <hidden>
Date: 2017-12-20 12:33:06

On Wed, Dec 13, 2017 at 9:52 AM, Lukasz Majewski [off-list ref] wrote:
quoted
On Wed Dec 13 08:34:22 2017 Linus Walleij [off-list ref]
wrote:
quoted
On Tue, Dec 12, 2017 at 12:36 AM, Lukasz Majewski [off-list ref]
wrote: Out of curiosity: Liebherr is obviously doing heavy-duty
industrial control systems. Likewise Hartley is doing similar
business over at Vision Engravings.

Is the situation such that there is a whole bunch of industrial
systems out there, in active use and needing future upgrades,
that use the EP93xx?
That's definitely the case. I'm as well aware of several thousands of
industrial devices which are expected to run 24/7 for the next 5
years at least. And they are updated from time to time.
I can agree with this statement.
OK I'm coloring this platform with a highlight for ARM32 maintenance.
quoted
quoted
Arnd has been nudging me to do DT conversion for EP93xx
so if there are many active industrial users of these
I should prioritize it, because these things have 20+ years
support cycles.
I'm not sure how important or necessary at all is to change anything
in these legacy platforms.
+1
That is an understandable conservative stance.

There is a fine line between "it works, don't touch it" and
"modernize the ARM32 ecosystem".

There is a point where supporting old board files will stand in
the way and cost a lot in maintenance (like moving drivers our
of arch/arm, or modernizing misc subsystems). Then moving the
platform over to device tree should be preferred.
I'm using OE to build toolchain (SDK). I can confirm that gcc 7.2 works
with it.

And yes, armv4 support shall be preserved in GCC ....
Yes that is the same toochain I use.

Yours,
Linus Walleij

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Linus Walleij <hidden>
Date: 2017-12-20 12:48:59

On Mon, Dec 18, 2017 at 12:55 PM, Arnd Bergmann [off-list ref] wrote:
On Sun, Dec 17, 2017 at 10:28 PM, Lukasz Majewski [off-list ref] wrote:
quoted
quoted
On Sun, Dec 17, 2017 at 8:41 PM, Lukasz Majewski [off-list ref]
wrote:
quoted
quoted
quoted
quoted
We also need to think about upholding support in GCC for
ARMv4(t) for the foreseeable future if there is a big web of
random deeply embedded systems out there that will need
updates.
But we should definitely preserve at least what we have.
Plain ARMv4 (and earlier) support in gcc is already marked
'deprecated' and will likely be gone in gcc-8 (it's still there as
of last week). ARMv4T is going to be around for a while, and you
can even keep building for ARMv4 using "-march=armv4t -marm" when
linking with 'ld --fix-v4bx'.
I think that we shall start complaining on the gcc-devel mailing
list now.

I would be hard to wake up in 2 years time and realise that we don't
have a modern compiler.
(...)
quoted
quoted
It would also be helpful
to test whether the -march=armv4t/--fix-v4bx workaround produces
working binaries for you, in that case you could report to the gcc
developers that the removal of armv4 can continue but that
the --fix-v4bx option in ld needs to stay around.
I may ask this issue on OE/Yocto mailing list as well....
To clarify, the only  affected platforms are those based on either
DEC/Intel StrongARM or Faraday FA526, i.e. EBSA-110,
FootBridge, RPC, SA1100, Moxart and Gemini.
It's a bit unfortunate since there are users and active contributors to
these architectures, I think the OE community is being missed out
just because they "are not Debian". :/

Even NetWinder.org is still up and kicking.

Some of it may be nostalgia and platform-hugging with regards to
SA110 and SA1100 systems, I am certainly aware of such tendencies
in myself. And I understand if GCC drops support for old systems
that only have a bunch of elderly gentlemen running it for the fun of it.

What really worries me is if there are widely deployed SA110,
SA1100, FA526 or similar embedded systems using plain ARMv4
and doing regular kernel builds and userspaces for them, in
items with 20+ years support cycles.

With reports in the media about things like nuclear powerplants running
unsupported versions of Windows NT or 95, I want to make sure
that we're not creating a similar situation somewhere for deeply
embedded Linux. Sadly these users mostly seem to come out
of the shadows after-the-fact.

My own experiments with an upgraded Gemini platform are mostly
related to the fact that home routers using this ARMv4 SoC are still
being sold and deployed, using a v2.6 kernel (contributing to the
world of botnets I suppose). The hardware-accelerated gigabit ethernet
on these routers for the home make them still fully usable despite the
ARMv4 core, but securitywise they are a nightmare.

Yours,
Linus Walleij

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-12-20 12:50:34

On Wed, Dec 20, 2017 at 1:33 PM, Linus Walleij [off-list ref] wrote:
On Wed, Dec 13, 2017 at 9:52 AM, Lukasz Majewski [off-list ref] wrote:
There is a point where supporting old board files will stand in
the way and cost a lot in maintenance (like moving drivers our
of arch/arm, or modernizing misc subsystems). Then moving the
platform over to device tree should be preferred.
I'm generally more interested in the multiplatform conversion than
the DT conversion, and I think converting this one to multiplatform
isn't actually that hard, and doesn't have a significant risk for
regressions, the main work is to convert the clock handling.

       Arnd

Re: [PATCH v5 0/4] ARM: ep93xx: ts72xx: Add support for BK3 board

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-12-20 12:59:35

On Wed, Dec 20, 2017 at 1:48 PM, Linus Walleij [off-list ref] wrote:
On Mon, Dec 18, 2017 at 12:55 PM, Arnd Bergmann [off-list ref] wrote:
quoted
On Sun, Dec 17, 2017 at 10:28 PM, Lukasz Majewski [off-list ref] wrote:
quoted
quoted
It would also be helpful
to test whether the -march=armv4t/--fix-v4bx workaround produces
working binaries for you, in that case you could report to the gcc
developers that the removal of armv4 can continue but that
the --fix-v4bx option in ld needs to stay around.
I may ask this issue on OE/Yocto mailing list as well....
To clarify, the only  affected platforms are those based on either
DEC/Intel StrongARM or Faraday FA526, i.e. EBSA-110,
FootBridge, RPC, SA1100, Moxart and Gemini.
It's a bit unfortunate since there are users and active contributors to
these architectures, I think the OE community is being missed out
just because they "are not Debian". :/
IIRC, OE already uses the --fix-v4bx workaround. I had an older patch
to do the same in the kernel, let me resend it now, so you can try it
and see if that works for you.

       Arnd
Next 5 of 5 remaining
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help