From patchwork Fri Oct 3 12:56:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 5022341 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AE6D69F32B for ; Fri, 3 Oct 2014 12:56:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D77732014A for ; Fri, 3 Oct 2014 12:56:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F33A12017A for ; Fri, 3 Oct 2014 12:56:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752603AbaJCM4P (ORCPT ); Fri, 3 Oct 2014 08:56:15 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:36617 "EHLO mailhub1.si.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752164AbaJCM4N (ORCPT ); Fri, 3 Oct 2014 08:56:13 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id E9A361C86ED; Fri, 3 Oct 2014 14:56:10 +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 yKUHNIG36IZi; Fri, 3 Oct 2014 14:56:10 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id C39961C86E9; Fri, 3 Oct 2014 14:56:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 96D3AC7396; Fri, 3 Oct 2014 14:56:10 +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 YxL08sEiL5_m; Fri, 3 Oct 2014 14:56:10 +0200 (CEST) Received: from PO10863.localdomain (unknown [172.25.231.75]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D5150C7394; Fri, 3 Oct 2014 14:56:09 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 0) id 5BEA11AB276; Fri, 3 Oct 2014 14:56:09 +0200 (CEST) From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Mark Brown , Marcelo Tosatti , Vitaly Bordug CC: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-spi@vger.kernel.org, Joakim Tjernlund , scottwood@freescale.com Subject: [PATCH 2/2] spi: fsl-spi: Allow dynamic allocation of CPM1 parameter RAM Message-Id: <20141003125609.5BEA11AB276@localhost.localdomain> Date: Fri, 3 Oct 2014 14:56:09 +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=unavailable 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 order to use SPI while using SCC2 with features like QMC or Ethernet, it is necessary to relocate SPI parameter RAM in a free location in the CPM dual port RAM. With this patch, when CONFIG_CPM1_RELOCSPI is set, the parameter RAM for SPI is dynamically allocated with cpm_muram_alloc(). Signed-off-by: Christophe Leroy --- arch/powerpc/platforms/8xx/Kconfig | 11 +++++++++++ drivers/spi/spi-fsl-cpm.c | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig index 7c1690b..3b76a3f 100644 --- a/arch/powerpc/platforms/8xx/Kconfig +++ b/arch/powerpc/platforms/8xx/Kconfig @@ -203,4 +203,15 @@ config UCODE_PATCH default y depends on !NO_UCODE_PATCH +config CPM1_RELOCSPI + bool "Dynamic SPI relocation" + default n + help + On recent MPC8xx (at least MPC866 and MPC885) SPI can be relocated + without micropatch. This activates relocation to a dynamically + allocated area in the CPM Dual port RAM. + When combined with SPI relocation patch (for older MPC8xx) it avoids + the "loss" of additional Dual port RAM space just above the patch, + which might be needed for example when using the CPM QMC. + endmenu diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c index 0f3a912..f33820e 100644 --- a/drivers/spi/spi-fsl-cpm.c +++ b/drivers/spi/spi-fsl-cpm.c @@ -262,6 +262,10 @@ 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 { +#ifdef CONFIG_CPM1_RELOCSPI + pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 32); + out_be16(spi_base, pram_ofs); +#else u16 rpbase = in_be16(spi_base); /* Microcode relocation patch applied | rpbase set by default */ @@ -271,6 +275,7 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) pram_ofs = offsetof(cpm8xx_t, cp_dparam[PROFF_SPI]) - offsetof(cpm8xx_t, cp_dpmem[0]); } +#endif } iounmap(spi_base);