From patchwork Wed May 31 09:18:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Elwell X-Patchwork-Id: 9756345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C4B760360 for ; Wed, 31 May 2017 09:18:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7420827F54 for ; Wed, 31 May 2017 09:18:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68DE828405; Wed, 31 May 2017 09:18:32 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2A7C27F54 for ; Wed, 31 May 2017 09:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751130AbdEaJSa (ORCPT ); Wed, 31 May 2017 05:18:30 -0400 Received: from mx08-00252a01.pphosted.com ([91.207.212.211]:60542 "EHLO mx08-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751129AbdEaJS2 (ORCPT ); Wed, 31 May 2017 05:18:28 -0400 Received: from pps.filterd (m0102629.ppops.net [127.0.0.1]) by mx08-00252a01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4V9IKRP024439 for ; Wed, 31 May 2017 10:18:27 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=subject : from : to : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp; bh=MR0VZG8RN0jP3xBS1hwJ/3mqnxk22Ly4imArdBdWny4=; b=wdShOO8UBcEKAlgkBgizEwht6cuWUyieYBcV6JrSQn/p3nclCYx86fjlJEECkD5XmFMB 8LUTlyxsNw80TFJ3CVSMeFIUy/SOTZGHBpya+3kBE/f2Y5adw5PDvXK8GeAyuKkYGVSk ouAQSUMLLd2Ckgu9+8mFk+t3UH089Wsj1HkMehrGCrJcS52G60wi4SzTnEaWlo1f71Vn JXDnh01WEISZ/q9IBuwNCvRVBeRwhFPHeXtKWmVvl55HctVg/JEgPIhXktGgmGcuBuN3 IAliEEOghVl+9u+xQtKOUm9WLCtJjDz/VfM2mLDMHfY/oOHJDZfuHVeBDVsa3HtY/wFw CA== Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by mx08-00252a01.pphosted.com with ESMTP id 2apwxeswxf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Wed, 31 May 2017 10:18:27 +0100 Received: by mail-wm0-f70.google.com with SMTP id w79so1355420wme.7 for ; Wed, 31 May 2017 02:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=MR0VZG8RN0jP3xBS1hwJ/3mqnxk22Ly4imArdBdWny4=; b=sxS/24bvQTulzvIPihAZLVghH20yq7JuV8FCg9QLSg/CFy0pj4hiGUDGutLqmXnqWf 72E/dmEiXTmLaGxYNEaBkDgOesCzDZK4dgCuMxAcNrlsxf0ZnvLXZKwSLoNKj5dotgsV PsYoUkWXjcFnHX2ExS7UQUJUyPtDmq0LanUv4U6YhgN3VU1vheIlfwcgD8qVvj5POxk7 mX4A+bjTMcRLplT8tTnr0K5PN79eFI3DZ1Y+rwKKYTesOVjRVZv0y1CTT0aU9lqX6hiy f88pCbjVbyNQJIejBfCVYMoIs6w/cKUQ84L8PZ1V/rhztLs/xRAaCuxBZK6d6T/h2vGT iC9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MR0VZG8RN0jP3xBS1hwJ/3mqnxk22Ly4imArdBdWny4=; b=FsPaYYWVwnx1Ou4LQBaG3//y0hMoV4vv2eLQBntPLj3gYfoskFITAZTQKj1elpacOQ ZsjTTsWxKRV6nHD8BLKfk7f0OU3oux15Bbx3HxluKWsg7kweuEVsoQmHqkrIwlg0ybZZ sjPpS3En47wGv+Px/N3ul3YFHiQ8AwWQh33avHOJbt6TbE7QdVkl2hcTNHzMiMfGxr/v mvdxPpHXiFJcAwlu1mZDKBcMxGSiREJDfQEEsQ5ftIMQUmwnIoLlbgnSMhYEsF/0q4kr h5X8gMVcXJ7DmG0Q5aYII2XrLApM562fb59EIv4BxBr4i6CQIE7/lOz+w6+vGgVQV1ZB 3x4w== X-Gm-Message-State: AODbwcB4N9jM0vLskmSh9H0IW94tyU89gep3kU6vIaFSmMj1Kb9waNJv yxQz0aF8FyoaZZs5i7gwPJoVBOc0Vn7f2ziBtlCsFiFtbtMvz9WF8aegB2w8YMmqV3kSBJx44Rz QYdJpz2OQ4uw= X-Received: by 10.223.176.154 with SMTP id i26mr12184914wra.81.1496222305523; Wed, 31 May 2017 02:18:25 -0700 (PDT) X-Received: by 10.223.176.154 with SMTP id i26mr12184895wra.81.1496222305278; Wed, 31 May 2017 02:18:25 -0700 (PDT) Received: from ?IPv6:2a00:2381:fdf7:14:79d0:49c2:6e14:f72b? ([2a00:2381:fdf7:14:79d0:49c2:6e14:f72b]) by smtp.gmail.com with ESMTPSA id n49sm14175984wrn.30.2017.05.31.02.18.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 02:18:24 -0700 (PDT) Subject: [PATCH v2 1/2] clk: bcm2835: Limit PCM clock to OSC and PLLD_PER From: Phil Elwell To: Michael Turquette , Stephen Boyd , Eric Anholt , Stefan Wahren , Florian Fainelli , linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <866b60bb-d1c8-726e-3a2d-11a34f9e8ac7@raspberrypi.org> Message-ID: <8a9ebac4-b299-b887-27b2-86f4f61846fd@raspberrypi.org> Date: Wed, 31 May 2017 10:18:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <866b60bb-d1c8-726e-3a2d-11a34f9e8ac7@raspberrypi.org> Content-Language: en-GB X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-31_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705310174 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Restrict clock sources for the PCM peripheral to the oscillator and PLLD_PER because other source may have varying rates or be switched off. Prevent other sources from being selected by replacing their names in the list of potential parents with dummy entries (entry index is significant). Signed-off-by: Phil Elwell --- drivers/clk/bcm/clk-bcm2835.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index 0258538..81ecd4c 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1516,6 +1516,31 @@ struct bcm2835_clk_desc { .parents = bcm2835_clock_per_parents, \ __VA_ARGS__) +/* + * Restrict clock sources for the PCM peripheral to the oscillator and + * PLLD_PER because other source may have varying rates or be switched + * off. + * + * Prevent other sources from being selected by replacing their names in + * the list of potential parents with dummy entries (entry index is + * significant). + */ +static const char *const bcm2835_pcm_per_parents[] = { + "-", + "xosc", + "-", + "-", + "-", + "-", + "plld_per", + "-", +}; + +#define REGISTER_PCM_CLK(...) REGISTER_CLK( \ + .num_mux_parents = ARRAY_SIZE(bcm2835_clock_pcm_per_parents), \ + .parents = bcm2835_clock_pcm_per_parents, \ + __VA_ARGS__) + /* main vpu parent mux */ static const char *const bcm2835_clock_vpu_parents[] = { "gnd", @@ -1993,7 +2018,7 @@ struct bcm2835_clk_desc { .int_bits = 4, .frac_bits = 8, .tcnt_mux = 22), - [BCM2835_CLOCK_PCM] = REGISTER_PER_CLK( + [BCM2835_CLOCK_PCM] = REGISTER_PCM_CLK( .name = "pcm", .ctl_reg = CM_PCMCTL, .div_reg = CM_PCMDIV,