From mboxrd@z Thu Jan 1 00:00:00 1970 From: Faiz Abbas Subject: Re: [PATCH v3 4/6] bus: ti-sysc: Add support for software reset Date: Mon, 11 Jun 2018 11:57:35 +0530 Message-ID: References: <20180606060826.14671-1-faiz_abbas@ti.com> <20180606060826.14671-5-faiz_abbas@ti.com> <20180607073530.GH5738@atomide.com> <20180608062158.GI5738@atomide.com> <20180611060957.GN5738@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180611060957.GN5738@atomide.com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Tony Lindgren Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, paul@pwsan.com, linux-kernel@vger.kernel.org, t-kristo@ti.com, robh+dt@kernel.org, bcousson@baylibre.com, linux-omap@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org List-Id: devicetree@vger.kernel.org On Monday 11 June 2018 11:39 AM, Tony Lindgren wrote: > * Faiz Abbas [180611 06:09]: >> Hi Tony, >> >> On Friday 08 June 2018 11:51 AM, Tony Lindgren wrote: >>> * Faiz Abbas [180607 10:24]: >>>> Hi, >>>> >>>> On Thursday 07 June 2018 01:05 PM, Tony Lindgren wrote: >>>>> * Faiz Abbas [180606 06:14]: >>>>>> +static int sysc_reset(struct sysc *ddata) >>>>>> +{ >>>>>> + int offset = ddata->offsets[SYSC_SYSCONFIG]; >>>>>> + int val = sysc_read(ddata, offset); >>>>>> + >>>>>> + val |= (0x1 << ddata->cap->regbits->srst_shift); >>>>>> + sysc_write(ddata, offset, val); >>>>>> + >>>>>> + /* Poll on reset status */ >>>>>> + if (ddata->cfg.quirks & SYSC_QUIRK_RESET_STATUS) { >>>>>> + offset = ddata->offsets[SYSC_SYSSTATUS]; >>>>>> + >>>>>> + return readl_poll_timeout(ddata->module_va + offset, val, >>>>>> + (val & ddata->cfg.syss_mask) == 0x0, >>>>>> + 100, MAX_MODULE_SOFTRESET_WAIT); >>>>>> + } >>>>>> + >>>>>> + return 0; >>>>>> +} >>>>> >>>>> I wonder if we should also add SYSS_QUIRK_RESET_STATUS in >>>>> addition to SYSC_QUIRK_RESET status to make it easy to >>>>> read the right register? >>>> >>>> I assumed SYSC_QUIRK is the prefix to indicate the ti-sysc driver not >>>> the register. Are there layouts in which the reset status bit is in the >>>> sysconfig register rather than the sysstatus register? >>> >>> Yes we can have reset status bit in either syss or syssconfig register. >> >> You mean sysstatus and sysconfig right? > > Yup. > >>> We detect that in sysc_init_syss_mask() but we should also set something >>> at that point to make it clear which reset to use. But as we don't need >>> the quirk flag, it's probably set a function pointer after the detection. >>> So how about let's have two functions sysc_reset() and sysc_syss_reset() >>> and then we can implement sysc_syss_reset() in a separate patch after >>> testing it when we have a non-platform data using example for >>> sysc_syss_reset(). >>> >> >> Shouldn't the function I add be called sysc_syss_reset()? The reset >> status bit is in the sysstatus. > > Yes > Great. I thought I completely misunderstood you. But I don't see what adding another function will accomplish. A QUIRK flag used in the same function would work well enough. Regards, Faiz