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:
Kumar Gala 2020-04-20 11:08:27 -05:00 committed by Kumar Gala
commit 7758f4a6f7
3 changed files with 22 additions and 49 deletions

View file

@ -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)

View file

@ -35,19 +35,6 @@
#interrupt-cells = <3>;
};
aliases {
gpio-n-000 = &gpio_n_000_031;
gpio-n-032 = &gpio_n_032_063;
gpio-n-064 = &gpio_n_064_077;
gpio-nw-000 = &gpio_nw_000_031;
gpio-nw-032 = &gpio_nw_032_063;
gpio-nw-064 = &gpio_nw_064_076;
gpio-w-000 = &gpio_w_000_031;
gpio-w-032 = &gpio_w_032_046;
gpio-sw-000 = &gpio_sw_000_031;
gpio-sw-032 = &gpio_sw_032_042;
};
soc {
#address-cells = <1>;
#size-cells = <1>;

View file

@ -15,7 +15,7 @@
#ifndef __SOC_GPIO_H_
#define __SOC_GPIO_H_
#define APL_GPIO_DEV_N_0 DT_ALIAS_GPIO_N_000_LABEL
#define APL_GPIO_DEV_N_0 DT_LABEL(DT_NODELABEL(gpio_n_000_031))
#define APL_GPIO_0 0
#define APL_GPIO_1 1
#define APL_GPIO_2 2
@ -49,7 +49,7 @@
#define APL_GPIO_30 30
#define APL_GPIO_31 31
#define APL_GPIO_DEV_N_1 DT_ALIAS_GPIO_N_032_LABEL
#define APL_GPIO_DEV_N_1 DT_LABEL(DT_NODELABEL(gpio_n_032_063))
#define APL_GPIO_32 0
#define APL_GPIO_33 1
#define APL_GPIO_34 2
@ -83,7 +83,7 @@
#define APL_GPIO_TCK 30
#define APL_GPIO_TRST_B 31
#define APL_GPIO_DEV_N_2 DT_ALIAS_GPIO_N_064_LABEL
#define APL_GPIO_DEV_N_2 DT_LABEL(DT_NODELABEL(gpio_n_064_077))
#define APL_GPIO_TMS 0
#define APL_GPIO_TDI 1
#define APL_GPIO_CX_PMODE 2
@ -99,7 +99,7 @@
#define APL_GPIO_SVOD0_DATA 12
#define APL_GPIO_SVOD0_CLK 13
#define APL_GPIO_DEV_NW_0 DT_ALIAS_GPIO_NW_000_LABEL
#define APL_GPIO_DEV_NW_0 DT_LABEL(DT_NODELABEL(gpio_nw_000_031))
#define APL_GPIO_187 0
#define APL_GPIO_188 1
#define APL_GPIO_189 2
@ -133,7 +133,7 @@
#define APL_GPIO_PMIC_STDBY 30
#define APL_GPIO_PROCHOT_B 31
#define APL_GPIO_DEV_NW_1 DT_ALIAS_GPIO_NW_032_LABEL
#define APL_GPIO_DEV_NW_1 DT_LABEL(DT_NODELABEL(gpio_nw_032_063))
#define APL_GPIO_PMIC_I2C_SCL 0
#define APL_GPIO_PMIC_I2C_SDA 1
#define APL_GPIO_74 2
@ -167,7 +167,7 @@
#define APL_GPIO_105 30
#define APL_GPIO_106 31
#define APL_GPIO_DEV_NW_2 DT_ALIAS_GPIO_NW_064_LABEL
#define APL_GPIO_DEV_NW_2 DT_LABEL(DT_NODELABEL(gpio_nw_064_076))
#define APL_GPIO_109 0
#define APL_GPIO_110 1
#define APL_GPIO_111 2
@ -182,7 +182,7 @@
#define APL_GPIO_122 11
#define APL_GPIO_123 12
#define APL_GPIO_DEV_W_0 DT_ALIAS_GPIO_W_000_LABEL
#define APL_GPIO_DEV_W_0 DT_LABEL(DT_NODELABEL(gpio_w_000_031))
#define APL_GPIO_124 0
#define APL_GPIO_125 1
#define APL_GPIO_126 2
@ -216,7 +216,7 @@
#define APL_GPIO_OSC_CLK_OUT_0 30
#define APL_GPIO_OSC_CLK_OUT_1 31
#define APL_GPIO_DEV_W_1 DT_ALIAS_GPIO_W_032_LABEL
#define APL_GPIO_DEV_W_1 DT_LABEL(DT_NODELABEL(gpio_w_032_046))
#define APL_GPIO_OSC_CLK_OUT_2 0
#define APL_GPIO_OSC_CLK_OUT_3 1
#define APL_GPIO_OSC_CLK_OUT_4 2
@ -233,7 +233,7 @@
#define APL_GPIO_SUS_STAT_B 13
#define APL_GPIO_SUSPWRDNACK 14
#define APL_GPIO_DEV_SW_0 DT_ALIAS_GPIO_SW_000_LABEL
#define APL_GPIO_DEV_SW_0 DT_LABEL(DT_NODELABEL(gpio_sw_000_031))
#define APL_GPIO_205 0
#define APL_GPIO_206 1
#define APL_GPIO_207 2
@ -267,7 +267,7 @@
#define APL_GPIO_183 30
#define APL_GPIO_SMB_ALERTB 31
#define APL_GPIO_DEV_SW_1 DT_ALIAS_GPIO_SW_032_LABEL
#define APL_GPIO_DEV_SW_1 DT_LABEL(DT_NODELABEL(gpio_sw_032_042))
#define APL_GPIO_SMB_CLK 0
#define APL_GPIO_SMB_DATA 1
#define APL_GPIO_LPC_ILB_SERIRQ 2