Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1941411imm; Thu, 24 May 2018 03:18:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqGzlyc5phqlELyOCGZ/6qOo9h7Oq7XXAp4EUETGRVB19V1S44G8tPYiFOvXTLn6trcQz8K X-Received: by 2002:a17:902:680e:: with SMTP id h14-v6mr6586895plk.90.1527157121312; Thu, 24 May 2018 03:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527157121; cv=none; d=google.com; s=arc-20160816; b=hPGnOB7AP191u2N74u/Ov1kR7ZUcHyvdyhqyVPaXW+UIrn0zV/oU1tw4go0SSBv3fI 72moTpv5IAN6hZIpi0bPpTAsPoeAZ6rcYTjwIssoDaVFJ4eOHkF3FeQ7zD/n0r6/flHT zsFyTX51Yie4OGnu7Z5r+KEl8ByKqDFxlcexBCq/XzuawbvLlP6QpmuqhZw7/a3fRTfd bsb6RPMan4EvRI23nJJPcIJxy8GgA+xrT8YJr8hQViVykZ671ixi/i6AxuPDD4p/+c0F UeeBCRL+odGPdTktRz+RwX2p1XY5x8d5YOJB5IdUbZwG20VMdH6DMCLX/A9CgzoZqANx N7Dg== 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=q3pvW9VhOGlo2WC5X5l9N9pm/glb5rBm0K1mNrkxL8c=; b=zwdFJfD9yNPM90T9HjlIzKAD6/lM9WWoeaY/cS06YZQtAH2oLfx32z+IpSvOckrQun zk+c9KtwfLiFaQV4kK/L6SzxxGGmf2Ov4OPlx2eu655cG4EwHTn2nptXbh3WvKt+DvYM NL3cF337enF2GnWxcjXOBhPA4THMrCo5uHKRrLL/zvglaRk95GCY8Bpoy4WOwfY56pE4 t0EAAVo/Ghgej9eo75nELpnSZsNtEOAA2UO6DTq/PKAjLfFLNuvOfNwP6Ucycg8blf1R SpUbTDjfPUDcUUf50I+bqAman7jd+VXD2WUzKzxJoGoBPDZzlDi31xe/9GF19sIukfOl 3IxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=du8KpxGI; 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 c2-v6si4432184pgt.310.2018.05.24.03.18.26; Thu, 24 May 2018 03:18:41 -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=du8KpxGI; 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 S1031338AbeEXKDw (ORCPT + 99 others); Thu, 24 May 2018 06:03:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:53116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030922AbeEXKDt (ORCPT ); Thu, 24 May 2018 06:03:49 -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 F411A20890; Thu, 24 May 2018 10:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156228; bh=X3EIQoQwEaUu+MMNs5lFv+UqhSnXj9EqACK2krKOZ4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=du8KpxGIp4O9J5ABBWls5Un5yaiXpILN8lpcqQ0og/lxFUnkATy8f9CMiBiBxNfIK uFUclt84PYS5xtpWiX3bfK6+uG9AICXNWsb63AiLx/QhHF/RaKVHsY4O2Q60xa6pGl 9MVRzw2M37kUbLWJrF20JYEMn7PhGZ1ebr/w0ub4= 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.16 111/161] scsi: mvsas: fix wrong endianness of sgpio api Date: Thu, 24 May 2018 11:38:56 +0200 Message-Id: <20180524093031.669148631@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@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.16-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; }