Skip to contentSkip to conversation

Conversion of ARMv4 Gemini to DT and multiplatform

PATCH Applied Linus Walleij 4 participants 13 messages Jan 22, 2017 – Feb 13, 2017

lore
Share & tools
lore
#0 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

I got a Gemini platform from Florian Fainelli over at OpenWRT some time back. I finally got around to "future-proofing" the platform, which was the idea when he paintakingly sent the box over to me.

This is the result: Gemini is converted to device tree and multiplatform, all existing drivers are rewritten into their proper subsystems and the old board-specific and machine-specific code is deleted.

I would ideally like the irqchip, clocksource, gpio, rtc and MTD patches (and bindings) to simply be merged into the respective subsystem and the remaining ARM/ARM SoC patches funnelled to the ARM SoC tree in a single pull request, lock stock and barrel, with changes to board files and DTS additions in one go. But I guess I could also switch the DTS files to a separate branch.

The OpenWRT tree still have a whole bunch of significant out-of tree drivers:

- Watchdog
- GMAC (ethernet)
- FOT2G USB EHCI host
- PATA
- PCI

But I do not see any big obstacle in porting these over to be probed from the device tree and upstreamed on top of this patch series. I might tinker with it if I get time.

The out-of-tree code can be found here:
http://git.openwrt.org/?p=openwrt.git;a=tree;f=target/linux/gemini;h=b74c3d8f0100e2ac8a4d71c4d23c082db2993e63;hb=HEAD

