riscv: Add FPIOA and GPIO support for Kendryte K210
Subsystems (5)
v4 cover riscv: Add FPIOA and GPIO support for Kendryte K210
This patch series adds support for pinmuxing, gpios, and leds on the Kendyte K210.
This patch series was previously part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576
This patch series depends on
https://patchwork.ozlabs.org/project/uboot/list/?series=178480
Changes in v4:
- Add sandbox dt-binding headers to MAINTAINERS
- Add test for led behavior
- Add test/dm/pinmux.c to patch
- Move sandbox_* variables into a priv structure. This resets them to the default state every time we re-probe.
- Reformat documentation in dm/pinctrl.h
Changes in v3:
- Add dt-bindings/pinctrl/sandbox-pinmux.h to patch
Changes in v2:
- Add test for pinmuxing
- Don't clear existing pinctrl settings on probe
- Re-order GPIOs to match the defaults more closely
- Rebase onto v13 of "riscv: Add Sipeed Maix support"
- Rewrite FPIOA driver to use pinmux property
- Support muxing the output enable signal for each function in the FPIOA
- Support output and input inversion in the pinmux driver
- Support pinmux property in pinctrl-generic
Sean Anderson (12):
pinctrl: Add pinmux property support to pinctrl-generic
pinctrl: Reformat documentation in dm/pinctrl.h
test: pinmux: Add test for pin muxing
pinctrl: Add support for Kendryte K210 FPIOA
gpio: sifive: Use generic reg read function
gpio: dw: Fix warnings about casting int to pointer
gpio: dw: Add a trailing underscore to generated name
gpio: dw: Return output value when direction is out
led: gpio: Default to using node name if label is absent
test: dm: Test for default led naming
riscv: Add pinmux and gpio bindings for Kendryte K210
riscv: Add FPIOA and GPIO support for Kendryte K210
MAINTAINERS | 3 + arch/riscv/dts/k210-maix-bit.dts | 104 +++ arch/riscv/dts/k210.dtsi | 12 + arch/sandbox/dts/test.dts | 47 +- board/sipeed/maix/Kconfig | 9 + doc/board/sipeed/maix.rst | 64 +- .../pinctrl/kendryte,k210-fpioa.txt | 102 +++ .../pinctrl/pinctrl-bindings.txt | 65 +- drivers/gpio/dwapb_gpio.c | 33 +- drivers/gpio/sifive-gpio.c | 2 +- drivers/led/led_gpio.c | 7 +- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/kendryte/Kconfig | 7 + drivers/pinctrl/kendryte/Makefile | 1 + drivers/pinctrl/kendryte/pinctrl.c | 678 ++++++++++++++++++ drivers/pinctrl/kendryte/pinctrl.h | 70 ++ drivers/pinctrl/pinctrl-generic.c | 125 +++- drivers/pinctrl/pinctrl-sandbox.c | 186 +++-- include/dm/pinctrl.h | 360 +++++++--- include/dt-bindings/pinctrl/k210-pinctrl.h | 277 +++++++ include/dt-bindings/pinctrl/sandbox-pinmux.h | 19 + test/dm/Makefile | 3 + test/dm/led.c | 3 +- test/dm/pinmux.c | 57 ++ test/py/tests/test_pinmux.py | 36 +- 26 files changed, 2027 insertions(+), 245 deletions(-) create mode 100644 doc/device-tree-bindings/pinctrl/kendryte,k210-fpioa.txt create mode 100644 drivers/pinctrl/kendryte/Kconfig create mode 100644 drivers/pinctrl/kendryte/Makefile create mode 100644 drivers/pinctrl/kendryte/pinctrl.c create mode 100644 drivers/pinctrl/kendryte/pinctrl.h create mode 100644 include/dt-bindings/pinctrl/k210-pinctrl.h create mode 100644 include/dt-bindings/pinctrl/sandbox-pinmux.h create mode 100644 test/dm/pinmux.c
Signature · 1 line
2.26.2
PATCH v4 1/12 pinctrl: Add pinmux property support to pinctrl-generic
The pinmux property allows for smaller and more compact device trees, especially when there are many pins which need to be assigned individually. Instead of specifying an array of strings to be parsed as pins and a function property, the pinmux property contains an array of integers representing pinmux groups. A pinmux group consists of the pin identifier and mux settings represented as a single integer or an array of integers. Each individual pin controller driver specifies the exact format of a pinmux group. As specified in the Linux documentation, a pinmux group may be multiple integers long. However, no existing drivers use multi-integer pinmux groups, so I have chosen to omit this feature. This makes the implementation easier, since there is no need to allocate a buffer to do endian conversions.
Support for the pinmux property is done differently than in Linux. As far as I can tell, inversion of control is used when implementing support for the pins and groups properties to avoid allocating. This results in some duplication of effort; every property in a config node is parsed once for each pin in that node. This is not such an overhead with pins and groups properties, since having multiple pins in one config node does not occur especially often. However, the semantics of the pinmux property make such a configuration much more appealing. A future patch could parse all config properties at once and store them in an array. This would make it easier to create drivers which do not function solely as callbacks from pinctrl-generic.
This commit increases the size of the sandbox build by approximately 48 bytes. However, it also decreases the size of the K210 device tree by 2 KiB from the previous version of this series.
The documentation has been updated from the last Linux commit before it was split off into yaml files.
---
(no changes since v2)
Changes in v2:
- New
.../pinctrl/pinctrl-bindings.txt | 65 ++++++++- drivers/pinctrl/pinctrl-generic.c | 125 ++++++++++++++---- include/dm/pinctrl.h | 21 +-- 3 files changed, 168 insertions(+), 43 deletions(-)
doc/device-tree-bindings/pinctrl/pinctrl-bindings.txt +59 -6
@@ -119,7 +119,8 @@ For example: The contents of each of those pin configuration child nodes is defined entirely by the binding for the individual pin controller device. There -exists no common standard for this content. +exists no common standard for this content. The pinctrl framework only +provides generic helper bindings that the pin controller driver can use. The pin configuration nodes need not be direct children of the pin controller device; they may be grandchildren, for example. Whether this is legal, and
@@ -156,6 +157,29 @@ state_2_node_a { pins = "mfio29", "mfio30"; }; +For hardware where pin multiplexing configurations have to be specified for +each single pin the number of required sub-nodes containing "pin" and +"function" properties can quickly escalate and become hard to write and +maintain. + +For cases like this, the pin controller driver may use the pinmux helper +property, where the pin identifier is provided with mux configuration settings +in a pinmux group. A pinmux group consists of the pin identifier and mux +settings represented as a single integer or an array of integers. + +The pinmux property accepts an array of pinmux groups, each of them describing +a single pin multiplexing configuration. + +pincontroller { + state_0_node_a { + pinmux = <PINMUX_GROUP>, <PINMUX_GROUP>, ...; + }; +}; + +Each individual pin controller driver bindings documentation shall specify +how pin IDs and pin multiplexing configuration are defined and assembled +together in a pinmux group. + == Generic pin configuration node content == Many data items that are represented in a pin configuration node are common
@@ -168,12 +192,15 @@ structure of the DT nodes that contain these properties. Supported generic properties are: pins - the list of pins that properties in the node - apply to (either this or "group" has to be + apply to (either this, "group" or "pinmux" has to be specified) group - the group to apply the properties to, if the driver supports configuration of whole groups rather than - individual pins (either this or "pins" has to be - specified) + individual pins (either this, "pins" or "pinmux" has + to be specified) +pinmux - the list of numeric pin ids and their mux settings + that properties in the node apply to (either this, + "pins" or "groups" have to be specified) bias-disable - disable any pin bias bias-high-impedance - high impedance mode ("third-state", "floating") bias-bus-hold - latch weakly
@@ -184,17 +211,30 @@ drive-push-pull - drive actively high and low drive-open-drain - drive with open drain drive-open-source - drive with open source drive-strength - sink or source at most X mA -input-enable - enable input on pin (no effect on output) -input-disable - disable input on pin (no effect on output) +drive-strength-microamp - sink or source at most X uA +input-enable - enable input on pin (no effect on output, such as + enabling an input buffer) +input-disable - disable input on pin (no effect on output, such as + disabling an input buffer) input-schmitt-enable - enable schmitt-trigger mode input-schmitt-disable - disable schmitt-trigger mode input-debounce - debounce mode with debound time X power-source - select between different power supplies low-power-enable - enable low power mode low-power-disable - disable low power mode +output-disable - disable output on a pin (such as disable an output + buffer) +output-enable - enable output on a pin without actively driving it + (such as enabling an output buffer) output-low - set the pin to output mode with low level output-high - set the pin to output mode with high level +sleep-hardware-state - indicate this is sleep related state which will be programmed + into the registers for the sleep state. slew-rate - set the slew rate +skew-delay - this affects the expected clock skew on input pins + and the delay before latching a value to an output + pin. Typically indicates how many double-inverters are + used to delay the signal. For example:
@@ -216,6 +256,12 @@ state_2_node_a { bias-pull-up; }; }; +state_3_node_a { + mux { + pinmux = <GPIOx_PINm_MUXn>, <GPIOx_PINj_MUXk)>; + input-enable; + }; +}; Some of the generic properties take arguments. For those that do, the arguments are described below.
@@ -224,11 +270,18 @@ arguments are described below. binding for the hardware defines: - Whether the entries are integers or strings, and their meaning. +- pinmux takes a list of pin IDs and mux settings as required argument. The + specific bindings for the hardware defines: + - How pin IDs and mux settings are defined and assembled together in a single + integer or an array of integers. + - bias-pull-up, -down and -pin-default take as optional argument on hardware supporting it the pull strength in Ohm. bias-disable will disable the pull. - drive-strength takes as argument the target strength in mA. +- drive-strength-microamp takes as argument the target strength in uA. + - input-debounce takes the debounce time in usec as argument or 0 to disable debouncing
drivers/pinctrl/pinctrl-generic.c +96 -29
183 lines not on this page · raw message
include/dm/pinctrl.h +13 -8
@@ -34,29 +34,33 @@ struct pinconf_param {* depending on your necessity. * * @get_pins_count: return number of selectable named pins available -* in this driver. (necessary to parse "pins" property in DTS) +* in this driver. (necessary to parse "pins" property in DTS) * @get_pin_name: return the pin name of the pin selector, * called by the core to figure out which pin it shall do -* operations to. (necessary to parse "pins" property in DTS) +* operations to. (necessary to parse "pins" property in DTS) * @get_groups_count: return number of selectable named groups available -* in this driver. (necessary to parse "groups" property in DTS) +* in this driver. (necessary to parse "groups" property in DTS) * @get_group_name: return the group name of the group selector, * called by the core to figure out which pin group it shall do -* operations to. (necessary to parse "groups" property in DTS) +* operations to. (necessary to parse "groups" property in DTS) * @get_functions_count: return number of selectable named functions available -* in this driver. (necessary for pin-muxing) +* in this driver. (necessary for pin-muxing) * @get_function_name: return the function name of the muxing selector, * called by the core to figure out which mux setting it shall map a -* certain device to. (necessary for pin-muxing) +* certain device to. (necessary for pin-muxing) * @pinmux_set: enable a certain muxing function with a certain pin. * The @func_selector selects a certain function whereas @pin_selector * selects a certain pin to be used. On simple controllers one of them -* may be ignored. (necessary for pin-muxing against a single pin) +* may be ignored. (necessary for pin-muxing against a single pin) * @pinmux_group_set: enable a certain muxing function with a certain pin -* group. The @func_selector selects a certain function whereas +* group. The @func_selector selects a certain function whereas * @group_selector selects a certain set of pins to be used. On simple * controllers one of them may be ignored. * (necessary for pin-muxing against a pin group) +* @pinmux_property_set: enable a pinmux group. @pinmux_group should specify the +* pin identifier and mux settings. The exact format of a pinmux group is +* left up to the driver. The pin selector for the mux-ed pin should be +* returned on success. (necessary to parse the "pinmux" property in DTS) * @pinconf_num_params: number of driver-specific parameters to be parsed * from device trees (necessary for pin-configuration) * @pinconf_params: list of driver_specific parameters to be parsed from
@@ -90,6 +94,7 @@ struct pinctrl_ops { unsigned func_selector);int (*pinmux_group_set)(struct udevice *dev,unsigned group_selector,unsigned func_selector); +int (*pinmux_property_set)(struct udevice *dev,u32 pinmux_group);unsigned int pinconf_num_params;const struct pinconf_param *pinconf_params; int (*pinconf_set)(struct udevice *dev, unsigned pin_selector,
Signature · 1 line
2.26.2
PATCH v4 2/12 pinctrl: Reformat documentation in dm/pinctrl.h
In reply to Sean AndersonThis normalizes the documentatation to conform to kernel-doc style [1]. It also moves the documentation for pinctrl_ops inline, and adds argument and return-value documentation. I have kept the usual function style for these comments. I could not find any existing examples of function documentation inside structs.
[1] https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html
---
Changes in v4:
- New
include/dm/pinctrl.h | 363 ++++++++++++++++++++++++++++--------------- 1 file changed, 242 insertions(+), 121 deletions(-)
include/dm/pinctrl.h +242 -121
@@ -11,11 +11,10 @@/** * struct pinconf_param - pin config parameters -* -* @property: property name in DT nodes -* @param: ID for this config parameter -* @default_value: default value for this config parameter used in case -* no value is specified in DT nodes +* @property: Property name in DT nodes +* @param: ID for this config parameter +* @default_value: default value for this config parameter used in case +* no value is specified in DT nodes */ struct pinconf_param {const char *const property;
@@ -27,111 +26,228 @@ struct pinconf_param {* struct pinctrl_ops - pin control operations, to be implemented by * pin controller drivers. * -* The @set_state is the only mandatory operation. You can implement your -* pinctrl driver with its own @set_state. In this case, the other callbacks -* are not required. Otherwise, generic pinctrl framework is also available; -* use pinctrl_generic_set_state for @set_state, and implement other operations +* set_state() is the only mandatory operation. You can implement your pinctrl +* driver with its own @set_state. In this case, the other callbacks are not +* required. Otherwise, generic pinctrl framework is also available; use +* pinctrl_generic_set_state for @set_state, and implement other operations * depending on your necessity. -* -* @get_pins_count: return number of selectable named pins available -* in this driver. (necessary to parse "pins" property in DTS) -* @get_pin_name: return the pin name of the pin selector, -* called by the core to figure out which pin it shall do -* operations to. (necessary to parse "pins" property in DTS) -* @get_groups_count: return number of selectable named groups available -* in this driver. (necessary to parse "groups" property in DTS) -* @get_group_name: return the group name of the group selector, -* called by the core to figure out which pin group it shall do -* operations to. (necessary to parse "groups" property in DTS) -* @get_functions_count: return number of selectable named functions available -* in this driver. (necessary for pin-muxing) -* @get_function_name: return the function name of the muxing selector, -* called by the core to figure out which mux setting it shall map a -* certain device to. (necessary for pin-muxing) -* @pinmux_set: enable a certain muxing function with a certain pin. -* The @func_selector selects a certain function whereas @pin_selector -* selects a certain pin to be used. On simple controllers one of them -* may be ignored. (necessary for pin-muxing against a single pin) -* @pinmux_group_set: enable a certain muxing function with a certain pin -* group. The @func_selector selects a certain function whereas -* @group_selector selects a certain set of pins to be used. On simple -* controllers one of them may be ignored. -* (necessary for pin-muxing against a pin group) -* @pinmux_property_set: enable a pinmux group. @pinmux_group should specify the -* pin identifier and mux settings. The exact format of a pinmux group is -* left up to the driver. The pin selector for the mux-ed pin should be -* returned on success. (necessary to parse the "pinmux" property in DTS) -* @pinconf_num_params: number of driver-specific parameters to be parsed -* from device trees (necessary for pin-configuration) -* @pinconf_params: list of driver_specific parameters to be parsed from -* device trees (necessary for pin-configuration) -* @pinconf_set: configure an individual pin with a given parameter. -* (necessary for pin-configuration against a single pin) -* @pinconf_group_set: configure all pins in a group with a given parameter. -* (necessary for pin-configuration against a pin group) -* @set_state: do pinctrl operations specified by @config, a pseudo device -* pointing a config node. (necessary for pinctrl_full) -* @set_state_simple: do needed pinctrl operations for a peripherl @periph. -* (necessary for pinctrl_simple) -* @get_pin_muxing: display the muxing of a given pin. -* @gpio_request_enable: requests and enables GPIO on a certain pin. -* Implement this only if you can mux every pin individually as GPIO. The -* affected GPIO range is passed along with an offset(pin number) into that -* specific GPIO range - function selectors and pin groups are orthogonal -* to this, the core will however make sure the pins do not collide. -* @gpio_disable_free: free up GPIO muxing on a certain pin, the reverse of -* @gpio_request_enable */ struct pinctrl_ops { +/** +* get_pins_count() - Get the number of selectable pins +* @dev: Pinctrl device to use +* +* This function is necessary to parse the "pins" property in DTS. +* +* Return: number of selectable named pins available in this driver +*/ int (*get_pins_count)(struct udevice *dev); + +/** +* get_pin_name() - Get the name of a pin +* @dev: Pinctrl device of the pin +* @selector: The pin selector +* +* This function is called by the core to figure out which pin it shall +* do operations to. This function is necessary to parse the "pins" +* property in DTS. +* +* Return: const pointer to the name of the pin +*/ const char *(*get_pin_name)(struct udevice *dev,unsigned selector); + +/** +* get_groups_count() - Get the number of selectable groups +* @dev: Pinctrl device to use +* +* This function is necessary to parse the "groups" property in DTS. +* +* Return: number of selectable named groups available in the driver +*/ int (*get_groups_count)(struct udevice *dev); + +/** +* get_group_name() - Get the name of a group +* @dev: Pinctrl device of the group +* @selector: The group selector +* +* This function is called by the core to figure out which group it +* shall do operations to. This function is necessary to parse the +* "groups" property in DTS. +* +* Return: const pointer to the name of the group +*/ const char *(*get_group_name)(struct udevice *dev,unsigned selector); + +/** +* get_functions_count() - Get the number of selectable functions +* @dev: Pinctrl device to use +* +* This function is necessary for pin-muxing. +* +* Return: number of selectable named functions available in this driver +*/ int (*get_functions_count)(struct udevice *dev); + +/** +* get_function_name() - Get the name of a function +* @dev: Pinmux device of the function +* @selector: The function selector +* +* This function is called by the core to figure out which mux setting +* it shall map a certain device to. This function is necessary for +* pin-muxing. +* +* Return: const pointer to the function name of the muxing selector +*/ const char *(*get_function_name)(struct udevice *dev,unsigned selector); + +/** +* pinmux_set() - Mux a pin to a function +* @dev: Pinctrl device to use +* @pin_selector: The pin selector +* @func_selector: The func selector +* +* On simple controllers one of @pin_selector or @func_selector may be +* ignored. This function is necessary for pin-muxing against a single +* pin. +* +* Return: 0 if OK, or negative error code on failure +*/ int (*pinmux_set)(struct udevice *dev,unsigned pin_selector,unsigned func_selector); + +/** +* pinmux_set() - Mux a group of pins to a function +* @dev: Pinctrl device to use +* @group_selector: The group selector +* @func_selector: The func selector +* +* On simple controllers one of @group_selector or @func_selector may be +* ignored. This function is necessary for pin-muxing against a group of +* pins. +* +* Return: 0 if OK, or negative error code on failure +*/ int (*pinmux_group_set)(struct udevice *dev,unsigned group_selector,unsigned func_selector); + +/** +* pinmux_property_set() - Enable a pinmux group +* @dev: Pinctrl device to use +* @pinmux_group: A u32 representing the pin identifier and mux +* settings. The exact format of a pinmux group is +* left up to the driver. +* +* Mux a single pin to a single function based on a driver-specific +* pinmux group. This function is necessary for parsing the "pinmux" +* property in DTS, and for pin-muxing against a pinmux group. +* +* Return: pin selector for the muxed pin if OK, or negative error code +* on failure +*/ int (*pinmux_property_set)(struct udevice *dev,u32 pinmux_group); + +/** +* @pinconf_num_params: Number of driver-specific parameters to be +* parsed from device trees. This member is +* necessary for pin configuration. +*/ unsigned int pinconf_num_params; + +/** +* @pinconf_params: List of driver-specific parameters to be parsed +* from the device tree. This member is necessary +* for pin configuration. +*/ const struct pinconf_param *pinconf_params; + +/** +* pinconf_set() - configure an individual pin with a parameter +* @dev: Pinctrl device to use +* @pin_selector: The pin selector +* @param: A &enum pin_config_param from @pinconf_params +* @argument: The argument to this param from the device tree +* +* This function is necessary for pin configuration against a single +* pin. +* +* Return: 0 if OK, or negative error code on failure +*/ int (*pinconf_set)(struct udevice *dev,unsigned pin_selector,unsigned param,unsigned argument); + +/** +* pinconf_group_set() - configure all pins in a group with a parameter +* @dev: Pinctrl device to use +* @pin_selector: The group selector +* @param: A &enum pin_config_param from @pinconf_params +* @argument: The argument to this param from the device tree +* +* This function is necessary for pin configuration against a group of +* pins. +* +* Return: 0 if OK, or negative error code on failure +*/ int (*pinconf_group_set)(struct udevice *dev,unsigned group_selector,unsigned param,unsigned argument); + +/** +* set_state() - Configure a pinctrl device +* @dev: Pinctrl device to use +* @config: Pseudo device pointing a config node +* +* This function is required to be implemented by all pinctrl drivers. +* Drivers may set this member to pinctrl_generic_set_state(), which +* will call other functions in &struct pinctrl_ops to parse @config. +* +* Return: 0 if OK, or negative error code on failure +*/ int (*set_state)(struct udevice *dev,struct udevice *config); -/* for pinctrl-simple */ +/** +* set_state_simple() - Configure a pinctrl device +* @dev: Pinctrl device to use +* @config: Pseudo-device pointing a config node +* +* This function is usually a simpler version of set_state(). Only the +* first pinctrl device on the system is supported by this function. +* +* Return: 0 if OK, or negative error code on failure +*/ int (*set_state_simple)(struct udevice *dev,struct udevice *periph); +/** * request() - Request a particular pinctrl function +* @dev: Device to adjust (UCLASS_PINCTRL) +* @func: Function number (driver-specific) * * This activates the selected function. * -* @dev: Device to adjust (UCLASS_PINCTRL) -* @func: Function number (driver-specific) -* @return 0 if OK, -ve on error +* Return: 0 if OK, or negative error code on failure */ int (*request)(struct udevice *dev,int func,int flags);/** * get_periph_id() - get the peripheral ID for a device +* @dev: Pinctrl device to use for decoding +* @periph: Device to check * * This generally looks at the peripheral's device tree node to work * out the peripheral ID. The return value is normally interpreted as * enum periph_id. so long as this is defined by the platform (which it * should be). * -* @dev: Pinctrl device to use for decoding -* @periph: Device to check -* @return peripheral ID of @periph, or -ENOENT on error +* Return: peripheral ID of @periph, or -ENOENT on error */ int (*get_periph_id)(struct udevice *dev,struct udevice *periph);/** * get_gpio_mux() - get the mux value for a particular GPIO +* @dev: Pinctrl device to use +* @banknum: GPIO bank number +* @index: GPIO index within the bank * * This allows the raw mux value for a GPIO to be obtained. It is * useful for displaying the function being used by that GPIO, such
@@ -139,46 +255,50 @@ struct pinctrl_ops {* subsystem and should not be used by generic code. Typically it is * used by a GPIO driver with knowledge of the SoC pinctrl setup. * -* @dev: Pinctrl device to use -* @banknum: GPIO bank number -* @index: GPIO index within the bank -* @return mux value (SoC-specific, e.g. 0 for input, 1 for output) +* Return: mux value (SoC-specific, e.g. 0 for input, 1 for output) */ int (*get_gpio_mux)(struct udevice *dev,int banknum,int index);/** * get_pin_muxing() - show pin muxing -* -* This allows to display the muxing of a given pin. It's useful for -* debug purpose to know if a pin is configured as GPIO or as an -* alternate function and which one. -* Typically it is used by a PINCTRL driver with knowledge of the SoC -* pinctrl setup. -* * @dev: Pinctrl device to use * @selector: Pin selector * @buf Pin's muxing description * @size Pin's muxing description length -* return 0 if OK, -ve on error +* +* This allows to display the muxing of a given pin. It's useful for +* debug purposes to know if a pin is configured as GPIO or as an +* alternate function and which one. Typically it is used by a PINCTRL +* driver with knowledge of the SoC pinctrl setup. +* +* Return: 0 if OK, or negative error code on failure */ int (*get_pin_muxing)(struct udevice *dev,unsigned int selector,char *buf,int size);/** -* gpio_request_enable: requests and enables GPIO on a certain pin. -* +* gpio_request_enable() - request and enable GPIO on a certain pin. * @dev: Pinctrl device to use * @selector: Pin selector -* return 0 if OK, -ve on error +* +* Implement this only if you can mux every pin individually as GPIO. +* The affected GPIO range is passed along with an offset(pin number) +* into that specific GPIO range - function selectors and pin groups are +* orthogonal to this, the core will however make sure the pins do not +* collide. +* +* Return: 0 if OK, or negative error code on failure */ int (*gpio_request_enable)(struct udevice *dev,unsigned int selector);/** -* gpio_disable_free: free up GPIO muxing on a certain pin. -* +* gpio_disable_free() - free up GPIO muxing on a certain pin. * @dev: Pinctrl device to use * @selector: Pin selector -* return 0 if OK, -ve on error +* +* This function is the reverse of gpio_request_enable(). +* +* Return: 0 if OK, or negative error code on failure */ int (*gpio_disable_free)(struct udevice *dev,unsigned int selector); };
@@ -230,8 +350,8 @@ struct pinctrl_ops {* push-pull mode, the argument is ignored. * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current * passed as argument. The argument is in mA. -* @PIN_CONFIG_DRIVE_STRENGTH_UA: the pin will sink or source at most the current -* passed as argument. The argument is in uA. +* @PIN_CONFIG_DRIVE_STRENGTH_UA: the pin will sink or source at most the +* current passed as argument. The argument is in uA. * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, * which means it will wait for signals to settle when reading inputs. The * argument gives the debounce time in usecs. Setting the
@@ -307,12 +427,13 @@ enum pin_config_param {#if CONFIG_IS_ENABLED (PINCTRL_GENERIC )/** * pinctrl_generic_set_state() - generic set_state operation +* @pctldev: Pinctrl device to use +* @config: Config device (pseudo device), pointing a config node in DTS +* * Parse the DT node of @config and its children and handle generic properties * such as "pins", "groups", "functions", and pin configuration parameters. * -* @pctldev: pinctrl device -* @config: config device (pseudo device), pointing a config node in DTS -* @return: 0 on success, or negative error code on failure +* Return: 0 on success, or negative error code on failure */ int pinctrl_generic_set_state (struct udevice *pctldev,struct udevice *config);#else
@@ -326,10 +447,10 @@ static inline int pinctrl_generic_set_state(struct udevice *pctldev,#if CONFIG_IS_ENABLED (PINCTRL )/** * pinctrl_select_state() - set a device to a given state +* @dev: Peripheral device +* @statename: State name, like "default" * -* @dev: peripheral device -* @statename: state name, like "default" -* @return: 0 on success, or negative error code on failure +* Return: 0 on success, or negative error code on failure */ int pinctrl_select_state (struct udevice *dev,const char *statename);#else
@@ -342,40 +463,43 @@ static inline int pinctrl_select_state(struct udevice *dev,/** * pinctrl_request() - Request a particular pinctrl function -* -* @dev: Device to check (UCLASS_PINCTRL) +* @dev: Pinctrl device to use * @func: Function number (driver-specific) * @flags: Flags (driver-specific) -* @return 0 if OK, -ve on error +* +* Return: 0 if OK, or negative error code on failure */ int pinctrl_request (struct udevice *dev,int func,int flags);/** * pinctrl_request_noflags() - Request a particular pinctrl function +* @dev: Pinctrl device to use +* @func: Function number (driver-specific) * * This is similar to pinctrl_request() but uses 0 for @flags. * -* @dev: Device to check (UCLASS_PINCTRL) -* @func: Function number (driver-specific) -* @return 0 if OK, -ve on error +* Return: 0 if OK, or negative error code on failure */ int pinctrl_request_noflags (struct udevice *dev,int func);/** * pinctrl_get_periph_id() - get the peripheral ID for a device +* @dev: Pinctrl device to use for decoding +* @periph: Device to check * * This generally looks at the peripheral's device tree node to work out the * peripheral ID. The return value is normally interpreted as enum periph_id. * so long as this is defined by the platform (which it should be). * -* @dev: Pinctrl device to use for decoding -* @periph: Device to check -* @return peripheral ID of @periph, or -ENOENT on error +* Return: peripheral ID of @periph, or -ENOENT on error */ int pinctrl_get_periph_id (struct udevice *dev,struct udevice *periph);/** * pinctrl_get_gpio_mux() - get the mux value for a particular GPIO +* @dev: Pinctrl device to use +* @banknum: GPIO bank number +* @index: GPIO index within the bank * * This allows the raw mux value for a GPIO to be obtained. It is * useful for displaying the function being used by that GPIO, such
@@ -383,66 +507,63 @@ int pinctrl_get_periph_id(struct udevice *dev, struct udevice *periph);* subsystem and should not be used by generic code. Typically it is * used by a GPIO driver with knowledge of the SoC pinctrl setup. * -* @dev: Pinctrl device to use -* @banknum: GPIO bank number -* @index: GPIO index within the bank -* @return mux value (SoC-specific, e.g. 0 for input, 1 for output) +* Return: mux value (SoC-specific, e.g. 0 for input, 1 for output) */ int pinctrl_get_gpio_mux (struct udevice *dev,int banknum,int index);/** * pinctrl_get_pin_muxing() - Returns the muxing description +* @dev: Pinctrl device to use +* @selector: Pin index within pin-controller +* @buf: Pin's muxing description +* @size: Pin's muxing description length * * This allows to display the muxing description of the given pin for * debug purpose * -* @dev: Pinctrl device to use -* @selector Pin index within pin-controller -* @buf Pin's muxing description -* @size Pin's muxing description length -* @return 0 if OK, -ve on error +* Return: 0 if OK, or negative error code on failure */ int pinctrl_get_pin_muxing (struct udevice *dev,int selector,char *buf,int size);/** * pinctrl_get_pins_count() - display pin-controller pins number +* @dev: Pinctrl device to use * * This allows to know the number of pins owned by a given pin-controller * -* @dev: Pinctrl device to use -* @return pins number if OK, -ve on error +* Return: number of pins if OK, or negative error code on failure */ int pinctrl_get_pins_count (struct udevice *dev);/** * pinctrl_get_pin_name() - Returns the pin's name +* @dev: Pinctrl device to use +* @selector: Pin index within pin-controller +* @buf: Pin's name * * This allows to display the pin's name for debug purpose * -* @dev: Pinctrl device to use -* @selector Pin index within pin-controller -* @buf Pin's name -* @return 0 if OK, -ve on error +* Return: 0 if OK, or negative error code on failure */ int pinctrl_get_pin_name (struct udevice *dev,int selector,char *buf,int size);/** * pinctrl_gpio_request() - request a single pin to be used as GPIO +* @dev: GPIO peripheral device +* @offset: GPIO pin offset from the GPIO controller * -* @dev: GPIO peripheral device -* @offset: the GPIO pin offset from the GPIO controller -* @return: 0 on success, or negative error code on failure +* Return: 0 on success, or negative error code on failure */ int pinctrl_gpio_request (struct udevice *dev,unsigned offset);/** * pinctrl_gpio_free() - free a single pin used as GPIO +* @dev: GPIO peripheral device +* @offset: GPIO pin offset from the GPIO controller * -* @dev: GPIO peripheral device -* @offset: the GPIO pin offset from the GPIO controller -* @return: 0 on success, or negative error code on failure +* Return: 0 on success, or negative error code on failure */ int pinctrl_gpio_free (struct udevice *dev,unsigned offset);
Signature · 1 line
2.26.2
PATCH v4 2/12 pinctrl: Reformat documentation in dm/pinctrl.h
Quoted 9 lines · Sean Anderson
This normalizes the documentatation to conform to kernel-doc style [1]. It also moves the documentation for
pinctrl_opsinline, and adds argument and return-value documentation. I have kept the usual function style for these comments. I could not find any existing examples of function documentation inside structs.[1] https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html
Quoted 8 lines
Signed-off-by Sean Anderson <[email protected]>---
Changes in v4:
- Newinclude/dm/pinctrl.h | 363 ++++++++++++++++++++++++++++--------------- 1 file changed, 242 insertions(+), 121 deletions(-)
PATCH v4 3/12 test: pinmux: Add test for pin muxing
In reply to Sean AndersonThis extends the pinctrl-sandbox driver to support pin muxing, and adds a test for that behaviour. The test is done in C and not python (like the existing tests for the pinctrl uclass) because it needs to call pinctrl_select_state. Another option could be to add a command that invokes pinctrl_select_state and then test everything in test/py/tests/test_pinmux.py.
The pinctrl-sandbox driver now mimics the way that many pinmux devices work. There are two groups of pins which are muxed together, as well as four pins which are muxed individually. I have tried to test all normal paths. However, very few error cases are explicitly checked for.
---
Changes in v4:
- Add sandbox dt-binding headers to MAINTAINERS
- Add test/dm/pinmux.c to patch
- Move sandbox_* variables into a priv structure. This resets them to the default state every time we re-probe.
Changes in v3:
- Add dt-bindings/pinctrl/sandbox-pinmux.h to patch
Changes in v2:
- New
MAINTAINERS | 1 + arch/sandbox/dts/test.dts | 45 ++++- drivers/pinctrl/pinctrl-sandbox.c | 186 ++++++++++++++----- include/dt-bindings/pinctrl/sandbox-pinmux.h | 19 ++ test/dm/Makefile | 3 + test/dm/pinmux.c | 57 ++++++ test/py/tests/test_pinmux.py | 36 ++-- 7 files changed, 274 insertions(+), 73 deletions(-) create mode 100644 include/dt-bindings/pinctrl/sandbox-pinmux.h create mode 100644 test/dm/pinmux.c
MAINTAINERS +1 -0
@@ -901,6 +901,7 @@ SANDBOX M: Simon Glass <[email protected]> S: Maintained F: arch/sandbox/ +F: include/dt-bindings/*/sandbox*.h SH M: Marek Vasut <[email protected]>
arch/sandbox/dts/test.dts +38 -7
74 lines not on this page · raw message
drivers/pinctrl/pinctrl-sandbox.c +138 -48
268 lines not on this page · raw message
include/dt-bindings/pinctrl/sandbox-pinmux.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Sean Anderson <[email protected]> +*/ + +#ifndef SANDBOX_PINMUX_H +#define SANDBOX_PINMUX_H + +#define SANDBOX_PINMUX_UART 0 +#define SANDBOX_PINMUX_I2C 1 +#define SANDBOX_PINMUX_SPI 2 +#define SANDBOX_PINMUX_I2S 3 +#define SANDBOX_PINMUX_GPIO 4 +#define SANDBOX_PINMUX_CS 5 +#define SANDBOX_PINMUX_PWM 6 + +#define SANDBOX_PINMUX (pin, func) ((func) << 16 | (pin)) + +#endif /* SANDBOX_PINMUX_H */
test/dm/Makefile +3 -0
@@ -76,4 +76,7 @@ obj-$(CONFIG_DM_RNG) += rng.o obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o obj-$(CONFIG_RESET_SYSCON) += syscon-reset.o +ifneq ($(CONFIG_PINMUX),) +obj-$(CONFIG_PINCONF) += pinmux.o +endif endif
test/dm/pinmux.c new file +57 -0
57 lines not on this page · raw message
test/py/tests/test_pinmux.py +18 -18
@@ -28,15 +28,15 @@ def test_pinmux_status_all(u_boot_console): assert ('a6 : gpio output .' in output) assert ('pinctrl:' in output) - assert ('SCL : I2C SCL.' in output) - assert ('SDA : I2C SDA.' in output) - assert ('TX : Uart TX.' in output) - assert ('RX : Uart RX.' in output) - assert ('W1 : 1-wire gpio.' in output) - assert ('GPIO0 : gpio bias-pull-up input-disable.' in output) - assert ('GPIO1 : gpio drive-open-drain.' in output) - assert ('GPIO2 : gpio bias-pull-down input-enable.' in output) - assert ('GPIO3 : gpio bias-disable.' in output) + assert ('P0 : UART TX.' in output) + assert ('P1 : UART RX.' in output) + assert ('P2 : I2S SCK.' in output) + assert ('P3 : I2S SD.' in output) + assert ('P4 : I2S WS.' in output) + assert ('P5 : GPIO0 bias-pull-up input-disable.' in output) + assert ('P6 : GPIO1 drive-open-drain.' in output) + assert ('P7 : GPIO2 bias-pull-down input-enable.' in output) + assert ('P8 : GPIO3 bias-disable.' in output) @pytest.mark.buildconfigspec('cmd_pinmux') @pytest.mark.boardspec('sandbox')
@@ -73,12 +73,12 @@ def test_pinmux_status(u_boot_console): assert (not 'pinctrl-gpio:' in output) assert (not 'pinctrl:' in output) - assert ('SCL : I2C SCL.' in output) - assert ('SDA : I2C SDA.' in output) - assert ('TX : Uart TX.' in output) - assert ('RX : Uart RX.' in output) - assert ('W1 : 1-wire gpio.' in output) - assert ('GPIO0 : gpio bias-pull-up input-disable.' in output) - assert ('GPIO1 : gpio drive-open-drain.' in output) - assert ('GPIO2 : gpio bias-pull-down input-enable.' in output) - assert ('GPIO3 : gpio bias-disable.' in output) + assert ('P0 : UART TX.' in output) + assert ('P1 : UART RX.' in output) + assert ('P2 : I2S SCK.' in output) + assert ('P3 : I2S SD.' in output) + assert ('P4 : I2S WS.' in output) + assert ('P5 : GPIO0 bias-pull-up input-disable.' in output) + assert ('P6 : GPIO1 drive-open-drain.' in output) + assert ('P7 : GPIO2 bias-pull-down input-enable.' in output) + assert ('P8 : GPIO3 bias-disable.' in output)
Signature · 1 line
2.26.2
PATCH v4 3/12 test: pinmux: Add test for pin muxing
Quoted 28 lines · Sean Anderson
This extends the pinctrl-sandbox driver to support pin muxing, and adds a test for that behaviour. The test is done in C and not python (like the existing tests for the pinctrl uclass) because it needs to call
pinctrl_select_state. Another option could be to add a command that invokespinctrl_select_stateand then test everything intest/py/tests/test_pinmux.py.The pinctrl-sandbox driver now mimics the way that many pinmux devices work. There are two groups of pins which are muxed together, as well as four pins which are muxed individually. I have tried to test all normal paths. However, very few error cases are explicitly checked for.
Signed-off-by Sean Anderson <[email protected]>---
Changes in v4:
- Add sandbox dt-binding headers toMAINTAINERS
- Addtest/dm/pinmux.cto patch
- Move sandbox_* variables into a priv structure. This resets them to the default state every time we re-probe.Changes in v3:
- Adddt-bindings/pinctrl/sandbox-pinmux.hto patchChanges in v2:
- New
Quoted 10 lines
MAINTAINERS | 1 + arch/sandbox/dts/test.dts | 45 ++++- drivers/pinctrl/pinctrl-sandbox.c | 186 ++++++++++++++----- include/dt-bindings/pinctrl/sandbox-pinmux.h | 19 ++ test/dm/Makefile | 3 + test/dm/pinmux.c | 57 ++++++ test/py/tests/test_pinmux.py | 36 ++-- 7 files changed, 274 insertions(+), 73 deletions(-) create mode 100644 include/dt-bindings/pinctrl/sandbox-pinmux.h create mode 100644 test/dm/pinmux.c
PATCH v4 4/12 pinctrl: Add support for Kendryte K210 FPIOA
In reply to Sean AndersonThe Fully-Programmable Input/Output Array (FPIOA) device controls pin multiplexing on the K210. The FPIOA can remap any supported function to any multifunctional IO pin. It can also perform basic GPIO functions, such as reading the current value of a pin. However, GPIO functionality remains largely unimplemented (in favor of the dedicated GPIO peripherals).
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576
Changes from that version include:
- Reformat to reduce errors from checkpatch
(no changes since v2)
Changes in v2:
- Don't clear existing pinctrl settings on probe
- Rewrite to use pinmux property
- Support muxing the output enable signal for each function
- Support output and input inversion
- Update binding documentation
MAINTAINERS | 2 + .../pinctrl/kendryte,k210-fpioa.txt | 102 +++ drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/kendryte/Kconfig | 7 + drivers/pinctrl/kendryte/Makefile | 1 + drivers/pinctrl/kendryte/pinctrl.c | 678 ++++++++++++++++++ drivers/pinctrl/kendryte/pinctrl.h | 70 ++ include/dt-bindings/pinctrl/k210-pinctrl.h | 277 +++++++ 9 files changed, 1139 insertions(+) create mode 100644 doc/device-tree-bindings/pinctrl/kendryte,k210-fpioa.txt create mode 100644 drivers/pinctrl/kendryte/Kconfig create mode 100644 drivers/pinctrl/kendryte/Makefile create mode 100644 drivers/pinctrl/kendryte/pinctrl.c create mode 100644 drivers/pinctrl/kendryte/pinctrl.h create mode 100644 include/dt-bindings/pinctrl/k210-pinctrl.h
MAINTAINERS +2 -0
@@ -877,7 +877,9 @@ RISC-V KENDRYTE M: Sean Anderson <[email protected]> S: Maintained F: doc/device-tree-bindings/mfd/kendryte,k210-sysctl.txt +F: doc/device-tree-bindings/pinctrl/kendryte,k210-fpioa.txt F: drivers/clk/kendryte/ +F: drivers/pinctrl/kendryte/ F: include/kendryte/ RNG
doc/device-tree-bindings/pinctrl/kendryte,k210-fpioa.txt new file +102 -0
102 lines not on this page · raw message
drivers/pinctrl/Kconfig +1 -0
@@ -289,6 +289,7 @@ endif source "drivers/pinctrl/broadcom/Kconfig" source "drivers/pinctrl/exynos/Kconfig" source "drivers/pinctrl/intel/Kconfig" +source "drivers/pinctrl/kendryte/Kconfig" source "drivers/pinctrl/mediatek/Kconfig" source "drivers/pinctrl/meson/Kconfig" source "drivers/pinctrl/mscc/Kconfig"
drivers/pinctrl/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_SANDBOX) += pinctrl-sandbox.o obj-$(CONFIG_PINCTRL_UNIPHIER) += uniphier/ obj-$(CONFIG_PINCTRL_PIC32) += pinctrl_pic32.o obj-$(CONFIG_PINCTRL_EXYNOS) += exynos/ +obj-$(CONFIG_PINCTRL_K210) += kendryte/ obj-$(CONFIG_PINCTRL_MESON) += meson/ obj-$(CONFIG_PINCTRL_MTK) += mediatek/ obj-$(CONFIG_PINCTRL_MSCC) += mscc/
drivers/pinctrl/kendryte/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +config PINCTRL_K210 + bool "Kendryte K210 Fully-Programmable Input/Output Array driver" + depends on DM && PINCTRL_GENERIC + help + Support pin multiplexing on the K210. The "FPIOA" can remap any + supported function to any multifunctional IO pin. It can also perform + basic GPIO functions, such as reading the current value of a pin.
drivers/pinctrl/kendryte/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += pinctrl.o
drivers/pinctrl/kendryte/pinctrl.c new file +678 -0
678 lines not on this page · raw message
drivers/pinctrl/kendryte/pinctrl.h new file +70 -0
70 lines not on this page · raw message
include/dt-bindings/pinctrl/k210-pinctrl.h new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v4 4/12 pinctrl: Add support for Kendryte K210 FPIOA
Quoted 24 lines · Sean Anderson
The Fully-Programmable Input/Output Array (FPIOA) device controls pin multiplexing on the K210. The FPIOA can remap any supported function to any multifunctional IO pin. It can also perform basic GPIO functions, such as reading the current value of a pin. However, GPIO functionality remains largely unimplemented (in favor of the dedicated GPIO peripherals).
Signed-off-by Sean Anderson <[email protected]>---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576Changes from that version include:
- Reformat to reduce errors from checkpatch(no changes since v2)
Changes in v2:
- Don't clear existing pinctrl settings on probe
- Rewrite to use pinmux property
- Support muxing the output enable signal for each function
- Support output and input inversion
- Update binding documentation
Quoted 17 lines
MAINTAINERS | 2 + .../pinctrl/kendryte,k210-fpioa.txt | 102 +++ drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/kendryte/Kconfig | 7 + drivers/pinctrl/kendryte/Makefile | 1 + drivers/pinctrl/kendryte/pinctrl.c | 678 ++++++++++++++++++ drivers/pinctrl/kendryte/pinctrl.h | 70 ++ include/dt-bindings/pinctrl/k210-pinctrl.h | 277 +++++++ 9 files changed, 1139 insertions(+) create mode 100644 doc/device-tree-bindings/pinctrl/kendryte,k210-fpioa.txt create mode 100644 drivers/pinctrl/kendryte/Kconfig create mode 100644 drivers/pinctrl/kendryte/Makefile create mode 100644 drivers/pinctrl/kendryte/pinctrl.c create mode 100644 drivers/pinctrl/kendryte/pinctrl.h create mode 100644 include/dt-bindings/pinctrl/k210-pinctrl.h
PATCH v4 5/12 gpio: sifive: Use generic reg read function
In reply to Sean AndersonUsing an fdt-specific function causes problems with a live tree.
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576
(no changes since v1)
drivers/gpio/sifive-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/sifive-gpio.c +1 -1
@@ -159,7 +159,7 @@ static int sifive_gpio_ofdata_to_platdata(struct udevice *dev)struct sifive_gpio_platdata *plat =dev_get_platdata (dev);fdt_addr_t addr; - addr =devfdt_get_addr (dev); + addr =dev_read_addr (dev);if (addr ==FDT_ADDR_T_NONE )return -EINVAL ;
Signature · 1 line
2.26.2
PATCH v4 5/12 gpio: sifive: Use generic reg read function
Quoted 5 lines · Sean Anderson
Using an fdt-specific function causes problems with a live tree.
Signed-off-by Sean Anderson <[email protected]>Reviewed-by Bin Meng <[email protected]>
Quoted 8 lines
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576(no changes since v1)
drivers/gpio/sifive-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v4 6/12 gpio: dw: Fix warnings about casting int to pointer
In reply to Sean AndersonChange the type of gpio_dwabp_platdata.base from fdt_addr_t to a void pointer, since we pass it to readl.
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576
(no changes since v1)
drivers/gpio/dwapb_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/dwapb_gpio.c +2 -2
@@ -40,7 +40,7 @@ struct gpio_dwapb_platdata {const char *name;int bank;int pins; -fdt_addr_t base; +void __iomem *base; };static int dwapb_gpio_direction_input (struct udevice *dev,unsigned pin)
@@ -176,7 +176,7 @@ static int gpio_dwapb_bind(struct udevice *dev)if (!plat)return -ENOMEM ; - plat->base = base; + plat->base = (void *)base; plat->bank = bank; plat->pins =ofnode_read_u32_default (node,"snps,nr-gpios" ,0 );
Signature · 1 line
2.26.2
PATCH v4 7/12 gpio: dw: Add a trailing underscore to generated name
In reply to Sean AndersonPreviously, if there was no bank-name property, it was easy to have confusing gpio names like "gpio1 at 08", instead of "gpio1 at 0_8". This patch follows the example of the sifive gpio driver.
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576
(no changes since v1)
drivers/gpio/dwapb_gpio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpio/dwapb_gpio.c +9 -1
@@ -186,7 +186,15 @@ static int gpio_dwapb_bind(struct udevice *dev)* Fall back to node name. This means accessing pins * via bank name won't work. */ - plat->name =ofnode_get_name (node); +char name[32 ]; + +snprintf (name,sizeof (name),"%s_" , +ofnode_get_name (node)); + plat->name =strdup (name); +if (!plat->name) { +kfree (plat); +return -ENOMEM ; + } } ret = device_bind_ofnode(dev, dev->driver, plat->name,
Signature · 1 line
2.26.2
PATCH v4 7/12 gpio: dw: Add a trailing underscore to generated name
Quoted 6 lines · Sean Anderson
Previously, if there was no bank-name property, it was easy to have confusing gpio names like "gpio1 at 08", instead of "gpio1 at 0_8". This patch follows the example of the sifive gpio driver.
Signed-off-by Sean Anderson <[email protected]>
Quoted 8 lines
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576(no changes since v1)
drivers/gpio/dwapb_gpio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
PATCH v4 8/12 gpio: dw: Return output value when direction is out
In reply to Sean Andersondm_gpio_ops.get_value can be called when the gpio is either input or output. The current dw code always returns the input value, which is invalid if the direction is set to out.
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576
(no changes since v3)
Changes in v3:
- Undo reorder to prevent use-before-declared error
Changes in v2:
- Reorder changes to minimize diff
drivers/gpio/dwapb_gpio.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/gpio/dwapb_gpio.c +12 -7
@@ -66,13 +66,6 @@ static int dwapb_gpio_direction_output(struct udevice *dev, unsigned pin,return 0 ; } -static int dwapb_gpio_get_value (struct udevice *dev,unsigned pin) -{ -struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); -return !!(readl (plat->base +GPIO_EXT_PORT (plat->bank)) & (1 << pin)); -} - -static int dwapb_gpio_set_value (struct udevice *dev,unsigned pin,int val) {struct gpio_dwapb_platdata *plat =dev_get_platdata (dev);
@@ -98,6 +91,18 @@ static int dwapb_gpio_get_function(struct udevice *dev, unsigned offset)return GPIOF_INPUT ; } +static int dwapb_gpio_get_value (struct udevice *dev,unsigned pin) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); +u32 value; + +if (dwapb_gpio_get_function (dev, pin) ==GPIOF_OUTPUT ) + value =readl (plat->base +GPIO_SWPORT_DR (plat->bank)); +else + value =readl (plat->base +GPIO_EXT_PORT (plat->bank)); +return !!(value &BIT (pin)); +} +static const struct dm_gpio_ops gpio_dwapb_ops = { .direction_input = dwapb_gpio_direction_input, .direction_output = dwapb_gpio_direction_output,
Signature · 1 line
2.26.2
PATCH v4 9/12 led: gpio: Default to using node name if label is absent
In reply to Sean AndersonThis more closely mirrors Linux's behaviour, and will make it easier to transition to using function+color in the future.
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576
(no changes since v1)
drivers/led/led_gpio.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/led/led_gpio.c +2 -5
@@ -99,11 +99,8 @@ static int led_gpio_bind(struct udevice *parent)const char *label; label =ofnode_read_string (node,"label" ); -if (!label) { -debug ("%s: node %s has no label\n" , __func__, -ofnode_get_name (node)); -return -EINVAL ; - } +if (!label) + label =ofnode_get_name (node); ret =device_bind_driver_to_node (parent,"gpio_led" ,ofnode_get_name (node), node, &dev);
Signature · 1 line
2.26.2
PATCH v4 10/12 test: dm: Test for default led naming
In reply to Sean AndersonThis modifies the existing led test to check for default led naming as added in the previous patch.
---
Changes in v4:
- New
arch/sandbox/dts/test.dts | 2 +- test/dm/led.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/sandbox/dts/test.dts +1 -1
@@ -460,7 +460,7 @@ default_off { gpios = <&gpio_a 6 0>; - label = "sandbox:default_off"; + /* label intentionally omitted */ default-state = "off"; }; };
test/dm/led.c +2 -1
@@ -39,7 +39,8 @@ static int dm_test_led_default_state(struct unit_test_state *uts)ut_assertok (led_get_by_label ("sandbox:default_on" , &dev));ut_asserteq (LEDST_ON ,led_get_state (dev)); -ut_assertok (led_get_by_label ("sandbox:default_off" , &dev)); +/* Also tests default label behaviour */ +ut_assertok (led_get_by_label ("default_off" , &dev));ut_asserteq (LEDST_OFF ,led_get_state (dev));return 0 ;
Signature · 1 line
2.26.2
PATCH v4 10/12 test: dm: Test for default led naming
Quoted 5 lines · Sean Anderson
This modifies the existing led test to check for default led naming as added in the previous patch.
Signed-off-by Sean Anderson <[email protected]>
Quoted 9 lines
---
Changes in v4:
- Newarch/sandbox/dts/test.dts | 2 +- test/dm/led.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
PATCH v4 11/12 riscv: Add pinmux and gpio bindings for Kendryte K210
In reply to Sean AndersonThis patch adds the necessary device tree bindings.
---
(no changes since v2)
Changes in v2:
- Convert to use pinmux property
- Don't hog ISP on boot
- Re-order GPIOs to match the defaults more closely
arch/riscv/dts/k210-maix-bit.dts | 104 +++++++++++++++++++++++++++++++ arch/riscv/dts/k210.dtsi | 12 ++++ 2 files changed, 116 insertions(+)
arch/riscv/dts/k210-maix-bit.dts +104 -0
@@ -17,6 +17,22 @@ stdout-path = "serial0:115200"; }; + gpio-leds { + compatible = "gpio-leds"; + + green { + gpios = <&gpio1_0 4 GPIO_ACTIVE_LOW>; + }; + + red { + gpios = <&gpio1_0 5 GPIO_ACTIVE_LOW>; + }; + + blue { + gpios = <&gpio1_0 6 GPIO_ACTIVE_LOW>; + }; + }; + sound { compatible = "simple-audio-card"; simple-audio-card,format = "i2s";
@@ -39,9 +55,97 @@ }; &uarths0 { + pinctrl-0 = <&fpioa_uarths>; + pinctrl-names = "default"; + status = "okay"; +}; + +&gpio0 { + pinctrl-0 = <&fpioa_gpiohs>; + pinctrl-names = "default"; + status = "okay"; +}; + +&gpio1 { + pinctrl-0 = <&fpioa_gpio>; + pinctrl-names = "default"; status = "okay"; }; &i2s0 { #sound-dai-cells = <1>; + pinctrl-0 = <&fpioa_i2s0>; + pinctrl-names = "default"; +}; + +&fpioa { + status = "okay"; + + fpioa_uarths: uarths { + pinmux = <K210_FPIOA(4, K210_PCF_UARTHS_RX)>, + <K210_FPIOA(5, K210_PCF_UARTHS_TX)>; + }; + + fpioa_gpio: gpio { + pinmux = <K210_FPIOA(8, K210_PCF_GPIO0)>, + <K210_FPIOA(9, K210_PCF_GPIO1)>, + <K210_FPIOA(10, K210_PCF_GPIO2)>, + <K210_FPIOA(11, K210_PCF_GPIO3)>, + <K210_FPIOA(12, K210_PCF_GPIO4)>, + <K210_FPIOA(13, K210_PCF_GPIO5)>, + <K210_FPIOA(14, K210_PCF_GPIO6)>, + <K210_FPIOA(15, K210_PCF_GPIO7)>; + }; + + fpioa_gpiohs: gpiohs { + pinmux = <K210_FPIOA(16, K210_PCF_GPIOHS0)>, + <K210_FPIOA(17, K210_PCF_GPIOHS1)>, + <K210_FPIOA(21, K210_PCF_GPIOHS5)>, + <K210_FPIOA(22, K210_PCF_GPIOHS6)>, + <K210_FPIOA(23, K210_PCF_GPIOHS7)>, + <K210_FPIOA(24, K210_PCF_GPIOHS8)>, + <K210_FPIOA(25, K210_PCF_GPIOHS9)>, + <K210_FPIOA(30, K210_PCF_GPIOHS14)>, + <K210_FPIOA(31, K210_PCF_GPIOHS15)>, + <K210_FPIOA(32, K210_PCF_GPIOHS16)>, + <K210_FPIOA(33, K210_PCF_GPIOHS17)>, + <K210_FPIOA(34, K210_PCF_GPIOHS18)>, + <K210_FPIOA(35, K210_PCF_GPIOHS19)>; + }; + + fpioa_i2s0: i2s0 { + pinmux = <K210_FPIOA(18, K210_PCF_I2S0_SCLK)>, + <K210_FPIOA(19, K210_PCF_I2S0_WS)>, + <K210_FPIOA(20, K210_PCF_I2S0_IN_D0)>; + }; + + fpioa_dvp: dvp { + pinmux = <K210_FPIOA(40, K210_PCF_SCCB_SDA)>, + <K210_FPIOA(41, K210_PCF_SCCB_SCLK)>, + <K210_FPIOA(42, K210_PCF_DVP_RST)>, + <K210_FPIOA(43, K210_PCF_DVP_VSYNC)>, + <K210_FPIOA(44, K210_PCF_DVP_PWDN)>, + <K210_FPIOA(45, K210_PCF_DVP_HSYNC)>, + <K210_FPIOA(46, K210_PCF_DVP_XCLK)>, + <K210_FPIOA(47, K210_PCF_DVP_PCLK)>; + }; + + fpioa_spi0: spi0 { + pinmux = <K210_FPIOA(36, K210_PCF_GPIOHS20)>, /* cs */ + <K210_FPIOA(37, K210_PCF_GPIOHS21)>, /* rst */ + <K210_FPIOA(38, K210_PCF_GPIOHS22)>, /* dc */ + <K210_FPIOA(39, K210_PCF_SPI0_SCLK)>; /* wr */ + }; + + fpioa_spi1: spi1 { + pinmux = <K210_FPIOA(26, K210_PCF_SPI1_D1)>, + <K210_FPIOA(27, K210_PCF_SPI1_SCLK)>, + <K210_FPIOA(28, K210_PCF_SPI1_D0)>, + <K210_FPIOA(29, K210_PCF_GPIOHS13)>; + }; +}; + +&dvp0 { + pinctrl-0 = <&fpioa_dvp>; + pinctrl-names = "default"; };
arch/riscv/dts/k210.dtsi +12 -0
@@ -5,6 +5,7 @@ #include <dt-bindings/clock/k210-sysctl.h> #include <dt-bindings/mfd/k210-sysctl.h> +#include <dt-bindings/pinctrl/k210-pinctrl.h> #include <dt-bindings/reset/k210-sysctl.h> / {
@@ -367,7 +368,18 @@ reg = <0x502B0000 0x100>; clocks = <&sysclk K210_CLK_FPIOA>; resets = <&sysrst K210_RST_FPIOA>; + kendryte,sysctl = <&sysctl>; + kendryte,power-offset = <K210_SYSCTL_POWER_SEL>; + pinctrl-0 = <&fpioa_jtag>; + pinctrl-names = "default"; status = "disabled"; + + fpioa_jtag: jtag { + pinmux = <K210_FPIOA(0, K210_PCF_JTAG_TCLK)>, + <K210_FPIOA(1, K210_PCF_JTAG_TDI)>, + <K210_FPIOA(2, K210_PCF_JTAG_TMS)>, + <K210_FPIOA(3, K210_PCF_JTAG_TDO)>; + }; }; sha256: sha256 at 502C0000 {
Signature · 1 line
2.26.2
PATCH v4 11/12 riscv: Add pinmux and gpio bindings for Kendryte K210
Quoted 9 lines · Sean Anderson
This patch adds the necessary device tree bindings.
Signed-off-by Sean Anderson <[email protected]>---
(no changes since v2)
Quoted 8 lines
Changes in v2:
- Convert to use pinmux property
- Don't hog ISP on boot
- Re-order GPIOs to match the defaults more closelyarch/riscv/dts/k210-maix-bit.dts | 104 +++++++++++++++++++++++++++++++ arch/riscv/dts/k210.dtsi | 12 ++++ 2 files changed, 116 insertions(+)
PATCH v4 12/12 riscv: Add FPIOA and GPIO support for Kendryte K210
In reply to Sean AndersonThis patch adds the necessary configs and docs for FPIOA and GPIO support on the K210.
---
(no changes since v3)
Changes in v3:
- Document pins 6 and 7 as not set
Changes in v2:
- Remove SPI flash related Kconfig settings
board/sipeed/maix/Kconfig | 9 ++++++ doc/board/sipeed/maix.rst | 64 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 2 deletions(-)
board/sipeed/maix/Kconfig +9 -0
@@ -44,4 +44,13 @@ config BOARD_SPECIFIC_OPTIONS imply RESET_SYSCON imply SYSRESET imply SYSRESET_SYSCON + imply PINCTRL + imply PINCONF + imply PINCTRL_K210 + imply DM_GPIO + imply DWAPB_GPIO + imply SIFIVE_GPIO + imply CMD_GPIO + imply LED + imply LED_GPIO endif
doc/board/sipeed/maix.rst +62 -2
80 lines not on this page · raw message
Signature · 1 line
2.26.2
v4 cover riscv: Add FPIOA and GPIO support for Kendryte K210
In reply to Sean AndersonQuoted 71 lines · Sean Anderson
This patch series adds support for pinmuxing, gpios, and leds on the Kendyte K210.
This patch series was previously part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576This patch series depends on
https://patchwork.ozlabs.org/project/uboot/list/?series=178480Changes in v4:
- Add sandbox dt-binding headers toMAINTAINERS
- Add test for led behavior
- Addtest/dm/pinmux.cto patch
- Move sandbox_* variables into a priv structure. This resets them to the default state every time we re-probe.
- Reformat documentation indm/pinctrl.hChanges in v3:
- Adddt-bindings/pinctrl/sandbox-pinmux.hto patchChanges in v2:
- Add test for pinmuxing
- Don't clear existing pinctrl settings on probe
- Re-order GPIOs to match the defaults more closely
- Rebase onto v13 of "riscv: Add Sipeed Maix support"
- Rewrite FPIOA driver to use pinmux property
- Support muxing the output enable signal for each function in the FPIOA
- Support output and input inversion in the pinmux driver
- Support pinmux property in pinctrl-genericSean Anderson (12):
pinctrl: Add pinmux property support to pinctrl-generic
pinctrl: Reformat documentation indm/pinctrl.h
test: pinmux: Add test for pin muxing
pinctrl: Add support for Kendryte K210 FPIOA
gpio: sifive: Use generic reg read function
gpio: dw: Fix warnings about casting int to pointer
gpio: dw: Add a trailing underscore to generated name
gpio: dw: Return output value when direction is out
led: gpio: Default to using node name if label is absent
test: dm: Test for default led naming
riscv: Add pinmux and gpio bindings for Kendryte K210
riscv: Add FPIOA and GPIO support for Kendryte K210MAINTAINERS | 3 + arch/riscv/dts/k210-maix-bit.dts | 104 +++ arch/riscv/dts/k210.dtsi | 12 + arch/sandbox/dts/test.dts | 47 +- board/sipeed/maix/Kconfig | 9 + doc/board/sipeed/maix.rst | 64 +- .../pinctrl/kendryte,k210-fpioa.txt | 102 +++ .../pinctrl/pinctrl-bindings.txt | 65 +- drivers/gpio/dwapb_gpio.c | 33 +- drivers/gpio/sifive-gpio.c | 2 +- drivers/led/led_gpio.c | 7 +- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/kendryte/Kconfig | 7 + drivers/pinctrl/kendryte/Makefile | 1 + drivers/pinctrl/kendryte/pinctrl.c | 678 ++++++++++++++++++ drivers/pinctrl/kendryte/pinctrl.h | 70 ++ drivers/pinctrl/pinctrl-generic.c | 125 +++- drivers/pinctrl/pinctrl-sandbox.c | 186 +++-- include/dm/pinctrl.h | 360 +++++++--- include/dt-bindings/pinctrl/k210-pinctrl.h | 277 +++++++ include/dt-bindings/pinctrl/sandbox-pinmux.h | 19 + test/dm/Makefile | 3 + test/dm/led.c | 3 +- test/dm/pinmux.c | 57 ++ test/py/tests/test_pinmux.py | 36 +- 26 files changed, 2027 insertions(+), 245 deletions(-)
Quoted 9 lines
create mode 100644 doc/device-tree-bindings/pinctrl/kendryte,k210-fpioa.txt create mode 100644 drivers/pinctrl/kendryte/Kconfig create mode 100644 drivers/pinctrl/kendryte/Makefile create mode 100644 drivers/pinctrl/kendryte/pinctrl.c create mode 100644 drivers/pinctrl/kendryte/pinctrl.h create mode 100644 include/dt-bindings/pinctrl/k210-pinctrl.h create mode 100644 include/dt-bindings/pinctrl/sandbox-pinmux.h create mode 100644 test/dm/pinmux.c
Rick can you put this in your rc3 PR? I think there are reviews for all patches in this series.
--Sean
v4 cover riscv: Add FPIOA and GPIO support for Kendryte K210
Hi Sean
Quoted 82 lines · Sean Anderson
Quoted 71 lines
This patch series adds support for pinmuxing, gpios, and leds on the Kendyte K210.
This patch series was previously part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576This patch series depends on
https://patchwork.ozlabs.org/project/uboot/list/?series=178480Changes in v4:
- Add sandbox dt-binding headers toMAINTAINERS
- Add test for led behavior
- Addtest/dm/pinmux.cto patch
- Move sandbox_* variables into a priv structure. This resets them to the default state every time we re-probe.
- Reformat documentation indm/pinctrl.hChanges in v3:
- Adddt-bindings/pinctrl/sandbox-pinmux.hto patchChanges in v2:
- Add test for pinmuxing
- Don't clear existing pinctrl settings on probe
- Re-order GPIOs to match the defaults more closely
- Rebase onto v13 of "riscv: Add Sipeed Maix support"
- Rewrite FPIOA driver to use pinmux property
- Support muxing the output enable signal for each function in the FPIOA
- Support output and input inversion in the pinmux driver
- Support pinmux property in pinctrl-genericSean Anderson (12):
pinctrl: Add pinmux property support to pinctrl-generic
pinctrl: Reformat documentation indm/pinctrl.h
test: pinmux: Add test for pin muxing
pinctrl: Add support for Kendryte K210 FPIOA
gpio: sifive: Use generic reg read function
gpio: dw: Fix warnings about casting int to pointer
gpio: dw: Add a trailing underscore to generated name
gpio: dw: Return output value when direction is out
led: gpio: Default to using node name if label is absent
test: dm: Test for default led naming
riscv: Add pinmux and gpio bindings for Kendryte K210
riscv: Add FPIOA and GPIO support for Kendryte K210MAINTAINERS | 3 + arch/riscv/dts/k210-maix-bit.dts | 104 +++ arch/riscv/dts/k210.dtsi | 12 + arch/sandbox/dts/test.dts | 47 +- board/sipeed/maix/Kconfig | 9 + doc/board/sipeed/maix.rst | 64 +- .../pinctrl/kendryte,k210-fpioa.txt | 102 +++ .../pinctrl/pinctrl-bindings.txt | 65 +- drivers/gpio/dwapb_gpio.c | 33 +- drivers/gpio/sifive-gpio.c | 2 +- drivers/led/led_gpio.c | 7 +- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/kendryte/Kconfig | 7 + drivers/pinctrl/kendryte/Makefile | 1 + drivers/pinctrl/kendryte/pinctrl.c | 678 ++++++++++++++++++ drivers/pinctrl/kendryte/pinctrl.h | 70 ++ drivers/pinctrl/pinctrl-generic.c | 125 +++- drivers/pinctrl/pinctrl-sandbox.c | 186 +++-- include/dm/pinctrl.h | 360 +++++++--- include/dt-bindings/pinctrl/k210-pinctrl.h | 277 +++++++ include/dt-bindings/pinctrl/sandbox-pinmux.h | 19 + test/dm/Makefile | 3 + test/dm/led.c | 3 +- test/dm/pinmux.c | 57 ++ test/py/tests/test_pinmux.py | 36 +- 26 files changed, 2027 insertions(+), 245 deletions(-)Quoted 9 lines
create mode 100644 doc/device-tree-bindings/pinctrl/kendryte,k210-fpioa.txt create mode 100644 drivers/pinctrl/kendryte/Kconfig create mode 100644 drivers/pinctrl/kendryte/Makefile create mode 100644 drivers/pinctrl/kendryte/pinctrl.c create mode 100644 drivers/pinctrl/kendryte/pinctrl.h create mode 100644 include/dt-bindings/pinctrl/k210-pinctrl.h create mode 100644 include/dt-bindings/pinctrl/sandbox-pinmux.h create mode 100644 test/dm/pinmux.c
Quoted 3 lines
Rick can you put this in your rc3 PR? I think there are reviews for all patches in this series.
OK, but it conflicts with u-boot/master
Applying: pinctrl: Add pinmux property support to pinctrl-generic
Applying: pinctrl: Reformat documentation in dm/pinctrl.h
Applying: test: pinmux: Add test for pin muxing
Applying: pinctrl: Add support for Kendryte K210 FPIOA
Applying: gpio: sifive: Use generic reg read function
error: patch failed: drivers/gpio/sifive-gpio.c:159
error: drivers/gpio/sifive-gpio.c: patch does not apply Patch failed at 0005 gpio: sifive: Use generic reg read function
Thanks,
Rick
Quoted 1 line
--Sean
v4 cover riscv: Add FPIOA and GPIO support for Kendryte K210
Quoted 90 lines · Rick Chen
Hi Sean
Quoted 82 lines · Sean Anderson
Quoted 71 lines
This patch series adds support for pinmuxing, gpios, and leds on the Kendyte K210.
This patch series was previously part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576This patch series depends on
https://patchwork.ozlabs.org/project/uboot/list/?series=178480Changes in v4:
- Add sandbox dt-binding headers toMAINTAINERS
- Add test for led behavior
- Addtest/dm/pinmux.cto patch
- Move sandbox_* variables into a priv structure. This resets them to the default state every time we re-probe.
- Reformat documentation indm/pinctrl.hChanges in v3:
- Adddt-bindings/pinctrl/sandbox-pinmux.hto patchChanges in v2:
- Add test for pinmuxing
- Don't clear existing pinctrl settings on probe
- Re-order GPIOs to match the defaults more closely
- Rebase onto v13 of "riscv: Add Sipeed Maix support"
- Rewrite FPIOA driver to use pinmux property
- Support muxing the output enable signal for each function in the FPIOA
- Support output and input inversion in the pinmux driver
- Support pinmux property in pinctrl-genericSean Anderson (12):
pinctrl: Add pinmux property support to pinctrl-generic
pinctrl: Reformat documentation indm/pinctrl.h
test: pinmux: Add test for pin muxing
pinctrl: Add support for Kendryte K210 FPIOA
gpio: sifive: Use generic reg read function
gpio: dw: Fix warnings about casting int to pointer
gpio: dw: Add a trailing underscore to generated name
gpio: dw: Return output value when direction is out
led: gpio: Default to using node name if label is absent
test: dm: Test for default led naming
riscv: Add pinmux and gpio bindings for Kendryte K210
riscv: Add FPIOA and GPIO support for Kendryte K210MAINTAINERS | 3 + arch/riscv/dts/k210-maix-bit.dts | 104 +++ arch/riscv/dts/k210.dtsi | 12 + arch/sandbox/dts/test.dts | 47 +- board/sipeed/maix/Kconfig | 9 + doc/board/sipeed/maix.rst | 64 +- .../pinctrl/kendryte,k210-fpioa.txt | 102 +++ .../pinctrl/pinctrl-bindings.txt | 65 +- drivers/gpio/dwapb_gpio.c | 33 +- drivers/gpio/sifive-gpio.c | 2 +- drivers/led/led_gpio.c | 7 +- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/kendryte/Kconfig | 7 + drivers/pinctrl/kendryte/Makefile | 1 + drivers/pinctrl/kendryte/pinctrl.c | 678 ++++++++++++++++++ drivers/pinctrl/kendryte/pinctrl.h | 70 ++ drivers/pinctrl/pinctrl-generic.c | 125 +++- drivers/pinctrl/pinctrl-sandbox.c | 186 +++-- include/dm/pinctrl.h | 360 +++++++--- include/dt-bindings/pinctrl/k210-pinctrl.h | 277 +++++++ include/dt-bindings/pinctrl/sandbox-pinmux.h | 19 + test/dm/Makefile | 3 + test/dm/led.c | 3 +- test/dm/pinmux.c | 57 ++ test/py/tests/test_pinmux.py | 36 +- 26 files changed, 2027 insertions(+), 245 deletions(-)Quoted 9 lines
create mode 100644 doc/device-tree-bindings/pinctrl/kendryte,k210-fpioa.txt create mode 100644 drivers/pinctrl/kendryte/Kconfig create mode 100644 drivers/pinctrl/kendryte/Makefile create mode 100644 drivers/pinctrl/kendryte/pinctrl.c create mode 100644 drivers/pinctrl/kendryte/pinctrl.h create mode 100644 include/dt-bindings/pinctrl/k210-pinctrl.h create mode 100644 include/dt-bindings/pinctrl/sandbox-pinmux.h create mode 100644 test/dm/pinmux.cQuoted 3 lines
Rick can you put this in your rc3 PR? I think there are reviews for all patches in this series.
OK, but it conflicts with u-boot/master
Quoted 8 lines
Applying: pinctrl: Add pinmux property support to pinctrl-generic
Applying: pinctrl: Reformat documentation indm/pinctrl.h
Applying: test: pinmux: Add test for pin muxing
Applying: pinctrl: Add support for Kendryte K210 FPIOA
Applying: gpio: sifive: Use generic reg read function
error: patch failed:drivers/gpio/sifive-gpio.c:159
error:drivers/gpio/sifive-gpio.c: patch does not apply Patch failed at 0005 gpio: sifive: Use generic reg read function
I rebased it onto upstream/master and ran into some trouble with the board failing to boot. I've CC'd you in a reply to the patch which causes the breakage. Hopefully it'll end up being a minor change.
--Sean