All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Jingoo Han <jg1.han@samsung.com>
Cc: "'Kishon Vijay Abraham I'" <kishon@ti.com>,
	"'Mohit Kumar'" <mohit.kumar@st.com>,
	"'Pratyush Anand'" <pratyush.anand@st.com>,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-pci@vger.kernel.org, bhelgaas@google.com,
	robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	rob@landley.net, linux@arm.linux.org.uk, tony@atomide.com,
	rnayak@ti.com, paul@pwsan.com,
	"'Richard Zhu'" <r65037@freescale.com>
Subject: Re: [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU
Date: Thu, 27 Mar 2014 18:32:11 +0100	[thread overview]
Message-ID: <201403271832.11425.marex@denx.de> (raw)
In-Reply-To: <000001cf49b1$fcd8a810$f689f830$%han@samsung.com>

On Thursday, March 27, 2014 at 12:45:01 PM, Jingoo Han wrote:
> On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
> > In DRA7, the cpu sees 32bit address, but the pcie controller can see only
> > 28bit address. So whenever the cpu issues a read/write request, the 4
> > most significant bits are used by L3 to determine the target controller.
> > For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe
> > controller but the PCIe controller will see only (0x000_0000 -
> > 0xFFF_FFF). So for programming the outbound translation window the
> > *base* should be programmed as 0x000_0000. Whenever we try to write to
> > say 0x2000_0000, it will be translated to whatever we have programmed in
> > the translation window with base as 0x000_0000.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> 
> (+cc Pratyush Anand, Marek Vasut, Richard Zhu)

Thanks.

> Acked-by: Jingoo Han <jg1.han@samsung.com>

This patch has no impact on MX6, the mask on MX6 is ~0 . A few comments below 
...
[...]

> > diff --git a/drivers/pci/host/pcie-designware.c
> > b/drivers/pci/host/pcie-designware.c index 17ce88f..98b661c 100644
> > --- a/drivers/pci/host/pcie-designware.c
> > +++ b/drivers/pci/host/pcie-designware.c
> > @@ -464,6 +464,9 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
> > 
> >  		return -EINVAL;
> >  	
> >  	}
> > 
> > +	if (of_property_read_u64(np, "base-mask", &pp->base_mask))
> > +		pp->base_mask = ~(0x0ULL);

You can just use ~0x0ULL without the () I believe.

[...]

