Re: SB600 for the Nemo board has non-zero devices on non-root bus

2018-06-04 Thread Michael Ellerman
On Wed, 2017-12-06 at 11:03:52 UTC, Christian Zigotzky wrote:
> On 06 December 2017 at 09:37AM, Christian Zigotzky wrote:
>  > On 03 December 2017 at 10:43AM, Christian Zigotzky wrote:
>  > >
>  > > On 3. Dec 2017, at 00:02, Olof Johansson  wrote:
>  > >>
>  > >> Typo, should be ';', not ':'. I obviously didn't even try 
> compiling this. :)
>  > >>
>  > >>
>  > >> -Olof
>  > >
>  > > Hi Olof,
>  > >
>  > > Thanks a lot for your patch! I will test it on Wednesday.
>  > >
>  > > Cheers,
>  > > Christian
>  >
>  >
>  > Hi Olof,
>  >
>  > I tested your patch today. Unfortunately the kernel 4.15-rc2 doesn't 
> compile with your patch.
>  >
>  > Error messages:
>  >
>  >                        ^
>  > arch/powerpc/platforms/pasemi/pci.c: In function ‘pas_pci_init’:
>  > arch/powerpc/platforms/pasemi/pci.c:298:2: error: implicit 
> declaration of function ‘pci_set_flag’ 
> [-Werror=implicit-function-declaration]
>  >   pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS);
>  >   ^~~~
>  > cc1: some warnings being treated as errors
>  >
>  > ---
>  >
>  > I figured out that we need 'pci_set_flags' instead of 'pci_set_flag'. 
> I modified your patch and after that the kernel compiles. Please find 
> attached the new patch.
>  >
>  > Cheers,
>  > Christian
> 
> Hi Olof,
> 
> Many thanks for your patch! :-) The RC2 of kernel 4.15 boots without any 
> problems on my P.A. Semi Nemo board (A-EON AmigaOne X1000). I don’t need 
> the additional boot argument 'pci=pcie_scan_all' anymore.
> 
> Is it possible to merge it via the powerpc tree?
> 
> Thanks,
> Christian
> 
> arch/powerpc/platforms/pasemi/pci.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/pasemi/pci.c 
> b/arch/powerpc/platforms/pasemi/pci.c
> index 5ff6108..ea54ed2 100644
> --- a/arch/powerpc/platforms/pasemi/pci.c
> +++ b/arch/powerpc/platforms/pasemi/pci.c
> @@ -224,6 +224,8 @@ void __init pas_pci_init(void)
>   return;
>   }
>  
> + pci_set_flags(PCI_SCAN_ALL_PCIE_DEVS);
> +
>   for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
>   if (np->name && !strcmp(np->name, "pxp") && !pas_add_bridge(np))
>   of_node_get(np);

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/eff06ef0891d200eb0ddd156c6e96c

cheers


[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-22 Thread Christian Zigotzky

Hi Michael,

Thanks a lot for your reply! :-)

I have found two interesting lines in the device tree:

compatible   "pasemi,nemo"
model    "pasemi,nemo"

What do you think?

Please find attached the output of `lsprop /proc/device-tree`.

Thanks,
Christian


On 22.12.2017 12:19, Michael Ellerman wrote:
>
> I suspect Darren was referring to all of sb600_set_flag().
>
> What we'd really like is to be able to do something like:
>
> void __init pas_pci_init(void)
> {
>     ...
>
>     if (of_find_compatible_node(NULL, NULL, "nemo-something"))
>         pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS).
>
>
> But I don't know if there's anything in the NEMO device tree that we can
> use to uniquely identify those machines? ie. the "nemo-something" string.
>
> Can you attach the output of `lsprop /proc/device-tree` ?
>
> cheers
>


compatible   "pasemi,nemo"
 "pasemi,pa6t-1682m"
 "PA6T-1682M"
 "pasemi,pwrficient"
 "pasemi"
device_type  "bootrom"
model"pasemi,nemo"
#interrupt-cells 0002
#address-cells   0002
#size-cells  0002
linux,phandle7fdff018 (2145382424)
platform-open-pic  fc00  00041000
name ""

/proc/device-tree/sdc@fc00:
compatible   "1682m-sdc"
 "pasemi,pwrficient-sdc"
 "pasemi,sdc"
device_type  "sdc"
#address-cells   0001
#size-cells  0001
reg   fc00  0080
linux,phandle7fe2f458 (2145580120)
name "sdc"

/proc/device-tree/sdc@fc00/rng@fc105000:
compatible   "1682m-rng"
 "pasemi,pwrficient-rng"
 "pasemi,rng"
device_type  "rng"
reg  fc105000 1000
linux,phandle7fe2fdd0 (2145582544)
name "rng"

/proc/device-tree/sdc@fc00/mdio@0:
compatible   "gpio-mdio"
mdc-pin  0005
#address-cells   0001
#size-cells  
reg   
linux,phandle7fe3d5a0 (2145637792)
mdio-pin 0006
name "mdio"

/proc/device-tree/sdc@fc00/mdio@0/ethernet-phy@0:
interrupt-parent 7fe2f6e8 (2145580776)
interrupts   0007 0001
reg  
linux,phandle7fe3d860 (2145638496)
name "ethernet-phy"

/proc/device-tree/sdc@fc00/openpic@fc00:
compatible   "pasemi,pwrficient-openpic"
 "chrp,open-pic"
device_type  "open-pic"
msi-available-ranges 0200 0200
#interrupt-cells 0002
#address-cells   
reg  fc00 0010
linux,phandle7fe2f6e8 (2145580776)
name "openpic"
interrupt-controller

/proc/device-tree/sdc@fc00/gizmo@fc104000:
compatible   "1682m-gizmo"
 "pasemi,pwrficient-gizmo"
 "pasemi,gizmo"
device_type  "gizmo"
reg  fc104000 1000
linux,phandle7fe2fbf0 (2145582064)
name "gizmo"

/proc/device-tree/sdc@fc00/gpio@fc103000:
compatible   "1682m-gpio"
 "pasemi,pwrficient-gpio"
 "pasemi,gpio"
device_type  "gpio"
reg  fc103000 1000
linux,phandle7fe2fa18 (2145581592)
name "gpio"

/proc/device-tree/options:
MENU_2_LABEL "Debian Sid/experimental Kernel 4.9"
MENU_4_COMMAND   "set pmu -astate=A4 ; ramdisk -z -addr=0x2400 -fatfs 
cf0:slitaz25.gz ; boot -elf -noints -fatfs cf0:vmlinux-3.13.14"
ETH0_HWADDR  "00:50:C2:20:DA:9E"
CFE_MEMORYSIZE   "8192"
MENU_5_LABEL "Fedora 17 Kernel 3.13.9"
MENU_8_LABEL "ubuntu MATE 16.04.2 LTS Kernel 4.9"
MENU_1_COMMAND   "setenv amigaboot_quiet Y ;boot -fs=iso atapi0.1:amigaboot.of"
MENU_8_COMMAND   "set pmu -astate=A4 ; setenv bootargs "root=/dev/sdb1 quiet ro 
splash" ; boot -elf -noints -fatfs cf0:vmlinux-4.9"
bootargs "root=/dev/sda4"
STARTUP  "speed;menu"
MENU_DEFAULT "0"
MENU_0_LABEL "AmigaOS"
MENU_5_COMMAND   73657420 706d7520 2d617374 6174653d
 4134203b 20736574 656e7620 626f6f74
 61726773 20227264 2e6d643d 30207264
 2e6c766d 3d302072 642e646d 3d302053
 5953464f 4e543d54 72756520 4b455954
 41424c45 3d646520 72642e6c 756b733d
 3020726f 6f743d2f 6465762f 73646233
 204c414e 473d6465 5f44452e 5554462d
 [191 bytes total]
MENU_3_LABEL "ubuntu MATE 17.04 Kernel 4.9"
MENU_6_LABEL "Fedora 25 PPC64 Kernel 4.9"
MENU_2_COMMAND   "set pmu -astate=A4 ; setenv bootargs "root=/dev/sda4" ; boot 
-elf -noints -fatfs cf0:vmlinux-4.9"
MENU_9_LABEL "openSUSE Tumbleweed Kernel 4.14"
speed"set pmu -astate=A4"
MENU_9_COMMAND   "set pmu -astate=A4 ; setenv bootargs "root=/dev/sdb6 
splash=silent" ; boot -elf -noints -fatfs cf0:vmlinux-4.14"
BOOT_CONSOLE "pcconsole0"
CFE_VERSION  "PAS-2.0.30"
little-endian?   
MENU_6_COMMAND   "set pmu -astate=A4 ; setenv bootargs 

Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-22 Thread Michael Ellerman
Christian Zigotzky  writes:

> Hi Bjorn,
>
> Sorry I'm bothering you again. Is this small out of tree init routine in 
> the Nemo patch? I haven't get an answer from Darren yet and I didn't 
> found the small out of tree init routine in the Nemo patch. Please find 
> attached the Nemo patch. Maybe you can find this small out of tree init 
> routine.
>
> What do you think of this following code?
>
> if (sb600_bus == -1)
> +   {
> +   busp = pci_find_bus(0, 0);
> +   pa_pxp_read_config(busp, PCI_DEVFN(17,0), 
> PCI_SECONDARY_BUS, 1, );
> +
> +   sb600_bus = val;
> +
> +   printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
> +   }

I suspect Darren was referring to all of sb600_set_flag().

What we'd really like is to be able to do something like:

void __init pas_pci_init(void)
{
...

if (of_find_compatible_node(NULL, NULL, "nemo-something"))
pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS).


But I don't know if there's anything in the NEMO device tree that we can
use to uniquely identify those machines? ie. the "nemo-something" string.

Can you attach the output of `lsprop /proc/device-tree` ?

cheers


[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-22 Thread Christian Zigotzky
I mean: I haven't gotten an answer from Darren yet. Sorry because of my 
English. I am still learning.


-- Christian


On 22 December 2017 at 10:57AM, Christian Zigotzky wrote:
> Hi Bjorn,
>
> Sorry I'm bothering you again. Is this small out of tree init routine 
in the Nemo patch? I haven't get an answer from Darren yet and I didn't 
found the small out of tree init routine in the Nemo patch. Please find 
attached the Nemo patch. Maybe you can find this small out of tree init 
routine.

>
> What do you think of this following code?
>
> if (sb600_bus == -1)
> +   {
> +   busp = pci_find_bus(0, 0);
> +   pa_pxp_read_config(busp, PCI_DEVFN(17,0), 
PCI_SECONDARY_BUS, 1, );

> +
> +   sb600_bus = val;
> +
> +   printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
> +   }
>
> Thanks,
> Christian
>
>
> On 04 December 2017 at 12:40PM, Darren Stevens wrote:
> > Hello Bjorn
> >
> > Firstly sorry for not being able to join in this discussion, I have 
been

> > moving house and only got my X1000 set up again yesterday..
> >
> > On 30/11/2017, Bjorn Helgaas wrote:
> >> I *think* something like the patch below should make this work if you
> >> use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
> >> that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
> >> something similar on powerpc, but maybe you do?
> >
> > Actually the root ports on the Nemo's PA6T processor don't respond 
to the
> > SB600 unless we turn on a special 'relax pci-e' bit in one of its 
control
> > registers. We use a small out of tree init routine to do this, and 
there

> > would be the ideal place to put a call to
> > pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS).
> >
> > This patch fixes the last major hurdle to getting the X1000 fully 
supported in

