Lines Matching +full:reset +full:- +full:delay +full:- +full:ms
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
81 * Reset the ESS switch. This also resets the ESS ethernet
91 ret = hwreset_assert(sc->sc_ess_rst); in ar40xx_hw_ess_reset()
93 device_printf(sc->sc_dev, "ERROR: failed to assert reset\n"); in ar40xx_hw_ess_reset()
96 DELAY(10*1000); in ar40xx_hw_ess_reset()
98 ret = hwreset_deassert(sc->sc_ess_rst); in ar40xx_hw_ess_reset()
100 device_printf(sc->sc_dev, in ar40xx_hw_ess_reset()
101 "ERROR: failed to deassert reset\n"); in ar40xx_hw_ess_reset()
105 DELAY(10*1000); in ar40xx_hw_ess_reset()
160 sc->sc_vlan.vlan = 1; in ar40xx_hw_vlan_init()
163 sc->sc_vlan.vlan_id[AR40XX_LAN_VLAN] = AR40XX_LAN_VLAN in ar40xx_hw_vlan_init()
165 sc->sc_vlan.vlan_id[AR40XX_WAN_VLAN] = AR40XX_WAN_VLAN in ar40xx_hw_vlan_init()
168 sc->sc_vlan.vlan_ports[AR40XX_LAN_VLAN] = in ar40xx_hw_vlan_init()
169 sc->sc_config.switch_cpu_bmp | sc->sc_config.switch_lan_bmp; in ar40xx_hw_vlan_init()
170 sc->sc_vlan.vlan_untagged[AR40XX_LAN_VLAN] = in ar40xx_hw_vlan_init()
171 sc->sc_config.switch_lan_bmp; in ar40xx_hw_vlan_init()
173 sc->sc_vlan.vlan_ports[AR40XX_WAN_VLAN] = in ar40xx_hw_vlan_init()
174 sc->sc_config.switch_cpu_bmp | sc->sc_config.switch_wan_bmp; in ar40xx_hw_vlan_init()
175 sc->sc_vlan.vlan_untagged[AR40XX_WAN_VLAN] = in ar40xx_hw_vlan_init()
176 sc->sc_config.switch_wan_bmp; in ar40xx_hw_vlan_init()
178 /* Populate the per-port PVID - pvid[] is an index into vlan_id[] */ in ar40xx_hw_vlan_init()
180 if (sc->sc_config.switch_lan_bmp & (1U << i)) in ar40xx_hw_vlan_init()
181 sc->sc_vlan.pvid[i] = AR40XX_LAN_VLAN; in ar40xx_hw_vlan_init()
182 if (sc->sc_config.switch_wan_bmp & (1U << i)) in ar40xx_hw_vlan_init()
183 sc->sc_vlan.pvid[i] = AR40XX_WAN_VLAN; in ar40xx_hw_vlan_init()
190 * Apply the per-port and global configuration from software.
194 * hardware. For now it's just used in the reset path.
209 device_printf(sc->sc_dev, in ar40xx_hw_sw_hw_apply()
219 * VLANs, or just straight up per-port VLANs. in ar40xx_hw_sw_hw_apply()
221 if (sc->sc_vlan.vlan) { in ar40xx_hw_sw_hw_apply()
222 device_printf(sc->sc_dev, "%s: configuring 802.1q VLANs\n", in ar40xx_hw_sw_hw_apply()
225 uint8_t vp = sc->sc_vlan.vlan_ports[j]; in ar40xx_hw_sw_hw_apply()
229 if ((sc->sc_vlan.vlan_id[j] in ar40xx_hw_sw_hw_apply()
241 sc->sc_vlan.vlan_id[j] & ETHERSWITCH_VID_MASK, in ar40xx_hw_sw_hw_apply()
242 sc->sc_vlan.vlan_ports[j], in ar40xx_hw_sw_hw_apply()
243 sc->sc_vlan.vlan_untagged[j]); in ar40xx_hw_sw_hw_apply()
246 device_printf(sc->sc_dev, "%s: configuring per-port VLANs\n", in ar40xx_hw_sw_hw_apply()
258 * Update per-port destination mask, vlan tag settings in ar40xx_hw_sw_hw_apply()
266 device_printf(sc->sc_dev, in ar40xx_hw_sw_hw_apply()
289 if (timeout-- <= 0) in ar40xx_hw_wait_bit()
292 DELAY(20); in ar40xx_hw_wait_bit()
295 device_printf(sc->sc_dev, "ERROR: timeout for reg " in ar40xx_hw_wait_bit()
319 s[5] = MS(ret0, AR40XX_REG_SW_MAC_ADDR0_BYTE5); in ar40xx_hw_read_switch_mac_address()
320 s[4] = MS(ret0, AR40XX_REG_SW_MAC_ADDR0_BYTE4); in ar40xx_hw_read_switch_mac_address()
321 s[3] = MS(ret1, AR40XX_REG_SW_MAC_ADDR1_BYTE3); in ar40xx_hw_read_switch_mac_address()
322 s[2] = MS(ret1, AR40XX_REG_SW_MAC_ADDR1_BYTE2); in ar40xx_hw_read_switch_mac_address()
323 s[1] = MS(ret1, AR40XX_REG_SW_MAC_ADDR1_BYTE1); in ar40xx_hw_read_switch_mac_address()
324 s[0] = MS(ret1, AR40XX_REG_SW_MAC_ADDR1_BYTE0); in ar40xx_hw_read_switch_mac_address()