lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1555084745.11529.34.camel@pengutronix.de>
Date:   Fri, 12 Apr 2019 17:59:05 +0200
From:   Lucas Stach <l.stach@...gutronix.de>
To:     Andrey Smirnov <andrew.smirnov@...il.com>,
        linux-pci@...r.kernel.org
Cc:     Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Fabio Estevam <fabio.estevam@....com>,
        Chris Healy <cphealy@...il.com>,
        Leonard Crestez <leonard.crestez@....com>,
        "A.s. Dong" <aisheng.dong@....com>,
        Richard Zhu <hongxing.zhu@....com>, linux-imx@....com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 07/11] PCI: imx6: Simplify bit operations in PHY
 functions

Am Sonntag, den 31.03.2019, 21:25 -0700 schrieb Andrey Smirnov:
> Simplify the code by incorporating left shifts into constant
> defnitions as well as using FIELD_PREP/GENMASK. No functional change
> intended.
> 
> > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
> > Cc: Bjorn Helgaas <bhelgaas@...gle.com>
> > Cc: Fabio Estevam <fabio.estevam@....com>
> > Cc: Chris Healy <cphealy@...il.com>
> > Cc: Lucas Stach <l.stach@...gutronix.de>
> > Cc: Leonard Crestez <leonard.crestez@....com>
> > Cc: "A.s. Dong" <aisheng.dong@....com>
> > Cc: Richard Zhu <hongxing.zhu@....com>
> Cc: linux-imx@....com
> Cc: linux-arm-kernel@...ts.infradead.org
> Cc: linux-kernel@...r.kernel.org
> Cc: linux-pci@...r.kernel.org
> Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>

Reviewed-by: Lucas Stach <l.stach@...gutronix.de>

> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 28 +++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index b1f30b94fb30..a49e5e491e12 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -105,11 +105,11 @@ struct imx6_pcie {
>  #define PL_OFFSET 0x700
>  
>  #define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
> -#define PCIE_PHY_CTRL_DATA_LOC 0
> -#define PCIE_PHY_CTRL_CAP_ADR_LOC 16
> -#define PCIE_PHY_CTRL_CAP_DAT_LOC 17
> -#define PCIE_PHY_CTRL_WR_LOC 18
> -#define PCIE_PHY_CTRL_RD_LOC 19
> > +#define PCIE_PHY_CTRL_DATA(x)		FIELD_PREP(GENMASK(15, 0), (x))
> > +#define PCIE_PHY_CTRL_CAP_ADR		BIT(16)
> > +#define PCIE_PHY_CTRL_CAP_DAT		BIT(17)
> > +#define PCIE_PHY_CTRL_WR		BIT(18)
> > +#define PCIE_PHY_CTRL_RD		BIT(19)
>  
>  #define PCIE_PHY_STAT (PL_OFFSET + 0x110)
>  #define PCIE_PHY_STAT_ACK_LOC 16
> @@ -178,17 +178,17 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr)
> >  	u32 val;
> >  	int ret;
>  
> > -	val = addr << PCIE_PHY_CTRL_DATA_LOC;
> > +	val = PCIE_PHY_CTRL_DATA(addr);
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);
>  
> > -	val |= (0x1 << PCIE_PHY_CTRL_CAP_ADR_LOC);
> > +	val |= PCIE_PHY_CTRL_CAP_ADR;
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);
>  
> >  	ret = pcie_phy_poll_ack(imx6_pcie, 1);
> >  	if (ret)
> >  		return ret;
>  
> > -	val = addr << PCIE_PHY_CTRL_DATA_LOC;
> > +	val = PCIE_PHY_CTRL_DATA(addr);
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);
>  
> >  	return pcie_phy_poll_ack(imx6_pcie, 0);
> @@ -206,7 +206,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data)
> >  		return ret;
>  
> >  	/* assert Read signal */
> > -	phy_ctl = 0x1 << PCIE_PHY_CTRL_RD_LOC;
> > +	phy_ctl = PCIE_PHY_CTRL_RD;
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl);
>  
> >  	ret = pcie_phy_poll_ack(imx6_pcie, 1);
> @@ -234,11 +234,11 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
> >  	if (ret)
> >  		return ret;
>  
> > -	var = data << PCIE_PHY_CTRL_DATA_LOC;
> > +	var = PCIE_PHY_CTRL_DATA(data);
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
>  
> >  	/* capture data */
> > -	var |= (0x1 << PCIE_PHY_CTRL_CAP_DAT_LOC);
> > +	var |= PCIE_PHY_CTRL_CAP_DAT;
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
>  
> >  	ret = pcie_phy_poll_ack(imx6_pcie, 1);
> @@ -246,7 +246,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
> >  		return ret;
>  
> >  	/* deassert cap data */
> > -	var = data << PCIE_PHY_CTRL_DATA_LOC;
> > +	var = PCIE_PHY_CTRL_DATA(data);
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
>  
> >  	/* wait for ack de-assertion */
> @@ -255,7 +255,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
> >  		return ret;
>  
> >  	/* assert wr signal */
> > -	var = 0x1 << PCIE_PHY_CTRL_WR_LOC;
> > +	var = PCIE_PHY_CTRL_WR;
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
>  
> >  	/* wait for ack */
> @@ -264,7 +264,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
> >  		return ret;
>  
> >  	/* deassert wr signal */
> > -	var = data << PCIE_PHY_CTRL_DATA_LOC;
> > +	var = PCIE_PHY_CTRL_DATA(data);
> >  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
>  
> >  	/* wait for ack de-assertion */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