18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * drivers/net/ethernet/ibm/emac/zmii.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. 88c2ecf20Sopenharmony_ci * <benh@kernel.crashing.org> 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Based on the arch/ppc version of the driver: 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Copyright (c) 2004, 2005 Zultys Technologies. 138c2ecf20Sopenharmony_ci * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * Based on original work by 168c2ecf20Sopenharmony_ci * Armin Kuster <akuster@mvista.com> 178c2ecf20Sopenharmony_ci * Copyright 2001 MontaVista Softare Inc. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci#ifndef __IBM_NEWEMAC_ZMII_H 208c2ecf20Sopenharmony_ci#define __IBM_NEWEMAC_ZMII_H 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* ZMII bridge registers */ 238c2ecf20Sopenharmony_cistruct zmii_regs { 248c2ecf20Sopenharmony_ci u32 fer; /* Function enable reg */ 258c2ecf20Sopenharmony_ci u32 ssr; /* Speed select reg */ 268c2ecf20Sopenharmony_ci u32 smiirs; /* SMII status reg */ 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* ZMII device */ 308c2ecf20Sopenharmony_cistruct zmii_instance { 318c2ecf20Sopenharmony_ci struct zmii_regs __iomem *base; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci /* Only one EMAC whacks us at a time */ 348c2ecf20Sopenharmony_ci struct mutex lock; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci /* subset of PHY_MODE_XXXX */ 378c2ecf20Sopenharmony_ci int mode; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci /* number of EMACs using this ZMII bridge */ 408c2ecf20Sopenharmony_ci int users; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci /* FER value left by firmware */ 438c2ecf20Sopenharmony_ci u32 fer_save; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci /* OF device instance */ 468c2ecf20Sopenharmony_ci struct platform_device *ofdev; 478c2ecf20Sopenharmony_ci}; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#ifdef CONFIG_IBM_EMAC_ZMII 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ciint zmii_init(void); 528c2ecf20Sopenharmony_civoid zmii_exit(void); 538c2ecf20Sopenharmony_ciint zmii_attach(struct platform_device *ofdev, int input, 548c2ecf20Sopenharmony_ci phy_interface_t *mode); 558c2ecf20Sopenharmony_civoid zmii_detach(struct platform_device *ofdev, int input); 568c2ecf20Sopenharmony_civoid zmii_get_mdio(struct platform_device *ofdev, int input); 578c2ecf20Sopenharmony_civoid zmii_put_mdio(struct platform_device *ofdev, int input); 588c2ecf20Sopenharmony_civoid zmii_set_speed(struct platform_device *ofdev, int input, int speed); 598c2ecf20Sopenharmony_ciint zmii_get_regs_len(struct platform_device *ocpdev); 608c2ecf20Sopenharmony_civoid *zmii_dump_regs(struct platform_device *ofdev, void *buf); 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#else 638c2ecf20Sopenharmony_ci# define zmii_init() 0 648c2ecf20Sopenharmony_ci# define zmii_exit() do { } while(0) 658c2ecf20Sopenharmony_ci# define zmii_attach(x,y,z) (-ENXIO) 668c2ecf20Sopenharmony_ci# define zmii_detach(x,y) do { } while(0) 678c2ecf20Sopenharmony_ci# define zmii_get_mdio(x,y) do { } while(0) 688c2ecf20Sopenharmony_ci# define zmii_put_mdio(x,y) do { } while(0) 698c2ecf20Sopenharmony_ci# define zmii_set_speed(x,y,z) do { } while(0) 708c2ecf20Sopenharmony_ci# define zmii_get_regs_len(x) 0 718c2ecf20Sopenharmony_ci# define zmii_dump_regs(x,buf) (buf) 728c2ecf20Sopenharmony_ci#endif /* !CONFIG_IBM_EMAC_ZMII */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#endif /* __IBM_NEWEMAC_ZMII_H */ 75