drivers/pinctrl/pinctrl-lpc18xx.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-lpc18xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-lpc18xx.c- Extension
.c- Size
- 43110 bytes
- Lines
- 1383
- 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/bitops.hlinux/clk.hlinux/init.hlinux/io.hlinux/mod_devicetable.hlinux/platform_device.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hcore.hpinctrl-utils.h
Detected Declarations
struct lpc18xx_pmx_funcstruct lpc18xx_scu_datastruct lpc18xx_pin_capsfunction lpc18xx_pconf_get_usb1function lpc18xx_pconf_get_i2c0function lpc18xx_pin_to_gpiofunction lpc18xx_get_pintselfunction lpc18xx_gpio_to_pintsel_valfunction lpc18xx_pconf_get_gpio_pin_intfunction lpc18xx_pconf_get_pinfunction lpc18xx_pconf_getfunction lpc18xx_pconf_set_usb1function lpc18xx_pconf_set_i2c0function lpc18xx_pconf_set_gpio_pin_intfunction lpc18xx_pconf_set_pinfunction lpc18xx_pconf_setfunction lpc18xx_pmx_get_funcs_countfunction lpc18xx_pmx_get_func_groupsfunction lpc18xx_pmx_setfunction lpc18xx_pctl_get_groups_countfunction lpc18xx_pctl_get_group_pinsfunction lpc18xx_valid_pin_functionfunction lpc18xx_create_group_func_mapfunction lpc18xx_scu_probe
Annotated Snippet
struct lpc18xx_pmx_func {
const char **groups;
unsigned ngroups;
};
struct lpc18xx_scu_data {
struct pinctrl_dev *pctl;
void __iomem *base;
struct clk *clk;
struct lpc18xx_pmx_func func[FUNC_MAX];
};
struct lpc18xx_pin_caps {
unsigned int offset;
unsigned char functions[LPC18XX_SCU_FUNC_PER_PIN];
unsigned char analog;
unsigned char type;
};
/* Analog pins are required to have both bias and input disabled */
#define LPC18XX_SCU_ANALOG_PIN_CFG 0x10
/* Macros to maniupluate analog member in lpc18xx_pin_caps */
#define LPC18XX_ANALOG_PIN BIT(7)
#define LPC18XX_ANALOG_ADC(a) ((a >> 5) & 0x3)
#define LPC18XX_ANALOG_BIT_MASK 0x1f
#define ADC0 (LPC18XX_ANALOG_PIN | (0x00 << 5))
#define ADC1 (LPC18XX_ANALOG_PIN | (0x01 << 5))
#define DAC LPC18XX_ANALOG_PIN
#define LPC_P(port, pin, f0, f1, f2, f3, f4, f5, f6, f7, a, t) \
static struct lpc18xx_pin_caps lpc18xx_pin_p##port##_##pin = { \
.offset = 0x##port * 32 * 4 + pin * 4, \
.functions = { \
FUNC_##f0, FUNC_##f1, FUNC_##f2, \
FUNC_##f3, FUNC_##f4, FUNC_##f5, \
FUNC_##f6, FUNC_##f7, \
}, \
.analog = a, \
.type = TYPE_##t, \
}
#define LPC_N(pname, off, f0, f1, f2, f3, f4, f5, f6, f7, a, t) \
static struct lpc18xx_pin_caps lpc18xx_pin_##pname = { \
.offset = off, \
.functions = { \
FUNC_##f0, FUNC_##f1, FUNC_##f2, \
FUNC_##f3, FUNC_##f4, FUNC_##f5, \
FUNC_##f6, FUNC_##f7, \
}, \
.analog = a, \
.type = TYPE_##t, \
}
/* Pinmuxing table taken from data sheet */
/* Pin FUNC0 FUNC1 FUNC2 FUNC3 FUNC4 FUNC5 FUNC6 FUNC7 ANALOG TYPE */
LPC_P(0,0, GPIO, SSP1, ENET, SGPIO, R, R, I2S0_TX_WS,I2S1, 0, ND);
LPC_P(0,1, GPIO, SSP1,ENET_ALT,SGPIO, R, R, ENET, I2S1, 0, ND);
LPC_P(1,0, GPIO, CTIN, EMC, R, R, SSP0, SGPIO, R, 0, ND);
LPC_P(1,1, GPIO, CTOUT, EMC, SGPIO, R, SSP0, R, R, 0, ND);
LPC_P(1,2, GPIO, CTOUT, EMC, SGPIO, R, SSP0, R, R, 0, ND);
LPC_P(1,3, GPIO, CTOUT, SGPIO, EMC, USB0, SSP1, R, SDMMC, 0, ND);
LPC_P(1,4, GPIO, CTOUT, SGPIO, EMC, USB0, SSP1, R, SDMMC, 0, ND);
LPC_P(1,5, GPIO, CTOUT, R, EMC, USB0, SSP1, SGPIO, SDMMC, 0, ND);
LPC_P(1,6, GPIO, CTIN, R, EMC, R, R, SGPIO, SDMMC, 0, ND);
LPC_P(1,7, GPIO, UART1, CTOUT, EMC, USB0, R, R, R, 0, ND);
LPC_P(1,8, GPIO, UART1, CTOUT, EMC, R, R, R, SDMMC, 0, ND);
LPC_P(1,9, GPIO, UART1, CTOUT, EMC, R, R, R, SDMMC, 0, ND);
LPC_P(1,10, GPIO, UART1, CTOUT, EMC, R, R, R, SDMMC, 0, ND);
LPC_P(1,11, GPIO, UART1, CTOUT, EMC, R, R, R, SDMMC, 0, ND);
LPC_P(1,12, GPIO, UART1, R, EMC, TIMER0, R, SGPIO, SDMMC, 0, ND);
LPC_P(1,13, GPIO, UART1, R, EMC, TIMER0, R, SGPIO, SDMMC, 0, ND);
LPC_P(1,14, GPIO, UART1, R, EMC, TIMER0, R, SGPIO, R, 0, ND);
LPC_P(1,15, GPIO, UART2, SGPIO, ENET, TIMER0, R, R, R, 0, ND);
LPC_P(1,16, GPIO, UART2, SGPIO,ENET_ALT,TIMER0, R, R, ENET, 0, ND);
LPC_P(1,17, GPIO, UART2, R, ENET, TIMER0, CAN1, SGPIO, R, 0, HD);
LPC_P(1,18, GPIO, UART2, R, ENET, TIMER0, CAN1, SGPIO, R, 0, ND);
LPC_P(1,19, ENET, SSP1, R, R, CLKOUT, R, I2S0_RX_MCLK,I2S1, 0, ND);
LPC_P(1,20, GPIO, SSP1, R, ENET, TIMER0, R, SGPIO, R, 0, ND);
LPC_P(2,0, SGPIO, UART0, EMC, USB0, GPIO, R, TIMER3, ENET, 0, ND);
LPC_P(2,1, SGPIO, UART0, EMC, USB0, GPIO, R, TIMER3, R, 0, ND);
LPC_P(2,2, SGPIO, UART0, EMC, USB0, GPIO, CTIN, TIMER3, R, 0, ND);
LPC_P(2,3, SGPIO, I2C1, UART3, CTIN, GPIO, R, TIMER3, USB0, 0, HD);
LPC_P(2,4, SGPIO, I2C1, UART3, CTIN, GPIO, R, TIMER3, USB0, 0, HD);
LPC_P(2,5, SGPIO, CTIN, USB1, ADCTRIG, GPIO, R, TIMER3, USB0, 0, HD);
LPC_P(2,6, SGPIO, UART0, EMC, USB0, GPIO, CTIN, TIMER3, R, 0, ND);
LPC_P(2,7, GPIO, CTOUT, UART3, EMC, R, R, TIMER3, R, 0, ND);
LPC_P(2,8, SGPIO, CTOUT, UART3, EMC, GPIO, R, R, R, 0, ND);
LPC_P(2,9, GPIO, CTOUT, UART3, EMC, R, R, R, R, 0, ND);
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/init.h`, `linux/io.h`, `linux/mod_devicetable.h`, `linux/platform_device.h`, `linux/pinctrl/pinconf-generic.h`, `linux/pinctrl/pinconf.h`.
- Detected declarations: `struct lpc18xx_pmx_func`, `struct lpc18xx_scu_data`, `struct lpc18xx_pin_caps`, `function lpc18xx_pconf_get_usb1`, `function lpc18xx_pconf_get_i2c0`, `function lpc18xx_pin_to_gpio`, `function lpc18xx_get_pintsel`, `function lpc18xx_gpio_to_pintsel_val`, `function lpc18xx_pconf_get_gpio_pin_int`, `function lpc18xx_pconf_get_pin`.
- 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.