drivers: gpio: gpio_intel_apl: Convert to DT_INST
Convert driver to use new DT_INST macros throughout. We remove the aliases and use nodelabel instead in the soc_gpio.h to determine the label for the specific gpio controller. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
576033f858
commit
7758f4a6f7
3 changed files with 22 additions and 49 deletions
|
@ -580,40 +580,26 @@ int gpio_intel_apl_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define GPIO_INTEL_APL_DEV_CFG_DATA(dir_l, dir_u, pos) \
|
||||
#define GPIO_INTEL_APL_DEV_CFG_DATA(n) \
|
||||
static const struct gpio_intel_apl_config \
|
||||
gpio_intel_apl_cfg_##dir_l##_##pos = { \
|
||||
gpio_intel_apl_cfg_##n = { \
|
||||
.common = { \
|
||||
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_ALIAS_GPIO_##dir_u##_##pos##_NGPIOS), \
|
||||
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \
|
||||
}, \
|
||||
.reg_base = (DT_ALIAS_GPIO_##dir_u##_##pos##_BASE_ADDRESS \
|
||||
& 0xFFFFFF00), \
|
||||
.pin_offset = DT_ALIAS_GPIO_##dir_u##_##pos##_PIN_OFFSET, \
|
||||
.num_pins = DT_ALIAS_GPIO_##dir_u##_##pos##_NGPIOS, \
|
||||
.reg_base = (DT_INST_REG_ADDR(n) & 0xFFFFFF00), \
|
||||
.pin_offset = DT_INST_PROP(n, pin_offset), \
|
||||
.num_pins = DT_INST_PROP(n, ngpios), \
|
||||
}; \
|
||||
\
|
||||
static struct gpio_intel_apl_data gpio_intel_apl_data_##dir_l##_##pos; \
|
||||
static struct gpio_intel_apl_data gpio_intel_apl_data_##n; \
|
||||
\
|
||||
DEVICE_AND_API_INIT(gpio_intel_apl_##dir_l##_##pos, \
|
||||
DT_ALIAS_GPIO_##dir_u##_##pos##_LABEL, \
|
||||
DEVICE_AND_API_INIT(gpio_intel_apl_##n, \
|
||||
DT_INST_LABEL(n), \
|
||||
gpio_intel_apl_init, \
|
||||
&gpio_intel_apl_data_##dir_l##_##pos, \
|
||||
&gpio_intel_apl_cfg_##dir_l##_##pos, \
|
||||
&gpio_intel_apl_data_##n, \
|
||||
&gpio_intel_apl_cfg_##n, \
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||
&gpio_intel_apl_api)
|
||||
|
||||
/* "sub" devices. no more than GPIO_INTEL_APL_NR_SUBDEVS of these! */
|
||||
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(n, N, 000);
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(n, N, 032);
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(n, N, 064);
|
||||
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(nw, NW, 000);
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(nw, NW, 032);
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(nw, NW, 064);
|
||||
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(w, W, 000);
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(w, W, 032);
|
||||
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(sw, SW, 000);
|
||||
GPIO_INTEL_APL_DEV_CFG_DATA(sw, SW, 032);
|
||||
DT_INST_FOREACH(GPIO_INTEL_APL_DEV_CFG_DATA)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue