From patchwork Fri Nov 17 13:38:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10062791 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 C5C416023A for ; Fri, 17 Nov 2017 13:54:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5F7C2ABA0 for ; Fri, 17 Nov 2017 13:54:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9C042ABC1; Fri, 17 Nov 2017 13:54:46 +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.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5B0852AC06 for ; Fri, 17 Nov 2017 13:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=V+ct4txWKXsZRoXWkVegtlKVAAvWCjzc+A4hkm7SstU=; b=rRtLUvdxQ71Inh sdRVqF9vQa5cxgxTbYdgJolAVCk0Yna8aFMJrMunqTF3YzgswrXQgPmlTrIvPozGC/Y3JlUaF4XRm VMyIb1P+zSMPs81hkv+MCRBe6BRIV1pkJdswVTwiKlqc3wpn4HhZPxn1sgYy9dzMf7QZVPhyUNTWR 8UMoWW1lgS9MewWgGIvW0r+GBTsBftatBdM2zVbJeGWbh9IN7vS2JS3Lzmqby8AqheY5kba6lRM/3 cQtpY2x3BrpU2F2iF5lyW/zYU72kB1L2sZa7DCC0/3qGAUZEsVtthctcqnemM7aa5Gsaye4ErfYC7 HATUv69D5gTI+7slVPkQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eFh6J-00019L-J9; Fri, 17 Nov 2017 13:54:35 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eFh6H-0000zD-8l for linux-arm-kernel@bombadil.infradead.org; Fri, 17 Nov 2017 13:54:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NSUuOHueiUUDjVfvMuH1uyUR+Ko/ee1HNTySsVXNViw=; b=hTbmCgSnqD/WxBKs3BlOqe0dS KdJ3iibvA5QZrKX28lUnGgB75E+eIiB91oAZV0xeVSDQDFF+eSPMdF3bUucXX2gMzNbU1rjK6hm7d bwPvSSFCP2nC71ueipykn4Y2I+ZHDgGy3F0LVYypDVqq+6ki09fnfvMT+v2da+ps1yn53It/7Ii9s chb0Oz1NytnddSnYsBzE+HxwtU1B6nvbpjtMSqMt7R1Icj79/vN3RCw0BsiA2XRMLxqlO0Nu8Vs3p TMlECsp8Ip2HossdbhJCmOuMiJ5U+g0OFEaGvgFwSwwy2a3/vSP7aacXrX9BMBAGLP+1GlUGYmyks JKD/6PP7A==; Received: from mail-bn3nam01on0049.outbound.protection.outlook.com ([104.47.33.49] helo=NAM01-BN3-obe.outbound.protection.outlook.com) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eFgrs-0003hd-RK for linux-arm-kernel@lists.infradead.org; Fri, 17 Nov 2017 13:39:43 +0000 Received: from BN6PR03CA0090.namprd03.prod.outlook.com (10.164.122.156) by BN6PR03MB2689.namprd03.prod.outlook.com (10.173.144.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Fri, 17 Nov 2017 13:39:07 +0000 Received: from BL2FFO11FD038.protection.gbl (2a01:111:f400:7c09::150) by BN6PR03CA0090.outlook.office365.com (2603:10b6:405:6f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Fri, 17 Nov 2017 13:39:07 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD038.mail.protection.outlook.com (10.173.161.134) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.197.9 via Frontend Transport; Fri, 17 Nov 2017 13:39:06 +0000 Received: from fsr-fed1964-102.ea.freescale.net (fsr-fed1964-102.ea.freescale.net [10.171.73.17]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vAHDcbAs004692; Fri, 17 Nov 2017 06:39:03 -0700 From: To: , Subject: [PATCH 09/10] staging: fsl-mc: add support for device type Date: Fri, 17 Nov 2017 15:38:33 +0200 Message-ID: <20171117133834.4635-9-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171117133834.4635-1-laurentiu.tudor@nxp.com> References: <20171117133834.4635-1-laurentiu.tudor@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131553995470315619; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7966004)(336005)(346002)(39380400002)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(104016004)(68736007)(54906003)(16586007)(76176999)(50986999)(316002)(33646002)(2906002)(77096006)(110136005)(4326008)(36756003)(5660300001)(2876002)(39060400002)(97736004)(86152003)(106466001)(8656006)(53936002)(47776003)(105606002)(81166006)(81156014)(6666003)(50226002)(6636002)(8936002)(2950100002)(5003940100001)(86362001)(305945005)(356003)(8676002)(189998001)(1076002)(48376002)(85426001)(498600001)(7416002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2689; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD038; 1:Q8Ua2nyMIfueHAIk/9gpbjmNJPvMLIAhWFZk9vg7PzWYToJy+//xE/7aeEINTbiGCzJw6lvTiB9MxceLZ1ZSMmsJD1uopEsVhdzaiQ91aoyK2uBvDaFPx4647bGieRQN MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f080ab49-5f60-4494-a063-08d52dc09341 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:BN6PR03MB2689; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2689; 3:qQaqp7FwesKwGUuqluiuCT4gOd0ESsyNiIuMnrZPesXJG9uXBEDZI6PnZB+84wNWn05JnzJzkQwZjg6nBtEuSGTRO4wkMJLw2mavJVd8h0obknoRV+fYBj4uZnzQUz3jS/7oZg25pKxdfCVrEOysCFsXDGHTnVmSr/HVUAGYm0qo8Jy94G0BfDWFfZJSZkT0YWSnwAOR49sQiDGRU3se7Q4omyZx0Vg4fNcLUokK4FkIPTRtp9epMzfF96NWSLA3f6yery6EXBB5HCKqa3OiDJGH/b7PDWKTpBmOCP0G9bUTuGiiU4HTgxEyh7X61h14rNjU89bx3G+I7+pdJOfMttBmyRY8VtQ7wBKq4dCGV0k=; 25:igDBkG3FD9RbEhM/MfJye1q6rxQELUlhIB4DESdz2bdTuTlxb8Tnu4MXA6s2ycMocXLq2SR2qAc0tWJlPjOmvbNdc74MgjuZVP7XpWwPdcbj2R6mwBomfHnmlUImB+O6okAUH5I1Fwwc6475TKiX8x2bJdCKBioCHAEK9NpbnN5gRKvZS/G5JJxSZzT1mpgEiMlU2E8sUKBUsIX0tyeGYMsYN2WmAeBdUkNbsdfCp2dUjcBMdFyoNgtHLfqJ7DtKuf1SNkQHik9F1bi5oWZVk5/m3bX5abAYvHCyE7PZPKqYKMMYTVcfjbAH7rwDkNZN9bjzPwIXrYHNJma//PKPhw== X-MS-TrafficTypeDiagnostic: BN6PR03MB2689: X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2689; 31:/8cyW7n20zto0dielQlJ9IoZ8yq9NIS5zYDA9Kvi7oPAZesNTWbRr/XnsVq367K2lgP5/u7JQ9KwAucfBP/BF+yLrhnQxVhPcxbpkmPJ36QQXid/cBBEFzYuE7wus4Tb1MtUis6y+EynIQK70DUyShAw2y8s+DDQ8vXdg6DBfMTny2kORhruKK90x5VDvyb55JdHy9xtIpWSK8Bz2kGZaUp/KpLE68GSpqi2oGQS1Ck=; 4:CRZCjw66GrHF0/5XDn83UISn8mpZRMojUDMPz7O+j8sxNHkm7itkb/ruk1x4wJLKk1g+Q7eKeP9pc5CQMdJnvm3NEjfyt+Thnf91CFE71aXSQNKdWEg2JTbodGraUeGC40d+KBhH73REgrfdsE5VU5bGeXOwruAyC+7Mw3XYwKW24ckievAZVm5BQkVY6Fjdv9smlfc2JeogBM54xJS1xSc3bKvCRuOY4VaY/2fnZ+vEmsxZGKKya0VZOvcdVaoRPKNV4o3kNJQXHFDZd17OGbvm3eI9yCFPNLCW5pJ1u0xW+93vjCX0G8iZEEqOa1n9 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(3231022)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123556025)(20161123563025)(20161123565025)(20161123561025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR03MB2689; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR03MB2689; X-Forefront-PRVS: 049486C505 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2689; 23:6Wg4MBfha+5VRnVbnn6VqVxUkFcsp9vkhL/VIwuDB?= =?us-ascii?Q?p3Jlq5rnY8YSpyPV1UlYpkSJCvjjIKsLLqmI8MnFFxFa8slLyU2gn1VGAdyh?= =?us-ascii?Q?695t5BjpfC4HBTdIurT41gj72OWLG/YPwcj+BLkk7n1MXMG/iO3JYYJLkMst?= =?us-ascii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OhWWd/ajyzEFWptS7nqozFjf0n10fmqryb7b4awM69zRfmjlgkf+J8mYwgozgpdk6pIZdu8HutJF3GeSa7Ec6+0wbDMXnh3ab1tWCts2avvdFqZjgiwX//o5HFBca8b5NDL2LtxM699OBEKoPlo2DOISEyZBO9vPdw1EIweFwpp1zriWgrzsjitVBxbmbDlHRagKCRGdDDAjFiSC4g SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2017 13:39:06.8599 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f080ab49-5f60-4494-a063-08d52dc09341 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2689 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171117_133941_130775_876682E8 X-CRM114-Status: GOOD ( 20.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, stuyoder@gmail.com, roy.pledge@nxp.com, linux-kernel@vger.kernel.org, leoyang.li@nxp.com, bogdan.purcareata@nxp.com, linux-arm-kernel@lists.infradead.org, Laurentiu Tudor 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 From: Laurentiu Tudor The MC bus has different types of devices and this is supported by device model. This patch adds initial support for device types (defines them, adds helpers and sets the device type). Signed-off-by: Laurentiu Tudor --- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 67 +++++++++++++++++++++++++++++++++ drivers/staging/fsl-mc/include/mc.h | 55 +++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 854bd80..aa935f3 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -156,6 +156,68 @@ struct bus_type fsl_mc_bus_type = { }; EXPORT_SYMBOL_GPL(fsl_mc_bus_type); +struct device_type fsl_mc_bus_dprc_type = { + .name = "fsl_mc_bus_dprc" +}; + +struct device_type fsl_mc_bus_dpni_type = { + .name = "fsl_mc_bus_dpni" +}; + +struct device_type fsl_mc_bus_dpio_type = { + .name = "fsl_mc_bus_dpio" +}; + +struct device_type fsl_mc_bus_dpsw_type = { + .name = "fsl_mc_bus_dpsw" +}; + +struct device_type fsl_mc_bus_dpbp_type = { + .name = "fsl_mc_bus_dpbp" +}; + +struct device_type fsl_mc_bus_dpcon_type = { + .name = "fsl_mc_bus_dpcon" +}; + +struct device_type fsl_mc_bus_dpmcp_type = { + .name = "fsl_mc_bus_dpmcp" +}; + +struct device_type fsl_mc_bus_dpmac_type = { + .name = "fsl_mc_bus_dpmac" +}; + +struct device_type fsl_mc_bus_dprtc_type = { + .name = "fsl_mc_bus_dprtc" +}; + +static struct device_type *fsl_mc_get_device_type(const char *type) +{ + static const struct { + struct device_type *dev_type; + const char *type; + } dev_types[] = { + { &fsl_mc_bus_dprc_type, "dprc" }, + { &fsl_mc_bus_dpni_type, "dpni" }, + { &fsl_mc_bus_dpio_type, "dpio" }, + { &fsl_mc_bus_dpsw_type, "dpsw" }, + { &fsl_mc_bus_dpbp_type, "dpbp" }, + { &fsl_mc_bus_dpcon_type, "dpcon" }, + { &fsl_mc_bus_dpmcp_type, "dpmcp" }, + { &fsl_mc_bus_dpmac_type, "dpmac" }, + { &fsl_mc_bus_dprtc_type, "dprtc" }, + { NULL, NULL } + }; + int i; + + for (i = 0; dev_types[i].dev_type; i++) + if (!strcmp(dev_types[i].type, type)) + return dev_types[i].dev_type; + + return NULL; +} + static int fsl_mc_driver_probe(struct device *dev) { struct fsl_mc_driver *mc_drv; @@ -506,6 +568,11 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, mc_dev->dev.parent = parent_dev; mc_dev->dev.bus = &fsl_mc_bus_type; mc_dev->dev.release = fsl_mc_device_release; + mc_dev->dev.type = fsl_mc_get_device_type(obj_desc->type); + if (!mc_dev->dev.type) { + dev_err(parent_dev, "unknown device type %s\n", obj_desc->type); + goto error_cleanup_dev; + } dev_set_name(&mc_dev->dev, "%s.%d", obj_desc->type, obj_desc->id); if (strcmp(obj_desc->type, "dprc") == 0) { diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index aafe63a..15db93d 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -398,4 +398,59 @@ void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); extern struct bus_type fsl_mc_bus_type; +extern struct device_type fsl_mc_bus_dprc_type; +extern struct device_type fsl_mc_bus_dpni_type; +extern struct device_type fsl_mc_bus_dpio_type; +extern struct device_type fsl_mc_bus_dpsw_type; +extern struct device_type fsl_mc_bus_dpbp_type; +extern struct device_type fsl_mc_bus_dpcon_type; +extern struct device_type fsl_mc_bus_dpmcp_type; +extern struct device_type fsl_mc_bus_dpmac_type; +extern struct device_type fsl_mc_bus_dprtc_type; + +static inline bool is_fsl_mc_bus_dprc(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dprc_type; +} + +static inline bool is_fsl_mc_bus_dpni(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dpni_type; +} + +static inline bool is_fsl_mc_bus_dpio(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dpio_type; +} + +static inline bool is_fsl_mc_bus_dpsw(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dpsw_type; +} + +static inline bool is_fsl_mc_bus_dpbp(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dpbp_type; +} + +static inline bool is_fsl_mc_bus_dpcon(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dpcon_type; +} + +static inline bool is_fsl_mc_bus_dpmcp(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dpmcp_type; +} + +static inline bool is_fsl_mc_bus_dpmac(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dpmac_type; +} + +static inline bool is_fsl_mc_bus_dprtc(const struct fsl_mc_device *mc_dev) +{ + return mc_dev->dev.type == &fsl_mc_bus_dprtc_type; +} + #endif /* _FSL_MC_H_ */