cns3xxx: merge fixes and improvements from trunk