boards: arm: mps2: Move FPGA GPIO init to new DT macros

Move the FPGA GPIO init to use the devicetree.h macros instead of
dts_fixup.h.  This allows us to remove dts_fixup.h on mps2 based
platforms.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-04-23 01:14:06 -05:00 committed by Carles Cufí
parent 0cfbd9af90
commit d45bec1fb7
3 changed files with 13 additions and 87 deletions

View file

@ -1,17 +0,0 @@
/* SPDX-License-Identifier: Apache-2.0 */
/* SoC level DTS fixup file */
#define DT_FPGAIO_LED0_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_40028000_LABEL
#define DT_FPGAIO_LED0_NUM DT_ARM_MPS2_FPGAIO_GPIO_40028000_NGPIOS
#define DT_FPGAIO_LED0 DT_ARM_MPS2_FPGAIO_GPIO_40028000_BASE_ADDRESS
#define DT_FPGAIO_BUTTON_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_40028008_LABEL
#define DT_FPGAIO_BUTTON_NUM DT_ARM_MPS2_FPGAIO_GPIO_40028008_NGPIOS
#define DT_FPGAIO_BUTTON DT_ARM_MPS2_FPGAIO_GPIO_40028008_BASE_ADDRESS
#define DT_FPGAIO_MISC_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_4002804C_LABEL
#define DT_FPGAIO_MISC_NUM DT_ARM_MPS2_FPGAIO_GPIO_4002804C_NGPIOS
#define DT_FPGAIO_MISC DT_ARM_MPS2_FPGAIO_GPIO_4002804C_BASE_ADDRESS
/* End of SoC Level DTS fixup file */

View file

@ -1,64 +0,0 @@
/*
* Copyright (c) 2019 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_SOC_MPS2_AN521)
/* SoC level DTS fixup file */
#if defined (CONFIG_ARM_NONSECURE_FIRMWARE)
/* CMSDK APB Timers */
#define DT_CMSDK_APB_TIMER0 DT_ARM_CMSDK_TIMER_40000000_BASE_ADDRESS
#define DT_CMSDK_APB_TIMER_0_IRQ DT_ARM_CMSDK_TIMER_40000000_IRQ_0
#define DT_CMSDK_APB_TIMER1 DT_ARM_CMSDK_TIMER_40001000_BASE_ADDRESS
#define DT_CMSDK_APB_TIMER_1_IRQ IRQ_TIMER1 DT_ARM_CMSDK_TIMER_40001000_IRQ_0
/* CMSDK APB Dual Timer */
#define DT_CMSDK_APB_DTIMER DT_ARM_CMSDK_DTIMER_40002000_BASE_ADDRESS
#define DT_CMSDK_APB_DUALTIMER_IRQ DT_ARM_CMSDK_DTIMER_40002000_IRQ_0
#define DT_FPGAIO_LED0_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_40302000_LABEL
#define DT_FPGAIO_LED0_NUM DT_ARM_MPS2_FPGAIO_GPIO_40302000_NGPIOS
#define DT_FPGAIO_LED0 DT_ARM_MPS2_FPGAIO_GPIO_40302000_BASE_ADDRESS
#define DT_FPGAIO_BUTTON_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_40302008_LABEL
#define DT_FPGAIO_BUTTON_NUM DT_ARM_MPS2_FPGAIO_GPIO_40302008_NGPIOS
#define DT_FPGAIO_BUTTON DT_ARM_MPS2_FPGAIO_GPIO_40302008_BASE_ADDRESS
#define DT_FPGAIO_MISC_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_4030204C_LABEL
#define DT_FPGAIO_MISC_NUM DT_ARM_MPS2_FPGAIO_GPIO_4030204C_NGPIOS
#define DT_FPGAIO_MISC DT_ARM_MPS2_FPGAIO_GPIO_4030204C_BASE_ADDRESS
#else
/* CMSDK APB Timers */
#define DT_CMSDK_APB_TIMER0 DT_ARM_CMSDK_TIMER_50000000_BASE_ADDRESS
#define DT_CMSDK_APB_TIMER_0_IRQ DT_ARM_CMSDK_TIMER_50000000_IRQ_0
#define DT_CMSDK_APB_TIMER1 DT_ARM_CMSDK_TIMER_50001000_BASE_ADDRESS
#define DT_CMSDK_APB_TIMER_1_IRQ IRQ_TIMER1 DT_ARM_CMSDK_TIMER_50001000_IRQ_0
/* CMSDK APB Dual Timer */
#define DT_CMSDK_APB_DTIMER DT_ARM_CMSDK_DTIMER_50002000_BASE_ADDRESS
#define DT_CMSDK_APB_DUALTIMER_IRQ DT_ARM_CMSDK_DTIMER_50002000_IRQ_0
#define DT_FPGAIO_LED0_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_50302000_LABEL
#define DT_FPGAIO_LED0_NUM DT_ARM_MPS2_FPGAIO_GPIO_50302000_NGPIOS
#define DT_FPGAIO_LED0 DT_ARM_MPS2_FPGAIO_GPIO_50302000_BASE_ADDRESS
#define DT_FPGAIO_BUTTON_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_50302008_LABEL
#define DT_FPGAIO_BUTTON_NUM DT_ARM_MPS2_FPGAIO_GPIO_50302008_NGPIOS
#define DT_FPGAIO_BUTTON DT_ARM_MPS2_FPGAIO_GPIO_50302008_BASE_ADDRESS
#define DT_FPGAIO_MISC_GPIO_NAME DT_ARM_MPS2_FPGAIO_GPIO_5030204C_LABEL
#define DT_FPGAIO_MISC_NUM DT_ARM_MPS2_FPGAIO_GPIO_5030204C_NGPIOS
#define DT_FPGAIO_MISC DT_ARM_MPS2_FPGAIO_GPIO_5030204C_BASE_ADDRESS
#endif
#endif /* CONFIG_SOC_MPS2_AN521 */
/* End of SoC Level DTS fixup file */

View file

@ -12,13 +12,20 @@
#include <init.h>
#include <soc.h>
/* Setup GPIO drivers for accessing FPGAIO registers */
GPIO_MMIO32_INIT(fpgaio_led0, DT_FPGAIO_LED0_GPIO_NAME, DT_FPGAIO_LED0,
BIT_MASK(DT_FPGAIO_LED0_NUM));
GPIO_MMIO32_INIT(fpgaio_button, DT_FPGAIO_BUTTON_GPIO_NAME, DT_FPGAIO_BUTTON,
BIT_MASK(DT_FPGAIO_BUTTON_NUM));
GPIO_MMIO32_INIT(fpgaio_misc, DT_FPGAIO_MISC_GPIO_NAME, DT_FPGAIO_MISC,
BIT_MASK(DT_FPGAIO_MISC_NUM));
#define FPGAIO_NODE(n) DT_INST(n, arm_mps2_fpgaio_gpio)
#define FPGAIO_INIT(n) \
GPIO_MMIO32_INIT(fpgaio_##n, DT_LABEL(FPGAIO_NODE(n)), \
DT_REG_ADDR(FPGAIO_NODE(n)), \
BIT_MASK(DT_PROP(FPGAIO_NODE(n), ngpios)))
/* We expect there to be 3 arm,mps2-fpgaio-gpio devices:
* led0, button, and misc
*/
FPGAIO_INIT(0);
FPGAIO_INIT(1);
FPGAIO_INIT(2);
/* (Secure System Control) Base Address */
#define SSE_200_SYSTEM_CTRL_S_BASE (0x50021000UL)