From 37a6a7ea68cd0880daa2a115c719c745e6f2d15d Mon Sep 17 00:00:00 2001 From: Derek Hageman Date: Tue, 30 Apr 2019 20:05:59 -0600 Subject: [PATCH] drivers: gpio: sam0: Remove defines from dts_fixup.h Move SAM0 GPIO to use the raw defines generated from the DTS parsing. Signed-off-by: Derek Hageman --- drivers/gpio/gpio_sam0.c | 24 +++++++++---------- dts/arm/atmel/samd.dtsi | 2 ++ dts/arm/atmel/samr21.dtsi | 1 + soc/arm/atmel_sam0/samd20/dts_fixup.h | 6 ----- soc/arm/atmel_sam0/samd21/dts_fixup.h | 6 ----- soc/arm/atmel_sam0/samr21/dts_fixup.h | 9 ------- .../gpio/gpio_basic_api/src/test_gpio.h | 2 +- 7 files changed, 16 insertions(+), 34 deletions(-) diff --git a/drivers/gpio/gpio_sam0.c b/drivers/gpio/gpio_sam0.c index 9615e498b97..a11f085ac99 100644 --- a/drivers/gpio/gpio_sam0.c +++ b/drivers/gpio/gpio_sam0.c @@ -122,37 +122,37 @@ static const struct gpio_driver_api gpio_sam0_api = { static int gpio_sam0_init(struct device *dev) { return 0; } /* Port A */ -#ifdef DT_GPIO_SAM0_PORTA_BASE_ADDRESS +#if DT_ATMEL_SAM0_GPIO_PORT_A_BASE_ADDRESS static const struct gpio_sam0_config gpio_sam0_config_0 = { - .regs = (PortGroup *)DT_GPIO_SAM0_PORTA_BASE_ADDRESS, + .regs = (PortGroup *)DT_ATMEL_SAM0_GPIO_PORT_A_BASE_ADDRESS, }; -DEVICE_AND_API_INIT(gpio_sam0_0, DT_GPIO_SAM0_PORTA_LABEL, gpio_sam0_init, - NULL, &gpio_sam0_config_0, POST_KERNEL, +DEVICE_AND_API_INIT(gpio_sam0_0, DT_ATMEL_SAM0_GPIO_PORT_A_LABEL, + gpio_sam0_init, NULL, &gpio_sam0_config_0, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &gpio_sam0_api); #endif /* Port B */ -#ifdef DT_GPIO_SAM0_PORTB_BASE_ADDRESS +#if DT_ATMEL_SAM0_GPIO_PORT_B_BASE_ADDRESS static const struct gpio_sam0_config gpio_sam0_config_1 = { - .regs = (PortGroup *)DT_GPIO_SAM0_PORTB_BASE_ADDRESS, + .regs = (PortGroup *)DT_ATMEL_SAM0_GPIO_PORT_B_BASE_ADDRESS, }; -DEVICE_AND_API_INIT(gpio_sam0_1, DT_GPIO_SAM0_PORTB_LABEL, gpio_sam0_init, - NULL, &gpio_sam0_config_1, POST_KERNEL, +DEVICE_AND_API_INIT(gpio_sam0_1, DT_ATMEL_SAM0_GPIO_PORT_B_LABEL, + gpio_sam0_init, NULL, &gpio_sam0_config_1, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &gpio_sam0_api); #endif /* Port C */ -#ifdef DT_GPIO_SAM0_PORTC_BASE_ADDRESS +#if DT_ATMEL_SAM0_GPIO_PORT_C_BASE_ADDRESS static const struct gpio_sam0_config gpio_sam0_config_2 = { - .regs = (PortGroup *)DT_GPIO_SAM0_PORTC_BASE_ADDRESS, + .regs = (PortGroup *)DT_ATMEL_SAM0_GPIO_PORT_C_BASE_ADDRESS, }; -DEVICE_AND_API_INIT(gpio_sam0_2, DT_GPIO_SAM0_PORTC_LABEL, gpio_sam0_init, - NULL, &gpio_sam0_config_2, POST_KERNEL, +DEVICE_AND_API_INIT(gpio_sam0_2, DT_ATMEL_SAM0_GPIO_PORT_C_LABEL, + gpio_sam0_init, NULL, &gpio_sam0_config_2, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &gpio_sam0_api); #endif diff --git a/dts/arm/atmel/samd.dtsi b/dts/arm/atmel/samd.dtsi index 870318bc275..4992b8d254f 100644 --- a/dts/arm/atmel/samd.dtsi +++ b/dts/arm/atmel/samd.dtsi @@ -36,6 +36,8 @@ aliases { pinmux-a = &pinmux_a; pinmux-b = &pinmux_b; + port-a = &porta; + port-b = &portb; }; soc { diff --git a/dts/arm/atmel/samr21.dtsi b/dts/arm/atmel/samr21.dtsi index 228d06dd1cf..bf59ba27610 100644 --- a/dts/arm/atmel/samr21.dtsi +++ b/dts/arm/atmel/samr21.dtsi @@ -9,6 +9,7 @@ / { aliases { pinmux-c = &pinmux_c; + port-c = &portc; }; soc { diff --git a/soc/arm/atmel_sam0/samd20/dts_fixup.h b/soc/arm/atmel_sam0/samd20/dts_fixup.h index aebe06baf28..9ccd995efde 100644 --- a/soc/arm/atmel_sam0/samd20/dts_fixup.h +++ b/soc/arm/atmel_sam0/samd20/dts_fixup.h @@ -5,12 +5,6 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_ATMEL_SAM0_NVMCTRL_41004000_BASE_ADDRESS_0 #define DT_FLASH_DEV_NAME DT_ATMEL_SAM0_NVMCTRL_41004000_LABEL -#define DT_GPIO_SAM0_PORTA_LABEL DT_ATMEL_SAM0_GPIO_41004400_LABEL -#define DT_GPIO_SAM0_PORTA_BASE_ADDRESS DT_ATMEL_SAM0_GPIO_41004400_BASE_ADDRESS - -#define DT_GPIO_SAM0_PORTB_LABEL DT_ATMEL_SAM0_GPIO_41004480_LABEL -#define DT_GPIO_SAM0_PORTB_BASE_ADDRESS DT_ATMEL_SAM0_GPIO_41004480_BASE_ADDRESS - #define DT_UART_SAM0_SERCOM0_CURRENT_SPEED DT_ATMEL_SAM0_UART_42000800_CURRENT_SPEED #define DT_UART_SAM0_SERCOM0_IRQ DT_ATMEL_SAM0_UART_42000800_IRQ_0 #define DT_UART_SAM0_SERCOM0_IRQ_PRIORITY DT_ATMEL_SAM0_UART_42000800_IRQ_0_PRIORITY diff --git a/soc/arm/atmel_sam0/samd21/dts_fixup.h b/soc/arm/atmel_sam0/samd21/dts_fixup.h index fae12165220..97dff550895 100644 --- a/soc/arm/atmel_sam0/samd21/dts_fixup.h +++ b/soc/arm/atmel_sam0/samd21/dts_fixup.h @@ -5,12 +5,6 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_ATMEL_SAM0_NVMCTRL_41004000_BASE_ADDRESS #define DT_FLASH_DEV_NAME DT_ATMEL_SAM0_NVMCTRL_41004000_LABEL -#define DT_GPIO_SAM0_PORTA_LABEL DT_ATMEL_SAM0_GPIO_41004400_LABEL -#define DT_GPIO_SAM0_PORTA_BASE_ADDRESS DT_ATMEL_SAM0_GPIO_41004400_BASE_ADDRESS - -#define DT_GPIO_SAM0_PORTB_LABEL DT_ATMEL_SAM0_GPIO_41004480_LABEL -#define DT_GPIO_SAM0_PORTB_BASE_ADDRESS DT_ATMEL_SAM0_GPIO_41004480_BASE_ADDRESS - #define DT_UART_SAM0_SERCOM0_CURRENT_SPEED DT_ATMEL_SAM0_UART_42000800_CURRENT_SPEED #define DT_UART_SAM0_SERCOM0_IRQ DT_ATMEL_SAM0_UART_42000800_IRQ_0 #define DT_UART_SAM0_SERCOM0_IRQ_PRIORITY DT_ATMEL_SAM0_UART_42000800_IRQ_0_PRIORITY diff --git a/soc/arm/atmel_sam0/samr21/dts_fixup.h b/soc/arm/atmel_sam0/samr21/dts_fixup.h index 16699bfacfc..b5a2dad17aa 100644 --- a/soc/arm/atmel_sam0/samr21/dts_fixup.h +++ b/soc/arm/atmel_sam0/samr21/dts_fixup.h @@ -9,15 +9,6 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_ATMEL_SAM0_NVMCTRL_41004000_BASE_ADDRESS #define DT_FLASH_DEV_NAME DT_ATMEL_SAM0_NVMCTRL_41004000_LABEL -#define DT_GPIO_SAM0_PORTA_LABEL DT_ATMEL_SAM0_GPIO_41004400_LABEL -#define DT_GPIO_SAM0_PORTA_BASE_ADDRESS DT_ATMEL_SAM0_GPIO_41004400_BASE_ADDRESS - -#define DT_GPIO_SAM0_PORTB_LABEL DT_ATMEL_SAM0_GPIO_41004480_LABEL -#define DT_GPIO_SAM0_PORTB_BASE_ADDRESS DT_ATMEL_SAM0_GPIO_41004480_BASE_ADDRESS - -#define DT_GPIO_SAM0_PORTC_LABEL DT_ATMEL_SAM0_GPIO_41004500_LABEL -#define DT_GPIO_SAM0_PORTC_BASE_ADDRESS DT_ATMEL_SAM0_GPIO_41004500_BASE_ADDRESS - #define DT_UART_SAM0_SERCOM0_CURRENT_SPEED DT_ATMEL_SAM0_UART_42000800_CURRENT_SPEED #define DT_UART_SAM0_SERCOM0_IRQ DT_ATMEL_SAM0_UART_42000800_IRQ_0 #define DT_UART_SAM0_SERCOM0_IRQ_PRIORITY DT_ATMEL_SAM0_UART_42000800_IRQ_0_PRIORITY diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h b/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h index cd9b06314cb..951da481ab6 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h +++ b/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h @@ -37,7 +37,7 @@ #define PIN_OUT 4 /* DIO4 */ #define PIN_IN 2 /* DIO2 */ #elif defined(CONFIG_BOARD_ARDUINO_ZERO) -#define DEV_NAME DT_GPIO_SAM0_PORTA_LABEL +#define DEV_NAME DT_ATMEL_SAM0_GPIO_PORT_A_LABEL #define PIN_OUT 20 /* PA20 / pin 6 */ #define PIN_IN 15 /* PA15 / pin 5 */ #elif defined(CONFIG_BOARD_NRF52840_PCA10056)