drivers: pinctrl: update lpc pin control implementation to use offsets
update pin control implementation to use offsets for pin registers instead of pin/port combination, to permit additional flexibility for lpc devices with non contiguous register layouts. Update LPC55s69 pin control names to align with newly generated pin control header. This change also requires an update to the NXP HAL to use the new pin control headers with offsets. Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
26b28b9527
commit
916c059f3d
3 changed files with 10 additions and 11 deletions
|
@ -7,25 +7,24 @@
|
|||
#include <drivers/pinctrl.h>
|
||||
#include <fsl_clock.h>
|
||||
|
||||
#define PORT(mux) (((mux) & 0xC0000000) >> 30)
|
||||
#define PIN(mux) (((mux) & 0x3F000000) >> 24)
|
||||
#define TYPE(mux) (((mux) & 0xC00000) >> 22)
|
||||
#define OFFSET(mux) (((mux) & 0xFFF00000) >> 20)
|
||||
#define TYPE(mux) (((mux) & 0xC0000) >> 18)
|
||||
|
||||
#define IOCON_TYPE_D 0x0
|
||||
#define IOCON_TYPE_I 0x1
|
||||
#define IOCON_TYPE_A 0x2
|
||||
|
||||
static IOCON_Type *iocon = (IOCON_Type *)DT_REG_ADDR(DT_NODELABEL(iocon));
|
||||
static volatile uint32_t *iocon =
|
||||
(volatile uint32_t *)DT_REG_ADDR(DT_NODELABEL(iocon));
|
||||
|
||||
int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
|
||||
uintptr_t reg)
|
||||
{
|
||||
for (uint8_t i = 0; i < pin_cnt; i++) {
|
||||
/* Check if this is an analog or i2c type pin */
|
||||
uint32_t pin_mux = pins[i];
|
||||
uint32_t port = PORT(pin_mux);
|
||||
uint32_t pin = PIN(pin_mux);
|
||||
uint32_t offset = OFFSET(pin_mux);
|
||||
|
||||
/* Check if this is an analog or i2c type pin */
|
||||
switch (TYPE(pin_mux)) {
|
||||
case IOCON_TYPE_D:
|
||||
pin_mux &= Z_PINCTRL_IOCON_D_PIN_MASK;
|
||||
|
@ -41,7 +40,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
|
|||
assert(TYPE(pin_mux <= IOCON_TYPE_A));
|
||||
}
|
||||
/* Set pinmux */
|
||||
iocon->PIO[port][pin] = pin_mux;
|
||||
*(iocon + offset) = pin_mux;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue