All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] PCI: designware: missing *config* reg space
@ 2015-04-27 20:27 Murali Karicheri
  2015-05-10 12:54 ` Pratyush Anand
  0 siblings, 1 reply; 3+ messages in thread
From: Murali Karicheri @ 2015-04-27 20:27 UTC (permalink / raw)
  To: Jingoo Han, Mohit Kumar, Lucas Stach, KISHON VIJAY, linux-pci,
	devicetree, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala, Bjorn Helgaas

All,

I would like to take action to resolve the following print message 
thrown by PCI designware core driver when kernel boots up on Keystone.

[    0.415778] keystone-pcie 21801000.pcie: missing *config* reg space

As per DT documentation introduced by commit 
4dd964df36d0e548e1806ec2ec275b62d4dc46e8 "PCI: designware: Look for 
configuration space in 'reg', not 'ranges'

This is introduced to stop abusing the range property for defining 
resource for config space. However if the device binding doesn't have
reg-name = "config" defined, this throws out an unnecessary log message
at boot which seems to me not right. AFAIK, reg-names is not mandatory.
config space address in Keystone case is defined using index. So for
keystone this needs to be fixed.

I propose to add the following check in the designware code to address
this. Keystone uses an older version of the Designware IP and doesn't 
have the ATU support. So va_cfg0_base and va_cfg1_base are already set 
up in ks_dw_pcie_host_init() before calling dw_pcie_host_init() and 
points to the remote config space address (both same for keystone). I 
think for other DW drivers, these variables are NULL. So add a check and 
avoid this error message for Keystone. Any comments?


--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -348,7 +348,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
         struct platform_device *pdev = to_platform_device(pp->dev);
         struct of_pci_range range;
         struct of_pci_range_parser parser;
-       struct resource *cfg_res;
+       struct resource *cfg_res = NULL;
         u32 val, na, ns;
         const __be32 *addrp;
         int i, index, ret;
@@ -359,7 +359,11 @@ int dw_pcie_host_init(struct pcie_port *pp)
         of_property_read_u32(np, "#address-cells", &na);
         ns = of_n_size_cells(np);

-       cfg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 
"config");
+       if (!pp->va_cfg0_base && !pp->va_cfg0_base)
+               cfg_res = platform_get_resource_byname(pdev,
+                                                      IORESOURCE_MEM,
+                                                      "config");
+
         if (cfg_res) {
                 pp->cfg0_size = resource_size(cfg_res)/2;
                 pp->cfg1_size = resource_size(cfg_res)/2;
@@ -372,7 +376,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
                 pp->cfg0_mod_base = of_read_number(addrp, ns);
                 pp->cfg1_mod_base = pp->cfg0_mod_base + pp->cfg0_size;
         } else {
-               dev_err(pp->dev, "missing *config* reg space\n");
+               if (!pp->va_cfg0_base && !pp->va_cfg1_base)
+                       dev_err(pp->dev, "missing *config* reg space\n");
         }



-- 
Murali Karicheri
Linux Kernel, Texas Instruments

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] PCI: designware: missing *config* reg space
  2015-04-27 20:27 [RFC] PCI: designware: missing *config* reg space Murali Karicheri
@ 2015-05-10 12:54 ` Pratyush Anand
  2015-05-11 18:11   ` Murali Karicheri
  0 siblings, 1 reply; 3+ messages in thread
From: Pratyush Anand @ 2015-05-10 12:54 UTC (permalink / raw)
  To: Murali Karicheri, Jingoo Han
  Cc: Lucas Stach, KISHON VIJAY, linux-pci, devicetree, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Bjorn Helgaas, Mohit ST

On Tue, Apr 28, 2015 at 1:57 AM, Murali Karicheri <m-karicheri2@ti.com> wrote:
> All,
>
> I would like to take action to resolve the following print message thrown by
> PCI designware core driver when kernel boots up on Keystone.
>
> [    0.415778] keystone-pcie 21801000.pcie: missing *config* reg space
>
> As per DT documentation introduced by commit
> 4dd964df36d0e548e1806ec2ec275b62d4dc46e8 "PCI: designware: Look for
> configuration space in 'reg', not 'ranges'
>
> This is introduced to stop abusing the range property for defining resource
> for config space. However if the device binding doesn't have
> reg-name = "config" defined, this throws out an unnecessary log message
> at boot which seems to me not right. AFAIK, reg-names is not mandatory.
> config space address in Keystone case is defined using index. So for
> keystone this needs to be fixed.
>
> I propose to add the following check in the designware code to address
> this. Keystone uses an older version of the Designware IP and doesn't have
> the ATU support. So va_cfg0_base and va_cfg1_base are already set up in
> ks_dw_pcie_host_init() before calling dw_pcie_host_init() and points to the
> remote config space address (both same for keystone). I think for other DW
> drivers, these variables are NULL. So add a check and avoid this error
> message for Keystone. Any comments?
>

or may be just following one liner should do the job for you.

diff --git a/drivers/pci/host/pcie-designware.c
b/drivers/pci/host/pcie-designware.c
index 2e9f84fdd9ce..4ff5308f0cc6 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -371,7 +371,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
                addrp = of_get_address(np, index, NULL, NULL);
                pp->cfg0_mod_base = of_read_number(addrp, ns);
                pp->cfg1_mod_base = pp->cfg0_mod_base + pp->cfg0_size;
-       } else {
+       } else if (!pp->va_cfg0_base) {
                dev_err(pp->dev, "missing *config* reg space\n");
        }


~Pratyush

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC] PCI: designware: missing *config* reg space
  2015-05-10 12:54 ` Pratyush Anand
