Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2012839imm; Thu, 24 May 2018 04:30:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZooKSJaussHIfLJqzdUZgjolX9vzklakx5XpR767TVkimFXC0D7GTJxjMfMkNLeUP2pHcZ2 X-Received: by 2002:a65:4204:: with SMTP id c4-v6mr5453530pgq.26.1527161448877; Thu, 24 May 2018 04:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527161448; cv=none; d=google.com; s=arc-20160816; b=HoG/wUsIYWsSiX1OvKSUJU+S52BUzyjhtr0wfeapUfDbRawrXGS2/x2TywGkHMyxYZ yNeqLRv6eUmknyqkMPfoqC/V2FmkjovcRLkkaM4gxc1+jMNpFy2wE4lbCP5ds0b66c+3 vvIrRQI27PNvznWqcSAMHQIyaEhq09xApISzZ/tGQd0RSqch1WJxMHeQRgrMev7DqHEf tS0oQm5oRJwzokk4FA8n6raBU/xGwHccNj9DvWfNlJWnxTbyso7NPX1DiYaKj4iOV9P3 WdCIkH1mLAV6Ywd1txd528CqkSKlbKiZXpWTVJPTf/ntUzzPR0uz1gtLEath0UvflYlM W6rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Yr9qj6KB2qaiCiyZLAeFIb1YhuIwR0Rp7kIa4NLPG98=; b=A2INhc7luPGaduABnXylYV52FzOKGbrXoWIXAy9uMCpIxObENbTquIUv+3uf8LNw9s CFJe2ncyZN7wSAFECfjz9RzZGatHjktfg660Ip+JqnMyV9uiwyV8LnotWaQwCvgKp6qh Uf/2giyUopPmedlueCZFgS7ChM2HsD1TssqbsznKLqfIr9i8tmgqAnACo+4NRJ8RtkhX Hdf4RS2KBoW6dKQUkPyOZ1/dlTLS5hji3qPnRUnzqd5d2UAY/XrIRe6mpR2AyWWS/HRy Pb20hWMhVZD6gkYcsRoQPC+8s2PrfLgSzEQ+GFt8QAjEIpjZtz5euhxRibVnvYtBCQ6F lsNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=os5xw+z1; 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 t5-v6si16617295pgu.341.2018.05.24.04.30.34; Thu, 24 May 2018 04:30:48 -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=os5xw+z1; 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 S968937AbeEXL3x (ORCPT + 99 others); Thu, 24 May 2018 07:29:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:45598 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967656AbeEXJvN (ORCPT ); Thu, 24 May 2018 05:51:13 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 D189C20891; Thu, 24 May 2018 09:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155473; bh=dhpBDv+6MuywsUXNF7946fiht5RLRLVFJvuaUThd4rI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=os5xw+z1R+gSsLeBOQNLKy0z2LuAC6uIy0Lm3UQcPackEeCU+2oP8xoSh97RlZa8x EB9DU3vvp+7GZrEJoGEKFw/YXZSrltiLkg5kA3gXwYwZUSiTBdaYvXAPLJ1WBCHD8h w8+SuHLN2UHhq8v0cU2o72qmIgalmSB1kcj4BiQU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wilfried Weissmann , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.9 63/96] scsi: mvsas: fix wrong endianness of sgpio api Date: Thu, 24 May 2018 11:38:46 +0200 Message-Id: <20180524093609.077292411@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wilfried Weissmann [ Upstream commit e75fba9c0668b3767f608ea07485f48d33c270cf ] This patch fixes the byte order of the SGPIO api and brings it back in sync with ledmon v0.80 and above. [mkp: added missing SoB and fixed whitespace] Signed-off-by: Wilfried Weissmann Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/mvsas/mv_94xx.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) --- a/drivers/scsi/mvsas/mv_94xx.c +++ b/drivers/scsi/mvsas/mv_94xx.c @@ -1080,16 +1080,16 @@ static int mvs_94xx_gpio_write(struct mv void __iomem *regs = mvi->regs_ex - 0x10200; int drive = (i/3) & (4-1); /* drive number on host */ - u32 block = mr32(MVS_SGPIO_DCTRL + + int driveshift = drive * 8; /* bit offset of drive */ + u32 block = ioread32be(regs + MVS_SGPIO_DCTRL + MVS_SGPIO_HOST_OFFSET * mvi->id); - /* * if bit is set then create a mask with the first * bit of the drive set in the mask ... */ - u32 bit = (write_data[i/8] & (1 << (i&(8-1)))) ? - 1<<(24-drive*8) : 0; + u32 bit = get_unaligned_be32(write_data) & (1 << i) ? + 1 << driveshift : 0; /* * ... and then shift it to the right position based @@ -1098,26 +1098,27 @@ static int mvs_94xx_gpio_write(struct mv switch (i%3) { case 0: /* activity */ block &= ~((0x7 << MVS_SGPIO_DCTRL_ACT_SHIFT) - << (24-drive*8)); + << driveshift); /* hardwire activity bit to SOF */ block |= LED_BLINKA_SOF << ( MVS_SGPIO_DCTRL_ACT_SHIFT + - (24-drive*8)); + driveshift); break; case 1: /* id */ block &= ~((0x3 << MVS_SGPIO_DCTRL_LOC_SHIFT) - << (24-drive*8)); + << driveshift); block |= bit << MVS_SGPIO_DCTRL_LOC_SHIFT; break; case 2: /* fail */ block &= ~((0x7 << MVS_SGPIO_DCTRL_ERR_SHIFT) - << (24-drive*8)); + << driveshift); block |= bit << MVS_SGPIO_DCTRL_ERR_SHIFT; break; } - mw32(MVS_SGPIO_DCTRL + MVS_SGPIO_HOST_OFFSET * mvi->id, - block); + iowrite32be(block, + regs + MVS_SGPIO_DCTRL + + MVS_SGPIO_HOST_OFFSET * mvi->id); } @@ -1132,7 +1133,7 @@ static int mvs_94xx_gpio_write(struct mv void __iomem *regs = mvi->regs_ex - 0x10200; mw32(MVS_SGPIO_DCTRL + MVS_SGPIO_HOST_OFFSET * mvi->id, - be32_to_cpu(((u32 *) write_data)[i])); + ((u32 *) write_data)[i]); } return reg_count; }