Linus Walleij (22):
ARM: gemini: convert to MULTI_IRQ_HANDLER
irqchip: DT bindings for Cortina Gemini irqchip
irqchip: add a driver for Cortina Gemini
clocksource: add DT bindings for Cortina Gemini
clocksource: Add driver for the Cortina Gemini
gpio: add DT bindings for Cortina Gemini GPIO
gpio: Add a driver for Cortina Systems Gemini GPIO
rtc: Add device tree probing to the Gemini driver
mtd: add DT bindings for the Cortina Systems Gemini Flash
mtd: physmap_of: add a hook for Gemini flash probing
ARM: dts: add top-level DT bindings for Cortina Gemini
ARM: gemini: DT for the Cortina Gemini SoC platforms
ARM: dts: add device tree for Gemini SoC and SQ201
ARM: dts: add a devicetree for Raidsonic NAS IB-4220-B
ARM: dts: add a devicetree for Teltonika RUT1xx
ARM: dts: add a devicetree for Wiliboard WBD-111
ARM: dts: add a devicetree for Wiliboard WBD-222
ARM: gemini: delete all boardfiles
ARM: gemini: switch to sparse IRQs
ARM: gemini: select ARM_PATCH_PHYS_VIRT and AUTO_ZRELADDR
ARM: gemini: convert to ARMv4 multiplatform
ARM: configs: add a gemini defconfig

 Documentation/devicetree/bindings/arm/gemini.txt   |  58 +++++
 .../bindings/gpio/cortina,gemini-gpio.txt          |  24 ++
 .../cortina,gemini-interrupt-controller.txt        |  22 ++
 .../bindings/mtd/cortina,gemini-flash.txt          |  24 ++
 .../devicetree/bindings/rtc/cortina,gemini.txt     |  14 ++
 .../bindings/timer/cortina,gemini-timer.txt        |  22 ++
 arch/arm/Kconfig                                   |   9 -
 arch/arm/boot/dts/Makefile                         |   6 +
 arch/arm/boot/dts/gemini-nas4220b.dts              |  68 +++++
 arch/arm/boot/dts/gemini-rut1xx.dts                |  63 +++++
 arch/arm/boot/dts/gemini-sq201.dts                 |  94 +++++++
 arch/arm/boot/dts/gemini-wbd111.dts                | 101 ++++++++
 arch/arm/boot/dts/gemini-wbd222.dts                | 101 ++++++++
 arch/arm/boot/dts/gemini.dtsi                      |  96 +++++++
 arch/arm/configs/gemini_defconfig                  |  63 +++++
 arch/arm/mach-gemini/Kconfig                       |  52 +---
 arch/arm/mach-gemini/Makefile                      |  15 +-
 arch/arm/mach-gemini/Makefile.boot                 |   9 -
 arch/arm/mach-gemini/board-dt.c                    |  62 +++++
 arch/arm/mach-gemini/board-nas4220b.c              | 106 --------
 arch/arm/mach-gemini/board-rut1xx.c                |  92 -------
 arch/arm/mach-gemini/board-wbd111.c                | 133 ----------
 arch/arm/mach-gemini/board-wbd222.c                | 133 ----------
 arch/arm/mach-gemini/common.h                      |  33 ---
 arch/arm/mach-gemini/devices.c                     | 118 ---------
 arch/arm/mach-gemini/gpio.c                        | 231 -----------------
 arch/arm/mach-gemini/idle.c                        |  31 ---
 arch/arm/mach-gemini/include/mach/entry-macro.S    |  33 ---
 arch/arm/mach-gemini/include/mach/global_reg.h     | 278 ---------------------
 arch/arm/mach-gemini/include/mach/hardware.h       |  71 ------
 arch/arm/mach-gemini/include/mach/irqs.h           |  53 ----
 arch/arm/mach-gemini/include/mach/uncompress.h     |  42 ----
 arch/arm/mach-gemini/irq.c                         | 105 --------
 arch/arm/mach-gemini/mm.c                          |  82 ------
 arch/arm/mach-gemini/reset.c                       |  25 --
 drivers/clocksource/Kconfig                        |  10 +
 drivers/clocksource/Makefile                       |   1 +
 .../time.c => drivers/clocksource/timer-gemini.c   | 168 ++++++++-----
 drivers/gpio/Kconfig                               |   9 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-gemini.c                         | 236 +++++++++++++++++
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-gemini.c                       | 190 ++++++++++++++
 drivers/mtd/maps/Kconfig                           |  10 +
 drivers/mtd/maps/Makefile                          |   3 +
 drivers/mtd/maps/physmap_of.c                      |   9 +-
 drivers/mtd/maps/physmap_of_gemini.c               | 120 +++++++++
 drivers/mtd/maps/physmap_of_gemini.h               |  16 ++
 drivers/rtc/rtc-gemini.c                           |   7 +
 49 files changed, 1545 insertions(+), 1705 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/gemini.txt
 create mode 100644 Documentation/devicetree/bindings/gpio/cortina,gemini-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/cortina,gemini-interrupt-controller.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/cortina,gemini-flash.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/cortina,gemini.txt
 create mode 100644 Documentation/devicetree/bindings/timer/cortina,gemini-timer.txt
 create mode 100644 arch/arm/boot/dts/gemini-nas4220b.dts
 create mode 100644 arch/arm/boot/dts/gemini-rut1xx.dts
 create mode 100644 arch/arm/boot/dts/gemini-sq201.dts
 create mode 100644 arch/arm/boot/dts/gemini-wbd111.dts
 create mode 100644 arch/arm/boot/dts/gemini-wbd222.dts
 create mode 100644 arch/arm/boot/dts/gemini.dtsi
 create mode 100644 arch/arm/configs/gemini_defconfig
 delete mode 100644 arch/arm/mach-gemini/Makefile.boot
 create mode 100644 arch/arm/mach-gemini/board-dt.c
 delete mode 100644 arch/arm/mach-gemini/board-nas4220b.c
 delete mode 100644 arch/arm/mach-gemini/board-rut1xx.c
 delete mode 100644 arch/arm/mach-gemini/board-wbd111.c
 delete mode 100644 arch/arm/mach-gemini/board-wbd222.c
 delete mode 100644 arch/arm/mach-gemini/common.h
 delete mode 100644 arch/arm/mach-gemini/devices.c
 delete mode 100644 arch/arm/mach-gemini/gpio.c
 delete mode 100644 arch/arm/mach-gemini/idle.c
 delete mode 100644 arch/arm/mach-gemini/include/mach/entry-macro.S
 delete mode 100644 arch/arm/mach-gemini/include/mach/global_reg.h
 delete mode 100644 arch/arm/mach-gemini/include/mach/hardware.h
 delete mode 100644 arch/arm/mach-gemini/include/mach/irqs.h
 delete mode 100644 arch/arm/mach-gemini/include/mach/uncompress.h
 delete mode 100644 arch/arm/mach-gemini/irq.c
 delete mode 100644 arch/arm/mach-gemini/mm.c
 delete mode 100644 arch/arm/mach-gemini/reset.c
 rename arch/arm/mach-gemini/time.c => drivers/clocksource/timer-gemini.c (55%)
 create mode 100644 drivers/gpio/gpio-gemini.c
 create mode 100644 drivers/irqchip/irq-gemini.c
 create mode 100644 drivers/mtd/maps/physmap_of_gemini.c
 create mode 100644 drivers/mtd/maps/physmap_of_gemini.h
Signature · 1 line
2.9.3
#1 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Quoted 4 lines · Linus Walleij

I got a Gemini platform from Florian Fainelli over at OpenWRT some time back. I finally got around to "future-proofing" the platform, which was the idea when he paintakingly sent the box over to me.

I would have happily tested that series ;) thanks a lot for making it happen!

Quoted 13 lines

This is the result: Gemini is converted to device tree and multiplatform, all existing drivers are rewritten into their proper subsystems and the old board-specific and machine-specific code is deleted.

I would ideally like the irqchip, clocksource, gpio, rtc and MTD patches (and bindings) to simply be merged into the respective subsystem and the remaining ARM/ARM SoC patches funnelled to the ARM SoC tree in a single pull request, lock stock and barrel, with changes to board files and DTS additions in one go. But I guess I could also switch the DTS files to a separate branch.

Quoted 5 lines

The OpenWRT tree still have a whole bunch of significant out-of tree drivers:

- Watchdog
- GMAC (ethernet)