> > the linux kernel, so thanks very much for that.
> >
> > Regards
> > Darren
> >
> >
>




[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-22 Thread Christian Zigotzky

Hi Bjorn,

Sorry I'm bothering you again. Is this small out of tree init routine in 
the Nemo patch? I haven't get an answer from Darren yet and I didn't 
found the small out of tree init routine in the Nemo patch. Please find 
attached the Nemo patch. Maybe you can find this small out of tree init 
routine.


What do you think of this following code?

if (sb600_bus == -1)
+   {
+   busp = pci_find_bus(0, 0);
+   pa_pxp_read_config(busp, PCI_DEVFN(17,0), 
PCI_SECONDARY_BUS, 1, );

+
+   sb600_bus = val;
+
+   printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
+   }

Thanks,
Christian


On 04 December 2017 at 12:40PM, Darren Stevens wrote:
> Hello Bjorn
>
> Firstly sorry for not being able to join in this discussion, I have been
> moving house and only got my X1000 set up again yesterday..
>
> On 30/11/2017, Bjorn Helgaas wrote:
>> I *think* something like the patch below should make this work if you
>> use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
>> that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
>> something similar on powerpc, but maybe you do?
>
> Actually the root ports on the Nemo's PA6T processor don't respond to the
> SB600 unless we turn on a special 'relax pci-e' bit in one of its control
> registers. We use a small out of tree init routine to do this, and there
> would be the ideal place to put a call to
> pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS).
>
> This patch fixes the last major hurdle to getting the X1000 fully 
supported in

> the linux kernel, so thanks very much for that.
>
> Regards
> Darren
>
>

diff -rupN a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
--- a/arch/powerpc/platforms/pasemi/pci.c	2017-09-11 17:04:18.257586417 +0200
+++ b/arch/powerpc/platforms/pasemi/pci.c	2017-09-11 17:03:43.040599938 +0200
@@ -27,6 +27,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -108,6 +109,69 @@ static int workaround_5945(struct pci_bu
 	return 1;
 }
 