> > diff --git a/drivers/pci/host/pcie-designware.h
> > b/drivers/pci/host/pcie-designware.h index 3063b35..3fa12a6 100644
> > --- a/drivers/pci/host/pcie-designware.h
> > +++ b/drivers/pci/host/pcie-designware.h
> > @@ -35,6 +35,7 @@ struct pcie_port {
> > 
> >  	struct device		*dev;
> >  	u8			root_bus_nr;
> >  	void __iomem		*dbi_base;
> > 
> > +	u64			base_mask;
> > 
> >  	u64			cfg0_base;
> >  	void __iomem		*va_cfg0_base;
> >  	u64			cfg1_base;

This structure contains a lot of slop, check [1] please. We really should be 
more careful about the structures. I think a separate patch to clean this up 
would be fine though.

[1] http://www.catb.org/esr/structure-packing/

WARNING: multiple messages have this Message-ID (diff)
From: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
To: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: 'Kishon Vijay Abraham I' <kishon-l0cyMroinI0@public.gmane.org>,
	'Mohit Kumar' <mohit.kumar-qxv4g6HH51o@public.gmane.org>,
	'Pratyush Anand' <pratyush.anand-qxv4g6HH51o@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
	rnayak-l0cyMroinI0@public.gmane.org,
	paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org,
	'Richard Zhu' <r65037-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Subject: Re: [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU
Date: Thu, 27 Mar 2014 18:32:11 +0100	[thread overview]
Message-ID: <201403271832.11425.marex@denx.de> (raw)
In-Reply-To: <000001cf49b1$fcd8a810$f689f830$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

On Thursday, March 27, 2014 at 12:45:01 PM, Jingoo Han wrote:
> On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
> > In DRA7, the cpu sees 32bit address, but the pcie controller can see only
> > 28bit address. So whenever the cpu issues a read/write request, the 4
> > most significant bits are used by L3 to determine the target controller.
> > For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe
> > controller but the PCIe controller will see only (0x000_0000 -
> > 0xFFF_FFF). So for programming the outbound translation window the
> > *base* should be programmed as 0x000_0000. Whenever we try to write to
> > say 0x2000_0000, it will be translated to whatever we have programmed in
> > the translation window with base as 0x000_0000.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> 
> (+cc Pratyush Anand, Marek Vasut, Richard Zhu)

Thanks.

> Acked-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

This patch has no impact on MX6, the mask on MX6 is ~0 . A few comments below 
...
[...]

> > diff --git a/drivers/pci/host/pcie-designware.c
> > b/drivers/pci/host/pcie-designware.c index 17ce88f..98b661c 100644
> > --- a/drivers/pci/host/pcie-designware.c
> > +++ b/drivers/pci/host/pcie-designware.c
> > @@ -464,6 +464,9 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
> > 
> >  		return -EINVAL;
> >  	
> >  	}
> > 
> > +	if (of_property_read_u64(np, "base-mask", &pp->base_mask))
> > +		pp->base_mask = ~(0x0ULL);

You can just use ~0x0ULL without the () I believe.

[...]

> > diff --git a/drivers/pci/host/pcie-designware.h
> > b/drivers/pci/host/pcie-designware.h index 3063b35..3fa12a6 100644
> > --- a/drivers/pci/host/pcie-designware.h
> > +++ b/drivers/pci/host/pcie-designware.h
> > @@ -35,6 +35,7 @@ struct pcie_port {
> > 
> >  	struct device		*dev;
> >  	u8			root_bus_nr;
> >  	void __iomem		*dbi_base;
> > 
> > +	u64			base_mask;
> > 
> >  	u64			cfg0_base;
> >  	void __iomem		*va_cfg0_base;
> >  	u64			cfg1_base;

This structure contains a lot of slop, check [1] please. We really should be 
more careful about the structures. I think a separate patch to clean this up 
would be fine though.

[1] http://www.catb.org/esr/structure-packing/
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU
Date: Thu, 27 Mar 2014 18:32:11 +0100	[thread overview]
Message-ID: <201403271832.11425.marex@denx.de> (raw)
In-Reply-To: <000001cf49b1$fcd8a810$f689f830$%han@samsung.com>

On Thursday, March 27, 2014 at 12:45:01 PM, Jingoo Han wrote:
> On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
> > In DRA7, the cpu sees 32bit address, but the pcie controller can see only
> > 28bit address. So whenever the cpu issues a read/write request, the 4
> > most significant bits are used by L3 to determine the target controller.
> > For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe
> > controller but the PCIe controller will see only (0x000_0000 -
> > 0xFFF_FFF). So for programming the outbound translation window the
> > *base* should be programmed as 0x000_0000. Whenever we try to write to
> > say 0x2000_0000, it will be translated to whatever we have programmed in
> > the translation window with base as 0x000_0000.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> 
> (+cc Pratyush Anand, Marek Vasut, Richard Zhu)

Thanks.

> Acked-by: Jingoo Han <jg1.han@samsung.com>

This patch has no impact on MX6, the mask on MX6 is ~0 . A few comments below 
...
[...]

> > diff --git a/drivers/pci/host/pcie-designware.c
> > b/drivers/pci/host/pcie-designware.c index 17ce88f..98b661c 100644
> > --- a/drivers/pci/host/pcie-designware.c
> > +++ b/drivers/pci/host/pcie-designware.c
> > @@ -464,6 +464,9 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
> > 
> >  		return -EINVAL;
> >  	
> >  	}
> > 
> > +	if (of_property_read_u64(np, "base-mask", &pp->base_mask))
> > +		pp->base_mask = ~(0x0ULL);

You can just use ~0x0ULL without the () I believe.

[...]

> > diff --git a/drivers/pci/host/pcie-designware.h
> > b/drivers/pci/host/pcie-designware.h index 3063b35..3fa12a6 100644
> > --- a/drivers/pci/host/pcie-designware.h
> > +++ b/drivers/pci/host/pcie-designware.h
> > @@ -35,6 +35,7 @@ struct pcie_port {
> > 
> >  	struct device		*dev;
> >  	u8			root_bus_nr;
> >  	void __iomem		*dbi_base;
> > 
> > +	u64			base_mask;
> > 
> >  	u64			cfg0_base;
> >  	void __iomem		*va_cfg0_base;
> >  	u64			cfg1_base;

This structure contains a lot of slop, check [1] please. We really should be 
more careful about the structures. I think a separate patch to clean this up 
would be fine though.

[1] http://www.catb.org/esr/structure-packing/

  parent reply	other threads:[~2014-03-27 17:32 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 01/12] phy: phy-omap-pipe3: Add support for PCIe PHY Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 14:45   ` Rob Herring
2014-03-26 14:45     ` Rob Herring
2014-03-26 14:45     ` Rob Herring
2014-03-26 15:19     ` Kishon Vijay Abraham I
2014-03-26 15:19       ` Kishon Vijay Abraham I
2014-03-26 15:19       ` Kishon Vijay Abraham I
2014-03-26 15:19       ` Kishon Vijay Abraham I
2014-03-27  3:43   ` Jingoo Han
2014-03-27  3:43     ` Jingoo Han
2014-03-27  5:26     ` Kishon Vijay Abraham I
2014-03-27  5:26       ` Kishon Vijay Abraham I
2014-03-27  5:26       ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-27 11:45   ` Jingoo Han
2014-03-27 11:45     ` Jingoo Han
2014-03-27 11:53     ` Mohit KUMAR DCG
2014-03-27 11:53       ` Mohit KUMAR DCG
2014-03-27 11:53       ` Mohit KUMAR DCG
2014-03-27 11:53       ` Mohit KUMAR DCG
2014-03-27 17:32     ` Marek Vasut [this message]
2014-03-27 17:32       ` Marek Vasut
2014-03-27 17:32       ` Marek Vasut
2014-03-26 13:57 ` [RFC PATCH 04/12] ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 05/12] ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 06/12] arm: dra7xx: Add hwmod data for pcie1 phy and pcie2 phy Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 07/12] arm: dra7xx: Add hwmod data for pcie1 and pcie2 subsystems Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 08/12] ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 09/12] ARM: dts: dra7: Add dt data for PCIe PHY control module Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 10/12] ARM: dts: dra7: Add dt data for PCIe PHY Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 11/12] ARM: dts: dra7: Add dt data for PCIe controller Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 12/12] ARM: OMAP: Enable PCI for DRA7 Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I
2014-03-26 13:57   ` Kishon Vijay Abraham I

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=201403271832.11425.marex@denx.de \
    --to=marex@denx.de \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jg1.han@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mohit.kumar@st.com \
    --cc=paul@pwsan.com \
    --cc=pawel.moll@arm.com \
    --cc=pratyush.anand@st.com \
    --cc=r65037@freescale.com \
    --cc=rnayak@ti.com \
    --cc=rob@landley.net \
    --cc=robh+dt@kernel.org \
    --cc=tony@atomide.com \
    /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 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.