Been wondering about the GMAC driver a little bit, and it does not appear to be neither a Synopsys/Designware core (although not 100% sure), nor the ftgmac100 either.

This submission does appear to be in a good shape:
https://lwn.net/Articles/437889/

Quoted 122 lines

- FOT2G USB EHCI host
- PATA
- PCI

But I do not see any big obstacle in porting these over to be probed from the device tree and upstreamed on top of this patch series. I might tinker with it if I get time.

The out-of-tree code can be found here:
http://git.openwrt.org/?p=openwrt.git;a=tree;f=target/linux/gemini;h=b74c3d8f0100e2ac8a4d71c4d23c082db2993e63;hb=HEAD

Linus Walleij (22):
ARM: gemini: convert to MULTI_IRQ_HANDLER
irqchip: DT bindings for Cortina Gemini irqchip
irqchip: add a driver for Cortina Gemini
clocksource: add DT bindings for Cortina Gemini
clocksource: Add driver for the Cortina Gemini
gpio: add DT bindings for Cortina Gemini GPIO
gpio: Add a driver for Cortina Systems Gemini GPIO
rtc: Add device tree probing to the Gemini driver
mtd: add DT bindings for the Cortina Systems Gemini Flash
mtd: physmap_of: add a hook for Gemini flash probing
ARM: dts: add top-level DT bindings for Cortina Gemini
ARM: gemini: DT for the Cortina Gemini SoC platforms
ARM: dts: add device tree for Gemini SoC and SQ201
ARM: dts: add a devicetree for Raidsonic NAS IB-4220-B
ARM: dts: add a devicetree for Teltonika RUT1xx
ARM: dts: add a devicetree for Wiliboard WBD-111
ARM: dts: add a devicetree for Wiliboard WBD-222
ARM: gemini: delete all boardfiles
ARM: gemini: switch to sparse IRQs
ARM: gemini: select ARM_PATCH_PHYS_VIRT and AUTO_ZRELADDR
ARM: gemini: convert to ARMv4 multiplatform
ARM: configs: add a gemini defconfig

 Documentation/devicetree/bindings/arm/gemini.txt   |  58 +++++
 .../bindings/gpio/cortina,gemini-gpio.txt          |  24 ++
 .../cortina,gemini-interrupt-controller.txt        |  22 ++
 .../bindings/mtd/cortina,gemini-flash.txt          |  24 ++
 .../devicetree/bindings/rtc/cortina,gemini.txt     |  14 ++
 .../bindings/timer/cortina,gemini-timer.txt        |  22 ++
 arch/arm/Kconfig                                   |   9 -
 arch/arm/boot/dts/Makefile                         |   6 +
 arch/arm/boot/dts/gemini-nas4220b.dts              |  68 +++++
 arch/arm/boot/dts/gemini-rut1xx.dts                |  63 +++++
 arch/arm/boot/dts/gemini-sq201.dts                 |  94 +++++++
 arch/arm/boot/dts/gemini-wbd111.dts                | 101 ++++++++
 arch/arm/boot/dts/gemini-wbd222.dts                | 101 ++++++++
 arch/arm/boot/dts/gemini.dtsi                      |  96 +++++++
 arch/arm/configs/gemini_defconfig                  |  63 +++++
 arch/arm/mach-gemini/Kconfig                       |  52 +---
 arch/arm/mach-gemini/Makefile                      |  15 +-
 arch/arm/mach-gemini/Makefile.boot                 |   9 -
 arch/arm/mach-gemini/board-dt.c                    |  62 +++++
 arch/arm/mach-gemini/board-nas4220b.c              | 106 --------
 arch/arm/mach-gemini/board-rut1xx.c                |  92 -------
 arch/arm/mach-gemini/board-wbd111.c                | 133 ----------
 arch/arm/mach-gemini/board-wbd222.c                | 133 ----------
 arch/arm/mach-gemini/common.h                      |  33 ---
 arch/arm/mach-gemini/devices.c                     | 118 ---------
 arch/arm/mach-gemini/gpio.c                        | 231 -----------------
 arch/arm/mach-gemini/idle.c                        |  31 ---
 arch/arm/mach-gemini/include/mach/entry-macro.S    |  33 ---
 arch/arm/mach-gemini/include/mach/global_reg.h     | 278 ---------------------
 arch/arm/mach-gemini/include/mach/hardware.h       |  71 ------
 arch/arm/mach-gemini/include/mach/irqs.h           |  53 ----
 arch/arm/mach-gemini/include/mach/uncompress.h     |  42 ----
 arch/arm/mach-gemini/irq.c                         | 105 --------
 arch/arm/mach-gemini/mm.c                          |  82 ------
 arch/arm/mach-gemini/reset.c                       |  25 --
 drivers/clocksource/Kconfig                        |  10 +
 drivers/clocksource/Makefile                       |   1 +
 .../time.c => drivers/clocksource/timer-gemini.c   | 168 ++++++++-----
 drivers/gpio/Kconfig                               |   9 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-gemini.c                         | 236 +++++++++++++++++
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-gemini.c                       | 190 ++++++++++++++
 drivers/mtd/maps/Kconfig                           |  10 +
 drivers/mtd/maps/Makefile                          |   3 +
 drivers/mtd/maps/physmap_of.c                      |   9 +-
 drivers/mtd/maps/physmap_of_gemini.c               | 120 +++++++++
 drivers/mtd/maps/physmap_of_gemini.h               |  16 ++
 drivers/rtc/rtc-gemini.c                           |   7 +
 49 files changed, 1545 insertions(+), 1705 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/gemini.txt
 create mode 100644 Documentation/devicetree/bindings/gpio/cortina,gemini-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/cortina,gemini-interrupt-controller.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/cortina,gemini-flash.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/cortina,gemini.txt
 create mode 100644 Documentation/devicetree/bindings/timer/cortina,gemini-timer.txt
 create mode 100644 arch/arm/boot/dts/gemini-nas4220b.dts
 create mode 100644 arch/arm/boot/dts/gemini-rut1xx.dts
 create mode 100644 arch/arm/boot/dts/gemini-sq201.dts
 create mode 100644 arch/arm/boot/dts/gemini-wbd111.dts
 create mode 100644 arch/arm/boot/dts/gemini-wbd222.dts
 create mode 100644 arch/arm/boot/dts/gemini.dtsi
 create mode 100644 arch/arm/configs/gemini_defconfig
 delete mode 100644 arch/arm/mach-gemini/Makefile.boot
 create mode 100644 arch/arm/mach-gemini/board-dt.c
 delete mode 100644 arch/arm/mach-gemini/board-nas4220b.c
 delete mode 100644 arch/arm/mach-gemini/board-rut1xx.c
 delete mode 100644 arch/arm/mach-gemini/board-wbd111.c
 delete mode 100644 arch/arm/mach-gemini/board-wbd222.c
 delete mode 100644 arch/arm/mach-gemini/common.h
 delete mode 100644 arch/arm/mach-gemini/devices.c
 delete mode 100644 arch/arm/mach-gemini/gpio.c
 delete mode 100644 arch/arm/mach-gemini/idle.c
 delete mode 100644 arch/arm/mach-gemini/include/mach/entry-macro.S
 delete mode 100644 arch/arm/mach-gemini/include/mach/global_reg.h
 delete mode 100644 arch/arm/mach-gemini/include/mach/hardware.h
 delete mode 100644 arch/arm/mach-gemini/include/mach/irqs.h
 delete mode 100644 arch/arm/mach-gemini/include/mach/uncompress.h
 delete mode 100644 arch/arm/mach-gemini/irq.c
 delete mode 100644 arch/arm/mach-gemini/mm.c
 delete mode 100644 arch/arm/mach-gemini/reset.c
 rename arch/arm/mach-gemini/time.c => drivers/clocksource/timer-gemini.c (55%)
 create mode 100644 drivers/gpio/gpio-gemini.c
 create mode 100644 drivers/irqchip/irq-gemini.c
 create mode 100644 drivers/mtd/maps/physmap_of_gemini.c
 create mode 100644 drivers/mtd/maps/physmap_of_gemini.h