+#ifdef CONFIG_PPC_PASEMI_NEMO
+static int sb600_bus = 5;
+static void __iomem *iob_mapbase = NULL;
+
+static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 *val);
+
+static void sb600_set_flag(int bus)
+{
+struct resource res;
+struct device_node *dn;
+   struct pci_bus *busp;
+   u32 val;
+   int err;
+
+   if (sb600_bus == -1)
+   {
+   busp = pci_find_bus(0, 0);
+   pa_pxp_read_config(busp, PCI_DEVFN(17,0), PCI_SECONDARY_BUS, 1, );
+
+   sb600_bus = val;
+
+   printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
+   }
+
+   if (iob_mapbase == NULL)
+   {
+dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob");
+if (!dn)
+{
+   printk(KERN_CRIT "NEMO SB600 missing iob node\n");
+   return;
+   }
+
+   err = of_address_to_resource(dn, 0, );
+of_node_put(dn);
+
+   if (err)
+   {
+   printk(KERN_CRIT "NEMO SB600 missing resource\n");
+   return;
+   }
+
+   printk(KERN_CRIT "NEMO SB600 IOB base %08lx\n",res.start);
+
+   iob_mapbase = ioremap(res.start + 0x100, 0x94);
+   }
+
+   if (iob_mapbase != NULL)
+   {
+   if (bus == sb600_bus)
+   {
+   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) | 0x800);
+   }
+   else
+   {
+   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) & ~0x800);
+   }
+   }
+}
+#endif
+
+
 static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
 			  int offset, int len, u32 *val)
 {
@@ -126,6 +190,10 @@ static int pa_pxp_read_config(struct pci
 
 	addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
 
+#ifdef CONFIG_PPC_PASEMI_NEMO
+   sb600_set_flag(bus->number);
+#endif
+
 	/*
 	 * Note: the caller has already checked that offset is
 	 * suitably aligned and that len is 1, 2 or 4.
@@ -210,6 +278,9 @@ static int __init pas_add_bridge(struct
 	/* Interpret the "ranges" property */
 	pci_process_bridge_OF_ranges(hose, dev, 1);
 
+	/* Scan for an isa bridge. */
+	isa_bridge_find_early(hose);
+
 	return 0;
 }
 
diff -rupN a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
--- a/arch/powerpc/platforms/pasemi/setup.c	2017-09-11 17:04:18.256586450 +0200
+++ b/arch/powerpc/platforms/pasemi/setup.c	2017-09-11 17:03:43.042599888 +0200
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -72,6 +73,17 @@ static void __noreturn pas_restart(char
 		out_le32(reset_reg, 0x600);
 }
 
+#ifdef CONFIG_PPC_PASEMI_NEMO
+void pas_shutdown(void)
+{
+   /* (added by DStevens 19/06/13)
+  Set the PLD bit that 

[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-15 Thread Christian Zigotzky

On 04 December 2017 at 12:40PM, Darren Stevens wrote:
> Hello Bjorn
>
> Firstly sorry for not being able to join in this discussion, I have been
> moving house and only got my X1000 set up again yesterday..
>
> On 30/11/2017, Bjorn Helgaas wrote:
>> I *think* something like the patch below should make this work if you
>> use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
>> that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
>> something similar on powerpc, but maybe you do?
>
> Actually the root ports on the Nemo's PA6T processor don't respond to the
> SB600 unless we turn on a special 'relax pci-e' bit in one of its control
> registers. We use a small out of tree init routine to do this, and there
> would be the ideal place to put a call to
> pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS).
>
> This patch fixes the last major hurdle to getting the X1000 fully 
supported in

> the linux kernel, so thanks very much for that.
>
> Regards
> Darren
>
>


On 15 December 2017 at 09:25PM, Bjorn Helgaas wrote:
> On Fri, Dec 15, 2017 at 09:04:51AM +0100, Christian Zigotzky wrote:
>> On 09 December 2017 at 7:03PM, Christian Zigotzky wrote:
>>> On 08 December 2017 at 12:59PM, Michael Ellerman wrote:

> Darren's idea of doing it at the same time you tweak the SB600 "relax
> pci-e" bit is ideal because then the two pieces are obviously
> connected and it wouldn't affect any other systems at all.

 Yes that would be ideal. That patch is currently out-of-tree I gather,
 but I guess everyone who's using these machines must have that patch
 anyway.

 Darren what does that code look like? Can we get it upstream and close
 the loop on this?

 cheers

>>>
>>> Hi Michael,
>>>
>>> Please find attached the code.
>>>
>>> Thanks,
>>> Christian
>>
>> Hi All,
>>
>> I haven't received any response yet. Is this the correct patch you
>> are looking for?
>
> This is a powerpc patch that doesn't affect the PCI core, so I would
> say this is Michael's bailiwick.
>
> I guess you're only looking for a hint about whether this is the right
> approach, because it's obviously fully baked yet (no changelog,
> signed-off-by, etc, not a "safe for all powerpc" run-time solution,
> not in Linux indentation style, etc).
>
> It looks like the "pasemi,1682m-iob" DT property is required and
> possibly sufficient to identify this system at run-time.
>
> My advice is to finish that stuff up, post it to the powerpc
> maintainers and the linuxppc-dev@lists.ozlabs.org list, and go from
> there.
>

Darren,

Where is this small out of tree init routine in our patch? I haven't 
found it yet. Please post this routine here. Please find attached our 
latest Nemo patch.


Thanks,
Christian
diff -rupN a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
--- a/arch/powerpc/platforms/pasemi/pci.c	2017-11-16 08:18:35.078874462 +0100
+++ b/arch/powerpc/platforms/pasemi/pci.c	2017-11-16 08:17:22.034367975 +0100
@@ -27,6 +27,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -108,6 +109,69 @@ static int workaround_5945(struct pci_bu
 	return 1;
 }
 
+#ifdef CONFIG_PPC_PASEMI_NEMO
+static int sb600_bus = 5;
+static void __iomem *iob_mapbase = NULL;
+
+static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 *val);
+
+static void sb600_set_flag(int bus)
+{
+struct resource res;
+struct device_node *dn;
+   struct pci_bus *busp;
+   u32 val;
+   int err;
+
+   if (sb600_bus == -1)
+   {
+   busp = pci_find_bus(0, 0);
+   pa_pxp_read_config(busp, PCI_DEVFN(17,0), PCI_SECONDARY_BUS, 1, );
+
+   sb600_bus = val;
+
+   printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
+   }
+
+   if (iob_mapbase == NULL)
+   {
+dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob");
+if (!dn)
+{
+   printk(KERN_CRIT "NEMO SB600 missing iob node\n");
+   return;
+   }
+
+   err = of_address_to_resource(dn, 0, );
+of_node_put(dn);
+
+   if (err)
+   {
+   printk(KERN_CRIT "NEMO SB600 missing resource\n");
+   return;
+   }
+
+   printk(KERN_CRIT "NEMO SB600 IOB base %08lx\n",res.start);
+
+   iob_mapbase = ioremap(res.start + 0x100, 0x94);
+   }
+
+   if (iob_mapbase != NULL)
+   {
+   if (bus == sb600_bus)
+   {
+   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) | 0x800);
+   }
+   else
+   {
+   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) & ~0x800);
+   }
+   }
+}
+#endif
+
+
 static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
 			  int offset, int len, u32 *val)
 {
@@ 

Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-15 Thread Bjorn Helgaas
On Fri, Dec 15, 2017 at 09:04:51AM +0100, Christian Zigotzky wrote:
> On 09 December 2017 at 7:03PM, Christian Zigotzky wrote:
> > On 08 December 2017 at 12:59PM, Michael Ellerman wrote:
> > >
> > >> Darren's idea of doing it at the same time you tweak the SB600 "relax
> > >> pci-e" bit is ideal because then the two pieces are obviously
> > >> connected and it wouldn't affect any other systems at all.
> > >
> > > Yes that would be ideal. That patch is currently out-of-tree I gather,
> > > but I guess everyone who's using these machines must have that patch
> > > anyway.
> > >
> > > Darren what does that code look like? Can we get it upstream and close
> > > the loop on this?
> > >
> > > cheers
> > >
> >
> > Hi Michael,
> >
> > Please find attached the code.
> >
> > Thanks,
> > Christian
> 
> Hi All,
> 
> I haven't received any response yet. Is this the correct patch you
> are looking for?

This is a powerpc patch that doesn't affect the PCI core, so I would
say this is Michael's bailiwick.

I guess you're only looking for a hint about whether this is the right
approach, because it's obviously fully baked yet (no changelog,
signed-off-by, etc, not a "safe for all powerpc" run-time solution,
not in Linux indentation style, etc).

It looks like the "pasemi,1682m-iob" DT property is required and
possibly sufficient to identify this system at run-time.

My advice is to finish that stuff up, post it to the powerpc
maintainers and the linuxppc-dev@lists.ozlabs.org list, and go from
there.

> diff -rupN a/arch/powerpc/platforms/pasemi/pci.c 
> b/arch/powerpc/platforms/pasemi/pci.c
> --- a/arch/powerpc/platforms/pasemi/pci.c 2017-11-16 08:18:35.078874462 
> +0100
> +++ b/arch/powerpc/platforms/pasemi/pci.c 2017-11-16 08:17:22.034367975 
> +0100
> @@ -27,6 +27,7 @@
>  #include 
>  
>  #include 
> +#include 
>  #include 
>  
>  #include 
> @@ -108,6 +109,69 @@ static int workaround_5945(struct pci_bu
>   return 1;
>  }
>  
> +#ifdef CONFIG_PPC_PASEMI_NEMO
> +static int sb600_bus = 5;
> +static void __iomem *iob_mapbase = NULL;
> +
> +static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
> + int offset, int len, u32 *val);
> +
> +static void sb600_set_flag(int bus)
> +{
> +struct resource res;
> +struct device_node *dn;
> +   struct pci_bus *busp;
> +   u32 val;
> +   int err;
> +
> +   if (sb600_bus == -1)
> +   {
> +   busp = pci_find_bus(0, 0);
> +   pa_pxp_read_config(busp, PCI_DEVFN(17,0), PCI_SECONDARY_BUS, 
> 1, );
> +
> +   sb600_bus = val;
> +
> +   printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
> +   }
> +
> +   if (iob_mapbase == NULL)
> +   {
> +dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob");
> +if (!dn)
> +{
> +   printk(KERN_CRIT "NEMO SB600 missing iob node\n");
> +   return;
> +   }
> +
> +   err = of_address_to_resource(dn, 0, );
> +of_node_put(dn);
> +
> +   if (err)
> +   {
> +   printk(KERN_CRIT "NEMO SB600 missing resource\n");
> +   return;
> +   }
> +
> +   printk(KERN_CRIT "NEMO SB600 IOB base %08lx\n",res.start);
> +
> +   iob_mapbase = ioremap(res.start + 0x100, 0x94);
> +   }
> +
> +   if (iob_mapbase != NULL)
> +   {
> +   if (bus == sb600_bus)
> +   {
> +   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) | 
> 0x800);
> +   }
> +   else
> +   {
> +   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) & 
> ~0x800);
> +   }
> +   }
> +}
> +#endif
> +
> +
>  static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
> int offset, int len, u32 *val)
>  {
> @@ -126,6 +190,10 @@ static int pa_pxp_read_config(struct pci
>  
>   addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
>  
> +#ifdef CONFIG_PPC_PASEMI_NEMO
> +   sb600_set_flag(bus->number);
> +#endif
> +
>   /*
>* Note: the caller has already checked that offset is
>* suitably aligned and that len is 1, 2 or 4.
> @@ -210,6 +278,9 @@ static int __init pas_add_bridge(struct
>   /* Interpret the "ranges" property */
>   pci_process_bridge_OF_ranges(hose, dev, 1);
>  
> + /* Scan for an isa bridge. */
> + isa_bridge_find_early(hose);
> +
>   return 0;
>  }



[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-15 Thread Christian Zigotzky

On 09 December 2017 at 7:03PM, Christian Zigotzky wrote:
> On 08 December 2017 at 12:59PM, Michael Ellerman wrote:
> >
> >> Darren's idea of doing it at the same time you tweak the SB600 "relax
> >> pci-e" bit is ideal because then the two pieces are obviously
> >> connected and it wouldn't affect any other systems at all.
> >
> > Yes that would be ideal. That patch is currently out-of-tree I gather,
> > but I guess everyone who's using these machines must have that patch
> > anyway.
> >
> > Darren what does that code look like? Can we get it upstream and close
> > the loop on this?
> >
> > cheers
> >
>
> Hi Michael,
>
> Please find attached the code.
>
> Thanks,
> Christian

Hi All,

I haven't received any response yet. Is this the correct patch you are 
looking for?


Thanks,
Christian
diff -rupN a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
--- a/arch/powerpc/platforms/pasemi/pci.c	2017-11-16 08:18:35.078874462 +0100
+++ b/arch/powerpc/platforms/pasemi/pci.c	2017-11-16 08:17:22.034367975 +0100
@@ -27,6 +27,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -108,6 +109,69 @@ static int workaround_5945(struct pci_bu
 	return 1;
 }
 
+#ifdef CONFIG_PPC_PASEMI_NEMO
+static int sb600_bus = 5;
+static void __iomem *iob_mapbase = NULL;
+
+static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 *val);
+
+static void sb600_set_flag(int bus)
+{
+struct resource res;
+struct device_node *dn;
+   struct pci_bus *busp;
+   u32 val;
+   int err;
+
+   if (sb600_bus == -1)
+   {
+   busp = pci_find_bus(0, 0);
+   pa_pxp_read_config(busp, PCI_DEVFN(17,0), PCI_SECONDARY_BUS, 1, );
+
+   sb600_bus = val;
+
+   printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
+   }
+
+   if (iob_mapbase == NULL)
+   {
+dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob");
+if (!dn)
+{
+   printk(KERN_CRIT "NEMO SB600 missing iob node\n");
+   return;
+   }
+
+   err = of_address_to_resource(dn, 0, );
+of_node_put(dn);
+
+   if (err)
+   {
+   printk(KERN_CRIT "NEMO SB600 missing resource\n");
+   return;
+   }
+
+   printk(KERN_CRIT "NEMO SB600 IOB base %08lx\n",res.start);
+
+   iob_mapbase = ioremap(res.start + 0x100, 0x94);
+   }
+
+   if (iob_mapbase != NULL)
+   {
+   if (bus == sb600_bus)
+   {
+   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) | 0x800);
+   }
+   else
+   {
+   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) & ~0x800);
+   }
+   }
+}
+#endif
+
+
 static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
 			  int offset, int len, u32 *val)
 {
@@ -126,6 +190,10 @@ static int pa_pxp_read_config(struct pci
 
 	addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
 
+#ifdef CONFIG_PPC_PASEMI_NEMO
+   sb600_set_flag(bus->number);
+#endif
+
 	/*
 	 * Note: the caller has already checked that offset is
 	 * suitably aligned and that len is 1, 2 or 4.
@@ -210,6 +278,9 @@ static int __init pas_add_bridge(struct
 	/* Interpret the "ranges" property */
 	pci_process_bridge_OF_ranges(hose, dev, 1);
 
+	/* Scan for an isa bridge. */
+	isa_bridge_find_early(hose);
+
 	return 0;
 }


[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-09 Thread Christian Zigotzky

On 08 December 2017 at 12:59PM, Michael Ellerman wrote:
>
>> Darren's idea of doing it at the same time you tweak the SB600 "relax
>> pci-e" bit is ideal because then the two pieces are obviously
>> connected and it wouldn't affect any other systems at all.
>
> Yes that would be ideal. That patch is currently out-of-tree I gather,
> but I guess everyone who's using these machines must have that patch
> anyway.
>
> Darren what does that code look like? Can we get it upstream and close
> the loop on this?
>
> cheers
>

Hi Michael,

Please find attached the code.

Thanks,
Christian
diff -rupN a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
--- a/arch/powerpc/platforms/pasemi/pci.c	2017-11-16 08:18:35.078874462 +0100
+++ b/arch/powerpc/platforms/pasemi/pci.c	2017-11-16 08:17:22.034367975 +0100
@@ -27,6 +27,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -108,6 +109,69 @@ static int workaround_5945(struct pci_bu
 	return 1;
 }
 
+#ifdef CONFIG_PPC_PASEMI_NEMO
+static int sb600_bus = 5;
+static void __iomem *iob_mapbase = NULL;
+
+static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 *val);
+
+static void sb600_set_flag(int bus)
+{
+struct resource res;
+struct device_node *dn;
+   struct pci_bus *busp;
+   u32 val;
+   int err;
+
+   if (sb600_bus == -1)
+   {
+   busp = pci_find_bus(0, 0);
+   pa_pxp_read_config(busp, PCI_DEVFN(17,0), PCI_SECONDARY_BUS, 1, );
+
+   sb600_bus = val;
+
+   printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
+   }
+
+   if (iob_mapbase == NULL)
+   {
+dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob");
+if (!dn)
+{
+   printk(KERN_CRIT "NEMO SB600 missing iob node\n");
+   return;
+   }
+
+   err = of_address_to_resource(dn, 0, );
+of_node_put(dn);
+
+   if (err)
+   {
+   printk(KERN_CRIT "NEMO SB600 missing resource\n");
+   return;
+   }
+
+   printk(KERN_CRIT "NEMO SB600 IOB base %08lx\n",res.start);
+
+   iob_mapbase = ioremap(res.start + 0x100, 0x94);
+   }
+
+   if (iob_mapbase != NULL)
+   {
+   if (bus == sb600_bus)
+   {
+   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) | 0x800);
+   }
+   else
+   {
+   out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) & ~0x800);
+   }
+   }
+}
+#endif
+
+
 static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
 			  int offset, int len, u32 *val)
 {
@@ -126,6 +190,10 @@ static int pa_pxp_read_config(struct pci
 
 	addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
 
+#ifdef CONFIG_PPC_PASEMI_NEMO
+   sb600_set_flag(bus->number);
+#endif
+
 	/*
 	 * Note: the caller has already checked that offset is
 	 * suitably aligned and that len is 1, 2 or 4.
@@ -210,6 +278,9 @@ static int __init pas_add_bridge(struct
 	/* Interpret the "ranges" property */
 	pci_process_bridge_OF_ranges(hose, dev, 1);
 
+	/* Scan for an isa bridge. */
+	isa_bridge_find_early(hose);
+
 	return 0;
 }


Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-08 Thread Michael Ellerman
Bjorn Helgaas  writes:

> On Wed, Dec 06, 2017 at 11:57:03PM +1100, Michael Ellerman wrote:
>> Christian Zigotzky  writes:
>> ...
>> >
>> > Hi Olof,
>> >
>> > Many thanks for your patch! :-) The RC2 of kernel 4.15 boots without any 
>> > problems on my P.A. Semi Nemo board (A-EON AmigaOne X1000). I don’t need 
>> > the additional boot argument 'pci=pcie_scan_all' anymore.
>> >
>> > Is it possible to merge it via the powerpc tree?
>> 
>> Yes.
>> 
>> It would be good to confirm that the change is harmless on other pasemi
>> boards. I'll try and get mine booted tomorrow, unless someone beats me
>> to it.
>
> Theoretically, it should not do any harm since it only turns off an
> enumeration optimization.  Boot will be slightly slower but should
> still work fine.

