Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2952370pxb; Mon, 16 Nov 2020 01:29:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzq0ojMMMHDvxUYH54BTobEAvbmxfcqMD+pApKw+uwdcEgiMrkv9+dKVPqBsjNcZ8gb14sF X-Received: by 2002:a05:6402:947:: with SMTP id h7mr14872394edz.85.1605518979655; Mon, 16 Nov 2020 01:29:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605518979; cv=none; d=google.com; s=arc-20160816; b=cfd6X1De0Usaw8LdYqI1RZez8nJsIAJVtp5KoCZTUqHsYeI6D4xl9xXxRTbhG7V940 R/Oy58s0PQYKFoz3RZD49ArpT0ZeZAl4bDRytSQq5EOY4dVfk4xHT/QYRlkERmfiVDWY Oi8QOr5WdgQovnTNVDoA3txtfs2m8t2gl6xiLok3SPNMpvc/brArZcd8Pifhx20yGiA+ 6zo/8GVde77WXwXJ9NskhNwBgXQaxifiLdxkgWZCMSp49Rlwrer5ItZWcgfe1dHc3vM0 f0rBpzhxOaWdA2CQPkkHPjg9ydn6dEEvGl3xVtENEnKwlj5NIfkOI2tV96xDFy755IXi 63RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=d+yksa/L/+O/IgdR91ydcBfWFIPXBuS75+yDTd5UP+s=; b=MIfHgKq2XAl8kxRZ3WJrpxJKpg2K0NYmSeTdfkOkDRPlCMUiAP97kfl9HlQvu/VQVf q+ekYfgdCqRBxndSQFzry5jgIrMtG6mj5X1ZDIUGlmj64gDQXJNq1J+M0QfDBiHmWgv9 t1RI8TyReQDTtz8HDu7GPY7cPVJ5foWYpAxnUTQprmQfMqmky5xAB0bgQogDdlqs7BlL bz5OUysUoqZt5gpIA2rp3Gw4LM2TWEK8mujVmWIKvlWPfy7h1l5j71/Um5y4H93+F3Vl TKpZqh5pNpcjUb65MSulttuFGuGTU+Bq9fjy9WMMM1g+/Ae287RupCcFgQYsZj6I3LjI v+yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gXltbHYZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb9si10521701ejc.725.2020.11.16.01.29.15; Mon, 16 Nov 2020 01:29:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gXltbHYZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726215AbgKPJYk (ORCPT + 99 others); Mon, 16 Nov 2020 04:24:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726172AbgKPJYj (ORCPT ); Mon, 16 Nov 2020 04:24:39 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88B7EC0613CF for ; Mon, 16 Nov 2020 01:24:39 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id 10so13567259pfp.5 for ; Mon, 16 Nov 2020 01:24:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d+yksa/L/+O/IgdR91ydcBfWFIPXBuS75+yDTd5UP+s=; b=gXltbHYZFSKk18EC26Ru7n9PknIiEOdJ2O+cT/vCIPlOHUCfJqi9YdOqw7xsvSNoBg MVzBkiImO+1jrabMHyeelgBpZjgoxB68Jzf8D6yRLpUwFtwof81LxHJBtIohMEyf9EC2 YW6iKO56lePLu4l1zmeBAtINBrLJzg5odeOXg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d+yksa/L/+O/IgdR91ydcBfWFIPXBuS75+yDTd5UP+s=; b=I1CyHbxPyAjEKNMBn3M4SmONHXfgxg/EbsD2oGyExsMzUBxNTcNGlxsrRixUiU5NQP hB0Ea6qFTao42qcsSOuIAFipuuBbZX6WINWtK07Wg+cCQRS67bP2s2L6Ttj/uxYm+fjp I0pth/HthHCHffWVFkfrEM65SIfvuQIu9QDwp4YYadZkGy4A51Am7vGpy06b0WPulF/y hwyGvX8y4TriogFGvlgbeB6vlgyds4HH4rdcvlVUZyDiYpM+NxjUHuqZsBzgnj23AiMk JIGUZiV/ilUMxQwMn1T+KUfhjz8Z54hkPJL32sDv6kFpXpYXTJtUpVQ6Iw5Q8nVGtH1h LtZQ== X-Gm-Message-State: AOAM530e4b65G3nP9mokHOklbFpymhQh8Cx0TAxjGiOiYtV6zJsV6AlQ ZpkdHtyDpamH7rBrRJIBvyz8nO6vS5FKO7Qnw+EwvA== X-Received: by 2002:a65:4905:: with SMTP id p5mr11516053pgs.299.1605518678986; Mon, 16 Nov 2020 01:24:38 -0800 (PST) MIME-Version: 1.0 References: <1605084902-13151-1-git-send-email-bayi.cheng@mediatek.com> <1605084902-13151-2-git-send-email-bayi.cheng@mediatek.com> In-Reply-To: <1605084902-13151-2-git-send-email-bayi.cheng@mediatek.com> From: Ikjoon Jang Date: Mon, 16 Nov 2020 17:24:28 +0800 Message-ID: Subject: Re: [PATCH v1] spi: spi-mtk-nor: add axi clock control for MT8192 spi-nor To: Bayi Cheng Cc: Mark Brown , Matthias Brugger , linux-spi@vger.kernel.org, "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" , open list , Chuanhong Guo , srv_heupstream@mediatek.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2020 at 4:55 PM Bayi Cheng wrote: > > From: bayi cheng > > MT8192 spi-nor is an independent sub system, we need extra control axi > bus clock for it. Add support for the additional axi clock to allow it > to be configured appropriately. > > Signed-off-by: bayi cheng Tested-by: Ikjoon Jang > --- > drivers/spi/spi-mtk-nor.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c > index b97f26a..bf2d0f9 100644 > --- a/drivers/spi/spi-mtk-nor.c > +++ b/drivers/spi/spi-mtk-nor.c > @@ -103,6 +103,7 @@ struct mtk_nor { > dma_addr_t buffer_dma; > struct clk *spi_clk; > struct clk *ctlr_clk; > + struct clk *axi_clk; > unsigned int spi_freq; > bool wbuf_en; > bool has_irq; > @@ -672,6 +673,7 @@ static void mtk_nor_disable_clk(struct mtk_nor *sp) > { > clk_disable_unprepare(sp->spi_clk); > clk_disable_unprepare(sp->ctlr_clk); > + clk_disable_unprepare(sp->axi_clk); > } > > static int mtk_nor_enable_clk(struct mtk_nor *sp) > @@ -688,6 +690,13 @@ static int mtk_nor_enable_clk(struct mtk_nor *sp) > return ret; > } > > + ret = clk_prepare_enable(sp->axi_clk); > + if (ret) { > + clk_disable_unprepare(sp->spi_clk); > + clk_disable_unprepare(sp->ctlr_clk); > + return ret; > + } > + > return 0; > } > > @@ -746,7 +755,7 @@ static int mtk_nor_probe(struct platform_device *pdev) > struct spi_controller *ctlr; > struct mtk_nor *sp; > void __iomem *base; > - struct clk *spi_clk, *ctlr_clk; > + struct clk *spi_clk, *ctlr_clk, *axi_clk; > int ret, irq; > unsigned long dma_bits; > > @@ -762,6 +771,10 @@ static int mtk_nor_probe(struct platform_device *pdev) > if (IS_ERR(ctlr_clk)) > return PTR_ERR(ctlr_clk); > > + axi_clk = devm_clk_get_optional(&pdev->dev, "axi"); > + if (IS_ERR(axi_clk)) > + return PTR_ERR(axi_clk); > + > dma_bits = (unsigned long)of_device_get_match_data(&pdev->dev); > if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(dma_bits))) { > dev_err(&pdev->dev, "failed to set dma mask(%lu)\n", dma_bits); > @@ -794,6 +807,7 @@ static int mtk_nor_probe(struct platform_device *pdev) > sp->dev = &pdev->dev; > sp->spi_clk = spi_clk; > sp->ctlr_clk = ctlr_clk; > + sp->axi_clk = axi_clk; > sp->high_dma = (dma_bits > 32); > sp->buffer = dmam_alloc_coherent(&pdev->dev, > MTK_NOR_BOUNCE_BUF_SIZE + MTK_NOR_DMA_ALIGN, > -- > 1.9.1 >