Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dt-bindings: soc: samsung: usi: add USIv1 and samsung,exynos8895-usi

Add new constants for choosing the additional USIv1 configuration modes
in device tree. Those are further used in the USI driver to figure out
which value to write into SW_CONF register. Modify the current USI IP-core
bindings to include information about USIv1 and a compatible for
exynos8895.

In the original bindings commit, protocol mode definitions were named
with the version of the supported USI (in this case, V2) with the idea of
leaving enough room in the future for other versions of this block. This,
however, is not how the modes should be modelled. The modes are not
version specific and you should not be able to tell USI which version of
a mode to use - that has to be handled in the driver - thus encoding this
information in the binding is meaningless. Only one constant per mode is
needed, so while we're at it, add new constants with the prefix USI_MODE
and mark the old ones as depracated.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250204172803.3425496-2-ivo.ivanov.ivanov1@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

authored by

Ivaylo Ivanov and committed by
Krzysztof Kozlowski
b6f1ea2a 2014c95a

+79 -37
+66 -33
Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml
··· 11 11 - Krzysztof Kozlowski <krzk@kernel.org> 12 12 13 13 description: | 14 - USI IP-core provides selectable serial protocol (UART, SPI or High-Speed I2C). 15 - USI shares almost all internal circuits within each protocol, so only one 16 - protocol can be chosen at a time. USI is modeled as a node with zero or more 17 - child nodes, each representing a serial sub-node device. The mode setting 18 - selects which particular function will be used. 14 + The USI IP-core provides configurable support for serial protocols, enabling 15 + different serial communication modes depending on the version. 16 + 17 + In USIv1, configurations are available to enable either one or two protocols 18 + simultaneously in select combinations - High-Speed I2C0, High-Speed 19 + I2C1, SPI, UART, High-Speed I2C0 and I2C1 or both High-Speed 20 + I2C1 and UART. 21 + 22 + In USIv2, only one protocol can be active at a time, either UART, SPI, or 23 + High-Speed I2C. 24 + 25 + The USI core shares internal circuits across protocols, meaning only the 26 + selected configuration is active at any given time. USI is modeled as a node 27 + with zero or more child nodes, each representing a serial sub-node device. The 28 + mode setting selects which particular function will be used. 19 29 20 30 properties: 21 31 $nodename: ··· 41 31 - const: samsung,exynos850-usi 42 32 - enum: 43 33 - samsung,exynos850-usi 34 + - samsung,exynos8895-usi 44 35 45 36 reg: 46 37 maxItems: 1 ··· 75 64 76 65 samsung,mode: 77 66 $ref: /schemas/types.yaml#/definitions/uint32 78 - enum: [0, 1, 2, 3] 67 + enum: [0, 1, 2, 3, 4, 5, 6] 79 68 description: 80 69 Selects USI function (which serial protocol to use). Refer to 81 70 <include/dt-bindings/soc/samsung,exynos-usi.h> for valid USI mode values. ··· 112 101 - samsung,sysreg 113 102 - samsung,mode 114 103 115 - if: 116 - properties: 117 - compatible: 118 - contains: 119 - enum: 120 - - samsung,exynos850-usi 104 + allOf: 105 + - if: 106 + properties: 107 + compatible: 108 + contains: 109 + enum: 110 + - samsung,exynos850-usi 121 111 122 - then: 123 - properties: 124 - reg: 125 - maxItems: 1 112 + then: 113 + properties: 114 + reg: 115 + maxItems: 1 126 116 127 - clocks: 128 - items: 129 - - description: Bus (APB) clock 130 - - description: Operating clock for UART/SPI/I2C protocol 117 + clocks: 118 + items: 119 + - description: Bus (APB) clock 120 + - description: Operating clock for UART/SPI/I2C protocol 131 121 132 - clock-names: 133 - maxItems: 2 122 + clock-names: 123 + maxItems: 2 134 124 135 - required: 136 - - reg 137 - - clocks 138 - - clock-names 125 + samsung,mode: 126 + enum: [0, 1, 2, 3] 139 127 140 - else: 141 - properties: 142 - reg: false 143 - clocks: false 144 - clock-names: false 145 - samsung,clkreq-on: false 128 + required: 129 + - reg 130 + - clocks 131 + - clock-names 132 + 133 + - if: 134 + properties: 135 + compatible: 136 + contains: 137 + enum: 138 + - samsung,exynos8895-usi 139 + 140 + then: 141 + properties: 142 + reg: false 143 + 144 + clocks: 145 + items: 146 + - description: Bus (APB) clock 147 + - description: Operating clock for UART/SPI protocol 148 + 149 + clock-names: 150 + maxItems: 2 151 + 152 + samsung,clkreq-on: false 153 + 154 + required: 155 + - clocks 156 + - clock-names 146 157 147 158 additionalProperties: false 148 159 ··· 177 144 compatible = "samsung,exynos850-usi"; 178 145 reg = <0x138200c0 0x20>; 179 146 samsung,sysreg = <&sysreg_peri 0x1010>; 180 - samsung,mode = <USI_V2_UART>; 147 + samsung,mode = <USI_MODE_UART>; 181 148 samsung,clkreq-on; /* needed for UART mode */ 182 149 #address-cells = <1>; 183 150 #size-cells = <1>;
+13 -4
include/dt-bindings/soc/samsung,exynos-usi.h
··· 9 9 #ifndef __DT_BINDINGS_SAMSUNG_EXYNOS_USI_H 10 10 #define __DT_BINDINGS_SAMSUNG_EXYNOS_USI_H 11 11 12 - #define USI_V2_NONE 0 13 - #define USI_V2_UART 1 14 - #define USI_V2_SPI 2 15 - #define USI_V2_I2C 3 12 + #define USI_MODE_NONE 0 13 + #define USI_MODE_UART 1 14 + #define USI_MODE_SPI 2 15 + #define USI_MODE_I2C 3 16 + #define USI_MODE_I2C1 4 17 + #define USI_MODE_I2C0_1 5 18 + #define USI_MODE_UART_I2C1 6 19 + 20 + /* Deprecated */ 21 + #define USI_V2_NONE USI_MODE_NONE 22 + #define USI_V2_UART USI_MODE_UART 23 + #define USI_V2_SPI USI_MODE_SPI 24 + #define USI_V2_I2C USI_MODE_I2C 16 25 17 26 #endif /* __DT_BINDINGS_SAMSUNG_EXYNOS_USI_H */