Yep OK.

> Darren's idea of doing it at the same time you tweak the SB600 "relax
> pci-e" bit is ideal because then the two pieces are obviously
> connected and it wouldn't affect any other systems at all.

Yes that would be ideal. That patch is currently out-of-tree I gather,
but I guess everyone who's using these machines must have that patch
anyway.

Darren what does that code look like? Can we get it upstream and close
the loop on this?

cheers


Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-08 Thread Michael Ellerman
Olof Johansson  writes:
> On Wed, Dec 6, 2017 at 4:44 AM, Michael Ellerman  wrote:
>> Olof Johansson  writes:
>>>
>>> The below patch, together with Bjorn's, should do it. Christian, can you 
>>> test
>>> and report back?
>>>
>>> I'm guessing it won't do any harm to set this on non-X1000 platforms. My
>>> test system is currently powered down so I can't check.
>>
>> My pasemi board had been powered off for a while and when I turned it
>> back on something popped, the power supply blew up and tripped a
>> breaker.
>>
>> So I also can't test this, at least for now, until I get my "allowed to
>> use hardware" license back from my colleagues in the office.
>
> Ouch. Sounds like it's the PSU not the board. Hopefully there was no
> board damage, let me know if you need a replacement though and I'll
> see what I can find.

Thanks. Yeah the power supply is toast. One of the guys is going to see
if he can fix it.

Will try and get the board going, will let you know if it's dead too.

cheers


Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-06 Thread Bjorn Helgaas
On Wed, Dec 06, 2017 at 11:57:03PM +1100, Michael Ellerman wrote:
> Christian Zigotzky  writes:
> ...
> >
> > Hi Olof,
> >
> > Many thanks for your patch! :-) The RC2 of kernel 4.15 boots without any 
> > problems on my P.A. Semi Nemo board (A-EON AmigaOne X1000). I don’t need 
> > the additional boot argument 'pci=pcie_scan_all' anymore.
> >
> > Is it possible to merge it via the powerpc tree?
> 
> Yes.
> 
> It would be good to confirm that the change is harmless on other pasemi
> boards. I'll try and get mine booted tomorrow, unless someone beats me
> to it.

Theoretically, it should not do any harm since it only turns off an
enumeration optimization.  Boot will be slightly slower but should
still work fine.

Darren's idea of doing it at the same time you tweak the SB600 "relax
pci-e" bit is ideal because then the two pieces are obviously
connected and it wouldn't affect any other systems at all.

Bjorn


Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-06 Thread Olof Johansson
On Wed, Dec 6, 2017 at 4:44 AM, Michael Ellerman  wrote:
> Olof Johansson  writes:
>
>> On Sat, Dec 02, 2017 at 01:54:41PM +0100, Christian Zigotzky wrote:
>>> On 02 December 2017 at 00:27AM, Bjorn Helgaas wrote:
>>> >
>>> > Thanks for testing that.  I'll merge a similar patch for v4.16.
>>> >
>>> > I don't think using "pci=pcie_scan_all" is really an acceptable
>>> > long-term answer for you, though.  Is there some way we can identify
>>> > at run-time whether we're on a Nemo system?  If so, we can make this
>>> > happen automatically.
>>> >
>>> > Bjorn
>>> >
>>> Hi Bjorn,
>>>
>>> Many thanks for your effort! I appreciate it very much. :-)
>>>
>>> We can identify the Nemo board at the boot time. See dmesg output: [
>>> 0.061592] NEMO SB600 IOB base e000
>>>
>>> @linuxppc-dev
>>> Any other ideas? Maybe the same as we can identify the other P.A. Semi
>>> boards (Electra, Chitra, and Athena).
>>>
>>> @Olof
>>> Maybe you know how we can identify the P.A. Semi Nemo board at the run-time.
>>>
>>> @Darren
>>> Do you have an idea?
>>
>>
>> The below patch, together with Bjorn's, should do it. Christian, can you test
>> and report back?
>>
>> I'm guessing it won't do any harm to set this on non-X1000 platforms. My
>> test system is currently powered down so I can't check.
>
> My pasemi board had been powered off for a while and when I turned it
> back on something popped, the power supply blew up and tripped a
> breaker.
>
> So I also can't test this, at least for now, until I get my "allowed to
> use hardware" license back from my colleagues in the office.

Ouch. Sounds like it's the PSU not the board. Hopefully there was no
board damage, let me know if you need a replacement though and I'll
see what I can find.


-Olof


Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-06 Thread Michael Ellerman
Christian Zigotzky  writes:
...
>
> Hi Olof,
>
> Many thanks for your patch! :-) The RC2 of kernel 4.15 boots without any 
> problems on my P.A. Semi Nemo board (A-EON AmigaOne X1000). I don’t need 
> the additional boot argument 'pci=pcie_scan_all' anymore.
>
> Is it possible to merge it via the powerpc tree?

Yes.

It would be good to confirm that the change is harmless on other pasemi
boards. I'll try and get mine booted tomorrow, unless someone beats me
to it.

cheers


Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-06 Thread Michael Ellerman
Olof Johansson  writes:

> On Sat, Dec 02, 2017 at 01:54:41PM +0100, Christian Zigotzky wrote:
>> On 02 December 2017 at 00:27AM, Bjorn Helgaas wrote:
>> > 
>> > Thanks for testing that.  I'll merge a similar patch for v4.16.
>> > 
>> > I don't think using "pci=pcie_scan_all" is really an acceptable
>> > long-term answer for you, though.  Is there some way we can identify
>> > at run-time whether we're on a Nemo system?  If so, we can make this
>> > happen automatically.
>> > 
>> > Bjorn
>> > 
>> Hi Bjorn,
>> 
>> Many thanks for your effort! I appreciate it very much. :-)
>> 
>> We can identify the Nemo board at the boot time. See dmesg output: [   
>> 0.061592] NEMO SB600 IOB base e000
>> 
>> @linuxppc-dev
>> Any other ideas? Maybe the same as we can identify the other P.A. Semi
>> boards (Electra, Chitra, and Athena).
>> 
>> @Olof
>> Maybe you know how we can identify the P.A. Semi Nemo board at the run-time.
>> 
>> @Darren
>> Do you have an idea?
>
>
> The below patch, together with Bjorn's, should do it. Christian, can you test
> and report back?
>
> I'm guessing it won't do any harm to set this on non-X1000 platforms. My
> test system is currently powered down so I can't check.

My pasemi board had been powered off for a while and when I turned it
back on something popped, the power supply blew up and tripped a
breaker.

So I also can't test this, at least for now, until I get my "allowed to
use hardware" license back from my colleagues in the office.

cheers


[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-06 Thread Christian Zigotzky

On 06 December 2017 at 09:37AM, Christian Zigotzky wrote:
> On 03 December 2017 at 10:43AM, Christian Zigotzky wrote:
> >
> > On 3. Dec 2017, at 00:02, Olof Johansson  wrote:
> >>
> >> Typo, should be ';', not ':'. I obviously didn't even try 
compiling this. :)

> >>
> >>
> >> -Olof
> >
> > Hi Olof,
> >
> > Thanks a lot for your patch! I will test it on Wednesday.
> >
> > Cheers,
> > Christian
>
>
> Hi Olof,
>
> I tested your patch today. Unfortunately the kernel 4.15-rc2 doesn't 
compile with your patch.

>
> Error messages:
>
>    ^
> arch/powerpc/platforms/pasemi/pci.c: In function ‘pas_pci_init’:
> arch/powerpc/platforms/pasemi/pci.c:298:2: error: implicit 
declaration of function ‘pci_set_flag’ 
[-Werror=implicit-function-declaration]

>   pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS);
>   ^~~~
> cc1: some warnings being treated as errors
>
> ---
>
> I figured out that we need 'pci_set_flags' instead of 'pci_set_flag'. 
I modified your patch and after that the kernel compiles. Please find 
attached the new patch.

>
> Cheers,
> Christian

Hi Olof,

Many thanks for your patch! :-) The RC2 of kernel 4.15 boots without any 
problems on my P.A. Semi Nemo board (A-EON AmigaOne X1000). I don’t need 
the additional boot argument 'pci=pcie_scan_all' anymore.


Is it possible to merge it via the powerpc tree?

Thanks,
Christian




arch/powerpc/platforms/pasemi/pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index 5ff6108..ea54ed2 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -224,6 +224,8 @@ void __init pas_pci_init(void)
 		return;
 	}
 
+	pci_set_flags(PCI_SCAN_ALL_PCIE_DEVS);
+
 	for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
 		if (np->name && !strcmp(np->name, "pxp") && !pas_add_bridge(np))
 			of_node_get(np);


[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-06 Thread Christian Zigotzky

On 03 December 2017 10:43AM, Christian Zigotzky wrote:
>
> On 3. Dec 2017, at 00:02, Olof Johansson  wrote:
>>
>>> On Sat, Dec 2, 2017 at 3:00 PM, Olof Johansson  wrote:
>>>
>>> The below patch, together with Bjorn's, should do it. Christian, 
can you test

>>> and report back?
>>>
>>> I'm guessing it won't do any harm to set this on non-X1000 
platforms. My

>>> test system is currently powered down so I can't check.
>>>
>>>
>>> From a3b390277627b0342c8ccfc16e58679e0d8abdde Mon Sep 17 00:00:00 2001
>>> From: Olof Johansson 
>>> Date: Sat, 2 Dec 2017 14:56:36 -0800
>>> Subject: [PATCH] powerpc/pasemi: set PCI_SCAN_ALL_PCI_DEVS
>>>
>>> Needed on Amiga X1000 with SB600.
>>>
>>> Reported-by: Christian Zigotzky 
>>> Cc: Bjorn Helgaas 
>>> Signed-off-by: Olof Johansson 
>>> ---
>>> arch/powerpc/platforms/pasemi/pci.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/arch/powerpc/platforms/pasemi/pci.c 
b/arch/powerpc/platforms/pasemi/pci.c

>>> index 5ff6108..ea54ed2 100644
>>> --- a/arch/powerpc/platforms/pasemi/pci.c
>>> +++ b/arch/powerpc/platforms/pasemi/pci.c
>>> @@ -224,6 +224,8 @@ void __init pas_pci_init(void)
>>>    return;
>>>    }
>>>
>>> +   pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS):
>>
>> Typo, should be ';', not ':'. I obviously didn't even try compiling 
this. :)

