Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754658AbcDKQ4D (ORCPT ); Mon, 11 Apr 2016 12:56:03 -0400 Received: from mail-bn1bon0068.outbound.protection.outlook.com ([157.56.111.68]:10877 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754426AbcDKQz7 (ORCPT ); Mon, 11 Apr 2016 12:55:59 -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 09/14] staging: fsl-mc: get version of root dprc from MC hardware Date: Mon, 11 Apr 2016 11:55:55 -0500 Message-ID: <1460393755-16392-1-git-send-email-stuart.yoder@nxp.com> X-Mailer: git-send-email 1.7.9.5 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131048673571430596;(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)(1110001)(1109001)(339900001)(199003)(189002)(5001770100001)(189998001)(48376002)(19580395003)(19580405001)(86362001)(106466001)(1096002)(50986999)(87936001)(1220700001)(11100500001)(586003)(47776003)(36756003)(105606002)(6806005)(4326007)(2906002)(104016004)(92566002)(50466002)(33646002)(5008740100001)(50226001)(81166005)(77096005)(7059030)(4720700001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR0301MB1218;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD038;1:s7bCTzwjWHh+0nVcoViX9gZvCEpxTj+JzbobIfiQ778WRQPiHStTwkykjmEX4CSG3V+epRCsFJb0Qzx+Vawz1XG6S6/iGRXGSVcL/FUqo4WDZiGbJoqabT/K7XMgKwaUDRyGiKtciTBEYQ3BZtVEa0OoHWdWCyQOrUIvhiX4w+wr+XUOlbUJuFarR+rCklmxiKYEgBYc9bCZ2jVTYLPnBmVW57EBkvx+QCLWA657Dk95DraS+K4OL6O3gMGt0SFrDSyj/fA8eWOuJ3w+mcOL1DZBvVlzVB3K9E305xFEEhnvFbSTFQ+Gul1wLFVFFj3UbzdQWEwI26E1mZ6Q2uOmhePtzWxEQ1wKeIt4b5xhC2QGDo5LyunDVWn9q/hAnSrOc/XF9SuXboKnpaJamKzn2cKFFo12yETVwKRIfM52T69rQFDl9fc3ae8hhUnmLVT763lcJqDbBH3iKUx25w9MQIcJ88KESWJu5btZDB8UarC112N8iWLUWlZC4+1KBTVy7IiKW3d82SSgJH2VT8YlPWamjtOHusiLsZdQ7bI/lNr7Y99OYwguQWokNKuL9hyBNlzcxMNapwXT1Bj9HoN09nOG6S7l5F7DDXGuBjVQcuE1FfU+csR9HnORR3MP31aEKrSiqr5KutyLtmll/1OQ70ICfYeeS8e2tD9oFFFvO6oHA30d4KAC/Y+yOCjZ/nNe MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c5229923-d29b-4afc-745b-08d3622a26e4 X-Microsoft-Exchange-Diagnostics: 1;BN3PR0301MB1218;2:wp5qKfppFSU85S4/lReCz4lYBSDaipXxyuJK9d7a7Jku9/PlzQhW44gtzJS1SU3zeSWCoYx2o8v5Z095hIclf3/7dxj9u39dyeW3FtkLnkkpVhF+t9ba7bM7Cic2jRVNUhMEV3bKkVoFHJkuYEG4Y9v+3kNDv65I960hYtB1X6YtDmzGXSXUg40ESn2AROCo;3:JAIEpL54YORJ94Y8UfpsioK7odN21tpWURMUrc3IjxIQRiB1DFXYgl92iImFX36HMKZdxn+1IrmJwyRSmSzMGtII2Dqfl9d9DWo5IPxI8EK1POsZUgAo6W9QOUoSNEaklqM5FUjQQ4+Yhnuxz4wK1fOmjlG4M5aLzZCZMm2zCgppy4DB7L2U3l6L1qsZiWhBIBSwqd0uaT6W/oHNnAXB3pTrJcFKovphCsR/HNZssG0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB1218; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0301MB1218;25:ZOPKg8x3lf6tUy5JB+Dz9tHY+no/rGf6XbZ5iCdRd+jAKGLrh1f8NH3jE4NVLPo+eH5CxGHChtdnaknxUWHIOIvh1EZHU8wtj1SOrhM22/2b4R8pborJY5p+Kb7tGvHA2CAjWU0/Ujyq5OdPw0j1e6vNUOOfY9VjuaIgOjcHVESfgyyOpUDNAAVc8r99//ZHDNq9CbrE023Bvy+rr/46TFNLb2nWB7ahri0l8Fit6t8IX5Np9yAnc5Q40K4AF6UdCiw9CPTjO7KJ/XQ5H+/Hx4ZFN/y/ShoxuXnikefX/Bs596vJtj/Vn/UwA+Mc7z5/rA/1Hp2q4xLq0lZrrkKMklbXU0p/iaoAhi3JvcwKB4Beh1r0JSCs6GCKQ40U2yDOpgc+ufU3mMSUsDZ9c653+81Q+HtBE9w2/EzOoZ1xHa4b9OtpxBzUP6k2K04/aIj6kFygxphcn5N7fwOWKyWtyQzw3kTsgO7WUGX4ms7ZleAmVOHnWbVqwfWx0QKddO860smoMfpMO1G2Z7M47HUcAHUk0o2i/3WNL0ZKfS8EI3KXYaSbnwuTMYHgjvx7U0f5HBaPROWnPZm3qrp3i6/2b+6bMziCacDcmIqwjxDOlM6M4asD3gRKc70vb7/RBrDDGiLM5B3Oaa4nk+TXteQhOQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(13018025)(13017025)(13015025)(13024025)(13023025)(8121501046)(10201501046)(3002001)(6055026);SRVR:BN3PR0301MB1218;BCL:0;PCL:0;RULEID:(400006);SRVR:BN3PR0301MB1218; X-Microsoft-Exchange-Diagnostics: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ascii?Q?tEJWJblDyTLUKx63G8DJkTVhXePzY/nEdqXDUlieLOyNSrKqK9wzkoWOnYA8?= =?us-ascii?Q?4p0Ayj4dx52xED6e8pSkEH8XDSKBcA73RoytVZrETQGOX4a3dwbs8VfPcxJ5?= =?us-ascii?Q?j9dmN8B5tbYSs2GNvnPePT9H46YKuKFaJ4kypZIBHAqHfaMfdx9TvxAkh92F?= =?us-ascii?Q?GiL3ILnzXT6lNluv8R1jyKZblaE5fbYECkroiTewyQMVM2dlYa9qQH4+9qgS?= =?us-ascii?Q?JdEz/6C9g99HIycZcFkoLh6/qCJaI52LBtzKdlYNxcJnr9HbHFWV8bDNnBe9?= =?us-ascii?Q?/csUC4zTWPgphB6Ei311W/MJOUZaXeX20ZScB/DZpZurfN7SEC1cTNsk7IJZ?= =?us-ascii?Q?ohfldA9dAMJpvtAuLph5xFWQYWr0nLOiKBwLgkvVpjaJkJrxTL8WEAvjmETa?= =?us-ascii?Q?vdB5ITBBnkr7TE8q71c/XXmMmBqtNgTS3nI9fdgCNrSOeC0emZHsPtPclIrT?= =?us-ascii?Q?Pe8yXHTXxquEXnCrb30/jDFKHmeQF7+4u10yp2fpZb2wd+vhqKFckC05tn1a?= =?us-ascii?Q?plr0PeDnS9EQuH2/kHLaQQ1ht+olfcSzs/QOJLA4tew=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN3PR0301MB1218;5:NpTtG4s1Fhybnkk/DPHlo6RkxTdIK6Zf9Bs0hyVIj6mFQ0kLu+PEVf14+QEqIiusk26ThLdVk7D6Ff290IjSAMJ6UUb75txHGaJn016IKug8EU5Yn3z9hb1LW05Sp5Tcafcljcug6uChcZSKCG6d0Qok3B8Xw5X629GtcPyKd84=;24:w6uRG349lKp6Dcu5iEFcTzPqZS0UHWkmc8ZVgqp+ISf6ApMLlGQt1OE25kjglxy8PR6Rgjmm2LVPxRIXDDQO9tUKY3cJhrFWhdhDa2bi3tg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2016 16:55:56.8310 (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: BN3PR0301MB1218 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3024 Lines: 104 From: Itai Katz The root dprc is discovered as a platform device in the device tree. The version of that dprc was previously set using hardcoded values from the API header in the kernel). This patch removes the use of the hardcoded version numbers and instead reads the actual dprc version from the hardware. Signed-off-by: Itai Katz (Stuart: resolved merge conflict, updated commit subject/log) Signed-off-by: Stuart Yoder --- drivers/staging/fsl-mc/bus/mc-bus.c | 45 ++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index 2075597..b4c3c5e 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -229,11 +229,10 @@ static bool fsl_mc_is_root_dprc(struct device *dev) return dev == root_dprc_dev; } -static int get_dprc_icid(struct fsl_mc_io *mc_io, - int container_id, u16 *icid) +static int get_dprc_attr(struct fsl_mc_io *mc_io, + int container_id, struct dprc_attributes *attr) { u16 dprc_handle; - struct dprc_attributes attr; int error; error = dprc_open(mc_io, 0, container_id, &dprc_handle); @@ -242,15 +241,14 @@ static int get_dprc_icid(struct fsl_mc_io *mc_io, return error; } - memset(&attr, 0, sizeof(attr)); - error = dprc_get_attributes(mc_io, 0, dprc_handle, &attr); + memset(attr, 0, sizeof(struct dprc_attributes)); + error = dprc_get_attributes(mc_io, 0, dprc_handle, attr); if (error < 0) { dev_err(mc_io->dev, "dprc_get_attributes() failed: %d\n", error); goto common_cleanup; } - *icid = attr.icid; error = 0; common_cleanup: @@ -258,6 +256,34 @@ common_cleanup: return error; } +static int get_dprc_icid(struct fsl_mc_io *mc_io, + int container_id, u16 *icid) +{ + struct dprc_attributes attr; + int error; + + error = get_dprc_attr(mc_io, container_id, &attr); + if (error == 0) + *icid = attr.icid; + + return error; +} + +static int get_dprc_version(struct fsl_mc_io *mc_io, + int container_id, u16 *major, u16 *minor) +{ + struct dprc_attributes attr; + int error; + + error = get_dprc_attr(mc_io, container_id, &attr); + if (error == 0) { + *major = attr.version.major; + *minor = attr.version.minor; + } + + return error; +} + static int translate_mc_addr(struct fsl_mc_device *mc_dev, enum dprc_region_type mc_region_type, u64 mc_offset, phys_addr_t *phys_addr) @@ -719,11 +745,14 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) goto error_cleanup_mc_io; } + error = get_dprc_version(mc_io, container_id, + &obj_desc.ver_major, &obj_desc.ver_minor); + if (error < 0) + goto error_cleanup_mc_io; + obj_desc.vendor = FSL_MC_VENDOR_FREESCALE; strcpy(obj_desc.type, "dprc"); obj_desc.id = container_id; - obj_desc.ver_major = DPRC_VER_MAJOR; - obj_desc.ver_minor = DPRC_VER_MINOR; obj_desc.irq_count = 1; obj_desc.region_count = 0; -- 1.7.9.5