Signature · 1 line
Florian
#2 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Quoted 8 lines · Florian Fainelli
Quoted 4 lines · Linus Walleij

I got a Gemini platform from Florian Fainelli over at OpenWRT some time back. I finally got around to "future-proofing" the platform, which was the idea when he paintakingly sent the box over to me.

I would have happily tested that series ;) thanks a lot for making it happen!

There is a git branch here:
https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-nomadik.git/log/?h=gemini

I collect info and instructions to get it running here:
https://dflund.se/~triad/krad/gemini/

Quoted 6 lines
Quoted 5 lines

The OpenWRT tree still have a whole bunch of significant out-of tree drivers:

- Watchdog
- GMAC (ethernet)

Quoted 6 lines

Been wondering about the GMAC driver a little bit, and it does not appear to be neither a Synopsys/Designware core (although not 100% sure), nor the ftgmac100 either.

This submission does appear to be in a good shape:
https://lwn.net/Articles/437889/

Hm what makes people stop submissions like that in mid-air? Maybe we can shape it up and resend on top of the device tree baseline.

Yours,
Linus Walleij

#3 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Hi Linus,

thanks for the work converting Gemini to DT.

Quoted 7 lines · Linus Walleij
Quoted 6 lines · Florian Fainelli
Quoted 4 lines · Linus Walleij

I got a Gemini platform from Florian Fainelli over at OpenWRT some time back. I finally got around to "future-proofing" the platform, which was the idea when he paintakingly sent the box over to me.

Quoted 22 lines
Quoted 2 lines

I would have happily tested that series ;) thanks a lot for making it happen!

There is a git branch here:
https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-nomadik.git/log/?h=gemini

I collect info and instructions to get it running here:
https://dflund.se/~triad/krad/gemini/

Quoted 12 lines
Quoted 5 lines

The OpenWRT tree still have a whole bunch of significant out-of tree drivers:

- Watchdog
- GMAC (ethernet)