>>
>>
>> -Olof
>
> Hi Olof,
>
> Thanks a lot for your patch! I will test it on Wednesday.
>
> Cheers,
> Christian


Hi Olof,

I tested your patch today. Unfortunately the kernel 4.15-rc2 doesn't 
compile with your patch.


Error messages:

   ^
arch/powerpc/platforms/pasemi/pci.c: In function ‘pas_pci_init’:
arch/powerpc/platforms/pasemi/pci.c:298:2: error: implicit declaration 
of function ‘pci_set_flag’ [-Werror=implicit-function-declaration]

  pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS);
  ^~~~
cc1: some warnings being treated as errors

---

I figured out that we need 'pci_set_flags' instead of 'pci_set_flag'. I 
modified your patch and after that the kernel compiles. Please find 
attached the new patch.


Cheers,
Christian
arch/powerpc/platforms/pasemi/pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index 5ff6108..ea54ed2 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -224,6 +224,8 @@ void __init pas_pci_init(void)
 		return;
 	}
 
+	pci_set_flags(PCI_SCAN_ALL_PCIE_DEVS);
+
 	for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
 		if (np->name && !strcmp(np->name, "pxp") && !pas_add_bridge(np))
 			of_node_get(np);


SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-04 Thread Christian Zigotzky
Darren,

What do you think about Olof’s solution?

Link: 
http://forum.hyperion-entertainment.biz/viewtopic.php?f=35=3891=43206#p43201

Thanks,
Christian

Sent from my iPhone

> On 4. Dec 2017, at 12:40, Darren Stevens  wrote:
> 
> Hello Bjorn
> 
> Firstly sorry for not being able to join in this discussion, I have been
> moving house and only got my X1000 set up again yesterday..
> 
>> On 30/11/2017, Bjorn Helgaas wrote:
>> I *think* something like the patch below should make this work if you
>> use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
>> that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
>> something similar on powerpc, but maybe you do?
> 
> Actually the root ports on the Nemo's PA6T processor don't respond to the
> SB600 unless we turn on a special 'relax pci-e' bit in one of its control
> registers. We use a small out of tree init routine to do this, and there
> would be the ideal place to put a call to
> pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS).
> 
> This patch fixes the last major hurdle to getting the X1000 fully supported in
> the linux kernel, so thanks very much for that.
> 
> Regards
> Darren
> 


Re: SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-04 Thread Darren Stevens
Hello Bjorn

Firstly sorry for not being able to join in this discussion, I have been
moving house and only got my X1000 set up again yesterday..

On 30/11/2017, Bjorn Helgaas wrote:
> I *think* something like the patch below should make this work if you
> use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
> that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
> something similar on powerpc, but maybe you do?

Actually the root ports on the Nemo's PA6T processor don't respond to the
SB600 unless we turn on a special 'relax pci-e' bit in one of its control
registers. We use a small out of tree init routine to do this, and there
would be the ideal place to put a call to
pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS).

This patch fixes the last major hurdle to getting the X1000 fully supported in
the linux kernel, so thanks very much for that.

Regards
Darren



[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-03 Thread Christian Zigotzky

On 3. Dec 2017, at 00:02, Olof Johansson  wrote:
> 
>> On Sat, Dec 2, 2017 at 3:00 PM, Olof Johansson  wrote:
>> 
>> The below patch, together with Bjorn's, should do it. Christian, can you test
>> and report back?
>> 
>> I'm guessing it won't do any harm to set this on non-X1000 platforms. My
>> test system is currently powered down so I can't check.
>> 
>> 
>> From a3b390277627b0342c8ccfc16e58679e0d8abdde Mon Sep 17 00:00:00 2001
>> From: Olof Johansson 
>> Date: Sat, 2 Dec 2017 14:56:36 -0800
>> Subject: [PATCH] powerpc/pasemi: set PCI_SCAN_ALL_PCI_DEVS
>> 
>> Needed on Amiga X1000 with SB600.
>> 
>> Reported-by: Christian Zigotzky 
>> Cc: Bjorn Helgaas 
>> Signed-off-by: Olof Johansson 
>> ---
>> arch/powerpc/platforms/pasemi/pci.c | 2 ++
>> 1 file changed, 2 insertions(+)
>> 
>> diff --git a/arch/powerpc/platforms/pasemi/pci.c 
>> b/arch/powerpc/platforms/pasemi/pci.c
>> index 5ff6108..ea54ed2 100644
>> --- a/arch/powerpc/platforms/pasemi/pci.c
>> +++ b/arch/powerpc/platforms/pasemi/pci.c
>> @@ -224,6 +224,8 @@ void __init pas_pci_init(void)
>>return;
>>}
>> 
>> +   pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS):
> 
> Typo, should be ';', not ':'. I obviously didn't even try compiling this. :)
> 
> 
> -Olof

Hi Olof,

Thanks a lot for your patch! I will test it on Wednesday.

Cheers,
Christian

Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-02 Thread Olof Johansson
On Sat, Dec 2, 2017 at 3:00 PM, Olof Johansson  wrote:
> On Sat, Dec 02, 2017 at 01:54:41PM +0100, Christian Zigotzky wrote:
>> On 02 December 2017 at 00:27AM, Bjorn Helgaas wrote:
>> >
>> > Thanks for testing that.  I'll merge a similar patch for v4.16.
>> >
>> > I don't think using "pci=pcie_scan_all" is really an acceptable
>> > long-term answer for you, though.  Is there some way we can identify
>> > at run-time whether we're on a Nemo system?  If so, we can make this
>> > happen automatically.
>> >
>> > Bjorn
>> >
>> Hi Bjorn,
>>
>> Many thanks for your effort! I appreciate it very much. :-)
>>
>> We can identify the Nemo board at the boot time. See dmesg output: [
>> 0.061592] NEMO SB600 IOB base e000
>>
>> @linuxppc-dev
>> Any other ideas? Maybe the same as we can identify the other P.A. Semi
>> boards (Electra, Chitra, and Athena).
>>
>> @Olof
>> Maybe you know how we can identify the P.A. Semi Nemo board at the run-time.
>>
>> @Darren
>> Do you have an idea?
>
>
> The below patch, together with Bjorn's, should do it. Christian, can you test
> and report back?
>
> I'm guessing it won't do any harm to set this on non-X1000 platforms. My
> test system is currently powered down so I can't check.
>
>
> From a3b390277627b0342c8ccfc16e58679e0d8abdde Mon Sep 17 00:00:00 2001
> From: Olof Johansson 
> Date: Sat, 2 Dec 2017 14:56:36 -0800
> Subject: [PATCH] powerpc/pasemi: set PCI_SCAN_ALL_PCI_DEVS
>
> Needed on Amiga X1000 with SB600.
>
> Reported-by: Christian Zigotzky 
> Cc: Bjorn Helgaas 
> Signed-off-by: Olof Johansson 
> ---
>  arch/powerpc/platforms/pasemi/pci.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/platforms/pasemi/pci.c 
> b/arch/powerpc/platforms/pasemi/pci.c
> index 5ff6108..ea54ed2 100644
> --- a/arch/powerpc/platforms/pasemi/pci.c
> +++ b/arch/powerpc/platforms/pasemi/pci.c
> @@ -224,6 +224,8 @@ void __init pas_pci_init(void)
> return;
> }
>
> +   pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS):

Typo, should be ';', not ':'. I obviously didn't even try compiling this. :)


-Olof


Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-02 Thread Olof Johansson
On Sat, Dec 02, 2017 at 01:54:41PM +0100, Christian Zigotzky wrote:
> On 02 December 2017 at 00:27AM, Bjorn Helgaas wrote:
> > 
> > Thanks for testing that.  I'll merge a similar patch for v4.16.
> > 
> > I don't think using "pci=pcie_scan_all" is really an acceptable
> > long-term answer for you, though.  Is there some way we can identify
> > at run-time whether we're on a Nemo system?  If so, we can make this
> > happen automatically.
> > 
> > Bjorn
> > 
> Hi Bjorn,
> 
> Many thanks for your effort! I appreciate it very much. :-)
> 
> We can identify the Nemo board at the boot time. See dmesg output: [   
> 0.061592] NEMO SB600 IOB base e000
> 
> @linuxppc-dev
> Any other ideas? Maybe the same as we can identify the other P.A. Semi
> boards (Electra, Chitra, and Athena).
> 
> @Olof
> Maybe you know how we can identify the P.A. Semi Nemo board at the run-time.
> 
> @Darren
> Do you have an idea?


The below patch, together with Bjorn's, should do it. Christian, can you test
and report back?

I'm guessing it won't do any harm to set this on non-X1000 platforms. My
test system is currently powered down so I can't check.


>From a3b390277627b0342c8ccfc16e58679e0d8abdde Mon Sep 17 00:00:00 2001
From: Olof Johansson 
Date: Sat, 2 Dec 2017 14:56:36 -0800
Subject: [PATCH] powerpc/pasemi: set PCI_SCAN_ALL_PCI_DEVS

Needed on Amiga X1000 with SB600.

Reported-by: Christian Zigotzky 
Cc: Bjorn Helgaas 
Signed-off-by: Olof Johansson 
---
 arch/powerpc/platforms/pasemi/pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/pasemi/pci.c 
b/arch/powerpc/platforms/pasemi/pci.c
index 5ff6108..ea54ed2 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -224,6 +224,8 @@ void __init pas_pci_init(void)
return;
}
 
+   pci_set_flag(PCI_SCAN_ALL_PCIE_DEVS):
+
for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
if (np->name && !strcmp(np->name, "pxp") && !pas_add_bridge(np))
of_node_get(np);
-- 
2.8.6



[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-02 Thread Christian Zigotzky

On 02 December 2017 at 00:27AM, Bjorn Helgaas wrote:


Thanks for testing that.  I'll merge a similar patch for v4.16.

I don't think using "pci=pcie_scan_all" is really an acceptable
long-term answer for you, though.  Is there some way we can identify
at run-time whether we're on a Nemo system?  If so, we can make this
happen automatically.

Bjorn


Hi Bjorn,

Many thanks for your effort! I appreciate it very much. :-)

We can identify the Nemo board at the boot time. See dmesg output: [    
0.061592] NEMO SB600 IOB base e000


@linuxppc-dev
Any other ideas? Maybe the same as we can identify the other P.A. Semi 
boards (Electra, Chitra, and Athena).


@Olof
Maybe you know how we can identify the P.A. Semi Nemo board at the run-time.

@Darren
Do you have an idea?

Thanks to all for your help.

