From patchwork Tue Dec 10 00:42:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Kryger X-Patchwork-Id: 22197 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1811823FBA for ; Tue, 10 Dec 2013 00:42:26 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id va2sf16397591obc.8 for ; Mon, 09 Dec 2013 16:42:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=n8poXol3hDAInj6pQLN9CesFDkJA0TMYsqWoLvC3ZfM=; b=QgSelgmRLTLzfzOVOzm0oxxH8NS6GveOM3Tk1CeD0Ozpo0UqvLPy7iWODS+x20+2hE HC+DhKkVKG9VoS81aoC+cB+WT7rjJjZjLTyNUICYDQjJsQRoL+lb25ornmVl8A/Qo7AV mswwZHrl7ckRBbvGZy5bTCGK7orfRRKoyVJgWs/CnCYsB3EMYCfGLaUG+l4O2+/k/Gs1 3KLAr/z8s/JvtaPdAosZeTcz40wfG6dYAWhMyXiBA6SP2nnSZGKKq4rmBjps7w5bpxHa rb8mrJ0MLssqtL76NNLw41fkgb3Hmh8T00ubIZ8WVaQre+raD4Qc/fbAhRX1Tt9mq37B lMbg== X-Gm-Message-State: ALoCoQlJvcl0azEEM8FcyjbIT9bNIzm6fKyLGvwFsTgaIfpl9ITOmk8WuOB0oz2+2bTfgCVHnpCX X-Received: by 10.42.136.136 with SMTP id u8mr6329228ict.16.1386636146002; Mon, 09 Dec 2013 16:42:26 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.48.105 with SMTP id k9ls2140304qen.96.gmail; Mon, 09 Dec 2013 16:42:25 -0800 (PST) X-Received: by 10.220.145.75 with SMTP id c11mr502567vcv.30.1386636145868; Mon, 09 Dec 2013 16:42:25 -0800 (PST) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id p7si4397980vei.24.2013.12.09.16.42.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Dec 2013 16:42:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ie18so4119828vcb.10 for ; Mon, 09 Dec 2013 16:42:25 -0800 (PST) X-Received: by 10.52.37.137 with SMTP id y9mr67776vdj.84.1386636145787; Mon, 09 Dec 2013 16:42:25 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp147968vcz; Mon, 9 Dec 2013 16:42:25 -0800 (PST) X-Received: by 10.182.142.229 with SMTP id rz5mr14715319obb.12.1386636144534; Mon, 09 Dec 2013 16:42:24 -0800 (PST) Received: from mail-oa0-f52.google.com (mail-oa0-f52.google.com [209.85.219.52]) by mx.google.com with ESMTPS id si5si8869597oeb.126.2013.12.09.16.42.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Dec 2013 16:42:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.219.52 is neither permitted nor denied by best guess record for domain of tim.kryger@linaro.org) client-ip=209.85.219.52; Received: by mail-oa0-f52.google.com with SMTP id h16so4808040oag.11 for ; Mon, 09 Dec 2013 16:42:23 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.182.98.162 with SMTP id ej2mr4692181obb.61.1386636143812; Mon, 09 Dec 2013 16:42:23 -0800 (PST) Received: by 10.76.3.106 with HTTP; Mon, 9 Dec 2013 16:42:23 -0800 (PST) In-Reply-To: <3010367.6CxxZ6Dpea@radagast> References: <1380647888-32473-1-git-send-email-tim.kryger@linaro.org> <5548535.pYirbknue4@radagast> <3010367.6CxxZ6Dpea@radagast> Date: Mon, 9 Dec 2013 16:42:23 -0800 Message-ID: Subject: Re: [PATCH v2] serial: 8250_dw: Improve unwritable LCR workaround From: Tim Kryger To: James Hogan Cc: Ezequiel Garcia , Greg Kroah-Hartman , Heikki Krogerus , linux-serial@vger.kernel.org, "linux-kernel@vger.kernel.org" , Patch Tracking , Thomas Petazzoni , Gregory Clement , Lior Amsalem , Jason Cooper , ARM Kernel List X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: tim.kryger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Fri, Dec 6, 2013 at 4:59 PM, James Hogan wrote: > It appears to work with ~0x20 too, and the workaround isn't getting hit (only > tested boot and logging in - nothing fancy). I think having the printks in > this code with the console directed at the serial must have caused > resursion/busy problems somehow. James, I tested tested the code you proposed (cleaned up to avoid magic numbers) on my hardware and it works fine. writeb(value, p->membase + (UART_LCR << p->regshift)); @@ -132,7 +133,8 @@ static void dw8250_serial_out32(struct uart_port *p, int offset, int value) if (offset == UART_LCR) { int tries = 1000; while (tries--) { - if (value == p->serial_in(p, UART_LCR)) + unsigned int lcr = p->serial_in(p, UART_LCR); + if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR)) return; dw8250_force_idle(p); writel(value, p->membase + (UART_LCR << p->regshift)); Would you mind posting this for proper review so we can get the fix in? Thanks, Tim Kryger diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 4658e3e..5f096c7 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -96,7 +96,8 @@ static void dw8250_serial_out(struct uart_port *p, int offset, int value) if (offset == UART_LCR) { int tries = 1000; while (tries--) { - if (value == p->serial_in(p, UART_LCR)) + unsigned int lcr = p->serial_in(p, UART_LCR); + if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR)) return; dw8250_force_idle(p);