Been wondering about the GMAC driver a little bit, and it does not appear to be neither a Synopsys/Designware core (although not 100% sure), nor the ftgmac100 either.

This submission does appear to be in a good shape:
https://lwn.net/Articles/437889/

AFAICR
This is a dual GMAC !

They are two different base address for each GMAC and one shared base address for both of them.
This is all in one address space which remaps the driver.

And to make it worse two interrupt lines, one of them is also shared.

Any ideas to "convert" this into DT ??
Because I think it's impossible to split both GMAC interfaces ??

Greetings
Hans Ulli Kroll

#4 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Hans, Florian et al: does any of you have a copy of the kernel source dump(s) from Teltonika, Raidsonic or Wiliboard?

Would be nice to have the stuff that vendors are using.

Quoted 11 lines · Hans Ulli Kroll

AFAICR
This is a dual GMAC !

They are two different base address for each GMAC and one shared base address for both of them.
This is all in one address space which remaps the driver.

And to make it worse two interrupt lines, one of them is also shared.

Any ideas to "convert" this into DT ??
Because I think it's impossible to split both GMAC interfaces ??

Sounds odd. Yeah hardware.h lists this:

#define GEMINI_TOE_BASE         0x60000000
#define GEMINI_GMAC0_BASE       0x6000A000
#define GEMINI_GMAC1_BASE       0x6000E000

I guess one approach is to make a driver handling all of it in one, let it ioremap all regions and support one or two GMACs on the same TOE. More complex solutions is to share the TOE using syscons regmap mechanism but it looks cumbersome.

{
compatible = "cortina,genesis-gmac-ethernet";
reg = <0x60000000 0xa000>, <0x6000a000 0x4000>, <0x6000e000 0x4000>; interrupts = <1 IRQ_TYPE_LEVEL_HIGH>, <2 IRQ_TYPE_LEVEL_HIGH>;
}

Or something like that?

Yours,
Linus Walleij

#5 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Quoted 31 lines · Linus Walleij

Hans, Florian et al: does any of you have a copy of the kernel source dump(s) from Teltonika, Raidsonic or Wiliboard?

Would be nice to have the stuff that vendors are using.

Quoted 11 lines · Hans Ulli Kroll

AFAICR
This is a dual GMAC !

They are two different base address for each GMAC and one shared base address for both of them.
This is all in one address space which remaps the driver.

And to make it worse two interrupt lines, one of them is also shared.

Any ideas to "convert" this into DT ??
Because I think it's impossible to split both GMAC interfaces ??

Sounds odd. Yeah hardware.h lists this:

#define GEMINI_TOE_BASE         0x60000000
#define GEMINI_GMAC0_BASE       0x6000A000
#define GEMINI_GMAC1_BASE       0x6000E000

I guess one approach is to make a driver handling all of it in one, let it ioremap all regions and support one or two GMACs on the same TOE. More complex solutions is to share the TOE using syscons regmap mechanism but it looks cumbersome.

Quoted 7 lines
{
   compatible = "cortina,genesis-gmac-ethernet";
   reg = <0x60000000 0xa000>, <0x6000a000 0x4000>, <0x6000e000 0x4000>;
   interrupts = <1 IRQ_TYPE_LEVEL_HIGH>, <2 IRQ_TYPE_LEVEL_HIGH>;
}

Or something like that?

I'd recommend looking at how mv643xx_eth does it, there are shared and individual portions of the register set in there, with concepts of "ports" which result in network device instances.

Signature · 1 line
Florian
#6 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Hi Florian, Linus,

sorry for delay, busy last week ...

Quoted 32 lines · Florian Fainelli
Quoted 31 lines · Linus Walleij

Hans, Florian et al: does any of you have a copy of the kernel source dump(s) from Teltonika, Raidsonic or Wiliboard?

Would be nice to have the stuff that vendors are using.

Quoted 11 lines · Hans Ulli Kroll

AFAICR
This is a dual GMAC !

They are two different base address for each GMAC and one shared base address for both of them.
This is all in one address space which remaps the driver.

And to make it worse two interrupt lines, one of them is also shared.

Any ideas to "convert" this into DT ??
Because I think it's impossible to split both GMAC interfaces ??

Sounds odd. Yeah hardware.h lists this:

#define GEMINI_TOE_BASE         0x60000000
#define GEMINI_GMAC0_BASE       0x6000A000
#define GEMINI_GMAC1_BASE       0x6000E000

I guess one approach is to make a driver handling all of it in one, let it ioremap all regions and support one or two GMACs on the same TOE. More complex solutions is to share the TOE using syscons regmap mechanism but it looks cumbersome.

Quoted 8 lines
Quoted 7 lines
{
   compatible = "cortina,genesis-gmac-ethernet";
   reg = <0x60000000 0xa000>, <0x6000a000 0x4000>, <0x6000e000 0x4000>;
   interrupts = <1 IRQ_TYPE_LEVEL_HIGH>, <2 IRQ_TYPE_LEVEL_HIGH>;
}

