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: 3313821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B30869F37A for ; Tue, 10 Dec 2013 00:43:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1B01202B8 for ; Tue, 10 Dec 2013 00:42:59 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E62C92022A for ; Tue, 10 Dec 2013 00:42:58 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqBPZ-0000lR-0c; Tue, 10 Dec 2013 00:42:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqBPW-0008Qb-JM; Tue, 10 Dec 2013 00:42:50 +0000 Received: from mail-oa0-f48.google.com ([209.85.219.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqBPS-0008Pw-Gn for linux-arm-kernel@lists.infradead.org; Tue, 10 Dec 2013 00:42:47 +0000 Received: by mail-oa0-f48.google.com with SMTP id l6so4757936oag.21 for ; Mon, 09 Dec 2013 16:42:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=n8poXol3hDAInj6pQLN9CesFDkJA0TMYsqWoLvC3ZfM=; b=llaaYIOIFu2ATN8lyfuwBwbT9yKFvYU6ubHhW8rmrJuz4yAYl3wOOqtDrlonnlLBuV 9O7IHi+3QTqvhoP6YGQqNy7u/YpLl91PQgKkx4XkBIJmEPdfLqUnsEyyMeZd2rU6/HuO frTR1JqqOkEkCfBNpVHrdho7qegjlwxAaQLdDpiXd7uxyrgNPeCU/3ccBYmGM0if5yM8 rVMQ0c47QxasVazxxh2eq2LuuYVAItlTCDrmdCEFy8Kz4QFFBhW8cF+y5D1SMHybT9Nd ySVdyjROEspBq6wjMghN44uOP2fLG99vFMWhawRivOAZ/bH6tWdZPHDMDOHUQ7ZbO50S VZuw== X-Gm-Message-State: ALoCoQkdXN0LuXsOprsxmE2HzV8/1BXw8EVTBYb6Gc5xqLzZPWdGlNxx/9dCbIwXr0hhDGMmkEbM 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131209_194246_583997_7DF83C18 X-CRM114-Status: GOOD ( 12.15 ) X-Spam-Score: -2.6 (--) Cc: Thomas Petazzoni , Lior Amsalem , Heikki Krogerus , Ezequiel Garcia , Patch Tracking , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , linux-serial@vger.kernel.org, Gregory Clement , ARM Kernel List , Jason Cooper X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);