From patchwork Fri Jul 8 09:00:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 71658 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp339773qgy; Fri, 8 Jul 2016 02:01:38 -0700 (PDT) X-Received: by 10.98.110.195 with SMTP id j186mr8096045pfc.49.1467968498650; Fri, 08 Jul 2016 02:01:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si3113520pac.286.2016.07.08.02.01.38; Fri, 08 Jul 2016 02:01:38 -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; 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; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753018AbcGHJBh (ORCPT + 2 others); Fri, 8 Jul 2016 05:01:37 -0400 Received: from mail.kernel.org ([198.145.29.136]:46214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751723AbcGHJBh (ORCPT ); Fri, 8 Jul 2016 05:01:37 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF39E2017D; Fri, 8 Jul 2016 09:01:35 +0000 (UTC) Received: from localhost.localdomain (unknown [180.106.221.147]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CCA5201BB; Fri, 8 Jul 2016 09:01:30 +0000 (UTC) From: Shawn Guo To: Greg Kroah-Hartman , Russell King Cc: Andre Przywara , Peter Hurley , Timur Tabi , Jun Nie , Jason Liu , xie.baoyou@zte.com.cn, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Shawn Guo , Russell King Subject: [PATCH v3 3/3] tty: amba-pl011: probe ZTE device from AMBA bus with a pseudo-ID Date: Fri, 8 Jul 2016 17:00:41 +0800 Message-Id: <1467968441-4056-4-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467968441-4056-1-git-send-email-shawn.guo@linaro.org> References: <1467968441-4056-1-git-send-email-shawn.guo@linaro.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham 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 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org There is no Peripheral Identification Registers on ZTE PL011 device, so although the driver amba-pl011 is ready to work for ZTE device, the device cannot be probed by the driver at all. With arm,primecell-periphid DT bindings (bindings/arm/primecell.txt) in place, it should be the cleanest the way to use a pseudo-ID to probe the device from AMBA bus. We create an unofficial vendor number AMBA_VENDOR_LINUX, which will practically never become an official vendor ID, and takes Configuration, Revision number, and Part number as input to compose a pseudo-ID for ZTE device. Also, since we start using vendor_zte to probe ZTE device, the __maybe_unused for vendor_zte is removed. Signed-off-by: Russell King Signed-off-by: Shawn Guo --- drivers/tty/serial/amba-pl011.c | 7 ++++++- include/linux/amba/bus.h | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) -- 1.9.1 -- 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/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 8b7fb3689ee7..6b349af7fadf 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -209,7 +209,7 @@ static unsigned int get_fifosize_zte(struct amba_device *dev) return 16; } -static struct vendor_data vendor_zte __maybe_unused = { +static struct vendor_data vendor_zte = { .reg_offset = pl011_zte_offsets, .access_32b = true, .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, @@ -2646,6 +2646,11 @@ static struct amba_id pl011_ids[] = { .mask = 0x00ffffff, .data = &vendor_st, }, + { + .id = AMBA_LINUX_ID(0x00, 0x1, 0xffe), + .mask = 0x00ffffff, + .data = &vendor_zte, + }, { 0, 0 }, }; diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 3d8dcdd1aeae..d143c13bed26 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h @@ -53,8 +53,14 @@ enum amba_vendor { AMBA_VENDOR_ST = 0x80, AMBA_VENDOR_QCOM = 0x51, AMBA_VENDOR_LSI = 0xb6, + AMBA_VENDOR_LINUX = 0xfe, /* This value is not official */ }; +/* This is used to generate pseudo-ID for AMBA device */ +#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)