Or something like that?

For addresses, base is here, for both interfaces
#define GEMINI_TOE_BASE 0x60000000
and now for each interface, offset to the above code is from the headerfile of the openwrt driver.
#define TOE_GMAC_DMA_BASE(x) (0x8000 + 0x4000 * (x))
#define TOE_GMAC_BASE(x) (0xA000 + 0x4000 * (x))

maybe some other registers to
#define TOE_NONTOE_QUE_HDR_BASE 0x2000
#define TOE_TOE_QUE_HDR_BASE 0x3000
#define TOE_V_BIT_BASE 0x4000
#define TOE_A_BIT_BASE 0x6000

AFAICR
The TOE part was "invented" for the gigabit interface.
They need to speed up the NIC because without TCP offloading you will get only fast ethernet speed on a gigabit NIC.

Quoted 3 lines

I'd recommend looking at how mv643xx_eth does it, there are shared and individual portions of the register set in there, with concepts of "ports" which result in network device instances.

Thanks will look at it.

Hans

#7 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Quoted 46 lines · Hans Ulli Kroll
Quoted 24 lines · Florian Fainelli
Quoted 22 lines · Linus Walleij
Quoted 10 lines

This is a dual GMAC !

They are two different base address for each GMAC and one shared base address for both of them.
This is all in one address space which remaps the driver.

And to make it worse two interrupt lines, one of them is also shared.

Any ideas to "convert" this into DT ??
Because I think it's impossible to split both GMAC interfaces ??

Sounds odd. Yeah hardware.h lists this:

#define GEMINI_TOE_BASE         0x60000000
#define GEMINI_GMAC0_BASE       0x6000A000
#define GEMINI_GMAC1_BASE       0x6000E000

I guess one approach is to make a driver handling all of it in one, let it ioremap all regions and support one or two GMACs on the same TOE. More complex solutions is to share the TOE using syscons regmap mechanism but it looks cumbersome.

Quoted 7 lines
Quoted 7 lines
{
   compatible = "cortina,genesis-gmac-ethernet";
   reg = <0x60000000 0xa000>, <0x6000a000 0x4000>, <0x6000e000 0x4000>;
   interrupts = <1 IRQ_TYPE_LEVEL_HIGH>, <2 IRQ_TYPE_LEVEL_HIGH>;
}

Or something like that?

For addresses, base is here, for both interfaces
#define GEMINI_TOE_BASE 0x60000000
and now for each interface, offset to the above code is from the headerfile of the openwrt driver.
#define TOE_GMAC_DMA_BASE(x) (0x8000 + 0x4000 * (x))
#define TOE_GMAC_BASE(x) (0xA000 + 0x4000 * (x))

maybe some other registers to

#define TOE_NONTOE_QUE_HDR_BASE         0x2000
#define TOE_TOE_QUE_HDR_BASE            0x3000
#define TOE_V_BIT_BASE                  0x4000
#define TOE_A_BIT_BASE                  0x6000
Quoted 4 lines

AFAICR
The TOE part was "invented" for the gigabit interface.
They need to speed up the NIC because without TCP offloading you will get only fast ethernet speed on a gigabit NIC.

I was suspecting that this ethernet is related to the Faraday ethernet driver that was merged in drivers/net/ethernet/faraday since so many other Gemini parts seems to be coming essentially directly from Faraday.

I looked through the header files etc there but the registers seem quite different ... :/

Still it is using the same "GMAC" naming and I strongly suspect this is an older Faraday IP that should go into the same driver folder.

Cc:ing some Faraday and Andestech emails to see if we can get some clarity in this. It would be nice if someone could atleast say "oh it's this IP FTxxx from Faraday" so we know what to name it.

Yours,
Linus Walleij

#8 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

HI Linus,

Quoted 60 lines · Linus Walleij
Quoted 46 lines · Hans Ulli Kroll
Quoted 24 lines · Florian Fainelli
Quoted 22 lines · Linus Walleij
Quoted 10 lines

This is a dual GMAC !

They are two different base address for each GMAC and one shared base address for both of them.
This is all in one address space which remaps the driver.

And to make it worse two interrupt lines, one of them is also shared.

Any ideas to "convert" this into DT ??
Because I think it's impossible to split both GMAC interfaces ??

Sounds odd. Yeah hardware.h lists this:

#define GEMINI_TOE_BASE         0x60000000
#define GEMINI_GMAC0_BASE       0x6000A000
#define GEMINI_GMAC1_BASE       0x6000E000

I guess one approach is to make a driver handling all of it in one, let it ioremap all regions and support one or two GMACs on the same TOE. More complex solutions is to share the TOE using syscons regmap mechanism but it looks cumbersome.

Quoted 7 lines
Quoted 7 lines
{
   compatible = "cortina,genesis-gmac-ethernet";
   reg = <0x60000000 0xa000>, <0x6000a000 0x4000>, <0x6000e000 0x4000>;
   interrupts = <1 IRQ_TYPE_LEVEL_HIGH>, <2 IRQ_TYPE_LEVEL_HIGH>;
}

