From 19cdfb4148338a94bdc75194e0fadad993c37758 Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Mon, 27 Nov 2017 18:21:23 -0800 Subject: mpm: Reset periph manager on update Upon updating certain components (the FPGA, for example), the Peripheral Manager is restarted, and the overlay is reapplied. In order to facilitate this, the RPC server intercepts and handles the update_component function. Tested on the RJ45 ethernet connection. It probably won't work as well if the SFP connection goes down when the overlay is removed. --- mpm/python/usrp_mpm/periph_manager/n310.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mpm/python/usrp_mpm/periph_manager/n310.py') diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py index 7adbc85f0..79c866aa4 100644 --- a/mpm/python/usrp_mpm/periph_manager/n310.py +++ b/mpm/python/usrp_mpm/periph_manager/n310.py @@ -31,6 +31,7 @@ from ..net import get_mac_addr from ..mpmtypes import SID from usrp_mpm.rpc_server import no_rpc from usrp_mpm import net +from usrp_mpm import dtoverlay from ..sysfs_gpio import SysFSGPIO from ..ethtable import EthDispatcherTable from ..liberiotable import LiberioDispatcherTable @@ -476,10 +477,12 @@ class n310(PeriphManagerBase): 'fpga': { 'callback': "update_fpga", 'path': '/lib/firmware/n3xx.bin', + 'reset': True, }, 'dts': { 'callback': "update_dts", 'path': '/lib/firmware/n3xx.dts', + 'reset': False, }, } @@ -586,6 +589,19 @@ class n310(PeriphManagerBase): for xport_mgr in itervalues(self._xport_mgrs): xport_mgr.deinit() + def tear_down(self): + """ + Tear down all members that need to be specially handled before + deconstruction. + For N310, this means the overlay. + """ + active_overlays = self.list_active_overlays() + self.log.trace("N310 has active device tree overlays: {}".format( + active_overlays + )) + for overlay in active_overlays: + dtoverlay.rm_overlay(overlay) + ########################################################################### # Transport API ########################################################################### -- cgit v1.2.3