1/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. 2 * 3 * This program is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License version 2 and 5 * only version 2 as published by the Free Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 */ 12 13#ifndef _EMAC_SGMII_H_ 14#define _EMAC_SGMII_H_ 15 16struct emac_adapter; 17struct platform_device; 18 19/** emac_sgmii - internal emac phy 20 * @init initialization function 21 * @open called when the driver is opened 22 * @close called when the driver is closed 23 * @link_change called when the link state changes 24 */ 25struct sgmii_ops { 26 int (*init)(struct emac_adapter *adpt); 27 int (*open)(struct emac_adapter *adpt); 28 void (*close)(struct emac_adapter *adpt); 29 int (*link_change)(struct emac_adapter *adpt, bool link_state); 30 void (*reset)(struct emac_adapter *adpt); 31}; 32 33/** emac_sgmii - internal emac phy 34 * @base base address 35 * @digital per-lane digital block 36 * @irq the interrupt number 37 * @decode_error_count reference count of consecutive decode errors 38 * @sgmii_ops sgmii ops 39 */ 40struct emac_sgmii { 41 void __iomem *base; 42 void __iomem *digital; 43 unsigned int irq; 44 atomic_t decode_error_count; 45 struct sgmii_ops *sgmii_ops; 46}; 47 48int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt); 49 50int emac_sgmii_init_fsm9900(struct emac_adapter *adpt); 51int emac_sgmii_init_qdf2432(struct emac_adapter *adpt); 52int emac_sgmii_init_qdf2400(struct emac_adapter *adpt); 53 54int emac_sgmii_init(struct emac_adapter *adpt); 55int emac_sgmii_open(struct emac_adapter *adpt); 56void emac_sgmii_close(struct emac_adapter *adpt); 57int emac_sgmii_link_change(struct emac_adapter *adpt, bool link_state); 58void emac_sgmii_reset(struct emac_adapter *adpt); 59#endif 60