Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1179389ybi; Fri, 2 Aug 2019 10:37:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJSmi2up/9I88xxH+aq14+YOKbczRDTE0k5EDBEh6Vs9TcpdNeNfW7T7B+u+yibTyB4CGY X-Received: by 2002:a17:90a:2305:: with SMTP id f5mr5668821pje.128.1564767442484; Fri, 02 Aug 2019 10:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564767442; cv=none; d=google.com; s=arc-20160816; b=CsOP4GLLPYw/HRDmzDBlRTqqKZVxBByicsREU1g+n5wp064QhElGwvrXVNI7nIPKTO 9X8B6LTiURy595ttIyA+qSt1PVpA6Nw6P/Bz13xSHL/89YZPhdnNDzrbJIA3vnvy39L9 KgpJrBPKd+87DANzlsYZs/MUT00Ilyl9Pm+igBO5Npu42HP46ky2dyNx/33DwWSntgGz 8m7EP38c9pr3JkAvttyHSBfWvGWjCC7YN1Fy0dX1pPdgKo5NBqh7VS/+EHPERuQYHxit yVuzq2Z7BG3hrJrCbFK+tY+tv7lFScP73AJH9EAL/iRuj7W7XnaWeJFNBsoyGP8c7nrv mP3w== 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=EJEa8BFzXjlWQNAONF4mvNbmlvtZpe2vpeSUVRiBfAM=; b=VL/0F4UsINYb5HexoFaWNxS1G8q1pB1/fpH+Ssg0ixnmV55KZz/3X2WOyVRwhBy7wO 25E0BGN+AxTDMDHg7zNLAA3QxpndfVq1J0m3scktse2KX8iudq14lgVGofZt0euK2+Vi C/wg4Fw22PvksntbYNdCupvy1CIc187aBbSn1zsj/3pstvzxeQZxi0D1pgQez5f+X5RO N9+52KTBy0dnn0mKxrv34TO3x6u99G5cI11gBdEzFR9NgbBvJ4XOkiTHb33ga900cM/P TpiTf/szwYDqzCSdzLFj8xb4tj8jqcDB7MY+5nsIk2Z087gssSudR37OjGFaAv0A/+qu c4CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="t4Rl/fpH"; 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 145si38066436pfb.262.2019.08.02.10.37.07; Fri, 02 Aug 2019 10:37:22 -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="t4Rl/fpH"; 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 S2405768AbfHBJr6 (ORCPT + 99 others); Fri, 2 Aug 2019 05:47:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:53048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404909AbfHBJr5 (ORCPT ); Fri, 2 Aug 2019 05:47:57 -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 7E2142086A; Fri, 2 Aug 2019 09:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739277; bh=iZDMvbc6z2rlK3vOdYcs9qXfz+vJdv8lHvMlkM9TD5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4Rl/fpH7KPAitA1nr974G9/BnT/wflWaVbwqW8JVGNvbW9jc20iiIrfTrVWlNWNe Y3dvpkl8vZ5zqVqNPYFpwU2KyNaybtzPJ76yyCB9qDCYE3wJ0pEiRz4JMmIGofymsp T9ZueXYdYeVsLyU3ev46JhAOP7u2bPEvofKQM2/M= 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.9 163/223] tty: serial: cpm_uart - fix init when SMC is relocated Date: Fri, 2 Aug 2019 11:36:28 +0200 Message-Id: <20190802092248.702924039@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@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 0040c29f651a..b9e137c03fe3 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