Or something like that?

For addresses, base is here, for both interfaces
#define GEMINI_TOE_BASE 0x60000000
and now for each interface, offset to the above code is from the headerfile of the openwrt driver.
#define TOE_GMAC_DMA_BASE(x) (0x8000 + 0x4000 * (x))
#define TOE_GMAC_BASE(x) (0xA000 + 0x4000 * (x))

maybe some other registers to

#define TOE_NONTOE_QUE_HDR_BASE         0x2000
#define TOE_TOE_QUE_HDR_BASE            0x3000
#define TOE_V_BIT_BASE                  0x4000
#define TOE_A_BIT_BASE                  0x6000
Quoted 4 lines

AFAICR
The TOE part was "invented" for the gigabit interface.
They need to speed up the NIC because without TCP offloading you will get only fast ethernet speed on a gigabit NIC.

I was suspecting that this ethernet is related to the Faraday ethernet driver that was merged in drivers/net/ethernet/faraday since so many other Gemini parts seems to be coming essentially directly from Faraday.

I looked through the header files etc there but the registers seem quite different ... :/

Quoted 7 lines

Still it is using the same "GMAC" naming and I strongly suspect this is an older Faraday IP that should go into the same driver folder.

Cc:ing some Faraday and Andestech emails to see if we can get some clarity in this. It would be nice if someone could atleast say "oh it's this IP FTxxx from Faraday" so we know what to name it.

I must look/seach for the nas2000 SDK, maybe this brings some light.

Greetings Hans Ulli Kroll

#9 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Hi Hans,

Quoted 60 lines

HI Linus,

Quoted 56 lines · Linus Walleij
Quoted 46 lines · Hans Ulli Kroll
Quoted 24 lines · Florian Fainelli
Quoted 22 lines · Linus Walleij
Quoted 10 lines

This is a dual GMAC !

They are two different base address for each GMAC and one shared base address for both of them.
This is all in one address space which remaps the driver.

And to make it worse two interrupt lines, one of them is also shared.

Any ideas to "convert" this into DT ??
Because I think it's impossible to split both GMAC interfaces ??

Sounds odd. Yeah hardware.h lists this:

#define GEMINI_TOE_BASE         0x60000000
#define GEMINI_GMAC0_BASE       0x6000A000
#define GEMINI_GMAC1_BASE       0x6000E000

I guess one approach is to make a driver handling all of it in one, let it ioremap all regions and support one or two GMACs on the same TOE. More complex solutions is to share the TOE using syscons regmap mechanism but it looks cumbersome.

Quoted 7 lines
Quoted 7 lines
{
   compatible = "cortina,genesis-gmac-ethernet";
   reg = <0x60000000 0xa000>, <0x6000a000 0x4000>,> <0x6000e000 0x4000>;
   interrupts = <1 IRQ_TYPE_LEVEL_HIGH>, <2> IRQ_TYPE_LEVEL_HIGH>;
}

Or something like that?

For addresses, base is here, for both interfaces
#define GEMINI_TOE_BASE 0x60000000
and now for each interface, offset to the above code is from the headerfile of the openwrt driver.
#define TOE_GMAC_DMA_BASE(x) (0x8000 + 0x4000 * (x))
#define TOE_GMAC_BASE(x) (0xA000 + 0x4000 * (x))

maybe some other registers to

#define TOE_NONTOE_QUE_HDR_BASE         0x2000
#define TOE_TOE_QUE_HDR_BASE            0x3000
#define TOE_V_BIT_BASE                  0x4000
#define TOE_A_BIT_BASE                  0x6000
Quoted 4 lines

AFAICR
The TOE part was "invented" for the gigabit interface. They need to speed up the NIC because without TCP offloading you will get only fast ethernet speed on a gigabit NIC.

I was suspecting that this ethernet is related to the Faraday ethernet driver that was merged in drivers/net/ethernet/faraday since so many other Gemini parts seems to be coming essentially directly from Faraday.

1. Faraday have no TOE design in GMAC, and the GMAC in Gemini is very old one (licensed to Storlink about 13 years ago)
2. Storlink may modify the GMC design and add TOE function in it to fit their SoC.

Quoted 6 lines
Quoted 6 lines

I looked through the header files etc there but the registers seem quite different ... :/

Still it is using the same "GMAC" naming and I strongly suspect this is an older Faraday IP that should go into the same driver folder.

Yes, This is not the same one as Faraday's.

Quoted 5 lines
Quoted 5 lines

Cc:ing some Faraday and Andestech emails to see if we can get some clarity in this. It would be nice if someone could atleast say "oh it's this IP FTxxx from Faraday" so we know what to name it.

You should think this IP is from Storlink

Quoted 4 lines

I must look/seach for the nas2000 SDK, maybe this brings some light.

Greetings Hans Ulli Kroll

Greetings John

