Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8143759ybi; Thu, 6 Jun 2019 07:25:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFT+rSF0ag6z7MNIkOqoeekagz05jnPUGb29iMNsVl5ndIhqrAaidSuhmffbkzImO2t90L X-Received: by 2002:a17:902:1021:: with SMTP id b30mr51434374pla.324.1559831122560; Thu, 06 Jun 2019 07:25:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559831122; cv=none; d=google.com; s=arc-20160816; b=KzxoXZBdfdSS+fAfDXM4mieSqtioirO2T5SZiDcVaOmKUlF3Y4Vg0lE0NdPUqGnp2m a1YluilJinWOTbUC5b8m+EwKTN/jSg19KS7fCGop4mz95kmw4/O3q80Z7trc9g1FsVyC LJOAcKURe8JQa2G1jT+fgxTFbBv2OQXguLYByZFbjkjuS5Z0CUiVZToNnmNqNYQQddZb 0moimZYYy7xBZzE/Fs/1hWF8PZB3OMLmaj9D/dvp01V1OvGvSSYQ5t8DV2TgS7c0gz/d jLJ2pggExB7pWL2GY/lI3o51gxi9E7utbxSqNL0+3m3pZkJP+wsPlls80i3uEnOSbs48 hT8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Jw2R/SmH3j/TnnVe6M/Xxen6cvG+da57C6CQsF8jnXI=; b=CNWILM6aa+iRW8dNKk9GA9Z021DiyyVF7QgSOx/oOhZYl5/MnGfJdnWM+nS29u3eWM +D5XPKNwW0R/LOunfVBXcH88vBQjkWdy0PDEiKS2duIzcjCgR9XggBJRqlrdQYr0IzRs 8Zy6n7eA8h+c1BjAgEJBbbcuX/SoiyzA3/kbx9ctonSi1iNrOpR3U6NUJz5S6Ofcp1lT p7gbu2Ei68JpW6UVcR1EsoJM7jbAeUk7sM7C6aLu7HXoxe1L1ZAGyuDc1f5yLZjsvu8Y Xgofn+K5Nbd9wfQUbPVPhxycYty4BeQfbLOVnEbDubeR/pF49Cx57KiXxLAoHfOXgYhZ yVSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z33si2147174pgk.516.2019.06.06.07.25.04; Thu, 06 Jun 2019 07:25:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729113AbfFFOXQ (ORCPT + 99 others); Thu, 6 Jun 2019 10:23:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:47990 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729103AbfFFOXP (ORCPT ); Thu, 6 Jun 2019 10:23:15 -0400 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 DB236AFD6; Thu, 6 Jun 2019 14:23:13 +0000 (UTC) From: Nicolas Saenz Julienne To: stefan.wahren@i2se.com, linux-kernel@vger.kernel.org Cc: mbrugger@suse.de, viresh.kumar@linaro.org, rjw@rjwysocki.net, sboyd@kernel.org, eric@anholt.net, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, ptesarik@suse.com, linux-rpi-kernel@lists.infradead.org, ssuloev@orpaltech.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mturquette@baylibre.com, linux-pm@vger.kernel.org, Nicolas Saenz Julienne Subject: [PATCH v2 0/7] cpufreq support for Raspberry Pi Date: Thu, 6 Jun 2019 16:22:47 +0200 Message-Id: <20190606142255.29454-1-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. @Eric: Even though some things change, namely to properly support being built as a module, I still added your Acked-by as it didn't change the overall design. I hope it's OK. That's all, kind regards, Nicolas [1] https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface --- 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 | 316 ++++++++++++++++++++++++++ drivers/cpufreq/Kconfig.arm | 8 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/raspberrypi-cpufreq.c | 100 ++++++++ drivers/firmware/raspberrypi.c | 10 + 11 files changed, 460 insertions(+), 24 deletions(-) create mode 100644 drivers/clk/bcm/clk-raspberrypi.c create mode 100644 drivers/cpufreq/raspberrypi-cpufreq.c -- 2.21.0