[adm5120] rewrite of memory detection code, should be fix #1909