Lines Matching full:bus

34 #define MDC_PIN(bus)	(((struct gpio_priv *)bus->priv)->mdc_pin)  argument
35 #define MDIO_PIN(bus) (((struct gpio_priv *)bus->priv)->mdio_pin) argument
37 static inline void mdio_lo(struct mii_bus *bus) in mdio_lo() argument
39 out_le32(gpio_regs+0x10, 1 << MDIO_PIN(bus)); in mdio_lo()
42 static inline void mdio_hi(struct mii_bus *bus) in mdio_hi() argument
44 out_le32(gpio_regs, 1 << MDIO_PIN(bus)); in mdio_hi()
47 static inline void mdc_lo(struct mii_bus *bus) in mdc_lo() argument
49 out_le32(gpio_regs+0x10, 1 << MDC_PIN(bus)); in mdc_lo()
52 static inline void mdc_hi(struct mii_bus *bus) in mdc_hi() argument
54 out_le32(gpio_regs, 1 << MDC_PIN(bus)); in mdc_hi()
57 static inline void mdio_active(struct mii_bus *bus) in mdio_active() argument
59 out_le32(gpio_regs+0x20, (1 << MDC_PIN(bus)) | (1 << MDIO_PIN(bus))); in mdio_active()
62 static inline void mdio_tristate(struct mii_bus *bus) in mdio_tristate() argument
64 out_le32(gpio_regs+0x30, (1 << MDIO_PIN(bus))); in mdio_tristate()
67 static inline int mdio_read(struct mii_bus *bus) in mdio_read() argument
69 return !!(in_le32(gpio_regs+0x40) & (1 << MDIO_PIN(bus))); in mdio_read()
72 static void clock_out(struct mii_bus *bus, int bit) in clock_out() argument
75 mdio_hi(bus); in clock_out()
77 mdio_lo(bus); in clock_out()
79 mdc_hi(bus); in clock_out()
81 mdc_lo(bus); in clock_out()
85 static void bitbang_pre(struct mii_bus *bus, int read, u8 addr, u8 reg) in bitbang_pre() argument
90 mdio_active(bus); in bitbang_pre()
92 clock_out(bus, 1); in bitbang_pre()
96 clock_out(bus, 0); in bitbang_pre()
97 clock_out(bus, 1); in bitbang_pre()
99 clock_out(bus, read); in bitbang_pre()
100 clock_out(bus, !read); in bitbang_pre()
104 clock_out(bus, (addr & 0x10) != 0); in bitbang_pre()
110 clock_out(bus, (reg & 0x10) != 0); in bitbang_pre()
115 static int gpio_mdio_read(struct mii_bus *bus, int phy_id, int location) in gpio_mdio_read() argument
122 bitbang_pre(bus, 1, addr, reg); in gpio_mdio_read()
125 mdio_tristate(bus); in gpio_mdio_read()
127 mdc_hi(bus); in gpio_mdio_read()
129 mdc_lo(bus); in gpio_mdio_read()
134 mdc_lo(bus); in gpio_mdio_read()
136 mdc_hi(bus); in gpio_mdio_read()
138 mdc_lo(bus); in gpio_mdio_read()
141 rdreg |= mdio_read(bus); in gpio_mdio_read()
144 mdc_hi(bus); in gpio_mdio_read()
146 mdc_lo(bus); in gpio_mdio_read()
154 static int gpio_mdio_write(struct mii_bus *bus, int phy_id, int location, u16 val) in gpio_mdio_write() argument
162 bitbang_pre(bus, 0, addr, reg); in gpio_mdio_write()
165 mdc_lo(bus); in gpio_mdio_write()
166 mdio_hi(bus); in gpio_mdio_write()
168 mdc_hi(bus); in gpio_mdio_write()
170 mdc_lo(bus); in gpio_mdio_write()
171 mdio_lo(bus); in gpio_mdio_write()
173 mdc_hi(bus); in gpio_mdio_write()
178 mdc_lo(bus); in gpio_mdio_write()
180 mdio_hi(bus); in gpio_mdio_write()
182 mdio_lo(bus); in gpio_mdio_write()
184 mdc_hi(bus); in gpio_mdio_write()
192 mdio_tristate(bus); in gpio_mdio_write()
193 mdc_lo(bus); in gpio_mdio_write()
195 mdc_hi(bus); in gpio_mdio_write()
200 static int gpio_mdio_reset(struct mii_bus *bus) in gpio_mdio_reset() argument
226 new_bus->name = "pasemi gpio mdio bus"; in gpio_mdio_probe()
247 pr_err("%s: Cannot register as MDIO bus, err %d\n", in gpio_mdio_probe()
265 struct mii_bus *bus = dev_get_drvdata(&dev->dev); in gpio_mdio_remove() local
267 mdiobus_unregister(bus); in gpio_mdio_remove()
271 kfree(bus->priv); in gpio_mdio_remove()
272 bus->priv = NULL; in gpio_mdio_remove()
273 mdiobus_free(bus); in gpio_mdio_remove()