dts: riscv: telink_b91: replace pinmux by pinctrl
Replaced pinmux by new pinctrl driver for Telink B91. Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
This commit is contained in:
parent
42d1d9c17c
commit
4747f3ac3d
3 changed files with 107 additions and 224 deletions
103
dts/bindings/pinctrl/telink,b91-pinctrl.yaml
Normal file
103
dts/bindings/pinctrl/telink,b91-pinctrl.yaml
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
# Copyright (c) 2022, Telink Semiconductor
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: |
|
||||
The Telink B91 pin controller is a singleton node responsible for
|
||||
controlling pin function selection and pin properties. For example, you can
|
||||
use this node to route UART0 TX to pin PB2 and enable the pull-up resistor
|
||||
on the pin.
|
||||
|
||||
The node has the 'pinctrl' node label set in your SoC's devicetree,
|
||||
so you can modify it like this:
|
||||
|
||||
&pinctrl {
|
||||
/* your modifications go here */
|
||||
};
|
||||
|
||||
All device pin configurations should be placed in child nodes of the
|
||||
'pinctrl' node, as shown in this example:
|
||||
|
||||
/* You can put this in places like a board-pinctrl.dtsi file in
|
||||
* your board directory, or a devicetree overlay in your application.
|
||||
*/
|
||||
|
||||
/* include pre-defined pins and functions for the SoC used by the board */
|
||||
#include <dt-bindings/pinctrl/b91-pinctrl.h>
|
||||
|
||||
&pinctrl {
|
||||
/* configuration for UART0 TX default state */
|
||||
uart0_tx_pb2_default: uart0_tx_pb2_default {
|
||||
/* configure PB2 as B91_FUNC_C */
|
||||
pinmux = <B91_PINMUX_SET(B91_PORT_B, B91_PIN_2, B91_FUNC_C)>;
|
||||
};
|
||||
/* configuration for UART0 RX default state */
|
||||
uart0_rx_pb3_default: uart0_rx_pb3_default {
|
||||
/* configure PB2 as B91_FUNC_C */
|
||||
pinmux = <B91_PINMUX_SET(B91_PORT_B, B91_PIN_3, B91_FUNC_C)>;
|
||||
};
|
||||
};
|
||||
|
||||
The 'uart0_tx_pb2_default' child node encodes the pin configurations
|
||||
for a particular state of a device; in this case, the default
|
||||
(that is, active) sate. You would specify the low-power configuration for
|
||||
the same device in a separate child node.
|
||||
|
||||
A pin configuration can also specify pin properties such as the
|
||||
'bias-pull-up' property. Here is a list of supported standard pin
|
||||
properties:
|
||||
|
||||
- bias-disable
|
||||
- bias-pull-down
|
||||
- bias-pull-up
|
||||
|
||||
To link pin configurations with a device, use a pinctrl-N property for some
|
||||
number N, like this example you could place in your board's DTS file:
|
||||
|
||||
#include "board-pinctrl.dtsi"
|
||||
|
||||
&uart0 {
|
||||
pinctrl-0 = <&uart0_tx_pb2_default &uart0_rx_pb3_default>;
|
||||
pinctrl-1 = <&uart0_tx_pb2_sleep &uart0_rx_pb3_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
compatible: "telink,b91-pinctrl"
|
||||
|
||||
include:
|
||||
- name: base.yaml
|
||||
- name: pincfg-node.yaml
|
||||
child-binding:
|
||||
property-allowlist:
|
||||
- bias-disable
|
||||
- bias-pull-down
|
||||
- bias-pull-up
|
||||
|
||||
properties:
|
||||
reg:
|
||||
required: true
|
||||
|
||||
label:
|
||||
required: true
|
||||
|
||||
pad-mul-sel:
|
||||
type: int
|
||||
required: true
|
||||
description: |
|
||||
PinMux pad_mul_sel register value. Pin functions depend on it.
|
||||
|
||||
For instance:
|
||||
Function C of PB2 configs the pin to UART0_TX if pad_mul_sel is set to <1>.
|
||||
But, the same function configs the same pin to DAC_I_DAT2_I if pad_mul_sel is set to <0>.
|
||||
|
||||
Refer to the Telink TLSR9 specs to get more information about pins configuration.
|
||||
|
||||
child-binding:
|
||||
description: |
|
||||
This binding gives a base representation of the Telink B91 pins configration.
|
||||
|
||||
properties:
|
||||
pinmux:
|
||||
required: true
|
||||
type: int
|
||||
description: |
|
||||
Telink B91 pin's configuration (port, pin and function).
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
# Copyright (c) 2021, Telink Semiconductor
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: Telink B91 PinMux
|
||||
|
||||
compatible: "telink,b91-pinmux"
|
||||
|
||||
include: base.yaml
|
||||
|
||||
properties:
|
||||
reg:
|
||||
required: true
|
||||
|
||||
label:
|
||||
required: true
|
||||
|
||||
pad-mul-sel:
|
||||
type: int
|
||||
required: true
|
||||
description: PinMux pad_mul_sel register values.
|
||||
|
||||
child-binding:
|
||||
description:
|
||||
This binding gives a base representation of the Telink B91 pins configration.
|
||||
|
||||
properties:
|
||||
pinmux:
|
||||
required: true
|
||||
type: int
|
||||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/i2c/i2c.h>
|
||||
#include <dt-bindings/pinctrl/b91-pinctrl.h>
|
||||
|
||||
/ {
|
||||
#address-cells = <1>;
|
||||
|
|
@ -206,206 +205,16 @@
|
|||
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||
};
|
||||
|
||||
pinmux: pinmux@80140330 {
|
||||
compatible = "telink,b91-pinmux";
|
||||
pinctrl: pinctrl@80140330 {
|
||||
compatible = "telink,b91-pinctrl";
|
||||
reg = <0x80140330 0x28
|
||||
0x80140306 0x28
|
||||
0x0000000e 0x0C>;
|
||||
reg-names = "pin_mux",
|
||||
"gpio_en",
|
||||
"pull_up_en";
|
||||
label = "PINMUX";
|
||||
status = "disabled";
|
||||
|
||||
/* UART0: TX(PA3 PB2 PD2), RX(PA4 PB3 PD3) */
|
||||
|
||||
uart0_tx_pa3: uart0_tx_pa3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_A, B91_PIN_3)>;
|
||||
};
|
||||
uart0_tx_pb2: uart0_tx_pb2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_B, B91_PIN_2)>;
|
||||
};
|
||||
uart0_tx_pd2: uart0_tx_pd2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_D, B91_PIN_2)>;
|
||||
};
|
||||
|
||||
uart0_rx_pa4: uart0_rx_pa4 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_A, B91_PIN_4)>;
|
||||
};
|
||||
uart0_rx_pb3: uart0_rx_pb3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_B, B91_PIN_3)>;
|
||||
};
|
||||
uart0_rx_pd3: uart0_rx_pd3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_D, B91_PIN_3)>;
|
||||
};
|
||||
|
||||
/* UART1: TX(PC6 PD6 PE0), RX(PC7 PD7 PE2) */
|
||||
|
||||
uart1_tx_pc6: uart1_tx_pc6 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_C, B91_PIN_6)>;
|
||||
};
|
||||
uart1_tx_pd6: uart1_tx_pd6 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_D, B91_PIN_6)>;
|
||||
};
|
||||
uart1_tx_pe0: uart1_tx_pe0 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_E, B91_PIN_0)>;
|
||||
};
|
||||
|
||||
uart1_rx_pc7: uart1_rx_pc7 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_C, B91_PIN_7)>;
|
||||
};
|
||||
uart1_rx_pd7: uart1_rx_pd7 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_D, B91_PIN_7)>;
|
||||
};
|
||||
uart1_rx_pe2: uart1_rx_pe2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_E, B91_PIN_2)>;
|
||||
};
|
||||
|
||||
/* PWM Channel 0 (PB4, PC0, PE3) */
|
||||
|
||||
pwm_ch0_pb4: pwm_ch0_pb4 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_B, B91_PIN_4)>;
|
||||
};
|
||||
pwm_ch0_pc0: pwm_ch0_pc0 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_C, B91_PIN_0)>;
|
||||
};
|
||||
pwm_ch0_pe3: pwm_ch0_pe3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_E, B91_PIN_3)>;
|
||||
};
|
||||
|
||||
/* PWM Channel 1 (PB5, PE1) */
|
||||
|
||||
pwm_ch1_pb5: pwm_ch1_pb5 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_B, B91_PIN_5)>;
|
||||
};
|
||||
pwm_ch1_pe1: pwm_ch1_pe1 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_E, B91_PIN_1)>;
|
||||
};
|
||||
|
||||
/* PWM Channel 2 (PB7, PE2) */
|
||||
|
||||
pwm_ch2_pb7: pwm_ch2_pb7 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_B, B91_PIN_7)>;
|
||||
};
|
||||
pwm_ch2_pe2: pwm_ch2_pe2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_E, B91_PIN_2)>;
|
||||
};
|
||||
|
||||
/* PWM Channel 3 (PB1, PE0) */
|
||||
|
||||
pwm_ch3_pb1: pwm_ch3_pb1 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_B, B91_PIN_1)>;
|
||||
};
|
||||
pwm_ch3_pe0: pwm_ch3_pe0 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_E, B91_PIN_0)>;
|
||||
};
|
||||
|
||||
/* PWM Channel 4 (PD7, PE4) */
|
||||
|
||||
pwm_ch4_pd7: pwm_ch4_pd7 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_D, B91_PIN_7)>;
|
||||
};
|
||||
pwm_ch4_pe4: pwm_ch4_pe4 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_E, B91_PIN_4)>;
|
||||
};
|
||||
|
||||
/* PWM Channel 5 (PB0, PE5) */
|
||||
|
||||
pwm_ch5_pb0: pwm_ch5_pb0 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_B, B91_PIN_0)>;
|
||||
};
|
||||
pwm_ch5_pe5: pwm_ch5_pe5 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_E, B91_PIN_5)>;
|
||||
};
|
||||
|
||||
/* PSPI: CLK(PC5, PB5, PD1), MOSI(PC7, PB7, PD3), MISO(PC6, PB6, PD2) */
|
||||
|
||||
pspi_clk_pc5: pspi_clk_pc5 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_C, B91_PIN_5)>;
|
||||
};
|
||||
pspi_mosi_io0_pc7: pspi_mosi_io0_pc7 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_C, B91_PIN_7)>;
|
||||
};
|
||||
pspi_miso_io1_pc6: pspi_miso_io1_pc6 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_C, B91_PIN_6)>;
|
||||
};
|
||||
|
||||
pspi_clk_pb5: pspi_clk_pb5 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_B, B91_PIN_5)>;
|
||||
};
|
||||
pspi_mosi_io0_pb7: pspi_mosi_io0_pb7 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_B, B91_PIN_7)>;
|
||||
};
|
||||
pspi_miso_io1_pb6: pspi_miso_io1_pb6 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_B, B91_PIN_6)>;
|
||||
};
|
||||
|
||||
pspi_clk_pd1: pspi_clk_pd1 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_D, B91_PIN_1)>;
|
||||
};
|
||||
pspi_mosi_io0_pd3: pspi_mosi_io0_pd3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_D, B91_PIN_3)>;
|
||||
};
|
||||
pspi_miso_io1_pd2: pspi_miso_io1_pd2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_D, B91_PIN_2)>;
|
||||
};
|
||||
|
||||
/* HSPI: CLK(PA2, PB4), MOSI(PA4, PB3), MISO(PA3, PB2) */
|
||||
|
||||
hspi_clk_pa2: hspi_clk_pa2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_A, B91_PIN_2)>;
|
||||
};
|
||||
hspi_mosi_io0_pa4: hspi_mosi_io0_pa4 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_A, B91_PIN_4)>;
|
||||
};
|
||||
hspi_miso_io1_pa3: hspi_miso_io1_pa3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_C, B91_PORT_A, B91_PIN_3)>;
|
||||
};
|
||||
|
||||
hspi_clk_pb4: hspi_clk_pb4 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_B, B91_PIN_4)>;
|
||||
};
|
||||
hspi_mosi_io0_pb3: hspi_mosi_io0_pb3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_B, B91_PIN_3)>;
|
||||
};
|
||||
hspi_miso_io1_pb2: hspi_miso_io1_pb2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_B, B91_PIN_2)>;
|
||||
};
|
||||
|
||||
hspi_io2_pb1: hspi_io2_pb1 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_B, B91_PIN_1)>;
|
||||
};
|
||||
hspi_io3_pb0: hspi_io3_pb0 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_B, B91_PIN_0)>;
|
||||
};
|
||||
|
||||
/* Define I2C pins: SCL(PB2, PC1, PE0, PE1), SDA(PB3, PC2, PE2, PE3) */
|
||||
|
||||
i2c_scl_pb2: i2c_scl_pb2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_B, B91_PIN_2)>;
|
||||
};
|
||||
i2c_scl_pc1: i2c_scl_pc1 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_C, B91_PIN_1)>;
|
||||
};
|
||||
i2c_scl_pe0: i2c_scl_pe0 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_E, B91_PIN_0)>;
|
||||
};
|
||||
i2c_scl_pe1: i2c_scl_pe1 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_E, B91_PIN_1)>;
|
||||
};
|
||||
|
||||
i2c_sda_pb3: i2c_sda_pb3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_B, B91_PORT_B, B91_PIN_3)>;
|
||||
};
|
||||
i2c_sda_pc2: i2c_sda_pc2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_C, B91_PIN_2)>;
|
||||
};
|
||||
i2c_sda_pe2: i2c_sda_pe2 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_E, B91_PIN_2)>;
|
||||
};
|
||||
i2c_sda_pe3: i2c_sda_pe3 {
|
||||
pinmux = <B91_PINMUX_SET(B91_FUNC_A, B91_PORT_E, B91_PIN_3)>;
|
||||
};
|
||||
label = "PINCTRL";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue