Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3815481ybi; Mon, 29 Jul 2019 13:10:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQDEbOh69jY+rzlc2WZgb6nNyzAAzfdl+UrvoAgAi3NOqZnHnlo0yJnloJbS2QEr3eza4M X-Received: by 2002:a17:902:aa03:: with SMTP id be3mr111425334plb.240.1564431011557; Mon, 29 Jul 2019 13:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431011; cv=none; d=google.com; s=arc-20160816; b=cKnmzKnSdms/RPp1Q5b/zawVLYJf7aKQQO1wjtYr25hc32084c/tc29EacpcQNI8+Z iWUURPqtMRS1U9SYgcrpsOJK3J60K29riLbkecgDLuSRAbBgabqqV/ESay4XBS2aNY9J Lr0JZpZjHaZL5+nHZz8PpgAGcfvgfSsS0Icvv5wBAwOFqe75tgvCQ0aza0p4CEMau+ko aTARLrV8cilwkjt8W1NqQTs+2kL9Z/2o0PLL5DwNpAv0i0lThXGmbKFILA93Y3O0ToXB jRInOXsrdSBg9sxFC5U/j4arlToEylaXKshJCxBeNKKG5M6OEcLTmFh0dMwZYzP+1jUv +QDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xbJHwOUn9u1SEofvoc0Um20bsQECxdf3IXD8RSRO2Bk=; b=MdynyIGPtNmJF6tM0NDHolX9HYIBaXCNCMFYI1SUpckyBtOasWRdpaaku/l/8Wo7Rn ot9r8+gff3CJoP1A9HMtx3hUeJ0jNVcoOl1sH21VYw404V1tRwpblt3U8vFR/+fapkrv ASlB8aDq90KOABbtQovhurpGaK3BbZahM4+MPfGjVdJDLIQExXFgNSiopfCV8gMZGBWC gn8N56UgtPFKfzFNhsr7wodxhh2mY6Y6kVO3egPsholSzbPsJNRti3l00p8uw+s5aavk u9VbIQGz/QSGDRN2ycxziCFN4g5Ux7lGY+1xw22hgTSxHVL8fDsZuVlXOyX0mL/chaVC 9h0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="C8Z/1UTC"; 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 y8si27321732plp.96.2019.07.29.13.09.56; Mon, 29 Jul 2019 13:10:11 -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="C8Z/1UTC"; 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 S2388787AbfG2Thv (ORCPT + 99 others); Mon, 29 Jul 2019 15:37:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:52702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388750AbfG2Tht (ORCPT ); Mon, 29 Jul 2019 15:37:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D2B392171F; Mon, 29 Jul 2019 19:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429068; bh=tuvR4FtMWj/BuN1LbZaX9rJkZodiYMjRD5VoourNhZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C8Z/1UTCiidRq/61EW7+N0G4Luwqft1eRk41r4Kgt9dTtDZfTDrNFc2kllEPV1OFm iHNgxsIZQ5HhzYhdj1b+WLDaaJBKuvOxm7qicNvpkG4CZ5b9fTKTh3mSningfSFrj8 l5TqVjbGo2+DnPrfrm4K8ACBWJSJExpS6k13N/pA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Sasha Levin Subject: [PATCH 4.14 226/293] tty: serial: cpm_uart - fix init when SMC is relocated Date: Mon, 29 Jul 2019 21:21:57 +0200 Message-Id: <20190729190841.807021309@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 06aaa3d066db87e8478522d910285141d44b1e58 ] SMC relocation can also be activated earlier by the bootloader, so the driver's behaviour cannot rely on selected kernel config. When the SMC is relocated, CPM_CR_INIT_TRX cannot be used. But the only thing CPM_CR_INIT_TRX does is to clear the rstate and tstate registers, so this can be done manually, even when SMC is not relocated. Signed-off-by: Christophe Leroy Fixes: 9ab921201444 ("cpm_uart: fix non-console port startup bug") Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 8b2b694334ec..8f5a5a16cb3b 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -421,7 +421,16 @@ static int cpm_uart_startup(struct uart_port *port) clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_RX); } cpm_uart_initbd(pinfo); - cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX); + if (IS_SMC(pinfo)) { + out_be32(&pinfo->smcup->smc_rstate, 0); + out_be32(&pinfo->smcup->smc_tstate, 0); + out_be16(&pinfo->smcup->smc_rbptr, + in_be16(&pinfo->smcup->smc_rbase)); + out_be16(&pinfo->smcup->smc_tbptr, + in_be16(&pinfo->smcup->smc_tbase)); + } else { + cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX); + } } /* Install interrupt handler. */ retval = request_irq(port->irq, cpm_uart_int, 0, "cpm_uart", port); @@ -875,16 +884,14 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo) (u8 __iomem *)pinfo->tx_bd_base - DPRAM_BASE); /* - * In case SMC1 is being relocated... + * In case SMC is being relocated... */ -#if defined (CONFIG_I2C_SPI_SMC1_UCODE_PATCH) out_be16(&up->smc_rbptr, in_be16(&pinfo->smcup->smc_rbase)); out_be16(&up->smc_tbptr, in_be16(&pinfo->smcup->smc_tbase)); out_be32(&up->smc_rstate, 0); out_be32(&up->smc_tstate, 0); out_be16(&up->smc_brkcr, 1); /* number of break chars */ out_be16(&up->smc_brkec, 0); -#endif /* Set up the uart parameters in the * parameter ram. @@ -898,8 +905,6 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo) out_be16(&up->smc_brkec, 0); out_be16(&up->smc_brkcr, 1); - cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX); - /* Set UART mode, 8 bit, no parity, one stop. * Enable receive and transmit. */ -- 2.20.1