From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759876AbbIVXiz (ORCPT ); Tue, 22 Sep 2015 19:38:55 -0400 Received: from mail-bl2on0116.outbound.protection.outlook.com ([65.55.169.116]:35539 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759860AbbIVXix (ORCPT ); Tue, 22 Sep 2015 19:38:53 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none;freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; From: "J. German Rivera" To: , , , CC: , , , , , , , , , , , "J. German Rivera" Subject: [PATCH v2 3/6] staging: fsl-mc: up-rev dpbp binary interface to v2.0 Date: Tue, 22 Sep 2015 18:08:56 -0500 Message-ID: <1442963339-32084-4-git-send-email-German.Rivera@freescale.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1442963339-32084-1-git-send-email-German.Rivera@freescale.com> References: <1442963339-32084-1-git-send-email-German.Rivera@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD001;1:a9RNm1QC9jP62v3rHY5WEvl4lTzyLrrp/h7iXFmNLljqw6k51GH/bVfWv9p1/B7M4PjwhOULBWEnE7XrcWTe8KfkUx5OSI+QxMf6lbDGRkk3CGu1j1Qz5YwFASGrhUwOkbag6ouDNpumSDR1ZBHZGemlE6LP66ZHt3HIeT6VT+GfDP+ffSQFlSGIX+IcLUmefs4fhCN6zRMDQI+nUg4/b58JiYGrhKE6sX3NmMeBHv+VINhe+f/vnhEI4ASc4yPH/NcE2J19sM4zScvc+fb4pF9wjFv9uLCz8XwDISpPNqsJwS058gd1yxo9MuD9hesj1E5yEYGgJhY0WuSHygcHn9nCXyF8b96TIUNi8w106YJWFF4XdaCvYObFJ7FOPWAVad0fNuMJD4Dgsy+pEXJ4gg== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1110001)(1109001)(339900001)(189002)(45074003)(199003)(86362001)(11100500001)(4001540100001)(46102003)(19580395003)(92566002)(5001830100001)(36756003)(19580405001)(62966003)(81156007)(97736004)(47776003)(5001860100001)(5001770100001)(105606002)(50466002)(48376002)(104016004)(6806005)(87936001)(50986999)(2950100001)(5003940100001)(64706001)(50226001)(5001960100002)(189998001)(229853001)(5001920100001)(2201001)(106466001)(5007970100001)(68736005)(77096005)(107886002)(77156002)(85426001)(76176999)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1303;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1303;2:ULxbwW3HWRcS4NlGDbNON7/bAlngk4+kCvSMaYWrgyybPp9/PsbuaNIOdCT2tj5s7UbJbS6nzAXvvjRU3uSAHoT90F6aQ6t5ErV0eNGmPt1yud/eJsdi7gk1IRKUosRL9ybU9GQdeFM7EiYSs84dpUliM2m+GZRm92Hv2QDoPsE=;3:jMFlsAMNiRMEwXnkDs7/qrSkLSdoNxaNS3zXc/AabJ4qV1qBlWo7SWbR05zoo7HHB1bA2ns9XnCbwz+6mG+P53+08822L6Z+5VOLj+B1nexXMQ4uB/bNYeqif7TrciAEl4VpAM1ktzRxqdyI3aP49/5PArKuaJ0tM5lxg3ifQVBFa/Ut4PI0YLdYd94/sOFI95PPWhKr46uH65E51QJqCE+ZgRpH4I4a2Y5W5PYcH4Y=;25:R9bEZc1l5Qc5yye6l2C7FjfK+dr0BDLOS6lDLJydQ8K6kW3xk1S3ue4/tY/6H00Smj4cTO8XFJ1ggijY7mrXDtoXk3eOjSrnzhkOvD9D5uhdLbdpHU3Fqt+O259VrvUCig9DpQ+7gG9QsbemTWEXjCCKsSKild5ZT68OARQxJ80i/WlmM7KxBYsViZ/21VQOym4hPfUeSYY3RnUqQ9B9SgRq+GQRpJMAaS8jjobiaD0IotYfqBtYkSIONM8hqy7ZrPU5yhChRmIn1QJKf6A0/w== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1303; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1303;20:Xi+Q6WjygsX+Tb4crCsYXNSYLJg+cl9xBB8WpeIDzlLhzjikyMEodfmLHmG2a4/qrkeNEIAfk6Py0Gcx16uiTukFXQCwKT9EGad9ZdO1J0e4ceZFfDU5c3FPPn9t2y4ajZlNrPVk9dsxreYQ4iMJGQUrxC8ybd8Xr14vag/o6wx3KqUxXkFG4cXDyjUw+SsUhkIYfMJ6BxEa6WCN/Ks0nCuw4Gn3lLWLW4pgNpJURWpQw3iihMZ5scEE++cggfbOuXfEw1+6rXFkP5ROejTydbtIM20nQQaMUF8+ISFFomPDsFOVJBn1jCMptaODX8FGW82a4a/Gf0luc9kWTfN6JMh6Rfz9+OsRXSPkJ2p3dqE=;4:K2b2oLoNa/3N7uRQI51soZ2br/fhoDfxoBpeyY5LCdc9pm/8J+LtnXdTN0hcy6Sy6RxaDa0f3H9aZEH8zdhWhhC/8YUtiQtD1aT96Z5ld9nxxEYptafsBKHRRf5lD/8emmZ2VakC0Lew/7fApOaF5M9HuefiKY+xiFYH8KH+n1L65T/IGkCZFypNxarzjDDm5s60pSRhTrq9ZZQBXs65340jksOzW+jISSweHMHTy3uo36WKKsgXgIU/6akrICGBDduipMWmsCrPi5sJzpq5sYYu5bJ6htV8b8SaB32QXfkVt/BzjWHTMxYuIMWw/9d0/dwbhfO7keLde3xriyzuQeqihfQgkBj/x/3FE6WRmvE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001);SRVR:BY1PR0301MB1303;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1303; X-Forefront-PRVS: 0707248B64 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0301MB1303;23:SY76sy5UZCotSzrhHIBtn9ZrBxs2HX1xcS3mMQD?= =?us-ascii?Q?OkGk7C+/t/ioUhEOLbZOJ14iLW8GeAZKgH4Kv/RpYjqruhRv9BoRpPikr7EA?= =?us-ascii?Q?COXHG2as7468iWY19zH9k/AR304QV6SYjU3OPLIzYSVi0MEC8EVKzH/YmE3a?= =?us-ascii?Q?spDY5Sf5nYO+BDaZSihqgh0IxAYnlw9mRbCKaX7rg4QOuar+vT+3jkdtwU38?= =?us-ascii?Q?zi1kZHtBhO6eFUNlxORx+U7ZrfNQdfguq4o1TINXxJX0bp5NO63s6W/cTwkW?= =?us-ascii?Q?HXeRlPK4/clqbqL/tg+gSiRcApE5CzU4qJdP94Dt5JKBofaLwpkw217h/Dig?= =?us-ascii?Q?88UX/0WeJGpLb2GqYYaPWrD7MqAs3f5XVeXnu5IvmY+56MPHIirykY4Ye0sE?= =?us-ascii?Q?xGIOvT+ycEhaWIBfcDlhkJBQXxcUMS/s5QYM/MGtRHqET+COF6f3I5kP6Ocn?= =?us-ascii?Q?U5omNptVz48b+Yo7tvW9a5A60iq76PeLby/y6MCIf6MWKPIX/iHEQrhlP/ns?= =?us-ascii?Q?24v6UaYSOqaXDHQHAsSpgBby1XfTyv8WK4YOq3wH3F4eyOD6zo/HTBATmQp3?= =?us-ascii?Q?mWYt4OfrTA8QvQUdSR/pqg7xkGf/7MRCxi1GJsNSN5jdv3MVB1ExaHIHSLF2?= =?us-ascii?Q?FfvOe5Qha3aoiEv+/3CDG1BA/gsFwszipxi+7PCMsC6naJZED0aMgLmVLv93?= =?us-ascii?Q?ByjAwOyWvisXpqBjgyNpFbsVIw3KvqpGcNNCpvC/U6r+cnhzQZU2/hZ2giZ1?= =?us-ascii?Q?6iPs2p9AdF0eb1p8F+bGQGtb9YN4/griN798LYIO4bw+4fryFtRYT5bbolWO?= =?us-ascii?Q?Dia8MNI4RzKzYHMW+ypSZrNvX5D6gVLGALBouDNppqNahkQATfExUhPUSkL+?= =?us-ascii?Q?xanf5CFpGvwaLTwoRRr/zOj2FiYWGLflWoVF9cbIZP2VVR/k3AyXdczudPB7?= =?us-ascii?Q?8hA+SiXG6ozJ9D31dUNqgNN+PzPDCDacv7RHlLUX0dBHu1Nsya55E4zTvd8O?= =?us-ascii?Q?XxkyehmDFunYPnlnBkNhzup1Aa8MzeqFmbE+q1QTRTNshwCXm1R+GWjmkWxg?= =?us-ascii?Q?u/enXKff2/A4onhwnCNg8m7oO4gLta6aCau3XiI5aCTGj9K1FZ++CQG2p66l?= =?us-ascii?Q?QyvUziWvjntdfk5WVRqDJTh84XTeDcI9xrDxDrebCyjA31XGcSXTmGGUX6uR?= =?us-ascii?Q?KMOZejcHCbpscTWYb9bCdX4zYW80LmomZVEDRpXmLuyX1mk5R0aEKmcBLVwf?= =?us-ascii?Q?ZnoeeJG2YbwOQ5raYGxQoOCQ0yso5SoHDa7Y7Fsgch2406jVAm2Z5TCZ/eoy?= =?us-ascii?Q?4eNqkN2NbRZ3/6I7SgRCv5Mk=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1303;5:PYQf9+ODX/HSunYf2ct5mDB7iY0zMeCPacrAm9PrTAocK/2nY48BDrHogB1RoaWwsaXhhsBOM7Vd3FqgEeQiGvlcGZXc6r7K0vnbkH7546XP4HSFQaQEWJyySiKqtvGXx2kcXJwEWp3IuJ37WD56Rw==;24:TxyNqoAcUyI33L7w+tSZSN5qlrhVUxhE1S4rfgn+tHNXkS2EJD+NwHEzJKgXzQkOLlT7JFuEH+x/lX3QXo9DZp4+R4uYQc6sv3MWQPYduAs=;20:XXd74wEuEqwhJ0jAre1m2x2iXojALO94EbyO3O9u8DkiVabFztktMSJjv3sNyWX4NN2qp7HQM7QsiHFMrg7wtQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2015 23:22:59.2444 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1303 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add cmd_flags parameter to all dpbp APIs to comply with the dpbp 2.0 MC interface. Updated MC version major number. Pass irq args in struct instead of separate args. Signed-off-by: J. German Rivera --- drivers/staging/fsl-mc/bus/dpbp.c | 136 ++++++++++++++++++++---------- drivers/staging/fsl-mc/include/dpbp-cmd.h | 2 +- drivers/staging/fsl-mc/include/dpbp.h | 91 +++++++++++++++----- 3 files changed, 162 insertions(+), 67 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index d99ab6d..0004e65 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -34,14 +34,19 @@ #include "../include/dpbp.h" #include "../include/dpbp-cmd.h" -int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token) +int dpbp_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpbp_id, + uint16_t *token) { struct mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN, - MC_CMD_PRI_LOW, 0); + cmd_flags, + 0); + cmd.params[0] |= mc_enc(0, 32, dpbp_id); /* send command to mc*/ @@ -56,12 +61,14 @@ int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token) } EXPORT_SYMBOL(dpbp_open); -int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token) +int dpbp_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) { struct mc_command cmd = { 0 }; /* prepare command */ - cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, MC_CMD_PRI_HIGH, + cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, cmd_flags, token); /* send command to mc*/ @@ -70,6 +77,7 @@ int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token) EXPORT_SYMBOL(dpbp_close); int dpbp_create(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, const struct dpbp_cfg *cfg, uint16_t *token) { @@ -80,7 +88,8 @@ int dpbp_create(struct fsl_mc_io *mc_io, /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE, - MC_CMD_PRI_LOW, 0); + cmd_flags, + 0); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); @@ -93,24 +102,29 @@ int dpbp_create(struct fsl_mc_io *mc_io, return 0; } -int dpbp_destroy(struct fsl_mc_io *mc_io, uint16_t token) +int dpbp_destroy(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) { struct mc_command cmd = { 0 }; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_DESTROY, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); /* send command to mc*/ return mc_send_command(mc_io, &cmd); } -int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token) +int dpbp_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) { struct mc_command cmd = { 0 }; /* prepare command */ - cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, MC_CMD_PRI_LOW, + cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags, token); /* send command to mc*/ @@ -118,25 +132,31 @@ int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token) } EXPORT_SYMBOL(dpbp_enable); -int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token) +int dpbp_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) { struct mc_command cmd = { 0 }; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); /* send command to mc*/ return mc_send_command(mc_io, &cmd); } EXPORT_SYMBOL(dpbp_disable); -int dpbp_is_enabled(struct fsl_mc_io *mc_io, uint16_t token, int *en) +int dpbp_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en) { struct mc_command cmd = { 0 }; int err; /* prepare command */ - cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, MC_CMD_PRI_LOW, + cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags, token); /* send command to mc*/ @@ -150,53 +170,58 @@ int dpbp_is_enabled(struct fsl_mc_io *mc_io, uint16_t token, int *en) return 0; } -int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token) +int dpbp_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) { struct mc_command cmd = { 0 }; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); /* send command to mc*/ return mc_send_command(mc_io, &cmd); } -int dpbp_set_irq(struct fsl_mc_io *mc_io, - uint16_t token, - uint8_t irq_index, - uint64_t irq_paddr, - uint32_t irq_val, - int user_irq_id) +int dpbp_set_irq(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + struct dpbp_irq_cfg *irq_cfg) { struct mc_command cmd = { 0 }; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); + cmd.params[0] |= mc_enc(0, 8, irq_index); - cmd.params[0] |= mc_enc(32, 32, irq_val); - cmd.params[1] |= mc_enc(0, 64, irq_paddr); - cmd.params[2] |= mc_enc(0, 32, user_irq_id); + cmd.params[0] |= mc_enc(32, 32, irq_cfg->val); + cmd.params[1] |= mc_enc(0, 64, irq_cfg->addr); + cmd.params[2] |= mc_enc(0, 32, irq_cfg->user_irq_id); /* send command to mc*/ return mc_send_command(mc_io, &cmd); } -int dpbp_get_irq(struct fsl_mc_io *mc_io, - uint16_t token, - uint8_t irq_index, - int *type, - uint64_t *irq_paddr, - uint32_t *irq_val, - int *user_irq_id) +int dpbp_get_irq(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + int *type, + struct dpbp_irq_cfg *irq_cfg) { struct mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); + cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ @@ -205,14 +230,16 @@ int dpbp_get_irq(struct fsl_mc_io *mc_io, return err; /* retrieve response parameters */ - *irq_val = (uint32_t)mc_dec(cmd.params[0], 0, 32); - *irq_paddr = (uint64_t)mc_dec(cmd.params[1], 0, 64); - *user_irq_id = (int)mc_dec(cmd.params[2], 0, 32); + irq_cfg->val = (uint32_t)mc_dec(cmd.params[0], 0, 32); + irq_cfg->addr = (uint64_t)mc_dec(cmd.params[1], 0, 64); + irq_cfg->user_irq_id = (int)mc_dec(cmd.params[2], 0, 32); *type = (int)mc_dec(cmd.params[2], 32, 32); + return 0; } int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint8_t en) @@ -221,7 +248,9 @@ int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_ENABLE, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); + cmd.params[0] |= mc_enc(0, 8, en); cmd.params[0] |= mc_enc(32, 8, irq_index); @@ -230,6 +259,7 @@ int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, } int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint8_t *en) @@ -239,7 +269,9 @@ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_ENABLE, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); + cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ @@ -249,10 +281,12 @@ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, /* retrieve response parameters */ *en = (uint8_t)mc_dec(cmd.params[0], 0, 8); + return 0; } int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint32_t mask) @@ -261,7 +295,9 @@ int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_MASK, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); + cmd.params[0] |= mc_enc(0, 32, mask); cmd.params[0] |= mc_enc(32, 8, irq_index); @@ -270,6 +306,7 @@ int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, } int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint32_t *mask) @@ -279,7 +316,9 @@ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_MASK, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); + cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ @@ -289,10 +328,12 @@ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, /* retrieve response parameters */ *mask = (uint32_t)mc_dec(cmd.params[0], 0, 32); + return 0; } int dpbp_get_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint32_t *status) @@ -302,7 +343,9 @@ int dpbp_get_irq_status(struct fsl_mc_io *mc_io, /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_STATUS, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); + cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ @@ -312,10 +355,12 @@ int dpbp_get_irq_status(struct fsl_mc_io *mc_io, /* retrieve response parameters */ *status = (uint32_t)mc_dec(cmd.params[0], 0, 32); + return 0; } int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint32_t status) @@ -324,7 +369,9 @@ int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLEAR_IRQ_STATUS, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); + cmd.params[0] |= mc_enc(0, 32, status); cmd.params[0] |= mc_enc(32, 8, irq_index); @@ -333,6 +380,7 @@ int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, } int dpbp_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, struct dpbp_attr *attr) { @@ -341,7 +389,8 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io, /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR, - MC_CMD_PRI_LOW, token); + cmd_flags, + token); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); @@ -353,6 +402,7 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io, attr->id = (int)mc_dec(cmd.params[0], 32, 32); attr->version.major = (uint16_t)mc_dec(cmd.params[1], 0, 16); attr->version.minor = (uint16_t)mc_dec(cmd.params[1], 16, 16); + return 0; } EXPORT_SYMBOL(dpbp_get_attributes); diff --git a/drivers/staging/fsl-mc/include/dpbp-cmd.h b/drivers/staging/fsl-mc/include/dpbp-cmd.h index 1fd70a21..efa9bf3 100644 --- a/drivers/staging/fsl-mc/include/dpbp-cmd.h +++ b/drivers/staging/fsl-mc/include/dpbp-cmd.h @@ -34,7 +34,7 @@ /* DPBP Version */ #define DPBP_VER_MAJOR 2 -#define DPBP_VER_MINOR 0 +#define DPBP_VER_MINOR 1 /* Command IDs */ #define DPBP_CMDID_CLOSE 0x800 diff --git a/drivers/staging/fsl-mc/include/dpbp.h b/drivers/staging/fsl-mc/include/dpbp.h index 5f3c8e7..5d16bb1 100644 --- a/drivers/staging/fsl-mc/include/dpbp.h +++ b/drivers/staging/fsl-mc/include/dpbp.h @@ -41,6 +41,7 @@ struct fsl_mc_io; /** * dpbp_open() - Open a control session for the specified object. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @dpbp_id: DPBP unique ID * @token: Returned token; use in subsequent API calls * @@ -54,11 +55,15 @@ struct fsl_mc_io; * * Return: '0' on Success; Error code otherwise. */ -int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token); +int dpbp_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpbp_id, + uint16_t *token); /** * dpbp_close() - Close the control session of the object * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * * After this function is called, no further operations are @@ -66,10 +71,12 @@ int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token); * * Return: '0' on Success; Error code otherwise. */ -int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token); +int dpbp_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); /** - * struct dpbp_cfg() - Structure representing DPBP configuration + * struct dpbp_cfg - Structure representing DPBP configuration * @options: place holder */ struct dpbp_cfg { @@ -79,6 +86,7 @@ struct dpbp_cfg { /** * dpbp_create() - Create the DPBP object. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @cfg: Configuration structure * @token: Returned token; use in subsequent API calls * @@ -97,99 +105,123 @@ struct dpbp_cfg { * Return: '0' on Success; Error code otherwise. */ int dpbp_create(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, const struct dpbp_cfg *cfg, uint16_t *token); /** * dpbp_destroy() - Destroy the DPBP object and release all its resources. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * * Return: '0' on Success; error code otherwise. */ -int dpbp_destroy(struct fsl_mc_io *mc_io, uint16_t token); +int dpbp_destroy(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); /** * dpbp_enable() - Enable the DPBP. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * * Return: '0' on Success; Error code otherwise. */ -int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token); +int dpbp_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); /** * dpbp_disable() - Disable the DPBP. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * * Return: '0' on Success; Error code otherwise. */ -int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token); +int dpbp_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); /** * dpbp_is_enabled() - Check if the DPBP is enabled. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @en: Returns '1' if object is enabled; '0' otherwise * * Return: '0' on Success; Error code otherwise. */ -int dpbp_is_enabled(struct fsl_mc_io *mc_io, uint16_t token, int *en); +int dpbp_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en); /** * dpbp_reset() - Reset the DPBP, returns the object to initial state. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * * Return: '0' on Success; Error code otherwise. */ -int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token); +int dpbp_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * struct dpbp_irq_cfg - IRQ configuration + * @addr: Address that must be written to signal a message-based interrupt + * @val: Value to write into irq_addr address + * @user_irq_id: A user defined number associated with this IRQ + */ +struct dpbp_irq_cfg { + uint64_t addr; + uint32_t val; + int user_irq_id; +}; /** * dpbp_set_irq() - Set IRQ information for the DPBP to trigger an interrupt. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @irq_index: Identifies the interrupt index to configure - * @irq_addr: Address that must be written to - * signal a message-based interrupt - * @irq_val: Value to write into irq_addr address - * @user_irq_id: A user defined number associated with this IRQ + * @irq_cfg: IRQ configuration * * Return: '0' on Success; Error code otherwise. */ int dpbp_set_irq(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, - uint64_t irq_addr, - uint32_t irq_val, - int user_irq_id); + struct dpbp_irq_cfg *irq_cfg); /** * dpbp_get_irq() - Get IRQ information from the DPBP. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @irq_index: The interrupt index to configure * @type: Interrupt type: 0 represents message interrupt - * type (both irq_addr and irq_val are valid) - * @irq_addr: Returned address that must be written to - * signal the message-based interrupt - * @irq_val: Value to write into irq_addr address - * @user_irq_id: A user defined number associated with this IRQ + * type (both irq_addr and irq_val are valid) + * @irq_cfg: IRQ attributes * * Return: '0' on Success; Error code otherwise. */ int dpbp_get_irq(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, int *type, - uint64_t *irq_addr, - uint32_t *irq_val, - int *user_irq_id); + struct dpbp_irq_cfg *irq_cfg); /** * dpbp_set_irq_enable() - Set overall interrupt state. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @irq_index: The interrupt index to configure * @en: Interrupt state - enable = 1, disable = 0 @@ -202,6 +234,7 @@ int dpbp_get_irq(struct fsl_mc_io *mc_io, * Return: '0' on Success; Error code otherwise. */ int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint8_t en); @@ -209,6 +242,7 @@ int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, /** * dpbp_get_irq_enable() - Get overall interrupt state * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @irq_index: The interrupt index to configure * @en: Returned interrupt state - enable = 1, disable = 0 @@ -216,6 +250,7 @@ int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, * Return: '0' on Success; Error code otherwise. */ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint8_t *en); @@ -223,6 +258,7 @@ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, /** * dpbp_set_irq_mask() - Set interrupt mask. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @irq_index: The interrupt index to configure * @mask: Event mask to trigger interrupt; @@ -236,6 +272,7 @@ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, * Return: '0' on Success; Error code otherwise. */ int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint32_t mask); @@ -243,6 +280,7 @@ int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, /** * dpbp_get_irq_mask() - Get interrupt mask. * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @irq_index: The interrupt index to configure * @mask: Returned event mask to trigger interrupt @@ -253,6 +291,7 @@ int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, * Return: '0' on Success; Error code otherwise. */ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint32_t *mask); @@ -261,6 +300,7 @@ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, * dpbp_get_irq_status() - Get the current status of any pending interrupts. * * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @irq_index: The interrupt index to configure * @status: Returned interrupts status - one bit per cause: @@ -270,6 +310,7 @@ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, * Return: '0' on Success; Error code otherwise. */ int dpbp_get_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint32_t *status); @@ -278,6 +319,7 @@ int dpbp_get_irq_status(struct fsl_mc_io *mc_io, * dpbp_clear_irq_status() - Clear a pending interrupt's status * * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @irq_index: The interrupt index to configure * @status: Bits to clear (W1C) - one bit per cause: @@ -287,6 +329,7 @@ int dpbp_get_irq_status(struct fsl_mc_io *mc_io, * Return: '0' on Success; Error code otherwise. */ int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, uint8_t irq_index, uint32_t status); @@ -316,12 +359,14 @@ struct dpbp_attr { * dpbp_get_attributes - Retrieve DPBP attributes. * * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPBP object * @attr: Returned object's attributes * * Return: '0' on Success; Error code otherwise. */ int dpbp_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, uint16_t token, struct dpbp_attr *attr); -- 2.3.3