Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1922139imm; Thu, 24 May 2018 03:00:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp+TGOBdxUCr5AHRfDZnSvK3/hZKwE0VEqKyxJvwvulhR/u56dk6cC2DhHIgTHKoX+Lq+ty X-Received: by 2002:a63:6e05:: with SMTP id j5-v6mr5329263pgc.150.1527156003860; Thu, 24 May 2018 03:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156003; cv=none; d=google.com; s=arc-20160816; b=qVWtl/NDAaGYyP6F9MjC44owYUCK8dwPrrBisVwqr/rLcBXk9HlUficA2ELnZs47yn QBjpSQda/23qzvUtOFfwDqAhLedlMgND68zrc1nV2XIrBWwC72zMAztp9DmVhuBmzEf3 MuB9JsxxURyi2+iBT6K++nJi8S7tHExHoRf2WhyhrCAAcBbXCL7CCjGmuUq3CSvmh9f6 oT6LF+n0hB0XbtBzdVDI3j6RUEdaKCmHXgPIKHzkPSlGspeZosuShcNCuWJ0SdV7QjSC 1fH66ivla9zBh30Y1sOo7C1RNI9Zih1GMyRRiD26lIdViAXg65Dx5qJmBtgsdtVZA7W3 S7YA== 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=uDGJYeBGABL1jtwTLKw3T9Vjexa4P5909HZLJweciZQ=; b=j8P1+7pMLQj38Oox/KaFdq8vAs+qF9LHl3GbbVIAURPIU7CUEjSZUBKVIZ5v0nvzmQ KsGUDfZzCwrEDUSQ5AhA8LgTPHcCeiIgly4kUVG0I2o0j7kDOC8MGFuNbszpHkaRBqzM SgtGNoxHcerAqteu/HSRAePi9w5vqliE91X5woN+aWiCxt9V7P2Wp1vfaWv4C3qu0cRc GrWJZNlE7PxpiSJ1sEmX825vKkjtnaRsn62tQyC++VNYXjB2OJyWDjoGj7+W4R54sSgG mIvyNwknQaprV1moRpMR/U/QTWtilcAaz9XFC5h5yrVOhvcDEoRP2RtXZI8E7XSj/30X wMag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UJIf3h8y; 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 z190-v6si16286886pgb.108.2018.05.24.02.59.49; Thu, 24 May 2018 03:00:03 -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=UJIf3h8y; 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 S1030563AbeEXJ6G (ORCPT + 99 others); Thu, 24 May 2018 05:58:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:37784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030466AbeEXJ6C (ORCPT ); Thu, 24 May 2018 05:58:02 -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 B1C3B20870; Thu, 24 May 2018 09:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155882; bh=NCmNzswuQzZ2KfKzjH4PgAnkBhbnGI5DGt+42efqqbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJIf3h8yBafcCjWrsaERdrSnymEm/4kQlJeJJ9rdXMxtVC/bVXXIoE10zZL4zagp8 3Mb8A34da3p9EaJAIdXTFLMMYPMMbi80mU5E47oYaC58Y/saHLSbf3zGhCXJGfXL7e RKvz4uV2ixTbRNn4YclLv4qHseKCjzow1QICJkDU= 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.14 117/165] scsi: mvsas: fix wrong endianness of sgpio api Date: Thu, 24 May 2018 11:38:43 +0200 Message-Id: <20180524093626.750813956@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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.14-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; }