From patchwork Wed Feb 13 03:08:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 10809039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15C12922 for ; Wed, 13 Feb 2019 03:09:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01BED2B982 for ; Wed, 13 Feb 2019 03:09:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8B2E2B985; Wed, 13 Feb 2019 03:09:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8792D2B982 for ; Wed, 13 Feb 2019 03:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=nSfko8tab2pNAWJahdB9XDp5cPva1Dmt28MARVJ2l4c=; b=DOgx2lL0H2JDB+ ewa1u2A2eQUFWsSxz8BTVUTYcTmaWckNWDQg62rg0MSctxVHKoZxG8CJ9UtLmJuZqbHfFKNFbRZkV pT7SVuFJBPEhXVLPrXubYhUni40sDR6DUwapMS1lsD+ElWaASLkie8HUWIYOrAzZRpf5aQZ9+lF42 8Flvu7RnuA5p+4nPuc6cuo5Loa7vM4kqzIOabTZN4gaG6B8uF/g0an1M68aO/qN/QHXEi5DaFB+ZA HGeH8UjgkVnuZupXMCIjKOJL8qjCXYA/PLXzYwcUzxYRzXlJMwrlXbrT47c/pmsvtdttRYXpJ+3EX /8vUpz7+8fA4CrmPoIAw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtkv4-0004g5-Uk; Wed, 13 Feb 2019 03:09:06 +0000 Received: from mail-db5eur03on0605.outbound.protection.outlook.com ([2a01:111:f400:fe0a::605] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtkv0-0004f8-VM for linux-arm-kernel@lists.infradead.org; Wed, 13 Feb 2019 03:09:04 +0000 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=9hadABVmIenAV+K4vIKEUEa78OqsP9peJGF1D2CDyp8=; b=IGaPIEqDPRZBTJyVqiP03OMNq5ZoCVa9Wal4nyHoFrZlI06WPGnTlXK2i3U4dkAPbmdKgLGwk4EB78UxCGJOdxtH9au8uhhf3zlil/1c2sswxKOhswNdIPedGozizpGCdHt7z23eqIDAuYLm23wsqstjs3q+IuEsH/fiUZ3Faw4= Received: from DB3PR0402MB3916.eurprd04.prod.outlook.com (52.134.72.18) by DB3PR0402MB3724.eurprd04.prod.outlook.com (52.134.66.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.22; Wed, 13 Feb 2019 03:08:58 +0000 Received: from DB3PR0402MB3916.eurprd04.prod.outlook.com ([fe80::14e8:6d2e:fe21:4fd5]) by DB3PR0402MB3916.eurprd04.prod.outlook.com ([fe80::14e8:6d2e:fe21:4fd5%3]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 03:08:58 +0000 From: Anson Huang To: "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "rjw@rjwysocki.net" , "viresh.kumar@linaro.org" , Aisheng Dong , Daniel Baluta , Andy Gross , "horms+renesas@verge.net.au" , "heiko@sntech.de" , "arnd@arndb.de" , "bjorn.andersson@linaro.org" , "jagan@amarulasolutions.com" , "enric.balletbo@collabora.com" , "marc.w.gonzalez@free.fr" , "olof@lixom.net" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" Subject: [PATCH 1/3] arm64: dts: freescale: imx8qxp: add cpu opp table Thread-Topic: [PATCH 1/3] arm64: dts: freescale: imx8qxp: add cpu opp table Thread-Index: AQHUw0l12uqkL+fgkEG7l0YedIa+eQ== Date: Wed, 13 Feb 2019 03:08:57 +0000 Message-ID: <1550027011-7884-1-git-send-email-Anson.Huang@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0150.apcprd02.prod.outlook.com (2603:1096:202:16::34) To DB3PR0402MB3916.eurprd04.prod.outlook.com (2603:10a6:8:10::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anson.huang@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0402MB3724; 6:zzCViibVj+AhkDg2jsl+/AZS6YPZFrJOrCypKpwsyHhanoe/EpQEX6tLTW/H9FlPwhhY7PA22P3em4DHVX5n8+W14aeRGwRO3KEGqpZxkMZ93SB8EWR3WYgeRF8G5g6B/tuqrXKQfjwxYRukyNpyoRTY8UiS/vRWlIgiO9UBvzXqW1+Uscs0rXXmtVwzZ1qsjO+NRFdJrc4rWmYfNUtqVZmAbh9OXrfuxDlI9D/8pdFI7xC1URX3hH5uau3BWpAALBxz11JZX2TeoM8UsPetUeSJy3p+bRdgTXQ7QTY4jYEhTs5hiHDSpAGwp2hsKTNFnNhf2DOtDpGwiULfVgj/xwBEidRPifPpKQDaWebP2GPSCLXjJ92y2AZgJvDtNIKCkcEXeC43oNwdnarRCWDZ9KTsVqDR1VNoG6qGB+j8dU/HB4FMBA+kK1iIbwIjbnJSAd4OE5TBdrQi5d13zxWqOw==; 5:5qwcRVnEmx4XDaGS5HLuYp9RxFeRwT3DSZKbulellllyFsoEigyYMyX2lweQndBjN3vjYveNVgVlW927nNdiY5eTGiExv/BC/+LXTapgxhByVSffS+yJpsYNLlJxeKflWBSIG9kPwJ/HDZ0g5c9l+movoZbOp7MvIHLqmhu69XGF5q2CAhMhmhQNIVw/6r2tmFvGdTGjV4R8m/vYlOdt2g==; 7:FEvz7j2rHTfYyckN2emi/6+rp54CCXxHrJtgut4d8qd9gPI9XMhz7/rs2B6paaXZdbiEbz0q7mlyGvEwyAOy0/+ug/zhgsPUxvSJ5kF5ksDZVSB44Jti7LxRUZXxFzHV9LbmGIzDWZ2zjt4Li122lQ== x-ms-office365-filtering-correlation-id: 22ffc791-f02c-4ca4-db71-08d69160980e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0402MB3724; x-ms-traffictypediagnostic: DB3PR0402MB3724: x-ld-processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(396003)(39860400002)(136003)(199004)(189003)(50226002)(97736004)(81166006)(81156014)(8676002)(7736002)(110136005)(305945005)(2906002)(256004)(52116002)(8936002)(476003)(486006)(2616005)(99286004)(3846002)(7416002)(6116002)(71200400001)(71190400001)(86362001)(36756003)(26005)(53936002)(478600001)(68736007)(386003)(2501003)(14454004)(186003)(102836004)(6506007)(2201001)(316002)(66066001)(4326008)(105586002)(6512007)(106356001)(25786009)(6486002)(4744005)(6436002)(32563001)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0402MB3724; H:DB3PR0402MB3916.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: agodWra/oj/qDBzTR6IjzZ/bchzWsl90BfIaiMmKpMOVy2JXEb+X2Rc3/KiR4pgIV9QUQkIVCjYFXfJSY5ArxsMSTyODN/G/ii6DSwLNSz6CwhVnS2yvOcjJpYNl85WTDVEhRnUHabKWxUlqpVqJfH+/X4DyCi3G8BYcH8axFvC6FbFnX/o3HfXn0RffUA7/19s5RQ8Iui2FTLICGYVX1066/r/Cx9GfyHwik11QH6o0BYeATwvAxUl1k3Km1DVcF7egZ0yObl1dSFwRJj0lXleddtAffbxKm3I8UYFZNure4nfxguY3tQKP496tVvAb/xUUafXt5wIEWz5V1gAKzVlZdvYfcaqKK0uu9OZyaKRIl2SpsIL2p7oPEBMKdvQ5xYYPY3Rehm0m86voqrK06NNufbY0dyGUb1Ke2UWWeIA= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22ffc791-f02c-4ca4-db71-08d69160980e X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 03:08:49.6780 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3724 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_190903_379497_A6352F40 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dl-linux-imx Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add i.MX8QXP CPU opp table to support cpufreq. Signed-off-by: Anson Huang --- arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi index 4c3dd95..3c27975 100644 --- a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi @@ -34,6 +34,14 @@ reg = <0x0 0x0>; enable-method = "psci"; next-level-cache = <&A35_L2>; + operating-points = < + /* kHz uV*/ + 1200000 1100000 + 900000 1000000 + >; + clocks = <&clk IMX_A35_CLK>; + clock-latency = <61036>; + #cooling-cells = <2>; }; A35_1: cpu@1 { From patchwork Wed Feb 13 03:09:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 10809043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB27F1399 for ; Wed, 13 Feb 2019 03:09:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D79D32BEC9 for ; Wed, 13 Feb 2019 03:09:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9F5F2BEDC; Wed, 13 Feb 2019 03:09:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D8062BEC9 for ; Wed, 13 Feb 2019 03:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ntWTAmyJbq1taKmyRAMy6l2dLKvJy6appygTkkNnZWI=; b=YN6u1zzTEk2Ofj ln0Sbrkp7dABJZM/BKT0IvnA2A9SrkZ31QVdghcDPihmNRNA8FJk7Fdf1NIq07nITRbn+rATM5Iua CttSPwSDjnKXbrX0Ho0AbkUgxIpY8lb5OO7vylc2/DecnFZe/bnSVpq8PoV1m1hwKuUdH+zimhwxz lCPhMD3ZojRj3MNUj6PhxkDFWldbgQRtm+B951UNcUh+r5L5BQsa98t++1UBnKK7p1pPAfYCuI9yN bBpAWixE878EilcV29sYuzn6JQhwlITeM6QREPW5s62K+04sBg4fFl2lmkeJGOLbJaxuh4wfYZ0iN nXoD9CzC+Y/KktpYBSPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtkvG-0004sO-Od; Wed, 13 Feb 2019 03:09:18 +0000 Received: from mail-eopbgr40043.outbound.protection.outlook.com ([40.107.4.43] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtkv8-0004hz-KY for linux-arm-kernel@lists.infradead.org; Wed, 13 Feb 2019 03:09:16 +0000 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=qX4Bdyv8t29fkm1tyactRlK1QolTiPnV9764JFgkFCY=; b=ax34OQEeK0sUnzcaKauS17Epo3AJRTBJhLAE4xlK5Ap1twFU7FwA+eUxzH9IEaM/Lv877tTpmvzu+AOa/+ZgRx/FBhHQRgA7O/Kf8d+kQc9vNdPbPGuRJUS4vdy0dHfIQgtfbKaZTSGcd2hay9SLdZSmevNdfrYtjX+4KC5akTE= Received: from DB3PR0402MB3916.eurprd04.prod.outlook.com (52.134.72.18) by DB3PR0402MB3724.eurprd04.prod.outlook.com (52.134.66.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.22; Wed, 13 Feb 2019 03:09:07 +0000 Received: from DB3PR0402MB3916.eurprd04.prod.outlook.com ([fe80::14e8:6d2e:fe21:4fd5]) by DB3PR0402MB3916.eurprd04.prod.outlook.com ([fe80::14e8:6d2e:fe21:4fd5%3]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 03:09:07 +0000 From: Anson Huang To: "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "rjw@rjwysocki.net" , "viresh.kumar@linaro.org" , Aisheng Dong , Daniel Baluta , Andy Gross , "horms+renesas@verge.net.au" , "heiko@sntech.de" , "arnd@arndb.de" , "bjorn.andersson@linaro.org" , "jagan@amarulasolutions.com" , "enric.balletbo@collabora.com" , "marc.w.gonzalez@free.fr" , "olof@lixom.net" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" Subject: [PATCH 2/3] arm64: defconfig: enable i.mx system controller cpufreq Thread-Topic: [PATCH 2/3] arm64: defconfig: enable i.mx system controller cpufreq Thread-Index: AQHUw0l7rOnduRgAhU2afJW6/pvR2A== Date: Wed, 13 Feb 2019 03:09:07 +0000 Message-ID: <1550027011-7884-2-git-send-email-Anson.Huang@nxp.com> References: <1550027011-7884-1-git-send-email-Anson.Huang@nxp.com> In-Reply-To: <1550027011-7884-1-git-send-email-Anson.Huang@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0150.apcprd02.prod.outlook.com (2603:1096:202:16::34) To DB3PR0402MB3916.eurprd04.prod.outlook.com (2603:10a6:8:10::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anson.huang@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0402MB3724; 6:2gnHvycJRcAfD0UX42RLf+AH4RU4EEi9PGcUWxofe1ad/f/VUFLympfvwBQKhjflIqqcrgoIPVdJ95HOAlyfeYZLvSjOjzgylFC8Bmegr44lQy5uvszamePLhhFmEkH36wmzc35ysJf7yS5tBTFXgvOxsuykS+kRnUrGhTX4aTe0F2paMnCqc5vZ73IHgwXqSCF5bhGpc0fMWKPT/25Wq3+dq4PRQarzLgFY/rRNaeQO46Ze0ekxAnSXwzAa3U8zIVpcrYkc1J89mwxQ7PApmcXuWps/b8wO2M4aQVkXXmToQptK0HX96dBSK85OaBvlhz1Ym+/Xpi+bsDstc4CkNVkBRqLfWgh9ymkxX0urWG/OZQt+kHQRvMQqE23NggBQ/V1XHFGt+YkvsHT15i4ml8rPrR+010DaR7gkrfbYlN9flyZ4ajDKY+Ucvnuhqjq0ZBbYv8nTUYLn0O94NA/Hjw==; 5:vTcZyiNbo501OzK3WA6BZEglifLhG/6e9SES6sgKsIrkx+Ifoe/C2bb3oQ0LF5X9JrwwPpNHWn74LT1uV55j8+0TsEi/DKNW+xzapthOnw3M7JZlHxiMJM+Xe9ZnwHvOubE1a+HupTnirYgnYVyWRSIROkMwISziSaVGQ6KMyBSV4S5zhfdb/wHbkUyPmbawXrOI+wxU6flcohbQqe3mVQ==; 7:8zf+7heMy9EcArEUGg47IS7Hple3SpWV+Rg14eE5Jvbk843qy4cZeyDgWOB48EO4kLOeHeY+PYMJAS1RyYB6OuyiPaoA4xU44t/wuXY9DBgEX4PXLYb/qQFMfKsM1A1/A5qixyQ2AQlg+LrJPAZ49A== x-ms-office365-filtering-correlation-id: 132d41a1-7d68-4a70-ec29-08d691609d82 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0402MB3724; x-ms-traffictypediagnostic: DB3PR0402MB3724: x-ld-processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(396003)(39860400002)(136003)(199004)(189003)(50226002)(97736004)(81166006)(81156014)(8676002)(7736002)(110136005)(446003)(305945005)(2906002)(256004)(52116002)(8936002)(476003)(486006)(2616005)(99286004)(11346002)(3846002)(7416002)(6116002)(71200400001)(71190400001)(86362001)(36756003)(26005)(53936002)(478600001)(68736007)(386003)(2501003)(14454004)(186003)(102836004)(6506007)(2201001)(76176011)(316002)(66066001)(4326008)(105586002)(6512007)(106356001)(25786009)(6486002)(4744005)(6436002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0402MB3724; H:DB3PR0402MB3916.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: ayw7x0eRbsq/tzsmMySnjEVe9/0CQRb9u+UFlUjXDuvmtz3YjYBEyXxrafKqbs9mBhGm/SNlqYnaraP2mFxmmkk5TZNBgXLiEp1zW0AOgROKBNA7WB/VUg1UJLypzAx9mvGEf7Mp+rfys6xqf5v/5iuZUgbKoR6Q5Oh4c5Wu0cGheUSf+5BLWdYB2FDNXiiHB0AO5f+w4CgVX09MuW43cuWthAkKVSNKzgJAlDvqKfgMgHWOiB5p8ipA+woZEP6Cl8zEDffgymv+tJjuCckX9GmvCcywTRFEPxd7X+x4dH6awMEtHpC0LGdvlCVG8bN3Sy0W+8fk29gUXUIvHascEbKM5l+BNKYGO465WoNHtOFQulj89H9IgsoWqJfhwVOpxMs4IdL2EoIOHoOqMkT5j7VFFTtblCgwfT5QNeEN2gs= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 132d41a1-7d68-4a70-ec29-08d691609d82 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 03:08:58.5400 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3724 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_190911_619525_E35DDDE1 X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dl-linux-imx Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Select CONFIG_ARM_IMX_SC_CPUFREQ by default to support i.MX system controller cpufreq driver. Signed-off-by: Anson Huang --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 2d9c390..3a940ae 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -109,6 +109,7 @@ CONFIG_CPUFREQ_DT=y CONFIG_ACPI_CPPC_CPUFREQ=m CONFIG_ARM_ARMADA_37XX_CPUFREQ=y CONFIG_ARM_SCPI_CPUFREQ=y +CONFIG_ARM_IMX_SC_CPUFREQ=y CONFIG_ARM_TEGRA186_CPUFREQ=y CONFIG_ARM_SCPI_PROTOCOL=y CONFIG_RASPBERRYPI_FIRMWARE=y From patchwork Wed Feb 13 03:09:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 10809051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2019922 for ; Wed, 13 Feb 2019 03:09:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDD252BEC9 for ; Wed, 13 Feb 2019 03:09:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1D812BEDC; Wed, 13 Feb 2019 03:09:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 088FA2BEC9 for ; Wed, 13 Feb 2019 03:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L32o7yu/FWbK0dmCp8Zk8o+zfBoUhJOQw3hiU60jr8c=; b=HhbwPo12XeCQwK X/EHCt63RSVo0/cqyaqQGHZmxJYGN+W5G5AUDROtpUqVlCr0t/u4XL8RWsMjy9PyJSWNZzG4k3oiP x8ml04cUC3U9DGA0DO6w9PLAvxArt4wOHOlZJ+ju4tHXN4XttR5eOMa3xyYTrQnd4SZxAuaMErE+L 3NJMZd19564bZvUa6bVYTPiXTZYxXxR7fdXM6fCQC6tGUifb8zUuz41lukmuMzEBAe39rh10Kr98X YO48o5NwD5rHi2rJg1wJTYwAm3pUSJt9sjWc4239tJS+WVz4STX4AsTe1BWCYzX08e30EknoK9PMf 2URKLOaNbjwGY3SdJcFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtkve-0005EW-M3; Wed, 13 Feb 2019 03:09:42 +0000 Received: from mail-eopbgr40084.outbound.protection.outlook.com ([40.107.4.84] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtkvO-0004zJ-Nq for linux-arm-kernel@lists.infradead.org; Wed, 13 Feb 2019 03:09:37 +0000 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=ESTAN2xODOVRrMPO0gHEyfekXMIGo93RGB9zhn3yZwc=; b=l4wjwtPQaDIAWtW3zKWzNdKGX7NarNVrsLbELD5Ta9gbX1tafPUdqn1WA4SJcSe8onvk0r7v3G9r1dumvQmEhgqPDmkmOPnjV70y+PUF8yq9FVlDk3sg95tTIgxIIUlZltQ2LWYF/b+bhopvavF4wSKiVNaCdJdX15N/GyogCnM= Received: from DB3PR0402MB3916.eurprd04.prod.outlook.com (52.134.72.18) by DB3PR0402MB3724.eurprd04.prod.outlook.com (52.134.66.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.22; Wed, 13 Feb 2019 03:09:15 +0000 Received: from DB3PR0402MB3916.eurprd04.prod.outlook.com ([fe80::14e8:6d2e:fe21:4fd5]) by DB3PR0402MB3916.eurprd04.prod.outlook.com ([fe80::14e8:6d2e:fe21:4fd5%3]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 03:09:15 +0000 From: Anson Huang To: "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "rjw@rjwysocki.net" , "viresh.kumar@linaro.org" , Aisheng Dong , Daniel Baluta , Andy Gross , "horms+renesas@verge.net.au" , "heiko@sntech.de" , "arnd@arndb.de" , "bjorn.andersson@linaro.org" , "jagan@amarulasolutions.com" , "enric.balletbo@collabora.com" , "marc.w.gonzalez@free.fr" , "olof@lixom.net" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" Subject: [PATCH 3/3] cpufreq: imx-sc: add i.mx system controller cpufreq support Thread-Topic: [PATCH 3/3] cpufreq: imx-sc: add i.mx system controller cpufreq support Thread-Index: AQHUw0mAk7D4InMTwEi38x/B8uOIAw== Date: Wed, 13 Feb 2019 03:09:15 +0000 Message-ID: <1550027011-7884-3-git-send-email-Anson.Huang@nxp.com> References: <1550027011-7884-1-git-send-email-Anson.Huang@nxp.com> In-Reply-To: <1550027011-7884-1-git-send-email-Anson.Huang@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0150.apcprd02.prod.outlook.com (2603:1096:202:16::34) To DB3PR0402MB3916.eurprd04.prod.outlook.com (2603:10a6:8:10::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anson.huang@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0402MB3724; 6:AoEyeCor673jgWKrFPJoIPWzaF59eOY8c0d+waDbGboqphftwrUN87TzpZI8PjjDq4Bd8G8RzjUC5esKwT1ofEwPBBEs+LON5RbBoU7z5IxQTOqvIfPOZ0Abdp2psfqq6dAGy2SgDLzCZ+3JpQfNq2qsF0Vci3Uy7xkgIlwegjQXHz09XyP1xouvRbL2EmcLHo2uAoiyTCv4PhYQ2vWIxDSTK7bag8ww6nkhRo8Pi/YU7AfWO6xHD5Gsefsu/qW5Ru9TIpMi+rGzAwEAONP8H3macsbxfB9FDdUyoY1fq5XJRLFekeDRVcEkG272KTFNDLYIlmfZDYgtPgcpimg0glZ05D5WSvMEjh8oLgCdy6Gd0f8TXy9rJUys5aZ0EuOwMSw52FHL6DXuOef80gvqzs9rQWhUctMyduPTHnikB/yC7OABPzMIPt7CHB6qbh6zSp646Sit3rbrFpsCEIpxfw==; 5:YF6A17F3y1+0FDbZ+c0Sp1Pwk3iUyRY7nkqH+mxRjPcGS4xZ0gRGiiMJidlAoutWY7m/6bNil7hPaEIrMpm6LThK7XtgIb/FxmXrXcBwBneCF9aAifM6mfB6ABxPTthGzosMAgYCDGCjPeE4cB09IRfEQDRWcMvtZoPBTNGDdFGd98f6GCvg3HHp/LTYNkfzC1Lj22UEtJqCpGvzC+9rdA==; 7:Yp3WaPRa48bUqGWgznMteLy4qFXk9jkY0CIgVjjFuKhFusbibkkVbUJi/09XOpPuszEuBpQfznaYM94iQabEacNmoLRVMwf8IvqeCaBsDVYr3KiZshRfZvKtc4S2131+qMRhNjqYQB8aQ0kF4TfHiw== x-ms-office365-filtering-correlation-id: 5fd999be-9608-4a72-f87f-08d69160a29d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0402MB3724; x-ms-traffictypediagnostic: DB3PR0402MB3724: x-ld-processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(396003)(39860400002)(136003)(199004)(189003)(50226002)(97736004)(81166006)(81156014)(8676002)(7736002)(110136005)(446003)(305945005)(2906002)(256004)(52116002)(8936002)(476003)(486006)(2616005)(99286004)(11346002)(3846002)(14444005)(7416002)(6116002)(71200400001)(71190400001)(86362001)(36756003)(26005)(53936002)(478600001)(68736007)(386003)(2501003)(14454004)(186003)(102836004)(6506007)(2201001)(76176011)(316002)(66066001)(4326008)(105586002)(6512007)(106356001)(25786009)(6486002)(6436002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0402MB3724; H:DB3PR0402MB3916.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: Adlm22p5rshd/trynX8g4zOyTtQfA3hx7V8+zj6wf9NQtmyxuhdDY4XWl8PEs3kN/5JlQmJxH/ktft9CdpqUW4GFpD3xRGQG8SVDqPGfwOXnyJPNLknLuLQAl6gFpG8vmnc2gbVFGH/cfats3ZeApzm1Dg2T+bu0+JW0wHUxLExu3D988RHNTrSnBF+8h2qxOd7xpRq+7j1az/A4NMM7YiLAIxMeVlfRQBIz9v4fb2N1s/Yeu2d1puJgIh8UP3OscINLYxFL45rEfVN7GaYyexVmmtSvdLPFj/EOUd7KHl8vv+HWqtJuQvispo4Pzm8rUp0al9ffgPJNJ56MCuc+Vwy8D8dukXuvfZ1SQ/AJ+q7DWG55t12DqjWyRyPuMhEU1BpHqmppUZ5V1TG9Grwrj5O89/GCaibdTAc2bqOuwl0= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fd999be-9608-4a72-f87f-08d69160a29d X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 03:09:07.3710 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3724 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_190927_324430_9F91D544 X-CRM114-Status: GOOD ( 19.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dl-linux-imx Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On NXP's i.MX SoCs with system controller inside, CPU frequency scaling can ONLY be done by system controller firmware, and it can ONLY be requested from secure mode, so Linux cpufreq driver has to call ARM SMC to trap to ARM-Trusted-Firmware to request system controller firmware to do CPU frequency scaling. This patch adds i.MX system controller cpufreq driver support, when doing CPU frequency scaling, cpufreq driver will do ARM SMC call and trap to ARM-Trusted-Firmware, then SIP(silicon provider) service will communicate with system controller for CPU frequenct scaling. Signed-off-by: Anson Huang --- drivers/cpufreq/Kconfig.arm | 9 ++ drivers/cpufreq/Makefile | 1 + drivers/cpufreq/imx-sc-cpufreq.c | 183 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 193 insertions(+) create mode 100644 drivers/cpufreq/imx-sc-cpufreq.c diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 179a1d3..6d76465 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -92,6 +92,15 @@ config ARM_IMX6Q_CPUFREQ If in doubt, say N. +config ARM_IMX_SC_CPUFREQ + tristate "NXP i.MX SoC system controller cpufreq support" + select PM_OPP + help + This adds cpufreq driver support for NXP i.MX series SoCs with system + controller inside. + + If in doubt, say N. + config ARM_KIRKWOOD_CPUFREQ def_bool MACH_KIRKWOOD help diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 689b26c..28ab9fb 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile @@ -56,6 +56,7 @@ obj-$(CONFIG_ACPI_CPPC_CPUFREQ) += cppc_cpufreq.o obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ) += highbank-cpufreq.o obj-$(CONFIG_ARM_IMX6Q_CPUFREQ) += imx6q-cpufreq.o +obj-$(CONFIG_ARM_IMX_SC_CPUFREQ) += imx-sc-cpufreq.o obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ) += kirkwood-cpufreq.o obj-$(CONFIG_ARM_MEDIATEK_CPUFREQ) += mediatek-cpufreq.o obj-$(CONFIG_MACH_MVEBU_V7) += mvebu-cpufreq.o diff --git a/drivers/cpufreq/imx-sc-cpufreq.c b/drivers/cpufreq/imx-sc-cpufreq.c new file mode 100644 index 0000000..dfc89abe --- /dev/null +++ b/drivers/cpufreq/imx-sc-cpufreq.c @@ -0,0 +1,183 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2017-2019 NXP. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_CLUSTER 1 + +#define IMX_SIP_CPUFREQ 0xC2000001 +#define IMX_SIP_SET_CPUFREQ 0x00 + +struct imx_sc_cpufreq { + struct device *cpu_dev; + struct clk *cpu_clk; +}; + +static struct cpufreq_frequency_table *freq_table[MAX_CLUSTER]; +static struct imx_sc_cpufreq cluster_freq[MAX_CLUSTER]; +static unsigned int transition_latency[MAX_CLUSTER]; +static DEFINE_SPINLOCK(cpufreq_psci_lock); + +static int imx_sc_cpufreq_set_target(struct cpufreq_policy *policy, + unsigned int index) +{ + unsigned int cluster_id = topology_physical_package_id(policy->cpu); + unsigned int old_freq, new_freq; + struct arm_smccc_res res; + + new_freq = freq_table[cluster_id][index].frequency; + old_freq = policy->cur; + + dev_dbg(cluster_freq[cluster_id].cpu_dev, "%u MHz --> %u MHz\n", + old_freq / 1000, new_freq / 1000); + + spin_lock(&cpufreq_psci_lock); + arm_smccc_smc(IMX_SIP_CPUFREQ, IMX_SIP_SET_CPUFREQ, + cluster_id, new_freq * 1000, 0, 0, 0, 0, &res); + spin_unlock(&cpufreq_psci_lock); + + return 0; +} + +static int imx_sc_cpufreq_init(struct cpufreq_policy *policy) +{ + int cluster_id = topology_physical_package_id(policy->cpu); + int opp_num, ret = 0; + + policy->clk = cluster_freq[cluster_id].cpu_clk; + policy->cur = clk_get_rate(cluster_freq[cluster_id].cpu_clk) / 1000; + cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); + + policy->freq_table = freq_table[cluster_id]; + policy->cpuinfo.transition_latency = transition_latency[cluster_id]; + opp_num = dev_pm_opp_get_opp_count(cluster_freq[cluster_id].cpu_dev); + policy->suspend_freq = freq_table[cluster_id][opp_num - 1].frequency; + + dev_info(cluster_freq[cluster_id].cpu_dev, + "cluster %d running at freq %d MHz, suspend freq %d MHz\n", + cluster_id, policy->cur / 1000, policy->suspend_freq / 1000); + + return ret; +} + +static struct cpufreq_driver imx_sc_cpufreq_driver = { + .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_IS_COOLING_DEV, + .verify = cpufreq_generic_frequency_table_verify, + .target_index = imx_sc_cpufreq_set_target, + .get = cpufreq_generic_get, + .init = imx_sc_cpufreq_init, + .name = "imx-sc-cpufreq", + .attr = cpufreq_generic_attr, +#ifdef CONFIG_PM + .suspend = cpufreq_generic_suspend, +#endif +}; + +static int imx_sc_cpufreq_probe(struct platform_device *pdev) +{ + struct imx_sc_ipc *cpufreq_ipc_handle; + struct device *cpu_dev; + struct device_node *np; + int cluster_id, ret = 0; + + /* wait mailbox driver ready */ + ret = imx_scu_get_handle(&cpufreq_ipc_handle); + if (ret) + return ret; + + cpu_dev = get_cpu_device(0); + if (!cpu_dev) { + pr_err("failed to get cpu device 0\n"); + return -ENODEV; + } + + np = of_node_get(cpu_dev->of_node); + if (!np) { + pr_warn("failed to find cpu 0 node\n"); + return -ENODEV; + } + + ret = dev_pm_opp_of_add_table(cpu_dev); + if (ret < 0) { + dev_err(cpu_dev, "failed to init OPP table: %d\n", ret); + goto put_node; + } + + cluster_id = topology_physical_package_id(0); + cluster_freq[cluster_id].cpu_dev = cpu_dev; + cluster_freq[cluster_id].cpu_clk = devm_clk_get(cpu_dev, NULL); + if (IS_ERR(cluster_freq[cluster_id].cpu_clk)) { + dev_err(cpu_dev, "failed to get cluster %d clock\n", + cluster_id); + ret = -ENOENT; + goto put_node; + } + + ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table[cluster_id]); + if (ret) { + dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); + goto out_free_opp; + } + + if (of_property_read_u32(np, "clock-latency", + &transition_latency[cluster_id])) + transition_latency[cluster_id] = CPUFREQ_ETERNAL; + + ret = cpufreq_register_driver(&imx_sc_cpufreq_driver); + if (ret) { + dev_err(cpu_dev, "failed to register cpufreq driver: %d\n", + ret); + goto free_freq_table; + } + + goto put_node; + +free_freq_table: + dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table[cluster_id]); +out_free_opp: + dev_pm_opp_of_remove_table(cpu_dev); +put_node: + of_node_put(np); + return ret; +} + +static int imx_sc_cpufreq_remove(struct platform_device *pdev) +{ + cpufreq_unregister_driver(&imx_sc_cpufreq_driver); + + return 0; +} + +static int __init imx_sc_register_cpufreq(void) +{ + platform_device_register_simple("imx-sc-cpufreq", -1, NULL, 0); + + return 0; +} +device_initcall(imx_sc_register_cpufreq); + +static struct platform_driver imx_sc_cpufreq_platdrv = { + .driver = { + .name = "imx-sc-cpufreq", + }, + .probe = imx_sc_cpufreq_probe, + .remove = imx_sc_cpufreq_remove, +}; +module_platform_driver(imx_sc_cpufreq_platdrv); + +MODULE_AUTHOR("Anson Huang "); +MODULE_DESCRIPTION("NXP i.MX system controller cpufreq driver"); +MODULE_LICENSE("GPL");