The context of my question is running the FMCOMMS2 connected to a zed board. I'm running the analog devices kernel, device tree: zynq-zed-adv7511.dts, zynq_xcomm_adv7511_defconfig. Using the fmcomms2 vivado PL project provided by analog devices. Everything seems to work ok with my build of FPGA, Linux, and FSBL. I can boot linux, the drivers configure the AD9361 and samples start flowing into the PL, i can ILA and view the samples, change RF frequency via sysfs, observe corresponding change in my ILA of the 9361 monitor bus. That is all well and good. But...
What i actually need to do is be able to boot into linux, [unbind relevant drivers], load an arbitrary FPGA image, and bind the spi AD9361 drivers again.
I found this discussion: "Resetting" AD9361 from software?
I used the suggestion of writing to /sys/bus/xxx/driver/yyy/unbind and bind on a simple uio toy device i've been playing with. That works fine, the unbind invokes the _remove function in the driver, and the bind invokes the _probe function, and things work nicely.
However, when i try to do this on the ad9361 spi driver, i get an unhappy kernel on unbind. My initial debugging shows that it is unhappy with rx_sampl_clk, it is trying to disable and 'unprepare', but that clock has never been 'enabled' or 'prepared'. This is confirmed by looking in /sys/kernel/debug/clk/clk_summary.
I'm paraphrasing some of this, i'm not at my work machine right now, but wanted to throw this out there anyway. I'll post in the morning what exactly i tried to unbind and what the result was, but for now, i'm wondering if this is something anyone has ever done?
This may broadcast my linux ignorance, but what would be super useful to me is a driver that can be started and stopped like a kernel module, with either command line arguments or a configuration file etc. without needing a device tree entry. Having programmable logic things specified in the device tree doesn't work for me very well in general as i need to be able to reconfigure the PL in different ways. At least i need to be able to load a different FPGA image after boot, even if certain peripherals it provides are specified in the device tree - i need a way to gracefully get linux to 'back off' and then reinitialize anything that needs to be initialized after PL reload.
Any insight is appreciated.