mach-ux500: factor out l2x0 handling code