drivers/pinctrl/freescale/pinctrl-imx-scmi.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/freescale/pinctrl-imx-scmi.c- Extension
.c- Size
- 9948 bytes
- Lines
- 373
- Domain
- Driver Families
- Bucket
- drivers/pinctrl
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/err.hlinux/errno.hlinux/module.hlinux/mod_devicetable.hlinux/of.hlinux/scmi_protocol.hlinux/seq_file.hlinux/slab.hlinux/types.hlinux/pinctrl/machine.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.h../pinctrl-utils.h../core.h../pinconf.h../pinmux.h
Detected Declarations
struct scmi_pinctrl_imxfunction pinctrl_scmi_imx_dt_node_to_mapfunction pinctrl_scmi_imx_dt_free_mapfunction pinctrl_scmi_imx_func_set_muxfunction pinctrl_scmi_imx_pinconf_getfunction pinctrl_scmi_imx_pinconf_setfunction pinctrl_scmi_imx_pinconf_dbg_showfunction scmi_pinctrl_imx_get_pinsfunction scmi_pinctrl_imx_probe
Annotated Snippet
struct scmi_pinctrl_imx {
struct device *dev;
struct scmi_protocol_handle *ph;
struct pinctrl_dev *pctldev;
struct pinctrl_desc pctl_desc;
const struct scmi_pinctrl_proto_ops *ops;
};
/* SCMI pin control types, aligned with SCMI firmware */
#define IMX_SCMI_NUM_CFG 5
#define IMX_SCMI_PIN_MUX 192
#define IMX_SCMI_PIN_CONFIG 193
#define IMX_SCMI_PIN_DAISY_ID 194
#define IMX_SCMI_PIN_DAISY_CFG 195
#define IMX_SCMI_PIN_EXT 196
#define IMX_SCMI_NO_PAD_CTL BIT(31)
#define IMX_SCMI_PAD_SION BIT(30)
#define IMX_SCMI_IOMUXC_CONFIG_SION BIT(4)
#define IMX_SCMI_PIN_SIZE 24
#define IMX94_DAISY_OFF 0x608
#define IMX95_DAISY_OFF 0x408
#define IMX952_DAISY_OFF 0x460
static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev,
struct device_node *np,
struct pinctrl_map **map,
unsigned int *num_maps)
{
struct pinctrl_map *new_map;
const __be32 *list;
unsigned long *configs = NULL;
unsigned long cfg[IMX_SCMI_NUM_CFG];
int map_num, size, pin_size, pin_id, num_pins;
int mux_reg, conf_reg, input_reg, mux_val, conf_val, input_val;
int i, j;
uint32_t ncfg;
static uint32_t daisy_off;
if (!daisy_off) {
if (of_machine_is_compatible("fsl,imx95")) {
daisy_off = IMX95_DAISY_OFF;
} else if (of_machine_is_compatible("fsl,imx94")) {
daisy_off = IMX94_DAISY_OFF;
} else if (of_machine_is_compatible("fsl,imx952")) {
daisy_off = IMX952_DAISY_OFF;
} else {
dev_err(pctldev->dev, "platform not support scmi pinctrl\n");
return -EINVAL;
}
}
list = of_get_property(np, "fsl,pins", &size);
if (!list) {
dev_err(pctldev->dev, "no fsl,pins property in node %pOF\n", np);
return -EINVAL;
}
pin_size = IMX_SCMI_PIN_SIZE;
if (!size || size % pin_size) {
dev_err(pctldev->dev, "Invalid fsl,pins or pins property in node %pOF\n", np);
return -EINVAL;
}
num_pins = size / pin_size;
map_num = num_pins;
new_map = kmalloc_objs(struct pinctrl_map, map_num);
if (!new_map)
return -ENOMEM;
*map = new_map;
*num_maps = map_num;
/* create config map */
for (i = 0; i < num_pins; i++) {
j = 0;
ncfg = IMX_SCMI_NUM_CFG;
mux_reg = be32_to_cpu(*list++);
conf_reg = be32_to_cpu(*list++);
input_reg = be32_to_cpu(*list++);
mux_val = be32_to_cpu(*list++);
input_val = be32_to_cpu(*list++);
conf_val = be32_to_cpu(*list++);
if (conf_val & IMX_SCMI_PAD_SION)
mux_val |= IMX_SCMI_IOMUXC_CONFIG_SION;
Annotation
- Immediate include surface: `linux/device.h`, `linux/err.h`, `linux/errno.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/of.h`, `linux/scmi_protocol.h`, `linux/seq_file.h`.
- Detected declarations: `struct scmi_pinctrl_imx`, `function pinctrl_scmi_imx_dt_node_to_map`, `function pinctrl_scmi_imx_dt_free_map`, `function pinctrl_scmi_imx_func_set_mux`, `function pinctrl_scmi_imx_pinconf_get`, `function pinctrl_scmi_imx_pinconf_set`, `function pinctrl_scmi_imx_pinconf_dbg_show`, `function scmi_pinctrl_imx_get_pins`, `function scmi_pinctrl_imx_probe`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.