From: Lian Minghuan-b31939 <b31939@freescale.com>
To: Scott Wood <scottwood@freescale.com>,
Minghuan Lian <Minghuan.Lian@freescale.com>
Cc: <linuxppc-dev@lists.ozlabs.org>, <linux-pci@vger.kernel.org>,
Zang Roy-R61911 <r61911@freescale.com>,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [03/12,v3] pci: fsl: add PCI indirect access support
Date: Mon, 6 Jan 2014 13:36:24 +0800 [thread overview]
Message-ID: <52CA40D8.1090805@freescale.com> (raw)
In-Reply-To: <20140103223306.GC22546@home.buserror.net>
HI Scott,
please see my comments inline.
On 01/04/2014 06:33 AM, Scott Wood wrote:
> On Wed, Oct 23, 2013 at 06:41:25PM +0800, Minghuan Lian wrote:
>> The patch adds PCI indirect read/write functions. The main code
>> is ported from arch/powerpc/sysdev/indirect_pci.c. We use general
>> IO API iowrite32be/ioread32be instead of out_be32/in_be32, and
>> use structure fsl_Pci instead of PowerPC's pci_controller.
>> The patch also provides fsl_pcie_check_link() to check PCI link.
>> The weak function fsl_arch_pci_exclude_device() is provided to
>> call ppc_md.pci_exclude_device() for PowerPC architecture.
>>
>> Signed-off-by: Minghuan Lian <Minghuan.Lian@freescale.com>
>>
>> ---
>> change log:
>> v1-v3:
>> Derived from http://patchwork.ozlabs.org/patch/278965/
>>
>> Based on upstream master.
>> Based on the discussion of RFC version here
>> http://patchwork.ozlabs.org/patch/274487/
>>
>> drivers/pci/host/pci-fsl-common.c | 169 ++++++++++++++++++++++++++++++++------
>> include/linux/fsl/pci-common.h | 6 ++
>> 2 files changed, 151 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-fsl-common.c b/drivers/pci/host/pci-fsl-common.c
>> index 69d338b..8bc9a64 100644
>> --- a/drivers/pci/host/pci-fsl-common.c
>> +++ b/drivers/pci/host/pci-fsl-common.c
>> @@ -35,52 +35,173 @@
>> #include <sysdev/fsl_soc.h>
>> #include <sysdev/fsl_pci.h>
>>
>> -static int fsl_pcie_check_link(struct pci_controller *hose)
>> +/* Indirect type */
>> +#define INDIRECT_TYPE_EXT_REG 0x00000002
>> +#define INDIRECT_TYPE_SURPRESS_PRIMARY_BUS 0x00000004
>> +#define INDIRECT_TYPE_NO_PCIE_LINK 0x00000008
>> +#define INDIRECT_TYPE_BIG_ENDIAN 0x00000010
>> +#define INDIRECT_TYPE_FSL_CFG_REG_LINK 0x00000040
> Why are these here rather than in the header, given that you have
> indirect_type in the struct in the header?
[Minghuan] It's better to define the type in the header file. I will fix it.
>
>> +int __weak fsl_arch_pci_exclude_device(struct fsl_pci *pci, u8 bus, u8 devfn)
>> +{
>> + return PCIBIOS_SUCCESSFUL;
>> +}
>> +
>> +static int fsl_pci_read_config(struct fsl_pci *pci, int bus, int devfn,
>> + int offset, int len, u32 *val)
>> +{
>> + u32 bus_no, reg, data;
>> +
>> + if (pci->indirect_type & INDIRECT_TYPE_NO_PCIE_LINK) {
>> + if (bus != pci->first_busno)
>> + return PCIBIOS_DEVICE_NOT_FOUND;
>> + if (devfn != 0)
>> + return PCIBIOS_DEVICE_NOT_FOUND;
>> + }
> A lot of this seems duplicated from arch/powerpc/sysdev/indirect_pci.c.
>
> How generally applicable is that file to non-PPC implementations? At a
> minimum I see a similar file in arch/microblaze. It should probably
> eventually be moved to common code, rather than duplicated again. A
> prerequisite for that would be making common the dependencies it has on
> the rest of what is currently arch PCI infrastructure; until then, it's
> probably better to just have the common fsl-pci code know how to
> interface with the appropriate PPC/ARM code rather than trying to copy
> the infrastructure as well.
[Minghuan] Yes, This is a duplicate except it uses struct fsl_pci. But
it is hard to be move to common code.
because every indirect read/write functions use different PCI controller
structure which is very basic structure and ARM has no this structure.
If we can not establish a unified pci controller structure, we can only
abstract out a simple structure which includes indirect access related
fields,
and need a callback function to get the pointer like this:
((powerpc/microblaze/mips/ pci_controller
*)(pci_bus->sysdata))->indirect_struct.
Should we provide the common code for indirect access API or wait for
the common PCI controller structure?
> -Scott
WARNING: multiple messages have this Message-ID (diff)
From: Lian Minghuan-b31939 <b31939@freescale.com>
To: Scott Wood <scottwood@freescale.com>,
Minghuan Lian <Minghuan.Lian@freescale.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Zang Roy-R61911 <r61911@freescale.com>
Subject: Re: [03/12,v3] pci: fsl: add PCI indirect access support
Date: Mon, 6 Jan 2014 13:36:24 +0800 [thread overview]
Message-ID: <52CA40D8.1090805@freescale.com> (raw)
In-Reply-To: <20140103223306.GC22546@home.buserror.net>
HI Scott,
please see my comments inline.
On 01/04/2014 06:33 AM, Scott Wood wrote:
> On Wed, Oct 23, 2013 at 06:41:25PM +0800, Minghuan Lian wrote:
>> The patch adds PCI indirect read/write functions. The main code
>> is ported from arch/powerpc/sysdev/indirect_pci.c. We use general
>> IO API iowrite32be/ioread32be instead of out_be32/in_be32, and
>> use structure fsl_Pci instead of PowerPC's pci_controller.
>> The patch also provides fsl_pcie_check_link() to check PCI link.
>> The weak function fsl_arch_pci_exclude_device() is provided to
>> call ppc_md.pci_exclude_device() for PowerPC architecture.
>>
>> Signed-off-by: Minghuan Lian <Minghuan.Lian@freescale.com>
>>
>> ---
>> change log:
>> v1-v3:
>> Derived from http://patchwork.ozlabs.org/patch/278965/
>>
>> Based on upstream master.
>> Based on the discussion of RFC version here
>> http://patchwork.ozlabs.org/patch/274487/
>>
>> drivers/pci/host/pci-fsl-common.c | 169 ++++++++++++++++++++++++++++++++------
>> include/linux/fsl/pci-common.h | 6 ++
>> 2 files changed, 151 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-fsl-common.c b/drivers/pci/host/pci-fsl-common.c
>> index 69d338b..8bc9a64 100644
>> --- a/drivers/pci/host/pci-fsl-common.c
>> +++ b/drivers/pci/host/pci-fsl-common.c
>> @@ -35,52 +35,173 @@
>> #include <sysdev/fsl_soc.h>
>> #include <sysdev/fsl_pci.h>
>>
>> -static int fsl_pcie_check_link(struct pci_controller *hose)
>> +/* Indirect type */
>> +#define INDIRECT_TYPE_EXT_REG 0x00000002
>> +#define INDIRECT_TYPE_SURPRESS_PRIMARY_BUS 0x00000004
>> +#define INDIRECT_TYPE_NO_PCIE_LINK 0x00000008
>> +#define INDIRECT_TYPE_BIG_ENDIAN 0x00000010
>> +#define INDIRECT_TYPE_FSL_CFG_REG_LINK 0x00000040
> Why are these here rather than in the header, given that you have
> indirect_type in the struct in the header?
[Minghuan] It's better to define the type in the header file. I will fix it.
>
>> +int __weak fsl_arch_pci_exclude_device(struct fsl_pci *pci, u8 bus, u8 devfn)
>> +{
>> + return PCIBIOS_SUCCESSFUL;
>> +}
>> +
>> +static int fsl_pci_read_config(struct fsl_pci *pci, int bus, int devfn,
>> + int offset, int len, u32 *val)
>> +{
>> + u32 bus_no, reg, data;
>> +
>> + if (pci->indirect_type & INDIRECT_TYPE_NO_PCIE_LINK) {
>> + if (bus != pci->first_busno)
>> + return PCIBIOS_DEVICE_NOT_FOUND;
>> + if (devfn != 0)
>> + return PCIBIOS_DEVICE_NOT_FOUND;
>> + }
> A lot of this seems duplicated from arch/powerpc/sysdev/indirect_pci.c.
>
> How generally applicable is that file to non-PPC implementations? At a
> minimum I see a similar file in arch/microblaze. It should probably
> eventually be moved to common code, rather than duplicated again. A
> prerequisite for that would be making common the dependencies it has on
> the rest of what is currently arch PCI infrastructure; until then, it's
> probably better to just have the common fsl-pci code know how to
> interface with the appropriate PPC/ARM code rather than trying to copy
> the infrastructure as well.
[Minghuan] Yes, This is a duplicate except it uses struct fsl_pci. But
it is hard to be move to common code.
because every indirect read/write functions use different PCI controller
structure which is very basic structure and ARM has no this structure.
If we can not establish a unified pci controller structure, we can only
abstract out a simple structure which includes indirect access related
fields,
and need a callback function to get the pointer like this:
((powerpc/microblaze/mips/ pci_controller
*)(pci_bus->sysdata))->indirect_struct.
Should we provide the common code for indirect access API or wait for
the common PCI controller structure?
> -Scott
next prev parent reply other threads:[~2014-01-06 5:35 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 10:41 [PATCH 01/12][v3] pci: fsl: derive the common PCI driver to drivers/pci/host Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-23 10:41 ` [PATCH 02/12][v3] pci: fsl: add structure fsl_pci Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-24 4:11 ` Kumar Gala
2013-10-24 4:11 ` Kumar Gala
2013-10-24 4:11 ` Kumar Gala
2013-10-24 4:15 ` Zang Roy-R61911
2013-10-24 4:15 ` Zang Roy-R61911
2013-10-24 4:15 ` Zang Roy-R61911
2013-10-25 5:58 ` Lian Minghuan-b31939
2013-10-25 5:58 ` Lian Minghuan-b31939
2013-10-25 5:58 ` Lian Minghuan-b31939
2013-10-28 18:22 ` Scott Wood
2013-10-28 18:22 ` Scott Wood
2013-10-28 18:22 ` Scott Wood
2014-01-03 22:19 ` [02/12,v3] " Scott Wood
2014-01-03 22:19 ` Scott Wood
2014-01-06 6:10 ` Lian Minghuan-b31939
2014-01-06 6:10 ` Lian Minghuan-b31939
2014-01-07 8:33 ` Scott Wood
2014-01-07 8:33 ` Scott Wood
2014-01-22 23:38 ` Roy Zang
2014-01-22 23:38 ` Roy Zang
2013-10-23 10:41 ` [PATCH 03/12][v3] pci: fsl: add PCI indirect access support Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2014-01-03 22:33 ` [03/12,v3] " Scott Wood
2014-01-03 22:33 ` Scott Wood
2014-01-06 5:36 ` Lian Minghuan-b31939 [this message]
2014-01-06 5:36 ` Lian Minghuan-b31939
2014-01-07 7:13 ` Scott Wood
2014-01-07 7:13 ` Scott Wood
2013-10-23 10:41 ` [PATCH 04/12][v3] pci: fsl: add early " Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-23 10:41 ` [PATCH 05/12][v3] pci: fsl: port PCI ATMU related code Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-23 10:41 ` [PATCH 06/12][v3] pci: fsl: port PCI controller setup code Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-23 10:41 ` [PATCH 07/12][v3] pci: fsl: port PCI platform driver Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-23 10:41 ` [PATCH 08/12][v3] pci: fsl: add PowerPC PCI driver Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-23 10:41 ` [PATCH 09/12][v3] pci: fsl: update PCI PM driver Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-23 10:41 ` [PATCH 10/12][v3] pci: fsl: support function fsl_pci_assign_primary Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-10-23 10:41 ` [PATCH 11/12][v3] pci: fsl: update PCI EDAC driver Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2014-01-03 22:16 ` [11/12,v3] " Scott Wood
2014-01-03 22:16 ` Scott Wood
2014-01-06 3:57 ` Lian Minghuan-b31939
2014-01-06 3:57 ` Lian Minghuan-b31939
2013-10-23 10:41 ` [PATCH 12/12][v3] pci: fsl: fix function check_pci_ctl_endpt_part Minghuan Lian
2013-10-23 10:41 ` Minghuan Lian
2013-11-25 23:01 ` [PATCH 01/12][v3] pci: fsl: derive the common PCI driver to drivers/pci/host Bjorn Helgaas
2013-11-25 23:01 ` Bjorn Helgaas
2014-01-03 22:37 ` Scott Wood
2014-01-03 22:37 ` Scott Wood
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=52CA40D8.1090805@freescale.com \
--to=b31939@freescale.com \
--cc=Minghuan.Lian@freescale.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=r61911@freescale.com \
--cc=scottwood@freescale.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.