From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 030EEC43441 for ; Tue, 27 Nov 2018 00:08:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ACDDD208E7 for ; Tue, 27 Nov 2018 00:08:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FK5muL8N" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACDDD208E7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbeK0LEc (ORCPT ); Tue, 27 Nov 2018 06:04:32 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33067 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727445AbeK0LEc (ORCPT ); Tue, 27 Nov 2018 06:04:32 -0500 Received: by mail-wm1-f65.google.com with SMTP id 79so361974wmo.0 for ; Mon, 26 Nov 2018 16:08:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tp0/MlgxpYV3RW3YBg/REc3475KFn5JRm7LiIM2eJfM=; b=FK5muL8N0ZoqBfRlFET5+uUFxG+Ah7wrXc2xTogOsAeXp9qJRFxiQWvLw/a4CROIpx 6fnmszGELniWjzKj000+45g6gicYTKogAcZFiQwtEnRvHUkLR5ralB4+6noyzL2aPlLk tws/v+io6UIDAlEFAMcZb7vPq9lzKOiAkscPaTOEOr8c7/boyrtyo4ArRfJBGFL4uYpx bJv02/6XeVjWwVk0H4VlWTIsUuPOLRf27VjscLG+0xoyefRZGlEF88p9I23+H4hCP3ki +o/OMU1IeDrUvqizfNAU3aAFp6sjgWlyzjLeWHAICiIaRoWcr3Ax9NlDgYC/ZFnGsKID 4FKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=tp0/MlgxpYV3RW3YBg/REc3475KFn5JRm7LiIM2eJfM=; b=sJm/hR0A7t/YUFclPsC+jfqqUUMjobmD8zYCzu74DzDSWGT02ipq3khletyvP3oCLU hJnb43NGq8rSOEgH3pDCnjfmphWCh6iSuelPJRcL1KC81iDNsKs8rHy3HN1scoOfDN1D C+BN5bul7ytspXA1rJYjPYYVbvdkvksHeLddwM3aiXl09POG8l9S3pz8fmIQlcU1DJ/P +9kFbrOJVA5k7ANMhZTb2Ma2lKi0Y3GNOBm3b94BWHDP8DTUHwr6qWgqXBgUyGWSf0t5 tMq1rd1ujQs0JG7Z1052x24dhswoDZy88YQbJdgpfzbGaWT3mNglFJGyhdPxag+L0WsD 0C7A== X-Gm-Message-State: AA+aEWbPkt53buXg4HbA438a0FWxQxkIFppDLdzxMHx1mMz/GBuDWzbC G/S6vDuzPKjUl5aauwV52r0= X-Google-Smtp-Source: AJdET5fJ+DdaGMcQlkqMvgPSdR4JakwvOJEdd8x0JKGdWr9bukXzdRLLd4XkHG9h1U2C3PKzIEfGxQ== X-Received: by 2002:a1c:e354:: with SMTP id a81mr25154404wmh.120.1543277315889; Mon, 26 Nov 2018 16:08:35 -0800 (PST) Received: from [10.67.49.109] (igp-prod-emp-gw.vpn.broadcom.com. [192.19.223.250]) by smtp.googlemail.com with ESMTPSA id j24sm1768471wrd.86.2018.11.26.16.08.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 16:08:35 -0800 (PST) Subject: Re: [PATCH] serial: 8250: Default SERIAL_OF_PLATFORM to SERIAL_8250 To: Guenter Roeck Cc: arnd@arndb.de, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org References: <20181115011125.GA32556@roeck-us.net> <29E7A6C0-7829-4650-93C6-7220FECAA6EF@gmail.com> <20181115053836.GA7606@roeck-us.net> <27ed27d3-220e-963f-7d2c-64df10421580@gmail.com> <20181115172535.GA26922@roeck-us.net> <5937b814-ca5f-5786-93a1-3334df8c92dc@gmail.com> <20181116011656.GA21813@roeck-us.net> <20181119205050.GA1933@roeck-us.net> <20181123182023.GA10080@roeck-us.net> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvl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ewEi5yzPg3TAT6FV3oBsNg3xlwU0gPK3v6gYPX5w9+ovPZ1/qqNfOrbsE FRuiSVsZQ5s3AAMFD/9XjlnnVDh9GX/r/6hjmr4U9tEsM+VQXaVXqZuHKaSmojOLUCP/YVQo 7IiYaNssCS4FCPe4yrL4FJJfJAsbeyDykMN7wAnBcOkbZ9BPJPNCbqU6dowLOiy8AuTYQ48m vIyQ4Ijnb6GTrtxIUDQeOBNuQC/gyyx3nbL/lVlHbxr4tb6YkhkO6shjXhQh7nQb33FjGO4P WU11Nr9i/qoV8QCo12MQEo244RRA6VMud06y/E449rWZFSTwGqb0FS0seTcYNvxt8PB2izX+ HZA8SL54j479ubxhfuoTu5nXdtFYFj5Lj5x34LKPx7MpgAmj0H7SDhpFWF2FzcC1bjiW9mjW HaKaX23Awt97AqQZXegbfkJwX2Y53ufq8Np3e1542lh3/mpiGSilCsaTahEGrHK+lIusl6mz Joil+u3k01ofvJMK0ZdzGUZ/aPMZ16LofjFA+MNxWrZFrkYmiGdv+LG45zSlZyIvzSiG2lKy kuVag+IijCIom78P9jRtB1q1Q5lwZp2TLAJlz92DmFwBg1hyFzwDADjZ2nrDxKUiybXIgZp9 aU2d++ptEGCVJOfEW4qpWCCLPbOT7XBr+g/4H3qWbs3j/cDDq7LuVYIe+wchy/iXEJaQVeTC y5arMQorqTFWlEOgRA8OP47L9knl9i4xuR0euV6DChDrguup2aJVU8JPBBgRAgAPAhsMBQJU X9LxBQkeXB3fAAoJEGFXmRW1Y3YOj4UAn3nrFLPZekMeqX5aD/aq/dsbXSfyAKC45Go0YyxV HGuUuzv+GKZ6nsysJw== Message-ID: <5a13dfac-adcb-b0b2-0114-90f9d1eabe8b@gmail.com> Date: Mon, 26 Nov 2018 16:08:26 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181123182023.GA10080@roeck-us.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +PPC folks On 11/23/18 10:20 AM, Guenter Roeck wrote: > On Mon, Nov 19, 2018 at 12:50:50PM -0800, Guenter Roeck wrote: >> On Mon, Nov 19, 2018 at 10:44:30AM -0800, Florian Fainelli wrote: >>> On 11/15/18 5:16 PM, Guenter Roeck wrote: >>>> On Thu, Nov 15, 2018 at 11:48:20AM -0800, Florian Fainelli wrote: >>>>> >>>>> OK, would you mind testing this below? It seems to me that 8250_of.c is >>>>> incompatible with arch/powerpc/kernel/legacy_serial.c and that is what >>>>> is causing the issue here. >>>>> >>>>> diff --git a/drivers/tty/serial/8250/Kconfig >>>>> b/drivers/tty/serial/8250/Kconfig >>>>> index d7737dca0e48..21cb14cbd34a 100644 >>>>> --- a/drivers/tty/serial/8250/Kconfig >>>>> +++ b/drivers/tty/serial/8250/Kconfig >>>>> @@ -483,7 +483,7 @@ config SERIAL_8250_PXA >>>>> >>>>> config SERIAL_OF_PLATFORM >>>>> tristate "Devicetree based probing for 8250 ports" >>>>> - depends on SERIAL_8250 && OF >>>>> + depends on SERIAL_8250 && OF && !(PPC && PPC_UDBG_16550) >>>>> default SERIAL_8250 >>>>> help >>>>> This option is used for all 8250 compatible serial ports that >>>> >>>> 44x/virtex5_defconfig has both PPC_UDBG_16550 and SERIAL_OF_PLATFORM enabled >>>> and fails to boot (or display anything on the console) with this patch applied. >>> >>> Thanks for trying, can you either share or provide a link to the mpc85xx >>> and ml507 qemu command lines that you use? I spent a good chunk of my >>> time trying to get a kernel to boot but has failed so far. >>> >> > > Any update ? I still see the boot failures in next-20181123. Yes, took most of last week's off sorry for the delay. I have finally been able to boot a kernel using your instructions, thanks. The problem is the following call chain: of_platform_serial_probe() -> serial8250_register_8250_port() -> up->port.uartclk == 0, return -EINVAL -> irq_dispose_mapping() and then we basically unwind what we just did with of_platform_serial_probe() including disabling the UART's IRQ, comment out the irq_dispose_mapping() and you will have a functional console again. 8250_of.c is clearly not a full replacement for legacy_serial.c (that was a first attempt), so we need to keep that code around. Making the depends even more conditional also does not sound too appealing, because while we have identified mpc85xx as being problematic, who knows about other platforms. So the best I have that does not involve a revert is this below. Ben, Michael, would that sound reasonable to you? It seems to me that there is a million ways to shoot the legacy_serial 8250 registration in the foot in any cases, and having CONFIG_SERIAL_OF_PLATFORM just made it painfully obvious. diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index 33b34a58fc62..31353a27d714 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c @@ -16,7 +16,7 @@ #include #include -#undef DEBUG +#define DEBUG #ifdef DEBUG #define DBG(fmt...) do { printk(fmt); } while(0) @@ -70,6 +70,29 @@ static void tsi_serial_out(struct uart_port *p, int offset, int value) writeb(value, p->membase + offset); } +#ifdef CONFIG_SERIAL_OF_PLATFORM +static struct property uart_prop = { + .value = "disabled", + .name = "status", + .length = strlen("disabled"), +}; + +static void __init disable_uart_node(struct device_node *np) +{ + /* To avoid having 8250_of.c attempt to register the same device + * and failing to do, and calling irq_dispose_mapping(), just + * disable the device_node for now. + */ + of_update_property(np, &uart_prop); + pr_info("%s: disabled UART node\n", __func__); +} +#else +static inline int disable_uart_node(struct device_node *np) +{ + return 0; +} +#endif + static int __init add_legacy_port(struct device_node *np, int want_index, int iotype, phys_addr_t base, phys_addr_t taddr, unsigned long irq, @@ -80,6 +103,8 @@ static int __init add_legacy_port(struct device_node *np, int want_index, u32 shift = 0; int index; + disable_uart_node(np); + /* get clock freq. if present */ clk = of_get_property(np, "clock-frequency", NULL); if (clk && *clk) -- Florian