arm: mps2: Convert gpio to use device tree
Add binding for arm,mps2-fpgaio-gpio and update device tree and change FPGA GPIO init code to utilize device tree defines. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
ff031032bf
commit
28d060513c
9 changed files with 124 additions and 43 deletions
|
@ -17,4 +17,16 @@
|
||||||
#define DT_CMSDK_AHB_GPIO3 DT_ARM_CMSDK_GPIO_40013000_BASE_ADDRESS
|
#define DT_CMSDK_AHB_GPIO3 DT_ARM_CMSDK_GPIO_40013000_BASE_ADDRESS
|
||||||
#define DT_IRQ_PORT3_ALL DT_ARM_CMSDK_GPIO_40013000_IRQ_0
|
#define DT_IRQ_PORT3_ALL DT_ARM_CMSDK_GPIO_40013000_IRQ_0
|
||||||
|
|
||||||
|
#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 */
|
/* End of SoC Level DTS fixup file */
|
||||||
|
|
|
@ -199,6 +199,37 @@
|
||||||
reg = <0x4002a000 0x1000>;
|
reg = <0x4002a000 0x1000>;
|
||||||
label = "I2C_SHIELD1";
|
label = "I2C_SHIELD1";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gpio_led0: mps2_fpgaio@40028000 {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x40028000 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <2>;
|
||||||
|
label = "FPGA_LED0";
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_button: mps2_fpgaio@40028008 {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x40028008 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <2>;
|
||||||
|
label = "FPGA_BUTTON";
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_misc: mps2_fpgaio@4002804c {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x4002804c 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <10>;
|
||||||
|
label = "FPGA_MISC";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -168,3 +168,33 @@ i2c_shield1: i2c@20d000 {
|
||||||
reg = <0x20d000 0x1000>;
|
reg = <0x20d000 0x1000>;
|
||||||
label = "I2C_SHIELD1";
|
label = "I2C_SHIELD1";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gpio_led0: mps2_fpgaio@302000 {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x302000 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <2>;
|
||||||
|
label = "FPGA_LED0";
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_button: mps2_fpgaio@302008 {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x302008 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <2>;
|
||||||
|
label = "FPGA_BUTTON";
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_misc: mps2_fpgaio@30204c {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x30204c 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <10>;
|
||||||
|
label = "FPGA_MISC";
|
||||||
|
};
|
||||||
|
|
20
dts/bindings/gpio/arm,mps2-fpgaio-gpio.yaml
Normal file
20
dts/bindings/gpio/arm,mps2-fpgaio-gpio.yaml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
title: ARM MPS2 FPGA GPIO
|
||||||
|
|
||||||
|
description: GPIO controller on ARM MPS2 FPGA
|
||||||
|
|
||||||
|
compatible: "arm,mps2-fpgaio-gpio"
|
||||||
|
|
||||||
|
include: [gpio-controller.yaml, base.yaml]
|
||||||
|
|
||||||
|
properties:
|
||||||
|
reg:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
ngpios:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
"#gpio-cells":
|
||||||
|
const: 1
|
||||||
|
|
||||||
|
gpio-cells:
|
||||||
|
- pin
|
|
@ -36,6 +36,18 @@
|
||||||
#define DT_CMSDK_AHB_GPIO3 DT_ARM_CMSDK_GPIO_40103000_BASE_ADDRESS
|
#define DT_CMSDK_AHB_GPIO3 DT_ARM_CMSDK_GPIO_40103000_BASE_ADDRESS
|
||||||
#define DT_IRQ_PORT3_ALL DT_ARM_CMSDK_GPIO_40103000_IRQ_0
|
#define DT_IRQ_PORT3_ALL DT_ARM_CMSDK_GPIO_40103000_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
|
#else
|
||||||
|
|
||||||
/* CMSDK APB Timers */
|
/* CMSDK APB Timers */
|
||||||
|
@ -62,6 +74,18 @@
|
||||||
#define DT_CMSDK_AHB_GPIO3 DT_ARM_CMSDK_GPIO_50103000_BASE_ADDRESS
|
#define DT_CMSDK_AHB_GPIO3 DT_ARM_CMSDK_GPIO_50103000_BASE_ADDRESS
|
||||||
#define DT_IRQ_PORT3_ALL DT_ARM_CMSDK_GPIO_50103000_IRQ_0
|
#define DT_IRQ_PORT3_ALL DT_ARM_CMSDK_GPIO_50103000_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
|
||||||
|
|
||||||
#endif /* CONFIG_SOC_MPS2_AN521 */
|
#endif /* CONFIG_SOC_MPS2_AN521 */
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
|
|
||||||
/* Setup GPIO drivers for accessing FPGAIO registers */
|
/* Setup GPIO drivers for accessing FPGAIO registers */
|
||||||
GPIO_MMIO32_INIT(fpgaio_led0, FPGAIO_LED0_GPIO_NAME,
|
GPIO_MMIO32_INIT(fpgaio_led0, DT_FPGAIO_LED0_GPIO_NAME, DT_FPGAIO_LED0,
|
||||||
&__MPS2_FPGAIO->led0, FPGAIO_LED0_MASK);
|
BIT_MASK(DT_FPGAIO_LED0_NUM));
|
||||||
GPIO_MMIO32_INIT(fpgaio_button, FPGAIO_BUTTON_GPIO_NAME,
|
GPIO_MMIO32_INIT(fpgaio_button, DT_FPGAIO_BUTTON_GPIO_NAME, DT_FPGAIO_BUTTON,
|
||||||
&__MPS2_FPGAIO->button, FPGAIO_BUTTON_MASK);
|
BIT_MASK(DT_FPGAIO_BUTTON_NUM));
|
||||||
GPIO_MMIO32_INIT(fpgaio_misc, FPGAIO_MISC_GPIO_NAME,
|
GPIO_MMIO32_INIT(fpgaio_misc, DT_FPGAIO_MISC_GPIO_NAME, DT_FPGAIO_MISC,
|
||||||
&__MPS2_FPGAIO->misc, FPGAIO_MISC_MASK);
|
BIT_MASK(DT_FPGAIO_MISC_NUM));
|
||||||
|
|
||||||
/* (Secure System Control) Base Address */
|
/* (Secure System Control) Base Address */
|
||||||
#define SSE_200_SYSTEM_CTRL_S_BASE (0x50021000UL)
|
#define SSE_200_SYSTEM_CTRL_S_BASE (0x50021000UL)
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#define __DSP_PRESENT 1U /* DSP extension present */
|
#define __DSP_PRESENT 1U /* DSP extension present */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <soc_devices.h>
|
|
||||||
#include <generated_dts_board.h>
|
#include <generated_dts_board.h>
|
||||||
|
#include <soc_registers.h>
|
||||||
|
|
||||||
extern void wakeup_cpu1(void);
|
extern void wakeup_cpu1(void);
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017 Linaro Limited
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SOC_DEVICES_H_
|
|
||||||
#define _SOC_DEVICES_H_
|
|
||||||
|
|
||||||
#ifndef _ASMLANGUAGE
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include "soc_registers.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* FPGA system control block (FPGAIO) */
|
|
||||||
#define FPGAIO_BASE_ADDR (0x40028000)
|
|
||||||
#define __MPS2_FPGAIO ((volatile struct mps2_fpgaio *)FPGAIO_BASE_ADDR)
|
|
||||||
|
|
||||||
/* Names of GPIO drivers used to provide access to some FPGAIO registers */
|
|
||||||
#define FPGAIO_LED0_GPIO_NAME "FPGAIO_LED0"
|
|
||||||
#define FPGAIO_BUTTON_GPIO_NAME "FPGAIO_BUTTON"
|
|
||||||
#define FPGAIO_MISC_GPIO_NAME "FPGAIO_MISC"
|
|
||||||
|
|
||||||
#endif /* !_ASMLANGUAGE */
|
|
||||||
|
|
||||||
#endif /* _SOC_DEVICES_H_ */
|
|
|
@ -45,16 +45,10 @@ struct mps2_fpgaio {
|
||||||
#define FPGAIO_LED0_USERLED0 0
|
#define FPGAIO_LED0_USERLED0 0
|
||||||
#define FPGAIO_LED0_USERLED1 1
|
#define FPGAIO_LED0_USERLED1 1
|
||||||
|
|
||||||
/* Mask of valid bits in fpgaio led0 register */
|
|
||||||
#define FPGAIO_LED0_MASK BIT_MASK(2)
|
|
||||||
|
|
||||||
/* Defines for bits in fpgaio button register */
|
/* Defines for bits in fpgaio button register */
|
||||||
#define FPGAIO_BUTTON_USERPB0 0
|
#define FPGAIO_BUTTON_USERPB0 0
|
||||||
#define FPGAIO_BUTTON_USERPB1 1
|
#define FPGAIO_BUTTON_USERPB1 1
|
||||||
|
|
||||||
/* Mask of valid bits in fpgaio button register */
|
|
||||||
#define FPGAIO_BUTTON_MASK BIT_MASK(2)
|
|
||||||
|
|
||||||
/* Defines for bits in fpgaio misc register */
|
/* Defines for bits in fpgaio misc register */
|
||||||
#define FPGAIO_MISC_CLCD_CS 0
|
#define FPGAIO_MISC_CLCD_CS 0
|
||||||
#define FPGAIO_MISC_SPI_SS 1
|
#define FPGAIO_MISC_SPI_SS 1
|
||||||
|
@ -66,7 +60,4 @@ struct mps2_fpgaio {
|
||||||
#define FPGAIO_MISC_SHIELD0_SPI_CS 8
|
#define FPGAIO_MISC_SHIELD0_SPI_CS 8
|
||||||
#define FPGAIO_MISC_SHIELD1_SPI_CS 9
|
#define FPGAIO_MISC_SHIELD1_SPI_CS 9
|
||||||
|
|
||||||
/* Mask of valid bits in fpgaio misc register */
|
|
||||||
#define FPGAIO_MISC_MASK BIT_MASK(10)
|
|
||||||
|
|
||||||
#endif /* _ARM_MPS2_REGS_H_ */
|
#endif /* _ARM_MPS2_REGS_H_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue