Unverified Commit dfa556e4 authored by Marek Behún's avatar Marek Behún Committed by Arnd Bergmann
Browse files

platform: cznic: turris-omnia-mcu: Add support for MCU connected GPIOs



Add support for GPIOs connected to the MCU on the Turris Omnia board.

This includes:
- front button pin
- enable pins for USB regulators
- MiniPCIe / mSATA card presence pins in MiniPCIe port 0
- LED output pins from WAN ethernet PHY, LAN switch and MiniPCIe ports
- on board revisions 32+ also various peripheral resets and another
  voltage regulator enable pin

Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
Acked-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20240701113010.16447-4-kabel@kernel.org


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 992f1a3d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -22,6 +22,22 @@ Description: (RO) Contains device first MAC address. Each Turris Omnia is

		Format: %pM.

What:		/sys/bus/i2c/devices/<mcu_device>/front_button_mode
Date:		September 2024
KernelVersion:	6.11
Contact:	Marek Behún <kabel@kernel.org>
Description:	(RW) The front button on the Turris Omnia router can be
		configured either to change the intensity of all the LEDs on the
		front panel, or to send the press event to the CPU as an
		interrupt.

		This file switches between these two modes:
		- "mcu" makes the button press event be handled by the MCU to
		  change the LEDs panel intensity.
		- "cpu" makes the button press event be handled by the CPU.

		Format: %s.

What:		/sys/bus/i2c/devices/<mcu_device>/fw_features
Date:		September 2024
KernelVersion:	6.11
+15 −0
Original line number Diff line number Diff line
@@ -16,9 +16,24 @@ config TURRIS_OMNIA_MCU
	tristate "Turris Omnia MCU driver"
	depends on MACH_ARMADA_38X || COMPILE_TEST
	depends on I2C
	select GPIOLIB
	select GPIOLIB_IRQCHIP
	help
	  Say Y here to add support for the features implemented by the
	  microcontroller on the CZ.NIC's Turris Omnia SOHO router.
	  The features include:
	  - GPIO pins
	    - to get front button press events (the front button can be
	      configured either to generate press events to the CPU or to change
	      front LEDs panel brightness)
	    - to enable / disable USB port voltage regulators and to detect
	      USB overcurrent
	    - to detect MiniPCIe / mSATA card presence in MiniPCIe port 0
	    - to configure resets of various peripherals on board revisions 32+
	    - to enable / disable the VHV voltage regulator to the SOC in order
	      to be able to program SOC's OTP on board revisions 32+
	    - to get input from the LED output pins of the WAN ethernet PHY, LAN
	      switch and MiniPCIe ports
	  To compile this driver as a module, choose M here; the module will be
	  called turris-omnia-mcu.

+1 −0
Original line number Diff line number Diff line
@@ -2,3 +2,4 @@

obj-$(CONFIG_TURRIS_OMNIA_MCU)	+= turris-omnia-mcu.o
turris-omnia-mcu-y		:= turris-omnia-mcu-base.o
turris-omnia-mcu-y		+= turris-omnia-mcu-gpio.o
+2 −1
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ static const struct attribute_group omnia_mcu_base_group = {

static const struct attribute_group *omnia_mcu_groups[] = {
	&omnia_mcu_base_group,
	&omnia_mcu_gpio_group,
	NULL
};

@@ -371,7 +372,7 @@ static int omnia_mcu_probe(struct i2c_client *client)
					     "Cannot read board info\n");
	}

	return 0;
	return omnia_mcu_register_gpiochip(mcu);
}

static const struct of_device_id of_omnia_mcu_match[] = {
+1095 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading