Commit 2145af01 authored by Peng Fan's avatar Peng Fan Committed by Sudeep Holla

firmware: arm_scmi: Add basic support for SCMI v3.2 pincontrol protocol

Add basic implementation of the SCMI v3.2 pincontrol protocol.
Co-developed-by: default avatarOleksii Moisieiev <oleksii_moisieiev@epam.com>
Signed-off-by: default avatarOleksii Moisieiev <oleksii_moisieiev@epam.com>
Co-developed-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Signed-off-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20240418-pinctrl-scmi-v11-3-499dca9864a7@nxp.comSigned-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent 1b403075
......@@ -10,7 +10,8 @@ scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_SMC) += smc.o
scmi-transport-$(CONFIG_ARM_SCMI_HAVE_MSG) += msg.o
scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_VIRTIO) += virtio.o
scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_OPTEE) += optee.o
scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o system.o voltage.o powercap.o
scmi-protocols-y := base.o clock.o perf.o power.o reset.o sensors.o system.o voltage.o powercap.o
scmi-protocols-y += pinctrl.o
scmi-module-objs := $(scmi-driver-y) $(scmi-protocols-y) $(scmi-transport-y)
obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-core.o
......
......@@ -3334,6 +3334,7 @@ static int __init scmi_driver_init(void)
scmi_voltage_register();
scmi_system_register();
scmi_powercap_register();
scmi_pinctrl_register();
return platform_driver_register(&scmi_driver);
}
......@@ -3351,6 +3352,7 @@ static void __exit scmi_driver_exit(void)
scmi_voltage_unregister();
scmi_system_unregister();
scmi_powercap_unregister();
scmi_pinctrl_unregister();
scmi_transports_exit();
......
This diff is collapsed.
......@@ -370,6 +370,7 @@ void __exit scmi_##name##_unregister(void) \
DECLARE_SCMI_REGISTER_UNREGISTER(base);
DECLARE_SCMI_REGISTER_UNREGISTER(clock);
DECLARE_SCMI_REGISTER_UNREGISTER(perf);
DECLARE_SCMI_REGISTER_UNREGISTER(pinctrl);
DECLARE_SCMI_REGISTER_UNREGISTER(power);
DECLARE_SCMI_REGISTER_UNREGISTER(reset);
DECLARE_SCMI_REGISTER_UNREGISTER(sensors);
......
......@@ -737,6 +737,89 @@ struct scmi_powercap_proto_ops {
u32 *power_thresh_high);
};
enum scmi_pinctrl_selector_type {
PIN_TYPE = 0,
GROUP_TYPE,
FUNCTION_TYPE,
};
enum scmi_pinctrl_conf_type {
SCMI_PIN_DEFAULT = 0,
SCMI_PIN_BIAS_BUS_HOLD = 1,
SCMI_PIN_BIAS_DISABLE = 2,
SCMI_PIN_BIAS_HIGH_IMPEDANCE = 3,
SCMI_PIN_BIAS_PULL_UP = 4,
SCMI_PIN_BIAS_PULL_DEFAULT = 5,
SCMI_PIN_BIAS_PULL_DOWN = 6,
SCMI_PIN_DRIVE_OPEN_DRAIN = 7,
SCMI_PIN_DRIVE_OPEN_SOURCE = 8,
SCMI_PIN_DRIVE_PUSH_PULL = 9,
SCMI_PIN_DRIVE_STRENGTH = 10,
SCMI_PIN_INPUT_DEBOUNCE = 11,
SCMI_PIN_INPUT_MODE = 12,
SCMI_PIN_PULL_MODE = 13,
SCMI_PIN_INPUT_VALUE = 14,
SCMI_PIN_INPUT_SCHMITT = 15,
SCMI_PIN_LOW_POWER_MODE = 16,
SCMI_PIN_OUTPUT_MODE = 17,
SCMI_PIN_OUTPUT_VALUE = 18,
SCMI_PIN_POWER_SOURCE = 19,
SCMI_PIN_SLEW_RATE = 20,
SCMI_PIN_OEM_START = 192,
SCMI_PIN_OEM_END = 255,
};
/**
* struct scmi_pinctrl_proto_ops - represents the various operations provided
* by SCMI Pinctrl Protocol
*
* @count_get: returns count of the registered elements in given type
* @name_get: returns name by index of given type
* @group_pins_get: returns the set of pins, assigned to the specified group
* @function_groups_get: returns the set of groups, assigned to the specified
* function
* @mux_set: set muxing function for groups of pins
* @settings_get_one: returns one configuration parameter for pin or group
* specified by config_type
* @settings_get_all: returns all configuration parameters for pin or group
* @settings_conf: sets the configuration parameter for pin or group
* @pin_request: aquire pin before selecting mux setting
* @pin_free: frees pin, acquired by request_pin call
*/
struct scmi_pinctrl_proto_ops {
int (*count_get)(const struct scmi_protocol_handle *ph,
enum scmi_pinctrl_selector_type type);
int (*name_get)(const struct scmi_protocol_handle *ph, u32 selector,
enum scmi_pinctrl_selector_type type,
const char **name);
int (*group_pins_get)(const struct scmi_protocol_handle *ph,
u32 selector, const unsigned int **pins,
unsigned int *nr_pins);
int (*function_groups_get)(const struct scmi_protocol_handle *ph,
u32 selector, unsigned int *nr_groups,
const unsigned int **groups);
int (*mux_set)(const struct scmi_protocol_handle *ph, u32 selector,
u32 group);
int (*settings_get_one)(const struct scmi_protocol_handle *ph,
u32 selector,
enum scmi_pinctrl_selector_type type,
enum scmi_pinctrl_conf_type config_type,
u32 *config_value);
int (*settings_get_all)(const struct scmi_protocol_handle *ph,
u32 selector,
enum scmi_pinctrl_selector_type type,
unsigned int *nr_configs,
enum scmi_pinctrl_conf_type *config_types,
u32 *config_values);
int (*settings_conf)(const struct scmi_protocol_handle *ph,
u32 selector, enum scmi_pinctrl_selector_type type,
unsigned int nr_configs,
enum scmi_pinctrl_conf_type *config_type,
u32 *config_value);
int (*pin_request)(const struct scmi_protocol_handle *ph, u32 pin);
int (*pin_free)(const struct scmi_protocol_handle *ph, u32 pin);
};
/**
* struct scmi_notify_ops - represents notifications' operations provided by
* SCMI core
......@@ -842,6 +925,7 @@ enum scmi_std_protocol {
SCMI_PROTOCOL_RESET = 0x16,
SCMI_PROTOCOL_VOLTAGE = 0x17,
SCMI_PROTOCOL_POWERCAP = 0x18,
SCMI_PROTOCOL_PINCTRL = 0x19,
};
enum scmi_system_events {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment