18c2ecf20Sopenharmony_ci/* Copyright 2008-2015 Freescale Semiconductor, Inc. 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 48c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions are met: 58c2ecf20Sopenharmony_ci * * Redistributions of source code must retain the above copyright 68c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 78c2ecf20Sopenharmony_ci * * Redistributions in binary form must reproduce the above copyright 88c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in the 98c2ecf20Sopenharmony_ci * documentation and/or other materials provided with the distribution. 108c2ecf20Sopenharmony_ci * * Neither the name of Freescale Semiconductor nor the 118c2ecf20Sopenharmony_ci * names of its contributors may be used to endorse or promote products 128c2ecf20Sopenharmony_ci * derived from this software without specific prior written permission. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * ALTERNATIVELY, this software may be distributed under the terms of the 168c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") as published by the Free Software 178c2ecf20Sopenharmony_ci * Foundation, either version 2 of that License or (at your option) any 188c2ecf20Sopenharmony_ci * later version. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY 218c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 228c2ecf20Sopenharmony_ci * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 238c2ecf20Sopenharmony_ci * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 248c2ecf20Sopenharmony_ci * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 258c2ecf20Sopenharmony_ci * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 268c2ecf20Sopenharmony_ci * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 278c2ecf20Sopenharmony_ci * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 288c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 298c2ecf20Sopenharmony_ci * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 308c2ecf20Sopenharmony_ci */ 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#ifndef __MAC_H 338c2ecf20Sopenharmony_ci#define __MAC_H 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#include <linux/device.h> 368c2ecf20Sopenharmony_ci#include <linux/if_ether.h> 378c2ecf20Sopenharmony_ci#include <linux/phy.h> 388c2ecf20Sopenharmony_ci#include <linux/list.h> 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#include "fman_port.h" 418c2ecf20Sopenharmony_ci#include "fman.h" 428c2ecf20Sopenharmony_ci#include "fman_mac.h" 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistruct fman_mac; 458c2ecf20Sopenharmony_cistruct mac_priv_s; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct mac_device { 488c2ecf20Sopenharmony_ci struct resource *res; 498c2ecf20Sopenharmony_ci u8 addr[ETH_ALEN]; 508c2ecf20Sopenharmony_ci struct fman_port *port[2]; 518c2ecf20Sopenharmony_ci u32 if_support; 528c2ecf20Sopenharmony_ci struct phy_device *phy_dev; 538c2ecf20Sopenharmony_ci phy_interface_t phy_if; 548c2ecf20Sopenharmony_ci struct device_node *phy_node; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci bool autoneg_pause; 578c2ecf20Sopenharmony_ci bool rx_pause_req; 588c2ecf20Sopenharmony_ci bool tx_pause_req; 598c2ecf20Sopenharmony_ci bool rx_pause_active; 608c2ecf20Sopenharmony_ci bool tx_pause_active; 618c2ecf20Sopenharmony_ci bool promisc; 628c2ecf20Sopenharmony_ci bool allmulti; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci int (*init)(struct mac_device *mac_dev); 658c2ecf20Sopenharmony_ci int (*start)(struct mac_device *mac_dev); 668c2ecf20Sopenharmony_ci int (*stop)(struct mac_device *mac_dev); 678c2ecf20Sopenharmony_ci void (*adjust_link)(struct mac_device *mac_dev); 688c2ecf20Sopenharmony_ci int (*set_promisc)(struct fman_mac *mac_dev, bool enable); 698c2ecf20Sopenharmony_ci int (*change_addr)(struct fman_mac *mac_dev, enet_addr_t *enet_addr); 708c2ecf20Sopenharmony_ci int (*set_allmulti)(struct fman_mac *mac_dev, bool enable); 718c2ecf20Sopenharmony_ci int (*set_tstamp)(struct fman_mac *mac_dev, bool enable); 728c2ecf20Sopenharmony_ci int (*set_multi)(struct net_device *net_dev, 738c2ecf20Sopenharmony_ci struct mac_device *mac_dev); 748c2ecf20Sopenharmony_ci int (*set_rx_pause)(struct fman_mac *mac_dev, bool en); 758c2ecf20Sopenharmony_ci int (*set_tx_pause)(struct fman_mac *mac_dev, u8 priority, 768c2ecf20Sopenharmony_ci u16 pause_time, u16 thresh_time); 778c2ecf20Sopenharmony_ci int (*set_exception)(struct fman_mac *mac_dev, 788c2ecf20Sopenharmony_ci enum fman_mac_exceptions exception, bool enable); 798c2ecf20Sopenharmony_ci int (*add_hash_mac_addr)(struct fman_mac *mac_dev, 808c2ecf20Sopenharmony_ci enet_addr_t *eth_addr); 818c2ecf20Sopenharmony_ci int (*remove_hash_mac_addr)(struct fman_mac *mac_dev, 828c2ecf20Sopenharmony_ci enet_addr_t *eth_addr); 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci struct fman_mac *fman_mac; 858c2ecf20Sopenharmony_ci struct mac_priv_s *priv; 868c2ecf20Sopenharmony_ci}; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistruct dpaa_eth_data { 898c2ecf20Sopenharmony_ci struct mac_device *mac_dev; 908c2ecf20Sopenharmony_ci int mac_hw_id; 918c2ecf20Sopenharmony_ci int fman_hw_id; 928c2ecf20Sopenharmony_ci}; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ciextern const char *mac_driver_description; 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ciint fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx); 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_civoid fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, 998c2ecf20Sopenharmony_ci bool *tx_pause); 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#endif /* __MAC_H */ 102