Some fixes by Stefano. For detailed authorship see SOC repo Signed-off-by: Anton Khirnov <anton@khirnov.net>