@ 2015-05-11 18:11   ` Murali Karicheri
  0 siblings, 0 replies; 3+ messages in thread
From: Murali Karicheri @ 2015-05-11 18:11 UTC (permalink / raw)
  To: Pratyush Anand, Jingoo Han
  Cc: Lucas Stach, KISHON VIJAY, linux-pci, devicetree, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Bjorn Helgaas, Mohit ST

On 05/10/2015 08:54 AM, Pratyush Anand wrote:
> On Tue, Apr 28, 2015 at 1:57 AM, Murali Karicheri <m-karicheri2@ti.com> wrote:
>> All,
>>
>> I would like to take action to resolve the following print message thrown by
>> PCI designware core driver when kernel boots up on Keystone.
>>
>> [    0.415778] keystone-pcie 21801000.pcie: missing *config* reg space
>>
>> As per DT documentation introduced by commit
>> 4dd964df36d0e548e1806ec2ec275b62d4dc46e8 "PCI: designware: Look for
>> configuration space in 'reg', not 'ranges'
>>
>> This is introduced to stop abusing the range property for defining resource
>> for config space. However if the device binding doesn't have
>> reg-name = "config" defined, this throws out an unnecessary log message
>> at boot which seems to me not right. AFAIK, reg-names is not mandatory.
>> config space address in Keystone case is defined using index. So for
>> keystone this needs to be fixed.
>>
>> I propose to add the following check in the designware code to address
>> this. Keystone uses an older version of the Designware IP and doesn't have
>> the ATU support. So va_cfg0_base and va_cfg1_base are already set up in
>> ks_dw_pcie_host_init() before calling dw_pcie_host_init() and points to the
>> remote config space address (both same for keystone). I think for other DW
>> drivers, these variables are NULL. So add a check and avoid this error
>> message for Keystone. Any comments?
>>
> or may be just following one liner should do the job for you.
>
> diff --git a/drivers/pci/host/pcie-designware.c
> b/drivers/pci/host/pcie-designware.c
> index 2e9f84fdd9ce..4ff5308f0cc6 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -371,7 +371,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
>                  addrp = of_get_address(np, index, NULL, NULL);
>                  pp->cfg0_mod_base = of_read_number(addrp, ns);
>                  pp->cfg1_mod_base = pp->cfg0_mod_base + pp->cfg0_size;
> -       } else {
> +       } else if (!pp->va_cfg0_base) {
>                  dev_err(pp->dev, "missing *config* reg space\n");
>          }
Yes. That will work. I will post a patch for this.

Murali
>
> ~Pratyush
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Murali Karicheri
Linux Kernel, Keystone

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-11 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-27 20:27 [RFC] PCI: designware: missing *config* reg space Murali Karicheri
2015-05-10 12:54 ` Pratyush Anand
2015-05-11 18:11   ` Murali Karicheri

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.