I have produced an IP for a custom board with a ZYNQ based SoC. The IP is pretty simple, having an AXI-LITE interface to setup some registers. The AXI interface is of course connected to the ZYNQ processor system through an AXI interconnect/bridge. Those registers in hand are used by an FSM in order for the FSM to send signals to several different peripherals of which some are routedd outside the FPGA (LEDs, opto-couplers, relays, IEPE, etc…) and some stay inside (XADC, other IP activation,etc…).
I have decided to setup an iomap (request_mem_region, ioremap) to map my registers to some virtual memory and write to them. Also to allow the user to be able to make calls I have setup a chardev (which is still quite buggy causing kernel panics but that is not the subject).
So the user can now do ioctl calls and write to the needed registers
The question is qute simple, is this the correct way to write drivers for such custom IP blocks? Or are there sub libraries to use? For instance the GPIO library or one for leds. What is thebetter approach in terms of design and reusability and in general the “perfect” design metodology.
P.S.
I will be adding interrupt management to this IP as well as some DMA, the DMA aspect is not a problem I have found a great starting point right here: (https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2154987522/Linux+Multichannel+DMA+from+User+Space)
but again any “better” design suggestions and guidelines will be appreciated