Lines Matching +full:init +full:- +full:mdio +full:- +full:phy

4  * SPDX-License-Identifier: Apache-2.0
11 #include <zephyr/drivers/mdio.h>
36 struct mdio_esp32_dev_data *const dev_data = dev->data; in mdio_transfer()
38 k_sem_take(&dev_data->sem, K_FOREVER); in mdio_transfer()
40 if (emac_ll_is_mii_busy(dev_data->hal.mac_regs)) { in mdio_transfer()
41 LOG_ERR("phy busy"); in mdio_transfer()
42 k_sem_give(&dev_data->sem); in mdio_transfer()
43 return -EBUSY; in mdio_transfer()
47 emac_ll_set_phy_data(dev_data->hal.mac_regs, data_in); in mdio_transfer()
49 emac_hal_set_phy_cmd(&dev_data->hal, prtad, regad, write); in mdio_transfer()
56 if (!emac_ll_is_mii_busy(dev_data->hal.mac_regs)) { in mdio_transfer()
62 LOG_ERR("phy timeout"); in mdio_transfer()
63 k_sem_give(&dev_data->sem); in mdio_transfer()
64 return -ETIMEDOUT; in mdio_transfer()
68 *data_out = emac_ll_get_phy_data(dev_data->hal.mac_regs); in mdio_transfer()
71 k_sem_give(&dev_data->sem); in mdio_transfer()
91 const struct mdio_esp32_dev_config *const cfg = dev->config; in mdio_esp32_initialize()
92 struct mdio_esp32_dev_data *const dev_data = dev->data; in mdio_esp32_initialize()
95 k_sem_init(&dev_data->sem, 1, 1); in mdio_esp32_initialize()
97 res = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); in mdio_esp32_initialize()
103 DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_NODELABEL(mdio))); in mdio_esp32_initialize()
105 (clock_control_subsys_t)DT_CLOCKS_CELL(DT_NODELABEL(mdio), offset); in mdio_esp32_initialize()
109 if (res < 0 && res != -EALREADY) { in mdio_esp32_initialize()
113 /* Only the mac registers are required for MDIO */ in mdio_esp32_initialize()
114 dev_data->hal.mac_regs = &EMAC_MAC; in mdio_esp32_initialize()
116 /* Init MDIO clock */ in mdio_esp32_initialize()
117 emac_hal_set_csr_clock_range(&dev_data->hal, esp_clk_apb_freq()); in mdio_esp32_initialize()
125 static DEVICE_API(mdio, mdio_esp32_driver_api) = {