public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v6 1/6] dt-bindings: gpio-mmio: Correct opencores GPIO
@ 2026-01-23 14:18 Gary Lau
  2026-01-24 12:36 ` Stafford Horne
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Lau @ 2026-01-23 14:18 UTC (permalink / raw)
  To: Stafford Horne
  Cc: linusw, linux-kernel, linux-openrisc, devicetree, robh, krzk+dt,
	conor+dt, geert+renesas, krzysztof.kozlowski, brgl, linux-gpio

Hi Stafford,

I should clarify my setup: I'm using hardware address translation to make the
OpenCores 8-bit GPIO appear as 32-bit to the CPU. Specifically:

1. Address translation: The CPU's 32-bit addresses are right-shifted by 2 bits
   (adr_i[2] in Verilog), so each 32-bit CPU access maps to the correct 8-bit
   OpenCores register.

2. Data width adaptation: Only dat_i[7:0] and dat_o[7:0] are connected, so
   32-bit writes are truncated to 8-bit, and reads are zero-extended.

This hardware wrapper makes brcm,bcm6345-gpio driver "work" with my OpenCores
GPIO, but it's really a hardware-level compatibility layer, not true software
compatibility.

So you're absolutely right that the native opencores,gpio isn't compatible
with brcm,bcm6345-gpio. My setup works because of custom hardware translation,
not because the IP cores are compatible.

Best regards,
Gary








^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH v6 1/6] dt-bindings: gpio-mmio: Correct opencores GPIO
@ 2026-01-23 14:08 Gary Lau
  0 siblings, 0 replies; 5+ messages in thread
From: Gary Lau @ 2026-01-23 14:08 UTC (permalink / raw)
  To: Stafford Horne
  Cc: linusw, linux-kernel, linux-openrisc, devicetree, robh, krzk+dt,
	conor+dt, geert+renesas, krzysztof.kozlowski, brgl, linux-gpio

Hi Stafford,
I've tested the "brcm,bcm6345-gpio" driver with the OpenCores 8-bit GPIO core, and it is working as expected.
For reference, here is the hardware connection logic I used for the OpenRISC to OpenCores GPIO interface:
Verilog:
simple_gpio gpio0 (
    .clk_i  (clk_i),
    .rst_i  (rst_i),
    .cyc_i  (cyc_i & (|sel_i)),
    .stb_i  (stb_i & (|sel_i)),
    .adr_i  (adr_i[2]),
    .we_i   (we_i),
    .dat_i  (dat_i[7:0]),
    .ack_o  (ack_o),
    .dat_o  (dat_o[7:0]),
    .gpio   (gpio[7:0]),
    .gpio_i (gpio_i)
);
And here is the corresponding part of my dts:
gpio0: gpio@91000000 {
    compatible = "brcm,bcm6345-gpio";
    reg = <0x91000000 0x4>, <0x91000004 0x4>;
    reg-names = "dat", "dirout";
    gpio-controller;
    big-endian; 
    status = "okay";







^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH v6 0/6] OpenRISC de0 nano single and multicore boards
@ 2026-01-15 15:09 Stafford Horne
  2026-01-15 15:09 ` [PATCH v6 1/6] dt-bindings: gpio-mmio: Correct opencores GPIO Stafford Horne
  0 siblings, 1 reply; 5+ messages in thread
From: Stafford Horne @ 2026-01-15 15:09 UTC (permalink / raw)
  To: LKML
  Cc: Linux OpenRISC, devicetree, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Stafford Horne

Since v5:
 - Adjust dt-binding patch based on suggestions from Geert and Krzysztof.
 - Add reviewed-by's on the dt-binding patch.
Since v4:
 - Rebased the series on linux-next to allow patches to be incremental.
 - Rewrote the dt-bindings patch as an incremental patch, Due to this I
   dropped reviewed-by's.
 - Added acked-by to the IPI fix patch.
Since v3:
 - Switch order of gpio-mmio driver and bindings patches to patch binding
   first before driver.  Suggested by Krzysztof.
 - Removed example form binding suggested by Krzysztof.
 - Added Reviewed-by's from Geert and Linus W.