Cheers,
Christian



Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-01 Thread Bjorn Helgaas
On Fri, Dec 01, 2017 at 11:08:46PM +0100, Christian Zigotzky wrote:
> On 30.11.2017 23:42, Bjorn Helgaas wrote:
> >
> > 00:11.0 claims to be a PCIe Root Port leading to [bus 05-06]. That
> > means there's a Link (presumably this A-Link II Express thing), and the
> > downstream end of the Link *should* be a PCIe Upstream Port on bus 05,
> > but no such device is visible.  I suppose the SB600 does implement
> > some sort of PCIe Port there, but keeps it invisible to software, and
> > at the same time, contains an invisible bridge that connects the Link
> > to all the conventional PCI devices on bus 05.
> >
> > When we scan bus 05, we do this:
> >
> >   pci_scan_child_bus_extend(bus=05)
> > for (devfn = 0; devfn < 0x100; devfn += 8)
> >   pci_scan_slot(05, 00.0)
> > pci_scan_single_device
> >   pci_scan_device(05, 00.0)   # fails; no 05:00.0
> >   pci_scan_slot(05, 01.0)
> > only_one_child(bus=05)
> >   parent = 00:11.0
> >   pci_pcie_type(00:11.0) == ROOT_PORT # returns true
> >
> > Since only_one_child() sees that 00:11.0 is a Root Port, we give up
> > before we even get to the PCI_SCAN_ALL_PCIE_DEVS test.
> >
> > I *think* something like the patch below should make this work if you
> > use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
> > that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
> > something similar on powerpc, but maybe you do?
> >
> 
> Hi Bjorn,
> 
> I tested your new patch today. It boots with the boot argument
> "pci=pcie_scan_all". Well done! :-)
> 
> It doesn't boot without the boot argument "pci=pcie_scan_all".

Thanks for testing that.  I'll merge a similar patch for v4.16.

I don't think using "pci=pcie_scan_all" is really an acceptable
long-term answer for you, though.  Is there some way we can identify
at run-time whether we're on a Nemo system?  If so, we can make this
happen automatically.

Bjorn


[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-12-01 Thread Christian Zigotzky

On 30.11.2017 23:42, Bjorn Helgaas wrote:
>
> 00:11.0 claims to be a PCIe Root Port leading to [bus 05-06]. That
> means there's a Link (presumably this A-Link II Express thing), and the
> downstream end of the Link *should* be a PCIe Upstream Port on bus 05,
> but no such device is visible.  I suppose the SB600 does implement
> some sort of PCIe Port there, but keeps it invisible to software, and
> at the same time, contains an invisible bridge that connects the Link
> to all the conventional PCI devices on bus 05.
>
> When we scan bus 05, we do this:
>
>   pci_scan_child_bus_extend(bus=05)
> for (devfn = 0; devfn < 0x100; devfn += 8)
>   pci_scan_slot(05, 00.0)
> pci_scan_single_device
>   pci_scan_device(05, 00.0)   # fails; no 05:00.0
>   pci_scan_slot(05, 01.0)
> only_one_child(bus=05)
>   parent = 00:11.0
>   pci_pcie_type(00:11.0) == ROOT_PORT # returns true
>
> Since only_one_child() sees that 00:11.0 is a Root Port, we give up
> before we even get to the PCI_SCAN_ALL_PCIE_DEVS test.
>
> I *think* something like the patch below should make this work if you
> use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
> that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
> something similar on powerpc, but maybe you do?
>

Hi Bjorn,

I tested your new patch today. It boots with the boot argument 
"pci=pcie_scan_all". Well done! :-)


It doesn't boot without the boot argument "pci=pcie_scan_all".

Many thanks for your help.

Cheers,
Christian

commit 75eaf674066590e79b3e03d32488871fc881ab40
Author: Bjorn Helgaas 
Date:   Thu Nov 30 15:22:39 2017 -0600

PCI: Make PCI_SCAN_ALL_PCIE_DEVS work for Root Ports as well as Downstream

Previously PCI_SCAN_ALL_PCIE_DEVS (set by quirks or the "pci=pcie_scan_all"
kernel parameter) only affected Switch Downstream Ports, not Root Ports.

Simplify and restructure only_one_child() so PCI_SCAN_ALL_PCIE_DEVS means
we scan for all possible devices below Root Ports as well as Switch
Downstream Ports.

