X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fphy%2Fmiiphybb.c;h=ba97a54c0676fd159a236254c38b9ec6bbce6340;hb=b3eabd82f21b4d9206622fc5aee16751d2f4be8f;hp=49a1f5fb49fd8269852ad8a6c138652b4549bc75;hpb=2e5167ccad93ca9cfa6a2acfab5e4785418e477e;p=oweals%2Fu-boot.git diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c index 49a1f5fb49..ba97a54c06 100644 --- a/drivers/net/phy/miiphybb.c +++ b/drivers/net/phy/miiphybb.c @@ -1,27 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2009 Industrie Dial Face S.p.A. * Luigi 'Comio' Mantellini * * (C) Copyright 2001 * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA */ /* @@ -246,24 +229,18 @@ static void miiphy_pre(struct bb_miiphy_bus *bus, char read, * Returns: * 0 on success */ -int bb_miiphy_read(const char *devname, unsigned char addr, - unsigned char reg, unsigned short *value) +int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg) { - short rdreg; /* register working value */ + unsigned short rdreg; /* register working value */ int v; int j; /* counter */ struct bb_miiphy_bus *bus; - bus = bb_miiphy_getbus(devname); + bus = bb_miiphy_getbus(miidev->name); if (bus == NULL) { return -1; } - if (value == NULL) { - puts("NULL value pointer\n"); - return -1; - } - miiphy_pre (bus, 1, addr, reg); /* tri-state our MDIO I/O pin so we can read */ @@ -283,8 +260,7 @@ int bb_miiphy_read(const char *devname, unsigned char addr, bus->set_mdc(bus, 1); bus->delay(bus); } - /* There is no PHY, set value to 0xFFFF and return */ - *value = 0xFFFF; + /* There is no PHY, return */ return -1; } @@ -310,13 +286,11 @@ int bb_miiphy_read(const char *devname, unsigned char addr, bus->set_mdc(bus, 1); bus->delay(bus); - *value = rdreg; - #ifdef DEBUG - printf ("miiphy_read(0x%x) @ 0x%x = 0x%04x\n", reg, addr, *value); + printf("miiphy_read(0x%x) @ 0x%x = 0x%04x\n", reg, addr, rdreg); #endif - return 0; + return rdreg; } @@ -327,13 +301,13 @@ int bb_miiphy_read(const char *devname, unsigned char addr, * Returns: * 0 on success */ -int bb_miiphy_write (const char *devname, unsigned char addr, - unsigned char reg, unsigned short value) +int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg, + u16 value) { struct bb_miiphy_bus *bus; int j; /* counter */ - bus = bb_miiphy_getbus(devname); + bus = bb_miiphy_getbus(miidev->name); if (bus == NULL) { /* Bus not found! */ return -1;