diff mbox series

[u-boot-next,09/12] pci: sh7780: Use PCI_CONF1_ADDRESS() macro

Message ID 20211126104252.5443-10-pali@kernel.org
State Accepted
Commit 7fabaa5313352a563568504a8354aaf11c1af85a
Delegated to: Tom Rini
Headers show
Series Common U-Boot macros for PCI Configuration Mechanism #1 | expand

Commit Message

Pali Rohár Nov. 26, 2021, 10:42 a.m. UTC
PCI sh7780 driver uses standard format of Config Address for PCI
Configuration Mechanism #1.

So use new U-Boot macro PCI_CONF1_ADDRESS().

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/pci_sh7780.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Simon Glass Dec. 28, 2021, 8:32 a.m. UTC | #1
On Fri, 26 Nov 2021 at 03:43, Pali Rohár <pali@kernel.org> wrote:
>
> PCI sh7780 driver uses standard format of Config Address for PCI
> Configuration Mechanism #1.
>
> So use new U-Boot macro PCI_CONF1_ADDRESS().
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/pci/pci_sh7780.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Jan. 13, 2022, 1:52 a.m. UTC | #2
On Fri, Nov 26, 2021 at 11:42:49AM +0100, Pali Rohár wrote:

> PCI sh7780 driver uses standard format of Config Address for PCI
> Configuration Mechanism #1.
> 
> So use new U-Boot macro PCI_CONF1_ADDRESS().
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/pci/pci_sh7780.c b/drivers/pci/pci_sh7780.c
index 06d711a6cb9e..7533286c0156 100644
--- a/drivers/pci/pci_sh7780.c
+++ b/drivers/pci/pci_sh7780.c
@@ -34,9 +34,9 @@ 
 int pci_sh4_read_config_dword(struct pci_controller *hose,
 				    pci_dev_t dev, int offset, u32 *value)
 {
-	u32 par_data = 0x80000000 | dev;
+	u32 par_data = PCI_CONF1_ADDRESS(PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev), offset);
 
-	p4_out(par_data | (offset & 0xfc), SH7780_PCIPAR);
+	p4_out(par_data, SH7780_PCIPAR);
 	*value = p4_in(SH7780_PCIPDR);
 
 	return 0;
@@ -45,9 +45,9 @@  int pci_sh4_read_config_dword(struct pci_controller *hose,
 int pci_sh4_write_config_dword(struct pci_controller *hose,
 				     pci_dev_t dev, int offset, u32 value)
 {
-	u32 par_data = 0x80000000 | dev;
+	u32 par_data = PCI_CONF1_ADDRESS(PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev), offset);
 
-	p4_out(par_data | (offset & 0xfc), SH7780_PCIPAR);
+	p4_out(par_data, SH7780_PCIPAR);
 	p4_out(value, SH7780_PCIPDR);
 	return 0;
 }