shbde_mdio.h (1681B)
1 /* 2 * Copyright 2017 Broadcom 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License, version 2, as 6 * published by the Free Software Foundation (the "GPL"). 7 * 8 * This program is distributed in the hope that it will be useful, but 9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * General Public License version 2 (GPLv2) for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * version 2 (GPLv2) along with this source code. 15 */ 16 /* 17 * $Id: $ 18 * $Copyright: (c) 2015 Broadcom Corp. 19 * All Rights Reserved.$ 20 * 21 */ 22 23 #ifndef __SHBDE_MDIO_H__ 24 #define __SHBDE_MDIO_H__ 25 26 #include <shbde.h> 27 28 typedef struct shbde_mdio_ctrl_s { 29 30 /* Primary HAL*/ 31 shbde_hal_t *shbde; 32 33 /* Context for iProc MDIO register access */ 34 void *regs; 35 36 /* Base address for MDIO registers */ 37 unsigned int base_addr; 38 39 /* iProc MDIO register access */ 40 unsigned int (*io32_read)(shbde_hal_t *shbde, void *iproc_regs, 41 unsigned int addr); 42 void (*io32_write)(shbde_hal_t *shbde, void *iproc_regs, 43 unsigned int addr, unsigned int data); 44 45 } shbde_mdio_ctrl_t; 46 47 48 extern int 49 shbde_iproc_mdio_init(shbde_mdio_ctrl_t *smc); 50 51 extern int 52 shbde_iproc_mdio_read(shbde_mdio_ctrl_t *smc, unsigned int phy_addr, 53 unsigned int reg, unsigned int *val); 54 55 extern int 56 shbde_iproc_mdio_write(shbde_mdio_ctrl_t *smc, unsigned int phy_addr, 57 unsigned int reg, unsigned int val); 58 59 #endif /* __SHBDE_MDIO_H__ */