Since v2:
 - Fixup (replace) gpio-mmio patch to update driver compatible list and just add
   opencores,gpio to mmio-gpio bindings.  Discussed with Geert and Linus W
   because the 8-bit opencores,gpio is not the same as the 32-bit broadcom
   chip. [1].
 - Update new device trees to use proper ordering, remove debug options, remove
   unneeded "status" properties.  Suggested by Geert.
Since v1:
 - Use proper schema in gpio-mmio suggsted by Conor Dooley
 - Remove 0 clock-frequency definitions in dtsi file

The patches add support for OpenRISC systems running on the De0 Nano FPGA
development board.  We have two SoCs which are available here:

 - https://github.com/olofk/de0_nano - Single core
 - https://github.com/stffrdhrn/de0_nano-multicore - Multicore

As I work on tutorials [2] to help other get started with OpenRISC I would like to
have these defconfig and devicetree definitions in the upstream kernel to avoid
losing them.

When I was working on resurrecting these old setup's I found a major bug in
OpenRISC SMP which is fixed in this series as well.

[1] https://lore.kernel.org/lkml/20251217080843.70621-1-shorne@gmail.com/
[2] https://openrisc.io/tutorials/

Stafford Horne (6):
  dt-bindings: gpio-mmio: Correct opencores GPIO
  gpio: mmio: Add compatible for opencores GPIO
  openrisc: dts: Add de0 nano config and devicetree
  openrisc: Fix IPIs on simple multicore systems
  openrisc: dts: Split simple smp dts to dts and dtsi
  openrisc: dts: Add de0 nano multicore config and devicetree

 .../devicetree/bindings/gpio/gpio-mmio.yaml   | 16 ++--
 arch/openrisc/boot/dts/de0-nano-common.dtsi   | 42 +++++++++
 arch/openrisc/boot/dts/de0-nano-multicore.dts | 25 +++++
 arch/openrisc/boot/dts/de0-nano.dts           | 54 +++++++++++
 arch/openrisc/boot/dts/simple-smp.dts         | 25 +++++
 .../dts/{simple_smp.dts => simple-smp.dtsi}   | 11 +--
 arch/openrisc/configs/de0_nano_defconfig      | 79 ++++++++++++++++
 .../configs/de0_nano_multicore_defconfig      | 92 +++++++++++++++++++
 arch/openrisc/configs/simple_smp_defconfig    |  2 +-
 arch/openrisc/include/asm/smp.h               |  3 +-
 arch/openrisc/kernel/smp.c                    | 22 ++++-
 drivers/gpio/gpio-mmio.c                      |  1 +
 drivers/irqchip/irq-ompic.c                   | 15 ++-
 drivers/irqchip/irq-or1k-pic.c                | 27 +++++-
 14 files changed, 390 insertions(+), 24 deletions(-)
 create mode 100644 arch/openrisc/boot/dts/de0-nano-common.dtsi
 create mode 100644 arch/openrisc/boot/dts/de0-nano-multicore.dts
 create mode 100644 arch/openrisc/boot/dts/de0-nano.dts
 create mode 100644 arch/openrisc/boot/dts/simple-smp.dts
 rename arch/openrisc/boot/dts/{simple_smp.dts => simple-smp.dtsi} (90%)
 create mode 100644 arch/openrisc/configs/de0_nano_defconfig
 create mode 100644 arch/openrisc/configs/de0_nano_multicore_defconfig

-- 
2.51.0


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

end of thread, other threads:[~2026-01-24 12:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 14:18 [PATCH v6 1/6] dt-bindings: gpio-mmio: Correct opencores GPIO Gary Lau
2026-01-24 12:36 ` Stafford Horne
  -- strict thread matches above, loose matches on Subject: below --
2026-01-23 14:08 Gary Lau
2026-01-15 15:09 [PATCH v6 0/6] OpenRISC de0 nano single and multicore boards Stafford Horne
2026-01-15 15:09 ` [PATCH v6 1/6] dt-bindings: gpio-mmio: Correct opencores GPIO Stafford Horne
2026-01-18 23:19   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox