Skip to content

Commit d20f7a0

Browse files
committed
Merge tag 'gpio-updates-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "We have a single new driver, new features in others and some cleanups all over the place. Nothing really stands out and it is all relatively small. - new driver: gpio-modepin (plus relevant change in zynqmp firmware) - add interrupt support to gpio-virtio - enable the 'gpio-line-names' property in the DT bindings for gpio-rockchip - use the subsystem helpers where applicable in gpio-uniphier instead of accessing IRQ structures directly - code shrink in gpio-xilinx - add interrupt to gpio-mlxbf2 (and include the removal of custom interrupt code from the mellanox ethernet driver) - support multiple interrupts per bank in gpio-tegra186 (and force one interrupt per bank in older models) - fix GPIO line IRQ offset calculation in gpio-realtek-otto - drop unneeded MODULE_ALIAS expansions in multiple drivers - code cleanup in gpio-aggregator - minor improvements in gpio-max730x and gpio-mc33880 - Kconfig cleanups" * tag 'gpio-updates-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: virtio_gpio: drop packed attribute gpio: virtio: Add IRQ support gpio: realtek-otto: fix GPIO line IRQ offset gpio: clean up Kconfig file net: mellanox: mlxbf_gige: Replace non-standard interrupt handling gpio: mlxbf2: Introduce IRQ support gpio: mc33880: Drop if with an always false condition gpio: max730x: Make __max730x_remove() return void gpio: aggregator: Wrap access to gpiochip_fwd.tmp[] gpio: modepin: Add driver support for modepin GPIO controller dt-bindings: gpio: zynqmp: Add binding documentation for modepin firmware: zynqmp: Add MMIO read and write support for PS_MODE pin gpio: tps65218: drop unneeded MODULE_ALIAS gpio: max77620: drop unneeded MODULE_ALIAS gpio: xilinx: simplify getting .driver_data gpio: tegra186: Support multiple interrupts per bank gpio: tegra186: Force one interrupt per bank gpio: uniphier: Use helper functions to get private data from IRQ data gpio: uniphier: Use helper function to get IRQ hardware number dt-bindings: gpio: add gpio-line-names to rockchip,gpio-bank.yaml
2 parents dd72945 + 7d0003d commit d20f7a0

26 files changed

+943
-351
lines changed

Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ properties:
2929

3030
gpio-controller: true
3131

32+
gpio-line-names: true
33+
3234
"#gpio-cells":
3335
const: 2
3436

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: "http://devicetree.org/schemas/gpio/xlnx,zynqmp-gpio-modepin.yaml#"
5+
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6+
7+
title: ZynqMP Mode Pin GPIO controller
8+
9+
description:
10+
PS_MODE is 4-bits boot mode pins sampled on POR deassertion. Mode Pin
11+
GPIO controller with configurable from numbers of pins (from 0 to 3 per
12+
PS_MODE). Every pin can be configured as input/output.
13+
14+
maintainers:
15+
- Piyush Mehta <[email protected]>
16+
17+
properties:
18+
compatible:
19+
const: xlnx,zynqmp-gpio-modepin
20+
21+
gpio-controller: true
22+
23+
"#gpio-cells":
24+
const: 2
25+
26+
required:
27+
- compatible
28+
- gpio-controller
29+
- "#gpio-cells"
30+
31+
additionalProperties: false
32+
33+
examples:
34+
- |
35+
zynqmp-firmware {
36+
gpio {
37+
compatible = "xlnx,zynqmp-gpio-modepin";
38+
gpio-controller;
39+
#gpio-cells = <2>;
40+
};
41+
};
42+
43+
...

drivers/firmware/xilinx/zynqmp.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@
2828
/* Max HashMap Order for PM API feature check (1<<7 = 128) */
2929
#define PM_API_FEATURE_CHECK_MAX_ORDER 7
3030

31+
/* CRL registers and bitfields */
32+
#define CRL_APB_BASE 0xFF5E0000U
33+
/* BOOT_PIN_CTRL- Used to control the mode pins after boot */
34+
#define CRL_APB_BOOT_PIN_CTRL (CRL_APB_BASE + (0x250U))
35+
/* BOOT_PIN_CTRL_MASK- out_val[11:8], out_en[3:0] */
36+
#define CRL_APB_BOOTPIN_CTRL_MASK 0xF0FU
37+
3138
static bool feature_check_enabled;
3239
static DEFINE_HASHTABLE(pm_api_features_map, PM_API_FEATURE_CHECK_MAX_ORDER);
3340

@@ -942,6 +949,45 @@ int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
942949
}
943950
EXPORT_SYMBOL_GPL(zynqmp_pm_pinctrl_set_config);
944951

952+
/**
953+
* zynqmp_pm_bootmode_read() - PM Config API for read bootpin status
954+
* @ps_mode: Returned output value of ps_mode
955+
*
956+
* This API function is to be used for notify the power management controller
957+
* to read bootpin status.
958+
*
959+
* Return: status, either success or error+reason
960+
*/
961+
unsigned int zynqmp_pm_bootmode_read(u32 *ps_mode)
962+
{
963+
unsigned int ret;
964+
u32 ret_payload[PAYLOAD_ARG_CNT];
965+
966+
ret = zynqmp_pm_invoke_fn(PM_MMIO_READ, CRL_APB_BOOT_PIN_CTRL, 0,
967+
0, 0, ret_payload);
968+
969+
*ps_mode = ret_payload[1];
970+
971+
return ret;
972+
}
973+
EXPORT_SYMBOL_GPL(zynqmp_pm_bootmode_read);
974+
975+
/**
976+
* zynqmp_pm_bootmode_write() - PM Config API for Configure bootpin
977+
* @ps_mode: Value to be written to the bootpin ctrl register
978+
*
979+
* This API function is to be used for notify the power management controller
980+
* to configure bootpin.
981+
*
982+
* Return: Returns status, either success or error+reason
983+
*/
984+
int zynqmp_pm_bootmode_write(u32 ps_mode)
985+
{
986+
return zynqmp_pm_invoke_fn(PM_MMIO_WRITE, CRL_APB_BOOT_PIN_CTRL,
987+
CRL_APB_BOOTPIN_CTRL_MASK, ps_mode, 0, NULL);
988+
}
989+
EXPORT_SYMBOL_GPL(zynqmp_pm_bootmode_write);
990+
945991
/**
946992
* zynqmp_pm_init_finalize() - PM call to inform firmware that the caller
947993
* master has initialized its own power management

0 commit comments

Comments
 (0)