ac39a3282dc98011a09da4e79a513e210fd41002
[openwrt/openwrt.git] / target / linux / gemini / patches-4.14 / 0004-pinctrl-Add-skew-delay-pin-config-and-bindings.patch
1 From eb3742c4250c6a79e7080bdb6286e5df50c7f26a Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Sat, 28 Oct 2017 15:37:17 +0200
4 Subject: [PATCH 04/31] pinctrl: Add skew-delay pin config and bindings
5
6 Some pin controllers (such as the Gemini) can control the
7 expected clock skew and output delay on certain pins with a
8 sub-nanosecond granularity. This is typically done by shunting
9 in a number of double inverters in front of or behind the pin.
10 Make it possible to configure this with a generic binding.
11
12 Cc: devicetree@vger.kernel.org
13 Acked-by: Rob Herring <robh@kernel.org>
14 Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
15 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
16 ---
17 Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt | 4 ++++
18 drivers/pinctrl/pinconf-generic.c | 2 ++
19 include/linux/pinctrl/pinconf-generic.h | 5 +++++
20 3 files changed, 11 insertions(+)
21
22 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
23 +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
24 @@ -271,6 +271,10 @@ output-high - set the pin to output mod
25 sleep-hardware-state - indicate this is sleep related state which will be programmed
26 into the registers for the sleep state.
27 slew-rate - set the slew rate
28 +skew-delay - this affects the expected clock skew on input pins
29 + and the delay before latching a value to an output
30 + pin. Typically indicates how many double-inverters are
31 + used to delay the signal.
32
33 For example:
34
35 --- a/drivers/pinctrl/pinconf-generic.c
36 +++ b/drivers/pinctrl/pinconf-generic.c
37 @@ -49,6 +49,7 @@ static const struct pin_config_item conf
38 PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector", true),
39 PCONFDUMP(PIN_CONFIG_SLEEP_HARDWARE_STATE, "sleep hardware state", NULL, false),
40 PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL, true),
41 + PCONFDUMP(PIN_CONFIG_SKEW_DELAY, "skew delay", NULL, true),
42 };
43
44 static void pinconf_generic_dump_one(struct pinctrl_dev *pctldev,
45 @@ -181,6 +182,7 @@ static const struct pinconf_generic_para
46 { "power-source", PIN_CONFIG_POWER_SOURCE, 0 },
47 { "sleep-hardware-state", PIN_CONFIG_SLEEP_HARDWARE_STATE, 0 },
48 { "slew-rate", PIN_CONFIG_SLEW_RATE, 0 },
49 + { "skew-delay", PIN_CONFIG_SKEW_DELAY, 0 },
50 };
51
52 /**
53 --- a/include/linux/pinctrl/pinconf-generic.h
54 +++ b/include/linux/pinctrl/pinconf-generic.h
55 @@ -90,6 +90,10 @@
56 * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to
57 * this parameter (on a custom format) tells the driver which alternative
58 * slew rate to use.
59 + * @PIN_CONFIG_SKEW_DELAY: if the pin has programmable skew rate (on inputs)
60 + * or latch delay (on outputs) this parameter (in a custom format)
61 + * specifies the clock skew or latch delay. It typically controls how
62 + * many double inverters are put in front of the line.
63 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if
64 * you need to pass in custom configurations to the pin controller, use
65 * PIN_CONFIG_END+1 as the base offset.
66 @@ -117,6 +121,7 @@ enum pin_config_param {
67 PIN_CONFIG_POWER_SOURCE,
68 PIN_CONFIG_SLEEP_HARDWARE_STATE,
69 PIN_CONFIG_SLEW_RATE,
70 + PIN_CONFIG_SKEW_DELAY,
71 PIN_CONFIG_END = 0x7F,
72 PIN_CONFIG_MAX = 0xFF,
73 };