From patchwork Tue Jun 11 17:58:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 10987995 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 F384213AF for ; Tue, 11 Jun 2019 17:59:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3DCE27FA8 for ; Tue, 11 Jun 2019 17:59:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D76CD28628; Tue, 11 Jun 2019 17:59:04 +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=unavailable 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 6F2A927FA8 for ; Tue, 11 Jun 2019 17:59:04 +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=MPeAbhLlt0B8JMlh9gYxA+dpCWc11SwB20YArbF2v2Q=; b=BM2WPBcV5CqN8R LlcEC2WQS5xMC9d8skjt3mIPcCYUrX9DXhbRaWYvEiKrfySMNfu6ocDZ/wAz5QGPM8DLH0rm7VRgF GICh18oS2vs6FE2w0EdVx42ziDUEfaUlpKj1RC3XVUdCGPBSx0DN9fnnplq1P2GUfgM9z2lc256Mq rGhTAYdJMOT0BJy+tuZQ6Rz+Y3LxttUQKhB0M/r+3CUYblqvgFY4GVpyEyUxmKwZ+rfqgA7I0XpIg zoWtrcBLuZvEqSQvRtgp7X4BHsytO4JG5ws9blYPo9Pi6PW2Cf0teTd6YZ6y3V0cIPtl/WAUGRh9O YQwDGlhpY4CGkZl8LuxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hal2x-00071J-7v; Tue, 11 Jun 2019 17:58:59 +0000 Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hal2s-0006y5-3d; Tue, 11 Jun 2019 17:58:55 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9685EABE1; Tue, 11 Jun 2019 17:58:50 +0000 (UTC) From: Nicolas Saenz Julienne To: stefan.wahren@i2se.com, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/7] cpufreq support for Raspberry Pi Date: Tue, 11 Jun 2019 19:58:32 +0200 Message-Id: <20190611175839.28351-1-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190611_105854_299635_2D6FB12C X-CRM114-Status: GOOD ( 12.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, f.fainelli@gmail.com, ptesarik@suse.com, sboyd@kernel.org, viresh.kumar@linaro.org, mturquette@baylibre.com, linux-pm@vger.kernel.org, rjw@rjwysocki.net, eric@anholt.net, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Nicolas Saenz Julienne , linux-clk@vger.kernel.org, mbrugger@suse.de, ssuloev@orpaltech.com 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 Hi all, this aims at adding cpufreq support to the Raspberry Pi family of boards. The series first factors out 'pllb' from clk-bcm2385 and creates a new clk driver that operates it over RPi's firmware interface[1]. We are forced to do so as the firmware 'owns' the pll and we're not allowed to change through the register interface directly as we might race with the over-temperature and under-voltage protections provided by the firmware. Next it creates a minimal cpufreq driver that populates the CPU's opp table, and registers cpufreq-dt. Which is needed as the firmware controls the max and min frequencies available. This was tested on a RPi3b+ and RPI2b, both using multi_v7_defconfig and arm64's defconfig. That's all, kind regards, Nicolas [1] https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface --- Changes since v2: - Fixed configs to match Stefan's comments - Round OPP frequencies - Rebase onto linux-next - Minor cleanups & checkpatch.pl Changes since v1: - Enabled by default on the whole family of devices - Added/Fixed module support - clk device now registered by firmware driver - raspberrypi-cpufreq device now registered by clk driver - Reimplemented clk rounding unsing determine_rate() - Enabled in configs for arm and arm64 Changes since RFC: - Move firmware clk device into own driver Nicolas Saenz Julienne (7): clk: bcm2835: remove pllb clk: bcm283x: add driver interfacing with Raspberry Pi's firmware firmware: raspberrypi: register clk device cpufreq: add driver for Raspbery Pi clk: raspberrypi: register platform device for raspberrypi-cpufreq ARM: defconfig: enable cpufreq driver for RPi arm64: defconfig: enable cpufreq support for RPi3 arch/arm/configs/bcm2835_defconfig | 9 + arch/arm/configs/multi_v7_defconfig | 2 + arch/arm64/configs/defconfig | 2 + drivers/clk/bcm/Kconfig | 7 + drivers/clk/bcm/Makefile | 1 + drivers/clk/bcm/clk-bcm2835.c | 28 +-- drivers/clk/bcm/clk-raspberrypi.c | 315 ++++++++++++++++++++++++++ drivers/cpufreq/Kconfig.arm | 8 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/raspberrypi-cpufreq.c | 97 ++++++++ drivers/firmware/raspberrypi.c | 10 + 11 files changed, 456 insertions(+), 24 deletions(-) create mode 100644 drivers/clk/bcm/clk-raspberrypi.c create mode 100644 drivers/cpufreq/raspberrypi-cpufreq.c