From patchwork Fri Apr 12 07:55:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 1084459 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="OtEHZfHa"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44gVbC1NYFz9s47 for ; Fri, 12 Apr 2019 17:56:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C64EDC21E50; Fri, 12 Apr 2019 07:55:53 +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 34A3AC21E3E; Fri, 12 Apr 2019 07:55:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 47531C21E13; Fri, 12 Apr 2019 07:55:12 +0000 (UTC) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70041.outbound.protection.outlook.com [40.107.7.41]) by lists.denx.de (Postfix) with ESMTPS id 25A70C21E4F for ; Fri, 12 Apr 2019 07:55:06 +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=dj77okqj2jykg3k4jniWuqp4z+QKSKciOBnHLKwz7m4=; b=OtEHZfHaCVM+a40OMMW5M04OpKOseuWZKgu3OsravYrr2LNfmrrA0bbnwqI50c6ekYNSbCgdjPDIu+G3aA+pSSW8bHgUjbSuvjbapAPR/AaU1j4watMdSrKbQNiFyOehDI2C1pJ36ZdFSDNd6e3w2rSjP+Ni8mx496JdjW54w6g= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB4609.eurprd04.prod.outlook.com (52.135.144.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.13; Fri, 12 Apr 2019 07:55:00 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::dc63:432c:eb4b:8d1b]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::dc63:432c:eb4b:8d1b%3]) with mapi id 15.20.1792.016; Fri, 12 Apr 2019 07:55:00 +0000 From: Peng Fan To: "sbabic@denx.de" , "festevam@gmail.com" Thread-Topic: [PATCH 4/8] misc: imx8: add sc_misc_get_temp Thread-Index: AQHU8QUHSlB2pKERjUGyIl06Rxr4wA== Date: Fri, 12 Apr 2019 07:55:00 +0000 Message-ID: <20190412080741.32412-4-peng.fan@nxp.com> References: <20190412080741.32412-1-peng.fan@nxp.com> In-Reply-To: <20190412080741.32412-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: HK2PR03CA0045.apcprd03.prod.outlook.com (2603:1096:202:17::15) 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: b84423f6-e09e-423f-5ea3-08d6bf1c29e0 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR04MB4609; x-ms-traffictypediagnostic: AM0PR04MB4609: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(396003)(376002)(346002)(189003)(199004)(66066001)(36756003)(446003)(3846002)(386003)(106356001)(4326008)(5660300002)(97736004)(71200400001)(6506007)(71190400001)(14454004)(53936002)(50226002)(1076003)(25786009)(256004)(105586002)(68736007)(8936002)(7736002)(44832011)(81156014)(54906003)(6116002)(11346002)(76176011)(8676002)(478600001)(6436002)(305945005)(6512007)(110136005)(26005)(2501003)(476003)(52116002)(2906002)(81166006)(2616005)(6486002)(102836004)(316002)(486006)(99286004)(86362001)(186003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4609; 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: 5vp6TxwXqGL515k2Wc3vE85kuuUB/pPOBK9qVhaOmjsrjEnx0jk9XujWDY8PGy+hAxsV36HU+RRO/R+XvNK3RF8u2miA0cp7Ce+BoEjGYLBM5QXmKcEaR2MkbW+UpKLrQkpzdIsFFdgk1z0Knn3ViDtmlPyvSTBHpTsxlMpR0ujoG+DuZdRVhCd9eAv9WWjuQ/LrmGuaIizVnpD4CvBoZQercMy9MWmbEGq30Pt7jxeoAJ8y9xodp9GWQzv6+UPMuMgE/+JKM/sjgXIEanBJZvNrHGu2DZMpSI0bF/5FoFZX6lCRWtcFNjTH4ukNqbEExmwjF0DCuq2D5NCIf80qaiUcBSu0VQgmO3sl8YMpFzKMGuO/hLGrrTXs4mVqchykcn9fAV3b5g7NNeBxCaAWWxOcBODZzSZefMn/nKdulLk= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b84423f6-e09e-423f-5ea3-08d6bf1c29e0 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 07:55:00.4575 (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: AM0PR04MB4609 Cc: "u-boot@lists.denx.de" , dl-uboot-imx Subject: [U-Boot] [PATCH 4/8] 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 --- 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 d1621669e2..ccf45d71f7 100644 --- a/arch/arm/include/asm/arch-imx8/sci/sci.h +++ b/arch/arm/include/asm/arch-imx8/sci/sci.h @@ -76,6 +76,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) {