static void __init ap132_mdio_setup(void) { void __iomem *base; u32 t; #define GPIO_IN_ENABLE3_ADDRESS 0x0050 #define GPIO_IN_ENABLE3_MII_GE1_MDI_MASK 0x00ff0000 #define GPIO_IN_ENABLE3_MII_GE1_MDI_LSB 16 #define GPIO_IN_ENABLE3_MII_GE1_MDI_SET(x) (((x) << GPIO_IN_ENABLE3_MII_GE1_MDI_LSB) & GPIO_IN_ENABLE3_MII_GE1_MDI_MASK) #define GPIO_OUT_FUNCTION4_ADDRESS 0x003c #define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK 0xff000000 #define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_LSB 24 #define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_SET(x) (((x) << GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_LSB) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK) #define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK 0x0000ff00 #define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_LSB 8 #define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_SET(x) (((x) << GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_LSB) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK) base = ioremap(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE); t = __raw_readl(base + GPIO_IN_ENABLE3_ADDRESS); t &= ~GPIO_IN_ENABLE3_MII_GE1_MDI_MASK; t |= GPIO_IN_ENABLE3_MII_GE1_MDI_SET(19); __raw_writel(t, base + GPIO_IN_ENABLE3_ADDRESS); __raw_writel(__raw_readl(base + AR71XX_GPIO_REG_OE) & ~(1 << 19), base + AR71XX_GPIO_REG_OE); __raw_writel(__raw_readl(base + AR71XX_GPIO_REG_OE) & ~(1 << 17), base + AR71XX_GPIO_REG_OE); t = __raw_readl(base + GPIO_OUT_FUNCTION4_ADDRESS); t &= ~(GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK | GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK); t |= GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_SET(0x20) | GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_SET(0x21); __raw_writel(t, base + GPIO_OUT_FUNCTION4_ADDRESS); iounmap(base); }
void athrs_ar8033_mgmt_init(void) { extern void ath_gpio_config_output(int gpio); uint32_t rddata; rddata = athr_reg_rd(GPIO_IN_ENABLE3_ADDRESS)& ~GPIO_IN_ENABLE3_MII_GE1_MDI_MASK; rddata |= GPIO_IN_ENABLE3_MII_GE1_MDI_SET(19); athr_reg_wr(GPIO_IN_ENABLE3_ADDRESS, rddata); ath_gpio_config_output(ATH_GPIO); ath_gpio_config_output(ATH_GPIO17); rddata = athr_reg_rd(GPIO_OUT_FUNCTION4_ADDRESS) & ~(GPIO_FUNCTION4_MASK); rddata |=(GPIO_FUNCTION4_ENABLE); athr_reg_wr(GPIO_OUT_FUNCTION4_ADDRESS, rddata); ath_mdio_gpio14(); }