Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp809123imu; Fri, 11 Jan 2019 09:23:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN7RFppy3dX4de2mxXzkpCstdJUfzNZScxpEV5nbBRxtvLZ0zMcICPJIFhZvaoHNZO/bMpMI X-Received: by 2002:a62:3603:: with SMTP id d3mr15966207pfa.146.1547227428888; Fri, 11 Jan 2019 09:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547227428; cv=none; d=google.com; s=arc-20160816; b=f0LpJZRd1HwKmI+e1w4PX2rbWwcMa4k98mOevGBVUGU4JRA3VkDzZs7pJmFONL1LGw cTahSOKeB9I4sa/5+CId4557yJSzShDe6/ItjSEK6Z5RZq5lLsiNCLQUWqovWREvE9xa hEIW4aPXk57hjDLSCahaQaeqqI5BgahYdTDJlQpLVZl4UEFHPEW6xjdEe05BJDfh11KP bb1Qk0w2awbXgDs9TGrWxlEiLYMMaDTE65RfZ3XDtokR+HfeKxTDSSnViVH/CRhKEAnv /464fjcJO6JDTBIXB8AKfdSS5OvsUvZx1R4s4VkIFlTgxRbYHkyFLieeoxkccZRdu2If kfkg== 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=kMAKAE1n6w0jiweeK7Ui6ZhFN+TRzH4vfpyEDeal7QY=; b=Y9N7d4FyBBCEdoGykmhgzOfcGE1EwC+65tUeyBjKTaC56d25M0+L96L7WhTRwBLF/X CpRI/krqYBLphhhWFr9i1QO6TAbIpXhuOZPnm8k6VtUHv7uGjoKfZbnfV4aEC+XUwM1f YuBUiF3Ode9H2hThUKcDy0JumXVJ0MZcTeQRU+eia4pKbZ70/JfyE2haC8queOjLEHIt wdxqVCSpbPbusoFZ5/MGHFTJ4Dudmg32USxAKcLgkqf52435w09N2iunmrAhFJeRvNVe RwtU6CHOW237SjJUT1Ll4l5YWrx80XY2ttvBIQAVQHYevElXVnRPzp5HyN8GnnRukNjA AnQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=uRJX5DBs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si22917256plc.364.2019.01.11.09.23.33; Fri, 11 Jan 2019 09:23:48 -0800 (PST) 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=@lunn.ch header.s=20171124 header.b=uRJX5DBs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732887AbfAKNv3 (ORCPT + 99 others); Fri, 11 Jan 2019 08:51:29 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:40302 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732876AbfAKNv3 (ORCPT ); Fri, 11 Jan 2019 08:51:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=kMAKAE1n6w0jiweeK7Ui6ZhFN+TRzH4vfpyEDeal7QY=; b=uRJX5DBsVuGkpmCWHZAnwbGPL8eAyGl0/nwPLAMk/ZzpTj7P31VUGmHjI3cQgvg25uIjNbC/0yLLHKD6zTGVuFAru0pW4dpnsBeBk9XmUXLKR9V/5O5tGDNv9/xiFE42ACpN7n+T6E5aSqp0J258cRCKOHNOwOoIiEkSySjb6xI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1ghxDZ-0000w2-C2; Fri, 11 Jan 2019 14:51:25 +0100 Date: Fri, 11 Jan 2019 14:51:25 +0100 From: Andrew Lunn To: Sheetal Tigadoli Cc: Thierry Reding , Rob Herring , Florian Fainelli , Ray Jui , Scott Branden , linux-pwm@vger.kernel.org, Praveen Kumar B , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/3] drivers: pwm: pwm-bcm-kona: Add pwm-kona-v2 support Message-ID: <20190111135125.GC1895@lunn.ch> References: <1547184076-20521-1-git-send-email-sheetal.tigadoli@broadcom.com> <1547184076-20521-3-git-send-email-sheetal.tigadoli@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547184076-20521-3-git-send-email-sheetal.tigadoli@broadcom.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 11, 2019 at 10:51:15AM +0530, Sheetal Tigadoli wrote: > From: Praveen Kumar B > > Add support for new version of pwm-kona. > Add support to make PWM changes configured and stable. > > Signed-off-by: Praveen Kumar B > Reviewed-by: Ray Jui > Reviewed-by: Scott Branden > Signed-off-by: Sheetal Tigadoli > --- > drivers/pwm/pwm-bcm-kona.c | 128 ++++++++++++++++++++++++++++++++++----------- > 1 file changed, 98 insertions(+), 30 deletions(-) > > diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c > index 09a95ae..2b44ad8 100644 > --- a/drivers/pwm/pwm-bcm-kona.c > +++ b/drivers/pwm/pwm-bcm-kona.c > @@ -45,30 +45,39 @@ > * high or low depending on its state at that exact instant. > */ > > -#define PWM_CONTROL_OFFSET (0x00000000) > +#define PWM_CONTROL_OFFSET 0x00000000 > #define PWM_CONTROL_SMOOTH_SHIFT(chan) (24 + (chan)) > #define PWM_CONTROL_TYPE_SHIFT(chan) (16 + (chan)) > #define PWM_CONTROL_POLARITY_SHIFT(chan) (8 + (chan)) > #define PWM_CONTROL_TRIGGER_SHIFT(chan) (chan) > > -#define PRESCALE_OFFSET (0x00000004) > +#define PRESCALE_OFFSET 0x00000004 > #define PRESCALE_SHIFT(chan) ((chan) << 2) > #define PRESCALE_MASK(chan) (0x7 << PRESCALE_SHIFT(chan)) > -#define PRESCALE_MIN (0x00000000) > -#define PRESCALE_MAX (0x00000007) > +#define PRESCALE_MIN 0x00000000 > +#define PRESCALE_MAX 0x00000007 Hi Praveen These changes are unrelated to adding support for a new PWM. So ideally they should be in a separate patch. > +static int kona_pwmc_wait_stable(struct pwm_chip *chip, unsigned int chan, > + unsigned int kona_ver) > +{ > + struct kona_pwmc *kp = to_kona_pwmc(chip); > + unsigned int value; > + unsigned int count = PWM_MONITOR_TIMEOUT_US * 1000; > + > + switch (kona_ver) { > + case KONA_PWM_V1: > + /* > + * There must be a min 400ns delay between clearing trigger and > + * settingit. Failing to do this may result in no PWM signal. > + */ > + ndelay(400); > + return 0; > + case KONA_PWM_V2: > + do { > + value = readl(kp->base + PWM_MONITOR_OFFSET); > + if (!(value & (BIT(chan)))) > + return 0; > + ndelay(1); > + } while (count--); You can probably use readl_poll_timeout() here. Andrew