drivers: Add FPGA register map uclass
PATCH 1/3 drivers: Add FPGA register map uclass
The FPGA (as a device) and the register map supplied by a FPGA are two different entities. There are U-Boot drivers for the former, but not for the later.
Add a uclass that makes it possible to read from and write to FPGA memory maps. The interface provided emulates the PCI interface, with one function for reading/writing plus a size parameter.
--- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/fpgamap/Kconfig | 9 +++ drivers/fpgamap/Makefile | 8 +++ drivers/fpgamap/fpgamap-uclass.c | 53 ++++++++++++++++ include/dm/uclass-id.h | 1 + include/fpgamap.h | 131 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 205 insertions(+) create mode 100644 drivers/fpgamap/Kconfig create mode 100644 drivers/fpgamap/Makefile create mode 100644 drivers/fpgamap/fpgamap-uclass.c create mode 100644 include/fpgamap.h
drivers/Kconfig +2 -0
@@ -32,6 +32,8 @@ source "drivers/firmware/Kconfig" source "drivers/fpga/Kconfig" +source "drivers/fpgamap/Kconfig" + source "drivers/gpio/Kconfig" source "drivers/i2c/Kconfig"
drivers/Makefile +1 -0
@@ -74,6 +74,7 @@ obj-$(CONFIG_CPU) += cpu/ obj-y += crypto/ obj-y += firmware/ obj-$(CONFIG_FPGA) += fpga/ +obj-$(CONFIG_FPGAMAP) += fpgamap/ obj-y += misc/ obj-$(CONFIG_MMC) += mmc/ obj-$(CONFIG_NVME) += nvme/
drivers/fpgamap/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +menuconfig FPGAMAP + bool "FPGA register map drivers" + help + Support drivers to operate on memory-mapped register maps of FPGAs. + Drivers are necessarily very device-dependant. + + Generic read/write operations with varying widths (8, 16, and 32 for + now), as well as read/write access to named registers (defined via + device tree entries) are supported
drivers/fpgamap/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# (C) Copyright 2017 +# Mario Six, Guntermann & Drunck GmbH, mario.six at gdsys.cc +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-$(CONFIG_FPGAMAP) += fpgamap-uclass.o
drivers/fpgamap/fpgamap-uclass.c new file +53 -0
53 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -36,6 +36,7 @@ enum uclass_id {UCLASS_DMA ,/* Direct Memory Access */ UCLASS_EFI ,/* EFI managed devices */ UCLASS_ETH ,/* Ethernet device */ +UCLASS_FPGAMAP ,/* FPGA register maps */ UCLASS_GPIO ,/* Bank of general-purpose I/O pins */ UCLASS_FIRMWARE ,/* Firmware */ UCLASS_I2C, /* I2C bus */
include/fpgamap.h new file +131 -0
131 lines not on this page · raw message
Signature · 1 line
2.16.1
PATCH 2/3 fpgamap/misc: Add ihs_fpga and gdsys_soc drivers
This patch adds drivers for IHS FPGAs and their associated busses.
--- drivers/fpgamap/Kconfig | 11 + drivers/fpgamap/Makefile | 1 + drivers/fpgamap/ihs_fpgamap.c | 811 ++++++++++++++++++++++++++++++++++++++++++ drivers/misc/Kconfig | 10 + drivers/misc/Makefile | 2 + drivers/misc/gdsys_soc.c | 67 ++++ drivers/misc/gdsys_soc.h | 24 ++ 7 files changed, 926 insertions(+) create mode 100644 drivers/fpgamap/ihs_fpgamap.c create mode 100644 drivers/misc/gdsys_soc.c create mode 100644 drivers/misc/gdsys_soc.h
drivers/fpgamap/Kconfig +11 -0
@@ -7,3 +7,14 @@ menuconfig FPGAMAP Generic read/write operations with varying widths (8, 16, and 32 for now), as well as read/write access to named registers (defined via device tree entries) are supported + +if FPGAMAP + +config IHS_FPGAMAP + bool "Enable IHS FPGA register map driver" + depends on DM + help + Support for IHS FPGA register map on a gdsys IHS FPGA used on gdsys + boards. + +endif
drivers/fpgamap/Makefile +1 -0
@@ -6,3 +6,4 @@ # obj-$(CONFIG_FPGAMAP) += fpgamap-uclass.o +obj-$(CONFIG_IHS_FPGAMAP) += ihs_fpgamap.o
drivers/fpgamap/ihs_fpgamap.c new file +811 -0
811 lines not on this page · raw message
drivers/misc/Kconfig +10 -0
@@ -263,5 +263,15 @@ config SYS_I2C_EEPROM_ADDR_OVERFLOW endif +config GDSYS_IOEP + bool "Enable gdsys IOEP driver" + depends on MISC + help + Support gdsys FPGA's IO endpoint driver. +config GDSYS_SOC + bool "Enable gdsys SOC driver" + depends on MISC + help + Support for IHS SOC. endmenu
drivers/misc/Makefile +2 -0
@@ -54,3 +54,5 @@ obj-$(CONFIG_QFW) += qfw.o obj-$(CONFIG_ROCKCHIP_EFUSE) += rockchip-efuse.o obj-$(CONFIG_STM32_RCC) += stm32_rcc.o obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o +obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o +obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o
drivers/misc/gdsys_soc.c new file +67 -0
67 lines not on this page · raw message
drivers/misc/gdsys_soc.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* (C) Copyright 2017 +* Mario Six, Guntermann & Drunck GmbH, mario.six at gdsys.cc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _GDSYS_SOC_H_ +#define _GDSYS_SOC_H_ + +/** +* gdsys_soc_get_fpga() - Retrieve pointer to parent bus' FPGA device +* +* To access their register maps, devices on gdsys soc buses usually have +* facilitate the accessor function of the IHS FPGA their parent bus is +* attached to. To access the FPGA device from within the bus' children, this +* function returns a pointer to it. +* +* @child: The child device on the FPGA bus needing access to the FPGA. +* @fpga: Pointer to the retrieved FPGA device. +* @return 0 on success, -ve on failure +*/ +int gdsys_soc_get_fpga (struct udevice *child,struct udevice **fpga); +#endif /* _GDSYS_SOC_H_ */
--
2.16.1
PATCH 3/3 cmd: Add fpgamap command
In reply to Mario SixAdd a command to debug the IHS FPGA's bus.
--- cmd/Kconfig | 5 + cmd/Makefile | 2 + cmd/fpgamap.c | 306 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 313 insertions(+) create mode 100644 cmd/fpgamap.c
cmd/Kconfig +5 -0
@@ -976,6 +976,11 @@ config CMD_USB_MASS_STORAGE help USB mass storage support +config CMD_FPGAMAP + bool "fpgamap" + help + Enable the command "fpgamap" to access register maps of FPGAs. + endmenu
cmd/Makefile +2 -0
@@ -144,6 +144,8 @@ obj-$(CONFIG_CMD_DFU) += dfu.o obj-$(CONFIG_CMD_GPT) += gpt.o obj-$(CONFIG_CMD_ETHSW) += ethsw.o +obj-$(CONFIG_CMD_FPGAMAP) += fpgamap.o + # Power obj-$(CONFIG_CMD_PMIC) += pmic.o obj-$(CONFIG_CMD_REGULATOR) += regulator.o
cmd/fpgamap.c new file +306 -0
306 lines not on this page · raw message
--
2.16.1
PATCH 1/3 drivers: Add FPGA register map uclass
In reply to Mario SixHi Mario,
Quoted 9 lines · Mario Six
The FPGA (as a device) and the register map supplied by a FPGA are two different entities. There are U-Boot drivers for the former, but not for the later.
Add a uclass that makes it possible to read from and write to FPGA memory maps. The interface provided emulates the PCI interface, with one function for reading/writing plus a size parameter.
Signed-off-by Mario Six <[email protected]>
Quoted 14 lines
--- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/fpgamap/Kconfig | 9 +++ drivers/fpgamap/Makefile | 8 +++ drivers/fpgamap/fpgamap-uclass.c | 53 ++++++++++++++++ include/dm/uclass-id.h | 1 + include/fpgamap.h | 131 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 205 insertions(+) create mode 100644 drivers/fpgamap/Kconfig create mode 100644 drivers/fpgamap/Makefile create mode 100644 drivers/fpgamap/fpgamap-uclass.c create mode 100644 include/fpgamap.h
Could we use regmap for this? That uclass really could use being enhanced to do the things you do here.
Regards,
Simon
PATCH 1/3 drivers: Add FPGA register map uclass
Hi Simon,
Quoted 27 lines · Simon Glass
Hi Mario,
Quoted 9 lines · Mario Six
The FPGA (as a device) and the register map supplied by a FPGA are two different entities. There are U-Boot drivers for the former, but not for the later.
Add a uclass that makes it possible to read from and write to FPGA memory maps. The interface provided emulates the PCI interface, with one function for reading/writing plus a size parameter.
Signed-off-by Mario Six <[email protected]>Quoted 14 lines
--- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/fpgamap/Kconfig | 9 +++ drivers/fpgamap/Makefile | 8 +++ drivers/fpgamap/fpgamap-uclass.c | 53 ++++++++++++++++ include/dm/uclass-id.h | 1 + include/fpgamap.h | 131 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 205 insertions(+) create mode 100644 drivers/fpgamap/Kconfig create mode 100644 drivers/fpgamap/Makefile create mode 100644 drivers/fpgamap/fpgamap-uclass.c create mode 100644 include/fpgamap.h
Quoted 3 lines
Could we use regmap for this? That uclass really could use being enhanced to do the things you do here.
OK, that should work, I'll move the functionality over to regmap then.
Quoted 3 lines
Regards,
Simon
Best regards,
Mario