drivers/pinctrl/freescale/pinctrl-imx.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/freescale/pinctrl-imx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/freescale/pinctrl-imx.c- Extension
.c- Size
- 21819 bytes
- Lines
- 823
- Domain
- Driver Families
- Bucket
- drivers/pinctrl
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/err.hlinux/init.hlinux/io.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_address.hlinux/platform_device.hlinux/regmap.hlinux/seq_file.hlinux/slab.hlinux/pinctrl/machine.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.h../core.h../pinconf.h../pinmux.hpinctrl-imx.h
Detected Declarations
function imx_pin_dbg_showfunction imx_dt_node_to_mapfunction imx_dt_free_mapfunction imx_pmx_set_one_pin_mmiofunction imx_pmx_setfunction imx_pinconf_get_mmiofunction imx_pinconf_getfunction imx_pinconf_set_mmiofunction imx_pinconf_setfunction imx_pinconf_dbg_showfunction imx_pinconf_group_dbg_showfunction imx_pinctrl_parse_pin_mmiofunction imx_pinctrl_parse_groupsfunction imx_pinctrl_parse_functionsfunction imx_pinctrl_dt_is_flat_functionsfunction for_each_child_of_node_scopedfunction imx_pinctrl_probe_dtfunction imx_pinctrl_probefunction imx_pinctrl_suspendfunction imx_pinctrl_resumeexport imx_pinctrl_probeexport imx_pinctrl_pm_ops
Annotated Snippet
if (info->flags & IMX_USE_SCU) {
/*
* For SCU case, we set mux and conf together
* in one IPC call
*/
new_map[j].data.configs.configs =
(unsigned long *)&pin->conf.scu;
new_map[j].data.configs.num_configs = 2;
} else {
new_map[j].data.configs.configs =
&pin->conf.mmio.config;
new_map[j].data.configs.num_configs = 1;
}
j++;
}
dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n",
(*map)->data.mux.function, (*map)->data.mux.group, map_num);
return 0;
}
static void imx_dt_free_map(struct pinctrl_dev *pctldev,
struct pinctrl_map *map, unsigned num_maps)
{
kfree(map);
}
static const struct pinctrl_ops imx_pctrl_ops = {
.get_groups_count = pinctrl_generic_get_group_count,
.get_group_name = pinctrl_generic_get_group_name,
.get_group_pins = pinctrl_generic_get_group_pins,
.pin_dbg_show = imx_pin_dbg_show,
.dt_node_to_map = imx_dt_node_to_map,
.dt_free_map = imx_dt_free_map,
};
static int imx_pmx_set_one_pin_mmio(struct imx_pinctrl *ipctl,
struct imx_pin *pin)
{
const struct imx_pinctrl_soc_info *info = ipctl->info;
struct imx_pin_mmio *pin_mmio = &pin->conf.mmio;
const struct imx_pin_reg *pin_reg;
unsigned int pin_id;
pin_id = pin->pin;
pin_reg = &ipctl->pin_regs[pin_id];
if (pin_reg->mux_reg == -1) {
dev_dbg(ipctl->dev, "Pin(%s) does not support mux function\n",
info->pins[pin_id].name);
return 0;
}
if (info->flags & SHARE_MUX_CONF_REG) {
u32 reg;
reg = readl(ipctl->base + pin_reg->mux_reg);
reg &= ~info->mux_mask;
reg |= (pin_mmio->mux_mode << info->mux_shift);
writel(reg, ipctl->base + pin_reg->mux_reg);
dev_dbg(ipctl->dev, "write: offset 0x%x val 0x%x\n",
pin_reg->mux_reg, reg);
} else {
writel(pin_mmio->mux_mode, ipctl->base + pin_reg->mux_reg);
dev_dbg(ipctl->dev, "write: offset 0x%x val 0x%x\n",
pin_reg->mux_reg, pin_mmio->mux_mode);
}
/*
* If the select input value begins with 0xff, it's a quirky
* select input and the value should be interpreted as below.
* 31 23 15 7 0
* | 0xff | shift | width | select |
* It's used to work around the problem that the select
* input for some pin is not implemented in the select
* input register but in some general purpose register.
* We encode the select input value, width and shift of
* the bit field into input_val cell of pin function ID
* in device tree, and then decode them here for setting
* up the select input bits in general purpose register.
*/
if (pin_mmio->input_val >> 24 == 0xff) {
u32 val = pin_mmio->input_val;
u8 select = val & 0xff;
u8 width = (val >> 8) & 0xff;
u8 shift = (val >> 16) & 0xff;
u32 mask = ((1 << width) - 1) << shift;
/*
Annotation
- Immediate include surface: `linux/err.h`, `linux/init.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`, `linux/platform_device.h`.
- Detected declarations: `function imx_pin_dbg_show`, `function imx_dt_node_to_map`, `function imx_dt_free_map`, `function imx_pmx_set_one_pin_mmio`, `function imx_pmx_set`, `function imx_pinconf_get_mmio`, `function imx_pinconf_get`, `function imx_pinconf_set_mmio`, `function imx_pinconf_set`, `function imx_pinconf_dbg_show`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.