From patchwork Tue Mar 15 14:41:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Langlais X-Patchwork-Id: 574 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:43:56 -0000 Delivered-To: patches@linaro.org Received: by 10.151.46.5 with SMTP id y5cs72185ybj; Tue, 15 Mar 2011 07:42:48 -0700 (PDT) Received: by 10.213.97.7 with SMTP id j7mr29102ebn.112.1300200166869; Tue, 15 Mar 2011 07:42:46 -0700 (PDT) Received: from eu1sys200aog113.obsmtp.com (eu1sys200aog113.obsmtp.com [207.126.144.135]) by mx.google.com with SMTP id t3si20177955eeh.30.2011.03.15.07.42.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 15 Mar 2011 07:42:46 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of philippe.langlais@stericsson.com) client-ip=207.126.144.135; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of philippe.langlais@stericsson.com) smtp.mail=philippe.langlais@stericsson.com Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob113.postini.com ([207.126.147.11]) with SMTP ID DSNKTX964ZyXmfMA+0QTf+5wUa9sf8Wk3Bqx@postini.com; Tue, 15 Mar 2011 14:42:46 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2C065159; Tue, 15 Mar 2011 14:42:41 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DB0B124B9; Tue, 15 Mar 2011 14:42:40 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 0F7EBA80AD; Tue, 15 Mar 2011 15:42:35 +0100 (CET) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.2.254.0; Tue, 15 Mar 2011 15:42:40 +0100 From: Philippe Langlais To: Cc: , , , Rabin Vincent Subject: [PATCH 1/4] amba: add name based matching Date: Tue, 15 Mar 2011 15:41:53 +0100 Message-ID: <1300200116-12185-2-git-send-email-philippe.langlais@stericsson.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1300200116-12185-1-git-send-email-philippe.langlais@stericsson.com> References: <1300200116-12185-1-git-send-email-philippe.langlais@stericsson.com> MIME-Version: 1.0 From: Rabin Vincent Some peripherals on the DBx500 family of SoCs have changes in their functionality and registers between different variants in the family but retain the same AMBA peripheral ID, making it impossible to distinguish between them in AMBA drivers with the current AMBA id_table. To support this, add a name parameter to the amba_device and the amba_id and allow name based matching as a second level filter after the periphid match. Acked-by: Linus Walleij Signed-off-by: Rabin Vincent --- drivers/amba/bus.c | 6 ++++++ include/linux/amba/bus.h | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 6d2bb25..7f1590f 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -29,6 +29,12 @@ amba_lookup(const struct amba_id *table, struct amba_device *dev) while (table->mask) { ret = (dev->periphid & table->mask) == table->id; + if (ret && (table->name || dev->name)) { + if (table->name && dev->name) + ret = strcmp(dev->name, table->name) == 0; + else + ret = 0; + } if (ret) break; table++; diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index fcbbe71..f5f82b2 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h @@ -32,12 +32,14 @@ struct amba_device { struct regulator *vcore; u64 dma_mask; unsigned int periphid; + const char *name; unsigned int irq[AMBA_NR_IRQS]; }; struct amba_id { unsigned int id; unsigned int mask; + const char *name; void *data; };