From patchwork Thu Jul 7 15:28:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9219125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7CF56048B for ; Thu, 7 Jul 2016 15:30:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C689727FA2 for ; Thu, 7 Jul 2016 15:30:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB0C727FA4; Thu, 7 Jul 2016 15:30:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E671927FA3 for ; Thu, 7 Jul 2016 15:30:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bLBEQ-0003j4-Rw; Thu, 07 Jul 2016 15:28:50 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bLBEN-0003ea-QQ for linux-arm-kernel@lists.infradead.org; Thu, 07 Jul 2016 15:28:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=+lXGH8QzQIrAcUCkRDS/WeuxHfv8hYN0afy2xp1WSuE=; b=N/fUxCWpQ9xAqBcial4Efse1+MaK8IfqWnCKjwGS+r2BMhV4ZiuwI0K6sXYtEEBKfbNasci8r2qdv1JvAADqgF+7QnlWPE5shXzYsWWSlDtsgc/PAb2rkWJ3XYbER3HC5D7FpbTINFYADxYKh28t+VNgsS4cFmQ0c8so6X78Xac=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:48728) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1bLBDm-0003Vg-2v; Thu, 07 Jul 2016 16:28:10 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1bLBDf-0001fs-95; Thu, 07 Jul 2016 16:28:03 +0100 Date: Thu, 7 Jul 2016 16:28:02 +0100 From: Russell King - ARM Linux To: Shawn Guo Subject: Re: [PATCH v2] serial: amba-pl011: complete support to ZTE uart Message-ID: <20160707152802.GR1041@n2100.armlinux.org.uk> References: <1458717126-20814-1-git-send-email-jun.nie@linaro.org> <570CF1B3.8080305@linaro.org> <20160428201106.GA2924@kroah.com> <20160707095453.GA10000@tiger> <20160707150107.GA20896@tiger> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160707150107.GA20896@tiger> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160707_082848_201870_E1CF6B56 X-CRM114-Status: GOOD ( 25.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Hurley , G Gregory , Jason Liu , Greg KH , Timur Tabi , linux-serial@vger.kernel.org, Andre Przywara , Jun Nie , Shawn Guo , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jul 07, 2016 at 11:01:07PM +0800, Shawn Guo wrote: > On Thu, Jul 07, 2016 at 05:54:53PM +0800, Shawn Guo wrote: > > I think this version of the patch is trying to address the comment you > > put on v1, i.e. instead of extending platform driver we should try to > > probe ZTE UART from AMBA bus. > > > > The solution here is to fake a AMBA peripheral ID which does not exist > > on hardware with a magic number. While it's working, it looks too > > hackish, and doesn't really scale in the long run. I hope that's also > > the reason you are unwilling to provide your ACK :) > > > > Unless you have a better solution to suggest, I would think that > > platform driver is a sensible way to support the device, and will go > > back to v1 approach. > > Just found that Russell's email address changed. Resend to the new > address. So, if I were to do this, there wouldn't be any objection? An alternative would be to use the real hardware ID if it exists, add a compatible to DT, and use of_device_is_compatible() in the driver to discover if it's a zte device. 8<==== Subject: [PATCH] amba: make ZTE pseudo-ID more "official" Signed-off-by: Russell King --- drivers/tty/serial/amba-pl011.c | 4 ++-- include/linux/amba/bus.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 77b05f5bf866..2dbe5776ac56 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2659,8 +2659,8 @@ static struct amba_id pl011_ids[] = { .data = &vendor_st, }, { - .id = 0xfefefe, - .mask = 0xffffff, + .id = AMBA_LINUX_ID(0x00, 0xf, 0xefe), + .mask = 0x00ffffff, .data = &vendor_zte, }, { 0, 0 }, diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 3d8dcdd1aeae..dc29d504b4fc 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h @@ -53,8 +53,13 @@ enum amba_vendor { AMBA_VENDOR_ST = 0x80, AMBA_VENDOR_QCOM = 0x51, AMBA_VENDOR_LSI = 0xb6, + AMBA_VENDOR_LINUX = 0xef, /* This value is not official */ }; +#define AMBA_LINUX_ID(conf, rev, part) \ + (((conf) & 0xff) << 24 | ((rev) & 0xf) << 20 | \ + AMBA_VENDOR_LINUX << 12 | ((part) & 0xfff)) + extern struct bus_type amba_bustype; #define to_amba_device(d) container_of(d, struct amba_device, dev)