From patchwork Wed Sep 20 11:14:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 9961307 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 ABF62600C5 for ; Wed, 20 Sep 2017 11:20:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C5A6290B7 for ; Wed, 20 Sep 2017 11:20:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90574290BB; Wed, 20 Sep 2017 11:20:18 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 BE182290B7 for ; Wed, 20 Sep 2017 11:20:08 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=X4sklO/rgIkLD5usmbZakKtmbkGM5GAW0Qhkdt5tZcg=; b=hpCOwStbojWBhqP06gL4lwLxWh 9KzEjWIdixIA+wmjv2rO1/epbz5Jn1i8g4ZeDZtjJy4eenvkTJY5Rn7/NaFtNE5OBwk4wVUVb2chn CkHJSdPuyrnvKXJ42fAHV3asCujJq3koyNspNPHnAT36mFe6KUSiSEP2DdDryFNgKP9yrsJ2+JAyx VzaI7qocN+nJ/f08MLUV+SfmBTRGTYxKLX8yvurDxm/mrLbhRno/z3SG/Dp6hPgtGlKHANpZLHCUO o/zl1d3cP2/phuDjOZuDZ7R4yjC5xw+Q4FwELU9qV+bMthIP55XdTWh4hRRv1GpuSOUdilJZ6RCea GWdhi8ZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dud2v-0004E3-PT; Wed, 20 Sep 2017 11:20:01 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1duczd-0001an-7z for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2017 11:16:45 +0000 Received: by mail-wm0-x244.google.com with SMTP id f4so2106526wmh.4 for ; Wed, 20 Sep 2017 04:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PMaxpNmYe07DmlqFixN6iuB9Mcv3FxUJUtqqkedrCeg=; b=RqHu/z7ZZXibkAwk/YywRGb6hZp5BNQgaaCVowa5WKFThavLJ8YQ1lmXDkYI+PkGrZ 0g4TG0vhhZ+aA2IuGy3e2WZd4n3SHSUqGPw3SRNSCGMMnSB4cY3w+QfoTk2ph5lHxCUF PGgN3TPL5sGpvSzx2X/8g3ESPuPgEzSSiqPo8MaReDlaOGZE1zSZXQr3Xel2LVHuRCV1 hhTzgwfvAL96epcUIho2uGQPlY98G3+KwBCbGVmXH0bIkCkmZkuEOFgwR1BduR9A5D6Y 4ZdP6TD6w6M9glxGGT4IGpxLCd2WF2isqVOib4qk4J1XMT22sazGD2dEB/xiaIaNdOK4 DnIg== 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:in-reply-to :references; bh=PMaxpNmYe07DmlqFixN6iuB9Mcv3FxUJUtqqkedrCeg=; b=qLHlofY5diyA5E6G9B7rU0nGAuK12hGVjlRaMZIsuKROKQoCku0mah9hByU8FdI9II X/Hzi+GbTKaHK7n7H7GL75SyUFOX/5Q6Oti5x4b5cU3rXve/pi+Y7kY1NrQMsGnT0gfT 7FX3bS6m+BylnmcHTDCAh73UFpnQnEkIvf3/ch+ybmSMSgZy1D8QCzywCsWX+uCeABIC UAhrnX2Mzpin6M4y/iCFZX14RR1tMSF3x/BbzFSI7JRcAEKyXoSv+k4Zg8vLP2T0lwAn IT/pzAe+b9EGehPVuXNA07xcOf3i/q5xbvePBqTUCbicTjKuDUu4ULA0xLio4xFJONjC xUkA== X-Gm-Message-State: AHPjjUjxLRtQiLyk4Jqm6eaagXCUon+UED1X0PiPsA+OcqtgpZrFeHya wCenWuGjPaQcwG8o54ikY5OIMg== X-Google-Smtp-Source: AOwi7QCQDSmFaFffN+nsjEQPtXwauJugYnX08mbezMs8tj/EHBbAxMgL/JOpC2oJz9V55XYbe5k1FA== X-Received: by 10.80.189.204 with SMTP id z12mr4212227edh.2.1505906179187; Wed, 20 Sep 2017 04:16:19 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::48e]) by smtp.gmail.com with ESMTPSA id s12sm884513edd.25.2017.09.20.04.16.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 04:16:18 -0700 (PDT) From: Jonas Gorski To: linux-mips@linux-mips.org, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH V2 8/8] MIPS: BCM63XX: split out swpkt_sar/usb clocks Date: Wed, 20 Sep 2017 13:14:08 +0200 Message-Id: <20170920111408.29711-9-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170920111408.29711-1-jonas.gorski@gmail.com> References: <20170920111408.29711-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170920_041637_755877_693928DD X-CRM114-Status: GOOD ( 13.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Florian Fainelli , Greg Kroah-Hartman , Kevin Cernekee , Russell King , Ralf Baechle , Rob Herring , bcm-kernel-feedback-list@broadcom.com MIME-Version: 1.0 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 Make the secondary switch clocks their own clocks. This allows proper enable reference counting between SAR/XTM and the main switch clocks, and controlling them individually from drivers. Signed-off-by: Jonas Gorski --- arch/mips/bcm63xx/clk.c | 61 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c index 2018425fe97e..164115944a7f 100644 --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c @@ -122,21 +122,56 @@ static struct clk clk_ephy = { }; /* + * Ethernet switch SAR clock + */ +static void swpkt_sar_set(struct clk *clk, int enable) +{ + if (BCMCPU_IS_6368()) + bcm_hwclock_set(CKCTL_6368_SWPKT_SAR_EN, enable); + else + return; +} + +static struct clk clk_swpkt_sar = { + .set = swpkt_sar_set, +}; + +/* + * Ethernet switch USB clock + */ +static void swpkt_usb_set(struct clk *clk, int enable) +{ + if (BCMCPU_IS_6368()) + bcm_hwclock_set(CKCTL_6368_SWPKT_USB_EN, enable); + else + return; +} + +static struct clk clk_swpkt_usb = { + .set = swpkt_usb_set, +}; + +/* * Ethernet switch clock */ static void enetsw_set(struct clk *clk, int enable) { - if (BCMCPU_IS_6328()) + if (BCMCPU_IS_6328()) { bcm_hwclock_set(CKCTL_6328_ROBOSW_EN, enable); - else if (BCMCPU_IS_6362()) + } else if (BCMCPU_IS_6362()) { bcm_hwclock_set(CKCTL_6362_ROBOSW_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_ROBOSW_EN | - CKCTL_6368_SWPKT_USB_EN | - CKCTL_6368_SWPKT_SAR_EN, - enable); - else + } else if (BCMCPU_IS_6368()) { + if (enable) { + clk_enable_unlocked(&clk_swpkt_sar); + clk_enable_unlocked(&clk_swpkt_usb); + } else { + clk_disable_unlocked(&clk_swpkt_usb); + clk_disable_unlocked(&clk_swpkt_sar); + } + bcm_hwclock_set(CKCTL_6368_ROBOSW_EN, enable); + } else { return; + } if (enable) { /* reset switch core afer clock change */ @@ -261,8 +296,12 @@ static void xtm_set(struct clk *clk, int enable) if (!BCMCPU_IS_6368()) return; - bcm_hwclock_set(CKCTL_6368_SAR_EN | - CKCTL_6368_SWPKT_SAR_EN, enable); + if (enable) + clk_enable_unlocked(&clk_swpkt_sar); + else + clk_disable_unlocked(&clk_swpkt_sar); + + bcm_hwclock_set(CKCTL_6368_SAR_EN, enable); if (enable) { /* reset sar core afer clock change */ @@ -451,6 +490,8 @@ static struct clk_lookup bcm6358_clks[] = { CLKDEV_INIT(NULL, "usbd", &clk_usbd), CLKDEV_INIT(NULL, "spi", &clk_spi), CLKDEV_INIT(NULL, "pcm", &clk_pcm), + CLKDEV_INIT(NULL, "swpkt_sar", &clk_swpkt_sar), + CLKDEV_INIT(NULL, "swpkt_usb", &clk_swpkt_usb), CLKDEV_INIT("bcm63xx_enet.0", "enet", &clk_enet0), CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet1), };