drivers/pinctrl/bcm/pinctrl-nsp-mux.c

Source file repositories/reference/linux-study-clean/drivers/pinctrl/bcm/pinctrl-nsp-mux.c

File Facts

System
Linux kernel
Corpus path
drivers/pinctrl/bcm/pinctrl-nsp-mux.c
Extension
.c
Size
17862 bytes
Lines
637
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct nsp_mux {
	unsigned int base;
	unsigned int shift;
	unsigned int mask;
	unsigned int alt;
};

/*
 * Keep track of nsp IOMUX configuration and prevent double configuration
 *
 * @nsp_mux: nsp IOMUX register description
 * @is_configured: flag to indicate whether a mux setting has already been
 * configured
 */
struct nsp_mux_log {
	struct nsp_mux mux;
	bool is_configured;
};

/*
 * Group based IOMUX configuration
 *
 * @name: name of the group
 * @pins: array of pins used by this group
 * @num_pins: total number of pins used by this group
 * @mux: nsp group based IOMUX configuration
 */
struct nsp_pin_group {
	const char *name;
	const unsigned int *pins;
	const unsigned int num_pins;
	const struct nsp_mux mux;
};

/*
 * nsp mux function and supported pin groups
 *
 * @name: name of the function
 * @groups: array of groups that can be supported by this function
 * @num_groups: total number of groups that can be supported by this function
 */
struct nsp_pin_function {
	const char *name;
	const char * const *groups;
	const unsigned int num_groups;
};

/*
 * nsp IOMUX pinctrl core
 *
 * @pctl: pointer to pinctrl_dev
 * @dev: pointer to device
 * @base0: first mux register
 * @base1: second mux register
 * @base2: third mux register
 * @groups: pointer to array of groups
 * @num_groups: total number of groups
 * @functions: pointer to array of functions
 * @num_functions: total number of functions
 * @mux_log: pointer to the array of mux logs
 * @lock: lock to protect register access
 */
struct nsp_pinctrl {
	struct pinctrl_dev *pctl;
	struct device *dev;
	void __iomem *base0;
	void __iomem *base1;
	void __iomem *base2;
	const struct nsp_pin_group *groups;
	unsigned int num_groups;
	const struct nsp_pin_function *functions;
	unsigned int num_functions;
	struct nsp_mux_log *mux_log;
	spinlock_t lock;
};

/*
 * Description of a pin in nsp
 *
 * @pin: pin number
 * @name: pin name
 * @gpio_select: reg data to select GPIO
 */
struct nsp_pin {
	unsigned int pin;
	char *name;
	unsigned int gpio_select;
};

#define NSP_PIN_DESC(p, n, g)		\

Annotation

Implementation Notes