From patchwork Tue Jul 19 14:29:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Vallee X-Patchwork-Id: 72328 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp111276qga; Tue, 19 Jul 2016 07:30:00 -0700 (PDT) X-Received: by 10.66.233.38 with SMTP id tt6mr65001827pac.99.1468938600818; Tue, 19 Jul 2016 07:30:00 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si9759747pfi.52.2016.07.19.07.29.59; Tue, 19 Jul 2016 07:30:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@eukrea-fr.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754001AbcGSO3p (ORCPT + 2 others); Tue, 19 Jul 2016 10:29:45 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37072 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753630AbcGSO3p (ORCPT ); Tue, 19 Jul 2016 10:29:45 -0400 Received: by mail-wm0-f43.google.com with SMTP id i5so28788444wmg.0 for ; Tue, 19 Jul 2016 07:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eukrea-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=7fD3bPGcw6k6yBGwihIXueMJUaxvxGh0WQsQlbTplmQ=; b=xSXynxDlcCkasKK+C2WY98QWT3FTba2zTUV606BwYS62d2wXbrB3D9irAvAkrYZNb8 t8NJFeLU+OWuICiGeM9MH2mB5BJQL8BFnsS+G7MuVac4Yvn3JlZgFZY/wSNng3YGwROJ HMCfU3dhS8dL1sZX0bZtL3pnG5smrw4DjPyZ/KYKbJuOvGp9k6hprktIvkgUl6YSY2UE 2kYkzLg/WEoIbJcRfQBkAen6qSnRp5oc4Iohxn+C8GXRK8/vIK9RY958p+K/FybrciUw a/PeSDRd+FkmrAH3tZPSANQhITSbDEOhn8MLAk+CqM+PIXcz5lL5JtRbX5pjEwPMWX6m RPgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7fD3bPGcw6k6yBGwihIXueMJUaxvxGh0WQsQlbTplmQ=; b=OfeqIN8ilaCJ0skPfIiRFFMqVksuF2MQJWLDNdyFjl29XUlSIJZqcgXtBQcjmnv8xl ZUpfZTm/tlAsLRE5ajg24B+h31bZhphtPl0l6xHRdgla/9w2K/RlY5x0hNa20/9GY2Ii N+Uktkm0vT0ra533WPtAcmkOTqdZxguA3ax1BsEjsRxw0mZJylF5iwNDGpmv8eajuIPZ pa5CeEjRDgi+adFl1syYIEPHdT7X2Nzu/A3JwCaeiqEPqr+8rE7Wc+LeG+jo/WRq3TMu am2E2Y+ZUTpoi6EtOsPXdDvs3fp+ebTWYvDzdd7DMPO3wIp/4Qm0LKLlfBX5YH0zNRz0 fHEw== X-Gm-Message-State: ALyK8tJjofrpQWJRFobGbEDTFQAr5UeJwF9+P4l0b8uwQwjaEfN78KYwYSfGEzKhlnbD4h6e X-Received: by 10.28.50.199 with SMTP id y190mr4631050wmy.61.1468938583606; Tue, 19 Jul 2016 07:29:43 -0700 (PDT) Received: from e6540-fv.local.eukrea.fr (35-95-190-109.dsl.ovh.fr. [109.190.95.35]) by smtp.gmail.com with ESMTPSA id a2sm23432137wma.2.2016.07.19.07.29.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 07:29:42 -0700 (PDT) From: Florian Vallee To: Jiri Slaby , Greg Kroah-Hartman , linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Florian Vallee Subject: [PATCH] sc16is7xx: make sure device is in suspend once probed Date: Tue, 19 Jul 2016 16:29:36 +0200 Message-Id: <1468938576-19508-1-git-send-email-fvallee@eukrea.fr> X-Mailer: git-send-email 2.7.4 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Previously sc16is7xx_power was called in order to set the device to a low power mode. However since SC16IS7XX_EFR_ENABLE_BIT was not set beforehand this suspend request had not effect. Also, soft-reset the device prior to port initialization. It may otherwise be in a state (interrupt pending, fifo not empty) which prevents it from sleeping. Signed-off-by: Florian Vallee --- drivers/tty/serial/sc16is7xx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index f36e6df..a9d94f7 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1205,6 +1205,10 @@ static int sc16is7xx_probe(struct device *dev, } #endif + /* reset device, purging any pending irq / data */ + regmap_write(s->regmap, SC16IS7XX_IOCONTROL_REG << SC16IS7XX_REG_SHIFT, + SC16IS7XX_IOCONTROL_SRESET_BIT); + for (i = 0; i < devtype->nr_uart; ++i) { s->p[i].line = i; /* Initialize port data */ @@ -1234,6 +1238,22 @@ static int sc16is7xx_probe(struct device *dev, init_kthread_work(&s->p[i].reg_work, sc16is7xx_reg_proc); /* Register port */ uart_add_one_port(&sc16is7xx_uart, &s->p[i].port); + + /* Enable EFR */ + sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, + SC16IS7XX_LCR_CONF_MODE_B); + + regcache_cache_bypass(s->regmap, true); + + /* Enable write access to enhanced features */ + sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_EFR_REG, + SC16IS7XX_EFR_ENABLE_BIT); + + regcache_cache_bypass(s->regmap, false); + + /* Restore access to general registers */ + sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, 0x00); + /* Go to suspend mode */ sc16is7xx_power(&s->p[i].port, 0); }