From patchwork Tue Oct 28 08:28:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 39651 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0FE3F24046 for ; Tue, 28 Oct 2014 08:32:03 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id d17sf369030eek.7 for ; Tue, 28 Oct 2014 01:32:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=USn6oneNekQvFdJkKvH6dDcl3PXwKR7Gh+SaBRIs1J4=; b=hA+5zedGj+hjNK9ElL2eyFiq1PnwvpebH7eZhg5dK7iohnX+oao8bEz3Bsp/RgttZ+ E7LgCpwVN0oG7htP9Y/ugS2HM6I6Xga61VTc933Ucn2P8FfJxME9nm9aXLh7n51mEFju DvTCYCxvZzMuE5j145My6honN6/Uxq5iBmIYFTRtiAxBirkJMTmafZ6dNsi1hgdvNAjt 8JynGSRgk+pJaQvJxgqSL1v4Z2CvJ+NV0cr9so8a8FGoKB1Zggjn33VhzQymYjSzHs2n REN9kBv6BzQfq4iPwjSooD20/0fvMvlA6K8Kk2miMWYR3CAOggjDY5NNWdvQKtZ1U+6U 86OQ== X-Gm-Message-State: ALoCoQm45viKiuPbwDxe48vJuiQSqqFRhY2DO0Dai0BEmeKf7MeaBExxcs262VMnrKqoHTuH7/Fb X-Received: by 10.112.89.195 with SMTP id bq3mr239248lbb.9.1414485123173; Tue, 28 Oct 2014 01:32:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.134 with SMTP id s6ls26409las.27.gmail; Tue, 28 Oct 2014 01:32:02 -0700 (PDT) X-Received: by 10.152.20.132 with SMTP id n4mr2135029lae.50.1414485122492; Tue, 28 Oct 2014 01:32:02 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id oc10si1226558lbb.99.2014.10.28.01.32.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 01:32:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id b6so143707lbj.6 for ; Tue, 28 Oct 2014 01:32:02 -0700 (PDT) X-Received: by 10.152.29.8 with SMTP id f8mr2111840lah.56.1414485122368; Tue, 28 Oct 2014 01:32:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp437627lbz; Tue, 28 Oct 2014 01:32:01 -0700 (PDT) X-Received: by 10.68.206.98 with SMTP id ln2mr1710730pbc.83.1414485120910; Tue, 28 Oct 2014 01:32:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rh5si637660pbc.189.2014.10.28.01.32.00 for ; Tue, 28 Oct 2014 01:32:00 -0700 (PDT) Received-SPF: none (google.com: linux-serial-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753526AbaJ1I2r (ORCPT ); Tue, 28 Oct 2014 04:28:47 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:42801 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759397AbaJ1I2h (ORCPT ); Tue, 28 Oct 2014 04:28:37 -0400 Received: from vsmta12.fe.internet.bosch.com (unknown [10.4.98.52]) by imta24.fe.bosch.de (Postfix) with ESMTP id EF7FBD80223 for ; Tue, 28 Oct 2014 09:28:35 +0100 (CET) Received: from localhost (vsgw21.fe.internet.bosch.com [10.4.98.19]) by vsmta12.fe.internet.bosch.com (Postfix) with SMTP id E4ED11B80CFB for ; Tue, 28 Oct 2014 09:28:35 +0100 (CET) Received: from hi-z5661.hi.de.bosch.com (10.34.211.28) by SI-HUB1001.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 14.3.195.1; Tue, 28 Oct 2014 09:28:14 +0100 Received: from hi-z5661.hi.de.bosch.com (localhost [127.0.0.1]) by hi-z5661.hi.de.bosch.com (Postfix) with ESMTP id 029BF41375; Tue, 28 Oct 2014 09:28:14 +0100 (CET) From: Dirk Behme To: CC: Daniel Thompson , Dirk Behme , Greg Kroah-Hartman , Jiri Slaby , Huang Shijie Subject: [PATCH 2/2] serial: imx: add imx_poll_init() Date: Tue, 28 Oct 2014 09:28:08 +0100 Message-ID: <1414484888-6229-2-git-send-email-dirk.behme@de.bosch.com> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1414484888-6229-1-git-send-email-dirk.behme@de.bosch.com> References: <1414484888-6229-1-git-send-email-dirk.behme@de.bosch.com> MIME-Version: 1.0 X-TM-AS-MML: disable Sender: linux-serial-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-serial@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dirk.behme@de.bosch.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Daniel Thompson For the console poll usage, .poll_init() will perform deeper hardware initialization to ensure the serial port is always active. Signed-off-by: Daniel Thompson Signed-off-by: Dirk Behme Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Huang Shijie Cc: linux-serial@vger.kernel.org --- drivers/tty/serial/imx.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 0b6f14b..6e772c7 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1507,6 +1507,41 @@ imx_verify_port(struct uart_port *port, struct serial_struct *ser) } #if defined(CONFIG_CONSOLE_POLL) + +static int imx_poll_init(struct uart_port *port) +{ + struct imx_port *sport = (struct imx_port *)port; + unsigned long flags; + unsigned long temp; + int retval; + + retval = clk_prepare_enable(sport->clk_ipg); + if (retval) + return retval; + retval = clk_prepare_enable(sport->clk_per); + if (retval) + clk_disable_unprepare(sport->clk_ipg); + + imx_setup_ufcr(sport, 0); + + spin_lock_irqsave(&sport->port.lock, flags); + + temp = readl(sport->port.membase + UCR1); + if (is_imx1_uart(sport)) + temp |= IMX1_UCR1_UARTCLKEN; + temp |= UCR1_UARTEN | UCR1_RRDYEN; + temp &= ~(UCR1_TXMPTYEN | UCR1_RTSDEN); + writel(temp, sport->port.membase + UCR1); + + temp = readl(sport->port.membase + UCR2); + temp |= UCR2_RXEN; + writel(temp, sport->port.membase + UCR2); + + spin_unlock_irqrestore(&sport->port.lock, flags); + + return 0; +} + static int imx_poll_get_char(struct uart_port *port) { if (!(readl_relaxed(port->membase + USR2) & USR2_RDR)) @@ -1551,6 +1586,7 @@ static struct uart_ops imx_pops = { .config_port = imx_config_port, .verify_port = imx_verify_port, #if defined(CONFIG_CONSOLE_POLL) + .poll_init = imx_poll_init, .poll_get_char = imx_poll_get_char, .poll_put_char = imx_poll_put_char, #endif