brcm47xx: use separated function in upgrade to detect file type