xref: /linux/drivers/net/phy/air_phy_lib.h (revision 90e63d5354951d37fa2b3b91e6f17b95d2bf9bee)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2026 Airoha Technology Corp.
4  * Copyright (C) 2026 Collabora Ltd.
5  *                    Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
6  */
7 
8 #ifndef __AIR_PHY_LIB_H
9 #define __AIR_PHY_LIB_H
10 
11 #include <linux/phy.h>
12 
13 #define AIR_EXT_PAGE_ACCESS		0x1f
14 
15 #define AIR_PHY_PAGE_STANDARD		0x0000
16 #define AIR_PHY_PAGE_EXTENDED_1		0x0001
17 #define AIR_PHY_PAGE_EXTENDED_4		0x0004
18 
19 /* MII Registers Page 4*/
20 #define AIR_BPBUS_MODE			0x10
21 #define   AIR_BPBUS_MODE_ADDR_FIXED		0x0000
22 #define   AIR_BPBUS_MODE_ADDR_INCR		BIT(15)
23 #define AIR_BPBUS_WR_ADDR_HIGH		0x11
24 #define AIR_BPBUS_WR_ADDR_LOW		0x12
25 #define AIR_BPBUS_WR_DATA_HIGH		0x13
26 #define AIR_BPBUS_WR_DATA_LOW		0x14
27 #define AIR_BPBUS_RD_ADDR_HIGH		0x15
28 #define AIR_BPBUS_RD_ADDR_LOW		0x16
29 #define AIR_BPBUS_RD_DATA_HIGH		0x17
30 #define AIR_BPBUS_RD_DATA_LOW		0x18
31 
32 int air_phy_buckpbus_reg_modify(struct phy_device *phydev, u32 pbus_address,
33 				u32 mask, u32 set);
34 int air_phy_buckpbus_reg_read(struct phy_device *phydev, u32 pbus_address,
35 			      u32 *pbus_data);
36 int air_phy_buckpbus_reg_write(struct phy_device *phydev, u32 pbus_address,
37 			       u32 pbus_data);
38 int air_phy_read_page(struct phy_device *phydev);
39 int air_phy_write_page(struct phy_device *phydev, int page);
40 
41 #endif /* __AIR_PHY_LIB_H */
42