linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] allow gpio simulator be used as interrupt controller
@ 2022-09-26  8:44 Wei Yongjun
  2022-09-26  8:44 ` [PATCH v2 1/3] genirq/irq_sim: Allow both one and two cell bindings Wei Yongjun
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Wei Yongjun @ 2022-09-26  8:44 UTC (permalink / raw)
  To: Bartosz Golaszewski, Thomas Gleixner, Linus Walleij
  Cc: Wei Yongjun, linux-gpio, linux-kernel

From: Wei Yongjun <weiyongjun1@huawei.com>

This series allow gpio simulator be used as interrupt controller, the use
case is mockup some device which using GPIO as interrupt controller, such
as mcp2515 CAN device. With the dts [1], we can mockup a mcp2515 device,
and trigger irq by following commands:

 $ echo pull-down > /sys/bus/gpio/devices/gpiochip0/sim_gpio0/pull
 $ echo pull-up > /sys/bus/gpio/devices/gpiochip0/sim_gpio0/pull

v1 -> v2:
 - add use case to gpio-sim.rst

--[1]---------------------------------------------------------
/dts-v1/;

#include <dt-bindings/interrupt-controller/irq.h>

/ {
	clk24m: clk24m {
		compatible = "fixed-clock";
		clock-output-names = "clk24m";
		clock-frequency = <24000000>;
		#clock-cells = <0>;
	};

	gpio-sim {
		compatible = "gpio-simulator";

		bank0: bank0 {
			gpio-controller;
			#gpio-cells = <2>;
			ngpios = <16>;

			interrupt-controller;
			#interrupt-cells = <2>;

			line_b-hog {
				gpio-hog;
				gpios = <0 1>;
				input;
				line-name = "irq-sim";
			};
		};
	};

	spi: spi {
		compatible = "spi-mockup";

		#address-cells = <1>;
		#size-cells = <0>;

		can0: can@1 {
			compatible = "microchip,mcp2515";
			reg = <1>;
			clocks = <&clk24m>;
			interrupt-parent = <&bank0>;
			interrupts = <0 IRQ_TYPE_EDGE_BOTH>;
		};

	};
};
------------------------------><-----------------------------

Wei Yongjun (3):
  genirq/irq_sim: Allow both one and two cell bindings
  gpio: sim: make gpio simulator can be used as interrupt controller
  gpio: sim: document use case for interrupt controller

 Documentation/admin-guide/gpio/gpio-sim.rst | 44 +++++++++++++++++++++
 drivers/gpio/gpio-sim.c                     |  2 +-
 kernel/irq/irq_sim.c                        |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

-- 
2.34.1


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

end of thread, other threads:[~2022-09-28  7:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-26  8:44 [PATCH v2 0/3] allow gpio simulator be used as interrupt controller Wei Yongjun
2022-09-26  8:44 ` [PATCH v2 1/3] genirq/irq_sim: Allow both one and two cell bindings Wei Yongjun
2022-09-26 11:24   ` Bartosz Golaszewski
2022-09-26 12:55     ` Marc Zyngier
2022-09-28  7:32       ` Wei Yongjun
2022-09-28  7:47         ` Marc Zyngier
2022-09-26  8:44 ` [PATCH v2 2/3] gpio: sim: make gpio simulator can be used as interrupt controller Wei Yongjun
2022-09-26  8:44 ` [PATCH v2 3/3] gpio: sim: document use case for " Wei Yongjun

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).