linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3
@ 2021-07-29 14:41 Linus Walleij
  2021-07-29 15:43 ` Andrew Lunn
  2021-08-01 13:22 ` Marc Zyngier
  0 siblings, 2 replies; 8+ messages in thread
From: Linus Walleij @ 2021-07-29 14:41 UTC (permalink / raw)
  To: linux-arm-kernel, Imre Kaloz, Krzysztof Halasa
  Cc: Linus Walleij, Rod Whitby, Marc Zyngier

This adds a devicetree for the Freecom FSG-3, a combined router
and NAS.

Cc: Rod Whitby <rod@whitby.id.au>
Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/boot/dts/Makefile                    |   1 +
 .../boot/dts/intel-ixp42x-freecom-fsg-3.dts   | 158 ++++++++++++++++++
 2 files changed, 159 insertions(+)
 create mode 100644 arch/arm/boot/dts/intel-ixp42x-freecom-fsg-3.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index c01a8f55892f..9bad559ba9a2 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -242,6 +242,7 @@ dtb-$(CONFIG_ARCH_INTEGRATOR) += \
 dtb-$(CONFIG_ARCH_IXP4XX) += \
 	intel-ixp42x-linksys-nslu2.dtb \
 	intel-ixp42x-linksys-wrv54g.dtb \
+	intel-ixp42x-freecom-fsg-3.dtb \
 	intel-ixp42x-welltech-epbx100.dtb \
 	intel-ixp42x-ixdp425.dtb \
 	intel-ixp43x-kixrp435.dtb \
