From patchwork Sun May 5 13:23:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 1095428 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="mXmUHuD8"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44xmmR5hMYz9s3l for ; Sun, 5 May 2019 23:24:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 81FD9C21E0B; Sun, 5 May 2019 13:23:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C81CEC21C2C; Sun, 5 May 2019 13:23:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 992AEC21C2C; Sun, 5 May 2019 13:23:53 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80052.outbound.protection.outlook.com [40.107.8.52]) by lists.denx.de (Postfix) with ESMTPS id 39FE5C21BE5 for ; Sun, 5 May 2019 13:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SQPE5BjjpRiwx/oFlR5LWRYAjFzA6z31WTYWmLrynBU=; b=mXmUHuD8CWWkkdFOxJ+ZB7RMm/ETnSzJiQiEk1kbObJNNFqhL9WLoIZQ5Us9fvVc4+Cn/jckuOann1MKKEi/ebjpBqX/L5fSrLlLqrAiCT8kVWpa3nB5HYiO6/pnCjtc7fv+xTSgSnu9LsIgPTZYt6DAlDrm5N88Q9+16pWz1uI= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB3970.eurprd04.prod.outlook.com (52.134.92.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.10; Sun, 5 May 2019 13:23:52 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::3173:24:d401:2378]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::3173:24:d401:2378%6]) with mapi id 15.20.1856.012; Sun, 5 May 2019 13:23:52 +0000 From: Peng Fan To: "sbabic@denx.de" , "festevam@gmail.com" Thread-Topic: [PATCH V2 1/4] misc: imx8: add sc_misc_get_temp Thread-Index: AQHVA0XHuzBTjVWt3UOjhwf1iLaSYg== Date: Sun, 5 May 2019 13:23:51 +0000 Message-ID: <20190505133713.27561-1-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.16.4 x-clientproxiedby: HK2PR04CA0073.apcprd04.prod.outlook.com (2603:1096:202:15::17) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4d7b813c-26c9-4a4f-1969-08d6d15cea3c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR04MB3970; x-ms-traffictypediagnostic: AM0PR04MB3970: x-ld-processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8; x-forefront-prvs: 00286C0CA6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(366004)(136003)(396003)(376002)(189003)(199004)(66556008)(66476007)(66946007)(73956011)(25786009)(64756008)(66446008)(6512007)(6506007)(5660300002)(81166006)(81156014)(14454004)(386003)(66066001)(102836004)(6486002)(44832011)(2501003)(8936002)(316002)(71190400001)(86362001)(71200400001)(36756003)(486006)(6436002)(476003)(53936002)(2906002)(3846002)(256004)(6116002)(1076003)(52116002)(2616005)(305945005)(26005)(4326008)(186003)(478600001)(8676002)(50226002)(99286004)(54906003)(110136005)(68736007)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB3970; H:AM0PR04MB4481.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 0mXIz+nd/v0Bjai4gJpwQfeR/2Suf1hCvPOu47a9jMqg0kKMSy7Fcgxuz5VjpPCHT500NVku7FEDgQIwrpsowCPKj8RG/xXv3USanVOhU/BIPjENG6mXz4ohnT/iCQcK3cJ/d6dpIqxm94nnumHiYgDbttF6rqS/vucLB6+5Ru/ylrc8NM387aqnEXOum0R9/wCQl1KsGUrA+b1BEXPOSWl1RSxtg2H5RmsGt/sqvvW3aea4VnzeOx8Sxa2boGaIbh1YoUUpW/Ha8+/OSqfF7XJsVshM5ScNFmXZZ/z0kPTHqwmywTK7i69GAHZX4y7eShaZ1PVPi3EioR2UavCpeeKlJHqyMK5GFnCFxV7xVkIZ6L2aGEGxbAoCmUhDQTNqrmb/ABPYDdYxDfmHkUGm9P0Yzt2XwOoZQdpcNF02370= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d7b813c-26c9-4a4f-1969-08d6d15cea3c X-MS-Exchange-CrossTenant-originalarrivaltime: 05 May 2019 13:23:52.0455 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB3970 Cc: "igor.opaniuk@toradex.com" , Marcel Ziswiler , "u-boot@lists.denx.de" , dl-uboot-imx Subject: [U-Boot] [PATCH V2 1/4] misc: imx8: add sc_misc_get_temp X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add sc_misc_get_temp to support get temperature Signed-off-by: Peng Fan --- V2: None arch/arm/include/asm/arch-imx8/sci/sci.h | 2 ++ arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h | 1 + drivers/misc/imx8/scu_api.c | 28 +++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/arch/arm/include/asm/arch-imx8/sci/sci.h b/arch/arm/include/asm/arch-imx8/sci/sci.h index 97377697f0..901b90d705 100644 --- a/arch/arm/include/asm/arch-imx8/sci/sci.h +++ b/arch/arm/include/asm/arch-imx8/sci/sci.h @@ -72,6 +72,8 @@ void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *boot_dev); void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status); void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit); int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val); +int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp, + s16 *celsius, s8 *tenths); /* RM API */ sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr); diff --git a/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h b/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h index 5d17b553d7..3629eb68d7 100644 --- a/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h +++ b/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h @@ -26,5 +26,6 @@ #define SC_MISC_REL_CONTAINER 2U /* Release container */ typedef u8 sc_misc_boot_status_t; +typedef u8 sc_misc_temp_t; #endif /* SC_MISC_API_H */ diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c index d9c4d5d784..031bc0048b 100644 --- a/drivers/misc/imx8/scu_api.c +++ b/drivers/misc/imx8/scu_api.c @@ -273,6 +273,34 @@ int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val) return 0; } +int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp, + s16 *celsius, s8 *tenths) +{ + struct udevice *dev = gd->arch.scu_dev; + int size = sizeof(struct sc_rpc_msg_s); + struct sc_rpc_msg_s msg; + int ret; + + RPC_VER(&msg) = SC_RPC_VERSION; + RPC_SVC(&msg) = (u8)SC_RPC_SVC_MISC; + RPC_FUNC(&msg) = (u8)MISC_FUNC_GET_TEMP; + RPC_U16(&msg, 0U) = (u16)resource; + RPC_U8(&msg, 2U) = (u8)temp; + RPC_SIZE(&msg) = 2U; + + ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size); + if (ret < 0) + return ret; + + if (celsius) + *celsius = RPC_I16(&msg, 0U); + + if (tenths) + *tenths = RPC_I8(&msg, 2U); + + return 0; +} + /* RM */ sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr) {