Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753594AbcDKRKe (ORCPT ); Mon, 11 Apr 2016 13:10:34 -0400 Received: from mail-bn1bon0079.outbound.protection.outlook.com ([157.56.111.79]:36720 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752104AbcDKRKc (ORCPT ); Mon, 11 Apr 2016 13:10:32 -0400 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=none action=none header.from=nxp.com; From: Stuart Yoder To: , CC: , , , , , Itai Katz , Stuart Yoder Subject: [PATCH 10/14] staging: fsl-mc: add dprc version check Date: Mon, 11 Apr 2016 11:56:05 -0500 Message-ID: <1460393765-16428-1-git-send-email-stuart.yoder@nxp.com> X-Mailer: git-send-email 1.7.9.5 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131048673671922491;(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)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(50986999)(2906002)(1220700001)(6806005)(104016004)(86362001)(50226001)(92566002)(586003)(1096002)(5008740100001)(19580405001)(5001770100001)(48376002)(4326007)(50466002)(189998001)(19580395003)(87936001)(33646002)(81166005)(105606002)(77096005)(47776003)(36756003)(106466001)(11100500001)(7059030)(4720700001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0301MB1228;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD034;1:8NrzFc9cv7vhIpL/n89/PPcYozQyvvA+FTl3wuxZGiy9r+canPbFDsaVl5AKIMYyxNxVRXNvl28PXKjq1Xg+THtkJLojUG6420CYLKa7i16KTHY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ylgu7izyzYnxGEowYcUO/ME2gsQISm8FgqLc2dQallLPqXeso9RlE9BWtrq9ReZKcPcsUiUi4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1228; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1228;25:UVzoRJtcwD0s7zDX2DsJ3j1FoNIyMIsqHcartGg/QrpmDZ7FJRb8xsNHmH3q3m6wJGss9DplzENPZMn+EXRVRYcaQD9olftkaeMGdJbcEq5dupnHUIhgx5ty8N1qCOZvQWt2HpqNgD4LDUe8t6wPsPxZh6iqAixlLlDmbqZwzMKH9YcR8dqE8zZnhLmqkdu/SEbVjfneGnp4VxmhTX0f3jNokOfNHtLIy2in4nqsOsS/9Z+qw30v6qVf7nR0SiF924TjJW/KqhVE3NtzCHgj1l6Yh92b/8zCTqI/Qk1Tut39m7x4TC1KJxqPvlufBFM7tGY8FkkmzcB7JWP8yEE9HmFwtuafQ7fLU4d/7CnnSp1ih2tOhqvgS/D/M6l2UIsddjQw3C76U9ds2vWEF53C8EvcrNEhDQm27inVu7RHrPCKTF9SJp+G27Q8QgZPfbAwWVH15rn9ggGWtm68Ik1ixgurYYYi65f+Gyg08dkA08ClX62Ie1Oj1BYjF8BVlFln/lTgQLGt/PNiLpuyRT4Tq+Ihf1+EBlmEUgm6Q3eIsGyMjZ/+NdfVzg5zsHkhF2iNEUm+V+zPyEKENbDcWNMPm2Mtjrdo/A6cy/WGZCs2CI9FL6JsV5QsF1Bm6UXeaghtbAVCVF2jAhImEMMfwsve0Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(13017025)(13015025)(13018025)(13024025)(13023025)(10201501046)(3002001)(6055026);SRVR:CY1PR0301MB1228;BCL:0;PCL:0;RULEID:(400006);SRVR:CY1PR0301MB1228; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1228;4:gejZAiV8oRxysLg/pVSOTXgnHIz6S2tbmS7qySNkeAA5fS+ptWSAZ88b2JgIKylmu+mjiQ8tdjoQIuGy9V+7Dg9J88eTgsy6joOnaguCMcxZg34HF/S8FlIn+SPjjhRwj/lsBi/quYWy994c+KdGFIWcTyQdqkZcRxEHOpMOqUeDVf3CrYC0jMLjThTDluQySzFHD26SwJ1VxguzoNw+zDn42C6PPsnw4K8goVUzIAtaP2tQIMBhbTGR3I4PCaqcmQnfMLwgy5qSgBKvRYwbIw8we0TLom3KnzqYNA58ZITR6FBq6YvabvZX3I2gMBfgA00IeEpqEpAkL3Mqshu9BdouqXb3/+yUw7mWCr3iiBWHpy5QA9/8+gvqEtWrzSXc5AAySKD4YDBL95y0Qwp2+VksqhTTZwuCracuGVmez3+S9+N0fMKDNgop2DcjnnyJsfrUJRtwgMTMEn/yrrtoWfzqpBy8YlUPDzMQryrFegs= X-Forefront-PRVS: 09090B6B69 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0301MB1228;23:ARohXEw/Avz5mcNu+FvCkIstw9oBwCs98PvPleu?= =?us-ascii?Q?g17v92qZRzrOVgqznKotBFL/eodeWBhmzT9zFvmSrkBKjXdfoWfSwjyB9R0f?= =?us-ascii?Q?eXXfNYPNKz1thH7h6LIEzZ2k9xVOA3QzJsXfStZvnWBcGXpKjLpXk1/TWQ7t?= =?us-ascii?Q?8v8G6wv4y1PkA2NrM4Uayx49BUo3QtFKeAx3o+wgHtTHV5m0Gjhm1FiSJ4YD?= =?us-ascii?Q?O0HMnxPzWpZK88P8V3Yo0Z3y08dz4efBmVP2AKLbAm0eR7WKEYbxv3EyK8xu?= =?us-ascii?Q?586UnGTBdyAJ8Rsj4twNsvSOMdiaEgUaqjERFV00zOHIcqLWYSqI96ziKgcW?= =?us-ascii?Q?MAX4pOKPFsg/IR7fP5DpzT13MskfsA54QvsBHwcVNHcjk/EeYIiEVj4LEM69?= =?us-ascii?Q?BosmeI+wD4JmeQ2k2TcsDx2iLVG7BdwTtwq86TcVTd1P7WbS/Z5pwdb00uxE?= =?us-ascii?Q?e73/03X6Z4hTWVAswz2dg7Qubbi7Hq1u5s/DMNLALDsVzownacUKZpvvFqwW?= =?us-ascii?Q?+eTJ6cP8WnTOTXD/vlSBwhymUbg18dyb44zGEbOaURFV3CPZ8qtIWJ2lrlPW?= =?us-ascii?Q?HCQJBERt93L4cm3Ty1rRnR7ArNL6DRgzCYd/i9NvTZWWFMuBccEJ4/5NmEfI?= =?us-ascii?Q?EOokHOmzTlOYSTrgKHqQmbb7ciBxPnuq67ahUHrg50+k/1iruHh/b+XD2PFu?= =?us-ascii?Q?COFJ5NRgEQpmuY8DCQIvhyFKJ0ch0NL9hwTam4+fw/8ITviYjJ16Nj3mynfk?= =?us-ascii?Q?YIY9gbpbhixYPcYXm/4eC74SoUVBkB+pNsonQtNssoc+IGHFHfHrhH54NCOM?= =?us-ascii?Q?GCJYwHJ4kympFrhJGwl1qrvuw4WTguF28tEHVoZfrORL41PdhURUjeFOHs2i?= =?us-ascii?Q?fUolMbMPXe8FaF5v2ZxbNLuz4OtmKRPdJvSeNCchS7X3Ln9REipU3UvGm6nw?= =?us-ascii?Q?7J7jLqCqESn3eeFVPWY6UZJIpTQsmBddT4kJfXZVd1A=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1228;5:gyK7INn4INmOc2C2M2pwRBAwg+w9u9AwcAKsU3LvKCbhyVQBcN5fkCBlm5X2G6iUVeT83gdv1pfY0PaBvAQUIviBIL/c7ybbX3aHnCbdix+3E3GU1QjuIZ3iJTijzCU/C5FFcnkAQDZVdDp2mSB6mjXAA/Zjx/f87E8SPCkGUAI=;24:9zntJbW5nDQMBxXC1CQAHPUfsosVOKZZXr9aihWXyxBVyf89/AbexBHqqyHFSuyyETJDnU7xZ/pBK8cQwlZhDABmC5TGkKSgWoAfy4v3Ub8= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2016 16:56:07.0050 (UTC) 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: CY1PR0301MB1228 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3365 Lines: 95 From: Itai Katz The dprc driver supports dprc version 5.0 and above. This patch adds the code to check the version. Signed-off-by: Itai Katz (Stuart: resolved merge conflicts, split dpseci quirk into separate patch) Signed-off-by: Stuart Yoder --- drivers/staging/fsl-mc/bus/dprc-cmd.h | 6 +++--- drivers/staging/fsl-mc/bus/dprc-driver.c | 19 +++++++++++++++++++ drivers/staging/fsl-mc/bus/mc-bus.c | 1 + drivers/staging/fsl-mc/include/mc-private.h | 2 ++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h b/drivers/staging/fsl-mc/bus/dprc-cmd.h index d0198f5..9b854fa 100644 --- a/drivers/staging/fsl-mc/bus/dprc-cmd.h +++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h @@ -40,9 +40,9 @@ #ifndef _FSL_DPRC_CMD_H #define _FSL_DPRC_CMD_H -/* DPRC Version */ -#define DPRC_VER_MAJOR 5 -#define DPRC_VER_MINOR 1 +/* Minimal supported DPRC Version */ +#define DPRC_MIN_VER_MAJOR 5 +#define DPRC_MIN_VER_MINOR 0 /* Command IDs */ #define DPRC_CMDID_CLOSE 0x800 diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 2d88c10..53c6e98 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -693,6 +693,25 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) goto error_cleanup_msi_domain; } + error = dprc_get_attributes(mc_dev->mc_io, 0, mc_dev->mc_handle, + &mc_bus->dprc_attr); + if (error < 0) { + dev_err(&mc_dev->dev, "dprc_get_attributes() failed: %d\n", + error); + goto error_cleanup_open; + } + + if (mc_bus->dprc_attr.version.major < DPRC_MIN_VER_MAJOR || + (mc_bus->dprc_attr.version.major == DPRC_MIN_VER_MAJOR && + mc_bus->dprc_attr.version.minor < DPRC_MIN_VER_MINOR)) { + dev_err(&mc_dev->dev, + "ERROR: DPRC version %d.%d not supported\n", + mc_bus->dprc_attr.version.major, + mc_bus->dprc_attr.version.minor); + error = -ENOTSUPP; + goto error_cleanup_open; + } + mutex_init(&mc_bus->scan_mutex); /* diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index b4c3c5e..4053643 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -745,6 +745,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) goto error_cleanup_mc_io; } + memset(&obj_desc, 0, sizeof(struct dprc_obj_desc)); error = get_dprc_version(mc_io, container_id, &obj_desc.ver_major, &obj_desc.ver_minor); if (error < 0) diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h index ee5f1d2..cab1ae9 100644 --- a/drivers/staging/fsl-mc/include/mc-private.h +++ b/drivers/staging/fsl-mc/include/mc-private.h @@ -94,12 +94,14 @@ struct fsl_mc_resource_pool { * from the physical DPRC. * @irq_resources: Pointer to array of IRQ objects for the IRQ pool * @scan_mutex: Serializes bus scanning + * @dprc_attr: DPRC attributes */ struct fsl_mc_bus { struct fsl_mc_device mc_dev; struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; struct fsl_mc_device_irq *irq_resources; struct mutex scan_mutex; /* serializes bus scanning */ + struct dprc_attributes dprc_attr; }; #define to_fsl_mc_bus(_mc_dev) \ -- 1.7.9.5