blob: b27c7b3906d82b90bc4bc95b6c48e8cc83fa3db5 [file] [log] [blame]
Bharat Gootyd9ff1ca2020-09-24 13:02:39 +05301/*
2 * Copyright (c) 2016 - 2021, Broadcom
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef MDIO_H
8#define MDIO_H
9
10#define CMIC_MIIM_PARAM (PLAT_CMIC_MIIM_BASE + 0x23cU)
11#define MDIO_PARAM_MIIM_CYCLE 29U
12#define MDIO_PARAM_INTERNAL_SEL 25U
13#define MDIO_PARAM_BUSID 22U
14#define MDIO_PARAM_BUSID_MASK 0x7U
15#define MDIO_PARAM_C45_SEL 21U
16#define MDIO_PARAM_PHYID 16U
17#define MDIO_PARAM_PHYID_MASK 0x1FU
18#define MDIO_PARAM_DATA 0U
19#define MDIO_PARAM_DATA_MASK 0xFFFFU
20#define CMIC_MIIM_READ_DATA (PLAT_CMIC_MIIM_BASE + 0x240U)
21#define MDIO_READ_DATA_MASK 0xffffU
22#define CMIC_MIIM_ADDRESS (PLAT_CMIC_MIIM_BASE + 0x244U)
23#define CMIC_MIIM_CTRL (PLAT_CMIC_MIIM_BASE + 0x248U)
24#define MDIO_CTRL_WRITE_OP 0x1U
25#define MDIO_CTRL_READ_OP 0x2U
26#define CMIC_MIIM_STAT (PLAT_CMIC_MIIM_BASE + 0x24cU)
27#define MDIO_STAT_DONE 1U
28
29int mdio_write(uint16_t busid, uint16_t phyid, uint32_t reg, uint16_t val);
30int mdio_read(uint16_t busid, uint16_t phyid, uint32_t reg);
31#endif /* MDIO_H */