From patchwork Thu Jun 1 09:10:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Elwell X-Patchwork-Id: 9758909 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 2F20060360 for ; Thu, 1 Jun 2017 09:10:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 261A32846C for ; Thu, 1 Jun 2017 09:10:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B02F284FE; Thu, 1 Jun 2017 09:10:41 +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 89A8D28505 for ; Thu, 1 Jun 2017 09:10:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751434AbdFAJKk (ORCPT ); Thu, 1 Jun 2017 05:10:40 -0400 Received: from mx08-00252a01.pphosted.com ([91.207.212.211]:58830 "EHLO mx08-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751106AbdFAJKj (ORCPT ); Thu, 1 Jun 2017 05:10:39 -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 v519A8Ff010299 for ; Thu, 1 Jun 2017 10:10:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=to : from : subject : message-id : date : mime-version : content-type : content-transfer-encoding; s=pp; bh=+SN2J4ep/M7G10/cKrgYtM27qY7PaHFrS3NR4SpKvnA=; b=RLqO6VLfGpt1Qq/w8FQ7D3KM6S48GrOxHC1olE4EsdY68RmN2dke2mg15msDnxUBx6zw xp3OghLO17W3Bg4uuY9bZNn2iX2w5sTAvZhDwkHlDtDMvPTCDCUlSmE59zPTtCYhMZV0 /iNagBH++zxkmzytw+fCZV7yzLDIrA+3P7mtFAKE/VH03bpQxcVr+PP1E9U4xYY5yD+u UxUt00XfC9+EqlgbV/UfhRyzsa7qSUe6keYocpMhcv2x9KskOcK4SLQjnM8JonaPf5qC E2UeJgCWG3iwNo7AAmcdZO49HQZVqciu4bbMdPuDnx0WBt00eUx55ilkx3QevEcPgezi hg== Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by mx08-00252a01.pphosted.com with ESMTP id 2apwxetcsg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Thu, 01 Jun 2017 10:10:37 +0100 Received: by mail-wm0-f70.google.com with SMTP id a77so8570627wma.12 for ; Thu, 01 Jun 2017 02:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=+SN2J4ep/M7G10/cKrgYtM27qY7PaHFrS3NR4SpKvnA=; b=e4ux80tAaRrz611N36P7PdolNO1/hP/r6rl3kW0qOjlxTyauJgnrGSl+gVfPH6Vyzt FLKSALtQDcOhf0D6dLjvBshZpHiZcrptrWkJZbmWD2JO2qCuaHFQW+YTDH9A/uK/km+i NOl0w2rra3u41vNbNeA1uVTA7sybxQkyo3rafqSTL9nHHd0wuMmbPu674hPR3Kj2EGrC icOFw5oA3LaEKLLrpKnGrlEsLo3T0lp62EAZNQw9Q4rKYuPiWwYSZILozwmrHjFAtjIs HYJjF2VFRnXpdsRyWSSJlrD3M+c44P321AejcHdZPyVH0D32QzLAN5NA/bU4qhRCF8NH pEFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=+SN2J4ep/M7G10/cKrgYtM27qY7PaHFrS3NR4SpKvnA=; b=oPUMbYj8Psqi/W4QmNFdz3aWTtC/8D2LirlF+dzVk1N5wncj/3daUQJdeAcgN8E0D9 YyM9tVjyN4mC9G38Xo4bpl7kQYtcY6xhtThX+nuJZEsZK+UVrEl+9ZhcGe7vOMfdKCiz Pn4sw9+9MMcupVP+1nwNJOYF4GFJwJ/ZMtLrlcLM6P403ScstxDiW32iIqd6utTOPWwJ uXoLam8JmTN58K9f50FcWAqM2ejYg7PkjuYdmujY2+et20lw30rFwZWDX3Yxuf97N1BA iWd1Y8kjYm9MowqR9aZlm2z9M0OcgxX8OFBMNqMFUN1+fF1Ah6D2Z4daqQk0LR1V7eT4 mlRQ== X-Gm-Message-State: AODbwcDr6XmU8vcuOcMi+fQfLjJHJb8IsznYsk7qKYGOZvSuxtmysj53 t3D+Ez/QRhbOt5kfAlECPurkxMf4UzXEjsQMkbXMvARxFko+yTqwdLwKqHd2jEIeia263g1ZgEV O6az4xBxtlEk= X-Received: by 10.223.150.115 with SMTP id c48mr428047wra.15.1496308236318; Thu, 01 Jun 2017 02:10:36 -0700 (PDT) X-Received: by 10.223.150.115 with SMTP id c48mr428034wra.15.1496308236125; Thu, 01 Jun 2017 02:10:36 -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 p76sm22062415wma.15.2017.06.01.02.10.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2017 02:10:35 -0700 (PDT) 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 From: Phil Elwell Subject: [PATCH v3 1/2] clk: bcm2835: Limit PCM clock to OSC and PLLD_PER Message-ID: <85cb59e5-c233-c945-95dd-e8f872b35f5c@raspberrypi.org> Date: Thu, 1 Jun 2017 10:10:37 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 Content-Language: en-GB X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-01_02:, , 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-1706010168 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 Reviewed-by: Eric Anholt --- 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,