Re: [OpenWrt-Devel] [PATCH 1/3] gemini: Add v5.4 kernel patches

2020-03-22 Thread Linus Walleij
On Sat, Mar 21, 2020 at 3:40 PM Christian Lamparter  wrote:

> I've made a RFC with a package for the drivetemp previously.
>
> 
>
> would this work as well?

Yups this looks good too.

I see you pushed the modified solution so I'll go and
test it, thanks a lot! :)

Yours,
Linus Walleij

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/3] gemini: Add v5.4 kernel patches

2020-03-21 Thread Christian Lamparter
On Saturday, 21 March 2020 14:05:53 CET Linus Walleij wrote:
> This adds the kernel patches needed for the Gemini.
> Just 7 patches, 5 of them are already upstream.
> 
> Notably we backport the patches to use the temperature
> sensor on the hard drive to drive temperature control
> of the NAS chassis. This is required for the DIR-685
> which has no external temperature sensor.
> 

I've made a RFC with a package for the drivetemp previously.



would this work as well?

Cheers,
Christian



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] gemini: Add v5.4 kernel patches

2020-03-21 Thread Linus Walleij
This adds the kernel patches needed for the Gemini.
Just 7 patches, 5 of them are already upstream.

Notably we backport the patches to use the temperature
sensor on the hard drive to drive temperature control
of the NAS chassis. This is required for the DIR-685
which has no external temperature sensor.

Signed-off-by: Linus Walleij 
---
 ...t-fotg2-add-Gemini-specific-handling.patch | 131 
 ...-DIR-685-partition-table-for-OpenWrt.patch |  37 +
 ...0003-ARM-dts-gemini-Rename-IDE-nodes.patch | 117 +++
 ...s-gemini-Add-thermal-zone-to-DIR-685.patch | 101 +++
 ...ta-Assign-OF-node-to-the-SCSI-device.patch |  86 ++
 ...sfs-attributes-for-VPD-pages-0h-and-.patch | 122 +++
 ...-disk-and-solid-state-drives-with-te.patch | 737 ++
 7 files changed, 1331 insertions(+)
 create mode 100644 
target/linux/gemini/patches-5.4/0001-usb-host-fotg2-add-Gemini-specific-handling.patch
 create mode 100644 
target/linux/gemini/patches-5.4/0002-ARM-dts-Augment-DIR-685-partition-table-for-OpenWrt.patch
 create mode 100644 
target/linux/gemini/patches-5.4/0003-ARM-dts-gemini-Rename-IDE-nodes.patch
 create mode 100644 
target/linux/gemini/patches-5.4/0004-ARM-dts-gemini-Add-thermal-zone-to-DIR-685.patch
 create mode 100644 
target/linux/gemini/patches-5.4/0005-libata-Assign-OF-node-to-the-SCSI-device.patch
 create mode 100644 
target/linux/gemini/patches-5.4/0006-scsi-core-Add-sysfs-attributes-for-VPD-pages-0h-and-.patch
 create mode 100644 
target/linux/gemini/patches-5.4/0007-hwmon-Driver-for-disk-and-solid-state-drives-with-te.patch

diff --git 
a/target/linux/gemini/patches-5.4/0001-usb-host-fotg2-add-Gemini-specific-handling.patch
 
b/target/linux/gemini/patches-5.4/0001-usb-host-fotg2-add-Gemini-specific-handling.patch
new file mode 100644
index ..4a6a804ca4fa
--- /dev/null
+++ 
b/target/linux/gemini/patches-5.4/0001-usb-host-fotg2-add-Gemini-specific-handling.patch
@@ -0,0 +1,131 @@
+From 3aaff88a0f5e154aa5a489d59fd4015a2a937c23 Mon Sep 17 00:00:00 2001
+From: Linus Walleij 
+Date: Fri, 21 Apr 2017 22:19:00 +0200
+Subject: [PATCH 1/7] usb: host: fotg2: add Gemini-specific handling
+
+The Cortina Systems Gemini has bolted on a PHY inside the
+silicon that can be handled by six bits in a MISC register in
+the system controller.
+
+If we are running on Gemini, look up a syscon regmap through
+a phandle and enable VBUS and optionally the Mini-B connector.
+
+If the device is flagged as "wakeup-source" using the standard
+DT bindings, we also enable this in the global controller for
+respective port.
+
+Signed-off-by: Linus Walleij 
+---
+ drivers/usb/host/Kconfig   |  1 +
+ drivers/usb/host/fotg210-hcd.c | 76 ++
+ 2 files changed, 77 insertions(+)
+
+--- a/drivers/usb/host/Kconfig
 b/drivers/usb/host/Kconfig
+@@ -363,6 +363,7 @@ config USB_ISP1362_HCD
+ config USB_FOTG210_HCD
+   tristate "FOTG210 HCD support"
+   depends on USB && HAS_DMA && HAS_IOMEM
++  select MFD_SYSCON
+   ---help---
+ Faraday FOTG210 is an OTG controller which can be configured as
+ an USB2.0 host. It is designed to meet USB2.0 EHCI specification
+--- a/drivers/usb/host/fotg210-hcd.c
 b/drivers/usb/host/fotg210-hcd.c
+@@ -33,6 +33,10 @@
+ #include 
+ #include 
+ #include 
++#include 
++/* For Cortina Gemini */
++#include 
++#include 
+ 
+ #include 
+ #include 
+@@ -5558,6 +5562,72 @@ static void fotg210_init(struct fotg210_
+   iowrite32(value, &fotg210->regs->otgcsr);
+ }
+ 
++/*
++ * Gemini-specific initialization function, only executed on the
++ * Gemini SoC using the global misc control register.
++ */
++#define GEMINI_GLOBAL_MISC_CTRL   0x30
++#define GEMINI_MISC_USB0_WAKEUP   BIT(14)
++#define GEMINI_MISC_USB1_WAKEUP   BIT(15)
++#define GEMINI_MISC_USB0_VBUS_ON  BIT(22)
++#define GEMINI_MISC_USB1_VBUS_ON  BIT(23)
++#define GEMINI_MISC_USB0_MINI_B   BIT(29)
++#define GEMINI_MISC_USB1_MINI_B   BIT(30)
++
++static int fotg210_gemini_init(struct device *dev, struct usb_hcd *hcd)
++{
++  struct device_node *np = dev->of_node;
++  struct regmap *map;
++  bool mini_b;
++  bool wakeup;
++  u32 mask, val;
++  int ret;
++
++  map = syscon_regmap_lookup_by_phandle(np, "syscon");
++  if (IS_ERR(map)) {
++  dev_err(dev, "no syscon\n");
++  return PTR_ERR(map);
++  }
++  mini_b = of_property_read_bool(np, "cortina,gemini-mini-b");
++  wakeup = of_property_read_bool(np, "wakeup-source");
++
++  /*
++   * Figure out if this is USB0 or USB1 by simply checking the
++   * physical base address.
++   */
++  mask = 0;
++  if (hcd->rsrc_start == 0x6900) {
++  val = GEMINI_MISC_USB1_VBUS_ON;
++  if (mini_b)
++  val |= GEMINI_MISC_USB1_MINI_B;
++  else
++  mask |= GEMINI_MISC_USB1_MINI_B;
++  if (wakeup)
++