fcmapphy.h (1840B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: fcmapphy.h 8 * 9 * Header file for FCMAP PHYs 10 */ 11 #ifndef SOC_FCMAPPHY_H 12 #define SOC_FCMAPPHY_H 13 14 15 #include <soc/phy/phyctrl.h> 16 #ifdef INCLUDE_FCMAP 17 18 #include <bfcmap.h> 19 20 typedef bfcmap_dev_addr_t soc_fcmap_dev_addr_t; 21 22 extern int 23 soc_fcmapphy_miim_write(soc_fcmap_dev_addr_t dev_addr, 24 uint32 phy_reg_addr, uint16 data); 25 26 extern int 27 soc_fcmapphy_miim_read(soc_fcmap_dev_addr_t dev_addr, 28 uint32 phy_reg_addr, uint16 *data); 29 30 /* 31 * Create a unique FCMAP portId for specified fcmap port 32 * connected to unit/port. 33 */ 34 #define SOC_FCMAP_PORTID(u, p) (((u) << 16) | ((p) & 0xff)) 35 36 /* 37 * Return port number within BCM unit from fcmap portId. 38 */ 39 #define SOC_FCMAP_PORTID2UNIT(p) ((p) >> 16) 40 41 /* 42 * Return BCM unit number from fcmap portId. 43 */ 44 #define SOC_FCMAP_PORTID2PORT(p) ((p) & 0xff) 45 46 /* 47 * Create FCMAP MDIO address. 48 */ 49 #define SOC_FCMAPPHY_MDIO_ADDR(unit, mdio, clause45) \ 50 ((((unit) & 0xff) << 24) | \ 51 (((mdio) & 0xff) << 0) | \ 52 (((clause45) & 0x1) << 8)) 53 54 #define SOC_FCMAPPHY_ADDR2UNIT(a) (((a) >> 24) & 0xff) 55 56 #define SOC_FCMAPPHY_ADDR2MDIO(a) ((a) & 0xff) 57 58 #define SOC_FCMAPPHY_ADDR_IS_CLAUSE45(a) (((a) >> 8) & 1) 59 60 extern int 61 soc_fcmapphy_init(int unit, soc_port_t port, phy_ctrl_t *pc, 62 bfcmap_core_t core_type, bfcmap_dev_io_f iofn); 63 extern int 64 soc_fcmapphy_uninit(int unit, soc_port_t port); 65 66 #ifdef BCM_WARM_BOOT_SUPPORT 67 extern int 68 soc_fcmapphy_blmi_enable(int enable); 69 #endif 70 71 72 #endif /* INCLUDE_FCMAP */ 73 #endif /* SOC_FCMAPPHY_H */ 74