Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp468170yba; Wed, 15 May 2019 04:39:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqweuzpRP7XnwSwJ52ReAg5GKmQOqbhbgqydSg/RT3vT9MP4j+P41T85DA8Fto8Tr6tx5HPp X-Received: by 2002:aa7:8554:: with SMTP id y20mr46809336pfn.258.1557920350673; Wed, 15 May 2019 04:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920350; cv=none; d=google.com; s=arc-20160816; b=RESkUSYnMnp5w8a1XUCDeYUDzbSUswLt2rrL45AlkWbLLUTGdGmFJh2tkHaBxPshKd rIo1QjXqnopsM0p+5bk5dUx+AkZaQEbNEs4P7MjHa+rUybz62u6A3ufVyVU6t0IqZyX0 6i2q1YUjdnGHCZ0U53enRR6QYsbl8i1euxegTwMgkYNRo11523wRKbuA7td/rPNTwigt piMoZS6q2IXkUvKeyKXnVZubcWEBO6s/EOku/qMmLRvzyP1oxbqZxiv6QUqDPNhLdJ/d hSYgLfr3kthEnAueqyFq/pPSG+yAMvVebnDUnNgcwIt5xfsnL/JGC7HZmIVzX8hDyUx0 SGsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l7YAQLxqCzggiqWG5JtNp5TpgkYbXa8ybTw+16+IU5M=; b=vA7tv58Z1T7cvgP5lv259vPSZEUtBhQMkLkynyvg4dalMAjZcNNRDoufN9x8Vz6Ruq /TpXQEPky0p2b54GhEEcykBnljD6IbNI6rjeJMOGZ/sKbU5mODvyKEwbJ6y7XvsiG9Oo 5LiatbQJuShmmU7h7btgCC0NZ3n0WUBiHmw9oOsfU6UXU/OCLGQqPYD0TSL92RLPrVg1 HpgCXienKq25p9n9aAohS++vN1MY3VTXkq9NCr9c6JY8glVBsLnK6l41iyKVQIW0B2ld rdO9487YrkcuCCUwprRDH3wj8BPOlwf/7Az21uRmMFt1U02d7K1ZQ+GKML5/MMABNjLw m4+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yGEuemmk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12si1593513pla.313.2019.05.15.04.38.55; Wed, 15 May 2019 04:39:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yGEuemmk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732879AbfEOLfv (ORCPT + 99 others); Wed, 15 May 2019 07:35:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:45060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733146AbfEOLdH (ORCPT ); Wed, 15 May 2019 07:33:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45A212053B; Wed, 15 May 2019 11:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919986; bh=Pbj+UVCC4TYDkmXlwC5abIs+I5M6h3icEkPBubW8FrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yGEuemmkPfXrr50iddCckDnyVjhRYukU5F9GjUB4X3kXrHTIHQbrpkcCEMQ3cPE3E muO5eGJdvUBL3eJDPP1jDcTL7kD2nhOOVn67gJq5cHOjknU/BEyX9Z87MpwIi+PcZk sBZQ5vITvyVOv8N1zIMAcqUmUQ9VPUHkpk3gCxuc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , "David S. Miller" Subject: [PATCH 5.1 30/46] aqc111: fix writing to the phy on BE Date: Wed, 15 May 2019 12:56:54 +0200 Message-Id: <20190515090626.165408904@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090616.670410738@linuxfoundation.org> References: <20190515090616.670410738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oliver Neukum [ Upstream commit 369b46e9fbcfa5136f2cb5f486c90e5f7fa92630 ] When writing to the phy on BE architectures an internal data structure was directly given, leading to it being byte swapped in the wrong way for the CPU in 50% of all cases. A temporary buffer must be used. Signed-off-by: Oliver Neukum Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/aqc111.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) --- a/drivers/net/usb/aqc111.c +++ b/drivers/net/usb/aqc111.c @@ -320,6 +320,7 @@ static int aqc111_get_link_ksettings(str static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed) { struct aqc111_data *aqc111_data = dev->driver_priv; + u32 phy_on_the_wire; aqc111_data->phy_cfg &= ~AQ_ADV_MASK; aqc111_data->phy_cfg |= AQ_PAUSE; @@ -361,7 +362,8 @@ static void aqc111_set_phy_speed(struct } } - aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &aqc111_data->phy_cfg); + phy_on_the_wire = aqc111_data->phy_cfg; + aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &phy_on_the_wire); } static int aqc111_set_link_ksettings(struct net_device *net, @@ -755,6 +757,7 @@ static void aqc111_unbind(struct usbnet { struct aqc111_data *aqc111_data = dev->driver_priv; u16 reg16; + u32 phy_on_the_wire; /* Force bz */ reg16 = SFR_PHYPWR_RSTCTL_BZ; @@ -768,8 +771,9 @@ static void aqc111_unbind(struct usbnet aqc111_data->phy_cfg &= ~AQ_ADV_MASK; aqc111_data->phy_cfg |= AQ_LOW_POWER; aqc111_data->phy_cfg &= ~AQ_PHY_POWER_EN; + phy_on_the_wire = aqc111_data->phy_cfg; aqc111_write32_cmd_nopm(dev, AQ_PHY_OPS, 0, 0, - &aqc111_data->phy_cfg); + &phy_on_the_wire); kfree(aqc111_data); } @@ -992,6 +996,7 @@ static int aqc111_reset(struct usbnet *d { struct aqc111_data *aqc111_data = dev->driver_priv; u8 reg8 = 0; + u32 phy_on_the_wire; dev->rx_urb_size = URB_SIZE; @@ -1004,8 +1009,9 @@ static int aqc111_reset(struct usbnet *d /* Power up ethernet PHY */ aqc111_data->phy_cfg = AQ_PHY_POWER_EN; + phy_on_the_wire = aqc111_data->phy_cfg; aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, - &aqc111_data->phy_cfg); + &phy_on_the_wire); /* Set the MAC address */ aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_NODE_ID, ETH_ALEN, @@ -1036,6 +1042,7 @@ static int aqc111_stop(struct usbnet *de { struct aqc111_data *aqc111_data = dev->driver_priv; u16 reg16 = 0; + u32 phy_on_the_wire; aqc111_read16_cmd(dev, AQ_ACCESS_MAC, SFR_MEDIUM_STATUS_MODE, 2, ®16); @@ -1047,8 +1054,9 @@ static int aqc111_stop(struct usbnet *de /* Put PHY to low power*/ aqc111_data->phy_cfg |= AQ_LOW_POWER; + phy_on_the_wire = aqc111_data->phy_cfg; aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, - &aqc111_data->phy_cfg); + &phy_on_the_wire); netif_carrier_off(dev->net); @@ -1324,6 +1332,7 @@ static int aqc111_suspend(struct usb_int u16 temp_rx_ctrl = 0x00; u16 reg16; u8 reg8; + u32 phy_on_the_wire; usbnet_suspend(intf, message); @@ -1395,12 +1404,14 @@ static int aqc111_suspend(struct usb_int aqc111_write_cmd(dev, AQ_WOL_CFG, 0, 0, WOL_CFG_SIZE, &wol_cfg); + phy_on_the_wire = aqc111_data->phy_cfg; aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, - &aqc111_data->phy_cfg); + &phy_on_the_wire); } else { aqc111_data->phy_cfg |= AQ_LOW_POWER; + phy_on_the_wire = aqc111_data->phy_cfg; aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, - &aqc111_data->phy_cfg); + &phy_on_the_wire); /* Disable RX path */ aqc111_read16_cmd_nopm(dev, AQ_ACCESS_MAC,