Signed-off-by: Bjorn Helgaas 

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 14e0ea1ff38b..9e57d4ef0c1f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2217,20 +2217,28 @@ static int only_one_child(struct pci_bus *bus)
 {
 	struct pci_dev *parent = bus->self;
 
-	if (!parent || !pci_is_pcie(parent))
+	if (!parent)
+		return 0;
+
+	/*
+	 * Systems with unusual topologies set PCI_SCAN_ALL_PCIE_DEVS so
+	 * we scan for all possible devices, not just Device 0.
+	 */
+	if (pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
 		return 0;
-	if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
-		return 1;
 
 	/*
-	 * PCIe downstream ports are bridges that normally lead to only a
-	 * device 0, but if PCI_SCAN_ALL_PCIE_DEVS is set, scan all
-	 * possible devices, not just device 0.  See PCIe spec r3.0,
-	 * sec 7.3.1.
+	 * A PCIe Downstream Port normally leads to a Link with only Device
+	 * 0 on it (PCIe spec r3.1, sec 7.3.1).  As an optimization, scan
+	 * only for Device 0 in that situation.
+	 *
+	 * Checking has_secondary_link is a hack to identify Downstream
+	 * Ports because sometimes Switches are configured such that the
+	 * PCIe Port Type labels are backwards.
 	 */
-	if (parent->has_secondary_link &&
-	!pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
+	if (pci_is_pcie(parent) && parent->has_secondary_link)
 		return 1;
+
 	return 0;
 }


Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-11-30 Thread Bjorn Helgaas
On Thu, Nov 30, 2017 at 12:39:36AM +0100, Christian Zigotzky wrote:
> On 29 November 2017 at 11:34PM, Bjorn Helgaas wrote:
> > On Wed, Nov 29, 2017 at 2:45 PM, Christian Zigotzky
> >> Thank you for your answer. I have tried to boot the kernel 4.15
> >> RC1 (built without the patch above) with the boot argument
> >> "pci=pcie_scan_all" but without any success.
> >>
> >> Just for info:
> >>
> >> The CPU is a PA Semi “PWRficient” PA6T-1682M. This device
> >> combines dual 1.8GHz PowerPC cores with a 2MB L2 cache, dual
> >> channel DDR2 memory controllers and 24 SerDes channels. The
> >> PowerPC cores adhere to the Power ISA v2.04, and support 64-bit
> >> extensions. They feature a double precision FPU and a VMX
> >> (AltiVec) vector unit. They each have a 64kB I-cache and a 64kB
> >> D-cache.  The SerDes channels support PCI Express, XAUI and SGMII
> >> protocols. The “ENVOI” I/O subsystem which drives them includes
> >> caching, offload and DMA resources to maximise I/O performance.

> >> Nemo uses the AMD/ATI SB600 South Bridge to provide various
> >> integrated I/O functions including SATA/PATA ports, USB and
> >> audio. The SB600 connects to the CPU via a PCIe x4 link. This is
> >> termed an “A-link II Express” link by ATI/AMD. The design team
> >> determined early in the development of Nemo that the link’s
> >> behaviour as an endpoint does not comply fully with the PCI
> >> Express specification. Specifically, it requires the root complex
> >> to use non-zero device numbers in type 0 configuration cycles to
> >> enumerate all the devices within the SB600. This is related to
> >> the PC architecture and is used to allow SB600 devices appear on
> >> logical bus 0.
> >>
> >> More information about the Nemo board:
> >>
> >> https://en.wikipedia.org/wiki/AmigaOne_X1000
> >> http://www.a-eon.com/?page=x1000
> >> http://www.amigaos.net/hardware/35/amigaone-x1000

> > It looks like the SB600 devices actually appear on bus 05 (not 00),
> > right?  I see these devices (among others):
> >
> >   00:10.0 PCI bridge: PA Semi, Inc PWRficient PCI-Express Port
> >   00:11.0 PCI bridge: PA Semi, Inc PWRficient PCI-Express Port
> >   01:00.0 VGA compatible controller: [AMD/ATI] Barts XT [Radeon HD 6870]
> >   05:12.0 SATA controller: [AMD/ATI] SB600 Non-Raid-5 SATA
> >   05:14.4 PCI bridge: [AMD/ATI] SBx00 PCI to PCI Bridge
> >   06:05.0 Ethernet controller: RTL-8100/8101L/8139
> >
> > So 00:10.0 and 00:11.0 are bridges leading to buses 01 and 05-06.
> > Maybe 00:11.0 is the Downstream Port that leads to this magic "A-Link
> > II Express" thing?
> >
> > But I don't think all those SB600 devices on bus 05 are PCIe devices.
> > It would certainly be unconventional to have a PCIe device (00:11.0)
> > at the upstream end of a link and conventional PCI devices (05:12.0,
> > 05:13.0, 05:13.1, etc) at the downstream end, with no visible PCIe
> > port.
> >
> > The usual thing would be that 00:11.0 would be a Root Port or a Switch
> > Downstream Port leading to a Link, and the other end of the Link would
> > terminate in either a Switch Upstream Port or an Upstream Port
> > embedded in an Endpoint.
> >
> > We'll have to think about how to handle this.  But the complete "lspci
> > -vv" output as root will have more useful information.
> 
> Thanks for your reply. Please find attached the complete "lspci -vv"
> output as root.

00:11.0 claims to be a PCIe Root Port leading to [bus 05-06].  That
means there's a Link (presumably this A-Link II Express thing), and the
downstream end of the Link *should* be a PCIe Upstream Port on bus 05,
but no such device is visible.  I suppose the SB600 does implement
some sort of PCIe Port there, but keeps it invisible to software, and
at the same time, contains an invisible bridge that connects the Link
to all the conventional PCI devices on bus 05.

When we scan bus 05, we do this:

  pci_scan_child_bus_extend(bus=05)
for (devfn = 0; devfn < 0x100; devfn += 8)
  pci_scan_slot(05, 00.0)
pci_scan_single_device
  pci_scan_device(05, 00.0)   # fails; no 05:00.0
  pci_scan_slot(05, 01.0)
only_one_child(bus=05)
  parent = 00:11.0
  pci_pcie_type(00:11.0) == ROOT_PORT # returns true

Since only_one_child() sees that 00:11.0 is a Root Port, we give up
before we even get to the PCI_SCAN_ALL_PCIE_DEVS test.

I *think* something like the patch below should make this work if you
use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
something similar on powerpc, but maybe you do?


commit 75eaf674066590e79b3e03d32488871fc881ab40
Author: Bjorn Helgaas 
Date:   Thu Nov 30 15:22:39 2017 -0600

PCI: Make PCI_SCAN_ALL_PCIE_DEVS work for Root Ports as well as Downstream

Previously PCI_SCAN_ALL_PCIE_DEVS (set by quirks or the "pci=pcie_scan_all"
kernel parameter) only affected Switch Downstream Ports, not Root Ports.

Simplify 

[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-11-29 Thread Christian Zigotzky

On 29 November 2017 at 11:34PM, Bjorn Helgaas wrote:
> On Wed, Nov 29, 2017 at 2:45 PM, Christian Zigotzky
>> Hi Bjorn,
>>
>> Thank you for your answer. I have tried to boot the kernel 4.15 RC1 
(built

>> without the patch above) with the boot argument "pci=pcie_scan_all" but
>> without any success.
>>
>> Just for info:
>>
>> The CPU is a PA Semi “PWRficient” PA6T-1682M. This device combines dual
>> 1.8GHz PowerPC cores with a 2MB L2 cache, dual channel DDR2 memory
>> controllers and 24 SerDes
>> channels. The PowerPC cores adhere to the Power ISA v2.04, and support
>> 64-bit extensions. They feature a double precision FPU and a VMX 
(AltiVec)

>> vector unit. They each have a 64kB I-cache and a 64kB D-cache.
>> The SerDes channels support PCI Express, XAUI and SGMII protocols. The
>> “ENVOI” I/O subsystem which drives them includes caching, offload 
and DMA

>> resources to maximise I/O
>> performance.
>> Nemo uses the AMD/ATI SB600 South Bridge to provide various 
integrated I/O
>> functions including SATA/PATA ports, USB and audio. The SB600 
connects to
>> the CPU via a PCIe x4 link. This is termed an “A-link II Express” 
link by
>> ATI/AMD. The design team determined early in the development of Nemo 
that

>> the link’s behaviour as an endpoint does not comply fully with the PCI
>> Express specification. Specifically, it requires the root complex to use
>> non-zero device numbers in type 0 configuration cycles to enumerate 
all the
>> devices within the SB600. This is related to the PC architecture and 
is used

>> to allow SB600 devices appear on logical bus 0.
>>
>> More information about the Nemo board:
>>
>> https://en.wikipedia.org/wiki/AmigaOne_X1000
>> http://www.a-eon.com/?page=x1000
>> http://www.amigaos.net/hardware/35/amigaone-x1000
>>
>> Please find attached the complete "lspci -vv" and dmesg output.
>
> Thanks.  Can you collect the "lspci -vv" output as root?  The one you
> attached wasn't as root and doesn't include the PCI capability
> information, which we need so we can tell which devices appear as
> conventional PCI and which as PCIe.
>
> It would also be helpful if you could send plain-text email because
> the linux-pci list discards fancy email
> (http://vger.kernel.org/majordomo-info.html#taboo).
>
> It looks like the SB600 devices actually appear on bus 05 (not 00),
> right?  I see these devices (among others):
>
>   00:10.0 PCI bridge: PA Semi, Inc PWRficient PCI-Express Port
>   00:11.0 PCI bridge: PA Semi, Inc PWRficient PCI-Express Port
>   01:00.0 VGA compatible controller: [AMD/ATI] Barts XT [Radeon HD 6870]
>   05:12.0 SATA controller: [AMD/ATI] SB600 Non-Raid-5 SATA
>   05:14.4 PCI bridge: [AMD/ATI] SBx00 PCI to PCI Bridge
>   06:05.0 Ethernet controller: RTL-8100/8101L/8139
>
> So 00:10.0 and 00:11.0 are bridges leading to buses 01 and 05-06.
> Maybe 00:11.0 is the Downstream Port that leads to this magic "A-Link
> II Express" thing?
>
> But I don't think all those SB600 devices on bus 05 are PCIe devices.
> It would certainly be unconventional to have a PCIe device (00:11.0)
> at the upstream end of a link and conventional PCI devices (05:12.0,
> 05:13.0, 05:13.1, etc) at the downstream end, with no visible PCIe
> port.
>
> The usual thing would be that 00:11.0 would be a Root Port or a Switch
> Downstream Port leading to a Link, and the other end of the Link would
> terminate in either a Switch Upstream Port or an Upstream Port
> embedded in an Endpoint.
>
> We'll have to think about how to handle this.  But the complete "lspci
> -vv" output as root will have more useful information.
>
> Bjorn

Hi Bjorn,

Thanks for your reply. Please find attached the complete "lspci -vv" 
output as root.


Cheers,
Christian





00:00.0 Host bridge: PA Semi, Inc PWRficient Host Bridge (rev 12)
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- 

00:01.0 Memory controller: PA Semi, Inc PWRficient L2 Cache (rev 11)
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- 

00:03.0 PIC: PA Semi, Inc PWRficient System/Debug Controller (rev 13) (prog-if 
80)
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- TAbort- SERR- 
Kernel driver in use: pasemi_edac

00:05.0 RAM memory: PA Semi, Inc PWRficient DDR2 Memory Controller (rev 11)
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- 
Kernel driver in use: pasemi_edac

00:08.0 Power PC: PA Semi, Inc PA6T Core (rev 12)
Control: I/O- Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- 

Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-11-29 Thread Bjorn Helgaas
On Wed, Nov 29, 2017 at 2:45 PM, Christian Zigotzky
<chzigot...@xenosoft.de> wrote:
> On 29 November 2017 at 8:46PM, Bjorn Helgaas wrote:
>>
>> On Wed, Nov 29, 2017 at 1:28 PM, Christian Zigotzky
>> <chzigot...@xenosoft.de> wrote:
>>>
>>> On 23 November 2017 at 2:31PM, Michael Ellerman wrote:
>>>>
>>>> Hi Christian,
>>>>
>>>> Thanks for your patch.
>>>>
>>>> Christian Zigotzky <chzigot...@xenosoft.de> writes:
>>>>>
>>>>> Hi All,
>>>>>
>>>>> Just a small patch for the P.A. Semi Nemo board:
>>>>>
>>>>> -
>>>>>
>>>>> diff -rupN a/drivers/pci/probe.c b/drivers/pci/probe.c
>>>>> --- a/drivers/pci/probe.c2017-11-16 08:18:40.504012010 +0100
>>>>> +++ b/drivers/pci/probe.c2017-11-16 08:17:22.044368405 +0100
>>>>> @@ -2219,6 +2219,8 @@ static int only_one_child(struct pci_bus
>>>>
>>>> As this is a patch to the PCI code I can't merge it via the powerpc
>>>> tree. You would need to send it to linux-...@vger.kernel.org.
>>>>
>>>>> if (!parent || !pci_is_pcie(parent))
>>>>> return 0;
>>>>> +#ifndef CONFIG_PPC_PASEMI_NEMO
>>>>> +// SB600 for the Nemo board has non-zero devices on non-root bus.
>>>>> if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
>>>>> return 1;
>>>>>
>>>>> @@ -2231,6 +2233,7 @@ static int only_one_child(struct pci_bus
>>>>> if (parent->has_secondary_link &&
>>>>> !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
>>>>> return 1;
>>>>> +#endif
>>>>
>>>> But the PCI maintainer is not going to accept a patch like this, which
>>>> adds a platform specific #ifdef in core code like this.
>>>>
>>>> If you look at the rest of that file I don't think you'll find a single
>>>> #ifdef other than for generic configuration symbols.
>>>>
>>>> Are you sure the PCI_SCAN_ALL_PCIE_DEVS logic doesn't work for you? It
>>>> sounds like it was added for exactly this problem.
>>>>
>>>> cheers
>>>>
>>> Hi Michael,
>>>
>>> Thanks for your reply. Sorry for my late answer. I removed the patch
>>> above
>>> from the RC1 and compiled the RC1 again. Unfortunately without the patch,
>>> the kernel doesn't recognize any drives and partitions. Do you have
>>> another
>>> idea?
>>
>> What happens if you boot RC1 with "pci=pcie_scan_all"?  If that works,
>> we do have some quirks that set that automatically, and we might be
>> able to add another one for the Nemo.
>>
>> Can you collect the complete "lspci -vv" and dmesg output for this
>> system?  I'm curious about why it is special.
>>
>> Bjorn
>>
> Hi Bjorn,
>
> Thank you for your answer. I have tried to boot the kernel 4.15 RC1 (built
> without the patch above) with the boot argument "pci=pcie_scan_all" but
> without any success.
>
> Just for info:
>
> The CPU is a PA Semi “PWRficient” PA6T-1682M. This device combines dual
> 1.8GHz PowerPC cores with a 2MB L2 cache, dual channel DDR2 memory
> controllers and 24 SerDes
> channels. The PowerPC cores adhere to the Power ISA v2.04, and support
> 64-bit extensions. They feature a double precision FPU and a VMX (AltiVec)
> vector unit. They each have a 64kB I-cache and a 64kB D-cache.
> The SerDes channels support PCI Express, XAUI and SGMII protocols. The
> “ENVOI” I/O subsystem which drives them includes caching, offload and DMA
> resources to maximise I/O
> performance.
> Nemo uses the AMD/ATI SB600 South Bridge to provide various integrated I/O
> functions including SATA/PATA ports, USB and audio. The SB600 connects to
> the CPU via a PCIe x4 link. This is termed an “A-link II Express” link by
> ATI/AMD. The design team determined early in the development of Nemo that
> the link’s behaviour as an endpoint does not comply fully with the PCI
> Express specification. Specifically, it requires the root complex to use
> non-zero device numbers in type 0 configuration cycles to enumerate all the
> devices within the SB600. This is related to the PC architecture and is used
> to allow SB600 devices appear on logical bus 0.
>
> More information about the Nemo board:
>
> https://en.wikipedia.org/wiki/AmigaOne_X1000
> http://www.a-eon.

[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-11-29 Thread Christian Zigotzky

On 29 November 2017 at 8:46PM, Bjorn Helgaas wrote:

On Wed, Nov 29, 2017 at 1:28 PM, Christian Zigotzky
<chzigot...@xenosoft.de> wrote:

On 23 November 2017 at 2:31PM, Michael Ellerman wrote:

Hi Christian,

Thanks for your patch.

Christian Zigotzky <chzigot...@xenosoft.de> writes:

Hi All,

Just a small patch for the P.A. Semi Nemo board:

-

diff -rupN a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c2017-11-16 08:18:40.504012010 +0100
+++ b/drivers/pci/probe.c2017-11-16 08:17:22.044368405 +0100
@@ -2219,6 +2219,8 @@ static int only_one_child(struct pci_bus

As this is a patch to the PCI code I can't merge it via the powerpc
tree. You would need to send it to linux-...@vger.kernel.org.


if (!parent || !pci_is_pcie(parent))
return 0;
+#ifndef CONFIG_PPC_PASEMI_NEMO
+// SB600 for the Nemo board has non-zero devices on non-root bus.
if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
return 1;

@@ -2231,6 +2233,7 @@ static int only_one_child(struct pci_bus
if (parent->has_secondary_link &&
!pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
return 1;
+#endif

But the PCI maintainer is not going to accept a patch like this, which
adds a platform specific #ifdef in core code like this.

If you look at the rest of that file I don't think you'll find a single
#ifdef other than for generic configuration symbols.

Are you sure the PCI_SCAN_ALL_PCIE_DEVS logic doesn't work for you? It
sounds like it was added for exactly this problem.

cheers


Hi Michael,

Thanks for your reply. Sorry for my late answer. I removed the patch above
from the RC1 and compiled the RC1 again. Unfortunately without the patch,
the kernel doesn't recognize any drives and partitions. Do you have another
idea?

What happens if you boot RC1 with "pci=pcie_scan_all"?  If that works,
we do have some quirks that set that automatically, and we might be
able to add another one for the Nemo.

Can you collect the complete "lspci -vv" and dmesg output for this
system?  I'm curious about why it is special.

Bjorn


Hi Bjorn,

Thank you for your answer. I have tried to boot the kernel 4.15 RC1 
(built without the patch above) with the boot argument 
"pci=pcie_scan_all" but without any success.


Just for info:

The CPU is a PA Semi “PWRficient” PA6T-1682M. This device combines dual 
1.8GHz PowerPC cores with a 2MB L2 cache, dual channel DDR2 memory 
controllers and 24 SerDes
channels. The PowerPC cores adhere to the Power ISA v2.04, and support 
64-bit extensions. They feature a double precision FPU and a VMX 
(AltiVec) vector unit. They each have a 64kB I-cache and a 64kB D-cache.
The SerDes channels support PCI Express, XAUI and SGMII protocols. The 
“ENVOI” I/O subsystem which drives them includes caching, offload and 
DMA resources to maximise I/O

performance.
Nemo uses the AMD/ATI SB600 South Bridge to provide various integrated 
I/O functions including SATA/PATA ports, USB and audio. The SB600 
connects to the CPU via a PCIe x4 link. This is termed an “A-link II 
Express” link by ATI/AMD. The design team determined early in the 
development of Nemo that the link’s behaviour as an endpoint does not 
comply fully with the PCI Express specification. Specifically, it 
requires the root complex to use non-zero device numbers in type 0 
configuration cycles to enumerate all the devices within the SB600. This 
is related to the PC architecture and is used to allow SB600 devices 
appear on logical bus 0.


More information about the Nemo board:

https://en.wikipedia.org/wiki/AmigaOne_X1000
http://www.a-eon.com/?page=x1000
http://www.amigaos.net/hardware/35/amigaone-x1000

Please find attached the complete "lspci -vv" and dmesg output.

Thanks,
Christian



[0.00] Allocated 4096 bytes for 2 pacas at c000
[0.00] hash-mmu: Page sizes from device-tree:
[0.00] hash-mmu: base_shift=12: shift=12, sllp=0x, 
avpnm=0x, tlbiel=1, penc=0
[0.00] hash-mmu: base_shift=16: shift=16, sllp=0x0110, 
avpnm=0x, tlbiel=1, penc=3
[0.00] hash-mmu: base_shift=20: shift=20, sllp=0x0030, 
avpnm=0x, tlbiel=0, penc=31
[0.00] hash-mmu: base_shift=24: shift=24, sllp=0x0100, 
avpnm=0x0001, tlbiel=0, penc=0
[0.00] Page orders: linear mapping = 24, virtual = 12, io = 12
[0.00] Using 1TB segments
[0.00] hash-mmu: Initializing hash mmu with SLB
[0.00] Linux version 4.15.0-rc1_A-EON_AmigaOne_X1000_Nemo 
(christian@AmigaoneX1000) (gcc version 6.3.0 20170618 (Debian 6.3.0-19)) #1 SMP 
Mon Nov 27 09:04:52 CET 2017
[0.00] IOBMAP L2 allocated at: c0007fe0
[0.00] Using PA Semi PWRficient machine description
[0.00] Found legacy serial port 0 for /pxp@0,e000/serial@1d
[0.00]   port=7f03f8, taddr=fcff03f8, irq=0, clk=1, speed=115200
[0.000

Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-11-29 Thread Bjorn Helgaas
On Wed, Nov 29, 2017 at 1:28 PM, Christian Zigotzky
<chzigot...@xenosoft.de> wrote:
> On 23 November 2017 2:31PM, Michael Ellerman wrote:
>>
>> Hi Christian,
>>
>> Thanks for your patch.
>>
>> Christian Zigotzky <chzigot...@xenosoft.de> writes:
>>>
>>> Hi All,
>>>
>>> Just a small patch for the P.A. Semi Nemo board:
>>>
>>> -
>>>
>>> diff -rupN a/drivers/pci/probe.c b/drivers/pci/probe.c
>>> --- a/drivers/pci/probe.c2017-11-16 08:18:40.504012010 +0100
>>> +++ b/drivers/pci/probe.c2017-11-16 08:17:22.044368405 +0100
>>> @@ -2219,6 +2219,8 @@ static int only_one_child(struct pci_bus
>>
>> As this is a patch to the PCI code I can't merge it via the powerpc
>> tree. You would need to send it to linux-...@vger.kernel.org.
>>
>>>if (!parent || !pci_is_pcie(parent))
>>>return 0;
>>> +#ifndef CONFIG_PPC_PASEMI_NEMO
>>> +// SB600 for the Nemo board has non-zero devices on non-root bus.
>>>if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
>>>return 1;
>>>
>>> @@ -2231,6 +2233,7 @@ static int only_one_child(struct pci_bus
>>>if (parent->has_secondary_link &&
>>>!pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
>>>return 1;
>>> +#endif
>>
>> But the PCI maintainer is not going to accept a patch like this, which
>> adds a platform specific #ifdef in core code like this.
>>
>> If you look at the rest of that file I don't think you'll find a single
>> #ifdef other than for generic configuration symbols.
>>
>> Are you sure the PCI_SCAN_ALL_PCIE_DEVS logic doesn't work for you? It
>> sounds like it was added for exactly this problem.
>>
>> cheers
>>
> Hi Michael,
>
> Thanks for your reply. Sorry for my late answer. I removed the patch above
> from the RC1 and compiled the RC1 again. Unfortunately without the patch,
> the kernel doesn't recognize any drives and partitions. Do you have another
> idea?

What happens if you boot RC1 with "pci=pcie_scan_all"?  If that works,
we do have some quirks that set that automatically, and we might be
able to add another one for the Nemo.

Can you collect the complete "lspci -vv" and dmesg output for this
system?  I'm curious about why it is special.

Bjorn


[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-11-29 Thread Christian Zigotzky

On 23 November 2017 2:31PM, Michael Ellerman wrote:

Hi Christian,

Thanks for your patch.

Christian Zigotzky <chzigot...@xenosoft.de> writes:

Hi All,

Just a small patch for the P.A. Semi Nemo board:

-

diff -rupN a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c    2017-11-16 08:18:40.504012010 +0100
+++ b/drivers/pci/probe.c    2017-11-16 08:17:22.044368405 +0100
@@ -2219,6 +2219,8 @@ static int only_one_child(struct pci_bus

As this is a patch to the PCI code I can't merge it via the powerpc
tree. You would need to send it to linux-...@vger.kernel.org.


   if (!parent || !pci_is_pcie(parent))
       return 0;
+    #ifndef CONFIG_PPC_PASEMI_NEMO
+    // SB600 for the Nemo board has non-zero devices on non-root bus.
   if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
       return 1;

@@ -2231,6 +2233,7 @@ static int only_one_child(struct pci_bus
   if (parent->has_secondary_link &&
       !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
       return 1;
+    #endif

But the PCI maintainer is not going to accept a patch like this, which
adds a platform specific #ifdef in core code like this.

If you look at the rest of that file I don't think you'll find a single
#ifdef other than for generic configuration symbols.

Are you sure the PCI_SCAN_ALL_PCIE_DEVS logic doesn't work for you? It
sounds like it was added for exactly this problem.

cheers


Hi Michael,

Thanks for your reply. Sorry for my late answer. I removed the patch 
above from the RC1 and compiled the RC1 again. Unfortunately without the 
patch, the kernel doesn't recognize any drives and partitions. Do you 
have another idea?


Thanks,
Christian



Re: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-11-23 Thread Michael Ellerman
Hi Christian,

Thanks for your patch.

Christian Zigotzky <chzigot...@xenosoft.de> writes:
> Hi All,
>
> Just a small patch for the P.A. Semi Nemo board:
>
> -
>
> diff -rupN a/drivers/pci/probe.c b/drivers/pci/probe.c
> --- a/drivers/pci/probe.c    2017-11-16 08:18:40.504012010 +0100
> +++ b/drivers/pci/probe.c    2017-11-16 08:17:22.044368405 +0100
> @@ -2219,6 +2219,8 @@ static int only_one_child(struct pci_bus

As this is a patch to the PCI code I can't merge it via the powerpc
tree. You would need to send it to linux-...@vger.kernel.org.

>
>   if (!parent || !pci_is_pcie(parent))
>       return 0;
> +    #ifndef CONFIG_PPC_PASEMI_NEMO
> +    // SB600 for the Nemo board has non-zero devices on non-root bus.
>   if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
>       return 1;
>
> @@ -2231,6 +2233,7 @@ static int only_one_child(struct pci_bus
>   if (parent->has_secondary_link &&
>       !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
>       return 1;
> +    #endif

But the PCI maintainer is not going to accept a patch like this, which
adds a platform specific #ifdef in core code like this.

If you look at the rest of that file I don't think you'll find a single
#ifdef other than for generic configuration symbols.

Are you sure the PCI_SCAN_ALL_PCIE_DEVS logic doesn't work for you? It
sounds like it was added for exactly this problem.

cheers


[PATCH] SB600 for the Nemo board has non-zero devices on non-root bus

2017-11-15 Thread Christian Zigotzky

Hi All,

Just a small patch for the P.A. Semi Nemo board:

-

diff -rupN a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c    2017-11-16 08:18:40.504012010 +0100
+++ b/drivers/pci/probe.c    2017-11-16 08:17:22.044368405 +0100
@@ -2219,6 +2219,8 @@ static int only_one_child(struct pci_bus

 if (!parent || !pci_is_pcie(parent))
     return 0;
+    #ifndef CONFIG_PPC_PASEMI_NEMO
+    // SB600 for the Nemo board has non-zero devices on non-root bus.
 if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
     return 1;

@@ -2231,6 +2233,7 @@ static int only_one_child(struct pci_bus
 if (parent->has_secondary_link &&
     !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
     return 1;
+    #endif
 return 0;
 }



This is my first patch on this mailing list. Sorry if it isn't in a good 
quality. I am still learning. I hope you can add it.


Thanks,
Christian