Received: by 2002:ac0:950e:0:0:0:0:0 with SMTP id f14csp394668imc; Sat, 16 Mar 2019 04:11:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKhcwLa842G9LchbU3cQIp7D8HqjRZ/7WMqTaaruZwyDSvmAvyl3q+Ltgl0OUWk4KEKpqv X-Received: by 2002:a63:e408:: with SMTP id a8mr8114919pgi.49.1552734714073; Sat, 16 Mar 2019 04:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552734714; cv=none; d=google.com; s=arc-20160816; b=S8abc9WtAvhhluqVnhTtVslnd6lFw1P43bcZLFRSv8Z7pSZWMtkWI5STxkj73cGHhI rHnjpTQ02tgPwL57dy5jXU1Dr6GgGR2PRI7LzLlbtmkVBBgDCaNoxacwTez5vtoyUFxk DaqkhIFdpbpoUlH8ZmnmtKDoXJ3GdjsFafvO0d/Y3KqVsmaBz6gtAESetbNYLdDHkZe7 YMo0GqD2VPuTpoqfAIctLHkLZCH8mwtuG/Rqd/69an2yfX0wxlZ4IsMIjUo3KFp/iocV MhUfoLKJQKgGQeTPu3iRt4r/8Db4fDjGtGyJUod4rrW/AxdXIiax/QBAMh4D5GcDRZv7 tAgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8yUYw7AmfV48/Wh6piSJt7i08bLmYjUV/hjOLafD05c=; b=LBJqesML6yHFm4va6/W1rqYAdziZitb7QMDJ/5QWzCo9QQTwSl/lxuFdbHBV1dOPae 5i+kKmLN2kmmsnYUZYhn/vNPaSe4l6LL7j1qeN51qlS4hGXrFMh5lOiVuK/0kDZk3dNS cwdFip2pZfKWBe9mBEAagrpor2XrzQHi3s4IVJcMPFFs2EILF73zvEJARsMjvsMcwRZw 5OZxHbNpc6OgGokfNYrVr+EWhRujLe5wrEvbwHzeKvC7gckNHeAwVxdTyPJwUY8SGC4J 8M+ec02NiWTf/mMcfix1xvnj9CjMrTH4opofc4LkF5lOgjuKnYAw8nYjcMZEjf2t6kez RmUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tqyHHjXF; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j26si4326059pfe.175.2019.03.16.04.11.26; Sat, 16 Mar 2019 04:11:54 -0700 (PDT) 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=@kernel.org header.s=default header.b=tqyHHjXF; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbfCPLIE (ORCPT + 99 others); Sat, 16 Mar 2019 07:08:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:38254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726620AbfCPLIE (ORCPT ); Sat, 16 Mar 2019 07:08:04 -0400 Received: from localhost (unknown [122.167.125.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AF091218AC; Sat, 16 Mar 2019 11:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552734482; bh=AbjBJ5sWAyUjg39D2wZ1vnphsgx/cTYbfPLM8YpPTeo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tqyHHjXFpYWqcHCenLIXsiKtZCKLXMARXad+XW4tqBfD6zDvNHkmBqosOkJbDBfGh fgEbNikwuJukvwLJc+2/v8FCu/HBwQymDOZnIQQCguo16WhT4Qted/bPWSiJYnf+jH XZ0nnJKKkRzsNODoOWiA1EPB8f3f4aGIOwX3bp58= Date: Sat, 16 Mar 2019 16:37:53 +0530 From: Vinod Koul To: Jernej Skrabec Cc: maxime.ripard@bootlin.com, wens@csie.org, robh+dt@kernel.org, mark.rutland@arm.com, dan.j.williams@intel.com, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH 2/6] dmaengine: sun6i: Add a quirk for additional mbus clock Message-ID: <20190316110753.GH5348@vkoul-mobl> References: <20190307165829.9086-1-jernej.skrabec@siol.net> <20190307165829.9086-3-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190307165829.9086-3-jernej.skrabec@siol.net> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07-03-19, 17:58, Jernej Skrabec wrote: > H6 DMA controller needs additional mbus clock to be enabled. > > Add a quirk for it and handle it accordingly. > > Signed-off-by: Jernej Skrabec > --- > drivers/dma/sun6i-dma.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c > index 0cd13f17fc11..761555080325 100644 > --- a/drivers/dma/sun6i-dma.c > +++ b/drivers/dma/sun6i-dma.c > @@ -129,6 +129,7 @@ struct sun6i_dma_config { > u32 dst_burst_lengths; > u32 src_addr_widths; > u32 dst_addr_widths; > + bool mbus_clk; > }; > > /* > @@ -182,6 +183,7 @@ struct sun6i_dma_dev { > struct dma_device slave; > void __iomem *base; > struct clk *clk; > + struct clk *clk_mbus; So rather than have mbus_clk and then a ptr, why not use the ptr and use NULL value to check for..? > int irq; > spinlock_t lock; > struct reset_control *rstc; > @@ -1208,6 +1210,14 @@ static int sun6i_dma_probe(struct platform_device *pdev) > return PTR_ERR(sdc->clk); > } > > + if (sdc->cfg->mbus_clk) { where is the populated? I was expecting this to be set based on DT! > + sdc->clk_mbus = devm_clk_get(&pdev->dev, "mbus"); > + if (IS_ERR(sdc->clk_mbus)) { > + dev_err(&pdev->dev, "No mbus clock specified\n"); > + return PTR_ERR(sdc->clk_mbus); > + } > + } > + > sdc->rstc = devm_reset_control_get(&pdev->dev, NULL); > if (IS_ERR(sdc->rstc)) { > dev_err(&pdev->dev, "No reset controller specified\n"); > @@ -1312,11 +1322,19 @@ static int sun6i_dma_probe(struct platform_device *pdev) > goto err_reset_assert; > } > > + if (sdc->cfg->mbus_clk) { > + ret = clk_prepare_enable(sdc->clk_mbus); > + if (ret) { > + dev_err(&pdev->dev, "Couldn't enable mbus clock\n"); > + goto err_clk_disable; > + } > + } > + > ret = devm_request_irq(&pdev->dev, sdc->irq, sun6i_dma_interrupt, 0, > dev_name(&pdev->dev), sdc); > if (ret) { > dev_err(&pdev->dev, "Cannot request IRQ\n"); > - goto err_clk_disable; > + goto err_mbus_clk_disable; > } > > ret = dma_async_device_register(&sdc->slave); > @@ -1341,6 +1359,8 @@ static int sun6i_dma_probe(struct platform_device *pdev) > dma_async_device_unregister(&sdc->slave); > err_irq_disable: > sun6i_kill_tasklet(sdc); > +err_mbus_clk_disable: > + clk_disable_unprepare(sdc->clk_mbus); > err_clk_disable: > clk_disable_unprepare(sdc->clk); > err_reset_assert: > @@ -1359,6 +1379,7 @@ static int sun6i_dma_remove(struct platform_device *pdev) > > sun6i_kill_tasklet(sdc); > > + clk_disable_unprepare(sdc->clk_mbus); > clk_disable_unprepare(sdc->clk); > reset_control_assert(sdc->rstc); > > -- > 2.21.0 -- ~Vinod