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

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

File Facts

System
Linux kernel
Corpus path
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c
Extension
.c
Size
34094 bytes
Lines
1012
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 cygnus_mux {
	unsigned int offset;
	unsigned int shift;
	unsigned int alt;
};

/*
 * Keep track of Cygnus IOMUX configuration and prevent double configuration
 *
 * @cygnus_mux: Cygnus IOMUX register description
 * @is_configured: flag to indicate whether a mux setting has already been
 * configured
 */
struct cygnus_mux_log {
	struct cygnus_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: Cygnus group based IOMUX configuration
 */
struct cygnus_pin_group {
	const char *name;
	const unsigned *pins;
	unsigned num_pins;
	struct cygnus_mux mux;
};

/*
 * Cygnus 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 cygnus_pin_function {
	const char *name;
	const char * const *groups;
	unsigned num_groups;
};

/*
 * Cygnus IOMUX pinctrl core
 *
 * @pctl: pointer to pinctrl_dev
 * @dev: pointer to device
 * @base0: first I/O register base of the Cygnus IOMUX controller
 * @base1: second I/O register base
 * @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 cygnus_pinctrl {
	struct pinctrl_dev *pctl;
	struct device *dev;
	void __iomem *base0;
	void __iomem *base1;

	const struct cygnus_pin_group *groups;
	unsigned num_groups;

	const struct cygnus_pin_function *functions;
	unsigned num_functions;

	struct cygnus_mux_log *mux_log;

	spinlock_t lock;
};

/*
 * Certain pins can be individually muxed to GPIO function
 *
 * @is_supported: flag to indicate GPIO mux is supported for this pin
 * @offset: register offset for GPIO mux override of a pin
 * @shift: bit shift for GPIO mux override of a pin
 */
struct cygnus_gpio_mux {
	int is_supported;
	unsigned int offset;
	unsigned int shift;
};

Annotation

Implementation Notes