* [PATCH 1/6] ARM: add Zii common directory and move switch reset command
@ 2019-03-13 10:56 Lucas Stach
2019-03-13 10:56 ` [PATCH 2/6] ARM: zii-common: add support for switch reset on RDU1 Lucas Stach
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Lucas Stach @ 2019-03-13 10:56 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov, Chris Healy
The Zii boards share some functionality across different boards. Add
a common directory, so we can implement this once and use across
different boards.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boards/Makefile | 1 +
arch/arm/boards/zii-common/Makefile | 1 +
arch/arm/boards/{zii-imx6q-rdu2 => zii-common}/switch-cmd.c | 0
arch/arm/boards/zii-imx6q-rdu2/Makefile | 2 +-
arch/arm/mach-imx/Kconfig | 4 ++++
5 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/boards/zii-common/Makefile
rename arch/arm/boards/{zii-imx6q-rdu2 => zii-common}/switch-cmd.c (100%)
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index c5dc41526b23..fc883e3dea03 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -156,6 +156,7 @@ obj-$(CONFIG_MACH_QEMU_VIRT64) += qemu-virt64/
obj-$(CONFIG_MACH_WARP7) += element14-warp7/
obj-$(CONFIG_MACH_VF610_TWR) += freescale-vf610-twr/
obj-$(CONFIG_MACH_XILINX_ZCU104) += xilinx-zcu104/
+obj-$(CONFIG_MACH_ZII_COMMON) += zii-common/
obj-$(CONFIG_MACH_ZII_RDU1) += zii-imx51-rdu1/
obj-$(CONFIG_MACH_ZII_RDU2) += zii-imx6q-rdu2/
obj-$(CONFIG_MACH_ZII_IMX8MQ_DEV) += zii-imx8mq-dev/
diff --git a/arch/arm/boards/zii-common/Makefile b/arch/arm/boards/zii-common/Makefile
new file mode 100644
index 000000000000..9decfe85fc13
--- /dev/null
+++ b/arch/arm/boards/zii-common/Makefile
@@ -0,0 +1 @@
+obj-y += switch-cmd.o
diff --git a/arch/arm/boards/zii-imx6q-rdu2/switch-cmd.c b/arch/arm/boards/zii-common/switch-cmd.c
similarity index 100%
rename from arch/arm/boards/zii-imx6q-rdu2/switch-cmd.c
rename to arch/arm/boards/zii-common/switch-cmd.c
diff --git a/arch/arm/boards/zii-imx6q-rdu2/Makefile b/arch/arm/boards/zii-imx6q-rdu2/Makefile
index 10dfba3a3cf3..c6285362f2ee 100644
--- a/arch/arm/boards/zii-imx6q-rdu2/Makefile
+++ b/arch/arm/boards/zii-imx6q-rdu2/Makefile
@@ -1,3 +1,3 @@
-obj-y += board.o switch-cmd.o
+obj-y += board.o
lwl-y += lowlevel.o
bbenv-y += defaultenv-rdu2
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index f3f3a493394d..3cfa0c19870f 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -431,6 +431,9 @@ config MACH_VF610_TWR
bool "Freescale VF610 Tower Board"
select ARCH_VF610
+config MACH_ZII_COMMON
+ bool
+
config MACH_ZII_RDU1
bool "ZII i.MX51 RDU1"
select ARCH_IMX51
@@ -441,6 +444,7 @@ config MACH_ZII_RDU2
bool "ZII i.MX6Q(+) RDU2"
select ARCH_IMX6
select MCI_IMX_ESDHC_PBL
+ select MACH_ZII_COMMON
config MACH_ZII_IMX8MQ_DEV
bool "ZII i.MX8MQ based devices"
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/6] ARM: zii-common: add support for switch reset on RDU1
2019-03-13 10:56 [PATCH 1/6] ARM: add Zii common directory and move switch reset command Lucas Stach
@ 2019-03-13 10:56 ` Lucas Stach
2019-03-13 10:56 ` [PATCH 3/6] ARM: zii-common: introduce RDU part-number based fixup abstraction Lucas Stach
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2019-03-13 10:56 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov, Chris Healy
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boards/zii-common/switch-cmd.c | 38 ++++++++++++++++++++-----
arch/arm/mach-imx/Kconfig | 1 +
include/linux/mfd/rave-sp.h | 1 +
3 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/arch/arm/boards/zii-common/switch-cmd.c b/arch/arm/boards/zii-common/switch-cmd.c
index bdba46fb3615..30438053a1ef 100644
--- a/arch/arm/boards/zii-common/switch-cmd.c
+++ b/arch/arm/boards/zii-common/switch-cmd.c
@@ -11,19 +11,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
-#include <common.h>
#include <command.h>
+#include <common.h>
#include <i2c/i2c.h>
+#include <linux/mfd/rave-sp.h>
-static int do_rave_switch_reset(int argc, char *argv[])
+static int do_rdu2_switch_reset(void)
{
struct i2c_client client;
u8 reg;
- if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
- !of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
- return -ENODEV;
-
client.adapter = i2c_get_adapter(1);
if (!client.adapter)
return -ENODEV;
@@ -42,8 +39,35 @@ static int do_rave_switch_reset(int argc, char *argv[])
return 0;
}
+static int do_rdu1_switch_reset(void)
+{
+ struct device_d *sp_dev = get_device_by_name("sp");
+ struct rave_sp *sp = sp_dev->priv;
+ u8 cmd[] = {
+ [0] = RAVE_SP_CMD_RESET_ETH_SWITCH,
+ [1] = 0
+ };
+
+ if (IS_ENABLED(CONFIG_RAVE_SP_CORE))
+ return rave_sp_exec(sp, cmd, sizeof(cmd), NULL, 0);
+ else
+ return -ENODEV;
+}
+
+static int do_rave_switch_reset(int argc, char *argv[])
+{
+ if (of_machine_is_compatible("zii,imx6q-zii-rdu2") ||
+ of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
+ return do_rdu2_switch_reset();
+
+ if (of_machine_is_compatible("zii,imx51-rdu1"))
+ return do_rdu1_switch_reset();
+
+ return -ENODEV;
+}
+
BAREBOX_CMD_START(rave_reset_switch)
.cmd = do_rave_switch_reset,
- BAREBOX_CMD_DESC("reset ethernet switch on RDU2")
+ BAREBOX_CMD_DESC("reset ethernet switch on RDU")
BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP)
BAREBOX_CMD_END
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 3cfa0c19870f..c4e7500e8fda 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -439,6 +439,7 @@ config MACH_ZII_RDU1
select ARCH_IMX51
select MACH_FREESCALE_MX51_PDK_POWER
select CRC8
+ select MACH_ZII_COMMON
config MACH_ZII_RDU2
bool "ZII i.MX6Q(+) RDU2"
diff --git a/include/linux/mfd/rave-sp.h b/include/linux/mfd/rave-sp.h
index 37a37788d885..7b3187cb745c 100644
--- a/include/linux/mfd/rave-sp.h
+++ b/include/linux/mfd/rave-sp.h
@@ -25,6 +25,7 @@ enum rave_sp_command {
RAVE_SP_CMD_SET_BACKLIGHT = 0xA6,
RAVE_SP_CMD_RESET = 0xA7,
RAVE_SP_CMD_RESET_REASON = 0xA8,
+ RAVE_SP_CMD_RESET_ETH_SWITCH = 0xAF,
RAVE_SP_CMD_JUMP_TO_BOOTLOADER = 0xB0,
RAVE_SP_CMD_BOOTLOADER = 0xB1,
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/6] ARM: zii-common: introduce RDU part-number based fixup abstraction
2019-03-13 10:56 [PATCH 1/6] ARM: add Zii common directory and move switch reset command Lucas Stach
2019-03-13 10:56 ` [PATCH 2/6] ARM: zii-common: add support for switch reset on RDU1 Lucas Stach
@ 2019-03-13 10:56 ` Lucas Stach
2019-03-13 10:56 ` [PATCH 4/6] ARM: zii-common: fetch network config from SP Lucas Stach
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2019-03-13 10:56 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov, Chris Healy
From: Andrey Smirnov <andrew.smirnov@gmail.com>
Multiple generation of RDU boards from ZII come with slight hardware
variation that can be detected and fixed-up correctly based on part
number stored in EEPROMs that are accessible via RAVE SP.
In order to reduce common boilerplate between various RDU boards
introduce a bit of abstraction to allow declaring part-number specific
fixup in RDU board code.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
lst: Move into zii-common location.
---
arch/arm/boards/zii-common/Makefile | 2 +-
arch/arm/boards/zii-common/pn-fixup.c | 32 +++++++++
arch/arm/boards/zii-common/pn-fixup.h | 93 +++++++++++++++++++++++++++
3 files changed, 126 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/boards/zii-common/pn-fixup.c
create mode 100644 arch/arm/boards/zii-common/pn-fixup.h
diff --git a/arch/arm/boards/zii-common/Makefile b/arch/arm/boards/zii-common/Makefile
index 9decfe85fc13..057f2a89c647 100644
--- a/arch/arm/boards/zii-common/Makefile
+++ b/arch/arm/boards/zii-common/Makefile
@@ -1 +1 @@
-obj-y += switch-cmd.o
+obj-y += switch-cmd.o pn-fixup.o
diff --git a/arch/arm/boards/zii-common/pn-fixup.c b/arch/arm/boards/zii-common/pn-fixup.c
new file mode 100644
index 000000000000..a66519991776
--- /dev/null
+++ b/arch/arm/boards/zii-common/pn-fixup.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Zodiac Inflight Innovation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <linux/nvmem-consumer.h>
+
+#include "pn-fixup.h"
+
+char *zii_read_part_number(const char *cell_name, size_t cell_size)
+{
+ struct device_node *np;
+
+ np = of_find_node_by_name(NULL, "device-info");
+ if (!np) {
+ pr_warn("No device information found\n");
+ return ERR_PTR(-ENOENT);
+ }
+
+ return nvmem_cell_get_and_read(np, cell_name, cell_size);
+}
diff --git a/arch/arm/boards/zii-common/pn-fixup.h b/arch/arm/boards/zii-common/pn-fixup.h
new file mode 100644
index 000000000000..39b848bd00d3
--- /dev/null
+++ b/arch/arm/boards/zii-common/pn-fixup.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2019 Zodiac Inflight Innovation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ZII_PN_FIXUP__
+#define __ZII_PN_FIXUP__
+
+struct zii_pn_fixup {
+ const char *pn;
+ void (*callback) (const struct zii_pn_fixup *fixup);
+};
+
+char *zii_read_part_number(const char *, size_t);
+/**
+ * __zii_process_fixups - Process array of ZII part number based fixups
+ *
+ * @__fixups: Array of part number base fixups
+ * @__cell_name: Name of the NVMEM cell containing the part number
+ * @__cell_size: Size of the NVMEM cell containing the part number
+ *
+ * NOTE: Keeping this code as a marcro allows us to avoid restricting
+ * the type of __fixups to an array of struct zii_pn_fixup. This is
+ * really convenient becuase it allows us to do things like
+ *
+ * struct zii_foo_fixup {
+ * struct zii_pn_fixup parent;
+ * type1 custom_field_1
+ * type2 custom_field_2
+ * ...
+ * };
+ *
+ * ...
+ *
+ * const struct zii_foo_fixup foo_fixups[] = {
+ * { fixup1 },
+ * { fixup2 },
+ * { fixup3 },
+ * };
+ *
+ * ...
+ *
+ * __zii_process_fixups(foo_fixups, "blah", BLAH_LENGTH);
+ *
+ * which allows us to have the most compact definition of array of
+ * fixups
+ */
+#define __zii_process_fixups(__fixups, __cell_name, __cell_size) \
+ do { \
+ char *__pn = zii_read_part_number(__cell_name, \
+ __cell_size); \
+ const struct zii_pn_fixup *__fixup; \
+ unsigned int __i; \
+ bool __match_found = false; \
+ \
+ if (WARN_ON(IS_ERR(__pn))) \
+ break; \
+ \
+ for (__i = 0; __i < ARRAY_SIZE(__fixups); __i++) { \
+ __fixup = \
+ (const struct zii_pn_fixup *) &__fixups[__i]; \
+ \
+ if (strstr(__pn, __fixup->pn)) { \
+ pr_debug("%s->%pS\n", __func__, \
+ __fixup->callback); \
+ __match_found = true; \
+ __fixup->callback(__fixup); \
+ } \
+ } \
+ if (!__match_found) \
+ pr_err("No config fixups found for P/N %s!\n", __pn); \
+ free(__pn); \
+ } while (0)
+
+#define DDS_PART_NUMBER_SIZE 15
+#define LRU_PART_NUMBER_SIZE 15
+
+#define zii_process_dds_fixups(_fixups) \
+ __zii_process_fixups(_fixups, "dds-part-number", DDS_PART_NUMBER_SIZE)
+
+#define zii_process_lru_fixups(_fixups) \
+ __zii_process_fixups(_fixups, "lru-part-number", LRU_PART_NUMBER_SIZE)
+
+#endif /* __ZII_PN_FIXUP__ */
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/6] ARM: zii-common: fetch network config from SP
2019-03-13 10:56 [PATCH 1/6] ARM: add Zii common directory and move switch reset command Lucas Stach
2019-03-13 10:56 ` [PATCH 2/6] ARM: zii-common: add support for switch reset on RDU1 Lucas Stach
2019-03-13 10:56 ` [PATCH 3/6] ARM: zii-common: introduce RDU part-number based fixup abstraction Lucas Stach
@ 2019-03-13 10:56 ` Lucas Stach
2019-03-13 10:56 ` [PATCH 5/6] ARM: rdu2: Add p/n based fixups for touchscreen and display panel Lucas Stach
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2019-03-13 10:56 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov, Chris Healy
On both RDU1 and RDU2 the seat notwork configuration is stored in
a configuration EEPROM accessible via the RAVE SP. Add an initcall
to fetch this configuration and add it to the kernel command line.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boards/zii-common/Makefile | 2 +-
arch/arm/boards/zii-common/board.c | 44 +++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/boards/zii-common/board.c
diff --git a/arch/arm/boards/zii-common/Makefile b/arch/arm/boards/zii-common/Makefile
index 057f2a89c647..fcc5cdf97dd5 100644
--- a/arch/arm/boards/zii-common/Makefile
+++ b/arch/arm/boards/zii-common/Makefile
@@ -1 +1 @@
-obj-y += switch-cmd.o pn-fixup.o
+obj-y += board.o switch-cmd.o pn-fixup.o
diff --git a/arch/arm/boards/zii-common/board.c b/arch/arm/boards/zii-common/board.c
new file mode 100644
index 000000000000..254b09a7a768
--- /dev/null
+++ b/arch/arm/boards/zii-common/board.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 Zodiac Inflight Innovation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <globalvar.h>
+#include <init.h>
+
+static int rdu_networkconfig(void)
+{
+ static char *rdu_netconfig;
+ struct device_d *sp_dev;
+
+ if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx6qp-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx51-rdu1"))
+ return 0;
+
+ sp_dev = get_device_by_name("sp");
+ if (!sp_dev) {
+ pr_warn("no sp device found, network config not available!\n");
+ return -ENODEV;
+ }
+
+ rdu_netconfig = basprintf("ip=%s:::%s::eth0:",
+ dev_get_param(sp_dev, "ipaddr"),
+ dev_get_param(sp_dev, "netmask"));
+
+ globalvar_add_simple_string("linux.bootargs.rdu_network",
+ &rdu_netconfig);
+
+ return 0;
+}
+late_initcall(rdu_networkconfig);
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 5/6] ARM: rdu2: Add p/n based fixups for touchscreen and display panel
2019-03-13 10:56 [PATCH 1/6] ARM: add Zii common directory and move switch reset command Lucas Stach
` (2 preceding siblings ...)
2019-03-13 10:56 ` [PATCH 4/6] ARM: zii-common: fetch network config from SP Lucas Stach
@ 2019-03-13 10:56 ` Lucas Stach
2019-03-13 10:56 ` [PATCH 6/6] ARM: rdu2: patch DSA config Lucas Stach
2019-03-18 8:06 ` [PATCH 1/6] ARM: add Zii common directory and move switch reset command Sascha Hauer
5 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2019-03-13 10:56 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov, Chris Healy
RDU1 devices come in different varietes and, depending on
particular configuration, certain device tree nodes need to be
adjusted accoringly.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/boards/zii-imx6q-rdu2/board.c | 234 +++++++++++++++++++++++++
arch/arm/dts/imx6qdl-zii-rdu2.dtsi | 126 ++++++++++++-
2 files changed, 359 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boards/zii-imx6q-rdu2/board.c b/arch/arm/boards/zii-imx6q-rdu2/board.c
index 6352f49c5a07..1733897a1a40 100644
--- a/arch/arm/boards/zii-imx6q-rdu2/board.c
+++ b/arch/arm/boards/zii-imx6q-rdu2/board.c
@@ -23,6 +23,29 @@
#include <mach/imx6.h>
#include <net.h>
#include <linux/nvmem-consumer.h>
+#include "../zii-common/pn-fixup.h"
+
+enum rdu2_lcd_interface_type {
+ IT_SINGLE_LVDS,
+ IT_DUAL_LVDS,
+ IT_EDP
+};
+
+enum rdu2_lvds_busformat {
+ BF_NONE,
+ BF_JEIDA,
+ BF_SPWG
+};
+
+#define RDU2_LRU_FLAG_EGALAX BIT(0)
+
+struct rdu2_lru_fixup {
+ struct zii_pn_fixup fixup;
+ unsigned int flags;
+ enum rdu2_lcd_interface_type type;
+ enum rdu2_lvds_busformat bus_format;
+ const char *compatible;
+};
#define RDU2_DAC1_RESET IMX_GPIO_NR(1, 0)
#define RDU2_DAC2_RESET IMX_GPIO_NR(1, 2)
@@ -218,3 +241,214 @@ static int rdu2_i210_invm(void)
return 0;
}
late_initcall(rdu2_i210_invm);
+
+static int rdu2_fixup_egalax_ts(struct device_node *root, void *context)
+{
+ struct device_node *np;
+
+ /*
+ * The 32" unit has a EETI eGalax touchscreen instead of the
+ * Synaptics RMI4 found on other units.
+ */
+ pr_info("Enabling eGalax touchscreen instead of RMI4\n");
+
+ np = of_find_compatible_node(root, NULL, "syna,rmi4-i2c");
+ if (!np)
+ return -ENODEV;
+
+ of_device_disable(np);
+
+ np = of_find_compatible_node(root, NULL, "eeti,exc3000");
+ if (!np)
+ return -ENODEV;
+
+ of_device_enable(np);
+ of_property_write_u32(np->parent, "clock-frequency", 200000);
+
+
+ return 0;
+}
+
+static int rdu2_fixup_edp(struct device_node *root)
+{
+ const bool kernel_fixup = root != NULL;
+ struct device_node *np;
+
+ if (kernel_fixup) {
+ /*
+ * Kernel DT fixup needs this additional step
+ */
+ pr_info("Found eDP display, enabling parallel output "
+ "and eDP bridge.\n");
+ np = of_find_compatible_node(root, NULL,
+ "fsl,imx-parallel-display");
+ if (!np)
+ return -ENODEV;
+
+ of_device_enable(np);
+ }
+
+ np = of_find_compatible_node(root, NULL, "toshiba,tc358767");
+ if (!np)
+ return -ENODEV;
+
+ of_device_enable(np);
+
+ return 0;
+}
+
+static int rdu2_fixup_lvds(struct device_node *root,
+ const struct rdu2_lru_fixup *fixup)
+{
+ const bool kernel_fixup = root != NULL;
+ struct device_node *np;
+
+ /*
+ * LVDS panels need the correct compatible
+ */
+ pr_info("Found LVDS display, enabling %s channel LDB and "
+ "panel with compatible \"%s\".\n",
+ fixup->type == IT_DUAL_LVDS ? "dual" : "single",
+ fixup->compatible);
+ /*
+ * LVDS panels need the correct timings
+ */
+ np = of_find_node_by_name(root, "panel");
+ if (!np)
+ return -ENODEV;
+
+ if (kernel_fixup) {
+ of_device_enable(np);
+ of_property_write_string(np, "compatible", fixup->compatible);
+ } else {
+ struct device_node *child, *tmp;
+
+ of_device_enable_and_register(np);
+ /*
+ * Delete all mode entries, which aren't suited for the
+ * current display
+ */
+ np = of_find_node_by_name(np, "display-timings");
+ if (!np)
+ return -ENODEV;
+
+ for_each_child_of_node_safe(np, tmp, child) {
+ if (!of_device_is_compatible(child,
+ fixup->compatible))
+ of_delete_node(child);
+ }
+ }
+ /*
+ * enable LDB channel 0 and set correct interface mode
+ */
+ np = of_find_compatible_node(root, NULL, "fsl,imx6q-ldb");
+ if (!np)
+ return -ENODEV;
+
+ if (kernel_fixup)
+ of_device_enable(np);
+ else
+ of_device_enable_and_register(np);
+
+ if (fixup->type == IT_DUAL_LVDS)
+ of_set_property(np, "fsl,dual-channel", NULL, 0, 1);
+
+ np = of_find_node_by_name(np, "lvds-channel@0");
+ if (!np)
+ return -ENODEV;
+
+ of_device_enable(np);
+
+ if (!kernel_fixup) {
+ of_property_write_string(np, "fsl,data-mapping",
+ fixup->bus_format == BF_SPWG ?
+ "spwg" : "jeida");
+ }
+
+ return 0;
+}
+
+static int rdu2_fixup_display(struct device_node *root, void *context)
+{
+ const struct rdu2_lru_fixup *fixup = context;
+ /*
+ * If the panel is eDP, just enable the parallel output and
+ * eDP bridge
+ */
+ if (fixup->type == IT_EDP)
+ return rdu2_fixup_edp(root);
+
+ return rdu2_fixup_lvds(root, context);
+}
+
+static void rdu2_lru_fixup(const struct zii_pn_fixup *context)
+{
+ const struct rdu2_lru_fixup *fixup =
+ container_of(context, struct rdu2_lru_fixup, fixup);
+
+ WARN_ON(rdu2_fixup_display(NULL, (void *)context));
+ of_register_fixup(rdu2_fixup_display, (void *)context);
+
+ if (fixup->flags & RDU2_LRU_FLAG_EGALAX)
+ of_register_fixup(rdu2_fixup_egalax_ts, NULL);
+}
+
+#define RDU2_LRU_FIXUP(__pn, __flags, __panel) \
+ { \
+ { __pn, rdu2_lru_fixup }, \
+ __flags, \
+ __panel \
+ }
+
+#define RDU2_PANEL_10P1 IT_SINGLE_LVDS, BF_SPWG, "innolux,g121i1-l01"
+#define RDU2_PANEL_11P6 IT_EDP, BF_NONE, NULL
+#define RDU2_PANEL_12P1 IT_SINGLE_LVDS, BF_SPWG, "nec,nl12880bc20-05"
+#define RDU2_PANEL_13P3 IT_DUAL_LVDS, BF_JEIDA, "auo,g133han01"
+#define RDU2_PANEL_15P6 IT_DUAL_LVDS, BF_SPWG, "nlt,nl192108ac18-02d"
+#define RDU2_PANEL_18P5 IT_DUAL_LVDS, BF_SPWG, "auo,g185han01"
+#define RDU2_PANEL_32P0 IT_DUAL_LVDS, BF_SPWG, "auo,p320hvn03"
+
+static const struct rdu2_lru_fixup rdu2_lru_fixups[] = {
+ RDU2_LRU_FIXUP("00-5122-01", 0, RDU2_PANEL_12P1),
+ RDU2_LRU_FIXUP("00-5122-02", 0, RDU2_PANEL_12P1),
+ RDU2_LRU_FIXUP("00-5120-01", 0, RDU2_PANEL_10P1),
+ RDU2_LRU_FIXUP("00-5120-02", 0, RDU2_PANEL_10P1),
+ RDU2_LRU_FIXUP("00-5120-51", 0, RDU2_PANEL_10P1),
+ RDU2_LRU_FIXUP("00-5120-52", 0, RDU2_PANEL_10P1),
+ RDU2_LRU_FIXUP("00-5123-01", 0, RDU2_PANEL_11P6),
+ RDU2_LRU_FIXUP("00-5123-02", 0, RDU2_PANEL_11P6),
+ RDU2_LRU_FIXUP("00-5123-03", 0, RDU2_PANEL_11P6),
+ RDU2_LRU_FIXUP("00-5123-51", 0, RDU2_PANEL_11P6),
+ RDU2_LRU_FIXUP("00-5123-52", 0, RDU2_PANEL_11P6),
+ RDU2_LRU_FIXUP("00-5123-53", 0, RDU2_PANEL_11P6),
+ RDU2_LRU_FIXUP("00-5124-01", 0, RDU2_PANEL_13P3),
+ RDU2_LRU_FIXUP("00-5124-02", 0, RDU2_PANEL_13P3),
+ RDU2_LRU_FIXUP("00-5124-03", 0, RDU2_PANEL_13P3),
+ RDU2_LRU_FIXUP("00-5124-53", 0, RDU2_PANEL_13P3),
+ RDU2_LRU_FIXUP("00-5127-01", 0, RDU2_PANEL_15P6),
+ RDU2_LRU_FIXUP("00-5127-02", 0, RDU2_PANEL_15P6),
+ RDU2_LRU_FIXUP("00-5127-03", 0, RDU2_PANEL_15P6),
+ RDU2_LRU_FIXUP("00-5127-53", 0, RDU2_PANEL_15P6),
+ RDU2_LRU_FIXUP("00-5125-01", 0, RDU2_PANEL_18P5),
+ RDU2_LRU_FIXUP("00-5125-02", 0, RDU2_PANEL_18P5),
+ RDU2_LRU_FIXUP("00-5125-03", 0, RDU2_PANEL_18P5),
+ RDU2_LRU_FIXUP("00-5125-53", 0, RDU2_PANEL_18P5),
+ RDU2_LRU_FIXUP("00-5132-01", RDU2_LRU_FLAG_EGALAX, RDU2_PANEL_32P0),
+ RDU2_LRU_FIXUP("00-5132-02", RDU2_LRU_FLAG_EGALAX, RDU2_PANEL_32P0),
+};
+
+/*
+ * This initcall needs to be executed before coredevices, so we have a chance
+ * to fix up the internal DT with the correct display information.
+ */
+static int rdu2_process_fixups(void)
+{
+ if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
+ return 0;
+
+ zii_process_lru_fixups(rdu2_lru_fixups);
+
+ return 0;
+}
+postmmu_initcall(rdu2_process_fixups);
diff --git a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
index fea219f1e15a..bfc75ba606d6 100644
--- a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
+++ b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
@@ -49,6 +49,11 @@
};
};
+ device-info {
+ nvmem-cells = <&lru_part_number>;
+ nvmem-cell-names = "lru-part-number";
+ };
+
aliases {
ethernet0 = &fec;
ethernet1 = &i210;
@@ -59,8 +64,96 @@
*/
switch-eeprom = &switch;
};
-};
+ panel {
+ compatible = "simple-panel";
+ /* Timings for all supported panels, the correct one is enabled
+ * after the board data has been retrieved from the environment
+ * controller
+ */
+
+ display-timings {
+ innolux-g121i1-l01 {
+ compatible = "innolux,g121i1-l01";
+
+ hback-porch = <79>;
+ hfront-porch = <80>;
+ hactive = <1280>;
+ hsync-len = <1>;
+ vback-porch = <11>;
+ vfront-porch = <11>;
+ vactive = <800>;
+ vsync-len = <1>;
+ clock-frequency = <71000000>;
+ };
+ nec-nl12880bc20-05 {
+ compatible = "nec,nl12880bc20-05";
+
+ hback-porch = <100>;
+ hfront-porch = <30>;
+ hactive = <1280>;
+ hsync-len = <30>;
+ vback-porch = <11>;
+ vfront-porch = <5>;
+ vactive = <800>;
+ vsync-len = <7>;
+ clock-frequency = <71000000>;
+ };
+ auo-g133han01 {
+ compatible = "auo,g133han01";
+
+ hback-porch = <88>;
+ hfront-porch = <58>;
+ hactive = <1920>;
+ hsync-len = <42>;
+ vback-porch = <14>;
+ vfront-porch = <8>;
+ vactive = <1080>;
+ vsync-len = <14>;
+ clock-frequency = <141200000>;
+ };
+ auo-g185han01 {
+ compatible = "auo,g185han01";
+
+ hback-porch = <44>;
+ hfront-porch = <60>;
+ hactive = <1920>;
+ hsync-len = <24>;
+ vback-porch = <5>;
+ vfront-porch = <10>;
+ vactive = <1080>;
+ vsync-len = <5>;
+ clock-frequency = <144000000>;
+ };
+ nlt-nl192108ac18-02d {
+ compatible = "nlt,nl192108ac18-02d";
+
+ hback-porch = <120>;
+ hfront-porch = <100>;
+ hactive = <1920>;
+ hsync-len = <60>;
+ vback-porch = <10>;
+ vfront-porch = <30>;
+ vactive = <1080>;
+ vsync-len = <5>;
+ clock-frequency = <148350000>;
+ };
+ auo-p320hvn03 {
+ compatible = "auo,p320hvn03";
+
+ hback-porch = <50>;
+ hfront-porch = <50>;
+ hactive = <1920>;
+ hsync-len = <40>;
+ vback-porch = <17>;
+ vfront-porch = <17>;
+ vactive = <1080>;
+ vsync-len = <11>;
+ clock-frequency = <148500000>;
+ };
+ };
+ };
+};
&uart4 {
rave-sp {
@@ -73,6 +166,11 @@
};
eeprom@a4 {
+ lru_part_number: lru-part-number@21 {
+ reg = <0x21 15>;
+ read-only;
+ };
+
boot_source: boot-source@83 {
reg = <0x83 1>;
};
@@ -110,12 +208,38 @@
nvmem-cell-names = "mac-address";
};
+&i2c1 {
+ edp-bridge@68 {
+ pinctrl-0 = <&pinctrl_tc358767>, <&pinctrl_disp0>;
+
+ ports {
+ port@1 {
+ reg = <1>;
+
+ tc358767_in: endpoint {
+ remote-endpoint = <&disp0_out>;
+ };
+ };
+ };
+ };
+};
+
&i2c2 {
temp-sense@48 {
barebox,sensor-name = "Temp Sensor 1";
};
};
+&ipu1_di0_disp0 {
+ remote-endpoint = <&tc358767_in>;
+};
+
+&ldb {
+ lvds-channel@0 {
+ fsl,data-width = <24>;
+ };
+};
+
&i210 {
nvmem-cells = <&mac_address_1>;
nvmem-cell-names = "mac-address";
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 6/6] ARM: rdu2: patch DSA config
2019-03-13 10:56 [PATCH 1/6] ARM: add Zii common directory and move switch reset command Lucas Stach
` (3 preceding siblings ...)
2019-03-13 10:56 ` [PATCH 5/6] ARM: rdu2: Add p/n based fixups for touchscreen and display panel Lucas Stach
@ 2019-03-13 10:56 ` Lucas Stach
2019-03-18 8:06 ` [PATCH 1/6] ARM: add Zii common directory and move switch reset command Sascha Hauer
5 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2019-03-13 10:56 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov, Chris Healy
From: Andrey Smirnov <andrew.smirnov@gmail.com>
This patches the DSA switch config in the kernel DT if the unit is
a 12.1" one, which doesn't have the FEC wired up to the switch.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[andrew.smirnov@gmail.com: Ported the patch to use p/n fixups]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/boards/zii-imx6q-rdu2/board.c | 46 ++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boards/zii-imx6q-rdu2/board.c b/arch/arm/boards/zii-imx6q-rdu2/board.c
index 1733897a1a40..344a654f23f1 100644
--- a/arch/arm/boards/zii-imx6q-rdu2/board.c
+++ b/arch/arm/boards/zii-imx6q-rdu2/board.c
@@ -38,6 +38,7 @@ enum rdu2_lvds_busformat {
};
#define RDU2_LRU_FLAG_EGALAX BIT(0)
+#define RDU2_LRU_FLAG_NO_FEC BIT(1)
struct rdu2_lru_fixup {
struct zii_pn_fixup fixup;
@@ -269,6 +270,44 @@ static int rdu2_fixup_egalax_ts(struct device_node *root, void *context)
return 0;
}
+static int rdu2_fixup_dsa(struct device_node *root, void *context)
+{
+ struct device_node *switch_np, *np;
+ phandle i210_handle;
+
+ /*
+ * The 12.1" unit has no FEC connection, so we need to rewrite
+ * the i210 port into the CPU port and delete the FEC port,
+ * which is part of the common setup.
+ */
+ pr_info("Rewriting i210 switch port into CPU port\n");
+
+ switch_np = of_find_compatible_node(root, NULL, "marvell,mv88e6085");
+ if (!switch_np)
+ return -ENODEV;
+
+ np = of_find_node_by_name(switch_np, "port@2");
+ if (!np)
+ return -ENODEV;
+
+ of_delete_node(np);
+
+ np = of_find_node_by_name(root, "i210@0");
+ if (!np)
+ return -ENODEV;
+
+ i210_handle = of_node_create_phandle(np);
+
+ np = of_find_node_by_name(switch_np, "port@0");
+ if (!np)
+ return -ENODEV;
+
+ of_property_write_u32(np, "ethernet", i210_handle);
+ of_property_write_string(np, "label", "cpu");
+
+ return 0;
+}
+
static int rdu2_fixup_edp(struct device_node *root)
{
const bool kernel_fixup = root != NULL;
@@ -391,6 +430,9 @@ static void rdu2_lru_fixup(const struct zii_pn_fixup *context)
if (fixup->flags & RDU2_LRU_FLAG_EGALAX)
of_register_fixup(rdu2_fixup_egalax_ts, NULL);
+
+ if (fixup->flags & RDU2_LRU_FLAG_NO_FEC)
+ of_register_fixup(rdu2_fixup_dsa, NULL);
}
#define RDU2_LRU_FIXUP(__pn, __flags, __panel) \
@@ -409,8 +451,8 @@ static void rdu2_lru_fixup(const struct zii_pn_fixup *context)
#define RDU2_PANEL_32P0 IT_DUAL_LVDS, BF_SPWG, "auo,p320hvn03"
static const struct rdu2_lru_fixup rdu2_lru_fixups[] = {
- RDU2_LRU_FIXUP("00-5122-01", 0, RDU2_PANEL_12P1),
- RDU2_LRU_FIXUP("00-5122-02", 0, RDU2_PANEL_12P1),
+ RDU2_LRU_FIXUP("00-5122-01", RDU2_LRU_FLAG_NO_FEC, RDU2_PANEL_12P1),
+ RDU2_LRU_FIXUP("00-5122-02", RDU2_LRU_FLAG_NO_FEC, RDU2_PANEL_12P1),
RDU2_LRU_FIXUP("00-5120-01", 0, RDU2_PANEL_10P1),
RDU2_LRU_FIXUP("00-5120-02", 0, RDU2_PANEL_10P1),
RDU2_LRU_FIXUP("00-5120-51", 0, RDU2_PANEL_10P1),
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/6] ARM: add Zii common directory and move switch reset command
2019-03-13 10:56 [PATCH 1/6] ARM: add Zii common directory and move switch reset command Lucas Stach
` (4 preceding siblings ...)
2019-03-13 10:56 ` [PATCH 6/6] ARM: rdu2: patch DSA config Lucas Stach
@ 2019-03-18 8:06 ` Sascha Hauer
5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-03-18 8:06 UTC (permalink / raw)
To: Lucas Stach; +Cc: Andrey Smirnov, barebox, Chris Healy
On Wed, Mar 13, 2019 at 11:56:30AM +0100, Lucas Stach wrote:
> The Zii boards share some functionality across different boards. Add
> a common directory, so we can implement this once and use across
> different boards.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> arch/arm/boards/Makefile | 1 +
> arch/arm/boards/zii-common/Makefile | 1 +
> arch/arm/boards/{zii-imx6q-rdu2 => zii-common}/switch-cmd.c | 0
> arch/arm/boards/zii-imx6q-rdu2/Makefile | 2 +-
> arch/arm/mach-imx/Kconfig | 4 ++++
> 5 files changed, 7 insertions(+), 1 deletion(-)
> create mode 100644 arch/arm/boards/zii-common/Makefile
> rename arch/arm/boards/{zii-imx6q-rdu2 => zii-common}/switch-cmd.c (100%)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-03-18 8:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 10:56 [PATCH 1/6] ARM: add Zii common directory and move switch reset command Lucas Stach
2019-03-13 10:56 ` [PATCH 2/6] ARM: zii-common: add support for switch reset on RDU1 Lucas Stach
2019-03-13 10:56 ` [PATCH 3/6] ARM: zii-common: introduce RDU part-number based fixup abstraction Lucas Stach
2019-03-13 10:56 ` [PATCH 4/6] ARM: zii-common: fetch network config from SP Lucas Stach
2019-03-13 10:56 ` [PATCH 5/6] ARM: rdu2: Add p/n based fixups for touchscreen and display panel Lucas Stach
2019-03-13 10:56 ` [PATCH 6/6] ARM: rdu2: patch DSA config Lucas Stach
2019-03-18 8:06 ` [PATCH 1/6] ARM: add Zii common directory and move switch reset command Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox