Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7290610imu; Wed, 14 Nov 2018 15:00:15 -0800 (PST) X-Google-Smtp-Source: AJdET5dQeqWGJWFz9g4rEHvzG5fWzU2rSrp3ti5FRpSff3J/QlJ2e2M0rH2uGY56Ts4ZqCo98wR1 X-Received: by 2002:a62:2741:: with SMTP id n62-v6mr3955362pfn.138.1542236415717; Wed, 14 Nov 2018 15:00:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542236415; cv=none; d=google.com; s=arc-20160816; b=GCaOjcClUOHL7R2xd13BNhazMqnkjkezaxO/wYgJmZEgmUS+tmcfj+k2ADnXRVBWJr VFdDUeRCi/tiEC+pWLlKdEf5lFox4FZUyhDsI1gO9POFBTkm9q+Zbsq9QrzNtmYKo2kk NPdW9B0nvaBF9wap5QQdOlSxcK8dA9oIsqWQTGmXtYeSHvW8W34gTwFSKitxXP+W+X/3 gu7Qwo2a1yexZrwqnGLDnU/3yd22MwmR+V/fGC4CDiHaENLm+pVLPW9IYSff7F1ivdUd PYtBuk50e4FBWqQV5muKflwLbFVhMY7Fg4w6GgDgM1Leo7rTsryA1B/2+we1qTClBtTK sx/A== 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:dkim-signature; bh=4+/Hf7JsCBuVFCzuyYowMXG14ZwLezEzin4Fj9FD7+Y=; b=HZHDFi5jZ3WpAmCo9F5rvtqgLR9pAq55LY1ukRRprQ1WTPq5B15i1diAVTIpIkprBT rVg17HO8xBTkdylGNhJlHD3X8WztxhMNBuzw8mSKyjjd6p+d+icXqwwfnZDw9xP4Bt+n mJ0dqtcpS9StkC23JlNyH/gVumhot34WgXA7anSDpLnuhOiwk/uYM2fhPrUHLObWPnic Y83kl4auyGH5VnGPlTAwSnkRm7gl61MqWknLZFzm6ZhlKe/A+NvvzLXpCJUR1KH4tPpq lQn0KHkB69pdO3DUkxfpuSFRL/8+PsTB7kX1h+9bejDVi2xuxZ0yK8datgDTL2CR5qlO LKAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=fl3hMS5D; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o186-v6si28557293pfo.236.2018.11.14.15.00.01; Wed, 14 Nov 2018 15:00:15 -0800 (PST) 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; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=fl3hMS5D; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728166AbeKOJDI (ORCPT + 99 others); Thu, 15 Nov 2018 04:03:08 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35576 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727118AbeKOJDH (ORCPT ); Thu, 15 Nov 2018 04:03:07 -0500 Received: by mail-wm1-f65.google.com with SMTP id t15-v6so16294795wmt.0; Wed, 14 Nov 2018 14:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4+/Hf7JsCBuVFCzuyYowMXG14ZwLezEzin4Fj9FD7+Y=; b=fl3hMS5DXZJKuKCmTl7flStFHW6obyR1q+8M9em0Cyq3Ht6dVS5np+lS732pKLacZR Ox1RkxwDL7zR732ujX1wO5NyMp5jmKWGKYRHDAY6NW3dn6pNCxS08G1I8UrHYwdYp4Aq feddQ+IXb7RNTEM+pHGGqtOx+O1+ajIOQiipU/AQRd7JExjzIFi2YjwC7GyuprNn2V+W DMqZvS7MPCXmEEjcwdMDTQtrmwkmSASsjbcNAN0WASSY3fUiieCTwrAai0sgKUnlBc5V Hir9xNBofSJhPDyia1VcHNKfQfV5uIavBJnO9B1MOkQCb2d27MIBHr5NxJMlI8mNyFdR eF2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4+/Hf7JsCBuVFCzuyYowMXG14ZwLezEzin4Fj9FD7+Y=; b=Lb+6cQVwPghQpWzi3XBcfuYmFYLiy5J++Zh6qz+KeBjMfuxp378AllFdR2FI38NSKl JLlvxQmOBXHc3AL12A+Evh/qIjhDV2uZnogTp2hKLgHkwHwTz5kpHI+LC4iEuHsRAVWs 8Gm9mdVoPx4qKFJlTfTaqzGE2epExrdjmai0xsnZnQmW/7o+s1RdC2xkj/YRNcoGh+kA NcnM17fHWz0U3K2mKLR/qfuPnEYN6vlVHTtStu0ER7qlo+3nQIGkO6jEH2Ie/HnvkjUY BtVAZlvA0V/COXrUYdh6gN8Bu1zjf6d9W1VvHn3xX1jYDbojuoGqHG0U+/8tLCd06Utc OKIQ== X-Gm-Message-State: AGRZ1gJ+wlXQLM0Q6VNCl7ZJz9xu25pUMXeq70zdRIA/FKfFkvuv0EfH 7SBX4mxSq0SvAgRg66auMPk= X-Received: by 2002:a1c:2ecf:: with SMTP id u198-v6mr3546573wmu.77.1542236270641; Wed, 14 Nov 2018 14:57:50 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100301AB549B11D5ACB.dip0.t-ipconnect.de. [2003:dc:d717:a100:301a:b549:b11d:5acb]) by smtp.googlemail.com with ESMTPSA id n7-v6sm18987784wrt.60.2018.11.14.14.57.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:57:49 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, Martin Blumenstingl Subject: [RFC v1 0/7] Meson8b: make the CPU clock mutable Date: Wed, 14 Nov 2018 23:57:18 +0100 Message-Id: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 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 This allows changing the CPU clock on the 32-bit Amlogic Meson SoCs (Meson8, Meson8b and Meson8m2). CPU frequency scaling will be enabled with a separate series by adding the CPU clock and the OPP tables to meson8.dtsi and meson8b.dtsi. While changing the CPU frequency (sys_pll or any of it's post-dividers) we need to run the CPU clock off the XTAL clock. Otherwise the system will lock up because we need to disable the sys_pll to change it's rate. This also makes the clk-pll's .enable hook a no-op if the clock is already enabled. Otherwise we're getting lockups when calling the first clk_{prepare_}enable on the sys_pll or any of it's children (as the CCF propagates the enable event up to the sys_pll). This is because the .enable hook unconditionally disables and enables the clock. However, we can't disable that clock (not even temporarily) if the CPU is running off sys_pll. Additionally this adds support for more M/N combinations in sys_pll to achieve all of the OPPs on Meson8b and all OPPs <= 1608 MHz on Meson8 and Meson8m2. Compared to Amlogic's 3.10 kernel there's one notable difference: we are actually allowing changes to the sys_pll. Amlogic's kernel sets sys_pll to a fixed rate during boot and then uses a timer generate a "virtual clock rate" by toggling between various dividers (for example: sys_pll is set to 1536MHz. to achieve 1008MHz they are toggling every 2500us between 1536MHZ and 768MHz so the average over is 1008MHz). I could reproduce any situation where changing sys_pll failed (for example due to high temperature). To prove that I ran "stress --cpu 4" for multiple hours and then cycled through all available CPU frequencies (while keeping "stress" running in the background). This worked fine on my Meson8b Odroid-C1 and EC-100 boards as well as my Meson8m2 board. Martin Blumenstingl (7): clk: meson: meson8b: run from the XTAL when changing the CPU frequency clk: meson: meson8b: do not use cpu_div3 for cpu_scale_out_sel clk: meson: clk-pll: check if the clock is already enabled clk: meson: clk-pll: add the is_enabled function in the clk_ops clk: meson: meson8b: mark the CPU clock as CLK_IS_CRITICAL clk: meson: meson8b: add support for more M/N values in sys_pll clk: meson: meson8b: allow changing the CPU clock tree drivers/clk/meson/clk-pll.c | 23 +++++++++ drivers/clk/meson/meson8b.c | 94 +++++++++++++++++++++++++++++++++---- 2 files changed, 108 insertions(+), 9 deletions(-) -- 2.19.1