Porting code from NXP1127

code from FAE of NXP