From patchwork Fri Oct 3 16:49:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 5024011 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 66AB4C11AB for ; Fri, 3 Oct 2014 16:50:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A9E72014A for ; Fri, 3 Oct 2014 16:50:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DC98201C8 for ; Fri, 3 Oct 2014 16:50:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753536AbaJCQt1 (ORCPT ); Fri, 3 Oct 2014 12:49:27 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:38886 "EHLO mailhub1.si.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753134AbaJCQt0 (ORCPT ); Fri, 3 Oct 2014 12:49:26 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 5F7FC1C86FF; Fri, 3 Oct 2014 18:49:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from mailhub1.si.c-s.fr ([192.168.12.234]) by localhost (mailhub1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9qqjx0vKeQBW; Fri, 3 Oct 2014 18:49:25 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4257A1C86FC; Fri, 3 Oct 2014 18:49:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5D16BC7397; Fri, 3 Oct 2014 18:49:21 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id lHGtJWb8pZ1I; Fri, 3 Oct 2014 18:49:20 +0200 (CEST) Received: from PO10863.localdomain (unknown [172.25.231.75]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 79187C7392; Fri, 3 Oct 2014 18:49:17 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 0) id DBD631AAFA2; Fri, 3 Oct 2014 18:49:16 +0200 (CEST) From: Christophe Leroy To: Mark Brown CC: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-spi@vger.kernel.org Subject: [PATCH v2 1/2] spi: fsl-spi: Fix parameter ram offset setup for CPM1 Message-Id: <20141003164916.DBD631AAFA2@localhost.localdomain> Date: Fri, 3 Oct 2014 18:49:16 +0200 (CEST) Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On CPM1, the SPI parameter RAM has a default location. In fsl_spi_cpm_get_pram() there was a confusion between the SPI_BASE register and the base of the SPI parameter RAM. Fortunatly, it was working properly with MPC866 and MPC885 because they do set SPI_BASE, but on MPC860 and other old MPC8xx that doesn't set SPI_BASE, pram_ofs was not properly set. This patch fixes this confusion. Signed-off-by: Christophe Leroy --- Changes from v1 to v2: none drivers/spi/spi-fsl-cpm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c index 54b0637..0f3a912 100644 --- a/drivers/spi/spi-fsl-cpm.c +++ b/drivers/spi/spi-fsl-cpm.c @@ -262,15 +262,14 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64); out_be16(spi_base, pram_ofs); } else { - struct spi_pram __iomem *pram = spi_base; - u16 rpbase = in_be16(&pram->rpbase); + u16 rpbase = in_be16(spi_base); - /* Microcode relocation patch applied? */ + /* Microcode relocation patch applied | rpbase set by default */ if (rpbase) { pram_ofs = rpbase; } else { - pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64); - out_be16(spi_base, pram_ofs); + pram_ofs = offsetof(cpm8xx_t, cp_dparam[PROFF_SPI]) - + offsetof(cpm8xx_t, cp_dpmem[0]); } }