Lines Matching refs:tse_pcs

44 static u16 tse_pcs_read(struct altera_tse_pcs *tse_pcs, int regnum)  in tse_pcs_read()  argument
46 if (tse_pcs->reg_width == 4) in tse_pcs_read()
47 return readl(tse_pcs->base + regnum * 4); in tse_pcs_read()
49 return readw(tse_pcs->base + regnum * 2); in tse_pcs_read()
52 static void tse_pcs_write(struct altera_tse_pcs *tse_pcs, int regnum, in tse_pcs_write() argument
55 if (tse_pcs->reg_width == 4) in tse_pcs_write()
56 writel(value, tse_pcs->base + regnum * 4); in tse_pcs_write()
58 writew(value, tse_pcs->base + regnum * 2); in tse_pcs_write()
61 static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs) in tse_pcs_reset() argument
67 bmcr = tse_pcs_read(tse_pcs, MII_BMCR); in tse_pcs_reset()
69 tse_pcs_write(tse_pcs, MII_BMCR, bmcr); in tse_pcs_reset()
72 if (!(tse_pcs_read(tse_pcs, MII_BMCR) & BMCR_RESET)) in tse_pcs_reset()
96 struct altera_tse_pcs *tse_pcs = phylink_pcs_to_tse_pcs(pcs); in alt_tse_pcs_config() local
99 ctrl = tse_pcs_read(tse_pcs, MII_BMCR); in alt_tse_pcs_config()
100 if_mode = tse_pcs_read(tse_pcs, SGMII_PCS_IF_MODE); in alt_tse_pcs_config()
103 tse_pcs_write(tse_pcs, SGMII_PCS_LINK_TIMER_0, 0x0D40); in alt_tse_pcs_config()
104 tse_pcs_write(tse_pcs, SGMII_PCS_LINK_TIMER_1, 0x03); in alt_tse_pcs_config()
115 tse_pcs_write(tse_pcs, MII_BMCR, ctrl); in alt_tse_pcs_config()
116 tse_pcs_write(tse_pcs, SGMII_PCS_IF_MODE, if_mode); in alt_tse_pcs_config()
118 return tse_pcs_reset(tse_pcs); in alt_tse_pcs_config()
124 struct altera_tse_pcs *tse_pcs = phylink_pcs_to_tse_pcs(pcs); in alt_tse_pcs_get_state() local
127 bmsr = tse_pcs_read(tse_pcs, MII_BMSR); in alt_tse_pcs_get_state()
128 lpa = tse_pcs_read(tse_pcs, MII_LPA); in alt_tse_pcs_get_state()
135 struct altera_tse_pcs *tse_pcs = phylink_pcs_to_tse_pcs(pcs); in alt_tse_pcs_an_restart() local
138 bmcr = tse_pcs_read(tse_pcs, MII_BMCR); in alt_tse_pcs_an_restart()
140 tse_pcs_write(tse_pcs, MII_BMCR, bmcr); in alt_tse_pcs_an_restart()
143 tse_pcs_reset(tse_pcs); in alt_tse_pcs_an_restart()
156 struct altera_tse_pcs *tse_pcs; in alt_tse_pcs_create() local
161 tse_pcs = devm_kzalloc(&ndev->dev, sizeof(*tse_pcs), GFP_KERNEL); in alt_tse_pcs_create()
162 if (!tse_pcs) in alt_tse_pcs_create()
165 tse_pcs->pcs.ops = &alt_tse_pcs_ops; in alt_tse_pcs_create()
166 tse_pcs->base = pcs_base; in alt_tse_pcs_create()
167 tse_pcs->reg_width = reg_width; in alt_tse_pcs_create()
169 return &tse_pcs->pcs; in alt_tse_pcs_create()