============================================================================
********************* Confidentiality Notice ************************ This electronic message and any attachments may contain confidential and legally privileged information or information which is otherwise protected from disclosure. If you are not the intended recipient, please do not disclose the contents, either in whole or in part, to anyone, and immediately delete the message and any attachments from your computer system and destroy all hard copies.
Thank you for your cooperation.
***********************************************************************

#10 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Hi John,

Quoted 59 lines · John Feng-Hsin Chiang(???)

Hi Hans,

Quoted 57 lines

HI Linus,

Quoted 53 lines · Linus Walleij
Quoted 50 lines · Hans Ulli Kroll
Quoted 24 lines · Florian Fainelli
Quoted 22 lines · Linus Walleij
Quoted 10 lines

This is a dual GMAC !

They are two different base address for each GMAC and one shared base address for both of them.
This is all in one address space which remaps the driver.

And to make it worse two interrupt lines, one of them is also shared.

Any ideas to "convert" this into DT ??
Because I think it's impossible to split both GMAC interfaces ??

Sounds odd. Yeah hardware.h lists this:

#define GEMINI_TOE_BASE         0x60000000
#define GEMINI_GMAC0_BASE       0x6000A000
#define GEMINI_GMAC1_BASE       0x6000E000

I guess one approach is to make a driver handling all of it in one, let it ioremap all regions and support one or two GMACs on the same TOE. More complex solutions is to share the TOE using syscons regmap mechanism but it looks cumbersome.

Quoted 7 lines
Quoted 7 lines
{
   compatible = "cortina,genesis-gmac-ethernet";
   reg = <0x60000000 0xa000>, <0x6000a000 0x4000>,> <0x6000e000 0x4000>;
   interrupts = <1 IRQ_TYPE_LEVEL_HIGH>, <2> IRQ_TYPE_LEVEL_HIGH>;
}

Or something like that?

For addresses, base is here, for both interfaces
#define GEMINI_TOE_BASE 0x60000000
and now for each interface, offset to the above code is from the headerfile of the openwrt driver.
#define TOE_GMAC_DMA_BASE(x) (0x8000 + 0x4000 * (x))
#define TOE_GMAC_BASE(x) (0xA000 + 0x4000 * (x))

maybe some other registers to

#define TOE_NONTOE_QUE_HDR_BASE         0x2000
#define TOE_TOE_QUE_HDR_BASE            0x3000
#define TOE_V_BIT_BASE                  0x4000
#define TOE_A_BIT_BASE                  0x6000

AFAICR
The TOE part was "invented" for the gigabit interface. They need to speed up the NIC because without TCP offloading you will get only fast ethernet speed on a gigabit NIC.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I was suspecting that this ethernet is related to the Faraday ethernet driver that was merged in drivers/net/ethernet/faraday since so many other Gemini parts seems to be coming essentially directly from Faraday.

1. Faraday have no TOE design in GMAC, and the GMAC in Gemini is very old one (licensed to Storlink about 13 years ago)
2. Storlink may modify the GMC design and add TOE function in it to fit their SoC.

Yeah, this was also my idea.
Storlink need to speed up their GMAC NIC, so they do some tricks here.

Quoted 10 lines
Quoted 6 lines
Quoted 6 lines

I looked through the header files etc there but the registers seem quite different ... :/

Still it is using the same "GMAC" naming and I strongly suspect this is an older Faraday IP that should go into the same driver folder.

Yes, This is not the same one as Faraday's.

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Cc:ing some Faraday and Andestech emails to see if we can get some clarity in this. It would be nice if someone could atleast say "oh it's this IP FTxxx from Faraday" so we know what to name it.

You should think this IP is from Storlink

I'll do. Thanks for the hint here, John.

Greetings
Hans Ulli Kroll

#11 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

In reply to Linus Walleij

Hi Linus

Quoted 5 lines · Linus Walleij

I got a Gemini platform from Florian Fainelli over at OpenWRT some time back. I finally got around to "future-proofing" the platform, which was the idea when he paintakingly sent the box over to me.

now I've got my toolchain cleaned up and working ... Tested on may nas 4220

here my

Quoted 1 line

- FOT2G USB EHCI host

The fotg2 driver is already upstream.
I've added DT support and this driver works.
The only problem here is dis/reconnect of usb devices, but I think this is some driver problem here.

I must clean up my DT support patches to send them of.

Greetings
Hans Ulli Kroll

#12 lore raw

cover Conversion of ARMv4 Gemini to DT and multiplatform

Quoted 5 lines · Hans Ulli Kroll

now I've got my toolchain cleaned up and working ... Tested on may nas 4220

here my

Thanks! I'll add it throughout.

Quoted 4 lines
Quoted 1 line

- FOT2G USB EHCI host

The fotg2 driver is already upstream.
I've added DT support and this driver works.

I saw some patches flying, awesome. I'll probably stack them up in my git tree. I can't test them: the SQ201 I'm using has a separate VIA USB on PCI for some reason, I guess they just didn't trust the built-in USB and just threw money at the problem.

With the patches in transit the upstream TODO (not started) is just down to:
- SATA
- Ethernet
- Crypto

Yours,
Linus Walleij