u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: "Pali Rohár" <pali@kernel.org>
Cc: Stefan Roese <sr@denx.de>, Bin Meng <bmeng.cn@gmail.com>,
	Heiko Schocher <hs@denx.de>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH u-boot-next 03/12] pci: mpc85xx: Use PCI_CONF1_EXT_ADDRESS() macro
Date: Tue, 28 Dec 2021 01:32:05 -0700	[thread overview]
Message-ID: <CAPnjgZ1D7=pK=5A_8MJ=ovtWPMj1wpMGHnXj=o1KNWYnX6By1A@mail.gmail.com> (raw)
In-Reply-To: <20211126104252.5443-4-pali@kernel.org>

Hi Pali,

On Fri, 26 Nov 2021 at 03:43, Pali Rohár <pali@kernel.org> wrote:
>
> PCI mpc85xx driver uses extended format of Config Address for PCI
> Configuration Mechanism #1.
>
> So use new U-Boot macro PCI_CONF1_EXT_ADDRESS().
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/pci/pci_mpc85xx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

nit below

>
> diff --git a/drivers/pci/pci_mpc85xx.c b/drivers/pci/pci_mpc85xx.c
> index 574cb784a893..1e180ee289b0 100644
> --- a/drivers/pci/pci_mpc85xx.c
> +++ b/drivers/pci/pci_mpc85xx.c
> @@ -23,7 +23,7 @@ static int mpc85xx_pci_dm_read_config(const struct udevice *dev, pci_dev_t bdf,
>         struct mpc85xx_pci_priv *priv = dev_get_priv(dev);
>         u32 addr;
>
> -       addr = bdf | (offset & 0xfc) | ((offset & 0xf00) << 16) | 0x80000000;
> +       addr = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset);
>         out_be32(priv->cfg_addr, addr);
>         sync();
>         *value = pci_conv_32_to_size(in_le32(priv->cfg_data), offset, size);
> @@ -38,7 +38,7 @@ static int mpc85xx_pci_dm_write_config(struct udevice *dev, pci_dev_t bdf,
>         struct mpc85xx_pci_priv *priv = dev_get_priv(dev);
>         u32 addr;
>
> -       addr = bdf | (offset & 0xfc) | ((offset & 0xf00) << 16) | 0x80000000;
> +       addr = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset);

It seems annoying to have to separate these out just to have the macro
put them back together. Perhaps add a version of the macro that takes
bdf as a parameter?

>         out_be32(priv->cfg_addr, addr);
>         sync();
>         out_le32(priv->cfg_data, pci_conv_size_to_32(0, value, offset, size));
> --
> 2.20.1
>

Regards,
Simon

  reply	other threads:[~2021-12-28  8:33 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 10:42 [PATCH u-boot-next 00/12] Common U-Boot macros for PCI Configuration Mechanism #1 Pali Rohár
2021-11-26 10:42 ` [PATCH u-boot-next 01/12] pci: Add standard PCI Config Address macros Pali Rohár
2021-12-28  8:32   ` Simon Glass
2021-12-28 13:34     ` Pali Rohár
2022-01-13  1:51   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 02/12] pci: gt64120: Use PCI_CONF1_ADDRESS() macro Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:51   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 03/12] pci: mpc85xx: Use PCI_CONF1_EXT_ADDRESS() macro Pali Rohár
2021-12-28  8:32   ` Simon Glass [this message]
2021-12-28 13:47     ` Pali Rohár
2022-01-13  1:51   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 04/12] pci: msc01: Use PCI_CONF1_ADDRESS() macro Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:51   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 05/12] pci: mvebu: Use PCI_CONF1_EXT_ADDRESS() macro Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:51   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 06/12] pci: tegra: " Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:51   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 07/12] pci: fsl: " Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:52   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 08/12] pci: mediatek: " Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:52   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 09/12] pci: sh7780: Use PCI_CONF1_ADDRESS() macro Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:52   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 10/12] x86: pci: " Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:52   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 11/12] m68k: mcf5445x: " Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:52   ` Tom Rini
2021-11-26 10:42 ` [PATCH u-boot-next 12/12] pci: sh7751: Fix access to config space via " Pali Rohár
2021-12-28  8:32   ` Simon Glass
2022-01-13  1:52   ` Tom Rini
2021-12-17 17:35 ` [PATCH u-boot-next 00/12] Common U-Boot macros for PCI Configuration Mechanism #1 Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPnjgZ1D7=pK=5A_8MJ=ovtWPMj1wpMGHnXj=o1KNWYnX6By1A@mail.gmail.com' \
    --to=sjg@chromium.org \
    --cc=bmeng.cn@gmail.com \
    --cc=hs@denx.de \
    --cc=pali@kernel.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).