diff --git a/arch/arm/boot/dts/intel-ixp42x-freecom-fsg-3.dts b/arch/arm/boot/dts/intel-ixp42x-freecom-fsg-3.dts
new file mode 100644
index 000000000000..77e78c6dc2cd
--- /dev/null
+++ b/arch/arm/boot/dts/intel-ixp42x-freecom-fsg-3.dts
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for the Freecom FSG-3 router.
+ * This machine is based on IXP425.
+ * This device tree is inspired by the board file by Rod Whitby.
+ */
+
+/dts-v1/;
+
+#include "intel-ixp42x.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Freecom FSG-3";
+	compatible = "freecom,fsg-3", "intel,ixp42x";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	memory@0 {
+		/* 64 MB memory */
+		device_type = "memory";
+		reg = <0x00000000 0x4000000>;
+	};
+
+	chosen {
+		/* Boot from the first partition on the hard drive */
+		bootargs = "console=ttyS0,115200n8 root=/dev/sda1 rw rootfstype=ext4 rootwait";
+		stdout-path = "uart0:115200n8";
+	};
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+
+		button-sync {
+			wakeup-source;
+			/* Closest approximation of what the key should do */
+			linux,code = <KEY_CONNECT>;
+			label = "sync";
+			gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
+		};
+		button-reset {
+			wakeup-source;
+			linux,code = <KEY_ESC>;
+			label = "reset";
+			gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
+		};
+		button-usb {
+			wakeup-source;
+			/* Unplug USB, closest approximation of what the key should do */
+			linux,code = <KEY_EJECTCD>;
+			label = "usb";
+			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	i2c {
+		compatible = "i2c-gpio";
+		sda-gpios = <&gpio0 12 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+		scl-gpios = <&gpio0 13 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		hwmon@28 {
+			/*
+			 * Temperature sensor and fan control chip.
+			 *
+			 * TODO: create a proper device tree binding for
+			 * the sensor and temperature zone and create a
+			 * zone with fan control.
+			 */
+			compatible = "winbond,w83781d";
+			reg = <0x28>;
+		};
+		rtc@6f {
+			compatible = "isil,isl1208";
+			reg = <0x6f>;
+		};
+	};
+
+	soc {
+		bus@c4000000 {
+			flash@0,0 {
+				compatible = "intel,ixp4xx-flash", "cfi-flash";
+				bank-width = <2>;
+				/* Enable writes on the expansion bus */
+				intel,ixp4xx-eb-write-enable = <1>;
+				/* 4 MB of Flash mapped in at CS0 */
+				reg = <0 0x00000000 0x400000>;
+
+				partitions {
+					compatible = "redboot-fis";
+					/* Eraseblock at 0x3e0000 */
+					fis-index-block = <0x1f>;
+				};
+			};
+		};
+
+		pci@c0000000 {
+			status = "ok";
+
+			/*
+			 * Written based on the FSG-3 PCI boardfile.
+			 * We have slots 12, 13 & 14 (IDSEL) with one IRQ each.
+			 */
+			interrupt-map =
+			/* IDSEL 12 */
+			<0x6000 0 0 1 &gpio0 5 IRQ_TYPE_LEVEL_LOW>, /* INT A on slot 12 is irq 5 */
+			<0x6000 0 0 2 &gpio0 5 IRQ_TYPE_LEVEL_LOW>, /* INT B on slot 12 is irq 5 */
+			<0x6000 0 0 3 &gpio0 5 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 12 is irq 5 */
+			<0x6000 0 0 4 &gpio0 5 IRQ_TYPE_LEVEL_LOW>, /* INT D on slot 12 is irq 5 */
+			/* IDSEL 13 */
+			<0x6800 0 0 1 &gpio0 7 IRQ_TYPE_LEVEL_LOW>, /* INT A on slot 13 is irq 7 */
+			<0x6800 0 0 2 &gpio0 7 IRQ_TYPE_LEVEL_LOW>, /* INT B on slot 13 is irq 7 */
+			<0x6800 0 0 3 &gpio0 7 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 13 is irq 7 */
+			<0x6800 0 0 4 &gpio0 7 IRQ_TYPE_LEVEL_LOW>, /* INT D on slot 13 is irq 7 */
+			/* IDSEL 14 */
+			<0x7000 0 0 1 &gpio0 6 IRQ_TYPE_LEVEL_LOW>, /* INT A on slot 14 is irq 6 */
+			<0x7000 0 0 2 &gpio0 6 IRQ_TYPE_LEVEL_LOW>, /* INT B on slot 14 is irq 6 */
+			<0x7000 0 0 3 &gpio0 6 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 14 is irq 6 */
+			<0x7000 0 0 4 &gpio0 6 IRQ_TYPE_LEVEL_LOW>; /* INT D on slot 14 is irq 6 */
+		};
+
+		/* EthB */
+		ethernet@c8009000 {
+			status = "ok";
+			queue-rx = <&qmgr 3>;
+			queue-txready = <&qmgr 20>;
+			phy-mode = "rgmii";
+			phy-handle = <&phy5>;
+
+			mdio {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				phy4: ethernet-phy@4 {
+					reg = <4>;
+				};
+
+				phy5: ethernet-phy@5 {
+					reg = <5>;
+				};
+			};
+		};
+
+		/* EthC */
+		ethernet@c800a000 {
+			status = "ok";
+			queue-rx = <&qmgr 4>;
+			queue-txready = <&qmgr 21>;
+			phy-mode = "rgmii";
+			phy-handle = <&phy4>;
+		};
+	};
+};
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3
  2021-07-29 14:41 [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3 Linus Walleij
@ 2021-07-29 15:43 ` Andrew Lunn
  2021-07-30 12:21   ` Linus Walleij
  2021-08-01 13:22 ` Marc Zyngier
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2021-07-29 15:43 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Imre Kaloz, Krzysztof Halasa, Rod Whitby, Marc Zyngier

> +		/* EthB */
> +		ethernet@c8009000 {
> +			status = "ok";
> +			queue-rx = <&qmgr 3>;
> +			queue-txready = <&qmgr 20>;
> +			phy-mode = "rgmii";
> +			phy-handle = <&phy5>;
> +
> +			mdio {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				phy4: ethernet-phy@4 {
> +					reg = <4>;
> +				};
> +
> +				phy5: ethernet-phy@5 {
> +					reg = <5>;
> +				};
> +			};
> +		};
> +
> +		/* EthC */
> +		ethernet@c800a000 {
> +			status = "ok";
> +			queue-rx = <&qmgr 4>;
> +			queue-txready = <&qmgr 21>;
> +			phy-mode = "rgmii";
> +			phy-handle = <&phy4>;
> +		};

https://usermanual.wiki/Freecom-Technologies/FreecomTechnologiesFsg3UsersManual552148.1686484831/view

This appears to also have an Ethernet switch. So is suspect this is
also wrong in the same way.

     Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3
  2021-07-29 15:43 ` Andrew Lunn
@ 2021-07-30 12:21   ` Linus Walleij
  2021-07-30 12:33     ` Marc Zyngier
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2021-07-30 12:21 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Linux ARM, Imre Kaloz, Krzysztof Halasa, Rod Whitby, Marc Zyngier

On Thu, Jul 29, 2021 at 5:43 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> > +             /* EthB */
> > +             ethernet@c8009000 {
(...)
> https://usermanual.wiki/Freecom-Technologies/FreecomTechnologiesFsg3UsersManual552148.1686484831/view
>
> This appears to also have an Ethernet switch. So is suspect this is
> also wrong in the same way.

In this case I am literally translating the existing board file:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mach-ixp4xx/fsg-setup.c

It appears to have been working for years, I strongly suspect that
the switch operates fine due to boot-time default set-up, and when
we start using this phy the static configuration of the switch will
deal with the switching.

Marc has this device and seemed to be merrily poking at it to
install a UART so if he gets it running he could confirm if the
switch works out of the box like this.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3
  2021-07-30 12:21   ` Linus Walleij
@ 2021-07-30 12:33     ` Marc Zyngier
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Zyngier @ 2021-07-30 12:33 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andrew Lunn, Linux ARM, Imre Kaloz, Krzysztof Halasa, Rod Whitby

On Fri, 30 Jul 2021 13:21:40 +0100,
Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> On Thu, Jul 29, 2021 at 5:43 PM Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > > +             /* EthB */
> > > +             ethernet@c8009000 {
> (...)
> > https://usermanual.wiki/Freecom-Technologies/FreecomTechnologiesFsg3UsersManual552148.1686484831/view
> >
> > This appears to also have an Ethernet switch. So is suspect this is
> > also wrong in the same way.
> 
> In this case I am literally translating the existing board file:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mach-ixp4xx/fsg-setup.c
> 
> It appears to have been working for years, I strongly suspect that
> the switch operates fine due to boot-time default set-up, and when
> we start using this phy the static configuration of the switch will
> deal with the switching.
> 
> Marc has this device and seemed to be merrily poking at it to
> install a UART so if he gets it running he could confirm if the
> switch works out of the box like this.

Yup, I'll have a look at it once I've cleared out my Inbox, which is
massively overflowing. Hopefully the machine has survived over 15
years being moved around in a box containing all sort of other junk.

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3
  2021-07-29 14:41 [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3 Linus Walleij
  2021-07-29 15:43 ` Andrew Lunn
@ 2021-08-01 13:22 ` Marc Zyngier
  2021-08-01 13:55   ` Andrew Lunn
  1 sibling, 1 reply; 8+ messages in thread
From: Marc Zyngier @ 2021-08-01 13:22 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-arm-kernel, Imre Kaloz, Krzysztof Halasa, Rod Whitby

On Thu, 29 Jul 2021 15:41:28 +0100,
Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> This adds a devicetree for the Freecom FSG-3, a combined router
> and NAS.

After a bit of soldering as well as fighting with the bootloader
(which is so broken that it makes the Vulcan's version of RedBoot look
pretty sane in comparison), I've managed to successfully boot the
machine to userspace.

Networking, PCI, USB, ATA (to some extent, see below), RTC and hwmon
all see to work correctly. The switch works *sometimes*, but I haven't
worked out whether it needs some special care or it is broken.

One thing that still puzzles me is that I can't manage to get the SCSI
layer to probe the disk. The original firmware finds it perfectly, but
I'm obviously failing to select the right config option that would
make the PATA controller (which gets probed) to register as a SCSI
target:

[the PCI device is seen correctly]

pci 0000:00:0c.0: [1106:3249] type 00 class 0x010400
pci 0000:00:0c.0: reg 0x10: [io  0x0af0-0x0aff]
pci 0000:00:0c.0: reg 0x14: [io  0x0a70-0x0a7f]
pci 0000:00:0c.0: reg 0x18: [io  0x01f0-0x01ff]
pci 0000:00:0c.0: reg 0x1c: [io  0x0170-0x017f]
pci 0000:00:0c.0: reg 0x20: [io  0xcc00-0xcc1f]
pci 0000:00:0c.0: reg 0x24: [io  0x8c00-0x8cff]

[and the driver picks it up, correctly seeing the 3 ports]

sata_via 0000:00:0c.0: version 2.6
sata_via 0000:00:0c.0: enabling device (0000 -> 0001)
sata_via 0000:00:0c.0: routed to hard irq line 8
scsi host0: sata_via
scsi host1: sata_via
scsi host2: sata_via
ata1: SATA max UDMA/133 port i16@0x1420 bmdma 0x1400 irq 24
ata2: SATA max UDMA/133 port i16@0x1430 bmdma 0x1408 irq 24
ata3: PATA max UDMA/133 port i16@0x1440 bmdma 0x1410 irq 24

[it then realises that there is nothing on the SATA ports]

ata1: failed to resume link (SControl 0)
ata1: SATA link down (SStatus 10 SControl 0)
ata2: failed to resume link (SControl 302)
ata2: SATA link down (SStatus 2A2F SControl 302)

but ata3, which has the internal disk, never gets scanned.

If feels that this is only a matter of plumbing, but I'm out of my
depth here. Any idea?

Anyway, FWIW:

Acked-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3
  2021-08-01 13:22 ` Marc Zyngier
@ 2021-08-01 13:55   ` Andrew Lunn
  2021-08-01 18:59     ` Marc Zyngier
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2021-08-01 13:55 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Linus Walleij, linux-arm-kernel, Imre Kaloz, Krzysztof Halasa,
	Rod Whitby

On Sun, Aug 01, 2021 at 02:22:21PM +0100, Marc Zyngier wrote:

> The switch works *sometimes*, but I haven't
> worked out whether it needs some special care or it is broken.

Hi Marc

The driver exports the file "registers" in /sysfs. Do you see any sort
of application/driver running in userspace which might be talking to
the switch?

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3
  2021-08-01 13:55   ` Andrew Lunn
@ 2021-08-01 18:59     ` Marc Zyngier
  2021-08-02 22:05       ` Linus Walleij
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Zyngier @ 2021-08-01 18:59 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Linus Walleij, linux-arm-kernel, Imre Kaloz, Krzysztof Halasa,
	Rod Whitby

Hi Andrew,

On Sun, 01 Aug 2021 14:55:28 +0100,
Andrew Lunn <andrew@lunn.ch> wrote:
> 
> On Sun, Aug 01, 2021 at 02:22:21PM +0100, Marc Zyngier wrote:
> 
> > The switch works *sometimes*, but I haven't
> > worked out whether it needs some special care or it is broken.
> 
> Hi Marc
> 
> The driver exports the file "registers" in /sysfs. Do you see any sort
> of application/driver running in userspace which might be talking to
> the switch?

Hmmm. Which driver? I don't see any switch-related driver, nor any
userspace (what I have is an extremely minimal OpenWRT userspace that
has hardly more than busybox).

This is all I see:

root@OpenWrt:/# find /sys -name registers
/sys/kernel/debug/usb/ohci/0000:00:0e.1/registers
/sys/kernel/debug/usb/ohci/0000:00:0e.0/registers
/sys/kernel/debug/regmap/dummy-bus@c4000000/registers

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3
  2021-08-01 18:59     ` Marc Zyngier
@ 2021-08-02 22:05       ` Linus Walleij
  0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2021-08-02 22:05 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Andrew Lunn, Linux ARM, Imre Kaloz, Krzysztof Halasa, Rod Whitby

On Sun, Aug 1, 2021 at 8:59 PM Marc Zyngier <maz@kernel.org> wrote:
> Andrew Lunn <andrew@lunn.ch> wrote:

> > The driver exports the file "registers" in /sysfs. Do you see any sort
> > of application/driver running in userspace which might be talking to
> > the switch?
>
> Hmmm. Which driver? I don't see any switch-related driver, nor any
> userspace (what I have is an extremely minimal OpenWRT userspace that
> has hardly more than busybox).

I think Andrew is referring to CONFIG_MICREL_KS8995MA
drivers/net/phy/spi_ks8995.c (previously a Kendin product).
http://ww1.microchip.com/downloads/en/DeviceDoc/ks8995ma.pdf

We are guessing the FSG-3 has this switch.

Unfortunately we don't know which pins it is connected to,
but it is an SPI device. Should look like this:

+       spi {
+               compatible = "spi-gpio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               sck-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
+               miso-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+               mosi-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
+               cs-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
+               num-chipselects = <1>;
+
+               switch@0 {
+                       compatible = "micrel,ks8995";
+                       reg = <0>;
+                       spi-max-frequency = <50000000>;
+               };
+       };

Maybe you can see which pins it is using in the original firmware?

It may be completely unconnected as it can also be configured from
a companion EEPROM with no interaction from the host.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-02 22:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 14:41 [PATCH] ARM: dts: ixp4xx: Add a devicetree for Freecom FSG-3 Linus Walleij
2021-07-29 15:43 ` Andrew Lunn
2021-07-30 12:21   ` Linus Walleij
2021-07-30 12:33     ` Marc Zyngier
2021-08-01 13:22 ` Marc Zyngier
2021-08-01 13:55   ` Andrew Lunn
2021-08-01 18:59     ` Marc Zyngier
2021-08-02 22:05       ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).