summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2020-02-24 13:30:37 +0100
committerMax Krummenacher <max.krummenacher@toradex.com>2020-03-21 15:14:54 +0100
commit3546f6693d6e7cc903573e709ae177bc0d99acbd (patch)
tree395863bd2577275502cd250e9d5087ec358da0ab
parent17ac8e6eec41dc8e391fbb76ad050fea79dd2686 (diff)
linux-toradex-mainline-4.14: drop recipe
With 'c6427ee apalis-tk1-mainline: use 5.4 kernel' linux-toradex-mainline-4.14 is no longer used. For a mainlinish kernel linux-toradex-mainline in meta-toradex-bsp is now used. This currently builds a 5.4.y based kernel. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0001-apalis-t30-tk1-mainline-customize-defconfig.patch85
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0001-perf-Make-perf-able-to-build-with-latest-libbfd.patch61
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0002-apalis_t30-tk1-fix-pcie-clock-and-reset-not-conformi.patch153
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0003-igb-integrate-tools-only-device-support.patch74
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0004-apalis_t30-tk1-igb-no-nvm-and-Ethernet-MAC-address-h.patch136
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0005-mmc-tegra-apalis-tk1-hack-to-make-sd1-functional.patch52
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0006-apalis-colibri_t30-apalis-tk1-snapd-squashfs-configu.patch41
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0007-ARM-tegra-apalis-tk1-Support-v1.2-hardware-revision.patch2359
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0008-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch140
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0009-drm-tegra-gem-Reshuffle-declarations.patch36
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch68
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0011-drm-tegra-fb-Implement-fb_mmap-callback.patch59
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0012-apalis-tk1-support-for-k20-mfd.patch3185
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0013-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra30.patch33
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0014-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra114-124.patch39
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch64
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0017-mmc-read-mmc-alias-from-device-tree.patch69
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0018-apalis-t30-mainline-force-fixed-ids-for-sdmmc-contro.patch45
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0019-ARM-tegra-apalis-tk1-Fix-high-speed-UART-compatible.patch73
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0020-apalis-t30-tk1-mainline-igb-avoid-nvm-checksum-failu.patch36
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0021-apalis_t30-fix-can2.patch34
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0022-mfd-as3722-disable-auto-power-on-when-AC-OK.patch88
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0023-apalis-tk1-mfd-k20-update-api-header-for-fw-version-.patch48
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0024-apalis_t30-enable-broken-hpi-on-emmc.patch39
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0026-apalis_t30-fix-mmc1-cmd-pull-up.patch41
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0027-apalis_t30-pull-up-sd-card-detect-pins.patch41
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0028-Revert-mmc-tegra-Disable-UHS-I-modes-for-Tegra124.patch31
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0029-mmc-tegra-fix-eMMC-DDR-mode.patch33
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0030-apalis-tk1-enable-ddr52-mode-on-emmc.patch49
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0031-apalis-tk1-force-fixed-ids-for-sdmmc-controllers.patch104
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0032-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch329
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0033-apalis-tk1-mfd-k20-supporte-for-fw-version-1.3.patch562
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0034-apalis-tk1-mfd-k20-update-supported-fw-version-to-1..patch174
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0035-perf-tools-Add-Python-3-support.patch915
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/apalis-t30-mainline/0033-apalis-t30-mainline-apply-pcie-fix-hacks.patch31
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline_4.14.bb99
36 files changed, 0 insertions, 9426 deletions
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0001-apalis-t30-tk1-mainline-customize-defconfig.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0001-apalis-t30-tk1-mainline-customize-defconfig.patch
deleted file mode 100644
index 7bc0054..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0001-apalis-t30-tk1-mainline-customize-defconfig.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From 6654e1bd342708a683daf47e7558455f709a3e7e Mon Sep 17 00:00:00 2001
-Message-Id: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Dominik Sliwa <dominik.sliwa@toradex.com>
-Date: Thu, 15 Dec 2016 10:40:06 +0100
-Subject: [PATCH 01/33] apalis-t30/tk1-mainline: customize defconfig
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/configs/tegra_defconfig | 19 ++++++++++++++++---
- 1 file changed, 16 insertions(+), 3 deletions(-)
-
-diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
-index 6678f2929356..cb97ea2db1e0 100644
---- a/arch/arm/configs/tegra_defconfig
-+++ b/arch/arm/configs/tegra_defconfig
-@@ -104,9 +104,21 @@ CONFIG_USB_PEGASUS=y
- CONFIG_USB_USBNET=y
- CONFIG_USB_NET_SMSC75XX=y
- CONFIG_USB_NET_SMSC95XX=y
-+CONFIG_ATH9K=m
-+CONFIG_ATH9K_CHANNEL_CONTEXT=y
-+CONFIG_ATH9K_HTC=m
-+CONFIG_ATH10K=m
-+CONFIG_ATH10K_PCI=m
-+# CONFIG_WLAN_VENDOR_ATMEL is not set
- CONFIG_BRCMFMAC=m
-+CONFIG_IWLWIFI=m
-+CONFIG_IWLDVM=m
-+CONFIG_IWLMVM=m
- CONFIG_RT2X00=y
- CONFIG_RT2800USB=m
-+CONFIG_RTL_CARDS=m
-+CONFIG_RTL8192CU=m
-+CONFIG_RSI_91X=m
- CONFIG_INPUT_JOYDEV=y
- CONFIG_INPUT_EVDEV=y
- CONFIG_KEYBOARD_GPIO=y
-@@ -180,6 +192,7 @@ CONFIG_USB_GSPCA=y
- CONFIG_DRM=y
- CONFIG_DRM_NOUVEAU=m
- CONFIG_DRM_TEGRA=y
-+CONFIG_DRM_TEGRA_STAGING=y
- CONFIG_DRM_PANEL_SIMPLE=y
- # CONFIG_LCD_CLASS_DEVICE is not set
- # CONFIG_BACKLIGHT_GENERIC is not set
-@@ -213,7 +226,7 @@ CONFIG_SND_SOC_TEGRA_MAX98090=y
- CONFIG_SND_SOC_TEGRA_SGTL5000=y
- CONFIG_USB=y
- CONFIG_USB_XHCI_HCD=y
--CONFIG_USB_XHCI_TEGRA=y
-+CONFIG_USB_XHCI_TEGRA=m
- CONFIG_USB_EHCI_HCD=y
- CONFIG_USB_EHCI_TEGRA=y
- CONFIG_USB_ACM=y
-@@ -227,11 +240,9 @@ CONFIG_MMC_BLOCK_MINORS=16
- CONFIG_MMC_SDHCI=y
- CONFIG_MMC_SDHCI_PLTFM=y
- CONFIG_MMC_SDHCI_TEGRA=y
--CONFIG_NEW_LEDS=y
- CONFIG_LEDS_CLASS=y
- CONFIG_LEDS_GPIO=y
- CONFIG_LEDS_PWM=y
--CONFIG_LEDS_TRIGGERS=y
- CONFIG_LEDS_TRIGGER_TIMER=y
- CONFIG_LEDS_TRIGGER_ONESHOT=y
- CONFIG_LEDS_TRIGGER_HEARTBEAT=y
-@@ -251,6 +262,7 @@ CONFIG_RTC_DRV_TEGRA=y
- CONFIG_DMADEVICES=y
- CONFIG_TEGRA20_APB_DMA=y
- CONFIG_STAGING=y
-+CONFIG_R8188EU=m
- CONFIG_MFD_NVEC=y
- CONFIG_KEYBOARD_NVEC=y
- CONFIG_SERIO_NVEC_PS2=y
-@@ -279,6 +291,7 @@ CONFIG_EXT3_FS=y
- CONFIG_EXT3_FS_POSIX_ACL=y
- CONFIG_EXT3_FS_SECURITY=y
- # CONFIG_DNOTIFY is not set
-+CONFIG_AUTOFS4_FS=y
- CONFIG_VFAT_FS=y
- CONFIG_TMPFS=y
- CONFIG_TMPFS_POSIX_ACL=y
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0001-perf-Make-perf-able-to-build-with-latest-libbfd.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0001-perf-Make-perf-able-to-build-with-latest-libbfd.patch
deleted file mode 100644
index 2c5926b..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0001-perf-Make-perf-able-to-build-with-latest-libbfd.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From b8365d06ca691301985c4a6fd7c6896cba1fa4b4 Mon Sep 17 00:00:00 2001
-From: Changbin Du <changbin.du@gmail.com>
-Date: Tue, 28 Jan 2020 23:29:38 +0800
-Subject: [PATCH] perf: Make perf able to build with latest libbfd
-
-libbfd has changed the bfd_section_* macros to inline functions
-bfd_section_<field> since 2019-09-18. See below two commits:
- o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
- o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html
-
-This fix make perf able to build with both old and new libbfd.
-
-Signed-off-by: Changbin Du <changbin.du@gmail.com>
-Acked-by: Jiri Olsa <jolsa@redhat.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: http://lore.kernel.org/lkml/20200128152938.31413-1-changbin.du@gmail.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-(cherry picked from commit 0ada120c883d4f1f6aafd01cf0fbb10d8bbba015)
----
- tools/perf/util/srcline.c | 16 +++++++++++++++-
- 1 file changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
-index 4105682afc7a..774412c4d98c 100644
---- a/tools/perf/util/srcline.c
-+++ b/tools/perf/util/srcline.c
-@@ -139,16 +139,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
- bfd_vma pc, vma;
- bfd_size_type size;
- struct a2l_data *a2l = data;
-+ flagword flags;
-
- if (a2l->found)
- return;
-
-- if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
-+#ifdef bfd_get_section_flags
-+ flags = bfd_get_section_flags(abfd, section);
-+#else
-+ flags = bfd_section_flags(section);
-+#endif
-+ if ((flags & SEC_ALLOC) == 0)
- return;
-
- pc = a2l->addr;
-+#ifdef bfd_get_section_vma
- vma = bfd_get_section_vma(abfd, section);
-+#else
-+ vma = bfd_section_vma(section);
-+#endif
-+#ifdef bfd_get_section_size
- size = bfd_get_section_size(section);
-+#else
-+ size = bfd_section_size(section);
-+#endif
-
- if (pc < vma || pc >= vma + size)
- return;
---
-2.20.1
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0002-apalis_t30-tk1-fix-pcie-clock-and-reset-not-conformi.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0002-apalis_t30-tk1-fix-pcie-clock-and-reset-not-conformi.patch
deleted file mode 100644
index c462ac7..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0002-apalis_t30-tk1-fix-pcie-clock-and-reset-not-conformi.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-From a7c1d4dfb4404c892823aa809993f00426d039bc Mon Sep 17 00:00:00 2001
-Message-Id: <a7c1d4dfb4404c892823aa809993f00426d039bc.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Thu, 15 Dec 2016 10:24:58 +0100
-Subject: [PATCH 02/33] apalis_t30/tk1: fix pcie clock and reset not conforming
- to specification
-
-Fix PCIe clock and reset not conforming to specification by moving PCIe
-reset handling including the PLX PEX 8605 errata 5 workaround from the
-board platform data into the right places timing wise in the PCIe driver
-itself.
-
-Also add a kernel command line argument to allow using the Apalis GPIO7
-as a regular GPIO rather than for above mentioned PLX PEX 8605
-workaround:
-
-pex_perst=0
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-(cherry picked from toradex_tk1_l4t_r21.5 commit
-3e2259b04c2e2c029f742e9dda06a3a2739977d4)
-(cherry picked from tegra commit
-a2f63805703b43d55d91ae17f10d0049bf0f625e)
----
- drivers/pci/host/pci-tegra.c | 88 ++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 88 insertions(+)
-
-diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
-index 1987fec1f126..5c7916b5de73 100644
---- a/drivers/pci/host/pci-tegra.c
-+++ b/drivers/pci/host/pci-tegra.c
-@@ -51,6 +51,34 @@
- #include <soc/tegra/cpuidle.h>
- #include <soc/tegra/pmc.h>
-
-+//#define CONFIG_MACH_APALIS_T30
-+#define CONFIG_MACH_APALIS_TK1
-+#if defined(CONFIG_MACH_APALIS_T30) || defined(CONFIG_MACH_APALIS_TK1)
-+#include <linux/gpio.h>
-+
-+#include "../../../include/dt-bindings/gpio/tegra-gpio.h"
-+
-+#ifdef CONFIG_MACH_APALIS_T30
-+#define APALIS_GPIO7 TEGRA_GPIO(S, 7)
-+
-+#define LAN_RESET_N -1
-+
-+#define PEX_PERST_N APALIS_GPIO7
-+
-+#define RESET_MOCI_N TEGRA_GPIO(I, 4)
-+#endif
-+
-+#ifdef CONFIG_MACH_APALIS_TK1
-+#define APALIS_GPIO7 TEGRA_GPIO(DD, 1)
-+
-+#define LAN_RESET_N TEGRA_GPIO(S, 2)
-+
-+#define PEX_PERST_N APALIS_GPIO7
-+
-+#define RESET_MOCI_N TEGRA_GPIO(U, 4)
-+#endif
-+#endif
-+
- #define INT_PCI_MSI_NR (8 * 32)
-
- /* register definitions */
-@@ -323,6 +351,26 @@ struct tegra_pcie_bus {
- unsigned int nr;
- };
-
-+#if defined(CONFIG_MACH_APALIS_T30) || defined(CONFIG_MACH_APALIS_TK1)
-+/* To disable the PCIe switch reset errata workaround */
-+int g_pex_perst = 1;
-+
-+/* To disable the PCIe switch reset errata workaround */
-+static int __init disable_pex_perst(char *s)
-+{
-+ if (!(*s) || !strcmp(s, "0"))
-+ g_pex_perst = 0;
-+
-+ return 0;
-+}
-+__setup("pex_perst=", disable_pex_perst);
-+#endif /* CONFIG_MACH_APALIS_T30 || CONFIG_MACH_APALIS_TK1 */
-+
-+static inline struct tegra_pcie *sys_to_pcie(struct pci_sys_data *sys)
-+{
-+ return sys->private_data;
-+}
-+
- static inline void afi_writel(struct tegra_pcie *pcie, u32 value,
- unsigned long offset)
- {
-@@ -526,6 +574,27 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
- unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
- unsigned long value;
-
-+#if defined(CONFIG_MACH_APALIS_T30) || defined(CONFIG_MACH_APALIS_TK1)
-+ /*
-+ * Reset PLX PEX 8605 PCIe Switch plus PCIe devices on Apalis Evaluation
-+ * Board
-+ */
-+ if (g_pex_perst)
-+ gpio_request(PEX_PERST_N, "PEX_PERST_N");
-+ gpio_request(RESET_MOCI_N, "RESET_MOCI_N");
-+ if (g_pex_perst)
-+ gpio_direction_output(PEX_PERST_N, 0);
-+ gpio_direction_output(RESET_MOCI_N, 0);
-+
-+#ifdef CONFIG_MACH_APALIS_TK1
-+ /* Reset I210 Gigabit Ethernet Controller */
-+ if (LAN_RESET_N) {
-+ gpio_request(LAN_RESET_N, "LAN_RESET_N");
-+ gpio_direction_output(LAN_RESET_N, 0);
-+ }
-+#endif /* CONFIG_MACH_APALIS_TK1 */
-+#endif /* CONFIG_MACH_APALIS_T30 || CONFIG_MACH_APALIS_TK1 */
-+
- /* pulse reset signal */
- value = afi_readl(port->pcie, ctrl);
- value &= ~AFI_PEX_CTRL_RST;
-@@ -536,6 +605,25 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
- value = afi_readl(port->pcie, ctrl);
- value |= AFI_PEX_CTRL_RST;
- afi_writel(port->pcie, value, ctrl);
-+
-+#if defined(CONFIG_MACH_APALIS_T30) || defined(CONFIG_MACH_APALIS_TK1)
-+ /* Must be asserted for 100 ms after power and clocks are stable */
-+ if (g_pex_perst)
-+ gpio_set_value(PEX_PERST_N, 1);
-+ /*
-+ * Err_5: PEX_REFCLK_OUTpx/nx Clock Outputs is not Guaranteed Until
-+ * 900 us After PEX_PERST# De-assertion
-+ */
-+ if (g_pex_perst)
-+ mdelay(1);
-+ gpio_set_value(RESET_MOCI_N, 1);
-+
-+#ifdef CONFIG_MACH_APALIS_TK1
-+ /* Release I210 Gigabit Ethernet Controller Reset */
-+ if (LAN_RESET_N)
-+ gpio_set_value(LAN_RESET_N, 1);
-+#endif /* CONFIG_MACH_APALIS_TK1 */
-+#endif /* CONFIG_MACH_APALIS_T30 || CONFIG_MACH_APALIS_TK1 */
- }
-
- static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0003-igb-integrate-tools-only-device-support.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0003-igb-integrate-tools-only-device-support.patch
deleted file mode 100644
index a9765a2..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0003-igb-integrate-tools-only-device-support.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From b0d16f4567ffe86b2e4611cb61ebf9fd74eee481 Mon Sep 17 00:00:00 2001
-Message-Id: <b0d16f4567ffe86b2e4611cb61ebf9fd74eee481.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Thu, 15 Dec 2016 10:55:11 +0100
-Subject: [PATCH 03/33] igb: integrate tools only device support
-
-Springville/i211 with a blank Flash/iNVM use different PCI IDs. Extend
-the driver to load despite i210/i211 data sheets claiming tools only,
-not for driver.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-(cherry picked from toradex_tk1_l4t_r21.5 commit
-783780c43fd4e1473fb64790c8b9e0adb2be04a3)
-(cherry picked from tegra commit
-2c7123458270c9b3ec9b5ed668f9d55a7f8dbad9)
----
- drivers/net/ethernet/intel/igb/e1000_82575.c | 2 ++
- drivers/net/ethernet/intel/igb/e1000_hw.h | 2 ++
- drivers/net/ethernet/intel/igb/igb_main.c | 2 ++
- 3 files changed, 6 insertions(+)
-
-diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
-index c37cc8bccf47..d38d8a76ce92 100644
---- a/drivers/net/ethernet/intel/igb/e1000_82575.c
-+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
-@@ -625,6 +625,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
- case E1000_DEV_ID_I350_SGMII:
- mac->type = e1000_i350;
- break;
-+ case E1000_DEV_ID_I210_TOOLS_ONLY:
- case E1000_DEV_ID_I210_COPPER:
- case E1000_DEV_ID_I210_FIBER:
- case E1000_DEV_ID_I210_SERDES:
-@@ -633,6 +634,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
- case E1000_DEV_ID_I210_SERDES_FLASHLESS:
- mac->type = e1000_i210;
- break;
-+ case E1000_DEV_ID_I211_TOOLS_ONLY:
- case E1000_DEV_ID_I211_COPPER:
- mac->type = e1000_i211;
- break;
-diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h
-index 6c9485ab4b57..a3827f182df9 100644
---- a/drivers/net/ethernet/intel/igb/e1000_hw.h
-+++ b/drivers/net/ethernet/intel/igb/e1000_hw.h
-@@ -58,6 +58,8 @@ struct e1000_hw;
- #define E1000_DEV_ID_I350_FIBER 0x1522
- #define E1000_DEV_ID_I350_SERDES 0x1523
- #define E1000_DEV_ID_I350_SGMII 0x1524
-+#define E1000_DEV_ID_I210_TOOLS_ONLY 0x1531
-+#define E1000_DEV_ID_I211_TOOLS_ONLY 0x1532
- #define E1000_DEV_ID_I210_COPPER 0x1533
- #define E1000_DEV_ID_I210_FIBER 0x1536
- #define E1000_DEV_ID_I210_SERDES 0x1537
-diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
-index 6ca580cdfd84..94ac43034033 100644
---- a/drivers/net/ethernet/intel/igb/igb_main.c
-+++ b/drivers/net/ethernet/intel/igb/igb_main.c
-@@ -77,7 +77,9 @@ static const struct pci_device_id igb_pci_tbl[] = {
- { PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_BACKPLANE_1GBPS) },
- { PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_SGMII) },
- { PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_BACKPLANE_2_5GBPS) },
-+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_I211_TOOLS_ONLY), board_82575 },
- { PCI_VDEVICE(INTEL, E1000_DEV_ID_I211_COPPER), board_82575 },
-+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_TOOLS_ONLY), board_82575 },
- { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_COPPER), board_82575 },
- { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_FIBER), board_82575 },
- { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_SERDES), board_82575 },
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0004-apalis_t30-tk1-igb-no-nvm-and-Ethernet-MAC-address-h.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0004-apalis_t30-tk1-igb-no-nvm-and-Ethernet-MAC-address-h.patch
deleted file mode 100644
index 4fa1ccb..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0004-apalis_t30-tk1-igb-no-nvm-and-Ethernet-MAC-address-h.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-From 934ba9a81ce07365edb96fcbf227783d0372bdb9 Mon Sep 17 00:00:00 2001
-Message-Id: <934ba9a81ce07365edb96fcbf227783d0372bdb9.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Thu, 15 Dec 2016 10:55:54 +0100
-Subject: [PATCH 04/33] apalis_t30/tk1: igb: no nvm and Ethernet MAC address
- handling
-
-Only warn rather than fail on NVM validation failures on Apalis T30 and
-Apalis TK1.
-
-Revise Ethernet MAC address assignment: should now handle up to two
-instances of custom user MACs (2nd one with a 0x100000 offset). This
-way customer does not have to worry about NVM on a secondary Ethernet
-on the carrier board and still gets a valid official MAC address from
-us (e.g. analogous to how we did it on our Protea carrier board).
-
-Use the Toradex OUI as default MAC address if no valid one is
-encountered.
-
-Tested on samples of Apalis T30 2GB V1.0B, V1.0C, V1.1A, Apalis T30 1GB
-V1.0A, V1.1A and Apalis T30 1GB IT V1.1A both with blank NVMs as well
-as iNVMs programmed with Intel's defaults.
-
-Tested on samples of Apalis TK1 2GB V1.0A, V1.0B and V1.1A both with
-blank NVMs as well as iNVMs programmed with Intel's defaults.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-(cherry picked from toradex_tk1_l4t_r21.5 commit
-70efa60d96c9f05d91d8875eee97446df7f9e877)
-(cherry picked from tegra commit
-c4c3c7449bdb15c53bfebb0a29c73b24ea810d23)
----
- drivers/net/ethernet/intel/igb/igb_main.c | 60 +++++++++++++++++++++++++++++--
- 1 file changed, 57 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
-index 94ac43034033..e9d6a8742826 100644
---- a/drivers/net/ethernet/intel/igb/igb_main.c
-+++ b/drivers/net/ethernet/intel/igb/igb_main.c
-@@ -55,6 +55,7 @@
- #include <linux/dca.h>
- #endif
- #include <linux/i2c.h>
-+#include <linux/ctype.h>
- #include "igb.h"
-
- #define MAJ 5
-@@ -69,6 +70,9 @@ static const char igb_driver_string[] =
- static const char igb_copyright[] =
- "Copyright (c) 2007-2014 Intel Corporation.";
-
-+static char g_mac_addr[ETH_ALEN];
-+static int g_usr_mac = 0;
-+
- static const struct e1000_info *igb_info_tbl[] = {
- [board_82575] = &e1000_82575_info,
- };
-@@ -259,6 +263,37 @@ static int debug = -1;
- module_param(debug, int, 0);
- MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
-
-+/* Retrieve user set MAC address */
-+static int __init setup_igb_mac(char *macstr)
-+{
-+ int i, j;
-+ unsigned char result, value;
-+
-+ for (i = 0; i < ETH_ALEN; i++) {
-+ result = 0;
-+
-+ if (i != 5 && *(macstr + 2) != ':')
-+ return -1;
-+
-+ for (j = 0; j < 2; j++) {
-+ if (isxdigit(*macstr) && (value = isdigit(*macstr) ?
-+ *macstr - '0' : toupper(*macstr) - 'A' + 10) < 16) {
-+ result = result * 16 + value;
-+ macstr++;
-+ } else
-+ return -1;
-+ }
-+
-+ macstr++;
-+ g_mac_addr[i] = result;
-+ }
-+
-+ g_usr_mac = 1;
-+
-+ return 0;
-+}
-+__setup("igb_mac=", setup_igb_mac);
-+
- struct igb_reg_info {
- u32 ofs;
- char *name;
-@@ -2521,12 +2556,31 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
- dev_err(&pdev->dev, "NVM Read Error\n");
- }
-
-+ if (g_usr_mac && (g_usr_mac < 3)) {
-+ /* Get user set MAC address */
-+ if (g_usr_mac == 2) {
-+ /* 0x100000 offset for 2nd Ethernet MAC */
-+ g_mac_addr[3] += 0x10;
-+ if (g_mac_addr[3] < 0x10)
-+ dev_warn(&pdev->dev,
-+ "MAC addr byte 3 (0x%02x) wrap around"
-+ "\n",
-+ g_mac_addr[3]);
-+ }
-+ memcpy(hw->mac.addr, g_mac_addr, ETH_ALEN);
-+ g_usr_mac++;
-+ }
-+
- memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);
-
- if (!is_valid_ether_addr(netdev->dev_addr)) {
-- dev_err(&pdev->dev, "Invalid MAC Address\n");
-- err = -EIO;
-- goto err_eeprom;
-+ /* Use Toradex OUI as default */
-+ char default_mac_addr[ETH_ALEN] = {
-+ 0x0, 0x14, 0x2d, 0x0, 0x0, 0x0
-+ };
-+ dev_warn(&pdev->dev, "using Toradex OUI as default igb MAC\n");
-+ memcpy(hw->mac.addr, default_mac_addr, ETH_ALEN);
-+ memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);
- }
-
- igb_set_default_mac_filter(adapter);
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0005-mmc-tegra-apalis-tk1-hack-to-make-sd1-functional.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0005-mmc-tegra-apalis-tk1-hack-to-make-sd1-functional.patch
deleted file mode 100644
index 5058e25..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0005-mmc-tegra-apalis-tk1-hack-to-make-sd1-functional.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 2c1a2558212cb107d67fc8bad8bc05de33924961 Mon Sep 17 00:00:00 2001
-Message-Id: <2c1a2558212cb107d67fc8bad8bc05de33924961.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Thu, 15 Dec 2016 10:56:26 +0100
-Subject: [PATCH 05/33] mmc: tegra: apalis-tk1: hack to make sd1 functional
-
-Disable the external loopback and use the internal loopback as per
-SDMMC_VENDOR_MISC_CNTRL_0 register's SDMMC_SPARE1 bits being set to
-0xfffd according to the TRM.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-(cherry picked from toradex_tk1_l4t_r21.5 commit
-fc14b7601e5ca587afd97936ef3fd599f4e9281c)
----
- drivers/mmc/host/sdhci-tegra.c | 11 +++++++++++
- 1 file changed, 11 insertions(+)
-
-diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
-index 0cd6fa80db66..327883d86b33 100644
---- a/drivers/mmc/host/sdhci-tegra.c
-+++ b/drivers/mmc/host/sdhci-tegra.c
-@@ -43,6 +43,7 @@
- #define SDHCI_MISC_CTRL_ENABLE_SDR50 0x10
- #define SDHCI_MISC_CTRL_ENABLE_SDHCI_SPEC_300 0x20
- #define SDHCI_MISC_CTRL_ENABLE_DDR50 0x200
-+#define SDHCI_MISC_CTRL_ENABLE_EXT_LOOPBACK 0x20000
-
- #define SDHCI_TEGRA_AUTO_CAL_CONFIG 0x1e4
- #define SDHCI_AUTO_CAL_START BIT(31)
-@@ -181,6 +182,16 @@ static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
- clk_ctrl |= SDHCI_CLOCK_CTRL_SDR50_TUNING_OVERRIDE;
- }
-
-+#define CONFIG_MACH_APALIS_TK1
-+#ifdef CONFIG_MACH_APALIS_TK1
-+ /*
-+ * Disable the external loopback and use the internal loopback as per
-+ * SDMMC_VENDOR_MISC_CNTRL_0 register's SDMMC_SPARE1 bits being set to
-+ * 0xfffd according to the TRM.
-+ */
-+ misc_ctrl &= ~SDHCI_MISC_CTRL_ENABLE_EXT_LOOPBACK;
-+#endif /* CONFIG_MACH_APALIS_TK1 */
-+
- sdhci_writel(host, misc_ctrl, SDHCI_TEGRA_VENDOR_MISC_CTRL);
- sdhci_writel(host, clk_ctrl, SDHCI_TEGRA_VENDOR_CLOCK_CTRL);
-
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0006-apalis-colibri_t30-apalis-tk1-snapd-squashfs-configu.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0006-apalis-colibri_t30-apalis-tk1-snapd-squashfs-configu.patch
deleted file mode 100644
index 0ba77dd..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0006-apalis-colibri_t30-apalis-tk1-snapd-squashfs-configu.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 8457755081b1f33ffcaceb101fdd31acc3e10d64 Mon Sep 17 00:00:00 2001
-Message-Id: <8457755081b1f33ffcaceb101fdd31acc3e10d64.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Sun, 18 Jun 2017 01:23:26 +0200
-Subject: [PATCH 06/33] apalis/colibri_t30, apalis-tk1: snapd squashfs
- configuration
-
-Prepare for snapd integration.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-(downstream tegra commit a24d47d56d9f5a6ed1ec3a42c6d9ccf5748bc2ba)
-(downstream toradex_tk1_l4t_r21.5 commit
-f328e55a793497870c533eac0ac21cb735a82e6d)
----
- arch/arm/configs/tegra_defconfig | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
-index cb97ea2db1e0..cfe997c617fc 100644
---- a/arch/arm/configs/tegra_defconfig
-+++ b/arch/arm/configs/tegra_defconfig
-@@ -295,7 +295,12 @@ CONFIG_AUTOFS4_FS=y
- CONFIG_VFAT_FS=y
- CONFIG_TMPFS=y
- CONFIG_TMPFS_POSIX_ACL=y
--CONFIG_SQUASHFS=y
-+CONFIG_SQUASHFS=m
-+CONFIG_SQUASHFS_FILE_DIRECT=y
-+CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y
-+CONFIG_SQUASHFS_XATTR=y
-+CONFIG_SQUASHFS_ZLIB=y
-+CONFIG_SQUASHFS_LZ4=y
- CONFIG_SQUASHFS_LZO=y
- CONFIG_SQUASHFS_XZ=y
- CONFIG_NFS_FS=y
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0007-ARM-tegra-apalis-tk1-Support-v1.2-hardware-revision.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0007-ARM-tegra-apalis-tk1-Support-v1.2-hardware-revision.patch
deleted file mode 100644
index 7b20a77..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0007-ARM-tegra-apalis-tk1-Support-v1.2-hardware-revision.patch
+++ /dev/null
@@ -1,2359 +0,0 @@
-From c98f7e071cb3f133a05b325e3123b212f15dba31 Mon Sep 17 00:00:00 2001
-Message-Id: <c98f7e071cb3f133a05b325e3123b212f15dba31.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Sat, 10 Feb 2018 02:38:06 +0100
-Subject: [PATCH 07/33] ARM: tegra: apalis-tk1: Support v1.2 hardware revision
-
-Support the V1.2 hardware revision with the following pin muxing
-changes:
-
-Ddc_scl_pv4 and ddc_sda_pv5 previously used as Apalis GPIO3 and GPIO4
-are now used as DDC pins.
-
-Gen2_i2c_scl_pt5 and gen2_i2c_sda_pt6 previously used as DDC pins are
-now used as USB power enable signals.
-
-Usb_vbus_en0_pn4 and usb_vbus_en1_pn5 previously used as USB power
-enable signals are now used as GPIO3 and GPIO4.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Signed-off-by: Thierry Reding <treding@nvidia.com>
----
- arch/arm/boot/dts/Makefile | 1 +
- arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts | 250 +++
- arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi | 2052 +++++++++++++++++++++++
- 3 files changed, 2303 insertions(+)
- create mode 100644 arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
- create mode 100644 arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index eff87a344566..56aa9647db64 100644
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -961,6 +961,7 @@ dtb-$(CONFIG_ARCH_TEGRA_114_SOC) += \
- tegra114-tn7.dtb
- dtb-$(CONFIG_ARCH_TEGRA_124_SOC) += \
- tegra124-apalis-eval.dtb \
-+ tegra124-apalis-v1.2-eval.dtb \
- tegra124-jetson-tk1.dtb \
- tegra124-nyan-big.dtb \
- tegra124-nyan-blaze.dtb \
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts b/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
-new file mode 100644
-index 000000000000..8a8d5fa0ecd1
---- /dev/null
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
-@@ -0,0 +1,250 @@
-+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
-+/*
-+ * Copyright 2016-2018 Toradex AG
-+ */
-+
-+/dts-v1/;
-+
-+#include <dt-bindings/input/input.h>
-+#include "tegra124-apalis-v1.2.dtsi"
-+
-+/ {
-+ model = "Toradex Apalis TK1 on Apalis Evaluation Board";
-+ compatible = "toradex,apalis-tk1-v1.2-eval", "toradex,apalis-tk1-eval",
-+ "toradex,apalis-tk1", "nvidia,tegra124";
-+
-+ aliases {
-+ rtc0 = "/i2c@7000c000/rtc@68";
-+ rtc1 = "/i2c@7000d000/pmic@40";
-+ rtc2 = "/rtc@7000e000";
-+ serial0 = &uarta;
-+ serial1 = &uartb;
-+ serial2 = &uartc;
-+ serial3 = &uartd;
-+ };
-+
-+ chosen {
-+ stdout-path = "serial0:115200n8";
-+ };
-+
-+ pcie@1003000 {
-+ pci@1,0 {
-+ status = "okay";
-+ };
-+ };
-+
-+ host1x@50000000 {
-+ hdmi@54280000 {
-+ status = "okay";
-+ };
-+ };
-+
-+ /* Apalis UART1 */
-+ serial@70006000 {
-+ status = "okay";
-+ };
-+
-+ /* Apalis UART2 */
-+ serial@70006040 {
-+ status = "okay";
-+ };
-+
-+ /* Apalis UART3 */
-+ serial@70006200 {
-+ status = "okay";
-+ };
-+
-+ /* Apalis UART4 */
-+ serial@70006300 {
-+ status = "okay";
-+ };
-+
-+ pwm@7000a000 {
-+ status = "okay";
-+ };
-+
-+ /*
-+ * GEN1_I2C: I2C1_SDA/SCL on MXM3 pin 209/211 (e.g. RTC on carrier
-+ * board)
-+ */
-+ i2c@7000c000 {
-+ status = "okay";
-+ clock-frequency = <400000>;
-+
-+ pcie-switch@58 {
-+ compatible = "plx,pex8605";
-+ reg = <0x58>;
-+ };
-+
-+ /* M41T0M6 real time clock on carrier board */
-+ rtc@68 {
-+ compatible = "st,m41t0";
-+ reg = <0x68>;
-+ };
-+ };
-+
-+ /* GEN2_I2C: unused */
-+
-+ /*
-+ * CAM_I2C: I2C3_SDA/SCL (CAM) on MXM3 pin 201/203 (e.g. camera sensor
-+ * on carrier board)
-+ */
-+ i2c@7000c500 {
-+ status = "okay";
-+ clock-frequency = <400000>;
-+ };
-+
-+ /*
-+ * I2C4 (DDC): I2C4_SDA/SCL (DDC) on MXM3 pin 205/207
-+ * (e.g. display EDID)
-+ */
-+ hdmi_ddc: i2c@7000c700 {
-+ status = "okay";
-+ };
-+
-+ /* SPI1: Apalis SPI1 */
-+ spi@7000d400 {
-+ status = "okay";
-+ spi-max-frequency = <50000000>;
-+
-+ spidev0: spidev@0 {
-+ compatible = "spidev";
-+ reg = <0>;
-+ spi-max-frequency = <50000000>;
-+ };
-+ };
-+
-+ /* SPI4: Apalis SPI2 */
-+ spi@7000da00 {
-+ status = "okay";
-+ spi-max-frequency = <50000000>;
-+
-+ spidev1: spidev@0 {
-+ compatible = "spidev";
-+ reg = <0>;
-+ spi-max-frequency = <50000000>;
-+ };
-+ };
-+
-+ /* Apalis Serial ATA */
-+ sata@70020000 {
-+ status = "okay";
-+ };
-+
-+ hda@70030000 {
-+ status = "okay";
-+ };
-+
-+ usb@70090000 {
-+ status = "okay";
-+ };
-+
-+ /* Apalis MMC1 */
-+ sdhci@700b0000 {
-+ status = "okay";
-+ /* MMC1_CD# */
-+ cd-gpios = <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_LOW>;
-+ bus-width = <4>;
-+ vqmmc-supply = <&vddio_sdmmc1>;
-+ };
-+
-+ /* Apalis SD1 */
-+ sdhci@700b0400 {
-+ status = "okay";
-+ /* SD1_CD# */
-+ cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
-+ bus-width = <4>;
-+ vqmmc-supply = <&vddio_sdmmc3>;
-+ };
-+
-+ /* EHCI instance 0: USB1_DP/N -> USBO1_DP/N */
-+ usb@7d000000 {
-+ status = "okay";
-+ dr_mode = "otg";
-+ };
-+
-+ usb-phy@7d000000 {
-+ status = "okay";
-+ vbus-supply = <&reg_usbo1_vbus>;
-+ };
-+
-+ /* EHCI instance 1: USB2_DP/N -> USBH2_DP/N */
-+ usb@7d004000 {
-+ status = "okay";
-+ };
-+
-+ usb-phy@7d004000 {
-+ status = "okay";
-+ vbus-supply = <&reg_usbh_vbus>;
-+ };
-+
-+ /* EHCI instance 2: USB3_DP/N -> USBH4_DP/N */
-+ usb@7d008000 {
-+ status = "okay";
-+ };
-+
-+ usb-phy@7d008000 {
-+ status = "okay";
-+ vbus-supply = <&reg_usbh_vbus>;
-+ };
-+
-+ backlight: backlight {
-+ compatible = "pwm-backlight";
-+ pwms = <&pwm 3 5000000>; /* BKL1_PWM */
-+ brightness-levels = <255 231 223 207 191 159 127 0>;
-+ default-brightness-level = <6>;
-+ /* BKL1_ON */
-+ enable-gpios = <&gpio TEGRA_GPIO(BB, 5) GPIO_ACTIVE_HIGH>;
-+ };
-+
-+ gpio-keys {
-+ compatible = "gpio-keys";
-+
-+ wakeup {
-+ label = "WAKE1_MICO";
-+ gpios = <&gpio TEGRA_GPIO(DD, 3) GPIO_ACTIVE_LOW>;
-+ linux,code = <KEY_WAKEUP>;
-+ debounce-interval = <10>;
-+ wakeup-source;
-+ };
-+ };
-+
-+ reg_5v0: regulator-5v0 {
-+ compatible = "regulator-fixed";
-+ regulator-name = "5V_SW";
-+ regulator-min-microvolt = <5000000>;
-+ regulator-max-microvolt = <5000000>;
-+ };
-+
-+ /* USBO1_EN */
-+ reg_usbo1_vbus: regulator-usbo1-vbus {
-+ compatible = "regulator-fixed";
-+ regulator-name = "VCC_USBO1";
-+ regulator-min-microvolt = <5000000>;
-+ regulator-max-microvolt = <5000000>;
-+ gpio = <&gpio TEGRA_GPIO(T, 5) GPIO_ACTIVE_HIGH>;
-+ enable-active-high;
-+ vin-supply = <&reg_5v0>;
-+ };
-+
-+ /* USBH_EN */
-+ reg_usbh_vbus: regulator-usbh-vbus {
-+ compatible = "regulator-fixed";
-+ regulator-name = "VCC_USBH(2A|2C|2D|3|4)";
-+ regulator-min-microvolt = <5000000>;
-+ regulator-max-microvolt = <5000000>;
-+ gpio = <&gpio TEGRA_GPIO(T, 6) GPIO_ACTIVE_HIGH>;
-+ enable-active-high;
-+ vin-supply = <&reg_5v0>;
-+ };
-+};
-+
-+&gpio {
-+ /* Apalis GPIO7 MXM3 pin 15 PLX PEX 8605 PCIe Switch Reset */
-+ pex_perst_n {
-+ gpio-hog;
-+ gpios = <TEGRA_GPIO(DD, 1) GPIO_ACTIVE_HIGH>;
-+ output-high;
-+ line-name = "PEX_PERST_N";
-+ };
-+};
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-new file mode 100644
-index 000000000000..bb67edb016c5
---- /dev/null
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-@@ -0,0 +1,2052 @@
-+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
-+/*
-+ * Copyright 2016-2018 Toradex AG
-+ */
-+
-+#include "tegra124.dtsi"
-+#include "tegra124-apalis-emc.dtsi"
-+
-+/*
-+ * Toradex Apalis TK1 Module Device Tree
-+ * Compatible for Revisions 2GB: V1.2A
-+ */
-+/ {
-+ model = "Toradex Apalis TK1";
-+ compatible = "toradex,apalis-tk1-v1.2", "toradex,apalis-tk1",
-+ "nvidia,tegra124";
-+
-+ memory {
-+ reg = <0x0 0x80000000 0x0 0x80000000>;
-+ };
-+
-+ pcie@1003000 {
-+ status = "okay";
-+ avddio-pex-supply = <&vdd_1v05>;
-+ avdd-pex-pll-supply = <&vdd_1v05>;
-+ avdd-pll-erefe-supply = <&avdd_1v05>;
-+ dvddio-pex-supply = <&vdd_1v05>;
-+ hvdd-pex-pll-e-supply = <&reg_3v3>;
-+ hvdd-pex-supply = <&reg_3v3>;
-+ vddio-pex-ctl-supply = <&reg_3v3>;
-+
-+ /* Apalis PCIe (additional lane Apalis type specific) */
-+ pci@1,0 {
-+ /* PCIE1_RX/TX and TS_DIFF1/2 */
-+ phys = <&{/padctl@7009f000/pads/pcie/lanes/pcie-4}>,
-+ <&{/padctl@7009f000/pads/pcie/lanes/pcie-3}>;
-+ phy-names = "pcie-0", "pcie-1";
-+ };
-+
-+ /* I210 Gigabit Ethernet Controller (On-module) */
-+ pci@2,0 {
-+ phys = <&{/padctl@7009f000/pads/pcie/lanes/pcie-2}>;
-+ phy-names = "pcie-0";
-+ status = "okay";
-+ };
-+ };
-+
-+ host1x@50000000 {
-+ hdmi@54280000 {
-+ pll-supply = <&reg_1v05_avdd_hdmi_pll>;
-+ vdd-supply = <&reg_3v3_avdd_hdmi>;
-+ nvidia,ddc-i2c-bus = <&hdmi_ddc>;
-+ nvidia,hpd-gpio =
-+ <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
-+ };
-+ };
-+
-+ gpu@0,57000000 {
-+ /*
-+ * Node left disabled on purpose - the bootloader will enable
-+ * it after having set the VPR up
-+ */
-+ vdd-supply = <&vdd_gpu>;
-+ };
-+
-+ pinmux: pinmux@70000868 {
-+ pinctrl-names = "default";
-+ pinctrl-0 = <&state_default>;
-+
-+ state_default: pinmux {
-+ /* Analogue Audio (On-module) */
-+ dap3_fs_pp0 {
-+ nvidia,pins = "dap3_fs_pp0";
-+ nvidia,function = "i2s2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap3_din_pp1 {
-+ nvidia,pins = "dap3_din_pp1";
-+ nvidia,function = "i2s2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ dap3_dout_pp2 {
-+ nvidia,pins = "dap3_dout_pp2";
-+ nvidia,function = "i2s2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap3_sclk_pp3 {
-+ nvidia,pins = "dap3_sclk_pp3";
-+ nvidia,function = "i2s2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap_mclk1_pw4 {
-+ nvidia,pins = "dap_mclk1_pw4";
-+ nvidia,function = "extperiph1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis BKL1_ON */
-+ pbb5 {
-+ nvidia,pins = "pbb5";
-+ nvidia,function = "vgp5";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis BKL1_PWM */
-+ pu6 {
-+ nvidia,pins = "pu6";
-+ nvidia,function = "pwm3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis CAM1_MCLK */
-+ cam_mclk_pcc0 {
-+ nvidia,pins = "cam_mclk_pcc0";
-+ nvidia,function = "vi_alt3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis Digital Audio */
-+ dap2_fs_pa2 {
-+ nvidia,pins = "dap2_fs_pa2";
-+ nvidia,function = "hda";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ dap2_sclk_pa3 {
-+ nvidia,pins = "dap2_sclk_pa3";
-+ nvidia,function = "hda";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ dap2_din_pa4 {
-+ nvidia,pins = "dap2_din_pa4";
-+ nvidia,function = "hda";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ dap2_dout_pa5 {
-+ nvidia,pins = "dap2_dout_pa5";
-+ nvidia,function = "hda";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pbb3 { /* DAP1_RESET */
-+ nvidia,pins = "pbb3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ clk3_out_pee0 {
-+ nvidia,pins = "clk3_out_pee0";
-+ nvidia,function = "extperiph3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis GPIO */
-+ usb_vbus_en0_pn4 {
-+ nvidia,pins = "usb_vbus_en0_pn4";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_DISABLE>;
-+ };
-+ usb_vbus_en1_pn5 {
-+ nvidia,pins = "usb_vbus_en1_pn5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_DISABLE>;
-+ };
-+ pex_l0_rst_n_pdd1 {
-+ nvidia,pins = "pex_l0_rst_n_pdd1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ pex_l0_clkreq_n_pdd2 {
-+ nvidia,pins = "pex_l0_clkreq_n_pdd2";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ pex_l1_rst_n_pdd5 {
-+ nvidia,pins = "pex_l1_rst_n_pdd5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ pex_l1_clkreq_n_pdd6 {
-+ nvidia,pins = "pex_l1_clkreq_n_pdd6";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ dp_hpd_pff0 {
-+ nvidia,pins = "dp_hpd_pff0";
-+ nvidia,function = "dp";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ pff2 {
-+ nvidia,pins = "pff2";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ owr { /* PEX_L1_CLKREQ_N multiplexed GPIO6 */
-+ nvidia,pins = "owr";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ nvidia,rcv-sel = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis HDMI1_CEC */
-+ hdmi_cec_pee3 {
-+ nvidia,pins = "hdmi_cec_pee3";
-+ nvidia,function = "cec";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis HDMI1_HPD */
-+ hdmi_int_pn7 {
-+ nvidia,pins = "hdmi_int_pn7";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,rcv-sel = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis I2C1 */
-+ gen1_i2c_scl_pc4 {
-+ nvidia,pins = "gen1_i2c_scl_pc4";
-+ nvidia,function = "i2c1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_ENABLE>;
-+ };
-+ gen1_i2c_sda_pc5 {
-+ nvidia,pins = "gen1_i2c_sda_pc5";
-+ nvidia,function = "i2c1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis I2C3 (CAM) */
-+ cam_i2c_scl_pbb1 {
-+ nvidia,pins = "cam_i2c_scl_pbb1";
-+ nvidia,function = "i2c3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_ENABLE>;
-+ };
-+ cam_i2c_sda_pbb2 {
-+ nvidia,pins = "cam_i2c_sda_pbb2";
-+ nvidia,function = "i2c3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis I2C4 (DDC) */
-+ ddc_scl_pv4 {
-+ nvidia,pins = "ddc_scl_pv4";
-+ nvidia,function = "i2c4";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,rcv-sel = <TEGRA_PIN_ENABLE>;
-+ };
-+ ddc_sda_pv5 {
-+ nvidia,pins = "ddc_sda_pv5";
-+ nvidia,function = "i2c4";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,rcv-sel = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis MMC1 */
-+ sdmmc1_cd_n_pv3 { /* CD# GPIO */
-+ nvidia,pins = "sdmmc1_wp_n_pv3";
-+ nvidia,function = "sdmmc1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ clk2_out_pw5 { /* D5 GPIO */
-+ nvidia,pins = "clk2_out_pw5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc1_dat3_py4 {
-+ nvidia,pins = "sdmmc1_dat3_py4";
-+ nvidia,function = "sdmmc1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc1_dat2_py5 {
-+ nvidia,pins = "sdmmc1_dat2_py5";
-+ nvidia,function = "sdmmc1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc1_dat1_py6 {
-+ nvidia,pins = "sdmmc1_dat1_py6";
-+ nvidia,function = "sdmmc1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc1_dat0_py7 {
-+ nvidia,pins = "sdmmc1_dat0_py7";
-+ nvidia,function = "sdmmc1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc1_clk_pz0 {
-+ nvidia,pins = "sdmmc1_clk_pz0";
-+ nvidia,function = "sdmmc1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc1_cmd_pz1 {
-+ nvidia,pins = "sdmmc1_cmd_pz1";
-+ nvidia,function = "sdmmc1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ clk2_req_pcc5 { /* D4 GPIO */
-+ nvidia,pins = "clk2_req_pcc5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc3_clk_lb_in_pee5 { /* D6 GPIO */
-+ nvidia,pins = "sdmmc3_clk_lb_in_pee5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ usb_vbus_en2_pff1 { /* D7 GPIO */
-+ nvidia,pins = "usb_vbus_en2_pff1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis PWM */
-+ ph0 {
-+ nvidia,pins = "ph0";
-+ nvidia,function = "pwm0";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ph1 {
-+ nvidia,pins = "ph1";
-+ nvidia,function = "pwm1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ph2 {
-+ nvidia,pins = "ph2";
-+ nvidia,function = "pwm2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ /* PWM3 active on pu6 being Apalis BKL1_PWM as well */
-+ ph3 {
-+ nvidia,pins = "ph3";
-+ nvidia,function = "pwm3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis SATA1_ACT# */
-+ dap1_dout_pn2 {
-+ nvidia,pins = "dap1_dout_pn2";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis SD1 */
-+ sdmmc3_clk_pa6 {
-+ nvidia,pins = "sdmmc3_clk_pa6";
-+ nvidia,function = "sdmmc3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc3_cmd_pa7 {
-+ nvidia,pins = "sdmmc3_cmd_pa7";
-+ nvidia,function = "sdmmc3";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc3_dat3_pb4 {
-+ nvidia,pins = "sdmmc3_dat3_pb4";
-+ nvidia,function = "sdmmc3";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc3_dat2_pb5 {
-+ nvidia,pins = "sdmmc3_dat2_pb5";
-+ nvidia,function = "sdmmc3";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc3_dat1_pb6 {
-+ nvidia,pins = "sdmmc3_dat1_pb6";
-+ nvidia,function = "sdmmc3";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc3_dat0_pb7 {
-+ nvidia,pins = "sdmmc3_dat0_pb7";
-+ nvidia,function = "sdmmc3";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc3_cd_n_pv2 { /* CD# GPIO */
-+ nvidia,pins = "sdmmc3_cd_n_pv2";
-+ nvidia,function = "rsvd3";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis SPDIF */
-+ spdif_out_pk5 {
-+ nvidia,pins = "spdif_out_pk5";
-+ nvidia,function = "spdif";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ spdif_in_pk6 {
-+ nvidia,pins = "spdif_in_pk6";
-+ nvidia,function = "spdif";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis SPI1 */
-+ ulpi_clk_py0 {
-+ nvidia,pins = "ulpi_clk_py0";
-+ nvidia,function = "spi1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ulpi_dir_py1 {
-+ nvidia,pins = "ulpi_dir_py1";
-+ nvidia,function = "spi1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ ulpi_nxt_py2 {
-+ nvidia,pins = "ulpi_nxt_py2";
-+ nvidia,function = "spi1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ulpi_stp_py3 {
-+ nvidia,pins = "ulpi_stp_py3";
-+ nvidia,function = "spi1";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis SPI2 */
-+ pg5 {
-+ nvidia,pins = "pg5";
-+ nvidia,function = "spi4";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pg6 {
-+ nvidia,pins = "pg6";
-+ nvidia,function = "spi4";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pg7 {
-+ nvidia,pins = "pg7";
-+ nvidia,function = "spi4";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ pi3 {
-+ nvidia,pins = "pi3";
-+ nvidia,function = "spi4";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis UART1 */
-+ pb1 { /* DCD GPIO */
-+ nvidia,pins = "pb1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ pk7 { /* RI GPIO */
-+ nvidia,pins = "pk7";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ uart1_txd_pu0 {
-+ nvidia,pins = "pu0";
-+ nvidia,function = "uarta";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ uart1_rxd_pu1 {
-+ nvidia,pins = "pu1";
-+ nvidia,function = "uarta";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ uart1_cts_n_pu2 {
-+ nvidia,pins = "pu2";
-+ nvidia,function = "uarta";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ uart1_rts_n_pu3 {
-+ nvidia,pins = "pu3";
-+ nvidia,function = "uarta";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ uart3_cts_n_pa1 { /* DSR GPIO */
-+ nvidia,pins = "uart3_cts_n_pa1";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ uart3_rts_n_pc0 { /* DTR GPIO */
-+ nvidia,pins = "uart3_rts_n_pc0";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis UART2 */
-+ uart2_txd_pc2 {
-+ nvidia,pins = "uart2_txd_pc2";
-+ nvidia,function = "irda";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ uart2_rxd_pc3 {
-+ nvidia,pins = "uart2_rxd_pc3";
-+ nvidia,function = "irda";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ uart2_cts_n_pj5 {
-+ nvidia,pins = "uart2_cts_n_pj5";
-+ nvidia,function = "uartb";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ uart2_rts_n_pj6 {
-+ nvidia,pins = "uart2_rts_n_pj6";
-+ nvidia,function = "uartb";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis UART3 */
-+ uart3_txd_pw6 {
-+ nvidia,pins = "uart3_txd_pw6";
-+ nvidia,function = "uartc";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ uart3_rxd_pw7 {
-+ nvidia,pins = "uart3_rxd_pw7";
-+ nvidia,function = "uartc";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis UART4 */
-+ uart4_rxd_pb0 {
-+ nvidia,pins = "pb0";
-+ nvidia,function = "uartd";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ uart4_txd_pj7 {
-+ nvidia,pins = "pj7";
-+ nvidia,function = "uartd";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis USBH_EN */
-+ gen2_i2c_sda_pt6 {
-+ nvidia,pins = "gen2_i2c_sda_pt6";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis USBH_OC# */
-+ pbb0 {
-+ nvidia,pins = "pbb0";
-+ nvidia,function = "vgp6";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis USBO1_EN */
-+ gen2_i2c_scl_pt5 {
-+ nvidia,pins = "gen2_i2c_scl_pt5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Apalis USBO1_OC# */
-+ pbb4 {
-+ nvidia,pins = "pbb4";
-+ nvidia,function = "vgp4";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* Apalis WAKE1_MICO */
-+ pex_wake_n_pdd3 {
-+ nvidia,pins = "pex_wake_n_pdd3";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* CORE_PWR_REQ */
-+ core_pwr_req {
-+ nvidia,pins = "core_pwr_req";
-+ nvidia,function = "pwron";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* CPU_PWR_REQ */
-+ cpu_pwr_req {
-+ nvidia,pins = "cpu_pwr_req";
-+ nvidia,function = "cpu";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* DVFS */
-+ dvfs_pwm_px0 {
-+ nvidia,pins = "dvfs_pwm_px0";
-+ nvidia,function = "cldvfs";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dvfs_clk_px2 {
-+ nvidia,pins = "dvfs_clk_px2";
-+ nvidia,function = "cldvfs";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* eMMC */
-+ sdmmc4_dat0_paa0 {
-+ nvidia,pins = "sdmmc4_dat0_paa0";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_dat1_paa1 {
-+ nvidia,pins = "sdmmc4_dat1_paa1";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_dat2_paa2 {
-+ nvidia,pins = "sdmmc4_dat2_paa2";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_dat3_paa3 {
-+ nvidia,pins = "sdmmc4_dat3_paa3";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_dat4_paa4 {
-+ nvidia,pins = "sdmmc4_dat4_paa4";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_dat5_paa5 {
-+ nvidia,pins = "sdmmc4_dat5_paa5";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_dat6_paa6 {
-+ nvidia,pins = "sdmmc4_dat6_paa6";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_dat7_paa7 {
-+ nvidia,pins = "sdmmc4_dat7_paa7";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_clk_pcc4 {
-+ nvidia,pins = "sdmmc4_clk_pcc4";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ sdmmc4_cmd_pt7 {
-+ nvidia,pins = "sdmmc4_cmd_pt7";
-+ nvidia,function = "sdmmc4";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* JTAG_RTCK */
-+ jtag_rtck {
-+ nvidia,pins = "jtag_rtck";
-+ nvidia,function = "rtck";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* LAN_DEV_OFF# */
-+ ulpi_data5_po6 {
-+ nvidia,pins = "ulpi_data5_po6";
-+ nvidia,function = "ulpi";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* LAN_RESET# */
-+ kb_row10_ps2 {
-+ nvidia,pins = "kb_row10_ps2";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* LAN_WAKE# */
-+ ulpi_data4_po5 {
-+ nvidia,pins = "ulpi_data4_po5";
-+ nvidia,function = "ulpi";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* MCU_INT1# */
-+ pk2 {
-+ nvidia,pins = "pk2";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* MCU_INT2# */
-+ pj2 {
-+ nvidia,pins = "pj2";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* MCU_INT3# */
-+ pi5 {
-+ nvidia,pins = "pi5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* MCU_INT4# */
-+ pj0 {
-+ nvidia,pins = "pj0";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* MCU_RESET */
-+ pbb6 {
-+ nvidia,pins = "pbb6";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* MCU SPI */
-+ gpio_x4_aud_px4 {
-+ nvidia,pins = "gpio_x4_aud_px4";
-+ nvidia,function = "spi2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ gpio_x5_aud_px5 {
-+ nvidia,pins = "gpio_x5_aud_px5";
-+ nvidia,function = "spi2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ gpio_x6_aud_px6 { /* MCU_CS */
-+ nvidia,pins = "gpio_x6_aud_px6";
-+ nvidia,function = "spi2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ gpio_x7_aud_px7 {
-+ nvidia,pins = "gpio_x7_aud_px7";
-+ nvidia,function = "spi2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ gpio_w2_aud_pw2 { /* MCU_CSEZP */
-+ nvidia,pins = "gpio_w2_aud_pw2";
-+ nvidia,function = "spi2";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* PMIC_CLK_32K */
-+ clk_32k_in {
-+ nvidia,pins = "clk_32k_in";
-+ nvidia,function = "clk";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* PMIC_CPU_OC_INT */
-+ clk_32k_out_pa0 {
-+ nvidia,pins = "clk_32k_out_pa0";
-+ nvidia,function = "soc";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* PWR_I2C */
-+ pwr_i2c_scl_pz6 {
-+ nvidia,pins = "pwr_i2c_scl_pz6";
-+ nvidia,function = "i2cpwr";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_ENABLE>;
-+ };
-+ pwr_i2c_sda_pz7 {
-+ nvidia,pins = "pwr_i2c_sda_pz7";
-+ nvidia,function = "i2cpwr";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ nvidia,open-drain = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* PWR_INT_N */
-+ pwr_int_n {
-+ nvidia,pins = "pwr_int_n";
-+ nvidia,function = "pmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* RESET_MOCI_CTRL */
-+ pu4 {
-+ nvidia,pins = "pu4";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* RESET_OUT_N */
-+ reset_out_n {
-+ nvidia,pins = "reset_out_n";
-+ nvidia,function = "reset_out_n";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* SHIFT_CTRL_DIR_IN */
-+ kb_row0_pr0 {
-+ nvidia,pins = "kb_row0_pr0";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row1_pr1 {
-+ nvidia,pins = "kb_row1_pr1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* Configure level-shifter as output for HDA */
-+ kb_row11_ps3 {
-+ nvidia,pins = "kb_row11_ps3";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* SHIFT_CTRL_DIR_OUT */
-+ kb_col5_pq5 {
-+ nvidia,pins = "kb_col5_pq5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_col6_pq6 {
-+ nvidia,pins = "kb_col6_pq6";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_col7_pq7 {
-+ nvidia,pins = "kb_col7_pq7";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* SHIFT_CTRL_OE */
-+ kb_col0_pq0 {
-+ nvidia,pins = "kb_col0_pq0";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_col1_pq1 {
-+ nvidia,pins = "kb_col1_pq1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_col2_pq2 {
-+ nvidia,pins = "kb_col2_pq2";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_col4_pq4 {
-+ nvidia,pins = "kb_col4_pq4";
-+ nvidia,function = "kbc";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row2_pr2 {
-+ nvidia,pins = "kb_row2_pr2";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+
-+ /* GPIO_PI6 aka TMP451 ALERT#/THERM2# */
-+ pi6 {
-+ nvidia,pins = "pi6";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ /* TOUCH_INT */
-+ gpio_w3_aud_pw3 {
-+ nvidia,pins = "gpio_w3_aud_pw3";
-+ nvidia,function = "spi6";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+
-+ pc7 { /* NC */
-+ nvidia,pins = "pc7";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pg0 { /* NC */
-+ nvidia,pins = "pg0";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pg1 { /* NC */
-+ nvidia,pins = "pg1";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pg2 { /* NC */
-+ nvidia,pins = "pg2";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pg3 { /* NC */
-+ nvidia,pins = "pg3";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pg4 { /* NC */
-+ nvidia,pins = "pg4";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ph4 { /* NC */
-+ nvidia,pins = "ph4";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ph5 { /* NC */
-+ nvidia,pins = "ph5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ph6 { /* NC */
-+ nvidia,pins = "ph6";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ph7 { /* NC */
-+ nvidia,pins = "ph7";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pi0 { /* NC */
-+ nvidia,pins = "pi0";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pi1 { /* NC */
-+ nvidia,pins = "pi1";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pi2 { /* NC */
-+ nvidia,pins = "pi2";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pi4 { /* NC */
-+ nvidia,pins = "pi4";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pi7 { /* NC */
-+ nvidia,pins = "pi7";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pk0 { /* NC */
-+ nvidia,pins = "pk0";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pk1 { /* NC */
-+ nvidia,pins = "pk1";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pk3 { /* NC */
-+ nvidia,pins = "pk3";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pk4 { /* NC */
-+ nvidia,pins = "pk4";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap1_fs_pn0 { /* NC */
-+ nvidia,pins = "dap1_fs_pn0";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap1_din_pn1 { /* NC */
-+ nvidia,pins = "dap1_din_pn1";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap1_sclk_pn3 { /* NC */
-+ nvidia,pins = "dap1_sclk_pn3";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ulpi_data7_po0 { /* NC */
-+ nvidia,pins = "ulpi_data7_po0";
-+ nvidia,function = "ulpi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ulpi_data0_po1 { /* NC */
-+ nvidia,pins = "ulpi_data0_po1";
-+ nvidia,function = "ulpi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ulpi_data1_po2 { /* NC */
-+ nvidia,pins = "ulpi_data1_po2";
-+ nvidia,function = "ulpi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ulpi_data2_po3 { /* NC */
-+ nvidia,pins = "ulpi_data2_po3";
-+ nvidia,function = "ulpi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ulpi_data3_po4 { /* NC */
-+ nvidia,pins = "ulpi_data3_po4";
-+ nvidia,function = "ulpi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ ulpi_data6_po7 { /* NC */
-+ nvidia,pins = "ulpi_data6_po7";
-+ nvidia,function = "ulpi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap4_fs_pp4 { /* NC */
-+ nvidia,pins = "dap4_fs_pp4";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap4_din_pp5 { /* NC */
-+ nvidia,pins = "dap4_din_pp5";
-+ nvidia,function = "rsvd3";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap4_dout_pp6 { /* NC */
-+ nvidia,pins = "dap4_dout_pp6";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap4_sclk_pp7 { /* NC */
-+ nvidia,pins = "dap4_sclk_pp7";
-+ nvidia,function = "rsvd3";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_col3_pq3 { /* NC */
-+ nvidia,pins = "kb_col3_pq3";
-+ nvidia,function = "kbc";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row3_pr3 { /* NC */
-+ nvidia,pins = "kb_row3_pr3";
-+ nvidia,function = "kbc";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row4_pr4 { /* NC */
-+ nvidia,pins = "kb_row4_pr4";
-+ nvidia,function = "rsvd3";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row5_pr5 { /* NC */
-+ nvidia,pins = "kb_row5_pr5";
-+ nvidia,function = "rsvd3";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row6_pr6 { /* NC */
-+ nvidia,pins = "kb_row6_pr6";
-+ nvidia,function = "kbc";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row7_pr7 { /* NC */
-+ nvidia,pins = "kb_row7_pr7";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row8_ps0 { /* NC */
-+ nvidia,pins = "kb_row8_ps0";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row9_ps1 { /* NC */
-+ nvidia,pins = "kb_row9_ps1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row12_ps4 { /* NC */
-+ nvidia,pins = "kb_row12_ps4";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row13_ps5 { /* NC */
-+ nvidia,pins = "kb_row13_ps5";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row14_ps6 { /* NC */
-+ nvidia,pins = "kb_row14_ps6";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row15_ps7 { /* NC */
-+ nvidia,pins = "kb_row15_ps7";
-+ nvidia,function = "rsvd3";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row16_pt0 { /* NC */
-+ nvidia,pins = "kb_row16_pt0";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ kb_row17_pt1 { /* NC */
-+ nvidia,pins = "kb_row17_pt1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pu5 { /* NC */
-+ nvidia,pins = "pu5";
-+ nvidia,function = "gmi";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ /*
-+ * PCB Version Indication: V1.2 and later have GPIO_PV0
-+ * wired to GND, was NC before
-+ */
-+ pv0 {
-+ nvidia,pins = "pv0";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pv1 { /* NC */
-+ nvidia,pins = "pv1";
-+ nvidia,function = "rsvd1";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ gpio_x1_aud_px1 { /* NC */
-+ nvidia,pins = "gpio_x1_aud_px1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ gpio_x3_aud_px3 { /* NC */
-+ nvidia,pins = "gpio_x3_aud_px3";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pbb7 { /* NC */
-+ nvidia,pins = "pbb7";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pcc1 { /* NC */
-+ nvidia,pins = "pcc1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ pcc2 { /* NC */
-+ nvidia,pins = "pcc2";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ clk3_req_pee1 { /* NC */
-+ nvidia,pins = "clk3_req_pee1";
-+ nvidia,function = "rsvd2";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ dap_mclk1_req_pee2 { /* NC */
-+ nvidia,pins = "dap_mclk1_req_pee2";
-+ nvidia,function = "rsvd4";
-+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
-+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
-+ };
-+ /*
-+ * Leave SDMMC3_CLK_LB_OUT muxed as SDMMC3 with output
-+ * driver enabled aka not tristated and input driver
-+ * enabled as well as it features some magic properties
-+ * even though the external loopback is disabled and the
-+ * internal loopback used as per
-+ * SDMMC_VENDOR_MISC_CNTRL_0 register's SDMMC_SPARE1
-+ * bits being set to 0xfffd according to the TRM!
-+ */
-+ sdmmc3_clk_lb_out_pee4 { /* NC */
-+ nvidia,pins = "sdmmc3_clk_lb_out_pee4";
-+ nvidia,function = "sdmmc3";
-+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
-+ };
-+ };
-+ };
-+
-+ serial@70006040 {
-+ compatible = "nvidia,tegra124-hsuart";
-+ };
-+
-+ serial@70006200 {
-+ compatible = "nvidia,tegra124-hsuart";
-+ };
-+
-+ serial@70006300 {
-+ compatible = "nvidia,tegra124-hsuart";
-+ };
-+
-+ hdmi_ddc: i2c@7000c700 {
-+ clock-frequency = <10000>;
-+ };
-+
-+ /* PWR_I2C: power I2C to audio codec, PMIC and temperature sensor */
-+ i2c@7000d000 {
-+ status = "okay";
-+ clock-frequency = <400000>;
-+
-+ /* SGTL5000 audio codec */
-+ sgtl5000: codec@a {
-+ compatible = "fsl,sgtl5000";
-+ reg = <0x0a>;
-+ VDDA-supply = <&reg_3v3>;
-+ VDDIO-supply = <&vddio_1v8>;
-+ clocks = <&tegra_car TEGRA124_CLK_EXTERN1>;
-+ };
-+
-+ pmic: pmic@40 {
-+ compatible = "ams,as3722";
-+ reg = <0x40>;
-+ interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
-+ ams,system-power-controller;
-+ #interrupt-cells = <2>;
-+ interrupt-controller;
-+ gpio-controller;
-+ #gpio-cells = <2>;
-+ pinctrl-names = "default";
-+ pinctrl-0 = <&as3722_default>;
-+
-+ as3722_default: pinmux {
-+ gpio2_7 {
-+ pins = "gpio2", /* PWR_EN_+V3.3 */
-+ "gpio7"; /* +V1.6_LPO */
-+ function = "gpio";
-+ bias-pull-up;
-+ };
-+
-+ gpio0_1_3_4_5_6 {
-+ pins = "gpio0", "gpio1", "gpio3",
-+ "gpio4", "gpio5", "gpio6";
-+ bias-high-impedance;
-+ };
-+ };
-+
-+ regulators {
-+ vsup-sd2-supply = <&reg_3v3>;
-+ vsup-sd3-supply = <&reg_3v3>;
-+ vsup-sd4-supply = <&reg_3v3>;
-+ vsup-sd5-supply = <&reg_3v3>;
-+ vin-ldo0-supply = <&vddio_ddr_1v35>;
-+ vin-ldo1-6-supply = <&reg_3v3>;
-+ vin-ldo2-5-7-supply = <&vddio_1v8>;
-+ vin-ldo3-4-supply = <&reg_3v3>;
-+ vin-ldo9-10-supply = <&reg_3v3>;
-+ vin-ldo11-supply = <&reg_3v3>;
-+
-+ vdd_cpu: sd0 {
-+ regulator-name = "+VDD_CPU_AP";
-+ regulator-min-microvolt = <700000>;
-+ regulator-max-microvolt = <1400000>;
-+ regulator-min-microamp = <3500000>;
-+ regulator-max-microamp = <3500000>;
-+ regulator-always-on;
-+ regulator-boot-on;
-+ ams,ext-control = <2>;
-+ };
-+
-+ sd1 {
-+ regulator-name = "+VDD_CORE";
-+ regulator-min-microvolt = <700000>;
-+ regulator-max-microvolt = <1350000>;
-+ regulator-min-microamp = <2500000>;
-+ regulator-max-microamp = <4000000>;
-+ regulator-always-on;
-+ regulator-boot-on;
-+ ams,ext-control = <1>;
-+ };
-+
-+ vddio_ddr_1v35: sd2 {
-+ regulator-name =
-+ "+V1.35_VDDIO_DDR(sd2)";
-+ regulator-min-microvolt = <1350000>;
-+ regulator-max-microvolt = <1350000>;
-+ regulator-always-on;
-+ regulator-boot-on;
-+ };
-+
-+ sd3 {
-+ regulator-name =
-+ "+V1.35_VDDIO_DDR(sd3)";
-+ regulator-min-microvolt = <1350000>;
-+ regulator-max-microvolt = <1350000>;
-+ regulator-always-on;
-+ regulator-boot-on;
-+ };
-+
-+ vdd_1v05: sd4 {
-+ regulator-name = "+V1.05";
-+ regulator-min-microvolt = <1050000>;
-+ regulator-max-microvolt = <1050000>;
-+ };
-+
-+ vddio_1v8: sd5 {
-+ regulator-name = "+V1.8";
-+ regulator-min-microvolt = <1800000>;
-+ regulator-max-microvolt = <1800000>;
-+ regulator-boot-on;
-+ regulator-always-on;
-+ };
-+
-+ vdd_gpu: sd6 {
-+ regulator-name = "+VDD_GPU_AP";
-+ regulator-min-microvolt = <650000>;
-+ regulator-max-microvolt = <1200000>;
-+ regulator-min-microamp = <3500000>;
-+ regulator-max-microamp = <3500000>;
-+ regulator-boot-on;
-+ regulator-always-on;
-+ };
-+
-+ avdd_1v05: ldo0 {
-+ regulator-name = "+V1.05_AVDD";
-+ regulator-min-microvolt = <1050000>;
-+ regulator-max-microvolt = <1050000>;
-+ regulator-boot-on;
-+ regulator-always-on;
-+ ams,ext-control = <1>;
-+ };
-+
-+ vddio_sdmmc1: ldo1 {
-+ regulator-name = "VDDIO_SDMMC1";
-+ regulator-min-microvolt = <1800000>;
-+ regulator-max-microvolt = <3300000>;
-+ };
-+
-+ ldo2 {
-+ regulator-name = "+V1.2";
-+ regulator-min-microvolt = <1200000>;
-+ regulator-max-microvolt = <1200000>;
-+ regulator-boot-on;
-+ regulator-always-on;
-+ };
-+
-+ ldo3 {
-+ regulator-name = "+V1.05_RTC";
-+ regulator-min-microvolt = <1000000>;
-+ regulator-max-microvolt = <1000000>;
-+ regulator-boot-on;
-+ regulator-always-on;
-+ ams,enable-tracking;
-+ };
-+
-+ /* 1.8V for LVDS, 3.3V for eDP */
-+ ldo4 {
-+ regulator-name = "AVDD_LVDS0_PLL";
-+ regulator-min-microvolt = <1800000>;
-+ regulator-max-microvolt = <1800000>;
-+ };
-+
-+ /* LDO5 not used */
-+
-+ vddio_sdmmc3: ldo6 {
-+ regulator-name = "VDDIO_SDMMC3";
-+ regulator-min-microvolt = <1800000>;
-+ regulator-max-microvolt = <3300000>;
-+ };
-+
-+ /* LDO7 not used */
-+
-+ ldo9 {
-+ regulator-name = "+V3.3_ETH(ldo9)";
-+ regulator-min-microvolt = <3300000>;
-+ regulator-max-microvolt = <3300000>;
-+ regulator-always-on;
-+ };
-+
-+ ldo10 {
-+ regulator-name = "+V3.3_ETH(ldo10)";
-+ regulator-min-microvolt = <3300000>;
-+ regulator-max-microvolt = <3300000>;
-+ regulator-always-on;
-+ };
-+
-+ ldo11 {
-+ regulator-name = "+V1.8_VPP_FUSE";
-+ regulator-min-microvolt = <1800000>;
-+ regulator-max-microvolt = <1800000>;
-+ };
-+ };
-+ };
-+
-+ /*
-+ * TMP451 temperature sensor
-+ * Note: THERM_N directly connected to AS3722 PMIC THERM
-+ */
-+ temperature-sensor@4c {
-+ compatible = "ti,tmp451";
-+ reg = <0x4c>;
-+ interrupt-parent = <&gpio>;
-+ interrupts = <TEGRA_GPIO(I, 6) IRQ_TYPE_LEVEL_LOW>;
-+ #thermal-sensor-cells = <1>;
-+ };
-+ };
-+
-+ /* SPI2: MCU SPI */
-+ spi@7000d600 {
-+ status = "okay";
-+ spi-max-frequency = <25000000>;
-+ };
-+
-+ pmc@7000e400 {
-+ nvidia,invert-interrupt;
-+ nvidia,suspend-mode = <1>;
-+ nvidia,cpu-pwr-good-time = <500>;
-+ nvidia,cpu-pwr-off-time = <300>;
-+ nvidia,core-pwr-good-time = <641 3845>;
-+ nvidia,core-pwr-off-time = <61036>;
-+ nvidia,core-power-req-active-high;
-+ nvidia,sys-clock-req-active-high;
-+
-+ /* Set power_off bit in ResetControl register of AS3722 PMIC */
-+ i2c-thermtrip {
-+ nvidia,i2c-controller-id = <4>;
-+ nvidia,bus-addr = <0x40>;
-+ nvidia,reg-addr = <0x36>;
-+ nvidia,reg-data = <0x2>;
-+ };
-+ };
-+
-+ sata@70020000 {
-+ phys = <&{/padctl@7009f000/pads/sata/lanes/sata-0}>;
-+ phy-names = "sata-0";
-+ avdd-supply = <&vdd_1v05>;
-+ hvdd-supply = <&reg_3v3>;
-+ vddio-supply = <&vdd_1v05>;
-+ };
-+
-+ usb@70090000 {
-+ /* USBO1, USBO1 (SS), USBH2, USBH4 and USBH4 (SS) */
-+ phys = <&{/padctl@7009f000/pads/usb2/lanes/usb2-0}>,
-+ <&{/padctl@7009f000/pads/pcie/lanes/pcie-1}>,
-+ <&{/padctl@7009f000/pads/usb2/lanes/usb2-1}>,
-+ <&{/padctl@7009f000/pads/usb2/lanes/usb2-2}>,
-+ <&{/padctl@7009f000/pads/pcie/lanes/pcie-0}>;
-+ phy-names = "usb2-0", "usb3-1", "usb2-1", "usb2-2", "usb3-0";
-+ avddio-pex-supply = <&vdd_1v05>;
-+ avdd-pll-erefe-supply = <&avdd_1v05>;
-+ avdd-pll-utmip-supply = <&vddio_1v8>;
-+ avdd-usb-ss-pll-supply = <&vdd_1v05>;
-+ avdd-usb-supply = <&reg_3v3>;
-+ dvddio-pex-supply = <&vdd_1v05>;
-+ hvdd-usb-ss-pll-e-supply = <&reg_3v3>;
-+ hvdd-usb-ss-supply = <&reg_3v3>;
-+ };
-+
-+ padctl@7009f000 {
-+ pads {
-+ usb2 {
-+ status = "okay";
-+
-+ lanes {
-+ usb2-0 {
-+ nvidia,function = "xusb";
-+ status = "okay";
-+ };
-+
-+ usb2-1 {
-+ nvidia,function = "xusb";
-+ status = "okay";
-+ };
-+
-+ usb2-2 {
-+ nvidia,function = "xusb";
-+ status = "okay";
-+ };
-+ };
-+ };
-+
-+ pcie {
-+ status = "okay";
-+
-+ lanes {
-+ pcie-0 {
-+ nvidia,function = "usb3-ss";
-+ status = "okay";
-+ };
-+
-+ pcie-1 {
-+ nvidia,function = "usb3-ss";
-+ status = "okay";
-+ };
-+
-+ pcie-2 {
-+ nvidia,function = "pcie";
-+ status = "okay";
-+ };
-+
-+ pcie-3 {
-+ nvidia,function = "pcie";
-+ status = "okay";
-+ };
-+
-+ pcie-4 {
-+ nvidia,function = "pcie";
-+ status = "okay";
-+ };
-+ };
-+ };
-+
-+ sata {
-+ status = "okay";
-+
-+ lanes {
-+ sata-0 {
-+ nvidia,function = "sata";
-+ status = "okay";
-+ };
-+ };
-+ };
-+ };
-+
-+ ports {
-+ /* USBO1 */
-+ usb2-0 {
-+ status = "okay";
-+ mode = "otg";
-+
-+ vbus-supply = <&reg_usbo1_vbus>;
-+ };
-+
-+ /* USBH2 */
-+ usb2-1 {
-+ status = "okay";
-+ mode = "host";
-+
-+ vbus-supply = <&reg_usbh_vbus>;
-+ };
-+
-+ /* USBH4 */
-+ usb2-2 {
-+ status = "okay";
-+ mode = "host";
-+
-+ vbus-supply = <&reg_usbh_vbus>;
-+ };
-+
-+ usb3-0 {
-+ nvidia,usb2-companion = <2>;
-+ status = "okay";
-+ };
-+
-+ usb3-1 {
-+ nvidia,usb2-companion = <0>;
-+ status = "okay";
-+ };
-+ };
-+ };
-+
-+ /* eMMC */
-+ sdhci@700b0600 {
-+ status = "okay";
-+ bus-width = <8>;
-+ non-removable;
-+ };
-+
-+ /* CPU DFLL clock */
-+ clock@70110000 {
-+ status = "okay";
-+ vdd-cpu-supply = <&vdd_cpu>;
-+ nvidia,i2c-fs-rate = <400000>;
-+ };
-+
-+ ahub@70300000 {
-+ i2s@70301200 {
-+ status = "okay";
-+ };
-+ };
-+
-+ clocks {
-+ compatible = "simple-bus";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ clk32k_in: clock@0 {
-+ compatible = "fixed-clock";
-+ reg = <0>;
-+ #clock-cells = <0>;
-+ clock-frequency = <32768>;
-+ };
-+ };
-+
-+ cpus {
-+ cpu@0 {
-+ vdd-cpu-supply = <&vdd_cpu>;
-+ };
-+ };
-+
-+ reg_1v05_avdd_hdmi_pll: regulator-1v05-avdd-hdmi-pll {
-+ compatible = "regulator-fixed";
-+ regulator-name = "+V1.05_AVDD_HDMI_PLL";
-+ regulator-min-microvolt = <1050000>;
-+ regulator-max-microvolt = <1050000>;
-+ gpio = <&gpio TEGRA_GPIO(H, 7) GPIO_ACTIVE_LOW>;
-+ vin-supply = <&vdd_1v05>;
-+ };
-+
-+ reg_3v3_mxm: regulator-3v3-mxm {
-+ compatible = "regulator-fixed";
-+ regulator-name = "+V3.3_MXM";
-+ regulator-min-microvolt = <3300000>;
-+ regulator-max-microvolt = <3300000>;
-+ regulator-always-on;
-+ regulator-boot-on;
-+ };
-+
-+ reg_3v3: regulator-3v3 {
-+ compatible = "regulator-fixed";
-+ regulator-name = "+V3.3";
-+ regulator-min-microvolt = <3300000>;
-+ regulator-max-microvolt = <3300000>;
-+ regulator-always-on;
-+ regulator-boot-on;
-+ /* PWR_EN_+V3.3 */
-+ gpio = <&pmic 2 GPIO_ACTIVE_HIGH>;
-+ enable-active-high;
-+ vin-supply = <&reg_3v3_mxm>;
-+ };
-+
-+ reg_3v3_avdd_hdmi: regulator-3v3-avdd-hdmi {
-+ compatible = "regulator-fixed";
-+ regulator-name = "+V3.3_AVDD_HDMI";
-+ regulator-min-microvolt = <3300000>;
-+ regulator-max-microvolt = <3300000>;
-+ vin-supply = <&vdd_1v05>;
-+ };
-+
-+ sound {
-+ compatible = "toradex,tegra-audio-sgtl5000-apalis_tk1",
-+ "nvidia,tegra-audio-sgtl5000";
-+ nvidia,model = "Toradex Apalis TK1";
-+ nvidia,audio-routing =
-+ "Headphone Jack", "HP_OUT",
-+ "LINE_IN", "Line In Jack",
-+ "MIC_IN", "Mic Jack";
-+ nvidia,i2s-controller = <&tegra_i2s2>;
-+ nvidia,audio-codec = <&sgtl5000>;
-+ clocks = <&tegra_car TEGRA124_CLK_PLL_A>,
-+ <&tegra_car TEGRA124_CLK_PLL_A_OUT0>,
-+ <&tegra_car TEGRA124_CLK_EXTERN1>;
-+ clock-names = "pll_a", "pll_a_out0", "mclk";
-+ };
-+
-+ thermal-zones {
-+ cpu {
-+ trips {
-+ cpu-shutdown-trip {
-+ temperature = <101000>;
-+ hysteresis = <0>;
-+ type = "critical";
-+ };
-+ };
-+ };
-+
-+ mem {
-+ trips {
-+ mem-shutdown-trip {
-+ temperature = <101000>;
-+ hysteresis = <0>;
-+ type = "critical";
-+ };
-+ };
-+ };
-+
-+ gpu {
-+ trips {
-+ gpu-shutdown-trip {
-+ temperature = <101000>;
-+ hysteresis = <0>;
-+ type = "critical";
-+ };
-+ };
-+ };
-+ };
-+};
-+
-+&gpio {
-+ /* I210 Gigabit Ethernet Controller Reset */
-+ lan_reset_n {
-+ gpio-hog;
-+ gpios = <TEGRA_GPIO(S, 2) GPIO_ACTIVE_HIGH>;
-+ output-high;
-+ line-name = "LAN_RESET_N";
-+ };
-+
-+ /* Control MXM3 pin 26 Reset Module Output Carrier Input */
-+ reset_moci_ctrl {
-+ gpio-hog;
-+ gpios = <TEGRA_GPIO(U, 4) GPIO_ACTIVE_HIGH>;
-+ output-high;
-+ line-name = "RESET_MOCI_CTRL";
-+ };
-+};
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0008-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0008-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch
deleted file mode 100644
index 7b44fdc..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0008-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-From 4a3ae8e688872fdc63a2d7af1f3b48b3eba3b975 Mon Sep 17 00:00:00 2001
-Message-Id: <4a3ae8e688872fdc63a2d7af1f3b48b3eba3b975.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Mon, 13 Nov 2017 14:37:25 +0100
-Subject: [PATCH 08/33] apalis-tk1: fix pcie reset for reliable gigabit
- ethernet operation
-
-It turns out that the current PCIe reset implementation is not quite
-working reliably due to some Intel i210 errata. Fix this by making sure
-the i210's +V3.3_ETH rail is properly disabled during its reset
-sequence.
-
-Also further improve on the bringing up the PCIe switch as found on the
-Apalis Evaluation board.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-(downstream commit 7ad9771527d2b1c884beb22d9df28bae899f8d3d)
----
- drivers/pci/host/pci-tegra.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 72 insertions(+)
-
-diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
-index 5c7916b5de73..0c6237159243 100644
---- a/drivers/pci/host/pci-tegra.c
-+++ b/drivers/pci/host/pci-tegra.c
-@@ -71,8 +71,12 @@
- #ifdef CONFIG_MACH_APALIS_TK1
- #define APALIS_GPIO7 TEGRA_GPIO(DD, 1)
-
-+#define LAN_DEV_OFF_N TEGRA_GPIO(O, 6)
-+
- #define LAN_RESET_N TEGRA_GPIO(S, 2)
-
-+#define LAN_WAKE_N TEGRA_GPIO(O, 5)
-+
- #define PEX_PERST_N APALIS_GPIO7
-
- #define RESET_MOCI_N TEGRA_GPIO(U, 4)
-@@ -329,6 +333,11 @@ struct tegra_pcie {
- struct regulator_bulk_data *supplies;
- unsigned int num_supplies;
-
-+#ifdef CONFIG_MACH_APALIS_TK1
-+ struct regulator *regulator_apalis_tk1_ldo9;
-+ struct regulator *regulator_apalis_tk1_ldo10;
-+#endif /* CONFIG_MACH_APALIS_TK1 */
-+
- const struct tegra_pcie_soc *soc;
- struct dentry *debugfs;
- };
-@@ -592,6 +601,42 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
- gpio_request(LAN_RESET_N, "LAN_RESET_N");
- gpio_direction_output(LAN_RESET_N, 0);
- }
-+
-+ /*
-+ * Make sure we don't get any back feeding from LAN_WAKE_N resp.
-+ * DEV_OFF_N
-+ */
-+ gpio_request(LAN_WAKE_N, "LAN_WAKE_N");
-+ gpio_request(LAN_DEV_OFF_N, "LAN_DEV_OFF_N");
-+ gpio_direction_output(LAN_WAKE_N, 0);
-+ gpio_direction_output(LAN_DEV_OFF_N, 0);
-+
-+ /* Make sure LDO9 and LDO10 are initially disabled @ 0V */
-+ if (regulator_is_enabled(port->pcie->regulator_apalis_tk1_ldo9))
-+ regulator_disable(port->pcie->regulator_apalis_tk1_ldo9);
-+ if (regulator_is_enabled(port->pcie->regulator_apalis_tk1_ldo10))
-+ regulator_disable(port->pcie->regulator_apalis_tk1_ldo10);
-+
-+ mdelay(100);
-+
-+ /* Make sure LAN_WAKE_N gets re-configured as a GPIO input */
-+ gpio_direction_input(LAN_WAKE_N);
-+
-+ /* Make sure controller gets enabled by disabling DEV_OFF_N */
-+ gpio_set_value(LAN_DEV_OFF_N, 1);
-+
-+ /*
-+ * Enable LDO9 and LDO10 for +V3.3_ETH on patched prototype
-+ * V1.0A and sample V1.0B and newer modules
-+ */
-+ if (regulator_enable(port->pcie->regulator_apalis_tk1_ldo9) < 0) {
-+ pr_err("pcie: couldn't enable regulator i210_vdd3p3_ldo9\n");
-+ return;
-+ }
-+ if (regulator_enable(port->pcie->regulator_apalis_tk1_ldo10) < 0) {
-+ pr_err("pcie: couldn't enable regulator i210_vdd3p3_ldo10\n");
-+ return;
-+ }
- #endif /* CONFIG_MACH_APALIS_TK1 */
- #endif /* CONFIG_MACH_APALIS_T30 || CONFIG_MACH_APALIS_TK1 */
-
-@@ -607,6 +652,10 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
- afi_writel(port->pcie, value, ctrl);
-
- #if defined(CONFIG_MACH_APALIS_T30) || defined(CONFIG_MACH_APALIS_TK1)
-+#ifdef CONFIG_MACH_APALIS_TK1
-+ gpio_set_value(LAN_RESET_N, 1);
-+#endif /* CONFIG_MACH_APALIS_TK1 */
-+
- /* Must be asserted for 100 ms after power and clocks are stable */
- if (g_pex_perst)
- gpio_set_value(PEX_PERST_N, 1);
-@@ -1181,6 +1230,29 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie)
- return err;
- }
-
-+#ifdef CONFIG_MACH_APALIS_TK1
-+ if (pcie->regulator_apalis_tk1_ldo9 == NULL) {
-+ pcie->regulator_apalis_tk1_ldo9 = regulator_get(pcie->dev, "i210_vdd3p3_ldo9");
-+ if (IS_ERR(pcie->regulator_apalis_tk1_ldo9)) {
-+ pr_err("pcie: couldn't get regulator i210_vdd3p3_ldo9\n");
-+ pcie->regulator_apalis_tk1_ldo9 = 0;
-+ }
-+ }
-+
-+ if (pcie->regulator_apalis_tk1_ldo10 == NULL) {
-+ pcie->regulator_apalis_tk1_ldo10 = regulator_get(pcie->dev, "i210_vdd3p3_ldo10");
-+ if (IS_ERR(pcie->regulator_apalis_tk1_ldo10)) {
-+ pr_err("pcie: couldn't get regulator i210_vdd3p3_ldo10\n");
-+ pcie->regulator_apalis_tk1_ldo10 = 0;
-+ }
-+ }
-+
-+ if (pcie->regulator_apalis_tk1_ldo9)
-+ err = regulator_enable(pcie->regulator_apalis_tk1_ldo9);
-+ if (pcie->regulator_apalis_tk1_ldo10)
-+ err = regulator_enable(pcie->regulator_apalis_tk1_ldo10);
-+#endif /* CONFIG_MACH_APALIS_TK1 */
-+
- reset_control_deassert(pcie->afi_rst);
-
- err = clk_prepare_enable(pcie->afi_clk);
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0009-drm-tegra-gem-Reshuffle-declarations.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0009-drm-tegra-gem-Reshuffle-declarations.patch
deleted file mode 100644
index a06dffd..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0009-drm-tegra-gem-Reshuffle-declarations.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From a8aeca9abdda04e5690c2208bc8fe6532a8fb798 Mon Sep 17 00:00:00 2001
-Message-Id: <a8aeca9abdda04e5690c2208bc8fe6532a8fb798.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Thierry Reding <treding@nvidia.com>
-Date: Wed, 7 Feb 2018 18:45:54 +0100
-Subject: [PATCH 09/33] drm/tegra: gem: Reshuffle declarations
-
-Move declarations in the gem.h header file into the same order as the
-corresponding definitions in gem.c.
-
-Signed-off-by: Thierry Reding <treding@nvidia.com>
----
- drivers/gpu/drm/tegra/gem.h | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/tegra/gem.h b/drivers/gpu/drm/tegra/gem.h
-index 8eb9fd24ef0e..1fcf94dce45c 100644
---- a/drivers/gpu/drm/tegra/gem.h
-+++ b/drivers/gpu/drm/tegra/gem.h
-@@ -68,10 +68,10 @@ void tegra_bo_free_object(struct drm_gem_object *gem);
- int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
- struct drm_mode_create_dumb *args);
-
--int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
--
- extern const struct vm_operations_struct tegra_bo_vm_ops;
-
-+int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
-+
- struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
- struct drm_gem_object *gem,
- int flags);
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch
deleted file mode 100644
index b8ca0cb..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 67619709309f73e21c785901e3535048fd05b62f Mon Sep 17 00:00:00 2001
-Message-Id: <67619709309f73e21c785901e3535048fd05b62f.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Thierry Reding <treding@nvidia.com>
-Date: Wed, 7 Feb 2018 18:45:55 +0100
-Subject: [PATCH 10/33] drm/tegra: gem: Make __tegra_gem_mmap() available more
- widely
-
-This function allows mapping a GEM object into a virtual memory address
-space, which makes it useful outside of the GEM code.
-
-While at it, rename the function so it doesn't clash with the function
-that implements the DRM_TEGRA_GEM_MMAP IOCTL.
-
-Signed-off-by: Thierry Reding <treding@nvidia.com>
----
- drivers/gpu/drm/tegra/gem.c | 7 +++----
- drivers/gpu/drm/tegra/gem.h | 1 +
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
-index ab1e53d434e8..8d702dfe817e 100644
---- a/drivers/gpu/drm/tegra/gem.c
-+++ b/drivers/gpu/drm/tegra/gem.c
-@@ -460,8 +460,7 @@ const struct vm_operations_struct tegra_bo_vm_ops = {
- .close = drm_gem_vm_close,
- };
-
--static int tegra_gem_mmap(struct drm_gem_object *gem,
-- struct vm_area_struct *vma)
-+int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
- {
- struct tegra_bo *bo = to_tegra_bo(gem);
-
-@@ -508,7 +507,7 @@ int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
-
- gem = vma->vm_private_data;
-
-- return tegra_gem_mmap(gem, vma);
-+ return __tegra_gem_mmap(gem, vma);
- }
-
- static struct sg_table *
-@@ -601,7 +600,7 @@ static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct *vma)
- if (err < 0)
- return err;
-
-- return tegra_gem_mmap(gem, vma);
-+ return __tegra_gem_mmap(gem, vma);
- }
-
- static void *tegra_gem_prime_vmap(struct dma_buf *buf)
-diff --git a/drivers/gpu/drm/tegra/gem.h b/drivers/gpu/drm/tegra/gem.h
-index 1fcf94dce45c..6bd7dd7e55b4 100644
---- a/drivers/gpu/drm/tegra/gem.h
-+++ b/drivers/gpu/drm/tegra/gem.h
-@@ -70,6 +70,7 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
-
- extern const struct vm_operations_struct tegra_bo_vm_ops;
-
-+int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma);
- int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
-
- struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0011-drm-tegra-fb-Implement-fb_mmap-callback.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0011-drm-tegra-fb-Implement-fb_mmap-callback.patch
deleted file mode 100644
index 0bc4e54..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0011-drm-tegra-fb-Implement-fb_mmap-callback.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 3d6b20bdedc331561dd04a1ac48f4eea61ddda4c Mon Sep 17 00:00:00 2001
-Message-Id: <3d6b20bdedc331561dd04a1ac48f4eea61ddda4c.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Thierry Reding <treding@nvidia.com>
-Date: Wed, 7 Feb 2018 18:45:56 +0100
-Subject: [PATCH 11/33] drm/tegra: fb: Implement ->fb_mmap() callback
-
-This fixes hangs with legacy applications that use the mmap() syscall on
-the fbdev device to map framebuffer memory. The fbdev implementation for
-mmap() creates a mapping that conflicts with DRM usage and causes a hang
-when the memory is accessed through the mapping.
-
-Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Signed-off-by: Thierry Reding <treding@nvidia.com>
-Tested-by: Stefan Agner <stefan@agner.ch>
-Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Signed-off-by: Thierry Reding <treding@nvidia.com>
----
- drivers/gpu/drm/tegra/fb.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
-
-diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
-index 80540c1c66dc..4681e184f125 100644
---- a/drivers/gpu/drm/tegra/fb.c
-+++ b/drivers/gpu/drm/tegra/fb.c
-@@ -201,12 +201,28 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
- }
-
- #ifdef CONFIG_DRM_FBDEV_EMULATION
-+static int tegra_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
-+{
-+ struct drm_fb_helper *helper = info->par;
-+ struct tegra_bo *bo;
-+ int err;
-+
-+ bo = tegra_fb_get_plane(helper->fb, 0);
-+
-+ err = drm_gem_mmap_obj(&bo->gem, bo->gem.size, vma);
-+ if (err < 0)
-+ return err;
-+
-+ return __tegra_gem_mmap(&bo->gem, vma);
-+}
-+
- static struct fb_ops tegra_fb_ops = {
- .owner = THIS_MODULE,
- DRM_FB_HELPER_DEFAULT_OPS,
- .fb_fillrect = drm_fb_helper_sys_fillrect,
- .fb_copyarea = drm_fb_helper_sys_copyarea,
- .fb_imageblit = drm_fb_helper_sys_imageblit,
-+ .fb_mmap = tegra_fb_mmap,
- };
-
- static int tegra_fbdev_probe(struct drm_fb_helper *helper,
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0012-apalis-tk1-support-for-k20-mfd.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0012-apalis-tk1-support-for-k20-mfd.patch
deleted file mode 100644
index 3042ca4..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0012-apalis-tk1-support-for-k20-mfd.patch
+++ /dev/null
@@ -1,3185 +0,0 @@
-From 55301c43044ec23e14509a5515a868b7ae995aa1 Mon Sep 17 00:00:00 2001
-Message-Id: <55301c43044ec23e14509a5515a868b7ae995aa1.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Dominik Sliwa <dominik.sliwa@toradex.com>
-Date: Wed, 18 Apr 2018 12:22:26 +0200
-Subject: [PATCH 12/33] apalis-tk1: support for k20 mfd
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi | 28 +
- arch/arm/configs/tegra_defconfig | 7 +
- drivers/gpio/Kconfig | 6 +
- drivers/gpio/Makefile | 1 +
- drivers/gpio/gpio-apalis-tk1-k20.c | 221 +++++
- drivers/iio/adc/Kconfig | 6 +
- drivers/iio/adc/Makefile | 1 +
- drivers/iio/adc/apalis-tk1-k20_adc.c | 200 +++++
- drivers/input/touchscreen/Kconfig | 10 +
- drivers/input/touchscreen/Makefile | 1 +
- drivers/input/touchscreen/apalis-tk1-k20_ts.c | 234 ++++++
- drivers/mfd/Kconfig | 14 +
- drivers/mfd/Makefile | 1 +
- drivers/mfd/apalis-tk1-k20-ezp.h | 47 ++
- drivers/mfd/apalis-tk1-k20.c | 1062 +++++++++++++++++++++++++
- drivers/net/can/Kconfig | 6 +
- drivers/net/can/Makefile | 1 +
- drivers/net/can/apalis-tk1-k20-can.c | 817 +++++++++++++++++++
- drivers/spi/spi-tegra114.c | 7 +-
- include/linux/mfd/apalis-tk1-k20-api.h | 123 +++
- include/linux/mfd/apalis-tk1-k20.h | 114 +++
- 21 files changed, 2901 insertions(+), 6 deletions(-)
- create mode 100644 drivers/gpio/gpio-apalis-tk1-k20.c
- create mode 100644 drivers/iio/adc/apalis-tk1-k20_adc.c
- create mode 100644 drivers/input/touchscreen/apalis-tk1-k20_ts.c
- create mode 100644 drivers/mfd/apalis-tk1-k20-ezp.h
- create mode 100644 drivers/mfd/apalis-tk1-k20.c
- create mode 100644 drivers/net/can/apalis-tk1-k20-can.c
- create mode 100644 include/linux/mfd/apalis-tk1-k20-api.h
- create mode 100644 include/linux/mfd/apalis-tk1-k20.h
-
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-index bb67edb016c5..93cf49c10954 100644
---- a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-@@ -1756,6 +1756,34 @@
- spi@7000d600 {
- status = "okay";
- spi-max-frequency = <25000000>;
-+
-+ k20mcu: apalis-tk1-k20@1 {
-+ compatible = "toradex,apalis-tk1-k20";
-+ reg = <1>;
-+ spi-max-frequency = <6120000>;
-+ interrupt-parent =<&gpio>;
-+ interrupts = <TEGRA_GPIO(K, 2) (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)>,
-+ <TEGRA_GPIO(I, 5) (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)>, /* INT3 CAN0 */
-+ <TEGRA_GPIO(J, 0) (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)>; /* INT4 CAN1 */
-+ rst-gpio = <&gpio TEGRA_GPIO(BB, 6) GPIO_ACTIVE_HIGH>;
-+
-+ /* GPIO based CS used to enter K20 EzPort mode */
-+ ezport-cs-gpio = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>;
-+ /* extra INT lines between K20 and TK1 */
-+ int2-gpio = <&gpio TEGRA_GPIO(J, 2) GPIO_ACTIVE_HIGH>;
-+
-+ toradex,apalis-tk1-k20-uses-adc;
-+ toradex,apalis-tk1-k20-uses-can;
-+ toradex,apalis-tk1-k20-uses-gpio;
-+ toradex,apalis-tk1-k20-uses-tsc;
-+
-+ controller-data {
-+ nvidia,enable-hw-based-cs;
-+ nvidia,cs-setup-clk-count = <1>;
-+ nvidia,cs-hold-clk-count = <1>;
-+ };
-+ };
-+
- };
-
- pmc@7000e400 {
-diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
-index cfe997c617fc..e8c9bdafa1b9 100644
---- a/arch/arm/configs/tegra_defconfig
-+++ b/arch/arm/configs/tegra_defconfig
-@@ -63,6 +63,7 @@ CONFIG_IPV6_MIP6=y
- CONFIG_IPV6_TUNNEL=y
- CONFIG_IPV6_MULTIPLE_TABLES=y
- CONFIG_CAN=y
-+CONFIG_CAN_APALIS_TK1_K20=m
- CONFIG_CAN_MCP251X=y
- CONFIG_BT=y
- CONFIG_BT_RFCOMM=y
-@@ -126,6 +127,7 @@ CONFIG_KEYBOARD_TEGRA=y
- CONFIG_KEYBOARD_CROS_EC=y
- CONFIG_MOUSE_PS2_ELANTECH=y
- CONFIG_INPUT_TOUCHSCREEN=y
-+CONFIG_TOUCHSCREEN_APALIS_TK1_K20=m
- CONFIG_TOUCHSCREEN_ATMEL_MXT=y
- CONFIG_TOUCHSCREEN_WM97XX=y
- # CONFIG_TOUCHSCREEN_WM9705 is not set
-@@ -155,6 +157,7 @@ CONFIG_GPIO_PCA953X_IRQ=y
- CONFIG_GPIO_PALMAS=y
- CONFIG_GPIO_TPS6586X=y
- CONFIG_GPIO_TPS65910=y
-+CONFIG_GPIO_APALIS_TK1_K20=m
- CONFIG_POWER_RESET=y
- CONFIG_POWER_RESET_AS3722=y
- CONFIG_POWER_RESET_GPIO=y
-@@ -165,6 +168,8 @@ CONFIG_SENSORS_LM95245=y
- CONFIG_WATCHDOG=y
- CONFIG_TEGRA_WATCHDOG=y
- CONFIG_MFD_AS3722=y
-+CONFIG_MFD_APALIS_TK1_K20=m
-+CONFIG_APALIS_TK1_K20_EZP=y
- CONFIG_MFD_CROS_EC=y
- CONFIG_MFD_CROS_EC_SPI=y
- CONFIG_MFD_MAX8907=y
-@@ -276,6 +281,7 @@ CONFIG_ARCH_TEGRA_114_SOC=y
- CONFIG_ARCH_TEGRA_124_SOC=y
- CONFIG_MEMORY=y
- CONFIG_IIO=y
-+CONFIG_APALIS_TK1_K20_ADC=m
- CONFIG_MPU3050_I2C=y
- CONFIG_SENSORS_ISL29018=y
- CONFIG_SENSORS_ISL29028=y
-@@ -309,6 +315,7 @@ CONFIG_ROOT_NFS=y
- CONFIG_NLS_CODEPAGE_437=y
- CONFIG_NLS_ISO8859_1=y
- CONFIG_PRINTK_TIME=y
-+CONFIG_DYNAMIC_DEBUG=y
- CONFIG_DEBUG_INFO=y
- CONFIG_MAGIC_SYSRQ=y
- CONFIG_DEBUG_SLAB=y
-diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
-index 3f80f167ed56..c5b006c10d37 100644
---- a/drivers/gpio/Kconfig
-+++ b/drivers/gpio/Kconfig
-@@ -1248,6 +1248,12 @@ endmenu
- menu "SPI GPIO expanders"
- depends on SPI_MASTER
-
-+config GPIO_APALIS_TK1_K20
-+ tristate "GPIOs of K20 MCU on Apalis TK1"
-+ depends on MFD_APALIS_TK1_K20
-+ help
-+ This enables support for GPIOs of K20 MCU found on Apalis TK1.
-+
- config GPIO_74X164
- tristate "74x164 serial-in/parallel-out 8-bits shift register"
- depends on OF_GPIO
-diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
-index 8a2dfba3b231..8ea42ecdf87e 100644
---- a/drivers/gpio/Makefile
-+++ b/drivers/gpio/Makefile
-@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA) += gpio-altera.o
- obj-$(CONFIG_GPIO_ALTERA_A10SR) += gpio-altera-a10sr.o
- obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o
- obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o
-+obj-$(CONFIG_GPIO_APALIS_TK1_K20) += gpio-apalis-tk1-k20.o
- obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o
- obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o
- obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o
-diff --git a/drivers/gpio/gpio-apalis-tk1-k20.c b/drivers/gpio/gpio-apalis-tk1-k20.c
-new file mode 100644
-index 000000000000..7b44f93df85b
---- /dev/null
-+++ b/drivers/gpio/gpio-apalis-tk1-k20.c
-@@ -0,0 +1,221 @@
-+/*
-+ * Copyright 2016-2017 Toradex AG
-+ * Dominik Sliwa <dominik.sliwa@toradex.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it under
-+ * the terms of the GNU General Public License version 2 as published by the
-+ * Free Software Foundation.
-+ */
-+
-+#include <linux/mfd/apalis-tk1-k20.h>
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/gpio.h>
-+#include <linux/slab.h>
-+#include <linux/platform_device.h>
-+
-+struct apalis_tk1_k20_gpio {
-+ struct gpio_chip chip;
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20;
-+};
-+
-+static int apalis_tk1_k20_gpio_input(struct gpio_chip *chip,
-+ unsigned int offset)
-+{
-+ struct apalis_tk1_k20_gpio *gpio = container_of(chip,
-+ struct apalis_tk1_k20_gpio, chip);
-+
-+ apalis_tk1_k20_lock(gpio->apalis_tk1_k20);
-+
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_NO,
-+ offset);
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_STA,
-+ 0);
-+
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_gpio_output(struct gpio_chip *chip,
-+ unsigned int offset,
-+ int value)
-+{
-+ struct apalis_tk1_k20_gpio *gpio = container_of(chip,
-+ struct apalis_tk1_k20_gpio, chip);
-+ int status;
-+
-+ apalis_tk1_k20_lock(gpio->apalis_tk1_k20);
-+
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_NO,
-+ offset);
-+ status = APALIS_TK1_K20_GPIO_STA_OE;
-+ status += value ? APALIS_TK1_K20_GPIO_STA_VAL : 0;
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_STA,
-+ status);
-+
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_gpio_get(struct gpio_chip *chip, unsigned int offset)
-+{
-+ struct apalis_tk1_k20_gpio *gpio = container_of(chip,
-+ struct apalis_tk1_k20_gpio, chip);
-+ int value;
-+
-+ apalis_tk1_k20_lock(gpio->apalis_tk1_k20);
-+
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_NO,
-+ offset);
-+ if (apalis_tk1_k20_reg_read(gpio->apalis_tk1_k20,
-+ APALIS_TK1_K20_GPIO_STA, &value) < 0) {
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+ return -ENODEV;
-+ }
-+ value &= APALIS_TK1_K20_GPIO_STA_VAL;
-+
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+
-+ return value ? 1 : 0;
-+}
-+
-+static int apalis_tk1_k20_gpio_request(struct gpio_chip *chip,
-+ unsigned int offset)
-+{
-+ struct apalis_tk1_k20_gpio *gpio = container_of(chip,
-+ struct apalis_tk1_k20_gpio, chip);
-+ int status = 0;
-+
-+ dev_dbg(gpio->apalis_tk1_k20->dev, "APALIS TK1 K20 GPIO %d\n",
-+ offset);
-+
-+ apalis_tk1_k20_lock(gpio->apalis_tk1_k20);
-+
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_NO,
-+ offset);
-+ if (apalis_tk1_k20_reg_read(gpio->apalis_tk1_k20,
-+ APALIS_TK1_K20_GPIO_NO, &status) < 0) {
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+ return -ENODEV;
-+ }
-+
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+
-+ return status;
-+}
-+
-+static void apalis_tk1_k20_gpio_free(struct gpio_chip *chip,
-+ unsigned int offset)
-+{
-+ struct apalis_tk1_k20_gpio *gpio =
-+ container_of(chip, struct apalis_tk1_k20_gpio, chip);
-+
-+ apalis_tk1_k20_lock(gpio->apalis_tk1_k20);
-+
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_NO,
-+ offset);
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20,
-+ APALIS_TK1_K20_GPIO_STA, 0);
-+
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+}
-+
-+
-+static void apalis_tk1_k20_gpio_set(struct gpio_chip *chip, unsigned int offset,
-+ int value)
-+{
-+ struct apalis_tk1_k20_gpio *gpio = container_of(chip,
-+ struct apalis_tk1_k20_gpio, chip);
-+ int status;
-+
-+ apalis_tk1_k20_lock(gpio->apalis_tk1_k20);
-+
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_NO,
-+ offset);
-+ if (apalis_tk1_k20_reg_read(gpio->apalis_tk1_k20,
-+ APALIS_TK1_K20_GPIO_STA, &status) < 0) {
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+ return;
-+ }
-+
-+ status &= ~APALIS_TK1_K20_GPIO_STA_VAL;
-+ status += value ? APALIS_TK1_K20_GPIO_STA_VAL : 0;
-+ apalis_tk1_k20_reg_write(gpio->apalis_tk1_k20, APALIS_TK1_K20_GPIO_STA,
-+ status);
-+
-+ apalis_tk1_k20_unlock(gpio->apalis_tk1_k20);
-+}
-+
-+static int apalis_tk1_k20_gpio_probe(struct platform_device *pdev)
-+{
-+ struct apalis_tk1_k20_gpio *priv;
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20;
-+ int status;
-+
-+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-+ if (!priv)
-+ return -ENOMEM;
-+
-+ apalis_tk1_k20 = dev_get_drvdata(pdev->dev.parent);
-+ if (!apalis_tk1_k20)
-+ return -ENODEV;
-+ priv->apalis_tk1_k20 = apalis_tk1_k20;
-+
-+ platform_set_drvdata(pdev, priv);
-+
-+ apalis_tk1_k20_lock(apalis_tk1_k20);
-+
-+ /* TBD: some code */
-+
-+ apalis_tk1_k20_unlock(apalis_tk1_k20);
-+
-+ priv->chip.base = -1;
-+ priv->chip.can_sleep = 1;
-+ priv->chip.parent = &pdev->dev;
-+ priv->chip.owner = THIS_MODULE;
-+ priv->chip.get = apalis_tk1_k20_gpio_get;
-+ priv->chip.set = apalis_tk1_k20_gpio_set;
-+ priv->chip.direction_input = apalis_tk1_k20_gpio_input;
-+ priv->chip.direction_output = apalis_tk1_k20_gpio_output;
-+ priv->chip.request = apalis_tk1_k20_gpio_request;
-+ priv->chip.free = apalis_tk1_k20_gpio_free;
-+ /* TODO: include as a define somewhere */
-+ priv->chip.ngpio = 160;
-+
-+ status = gpiochip_add(&priv->chip);
-+
-+ return status;
-+}
-+
-+static int apalis_tk1_k20_gpio_remove(struct platform_device *pdev)
-+{
-+ struct apalis_tk1_k20_gpio *priv = platform_get_drvdata(pdev);
-+
-+ gpiochip_remove(&priv->chip);
-+ return 0;
-+}
-+
-+static const struct platform_device_id apalis_tk1_k20_gpio_idtable[] = {
-+ {
-+ .name = "apalis-tk1-k20-gpio",
-+ },
-+ { /* sentinel */ }
-+};
-+MODULE_DEVICE_TABLE(platform, apalis_tk1_k20_gpio_idtable);
-+
-+static struct platform_driver apalis_tk1_k20_gpio_driver = {
-+ .id_table = apalis_tk1_k20_gpio_idtable,
-+ .remove = apalis_tk1_k20_gpio_remove,
-+ .probe = apalis_tk1_k20_gpio_probe,
-+ .driver = {
-+ .name = "apalis-tk1-k20-gpio",
-+ },
-+};
-+
-+module_platform_driver(apalis_tk1_k20_gpio_driver);
-+
-+MODULE_DESCRIPTION("GPIO driver for K20 MCU on Apalis TK1");
-+MODULE_AUTHOR("Dominik Sliwa <dominik.sliwa@toradex.com>");
-+MODULE_LICENSE("GPL v2");
-diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
-index 369a2c632e46..d4ec5fad1467 100644
---- a/drivers/iio/adc/Kconfig
-+++ b/drivers/iio/adc/Kconfig
-@@ -116,6 +116,12 @@ config AD7923
- To compile this driver as a module, choose M here: the
- module will be called ad7923.
-
-+config APALIS_TK1_K20_ADC
-+ tristate "ADCs of K20 MCU on Apalis TK1"
-+ depends on MFD_APALIS_TK1_K20
-+ help
-+ This enables support for ADCs of K20 MCU found on Apalis TK1.
-+
- config AD799X
- tristate "Analog Devices AD799x ADC driver"
- depends on I2C
-diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
-index 9572c1090f35..5f761384b305 100644
---- a/drivers/iio/adc/Makefile
-+++ b/drivers/iio/adc/Makefile
-@@ -16,6 +16,7 @@ obj-$(CONFIG_AD7793) += ad7793.o
- obj-$(CONFIG_AD7887) += ad7887.o
- obj-$(CONFIG_AD799X) += ad799x.o
- obj-$(CONFIG_ASPEED_ADC) += aspeed_adc.o
-+obj-$(CONFIG_APALIS_TK1_K20_ADC) += apalis-tk1-k20_adc.o
- obj-$(CONFIG_AT91_ADC) += at91_adc.o
- obj-$(CONFIG_AT91_SAMA5D2_ADC) += at91-sama5d2_adc.o
- obj-$(CONFIG_AXP20X_ADC) += axp20x_adc.o
-diff --git a/drivers/iio/adc/apalis-tk1-k20_adc.c b/drivers/iio/adc/apalis-tk1-k20_adc.c
-new file mode 100644
-index 000000000000..b45e51df5c81
---- /dev/null
-+++ b/drivers/iio/adc/apalis-tk1-k20_adc.c
-@@ -0,0 +1,200 @@
-+/*
-+ * Copyright 2016-2017 Toradex AG
-+ * Dominik Sliwa <dominik.sliwa@toradex.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it under
-+ * the terms of the GNU General Public License version 2 as published by the
-+ * Free Software Foundation.
-+ */
-+
-+#include <linux/mfd/apalis-tk1-k20.h>
-+#include <linux/delay.h>
-+#include <linux/iio/iio.h>
-+#include <linux/iio/driver.h>
-+#include <linux/iio/machine.h>
-+#include <linux/module.h>
-+#include <linux/mutex.h>
-+#include <linux/platform_device.h>
-+#include <linux/slab.h>
-+
-+struct apalis_tk1_k20_adc {
-+ struct iio_dev chip;
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20;
-+};
-+
-+static int apalis_tk1_k20_get_adc_result(struct apalis_tk1_k20_adc *adc, int id,
-+ int *val)
-+{
-+ uint8_t adc_read[2];
-+ int adc_register;
-+
-+ switch (id) {
-+ case APALIS_TK1_K20_ADC1:
-+ adc_register = APALIS_TK1_K20_ADC_CH0L;
-+ break;
-+ case APALIS_TK1_K20_ADC2:
-+ adc_register = APALIS_TK1_K20_ADC_CH1L;
-+ break;
-+ case APALIS_TK1_K20_ADC3:
-+ adc_register = APALIS_TK1_K20_ADC_CH2L;
-+ break;
-+ case APALIS_TK1_K20_ADC4:
-+ adc_register = APALIS_TK1_K20_ADC_CH3L;
-+ break;
-+ default:
-+ return -ENODEV;
-+ }
-+
-+ apalis_tk1_k20_lock(adc->apalis_tk1_k20);
-+
-+ if (apalis_tk1_k20_reg_read_bulk(adc->apalis_tk1_k20, adc_register,
-+ adc_read, 2) < 0) {
-+ apalis_tk1_k20_unlock(adc->apalis_tk1_k20);
-+ return -EIO;
-+ }
-+ *val = (adc_read[1] << 8) + adc_read[0];
-+
-+ apalis_tk1_k20_unlock(adc->apalis_tk1_k20);
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_adc_read_raw(struct iio_dev *indio_dev,
-+ struct iio_chan_spec const *chan,
-+ int *val, int *val2, long mask)
-+{
-+ struct apalis_tk1_k20_adc *adc = iio_priv(indio_dev);
-+ enum apalis_tk1_k20_adc_id id = chan->channel;
-+ int ret;
-+
-+ switch (mask) {
-+ case IIO_CHAN_INFO_RAW:
-+ ret = apalis_tk1_k20_get_adc_result(adc, id, val) ?
-+ -EIO : IIO_VAL_INT;
-+ break;
-+ case IIO_CHAN_INFO_SCALE:
-+ *val = APALIS_TK1_K20_VADC_MILI;
-+ *val2 = APALIS_TK1_K20_ADC_BITS;
-+ ret = IIO_VAL_FRACTIONAL_LOG2;
-+ break;
-+ default:
-+ ret = -EINVAL;
-+ break;
-+ }
-+
-+ return ret;
-+}
-+
-+static const struct iio_info apalis_tk1_k20_adc_info = {
-+ .read_raw = &apalis_tk1_k20_adc_read_raw,
-+ .driver_module = THIS_MODULE,
-+};
-+
-+#define APALIS_TK1_K20_CHAN(_id, _type) { \
-+ .type = _type, \
-+ .indexed = 1, \
-+ .channel = APALIS_TK1_K20_##_id, \
-+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
-+ BIT(IIO_CHAN_INFO_SCALE), \
-+ .datasheet_name = #_id, \
-+}
-+
-+static const struct iio_chan_spec apalis_tk1_k20_adc_channels[] = {
-+ [APALIS_TK1_K20_ADC1] = APALIS_TK1_K20_CHAN(ADC1, IIO_VOLTAGE),
-+ [APALIS_TK1_K20_ADC2] = APALIS_TK1_K20_CHAN(ADC2, IIO_VOLTAGE),
-+ [APALIS_TK1_K20_ADC3] = APALIS_TK1_K20_CHAN(ADC3, IIO_VOLTAGE),
-+ [APALIS_TK1_K20_ADC4] = APALIS_TK1_K20_CHAN(ADC4, IIO_VOLTAGE),
-+};
-+
-+
-+static int apalis_tk1_k20_adc_probe(struct platform_device *pdev)
-+{
-+ struct apalis_tk1_k20_adc *priv;
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20;
-+ struct iio_dev *indio_dev;
-+ int ret;
-+
-+ indio_dev = iio_device_alloc(sizeof(*priv));
-+ if (!indio_dev)
-+ return -ENOMEM;
-+
-+ apalis_tk1_k20 = dev_get_drvdata(pdev->dev.parent);
-+ if (!apalis_tk1_k20) {
-+ ret = -ENODEV;
-+ goto err_iio_device;
-+ }
-+
-+ priv = iio_priv(indio_dev);
-+ priv->apalis_tk1_k20 = apalis_tk1_k20;
-+
-+ apalis_tk1_k20_lock(apalis_tk1_k20);
-+
-+ /* Enable ADC */
-+ apalis_tk1_k20_reg_write(apalis_tk1_k20, APALIS_TK1_K20_ADCREG, 0x01);
-+
-+ apalis_tk1_k20_unlock(apalis_tk1_k20);
-+
-+ platform_set_drvdata(pdev, indio_dev);
-+
-+ indio_dev->dev.of_node = pdev->dev.of_node;
-+ indio_dev->dev.parent = &pdev->dev;
-+ indio_dev->name = pdev->name;
-+ indio_dev->modes = INDIO_DIRECT_MODE;
-+ indio_dev->info = &apalis_tk1_k20_adc_info;
-+ indio_dev->channels = apalis_tk1_k20_adc_channels;
-+ indio_dev->num_channels = ARRAY_SIZE(apalis_tk1_k20_adc_channels);
-+
-+ ret = iio_device_register(indio_dev);
-+ if (ret) {
-+ dev_err(&pdev->dev, "iio dev register err: %d\n", ret);
-+ goto err_iio_device;
-+ }
-+
-+ return 0;
-+
-+err_iio_device:
-+ iio_device_free(indio_dev);
-+ return ret;
-+}
-+
-+static int apalis_tk1_k20_adc_remove(struct platform_device *pdev)
-+{
-+ struct iio_dev *indio_dev = platform_get_drvdata(pdev);
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20 = dev_get_drvdata(
-+ pdev->dev.parent);
-+
-+ apalis_tk1_k20_lock(apalis_tk1_k20);
-+
-+ /* Disable ADC */
-+ apalis_tk1_k20_reg_write(apalis_tk1_k20, APALIS_TK1_K20_ADCREG, 0x00);
-+
-+ apalis_tk1_k20_unlock(apalis_tk1_k20);
-+
-+ iio_device_unregister(indio_dev);
-+ iio_device_free(indio_dev);
-+
-+ return 0;
-+}
-+
-+static const struct platform_device_id apalis_tk1_k20_adc_idtable[] = {
-+ {
-+ .name = "apalis-tk1-k20-adc",
-+ },
-+ { /* sentinel */ }
-+};
-+MODULE_DEVICE_TABLE(platform, apalis_tk1_k20_adc_idtable);
-+
-+static struct platform_driver apalis_tk1_k20_adc_driver = {
-+ .id_table = apalis_tk1_k20_adc_idtable,
-+ .remove = apalis_tk1_k20_adc_remove,
-+ .probe = apalis_tk1_k20_adc_probe,
-+ .driver = {
-+ .name = "apalis-tk1-k20-adc",
-+ },
-+};
-+
-+module_platform_driver(apalis_tk1_k20_adc_driver);
-+
-+MODULE_DESCRIPTION("K20 ADCs on Apalis TK1");
-+MODULE_AUTHOR("Dominik Sliwa");
-+MODULE_LICENSE("GPL");
-diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
-index 64b30fe273fd..81e9c604f612 100644
---- a/drivers/input/touchscreen/Kconfig
-+++ b/drivers/input/touchscreen/Kconfig
-@@ -92,6 +92,16 @@ config TOUCHSCREEN_AD7879_SPI
- To compile this driver as a module, choose M here: the
- module will be called ad7879-spi.
-
-+config TOUCHSCREEN_APALIS_TK1_K20
-+ tristate "K20 based touchscreen controller on Apalis TK1"
-+ depends on MFD_APALIS_TK1_K20
-+ help
-+ Say Y here if you want to support the touchscreen controller
-+ implemented in the K20 found on Apalis TK1.
-+
-+ To compile this driver as a module, choose M here: the module will be
-+ called apalis-tk1-k20_ts.
-+
- config TOUCHSCREEN_AR1021_I2C
- tristate "Microchip AR1020/1021 i2c touchscreen"
- depends on I2C && OF
-diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
-index 850c1562555a..d9352ec30431 100644
---- a/drivers/input/touchscreen/Makefile
-+++ b/drivers/input/touchscreen/Makefile
-@@ -14,6 +14,7 @@ obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o
- obj-$(CONFIG_TOUCHSCREEN_AD7879_I2C) += ad7879-i2c.o
- obj-$(CONFIG_TOUCHSCREEN_AD7879_SPI) += ad7879-spi.o
- obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
-+obj-$(CONFIG_TOUCHSCREEN_APALIS_TK1_K20) += apalis-tk1-k20_ts.o
- obj-$(CONFIG_TOUCHSCREEN_AR1021_I2C) += ar1021_i2c.o
- obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o
- obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o
-diff --git a/drivers/input/touchscreen/apalis-tk1-k20_ts.c b/drivers/input/touchscreen/apalis-tk1-k20_ts.c
-new file mode 100644
-index 000000000000..ef9e56c94685
---- /dev/null
-+++ b/drivers/input/touchscreen/apalis-tk1-k20_ts.c
-@@ -0,0 +1,234 @@
-+/*
-+ * Copyright 2016-2017 Toradex AG
-+ * Dominik Sliwa <dominik.sliwa@toradex.com>
-+ *
-+ * Based on driver for the Freescale Semiconductor MC13783 touchscreen by:
-+ * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
-+ * Copyright (C) 2009 Sascha Hauer, Pengutronix
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published by
-+ * the Free Software Foundation.
-+ */
-+
-+#include <linux/platform_device.h>
-+#include <linux/mfd/apalis-tk1-k20.h>
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/input.h>
-+#include <linux/sched.h>
-+#include <linux/slab.h>
-+#include <linux/init.h>
-+
-+#define APALIS_TK1_K20_TS_NAME "apalis-tk1-k20-ts"
-+
-+struct apalis_tk1_k20_ts {
-+ struct input_dev *idev;
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20;
-+ struct delayed_work work;
-+ struct workqueue_struct *workq;
-+ uint16_t sample[4];
-+};
-+
-+static irqreturn_t apalis_tk1_k20_ts_handler(int irq, void *data)
-+{
-+ struct apalis_tk1_k20_ts *priv = data;
-+
-+ /*
-+ * Kick off reading coordinates. Note that if work happens already
-+ * be queued for future execution (it rearms itself) it will not
-+ * be rescheduled for immediate execution here. However the rearm
-+ * delay is HZ / 25 which is acceptable.
-+ */
-+ queue_delayed_work(priv->workq, &priv->work, 0);
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static void apalis_tk1_k20_ts_report_sample(struct apalis_tk1_k20_ts *priv)
-+{
-+ struct input_dev *idev = priv->idev;
-+ int xp, xm, yp, ym;
-+ int x, y, press, btn;
-+
-+ xp = priv->sample[1];
-+ xm = priv->sample[0];
-+ yp = priv->sample[3];
-+ ym = priv->sample[2];
-+
-+ x = (xp + xm) / 2;
-+ y = (yp + ym) / 2;
-+ press = (abs(yp - ym) + abs(xp - xm)) / 2;
-+
-+ if ((yp != 0) && (xp != 0)) {
-+ btn = 1;
-+ input_report_abs(idev, ABS_X, x);
-+ input_report_abs(idev, ABS_Y, y);
-+
-+ dev_dbg(&idev->dev, "report (%d, %d, %d)\n",
-+ x, y, press);
-+ queue_delayed_work(priv->workq, &priv->work, HZ / 25);
-+ } else {
-+ dev_dbg(&idev->dev, "report release\n");
-+ btn = 0;
-+ }
-+
-+ input_report_abs(idev, ABS_PRESSURE, press);
-+ input_report_key(idev, BTN_TOUCH, btn);
-+ input_sync(idev);
-+}
-+
-+static void apalis_tk1_k20_ts_work(struct work_struct *work)
-+{
-+ struct apalis_tk1_k20_ts *priv =
-+ container_of(work, struct apalis_tk1_k20_ts, work.work);
-+ uint8_t buf[8], i;
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+
-+ if (apalis_tk1_k20_reg_read_bulk(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_TSC_XML, buf, 8) < 0) {
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ dev_err(&priv->idev->dev, "Error reading data\n");
-+ return;
-+ }
-+
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+
-+ for (i = 0; i < 4; i++)
-+ priv->sample[i] = (buf[(2 * i) + 1] << 8) + buf[2 * i];
-+
-+ apalis_tk1_k20_ts_report_sample(priv);
-+}
-+
-+static int apalis_tk1_k20_ts_open(struct input_dev *dev)
-+{
-+ struct apalis_tk1_k20_ts *priv = input_get_drvdata(dev);
-+ int ret;
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+
-+ ret = apalis_tk1_k20_irq_request(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_TSC_IRQ, apalis_tk1_k20_ts_handler,
-+ APALIS_TK1_K20_TS_NAME, priv);
-+ if (ret)
-+ goto out;
-+
-+ ret = apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_TSCREG, APALIS_TK1_K20_TSC_ENA_MASK,
-+ APALIS_TK1_K20_TSC_ENA);
-+ if (ret)
-+ apalis_tk1_k20_irq_free(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_TSC_IRQ, priv);
-+
-+out:
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+
-+ return ret;
-+}
-+
-+static void apalis_tk1_k20_ts_close(struct input_dev *dev)
-+{
-+ struct apalis_tk1_k20_ts *priv = input_get_drvdata(dev);
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+
-+ apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20, APALIS_TK1_K20_TSCREG,
-+ APALIS_TK1_K20_TSC_ENA_MASK, 0);
-+ apalis_tk1_k20_irq_free(priv->apalis_tk1_k20, APALIS_TK1_K20_TSC_IRQ,
-+ priv);
-+
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+
-+ cancel_delayed_work_sync(&priv->work);
-+}
-+
-+static int apalis_tk1_k20_ts_probe(struct platform_device *pdev)
-+{
-+ struct apalis_tk1_k20_ts *priv;
-+ struct input_dev *idev;
-+ int ret = -ENOMEM;
-+
-+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-+ idev = input_allocate_device();
-+ if (!priv || !idev)
-+ goto err_free_mem;
-+
-+ INIT_DELAYED_WORK(&priv->work, apalis_tk1_k20_ts_work);
-+
-+ priv->apalis_tk1_k20 = dev_get_drvdata(pdev->dev.parent);
-+ priv->idev = idev;
-+
-+ priv->workq = create_singlethread_workqueue("apalis_tk1_k20_ts");
-+ if (!priv->workq)
-+ goto err_free_mem;
-+
-+ idev->name = APALIS_TK1_K20_TS_NAME;
-+ idev->dev.parent = &pdev->dev;
-+
-+ idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
-+ idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
-+ input_set_abs_params(idev, ABS_X, 0, 0xfff, 0, 0);
-+ input_set_abs_params(idev, ABS_Y, 0, 0xfff, 0, 0);
-+ input_set_abs_params(idev, ABS_PRESSURE, 0, 0xfff, 0, 0);
-+
-+ idev->open = apalis_tk1_k20_ts_open;
-+ idev->close = apalis_tk1_k20_ts_close;
-+
-+ input_set_drvdata(idev, priv);
-+
-+ ret = input_register_device(priv->idev);
-+ if (ret) {
-+ dev_err(&pdev->dev,
-+ "register input device failed with %d\n", ret);
-+ goto err_destroy_wq;
-+ }
-+
-+ platform_set_drvdata(pdev, priv);
-+
-+ return 0;
-+
-+err_destroy_wq:
-+ destroy_workqueue(priv->workq);
-+err_free_mem:
-+ input_free_device(idev);
-+ kfree(priv);
-+
-+ return ret;
-+}
-+
-+static int apalis_tk1_k20_ts_remove(struct platform_device *pdev)
-+{
-+ struct apalis_tk1_k20_ts *priv = platform_get_drvdata(pdev);
-+
-+ platform_set_drvdata(pdev, NULL);
-+
-+ destroy_workqueue(priv->workq);
-+ input_unregister_device(priv->idev);
-+ kfree(priv);
-+
-+ return 0;
-+}
-+
-+static const struct platform_device_id apalis_tk1_k20_ts_idtable[] = {
-+ {
-+ .name = "apalis-tk1-k20-ts",
-+ },
-+ { /* sentinel */ }
-+};
-+MODULE_DEVICE_TABLE(platform, apalis_tk1_k20_ts_idtable);
-+
-+static struct platform_driver apalis_tk1_k20_ts_driver = {
-+ .id_table = apalis_tk1_k20_ts_idtable,
-+ .probe = apalis_tk1_k20_ts_probe,
-+ .remove = apalis_tk1_k20_ts_remove,
-+ .driver = {
-+ .name = APALIS_TK1_K20_TS_NAME,
-+ },
-+};
-+
-+module_platform_driver(apalis_tk1_k20_ts_driver);
-+
-+MODULE_DESCRIPTION("K20 touchscreen controller on Apalis TK1");
-+MODULE_AUTHOR("Dominik Sliwa <dominik.sliwa@toradex.com>");
-+MODULE_LICENSE("GPL v2");
-diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
-index fc5e4fef89d2..cd0a1dfd0a63 100644
---- a/drivers/mfd/Kconfig
-+++ b/drivers/mfd/Kconfig
-@@ -190,6 +190,20 @@ config MFD_AXP20X_RSB
- components like regulators or the PEK (Power Enable Key) under the
- corresponding menus.
-
-+config MFD_APALIS_TK1_K20
-+ tristate "K20 on Apalis TK1"
-+ depends on SPI_MASTER
-+ select MFD_CORE
-+ help
-+ The Kinetis MK20DN512 companion micro controller found on Apalis TK1
-+ supports CAN, resistive touch, GPIOs and analog inputs.
-+
-+config APALIS_TK1_K20_EZP
-+ bool "K20 on Apalis TK1 programming via EZ Port"
-+ depends on MFD_APALIS_TK1_K20
-+ help
-+ Support for flashing new K20 firmware using EZ-Port functionality.
-+
- config MFD_CROS_EC
- tristate "ChromeOS Embedded Controller"
- select MFD_CORE
-diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
-index 8703ff17998e..ba4f60862f9f 100644
---- a/drivers/mfd/Makefile
-+++ b/drivers/mfd/Makefile
-@@ -9,6 +9,7 @@ obj-$(CONFIG_MFD_88PM800) += 88pm800.o 88pm80x.o
- obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o
- obj-$(CONFIG_MFD_ACT8945A) += act8945a.o
- obj-$(CONFIG_MFD_SM501) += sm501.o
-+obj-$(CONFIG_MFD_APALIS_TK1_K20) += apalis-tk1-k20.o
- obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
- obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
- obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
-diff --git a/drivers/mfd/apalis-tk1-k20-ezp.h b/drivers/mfd/apalis-tk1-k20-ezp.h
-new file mode 100644
-index 000000000000..e89d6adbe471
---- /dev/null
-+++ b/drivers/mfd/apalis-tk1-k20-ezp.h
-@@ -0,0 +1,47 @@
-+/*
-+ * Copyright 2016-2017 Toradex AG
-+ * Dominik Sliwa <dominik.sliwa@toradex.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it under
-+ * the terms of the GNU General Public License version 2 as published by the
-+ * Free Software Foundation.
-+ */
-+
-+#ifndef __DRIVERS_MFD_APALIS_TK1_K20_H
-+#define __DRIVERS_MFD_APALIS_TK1_K20_H
-+
-+#ifdef CONFIG_APALIS_TK1_K20_EZP
-+#define APALIS_TK1_K20_FW_FOPT_ADDR 0x40D
-+#define APALIS_TK1_K20_FOPT_EZP_ENA BIT(1)
-+#define APALIS_TK1_K20_FW_VER_ADDR 0x410
-+
-+#define APALIS_TK1_K20_FLASH_SIZE 0x80000
-+
-+/* EZ Port commands */
-+#define APALIS_TK1_K20_EZP_WREN 0x06
-+#define APALIS_TK1_K20_EZP_WRDI 0x04
-+#define APALIS_TK1_K20_EZP_RDSR 0x05
-+#define APALIS_TK1_K20_EZP_READ 0x03
-+#define APALIS_TK1_K20_EZP_FREAD 0x0B
-+#define APALIS_TK1_K20_EZP_SP 0x02
-+#define APALIS_TK1_K20_EZP_SE 0xD8
-+#define APALIS_TK1_K20_EZP_BE 0xC7
-+#define APALIS_TK1_K20_EZP_RESET 0xB9
-+#define APALIS_TK1_K20_EZP_WRFCCOB 0xBA
-+#define APALIS_TK1_K20_EZP_FRDFCOOB 0xBB
-+
-+/* Bits of EZ Port status register */
-+#define APALIS_TK1_K20_EZP_STA_WIP BIT(0)
-+#define APALIS_TK1_K20_EZP_STA_WEN BIT(1)
-+#define APALIS_TK1_K20_EZP_STA_BEDIS BIT(2)
-+#define APALIS_TK1_K20_EZP_STA_WEF BIT(6)
-+#define APALIS_TK1_K20_EZP_STA_FS BIT(7)
-+
-+#define APALIS_TK1_K20_EZP_MAX_SPEED 4080000
-+#define APALIS_TK1_K20_EZP_MAX_DATA 32
-+#define APALIS_TK1_K20_EZP_WRITE_SIZE 32
-+
-+static const struct firmware *fw_entry;
-+#endif /* CONFIG_APALIS_TK1_K20_EZP */
-+
-+#endif /* __DRIVERS_MFD_APALIS_TK1_K20_H */
-diff --git a/drivers/mfd/apalis-tk1-k20.c b/drivers/mfd/apalis-tk1-k20.c
-new file mode 100644
-index 000000000000..913be65c33e6
---- /dev/null
-+++ b/drivers/mfd/apalis-tk1-k20.c
-@@ -0,0 +1,1062 @@
-+/*
-+ * Copyright 2016-2017 Toradex AG
-+ * Dominik Sliwa <dominik.sliwa@toradex.com>
-+ *
-+ * based on an driver for MC13xxx by:
-+ * Copyright 2009-2010 Pengutronix
-+ * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it under
-+ * the terms of the GNU General Public License version 2 as published by the
-+ * Free Software Foundation.
-+ */
-+
-+#include <linux/slab.h>
-+#include <linux/module.h>
-+#include <linux/platform_device.h>
-+#include <linux/interrupt.h>
-+#include <linux/mfd/core.h>
-+#include <linux/mfd/apalis-tk1-k20.h>
-+#include <linux/of.h>
-+#include <linux/of_device.h>
-+#include <linux/of_gpio.h>
-+#include <linux/of_irq.h>
-+#include <linux/err.h>
-+#include <linux/firmware.h>
-+#include <linux/spi/spi.h>
-+#include <linux/delay.h>
-+
-+#include "apalis-tk1-k20-ezp.h"
-+#define APALIS_TK1_K20_MAX_MSG 4
-+
-+static const struct spi_device_id apalis_tk1_k20_device_ids[] = {
-+ {
-+ .name = "apalis-tk1-k20",
-+ }, {
-+ /* sentinel */
-+ }
-+};
-+MODULE_DEVICE_TABLE(spi, apalis_tk1_k20_device_ids);
-+
-+static const struct of_device_id apalis_tk1_k20_dt_ids[] = {
-+ {
-+ .compatible = "toradex,apalis-tk1-k20",
-+ }, {
-+ /* sentinel */
-+ }
-+};
-+MODULE_DEVICE_TABLE(of, apalis_tk1_k20_dt_ids);
-+
-+static const struct regmap_config apalis_tk1_k20_regmap_spi_config = {
-+ .reg_bits = 8,
-+ .pad_bits = 0,
-+ .val_bits = 8,
-+
-+ .max_register = APALIS_TK1_K20_LAST_REG,
-+
-+ .cache_type = REGCACHE_NONE,
-+ .use_single_rw = 0,
-+};
-+
-+static int apalis_tk1_k20_spi_read(void *context, const void *reg,
-+ size_t reg_size, void *val, size_t val_size)
-+{
-+ unsigned char w[APALIS_TK1_K20_MAX_BULK] = {APALIS_TK1_K20_READ_INST,
-+ *((unsigned char *) reg), val_size, 0x00, 0x00, 0x00,
-+ 0x00};
-+ unsigned char r[APALIS_TK1_K20_MAX_BULK];
-+ unsigned char *p = val;
-+ int i = 0, j = 0;
-+ struct device *dev = context;
-+ struct spi_device *spi = to_spi_device(dev);
-+ struct spi_transfer t = {
-+ .tx_buf = w,
-+ .rx_buf = r,
-+ .len = 8,
-+ .cs_change = 0,
-+ .delay_usecs = 0,
-+ };
-+
-+ struct spi_message m;
-+ int ret;
-+ spi->mode = SPI_MODE_1;
-+
-+ if (reg_size != 1)
-+ return -ENOTSUPP;
-+
-+ if (val_size == 1) {
-+ spi_message_init(&m);
-+ spi_message_add_tail(&t, &m);
-+ ret = spi_sync(spi, &m);
-+
-+ for (i = 3; i < 7; i++ )
-+ {
-+ if (((unsigned char *)t.rx_buf)[i] == 0x55) {
-+ *p = ((unsigned char *)t.rx_buf)[i + 1];
-+ return ret;
-+ }
-+ }
-+
-+ for (j = 0; j < APALIS_TK1_MAX_RETRY_CNT; j++) {
-+ udelay(250 * j * j);
-+ t.tx_buf = w;
-+ t.rx_buf = r;
-+ spi_message_init(&m);
-+ spi_message_add_tail(&t, &m);
-+ ret = spi_sync(spi, &m);
-+ for (i = 3; i < 7; i++ )
-+ {
-+ if (((unsigned char *)t.rx_buf)[i] == 0x55) {
-+ *p = ((unsigned char *)t.rx_buf)[i + 1];
-+ return ret;
-+ }
-+ }
-+ }
-+ ret = -EIO;
-+
-+ } else if ((val_size > 1) && (val_size < APALIS_TK1_K20_MAX_BULK)) {
-+ t.len = 5;
-+ w[0] = APALIS_TK1_K20_BULK_READ_INST;
-+ spi_message_init(&m);
-+ spi_message_add_tail(&t, &m);
-+ ret = spi_sync(spi, &m);
-+ /* no need to reinit the message*/
-+ t.len = val_size;
-+ t.rx_buf = p;
-+ /* just use the same transfer */
-+ ret = spi_sync(spi, &m);
-+
-+ } else {
-+ return -ENOTSUPP;
-+ }
-+
-+ return ret;
-+}
-+
-+
-+static int apalis_tk1_k20_spi_write(void *context, const void *data,
-+ size_t count)
-+{
-+ struct device *dev = context;
-+ struct spi_device *spi = to_spi_device(dev);
-+ uint8_t out_data[APALIS_TK1_K20_MAX_BULK];
-+ int ret;
-+
-+
-+ spi->mode = SPI_MODE_1;
-+
-+ if (count == 2) {
-+ out_data[0] = APALIS_TK1_K20_WRITE_INST;
-+ out_data[1] = ((uint8_t *)data)[0];
-+ out_data[2] = ((uint8_t *)data)[1];
-+ ret = spi_write(spi, out_data, 3);
-+
-+ } else if ((count > 2) && (count < APALIS_TK1_K20_MAX_BULK)) {
-+ out_data[0] = APALIS_TK1_K20_BULK_WRITE_INST;
-+ out_data[1] = ((uint8_t *)data)[0];
-+ out_data[2] = count - 1;
-+ memcpy(&out_data[3], &((uint8_t *)data)[1], count - 1);
-+ ret = spi_write(spi, out_data, count + 2);
-+ } else {
-+ dev_err(dev, "Apalis TK1 K20 MFD invalid write count = %d\n",
-+ count);
-+ return -ENOTSUPP;
-+ }
-+ return ret;
-+}
-+
-+static struct regmap_bus regmap_apalis_tk1_k20_bus = {
-+ .write = apalis_tk1_k20_spi_write,
-+ .read = apalis_tk1_k20_spi_read,
-+};
-+
-+void apalis_tk1_k20_lock(struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ if (!mutex_trylock(&apalis_tk1_k20->lock)) {
-+ dev_dbg(apalis_tk1_k20->dev, "wait for %s from %ps\n",
-+ __func__, __builtin_return_address(0));
-+
-+ mutex_lock(&apalis_tk1_k20->lock);
-+ }
-+ dev_dbg(apalis_tk1_k20->dev, "%s from %ps\n",
-+ __func__, __builtin_return_address(0));
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_lock);
-+
-+void apalis_tk1_k20_unlock(struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ dev_dbg(apalis_tk1_k20->dev, "%s from %ps\n",
-+ __func__, __builtin_return_address(0));
-+ mutex_unlock(&apalis_tk1_k20->lock);
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_unlock);
-+
-+int apalis_tk1_k20_reg_read(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ unsigned int offset, u32 *val)
-+{
-+ int ret;
-+
-+ ret = regmap_read(apalis_tk1_k20->regmap, offset, val);
-+ dev_dbg(apalis_tk1_k20->dev, "[0x%02x] -> 0x%02x ret = %d\n", offset,
-+ *val, ret);
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_reg_read);
-+
-+int apalis_tk1_k20_reg_write(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ unsigned int offset, u32 val)
-+{
-+ int ret;
-+
-+ if (val >= BIT(24))
-+ return -EINVAL;
-+
-+ ret = regmap_write(apalis_tk1_k20->regmap, offset, val);
-+
-+ dev_dbg(apalis_tk1_k20->dev, "[0x%02x] <- 0x%02x ret = %d\n", offset, val,
-+ ret);
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_reg_write);
-+
-+int apalis_tk1_k20_reg_read_bulk(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ unsigned int offset,
-+ uint8_t *val, size_t size)
-+{
-+ int ret;
-+
-+ if (size > APALIS_TK1_K20_MAX_BULK)
-+ return -EINVAL;
-+
-+ ret = regmap_bulk_read(apalis_tk1_k20->regmap, offset, val, size);
-+ dev_dbg(apalis_tk1_k20->dev, "bulk read %d bytes from [0x%02x]\n",
-+ size, offset);
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_reg_read_bulk);
-+
-+int apalis_tk1_k20_reg_write_bulk(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ unsigned int offset, uint8_t *buf, size_t size)
-+{
-+ dev_dbg(apalis_tk1_k20->dev, "bulk write %d bytes to [0x%02x]\n",
-+ (unsigned int)size, offset);
-+
-+ if (size > APALIS_TK1_K20_MAX_BULK)
-+ return -EINVAL;
-+ return regmap_bulk_write(apalis_tk1_k20->regmap, offset, buf, size);
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_reg_write_bulk);
-+
-+int apalis_tk1_k20_reg_rmw(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ unsigned int offset, u32 mask, u32 val)
-+{
-+ dev_dbg(apalis_tk1_k20->dev, "[0x%02x] <- 0x%06x (mask: 0x%06x)\n",
-+ offset, val, mask);
-+
-+ return regmap_update_bits(apalis_tk1_k20->regmap, offset, mask, val);
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_reg_rmw);
-+
-+int apalis_tk1_k20_irq_mask(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ int irq)
-+{
-+ int virq = -1;
-+ if (irq != APALIS_TK1_K20_CAN1_IRQ && irq != APALIS_TK1_K20_CAN0_IRQ) {
-+ virq = regmap_irq_get_virq(apalis_tk1_k20->irq_data, irq);
-+
-+ } else {
-+ virq = (irq == APALIS_TK1_K20_CAN0_IRQ) ?
-+ apalis_tk1_k20->can0_irq:apalis_tk1_k20->can1_irq;
-+ }
-+
-+ disable_irq_nosync(virq);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_irq_mask);
-+
-+int apalis_tk1_k20_irq_unmask(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ int irq)
-+{
-+ int virq = -1;
-+ if (irq != APALIS_TK1_K20_CAN1_IRQ && irq != APALIS_TK1_K20_CAN0_IRQ) {
-+ virq = regmap_irq_get_virq(apalis_tk1_k20->irq_data, irq);
-+
-+ } else {
-+ virq = (irq == APALIS_TK1_K20_CAN0_IRQ) ?
-+ apalis_tk1_k20->can0_irq:apalis_tk1_k20->can1_irq;
-+ }
-+
-+ enable_irq(virq);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_irq_unmask);
-+
-+int apalis_tk1_k20_irq_status(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ int irq, int *enabled, int *pending)
-+{
-+ int ret;
-+ unsigned int offmask = APALIS_TK1_K20_MSQREG;
-+ unsigned int offstat = APALIS_TK1_K20_IRQREG;
-+ u32 irqbit = 1 << irq;
-+
-+ if (irq < 0 || irq >= ARRAY_SIZE(apalis_tk1_k20->irqs))
-+ return -EINVAL;
-+
-+ if (enabled) {
-+ u32 mask;
-+
-+ ret = apalis_tk1_k20_reg_read(apalis_tk1_k20, offmask, &mask);
-+ if (ret)
-+ return ret;
-+
-+ *enabled = mask & irqbit;
-+ }
-+
-+ if (pending) {
-+ u32 stat;
-+
-+ ret = apalis_tk1_k20_reg_read(apalis_tk1_k20, offstat, &stat);
-+ if (ret)
-+ return ret;
-+
-+ *pending = stat & irqbit;
-+ }
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_irq_status);
-+
-+int apalis_tk1_k20_irq_request(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ int irq, irq_handler_t handler, const char *name, void *dev)
-+{
-+ int virq = -1;
-+ int irq_flags = IRQF_ONESHOT;
-+ if (irq != APALIS_TK1_K20_CAN1_IRQ && irq != APALIS_TK1_K20_CAN0_IRQ) {
-+ virq = regmap_irq_get_virq(apalis_tk1_k20->irq_data, irq);
-+ irq_flags = IRQF_ONESHOT;
-+ } else {
-+ virq = (irq == APALIS_TK1_K20_CAN0_IRQ) ?
-+ apalis_tk1_k20->can0_irq:apalis_tk1_k20->can1_irq;
-+ irq_flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING |
-+ IRQF_TRIGGER_RISING;
-+ }
-+ return devm_request_threaded_irq(apalis_tk1_k20->dev, virq,
-+ NULL, handler, irq_flags, name, dev);
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_irq_request);
-+
-+int apalis_tk1_k20_irq_free(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ int irq, void *dev)
-+{
-+ int virq = -1;
-+ if (irq != APALIS_TK1_K20_CAN1_IRQ && irq != APALIS_TK1_K20_CAN0_IRQ) {
-+ virq = regmap_irq_get_virq(apalis_tk1_k20->irq_data, irq);
-+
-+ } else {
-+ virq = (irq == APALIS_TK1_K20_CAN0_IRQ) ?
-+ apalis_tk1_k20->can0_irq:apalis_tk1_k20->can1_irq;
-+ }
-+
-+ devm_free_irq(apalis_tk1_k20->dev, virq, dev);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL(apalis_tk1_k20_irq_free);
-+
-+
-+static int apalis_tk1_k20_add_subdevice_pdata_id(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20, const char *name,
-+ void *pdata, size_t pdata_size, int id)
-+{
-+ struct mfd_cell cell = {
-+ .platform_data = pdata,
-+ .pdata_size = pdata_size,
-+ };
-+
-+ cell.name = kmemdup(name, strlen(name) + 1, GFP_KERNEL);
-+ if (!cell.name)
-+ return -ENOMEM;
-+
-+ return mfd_add_devices(apalis_tk1_k20->dev, id, &cell, 1, NULL, 0,
-+ regmap_irq_get_domain(apalis_tk1_k20->irq_data));
-+}
-+
-+static int apalis_tk1_k20_add_subdevice_pdata(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20, const char *name,
-+ void *pdata, size_t pdata_size)
-+{
-+ return apalis_tk1_k20_add_subdevice_pdata_id(apalis_tk1_k20, name,
-+ pdata, pdata_size, -1);
-+}
-+
-+static int apalis_tk1_k20_add_subdevice(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20, const char *name)
-+{
-+ return apalis_tk1_k20_add_subdevice_pdata(apalis_tk1_k20, name, NULL,
-+ 0);
-+}
-+
-+static void apalis_tk1_k20_reset_chip(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ udelay(10);
-+ gpio_set_value(apalis_tk1_k20->reset_gpio, 0);
-+ msleep(10);
-+ gpio_set_value(apalis_tk1_k20->reset_gpio, 1);
-+ udelay(10);
-+}
-+
-+#ifdef CONFIG_APALIS_TK1_K20_EZP
-+static int apalis_tk1_k20_read_ezport(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20, uint8_t command,
-+ int addr, int count, uint8_t *buffer)
-+{
-+ uint8_t w[4 + APALIS_TK1_K20_EZP_MAX_DATA];
-+ uint8_t r[4 + APALIS_TK1_K20_EZP_MAX_DATA];
-+ uint8_t *out;
-+ struct spi_message m;
-+ struct spi_device *spi = to_spi_device(apalis_tk1_k20->dev);
-+ struct spi_transfer t = {
-+ .tx_buf = w,
-+ .rx_buf = r,
-+ .speed_hz = APALIS_TK1_K20_EZP_MAX_SPEED,
-+ };
-+ int ret;
-+
-+ spi->mode = SPI_MODE_0;
-+
-+ if (count > APALIS_TK1_K20_EZP_MAX_DATA)
-+ return -ENOSPC;
-+
-+ memset(w, 0, 4 + count);
-+
-+ switch (command) {
-+ case APALIS_TK1_K20_EZP_READ:
-+ case APALIS_TK1_K20_EZP_FREAD:
-+ t.len = 4 + count;
-+ w[1] = (addr & 0xFF0000) >> 16;
-+ w[2] = (addr & 0xFF00) >> 8;
-+ w[3] = (addr & 0xFC);
-+ out = &r[4];
-+ break;
-+ case APALIS_TK1_K20_EZP_RDSR:
-+ case APALIS_TK1_K20_EZP_FRDFCOOB:
-+ t.len = 1 + count;
-+ out = &r[1];
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+ w[0] = command;
-+
-+ gpio_set_value(apalis_tk1_k20->ezpcs_gpio, 0);
-+ spi_message_init(&m);
-+ spi_message_add_tail(&t, &m);
-+ ret = spi_sync(spi, &m);
-+ gpio_set_value(apalis_tk1_k20->ezpcs_gpio, 1);
-+ if (ret != 0)
-+ return ret;
-+
-+ memcpy(buffer, out, count);
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_write_ezport(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20, uint8_t command,
-+ int addr, int count, const uint8_t *buffer)
-+{
-+ uint8_t w[4 + APALIS_TK1_K20_EZP_MAX_DATA];
-+ uint8_t r[4 + APALIS_TK1_K20_EZP_MAX_DATA];
-+ struct spi_message m;
-+ struct spi_device *spi = to_spi_device(apalis_tk1_k20->dev);
-+ struct spi_transfer t = {
-+ .tx_buf = w,
-+ .rx_buf = r,
-+ .speed_hz = APALIS_TK1_K20_EZP_MAX_SPEED,
-+ };
-+ int ret;
-+
-+ spi->mode = SPI_MODE_0;
-+
-+ if (count > APALIS_TK1_K20_EZP_MAX_DATA)
-+ return -ENOSPC;
-+
-+ switch (command) {
-+ case APALIS_TK1_K20_EZP_SP:
-+ case APALIS_TK1_K20_EZP_SE:
-+ t.len = 4 + count;
-+ w[1] = (addr & 0xFF0000) >> 16;
-+ w[2] = (addr & 0xFF00) >> 8;
-+ w[3] = (addr & 0xF8);
-+ memcpy(&w[4], buffer, count);
-+ break;
-+ case APALIS_TK1_K20_EZP_WREN:
-+ case APALIS_TK1_K20_EZP_WRDI:
-+ case APALIS_TK1_K20_EZP_BE:
-+ case APALIS_TK1_K20_EZP_RESET:
-+ case APALIS_TK1_K20_EZP_WRFCCOB:
-+ t.len = 1 + count;
-+ memcpy(&w[1], buffer, count);
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+ w[0] = command;
-+
-+ gpio_set_value(apalis_tk1_k20->ezpcs_gpio, 0);
-+ spi_message_init(&m);
-+ spi_message_add_tail(&t, &m);
-+ ret = spi_sync(spi, &m);
-+ gpio_set_value(apalis_tk1_k20->ezpcs_gpio, 1);
-+
-+ return ret;
-+}
-+
-+static int apalis_tk1_k20_set_wren_ezport(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ uint8_t buffer;
-+
-+ if (apalis_tk1_k20_write_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_WREN,
-+ 0, 0, NULL) < 0)
-+ return -EIO;
-+ if (apalis_tk1_k20_read_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_RDSR,
-+ 0, 1, &buffer) < 0)
-+ return -EIO;
-+ if ((buffer & APALIS_TK1_K20_EZP_STA_WEN))
-+ return 0;
-+
-+ /* If it failed try one last time */
-+ if (apalis_tk1_k20_write_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_WREN,
-+ 0, 0, NULL) < 0)
-+ return -EIO;
-+ if (apalis_tk1_k20_read_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_RDSR,
-+ 0, 1, &buffer) < 0)
-+ return -EIO;
-+ if ((buffer & APALIS_TK1_K20_EZP_STA_WEN))
-+ return 0;
-+
-+ return -EIO;
-+
-+}
-+
-+static int apalis_tk1_k20_enter_ezport(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ uint8_t status = 0x00;
-+ uint8_t buffer;
-+
-+ gpio_set_value(apalis_tk1_k20->ezpcs_gpio, 0);
-+ msleep(10);
-+ apalis_tk1_k20_reset_chip(apalis_tk1_k20);
-+ msleep(10);
-+ gpio_set_value(apalis_tk1_k20->ezpcs_gpio, 1);
-+ if (apalis_tk1_k20_read_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_RDSR,
-+ 0, 1, &buffer) < 0)
-+ goto bad;
-+ status = buffer;
-+ if (apalis_tk1_k20_write_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_WREN,
-+ 0, 0, NULL) < 0)
-+ goto bad;
-+ if (apalis_tk1_k20_read_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_RDSR,
-+ 0, 1, &buffer) < 0)
-+ goto bad;
-+ if ((buffer & APALIS_TK1_K20_EZP_STA_WEN) && buffer != status)
-+ return 0;
-+
-+bad:
-+ dev_err(apalis_tk1_k20->dev, "Error entering EZ Port mode.\n");
-+ return -EIO;
-+}
-+
-+static int apalis_tk1_k20_erase_chip_ezport(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ uint8_t buffer[16];
-+ int i;
-+
-+ if (apalis_tk1_k20_set_wren_ezport(apalis_tk1_k20))
-+ goto bad;
-+ if (apalis_tk1_k20_write_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_BE,
-+ 0, 0, NULL) < 0)
-+ goto bad;
-+
-+ if (apalis_tk1_k20_read_ezport(apalis_tk1_k20, APALIS_TK1_K20_EZP_RDSR,
-+ 0, 1, buffer) < 0)
-+ goto bad;
-+
-+ i = 0;
-+ while (buffer[0] & APALIS_TK1_K20_EZP_STA_WIP) {
-+ msleep(20);
-+ if ((apalis_tk1_k20_read_ezport(apalis_tk1_k20,
-+ APALIS_TK1_K20_EZP_RDSR, 0, 1, buffer) < 0) || (i > 50))
-+ goto bad;
-+ i++;
-+ }
-+
-+ return 0;
-+
-+bad:
-+ dev_err(apalis_tk1_k20->dev, "Error erasing the chip.\n");
-+ return -EIO;
-+}
-+
-+static int apalis_tk1_k20_flash_chip_ezport(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ uint8_t buffer;
-+ const uint8_t *fw_chunk;
-+ int i, j, transfer_size;
-+
-+ for (i = 0; i < fw_entry->size;) {
-+ if (apalis_tk1_k20_set_wren_ezport(apalis_tk1_k20))
-+ goto bad;
-+
-+ fw_chunk = fw_entry->data + i;
-+ transfer_size = (i + APALIS_TK1_K20_EZP_WRITE_SIZE <
-+ fw_entry->size) ? APALIS_TK1_K20_EZP_WRITE_SIZE
-+ : (fw_entry->size - i - 1);
-+ dev_dbg(apalis_tk1_k20->dev,
-+ "Apalis TK1 K20 MFD transfer_size = %d addr = 0x%X\n",
-+ transfer_size, i);
-+ if (apalis_tk1_k20_write_ezport(apalis_tk1_k20,
-+ APALIS_TK1_K20_EZP_SP, i,
-+ transfer_size, fw_chunk) < 0)
-+ goto bad;
-+ udelay(2000);
-+ if (apalis_tk1_k20_read_ezport(apalis_tk1_k20,
-+ APALIS_TK1_K20_EZP_RDSR, 0, 1, &buffer) < 0)
-+ goto bad;
-+
-+ j = 0;
-+ while (buffer & APALIS_TK1_K20_EZP_STA_WIP) {
-+ msleep(10);
-+ if ((apalis_tk1_k20_read_ezport(apalis_tk1_k20,
-+ APALIS_TK1_K20_EZP_RDSR, 0, 1,
-+ &buffer) < 0) || (j > 10000))
-+ goto bad;
-+ j++;
-+ }
-+ i += APALIS_TK1_K20_EZP_WRITE_SIZE;
-+ }
-+
-+ return 0;
-+
-+bad:
-+ dev_err(apalis_tk1_k20->dev, "Error writing to the chip.\n");
-+ return -EIO;
-+}
-+
-+static uint8_t apalis_tk1_k20_fw_ezport_status(void)
-+{
-+ return fw_entry->data[APALIS_TK1_K20_FW_FOPT_ADDR] &
-+ APALIS_TK1_K20_FOPT_EZP_ENA;
-+}
-+
-+static uint8_t apalis_tk1_k20_get_fw_revision(void)
-+{
-+ if (fw_entry)
-+ if (fw_entry->size > APALIS_TK1_K20_FW_VER_ADDR)
-+ return fw_entry->data[APALIS_TK1_K20_FW_VER_ADDR];
-+ return 0;
-+}
-+#endif /* CONFIG_APALIS_TK1_K20_EZP */
-+
-+
-+#ifdef CONFIG_OF
-+static int apalis_tk1_k20_probe_flags_dt(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ struct device_node *np = apalis_tk1_k20->dev->of_node;
-+
-+ if (!np)
-+ return -ENODEV;
-+
-+ if (of_property_read_bool(np, "toradex,apalis-tk1-k20-uses-adc"))
-+ apalis_tk1_k20->flags |= APALIS_TK1_K20_USES_ADC;
-+
-+ if (of_property_read_bool(np, "toradex,apalis-tk1-k20-uses-tsc"))
-+ apalis_tk1_k20->flags |= APALIS_TK1_K20_USES_TSC;
-+
-+ if (of_property_read_bool(np, "toradex,apalis-tk1-k20-uses-can"))
-+ apalis_tk1_k20->flags |= APALIS_TK1_K20_USES_CAN;
-+
-+ if (of_property_read_bool(np, "toradex,apalis-tk1-k20-uses-gpio"))
-+ apalis_tk1_k20->flags |= APALIS_TK1_K20_USES_GPIO;
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_probe_gpios_dt(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ struct device_node *np = apalis_tk1_k20->dev->of_node;
-+
-+ if (!np)
-+ return -ENODEV;
-+
-+ apalis_tk1_k20->reset_gpio = of_get_named_gpio(np, "rst-gpio", 0);
-+ if (apalis_tk1_k20->reset_gpio < 0)
-+ return apalis_tk1_k20->reset_gpio;
-+ gpio_request(apalis_tk1_k20->reset_gpio, "apalis-tk1-k20-reset");
-+ gpio_direction_output(apalis_tk1_k20->reset_gpio, 1);
-+
-+ apalis_tk1_k20->ezpcs_gpio = of_get_named_gpio(np, "ezport-cs-gpio", 0);
-+ if (apalis_tk1_k20->ezpcs_gpio < 0)
-+ return apalis_tk1_k20->ezpcs_gpio;
-+ gpio_request(apalis_tk1_k20->ezpcs_gpio, "apalis-tk1-k20-ezpcs");
-+ gpio_direction_output(apalis_tk1_k20->ezpcs_gpio, 1);
-+
-+ apalis_tk1_k20->int2_gpio = of_get_named_gpio(np, "int2-gpio", 0);
-+ if (apalis_tk1_k20->int2_gpio < 0)
-+ return apalis_tk1_k20->int2_gpio;
-+ gpio_request(apalis_tk1_k20->int2_gpio, "apalis-tk1-k20-int2");
-+ gpio_direction_output(apalis_tk1_k20->int2_gpio, 1);
-+
-+ return 0;
-+}
-+#else
-+static inline int apalis_tk1_k20_probe_flags_dt(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ return -ENODEV;
-+}
-+static inline int apalis_tk1_k20_probe_gpios_dt(
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20)
-+{
-+ return -ENODEV;
-+}
-+#endif
-+
-+int apalis_tk1_k20_dev_init(struct device *dev)
-+{
-+ struct apalis_tk1_k20_platform_data *pdata = dev_get_platdata(dev);
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20 = dev_get_drvdata(dev);
-+ uint32_t revision = 0x00;
-+ int ret, i;
-+ int erase_only = 0;
-+
-+ apalis_tk1_k20->dev = dev;
-+
-+ ret = apalis_tk1_k20_probe_gpios_dt(apalis_tk1_k20);
-+ if ((ret < 0) && pdata) {
-+ if (pdata) {
-+ apalis_tk1_k20->ezpcs_gpio = pdata->ezpcs_gpio;
-+ apalis_tk1_k20->reset_gpio = pdata->reset_gpio;
-+ apalis_tk1_k20->int2_gpio = pdata->int2_gpio;
-+ } else {
-+ dev_err(dev, "Error claiming GPIOs\n");
-+ ret = -EINVAL;
-+ goto bad;
-+ }
-+ }
-+ apalis_tk1_k20_reset_chip(apalis_tk1_k20);
-+ msleep(10);
-+ ret = apalis_tk1_k20_reg_read(apalis_tk1_k20, APALIS_TK1_K20_REVREG,
-+ &revision);
-+
-+#ifdef CONFIG_APALIS_TK1_K20_EZP
-+ if ((request_firmware(&fw_entry, "apalis-tk1-k20.bin", dev) < 0)
-+ && (revision != APALIS_TK1_K20_FW_VER)) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Unsupported firmware version %d.%d and no local" \
-+ " firmware file available.\n",
-+ (revision & 0xF0 >> 8),
-+ (revision & 0x0F));
-+ ret = -ENOTSUPP;
-+ goto bad;
-+ }
-+
-+ if ((fw_entry == NULL) && (revision != APALIS_TK1_K20_FW_VER)) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Unsupported firmware version %d.%d and no local" \
-+ " firmware file available.\n",
-+ (revision & 0xF0 >> 8),
-+ (revision & 0x0F));
-+ ret = -ENOTSUPP;
-+ goto bad;
-+ }
-+
-+ if (fw_entry != NULL) {
-+ if (fw_entry->size == 1)
-+ erase_only = 1;
-+ }
-+
-+ if ((apalis_tk1_k20_get_fw_revision() != APALIS_TK1_K20_FW_VER) &&
-+ (revision != APALIS_TK1_K20_FW_VER) && !erase_only &&
-+ (fw_entry != NULL)) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Unsupported firmware version in both the device " \
-+ "as well as the local firmware file.\n");
-+ release_firmware(fw_entry);
-+ ret = -ENOTSUPP;
-+ goto bad;
-+ }
-+
-+ if ((revision != APALIS_TK1_K20_FW_VER) && !erase_only &&
-+ (!apalis_tk1_k20_fw_ezport_status()) &&
-+ (fw_entry != NULL)) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Unsupported firmware version in the device and the " \
-+ "local firmware file disables the EZ Port.\n");
-+ release_firmware(fw_entry);
-+ ret = -ENOTSUPP;
-+ goto bad;
-+ }
-+
-+ if (((revision != APALIS_TK1_K20_FW_VER) || erase_only) &&
-+ (fw_entry != NULL)) {
-+ i = 0;
-+ while (apalis_tk1_k20_enter_ezport(apalis_tk1_k20) < 0
-+ && i++ < 5) {
-+ msleep(50);
-+ }
-+ if (i >= 5) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Problem entering EZ port mode.\n");
-+ release_firmware(fw_entry);
-+ ret = -EIO;
-+ goto bad;
-+ }
-+ if (apalis_tk1_k20_erase_chip_ezport(apalis_tk1_k20) < 0) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Problem erasing the chip.\n");
-+ release_firmware(fw_entry);
-+ ret = -EPROBE_DEFER;
-+ goto bad;
-+ }
-+ if (erase_only) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Chip fully erased.\n");
-+ release_firmware(fw_entry);
-+ ret = -EIO;
-+ goto bad;
-+ }
-+ if (apalis_tk1_k20_flash_chip_ezport(apalis_tk1_k20) < 0) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Problem flashing new firmware.\n");
-+ release_firmware(fw_entry);
-+ ret = -EPROBE_DEFER;
-+ goto bad;
-+ }
-+ }
-+ if (fw_entry != NULL)
-+ release_firmware(fw_entry);
-+
-+ msleep(10);
-+ apalis_tk1_k20_reset_chip(apalis_tk1_k20);
-+ msleep(10);
-+
-+ ret = apalis_tk1_k20_reg_read(apalis_tk1_k20, APALIS_TK1_K20_REVREG,
-+ &revision);
-+#endif /* CONFIG_APALIS_TK1_K20_EZP */
-+
-+ if (ret) {
-+ dev_err(apalis_tk1_k20->dev, "Device is not answering.\n");
-+ goto bad;
-+ }
-+
-+ if (revision != APALIS_TK1_K20_FW_VER) {
-+ dev_err(apalis_tk1_k20->dev,
-+ "Unsupported firmware version %d.%d.\n",
-+ ((revision & 0xF0) >> 4), (revision & 0x0F));
-+ ret = -ENOTSUPP;
-+ goto bad;
-+ }
-+
-+ for (i = 0; i < ARRAY_SIZE(apalis_tk1_k20->irqs); i++) {
-+ apalis_tk1_k20->irqs[i].reg_offset = i /
-+ APALIS_TK1_K20_IRQ_PER_REG;
-+ apalis_tk1_k20->irqs[i].mask = BIT(i %
-+ APALIS_TK1_K20_IRQ_PER_REG);
-+ }
-+
-+ apalis_tk1_k20->irq_chip.name = dev_name(dev);
-+ apalis_tk1_k20->irq_chip.status_base = APALIS_TK1_K20_IRQREG;
-+ apalis_tk1_k20->irq_chip.mask_base = APALIS_TK1_K20_MSQREG;
-+ apalis_tk1_k20->irq_chip.ack_base = 0;
-+ apalis_tk1_k20->irq_chip.irq_reg_stride = 0;
-+ apalis_tk1_k20->irq_chip.num_regs = APALIS_TK1_K20_IRQ_REG_CNT;
-+ apalis_tk1_k20->irq_chip.irqs = apalis_tk1_k20->irqs;
-+ apalis_tk1_k20->irq_chip.num_irqs = ARRAY_SIZE(apalis_tk1_k20->irqs);
-+
-+ ret = regmap_add_irq_chip(apalis_tk1_k20->regmap, apalis_tk1_k20->irq,
-+ IRQF_ONESHOT | IRQF_TRIGGER_FALLING |
-+ IRQF_TRIGGER_RISING, 0, &apalis_tk1_k20->irq_chip,
-+ &apalis_tk1_k20->irq_data);
-+ if (ret)
-+ goto bad;
-+
-+ mutex_init(&apalis_tk1_k20->lock);
-+
-+ if (apalis_tk1_k20_probe_flags_dt(apalis_tk1_k20) < 0 && pdata)
-+ apalis_tk1_k20->flags = pdata->flags;
-+
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_CAN) {
-+ apalis_tk1_k20->can0_irq = irq_of_parse_and_map(
-+ apalis_tk1_k20->dev->of_node, 1);
-+ apalis_tk1_k20->can1_irq = irq_of_parse_and_map(
-+ apalis_tk1_k20->dev->of_node, 2);
-+ if (apalis_tk1_k20->can0_irq == 0 ||
-+ apalis_tk1_k20->can1_irq == 0) {
-+ apalis_tk1_k20->flags &= ~APALIS_TK1_K20_USES_CAN;
-+ dev_err(apalis_tk1_k20->dev,
-+ "Missing CAN interrupts.\n");
-+ }
-+ }
-+
-+ if (pdata) {
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_TSC)
-+ apalis_tk1_k20_add_subdevice_pdata(apalis_tk1_k20,
-+ "apalis-tk1-k20-ts",
-+ &pdata->touch, sizeof(pdata->touch));
-+
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_ADC)
-+ apalis_tk1_k20_add_subdevice_pdata(apalis_tk1_k20,
-+ "apalis-tk1-k20-adc",
-+ &pdata->adc, sizeof(pdata->adc));
-+
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_CAN) {
-+ /* We have 2 CAN devices inside K20 */
-+ pdata->can0.id = 0;
-+ pdata->can1.id = 1;
-+ apalis_tk1_k20_add_subdevice_pdata(apalis_tk1_k20,
-+ "apalis-tk1-k20-can",
-+ &pdata->can0, sizeof(pdata->can0));
-+ apalis_tk1_k20_add_subdevice_pdata(apalis_tk1_k20,
-+ "apalis-tk1-k20-can",
-+ &pdata->can1, sizeof(pdata->can1));
-+ }
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_GPIO)
-+ apalis_tk1_k20_add_subdevice_pdata(apalis_tk1_k20,
-+ "apalis-tk1-k20-gpio",
-+ &pdata->gpio, sizeof(pdata->gpio));
-+ } else {
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_TSC)
-+ apalis_tk1_k20_add_subdevice(apalis_tk1_k20,
-+ "apalis-tk1-k20-ts");
-+
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_ADC)
-+ apalis_tk1_k20_add_subdevice(apalis_tk1_k20,
-+ "apalis-tk1-k20-adc");
-+
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_CAN) {
-+ /* We have 2 CAN devices inside K20 */
-+ apalis_tk1_k20_add_subdevice_pdata_id(apalis_tk1_k20,
-+ "apalis-tk1-k20-can",
-+ NULL, 0, 0);
-+ apalis_tk1_k20_add_subdevice_pdata_id(apalis_tk1_k20,
-+ "apalis-tk1-k20-can",
-+ NULL, 0, 1);
-+ }
-+
-+ if (apalis_tk1_k20->flags & APALIS_TK1_K20_USES_GPIO)
-+ apalis_tk1_k20_add_subdevice(apalis_tk1_k20,
-+ "apalis-tk1-k20-gpio");
-+ }
-+
-+ dev_info(apalis_tk1_k20->dev, "Apalis TK1 K20 MFD driver. "
-+ "Firmware version %d.%d.\n", FW_MAJOR, FW_MINOR);
-+
-+ return 0;
-+
-+bad:
-+ if (apalis_tk1_k20->ezpcs_gpio >= 0)
-+ gpio_free(apalis_tk1_k20->ezpcs_gpio);
-+ if (apalis_tk1_k20->reset_gpio >= 0)
-+ gpio_free(apalis_tk1_k20->reset_gpio);
-+ if (apalis_tk1_k20->int2_gpio >= 0)
-+ gpio_free(apalis_tk1_k20->int2_gpio);
-+
-+ return ret;
-+}
-+
-+
-+static int apalis_tk1_k20_spi_probe(struct spi_device *spi)
-+{
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20;
-+ int ret;
-+
-+ apalis_tk1_k20 = devm_kzalloc(&spi->dev, sizeof(*apalis_tk1_k20),
-+ GFP_KERNEL);
-+ if (!apalis_tk1_k20)
-+ return -ENOMEM;
-+
-+ dev_set_drvdata(&spi->dev, apalis_tk1_k20);
-+
-+ spi->mode = SPI_MODE_1;
-+
-+ apalis_tk1_k20->irq = spi->irq;
-+
-+ spi->max_speed_hz = (spi->max_speed_hz >= APALIS_TK1_K20_MAX_SPI_SPEED)
-+ ? APALIS_TK1_K20_MAX_SPI_SPEED : spi->max_speed_hz;
-+
-+ ret = spi_setup(spi);
-+ if (ret)
-+ return ret;
-+
-+ apalis_tk1_k20->regmap = devm_regmap_init(&spi->dev,
-+ &regmap_apalis_tk1_k20_bus, &spi->dev,
-+ &apalis_tk1_k20_regmap_spi_config);
-+ if (IS_ERR(apalis_tk1_k20->regmap)) {
-+ ret = PTR_ERR(apalis_tk1_k20->regmap);
-+ dev_err(&spi->dev, "Failed to initialize regmap: %d\n", ret);
-+ return ret;
-+ }
-+
-+ return apalis_tk1_k20_dev_init(&spi->dev);
-+}
-+
-+static int apalis_tk1_k20_spi_remove(struct spi_device *spi)
-+{
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20 =
-+ dev_get_drvdata(&spi->dev);
-+
-+ if (apalis_tk1_k20->ezpcs_gpio >= 0)
-+ gpio_free(apalis_tk1_k20->ezpcs_gpio);
-+ if (apalis_tk1_k20->reset_gpio >= 0)
-+ gpio_free(apalis_tk1_k20->reset_gpio);
-+ if (apalis_tk1_k20->int2_gpio >= 0)
-+ gpio_free(apalis_tk1_k20->int2_gpio);
-+
-+ kfree(spi->controller_data);
-+ spi->controller_data = NULL;
-+
-+ mfd_remove_devices(&spi->dev);
-+ regmap_del_irq_chip(apalis_tk1_k20->irq, apalis_tk1_k20->irq_data);
-+ mutex_destroy(&apalis_tk1_k20->lock);
-+
-+ return 0;
-+}
-+
-+static struct spi_driver apalis_tk1_k20_spi_driver = {
-+ .id_table = apalis_tk1_k20_device_ids,
-+ .driver = {
-+ .name = "apalis-tk1-k20",
-+ .of_match_table = apalis_tk1_k20_dt_ids,
-+ },
-+ .probe = apalis_tk1_k20_spi_probe,
-+ .remove = apalis_tk1_k20_spi_remove,
-+};
-+
-+static int __init apalis_tk1_k20_init(void)
-+{
-+ return spi_register_driver(&apalis_tk1_k20_spi_driver);
-+}
-+subsys_initcall(apalis_tk1_k20_init);
-+
-+static void __exit apalis_tk1_k20_exit(void)
-+{
-+ spi_unregister_driver(&apalis_tk1_k20_spi_driver);
-+}
-+module_exit(apalis_tk1_k20_exit);
-+
-+MODULE_DESCRIPTION("MFD driver for Kinetis MK20DN512 MCU on Apalis TK1");
-+MODULE_AUTHOR("Dominik Sliwa <dominik.sliwa@toradex.com>");
-+MODULE_LICENSE("GPL v2");
-diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
-index ac4ff394bc56..16b2d8e2d16a 100644
---- a/drivers/net/can/Kconfig
-+++ b/drivers/net/can/Kconfig
-@@ -88,6 +88,12 @@ config CAN_AT91
- This is a driver for the SoC CAN controller in Atmel's AT91SAM9263
- and AT91SAM9X5 processors.
-
-+config CAN_APALIS_TK1_K20
-+ tristate "Apalis TK1 K20 CAN controllers"
-+ depends on MFD_APALIS_TK1_K20
-+ ---help---
-+ Driver for the Apalis TK1 K20 CAN controllers.
-+
- config CAN_BFIN
- depends on BF534 || BF536 || BF537 || BF538 || BF539 || BF54x
- tristate "Analog Devices Blackfin on-chip CAN"
-diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile
-index 02b8ed794564..80ca9eba724a 100644
---- a/drivers/net/can/Makefile
-+++ b/drivers/net/can/Makefile
-@@ -19,6 +19,7 @@ obj-y += usb/
- obj-y += softing/
-
- obj-$(CONFIG_CAN_AT91) += at91_can.o
-+obj-$(CONFIG_CAN_APALIS_TK1_K20) += apalis-tk1-k20-can.o
- obj-$(CONFIG_CAN_BFIN) += bfin_can.o
- obj-$(CONFIG_CAN_CC770) += cc770/
- obj-$(CONFIG_CAN_C_CAN) += c_can/
-diff --git a/drivers/net/can/apalis-tk1-k20-can.c b/drivers/net/can/apalis-tk1-k20-can.c
-new file mode 100644
-index 000000000000..e24adbb35dfd
---- /dev/null
-+++ b/drivers/net/can/apalis-tk1-k20-can.c
-@@ -0,0 +1,817 @@
-+/*
-+ * Copyright 2016-2017 Toradex AG
-+ * Dominik Sliwa <dominik.sliwa@toradex.com>
-+ *
-+ * CAN bus driver for Apalis TK1 K20 CAN Controller over MFD device
-+ * based on MCP251x CAN driver
-+ *
-+ * This program is free software; you can redistribute it and/or modify it under
-+ * the terms of the GNU General Public License version 2 as published by the
-+ * Free Software Foundation.
-+ */
-+
-+#include <linux/can/core.h>
-+#include <linux/can/dev.h>
-+#include <linux/can/led.h>
-+#include <linux/completion.h>
-+#include <linux/delay.h>
-+#include <linux/device.h>
-+#include <linux/dma-mapping.h>
-+#include <linux/freezer.h>
-+#include <linux/interrupt.h>
-+#include <linux/io.h>
-+#include <linux/kernel.h>
-+#include <linux/mfd/apalis-tk1-k20.h>
-+#include <linux/module.h>
-+#include <linux/netdevice.h>
-+#include <linux/platform_device.h>
-+#include <linux/slab.h>
-+#include <linux/uaccess.h>
-+
-+/* Buffer size required for the largest transfer (i.e., reading a
-+ * frame)
-+ */
-+#define CAN_FRAME_MAX_LEN 8
-+#define CAN_HEADER_MAX_LEN 5
-+#define CAN_TRANSFER_BUF_LEN (CAN_HEADER_MAX_LEN + CAN_FRAME_MAX_LEN)
-+
-+#define MB_DLC_OFF 4
-+#define MB_EID_OFF 0
-+#define MB_RTR_SHIFT 4
-+#define MB_IDE_SHIFT 5
-+#define MB_DLC_MASK 0xF
-+#define MB_EID_LEN 4
-+
-+#define CANCTRL_MODMASK 0x03
-+#define CANCTRL_INTEN BIT(2)
-+#define CANINTF_RX BIT(3)
-+#define CANINTF_TX BIT(4)
-+#define CANINTF_ERR BIT(5)
-+#define CANCTRL_INTMASK (CANINTF_RX | CANINTF_TX | CANINTF_ERR)
-+
-+#define EFLG_EWARN 0x01
-+#define EFLG_RXWAR 0x02
-+#define EFLG_TXWAR 0x04
-+#define EFLG_RXEP 0x08
-+#define EFLG_TXEP 0x10
-+#define EFLG_TXBO 0x20
-+#define EFLG_RXOVR 0x40
-+
-+#define TX_ECHO_SKB_MAX 1
-+
-+#define K20_CAN_MAX_ID 1
-+
-+#define DEVICE_NAME "apalis-tk1-k20-can"
-+
-+static const struct can_bittiming_const apalis_tk1_k20_can_bittiming_const = {
-+ .name = "tk1-k20-can",
-+ .tseg1_min = 3,
-+ .tseg1_max = 16,
-+ .tseg2_min = 2,
-+ .tseg2_max = 8,
-+ .sjw_max = 4,
-+ .brp_min = 1,
-+ .brp_max = 64,
-+ .brp_inc = 1,
-+};
-+
-+struct apalis_tk1_k20_priv {
-+ struct can_priv can;
-+ struct net_device *net;
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20;
-+ struct apalis_tk1_k20_can_platform_data *pdata;
-+
-+ struct sk_buff *tx_skb;
-+ int tx_len;
-+
-+ struct workqueue_struct *wq;
-+ struct work_struct tx_work;
-+ struct work_struct restart_work;
-+ struct mutex apalis_tk1_k20_can_lock;
-+
-+ int force_quit;
-+ int after_suspend;
-+#define AFTER_SUSPEND_UP 1
-+#define AFTER_SUSPEND_DOWN 2
-+#define AFTER_SUSPEND_RESTART 4
-+ int restart_tx;
-+};
-+
-+static void apalis_tk1_k20_can_clean(struct net_device *net)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+
-+ if (priv->tx_skb || priv->tx_len)
-+ net->stats.tx_errors++;
-+ if (priv->tx_skb)
-+ dev_kfree_skb(priv->tx_skb);
-+ if (priv->tx_len)
-+ can_free_echo_skb(priv->net, 0);
-+ priv->tx_skb = NULL;
-+ priv->tx_len = 0;
-+}
-+
-+static void apalis_tk1_k20_can_hw_tx_frame(struct net_device *net, u8 *buf,
-+ int len, int tx_buf_idx)
-+{
-+ /* TODO: Implement multiple TX buffer handling */
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ apalis_tk1_k20_reg_write_bulk(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN_OUT_BUF
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), buf, len);
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+}
-+
-+static void apalis_tk1_k20_can_hw_tx(struct net_device *net,
-+ struct can_frame *frame, int tx_buf_idx)
-+{
-+ u8 buf[CAN_TRANSFER_BUF_LEN];
-+
-+ buf[MB_DLC_OFF] = frame->can_dlc;
-+ memcpy(buf + MB_EID_OFF, &frame->can_id, MB_EID_LEN);
-+ memcpy(buf + CAN_HEADER_MAX_LEN, frame->data, frame->can_dlc);
-+
-+ apalis_tk1_k20_can_hw_tx_frame(net, buf, frame->can_dlc
-+ + CAN_HEADER_MAX_LEN, tx_buf_idx);
-+}
-+
-+static void apalis_tk1_k20_can_hw_rx(struct net_device *net, int buf_idx)
-+{
-+ int i = 0;
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+ struct sk_buff *skb;
-+ struct can_frame *frame;
-+ u8 buf[CAN_TRANSFER_BUF_LEN * APALIS_TK1_MAX_CAN_DMA_XREF];
-+ u32 frame_available = 0;
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ apalis_tk1_k20_reg_read(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN_IN_BUF_CNT
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), &frame_available);
-+ frame_available = min(frame_available, APALIS_TK1_MAX_CAN_DMA_XREF);
-+ apalis_tk1_k20_reg_read_bulk(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN_IN_BUF
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), buf,
-+ CAN_TRANSFER_BUF_LEN * frame_available);
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+
-+ for (i = 0; i < frame_available; i++) {
-+ skb = alloc_can_skb(priv->net, &frame);
-+ if (!skb) {
-+ dev_err(&net->dev, "cannot allocate RX skb\n");
-+ priv->net->stats.rx_dropped++;
-+ return;
-+ }
-+ memcpy(&frame->can_id, &buf[i * CAN_TRANSFER_BUF_LEN]
-+ + MB_EID_OFF, MB_EID_LEN);
-+ /* Data length */
-+ frame->can_dlc = get_can_dlc(buf[i * CAN_TRANSFER_BUF_LEN
-+ + MB_DLC_OFF]);
-+ memcpy(frame->data, &buf[i * CAN_TRANSFER_BUF_LEN]
-+ + CAN_HEADER_MAX_LEN, frame->can_dlc);
-+
-+ priv->net->stats.rx_packets++;
-+ priv->net->stats.rx_bytes += frame->can_dlc;
-+
-+ can_led_event(priv->net, CAN_LED_EVENT_RX);
-+
-+ netif_rx_ni(skb);
-+ }
-+
-+
-+}
-+
-+static netdev_tx_t apalis_tk1_k20_can_hard_start_xmit(struct sk_buff *skb,
-+ struct net_device *net)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+
-+ if (priv->tx_skb || priv->tx_len) {
-+ dev_warn(&net->dev, "hard_xmit called while TX busy\n");
-+ return NETDEV_TX_BUSY;
-+ }
-+
-+ if (can_dropped_invalid_skb(net, skb))
-+ return NETDEV_TX_OK;
-+
-+ netif_stop_queue(net);
-+ priv->tx_skb = skb;
-+ queue_work(priv->wq, &priv->tx_work);
-+
-+ return NETDEV_TX_OK;
-+}
-+
-+static int apalis_tk1_k20_can_do_set_mode(struct net_device *net,
-+ enum can_mode mode)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+
-+ switch (mode) {
-+ case CAN_MODE_START:
-+ apalis_tk1_k20_can_clean(net);
-+ /* We have to delay work since I/O may sleep */
-+ priv->can.state = CAN_STATE_ERROR_ACTIVE;
-+ priv->restart_tx = 1;
-+ if (priv->can.restart_ms == 0)
-+ priv->after_suspend = AFTER_SUSPEND_RESTART;
-+ queue_work(priv->wq, &priv->restart_work);
-+ break;
-+ default:
-+ return -EOPNOTSUPP;
-+ }
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_can_set_normal_mode(struct net_device *net)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ /* Enable interrupts */
-+ apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20, APALIS_TK1_K20_CANREG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id),
-+ CANCTRL_INTEN, CANCTRL_INTEN);
-+
-+ if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK) {
-+ /* Put device into loopback mode */
-+ apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CANREG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), CANCTRL_MODMASK,
-+ CAN_CTRLMODE_LOOPBACK);
-+ } else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) {
-+ /* Put device into listen-only mode */
-+ apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CANREG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), CANCTRL_MODMASK,
-+ CAN_CTRLMODE_LISTENONLY);
-+ } else {
-+ /* Put device into normal mode */
-+ apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CANREG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), CANCTRL_MODMASK,
-+ 0x00);
-+ }
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ priv->can.state = CAN_STATE_ERROR_ACTIVE;
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_can_do_set_bittiming(struct net_device *net)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+ struct can_bittiming *bt = &priv->can.bittiming;
-+
-+ if ((bt->bitrate / APALIS_TK1_CAN_CLK_UNIT) > 0xFF)
-+ return -EINVAL;
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ apalis_tk1_k20_reg_write(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN_BAUD_REG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), (bt->bitrate /
-+ APALIS_TK1_CAN_CLK_UNIT) & 0xFF);
-+ apalis_tk1_k20_reg_write(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN_BIT_1
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id),
-+ ((bt->sjw & 0x3) << 6) |
-+ ((bt->phase_seg2 & 0x7) << 3) |
-+ (bt->phase_seg1 & 0x7));
-+ apalis_tk1_k20_reg_write(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN_BIT_2
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id),
-+ (bt->prop_seg & 0x7));
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ dev_dbg(priv->apalis_tk1_k20->dev, "Setting CAN%d bitrate " \
-+ "to %d (0x%X * 6.25kHz)\n", priv->pdata->id, bt->bitrate,
-+ (bt->bitrate / APALIS_TK1_CAN_CLK_UNIT) & 0xFF);
-+ dev_dbg(priv->apalis_tk1_k20->dev, "Setting CAN%d bit timing " \
-+ "RJW = %d, PSEG1 = %d, PSEG2 = %d, PROPSEG = %d\n",
-+ priv->pdata->id, bt->sjw, bt->phase_seg1,
-+ bt->phase_seg2, bt->prop_seg);
-+ dev_dbg(priv->apalis_tk1_k20->dev, "Setting CAN%d bit timing " \
-+ "bitrate = %d\n", priv->pdata->id, bt->bitrate);
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_can_setup(struct net_device *net,
-+ struct apalis_tk1_k20_priv *priv)
-+{
-+ apalis_tk1_k20_can_do_set_bittiming(net);
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_can_hw_reset(struct net_device *net)
-+{
-+ return 0;
-+}
-+
-+static void apalis_tk1_k20_can_open_clean(struct net_device *net)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+ struct apalis_tk1_k20_can_platform_data *pdata = priv->pdata;
-+
-+ if (pdata->id == 0)
-+ apalis_tk1_k20_irq_free(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN0_IRQ, priv);
-+ if (pdata->id == 1)
-+ apalis_tk1_k20_irq_free(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN1_IRQ, priv);
-+ close_candev(net);
-+}
-+
-+static int apalis_tk1_k20_can_stop(struct net_device *net)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+ struct apalis_tk1_k20_can_platform_data *pdata = priv->pdata;
-+
-+ close_candev(net);
-+
-+ priv->force_quit = 1;
-+ if (pdata->id == 0)
-+ apalis_tk1_k20_irq_free(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN0_IRQ, priv);
-+ if (pdata->id == 1)
-+ apalis_tk1_k20_irq_free(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN1_IRQ, priv);
-+ destroy_workqueue(priv->wq);
-+ priv->wq = NULL;
-+
-+ mutex_lock(&priv->apalis_tk1_k20_can_lock);
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ if (pdata->id == 0)
-+ apalis_tk1_k20_irq_mask(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN0_IRQ);
-+ if (pdata->id == 1)
-+ apalis_tk1_k20_irq_mask(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN1_IRQ);
-+ /* Disable and clear pending interrupts */
-+ priv->can.state = CAN_STATE_STOPPED;
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-+
-+ can_led_event(net, CAN_LED_EVENT_STOP);
-+
-+ return 0;
-+}
-+
-+static void apalis_tk1_k20_can_error_skb(struct net_device *net, int can_id,
-+ int data1)
-+{
-+ struct sk_buff *skb;
-+ struct can_frame *frame;
-+
-+ skb = alloc_can_err_skb(net, &frame);
-+ if (skb) {
-+ frame->can_id |= can_id;
-+ frame->data[1] = data1;
-+ netif_rx_ni(skb);
-+ } else {
-+ netdev_err(net, "cannot allocate error skb\n");
-+ }
-+}
-+
-+static void apalis_tk1_k20_can_tx_work_handler(struct work_struct *ws)
-+{
-+ struct apalis_tk1_k20_priv *priv = container_of(ws,
-+ struct apalis_tk1_k20_priv, tx_work);
-+ struct net_device *net = priv->net;
-+ struct can_frame *frame;
-+
-+ mutex_lock(&priv->apalis_tk1_k20_can_lock);
-+ if (priv->tx_skb) {
-+ if (priv->can.state == CAN_STATE_BUS_OFF) {
-+ apalis_tk1_k20_can_clean(net);
-+ } else {
-+ frame = (struct can_frame *)priv->tx_skb->data;
-+
-+ if (frame->can_dlc > CAN_FRAME_MAX_LEN)
-+ frame->can_dlc = CAN_FRAME_MAX_LEN;
-+ apalis_tk1_k20_can_hw_tx(net, frame, 0);
-+ priv->tx_len = 1 + frame->can_dlc;
-+ can_put_echo_skb(priv->tx_skb, net, 0);
-+ priv->tx_skb = NULL;
-+ }
-+ }
-+ mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-+}
-+
-+#ifdef CONFIG_PM_SLEEP
-+
-+static int apalis_tk1_k20_can_suspend(struct device *dev)
-+{
-+ struct apalis_tk1_k20_priv *priv = dev_get_drvdata(dev);
-+ struct apalis_tk1_k20_can_platform_data *pdata = priv->pdata;
-+
-+ priv->force_quit = 1;
-+
-+ mutex_lock(&priv->apalis_tk1_k20_can_lock);
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ if (pdata->id == 0)
-+ apalis_tk1_k20_irq_mask(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN0_IRQ);
-+ if (pdata->id == 1)
-+ apalis_tk1_k20_irq_mask(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN1_IRQ);
-+ /* Disable interrupts */
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-+ /* Note: at this point neither IST nor workqueues are running.
-+ * open/stop cannot be called anyway so locking is not needed
-+ */
-+ if (netif_running(priv->net)) {
-+ netif_device_detach(priv->net);
-+
-+ priv->after_suspend = AFTER_SUSPEND_UP;
-+ } else {
-+ priv->after_suspend = AFTER_SUSPEND_DOWN;
-+ }
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_can_resume(struct device *dev)
-+{
-+ struct apalis_tk1_k20_priv *priv = dev_get_drvdata(dev);
-+ struct apalis_tk1_k20_can_platform_data *pdata = priv->pdata;
-+
-+ if (priv->after_suspend & AFTER_SUSPEND_UP)
-+ queue_work(priv->wq, &priv->restart_work);
-+ else
-+ priv->after_suspend = 0;
-+
-+ priv->force_quit = 0;
-+ mutex_lock(&priv->apalis_tk1_k20_can_lock);
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ if (pdata->id == 0)
-+ apalis_tk1_k20_irq_unmask(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN0_IRQ);
-+ if (pdata->id == 1)
-+ apalis_tk1_k20_irq_unmask(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN1_IRQ);
-+ /* Enable interrupts */
-+ priv->can.state = CAN_STATE_STOPPED;
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-+ return 0;
-+}
-+
-+static SIMPLE_DEV_PM_OPS(apalis_tk1_k20_can_pm_ops, apalis_tk1_k20_can_suspend,
-+ apalis_tk1_k20_can_resume);
-+
-+#endif
-+
-+static void apalis_tk1_k20_can_restart_work_handler(struct work_struct *ws)
-+{
-+ struct apalis_tk1_k20_priv *priv = container_of(ws,
-+ struct apalis_tk1_k20_priv, restart_work);
-+ struct net_device *net = priv->net;
-+
-+ mutex_lock(&priv->apalis_tk1_k20_can_lock);
-+ if (priv->after_suspend) {
-+ mdelay(10);
-+ apalis_tk1_k20_can_hw_reset(net);
-+ apalis_tk1_k20_can_setup(net, priv);
-+ if (priv->after_suspend & AFTER_SUSPEND_RESTART) {
-+ apalis_tk1_k20_can_set_normal_mode(net);
-+ } else if (priv->after_suspend & AFTER_SUSPEND_UP) {
-+ netif_device_attach(net);
-+ apalis_tk1_k20_can_clean(net);
-+ apalis_tk1_k20_can_set_normal_mode(net);
-+ netif_wake_queue(net);
-+ }
-+ priv->after_suspend = 0;
-+ priv->force_quit = 0;
-+ }
-+
-+ if (priv->restart_tx) {
-+ priv->restart_tx = 0;
-+ apalis_tk1_k20_can_clean(net);
-+ netif_wake_queue(net);
-+ apalis_tk1_k20_can_error_skb(net, CAN_ERR_RESTARTED, 0);
-+ }
-+ mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-+}
-+
-+static irqreturn_t apalis_tk1_k20_can_ist(int irq, void *dev_id)
-+{
-+ struct apalis_tk1_k20_priv *priv = dev_id;
-+ struct net_device *net = priv->net;
-+
-+ mutex_lock(&priv->apalis_tk1_k20_can_lock);
-+ while (!priv->force_quit) {
-+ enum can_state new_state = CAN_STATE_ERROR_ACTIVE;
-+ int ret;
-+ u32 intf, eflag;
-+ u8 clear_intf = 0;
-+ int can_id = 0, data1 = 0;
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ ret = apalis_tk1_k20_reg_read(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CANREG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), &intf);
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+
-+ if (ret) {
-+ dev_err(&net->dev, "Communication error\n");
-+ break;
-+ }
-+
-+ intf &= CANCTRL_INTMASK;
-+ /* receive */
-+ if (intf & CANINTF_RX)
-+ apalis_tk1_k20_can_hw_rx(net, 0);
-+
-+ /* any error interrupt we need to clear? */
-+ if (intf & CANINTF_ERR)
-+ clear_intf |= intf & CANINTF_ERR;
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ if (clear_intf)
-+ ret = apalis_tk1_k20_reg_write(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CANREG_CLR
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id),clear_intf);
-+ if (ret) {
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ dev_err(&net->dev, "Communication error\n");
-+ break;
-+ }
-+
-+ /* Update can state */
-+ if (intf & CANINTF_ERR) {
-+ ret = apalis_tk1_k20_reg_read(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CANERR +
-+ APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), &eflag);
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ if (ret) {
-+ dev_err(&net->dev, "Communication error\n");
-+ break;
-+ }
-+ if (eflag & EFLG_TXBO) {
-+ new_state = CAN_STATE_BUS_OFF;
-+ can_id |= CAN_ERR_BUSOFF;
-+ } else if (eflag & EFLG_TXEP) {
-+ new_state = CAN_STATE_ERROR_PASSIVE;
-+ can_id |= CAN_ERR_CRTL;
-+ data1 |= CAN_ERR_CRTL_TX_PASSIVE;
-+ } else if (eflag & EFLG_RXEP) {
-+ new_state = CAN_STATE_ERROR_PASSIVE;
-+ can_id |= CAN_ERR_CRTL;
-+ data1 |= CAN_ERR_CRTL_RX_PASSIVE;
-+ } else if (eflag & EFLG_TXWAR) {
-+ new_state = CAN_STATE_ERROR_WARNING;
-+ can_id |= CAN_ERR_CRTL;
-+ data1 |= CAN_ERR_CRTL_TX_WARNING;
-+ } else if (eflag & EFLG_RXWAR) {
-+ new_state = CAN_STATE_ERROR_WARNING;
-+ can_id |= CAN_ERR_CRTL;
-+ data1 |= CAN_ERR_CRTL_RX_WARNING;
-+ } else {
-+ new_state = CAN_STATE_ERROR_ACTIVE;
-+ }
-+ }
-+ else {
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ }
-+
-+ /* Update can state statistics */
-+ switch (priv->can.state) {
-+ case CAN_STATE_ERROR_ACTIVE:
-+ if (new_state >= CAN_STATE_ERROR_WARNING &&
-+ new_state <= CAN_STATE_BUS_OFF)
-+ priv->can.can_stats.error_warning++;
-+ case CAN_STATE_ERROR_WARNING: /* fallthrough */
-+ if (new_state >= CAN_STATE_ERROR_PASSIVE &&
-+ new_state <= CAN_STATE_BUS_OFF)
-+ priv->can.can_stats.error_passive++;
-+ break;
-+ default:
-+ break;
-+ }
-+ priv->can.state = new_state;
-+
-+ if (intf & CANINTF_ERR) {
-+ /* Handle overflow counters */
-+ if (eflag & EFLG_RXOVR) {
-+ if (eflag & EFLG_RXOVR) {
-+ net->stats.rx_over_errors++;
-+ net->stats.rx_errors++;
-+ }
-+ can_id |= CAN_ERR_CRTL;
-+ data1 |= CAN_ERR_CRTL_RX_OVERFLOW;
-+ }
-+ apalis_tk1_k20_can_error_skb(net, can_id, data1);
-+ }
-+
-+ if (priv->can.state == CAN_STATE_BUS_OFF &&
-+ priv->can.restart_ms == 0) {
-+ priv->force_quit = 1;
-+ can_bus_off(net);
-+ break;
-+ }
-+
-+ if (intf == 0)
-+ break;
-+
-+ if (intf & CANINTF_TX) {
-+ net->stats.tx_packets++;
-+ net->stats.tx_bytes += priv->tx_len - 1;
-+ can_led_event(net, CAN_LED_EVENT_TX);
-+ if (priv->tx_len) {
-+ can_get_echo_skb(net, 0);
-+ priv->tx_len = 0;
-+ }
-+ netif_wake_queue(net);
-+ if (!(intf & (CANINTF_RX | CANINTF_ERR)))
-+ break;
-+ }
-+ }
-+ mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-+ return IRQ_HANDLED;
-+}
-+
-+static int apalis_tk1_k20_can_open(struct net_device *net)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+ struct apalis_tk1_k20_can_platform_data *pdata = priv->pdata;
-+ int ret;
-+
-+ ret = open_candev(net);
-+ if (ret) {
-+ dev_err(&net->dev, "unable to initialize CAN\n");
-+ return ret;
-+ }
-+
-+ mutex_lock(&priv->apalis_tk1_k20_can_lock);
-+
-+ priv->force_quit = 0;
-+ priv->tx_skb = NULL;
-+ priv->tx_len = 0;
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ if (pdata->id == 0)
-+ ret = apalis_tk1_k20_irq_request(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN0_IRQ,
-+ apalis_tk1_k20_can_ist,
-+ DEVICE_NAME, priv);
-+ if (pdata->id == 1)
-+ ret = apalis_tk1_k20_irq_request(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CAN1_IRQ,
-+ apalis_tk1_k20_can_ist,
-+ DEVICE_NAME, priv);
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+ if (ret) {
-+ dev_err(&net->dev, "failed to acquire IRQ\n");
-+ close_candev(net);
-+ goto open_unlock;
-+ }
-+
-+ priv->wq = create_freezable_workqueue("apalis_tk1_k20_wq");
-+ INIT_WORK(&priv->tx_work, apalis_tk1_k20_can_tx_work_handler);
-+ INIT_WORK(&priv->restart_work, apalis_tk1_k20_can_restart_work_handler);
-+
-+ ret = apalis_tk1_k20_can_hw_reset(net);
-+ if (ret) {
-+ apalis_tk1_k20_can_open_clean(net);
-+ goto open_unlock;
-+ }
-+
-+ ret = apalis_tk1_k20_can_setup(net, priv);
-+ if (ret) {
-+ apalis_tk1_k20_can_open_clean(net);
-+ goto open_unlock;
-+ }
-+
-+ ret = apalis_tk1_k20_can_set_normal_mode(net);
-+ if (ret) {
-+ apalis_tk1_k20_can_open_clean(net);
-+ goto open_unlock;
-+ }
-+
-+ can_led_event(net, CAN_LED_EVENT_OPEN);
-+
-+ netif_wake_queue(net);
-+
-+open_unlock:
-+ mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-+ return ret;
-+}
-+
-+static const struct net_device_ops apalis_tk1_k20_netdev_ops = {
-+ .ndo_open = apalis_tk1_k20_can_open,
-+ .ndo_stop = apalis_tk1_k20_can_stop,
-+ .ndo_start_xmit = apalis_tk1_k20_can_hard_start_xmit,
-+};
-+
-+static int apalis_tk1_k20_can_probe(struct platform_device *pdev)
-+{
-+ struct net_device *net;
-+ struct apalis_tk1_k20_priv *priv;
-+ struct apalis_tk1_k20_can_platform_data *pdata =
-+ pdev->dev.platform_data;
-+ int ret = -ENODEV;
-+
-+ if (!pdata) {
-+ pdata = kmalloc(sizeof(struct apalis_tk1_k20_can_platform_data),
-+ GFP_KERNEL);
-+ if (pdev->id == -1)
-+ pdata->id = 0;
-+ if (pdev->id >= 0 && pdev->id <= K20_CAN_MAX_ID)
-+ pdata->id = pdev->id;
-+ else
-+ goto error_out;
-+ }
-+
-+ if (pdata->id > K20_CAN_MAX_ID)
-+ goto error_out;
-+ /* Allocate can/net device */
-+ net = alloc_candev(sizeof(struct apalis_tk1_k20_priv), TX_ECHO_SKB_MAX);
-+ if (!net) {
-+ ret = -ENOMEM;
-+ goto error_out;
-+ }
-+
-+ net->netdev_ops = &apalis_tk1_k20_netdev_ops;
-+ net->flags |= IFF_ECHO;
-+
-+ priv = netdev_priv(net);
-+ priv->can.bittiming_const = &apalis_tk1_k20_can_bittiming_const;
-+ priv->can.do_set_mode = apalis_tk1_k20_can_do_set_mode;
-+ priv->can.clock.freq = 8000000;
-+ priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
-+ CAN_CTRLMODE_LOOPBACK | CAN_CTRLMODE_LISTENONLY;
-+ priv->net = net;
-+ priv->pdata = pdata;
-+ priv->apalis_tk1_k20 = dev_get_drvdata(pdev->dev.parent);
-+
-+ mutex_init(&priv->apalis_tk1_k20_can_lock);
-+
-+ SET_NETDEV_DEV(net, &pdev->dev);
-+
-+ platform_set_drvdata(pdev, priv);
-+
-+ ret = register_candev(net);
-+ if (ret)
-+ goto error_probe;
-+
-+ devm_can_led_init(net);
-+
-+ dev_info(&pdev->dev, "probed %d\n", pdev->id);
-+
-+ return ret;
-+
-+error_probe:
-+ free_candev(net);
-+error_out:
-+ return ret;
-+}
-+
-+static int apalis_tk1_k20_can_remove(struct platform_device *pdev)
-+{
-+ struct apalis_tk1_k20_priv *priv = platform_get_drvdata(pdev);
-+ struct net_device *net = priv->net;
-+
-+ unregister_candev(net);
-+ free_candev(net);
-+
-+ return 0;
-+}
-+
-+static const struct platform_device_id apalis_tk1_k20_can_idtable[] = {
-+ {.name = "apalis-tk1-k20-can", },
-+ { /* sentinel */}
-+};
-+
-+MODULE_DEVICE_TABLE(platform, apalis_tk1_k20_can_idtable);
-+
-+static struct platform_driver apalis_tk1_k20_can_driver = {
-+ .id_table = apalis_tk1_k20_can_idtable,
-+ .remove = apalis_tk1_k20_can_remove,
-+ .probe = apalis_tk1_k20_can_probe,
-+ .driver = {
-+ .name = DEVICE_NAME,
-+#ifdef CONFIG_PM_SLEEP
-+ .pm = &apalis_tk1_k20_can_pm_ops,
-+#endif
-+ },
-+};
-+
-+module_platform_driver(apalis_tk1_k20_can_driver);
-+
-+MODULE_DESCRIPTION("CAN driver for K20 MCU on Apalis TK1");
-+MODULE_AUTHOR("Dominik Sliwa <dominik.sliwa@toradex.com>");
-+MODULE_LICENSE("GPL v2");
-diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
-index 44550182a4a3..329dd49724a1 100644
---- a/drivers/spi/spi-tegra114.c
-+++ b/drivers/spi/spi-tegra114.c
-@@ -703,12 +703,6 @@ static u32 tegra_spi_setup_transfer_one(struct spi_device *spi,
- } else
- tegra_spi_writel(tspi, command1, SPI_COMMAND1);
-
-- command1 |= SPI_CS_SW_HW;
-- if (spi->mode & SPI_CS_HIGH)
-- command1 |= SPI_CS_SS_VAL;
-- else
-- command1 &= ~SPI_CS_SS_VAL;
--
- tegra_spi_writel(tspi, 0, SPI_COMMAND2);
- } else {
- command1 = tspi->command1_reg;
-@@ -776,6 +770,7 @@ static int tegra_spi_setup(struct spi_device *spi)
-
- spin_lock_irqsave(&tspi->lock, flags);
- val = tspi->def_command1_reg;
-+ val |= SPI_CS_SEL(spi->chip_select);
- if (spi->mode & SPI_CS_HIGH)
- val &= ~SPI_CS_POL_INACTIVE(spi->chip_select);
- else
-diff --git a/include/linux/mfd/apalis-tk1-k20-api.h b/include/linux/mfd/apalis-tk1-k20-api.h
-new file mode 100644
-index 000000000000..85bbf9f28ca4
---- /dev/null
-+++ b/include/linux/mfd/apalis-tk1-k20-api.h
-@@ -0,0 +1,123 @@
-+/*
-+ * Copyright 2016-2017 Toradex AG
-+ * Dominik Sliwa <dominik.sliwa@toradex.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it under
-+ * the terms of the GNU General Public License version 2 as published by the
-+ * Free Software Foundation.
-+ */
-+
-+#ifndef __LINUX_MFD_APALIS_TK1_K20_API_H
-+#define __LINUX_MFD_APALIS_TK1_K20_API_H
-+
-+/* Commands and registers used in SPI communication */
-+
-+/* Commands*/
-+#define APALIS_TK1_K20_READ_INST 0x0F
-+#define APALIS_TK1_K20_WRITE_INST 0xF0
-+#define APALIS_TK1_K20_BULK_WRITE_INST 0x3C
-+#define APALIS_TK1_K20_BULK_READ_INST 0xC3
-+
-+#define APALIS_TK1_K20_MAX_BULK 250u
-+#define APALIS_TK1_K20_HEADER 4u
-+
-+/* General registers*/
-+#define APALIS_TK1_K20_STAREG 0x00 /* general status register RO */
-+#define APALIS_TK1_K20_REVREG 0x01 /* FW revision register RO*/
-+#define APALIS_TK1_K20_IRQREG 0x02 /* IRQ status RO(reset of read) */
-+#define APALIS_TK1_K20_CTRREG 0x03 /* general control register RW */
-+#define APALIS_TK1_K20_MSQREG 0x04 /* IRQ mask register RW */
-+
-+/* 0x05-0x0F Reserved */
-+
-+/* CAN Registers */
-+#define APALIS_TK1_K20_CANREG 0x10 /* CAN0 control & status register RW */
-+#define APALIS_TK1_K20_CANREG_CLR 0x11 /* CAN0 CANREG clear register WO */
-+#define APALIS_TK1_K20_CANERR 0x12 /* CAN0 error register RW */
-+#define APALIS_TK1_K20_CAN_BAUD_REG 0x13 /* CAN0 baud set register RW */
-+#define APALIS_TK1_K20_CAN_BIT_1 0x14 /* CAN0 bit timing register 1 RW */
-+#define APALIS_TK1_K20_CAN_BIT_2 0x15 /* CAN0 bit timing register 2 RW */
-+#define APALIS_TK1_K20_CAN_IN_BUF_CNT 0x16 /* CAN0 IN received data count RO */
-+#define APALIS_TK1_K20_CAN_IN_BUF 0x17 /* CAN0 IN RO */
-+/* buffer size is 13 bytes */
-+#define APALIS_TK1_K20_CAN_IN_BUF_END 0x23 /* CAN0 IN RO */
-+#define APALIS_TK1_K20_CAN_OUT_BUF 0x24 /* CAN0 OUT WO */
-+/* buffer size is 13 bytes */
-+#define APALIS_TK1_K20_CAN_OUT_BUF_END (APALIS_TK1_K20_CAN_OUT_BUF + 13 - 1)/* CAN OUT BUF END */
-+#define APALIS_TK1_K20_CAN_OFFSET 0x30
-+#define APALIS_TK1_K20_CAN_DEV_OFFSET(x) (x ? APALIS_TK1_K20_CAN_OFFSET : 0)
-+
-+/* 0x30-0x3F Reserved */
-+/* 0x40-0x62 CAN1 registers same layout as CAN0*/
-+/* 0x63-0x6F Reserved */
-+
-+/* ADC Registers */
-+#define APALIS_TK1_K20_ADCREG 0x70 /* ADC control & status register RW */
-+#define APALIS_TK1_K20_ADC_CH0L 0x71 /* ADC Channel 0 LSB RO */
-+#define APALIS_TK1_K20_ADC_CH0H 0x72 /* ADC Channel 0 MSB RO */
-+#define APALIS_TK1_K20_ADC_CH1L 0x73 /* ADC Channel 1 LSB RO */
-+#define APALIS_TK1_K20_ADC_CH1H 0x74 /* ADC Channel 1 MSB RO */
-+#define APALIS_TK1_K20_ADC_CH2L 0x75 /* ADC Channel 2 LSB RO */
-+#define APALIS_TK1_K20_ADC_CH2H 0x76 /* ADC Channel 2 MSB RO */
-+#define APALIS_TK1_K20_ADC_CH3L 0x77 /* ADC Channel 3 LSB RO */
-+#define APALIS_TK1_K20_ADC_CH3H 0x78 /* ADC Channel 3 MSB RO */
-+/* Bulk read of LSB register can be use to read entire 16-bit in one command */
-+/* Bulk read of APALIS_TK1_K20_ADC_CH0L register can be use to read all
-+ * ADC channels in one command */
-+
-+/* 0x79-0x7F reserved */
-+
-+/* TSC Register */
-+#define APALIS_TK1_K20_TSCREG 0x80 /* TSC control & status register RW */
-+#define APALIS_TK1_K20_TSC_XML 0x81 /* TSC X- data LSB RO */
-+#define APALIS_TK1_K20_TSC_XMH 0x82 /* TSC X- data MSB RO */
-+#define APALIS_TK1_K20_TSC_XPL 0x83 /* TSC X+ data LSB RO */
-+#define APALIS_TK1_K20_TSC_XPH 0x84 /* TSC X+ data MSB RO */
-+#define APALIS_TK1_K20_TSC_YML 0x85 /* TSC Y- data LSB RO */
-+#define APALIS_TK1_K20_TSC_YMH 0x86 /* TSC Y- data MSB RO */
-+#define APALIS_TK1_K20_TSC_YPL 0x87 /* TSC Y+ data LSB RO */
-+#define APALIS_TK1_K20_TSC_YPH 0x88 /* TSC Y+ data MSB RO */
-+/* Bulk read of LSB register can be use to read entire 16-bit in one command */
-+#define APALIS_TK1_K20_TSC_ENA BIT(0)
-+#define APALIS_TK1_K20_TSC_ENA_MASK BIT(0)
-+
-+/* 0x89-0x8F Reserved */
-+
-+/* GPIO Registers */
-+#define APALIS_TK1_K20_GPIOREG 0x90 /* GPIO control & status register RW */
-+#define APALIS_TK1_K20_GPIO_NO 0x91 /* currently configured GPIO RW */
-+#define APALIS_TK1_K20_GPIO_STA 0x92 /* Status register for the APALIS_TK1_K20_GPIO_NO GPIO RW */
-+/* MSB | 0 ... 0 | VALUE | Output-1 / Input-0 | LSB */
-+#define APALIS_TK1_K20_GPIO_STA_OE BIT(0)
-+#define APALIS_TK1_K20_GPIO_STA_VAL BIT(1)
-+
-+/* 0x93-0xFC Reserved */
-+#define APALIS_TK1_K20_LAST_REG 0xFD
-+#define APALIS_TK1_K20_RET_REQ 0xFE
-+/* 0xFF Reserved */
-+
-+/* Interrupt flags */
-+#define APALIS_TK1_K20_GEN_IRQ 0
-+#define APALIS_TK1_K20_CAN0_IRQ 1
-+#define APALIS_TK1_K20_CAN1_IRQ 2
-+#define APALIS_TK1_K20_ADC_IRQ 3
-+#define APALIS_TK1_K20_TSC_IRQ 4
-+#define APALIS_TK1_K20_GPIO_IRQ 5
-+
-+#define APALIS_TK1_K20_FW_VER 0x10
-+
-+#define FW_MINOR (APALIS_TK1_K20_FW_VER & 0x0F)
-+#define FW_MAJOR ((APALIS_TK1_K20_FW_VER & 0xF0) >> 4)
-+
-+#define TK1_K20_SENTINEL 0x55
-+#define TK1_K20_INVAL 0xAA
-+
-+#define APALIS_TK1_K20_NUMREGS 0x3f
-+#define APALIS_TK1_K20_IRQ_REG_CNT 1
-+#define APALIS_TK1_K20_IRQ_PER_REG 8
-+
-+#define APALIS_TK1_CAN_CLK_UNIT 6250
-+
-+#define APALIS_TK1_MAX_CAN_DMA_XREF 19u
-+
-+#endif /* ifndef __LINUX_MFD_APALIS_TK1_K20_API_H */
-diff --git a/include/linux/mfd/apalis-tk1-k20.h b/include/linux/mfd/apalis-tk1-k20.h
-new file mode 100644
-index 000000000000..6d9e42b6002e
---- /dev/null
-+++ b/include/linux/mfd/apalis-tk1-k20.h
-@@ -0,0 +1,114 @@
-+/*
-+ * Copyright 2016-2017 Toradex AG
-+ * Dominik Sliwa <dominik.sliwa@toradex.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it under
-+ * the terms of the GNU General Public License version 2 as published by the
-+ * Free Software Foundation.
-+ */
-+
-+#ifndef __LINUX_MFD_APALIS_TK1_K20_H
-+#define __LINUX_MFD_APALIS_TK1_K20_H
-+
-+#include <linux/interrupt.h>
-+#include <linux/mutex.h>
-+#include <linux/regmap.h>
-+#include <linux/mfd/apalis-tk1-k20-api.h>
-+
-+#define APALIS_TK1_MAX_RETRY_CNT 4
-+
-+#define APALIS_TK1_K20_MAX_SPI_SPEED 6120000
-+
-+struct apalis_tk1_k20_regmap {
-+ struct regmap *regmap;
-+
-+ struct device *dev;
-+
-+ struct regmap_irq irqs[APALIS_TK1_K20_IRQ_REG_CNT * APALIS_TK1_K20_IRQ_PER_REG];
-+ struct regmap_irq_chip irq_chip;
-+ struct regmap_irq_chip_data *irq_data;
-+ int can0_irq;
-+ int can1_irq;
-+
-+ struct mutex lock;
-+ int irq;
-+ int flags;
-+
-+ int ezpcs_gpio;
-+ int reset_gpio;
-+ int appcs_gpio;
-+ int int2_gpio;
-+};
-+
-+void apalis_tk1_k20_lock(struct apalis_tk1_k20_regmap *apalis_tk1_k20);
-+void apalis_tk1_k20_unlock(struct apalis_tk1_k20_regmap *apalis_tk1_k20);
-+
-+int apalis_tk1_k20_reg_read(struct apalis_tk1_k20_regmap *apalis_tk1_k20, unsigned int offset, u32 *val);
-+int apalis_tk1_k20_reg_write(struct apalis_tk1_k20_regmap *apalis_tk1_k20, unsigned int offset, u32 val);
-+int apalis_tk1_k20_reg_read_bulk(struct apalis_tk1_k20_regmap *apalis_tk1_k20, unsigned int offset,
-+ uint8_t *val, size_t size);
-+int apalis_tk1_k20_reg_write_bulk(struct apalis_tk1_k20_regmap *apalis_tk1_k20, unsigned int offset,
-+ uint8_t *val, size_t size);
-+int apalis_tk1_k20_reg_rmw(struct apalis_tk1_k20_regmap *apalis_tk1_k20, unsigned int offset,
-+ u32 mask, u32 val);
-+
-+int apalis_tk1_k20_irq_mask(struct apalis_tk1_k20_regmap *apalis_tk1_k20, int irq);
-+int apalis_tk1_k20_irq_unmask(struct apalis_tk1_k20_regmap *apalis_tk1_k20, int irq);
-+int apalis_tk1_k20_irq_request(struct apalis_tk1_k20_regmap *apalis_tk1_k20, int irq,
-+ irq_handler_t handler, const char *name, void *dev);
-+int apalis_tk1_k20_irq_free(struct apalis_tk1_k20_regmap *apalis_tk1_k20, int irq, void *dev);
-+
-+int apalis_tk1_k20_irq_status(struct apalis_tk1_k20_regmap *apalis_tk1_k20, int irq,
-+ int *enabled, int *pending);
-+
-+int apalis_tk1_k20_get_flags(struct apalis_tk1_k20_regmap *apalis_tk1_k20);
-+
-+struct apalis_tk1_k20_can_platform_data {
-+ uint8_t id;
-+ u16 status;
-+};
-+
-+struct apalis_tk1_k20_tsc_platform_data {
-+ u16 status;
-+};
-+
-+struct apalis_tk1_k20_adc_platform_data {
-+ u16 status;
-+};
-+
-+struct apalis_tk1_k20_gpio_platform_data {
-+ u16 status;
-+};
-+
-+#define APALIS_TK1_K20_USES_TSC BIT(0)
-+#define APALIS_TK1_K20_USES_ADC BIT(1)
-+#define APALIS_TK1_K20_USES_CAN BIT(2)
-+#define APALIS_TK1_K20_USES_GPIO BIT(3)
-+
-+struct apalis_tk1_k20_platform_data {
-+ unsigned int flags;
-+
-+ struct apalis_tk1_k20_tsc_platform_data touch;
-+ struct apalis_tk1_k20_adc_platform_data adc;
-+ struct apalis_tk1_k20_can_platform_data can0;
-+ struct apalis_tk1_k20_can_platform_data can1;
-+ struct apalis_tk1_k20_gpio_platform_data gpio;
-+
-+ int ezpcs_gpio;
-+ int reset_gpio;
-+ int appcs_gpio;
-+ int int2_gpio;
-+};
-+
-+#define APALIS_TK1_K20_ADC_CHANNELS 4
-+#define APALIS_TK1_K20_ADC_BITS 16
-+#define APALIS_TK1_K20_VADC_MILI 3300
-+
-+enum apalis_tk1_k20_adc_id {
-+ APALIS_TK1_K20_ADC1,
-+ APALIS_TK1_K20_ADC2,
-+ APALIS_TK1_K20_ADC3,
-+ APALIS_TK1_K20_ADC4
-+};
-+
-+#endif /* ifndef __LINUX_MFD_APALIS_TK1_K20_H */
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0013-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra30.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0013-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra30.patch
deleted file mode 100644
index 8a1dc12..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0013-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra30.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 6c165ae3ea4fc94f606abb16b00eab01245c1ee9 Mon Sep 17 00:00:00 2001
-Message-Id: <6c165ae3ea4fc94f606abb16b00eab01245c1ee9.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Dmitry Osipenko <digetx@gmail.com>
-Date: Tue, 19 Dec 2017 05:58:07 +0300
-Subject: [PATCH 13/33] usb: chipidea: tegra: Use aligned DMA on Tegra30
-
-USB Ethernet gadget now works on Tegra30.
-
-Acked-by: Thierry Reding <treding@nvidia.com>
-Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
-Signed-off-by: Peter Chen <peter.chen@nxp.com>
----
- drivers/usb/chipidea/ci_hdrc_tegra.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c
-index bfcee2702d50..85ae796b75b1 100644
---- a/drivers/usb/chipidea/ci_hdrc_tegra.c
-+++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
-@@ -32,7 +32,7 @@ static const struct tegra_udc_soc_info tegra20_udc_soc_info = {
- };
-
- static const struct tegra_udc_soc_info tegra30_udc_soc_info = {
-- .flags = 0,
-+ .flags = CI_HDRC_REQUIRES_ALIGNED_DMA,
- };
-
- static const struct tegra_udc_soc_info tegra114_udc_soc_info = {
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0014-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra114-124.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0014-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra114-124.patch
deleted file mode 100644
index c00c05d..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0014-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra114-124.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 7c6c2b214f72d0e250bb549c2e5e50a8e28b8075 Mon Sep 17 00:00:00 2001
-Message-Id: <7c6c2b214f72d0e250bb549c2e5e50a8e28b8075.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
-Date: Tue, 19 Dec 2017 05:58:07 +0300
-Subject: [PATCH 14/33] usb: chipidea: tegra: Use aligned DMA on Tegra114/124
-
-USB Ethernet gadget now works on Tegra114 and Tegra124.
-
-Similar to commit 061e20e9899e ("usb: chipidea: tegra: Use aligned DMA
-on Tegra30").
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- drivers/usb/chipidea/ci_hdrc_tegra.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c
-index 85ae796b75b1..1af8afd92873 100644
---- a/drivers/usb/chipidea/ci_hdrc_tegra.c
-+++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
-@@ -36,11 +36,11 @@ static const struct tegra_udc_soc_info tegra30_udc_soc_info = {
- };
-
- static const struct tegra_udc_soc_info tegra114_udc_soc_info = {
-- .flags = 0,
-+ .flags = CI_HDRC_REQUIRES_ALIGNED_DMA,
- };
-
- static const struct tegra_udc_soc_info tegra124_udc_soc_info = {
-- .flags = 0,
-+ .flags = CI_HDRC_REQUIRES_ALIGNED_DMA,
- };
-
- static const struct of_device_id tegra_udc_of_match[] = {
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch
deleted file mode 100644
index 582dce2..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From b74554415a51457783875820b41f3c37abb01cdc Mon Sep 17 00:00:00 2001
-Message-Id: <b74554415a51457783875820b41f3c37abb01cdc.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Thu, 19 Apr 2018 13:49:30 +0200
-Subject: [PATCH 16/33] Revert "mmc: core: simplify ida handling"
-
-This reverts commit 7413d1f509eb0ee605973c1a6da9911700c80012.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- drivers/mmc/core/host.c | 20 ++++++++++++++++----
- 1 file changed, 16 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
-index 3740fb0052a4..841b9ce01a8e 100644
---- a/drivers/mmc/core/host.c
-+++ b/drivers/mmc/core/host.c
-@@ -35,11 +35,14 @@
- #define cls_dev_to_mmc_host(d) container_of(d, struct mmc_host, class_dev)
-
- static DEFINE_IDA(mmc_host_ida);
-+static DEFINE_SPINLOCK(mmc_host_lock);
-
- static void mmc_host_classdev_release(struct device *dev)
- {
- struct mmc_host *host = cls_dev_to_mmc_host(dev);
-- ida_simple_remove(&mmc_host_ida, host->index);
-+ spin_lock(&mmc_host_lock);
-+ ida_remove(&mmc_host_ida, host->index);
-+ spin_unlock(&mmc_host_lock);
- kfree(host);
- }
-
-@@ -358,13 +361,22 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
- /* scanning will be enabled when we're ready */
- host->rescan_disable = 1;
-
-- err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL);
-- if (err < 0) {
-+again:
-+ if (!ida_pre_get(&mmc_host_ida, GFP_KERNEL)) {
- kfree(host);
- return NULL;
- }
-
-- host->index = err;
-+ spin_lock(&mmc_host_lock);
-+ err = ida_get_new(&mmc_host_ida, &host->index);
-+ spin_unlock(&mmc_host_lock);
-+
-+ if (err == -EAGAIN) {
-+ goto again;
-+ } else if (err) {
-+ kfree(host);
-+ return NULL;
-+ }
-
- dev_set_name(&host->class_dev, "mmc%d", host->index);
-
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0017-mmc-read-mmc-alias-from-device-tree.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0017-mmc-read-mmc-alias-from-device-tree.patch
deleted file mode 100644
index 57fbe91..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0017-mmc-read-mmc-alias-from-device-tree.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 4db90f3efa119cfcfc55df16b1ee1f4d5d0a7528 Mon Sep 17 00:00:00 2001
-Message-Id: <4db90f3efa119cfcfc55df16b1ee1f4d5d0a7528.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Stefan Agner <stefan@agner.ch>
-Date: Fri, 29 Apr 2016 10:32:17 -0700
-Subject: [PATCH 17/33] mmc: read mmc alias from device tree
-
-To get the SD/MMC host device ID, read the alias from the device
-tree.
-
-This is useful in case a SoC has multipe SD/MMC host controllers while
-the second controller should logically be the first device (e.g. if
-the second controller is connected to an internal eMMC). Combined
-with block device numbering using MMC/SD host device ID, this
-results in predictable name assignment of the internal eMMC block
-device.
-
-Signed-off-by: Stefan Agner <stefan@agner.ch>
-Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
-[dianders: rebase + roll in http://crosreview.com/259916]
-Signed-off-by: Douglas Anderson <dianders@chromium.org>
----
- drivers/mmc/core/host.c | 17 ++++++++++++++++-
- 1 file changed, 16 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
-index 841b9ce01a8e..e4fdd5c0ec0b 100644
---- a/drivers/mmc/core/host.c
-+++ b/drivers/mmc/core/host.c
-@@ -353,11 +353,26 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
- {
- int err;
- struct mmc_host *host;
-+ int id;
-
- host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
- if (!host)
- return NULL;
-
-+ /* If OF aliases exist, start dynamic assignment after highest */
-+ id = of_alias_get_highest_id("mmc");
-+ id = (id < 0) ? 0 : id + 1;
-+
-+ /* If this devices has OF node, maybe it has an alias */
-+ if (dev->of_node) {
-+ int of_id = of_alias_get_id(dev->of_node, "mmc");
-+
-+ if (of_id < 0)
-+ dev_warn(dev, "/aliases ID not available\n");
-+ else
-+ id = of_id;
-+ }
-+
- /* scanning will be enabled when we're ready */
- host->rescan_disable = 1;
-
-@@ -368,7 +383,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
- }
-
- spin_lock(&mmc_host_lock);
-- err = ida_get_new(&mmc_host_ida, &host->index);
-+ err = ida_get_new_above(&mmc_host_ida, id, &host->index);
- spin_unlock(&mmc_host_lock);
-
- if (err == -EAGAIN) {
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0018-apalis-t30-mainline-force-fixed-ids-for-sdmmc-contro.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0018-apalis-t30-mainline-force-fixed-ids-for-sdmmc-contro.patch
deleted file mode 100644
index 4a2955a..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0018-apalis-t30-mainline-force-fixed-ids-for-sdmmc-contro.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From fc10da7a4d39c99adef1cfe3bd79505da47aeb6f Mon Sep 17 00:00:00 2001
-Message-Id: <fc10da7a4d39c99adef1cfe3bd79505da47aeb6f.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Thu, 19 Apr 2018 14:01:58 +0200
-Subject: [PATCH 18/33] apalis-t30-mainline: force fixed ids for sdmmc
- controllers
-
-The following, together with the previous 3 kernel patches, forces a
-fixed assignment between device id and sdmmc controller.
-
-I.e. the eMMC on SDMMC4 will be /dev/mmcblk0.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra30-apalis-eval.dts | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/arch/arm/boot/dts/tegra30-apalis-eval.dts b/arch/arm/boot/dts/tegra30-apalis-eval.dts
-index 07b945b0391a..785217d9f70b 100644
---- a/arch/arm/boot/dts/tegra30-apalis-eval.dts
-+++ b/arch/arm/boot/dts/tegra30-apalis-eval.dts
-@@ -8,6 +8,18 @@
- model = "Toradex Apalis T30 on Apalis Evaluation Board";
- compatible = "toradex,apalis_t30-eval", "toradex,apalis_t30", "nvidia,tegra30";
-
-+ aliases {
-+ /*
-+ * The following, together with kernel patches, forces a fixed
-+ * assignment between device id and SDMMC controllers.
-+ *
-+ * I.e. the eMMC on SDMMC4 will be /dev/mmcblk0.
-+ */
-+ mmc0 = "/sdhci@78000600"; /* eMMC */
-+ mmc1 = &mmc1; /* MMC1 8-bit slot */
-+ mmc2 = &sd1; /* SD1 4-bit slot */
-+ };
-+
- aliases {
- rtc0 = "/i2c@7000c000/rtc@68";
- rtc1 = "/i2c@7000d000/tps65911@2d";
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0019-ARM-tegra-apalis-tk1-Fix-high-speed-UART-compatible.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0019-ARM-tegra-apalis-tk1-Fix-high-speed-UART-compatible.patch
deleted file mode 100644
index 7f74461..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0019-ARM-tegra-apalis-tk1-Fix-high-speed-UART-compatible.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From dcb6b8c0c1175002f3d368ad0bac2122bfa038a0 Mon Sep 17 00:00:00 2001
-Message-Id: <dcb6b8c0c1175002f3d368ad0bac2122bfa038a0.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Thu, 3 May 2018 09:46:46 +0200
-Subject: [PATCH 19/33] ARM: tegra: apalis-tk1: Fix high speed UART compatible
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Turns out the compatible "nvidia,tegra124-hsuart" does not (yet) exist
-and everybody else also uses it only in conjunction with
-"nvidia,tegra30-hsuart".
-
-Reported-by: Martin Šafařík <msafarik@retia.cz>
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Signed-off-by: Thierry Reding <treding@nvidia.com>
-(cherry picked from commit b036a75aaea4659ac8b0d7e39ad15d2b54894704)
----
- arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi | 6 +++---
- arch/arm/boot/dts/tegra124-apalis.dtsi | 6 +++---
- 2 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-index 93cf49c10954..0620dcbe5817 100644
---- a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-@@ -1536,15 +1536,15 @@
- };
-
- serial@70006040 {
-- compatible = "nvidia,tegra124-hsuart";
-+ compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart";
- };
-
- serial@70006200 {
-- compatible = "nvidia,tegra124-hsuart";
-+ compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart";
- };
-
- serial@70006300 {
-- compatible = "nvidia,tegra124-hsuart";
-+ compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart";
- };
-
- hdmi_ddc: i2c@7000c700 {
-diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi b/arch/arm/boot/dts/tegra124-apalis.dtsi
-index 5d9b18ef5af6..8f80a8cf6a05 100644
---- a/arch/arm/boot/dts/tegra124-apalis.dtsi
-+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
-@@ -1567,15 +1567,15 @@
- };
-
- serial@70006040 {
-- compatible = "nvidia,tegra124-hsuart";
-+ compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart";
- };
-
- serial@70006200 {
-- compatible = "nvidia,tegra124-hsuart";
-+ compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart";
- };
-
- serial@70006300 {
-- compatible = "nvidia,tegra124-hsuart";
-+ compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart";
- };
-
- hdmi_ddc: i2c@7000c400 {
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0020-apalis-t30-tk1-mainline-igb-avoid-nvm-checksum-failu.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0020-apalis-t30-tk1-mainline-igb-avoid-nvm-checksum-failu.patch
deleted file mode 100644
index e29e0ac..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0020-apalis-t30-tk1-mainline-igb-avoid-nvm-checksum-failu.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 860eb2cc7b67c4173186c677259ac3c95ed80cab Mon Sep 17 00:00:00 2001
-Message-Id: <860eb2cc7b67c4173186c677259ac3c95ed80cab.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Tue, 12 Jun 2018 09:47:30 +0200
-Subject: [PATCH 20/33] apalis-t30/tk1-mainline: igb: avoid nvm checksum
- failure
-
-This avoids the following error in case the iNVM of the i210/i211 is not
-yet programmed (e.g. due to using one of them early Apalis T30 samples
-or a factory pristine module as in the FCT case):
-
-The NVM Checksum Is Not Valid
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
-index e9d6a8742826..66f78b27ed53 100644
---- a/drivers/net/ethernet/intel/igb/igb_main.c
-+++ b/drivers/net/ethernet/intel/igb/igb_main.c
-@@ -2533,7 +2533,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
- case e1000_i210:
- case e1000_i211:
- if (igb_get_flash_presence_i210(hw)) {
-- if (hw->nvm.ops.validate(hw) < 0) {
-+ if ((hw->nvm.ops.validate(hw) < 0) && !g_usr_mac) {
- dev_err(&pdev->dev,
- "The NVM Checksum Is Not Valid\n");
- err = -EIO;
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0021-apalis_t30-fix-can2.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0021-apalis_t30-fix-can2.patch
deleted file mode 100644
index d394d57..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0021-apalis_t30-fix-can2.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 7b35e59d9c78029407b9dbc9ac726fdbacdb507a Mon Sep 17 00:00:00 2001
-Message-Id: <7b35e59d9c78029407b9dbc9ac726fdbacdb507a.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Tue, 12 Jun 2018 14:39:50 +0200
-Subject: [PATCH 21/33] apalis_t30: fix can2
-
-CAN2 currently fails on probe as follows:
-
-mcp251x spi1.1: Probe failed, err=19
-
-Fix this by enabling input on pin mux of resp. SPI4 pins.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra30-apalis.dtsi | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi
-index faa8cd2914e8..4b022b50782b 100644
---- a/arch/arm/boot/dts/tegra30-apalis.dtsi
-+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
-@@ -118,6 +118,7 @@
- nvidia,function = "spi4";
- nvidia,pull = <TEGRA_PIN_PULL_NONE>;
- nvidia,tristate = <TEGRA_PIN_DISABLE>;
-+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
- };
- /* CAN_INT2 */
- spi2_cs2_n_pw3 {
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0022-mfd-as3722-disable-auto-power-on-when-AC-OK.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0022-mfd-as3722-disable-auto-power-on-when-AC-OK.patch
deleted file mode 100644
index fd4608c..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0022-mfd-as3722-disable-auto-power-on-when-AC-OK.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From 039b32b6cc7132a1613466c29a7f6dcdaa2ba22b Mon Sep 17 00:00:00 2001
-Message-Id: <039b32b6cc7132a1613466c29a7f6dcdaa2ba22b.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Thu, 14 Jun 2018 05:40:06 +0200
-Subject: [PATCH 22/33] mfd: as3722: disable auto power on when AC OK
-
-On ams AS3722, power on when AC OK is enabled by default.
-Making this option as disable by default and enable only
-when platform need this explicitly.
-
-Change-Id: I103d62ab9170c96b00ce8b58235afb8d24ba5e63
-Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
-Reviewed-on: http://git-master/r/349290
-Reviewed-by: Bibek Basu <bbasu@nvidia.com>
-Tested-by: Bibek Basu <bbasu@nvidia.com>
-
-Downsteam commit 09cd706fecb9 ("mfd: as3722: disable auto power on when
-AC OK").
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- drivers/mfd/as3722.c | 12 ++++++++++++
- include/linux/mfd/as3722.h | 3 +++
- 2 files changed, 15 insertions(+)
-
-diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c
-index f87342c211bc..215465c97759 100644
---- a/drivers/mfd/as3722.c
-+++ b/drivers/mfd/as3722.c
-@@ -349,6 +349,8 @@ static int as3722_i2c_of_probe(struct i2c_client *i2c,
- "ams,enable-internal-int-pullup");
- as3722->en_intern_i2c_pullup = of_property_read_bool(np,
- "ams,enable-internal-i2c-pullup");
-+ as3722->en_ac_ok_pwr_on = of_property_read_bool(np,
-+ "ams,enable-ac-ok-power-on");
- as3722->irq_flags = irqd_get_trigger_type(irq_data);
- dev_dbg(&i2c->dev, "IRQ flags are 0x%08lx\n", as3722->irq_flags);
- return 0;
-@@ -360,6 +362,7 @@ static int as3722_i2c_probe(struct i2c_client *i2c,
- struct as3722 *as3722;
- unsigned long irq_flags;
- int ret;
-+ u8 val = 0;
-
- as3722 = devm_kzalloc(&i2c->dev, sizeof(struct as3722), GFP_KERNEL);
- if (!as3722)
-@@ -398,6 +401,15 @@ static int as3722_i2c_probe(struct i2c_client *i2c,
- if (ret < 0)
- return ret;
-
-+ if (as3722->en_ac_ok_pwr_on)
-+ val = AS3722_CTRL_SEQ1_AC_OK_PWR_ON;
-+ ret = as3722_update_bits(as3722, AS3722_CTRL_SEQU1_REG,
-+ AS3722_CTRL_SEQ1_AC_OK_PWR_ON, val);
-+ if (ret < 0) {
-+ dev_err(as3722->dev, "CTRL_SEQ1 update failed: %d\n", ret);
-+ return ret;
-+ }
-+
- ret = devm_mfd_add_devices(&i2c->dev, -1, as3722_devs,
- ARRAY_SIZE(as3722_devs), NULL, 0,
- regmap_irq_get_domain(as3722->irq_data));
-diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h
-index 51e6f9414575..8841b9896033 100644
---- a/include/linux/mfd/as3722.h
-+++ b/include/linux/mfd/as3722.h
-@@ -296,6 +296,8 @@
- #define AS3722_ADC1_CONV_NOTREADY BIT(7)
- #define AS3722_ADC1_SOURCE_SELECT_MASK 0x1F
-
-+#define AS3722_CTRL_SEQ1_AC_OK_PWR_ON BIT(0)
-+
- /* GPIO modes */
- #define AS3722_GPIO_MODE_MASK 0x07
- #define AS3722_GPIO_MODE_INPUT 0x00
-@@ -391,6 +393,7 @@ struct as3722 {
- unsigned long irq_flags;
- bool en_intern_int_pullup;
- bool en_intern_i2c_pullup;
-+ bool en_ac_ok_pwr_on;
- struct regmap_irq_chip_data *irq_data;
- };
-
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0023-apalis-tk1-mfd-k20-update-api-header-for-fw-version-.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0023-apalis-tk1-mfd-k20-update-api-header-for-fw-version-.patch
deleted file mode 100644
index 940476a..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0023-apalis-tk1-mfd-k20-update-api-header-for-fw-version-.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From dbef03b4e18e548eeeaf62133af3591e4cc1ce95 Mon Sep 17 00:00:00 2001
-Message-Id: <dbef03b4e18e548eeeaf62133af3591e4cc1ce95.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Fri, 22 Jun 2018 10:23:41 +0200
-Subject: [PATCH 23/33] apalis-tk1: mfd: k20: update api header for fw version
- 1.1 support
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- include/linux/mfd/apalis-tk1-k20-api.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/include/linux/mfd/apalis-tk1-k20-api.h b/include/linux/mfd/apalis-tk1-k20-api.h
-index 85bbf9f28ca4..199b433c3d96 100644
---- a/include/linux/mfd/apalis-tk1-k20-api.h
-+++ b/include/linux/mfd/apalis-tk1-k20-api.h
-@@ -48,7 +48,7 @@
- #define APALIS_TK1_K20_CAN_DEV_OFFSET(x) (x ? APALIS_TK1_K20_CAN_OFFSET : 0)
-
- /* 0x30-0x3F Reserved */
--/* 0x40-0x62 CAN1 registers same layout as CAN0*/
-+/* 0x40-0x62 CAN1 registers same layout as CAN0 */
- /* 0x63-0x6F Reserved */
-
- /* ADC Registers */
-@@ -104,7 +104,8 @@
- #define APALIS_TK1_K20_TSC_IRQ 4
- #define APALIS_TK1_K20_GPIO_IRQ 5
-
--#define APALIS_TK1_K20_FW_VER 0x10
-+#define APALIS_TK1_K20_FW_VER 0x11
-+#define APALIS_TK1_K20_TESTER_FW_VER 0xFE
-
- #define FW_MINOR (APALIS_TK1_K20_FW_VER & 0x0F)
- #define FW_MAJOR ((APALIS_TK1_K20_FW_VER & 0xF0) >> 4)
-@@ -112,7 +113,6 @@
- #define TK1_K20_SENTINEL 0x55
- #define TK1_K20_INVAL 0xAA
-
--#define APALIS_TK1_K20_NUMREGS 0x3f
- #define APALIS_TK1_K20_IRQ_REG_CNT 1
- #define APALIS_TK1_K20_IRQ_PER_REG 8
-
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0024-apalis_t30-enable-broken-hpi-on-emmc.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0024-apalis_t30-enable-broken-hpi-on-emmc.patch
deleted file mode 100644
index b9ef12e..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0024-apalis_t30-enable-broken-hpi-on-emmc.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From cd57d1b777e57b6b8087d119bbccdcf23353d55a Mon Sep 17 00:00:00 2001
-Message-Id: <cd57d1b777e57b6b8087d119bbccdcf23353d55a.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Wed, 11 Jul 2018 10:08:41 +0200
-Subject: [PATCH 24/33] apalis_t30: enable broken-hpi on emmc
-
-Avoid eMMC issues by specifying broken-hpi.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra30-apalis.dtsi | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi
-index 4b022b50782b..82eb7538b8c1 100644
---- a/arch/arm/boot/dts/tegra30-apalis.dtsi
-+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
-@@ -698,8 +698,16 @@
- /* eMMC */
- sdhci@78000600 {
- status = "okay";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
- bus-width = <8>;
- non-removable;
-+
-+ emmc: emmc@0 {
-+ reg = <0>;
-+ compatible = "mmc-card";
-+ broken-hpi;
-+ };
- };
-
- clocks {
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0026-apalis_t30-fix-mmc1-cmd-pull-up.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0026-apalis_t30-fix-mmc1-cmd-pull-up.patch
deleted file mode 100644
index 37c1895..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0026-apalis_t30-fix-mmc1-cmd-pull-up.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 6942904ff6f6c2ecb4fa26f9e1fc1b28ceb851d9 Mon Sep 17 00:00:00 2001
-Message-Id: <6942904ff6f6c2ecb4fa26f9e1fc1b28ceb851d9.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Wed, 11 Jul 2018 10:31:07 +0200
-Subject: [PATCH 26/33] apalis_t30: fix mmc1 cmd pull-up
-
-Fix MMC1 cmd pin pull-up causing issues on carrier boards without
-external pull-up.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra30-apalis.dtsi | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi
-index 82eb7538b8c1..f97b705abd0d 100644
---- a/arch/arm/boot/dts/tegra30-apalis.dtsi
-+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
-@@ -167,14 +167,14 @@
-
- /* Apalis MMC1 */
- sdmmc3_clk_pa6 {
-- nvidia,pins = "sdmmc3_clk_pa6",
-- "sdmmc3_cmd_pa7";
-+ nvidia,pins = "sdmmc3_clk_pa6";
- nvidia,function = "sdmmc3";
- nvidia,pull = <TEGRA_PIN_PULL_NONE>;
- nvidia,tristate = <TEGRA_PIN_DISABLE>;
- };
- sdmmc3_dat0_pb7 {
-- nvidia,pins = "sdmmc3_dat0_pb7",
-+ nvidia,pins = "sdmmc3_cmd_pa7",
-+ "sdmmc3_dat0_pb7",
- "sdmmc3_dat1_pb6",
- "sdmmc3_dat2_pb5",
- "sdmmc3_dat3_pb4",
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0027-apalis_t30-pull-up-sd-card-detect-pins.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0027-apalis_t30-pull-up-sd-card-detect-pins.patch
deleted file mode 100644
index c97d49f..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0027-apalis_t30-pull-up-sd-card-detect-pins.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From a9ff91c77ce8693f394a48d16869cb443a0f4169 Mon Sep 17 00:00:00 2001
-Message-Id: <a9ff91c77ce8693f394a48d16869cb443a0f4169.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Wed, 11 Jul 2018 10:32:47 +0200
-Subject: [PATCH 27/33] apalis_t30: pull-up sd card detect pins
-
-In order to avoid any floating SD card detect pins as may e.g. happen on
-Ixora V1.1A pull them all up.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra30-apalis.dtsi | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi
-index f97b705abd0d..785d9b109d8e 100644
---- a/arch/arm/boot/dts/tegra30-apalis.dtsi
-+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
-@@ -190,7 +190,7 @@
- pv3 {
- nvidia,pins = "pv3";
- nvidia,function = "rsvd2";
-- nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
- nvidia,tristate = <TEGRA_PIN_DISABLE>;
- nvidia,enable-input = <TEGRA_PIN_ENABLE>;
- };
-@@ -256,7 +256,7 @@
- clk2_req_pcc5 {
- nvidia,pins = "clk2_req_pcc5";
- nvidia,function = "rsvd2";
-- nvidia,pull = <TEGRA_PIN_PULL_NONE>;
-+ nvidia,pull = <TEGRA_PIN_PULL_UP>;
- nvidia,tristate = <TEGRA_PIN_DISABLE>;
- nvidia,enable-input = <TEGRA_PIN_ENABLE>;
- };
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0028-Revert-mmc-tegra-Disable-UHS-I-modes-for-Tegra124.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0028-Revert-mmc-tegra-Disable-UHS-I-modes-for-Tegra124.patch
deleted file mode 100644
index e47fb22..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0028-Revert-mmc-tegra-Disable-UHS-I-modes-for-Tegra124.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 65cea0704a8a7665fcf31fe9388b4050f7656813 Mon Sep 17 00:00:00 2001
-Message-Id: <65cea0704a8a7665fcf31fe9388b4050f7656813.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Wed, 11 Jul 2018 10:37:25 +0200
-Subject: [PATCH 28/33] Revert "mmc: tegra: Disable UHS-I modes for Tegra124"
-
-This reverts commit 70ad7f7e40af31e7ab4a1719602542856b7ea856.
----
- drivers/mmc/host/sdhci-tegra.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
-index 327883d86b33..c83115860cf4 100644
---- a/drivers/mmc/host/sdhci-tegra.c
-+++ b/drivers/mmc/host/sdhci-tegra.c
-@@ -409,6 +409,10 @@ static const struct sdhci_pltfm_data sdhci_tegra124_pdata = {
-
- static const struct sdhci_tegra_soc_data soc_data_tegra124 = {
- .pdata = &sdhci_tegra124_pdata,
-+ .nvquirks = NVQUIRK_ENABLE_SDR50 |
-+ NVQUIRK_ENABLE_DDR50 |
-+ NVQUIRK_ENABLE_SDR104 |
-+ NVQUIRK_HAS_PADCALIB,
- };
-
- static const struct sdhci_pltfm_data sdhci_tegra210_pdata = {
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0029-mmc-tegra-fix-eMMC-DDR-mode.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0029-mmc-tegra-fix-eMMC-DDR-mode.patch
deleted file mode 100644
index fadb534..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0029-mmc-tegra-fix-eMMC-DDR-mode.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 7641e3bc8feb2ebeb36ccf0877a70f1985e54dd8 Mon Sep 17 00:00:00 2001
-Message-Id: <7641e3bc8feb2ebeb36ccf0877a70f1985e54dd8.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Stefan Agner <stefan@agner.ch>
-Date: Tue, 10 Jul 2018 16:04:20 +0200
-Subject: [PATCH 29/33] mmc: tegra: fix eMMC DDR mode
-
-Make sure the clock is also doubled when using eMMC DDR modes.
-
-Signed-off-by: Stefan Agner <stefan@agner.ch>
-Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- drivers/mmc/host/sdhci-tegra.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
-index c83115860cf4..3b6d504bef45 100644
---- a/drivers/mmc/host/sdhci-tegra.c
-+++ b/drivers/mmc/host/sdhci-tegra.c
-@@ -239,7 +239,8 @@ static void tegra_sdhci_set_uhs_signaling(struct sdhci_host *host,
- struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
-
-- if (timing == MMC_TIMING_UHS_DDR50)
-+ if (timing == MMC_TIMING_UHS_DDR50 ||
-+ timing == MMC_TIMING_MMC_DDR52)
- tegra_host->ddr_signaling = true;
-
- return sdhci_set_uhs_signaling(host, timing);
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0030-apalis-tk1-enable-ddr52-mode-on-emmc.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0030-apalis-tk1-enable-ddr52-mode-on-emmc.patch
deleted file mode 100644
index 4111cb5..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0030-apalis-tk1-enable-ddr52-mode-on-emmc.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 41eac99552d6f0c1895e31b868d0a7cfa8334b4e Mon Sep 17 00:00:00 2001
-Message-Id: <41eac99552d6f0c1895e31b868d0a7cfa8334b4e.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Wed, 11 Jul 2018 10:38:06 +0200
-Subject: [PATCH 30/33] apalis-tk1: enable ddr52 mode on emmc
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi | 5 +++++
- arch/arm/boot/dts/tegra124-apalis.dtsi | 5 +++++
- 2 files changed, 10 insertions(+)
-
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-index 0620dcbe5817..08e4b08e26f8 100644
---- a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-@@ -1939,6 +1939,11 @@
- status = "okay";
- bus-width = <8>;
- non-removable;
-+ vmmc-supply = <&reg_3v3>; /* VCC */
-+ vqmmc-supply = <&vddio_1v8>; /* VCCQ */
-+ /* SDR104/DDR50/SDR50 bits in CAPA2 is not supported */
-+ sdhci-caps-mask = <0x7 0x0>;
-+ mmc-ddr-1_8v;
- };
-
- /* CPU DFLL clock */
-diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi b/arch/arm/boot/dts/tegra124-apalis.dtsi
-index 8f80a8cf6a05..a19844e61adc 100644
---- a/arch/arm/boot/dts/tegra124-apalis.dtsi
-+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
-@@ -1949,6 +1949,11 @@
- status = "okay";
- bus-width = <8>;
- non-removable;
-+ vmmc-supply = <&reg_3v3>; /* VCC */
-+ vqmmc-supply = <&vddio_1v8>; /* VCCQ */
-+ /* SDR104/DDR50/SDR50 bits in CAPA2 is not supported */
-+ sdhci-caps-mask = <0x7 0x0>;
-+ mmc-ddr-1_8v;
- };
-
- /* CPU DFLL clock */
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0031-apalis-tk1-force-fixed-ids-for-sdmmc-controllers.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0031-apalis-tk1-force-fixed-ids-for-sdmmc-controllers.patch
deleted file mode 100644
index 1a38fd1..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0031-apalis-tk1-force-fixed-ids-for-sdmmc-controllers.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From afd589352be71175ac13a3c7139eae7724a37460 Mon Sep 17 00:00:00 2001
-Message-Id: <afd589352be71175ac13a3c7139eae7724a37460.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Wed, 11 Jul 2018 10:58:19 +0200
-Subject: [PATCH 31/33] apalis-tk1: force fixed ids for sdmmc controllers
-
-The following, together with kernel patches, forces a fixed assignment
-between device id and sdmmc controller.
-
-I.e. the eMMC on SDMMC4 will be /dev/mmcblk0.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra124-apalis-eval.dts | 16 ++++++++++++++--
- arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts | 16 ++++++++++++++--
- 2 files changed, 28 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/boot/dts/tegra124-apalis-eval.dts b/arch/arm/boot/dts/tegra124-apalis-eval.dts
-index ecffcd115fa7..7e2b9cf84741 100644
---- a/arch/arm/boot/dts/tegra124-apalis-eval.dts
-+++ b/arch/arm/boot/dts/tegra124-apalis-eval.dts
-@@ -49,6 +49,18 @@
- compatible = "toradex,apalis-tk1-eval", "toradex,apalis-tk1",
- "nvidia,tegra124";
-
-+ aliases {
-+ /*
-+ * The following, together with kernel patches, forces a fixed
-+ * assignment between device id and SDMMC controllers.
-+ *
-+ * I.e. the eMMC on SDMMC4 will be /dev/mmcblk0.
-+ */
-+ mmc0 = "/sdhci@700b0600"; /* eMMC */
-+ mmc1 = &mmc1; /* MMC1 slot */
-+ mmc2 = &sd1; /* SD1 slot */
-+ };
-+
- aliases {
- rtc0 = "/i2c@7000c000/rtc@68";
- rtc1 = "/i2c@7000d000/pmic@40";
-@@ -176,7 +188,7 @@
- };
-
- /* Apalis MMC1 */
-- sdhci@700b0000 {
-+ mmc1: sdhci@700b0000 {
- status = "okay";
- /* MMC1_CD# */
- cd-gpios = <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_LOW>;
-@@ -185,7 +197,7 @@
- };
-
- /* Apalis SD1 */
-- sdhci@700b0400 {
-+ sd1: sdhci@700b0400 {
- status = "okay";
- /* SD1_CD# */
- cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts b/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
-index 8a8d5fa0ecd1..046a415d5db8 100644
---- a/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
-@@ -13,6 +13,18 @@
- compatible = "toradex,apalis-tk1-v1.2-eval", "toradex,apalis-tk1-eval",
- "toradex,apalis-tk1", "nvidia,tegra124";
-
-+ aliases {
-+ /*
-+ * The following, together with kernel patches, forces a fixed
-+ * assignment between device id and SDMMC controllers.
-+ *
-+ * I.e. the eMMC on SDMMC4 will be /dev/mmcblk0.
-+ */
-+ mmc0 = "/sdhci@700b0600"; /* eMMC */
-+ mmc1 = &mmc1; /* MMC1 slot */
-+ mmc2 = &sd1; /* SD1 slot */
-+ };
-+
- aliases {
- rtc0 = "/i2c@7000c000/rtc@68";
- rtc1 = "/i2c@7000d000/pmic@40";
-@@ -140,7 +152,7 @@
- };
-
- /* Apalis MMC1 */
-- sdhci@700b0000 {
-+ mmc1: sdhci@700b0000 {
- status = "okay";
- /* MMC1_CD# */
- cd-gpios = <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_LOW>;
-@@ -149,7 +161,7 @@
- };
-
- /* Apalis SD1 */
-- sdhci@700b0400 {
-+ sd1: sdhci@700b0400 {
- status = "okay";
- /* SD1_CD# */
- cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0032-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0032-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch
deleted file mode 100644
index e0f2483..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0032-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch
+++ /dev/null
@@ -1,329 +0,0 @@
-From 7e4a3d7ee5cf304ce0c5a5be6e1dcb7cafc34a1b Mon Sep 17 00:00:00 2001
-Message-Id: <7e4a3d7ee5cf304ce0c5a5be6e1dcb7cafc34a1b.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Wed, 11 Jul 2018 15:44:16 +0200
-Subject: [PATCH 32/33] apalis-tk1: fix pcie reset for reliable gigabit
- ethernet operation
-
-It turns out that the forward port of the current PCIe reset
-implementation was not quite working reliably due to differences in
-regulator naming. Another shortcoming was that it currently resets
-multiple times due to not differentiating which PCIe port needs
-resetting. Improve this by doing specific reset per port only.
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts | 10 --
- arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi | 20 ---
- arch/arm/boot/dts/tegra124-apalis.dtsi | 2 -
- drivers/pci/host/pci-tegra.c | 171 ++++++++++++++----------
- 4 files changed, 103 insertions(+), 100 deletions(-)
-
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts b/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
-index 046a415d5db8..4f2e4766379d 100644
---- a/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
-@@ -250,13 +250,3 @@
- vin-supply = <&reg_5v0>;
- };
- };
--
--&gpio {
-- /* Apalis GPIO7 MXM3 pin 15 PLX PEX 8605 PCIe Switch Reset */
-- pex_perst_n {
-- gpio-hog;
-- gpios = <TEGRA_GPIO(DD, 1) GPIO_ACTIVE_HIGH>;
-- output-high;
-- line-name = "PEX_PERST_N";
-- };
--};
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-index 08e4b08e26f8..1336e8caf95d 100644
---- a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-@@ -1721,14 +1721,12 @@
- regulator-name = "+V3.3_ETH(ldo9)";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
-- regulator-always-on;
- };
-
- ldo10 {
- regulator-name = "+V3.3_ETH(ldo10)";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
-- regulator-always-on;
- };
-
- ldo11 {
-@@ -2065,21 +2063,3 @@
- };
- };
- };
--
--&gpio {
-- /* I210 Gigabit Ethernet Controller Reset */
-- lan_reset_n {
-- gpio-hog;
-- gpios = <TEGRA_GPIO(S, 2) GPIO_ACTIVE_HIGH>;
-- output-high;
-- line-name = "LAN_RESET_N";
-- };
--
-- /* Control MXM3 pin 26 Reset Module Output Carrier Input */
-- reset_moci_ctrl {
-- gpio-hog;
-- gpios = <TEGRA_GPIO(U, 4) GPIO_ACTIVE_HIGH>;
-- output-high;
-- line-name = "RESET_MOCI_CTRL";
-- };
--};
-diff --git a/arch/arm/boot/dts/tegra124-apalis.dtsi b/arch/arm/boot/dts/tegra124-apalis.dtsi
-index a19844e61adc..00920c26f60a 100644
---- a/arch/arm/boot/dts/tegra124-apalis.dtsi
-+++ b/arch/arm/boot/dts/tegra124-apalis.dtsi
-@@ -1756,14 +1756,12 @@
- regulator-name = "+V3.3_ETH(ldo9)";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
-- regulator-always-on;
- };
-
- ldo10 {
- regulator-name = "+V3.3_ETH(ldo10)";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
-- regulator-always-on;
- };
-
- ldo11 {
-diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
-index 0c6237159243..0e19ff52275e 100644
---- a/drivers/pci/host/pci-tegra.c
-+++ b/drivers/pci/host/pci-tegra.c
-@@ -333,6 +333,9 @@ struct tegra_pcie {
- struct regulator_bulk_data *supplies;
- unsigned int num_supplies;
-
-+#ifdef CONFIG_MACH_APALIS_T30
-+ int pci_reset_status;
-+#endif
- #ifdef CONFIG_MACH_APALIS_TK1
- struct regulator *regulator_apalis_tk1_ldo9;
- struct regulator *regulator_apalis_tk1_ldo10;
-@@ -584,58 +587,82 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
- unsigned long value;
-
- #if defined(CONFIG_MACH_APALIS_T30) || defined(CONFIG_MACH_APALIS_TK1)
-+#ifdef CONFIG_MACH_APALIS_T30
- /*
-- * Reset PLX PEX 8605 PCIe Switch plus PCIe devices on Apalis Evaluation
-- * Board
-+ * Apalis PCIe aka port 1 and Apalis Type Specific 4 Lane PCIe aka port
-+ * 0 share the same RESET_MOCI therefore only assert it once for both
-+ * ports to avoid loosing the previously brought up port again.
- */
-- if (g_pex_perst)
-- gpio_request(PEX_PERST_N, "PEX_PERST_N");
-- gpio_request(RESET_MOCI_N, "RESET_MOCI_N");
-- if (g_pex_perst)
-- gpio_direction_output(PEX_PERST_N, 0);
-- gpio_direction_output(RESET_MOCI_N, 0);
--
-+ if ((port->index == 1) || (port->index == 0)) {
-+ /* only do it once per init cycle */
-+ if (port->pcie->pci_reset_status % 2 == 0) {
-+#endif
- #ifdef CONFIG_MACH_APALIS_TK1
-- /* Reset I210 Gigabit Ethernet Controller */
-- if (LAN_RESET_N) {
-- gpio_request(LAN_RESET_N, "LAN_RESET_N");
-- gpio_direction_output(LAN_RESET_N, 0);
-+ if (port->index == 0) { /* Apalis PCIe */
-+#endif
-+ /*
-+ * Reset PLX PEX 8605 PCIe Switch plus PCIe devices on Apalis Evaluation
-+ * Board
-+ */
-+ if (g_pex_perst)
-+ gpio_request(PEX_PERST_N, "PEX_PERST_N");
-+ gpio_request(RESET_MOCI_N, "RESET_MOCI_N");
-+ if (g_pex_perst)
-+ gpio_direction_output(PEX_PERST_N, 0);
-+ gpio_direction_output(RESET_MOCI_N, 0);
-+#ifdef CONFIG_MACH_APALIS_T30
-+ }
-+#endif
- }
-+#ifdef CONFIG_MACH_APALIS_TK1
-+ if (port->index == 1) { /* I210 Gigabit Ethernet Controller (On-module) */
-+ /* Reset I210 Gigabit Ethernet Controller */
-+ if (LAN_RESET_N >= 0) {
-+ gpio_request(LAN_RESET_N, "LAN_RESET_N");
-+ gpio_direction_output(LAN_RESET_N, 0);
-+ }
-
-- /*
-- * Make sure we don't get any back feeding from LAN_WAKE_N resp.
-- * DEV_OFF_N
-- */
-- gpio_request(LAN_WAKE_N, "LAN_WAKE_N");
-- gpio_request(LAN_DEV_OFF_N, "LAN_DEV_OFF_N");
-- gpio_direction_output(LAN_WAKE_N, 0);
-- gpio_direction_output(LAN_DEV_OFF_N, 0);
--
-- /* Make sure LDO9 and LDO10 are initially disabled @ 0V */
-- if (regulator_is_enabled(port->pcie->regulator_apalis_tk1_ldo9))
-- regulator_disable(port->pcie->regulator_apalis_tk1_ldo9);
-- if (regulator_is_enabled(port->pcie->regulator_apalis_tk1_ldo10))
-- regulator_disable(port->pcie->regulator_apalis_tk1_ldo10);
-+ /*
-+ * Make sure we don't get any back feeding from LAN_WAKE_N resp.
-+ * DEV_OFF_N
-+ */
-+ gpio_request(LAN_WAKE_N, "LAN_WAKE_N");
-+ gpio_request(LAN_DEV_OFF_N, "LAN_DEV_OFF_N");
-+ gpio_direction_output(LAN_WAKE_N, 0);
-+ gpio_direction_output(LAN_DEV_OFF_N, 0);
-+
-+ /* Make sure LDO9 and LDO10 are initially disabled @ 0V */
-+ if (regulator_is_enabled(port->pcie->regulator_apalis_tk1_ldo9)) {
-+ value = regulator_enable(port->pcie->regulator_apalis_tk1_ldo9);
-+ if (regulator_disable(port->pcie->regulator_apalis_tk1_ldo9) < 0)
-+ pr_err("failed disabling +V3.3_ETH(ldo9)\n");
-+ }
-+ if (regulator_is_enabled(port->pcie->regulator_apalis_tk1_ldo10)) {
-+ value = regulator_enable(port->pcie->regulator_apalis_tk1_ldo10);
-+ if (regulator_disable(port->pcie->regulator_apalis_tk1_ldo10) <0)
-+ pr_err("failed disabling +V3.3_ETH(ldo10)\n");
-+ }
-
-- mdelay(100);
-+ mdelay(100);
-
-- /* Make sure LAN_WAKE_N gets re-configured as a GPIO input */
-- gpio_direction_input(LAN_WAKE_N);
-+ /* Make sure LAN_WAKE_N gets re-configured as a GPIO input */
-+ gpio_direction_input(LAN_WAKE_N);
-
-- /* Make sure controller gets enabled by disabling DEV_OFF_N */
-- gpio_set_value(LAN_DEV_OFF_N, 1);
-+ /* Make sure controller gets enabled by disabling DEV_OFF_N */
-+ gpio_set_value(LAN_DEV_OFF_N, 1);
-
-- /*
-- * Enable LDO9 and LDO10 for +V3.3_ETH on patched prototype
-- * V1.0A and sample V1.0B and newer modules
-- */
-- if (regulator_enable(port->pcie->regulator_apalis_tk1_ldo9) < 0) {
-- pr_err("pcie: couldn't enable regulator i210_vdd3p3_ldo9\n");
-- return;
-- }
-- if (regulator_enable(port->pcie->regulator_apalis_tk1_ldo10) < 0) {
-- pr_err("pcie: couldn't enable regulator i210_vdd3p3_ldo10\n");
-- return;
-+ /*
-+ * Enable LDO9 and LDO10 for +V3.3_ETH on patched prototype
-+ * V1.0A and sample V1.0B and newer modules
-+ */
-+ if (regulator_enable(port->pcie->regulator_apalis_tk1_ldo9) < 0) {
-+ pr_err("pcie: couldn't enable regulator +V3.3_ETH(ldo9)\n");
-+ return;
-+ }
-+ if (regulator_enable(port->pcie->regulator_apalis_tk1_ldo10) < 0) {
-+ pr_err("pcie: couldn't enable regulator +V3.3_ETH(ldo10)\n");
-+ return;
-+ }
- }
- #endif /* CONFIG_MACH_APALIS_TK1 */
- #endif /* CONFIG_MACH_APALIS_T30 || CONFIG_MACH_APALIS_TK1 */
-@@ -652,25 +679,38 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
- afi_writel(port->pcie, value, ctrl);
-
- #if defined(CONFIG_MACH_APALIS_T30) || defined(CONFIG_MACH_APALIS_TK1)
-+#ifdef CONFIG_MACH_APALIS_T30
-+ if ((port->index == 1) || (port->index == 0)) {
-+ /* only do it once per init cycle */
-+ if (port->pcie->pci_reset_status % 2 == 0) {
-+#endif
- #ifdef CONFIG_MACH_APALIS_TK1
-- gpio_set_value(LAN_RESET_N, 1);
--#endif /* CONFIG_MACH_APALIS_TK1 */
--
-- /* Must be asserted for 100 ms after power and clocks are stable */
-- if (g_pex_perst)
-- gpio_set_value(PEX_PERST_N, 1);
-- /*
-- * Err_5: PEX_REFCLK_OUTpx/nx Clock Outputs is not Guaranteed Until
-- * 900 us After PEX_PERST# De-assertion
-- */
-- if (g_pex_perst)
-- mdelay(1);
-- gpio_set_value(RESET_MOCI_N, 1);
-+ if (port->index == 0) { /* Apalis PCIe */
-+#endif
-+ /* Must be asserted for 100 ms after power and clocks are stable */
-+ if (g_pex_perst)
-+ gpio_set_value(PEX_PERST_N, 1);
-+ /*
-+ * Err_5: PEX_REFCLK_OUTpx/nx Clock Outputs is not Guaranteed Until
-+ * 900 us After PEX_PERST# De-assertion
-+ */
-+ if (g_pex_perst)
-+ mdelay(1);
-+ gpio_set_value(RESET_MOCI_N, 1);
-+#ifdef CONFIG_MACH_APALIS_T30
-+ }
-+ port->pcie->pci_reset_status++;
-+#endif
-+ }
-
- #ifdef CONFIG_MACH_APALIS_TK1
-- /* Release I210 Gigabit Ethernet Controller Reset */
-- if (LAN_RESET_N)
-- gpio_set_value(LAN_RESET_N, 1);
-+ mdelay(5);
-+
-+ if (port->index == 1) { /* I210 Gigabit Ethernet Controller (On-module) */
-+ /* Release I210 Gigabit Ethernet Controller Reset */
-+ if (LAN_RESET_N >= 0)
-+ gpio_set_value(LAN_RESET_N, 1);
-+ }
- #endif /* CONFIG_MACH_APALIS_TK1 */
- #endif /* CONFIG_MACH_APALIS_T30 || CONFIG_MACH_APALIS_TK1 */
- }
-@@ -1232,25 +1272,20 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie)
-
- #ifdef CONFIG_MACH_APALIS_TK1
- if (pcie->regulator_apalis_tk1_ldo9 == NULL) {
-- pcie->regulator_apalis_tk1_ldo9 = regulator_get(pcie->dev, "i210_vdd3p3_ldo9");
-+ pcie->regulator_apalis_tk1_ldo9 = regulator_get(pcie->dev, "+V3.3_ETH(ldo9)");
- if (IS_ERR(pcie->regulator_apalis_tk1_ldo9)) {
-- pr_err("pcie: couldn't get regulator i210_vdd3p3_ldo9\n");
-+ pr_err("pcie: couldn't get regulator +V3.3_ETH(ldo9)\n");
- pcie->regulator_apalis_tk1_ldo9 = 0;
- }
- }
-
- if (pcie->regulator_apalis_tk1_ldo10 == NULL) {
-- pcie->regulator_apalis_tk1_ldo10 = regulator_get(pcie->dev, "i210_vdd3p3_ldo10");
-+ pcie->regulator_apalis_tk1_ldo10 = regulator_get(pcie->dev, "+V3.3_ETH(ldo10)");
- if (IS_ERR(pcie->regulator_apalis_tk1_ldo10)) {
-- pr_err("pcie: couldn't get regulator i210_vdd3p3_ldo10\n");
-+ pr_err("pcie: couldn't get regulator +V3.3_ETH(ldo10)\n");
- pcie->regulator_apalis_tk1_ldo10 = 0;
- }
- }
--
-- if (pcie->regulator_apalis_tk1_ldo9)
-- err = regulator_enable(pcie->regulator_apalis_tk1_ldo9);
-- if (pcie->regulator_apalis_tk1_ldo10)
-- err = regulator_enable(pcie->regulator_apalis_tk1_ldo10);
- #endif /* CONFIG_MACH_APALIS_TK1 */
-
- reset_control_deassert(pcie->afi_rst);
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0033-apalis-tk1-mfd-k20-supporte-for-fw-version-1.3.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0033-apalis-tk1-mfd-k20-supporte-for-fw-version-1.3.patch
deleted file mode 100644
index f98a7bb..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0033-apalis-tk1-mfd-k20-supporte-for-fw-version-1.3.patch
+++ /dev/null
@@ -1,562 +0,0 @@
-From 0f4ef2cbf760bc5ec8a78918baaccd75f3bc7f44 Mon Sep 17 00:00:00 2001
-From: Dominik Sliwa <dominik.sliwa@toradex.com>
-Date: Tue, 11 Sep 2018 14:05:49 +0200
-Subject: [PATCH 33/33] apalis-tk1: mfd: k20: supporte for fw version 1.2
-
-apalis-tk1: mfd: k20: add fw_ignore and fw_reload parameters
-
-Parameter fw_ignore disables fw version check.
-Parameter fw_reload forces k20 firmware reflash via EzPort.
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-
-apalis-tk1: can: k20: change tx complete signaling
-
-In fw version 1.2 K20 CANINTF_TX now indicates TX in progress,
-not TX completed.
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-
-apalis-tk1: mfd: k20: update supported fw version to 1.2
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-
-apalis-tk1: mfd: k20: release fw after flashing
-
-Previously fw was not released when K20 was flashed successfully
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-
-apalis-tk1: mfd: k20: extra cycles for fifo cleanup
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-
-apalis-tk1: mfd: k20: update supported fw version to 1.3
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
----
- drivers/mfd/apalis-tk1-k20.c | 168 ++++++++++++++-----------
- drivers/net/can/apalis-tk1-k20-can.c | 99 +++++++++++----
- include/linux/mfd/apalis-tk1-k20-api.h | 2 +-
- 3 files changed, 171 insertions(+), 98 deletions(-)
-
-diff --git a/drivers/mfd/apalis-tk1-k20.c b/drivers/mfd/apalis-tk1-k20.c
-index 913be65c33e6..a6d1c1cdc0b6 100644
---- a/drivers/mfd/apalis-tk1-k20.c
-+++ b/drivers/mfd/apalis-tk1-k20.c
-@@ -2,7 +2,7 @@
- * Copyright 2016-2017 Toradex AG
- * Dominik Sliwa <dominik.sliwa@toradex.com>
- *
-- * based on an driver for MC13xxx by:
-+ * based on a driver for MC13xxx by:
- * Copyright 2009-2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- *
-@@ -29,6 +29,16 @@
- #include "apalis-tk1-k20-ezp.h"
- #define APALIS_TK1_K20_MAX_MSG 4
-
-+static unsigned int fw_ignore = 0;
-+module_param(fw_ignore , uint, 0);
-+MODULE_PARM_DESC(fw_ignore, "Assume that K20 is running valid fw version. "
-+ "Don't verify, don't erase, don't update");
-+
-+static unsigned int force_fw_reload = 0;
-+module_param(force_fw_reload , uint, 0);
-+MODULE_PARM_DESC(force_fw_reload, "Update K20 fw even when the same version"
-+ " is already flashed.");
-+
- static const struct spi_device_id apalis_tk1_k20_device_ids[] = {
- {
- .name = "apalis-tk1-k20",
-@@ -115,7 +125,7 @@ static int apalis_tk1_k20_spi_read(void *context, const void *reg,
- ret = -EIO;
-
- } else if ((val_size > 1) && (val_size < APALIS_TK1_K20_MAX_BULK)) {
-- t.len = 5;
-+ t.len = 12;
- w[0] = APALIS_TK1_K20_BULK_READ_INST;
- spi_message_init(&m);
- spi_message_add_tail(&t, &m);
-@@ -142,7 +152,6 @@ static int apalis_tk1_k20_spi_write(void *context, const void *data,
- uint8_t out_data[APALIS_TK1_K20_MAX_BULK];
- int ret;
-
--
- spi->mode = SPI_MODE_1;
-
- if (count == 2) {
-@@ -704,18 +713,21 @@ static int apalis_tk1_k20_probe_gpios_dt(
- apalis_tk1_k20->reset_gpio = of_get_named_gpio(np, "rst-gpio", 0);
- if (apalis_tk1_k20->reset_gpio < 0)
- return apalis_tk1_k20->reset_gpio;
-+
- gpio_request(apalis_tk1_k20->reset_gpio, "apalis-tk1-k20-reset");
- gpio_direction_output(apalis_tk1_k20->reset_gpio, 1);
-
- apalis_tk1_k20->ezpcs_gpio = of_get_named_gpio(np, "ezport-cs-gpio", 0);
- if (apalis_tk1_k20->ezpcs_gpio < 0)
- return apalis_tk1_k20->ezpcs_gpio;
-+
- gpio_request(apalis_tk1_k20->ezpcs_gpio, "apalis-tk1-k20-ezpcs");
- gpio_direction_output(apalis_tk1_k20->ezpcs_gpio, 1);
-
- apalis_tk1_k20->int2_gpio = of_get_named_gpio(np, "int2-gpio", 0);
- if (apalis_tk1_k20->int2_gpio < 0)
- return apalis_tk1_k20->int2_gpio;
-+
- gpio_request(apalis_tk1_k20->int2_gpio, "apalis-tk1-k20-int2");
- gpio_direction_output(apalis_tk1_k20->int2_gpio, 1);
-
-@@ -734,53 +746,28 @@ static inline int apalis_tk1_k20_probe_gpios_dt(
- }
- #endif
-
--int apalis_tk1_k20_dev_init(struct device *dev)
-+int apalis_tk1_k20_fw_update(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
-+ uint32_t revision)
- {
-- struct apalis_tk1_k20_platform_data *pdata = dev_get_platdata(dev);
-- struct apalis_tk1_k20_regmap *apalis_tk1_k20 = dev_get_drvdata(dev);
-- uint32_t revision = 0x00;
-- int ret, i;
- int erase_only = 0;
-
-- apalis_tk1_k20->dev = dev;
--
-- ret = apalis_tk1_k20_probe_gpios_dt(apalis_tk1_k20);
-- if ((ret < 0) && pdata) {
-- if (pdata) {
-- apalis_tk1_k20->ezpcs_gpio = pdata->ezpcs_gpio;
-- apalis_tk1_k20->reset_gpio = pdata->reset_gpio;
-- apalis_tk1_k20->int2_gpio = pdata->int2_gpio;
-- } else {
-- dev_err(dev, "Error claiming GPIOs\n");
-- ret = -EINVAL;
-- goto bad;
-- }
-- }
-- apalis_tk1_k20_reset_chip(apalis_tk1_k20);
-- msleep(10);
-- ret = apalis_tk1_k20_reg_read(apalis_tk1_k20, APALIS_TK1_K20_REVREG,
-- &revision);
--
--#ifdef CONFIG_APALIS_TK1_K20_EZP
-- if ((request_firmware(&fw_entry, "apalis-tk1-k20.bin", dev) < 0)
-+ if ((request_firmware(&fw_entry, "apalis-tk1-k20.bin",
-+ apalis_tk1_k20->dev)
-+ < 0)
- && (revision != APALIS_TK1_K20_FW_VER)) {
- dev_err(apalis_tk1_k20->dev,
-- "Unsupported firmware version %d.%d and no local" \
-+ "Unsupported firmware version %d.%d and no local"
- " firmware file available.\n",
-- (revision & 0xF0 >> 8),
-- (revision & 0x0F));
-- ret = -ENOTSUPP;
-- goto bad;
-+ (revision & 0xF0 >> 8), (revision & 0x0F));
-+ return -ENOTSUPP;
- }
-
- if ((fw_entry == NULL) && (revision != APALIS_TK1_K20_FW_VER)) {
- dev_err(apalis_tk1_k20->dev,
-- "Unsupported firmware version %d.%d and no local" \
-+ "Unsupported firmware version %d.%d and no local"
- " firmware file available.\n",
-- (revision & 0xF0 >> 8),
-- (revision & 0x0F));
-- ret = -ENOTSUPP;
-- goto bad;
-+ (revision & 0xF0 >> 8), (revision & 0x0F));
-+ return -ENOTSUPP;
- }
-
- if (fw_entry != NULL) {
-@@ -788,73 +775,106 @@ int apalis_tk1_k20_dev_init(struct device *dev)
- erase_only = 1;
- }
-
-- if ((apalis_tk1_k20_get_fw_revision() != APALIS_TK1_K20_FW_VER) &&
-- (revision != APALIS_TK1_K20_FW_VER) && !erase_only &&
-- (fw_entry != NULL)) {
-+ if ((apalis_tk1_k20_get_fw_revision() != APALIS_TK1_K20_FW_VER)
-+ && (revision != APALIS_TK1_K20_FW_VER) && !erase_only
-+ && (fw_entry != NULL)) {
- dev_err(apalis_tk1_k20->dev,
-- "Unsupported firmware version in both the device " \
-+ "Unsupported firmware version in both the device "
- "as well as the local firmware file.\n");
- release_firmware(fw_entry);
-- ret = -ENOTSUPP;
-- goto bad;
-+ return -ENOTSUPP;
- }
-
-- if ((revision != APALIS_TK1_K20_FW_VER) && !erase_only &&
-- (!apalis_tk1_k20_fw_ezport_status()) &&
-- (fw_entry != NULL)) {
-+ if ((revision != APALIS_TK1_K20_FW_VER) && !erase_only
-+ && (!apalis_tk1_k20_fw_ezport_status()) && (fw_entry != NULL)) {
- dev_err(apalis_tk1_k20->dev,
-- "Unsupported firmware version in the device and the " \
-+ "Unsupported firmware version in the device and the "
- "local firmware file disables the EZ Port.\n");
- release_firmware(fw_entry);
-- ret = -ENOTSUPP;
-- goto bad;
-+ return -ENOTSUPP;
- }
-
-- if (((revision != APALIS_TK1_K20_FW_VER) || erase_only) &&
-- (fw_entry != NULL)) {
-- i = 0;
-+ if (((revision != APALIS_TK1_K20_FW_VER) || erase_only
-+ || force_fw_reload)
-+ && (fw_entry != NULL)) {
-+ int i = 0;
- while (apalis_tk1_k20_enter_ezport(apalis_tk1_k20) < 0
-- && i++ < 5) {
-+ && i++ < 5) {
- msleep(50);
- }
- if (i >= 5) {
- dev_err(apalis_tk1_k20->dev,
- "Problem entering EZ port mode.\n");
- release_firmware(fw_entry);
-- ret = -EIO;
-- goto bad;
-+ return -EIO;
- }
- if (apalis_tk1_k20_erase_chip_ezport(apalis_tk1_k20) < 0) {
- dev_err(apalis_tk1_k20->dev,
-- "Problem erasing the chip.\n");
-+ "Problem erasing the chip. Deferring...\n");
- release_firmware(fw_entry);
-- ret = -EPROBE_DEFER;
-- goto bad;
-+ return -EPROBE_DEFER;
- }
- if (erase_only) {
-- dev_err(apalis_tk1_k20->dev,
-- "Chip fully erased.\n");
-+ dev_err(apalis_tk1_k20->dev, "Chip fully erased.\n");
- release_firmware(fw_entry);
-- ret = -EIO;
-- goto bad;
-+ return -EIO;
- }
- if (apalis_tk1_k20_flash_chip_ezport(apalis_tk1_k20) < 0) {
- dev_err(apalis_tk1_k20->dev,
-- "Problem flashing new firmware.\n");
-+ "Problem flashing new firmware. Deferring...\n");
- release_firmware(fw_entry);
-- ret = -EPROBE_DEFER;
-- goto bad;
-+ return -EPROBE_DEFER;
- }
- }
-+
- if (fw_entry != NULL)
- release_firmware(fw_entry);
-
-- msleep(10);
-+ return 1;
-+}
-+
-+int apalis_tk1_k20_dev_init(struct device *dev)
-+{
-+ struct apalis_tk1_k20_platform_data *pdata = dev_get_platdata(dev);
-+ struct apalis_tk1_k20_regmap *apalis_tk1_k20 = dev_get_drvdata(dev);
-+ uint32_t revision = 0x00;
-+ int ret, i;
-+
-+ apalis_tk1_k20->dev = dev;
-+
-+ ret = apalis_tk1_k20_probe_gpios_dt(apalis_tk1_k20);
-+ if ((ret < 0) && pdata) {
-+ if (pdata) {
-+ apalis_tk1_k20->ezpcs_gpio = pdata->ezpcs_gpio;
-+ apalis_tk1_k20->reset_gpio = pdata->reset_gpio;
-+ apalis_tk1_k20->int2_gpio = pdata->int2_gpio;
-+ } else {
-+ dev_err(dev, "Error claiming GPIOs\n");
-+ ret = -EINVAL;
-+ goto bad;
-+ }
-+ }
- apalis_tk1_k20_reset_chip(apalis_tk1_k20);
- msleep(10);
--
- ret = apalis_tk1_k20_reg_read(apalis_tk1_k20, APALIS_TK1_K20_REVREG,
- &revision);
-+
-+#ifdef CONFIG_APALIS_TK1_K20_EZP
-+
-+ if (fw_ignore == 0) {
-+ ret = apalis_tk1_k20_fw_update(apalis_tk1_k20, revision);
-+
-+ if (ret < 0)
-+ goto bad;
-+ }
-+ if (ret) {
-+ msleep(10);
-+ apalis_tk1_k20_reset_chip(apalis_tk1_k20);
-+ msleep(10);
-+
-+ ret = apalis_tk1_k20_reg_read(apalis_tk1_k20, APALIS_TK1_K20_REVREG,
-+ &revision);
-+ }
- #endif /* CONFIG_APALIS_TK1_K20_EZP */
-
- if (ret) {
-@@ -862,7 +882,7 @@ int apalis_tk1_k20_dev_init(struct device *dev)
- goto bad;
- }
-
-- if (revision != APALIS_TK1_K20_FW_VER) {
-+ if ((revision != APALIS_TK1_K20_FW_VER) && (fw_ignore == 0)) {
- dev_err(apalis_tk1_k20->dev,
- "Unsupported firmware version %d.%d.\n",
- ((revision & 0xF0) >> 4), (revision & 0x0F));
-@@ -870,6 +890,14 @@ int apalis_tk1_k20_dev_init(struct device *dev)
- goto bad;
- }
-
-+ if (fw_ignore == 1) {
-+ dev_err(apalis_tk1_k20->dev, "fw_ignore == 1. Detected "
-+ "firmware %d.%d. Driver expected %d.%d\n",
-+ ((revision & 0xF0) >> 4), (revision & 0x0F),
-+ ((APALIS_TK1_K20_FW_VER & 0xF0) >> 4),
-+ (APALIS_TK1_K20_FW_VER & 0x0F));
-+ }
-+
- for (i = 0; i < ARRAY_SIZE(apalis_tk1_k20->irqs); i++) {
- apalis_tk1_k20->irqs[i].reg_offset = i /
- APALIS_TK1_K20_IRQ_PER_REG;
-diff --git a/drivers/net/can/apalis-tk1-k20-can.c b/drivers/net/can/apalis-tk1-k20-can.c
-index e24adbb35dfd..0c238b8062ca 100644
---- a/drivers/net/can/apalis-tk1-k20-can.c
-+++ b/drivers/net/can/apalis-tk1-k20-can.c
-@@ -42,11 +42,12 @@
- #define MB_DLC_MASK 0xF
- #define MB_EID_LEN 4
-
--#define CANCTRL_MODMASK 0x03
--#define CANCTRL_INTEN BIT(2)
--#define CANINTF_RX BIT(3)
--#define CANINTF_TX BIT(4)
--#define CANINTF_ERR BIT(5)
-+#define CANCTRL_MODMASK (BIT(1) | BIT(0))
-+#define CANCTRL_INTEN BIT(2)
-+#define CANINTF_RX BIT(3)
-+#define CANINTF_TX BIT(4)
-+#define CANINTF_ERR BIT(5)
-+#define CANCTRL_ENABLE BIT(6)
- #define CANCTRL_INTMASK (CANINTF_RX | CANINTF_TX | CANINTF_ERR)
-
- #define EFLG_EWARN 0x01
-@@ -95,6 +96,7 @@ struct apalis_tk1_k20_priv {
- #define AFTER_SUSPEND_DOWN 2
- #define AFTER_SUSPEND_RESTART 4
- int restart_tx;
-+ int tx_frame;
- };
-
- static void apalis_tk1_k20_can_clean(struct net_device *net)
-@@ -123,6 +125,8 @@ static void apalis_tk1_k20_can_hw_tx_frame(struct net_device *net, u8 *buf,
- + APALIS_TK1_K20_CAN_DEV_OFFSET(
- priv->pdata->id), buf, len);
- apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+
-+ priv->tx_frame = 1;
- }
-
- static void apalis_tk1_k20_can_hw_tx(struct net_device *net,
-@@ -233,11 +237,8 @@ static int apalis_tk1_k20_can_set_normal_mode(struct net_device *net)
- struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-
- apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-- /* Enable interrupts */
-- apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20, APALIS_TK1_K20_CANREG
-- + APALIS_TK1_K20_CAN_DEV_OFFSET(
-- priv->pdata->id),
-- CANCTRL_INTEN, CANCTRL_INTEN);
-+
-+ priv->can.state = CAN_STATE_ERROR_ACTIVE;
-
- if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK) {
- /* Put device into loopback mode */
-@@ -253,6 +254,14 @@ static int apalis_tk1_k20_can_set_normal_mode(struct net_device *net)
- + APALIS_TK1_K20_CAN_DEV_OFFSET(
- priv->pdata->id), CANCTRL_MODMASK,
- CAN_CTRLMODE_LISTENONLY);
-+ priv->can.state = CAN_STATE_ERROR_PASSIVE;
-+ } else if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) {
-+ /* Put device into triple sampling mode */
-+ apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20,
-+ APALIS_TK1_K20_CANREG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id), CANCTRL_MODMASK,
-+ 0x03);
- } else {
- /* Put device into normal mode */
- apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20,
-@@ -262,7 +271,28 @@ static int apalis_tk1_k20_can_set_normal_mode(struct net_device *net)
- 0x00);
- }
- apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-- priv->can.state = CAN_STATE_ERROR_ACTIVE;
-+
-+ return 0;
-+}
-+
-+static int apalis_tk1_k20_can_enable(struct net_device *net,
-+ bool enable)
-+{
-+ struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-+
-+ apalis_tk1_k20_lock(priv->apalis_tk1_k20);
-+ /* Enable interrupts */
-+ apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20, APALIS_TK1_K20_CANREG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id),
-+ CANCTRL_INTEN, (enable) ? CANCTRL_INTEN:0);
-+ /* Enable CAN */
-+ apalis_tk1_k20_reg_rmw(priv->apalis_tk1_k20, APALIS_TK1_K20_CANREG
-+ + APALIS_TK1_K20_CAN_DEV_OFFSET(
-+ priv->pdata->id),
-+ CANCTRL_ENABLE, (enable) ? CANCTRL_ENABLE:0);
-+ apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
-+
- return 0;
- }
-
-@@ -350,6 +380,8 @@ static int apalis_tk1_k20_can_stop(struct net_device *net)
- destroy_workqueue(priv->wq);
- priv->wq = NULL;
-
-+ apalis_tk1_k20_can_enable(net, false);
-+
- mutex_lock(&priv->apalis_tk1_k20_can_lock);
- apalis_tk1_k20_lock(priv->apalis_tk1_k20);
- if (pdata->id == 0)
-@@ -358,7 +390,7 @@ static int apalis_tk1_k20_can_stop(struct net_device *net)
- if (pdata->id == 1)
- apalis_tk1_k20_irq_mask(priv->apalis_tk1_k20,
- APALIS_TK1_K20_CAN1_IRQ);
-- /* Disable and clear pending interrupts */
-+
- priv->can.state = CAN_STATE_STOPPED;
- apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
- mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-@@ -462,7 +494,7 @@ static int apalis_tk1_k20_can_resume(struct device *dev)
- if (pdata->id == 1)
- apalis_tk1_k20_irq_unmask(priv->apalis_tk1_k20,
- APALIS_TK1_K20_CAN1_IRQ);
-- /* Enable interrupts */
-+
- priv->can.state = CAN_STATE_STOPPED;
- apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
- mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-@@ -519,6 +551,7 @@ static irqreturn_t apalis_tk1_k20_can_ist(int irq, void *dev_id)
- u8 clear_intf = 0;
- int can_id = 0, data1 = 0;
-
-+
- apalis_tk1_k20_lock(priv->apalis_tk1_k20);
- ret = apalis_tk1_k20_reg_read(priv->apalis_tk1_k20,
- APALIS_TK1_K20_CANREG
-@@ -532,6 +565,25 @@ static irqreturn_t apalis_tk1_k20_can_ist(int irq, void *dev_id)
- }
-
- intf &= CANCTRL_INTMASK;
-+
-+ if (!(intf & CANINTF_TX) &&
-+ (priv->tx_frame == 1)) {
-+ priv->tx_frame = 0;
-+ net->stats.tx_packets++;
-+ net->stats.tx_bytes += priv->tx_len - 1;
-+ can_led_event(net, CAN_LED_EVENT_TX);
-+ if (priv->tx_len) {
-+ can_get_echo_skb(net, 0);
-+ priv->tx_len = 0;
-+ }
-+ netif_wake_queue(net);
-+ if (!(intf & (CANINTF_RX | CANINTF_ERR)))
-+ break;
-+ }
-+
-+ if (intf == 0)
-+ break;
-+
- /* receive */
- if (intf & CANINTF_RX)
- apalis_tk1_k20_can_hw_rx(net, 0);
-@@ -625,21 +677,7 @@ static irqreturn_t apalis_tk1_k20_can_ist(int irq, void *dev_id)
- break;
- }
-
-- if (intf == 0)
-- break;
-
-- if (intf & CANINTF_TX) {
-- net->stats.tx_packets++;
-- net->stats.tx_bytes += priv->tx_len - 1;
-- can_led_event(net, CAN_LED_EVENT_TX);
-- if (priv->tx_len) {
-- can_get_echo_skb(net, 0);
-- priv->tx_len = 0;
-- }
-- netif_wake_queue(net);
-- if (!(intf & (CANINTF_RX | CANINTF_ERR)))
-- break;
-- }
- }
- mutex_unlock(&priv->apalis_tk1_k20_can_lock);
- return IRQ_HANDLED;
-@@ -662,6 +700,7 @@ static int apalis_tk1_k20_can_open(struct net_device *net)
- priv->force_quit = 0;
- priv->tx_skb = NULL;
- priv->tx_len = 0;
-+ priv->tx_frame = 0;
- apalis_tk1_k20_lock(priv->apalis_tk1_k20);
- if (pdata->id == 0)
- ret = apalis_tk1_k20_irq_request(priv->apalis_tk1_k20,
-@@ -701,6 +740,11 @@ static int apalis_tk1_k20_can_open(struct net_device *net)
- apalis_tk1_k20_can_open_clean(net);
- goto open_unlock;
- }
-+ ret = apalis_tk1_k20_can_enable(net, true);
-+ if (ret) {
-+ apalis_tk1_k20_can_open_clean(net);
-+ goto open_unlock;
-+ }
-
- can_led_event(net, CAN_LED_EVENT_OPEN);
-
-@@ -765,6 +809,7 @@ static int apalis_tk1_k20_can_probe(struct platform_device *pdev)
- platform_set_drvdata(pdev, priv);
-
- ret = register_candev(net);
-+
- if (ret)
- goto error_probe;
-
-diff --git a/include/linux/mfd/apalis-tk1-k20-api.h b/include/linux/mfd/apalis-tk1-k20-api.h
-index 199b433c3d96..75c7821ec43f 100644
---- a/include/linux/mfd/apalis-tk1-k20-api.h
-+++ b/include/linux/mfd/apalis-tk1-k20-api.h
-@@ -104,7 +104,7 @@
- #define APALIS_TK1_K20_TSC_IRQ 4
- #define APALIS_TK1_K20_GPIO_IRQ 5
-
--#define APALIS_TK1_K20_FW_VER 0x11
-+#define APALIS_TK1_K20_FW_VER 0x13
- #define APALIS_TK1_K20_TESTER_FW_VER 0xFE
-
- #define FW_MINOR (APALIS_TK1_K20_FW_VER & 0x0F)
---
-2.19.2
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0034-apalis-tk1-mfd-k20-update-supported-fw-version-to-1..patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0034-apalis-tk1-mfd-k20-update-supported-fw-version-to-1..patch
deleted file mode 100644
index af4d2c5..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0034-apalis-tk1-mfd-k20-update-supported-fw-version-to-1..patch
+++ /dev/null
@@ -1,174 +0,0 @@
-From aee208a3f787e9944faccfedf3feef91fb6b77ea Mon Sep 17 00:00:00 2001
-From: Dominik Sliwa <dominik.sliwa@toradex.com>
-Date: Wed, 30 Jan 2019 12:47:03 +0100
-Subject: [PATCH] apalis-tk1: mfd: k20: update supported fw version to 1.4
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
-
-apalis-tk1: can: mfd: k20: use level interrupts and prioritize tx
-
-Prioritize CAN TX trafic, and move from edge to level triggered
-interrupts.
-
-Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
----
- arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi | 4 +--
- drivers/mfd/apalis-tk1-k20.c | 3 +-
- drivers/net/can/apalis-tk1-k20-can.c | 35 +++++++++++----------
- include/linux/mfd/apalis-tk1-k20-api.h | 2 +-
- 4 files changed, 23 insertions(+), 21 deletions(-)
-
-diff --git a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-index 1336e8caf95d..93fce73e385a 100644
---- a/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-+++ b/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
-@@ -1761,8 +1761,8 @@
- spi-max-frequency = <6120000>;
- interrupt-parent =<&gpio>;
- interrupts = <TEGRA_GPIO(K, 2) (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)>,
-- <TEGRA_GPIO(I, 5) (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)>, /* INT3 CAN0 */
-- <TEGRA_GPIO(J, 0) (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)>; /* INT4 CAN1 */
-+ <TEGRA_GPIO(I, 5) (IRQ_TYPE_LEVEL_HIGH)>, /* INT3 CAN0 */
-+ <TEGRA_GPIO(J, 0) (IRQ_TYPE_LEVEL_HIGH)>; /* INT4 CAN1 */
- rst-gpio = <&gpio TEGRA_GPIO(BB, 6) GPIO_ACTIVE_HIGH>;
-
- /* GPIO based CS used to enter K20 EzPort mode */
-diff --git a/drivers/mfd/apalis-tk1-k20.c b/drivers/mfd/apalis-tk1-k20.c
-index a6d1c1cdc0b6..dfdd3683d527 100644
---- a/drivers/mfd/apalis-tk1-k20.c
-+++ b/drivers/mfd/apalis-tk1-k20.c
-@@ -351,8 +351,7 @@ int apalis_tk1_k20_irq_request(struct apalis_tk1_k20_regmap *apalis_tk1_k20,
- } else {
- virq = (irq == APALIS_TK1_K20_CAN0_IRQ) ?
- apalis_tk1_k20->can0_irq:apalis_tk1_k20->can1_irq;
-- irq_flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING |
-- IRQF_TRIGGER_RISING;
-+ irq_flags = IRQF_ONESHOT | IRQF_TRIGGER_HIGH;
- }
- return devm_request_threaded_irq(apalis_tk1_k20->dev, virq,
- NULL, handler, irq_flags, name, dev);
-diff --git a/drivers/net/can/apalis-tk1-k20-can.c b/drivers/net/can/apalis-tk1-k20-can.c
-index 0c238b8062ca..d78940e3d262 100644
---- a/drivers/net/can/apalis-tk1-k20-can.c
-+++ b/drivers/net/can/apalis-tk1-k20-can.c
-@@ -125,8 +125,6 @@ static void apalis_tk1_k20_can_hw_tx_frame(struct net_device *net, u8 *buf,
- + APALIS_TK1_K20_CAN_DEV_OFFSET(
- priv->pdata->id), buf, len);
- apalis_tk1_k20_unlock(priv->apalis_tk1_k20);
--
-- priv->tx_frame = 1;
- }
-
- static void apalis_tk1_k20_can_hw_tx(struct net_device *net,
-@@ -142,7 +140,7 @@ static void apalis_tk1_k20_can_hw_tx(struct net_device *net,
- + CAN_HEADER_MAX_LEN, tx_buf_idx);
- }
-
--static void apalis_tk1_k20_can_hw_rx(struct net_device *net, int buf_idx)
-+static int apalis_tk1_k20_can_hw_rx(struct net_device *net, int buf_idx)
- {
- int i = 0;
- struct apalis_tk1_k20_priv *priv = netdev_priv(net);
-@@ -169,7 +167,7 @@ static void apalis_tk1_k20_can_hw_rx(struct net_device *net, int buf_idx)
- if (!skb) {
- dev_err(&net->dev, "cannot allocate RX skb\n");
- priv->net->stats.rx_dropped++;
-- return;
-+ return -ENOMEM;
- }
- memcpy(&frame->can_id, &buf[i * CAN_TRANSFER_BUF_LEN]
- + MB_EID_OFF, MB_EID_LEN);
-@@ -187,6 +185,7 @@ static void apalis_tk1_k20_can_hw_rx(struct net_device *net, int buf_idx)
- netif_rx_ni(skb);
- }
-
-+ return frame_available;
-
- }
-
-@@ -436,6 +435,7 @@ static void apalis_tk1_k20_can_tx_work_handler(struct work_struct *ws)
- priv->tx_len = 1 + frame->can_dlc;
- can_put_echo_skb(priv->tx_skb, net, 0);
- priv->tx_skb = NULL;
-+ priv->tx_frame = 1;
- }
- }
- mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-@@ -546,7 +546,7 @@ static irqreturn_t apalis_tk1_k20_can_ist(int irq, void *dev_id)
- mutex_lock(&priv->apalis_tk1_k20_can_lock);
- while (!priv->force_quit) {
- enum can_state new_state = CAN_STATE_ERROR_ACTIVE;
-- int ret;
-+ int ret, rx_cnt = 0;
- u32 intf, eflag;
- u8 clear_intf = 0;
- int can_id = 0, data1 = 0;
-@@ -566,31 +566,31 @@ static irqreturn_t apalis_tk1_k20_can_ist(int irq, void *dev_id)
-
- intf &= CANCTRL_INTMASK;
-
-- if (!(intf & CANINTF_TX) &&
-+ if (intf == 0)
-+ break;
-+
-+ /* TX complete */
-+ if ((intf & CANINTF_TX) &&
- (priv->tx_frame == 1)) {
- priv->tx_frame = 0;
- net->stats.tx_packets++;
-- net->stats.tx_bytes += priv->tx_len - 1;
-- can_led_event(net, CAN_LED_EVENT_TX);
- if (priv->tx_len) {
-+ net->stats.tx_bytes += priv->tx_len - 1;
-+ can_led_event(net, CAN_LED_EVENT_TX);
- can_get_echo_skb(net, 0);
- priv->tx_len = 0;
- }
- netif_wake_queue(net);
-- if (!(intf & (CANINTF_RX | CANINTF_ERR)))
-- break;
-+ clear_intf |= CANINTF_TX;
- }
--
-- if (intf == 0)
-- break;
--
- /* receive */
- if (intf & CANINTF_RX)
-- apalis_tk1_k20_can_hw_rx(net, 0);
-+ rx_cnt = apalis_tk1_k20_can_hw_rx(net, 0);
-
- /* any error interrupt we need to clear? */
- if (intf & CANINTF_ERR)
-- clear_intf |= intf & CANINTF_ERR;
-+ clear_intf |= CANINTF_ERR;
-+
- apalis_tk1_k20_lock(priv->apalis_tk1_k20);
- if (clear_intf)
- ret = apalis_tk1_k20_reg_write(priv->apalis_tk1_k20,
-@@ -677,6 +677,9 @@ static irqreturn_t apalis_tk1_k20_can_ist(int irq, void *dev_id)
- break;
- }
-
-+ if (priv->tx_skb != NULL) {
-+ break;
-+ }
-
- }
- mutex_unlock(&priv->apalis_tk1_k20_can_lock);
-diff --git a/include/linux/mfd/apalis-tk1-k20-api.h b/include/linux/mfd/apalis-tk1-k20-api.h
-index 75c7821ec43f..333d20f7852b 100644
---- a/include/linux/mfd/apalis-tk1-k20-api.h
-+++ b/include/linux/mfd/apalis-tk1-k20-api.h
-@@ -104,7 +104,7 @@
- #define APALIS_TK1_K20_TSC_IRQ 4
- #define APALIS_TK1_K20_GPIO_IRQ 5
-
--#define APALIS_TK1_K20_FW_VER 0x13
-+#define APALIS_TK1_K20_FW_VER 0x14
- #define APALIS_TK1_K20_TESTER_FW_VER 0xFE
-
- #define FW_MINOR (APALIS_TK1_K20_FW_VER & 0x0F)
---
-2.20.1
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0035-perf-tools-Add-Python-3-support.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0035-perf-tools-Add-Python-3-support.patch
deleted file mode 100644
index 614f525..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/0035-perf-tools-Add-Python-3-support.patch
+++ /dev/null
@@ -1,915 +0,0 @@
-From 397564ae5691bd47180acbc12729777ee688041b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= <jskarvad@redhat.com>
-Date: Fri, 19 Jan 2018 21:56:41 +0100
-Subject: [PATCH] perf tools: Add Python 3 support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Added Python 3 support while keeping Python 2.7 compatibility.
-
-Committer notes:
-
-This doesn't make it to auto detect python 3, one has to explicitely ask
-it to build with python 3 devel files, here are the instructions
-provided by Jaroslav:
-
- ---
- $ cp -a tools/perf tools/python3-perf
- $ make V=1 prefix=/usr -C tools/perf PYTHON=/usr/bin/python2 all
- $ make V=1 prefix=/usr -C tools/python3-perf PYTHON=/usr/bin/python3 all
- $ make V=1 prefix=/usr -C tools/python3-perf PYTHON=/usr/bin/python3 DESTDIR=%{buildroot} install-python_ext
- $ make V=1 prefix=/usr -C tools/perf PYTHON=/usr/bin/python2 DESTDIR=%{buildroot} install-python_ext
- ---
-
-We need to make this automatic, just like the existing tests for checking if
-the python2 devel files are in place, allowing the build with python3 if
-available, fallbacking to python2 and then just disabling it if none are
-available.
-
-So, using the PYTHON variable to build it using O= we get:
-
-Before this patch:
-
- $ rpm -q python3 python3-devel
- python3-3.6.4-7.fc27.x86_64
- python3-devel-3.6.4-7.fc27.x86_64
- $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make O=/tmp/build/perf PYTHON=/usr/bin/python3 -C tools/perf install-bin
- make: Entering directory '/home/acme/git/linux/tools/perf'
- <SNIP>
- Makefile.config:670: Python 3 is not yet supported; please set
- Makefile.config:671: PYTHON and/or PYTHON_CONFIG appropriately.
- Makefile.config:672: If you also have Python 2 installed, then
- Makefile.config:673: try something like:
- Makefile.config:674:
- Makefile.config:675: make PYTHON=python2
- Makefile.config:676:
- Makefile.config:677: Otherwise, disable Python support entirely:
- Makefile.config:678:
- Makefile.config:679: make NO_LIBPYTHON=1
- Makefile.config:680:
- Makefile.config:681: *** . Stop.
- make[1]: *** [Makefile.perf:212: sub-make] Error 2
- make: *** [Makefile:110: install-bin] Error 2
- make: Leaving directory '/home/acme/git/linux/tools/perf'
- $
-
-After:
-
- $ make O=/tmp/build/perf PYTHON=python3 -C tools/perf install-bin
- $ ldd ~/bin/perf | grep python
- libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007f58a31e8000)
- $ rpm -qf /lib64/libpython3.6m.so.1.0
- python3-libs-3.6.4-7.fc27.x86_64
- $
-
-Now verify that when using the binding the right ELF file is loaded,
-using perf trace:
-
- $ perf trace -e open* perf test python
- 0.051 ( 0.016 ms): perf/3927 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3
-<SNIP>
- 18: 'import perf' in python :
- 8.849 ( 0.013 ms): sh/3929 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3
-<SNIP>
- 25.572 ( 0.008 ms): python3/3931 openat(dfd: CWD, filename: /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so, flags: CLOEXEC) = 3
-<SNIP>
- Ok
-<SNIP>
- $
-
-And using tools/perf/python/twatch.py, to show PERF_RECORD_ metaevents:
-
- $ python3 tools/perf/python/twatch.py
- cpu: 3, pid: 16060, tid: 16060 { type: fork, pid: 5207, ppid: 16060, tid: 5207, ptid: 16060, time: 10798513015459}
- cpu: 3, pid: 16060, tid: 16060 { type: fork, pid: 5208, ppid: 16060, tid: 5208, ptid: 16060, time: 10798513562503}
- cpu: 0, pid: 5208, tid: 5208 { type: comm, pid: 5208, tid: 5208, comm: grep }
- cpu: 2, pid: 5207, tid: 5207 { type: comm, pid: 5207, tid: 5207, comm: ps }
- cpu: 2, pid: 5207, tid: 5207 { type: exit, pid: 5207, ppid: 5207, tid: 5207, ptid: 5207, time: 10798551337484}
- cpu: 3, pid: 5208, tid: 5208 { type: exit, pid: 5208, ppid: 5208, tid: 5208, ptid: 5208, time: 10798551292153}
- cpu: 3, pid: 601, tid: 601 { type: fork, pid: 5209, ppid: 601, tid: 5209, ptid: 601, time: 10801779977324}
- ^CTraceback (most recent call last):
- File "tools/perf/python/twatch.py", line 68, in <module>
- main()
- File "tools/perf/python/twatch.py", line 40, in main
- evlist.poll(timeout = -1)
- KeyboardInterrupt
- $
-
- # ps ax|grep twatch
- 5197 pts/8 S+ 0:00 python3 tools/perf/python/twatch.py
- # ls -la /proc/5197/smaps
- -r--r--r--. 1 acme acme 0 Feb 19 13:14 /proc/5197/smaps
- # grep python /proc/5197/smaps
- 558111307000-558111309000 r-xp 00000000 fd:00 3151710 /usr/bin/python3.6
- 558111508000-558111509000 r--p 00001000 fd:00 3151710 /usr/bin/python3.6
- 558111509000-55811150a000 rw-p 00002000 fd:00 3151710 /usr/bin/python3.6
- 7ffad6fc1000-7ffad7008000 r-xp 00000000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so
- 7ffad7008000-7ffad7207000 ---p 00047000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so
- 7ffad7207000-7ffad7208000 r--p 00046000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so
- 7ffad7208000-7ffad7215000 rw-p 00047000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so
- 7ffadea77000-7ffaded3d000 r-xp 00000000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0
- 7ffaded3d000-7ffadef3c000 ---p 002c6000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0
- 7ffadef3c000-7ffadef42000 r--p 002c5000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0
- 7ffadef42000-7ffadefa5000 rw-p 002cb000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0
- #
-
-And with this patch, but building normally, without specifying the
-PYTHON=python3 part, which will make it use python2 if its devel files are
-available, like in this test:
-
- $ make O=/tmp/build/perf -C tools/perf install-bin
- $ ldd ~/bin/perf | grep python
- libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007f6a44410000)
- $ ldd /tmp/build/perf/python_ext_build/lib/perf.so | grep python
- libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fed28a2c000)
- $
-
- [acme@jouet perf]$ tools/perf/python/twatch.py
- cpu: 0, pid: 2817, tid: 2817 { type: fork, pid: 2817, ppid: 2817, tid: 8910, ptid: 2817, time: 11126454335306}
- cpu: 0, pid: 2817, tid: 2817 { type: comm, pid: 2817, tid: 8910, comm: worker }
- $ ps ax | grep twatch.py
- 8909 pts/8 S+ 0:00 /usr/bin/python tools/perf/python/twatch.py
- $ grep python /proc/8909/smaps
- 5579de658000-5579de659000 r-xp 00000000 fd:00 3156044 /usr/bin/python2.7
- 5579de858000-5579de859000 r--p 00000000 fd:00 3156044 /usr/bin/python2.7
- 5579de859000-5579de85a000 rw-p 00001000 fd:00 3156044 /usr/bin/python2.7
- 7f0de01f7000-7f0de023e000 r-xp 00000000 00:2d 230695 /tmp/build/perf/python/perf.so
- 7f0de023e000-7f0de043d000 ---p 00047000 00:2d 230695 /tmp/build/perf/python/perf.so
- 7f0de043d000-7f0de043e000 r--p 00046000 00:2d 230695 /tmp/build/perf/python/perf.so
- 7f0de043e000-7f0de044b000 rw-p 00047000 00:2d 230695 /tmp/build/perf/python/perf.so
- 7f0de6f0f000-7f0de6f13000 r-xp 00000000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so
- 7f0de6f13000-7f0de7113000 ---p 00004000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so
- 7f0de7113000-7f0de7114000 r--p 00004000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so
- 7f0de7114000-7f0de7115000 rw-p 00005000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so
- 7f0de7e73000-7f0de8052000 r-xp 00000000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0
- 7f0de8052000-7f0de8251000 ---p 001df000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0
- 7f0de8251000-7f0de8255000 r--p 001de000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0
- 7f0de8255000-7f0de8291000 rw-p 001e2000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0
- $
-
-Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: David Ahern <dsahern@gmail.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Wang Nan <wangnan0@huawei.com>
-LPU-Reference: 20180119205641.24242-1-jskarvad@redhat.com
-Link: https://lkml.kernel.org/n/tip-8d7dt9kqp83vsz25hagug8fu@git.kernel.org
-[ Removed explicit check for python version, allowing it to really build with python3 ]
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-(cherry picked from commit 66dfdff03d196e51322c6a85c0d8db8bb2bdd655)
----
- tools/perf/Makefile.config | 23 +--
- tools/perf/Makefile.perf | 4 +-
- .../scripts/python/Perf-Trace-Util/Context.c | 34 +++-
- tools/perf/util/python.c | 95 ++++++++---
- .../scripting-engines/trace-event-python.c | 147 +++++++++++++-----
- tools/perf/util/setup.py | 6 +-
- 6 files changed, 221 insertions(+), 88 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index f362ee46506a..ecdc3770d899 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -622,25 +622,10 @@ else
- ifneq ($(feature-libpython), 1)
- $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
- else
-- ifneq ($(feature-libpython-version), 1)
-- $(warning Python 3 is not yet supported; please set)
-- $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
-- $(warning If you also have Python 2 installed, then)
-- $(warning try something like:)
-- $(warning $(and ,))
-- $(warning $(and ,) make PYTHON=python2)
-- $(warning $(and ,))
-- $(warning Otherwise, disable Python support entirely:)
-- $(warning $(and ,))
-- $(warning $(and ,) make NO_LIBPYTHON=1)
-- $(warning $(and ,))
-- $(error $(and ,))
-- else
-- LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
-- EXTLIBS += $(PYTHON_EMBED_LIBADD)
-- LANG_BINDINGS += $(obj-perf)python/perf.so
-- $(call detected,CONFIG_LIBPYTHON)
-- endif
-+ LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
-+ EXTLIBS += $(PYTHON_EMBED_LIBADD)
-+ LANG_BINDINGS += $(obj-perf)python/perf.so
-+ $(call detected,CONFIG_LIBPYTHON)
- endif
- endif
- endif
-diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
-index 349ea5133d83..6879321c612d 100644
---- a/tools/perf/Makefile.perf
-+++ b/tools/perf/Makefile.perf
-@@ -294,7 +294,7 @@ PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
- PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
- export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
-
--python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
-+python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
-
- PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
- PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI)
-@@ -444,7 +444,7 @@ $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_D
- $(PYTHON_WORD) util/setup.py \
- --quiet build_ext; \
- mkdir -p $(OUTPUT)python && \
-- cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
-+ cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
-
- please_set_SHELL_PATH_to_a_more_modern_shell:
- $(Q)$$(:)
-diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Context.c b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
-index fcd1dd667906..1a0d27757eec 100644
---- a/tools/perf/scripts/python/Perf-Trace-Util/Context.c
-+++ b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
-@@ -23,7 +23,17 @@
- #include "../../../perf.h"
- #include "../../../util/trace-event.h"
-
-+#if PY_MAJOR_VERSION < 3
-+#define _PyCapsule_GetPointer(arg1, arg2) \
-+ PyCObject_AsVoidPtr(arg1)
-+
- PyMODINIT_FUNC initperf_trace_context(void);
-+#else
-+#define _PyCapsule_GetPointer(arg1, arg2) \
-+ PyCapsule_GetPointer((arg1), (arg2))
-+
-+PyMODINIT_FUNC PyInit_perf_trace_context(void);
-+#endif
-
- static PyObject *perf_trace_context_common_pc(PyObject *obj, PyObject *args)
- {
-@@ -34,7 +44,7 @@ static PyObject *perf_trace_context_common_pc(PyObject *obj, PyObject *args)
- if (!PyArg_ParseTuple(args, "O", &context))
- return NULL;
-
-- scripting_context = PyCObject_AsVoidPtr(context);
-+ scripting_context = _PyCapsule_GetPointer(context, NULL);
- retval = common_pc(scripting_context);
-
- return Py_BuildValue("i", retval);
-@@ -50,7 +60,7 @@ static PyObject *perf_trace_context_common_flags(PyObject *obj,
- if (!PyArg_ParseTuple(args, "O", &context))
- return NULL;
-
-- scripting_context = PyCObject_AsVoidPtr(context);
-+ scripting_context = _PyCapsule_GetPointer(context, NULL);
- retval = common_flags(scripting_context);
-
- return Py_BuildValue("i", retval);
-@@ -66,7 +76,7 @@ static PyObject *perf_trace_context_common_lock_depth(PyObject *obj,
- if (!PyArg_ParseTuple(args, "O", &context))
- return NULL;
-
-- scripting_context = PyCObject_AsVoidPtr(context);
-+ scripting_context = _PyCapsule_GetPointer(context, NULL);
- retval = common_lock_depth(scripting_context);
-
- return Py_BuildValue("i", retval);
-@@ -82,7 +92,25 @@ static PyMethodDef ContextMethods[] = {
- { NULL, NULL, 0, NULL}
- };
-
-+#if PY_MAJOR_VERSION < 3
- PyMODINIT_FUNC initperf_trace_context(void)
- {
- (void) Py_InitModule("perf_trace_context", ContextMethods);
- }
-+#else
-+PyMODINIT_FUNC PyInit_perf_trace_context(void)
-+{
-+ static struct PyModuleDef moduledef = {
-+ PyModuleDef_HEAD_INIT,
-+ "perf_trace_context", /* m_name */
-+ "", /* m_doc */
-+ -1, /* m_size */
-+ ContextMethods, /* m_methods */
-+ NULL, /* m_reload */
-+ NULL, /* m_traverse */
-+ NULL, /* m_clear */
-+ NULL, /* m_free */
-+ };
-+ return PyModule_Create(&moduledef);
-+}
-+#endif
-diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
-index 8e49d9cafcfc..16620c37fd8c 100644
---- a/tools/perf/util/python.c
-+++ b/tools/perf/util/python.c
-@@ -12,6 +12,30 @@
- #include "print_binary.h"
- #include "thread_map.h"
-
-+#if PY_MAJOR_VERSION < 3
-+#define _PyUnicode_FromString(arg) \
-+ PyString_FromString(arg)
-+#define _PyUnicode_AsString(arg) \
-+ PyString_AsString(arg)
-+#define _PyUnicode_FromFormat(...) \
-+ PyString_FromFormat(__VA_ARGS__)
-+#define _PyLong_FromLong(arg) \
-+ PyInt_FromLong(arg)
-+
-+#else
-+
-+#define _PyUnicode_FromString(arg) \
-+ PyUnicode_FromString(arg)
-+#define _PyUnicode_FromFormat(...) \
-+ PyUnicode_FromFormat(__VA_ARGS__)
-+#define _PyLong_FromLong(arg) \
-+ PyLong_FromLong(arg)
-+#endif
-+
-+#ifndef Py_TYPE
-+#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
-+#endif
-+
- /*
- * Provide these two so that we don't have to link against callchain.c and
- * start dragging hist.c, etc.
-@@ -49,7 +73,11 @@ int eprintf(int level, int var, const char *fmt, ...)
- # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
- #endif
-
-+#if PY_MAJOR_VERSION < 3
- PyMODINIT_FUNC initperf(void);
-+#else
-+PyMODINIT_FUNC PyInit_perf(void);
-+#endif
-
- #define member_def(type, member, ptype, help) \
- { #member, ptype, \
-@@ -107,7 +135,7 @@ static PyObject *pyrf_mmap_event__repr(struct pyrf_event *pevent)
- pevent->event.mmap.pgoff, pevent->event.mmap.filename) < 0) {
- ret = PyErr_NoMemory();
- } else {
-- ret = PyString_FromString(s);
-+ ret = _PyUnicode_FromString(s);
- free(s);
- }
- return ret;
-@@ -138,7 +166,7 @@ static PyMemberDef pyrf_task_event__members[] = {
-
- static PyObject *pyrf_task_event__repr(struct pyrf_event *pevent)
- {
-- return PyString_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, "
-+ return _PyUnicode_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, "
- "ptid: %u, time: %" PRIu64 "}",
- pevent->event.header.type == PERF_RECORD_FORK ? "fork" : "exit",
- pevent->event.fork.pid,
-@@ -171,7 +199,7 @@ static PyMemberDef pyrf_comm_event__members[] = {
-
- static PyObject *pyrf_comm_event__repr(struct pyrf_event *pevent)
- {
-- return PyString_FromFormat("{ type: comm, pid: %u, tid: %u, comm: %s }",
-+ return _PyUnicode_FromFormat("{ type: comm, pid: %u, tid: %u, comm: %s }",
- pevent->event.comm.pid,
- pevent->event.comm.tid,
- pevent->event.comm.comm);
-@@ -202,7 +230,7 @@ static PyObject *pyrf_throttle_event__repr(struct pyrf_event *pevent)
- {
- struct throttle_event *te = (struct throttle_event *)(&pevent->event.header + 1);
-
-- return PyString_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64
-+ return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64
- ", stream_id: %" PRIu64 " }",
- pevent->event.header.type == PERF_RECORD_THROTTLE ? "" : "un",
- te->time, te->id, te->stream_id);
-@@ -237,7 +265,7 @@ static PyObject *pyrf_lost_event__repr(struct pyrf_event *pevent)
- pevent->event.lost.id, pevent->event.lost.lost) < 0) {
- ret = PyErr_NoMemory();
- } else {
-- ret = PyString_FromString(s);
-+ ret = _PyUnicode_FromString(s);
- free(s);
- }
- return ret;
-@@ -264,7 +292,7 @@ static PyMemberDef pyrf_read_event__members[] = {
-
- static PyObject *pyrf_read_event__repr(struct pyrf_event *pevent)
- {
-- return PyString_FromFormat("{ type: read, pid: %u, tid: %u }",
-+ return _PyUnicode_FromFormat("{ type: read, pid: %u, tid: %u }",
- pevent->event.read.pid,
- pevent->event.read.tid);
- /*
-@@ -299,7 +327,7 @@ static PyObject *pyrf_sample_event__repr(struct pyrf_event *pevent)
- if (asprintf(&s, "{ type: sample }") < 0) {
- ret = PyErr_NoMemory();
- } else {
-- ret = PyString_FromString(s);
-+ ret = _PyUnicode_FromString(s);
- free(s);
- }
- return ret;
-@@ -330,7 +358,7 @@ tracepoint_field(struct pyrf_event *pe, struct format_field *field)
- }
- if (field->flags & FIELD_IS_STRING &&
- is_printable_array(data + offset, len)) {
-- ret = PyString_FromString((char *)data + offset);
-+ ret = _PyUnicode_FromString((char *)data + offset);
- } else {
- ret = PyByteArray_FromStringAndSize((const char *) data + offset, len);
- field->flags &= ~FIELD_IS_STRING;
-@@ -352,7 +380,7 @@ tracepoint_field(struct pyrf_event *pe, struct format_field *field)
- static PyObject*
- get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name)
- {
-- const char *str = PyString_AsString(PyObject_Str(attr_name));
-+ const char *str = _PyUnicode_AsString(PyObject_Str(attr_name));
- struct perf_evsel *evsel = pevent->evsel;
- struct format_field *field;
-
-@@ -416,7 +444,7 @@ static PyObject *pyrf_context_switch_event__repr(struct pyrf_event *pevent)
- !!(pevent->event.header.misc & PERF_RECORD_MISC_SWITCH_OUT)) < 0) {
- ret = PyErr_NoMemory();
- } else {
-- ret = PyString_FromString(s);
-+ ret = _PyUnicode_FromString(s);
- free(s);
- }
- return ret;
-@@ -528,7 +556,7 @@ static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus,
- static void pyrf_cpu_map__delete(struct pyrf_cpu_map *pcpus)
- {
- cpu_map__put(pcpus->cpus);
-- pcpus->ob_type->tp_free((PyObject*)pcpus);
-+ Py_TYPE(pcpus)->tp_free((PyObject*)pcpus);
- }
-
- static Py_ssize_t pyrf_cpu_map__length(PyObject *obj)
-@@ -597,7 +625,7 @@ static int pyrf_thread_map__init(struct pyrf_thread_map *pthreads,
- static void pyrf_thread_map__delete(struct pyrf_thread_map *pthreads)
- {
- thread_map__put(pthreads->threads);
-- pthreads->ob_type->tp_free((PyObject*)pthreads);
-+ Py_TYPE(pthreads)->tp_free((PyObject*)pthreads);
- }
-
- static Py_ssize_t pyrf_thread_map__length(PyObject *obj)
-@@ -759,7 +787,7 @@ static int pyrf_evsel__init(struct pyrf_evsel *pevsel,
- static void pyrf_evsel__delete(struct pyrf_evsel *pevsel)
- {
- perf_evsel__exit(&pevsel->evsel);
-- pevsel->ob_type->tp_free((PyObject*)pevsel);
-+ Py_TYPE(pevsel)->tp_free((PyObject*)pevsel);
- }
-
- static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel,
-@@ -850,7 +878,7 @@ static int pyrf_evlist__init(struct pyrf_evlist *pevlist,
- static void pyrf_evlist__delete(struct pyrf_evlist *pevlist)
- {
- perf_evlist__exit(&pevlist->evlist);
-- pevlist->ob_type->tp_free((PyObject*)pevlist);
-+ Py_TYPE(pevlist)->tp_free((PyObject*)pevlist);
- }
-
- static PyObject *pyrf_evlist__mmap(struct pyrf_evlist *pevlist,
-@@ -902,12 +930,16 @@ static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist,
-
- for (i = 0; i < evlist->pollfd.nr; ++i) {
- PyObject *file;
-+#if PY_MAJOR_VERSION < 3
- FILE *fp = fdopen(evlist->pollfd.entries[i].fd, "r");
-
- if (fp == NULL)
- goto free_list;
-
- file = PyFile_FromFile(fp, "perf", "r", NULL);
-+#else
-+ file = PyFile_FromFd(evlist->pollfd.entries[i].fd, "perf", "r", -1, NULL, NULL, NULL, 1);
-+#endif
- if (file == NULL)
- goto free_list;
-
-@@ -1194,9 +1226,9 @@ static PyObject *pyrf__tracepoint(struct pyrf_evsel *pevsel,
-
- tp_format = trace_event__tp_format(sys, name);
- if (IS_ERR(tp_format))
-- return PyInt_FromLong(-1);
-+ return _PyLong_FromLong(-1);
-
-- return PyInt_FromLong(tp_format->id);
-+ return _PyLong_FromLong(tp_format->id);
- }
-
- static PyMethodDef perf__methods[] = {
-@@ -1209,11 +1241,31 @@ static PyMethodDef perf__methods[] = {
- { .ml_name = NULL, }
- };
-
-+#if PY_MAJOR_VERSION < 3
- PyMODINIT_FUNC initperf(void)
-+#else
-+PyMODINIT_FUNC PyInit_perf(void)
-+#endif
- {
- PyObject *obj;
- int i;
-- PyObject *dict, *module = Py_InitModule("perf", perf__methods);
-+ PyObject *dict;
-+#if PY_MAJOR_VERSION < 3
-+ PyObject *module = Py_InitModule("perf", perf__methods);
-+#else
-+ static struct PyModuleDef moduledef = {
-+ PyModuleDef_HEAD_INIT,
-+ "perf", /* m_name */
-+ "", /* m_doc */
-+ -1, /* m_size */
-+ perf__methods, /* m_methods */
-+ NULL, /* m_reload */
-+ NULL, /* m_traverse */
-+ NULL, /* m_clear */
-+ NULL, /* m_free */
-+ };
-+ PyObject *module = PyModule_Create(&moduledef);
-+#endif
-
- if (module == NULL ||
- pyrf_event__setup_types() < 0 ||
-@@ -1221,7 +1273,11 @@ PyMODINIT_FUNC initperf(void)
- pyrf_evsel__setup_types() < 0 ||
- pyrf_thread_map__setup_types() < 0 ||
- pyrf_cpu_map__setup_types() < 0)
-+#if PY_MAJOR_VERSION < 3
- return;
-+#else
-+ return module;
-+#endif
-
- /* The page_size is placed in util object. */
- page_size = sysconf(_SC_PAGE_SIZE);
-@@ -1270,7 +1326,7 @@ PyMODINIT_FUNC initperf(void)
- goto error;
-
- for (i = 0; perf__constants[i].name != NULL; i++) {
-- obj = PyInt_FromLong(perf__constants[i].value);
-+ obj = _PyLong_FromLong(perf__constants[i].value);
- if (obj == NULL)
- goto error;
- PyDict_SetItemString(dict, perf__constants[i].name, obj);
-@@ -1280,6 +1336,9 @@ PyMODINIT_FUNC initperf(void)
- error:
- if (PyErr_Occurred())
- PyErr_SetString(PyExc_ImportError, "perf: Init failed!");
-+#if PY_MAJOR_VERSION >= 3
-+ return module;
-+#endif
- }
-
- /*
-diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
-index f03fa7a835a1..8db28d4ff4b6 100644
---- a/tools/perf/util/scripting-engines/trace-event-python.c
-+++ b/tools/perf/util/scripting-engines/trace-event-python.c
-@@ -50,7 +50,37 @@
- #include "print_binary.h"
- #include "stat.h"
-
-+#if PY_MAJOR_VERSION < 3
-+#define _PyUnicode_FromString(arg) \
-+ PyString_FromString(arg)
-+#define _PyUnicode_FromStringAndSize(arg1, arg2) \
-+ PyString_FromStringAndSize((arg1), (arg2))
-+#define _PyBytes_FromStringAndSize(arg1, arg2) \
-+ PyString_FromStringAndSize((arg1), (arg2))
-+#define _PyLong_FromLong(arg) \
-+ PyInt_FromLong(arg)
-+#define _PyLong_AsLong(arg) \
-+ PyInt_AsLong(arg)
-+#define _PyCapsule_New(arg1, arg2, arg3) \
-+ PyCObject_FromVoidPtr((arg1), (arg2))
-+
- PyMODINIT_FUNC initperf_trace_context(void);
-+#else
-+#define _PyUnicode_FromString(arg) \
-+ PyUnicode_FromString(arg)
-+#define _PyUnicode_FromStringAndSize(arg1, arg2) \
-+ PyUnicode_FromStringAndSize((arg1), (arg2))
-+#define _PyBytes_FromStringAndSize(arg1, arg2) \
-+ PyBytes_FromStringAndSize((arg1), (arg2))
-+#define _PyLong_FromLong(arg) \
-+ PyLong_FromLong(arg)
-+#define _PyLong_AsLong(arg) \
-+ PyLong_AsLong(arg)
-+#define _PyCapsule_New(arg1, arg2, arg3) \
-+ PyCapsule_New((arg1), (arg2), (arg3))
-+
-+PyMODINIT_FUNC PyInit_perf_trace_context(void);
-+#endif
-
- #define TRACE_EVENT_TYPE_MAX \
- ((1 << (sizeof(unsigned short) * 8)) - 1)
-@@ -136,7 +166,7 @@ static int get_argument_count(PyObject *handler)
- PyObject *arg_count_obj = PyObject_GetAttrString(code_obj,
- "co_argcount");
- if (arg_count_obj) {
-- arg_count = (int) PyInt_AsLong(arg_count_obj);
-+ arg_count = (int) _PyLong_AsLong(arg_count_obj);
- Py_DECREF(arg_count_obj);
- }
- Py_DECREF(code_obj);
-@@ -183,10 +213,10 @@ static void define_value(enum print_arg_type field_type,
-
- value = eval_flag(field_value);
-
-- PyTuple_SetItem(t, n++, PyString_FromString(ev_name));
-- PyTuple_SetItem(t, n++, PyString_FromString(field_name));
-- PyTuple_SetItem(t, n++, PyInt_FromLong(value));
-- PyTuple_SetItem(t, n++, PyString_FromString(field_str));
-+ PyTuple_SetItem(t, n++, _PyUnicode_FromString(ev_name));
-+ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_name));
-+ PyTuple_SetItem(t, n++, _PyLong_FromLong(value));
-+ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_str));
-
- try_call_object(handler_name, t);
-
-@@ -224,10 +254,10 @@ static void define_field(enum print_arg_type field_type,
- if (!t)
- Py_FatalError("couldn't create Python tuple");
-
-- PyTuple_SetItem(t, n++, PyString_FromString(ev_name));
-- PyTuple_SetItem(t, n++, PyString_FromString(field_name));
-+ PyTuple_SetItem(t, n++, _PyUnicode_FromString(ev_name));
-+ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_name));
- if (field_type == PRINT_FLAGS)
-- PyTuple_SetItem(t, n++, PyString_FromString(delim));
-+ PyTuple_SetItem(t, n++, _PyUnicode_FromString(delim));
-
- try_call_object(handler_name, t);
-
-@@ -326,12 +356,12 @@ static PyObject *get_field_numeric_entry(struct event_format *event,
- if (field->flags & FIELD_IS_SIGNED) {
- if ((long long)val >= LONG_MIN &&
- (long long)val <= LONG_MAX)
-- obj = PyInt_FromLong(val);
-+ obj = _PyLong_FromLong(val);
- else
- obj = PyLong_FromLongLong(val);
- } else {
- if (val <= LONG_MAX)
-- obj = PyInt_FromLong(val);
-+ obj = _PyLong_FromLong(val);
- else
- obj = PyLong_FromUnsignedLongLong(val);
- }
-@@ -390,9 +420,9 @@ static PyObject *python_process_callchain(struct perf_sample *sample,
- pydict_set_item_string_decref(pysym, "end",
- PyLong_FromUnsignedLongLong(node->sym->end));
- pydict_set_item_string_decref(pysym, "binding",
-- PyInt_FromLong(node->sym->binding));
-+ _PyLong_FromLong(node->sym->binding));
- pydict_set_item_string_decref(pysym, "name",
-- PyString_FromStringAndSize(node->sym->name,
-+ _PyUnicode_FromStringAndSize(node->sym->name,
- node->sym->namelen));
- pydict_set_item_string_decref(pyelem, "sym", pysym);
- }
-@@ -407,7 +437,7 @@ static PyObject *python_process_callchain(struct perf_sample *sample,
- dsoname = map->dso->name;
- }
- pydict_set_item_string_decref(pyelem, "dso",
-- PyString_FromString(dsoname));
-+ _PyUnicode_FromString(dsoname));
- }
-
- callchain_cursor_advance(&callchain_cursor);
-@@ -484,16 +514,16 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
- if (!dict_sample)
- Py_FatalError("couldn't create Python dictionary");
-
-- pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel)));
-- pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize(
-+ pydict_set_item_string_decref(dict, "ev_name", _PyUnicode_FromString(perf_evsel__name(evsel)));
-+ pydict_set_item_string_decref(dict, "attr", _PyUnicode_FromStringAndSize(
- (const char *)&evsel->attr, sizeof(evsel->attr)));
-
- pydict_set_item_string_decref(dict_sample, "pid",
-- PyInt_FromLong(sample->pid));
-+ _PyLong_FromLong(sample->pid));
- pydict_set_item_string_decref(dict_sample, "tid",
-- PyInt_FromLong(sample->tid));
-+ _PyLong_FromLong(sample->tid));
- pydict_set_item_string_decref(dict_sample, "cpu",
-- PyInt_FromLong(sample->cpu));
-+ _PyLong_FromLong(sample->cpu));
- pydict_set_item_string_decref(dict_sample, "ip",
- PyLong_FromUnsignedLongLong(sample->ip));
- pydict_set_item_string_decref(dict_sample, "time",
-@@ -503,17 +533,17 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
- set_sample_read_in_dict(dict_sample, sample, evsel);
- pydict_set_item_string_decref(dict, "sample", dict_sample);
-
-- pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize(
-+ pydict_set_item_string_decref(dict, "raw_buf", _PyBytes_FromStringAndSize(
- (const char *)sample->raw_data, sample->raw_size));
- pydict_set_item_string_decref(dict, "comm",
-- PyString_FromString(thread__comm_str(al->thread)));
-+ _PyUnicode_FromString(thread__comm_str(al->thread)));
- if (al->map) {
- pydict_set_item_string_decref(dict, "dso",
-- PyString_FromString(al->map->dso->name));
-+ _PyUnicode_FromString(al->map->dso->name));
- }
- if (al->sym) {
- pydict_set_item_string_decref(dict, "symbol",
-- PyString_FromString(al->sym->name));
-+ _PyUnicode_FromString(al->sym->name));
- }
-
- pydict_set_item_string_decref(dict, "callchain", callchain);
-@@ -573,9 +603,9 @@ static void python_process_tracepoint(struct perf_sample *sample,
- scripting_context->event_data = data;
- scripting_context->pevent = evsel->tp_format->pevent;
-
-- context = PyCObject_FromVoidPtr(scripting_context, NULL);
-+ context = _PyCapsule_New(scripting_context, NULL, NULL);
-
-- PyTuple_SetItem(t, n++, PyString_FromString(handler_name));
-+ PyTuple_SetItem(t, n++, _PyUnicode_FromString(handler_name));
- PyTuple_SetItem(t, n++, context);
-
- /* ip unwinding */
-@@ -584,18 +614,18 @@ static void python_process_tracepoint(struct perf_sample *sample,
- Py_INCREF(callchain);
-
- if (!dict) {
-- PyTuple_SetItem(t, n++, PyInt_FromLong(cpu));
-- PyTuple_SetItem(t, n++, PyInt_FromLong(s));
-- PyTuple_SetItem(t, n++, PyInt_FromLong(ns));
-- PyTuple_SetItem(t, n++, PyInt_FromLong(pid));
-- PyTuple_SetItem(t, n++, PyString_FromString(comm));
-+ PyTuple_SetItem(t, n++, _PyLong_FromLong(cpu));
-+ PyTuple_SetItem(t, n++, _PyLong_FromLong(s));
-+ PyTuple_SetItem(t, n++, _PyLong_FromLong(ns));
-+ PyTuple_SetItem(t, n++, _PyLong_FromLong(pid));
-+ PyTuple_SetItem(t, n++, _PyUnicode_FromString(comm));
- PyTuple_SetItem(t, n++, callchain);
- } else {
-- pydict_set_item_string_decref(dict, "common_cpu", PyInt_FromLong(cpu));
-- pydict_set_item_string_decref(dict, "common_s", PyInt_FromLong(s));
-- pydict_set_item_string_decref(dict, "common_ns", PyInt_FromLong(ns));
-- pydict_set_item_string_decref(dict, "common_pid", PyInt_FromLong(pid));
-- pydict_set_item_string_decref(dict, "common_comm", PyString_FromString(comm));
-+ pydict_set_item_string_decref(dict, "common_cpu", _PyLong_FromLong(cpu));
-+ pydict_set_item_string_decref(dict, "common_s", _PyLong_FromLong(s));
-+ pydict_set_item_string_decref(dict, "common_ns", _PyLong_FromLong(ns));
-+ pydict_set_item_string_decref(dict, "common_pid", _PyLong_FromLong(pid));
-+ pydict_set_item_string_decref(dict, "common_comm", _PyUnicode_FromString(comm));
- pydict_set_item_string_decref(dict, "common_callchain", callchain);
- }
- for (field = event->format.fields; field; field = field->next) {
-@@ -614,7 +644,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
- }
- if (field->flags & FIELD_IS_STRING &&
- is_printable_array(data + offset, len)) {
-- obj = PyString_FromString((char *) data + offset);
-+ obj = _PyUnicode_FromString((char *) data + offset);
- } else {
- obj = PyByteArray_FromStringAndSize((const char *) data + offset, len);
- field->flags &= ~FIELD_IS_STRING;
-@@ -664,7 +694,7 @@ static PyObject *tuple_new(unsigned int sz)
- static int tuple_set_u64(PyObject *t, unsigned int pos, u64 val)
- {
- #if BITS_PER_LONG == 64
-- return PyTuple_SetItem(t, pos, PyInt_FromLong(val));
-+ return PyTuple_SetItem(t, pos, _PyLong_FromLong(val));
- #endif
- #if BITS_PER_LONG == 32
- return PyTuple_SetItem(t, pos, PyLong_FromLongLong(val));
-@@ -673,12 +703,12 @@ static int tuple_set_u64(PyObject *t, unsigned int pos, u64 val)
-
- static int tuple_set_s32(PyObject *t, unsigned int pos, s32 val)
- {
-- return PyTuple_SetItem(t, pos, PyInt_FromLong(val));
-+ return PyTuple_SetItem(t, pos, _PyLong_FromLong(val));
- }
-
- static int tuple_set_string(PyObject *t, unsigned int pos, const char *s)
- {
-- return PyTuple_SetItem(t, pos, PyString_FromString(s));
-+ return PyTuple_SetItem(t, pos, _PyUnicode_FromString(s));
- }
-
- static int python_export_evsel(struct db_export *dbe, struct perf_evsel *evsel)
-@@ -1024,8 +1054,8 @@ process_stat(struct perf_evsel *counter, int cpu, int thread, u64 tstamp,
- return;
- }
-
-- PyTuple_SetItem(t, n++, PyInt_FromLong(cpu));
-- PyTuple_SetItem(t, n++, PyInt_FromLong(thread));
-+ PyTuple_SetItem(t, n++, _PyLong_FromLong(cpu));
-+ PyTuple_SetItem(t, n++, _PyLong_FromLong(thread));
-
- tuple_set_u64(t, n++, tstamp);
- tuple_set_u64(t, n++, count->val);
-@@ -1207,27 +1237,58 @@ static void set_table_handlers(struct tables *tables)
- SET_TABLE_HANDLER(call_return);
- }
-
-+#if PY_MAJOR_VERSION < 3
-+static void _free_command_line(const char **command_line, int num)
-+{
-+ free(command_line);
-+}
-+#else
-+static void _free_command_line(wchar_t **command_line, int num)
-+{
-+ int i;
-+ for (i = 0; i < num; i++)
-+ PyMem_RawFree(command_line[i]);
-+ free(command_line);
-+}
-+#endif
-+
-+
- /*
- * Start trace script
- */
- static int python_start_script(const char *script, int argc, const char **argv)
- {
- struct tables *tables = &tables_global;
-+#if PY_MAJOR_VERSION < 3
- const char **command_line;
-+#else
-+ wchar_t **command_line;
-+#endif
- char buf[PATH_MAX];
- int i, err = 0;
- FILE *fp;
-
-+#if PY_MAJOR_VERSION < 3
- command_line = malloc((argc + 1) * sizeof(const char *));
- command_line[0] = script;
- for (i = 1; i < argc + 1; i++)
- command_line[i] = argv[i - 1];
-+#else
-+ command_line = malloc((argc + 1) * sizeof(wchar_t *));
-+ command_line[0] = Py_DecodeLocale(script, NULL);
-+ for (i = 1; i < argc + 1; i++)
-+ command_line[i] = Py_DecodeLocale(argv[i - 1], NULL);
-+#endif
-
- Py_Initialize();
-
-+#if PY_MAJOR_VERSION < 3
- initperf_trace_context();
--
- PySys_SetArgv(argc + 1, (char **)command_line);
-+#else
-+ PyInit_perf_trace_context();
-+ PySys_SetArgv(argc + 1, command_line);
-+#endif
-
- fp = fopen(script, "r");
- if (!fp) {
-@@ -1257,12 +1318,12 @@ static int python_start_script(const char *script, int argc, const char **argv)
- goto error;
- }
-
-- free(command_line);
-+ _free_command_line(command_line, argc + 1);
-
- return err;
- error:
- Py_Finalize();
-- free(command_line);
-+ _free_command_line(command_line, argc + 1);
-
- return err;
- }
-diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
-index 23f1bf175179..a5f9e236cc71 100644
---- a/tools/perf/util/setup.py
-+++ b/tools/perf/util/setup.py
-@@ -1,4 +1,4 @@
--#!/usr/bin/python2
-+#!/usr/bin/python
-
- from os import getenv
-
-@@ -37,11 +37,11 @@ build_tmp = getenv('PYTHON_EXTBUILD_TMP')
- libtraceevent = getenv('LIBTRACEEVENT')
- libapikfs = getenv('LIBAPI')
-
--ext_sources = [f.strip() for f in file('util/python-ext-sources')
-+ext_sources = [f.strip() for f in open('util/python-ext-sources')
- if len(f.strip()) > 0 and f[0] != '#']
-
- # use full paths with source files
--ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)
-+ext_sources = list(map(lambda x: '%s/%s' % (src_perf, x) , ext_sources))
-
- perf = Extension('perf',
- sources = ext_sources,
---
-2.20.1
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/apalis-t30-mainline/0033-apalis-t30-mainline-apply-pcie-fix-hacks.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/apalis-t30-mainline/0033-apalis-t30-mainline-apply-pcie-fix-hacks.patch
deleted file mode 100644
index d6539d0..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline-4.14/apalis-t30-mainline/0033-apalis-t30-mainline-apply-pcie-fix-hacks.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From f91b1e8680a93b6d33af3380e24bd2f9501c30c5 Mon Sep 17 00:00:00 2001
-Message-Id: <f91b1e8680a93b6d33af3380e24bd2f9501c30c5.1531317141.git.marcel.ziswiler@toradex.com>
-In-Reply-To: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-References: <6654e1bd342708a683daf47e7558455f709a3e7e.1531317141.git.marcel.ziswiler@toradex.com>
-From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-Date: Fri, 20 Apr 2018 10:07:58 +0200
-Subject: [PATCH 33/33] apalis-t30-mainline: apply pcie fix hacks
-
-Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
----
- drivers/pci/host/pci-tegra.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
-index 0e19ff52275e..ad7385525964 100644
---- a/drivers/pci/host/pci-tegra.c
-+++ b/drivers/pci/host/pci-tegra.c
-@@ -51,8 +51,8 @@
- #include <soc/tegra/cpuidle.h>
- #include <soc/tegra/pmc.h>
-
--//#define CONFIG_MACH_APALIS_T30
--#define CONFIG_MACH_APALIS_TK1
-+#define CONFIG_MACH_APALIS_T30
-+//#define CONFIG_MACH_APALIS_TK1
- #if defined(CONFIG_MACH_APALIS_T30) || defined(CONFIG_MACH_APALIS_TK1)
- #include <linux/gpio.h>
-
---
-2.14.4
-
diff --git a/recipes-kernel/linux/linux-toradex-mainline_4.14.bb b/recipes-kernel/linux/linux-toradex-mainline_4.14.bb
deleted file mode 100644
index 15f254b..0000000
--- a/recipes-kernel/linux/linux-toradex-mainline_4.14.bb
+++ /dev/null
@@ -1,99 +0,0 @@
-SUMMARY = "Linux Kernel for Toradex Apalis Tegra based modules"
-SECTION = "kernel"
-LICENSE = "GPLv2"
-
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux-toradex-mainline-4.14:"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
-
-inherit kernel siteinfo toradex-kernel-localversion
-
-# git hash not available since tarball from kernel.org is used
-SCMVERSION = "n"
-
-LINUX_VERSION ?= "4.14.168"
-
-PV = "${LINUX_VERSION}"
-S = "${WORKDIR}/linux-${PV}"
-GENERIC_PATCHES = " \
- file://0001-apalis-t30-tk1-mainline-customize-defconfig.patch \
- file://0002-apalis_t30-tk1-fix-pcie-clock-and-reset-not-conformi.patch \
- file://0003-igb-integrate-tools-only-device-support.patch \
- file://0004-apalis_t30-tk1-igb-no-nvm-and-Ethernet-MAC-address-h.patch \
- file://0005-mmc-tegra-apalis-tk1-hack-to-make-sd1-functional.patch \
- file://0006-apalis-colibri_t30-apalis-tk1-snapd-squashfs-configu.patch \
- file://0007-ARM-tegra-apalis-tk1-Support-v1.2-hardware-revision.patch \
- file://0008-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch \
- file://0009-drm-tegra-gem-Reshuffle-declarations.patch \
- file://0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch \
- file://0011-drm-tegra-fb-Implement-fb_mmap-callback.patch \
- file://0012-apalis-tk1-support-for-k20-mfd.patch \
- file://0013-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra30.patch \
- file://0014-usb-chipidea-tegra-Use-aligned-DMA-on-Tegra114-124.patch \
- file://0016-Revert-mmc-core-simplify-ida-handling.patch \
- file://0017-mmc-read-mmc-alias-from-device-tree.patch \
- file://0018-apalis-t30-mainline-force-fixed-ids-for-sdmmc-contro.patch \
- file://0019-ARM-tegra-apalis-tk1-Fix-high-speed-UART-compatible.patch \
- file://0020-apalis-t30-tk1-mainline-igb-avoid-nvm-checksum-failu.patch \
- file://0021-apalis_t30-fix-can2.patch \
- file://0022-mfd-as3722-disable-auto-power-on-when-AC-OK.patch \
- file://0023-apalis-tk1-mfd-k20-update-api-header-for-fw-version-.patch \
- file://0024-apalis_t30-enable-broken-hpi-on-emmc.patch \
- file://0027-apalis_t30-pull-up-sd-card-detect-pins.patch \
- file://0028-Revert-mmc-tegra-Disable-UHS-I-modes-for-Tegra124.patch \
- file://0029-mmc-tegra-fix-eMMC-DDR-mode.patch \
- file://0030-apalis-tk1-enable-ddr52-mode-on-emmc.patch \
- file://0031-apalis-tk1-force-fixed-ids-for-sdmmc-controllers.patch \
- file://0032-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch \
- file://0033-apalis-tk1-mfd-k20-supporte-for-fw-version-1.3.patch \
- file://0034-apalis-tk1-mfd-k20-update-supported-fw-version-to-1..patch \
- file://0035-perf-tools-Add-Python-3-support.patch \
- file://0001-perf-Make-perf-able-to-build-with-latest-libbfd.patch \
-"
-MACHINE_PATCHES = " \
-"
-MACHINE_PATCHES_apalis-t30-mainline = " \
- file://0033-apalis-t30-mainline-apply-pcie-fix-hacks.patch \
-"
-SRC_URI = " \
- https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${PV}.tar.xz \
- ${GENERIC_PATCHES} \
- ${MACHINE_PATCHES} \
-"
-SRC_URI[md5sum] = "e3447527902445b779f5eff66de5bc8c"
-SRC_URI[sha256sum] = "db5777d3a12a85bc8c130b7b250bab2283f9d964b725e5de3c216b495eeb31fe"
-
-# For CI use one could use the following instead (plus patches still of course)
-LINUX_VERSION_use-head-next ?= "4.14"
-SRCREV_use-head-next = "${AUTOREV}"
-PV_use-head-next = "${LINUX_VERSION}+git${SRCPV}"
-S_use-head-next = "${WORKDIR}/git"
-SRCBRANCH_use-head-next = "linux-4.14.y"
-SRC_URI_use-head-next = " \
- git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git;protocol=git;branch=${SRCBRANCH} \
- ${GENERIC_PATCHES} \
- ${MACHINE_PATCHES} \
-"
-
-COMPATIBLE_MACHINE = "(apalis-tk1-mainline|apalis-t30-mainline)"
-KERNEL_EXTRA_ARGS = " LOADADDR=0x80008000 "
-
-# One possibiltiy for changes to the defconfig:
-config_script () {
- echo "dummy" > /dev/null
-}
-
-do_configure_prepend () {
- cd ${S}
- export KBUILD_OUTPUT=${B}
- oe_runmake ${KERNEL_DEFCONFIG}
-
- #maybe change some configuration
- config_script
-
- cd - > /dev/null
-}
-
-do_uboot_mkimage_prepend() {
- cd ${B}
-}