linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops
@ 2015-04-14  4:27 Daniel Axtens
  2015-04-14  4:27 ` [PATCH 01/10] powerpc: Add MSI operations to pci_controller_ops struct Daniel Axtens
                   ` (9 more replies)
  0 siblings, 10 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:27 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

This patch set moves MSI related PCI controller operations out of
ppc_md and into the pci_controller_ops struct.

This is a follow up to the previous patch series creating the
pci_controller_ops structure. [1]

This series follows the same structure:

 - Add functions to pci_controller_ops struct, patch call sites to
   call struct functions if available, in preference to ppc_md
   funtions.

 - Move affected platforms and subsystems over one by one.

 - Remove shims, remove from ppc_md.

The set has been build tested for PowerNV, pseries, Cell, PaSemi,
ppc44x and Corenet 64 (for fsl_pci). It builds at every point in the
series. It has been boot-tested on pseries.

It depends on my previous patch series. As such, it is based on
today's linux-next.

[1] https://lkml.kernel.org/r/1427778057-9505-1-git-send-email-dja@axtens.net

Daniel Axtens (10):
  powerpc: Add MSI operations to pci_controller_ops struct
  powerpc/powernv: Move MSI-related ops to pci_controller_ops
  powerpc/cell: Move MSI-related ops to pci_controller_ops
  powerpc/pseries: Move MSI-related ops to pci_controller_ops
  powerpc/fsl_msi: Move MSI-related ops to pci_controller_ops
  powerpc/ppc4xx_msi: Move MSI-related ops to pci_controller_ops
  powerpc/ppc4xx_hsta_msi: Move MSI-related ops to pci_controller_ops
  powerpc/mpic_pasemi_msi: Move MSI-related ops to pci_controller_ops
  powerpc/mpic_u3msi: Move MSI-related ops to pci_controller_ops
  powerpc: Remove MSI-related PCI controller ops from ppc_md

 arch/powerpc/include/asm/machdep.h     |  6 ------
 arch/powerpc/include/asm/pci-bridge.h  |  6 ++++++
 arch/powerpc/kernel/msi.c              | 11 ++++++++---
 arch/powerpc/platforms/cell/axon_msi.c |  5 +++--
 arch/powerpc/platforms/powernv/pci.c   | 10 ++++------
 arch/powerpc/platforms/pseries/msi.c   |  8 +++++---
 arch/powerpc/sysdev/fsl_msi.c          | 23 +++++++++++++++--------
 arch/powerpc/sysdev/mpic_pasemi_msi.c  |  9 ++++++---
 arch/powerpc/sysdev/mpic_u3msi.c       |  9 ++++++---
 arch/powerpc/sysdev/ppc4xx_hsta_msi.c  |  7 +++++--
 arch/powerpc/sysdev/ppc4xx_msi.c       |  7 +++++--
 11 files changed, 63 insertions(+), 38 deletions(-)

-- 
2.1.4

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

* [PATCH 01/10] powerpc: Add MSI operations to pci_controller_ops struct
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
@ 2015-04-14  4:27 ` Daniel Axtens
  2015-04-14  4:27 ` [PATCH 02/10] powerpc/powernv: Move MSI-related ops to pci_controller_ops Daniel Axtens
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:27 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Add MSI setup and teardown functions to pci_controller_ops.

Patch the callsites (arch_{setup,teardown}_msi_irqs) to prefer the
controller ops version if it's available.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h |  6 ++++++
 arch/powerpc/kernel/msi.c             | 18 +++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 1811c44..a3b6252 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -30,6 +30,12 @@ struct pci_controller_ops {
 	/* Called during PCI resource reassignment */
 	resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
 	void		(*reset_secondary_bus)(struct pci_dev *dev);
+
+#ifdef CONFIG_PCI_MSI
+	int		(*setup_msi_irqs)(struct pci_dev *dev,
+					  int nvec, int type);
+	void		(*teardown_msi_irqs)(struct pci_dev *dev);
+#endif
 };
 
 /*
diff --git a/arch/powerpc/kernel/msi.c b/arch/powerpc/kernel/msi.c
index 71bd161..3d452f7 100644
--- a/arch/powerpc/kernel/msi.c
+++ b/arch/powerpc/kernel/msi.c
@@ -15,7 +15,11 @@
 
 int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
-	if (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs) {
+	struct pci_controller *phb = pci_bus_to_host(dev->bus);
+
+	if ((!phb->controller_ops.setup_msi_irqs ||
+	     !phb->controller_ops.teardown_msi_irqs) &&
+	    (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs)) {
 		pr_debug("msi: Platform doesn't provide MSI callbacks.\n");
 		return -ENOSYS;
 	}
@@ -24,10 +28,18 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 	if (type == PCI_CAP_ID_MSI && nvec > 1)
 		return 1;
 
-	return ppc_md.setup_msi_irqs(dev, nvec, type);
+	if (phb->controller_ops.setup_msi_irqs)
+		return phb->controller_ops.setup_msi_irqs(dev, nvec, type);
+	else
+		return ppc_md.setup_msi_irqs(dev, nvec, type);
 }
 
 void arch_teardown_msi_irqs(struct pci_dev *dev)
 {
-	ppc_md.teardown_msi_irqs(dev);
+	struct pci_controller *phb = pci_bus_to_host(dev->bus);
+
+	if (phb->controller_ops.teardown_msi_irqs)
+		phb->controller_ops.teardown_msi_irqs(dev);
+	else
+		ppc_md.teardown_msi_irqs(dev);
 }
-- 
2.1.4

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

* [PATCH 02/10] powerpc/powernv: Move MSI-related ops to pci_controller_ops
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
  2015-04-14  4:27 ` [PATCH 01/10] powerpc: Add MSI operations to pci_controller_ops struct Daniel Axtens
@ 2015-04-14  4:27 ` Daniel Axtens
  2015-04-14  4:27 ` [PATCH 03/10] powerpc/cell: " Daniel Axtens
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:27 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Move the PowerNV/BML platform to use the pci_controller_ops structure
rather than ppc_md for MSI related PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/powernv/pci.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index bca2aeb..0f04940 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -768,16 +768,14 @@ void __init pnv_pci_init(void)
 	ppc_md.tce_free_rm = pnv_tce_free_rm;
 	ppc_md.tce_get = pnv_tce_get;
 	set_pci_dma_ops(&dma_iommu_ops);
-
-	/* Configure MSIs */
-#ifdef CONFIG_PCI_MSI
-	ppc_md.setup_msi_irqs = pnv_setup_msi_irqs;
-	ppc_md.teardown_msi_irqs = pnv_teardown_msi_irqs;
-#endif
 }
 
 machine_subsys_initcall_sync(powernv, tce_iommu_bus_notifier_init);
 
 struct pci_controller_ops pnv_pci_controller_ops = {
 	.dma_dev_setup = pnv_pci_dma_dev_setup,
+#ifdef CONFIG_PCI_MSI
+	.setup_msi_irqs = pnv_setup_msi_irqs,
+	.teardown_msi_irqs = pnv_teardown_msi_irqs,
+#endif
 };
-- 
2.1.4

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

* [PATCH 03/10] powerpc/cell: Move MSI-related ops to pci_controller_ops
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
  2015-04-14  4:27 ` [PATCH 01/10] powerpc: Add MSI operations to pci_controller_ops struct Daniel Axtens
  2015-04-14  4:27 ` [PATCH 02/10] powerpc/powernv: Move MSI-related ops to pci_controller_ops Daniel Axtens
@ 2015-04-14  4:27 ` Daniel Axtens
  2015-04-14  4:27 ` [PATCH 04/10] powerpc/pseries: " Daniel Axtens
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:27 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Move the Cell platform to use the pci_controller_ops structure rather
than ppc_md for MSI related PCI controller operations.

We can be confident that the functions will be added to the platform's
ops struct before any PCI controller's ops struct is populated
because:

1) These ops are added to the struct in a subsys initcall.

We populate the ops in axon_msi_probe, which is the probe call for the
axon-msi driver. However the driver is registered in axon_msi_init,
which is a subsys initcall, so this will happen at the subsys level.

2) The controller recieves the struct later, in a device initcall.

Cell populates the controller in cell_setup_phb, which is hooked up to
ppc_md.pci_setup_phb. ppc_md.pci_setup_phb is only ever called in
of_platform.c, as part of the OpenFirmware PCI driver's probe
routine. That driver is registered in a device initcall, so it will
occur *after* the struct is properly populated.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/cell/axon_msi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index 623bd96..d9b8a44 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -22,6 +22,7 @@
 #include <asm/machdep.h>
 #include <asm/prom.h>
 
+#include "cell.h"
 
 /*
  * MSIC registers, specified as offsets from dcr_base
@@ -406,8 +407,8 @@ static int axon_msi_probe(struct platform_device *device)
 
 	dev_set_drvdata(&device->dev, msic);
 
-	ppc_md.setup_msi_irqs = axon_msi_setup_msi_irqs;
-	ppc_md.teardown_msi_irqs = axon_msi_teardown_msi_irqs;
+	cell_pci_controller_ops.setup_msi_irqs = axon_msi_setup_msi_irqs;
+	cell_pci_controller_ops.teardown_msi_irqs = axon_msi_teardown_msi_irqs;
 
 	axon_msi_debug_setup(dn, msic);
 
-- 
2.1.4

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

* [PATCH 04/10] powerpc/pseries: Move MSI-related ops to pci_controller_ops
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
                   ` (2 preceding siblings ...)
  2015-04-14  4:27 ` [PATCH 03/10] powerpc/cell: " Daniel Axtens
@ 2015-04-14  4:27 ` Daniel Axtens
  2015-04-14  4:27 ` [PATCH 05/10] powerpc/fsl_msi: " Daniel Axtens
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:27 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Move the pseries platform to use the pci_controller_ops structure
rather than ppc_md for MSI related PCI controller operations
---
 arch/powerpc/platforms/pseries/msi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index c8d24f9..a70806e 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -18,6 +18,8 @@
 #include <asm/ppc-pci.h>
 #include <asm/machdep.h>
 
+#include "pseries.h"
+
 static int query_token, change_token;
 
 #define RTAS_QUERY_FN		0
@@ -516,9 +518,9 @@ static int rtas_msi_init(void)
 
 	pr_debug("rtas_msi: Registering RTAS MSI callbacks.\n");
 
-	WARN_ON(ppc_md.setup_msi_irqs);
-	ppc_md.setup_msi_irqs = rtas_setup_msi_irqs;
-	ppc_md.teardown_msi_irqs = rtas_teardown_msi_irqs;
+	WARN_ON(pseries_pci_controller_ops.setup_msi_irqs);
+	pseries_pci_controller_ops.setup_msi_irqs = rtas_setup_msi_irqs;
+	pseries_pci_controller_ops.teardown_msi_irqs = rtas_teardown_msi_irqs;
 
 	WARN_ON(ppc_md.pci_irq_fixup);
 	ppc_md.pci_irq_fixup = rtas_msi_pci_irq_fixup;
-- 
2.1.4

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

* [PATCH 05/10] powerpc/fsl_msi: Move MSI-related ops to pci_controller_ops
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
                   ` (3 preceding siblings ...)
  2015-04-14  4:27 ` [PATCH 04/10] powerpc/pseries: " Daniel Axtens
@ 2015-04-14  4:27 ` Daniel Axtens
  2015-04-14  4:27 ` [PATCH 06/10] powerpc/ppc4xx_msi: " Daniel Axtens
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:27 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Move the fsl_msi subsystem to use the pci_controller_ops structure
rather than ppc_md for MSI related PCI controller operations.

Previously, MSI ops were added to ppc_md at the subsys level. However,
in fsl_pci.c, PCI controllers are created at the at arch level. So,
unlike in e.g. PowerNV/pSeries/Cell, we can't simply populate a
platform-level controller ops structure and have it copied into the
controllers when they are created.

Instead, walk every phb, and attempt to populate it with the MSI ops.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/sysdev/fsl_msi.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index f086c6f..5236e54 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -405,6 +405,7 @@ static int fsl_of_msi_probe(struct platform_device *dev)
 	const struct fsl_msi_feature *features;
 	int len;
 	u32 offset;
+	struct pci_controller *phb;
 
 	match = of_match_device(fsl_of_msi_ids, &dev->dev);
 	if (!match)
@@ -541,14 +542,20 @@ static int fsl_of_msi_probe(struct platform_device *dev)
 
 	list_add_tail(&msi->list, &msi_head);
 
-	/* The multiple setting ppc_md.setup_msi_irqs will not harm things */
-	if (!ppc_md.setup_msi_irqs) {
-		ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
-		ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
-	} else if (ppc_md.setup_msi_irqs != fsl_setup_msi_irqs) {
-		dev_err(&dev->dev, "Different MSI driver already installed!\n");
-		err = -ENODEV;
-		goto error_out;
+	/*
+	 * Apply the MSI ops to all the controllers.
+	 * It doesn't hurt to reassign the same ops,
+	 * but bail out if we find another MSI driver.
+	 */
+	list_for_each_entry(phb, &hose_list, list_node) {
+		if (!phb->controller_ops.setup_msi_irqs) {
+			phb->controller_ops.setup_msi_irqs = fsl_setup_msi_irqs;
+			phb->controller_ops.teardown_msi_irqs = fsl_teardown_msi_irqs;
+		} else if (phb->controller_ops.setup_msi_irqs != fsl_setup_msi_irqs) {
+			dev_err(&dev->dev, "Different MSI driver already installed!\n");
+			err = -ENODEV;
+			goto error_out;
+		}
 	}
 	return 0;
 error_out:
-- 
2.1.4

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

* [PATCH 06/10] powerpc/ppc4xx_msi: Move MSI-related ops to pci_controller_ops
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
                   ` (4 preceding siblings ...)
  2015-04-14  4:27 ` [PATCH 05/10] powerpc/fsl_msi: " Daniel Axtens
@ 2015-04-14  4:27 ` Daniel Axtens
  2015-04-14  4:28 ` [PATCH 07/10] powerpc/ppc4xx_hsta_msi: " Daniel Axtens
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:27 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Move the ppc4xx msi subsystem to use the pci_controller_ops structure
rather than ppc_md for MSI related PCI controller operations.

As with fsl_msi, operations are plugged in at the subsys level, after
controller creation. Again, we iterate over all controllers and
populate them with the MSI ops.
---
 arch/powerpc/sysdev/ppc4xx_msi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/sysdev/ppc4xx_msi.c
index 6e2e6aa..6eb21f2 100644
--- a/arch/powerpc/sysdev/ppc4xx_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_msi.c
@@ -218,6 +218,7 @@ static int ppc4xx_msi_probe(struct platform_device *dev)
 	struct ppc4xx_msi *msi;
 	struct resource res;
 	int err = 0;
+	struct pci_controller *phb;
 
 	dev_dbg(&dev->dev, "PCIE-MSI: Setting up MSI support...\n");
 
@@ -250,8 +251,10 @@ static int ppc4xx_msi_probe(struct platform_device *dev)
 	}
 	ppc4xx_msi = *msi;
 
-	ppc_md.setup_msi_irqs = ppc4xx_setup_msi_irqs;
-	ppc_md.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;
+	list_for_each_entry(phb, &hose_list, list_node) {
+		phb->controller_ops.setup_msi_irqs = ppc4xx_setup_msi_irqs;
+		phb->controller_ops.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;
+	}
 	return err;
 
 error_out:
-- 
2.1.4

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

* [PATCH 07/10] powerpc/ppc4xx_hsta_msi: Move MSI-related ops to pci_controller_ops
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
                   ` (5 preceding siblings ...)
  2015-04-14  4:27 ` [PATCH 06/10] powerpc/ppc4xx_msi: " Daniel Axtens
@ 2015-04-14  4:28 ` Daniel Axtens
  2015-04-14  4:28 ` [PATCH 08/10] powerpc/mpic_pasemi_msi: " Daniel Axtens
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:28 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Move the ppc4xx hsta msi subsystem to use the pci_controller_ops
structure rather than ppc_md for MSI related PCI controller
operations.

As with fsl_msi, operations are plugged in at the subsys level, after
controller creation. Again, we iterate over all controllers and
populate them with the MSI ops.
---
 arch/powerpc/sysdev/ppc4xx_hsta_msi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
index f366d2d..2bc3367 100644
--- a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
@@ -128,6 +128,7 @@ static int hsta_msi_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct resource *mem;
 	int irq, ret, irq_count;
+	struct pci_controller *phb;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (IS_ERR(mem)) {
@@ -171,8 +172,10 @@ static int hsta_msi_probe(struct platform_device *pdev)
 		}
 	}
 
-	ppc_md.setup_msi_irqs = hsta_setup_msi_irqs;
-	ppc_md.teardown_msi_irqs = hsta_teardown_msi_irqs;
+	list_for_each_entry(phb, &hose_list, list_node) {
+		phb->controller_ops.setup_msi_irqs = hsta_setup_msi_irqs;
+		phb->controller_ops.teardown_msi_irqs = hsta_teardown_msi_irqs;
+	}
 	return 0;
 
 out2:
-- 
2.1.4

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

* [PATCH 08/10] powerpc/mpic_pasemi_msi: Move MSI-related ops to pci_controller_ops
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
                   ` (6 preceding siblings ...)
  2015-04-14  4:28 ` [PATCH 07/10] powerpc/ppc4xx_hsta_msi: " Daniel Axtens
@ 2015-04-14  4:28 ` Daniel Axtens
  2015-07-07 10:50   ` PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore Christian Zigotzky
  2015-04-14  4:28 ` [PATCH 09/10] powerpc/mpic_u3msi: Move MSI-related ops to pci_controller_ops Daniel Axtens
  2015-04-14  4:28 ` [PATCH 10/10] powerpc: Remove MSI-related PCI controller ops from ppc_md Daniel Axtens
  9 siblings, 1 reply; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:28 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Move the PaSemi MPIC msi subsystem to use the pci_controller_ops
structure rather than ppc_md for MSI related PCI controller
operations.

As with fsl_msi, operations are plugged in at the subsys level, after
controller creation. Again, we iterate over all controllers and
populate them with the MSI ops.
---
 arch/powerpc/sysdev/mpic_pasemi_msi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c
index a3f660e..b49334c 100644
--- a/arch/powerpc/sysdev/mpic_pasemi_msi.c
+++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c
@@ -144,6 +144,7 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 int mpic_pasemi_msi_init(struct mpic *mpic)
 {
 	int rc;
+	struct pci_controller *phb;
 
 	if (!mpic->irqhost->of_node ||
 	    !of_device_is_compatible(mpic->irqhost->of_node,
@@ -159,9 +160,11 @@ int mpic_pasemi_msi_init(struct mpic *mpic)
 	pr_debug("pasemi_msi: Registering PA Semi MPIC MSI callbacks\n");
 
 	msi_mpic = mpic;
-	WARN_ON(ppc_md.setup_msi_irqs);
-	ppc_md.setup_msi_irqs = pasemi_msi_setup_msi_irqs;
-	ppc_md.teardown_msi_irqs = pasemi_msi_teardown_msi_irqs;
+	list_for_each_entry(phb, &hose_list, list_node) {
+		WARN_ON(phb->controller_ops.setup_msi_irqs);
+		phb->controller_ops.setup_msi_irqs = pasemi_msi_setup_msi_irqs;
+		phb->controller_ops.teardown_msi_irqs = pasemi_msi_teardown_msi_irqs;
+	}
 
 	return 0;
 }
-- 
2.1.4

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

* [PATCH 09/10] powerpc/mpic_u3msi: Move MSI-related ops to pci_controller_ops
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
                   ` (7 preceding siblings ...)
  2015-04-14  4:28 ` [PATCH 08/10] powerpc/mpic_pasemi_msi: " Daniel Axtens
@ 2015-04-14  4:28 ` Daniel Axtens
  2015-04-14  4:28 ` [PATCH 10/10] powerpc: Remove MSI-related PCI controller ops from ppc_md Daniel Axtens
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:28 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Move the u3 MPIC msi subsystem to use the pci_controller_ops structure
rather than ppc_md for MSI related PCI controller operations.

As with fsl_msi, operations are plugged in at the subsys level, after
controller creation. Again, we iterate over all controllers and
populate them with the MSI ops.
---
 arch/powerpc/sysdev/mpic_u3msi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index b2cef18..fc46ef3 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -181,6 +181,7 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 int mpic_u3msi_init(struct mpic *mpic)
 {
 	int rc;
+	struct pci_controller *phb;
 
 	rc = mpic_msi_init_allocator(mpic);
 	if (rc) {
@@ -193,9 +194,11 @@ int mpic_u3msi_init(struct mpic *mpic)
 	BUG_ON(msi_mpic);
 	msi_mpic = mpic;
 
-	WARN_ON(ppc_md.setup_msi_irqs);
-	ppc_md.setup_msi_irqs = u3msi_setup_msi_irqs;
-	ppc_md.teardown_msi_irqs = u3msi_teardown_msi_irqs;
+	list_for_each_entry(phb, &hose_list, list_node) {
+		WARN_ON(phb->controller_ops.setup_msi_irqs);
+		phb->controller_ops.setup_msi_irqs = u3msi_setup_msi_irqs;
+		phb->controller_ops.teardown_msi_irqs = u3msi_teardown_msi_irqs;
+	}
 
 	return 0;
 }
-- 
2.1.4

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

* [PATCH 10/10] powerpc: Remove MSI-related PCI controller ops from ppc_md
  2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
                   ` (8 preceding siblings ...)
  2015-04-14  4:28 ` [PATCH 09/10] powerpc/mpic_u3msi: Move MSI-related ops to pci_controller_ops Daniel Axtens
@ 2015-04-14  4:28 ` Daniel Axtens
  9 siblings, 0 replies; 29+ messages in thread
From: Daniel Axtens @ 2015-04-14  4:28 UTC (permalink / raw)
  To: linuxppc-dev, benh, mpe; +Cc: Daniel Axtens

Remove unneeded ppc_md functions. Patch callsites to use pci_controller_ops
functions exclusively.
---
 arch/powerpc/include/asm/machdep.h |  6 ------
 arch/powerpc/kernel/msi.c          | 15 ++++-----------
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index ef889943..0d387d0 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -131,12 +131,6 @@ struct machdep_calls {
 	/* To setup PHBs when using automatic OF platform driver for PCI */
 	int		(*pci_setup_phb)(struct pci_controller *host);
 
-#ifdef CONFIG_PCI_MSI
-	int		(*setup_msi_irqs)(struct pci_dev *dev,
-					  int nvec, int type);
-	void		(*teardown_msi_irqs)(struct pci_dev *dev);
-#endif
-
 	void		(*restart)(char *cmd);
 	void		(*halt)(void);
 	void		(*panic)(char *str);
diff --git a/arch/powerpc/kernel/msi.c b/arch/powerpc/kernel/msi.c
index 3d452f7..dab616a 100644
--- a/arch/powerpc/kernel/msi.c
+++ b/arch/powerpc/kernel/msi.c
@@ -17,9 +17,8 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
 	struct pci_controller *phb = pci_bus_to_host(dev->bus);
 
-	if ((!phb->controller_ops.setup_msi_irqs ||
-	     !phb->controller_ops.teardown_msi_irqs) &&
-	    (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs)) {
+	if (!phb->controller_ops.setup_msi_irqs ||
+	    !phb->controller_ops.teardown_msi_irqs) {
 		pr_debug("msi: Platform doesn't provide MSI callbacks.\n");
 		return -ENOSYS;
 	}
@@ -28,18 +27,12 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 	if (type == PCI_CAP_ID_MSI && nvec > 1)
 		return 1;
 
-	if (phb->controller_ops.setup_msi_irqs)
-		return phb->controller_ops.setup_msi_irqs(dev, nvec, type);
-	else
-		return ppc_md.setup_msi_irqs(dev, nvec, type);
+	return phb->controller_ops.setup_msi_irqs(dev, nvec, type);
 }
 
 void arch_teardown_msi_irqs(struct pci_dev *dev)
 {
 	struct pci_controller *phb = pci_bus_to_host(dev->bus);
 
-	if (phb->controller_ops.teardown_msi_irqs)
-		phb->controller_ops.teardown_msi_irqs(dev);
-	else
-		ppc_md.teardown_msi_irqs(dev);
+	phb->controller_ops.teardown_msi_irqs(dev);
 }
-- 
2.1.4

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-04-14  4:28 ` [PATCH 08/10] powerpc/mpic_pasemi_msi: " Daniel Axtens
@ 2015-07-07 10:50   ` Christian Zigotzky
  2015-07-07 11:25     ` Christian Zigotzky
  0 siblings, 1 reply; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-07 10:50 UTC (permalink / raw)
  To: linuxppc-dev

Dear Linuxppc-dev mailing list,

I compiled a kernel from the git on Tuesday 23rd of June 2015. It didn't 
boot with my PASEMI PA6T board.

Error messages:

Oops: Kernel access of bad area, sig: 11 [#1]

.sb600_8259_cascade+0x4c/0xac (unreliable)
.schedule+0x74/0x9c (unreliable)

Kernel panic - not syncing: Fatal exception in interrupt

I compiled the RC1 of kernel 4.2 last Sunday. Unfortunately it didn't 
boot either. The kernel 4.1 and 4.1.1 boot without any problems.

Could someone please explain me why it doesn't boot anymore?

I would like to thank you very much in advance for helping me.

If you have any questions, please don't hesitate to ask. I'm looking 
forward to getting your reply.


Kind regards,

Christian Zigotzky

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-07 10:50   ` PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore Christian Zigotzky
@ 2015-07-07 11:25     ` Christian Zigotzky
  2015-07-07 12:44       ` Christian Zigotzky
  0 siblings, 1 reply; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-07 11:25 UTC (permalink / raw)
  To: linuxppc-dev

Error messages images:

http://forum.hyperion-entertainment.biz/download/file.php?id=1772&mode=view
http://forum.hyperion-entertainment.biz/download/file.php?id=1774&mode=view

-- Christian

On 07 July 2015 12:50 PM Christian Zigotzky wrote:
> Dear Linuxppc-dev mailing list,
>
> I compiled a kernel from the git on Tuesday 23rd of June 2015. It 
> didn't boot with my PASEMI PA6T board.
>
> Error messages:
>
> Oops: Kernel access of bad area, sig: 11 [#1]
>
> .sb600_8259_cascade+0x4c/0xac (unreliable)
> .schedule+0x74/0x9c (unreliable)
>
> Kernel panic - not syncing: Fatal exception in interrupt
>
> I compiled the RC1 of kernel 4.2 last Sunday. Unfortunately it didn't 
> boot either. The kernel 4.1 and 4.1.1 boot without any problems.
>
> Could someone please explain me why it doesn't boot anymore?
>
> I would like to thank you very much in advance for helping me.
>
> If you have any questions, please don't hesitate to ask. I'm looking 
> forward to getting your reply.
>
>
> Kind regards,
>
> Christian Zigotzky
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-07 11:25     ` Christian Zigotzky
@ 2015-07-07 12:44       ` Christian Zigotzky
  2015-07-08 18:00         ` Christian Zigotzky
  0 siblings, 1 reply; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-07 12:44 UTC (permalink / raw)
  To: linuxppc-dev



Error messages images:

http://forum.hyperion-entertainment.biz/download/file.php?id=1772&mode=view
http://forum.hyperion-entertainment.biz/download/file.php?id=1774&mode=view

-- Christian

On 07 July 2015 12:50 PM Christian Zigotzky wrote:
> Dear Linuxppc-dev mailing list,
>
> I compiled a kernel from the git on Tuesday 23rd of June 2015. It
> didn't boot with my PASEMI PA6T board.
>
> Error messages:
>
> Oops: Kernel access of bad area, sig: 11 [#1]
>
> .sb600_8259_cascade+0x4c/0xac (unreliable)
> .schedule+0x74/0x9c (unreliable)
>
> Kernel panic - not syncing: Fatal exception in interrupt
>
> I compiled the RC1 of kernel 4.2 last Sunday. Unfortunately it didn't
> boot either. The kernel 4.1 and 4.1.1 boot without any problems.
>
> Could someone please explain me why it doesn't boot anymore?
>
> I would like to thank you very much in advance for helping me.
>
> If you have any questions, please don't hesitate to ask. I'm looking
> forward to getting your reply.
>
>
> Kind regards,
>
> Christian Zigotzky
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-07 12:44       ` Christian Zigotzky
@ 2015-07-08 18:00         ` Christian Zigotzky
  2015-07-08 22:36           ` Benjamin Herrenschmidt
  2015-07-09 22:27           ` Christian Zigotzky
  0 siblings, 2 replies; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-08 18:00 UTC (permalink / raw)
  To: linuxppc-dev

Dear Linuxppc-dev mailing list,

I used git bisect and found out that the following commit is the problem.

commit 3ceaccdf92073d193f0bfbe24280dd736e3fed86
Author: Dave Hansen <dave.hansen@linux.intel.com>


Log:

git clone 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-git

git bisect start b953c0d234bc72e8489d3bf51a276c5c4ec85345 (Linux 4.1)

git bisect bad d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (Linux 4.2-rc1)

Output:

Bisecting: 6261 revisions left to test after this (roughly 13 steps)
[4570a37169d4b44d316f40b2ccc681dc93fedc7b] Merge tag 'sound-4.2-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

----

git bisect bad

Output:

Bisecting: 3295 revisions left to test after this (roughly 12 steps)
[4e241557fc1cb560bd9e77ca1b4a9352732a5427] Merge tag 'for-linus' of 
git://git.kernel.org/pub/scm/virt/kvm/kvm

----

git bisect bad

Output:

Bisecting: 1625 revisions left to test after this (roughly 11 steps)
[44d21c3f3a2ef2f58b18bda64c52c99e723f3f4a] Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

----

git bisect bad

Output:

Bisecting: 712 revisions left to test after this (roughly 10 steps)
[e75c73ad64478c12b3a44b86a3e7f62a4f65b93e] Merge branch 
'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

----

git bisect bad (sometimes the kernel boots but the mouse doesn't work)

Output:

Bisecting: 371 revisions left to test after this (roughly 9 steps)
[c58267e9fa7b0345dd9006939254701e3622ca6a] Merge branch 
'perf-core-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

----

git bisect good

Output:

Bisecting: 185 revisions left to test after this (roughly 8 steps)
[59a36d16be8f9f68410f1bd396577fb7f31ae877] x86/fpu: Factor out 
fpu/regset.h from fpu/internal.h

----

git bisect good

Output:

Bisecting: 93 revisions left to test after this (roughly 7 steps)
[23b7776290b10297fe2cae0fb5f166a4f2c68121] Merge branch 
'sched-core-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

----

git bisect good

Output:

Bisecting: 46 revisions left to test after this (roughly 6 steps)
[0c4109bec0a6cde471bef3a21cd6f8384a614469] x86/fpu/xstate: Fix up bad 
get_xsave_addr() assumptions

----

git bisect good

Output:

Bisecting: 19 revisions left to test after this (roughly 5 steps)
[cfe3eceb7a2eb91284d5605c5315249bb165e9d3] Merge branch 
'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

----

git bisect good

Output:

Bisecting: 9 revisions left to test after this (roughly 3 steps)
[cd4996dce18b619bd7b3acf75c91f49c77f05a97] x86/mpx: Trace allocation of 
new bounds tables

----

git bisect good

Output:

Bisecting: 4 revisions left to test after this (roughly 2 steps)
[613fcb7d3c79ec25b5913a6aa974c9047c31e68c] x86/mpx: Support 32-bit 
binaries on 64-bit kernels

----

git bisect good

Output:

Bisecting: 2 revisions left to test after this (roughly 1 step)
[bea03c50b871a2fa922f31ad7c9993bb4fc7b192] x86/mpx: Do not count MPX 
VMAs as neighbors when unmapping

----

git bisect bad (sometimes the kernel boots but the mouse doesn't work)

Output:

Bisecting: 0 revisions left to test after this (roughly 0 steps)
[3ceaccdf92073d193f0bfbe24280dd736e3fed86] x86/mpx: Rewrite the unmap code

----

git bisect bad (sometimes the kernel boots but the mouse doesn't work)

Output:

3ceaccdf92073d193f0bfbe24280dd736e3fed86 is the first bad commit
commit 3ceaccdf92073d193f0bfbe24280dd736e3fed86
Author: Dave Hansen <dave.hansen@linux.intel.com>
Date:   Sun Jun 7 11:37:06 2015 -0700

     x86/mpx: Rewrite the unmap code

     The MPX code needs to clear out bounds tables for memory which
     is no longer in use.  We do this when a userspace mapping is
     torn down (unmapped).

     There are two modes:

       1. An entire bounds table becomes unused, and can be freed
          and its pointer removed from the bounds directory.  This
          happens either when a large mapping is torn down, or when
          a small mapping is torn down and it is the last mapping
          "covered" by a bounds table.

       2. Only part of a bounds table becomes unused, in which case
          we free the backing memory as if MADV_DONTNEED was called.

     The old code was a spaghetti mess of "edge" bounds tables
     where the edges were handled specially, even if we were
     unmapping an entire one.  Non-edge bounds tables are always
     fully unmapped, but share a different code path from the edge
     ones.  The old code had a bug where it was unmapping too much
     memory.  I worked on fixing it for two days and gave up.

     I didn't write the original code.  I didn't particularly like
     it, but it worked, so I left it.  After my debug session, I
     realized it was undebuggagle *and* buggy, so out it went.

     I also wrote a new unmapping test program which uncovers bugs
     pretty nicely.

     Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
     Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
     Cc: Andrew Morton <akpm@linux-foundation.org>
     Cc: Dave Hansen <dave@sr71.net>
     Cc: H. Peter Anvin <hpa@zytor.com>
     Cc: Linus Torvalds <torvalds@linux-foundation.org>
     Cc: Peter Zijlstra <peterz@infradead.org>
     Link: 
http://lkml.kernel.org/r/20150607183706.DCAEC67D@viggo.jf.intel.com
     Signed-off-by: Ingo Molnar <mingo@kernel.org>

:040000 040000 d6809ce6030ff42a5813da4a94971888d8ad67c9 
a0514265bbf313aba996e5606c00881acc62b220 M    arch

----

Cheers,

Christian


On 07 July 2015 2:44 PM, Christian Zigotzky wrote:
>
>
> Error messages images:
>
> http://forum.hyperion-entertainment.biz/download/file.php?id=1772&mode=view 
>
> http://forum.hyperion-entertainment.biz/download/file.php?id=1774&mode=view 
>
>
> -- Christian
>
> On 07 July 2015 12:50 PM Christian Zigotzky wrote:
>> Dear Linuxppc-dev mailing list,
>>
>> I compiled a kernel from the git on Tuesday 23rd of June 2015. It
>> didn't boot with my PASEMI PA6T board.
>>
>> Error messages:
>>
>> Oops: Kernel access of bad area, sig: 11 [#1]
>>
>> .sb600_8259_cascade+0x4c/0xac (unreliable)
>> .schedule+0x74/0x9c (unreliable)
>>
>> Kernel panic - not syncing: Fatal exception in interrupt
>>
>> I compiled the RC1 of kernel 4.2 last Sunday. Unfortunately it didn't
>> boot either. The kernel 4.1 and 4.1.1 boot without any problems.
>>
>> Could someone please explain me why it doesn't boot anymore?
>>
>> I would like to thank you very much in advance for helping me.
>>
>> If you have any questions, please don't hesitate to ask. I'm looking
>> forward to getting your reply.
>>
>>
>> Kind regards,
>>
>> Christian Zigotzky
>>
>>
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-08 18:00         ` Christian Zigotzky
@ 2015-07-08 22:36           ` Benjamin Herrenschmidt
  2015-07-09  1:42             ` Michael Ellerman
  2015-07-09 22:27           ` Christian Zigotzky
  1 sibling, 1 reply; 29+ messages in thread
From: Benjamin Herrenschmidt @ 2015-07-08 22:36 UTC (permalink / raw)
  To: Christian Zigotzky; +Cc: linuxppc-dev

On Wed, 2015-07-08 at 20:00 +0200, Christian Zigotzky wrote:
> Dear Linuxppc-dev mailing list,
> 
> I used git bisect and found out that the following commit is the problem.
> 
> commit 3ceaccdf92073d193f0bfbe24280dd736e3fed86
> Author: Dave Hansen <dave.hansen@linux.intel.com>

There is no way that commit affects anything on that platform, it only
changes a file in arch/x86 that isn't compiled on a powerpc build. You
must have made a mistake in your bisection, possibly the one "sometimes
boots" should be considered good, but I can't say for sure.

Michael has a PA6T board at work, so I assume he will see if he can
reproduce.

Ben.

> 
> Log:
> 
> git clone 
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-git
> 
> git bisect start b953c0d234bc72e8489d3bf51a276c5c4ec85345 (Linux 4.1)
> 
> git bisect bad d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (Linux 4.2-rc1)
> 
> Output:
> 
> Bisecting: 6261 revisions left to test after this (roughly 13 steps)
> [4570a37169d4b44d316f40b2ccc681dc93fedc7b] Merge tag 'sound-4.2-rc1' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
> 
> ----
> 
> git bisect bad
> 
> Output:
> 
> Bisecting: 3295 revisions left to test after this (roughly 12 steps)
> [4e241557fc1cb560bd9e77ca1b4a9352732a5427] Merge tag 'for-linus' of 
> git://git.kernel.org/pub/scm/virt/kvm/kvm
> 
> ----
> 
> git bisect bad
> 
> Output:
> 
> Bisecting: 1625 revisions left to test after this (roughly 11 steps)
> [44d21c3f3a2ef2f58b18bda64c52c99e723f3f4a] Merge 
> git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
> 
> ----
> 
> git bisect bad
> 
> Output:
> 
> Bisecting: 712 revisions left to test after this (roughly 10 steps)
> [e75c73ad64478c12b3a44b86a3e7f62a4f65b93e] Merge branch 
> 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
> 
> ----
> 
> git bisect bad (sometimes the kernel boots but the mouse doesn't work)
> 
> Output:
> 
> Bisecting: 371 revisions left to test after this (roughly 9 steps)
> [c58267e9fa7b0345dd9006939254701e3622ca6a] Merge branch 
> 'perf-core-for-linus' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
> 
> ----
> 
> git bisect good
> 
> Output:
> 
> Bisecting: 185 revisions left to test after this (roughly 8 steps)
> [59a36d16be8f9f68410f1bd396577fb7f31ae877] x86/fpu: Factor out 
> fpu/regset.h from fpu/internal.h
> 
> ----
> 
> git bisect good
> 
> Output:
> 
> Bisecting: 93 revisions left to test after this (roughly 7 steps)
> [23b7776290b10297fe2cae0fb5f166a4f2c68121] Merge branch 
> 'sched-core-for-linus' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
> 
> ----
> 
> git bisect good
> 
> Output:
> 
> Bisecting: 46 revisions left to test after this (roughly 6 steps)
> [0c4109bec0a6cde471bef3a21cd6f8384a614469] x86/fpu/xstate: Fix up bad 
> get_xsave_addr() assumptions
> 
> ----
> 
> git bisect good
> 
> Output:
> 
> Bisecting: 19 revisions left to test after this (roughly 5 steps)
> [cfe3eceb7a2eb91284d5605c5315249bb165e9d3] Merge branch 
> 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
> 
> ----
> 
> git bisect good
> 
> Output:
> 
> Bisecting: 9 revisions left to test after this (roughly 3 steps)
> [cd4996dce18b619bd7b3acf75c91f49c77f05a97] x86/mpx: Trace allocation of 
> new bounds tables
> 
> ----
> 
> git bisect good
> 
> Output:
> 
> Bisecting: 4 revisions left to test after this (roughly 2 steps)
> [613fcb7d3c79ec25b5913a6aa974c9047c31e68c] x86/mpx: Support 32-bit 
> binaries on 64-bit kernels
> 
> ----
> 
> git bisect good
> 
> Output:
> 
> Bisecting: 2 revisions left to test after this (roughly 1 step)
> [bea03c50b871a2fa922f31ad7c9993bb4fc7b192] x86/mpx: Do not count MPX 
> VMAs as neighbors when unmapping
> 
> ----
> 
> git bisect bad (sometimes the kernel boots but the mouse doesn't work)
> 
> Output:
> 
> Bisecting: 0 revisions left to test after this (roughly 0 steps)
> [3ceaccdf92073d193f0bfbe24280dd736e3fed86] x86/mpx: Rewrite the unmap code
> 
> ----
> 
> git bisect bad (sometimes the kernel boots but the mouse doesn't work)
> 
> Output:
> 
> 3ceaccdf92073d193f0bfbe24280dd736e3fed86 is the first bad commit
> commit 3ceaccdf92073d193f0bfbe24280dd736e3fed86
> Author: Dave Hansen <dave.hansen@linux.intel.com>
> Date:   Sun Jun 7 11:37:06 2015 -0700
> 
>      x86/mpx: Rewrite the unmap code
> 
>      The MPX code needs to clear out bounds tables for memory which
>      is no longer in use.  We do this when a userspace mapping is
>      torn down (unmapped).
> 
>      There are two modes:
> 
>        1. An entire bounds table becomes unused, and can be freed
>           and its pointer removed from the bounds directory.  This
>           happens either when a large mapping is torn down, or when
>           a small mapping is torn down and it is the last mapping
>           "covered" by a bounds table.
> 
>        2. Only part of a bounds table becomes unused, in which case
>           we free the backing memory as if MADV_DONTNEED was called.
> 
>      The old code was a spaghetti mess of "edge" bounds tables
>      where the edges were handled specially, even if we were
>      unmapping an entire one.  Non-edge bounds tables are always
>      fully unmapped, but share a different code path from the edge
>      ones.  The old code had a bug where it was unmapping too much
>      memory.  I worked on fixing it for two days and gave up.
> 
>      I didn't write the original code.  I didn't particularly like
>      it, but it worked, so I left it.  After my debug session, I
>      realized it was undebuggagle *and* buggy, so out it went.
> 
>      I also wrote a new unmapping test program which uncovers bugs
>      pretty nicely.
> 
>      Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
>      Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
>      Cc: Andrew Morton <akpm@linux-foundation.org>
>      Cc: Dave Hansen <dave@sr71.net>
>      Cc: H. Peter Anvin <hpa@zytor.com>
>      Cc: Linus Torvalds <torvalds@linux-foundation.org>
>      Cc: Peter Zijlstra <peterz@infradead.org>
>      Link: 
> http://lkml.kernel.org/r/20150607183706.DCAEC67D@viggo.jf.intel.com
>      Signed-off-by: Ingo Molnar <mingo@kernel.org>
> 
> :040000 040000 d6809ce6030ff42a5813da4a94971888d8ad67c9 
> a0514265bbf313aba996e5606c00881acc62b220 M    arch
> 
> ----
> 
> Cheers,
> 
> Christian
> 
> 
> On 07 July 2015 2:44 PM, Christian Zigotzky wrote:
> >
> >
> > Error messages images:
> >
> > http://forum.hyperion-entertainment.biz/download/file.php?id=1772&mode=view 
> >
> > http://forum.hyperion-entertainment.biz/download/file.php?id=1774&mode=view 
> >
> >
> > -- Christian
> >
> > On 07 July 2015 12:50 PM Christian Zigotzky wrote:
> >> Dear Linuxppc-dev mailing list,
> >>
> >> I compiled a kernel from the git on Tuesday 23rd of June 2015. It
> >> didn't boot with my PASEMI PA6T board.
> >>
> >> Error messages:
> >>
> >> Oops: Kernel access of bad area, sig: 11 [#1]
> >>
> >> .sb600_8259_cascade+0x4c/0xac (unreliable)
> >> .schedule+0x74/0x9c (unreliable)
> >>
> >> Kernel panic - not syncing: Fatal exception in interrupt
> >>
> >> I compiled the RC1 of kernel 4.2 last Sunday. Unfortunately it didn't
> >> boot either. The kernel 4.1 and 4.1.1 boot without any problems.
> >>
> >> Could someone please explain me why it doesn't boot anymore?
> >>
> >> I would like to thank you very much in advance for helping me.
> >>
> >> If you have any questions, please don't hesitate to ask. I'm looking
> >> forward to getting your reply.
> >>
> >>
> >> Kind regards,
> >>
> >> Christian Zigotzky
> >>
> >>
> >> _______________________________________________
> >> Linuxppc-dev mailing list
> >> Linuxppc-dev@lists.ozlabs.org
> >> https://lists.ozlabs.org/listinfo/linuxppc-dev
> >
> >
> >
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/linuxppc-dev
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-08 22:36           ` Benjamin Herrenschmidt
@ 2015-07-09  1:42             ` Michael Ellerman
  2015-07-09  5:19               ` Christian Zigotzky
  2015-07-09  7:53               ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 29+ messages in thread
From: Michael Ellerman @ 2015-07-09  1:42 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Christian Zigotzky, linuxppc-dev

On Thu, 2015-07-09 at 08:36 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2015-07-08 at 20:00 +0200, Christian Zigotzky wrote:
> > Dear Linuxppc-dev mailing list,
> > 
> > I used git bisect and found out that the following commit is the problem.
> > 
> > commit 3ceaccdf92073d193f0bfbe24280dd736e3fed86
> > Author: Dave Hansen <dave.hansen@linux.intel.com>
> 
> There is no way that commit affects anything on that platform, it only
> changes a file in arch/x86 that isn't compiled on a powerpc build. You
> must have made a mistake in your bisection, possibly the one "sometimes
> boots" should be considered good, but I can't say for sure.
> 
> Michael has a PA6T board at work, so I assume he will see if he can
> reproduce.

Yeah I can't reproduce here.

I think you need to bisect again and look for the particular crash you
reported. If you see that crash then mark it bad, else mark it good.

cheers

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09  1:42             ` Michael Ellerman
@ 2015-07-09  5:19               ` Christian Zigotzky
  2015-07-09  7:07                 ` Michael Ellerman
  2015-07-09  7:53               ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-09  5:19 UTC (permalink / raw)
  To: linuxppc-dev

Hi All

Many thanks for your answers. You're right. It is something wrong with 
my bisect. I will do another bisect. I will evaluate the one "sometimes 
boots" with good.

Thanks

Christian

On 09 July 2015 03:42 AM, Michael Ellerman wrote:
> On Thu, 2015-07-09 at 08:36 +1000, Benjamin Herrenschmidt wrote:
>> On Wed, 2015-07-08 at 20:00 +0200, Christian Zigotzky wrote:
>>> Dear Linuxppc-dev mailing list,
>>>
>>> I used git bisect and found out that the following commit is the problem.
>>>
>>> commit 3ceaccdf92073d193f0bfbe24280dd736e3fed86
>>> Author: Dave Hansen <dave.hansen@linux.intel.com>
>> There is no way that commit affects anything on that platform, it only
>> changes a file in arch/x86 that isn't compiled on a powerpc build. You
>> must have made a mistake in your bisection, possibly the one "sometimes
>> boots" should be considered good, but I can't say for sure.
>>
>> Michael has a PA6T board at work, so I assume he will see if he can
>> reproduce.
> Yeah I can't reproduce here.
>
> I think you need to bisect again and look for the particular crash you
> reported. If you see that crash then mark it bad, else mark it good.
>
> cheers
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09  5:19               ` Christian Zigotzky
@ 2015-07-09  7:07                 ` Michael Ellerman
  0 siblings, 0 replies; 29+ messages in thread
From: Michael Ellerman @ 2015-07-09  7:07 UTC (permalink / raw)
  To: Christian Zigotzky; +Cc: linuxppc-dev

On Thu, 2015-07-09 at 07:19 +0200, Christian Zigotzky wrote:
> Hi All
> 
> Many thanks for your answers. You're right. It is something wrong with 
> my bisect. I will do another bisect. I will evaluate the one "sometimes 
> boots" with good.

Thanks Christian.

cheers

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

* Re: PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09  1:42             ` Michael Ellerman
  2015-07-09  5:19               ` Christian Zigotzky
@ 2015-07-09  7:53               ` Benjamin Herrenschmidt
  2015-07-09  8:50                 ` Christian Zigotzky
  2015-07-09  9:12                 ` Christian Zigotzky
  1 sibling, 2 replies; 29+ messages in thread
From: Benjamin Herrenschmidt @ 2015-07-09  7:53 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Christian Zigotzky, linuxppc-dev

On Thu, 2015-07-09 at 11:42 +1000, Michael Ellerman wrote:
> > 
> > There is no way that commit affects anything on that platform, it
> only
> > changes a file in arch/x86 that isn't compiled on a powerpc build.
> You
> > must have made a mistake in your bisection, possibly the one
> "sometimes
> > boots" should be considered good, but I can't say for sure.
> > 
> > Michael has a PA6T board at work, so I assume he will see if he can
> > reproduce.
> 
> Yeah I can't reproduce here.
> 
> I think you need to bisect again and look for the particular crash you
> reported. If you see that crash then mark it bad, else mark it good.

Michael, the crash looks like a neat NULL dereference, any chance you
can spot something in the code that might explain it ?

The strange thing is that the crash is in sb600_8259_cascade(), however
that function doesn't seem to exist in a current kernel tree, or if it
does it's somewhat hidden behind grep-defeating macros.

All I can find that relates to something called "sb600" is some quirks
in AHCI and x86 fixups that seem ATI related.

Christian, do you have some out of tree driver in that kernel ?

Ben.
 

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09  7:53               ` Benjamin Herrenschmidt
@ 2015-07-09  8:50                 ` Christian Zigotzky
  2015-07-09  9:12                 ` Christian Zigotzky
  1 sibling, 0 replies; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-09  8:50 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1642 bytes --]

Dear Ben,

Thank you for your answer.

On 09 July 2015 at 09:53 AM, Benjamin Herrenschmidt wrote:
>
> Michael, the crash looks like a neat NULL dereference, any chance you
> can spot something in the code that might explain it ?
>
> The strange thing is that the crash is in sb600_8259_cascade(), however
> that function doesn't seem to exist in a current kernel tree, or if it
> does it's somewhat hidden behind grep-defeating macros.
>
> All I can find that relates to something called "sb600" is some quirks
> in AHCI and x86 fixups that seem ATI related.
>
> Christian, do you have some out of tree driver in that kernel ?
Yes I have. Our PA6T system 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 PA6T CPU via a PCIe x4 link. This 
is termed an “A-link II Express” link by ATI/AMD.

I/O features:

- PCIe x4 link to CPU
- SATA-II AHCI controller with 4 ports
- PATA (IDE) controller (single channel)
- multiple USB ports (5 OHCI and 1 EHCI host controllers and all ports 
are fully USB 1.1 and USB 2.0 compliant)
- UAA compatible HD Audio controller
- PCIe-PCI bridge supporting multiple PCI slots with 5V signalling support
- 8259 compatible interrupt controller
- Real Time Clock

I have to patch the official kernel source code because of the SB600 
South Bridge.

I have added the patch for the kernel 4.1 as an email attachment.

I would like to thank you very much in advance for helping me. If you 
have any further questions, please do not hesitate to ask. I am looking 
forward to getting your reply.

Rgds,

Christian



[-- Attachment #2: nemo_4.1-3.patch --]
[-- Type: text/x-patch, Size: 28594 bytes --]

diff -rupN linux-4.1/arch/powerpc/kernel/head_64.S linux-4.1-nemo/arch/powerpc/kernel/head_64.S
--- linux-4.1/arch/powerpc/kernel/head_64.S	2015-06-22 03:47:01.850778538 +0200
+++ linux-4.1-nemo/arch/powerpc/kernel/head_64.S	2015-06-22 03:27:29.590650112 +0200
@@ -70,6 +70,13 @@ _GLOBAL(__start)
 	/* NOP this out unconditionally */
 BEGIN_FTR_SECTION
 	FIXUP_ENDIAN
+/* Hack for PWRficient platforms: Due to CFE(?) bug, the 64-bit
+ * word at 0x8 needs to be set to 0. Patch it up here once we're
+ * done executing it (we can be lazy and avoid invalidating
+ * icache)
+ */
+li     r0,0
+std    0,8(0)
 	b	__start_initialization_multiplatform
 END_FTR_SECTION(0, 1)
 
diff -rupN linux-4.1/arch/powerpc/kernel/pci-common.c linux-4.1-nemo/arch/powerpc/kernel/pci-common.c
--- linux-4.1/arch/powerpc/kernel/pci-common.c	2015-06-22 03:47:01.866778538 +0200
+++ linux-4.1-nemo/arch/powerpc/kernel/pci-common.c	2015-06-22 03:27:29.603650164 +0200
@@ -721,6 +721,19 @@ void pci_process_bridge_OF_ranges(struct
 				isa_io_base =
 					(unsigned long)hose->io_base_virt;
 #endif /* CONFIG_PPC32 */
+
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+                       /* Workaround for lack of device tree. New for kernel 3.17: range.cpu_addr instead of cpu_addr and range.size instead of size Ch. Zigotzky */
+                       if (primary) {
+                               __ioremap_at(range.cpu_addr, (void *)ISA_IO_BASE,
+                               range.size, _PAGE_NO_CACHE|_PAGE_GUARDED);
+                       hose->io_base_virt = (void *)_IO_BASE;
+		       /* _IO_BASE needs unsigned long long for the kernel 3.17 Ch. Zigotzky */
+                       printk("Initialised io_base_virt 0x%lx _IO_BASE 0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long long)_IO_BASE);
+                    }
+#endif
+
 			/* pci_io_size and io_base_phys always represent IO
 			 * space starting at 0 so we factor in pci_addr
 			 */
@@ -1194,6 +1207,7 @@ static void pcibios_allocate_bus_resourc
 				&ioport_resource : &iomem_resource;
 		else {
 			pr = pci_find_parent_resource(bus->self, res);
+#ifndef CONFIG_PPC_PASEMI_SB600
 			if (pr == res) {
 				/* this happens when the generic PCI
 				 * code (wrongly) decides that this
@@ -1201,6 +1215,7 @@ static void pcibios_allocate_bus_resourc
 				 */
 				continue;
 			}
+#endif
 		}
 
 		pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx "
@@ -1632,8 +1647,9 @@ void pcibios_scan_phb(struct pci_control
 	pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
 
 	/* Get some IO space for the new PHB */
+#ifndef CONFIG_PPC_PASEMI_SB600
 	pcibios_setup_phb_io_space(hose);
-
+#endif
 	/* Wire up PHB bus resources */
 	pcibios_setup_phb_resources(hose, &resources);
 
diff -rupN linux-4.1/arch/powerpc/kernel/setup-common.c linux-4.1-nemo/arch/powerpc/kernel/setup-common.c
--- linux-4.1/arch/powerpc/kernel/setup-common.c	2015-06-22 03:47:01.879778538 +0200
+++ linux-4.1-nemo/arch/powerpc/kernel/setup-common.c	2015-06-22 03:27:29.605650172 +0200
@@ -76,7 +76,15 @@ EXPORT_SYMBOL(ppc_md);
 struct machdep_calls *machine_id;
 EXPORT_SYMBOL(machine_id);
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+/* FIXME!!
+ * Current PASemi code does not correctly update the value of boot_cpuid
+ * As a temporary fix we use the default 0, which is known to work
+ */
+int boot_cpuid = 0;
+#else
 int boot_cpuid = -1;
+#endif
 EXPORT_SYMBOL_GPL(boot_cpuid);
 
 unsigned long klimit = (unsigned long) _end;
diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/iommu.c linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c
--- linux-4.1/arch/powerpc/platforms/pasemi/iommu.c	2015-06-22 03:47:02.018778538 +0200
+++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c	2015-06-22 03:27:29.611650196 +0200
@@ -1,3 +1,9 @@
+/* This is a modified copy of
+* usr/src/linux-2.6.39.4/arch/powerpc/platforms/pasemi/iommu.c
+* The mod is on line 150
+* By Len Karpowicz <twotat2z@embarqmail.com
+*/
+
 /*
  * Copyright (C) 2005-2008, PA Semi, Inc
  *
@@ -143,8 +149,11 @@ static void iommu_table_iobmap_setup(voi
 	iommu_table_iobmap.it_page_shift = IOBMAP_PAGE_SHIFT;
 
 	/* it_size is in number of entries */
-	iommu_table_iobmap.it_size =
-		0x80000000 >> iommu_table_iobmap.it_page_shift;
+
+/* Note: changed 0x80000000 to 0x7FFFFFFF for SBLive! SB0220 */
+/* out of range problem on A-EON AmigaOne X1000 */
+       iommu_table_iobmap.it_size = 0x7FFFFFFF >> IOBMAP_PAGE_SHIFT;
+
 
 	/* Initialize the common IOMMU code */
 	iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/Kconfig linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig
--- linux-4.1/arch/powerpc/platforms/pasemi/Kconfig	2015-06-22 03:47:02.017778538 +0200
+++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig	2015-06-22 03:27:29.620650232 +0200
@@ -14,6 +14,13 @@ config PPC_PASEMI
 menu "PA Semi PWRficient options"
 	depends on PPC_PASEMI
 
+config PPC_PASEMI_SB600
+       bool "Nemo SB600 South Bridge Support"
+       depends on PPC_PASEMI
+       select PPC_I8259
+       help
+       Workarounds for the SB600 South Bridge.
+
 config PPC_PASEMI_IOMMU
 	bool "PA Semi IOMMU support"
 	depends on PPC_PASEMI
diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/pci.c linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c
--- linux-4.1/arch/powerpc/platforms/pasemi/pci.c	2015-06-22 03:47:02.019778538 +0200
+++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c	2015-06-22 03:27:29.621650236 +0200
@@ -108,6 +108,69 @@ static int workaround_5945(struct pci_bu
 	return 1;
 }
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+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, &val);
+
+               sb600_bus = val;
+
+               printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
+       }
+
+       if (iob_mapbase == NULL)
+       {
+        dn = of_find_compatible_node(NULL, "io-bridge", "pasemi,1682m-iob");
+        if (!dn)
+        {
+               printk(KERN_CRIT "NEMO SB600 missing iob node\n");
+                       return;
+               }
+
+               err = of_address_to_resource(dn, 0, &res);
+        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 +189,10 @@ static int pa_pxp_read_config(struct pci
 
 	addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+       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.
diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/setup.c linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c
--- linux-4.1/arch/powerpc/platforms/pasemi/setup.c	2015-06-22 03:47:02.019778538 +0200
+++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c	2015-06-22 03:27:29.623650244 +0200
@@ -34,6 +34,7 @@
 #include <asm/prom.h>
 #include <asm/iommu.h>
 #include <asm/machdep.h>
+#include <asm/i8259.h>
 #include <asm/mpic.h>
 #include <asm/smp.h>
 #include <asm/time.h>
@@ -72,6 +73,17 @@ static void pas_restart(char *cmd)
 		out_le32(reset_reg, 0x6000000);
 }
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+void pas_shutdown(void)
+{
+       /* (added by DStevens 19/06/13)
+          Set the PLD bit that makes the SB600 think the power button is being pressed */
+       void __iomem *pld_map = ioremap(0xf5000000,4096);
+       while (1)
+               out_8(pld_map+7,0x01);
+}
+#endif
+
 #ifdef CONFIG_SMP
 static arch_spinlock_t timebase_lock;
 static unsigned long timebase;
@@ -183,6 +195,55 @@ static int __init pas_setup_mce_regs(voi
 }
 machine_device_initcall(pasemi, pas_setup_mce_regs);
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+static unsigned sb600_irq_to_vector(int irq)
+{
+       switch(irq) {
+       case 3: return 216;
+       case 4: return 217;
+       case 5: return 218;
+       case 6: return 219;
+       case 7: return 220;
+       case 8: return 222;
+       case 9: return 212;
+       case 10: return 213;
+       case 11: return 214;
+       case 12: return 215;
+       case 14: return 221;
+       default: return 0;
+       }
+}
+
+static void sb600_8259_cascade(unsigned int irq, struct irq_data *desc)
+{
+       unsigned int cascade_irq = i8259_irq();
+       unsigned vector = sb600_irq_to_vector(cascade_irq);
+       if (vector > 0)
+               generic_handle_irq(vector);
+       outb(0x20, 0xA0);       /* Non-specific EOI */
+       outb(0x20, 0x20);       /* Non-specific EOI to cascade */
+       desc->chip->irq_eoi(desc);
+}
+extern void i8259_unmask_irq(struct irq_data *d);
+
+__init void sb600_8259_init(void)
+{
+       int gpio_virq;
+
+       // Connect legacy i8259 controller in SB600
+       printk("Init i8259\n");
+       i8259_init(NULL, 0);
+
+       gpio_virq = irq_create_mapping(NULL, 3);
+       irq_set_irq_type(gpio_virq, IRQ_TYPE_LEVEL_HIGH);
+       irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
+       mpic_unmask_irq(irq_get_irq_data(gpio_virq));
+
+       // Initial mapping for RTC
+       irq_create_mapping(NULL, 222);
+}
+#endif
+
 static __init void pas_init_IRQ(void)
 {
 	struct device_node *np;
@@ -246,6 +307,12 @@ static __init void pas_init_IRQ(void)
 
 	of_node_put(mpic_node);
 	of_node_put(root);
+
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+       sb600_8259_init();
+#endif
+
 }
 
 static void __init pas_progress(char *s, unsigned short hex)
@@ -403,12 +470,39 @@ static const struct of_device_id pasemi_
 	{},
 };
 
-static int __init pasemi_publish_devices(void)
-{
-	pasemi_pcmcia_init();
+#ifdef CONFIG_PPC_PASEMI_SB600
+
+/*
+ This should come from OF tree. See sysdev/rtc_cmos_setup for details. Need to get i8259 supported correctly first, so that
+ as the standard support hard-codes IRQ 8.
+ */
+
+
+static struct resource rtc_resource[] = {{
+       .name = "rtc",
+       .start = 0x70,
+       .end = 0x71,
+       .flags = IORESOURCE_IO,
+}, {
+       .name = "rtc",
+       .start = 222,
+       .end = 222,
+       .flags = IORESOURCE_IRQ,
+}};
+
+#endif
+
+
+ static int __init pasemi_publish_devices(void)
+ {
+        pasemi_pcmcia_init();
+
+        /* Publish OF platform devices for SDC and other non-PCI devices */
+        of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
 
-	/* Publish OF platform devices for SDC and other non-PCI devices */
-	of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
+#ifdef CONFIG_PPC_PASEMI_SB600
+       platform_device_register_simple("rtc_cmos", -1, rtc_resource, 2);
+#endif
 
 	return 0;
 }
@@ -430,9 +524,20 @@ static int __init pas_probe(void)
 
 	alloc_iobmap_l2();
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+       pm_power_off              = pas_shutdown;         // Varisys provided a way to turn us off
+#endif
 	return 1;
 }
 
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+static int sb600_pci_probe_mode(struct pci_bus *bus)
+{
+       return PCI_PROBE_DEVTREE;
+}
+#endif
+
 define_machine(pasemi) {
 	.name			= "PA Semi PWRficient",
 	.probe			= pas_probe,
@@ -445,4 +550,7 @@ define_machine(pasemi) {
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= pas_progress,
 	.machine_check_exception = pas_machine_check_handler,
+#if 0 // def CONFIG_PPC_PASEMI_SB600
+       .pci_probe_mode = sb600_pci_probe_mode,
+#endif
 };
diff -rupN linux-4.1/arch/powerpc/sysdev/i8259.c linux-4.1-nemo/arch/powerpc/sysdev/i8259.c
--- linux-4.1/arch/powerpc/sysdev/i8259.c	2015-06-22 03:47:02.064778538 +0200
+++ linux-4.1-nemo/arch/powerpc/sysdev/i8259.c	2015-06-22 03:27:29.631650275 +0200
@@ -103,11 +103,11 @@ static void i8259_set_irq_mask(int irq_n
 	outb(cached_21,0x21);
 }
 
-static void i8259_mask_irq(struct irq_data *d)
+void i8259_mask_irq(struct irq_data *d)
 {
 	unsigned long flags;
 
-	pr_debug("i8259_mask_irq(%d)\n", d->irq);
+	printk("i8259_mask_irq(%d)\n", d->irq);
 
 	raw_spin_lock_irqsave(&i8259_lock, flags);
 	if (d->irq < 8)
@@ -118,11 +118,11 @@ static void i8259_mask_irq(struct irq_da
 	raw_spin_unlock_irqrestore(&i8259_lock, flags);
 }
 
-static void i8259_unmask_irq(struct irq_data *d)
+void i8259_unmask_irq(struct irq_data *d)
 {
 	unsigned long flags;
 
-	pr_debug("i8259_unmask_irq(%d)\n", d->irq);
+	printk("i8259_unmask_irq(%d)\n", d->irq);
 
 	raw_spin_lock_irqsave(&i8259_lock, flags);
 	if (d->irq < 8)
@@ -229,6 +229,8 @@ void i8259_init(struct device_node *node
 	/* initialize the controller */
 	raw_spin_lock_irqsave(&i8259_lock, flags);
 
+	printk("About to write to i8259\n");
+
 	/* Mask all first */
 	outb(0xff, 0xA1);
 	outb(0xff, 0x21);
@@ -259,8 +261,12 @@ void i8259_init(struct device_node *node
 	outb(cached_A1, 0xA1);
 	outb(cached_21, 0x21);
 
+	printk("Done write to i8259\n");
+
 	raw_spin_unlock_irqrestore(&i8259_lock, flags);
 
+#ifndef CONFIG_PPC_PASEMI_SB600
+
 	/* create a legacy host */
 	i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL);
 	if (i8259_host == NULL) {
@@ -268,6 +274,8 @@ void i8259_init(struct device_node *node
 		return;
 	}
 
+#endif
+
 	/* reserve our resources */
 	/* XXX should we continue doing that ? it seems to cause problems
 	 * with further requesting of PCI IO resources for that range...
diff -rupN linux-4.1/arch/powerpc/sysdev/mpic.c linux-4.1-nemo/arch/powerpc/sysdev/mpic.c
--- linux-4.1/arch/powerpc/sysdev/mpic.c	2015-06-22 03:47:02.067778538 +0200
+++ linux-4.1-nemo/arch/powerpc/sysdev/mpic.c	2015-06-22 03:27:29.634650287 +0200
@@ -661,6 +661,56 @@ static inline void mpic_eoi(struct mpic
  * Linux descriptor level callbacks
  */
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+
+static int sb600_vector_to_irq(unsigned vector)
+{
+       switch(vector) {
+       case 212: return 9;
+       case 213: return 10;
+       case 214: return 11;
+       case 215: return 12;
+       case 216: return 3;
+       case 217: return 4;
+       case 218: return 5;
+       case 219: return 6;
+       case 220: return 7;
+       case 221: return 14;
+       case 222: return 8;
+       default: return -1;
+       }
+}
+
+extern void i8259_mask_irq(struct irq_data *d);
+extern void i8259_unmask_irq(struct irq_data *d);
+
+int sb600_unmask_irq(unsigned irq)
+{
+       int vector = sb600_vector_to_irq(irq);
+       if (vector >= 0) {
+               i8259_unmask_irq(irq_get_irq_data(vector));
+               return 1;
+       } else
+               return 0;
+}
+
+int sb600_mask_irq(unsigned irq)
+{
+       int vector = sb600_vector_to_irq(irq);
+       if (vector >= 0) {
+               i8259_mask_irq(irq_get_irq_data(vector));
+               return 1;
+       } else
+               return 0;
+}
+
+int sb600_end_irq(unsigned irq)
+{
+       int vector = sb600_vector_to_irq(irq);
+       return (vector >= 0);
+}
+
+#endif
 
 void mpic_unmask_irq(struct irq_data *d)
 {
@@ -668,7 +718,12 @@ void mpic_unmask_irq(struct irq_data *d)
 	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = irqd_to_hwirq(d);
 
-	DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, d->irq, src);
+#ifdef CONFIG_PPC_PASEMI_SB600
+       if (sb600_unmask_irq(src))
+               return;
+#endif
+
+       DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq, src);
 
 	mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
 		       mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) &
@@ -689,7 +744,12 @@ void mpic_mask_irq(struct irq_data *d)
 	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = irqd_to_hwirq(d);
 
-	DBG("%s: disable_irq: %d (src %d)\n", mpic->name, d->irq, src);
+#ifdef CONFIG_PPC_PASEMI_SB600
+       if (sb600_mask_irq(src))
+               return;
+#endif
+
+       DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);
 
 	mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
 		       mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) |
@@ -709,6 +769,14 @@ void mpic_end_irq(struct irq_data *d)
 {
 	struct mpic *mpic = mpic_from_irq_data(d);
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+       unsigned int src = irqd_to_hwirq(d);
+
+       if (src >= 212 && src <= 222)
+               return;
+#endif
+
+
 #ifdef DEBUG_IRQ
 	DBG("%s: end_irq: %d\n", mpic->name, d->irq);
 #endif
diff -rupN linux-4.1/drivers/ata/libata-sff.c linux-4.1-nemo/drivers/ata/libata-sff.c
--- linux-4.1/drivers/ata/libata-sff.c	2015-06-22 03:47:03.376778537 +0200
+++ linux-4.1-nemo/drivers/ata/libata-sff.c	2015-06-22 03:27:29.646650335 +0200
@@ -2438,9 +2438,9 @@ int ata_pci_sff_activate_host(struct ata
 	if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
 		u8 tmp8, mask;
 
-		/* TODO: What if one channel is in native mode ... */
+		/* Don't look at dummy ports in the mask */	
 		pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
-		mask = (1 << 2) | (1 << 0);
+		mask = (! ata_port_is_dummy(host->ports[1]) << 2) | (! ata_port_is_dummy(host->ports[0]) << 0);	
 		if ((tmp8 & mask) != mask)
 			legacy_mode = 1;
 	}
diff -rupN linux-4.1/drivers/ata/pata_atiixp.c linux-4.1-nemo/drivers/ata/pata_atiixp.c
--- linux-4.1/drivers/ata/pata_atiixp.c	2015-06-22 03:47:03.384778537 +0200
+++ linux-4.1-nemo/drivers/ata/pata_atiixp.c	2015-06-22 03:27:29.649650347 +0200
@@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_de
 	};
 	const struct ata_port_info *ppi[] = { &info, &info };
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+       // Second port not wired on SB600, and config bit cannot be set by BIOS
+       ppi[1] = &ata_dummy_port_info;
+#endif
+
 	return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
 				      ATA_HOST_PARALLEL_SCAN);
 }
diff -rupN linux-4.1/drivers/ata/pata_of_platform.c linux-4.1-nemo/drivers/ata/pata_of_platform.c
--- linux-4.1/drivers/ata/pata_of_platform.c	2015-06-22 03:47:03.400778537 +0200
+++ linux-4.1-nemo/drivers/ata/pata_of_platform.c	2015-06-22 03:27:29.653650363 +0200
@@ -41,14 +41,36 @@ static int pata_of_platform_probe(struct
 		return -EINVAL;
 	}
 
-	ret = of_address_to_resource(dn, 1, &ctl_res);
-	if (ret) {
-		dev_err(&ofdev->dev, "can't get CTL address from "
-			"device tree\n");
-		return -EINVAL;
+	if (of_device_is_compatible(dn, "electra-ide")) {
+		/* Altstatus is really at offset 0x3f6 from the primary window
+		 * on electra-ide. Adjust ctl_res and io_res accordingly.
+		 */
+		ctl_res = io_res;
+		ctl_res.start = ctl_res.start+0x3f6;
+		io_res.end = ctl_res.start-1;
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+       } else if (of_device_is_compatible(dn, "electra-cf")) {
+               /* Task regs are at 0x800, with alt status @ 0x80e in the primary window
+                * on electra-cf. Adjust ctl_res and io_res accordingly.
+                */
+               ctl_res = io_res;
+               io_res.start += 0x800;
+               ctl_res.start = ctl_res.start + 0x80e;
+               io_res.end = ctl_res.start-1;
+#endif
+	} else {
+		ret = of_address_to_resource(dn, 1, &ctl_res);
+		if (ret) {
+			dev_err(&ofdev->dev, "can't get CTL address from "
+				"device tree\n");
+			return -EINVAL;
+		}
 	}
 
 	irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
+	if (irq_res)
+		irq_res->flags = 0;
 
 	prop = of_get_property(dn, "reg-shift", NULL);
 	if (prop)
@@ -65,6 +87,11 @@ static int pata_of_platform_probe(struct
 		dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0\n");
 	}
 
+#ifdef CONFIG_PPC_PASEMI_SB600
+       irq_res = 0;                    // force irq off (doesn't seem to work)
+#endif
+
+
 	pio_mask = 1 << pio_mode;
 	pio_mask |= (1 << pio_mode) - 1;
 
@@ -74,7 +101,11 @@ static int pata_of_platform_probe(struct
 
 static struct of_device_id pata_of_platform_match[] = {
 	{ .compatible = "ata-generic", },
-	{ },
+	{ .compatible = "electra-ide", },
+#ifdef CONFIG_PPC_PASEMI_SB600
+       { .compatible = "electra-cf",},
+#endif
+	{},
 };
 MODULE_DEVICE_TABLE(of, pata_of_platform_match);
 
diff -rupN linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c
--- linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c	2015-06-22 03:47:04.600778536 +0200
+++ linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c	2015-06-22 03:27:29.675650448 +0200
@@ -226,7 +226,10 @@ static void radeon_set_power_state(struc
 		/* set memory clock */
 		if (rdev->asic->pm.set_memory_clock && (mclk != rdev->pm.current_mclk)) {
 			radeon_pm_debug_check_in_vbl(rdev, false);
+               /* D.Stevens 2012 for the A-EON AmigaOne X1000: Setting memory clock only works on CAICOS and 6570, don't set for anything else (We ignore 6570 here */
+               if (rdev->family == CHIP_CAICOS) {
 			radeon_set_memory_clock(rdev, mclk);
+               }
 			radeon_pm_debug_check_in_vbl(rdev, true);
 			rdev->pm.current_mclk = mclk;
 			DRM_DEBUG_DRIVER("Setting: m: %d\n", mclk);
@@ -1220,7 +1223,7 @@ static void radeon_pm_resume_old(struct
 						SET_VOLTAGE_TYPE_ASIC_VDDCI);
 		if (rdev->pm.default_sclk)
 			radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
-		if (rdev->pm.default_mclk)
+		if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))     /* Fix for PPC systems HD6000 >6570 by A-EON Core Linux Support Team */	
 			radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
 	}
 	/* asic init will reset the default power state */
@@ -1271,7 +1274,7 @@ dpm_resume_fail:
 						SET_VOLTAGE_TYPE_ASIC_VDDCI);
 		if (rdev->pm.default_sclk)
 			radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
-		if (rdev->pm.default_mclk)
+		if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))     /* Fix for PPC & > HD6570 by A-EON Linux Core Support Team */	
 			radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
 	}
 }
@@ -1318,7 +1321,7 @@ static int radeon_pm_init_old(struct rad
 							SET_VOLTAGE_TYPE_ASIC_VDDCI);
 			if (rdev->pm.default_sclk)
 				radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
-			if (rdev->pm.default_mclk)
+			if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))     // D.Stevens 2013: fix for >HD6570 on PPC	
 				radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
 		}
 	}
@@ -1431,7 +1434,7 @@ dpm_failed:
 						SET_VOLTAGE_TYPE_ASIC_VDDCI);
 		if (rdev->pm.default_sclk)
 			radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
-		if (rdev->pm.default_mclk)
+		if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))  // D.Stevens 2013: Fix for >HD6570 on ppc	
 			radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
 	}
 	DRM_ERROR("radeon: dpm initialization failed\n");
diff -rupN linux-4.1/drivers/pci/pci.c linux-4.1-nemo/drivers/pci/pci.c
--- linux-4.1/drivers/pci/pci.c	2015-06-22 03:47:08.817778536 +0200
+++ linux-4.1-nemo/drivers/pci/pci.c	2015-06-22 03:27:29.717650601 +0200
@@ -421,7 +421,16 @@ struct resource *pci_find_parent_resourc
 	pci_bus_for_each_resource(bus, r, i) {
 		if (!r)
 			continue;
+#ifdef CONFIG_PPC_PASEMI_SB600
+	/* The new code here checks for resources that are not allocated, and no longer
+	 * returns these, however the SB600 code uses this feature to allocate IO ranges
+	 * in the ISA map, and this breaks booting on the AmigaOneX1000.
+	 * Temporary fix to get the kernel working, remove the resource allocated check.
+	 */
+		if (resource_contains(r, res)) {
+#else
 		if (res->start && resource_contains(r, res)) {
+#endif
 
 			/*
 			 * If the window is prefetchable but the BAR is
diff -rupN linux-4.1/drivers/pci/probe.c linux-4.1-nemo/drivers/pci/probe.c
--- linux-4.1/drivers/pci/probe.c	2015-06-22 03:47:08.824778536 +0200
+++ linux-4.1-nemo/drivers/pci/probe.c	2015-06-22 03:27:29.720650613 +0200
@@ -363,7 +363,11 @@ static void pci_read_bridge_io(struct pc
 		limit |= ((unsigned long) io_limit_hi << 16);
 	}
 
-	if (base <= limit) {
+       if (base <= limit
+       #ifdef CONFIG_PPC_PASEMI_SB600
+               || child->busn_res.start == 5
+       #endif
+              ) {
 		res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
 		region.start = base;
 		region.end = limit + io_granularity - 1;
@@ -1609,11 +1613,14 @@ static int only_one_child(struct pci_bus
 
 	if (!parent || !pci_is_pcie(parent))
 		return 0;
+       #ifndef CONFIG_PPC_PASEMI_SB600
+       // SB600 has non-zero devices on non-root bus.
 	if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
 		return 1;
 	if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM &&
 	    !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
 		return 1;
+	#endif
 	return 0;
 }
 
diff -rupN linux-4.1/drivers/rtc/rtc-cmos.c linux-4.1-nemo/drivers/rtc/rtc-cmos.c
--- linux-4.1/drivers/rtc/rtc-cmos.c	2015-06-22 03:47:09.156778536 +0200
+++ linux-4.1-nemo/drivers/rtc/rtc-cmos.c	2015-06-22 03:27:29.742650701 +0200
@@ -242,6 +242,13 @@ static int cmos_read_alarm(struct device
 	}
 
 	rtc_control = CMOS_READ(RTC_CONTROL);
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+       // Nemo BIOS does not init RTC
+       rtc_control = rtc_control | RTC_24H;
+       CMOS_WRITE(rtc_control, RTC_CONTROL);
+#endif
+
 	spin_unlock_irq(&rtc_lock);
 
 	if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
diff -rupN linux-4.1/sound/pci/hda/patch_sigmatel.c linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c
--- linux-4.1/sound/pci/hda/patch_sigmatel.c	2015-06-22 03:47:15.039778536 +0200
+++ linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c	2015-06-22 03:27:29.768650804 +0200
@@ -166,6 +166,7 @@ enum {
 	STAC_D965_VERBS,
 	STAC_DELL_3ST,
 	STAC_DELL_BIOS,
+	STAC_NEMO_DEFAULT,
 	STAC_DELL_BIOS_AMIC,
 	STAC_DELL_BIOS_SPDIF,
 	STAC_927X_DELL_DMIC,
@@ -1359,6 +1360,23 @@ static const struct hda_pintbl oqo9200_p
 	{}
 };
 
+static const struct hda_pintbl nemo_pin_configs[] = {
+   { 0x0a, 0x02214020 },
+   { 0x0b, 0x02A19080 },
+   { 0x0c, 0x0181304E },
+   { 0x0d, 0x01014010 },
+   { 0x0e, 0x01A19040 },
+   { 0x0f, 0x01011012 },
+   { 0x10, 0x01016011 },
+   { 0x11, 0x01012014 },
+   { 0x12, 0x103301F0 },
+   { 0x13, 0x00000000 },
+   { 0x14, 0x00000000 },
+   { 0x21, 0x01442170 },
+   { 0x22, 0x00000000 },
+   { 0x23, 0x00000000 },
+   {}
+};
 
 static void stac9200_fixup_panasonic(struct hda_codec *codec,
 				     const struct hda_fixup *fix, int action)
@@ -3868,6 +3886,10 @@ static const struct hda_fixup stac927x_f
 		.type = HDA_FIXUP_PINS,
 		.v.pins = d965_5st_no_fp_pin_configs,
 	},
+	[STAC_NEMO_DEFAULT] = {
+       		.type = HDA_FIXUP_PINS,
+		.v.pins = nemo_pin_configs,
+	},
 	[STAC_DELL_3ST] = {
 		.type = HDA_FIXUP_PINS,
 		.v.pins = dell_3st_pin_configs,
@@ -3924,6 +3946,7 @@ static const struct hda_model_fixup stac
 	{ .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
 	{ .id = STAC_DELL_3ST, .name = "dell-3stack" },
 	{ .id = STAC_DELL_BIOS, .name = "dell-bios" },
+	{ .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },	
 	{ .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
 	{ .id = STAC_927X_VOLKNOB, .name = "volknob" },
 	{}
@@ -3962,6 +3985,8 @@ static const struct snd_pci_quirk stac92
 			   "Intel D965", STAC_D965_5ST),
 	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
 			   "Intel D965", STAC_D965_5ST),
+	/* Nemo */
+	SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000", STAC_NEMO_DEFAULT),
 	/* volume-knob fixes */
 	SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
 	{} /* terminator */
@@ -5035,6 +5060,7 @@ static const struct hda_codec_preset snd
  	{ .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
  	{ .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
  	{ .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
+	{ .id = 0x83847638, .name = "STAC92HD700", .patch = patch_stac927x },
  	{ .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
  	{ .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
  	{ .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09  7:53               ` Benjamin Herrenschmidt
  2015-07-09  8:50                 ` Christian Zigotzky
@ 2015-07-09  9:12                 ` Christian Zigotzky
  2015-07-09  9:52                   ` Denis Kirjanov
  1 sibling, 1 reply; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-09  9:12 UTC (permalink / raw)
  To: linuxppc-dev

All

I think you haven't received the SB600 patch yet. I have pasted it in 
this email directly. Thank you for your help. I am sorry because of this 
long patch but I hope you could help me a bit.

Thanks

Christian

------------- nemo_4.1-3.patch -------------

diff -rupN linux-4.1/arch/powerpc/kernel/head_64.S 
linux-4.1-nemo/arch/powerpc/kernel/head_64.S
--- linux-4.1/arch/powerpc/kernel/head_64.S    2015-06-22 
03:47:01.850778538 +0200
+++ linux-4.1-nemo/arch/powerpc/kernel/head_64.S    2015-06-22 
03:27:29.590650112 +0200
@@ -70,6 +70,13 @@ _GLOBAL(__start)
      /* NOP this out unconditionally */
  BEGIN_FTR_SECTION
      FIXUP_ENDIAN
+/* Hack for PWRficient platforms: Due to CFE(?) bug, the 64-bit
+ * word at 0x8 needs to be set to 0. Patch it up here once we're
+ * done executing it (we can be lazy and avoid invalidating
+ * icache)
+ */
+li     r0,0
+std    0,8(0)
      b    __start_initialization_multiplatform
  END_FTR_SECTION(0, 1)

diff -rupN linux-4.1/arch/powerpc/kernel/pci-common.c 
linux-4.1-nemo/arch/powerpc/kernel/pci-common.c
--- linux-4.1/arch/powerpc/kernel/pci-common.c    2015-06-22 
03:47:01.866778538 +0200
+++ linux-4.1-nemo/arch/powerpc/kernel/pci-common.c    2015-06-22 
03:27:29.603650164 +0200
@@ -721,6 +721,19 @@ void pci_process_bridge_OF_ranges(struct
                  isa_io_base =
                      (unsigned long)hose->io_base_virt;
  #endif /* CONFIG_PPC32 */
+
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+                       /* Workaround for lack of device tree. New for 
kernel 3.17: range.cpu_addr instead of cpu_addr and range.size instead 
of size Ch. Zigotzky */
+                       if (primary) {
+                               __ioremap_at(range.cpu_addr, (void 
*)ISA_IO_BASE,
+                               range.size, _PAGE_NO_CACHE|_PAGE_GUARDED);
+                       hose->io_base_virt = (void *)_IO_BASE;
+               /* _IO_BASE needs unsigned long long for the kernel 3.17 
Ch. Zigotzky */
+                       printk("Initialised io_base_virt 0x%lx _IO_BASE 
0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long long)_IO_BASE);
+                    }
+#endif
+
              /* pci_io_size and io_base_phys always represent IO
               * space starting at 0 so we factor in pci_addr
               */
@@ -1194,6 +1207,7 @@ static void pcibios_allocate_bus_resourc
                  &ioport_resource : &iomem_resource;
          else {
              pr = pci_find_parent_resource(bus->self, res);
+#ifndef CONFIG_PPC_PASEMI_SB600
              if (pr == res) {
                  /* this happens when the generic PCI
                   * code (wrongly) decides that this
@@ -1201,6 +1215,7 @@ static void pcibios_allocate_bus_resourc
                   */
                  continue;
              }
+#endif
          }

          pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx "
@@ -1632,8 +1647,9 @@ void pcibios_scan_phb(struct pci_control
      pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));

      /* Get some IO space for the new PHB */
+#ifndef CONFIG_PPC_PASEMI_SB600
      pcibios_setup_phb_io_space(hose);
-
+#endif
      /* Wire up PHB bus resources */
      pcibios_setup_phb_resources(hose, &resources);

diff -rupN linux-4.1/arch/powerpc/kernel/setup-common.c 
linux-4.1-nemo/arch/powerpc/kernel/setup-common.c
--- linux-4.1/arch/powerpc/kernel/setup-common.c    2015-06-22 
03:47:01.879778538 +0200
+++ linux-4.1-nemo/arch/powerpc/kernel/setup-common.c    2015-06-22 
03:27:29.605650172 +0200
@@ -76,7 +76,15 @@ EXPORT_SYMBOL(ppc_md);
  struct machdep_calls *machine_id;
  EXPORT_SYMBOL(machine_id);

+#ifdef CONFIG_PPC_PASEMI_SB600
+/* FIXME!!
+ * Current PASemi code does not correctly update the value of boot_cpuid
+ * As a temporary fix we use the default 0, which is known to work
+ */
+int boot_cpuid = 0;
+#else
  int boot_cpuid = -1;
+#endif
  EXPORT_SYMBOL_GPL(boot_cpuid);

  unsigned long klimit = (unsigned long) _end;
diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/iommu.c 
linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c
--- linux-4.1/arch/powerpc/platforms/pasemi/iommu.c    2015-06-22 
03:47:02.018778538 +0200
+++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c 2015-06-22 
03:27:29.611650196 +0200
@@ -1,3 +1,9 @@
+/* This is a modified copy of
+* usr/src/linux-2.6.39.4/arch/powerpc/platforms/pasemi/iommu.c
+* The mod is on line 150
+* By Len Karpowicz <twotat2z@embarqmail.com
+*/
+
  /*
   * Copyright (C) 2005-2008, PA Semi, Inc
   *
@@ -143,8 +149,11 @@ static void iommu_table_iobmap_setup(voi
      iommu_table_iobmap.it_page_shift = IOBMAP_PAGE_SHIFT;

      /* it_size is in number of entries */
-    iommu_table_iobmap.it_size =
-        0x80000000 >> iommu_table_iobmap.it_page_shift;
+
+/* Note: changed 0x80000000 to 0x7FFFFFFF for SBLive! SB0220 */
+/* out of range problem on A-EON AmigaOne X1000 */
+       iommu_table_iobmap.it_size = 0x7FFFFFFF >> IOBMAP_PAGE_SHIFT;
+

      /* Initialize the common IOMMU code */
      iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/Kconfig 
linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig
--- linux-4.1/arch/powerpc/platforms/pasemi/Kconfig    2015-06-22 
03:47:02.017778538 +0200
+++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig 2015-06-22 
03:27:29.620650232 +0200
@@ -14,6 +14,13 @@ config PPC_PASEMI
  menu "PA Semi PWRficient options"
      depends on PPC_PASEMI

+config PPC_PASEMI_SB600
+       bool "Nemo SB600 South Bridge Support"
+       depends on PPC_PASEMI
+       select PPC_I8259
+       help
+       Workarounds for the SB600 South Bridge.
+
  config PPC_PASEMI_IOMMU
      bool "PA Semi IOMMU support"
      depends on PPC_PASEMI
diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/pci.c 
linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c
--- linux-4.1/arch/powerpc/platforms/pasemi/pci.c    2015-06-22 
03:47:02.019778538 +0200
+++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c    2015-06-22 
03:27:29.621650236 +0200
@@ -108,6 +108,69 @@ static int workaround_5945(struct pci_bu
      return 1;
  }

+#ifdef CONFIG_PPC_PASEMI_SB600
+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, &val);
+
+               sb600_bus = val;
+
+               printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
+       }
+
+       if (iob_mapbase == NULL)
+       {
+        dn = of_find_compatible_node(NULL, "io-bridge", 
"pasemi,1682m-iob");
+        if (!dn)
+        {
+               printk(KERN_CRIT "NEMO SB600 missing iob node\n");
+                       return;
+               }
+
+               err = of_address_to_resource(dn, 0, &res);
+        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 +189,10 @@ static int pa_pxp_read_config(struct pci

      addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);

+#ifdef CONFIG_PPC_PASEMI_SB600
+       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.
diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/setup.c 
linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c
--- linux-4.1/arch/powerpc/platforms/pasemi/setup.c    2015-06-22 
03:47:02.019778538 +0200
+++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c 2015-06-22 
03:27:29.623650244 +0200
@@ -34,6 +34,7 @@
  #include <asm/prom.h>
  #include <asm/iommu.h>
  #include <asm/machdep.h>
+#include <asm/i8259.h>
  #include <asm/mpic.h>
  #include <asm/smp.h>
  #include <asm/time.h>
@@ -72,6 +73,17 @@ static void pas_restart(char *cmd)
          out_le32(reset_reg, 0x6000000);
  }

+#ifdef CONFIG_PPC_PASEMI_SB600
+void pas_shutdown(void)
+{
+       /* (added by DStevens 19/06/13)
+          Set the PLD bit that makes the SB600 think the power button 
is being pressed */
+       void __iomem *pld_map = ioremap(0xf5000000,4096);
+       while (1)
+               out_8(pld_map+7,0x01);
+}
+#endif
+
  #ifdef CONFIG_SMP
  static arch_spinlock_t timebase_lock;
  static unsigned long timebase;
@@ -183,6 +195,55 @@ static int __init pas_setup_mce_regs(voi
  }
  machine_device_initcall(pasemi, pas_setup_mce_regs);

+#ifdef CONFIG_PPC_PASEMI_SB600
+static unsigned sb600_irq_to_vector(int irq)
+{
+       switch(irq) {
+       case 3: return 216;
+       case 4: return 217;
+       case 5: return 218;
+       case 6: return 219;
+       case 7: return 220;
+       case 8: return 222;
+       case 9: return 212;
+       case 10: return 213;
+       case 11: return 214;
+       case 12: return 215;
+       case 14: return 221;
+       default: return 0;
+       }
+}
+
+static void sb600_8259_cascade(unsigned int irq, struct irq_data *desc)
+{
+       unsigned int cascade_irq = i8259_irq();
+       unsigned vector = sb600_irq_to_vector(cascade_irq);
+       if (vector > 0)
+               generic_handle_irq(vector);
+       outb(0x20, 0xA0);       /* Non-specific EOI */
+       outb(0x20, 0x20);       /* Non-specific EOI to cascade */
+       desc->chip->irq_eoi(desc);
+}
+extern void i8259_unmask_irq(struct irq_data *d);
+
+__init void sb600_8259_init(void)
+{
+       int gpio_virq;
+
+       // Connect legacy i8259 controller in SB600
+       printk("Init i8259\n");
+       i8259_init(NULL, 0);
+
+       gpio_virq = irq_create_mapping(NULL, 3);
+       irq_set_irq_type(gpio_virq, IRQ_TYPE_LEVEL_HIGH);
+       irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
+       mpic_unmask_irq(irq_get_irq_data(gpio_virq));
+
+       // Initial mapping for RTC
+       irq_create_mapping(NULL, 222);
+}
+#endif
+
  static __init void pas_init_IRQ(void)
  {
      struct device_node *np;
@@ -246,6 +307,12 @@ static __init void pas_init_IRQ(void)

      of_node_put(mpic_node);
      of_node_put(root);
+
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+       sb600_8259_init();
+#endif
+
  }

  static void __init pas_progress(char *s, unsigned short hex)
@@ -403,12 +470,39 @@ static const struct of_device_id pasemi_
      {},
  };

-static int __init pasemi_publish_devices(void)
-{
-    pasemi_pcmcia_init();
+#ifdef CONFIG_PPC_PASEMI_SB600
+
+/*
+ This should come from OF tree. See sysdev/rtc_cmos_setup for details. 
Need to get i8259 supported correctly first, so that
+ as the standard support hard-codes IRQ 8.
+ */
+
+
+static struct resource rtc_resource[] = {{
+       .name = "rtc",
+       .start = 0x70,
+       .end = 0x71,
+       .flags = IORESOURCE_IO,
+}, {
+       .name = "rtc",
+       .start = 222,
+       .end = 222,
+       .flags = IORESOURCE_IRQ,
+}};
+
+#endif
+
+
+ static int __init pasemi_publish_devices(void)
+ {
+        pasemi_pcmcia_init();
+
+        /* Publish OF platform devices for SDC and other non-PCI devices */
+        of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);

-    /* Publish OF platform devices for SDC and other non-PCI devices */
-    of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
+#ifdef CONFIG_PPC_PASEMI_SB600
+       platform_device_register_simple("rtc_cmos", -1, rtc_resource, 2);
+#endif

      return 0;
  }
@@ -430,9 +524,20 @@ static int __init pas_probe(void)

      alloc_iobmap_l2();

+#ifdef CONFIG_PPC_PASEMI_SB600
+       pm_power_off              = pas_shutdown;         // Varisys 
provided a way to turn us off
+#endif
      return 1;
  }

+
+#ifdef CONFIG_PPC_PASEMI_SB600
+static int sb600_pci_probe_mode(struct pci_bus *bus)
+{
+       return PCI_PROBE_DEVTREE;
+}
+#endif
+
  define_machine(pasemi) {
      .name            = "PA Semi PWRficient",
      .probe            = pas_probe,
@@ -445,4 +550,7 @@ define_machine(pasemi) {
      .calibrate_decr        = generic_calibrate_decr,
      .progress        = pas_progress,
      .machine_check_exception = pas_machine_check_handler,
+#if 0 // def CONFIG_PPC_PASEMI_SB600
+       .pci_probe_mode = sb600_pci_probe_mode,
+#endif
  };
diff -rupN linux-4.1/arch/powerpc/sysdev/i8259.c 
linux-4.1-nemo/arch/powerpc/sysdev/i8259.c
--- linux-4.1/arch/powerpc/sysdev/i8259.c    2015-06-22 
03:47:02.064778538 +0200
+++ linux-4.1-nemo/arch/powerpc/sysdev/i8259.c    2015-06-22 
03:27:29.631650275 +0200
@@ -103,11 +103,11 @@ static void i8259_set_irq_mask(int irq_n
      outb(cached_21,0x21);
  }

-static void i8259_mask_irq(struct irq_data *d)
+void i8259_mask_irq(struct irq_data *d)
  {
      unsigned long flags;

-    pr_debug("i8259_mask_irq(%d)\n", d->irq);
+    printk("i8259_mask_irq(%d)\n", d->irq);

      raw_spin_lock_irqsave(&i8259_lock, flags);
      if (d->irq < 8)
@@ -118,11 +118,11 @@ static void i8259_mask_irq(struct irq_da
      raw_spin_unlock_irqrestore(&i8259_lock, flags);
  }

-static void i8259_unmask_irq(struct irq_data *d)
+void i8259_unmask_irq(struct irq_data *d)
  {
      unsigned long flags;

-    pr_debug("i8259_unmask_irq(%d)\n", d->irq);
+    printk("i8259_unmask_irq(%d)\n", d->irq);

      raw_spin_lock_irqsave(&i8259_lock, flags);
      if (d->irq < 8)
@@ -229,6 +229,8 @@ void i8259_init(struct device_node *node
      /* initialize the controller */
      raw_spin_lock_irqsave(&i8259_lock, flags);

+    printk("About to write to i8259\n");
+
      /* Mask all first */
      outb(0xff, 0xA1);
      outb(0xff, 0x21);
@@ -259,8 +261,12 @@ void i8259_init(struct device_node *node
      outb(cached_A1, 0xA1);
      outb(cached_21, 0x21);

+    printk("Done write to i8259\n");
+
      raw_spin_unlock_irqrestore(&i8259_lock, flags);

+#ifndef CONFIG_PPC_PASEMI_SB600
+
      /* create a legacy host */
      i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL);
      if (i8259_host == NULL) {
@@ -268,6 +274,8 @@ void i8259_init(struct device_node *node
          return;
      }

+#endif
+
      /* reserve our resources */
      /* XXX should we continue doing that ? it seems to cause problems
       * with further requesting of PCI IO resources for that range...
diff -rupN linux-4.1/arch/powerpc/sysdev/mpic.c 
linux-4.1-nemo/arch/powerpc/sysdev/mpic.c
--- linux-4.1/arch/powerpc/sysdev/mpic.c    2015-06-22 
03:47:02.067778538 +0200
+++ linux-4.1-nemo/arch/powerpc/sysdev/mpic.c    2015-06-22 
03:27:29.634650287 +0200
@@ -661,6 +661,56 @@ static inline void mpic_eoi(struct mpic
   * Linux descriptor level callbacks
   */

+#ifdef CONFIG_PPC_PASEMI_SB600
+
+static int sb600_vector_to_irq(unsigned vector)
+{
+       switch(vector) {
+       case 212: return 9;
+       case 213: return 10;
+       case 214: return 11;
+       case 215: return 12;
+       case 216: return 3;
+       case 217: return 4;
+       case 218: return 5;
+       case 219: return 6;
+       case 220: return 7;
+       case 221: return 14;
+       case 222: return 8;
+       default: return -1;
+       }
+}
+
+extern void i8259_mask_irq(struct irq_data *d);
+extern void i8259_unmask_irq(struct irq_data *d);
+
+int sb600_unmask_irq(unsigned irq)
+{
+       int vector = sb600_vector_to_irq(irq);
+       if (vector >= 0) {
+               i8259_unmask_irq(irq_get_irq_data(vector));
+               return 1;
+       } else
+               return 0;
+}
+
+int sb600_mask_irq(unsigned irq)
+{
+       int vector = sb600_vector_to_irq(irq);
+       if (vector >= 0) {
+               i8259_mask_irq(irq_get_irq_data(vector));
+               return 1;
+       } else
+               return 0;
+}
+
+int sb600_end_irq(unsigned irq)
+{
+       int vector = sb600_vector_to_irq(irq);
+       return (vector >= 0);
+}
+
+#endif

  void mpic_unmask_irq(struct irq_data *d)
  {
@@ -668,7 +718,12 @@ void mpic_unmask_irq(struct irq_data *d)
      struct mpic *mpic = mpic_from_irq_data(d);
      unsigned int src = irqd_to_hwirq(d);

-    DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, d->irq, 
src);
+#ifdef CONFIG_PPC_PASEMI_SB600
+       if (sb600_unmask_irq(src))
+               return;
+#endif
+
+       DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq, 
src);

      mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
                 mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) &
@@ -689,7 +744,12 @@ void mpic_mask_irq(struct irq_data *d)
      struct mpic *mpic = mpic_from_irq_data(d);
      unsigned int src = irqd_to_hwirq(d);

-    DBG("%s: disable_irq: %d (src %d)\n", mpic->name, d->irq, src);
+#ifdef CONFIG_PPC_PASEMI_SB600
+       if (sb600_mask_irq(src))
+               return;
+#endif
+
+       DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);

      mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
                 mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) |
@@ -709,6 +769,14 @@ void mpic_end_irq(struct irq_data *d)
  {
      struct mpic *mpic = mpic_from_irq_data(d);

+#ifdef CONFIG_PPC_PASEMI_SB600
+       unsigned int src = irqd_to_hwirq(d);
+
+       if (src >= 212 && src <= 222)
+               return;
+#endif
+
+
  #ifdef DEBUG_IRQ
      DBG("%s: end_irq: %d\n", mpic->name, d->irq);
  #endif
diff -rupN linux-4.1/drivers/ata/libata-sff.c 
linux-4.1-nemo/drivers/ata/libata-sff.c
--- linux-4.1/drivers/ata/libata-sff.c    2015-06-22 03:47:03.376778537 
+0200
+++ linux-4.1-nemo/drivers/ata/libata-sff.c    2015-06-22 
03:27:29.646650335 +0200
@@ -2438,9 +2438,9 @@ int ata_pci_sff_activate_host(struct ata
      if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
          u8 tmp8, mask;

-        /* TODO: What if one channel is in native mode ... */
+        /* Don't look at dummy ports in the mask */
          pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
-        mask = (1 << 2) | (1 << 0);
+        mask = (! ata_port_is_dummy(host->ports[1]) << 2) | (! 
ata_port_is_dummy(host->ports[0]) << 0);
          if ((tmp8 & mask) != mask)
              legacy_mode = 1;
      }
diff -rupN linux-4.1/drivers/ata/pata_atiixp.c 
linux-4.1-nemo/drivers/ata/pata_atiixp.c
--- linux-4.1/drivers/ata/pata_atiixp.c    2015-06-22 03:47:03.384778537 
+0200
+++ linux-4.1-nemo/drivers/ata/pata_atiixp.c    2015-06-22 
03:27:29.649650347 +0200
@@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_de
      };
      const struct ata_port_info *ppi[] = { &info, &info };

+#ifdef CONFIG_PPC_PASEMI_SB600
+       // Second port not wired on SB600, and config bit cannot be set 
by BIOS
+       ppi[1] = &ata_dummy_port_info;
+#endif
+
      return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
                        ATA_HOST_PARALLEL_SCAN);
  }
diff -rupN linux-4.1/drivers/ata/pata_of_platform.c 
linux-4.1-nemo/drivers/ata/pata_of_platform.c
--- linux-4.1/drivers/ata/pata_of_platform.c    2015-06-22 
03:47:03.400778537 +0200
+++ linux-4.1-nemo/drivers/ata/pata_of_platform.c    2015-06-22 
03:27:29.653650363 +0200
@@ -41,14 +41,36 @@ static int pata_of_platform_probe(struct
          return -EINVAL;
      }

-    ret = of_address_to_resource(dn, 1, &ctl_res);
-    if (ret) {
-        dev_err(&ofdev->dev, "can't get CTL address from "
-            "device tree\n");
-        return -EINVAL;
+    if (of_device_is_compatible(dn, "electra-ide")) {
+        /* Altstatus is really at offset 0x3f6 from the primary window
+         * on electra-ide. Adjust ctl_res and io_res accordingly.
+         */
+        ctl_res = io_res;
+        ctl_res.start = ctl_res.start+0x3f6;
+        io_res.end = ctl_res.start-1;
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+       } else if (of_device_is_compatible(dn, "electra-cf")) {
+               /* Task regs are at 0x800, with alt status @ 0x80e in 
the primary window
+                * on electra-cf. Adjust ctl_res and io_res accordingly.
+                */
+               ctl_res = io_res;
+               io_res.start += 0x800;
+               ctl_res.start = ctl_res.start + 0x80e;
+               io_res.end = ctl_res.start-1;
+#endif
+    } else {
+        ret = of_address_to_resource(dn, 1, &ctl_res);
+        if (ret) {
+            dev_err(&ofdev->dev, "can't get CTL address from "
+                "device tree\n");
+            return -EINVAL;
+        }
      }

      irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
+    if (irq_res)
+        irq_res->flags = 0;

      prop = of_get_property(dn, "reg-shift", NULL);
      if (prop)
@@ -65,6 +87,11 @@ static int pata_of_platform_probe(struct
          dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0\n");
      }

+#ifdef CONFIG_PPC_PASEMI_SB600
+       irq_res = 0;                    // force irq off (doesn't seem 
to work)
+#endif
+
+
      pio_mask = 1 << pio_mode;
      pio_mask |= (1 << pio_mode) - 1;

@@ -74,7 +101,11 @@ static int pata_of_platform_probe(struct

  static struct of_device_id pata_of_platform_match[] = {
      { .compatible = "ata-generic", },
-    { },
+    { .compatible = "electra-ide", },
+#ifdef CONFIG_PPC_PASEMI_SB600
+       { .compatible = "electra-cf",},
+#endif
+    {},
  };
  MODULE_DEVICE_TABLE(of, pata_of_platform_match);

diff -rupN linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c 
linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c
--- linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22 
03:47:04.600778536 +0200
+++ linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22 
03:27:29.675650448 +0200
@@ -226,7 +226,10 @@ static void radeon_set_power_state(struc
          /* set memory clock */
          if (rdev->asic->pm.set_memory_clock && (mclk != 
rdev->pm.current_mclk)) {
              radeon_pm_debug_check_in_vbl(rdev, false);
+               /* D.Stevens 2012 for the A-EON AmigaOne X1000: Setting 
memory clock only works on CAICOS and 6570, don't set for anything else 
(We ignore 6570 here */
+               if (rdev->family == CHIP_CAICOS) {
              radeon_set_memory_clock(rdev, mclk);
+               }
              radeon_pm_debug_check_in_vbl(rdev, true);
              rdev->pm.current_mclk = mclk;
              DRM_DEBUG_DRIVER("Setting: m: %d\n", mclk);
@@ -1220,7 +1223,7 @@ static void radeon_pm_resume_old(struct
                          SET_VOLTAGE_TYPE_ASIC_VDDCI);
          if (rdev->pm.default_sclk)
              radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
-        if (rdev->pm.default_mclk)
+        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))     
/* Fix for PPC systems HD6000 >6570 by A-EON Core Linux Support Team */
              radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
      }
      /* asic init will reset the default power state */
@@ -1271,7 +1274,7 @@ dpm_resume_fail:
                          SET_VOLTAGE_TYPE_ASIC_VDDCI);
          if (rdev->pm.default_sclk)
              radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
-        if (rdev->pm.default_mclk)
+        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))     
/* Fix for PPC & > HD6570 by A-EON Linux Core Support Team */
              radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
      }
  }
@@ -1318,7 +1321,7 @@ static int radeon_pm_init_old(struct rad
                              SET_VOLTAGE_TYPE_ASIC_VDDCI);
              if (rdev->pm.default_sclk)
                  radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
-            if (rdev->pm.default_mclk)
+            if (rdev->pm.default_mclk && (rdev->family == 
CHIP_CAICOS))     // D.Stevens 2013: fix for >HD6570 on PPC
                  radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
          }
      }
@@ -1431,7 +1434,7 @@ dpm_failed:
                          SET_VOLTAGE_TYPE_ASIC_VDDCI);
          if (rdev->pm.default_sclk)
              radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
-        if (rdev->pm.default_mclk)
+        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))  // 
D.Stevens 2013: Fix for >HD6570 on ppc
              radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
      }
      DRM_ERROR("radeon: dpm initialization failed\n");
diff -rupN linux-4.1/drivers/pci/pci.c linux-4.1-nemo/drivers/pci/pci.c
--- linux-4.1/drivers/pci/pci.c    2015-06-22 03:47:08.817778536 +0200
+++ linux-4.1-nemo/drivers/pci/pci.c    2015-06-22 03:27:29.717650601 +0200
@@ -421,7 +421,16 @@ struct resource *pci_find_parent_resourc
      pci_bus_for_each_resource(bus, r, i) {
          if (!r)
              continue;
+#ifdef CONFIG_PPC_PASEMI_SB600
+    /* The new code here checks for resources that are not allocated, 
and no longer
+     * returns these, however the SB600 code uses this feature to 
allocate IO ranges
+     * in the ISA map, and this breaks booting on the AmigaOneX1000.
+     * Temporary fix to get the kernel working, remove the resource 
allocated check.
+     */
+        if (resource_contains(r, res)) {
+#else
          if (res->start && resource_contains(r, res)) {
+#endif

              /*
               * If the window is prefetchable but the BAR is
diff -rupN linux-4.1/drivers/pci/probe.c linux-4.1-nemo/drivers/pci/probe.c
--- linux-4.1/drivers/pci/probe.c    2015-06-22 03:47:08.824778536 +0200
+++ linux-4.1-nemo/drivers/pci/probe.c    2015-06-22 03:27:29.720650613 
+0200
@@ -363,7 +363,11 @@ static void pci_read_bridge_io(struct pc
          limit |= ((unsigned long) io_limit_hi << 16);
      }

-    if (base <= limit) {
+       if (base <= limit
+       #ifdef CONFIG_PPC_PASEMI_SB600
+               || child->busn_res.start == 5
+       #endif
+              ) {
          res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | 
IORESOURCE_IO;
          region.start = base;
          region.end = limit + io_granularity - 1;
@@ -1609,11 +1613,14 @@ static int only_one_child(struct pci_bus

      if (!parent || !pci_is_pcie(parent))
          return 0;
+       #ifndef CONFIG_PPC_PASEMI_SB600
+       // SB600 has non-zero devices on non-root bus.
      if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
          return 1;
      if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM &&
          !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
          return 1;
+    #endif
      return 0;
  }

diff -rupN linux-4.1/drivers/rtc/rtc-cmos.c 
linux-4.1-nemo/drivers/rtc/rtc-cmos.c
--- linux-4.1/drivers/rtc/rtc-cmos.c    2015-06-22 03:47:09.156778536 +0200
+++ linux-4.1-nemo/drivers/rtc/rtc-cmos.c    2015-06-22 
03:27:29.742650701 +0200
@@ -242,6 +242,13 @@ static int cmos_read_alarm(struct device
      }

      rtc_control = CMOS_READ(RTC_CONTROL);
+
+#ifdef CONFIG_PPC_PASEMI_SB600
+       // Nemo BIOS does not init RTC
+       rtc_control = rtc_control | RTC_24H;
+       CMOS_WRITE(rtc_control, RTC_CONTROL);
+#endif
+
      spin_unlock_irq(&rtc_lock);

      if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
diff -rupN linux-4.1/sound/pci/hda/patch_sigmatel.c 
linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c
--- linux-4.1/sound/pci/hda/patch_sigmatel.c    2015-06-22 
03:47:15.039778536 +0200
+++ linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c    2015-06-22 
03:27:29.768650804 +0200
@@ -166,6 +166,7 @@ enum {
      STAC_D965_VERBS,
      STAC_DELL_3ST,
      STAC_DELL_BIOS,
+    STAC_NEMO_DEFAULT,
      STAC_DELL_BIOS_AMIC,
      STAC_DELL_BIOS_SPDIF,
      STAC_927X_DELL_DMIC,
@@ -1359,6 +1360,23 @@ static const struct hda_pintbl oqo9200_p
      {}
  };

+static const struct hda_pintbl nemo_pin_configs[] = {
+   { 0x0a, 0x02214020 },
+   { 0x0b, 0x02A19080 },
+   { 0x0c, 0x0181304E },
+   { 0x0d, 0x01014010 },
+   { 0x0e, 0x01A19040 },
+   { 0x0f, 0x01011012 },
+   { 0x10, 0x01016011 },
+   { 0x11, 0x01012014 },
+   { 0x12, 0x103301F0 },
+   { 0x13, 0x00000000 },
+   { 0x14, 0x00000000 },
+   { 0x21, 0x01442170 },
+   { 0x22, 0x00000000 },
+   { 0x23, 0x00000000 },
+   {}
+};

  static void stac9200_fixup_panasonic(struct hda_codec *codec,
                       const struct hda_fixup *fix, int action)
@@ -3868,6 +3886,10 @@ static const struct hda_fixup stac927x_f
          .type = HDA_FIXUP_PINS,
          .v.pins = d965_5st_no_fp_pin_configs,
      },
+    [STAC_NEMO_DEFAULT] = {
+               .type = HDA_FIXUP_PINS,
+        .v.pins = nemo_pin_configs,
+    },
      [STAC_DELL_3ST] = {
          .type = HDA_FIXUP_PINS,
          .v.pins = dell_3st_pin_configs,
@@ -3924,6 +3946,7 @@ static const struct hda_model_fixup stac
      { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
      { .id = STAC_DELL_3ST, .name = "dell-3stack" },
      { .id = STAC_DELL_BIOS, .name = "dell-bios" },
+    { .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },
      { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
      { .id = STAC_927X_VOLKNOB, .name = "volknob" },
      {}
@@ -3962,6 +3985,8 @@ static const struct snd_pci_quirk stac92
                 "Intel D965", STAC_D965_5ST),
      SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
                 "Intel D965", STAC_D965_5ST),
+    /* Nemo */
+    SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000", STAC_NEMO_DEFAULT),
      /* volume-knob fixes */
      SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
      {} /* terminator */
@@ -5035,6 +5060,7 @@ static const struct hda_codec_preset snd
       { .id = 0x83847683, .name = "STAC9221D A2", .patch = 
patch_stac922x },
       { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
       { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
+    { .id = 0x83847638, .name = "STAC92HD700", .patch = patch_stac927x },
       { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
       { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
       { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },

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

* Re: PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09  9:12                 ` Christian Zigotzky
@ 2015-07-09  9:52                   ` Denis Kirjanov
  2015-07-09 10:37                     ` Christian Zigotzky
  2015-07-13  6:47                     ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 29+ messages in thread
From: Denis Kirjanov @ 2015-07-09  9:52 UTC (permalink / raw)
  To: Christian Zigotzky; +Cc: linuxppc-dev

On 7/9/15, Christian Zigotzky <chzigotzky@xenosoft.de> wrote:
> All
>
> I think you haven't received the SB600 patch yet. I have pasted it in
> this email directly. Thank you for your help. I am sorry because of this
> long patch but I hope you could help me a bit.

But the first thing then is to upstream the sb600 patch...
>
> Thanks
>
> Christian
>
> ------------- nemo_4.1-3.patch -------------
>
> diff -rupN linux-4.1/arch/powerpc/kernel/head_64.S
> linux-4.1-nemo/arch/powerpc/kernel/head_64.S
> --- linux-4.1/arch/powerpc/kernel/head_64.S    2015-06-22
> 03:47:01.850778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/kernel/head_64.S    2015-06-22
> 03:27:29.590650112 +0200
> @@ -70,6 +70,13 @@ _GLOBAL(__start)
>       /* NOP this out unconditionally */
>   BEGIN_FTR_SECTION
>       FIXUP_ENDIAN
> +/* Hack for PWRficient platforms: Due to CFE(?) bug, the 64-bit
> + * word at 0x8 needs to be set to 0. Patch it up here once we're
> + * done executing it (we can be lazy and avoid invalidating
> + * icache)
> + */
> +li     r0,0
> +std    0,8(0)
>       b    __start_initialization_multiplatform
>   END_FTR_SECTION(0, 1)
>
> diff -rupN linux-4.1/arch/powerpc/kernel/pci-common.c
> linux-4.1-nemo/arch/powerpc/kernel/pci-common.c
> --- linux-4.1/arch/powerpc/kernel/pci-common.c    2015-06-22
> 03:47:01.866778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/kernel/pci-common.c    2015-06-22
> 03:27:29.603650164 +0200
> @@ -721,6 +721,19 @@ void pci_process_bridge_OF_ranges(struct
>                   isa_io_base =
>                       (unsigned long)hose->io_base_virt;
>   #endif /* CONFIG_PPC32 */
> +
> +
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +                       /* Workaround for lack of device tree. New for
> kernel 3.17: range.cpu_addr instead of cpu_addr and range.size instead
> of size Ch. Zigotzky */
> +                       if (primary) {
> +                               __ioremap_at(range.cpu_addr, (void
> *)ISA_IO_BASE,
> +                               range.size, _PAGE_NO_CACHE|_PAGE_GUARDED);
> +                       hose->io_base_virt = (void *)_IO_BASE;
> +               /* _IO_BASE needs unsigned long long for the kernel 3.17
> Ch. Zigotzky */
> +                       printk("Initialised io_base_virt 0x%lx _IO_BASE
> 0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long long)_IO_BASE);
> +                    }
> +#endif
> +
>               /* pci_io_size and io_base_phys always represent IO
>                * space starting at 0 so we factor in pci_addr
>                */
> @@ -1194,6 +1207,7 @@ static void pcibios_allocate_bus_resourc
>                   &ioport_resource : &iomem_resource;
>           else {
>               pr = pci_find_parent_resource(bus->self, res);
> +#ifndef CONFIG_PPC_PASEMI_SB600
>               if (pr == res) {
>                   /* this happens when the generic PCI
>                    * code (wrongly) decides that this
> @@ -1201,6 +1215,7 @@ static void pcibios_allocate_bus_resourc
>                    */
>                   continue;
>               }
> +#endif
>           }
>
>           pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx "
> @@ -1632,8 +1647,9 @@ void pcibios_scan_phb(struct pci_control
>       pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
>
>       /* Get some IO space for the new PHB */
> +#ifndef CONFIG_PPC_PASEMI_SB600
>       pcibios_setup_phb_io_space(hose);
> -
> +#endif
>       /* Wire up PHB bus resources */
>       pcibios_setup_phb_resources(hose, &resources);
>
> diff -rupN linux-4.1/arch/powerpc/kernel/setup-common.c
> linux-4.1-nemo/arch/powerpc/kernel/setup-common.c
> --- linux-4.1/arch/powerpc/kernel/setup-common.c    2015-06-22
> 03:47:01.879778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/kernel/setup-common.c    2015-06-22
> 03:27:29.605650172 +0200
> @@ -76,7 +76,15 @@ EXPORT_SYMBOL(ppc_md);
>   struct machdep_calls *machine_id;
>   EXPORT_SYMBOL(machine_id);
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +/* FIXME!!
> + * Current PASemi code does not correctly update the value of boot_cpuid
> + * As a temporary fix we use the default 0, which is known to work
> + */
> +int boot_cpuid = 0;
> +#else
>   int boot_cpuid = -1;
> +#endif
>   EXPORT_SYMBOL_GPL(boot_cpuid);
>
>   unsigned long klimit = (unsigned long) _end;
> diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/iommu.c
> linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c
> --- linux-4.1/arch/powerpc/platforms/pasemi/iommu.c    2015-06-22
> 03:47:02.018778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c 2015-06-22
> 03:27:29.611650196 +0200
> @@ -1,3 +1,9 @@
> +/* This is a modified copy of
> +* usr/src/linux-2.6.39.4/arch/powerpc/platforms/pasemi/iommu.c
> +* The mod is on line 150
> +* By Len Karpowicz <twotat2z@embarqmail.com
> +*/
> +
>   /*
>    * Copyright (C) 2005-2008, PA Semi, Inc
>    *
> @@ -143,8 +149,11 @@ static void iommu_table_iobmap_setup(voi
>       iommu_table_iobmap.it_page_shift = IOBMAP_PAGE_SHIFT;
>
>       /* it_size is in number of entries */
> -    iommu_table_iobmap.it_size =
> -        0x80000000 >> iommu_table_iobmap.it_page_shift;
> +
> +/* Note: changed 0x80000000 to 0x7FFFFFFF for SBLive! SB0220 */
> +/* out of range problem on A-EON AmigaOne X1000 */
> +       iommu_table_iobmap.it_size = 0x7FFFFFFF >> IOBMAP_PAGE_SHIFT;
> +
>
>       /* Initialize the common IOMMU code */
>       iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
> diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/Kconfig
> linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig
> --- linux-4.1/arch/powerpc/platforms/pasemi/Kconfig    2015-06-22
> 03:47:02.017778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig 2015-06-22
> 03:27:29.620650232 +0200
> @@ -14,6 +14,13 @@ config PPC_PASEMI
>   menu "PA Semi PWRficient options"
>       depends on PPC_PASEMI
>
> +config PPC_PASEMI_SB600
> +       bool "Nemo SB600 South Bridge Support"
> +       depends on PPC_PASEMI
> +       select PPC_I8259
> +       help
> +       Workarounds for the SB600 South Bridge.
> +
>   config PPC_PASEMI_IOMMU
>       bool "PA Semi IOMMU support"
>       depends on PPC_PASEMI
> diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/pci.c
> linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c
> --- linux-4.1/arch/powerpc/platforms/pasemi/pci.c    2015-06-22
> 03:47:02.019778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c    2015-06-22
> 03:27:29.621650236 +0200
> @@ -108,6 +108,69 @@ static int workaround_5945(struct pci_bu
>       return 1;
>   }
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +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, &val);
> +
> +               sb600_bus = val;
> +
> +               printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
> +       }
> +
> +       if (iob_mapbase == NULL)
> +       {
> +        dn = of_find_compatible_node(NULL, "io-bridge",
> "pasemi,1682m-iob");
> +        if (!dn)
> +        {
> +               printk(KERN_CRIT "NEMO SB600 missing iob node\n");
> +                       return;
> +               }
> +
> +               err = of_address_to_resource(dn, 0, &res);
> +        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 +189,10 @@ static int pa_pxp_read_config(struct pci
>
>       addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       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.
> diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/setup.c
> linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c
> --- linux-4.1/arch/powerpc/platforms/pasemi/setup.c    2015-06-22
> 03:47:02.019778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c 2015-06-22
> 03:27:29.623650244 +0200
> @@ -34,6 +34,7 @@
>   #include <asm/prom.h>
>   #include <asm/iommu.h>
>   #include <asm/machdep.h>
> +#include <asm/i8259.h>
>   #include <asm/mpic.h>
>   #include <asm/smp.h>
>   #include <asm/time.h>
> @@ -72,6 +73,17 @@ static void pas_restart(char *cmd)
>           out_le32(reset_reg, 0x6000000);
>   }
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +void pas_shutdown(void)
> +{
> +       /* (added by DStevens 19/06/13)
> +          Set the PLD bit that makes the SB600 think the power button
> is being pressed */
> +       void __iomem *pld_map = ioremap(0xf5000000,4096);
> +       while (1)
> +               out_8(pld_map+7,0x01);
> +}
> +#endif
> +
>   #ifdef CONFIG_SMP
>   static arch_spinlock_t timebase_lock;
>   static unsigned long timebase;
> @@ -183,6 +195,55 @@ static int __init pas_setup_mce_regs(voi
>   }
>   machine_device_initcall(pasemi, pas_setup_mce_regs);
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +static unsigned sb600_irq_to_vector(int irq)
> +{
> +       switch(irq) {
> +       case 3: return 216;
> +       case 4: return 217;
> +       case 5: return 218;
> +       case 6: return 219;
> +       case 7: return 220;
> +       case 8: return 222;
> +       case 9: return 212;
> +       case 10: return 213;
> +       case 11: return 214;
> +       case 12: return 215;
> +       case 14: return 221;
> +       default: return 0;
> +       }
> +}
> +
> +static void sb600_8259_cascade(unsigned int irq, struct irq_data *desc)
> +{
> +       unsigned int cascade_irq = i8259_irq();
> +       unsigned vector = sb600_irq_to_vector(cascade_irq);
> +       if (vector > 0)
> +               generic_handle_irq(vector);
> +       outb(0x20, 0xA0);       /* Non-specific EOI */
> +       outb(0x20, 0x20);       /* Non-specific EOI to cascade */
> +       desc->chip->irq_eoi(desc);
> +}
> +extern void i8259_unmask_irq(struct irq_data *d);
> +
> +__init void sb600_8259_init(void)
> +{
> +       int gpio_virq;
> +
> +       // Connect legacy i8259 controller in SB600
> +       printk("Init i8259\n");
> +       i8259_init(NULL, 0);
> +
> +       gpio_virq = irq_create_mapping(NULL, 3);
> +       irq_set_irq_type(gpio_virq, IRQ_TYPE_LEVEL_HIGH);
> +       irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
> +       mpic_unmask_irq(irq_get_irq_data(gpio_virq));
> +
> +       // Initial mapping for RTC
> +       irq_create_mapping(NULL, 222);
> +}
> +#endif
> +
>   static __init void pas_init_IRQ(void)
>   {
>       struct device_node *np;
> @@ -246,6 +307,12 @@ static __init void pas_init_IRQ(void)
>
>       of_node_put(mpic_node);
>       of_node_put(root);
> +
> +
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       sb600_8259_init();
> +#endif
> +
>   }
>
>   static void __init pas_progress(char *s, unsigned short hex)
> @@ -403,12 +470,39 @@ static const struct of_device_id pasemi_
>       {},
>   };
>
> -static int __init pasemi_publish_devices(void)
> -{
> -    pasemi_pcmcia_init();
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +
> +/*
> + This should come from OF tree. See sysdev/rtc_cmos_setup for details.
> Need to get i8259 supported correctly first, so that
> + as the standard support hard-codes IRQ 8.
> + */
> +
> +
> +static struct resource rtc_resource[] = {{
> +       .name = "rtc",
> +       .start = 0x70,
> +       .end = 0x71,
> +       .flags = IORESOURCE_IO,
> +}, {
> +       .name = "rtc",
> +       .start = 222,
> +       .end = 222,
> +       .flags = IORESOURCE_IRQ,
> +}};
> +
> +#endif
> +
> +
> + static int __init pasemi_publish_devices(void)
> + {
> +        pasemi_pcmcia_init();
> +
> +        /* Publish OF platform devices for SDC and other non-PCI devices */
> +        of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
>
> -    /* Publish OF platform devices for SDC and other non-PCI devices */
> -    of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       platform_device_register_simple("rtc_cmos", -1, rtc_resource, 2);
> +#endif
>
>       return 0;
>   }
> @@ -430,9 +524,20 @@ static int __init pas_probe(void)
>
>       alloc_iobmap_l2();
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       pm_power_off              = pas_shutdown;         // Varisys
> provided a way to turn us off
> +#endif
>       return 1;
>   }
>
> +
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +static int sb600_pci_probe_mode(struct pci_bus *bus)
> +{
> +       return PCI_PROBE_DEVTREE;
> +}
> +#endif
> +
>   define_machine(pasemi) {
>       .name            = "PA Semi PWRficient",
>       .probe            = pas_probe,
> @@ -445,4 +550,7 @@ define_machine(pasemi) {
>       .calibrate_decr        = generic_calibrate_decr,
>       .progress        = pas_progress,
>       .machine_check_exception = pas_machine_check_handler,
> +#if 0 // def CONFIG_PPC_PASEMI_SB600
> +       .pci_probe_mode = sb600_pci_probe_mode,
> +#endif
>   };
> diff -rupN linux-4.1/arch/powerpc/sysdev/i8259.c
> linux-4.1-nemo/arch/powerpc/sysdev/i8259.c
> --- linux-4.1/arch/powerpc/sysdev/i8259.c    2015-06-22
> 03:47:02.064778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/sysdev/i8259.c    2015-06-22
> 03:27:29.631650275 +0200
> @@ -103,11 +103,11 @@ static void i8259_set_irq_mask(int irq_n
>       outb(cached_21,0x21);
>   }
>
> -static void i8259_mask_irq(struct irq_data *d)
> +void i8259_mask_irq(struct irq_data *d)
>   {
>       unsigned long flags;
>
> -    pr_debug("i8259_mask_irq(%d)\n", d->irq);
> +    printk("i8259_mask_irq(%d)\n", d->irq);
>
>       raw_spin_lock_irqsave(&i8259_lock, flags);
>       if (d->irq < 8)
> @@ -118,11 +118,11 @@ static void i8259_mask_irq(struct irq_da
>       raw_spin_unlock_irqrestore(&i8259_lock, flags);
>   }
>
> -static void i8259_unmask_irq(struct irq_data *d)
> +void i8259_unmask_irq(struct irq_data *d)
>   {
>       unsigned long flags;
>
> -    pr_debug("i8259_unmask_irq(%d)\n", d->irq);
> +    printk("i8259_unmask_irq(%d)\n", d->irq);
>
>       raw_spin_lock_irqsave(&i8259_lock, flags);
>       if (d->irq < 8)
> @@ -229,6 +229,8 @@ void i8259_init(struct device_node *node
>       /* initialize the controller */
>       raw_spin_lock_irqsave(&i8259_lock, flags);
>
> +    printk("About to write to i8259\n");
> +
>       /* Mask all first */
>       outb(0xff, 0xA1);
>       outb(0xff, 0x21);
> @@ -259,8 +261,12 @@ void i8259_init(struct device_node *node
>       outb(cached_A1, 0xA1);
>       outb(cached_21, 0x21);
>
> +    printk("Done write to i8259\n");
> +
>       raw_spin_unlock_irqrestore(&i8259_lock, flags);
>
> +#ifndef CONFIG_PPC_PASEMI_SB600
> +
>       /* create a legacy host */
>       i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL);
>       if (i8259_host == NULL) {
> @@ -268,6 +274,8 @@ void i8259_init(struct device_node *node
>           return;
>       }
>
> +#endif
> +
>       /* reserve our resources */
>       /* XXX should we continue doing that ? it seems to cause problems
>        * with further requesting of PCI IO resources for that range...
> diff -rupN linux-4.1/arch/powerpc/sysdev/mpic.c
> linux-4.1-nemo/arch/powerpc/sysdev/mpic.c
> --- linux-4.1/arch/powerpc/sysdev/mpic.c    2015-06-22
> 03:47:02.067778538 +0200
> +++ linux-4.1-nemo/arch/powerpc/sysdev/mpic.c    2015-06-22
> 03:27:29.634650287 +0200
> @@ -661,6 +661,56 @@ static inline void mpic_eoi(struct mpic
>    * Linux descriptor level callbacks
>    */
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +
> +static int sb600_vector_to_irq(unsigned vector)
> +{
> +       switch(vector) {
> +       case 212: return 9;
> +       case 213: return 10;
> +       case 214: return 11;
> +       case 215: return 12;
> +       case 216: return 3;
> +       case 217: return 4;
> +       case 218: return 5;
> +       case 219: return 6;
> +       case 220: return 7;
> +       case 221: return 14;
> +       case 222: return 8;
> +       default: return -1;
> +       }
> +}
> +
> +extern void i8259_mask_irq(struct irq_data *d);
> +extern void i8259_unmask_irq(struct irq_data *d);
> +
> +int sb600_unmask_irq(unsigned irq)
> +{
> +       int vector = sb600_vector_to_irq(irq);
> +       if (vector >= 0) {
> +               i8259_unmask_irq(irq_get_irq_data(vector));
> +               return 1;
> +       } else
> +               return 0;
> +}
> +
> +int sb600_mask_irq(unsigned irq)
> +{
> +       int vector = sb600_vector_to_irq(irq);
> +       if (vector >= 0) {
> +               i8259_mask_irq(irq_get_irq_data(vector));
> +               return 1;
> +       } else
> +               return 0;
> +}
> +
> +int sb600_end_irq(unsigned irq)
> +{
> +       int vector = sb600_vector_to_irq(irq);
> +       return (vector >= 0);
> +}
> +
> +#endif
>
>   void mpic_unmask_irq(struct irq_data *d)
>   {
> @@ -668,7 +718,12 @@ void mpic_unmask_irq(struct irq_data *d)
>       struct mpic *mpic = mpic_from_irq_data(d);
>       unsigned int src = irqd_to_hwirq(d);
>
> -    DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, d->irq,
> src);
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       if (sb600_unmask_irq(src))
> +               return;
> +#endif
> +
> +       DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq,
> src);
>
>       mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
>                  mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) &
> @@ -689,7 +744,12 @@ void mpic_mask_irq(struct irq_data *d)
>       struct mpic *mpic = mpic_from_irq_data(d);
>       unsigned int src = irqd_to_hwirq(d);
>
> -    DBG("%s: disable_irq: %d (src %d)\n", mpic->name, d->irq, src);
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       if (sb600_mask_irq(src))
> +               return;
> +#endif
> +
> +       DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);
>
>       mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
>                  mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) |
> @@ -709,6 +769,14 @@ void mpic_end_irq(struct irq_data *d)
>   {
>       struct mpic *mpic = mpic_from_irq_data(d);
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       unsigned int src = irqd_to_hwirq(d);
> +
> +       if (src >= 212 && src <= 222)
> +               return;
> +#endif
> +
> +
>   #ifdef DEBUG_IRQ
>       DBG("%s: end_irq: %d\n", mpic->name, d->irq);
>   #endif
> diff -rupN linux-4.1/drivers/ata/libata-sff.c
> linux-4.1-nemo/drivers/ata/libata-sff.c
> --- linux-4.1/drivers/ata/libata-sff.c    2015-06-22 03:47:03.376778537
> +0200
> +++ linux-4.1-nemo/drivers/ata/libata-sff.c    2015-06-22
> 03:27:29.646650335 +0200
> @@ -2438,9 +2438,9 @@ int ata_pci_sff_activate_host(struct ata
>       if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
>           u8 tmp8, mask;
>
> -        /* TODO: What if one channel is in native mode ... */
> +        /* Don't look at dummy ports in the mask */
>           pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
> -        mask = (1 << 2) | (1 << 0);
> +        mask = (! ata_port_is_dummy(host->ports[1]) << 2) | (!
> ata_port_is_dummy(host->ports[0]) << 0);
>           if ((tmp8 & mask) != mask)
>               legacy_mode = 1;
>       }
> diff -rupN linux-4.1/drivers/ata/pata_atiixp.c
> linux-4.1-nemo/drivers/ata/pata_atiixp.c
> --- linux-4.1/drivers/ata/pata_atiixp.c    2015-06-22 03:47:03.384778537
> +0200
> +++ linux-4.1-nemo/drivers/ata/pata_atiixp.c    2015-06-22
> 03:27:29.649650347 +0200
> @@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_de
>       };
>       const struct ata_port_info *ppi[] = { &info, &info };
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       // Second port not wired on SB600, and config bit cannot be set
> by BIOS
> +       ppi[1] = &ata_dummy_port_info;
> +#endif
> +
>       return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
>                         ATA_HOST_PARALLEL_SCAN);
>   }
> diff -rupN linux-4.1/drivers/ata/pata_of_platform.c
> linux-4.1-nemo/drivers/ata/pata_of_platform.c
> --- linux-4.1/drivers/ata/pata_of_platform.c    2015-06-22
> 03:47:03.400778537 +0200
> +++ linux-4.1-nemo/drivers/ata/pata_of_platform.c    2015-06-22
> 03:27:29.653650363 +0200
> @@ -41,14 +41,36 @@ static int pata_of_platform_probe(struct
>           return -EINVAL;
>       }
>
> -    ret = of_address_to_resource(dn, 1, &ctl_res);
> -    if (ret) {
> -        dev_err(&ofdev->dev, "can't get CTL address from "
> -            "device tree\n");
> -        return -EINVAL;
> +    if (of_device_is_compatible(dn, "electra-ide")) {
> +        /* Altstatus is really at offset 0x3f6 from the primary window
> +         * on electra-ide. Adjust ctl_res and io_res accordingly.
> +         */
> +        ctl_res = io_res;
> +        ctl_res.start = ctl_res.start+0x3f6;
> +        io_res.end = ctl_res.start-1;
> +
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       } else if (of_device_is_compatible(dn, "electra-cf")) {
> +               /* Task regs are at 0x800, with alt status @ 0x80e in
> the primary window
> +                * on electra-cf. Adjust ctl_res and io_res accordingly.
> +                */
> +               ctl_res = io_res;
> +               io_res.start += 0x800;
> +               ctl_res.start = ctl_res.start + 0x80e;
> +               io_res.end = ctl_res.start-1;
> +#endif
> +    } else {
> +        ret = of_address_to_resource(dn, 1, &ctl_res);
> +        if (ret) {
> +            dev_err(&ofdev->dev, "can't get CTL address from "
> +                "device tree\n");
> +            return -EINVAL;
> +        }
>       }
>
>       irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
> +    if (irq_res)
> +        irq_res->flags = 0;
>
>       prop = of_get_property(dn, "reg-shift", NULL);
>       if (prop)
> @@ -65,6 +87,11 @@ static int pata_of_platform_probe(struct
>           dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0\n");
>       }
>
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       irq_res = 0;                    // force irq off (doesn't seem
> to work)
> +#endif
> +
> +
>       pio_mask = 1 << pio_mode;
>       pio_mask |= (1 << pio_mode) - 1;
>
> @@ -74,7 +101,11 @@ static int pata_of_platform_probe(struct
>
>   static struct of_device_id pata_of_platform_match[] = {
>       { .compatible = "ata-generic", },
> -    { },
> +    { .compatible = "electra-ide", },
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       { .compatible = "electra-cf",},
> +#endif
> +    {},
>   };
>   MODULE_DEVICE_TABLE(of, pata_of_platform_match);
>
> diff -rupN linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c
> linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c
> --- linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22
> 03:47:04.600778536 +0200
> +++ linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22
> 03:27:29.675650448 +0200
> @@ -226,7 +226,10 @@ static void radeon_set_power_state(struc
>           /* set memory clock */
>           if (rdev->asic->pm.set_memory_clock && (mclk !=
> rdev->pm.current_mclk)) {
>               radeon_pm_debug_check_in_vbl(rdev, false);
> +               /* D.Stevens 2012 for the A-EON AmigaOne X1000: Setting
> memory clock only works on CAICOS and 6570, don't set for anything else
> (We ignore 6570 here */
> +               if (rdev->family == CHIP_CAICOS) {
>               radeon_set_memory_clock(rdev, mclk);
> +               }
>               radeon_pm_debug_check_in_vbl(rdev, true);
>               rdev->pm.current_mclk = mclk;
>               DRM_DEBUG_DRIVER("Setting: m: %d\n", mclk);
> @@ -1220,7 +1223,7 @@ static void radeon_pm_resume_old(struct
>                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
>           if (rdev->pm.default_sclk)
>               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
> -        if (rdev->pm.default_mclk)
> +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
> /* Fix for PPC systems HD6000 >6570 by A-EON Core Linux Support Team */
>               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>       }
>       /* asic init will reset the default power state */
> @@ -1271,7 +1274,7 @@ dpm_resume_fail:
>                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
>           if (rdev->pm.default_sclk)
>               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
> -        if (rdev->pm.default_mclk)
> +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
> /* Fix for PPC & > HD6570 by A-EON Linux Core Support Team */
>               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>       }
>   }
> @@ -1318,7 +1321,7 @@ static int radeon_pm_init_old(struct rad
>                               SET_VOLTAGE_TYPE_ASIC_VDDCI);
>               if (rdev->pm.default_sclk)
>                   radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
> -            if (rdev->pm.default_mclk)
> +            if (rdev->pm.default_mclk && (rdev->family ==
> CHIP_CAICOS))     // D.Stevens 2013: fix for >HD6570 on PPC
>                   radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>           }
>       }
> @@ -1431,7 +1434,7 @@ dpm_failed:
>                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
>           if (rdev->pm.default_sclk)
>               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
> -        if (rdev->pm.default_mclk)
> +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))  //
> D.Stevens 2013: Fix for >HD6570 on ppc
>               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>       }
>       DRM_ERROR("radeon: dpm initialization failed\n");
> diff -rupN linux-4.1/drivers/pci/pci.c linux-4.1-nemo/drivers/pci/pci.c
> --- linux-4.1/drivers/pci/pci.c    2015-06-22 03:47:08.817778536 +0200
> +++ linux-4.1-nemo/drivers/pci/pci.c    2015-06-22 03:27:29.717650601 +0200
> @@ -421,7 +421,16 @@ struct resource *pci_find_parent_resourc
>       pci_bus_for_each_resource(bus, r, i) {
>           if (!r)
>               continue;
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +    /* The new code here checks for resources that are not allocated,
> and no longer
> +     * returns these, however the SB600 code uses this feature to
> allocate IO ranges
> +     * in the ISA map, and this breaks booting on the AmigaOneX1000.
> +     * Temporary fix to get the kernel working, remove the resource
> allocated check.
> +     */
> +        if (resource_contains(r, res)) {
> +#else
>           if (res->start && resource_contains(r, res)) {
> +#endif
>
>               /*
>                * If the window is prefetchable but the BAR is
> diff -rupN linux-4.1/drivers/pci/probe.c linux-4.1-nemo/drivers/pci/probe.c
> --- linux-4.1/drivers/pci/probe.c    2015-06-22 03:47:08.824778536 +0200
> +++ linux-4.1-nemo/drivers/pci/probe.c    2015-06-22 03:27:29.720650613
> +0200
> @@ -363,7 +363,11 @@ static void pci_read_bridge_io(struct pc
>           limit |= ((unsigned long) io_limit_hi << 16);
>       }
>
> -    if (base <= limit) {
> +       if (base <= limit
> +       #ifdef CONFIG_PPC_PASEMI_SB600
> +               || child->busn_res.start == 5
> +       #endif
> +              ) {
>           res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) |
> IORESOURCE_IO;
>           region.start = base;
>           region.end = limit + io_granularity - 1;
> @@ -1609,11 +1613,14 @@ static int only_one_child(struct pci_bus
>
>       if (!parent || !pci_is_pcie(parent))
>           return 0;
> +       #ifndef CONFIG_PPC_PASEMI_SB600
> +       // SB600 has non-zero devices on non-root bus.
>       if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
>           return 1;
>       if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM &&
>           !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
>           return 1;
> +    #endif
>       return 0;
>   }
>
> diff -rupN linux-4.1/drivers/rtc/rtc-cmos.c
> linux-4.1-nemo/drivers/rtc/rtc-cmos.c
> --- linux-4.1/drivers/rtc/rtc-cmos.c    2015-06-22 03:47:09.156778536 +0200
> +++ linux-4.1-nemo/drivers/rtc/rtc-cmos.c    2015-06-22
> 03:27:29.742650701 +0200
> @@ -242,6 +242,13 @@ static int cmos_read_alarm(struct device
>       }
>
>       rtc_control = CMOS_READ(RTC_CONTROL);
> +
> +#ifdef CONFIG_PPC_PASEMI_SB600
> +       // Nemo BIOS does not init RTC
> +       rtc_control = rtc_control | RTC_24H;
> +       CMOS_WRITE(rtc_control, RTC_CONTROL);
> +#endif
> +
>       spin_unlock_irq(&rtc_lock);
>
>       if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
> diff -rupN linux-4.1/sound/pci/hda/patch_sigmatel.c
> linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c
> --- linux-4.1/sound/pci/hda/patch_sigmatel.c    2015-06-22
> 03:47:15.039778536 +0200
> +++ linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c    2015-06-22
> 03:27:29.768650804 +0200
> @@ -166,6 +166,7 @@ enum {
>       STAC_D965_VERBS,
>       STAC_DELL_3ST,
>       STAC_DELL_BIOS,
> +    STAC_NEMO_DEFAULT,
>       STAC_DELL_BIOS_AMIC,
>       STAC_DELL_BIOS_SPDIF,
>       STAC_927X_DELL_DMIC,
> @@ -1359,6 +1360,23 @@ static const struct hda_pintbl oqo9200_p
>       {}
>   };
>
> +static const struct hda_pintbl nemo_pin_configs[] = {
> +   { 0x0a, 0x02214020 },
> +   { 0x0b, 0x02A19080 },
> +   { 0x0c, 0x0181304E },
> +   { 0x0d, 0x01014010 },
> +   { 0x0e, 0x01A19040 },
> +   { 0x0f, 0x01011012 },
> +   { 0x10, 0x01016011 },
> +   { 0x11, 0x01012014 },
> +   { 0x12, 0x103301F0 },
> +   { 0x13, 0x00000000 },
> +   { 0x14, 0x00000000 },
> +   { 0x21, 0x01442170 },
> +   { 0x22, 0x00000000 },
> +   { 0x23, 0x00000000 },
> +   {}
> +};
>
>   static void stac9200_fixup_panasonic(struct hda_codec *codec,
>                        const struct hda_fixup *fix, int action)
> @@ -3868,6 +3886,10 @@ static const struct hda_fixup stac927x_f
>           .type = HDA_FIXUP_PINS,
>           .v.pins = d965_5st_no_fp_pin_configs,
>       },
> +    [STAC_NEMO_DEFAULT] = {
> +               .type = HDA_FIXUP_PINS,
> +        .v.pins = nemo_pin_configs,
> +    },
>       [STAC_DELL_3ST] = {
>           .type = HDA_FIXUP_PINS,
>           .v.pins = dell_3st_pin_configs,
> @@ -3924,6 +3946,7 @@ static const struct hda_model_fixup stac
>       { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
>       { .id = STAC_DELL_3ST, .name = "dell-3stack" },
>       { .id = STAC_DELL_BIOS, .name = "dell-bios" },
> +    { .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },
>       { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
>       { .id = STAC_927X_VOLKNOB, .name = "volknob" },
>       {}
> @@ -3962,6 +3985,8 @@ static const struct snd_pci_quirk stac92
>                  "Intel D965", STAC_D965_5ST),
>       SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
>                  "Intel D965", STAC_D965_5ST),
> +    /* Nemo */
> +    SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000", STAC_NEMO_DEFAULT),
>       /* volume-knob fixes */
>       SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
>       {} /* terminator */
> @@ -5035,6 +5060,7 @@ static const struct hda_codec_preset snd
>        { .id = 0x83847683, .name = "STAC9221D A2", .patch =
> patch_stac922x },
>        { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
>        { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
> +    { .id = 0x83847638, .name = "STAC92HD700", .patch = patch_stac927x },
>        { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
>        { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
>        { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09  9:52                   ` Denis Kirjanov
@ 2015-07-09 10:37                     ` Christian Zigotzky
  2015-07-13  6:47                     ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-09 10:37 UTC (permalink / raw)
  To: linuxppc-dev

Denis

You're right. First I'd like to figure out what the problem is. Then 
I'll build a new kernel for our PA6T system. After that I'll test it. 
Afterwards the beta testers will test it. Finally I'd like to upstream 
the SB600 patch.

Rgds

Christian

On 09 July 2015 at 11:52 AM, Denis Kirjanov wrote:
> On 7/9/15, Christian Zigotzky <chzigotzky@xenosoft.de> wrote:
>> All
>>
>> I think you haven't received the SB600 patch yet. I have pasted it in
>> this email directly. Thank you for your help. I am sorry because of this
>> long patch but I hope you could help me a bit.
> But the first thing then is to upstream the sb600 patch...
>> Thanks
>>
>> Christian
>>
>> ------------- nemo_4.1-3.patch -------------
>>
>> diff -rupN linux-4.1/arch/powerpc/kernel/head_64.S
>> linux-4.1-nemo/arch/powerpc/kernel/head_64.S
>> --- linux-4.1/arch/powerpc/kernel/head_64.S    2015-06-22
>> 03:47:01.850778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/kernel/head_64.S    2015-06-22
>> 03:27:29.590650112 +0200
>> @@ -70,6 +70,13 @@ _GLOBAL(__start)
>>        /* NOP this out unconditionally */
>>    BEGIN_FTR_SECTION
>>        FIXUP_ENDIAN
>> +/* Hack for PWRficient platforms: Due to CFE(?) bug, the 64-bit
>> + * word at 0x8 needs to be set to 0. Patch it up here once we're
>> + * done executing it (we can be lazy and avoid invalidating
>> + * icache)
>> + */
>> +li     r0,0
>> +std    0,8(0)
>>        b    __start_initialization_multiplatform
>>    END_FTR_SECTION(0, 1)
>>
>> diff -rupN linux-4.1/arch/powerpc/kernel/pci-common.c
>> linux-4.1-nemo/arch/powerpc/kernel/pci-common.c
>> --- linux-4.1/arch/powerpc/kernel/pci-common.c    2015-06-22
>> 03:47:01.866778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/kernel/pci-common.c    2015-06-22
>> 03:27:29.603650164 +0200
>> @@ -721,6 +721,19 @@ void pci_process_bridge_OF_ranges(struct
>>                    isa_io_base =
>>                        (unsigned long)hose->io_base_virt;
>>    #endif /* CONFIG_PPC32 */
>> +
>> +
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +                       /* Workaround for lack of device tree. New for
>> kernel 3.17: range.cpu_addr instead of cpu_addr and range.size instead
>> of size Ch. Zigotzky */
>> +                       if (primary) {
>> +                               __ioremap_at(range.cpu_addr, (void
>> *)ISA_IO_BASE,
>> +                               range.size, _PAGE_NO_CACHE|_PAGE_GUARDED);
>> +                       hose->io_base_virt = (void *)_IO_BASE;
>> +               /* _IO_BASE needs unsigned long long for the kernel 3.17
>> Ch. Zigotzky */
>> +                       printk("Initialised io_base_virt 0x%lx _IO_BASE
>> 0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long long)_IO_BASE);
>> +                    }
>> +#endif
>> +
>>                /* pci_io_size and io_base_phys always represent IO
>>                 * space starting at 0 so we factor in pci_addr
>>                 */
>> @@ -1194,6 +1207,7 @@ static void pcibios_allocate_bus_resourc
>>                    &ioport_resource : &iomem_resource;
>>            else {
>>                pr = pci_find_parent_resource(bus->self, res);
>> +#ifndef CONFIG_PPC_PASEMI_SB600
>>                if (pr == res) {
>>                    /* this happens when the generic PCI
>>                     * code (wrongly) decides that this
>> @@ -1201,6 +1215,7 @@ static void pcibios_allocate_bus_resourc
>>                     */
>>                    continue;
>>                }
>> +#endif
>>            }
>>
>>            pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx "
>> @@ -1632,8 +1647,9 @@ void pcibios_scan_phb(struct pci_control
>>        pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
>>
>>        /* Get some IO space for the new PHB */
>> +#ifndef CONFIG_PPC_PASEMI_SB600
>>        pcibios_setup_phb_io_space(hose);
>> -
>> +#endif
>>        /* Wire up PHB bus resources */
>>        pcibios_setup_phb_resources(hose, &resources);
>>
>> diff -rupN linux-4.1/arch/powerpc/kernel/setup-common.c
>> linux-4.1-nemo/arch/powerpc/kernel/setup-common.c
>> --- linux-4.1/arch/powerpc/kernel/setup-common.c    2015-06-22
>> 03:47:01.879778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/kernel/setup-common.c    2015-06-22
>> 03:27:29.605650172 +0200
>> @@ -76,7 +76,15 @@ EXPORT_SYMBOL(ppc_md);
>>    struct machdep_calls *machine_id;
>>    EXPORT_SYMBOL(machine_id);
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +/* FIXME!!
>> + * Current PASemi code does not correctly update the value of boot_cpuid
>> + * As a temporary fix we use the default 0, which is known to work
>> + */
>> +int boot_cpuid = 0;
>> +#else
>>    int boot_cpuid = -1;
>> +#endif
>>    EXPORT_SYMBOL_GPL(boot_cpuid);
>>
>>    unsigned long klimit = (unsigned long) _end;
>> diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/iommu.c
>> linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c
>> --- linux-4.1/arch/powerpc/platforms/pasemi/iommu.c    2015-06-22
>> 03:47:02.018778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c 2015-06-22
>> 03:27:29.611650196 +0200
>> @@ -1,3 +1,9 @@
>> +/* This is a modified copy of
>> +* usr/src/linux-2.6.39.4/arch/powerpc/platforms/pasemi/iommu.c
>> +* The mod is on line 150
>> +* By Len Karpowicz <twotat2z@embarqmail.com
>> +*/
>> +
>>    /*
>>     * Copyright (C) 2005-2008, PA Semi, Inc
>>     *
>> @@ -143,8 +149,11 @@ static void iommu_table_iobmap_setup(voi
>>        iommu_table_iobmap.it_page_shift = IOBMAP_PAGE_SHIFT;
>>
>>        /* it_size is in number of entries */
>> -    iommu_table_iobmap.it_size =
>> -        0x80000000 >> iommu_table_iobmap.it_page_shift;
>> +
>> +/* Note: changed 0x80000000 to 0x7FFFFFFF for SBLive! SB0220 */
>> +/* out of range problem on A-EON AmigaOne X1000 */
>> +       iommu_table_iobmap.it_size = 0x7FFFFFFF >> IOBMAP_PAGE_SHIFT;
>> +
>>
>>        /* Initialize the common IOMMU code */
>>        iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
>> diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/Kconfig
>> linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig
>> --- linux-4.1/arch/powerpc/platforms/pasemi/Kconfig    2015-06-22
>> 03:47:02.017778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig 2015-06-22
>> 03:27:29.620650232 +0200
>> @@ -14,6 +14,13 @@ config PPC_PASEMI
>>    menu "PA Semi PWRficient options"
>>        depends on PPC_PASEMI
>>
>> +config PPC_PASEMI_SB600
>> +       bool "Nemo SB600 South Bridge Support"
>> +       depends on PPC_PASEMI
>> +       select PPC_I8259
>> +       help
>> +       Workarounds for the SB600 South Bridge.
>> +
>>    config PPC_PASEMI_IOMMU
>>        bool "PA Semi IOMMU support"
>>        depends on PPC_PASEMI
>> diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/pci.c
>> linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c
>> --- linux-4.1/arch/powerpc/platforms/pasemi/pci.c    2015-06-22
>> 03:47:02.019778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c    2015-06-22
>> 03:27:29.621650236 +0200
>> @@ -108,6 +108,69 @@ static int workaround_5945(struct pci_bu
>>        return 1;
>>    }
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +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, &val);
>> +
>> +               sb600_bus = val;
>> +
>> +               printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
>> +       }
>> +
>> +       if (iob_mapbase == NULL)
>> +       {
>> +        dn = of_find_compatible_node(NULL, "io-bridge",
>> "pasemi,1682m-iob");
>> +        if (!dn)
>> +        {
>> +               printk(KERN_CRIT "NEMO SB600 missing iob node\n");
>> +                       return;
>> +               }
>> +
>> +               err = of_address_to_resource(dn, 0, &res);
>> +        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 +189,10 @@ static int pa_pxp_read_config(struct pci
>>
>>        addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       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.
>> diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/setup.c
>> linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c
>> --- linux-4.1/arch/powerpc/platforms/pasemi/setup.c    2015-06-22
>> 03:47:02.019778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c 2015-06-22
>> 03:27:29.623650244 +0200
>> @@ -34,6 +34,7 @@
>>    #include <asm/prom.h>
>>    #include <asm/iommu.h>
>>    #include <asm/machdep.h>
>> +#include <asm/i8259.h>
>>    #include <asm/mpic.h>
>>    #include <asm/smp.h>
>>    #include <asm/time.h>
>> @@ -72,6 +73,17 @@ static void pas_restart(char *cmd)
>>            out_le32(reset_reg, 0x6000000);
>>    }
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +void pas_shutdown(void)
>> +{
>> +       /* (added by DStevens 19/06/13)
>> +          Set the PLD bit that makes the SB600 think the power button
>> is being pressed */
>> +       void __iomem *pld_map = ioremap(0xf5000000,4096);
>> +       while (1)
>> +               out_8(pld_map+7,0x01);
>> +}
>> +#endif
>> +
>>    #ifdef CONFIG_SMP
>>    static arch_spinlock_t timebase_lock;
>>    static unsigned long timebase;
>> @@ -183,6 +195,55 @@ static int __init pas_setup_mce_regs(voi
>>    }
>>    machine_device_initcall(pasemi, pas_setup_mce_regs);
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +static unsigned sb600_irq_to_vector(int irq)
>> +{
>> +       switch(irq) {
>> +       case 3: return 216;
>> +       case 4: return 217;
>> +       case 5: return 218;
>> +       case 6: return 219;
>> +       case 7: return 220;
>> +       case 8: return 222;
>> +       case 9: return 212;
>> +       case 10: return 213;
>> +       case 11: return 214;
>> +       case 12: return 215;
>> +       case 14: return 221;
>> +       default: return 0;
>> +       }
>> +}
>> +
>> +static void sb600_8259_cascade(unsigned int irq, struct irq_data *desc)
>> +{
>> +       unsigned int cascade_irq = i8259_irq();
>> +       unsigned vector = sb600_irq_to_vector(cascade_irq);
>> +       if (vector > 0)
>> +               generic_handle_irq(vector);
>> +       outb(0x20, 0xA0);       /* Non-specific EOI */
>> +       outb(0x20, 0x20);       /* Non-specific EOI to cascade */
>> +       desc->chip->irq_eoi(desc);
>> +}
>> +extern void i8259_unmask_irq(struct irq_data *d);
>> +
>> +__init void sb600_8259_init(void)
>> +{
>> +       int gpio_virq;
>> +
>> +       // Connect legacy i8259 controller in SB600
>> +       printk("Init i8259\n");
>> +       i8259_init(NULL, 0);
>> +
>> +       gpio_virq = irq_create_mapping(NULL, 3);
>> +       irq_set_irq_type(gpio_virq, IRQ_TYPE_LEVEL_HIGH);
>> +       irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
>> +       mpic_unmask_irq(irq_get_irq_data(gpio_virq));
>> +
>> +       // Initial mapping for RTC
>> +       irq_create_mapping(NULL, 222);
>> +}
>> +#endif
>> +
>>    static __init void pas_init_IRQ(void)
>>    {
>>        struct device_node *np;
>> @@ -246,6 +307,12 @@ static __init void pas_init_IRQ(void)
>>
>>        of_node_put(mpic_node);
>>        of_node_put(root);
>> +
>> +
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       sb600_8259_init();
>> +#endif
>> +
>>    }
>>
>>    static void __init pas_progress(char *s, unsigned short hex)
>> @@ -403,12 +470,39 @@ static const struct of_device_id pasemi_
>>        {},
>>    };
>>
>> -static int __init pasemi_publish_devices(void)
>> -{
>> -    pasemi_pcmcia_init();
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +
>> +/*
>> + This should come from OF tree. See sysdev/rtc_cmos_setup for details.
>> Need to get i8259 supported correctly first, so that
>> + as the standard support hard-codes IRQ 8.
>> + */
>> +
>> +
>> +static struct resource rtc_resource[] = {{
>> +       .name = "rtc",
>> +       .start = 0x70,
>> +       .end = 0x71,
>> +       .flags = IORESOURCE_IO,
>> +}, {
>> +       .name = "rtc",
>> +       .start = 222,
>> +       .end = 222,
>> +       .flags = IORESOURCE_IRQ,
>> +}};
>> +
>> +#endif
>> +
>> +
>> + static int __init pasemi_publish_devices(void)
>> + {
>> +        pasemi_pcmcia_init();
>> +
>> +        /* Publish OF platform devices for SDC and other non-PCI devices */
>> +        of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
>>
>> -    /* Publish OF platform devices for SDC and other non-PCI devices */
>> -    of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       platform_device_register_simple("rtc_cmos", -1, rtc_resource, 2);
>> +#endif
>>
>>        return 0;
>>    }
>> @@ -430,9 +524,20 @@ static int __init pas_probe(void)
>>
>>        alloc_iobmap_l2();
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       pm_power_off              = pas_shutdown;         // Varisys
>> provided a way to turn us off
>> +#endif
>>        return 1;
>>    }
>>
>> +
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +static int sb600_pci_probe_mode(struct pci_bus *bus)
>> +{
>> +       return PCI_PROBE_DEVTREE;
>> +}
>> +#endif
>> +
>>    define_machine(pasemi) {
>>        .name            = "PA Semi PWRficient",
>>        .probe            = pas_probe,
>> @@ -445,4 +550,7 @@ define_machine(pasemi) {
>>        .calibrate_decr        = generic_calibrate_decr,
>>        .progress        = pas_progress,
>>        .machine_check_exception = pas_machine_check_handler,
>> +#if 0 // def CONFIG_PPC_PASEMI_SB600
>> +       .pci_probe_mode = sb600_pci_probe_mode,
>> +#endif
>>    };
>> diff -rupN linux-4.1/arch/powerpc/sysdev/i8259.c
>> linux-4.1-nemo/arch/powerpc/sysdev/i8259.c
>> --- linux-4.1/arch/powerpc/sysdev/i8259.c    2015-06-22
>> 03:47:02.064778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/sysdev/i8259.c    2015-06-22
>> 03:27:29.631650275 +0200
>> @@ -103,11 +103,11 @@ static void i8259_set_irq_mask(int irq_n
>>        outb(cached_21,0x21);
>>    }
>>
>> -static void i8259_mask_irq(struct irq_data *d)
>> +void i8259_mask_irq(struct irq_data *d)
>>    {
>>        unsigned long flags;
>>
>> -    pr_debug("i8259_mask_irq(%d)\n", d->irq);
>> +    printk("i8259_mask_irq(%d)\n", d->irq);
>>
>>        raw_spin_lock_irqsave(&i8259_lock, flags);
>>        if (d->irq < 8)
>> @@ -118,11 +118,11 @@ static void i8259_mask_irq(struct irq_da
>>        raw_spin_unlock_irqrestore(&i8259_lock, flags);
>>    }
>>
>> -static void i8259_unmask_irq(struct irq_data *d)
>> +void i8259_unmask_irq(struct irq_data *d)
>>    {
>>        unsigned long flags;
>>
>> -    pr_debug("i8259_unmask_irq(%d)\n", d->irq);
>> +    printk("i8259_unmask_irq(%d)\n", d->irq);
>>
>>        raw_spin_lock_irqsave(&i8259_lock, flags);
>>        if (d->irq < 8)
>> @@ -229,6 +229,8 @@ void i8259_init(struct device_node *node
>>        /* initialize the controller */
>>        raw_spin_lock_irqsave(&i8259_lock, flags);
>>
>> +    printk("About to write to i8259\n");
>> +
>>        /* Mask all first */
>>        outb(0xff, 0xA1);
>>        outb(0xff, 0x21);
>> @@ -259,8 +261,12 @@ void i8259_init(struct device_node *node
>>        outb(cached_A1, 0xA1);
>>        outb(cached_21, 0x21);
>>
>> +    printk("Done write to i8259\n");
>> +
>>        raw_spin_unlock_irqrestore(&i8259_lock, flags);
>>
>> +#ifndef CONFIG_PPC_PASEMI_SB600
>> +
>>        /* create a legacy host */
>>        i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL);
>>        if (i8259_host == NULL) {
>> @@ -268,6 +274,8 @@ void i8259_init(struct device_node *node
>>            return;
>>        }
>>
>> +#endif
>> +
>>        /* reserve our resources */
>>        /* XXX should we continue doing that ? it seems to cause problems
>>         * with further requesting of PCI IO resources for that range...
>> diff -rupN linux-4.1/arch/powerpc/sysdev/mpic.c
>> linux-4.1-nemo/arch/powerpc/sysdev/mpic.c
>> --- linux-4.1/arch/powerpc/sysdev/mpic.c    2015-06-22
>> 03:47:02.067778538 +0200
>> +++ linux-4.1-nemo/arch/powerpc/sysdev/mpic.c    2015-06-22
>> 03:27:29.634650287 +0200
>> @@ -661,6 +661,56 @@ static inline void mpic_eoi(struct mpic
>>     * Linux descriptor level callbacks
>>     */
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +
>> +static int sb600_vector_to_irq(unsigned vector)
>> +{
>> +       switch(vector) {
>> +       case 212: return 9;
>> +       case 213: return 10;
>> +       case 214: return 11;
>> +       case 215: return 12;
>> +       case 216: return 3;
>> +       case 217: return 4;
>> +       case 218: return 5;
>> +       case 219: return 6;
>> +       case 220: return 7;
>> +       case 221: return 14;
>> +       case 222: return 8;
>> +       default: return -1;
>> +       }
>> +}
>> +
>> +extern void i8259_mask_irq(struct irq_data *d);
>> +extern void i8259_unmask_irq(struct irq_data *d);
>> +
>> +int sb600_unmask_irq(unsigned irq)
>> +{
>> +       int vector = sb600_vector_to_irq(irq);
>> +       if (vector >= 0) {
>> +               i8259_unmask_irq(irq_get_irq_data(vector));
>> +               return 1;
>> +       } else
>> +               return 0;
>> +}
>> +
>> +int sb600_mask_irq(unsigned irq)
>> +{
>> +       int vector = sb600_vector_to_irq(irq);
>> +       if (vector >= 0) {
>> +               i8259_mask_irq(irq_get_irq_data(vector));
>> +               return 1;
>> +       } else
>> +               return 0;
>> +}
>> +
>> +int sb600_end_irq(unsigned irq)
>> +{
>> +       int vector = sb600_vector_to_irq(irq);
>> +       return (vector >= 0);
>> +}
>> +
>> +#endif
>>
>>    void mpic_unmask_irq(struct irq_data *d)
>>    {
>> @@ -668,7 +718,12 @@ void mpic_unmask_irq(struct irq_data *d)
>>        struct mpic *mpic = mpic_from_irq_data(d);
>>        unsigned int src = irqd_to_hwirq(d);
>>
>> -    DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, d->irq,
>> src);
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       if (sb600_unmask_irq(src))
>> +               return;
>> +#endif
>> +
>> +       DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq,
>> src);
>>
>>        mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
>>                   mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) &
>> @@ -689,7 +744,12 @@ void mpic_mask_irq(struct irq_data *d)
>>        struct mpic *mpic = mpic_from_irq_data(d);
>>        unsigned int src = irqd_to_hwirq(d);
>>
>> -    DBG("%s: disable_irq: %d (src %d)\n", mpic->name, d->irq, src);
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       if (sb600_mask_irq(src))
>> +               return;
>> +#endif
>> +
>> +       DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);
>>
>>        mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
>>                   mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) |
>> @@ -709,6 +769,14 @@ void mpic_end_irq(struct irq_data *d)
>>    {
>>        struct mpic *mpic = mpic_from_irq_data(d);
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       unsigned int src = irqd_to_hwirq(d);
>> +
>> +       if (src >= 212 && src <= 222)
>> +               return;
>> +#endif
>> +
>> +
>>    #ifdef DEBUG_IRQ
>>        DBG("%s: end_irq: %d\n", mpic->name, d->irq);
>>    #endif
>> diff -rupN linux-4.1/drivers/ata/libata-sff.c
>> linux-4.1-nemo/drivers/ata/libata-sff.c
>> --- linux-4.1/drivers/ata/libata-sff.c    2015-06-22 03:47:03.376778537
>> +0200
>> +++ linux-4.1-nemo/drivers/ata/libata-sff.c    2015-06-22
>> 03:27:29.646650335 +0200
>> @@ -2438,9 +2438,9 @@ int ata_pci_sff_activate_host(struct ata
>>        if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
>>            u8 tmp8, mask;
>>
>> -        /* TODO: What if one channel is in native mode ... */
>> +        /* Don't look at dummy ports in the mask */
>>            pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
>> -        mask = (1 << 2) | (1 << 0);
>> +        mask = (! ata_port_is_dummy(host->ports[1]) << 2) | (!
>> ata_port_is_dummy(host->ports[0]) << 0);
>>            if ((tmp8 & mask) != mask)
>>                legacy_mode = 1;
>>        }
>> diff -rupN linux-4.1/drivers/ata/pata_atiixp.c
>> linux-4.1-nemo/drivers/ata/pata_atiixp.c
>> --- linux-4.1/drivers/ata/pata_atiixp.c    2015-06-22 03:47:03.384778537
>> +0200
>> +++ linux-4.1-nemo/drivers/ata/pata_atiixp.c    2015-06-22
>> 03:27:29.649650347 +0200
>> @@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_de
>>        };
>>        const struct ata_port_info *ppi[] = { &info, &info };
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       // Second port not wired on SB600, and config bit cannot be set
>> by BIOS
>> +       ppi[1] = &ata_dummy_port_info;
>> +#endif
>> +
>>        return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
>>                          ATA_HOST_PARALLEL_SCAN);
>>    }
>> diff -rupN linux-4.1/drivers/ata/pata_of_platform.c
>> linux-4.1-nemo/drivers/ata/pata_of_platform.c
>> --- linux-4.1/drivers/ata/pata_of_platform.c    2015-06-22
>> 03:47:03.400778537 +0200
>> +++ linux-4.1-nemo/drivers/ata/pata_of_platform.c    2015-06-22
>> 03:27:29.653650363 +0200
>> @@ -41,14 +41,36 @@ static int pata_of_platform_probe(struct
>>            return -EINVAL;
>>        }
>>
>> -    ret = of_address_to_resource(dn, 1, &ctl_res);
>> -    if (ret) {
>> -        dev_err(&ofdev->dev, "can't get CTL address from "
>> -            "device tree\n");
>> -        return -EINVAL;
>> +    if (of_device_is_compatible(dn, "electra-ide")) {
>> +        /* Altstatus is really at offset 0x3f6 from the primary window
>> +         * on electra-ide. Adjust ctl_res and io_res accordingly.
>> +         */
>> +        ctl_res = io_res;
>> +        ctl_res.start = ctl_res.start+0x3f6;
>> +        io_res.end = ctl_res.start-1;
>> +
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       } else if (of_device_is_compatible(dn, "electra-cf")) {
>> +               /* Task regs are at 0x800, with alt status @ 0x80e in
>> the primary window
>> +                * on electra-cf. Adjust ctl_res and io_res accordingly.
>> +                */
>> +               ctl_res = io_res;
>> +               io_res.start += 0x800;
>> +               ctl_res.start = ctl_res.start + 0x80e;
>> +               io_res.end = ctl_res.start-1;
>> +#endif
>> +    } else {
>> +        ret = of_address_to_resource(dn, 1, &ctl_res);
>> +        if (ret) {
>> +            dev_err(&ofdev->dev, "can't get CTL address from "
>> +                "device tree\n");
>> +            return -EINVAL;
>> +        }
>>        }
>>
>>        irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
>> +    if (irq_res)
>> +        irq_res->flags = 0;
>>
>>        prop = of_get_property(dn, "reg-shift", NULL);
>>        if (prop)
>> @@ -65,6 +87,11 @@ static int pata_of_platform_probe(struct
>>            dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0\n");
>>        }
>>
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       irq_res = 0;                    // force irq off (doesn't seem
>> to work)
>> +#endif
>> +
>> +
>>        pio_mask = 1 << pio_mode;
>>        pio_mask |= (1 << pio_mode) - 1;
>>
>> @@ -74,7 +101,11 @@ static int pata_of_platform_probe(struct
>>
>>    static struct of_device_id pata_of_platform_match[] = {
>>        { .compatible = "ata-generic", },
>> -    { },
>> +    { .compatible = "electra-ide", },
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       { .compatible = "electra-cf",},
>> +#endif
>> +    {},
>>    };
>>    MODULE_DEVICE_TABLE(of, pata_of_platform_match);
>>
>> diff -rupN linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c
>> linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c
>> --- linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22
>> 03:47:04.600778536 +0200
>> +++ linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22
>> 03:27:29.675650448 +0200
>> @@ -226,7 +226,10 @@ static void radeon_set_power_state(struc
>>            /* set memory clock */
>>            if (rdev->asic->pm.set_memory_clock && (mclk !=
>> rdev->pm.current_mclk)) {
>>                radeon_pm_debug_check_in_vbl(rdev, false);
>> +               /* D.Stevens 2012 for the A-EON AmigaOne X1000: Setting
>> memory clock only works on CAICOS and 6570, don't set for anything else
>> (We ignore 6570 here */
>> +               if (rdev->family == CHIP_CAICOS) {
>>                radeon_set_memory_clock(rdev, mclk);
>> +               }
>>                radeon_pm_debug_check_in_vbl(rdev, true);
>>                rdev->pm.current_mclk = mclk;
>>                DRM_DEBUG_DRIVER("Setting: m: %d\n", mclk);
>> @@ -1220,7 +1223,7 @@ static void radeon_pm_resume_old(struct
>>                            SET_VOLTAGE_TYPE_ASIC_VDDCI);
>>            if (rdev->pm.default_sclk)
>>                radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
>> -        if (rdev->pm.default_mclk)
>> +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
>> /* Fix for PPC systems HD6000 >6570 by A-EON Core Linux Support Team */
>>                radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>>        }
>>        /* asic init will reset the default power state */
>> @@ -1271,7 +1274,7 @@ dpm_resume_fail:
>>                            SET_VOLTAGE_TYPE_ASIC_VDDCI);
>>            if (rdev->pm.default_sclk)
>>                radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
>> -        if (rdev->pm.default_mclk)
>> +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
>> /* Fix for PPC & > HD6570 by A-EON Linux Core Support Team */
>>                radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>>        }
>>    }
>> @@ -1318,7 +1321,7 @@ static int radeon_pm_init_old(struct rad
>>                                SET_VOLTAGE_TYPE_ASIC_VDDCI);
>>                if (rdev->pm.default_sclk)
>>                    radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
>> -            if (rdev->pm.default_mclk)
>> +            if (rdev->pm.default_mclk && (rdev->family ==
>> CHIP_CAICOS))     // D.Stevens 2013: fix for >HD6570 on PPC
>>                    radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>>            }
>>        }
>> @@ -1431,7 +1434,7 @@ dpm_failed:
>>                            SET_VOLTAGE_TYPE_ASIC_VDDCI);
>>            if (rdev->pm.default_sclk)
>>                radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
>> -        if (rdev->pm.default_mclk)
>> +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))  //
>> D.Stevens 2013: Fix for >HD6570 on ppc
>>                radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>>        }
>>        DRM_ERROR("radeon: dpm initialization failed\n");
>> diff -rupN linux-4.1/drivers/pci/pci.c linux-4.1-nemo/drivers/pci/pci.c
>> --- linux-4.1/drivers/pci/pci.c    2015-06-22 03:47:08.817778536 +0200
>> +++ linux-4.1-nemo/drivers/pci/pci.c    2015-06-22 03:27:29.717650601 +0200
>> @@ -421,7 +421,16 @@ struct resource *pci_find_parent_resourc
>>        pci_bus_for_each_resource(bus, r, i) {
>>            if (!r)
>>                continue;
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +    /* The new code here checks for resources that are not allocated,
>> and no longer
>> +     * returns these, however the SB600 code uses this feature to
>> allocate IO ranges
>> +     * in the ISA map, and this breaks booting on the AmigaOneX1000.
>> +     * Temporary fix to get the kernel working, remove the resource
>> allocated check.
>> +     */
>> +        if (resource_contains(r, res)) {
>> +#else
>>            if (res->start && resource_contains(r, res)) {
>> +#endif
>>
>>                /*
>>                 * If the window is prefetchable but the BAR is
>> diff -rupN linux-4.1/drivers/pci/probe.c linux-4.1-nemo/drivers/pci/probe.c
>> --- linux-4.1/drivers/pci/probe.c    2015-06-22 03:47:08.824778536 +0200
>> +++ linux-4.1-nemo/drivers/pci/probe.c    2015-06-22 03:27:29.720650613
>> +0200
>> @@ -363,7 +363,11 @@ static void pci_read_bridge_io(struct pc
>>            limit |= ((unsigned long) io_limit_hi << 16);
>>        }
>>
>> -    if (base <= limit) {
>> +       if (base <= limit
>> +       #ifdef CONFIG_PPC_PASEMI_SB600
>> +               || child->busn_res.start == 5
>> +       #endif
>> +              ) {
>>            res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) |
>> IORESOURCE_IO;
>>            region.start = base;
>>            region.end = limit + io_granularity - 1;
>> @@ -1609,11 +1613,14 @@ static int only_one_child(struct pci_bus
>>
>>        if (!parent || !pci_is_pcie(parent))
>>            return 0;
>> +       #ifndef CONFIG_PPC_PASEMI_SB600
>> +       // SB600 has non-zero devices on non-root bus.
>>        if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
>>            return 1;
>>        if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM &&
>>            !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
>>            return 1;
>> +    #endif
>>        return 0;
>>    }
>>
>> diff -rupN linux-4.1/drivers/rtc/rtc-cmos.c
>> linux-4.1-nemo/drivers/rtc/rtc-cmos.c
>> --- linux-4.1/drivers/rtc/rtc-cmos.c    2015-06-22 03:47:09.156778536 +0200
>> +++ linux-4.1-nemo/drivers/rtc/rtc-cmos.c    2015-06-22
>> 03:27:29.742650701 +0200
>> @@ -242,6 +242,13 @@ static int cmos_read_alarm(struct device
>>        }
>>
>>        rtc_control = CMOS_READ(RTC_CONTROL);
>> +
>> +#ifdef CONFIG_PPC_PASEMI_SB600
>> +       // Nemo BIOS does not init RTC
>> +       rtc_control = rtc_control | RTC_24H;
>> +       CMOS_WRITE(rtc_control, RTC_CONTROL);
>> +#endif
>> +
>>        spin_unlock_irq(&rtc_lock);
>>
>>        if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
>> diff -rupN linux-4.1/sound/pci/hda/patch_sigmatel.c
>> linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c
>> --- linux-4.1/sound/pci/hda/patch_sigmatel.c    2015-06-22
>> 03:47:15.039778536 +0200
>> +++ linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c    2015-06-22
>> 03:27:29.768650804 +0200
>> @@ -166,6 +166,7 @@ enum {
>>        STAC_D965_VERBS,
>>        STAC_DELL_3ST,
>>        STAC_DELL_BIOS,
>> +    STAC_NEMO_DEFAULT,
>>        STAC_DELL_BIOS_AMIC,
>>        STAC_DELL_BIOS_SPDIF,
>>        STAC_927X_DELL_DMIC,
>> @@ -1359,6 +1360,23 @@ static const struct hda_pintbl oqo9200_p
>>        {}
>>    };
>>
>> +static const struct hda_pintbl nemo_pin_configs[] = {
>> +   { 0x0a, 0x02214020 },
>> +   { 0x0b, 0x02A19080 },
>> +   { 0x0c, 0x0181304E },
>> +   { 0x0d, 0x01014010 },
>> +   { 0x0e, 0x01A19040 },
>> +   { 0x0f, 0x01011012 },
>> +   { 0x10, 0x01016011 },
>> +   { 0x11, 0x01012014 },
>> +   { 0x12, 0x103301F0 },
>> +   { 0x13, 0x00000000 },
>> +   { 0x14, 0x00000000 },
>> +   { 0x21, 0x01442170 },
>> +   { 0x22, 0x00000000 },
>> +   { 0x23, 0x00000000 },
>> +   {}
>> +};
>>
>>    static void stac9200_fixup_panasonic(struct hda_codec *codec,
>>                         const struct hda_fixup *fix, int action)
>> @@ -3868,6 +3886,10 @@ static const struct hda_fixup stac927x_f
>>            .type = HDA_FIXUP_PINS,
>>            .v.pins = d965_5st_no_fp_pin_configs,
>>        },
>> +    [STAC_NEMO_DEFAULT] = {
>> +               .type = HDA_FIXUP_PINS,
>> +        .v.pins = nemo_pin_configs,
>> +    },
>>        [STAC_DELL_3ST] = {
>>            .type = HDA_FIXUP_PINS,
>>            .v.pins = dell_3st_pin_configs,
>> @@ -3924,6 +3946,7 @@ static const struct hda_model_fixup stac
>>        { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
>>        { .id = STAC_DELL_3ST, .name = "dell-3stack" },
>>        { .id = STAC_DELL_BIOS, .name = "dell-bios" },
>> +    { .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },
>>        { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
>>        { .id = STAC_927X_VOLKNOB, .name = "volknob" },
>>        {}
>> @@ -3962,6 +3985,8 @@ static const struct snd_pci_quirk stac92
>>                   "Intel D965", STAC_D965_5ST),
>>        SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
>>                   "Intel D965", STAC_D965_5ST),
>> +    /* Nemo */
>> +    SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000", STAC_NEMO_DEFAULT),
>>        /* volume-knob fixes */
>>        SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
>>        {} /* terminator */
>> @@ -5035,6 +5060,7 @@ static const struct hda_codec_preset snd
>>         { .id = 0x83847683, .name = "STAC9221D A2", .patch =
>> patch_stac922x },
>>         { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
>>         { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
>> +    { .id = 0x83847638, .name = "STAC92HD700", .patch = patch_stac927x },
>>         { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
>>         { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
>>         { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-08 18:00         ` Christian Zigotzky
  2015-07-08 22:36           ` Benjamin Herrenschmidt
@ 2015-07-09 22:27           ` Christian Zigotzky
  2015-07-10  6:51             ` Christian Zigotzky
  2015-07-13  6:44             ` Benjamin Herrenschmidt
  1 sibling, 2 replies; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-09 22:27 UTC (permalink / raw)
  To: linuxppc-dev

Hi All,

Many thanks for your help. You're right. It was something wrong with my 
last bisect. I did another bisect. I evaluated the one "sometimes boots" 
with good.

Log:

git clone 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-git

git bisect start

git bisect good b953c0d234bc72e8489d3bf51a276c5c4ec85345 (Linux 4.1)

git bisect bad d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (Linux 4.2-rc1)

Output:

Bisecting: 6261 revisions left to test after this (roughly 13 steps)
[4570a37169d4b44d316f40b2ccc681dc93fedc7b] Merge tag 'sound-4.2-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

----

git bisect bad

Output:

Bisecting: 3295 revisions left to test after this (roughly 12 steps)
[4e241557fc1cb560bd9e77ca1b4a9352732a5427] Merge tag 'for-linus' of 
git://git.kernel.org/pub/scm/virt/kvm/kvm

----

git bisect bad

Output:

Bisecting: 1625 revisions left to test after this (roughly 11 steps)
[44d21c3f3a2ef2f58b18bda64c52c99e723f3f4a] Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

----

git bisect bad

Output:

Bisecting: 712 revisions left to test after this (roughly 10 steps)
[e75c73ad64478c12b3a44b86a3e7f62a4f65b93e] Merge branch 
'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

----

git bisect good

Output:

Bisecting: 343 revisions left to test after this (roughly 9 steps)
[43224b96af3154cedd7220f7b90094905f07ac78] Merge branch 
'timers-core-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

----

git bisect good

Output:

Bisecting: 171 revisions left to test after this (roughly 8 steps)
[056c04ba8bbad4c563c05306cc8a8c66e713f280] crypto: seqiv - Fix module 
unload/reload crash

----

git bisect good

Output:

Bisecting: 85 revisions left to test after this (roughly 7 steps)
[edf18b9108f5025f9e83b2c167c9122954acbc62] crypto: api - Add 
CRYPTO_MINALIGN_ATTR to struct crypto_alg

----

git bisect good

Output:

Bisecting: 41 revisions left to test after this (roughly 6 steps)
[407a2c720556e8e340e06f6a7174f5d6d80cf9ea] Merge branch 
'irq-core-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

----

It didn't boot with the following error messages:

Oops: Kernel access of bad area, sig: 11 [#1]

.sb600_8259_cascade+0x4c/0xac (unreliable)
.kmem_cache_alloc+0x5c/0x1c4 (unreliable)

----

git bisect bad

Output:

Bisecting: 21 revisions left to test after this (roughly 5 steps)
[3b0f95be143bea1aa47beb20134ef82e4e4068dc] irq: Add 
irq_set_chained_handler_and_data()

----

git bisect good

Output:

Bisecting: 12 revisions left to test after this (roughly 4 steps)
[62a993df31f795d87bcb4c6cb005d36f32f6ad55] irqchip: atmel-aic5: Add 
sama5d2 support

----

git bisect good

Output:

Bisecting: 6 revisions left to test after this (roughly 3 steps)
[a614a610ac9b28f195d790d25be72d26f345c53a] genirq: Remove bogus 
restriction in irq_move_mask_irq()

----

It didn't boot with the following error messages:

Oops: Kernel access of bad area, sig: 11 [#1]

.sb600_8259_cascade+0x4c/0xac (unreliable)
.__kernfs_new_node+0x54/0xd8 (unreliable)

----

git bisect bad

Output:

Bisecting: 2 revisions left to test after this (roughly 2 steps)
[0d0b4c866bcce647f40d73efe5e90aeeb079050a] genirq: Introduce struct 
irq_common_data to host shared irq data

----

It didn't boot with the following error messages:

Oops: Kernel access of bad area, sig: 11 [#1]

.sb600_8259_cascade+0x4c/0xac (unreliable)
.schedule+0x74/0x9c (unreliable)

----

git bisect bad

Output:

Bisecting: 0 revisions left to test after this (roughly 1 step)
[77ed42f18edd486e9994ccd1f174076309a6343f] genirq: Prevent crash in 
irq_move_irq()

----

git bisect good

Output:
0d0b4c866bcce647f40d73efe5e90aeeb079050a is the first bad commit
commit 0d0b4c866bcce647f40d73efe5e90aeeb079050a
Author: Jiang Liu <jiang.liu@linux.intel.com>
Date:   Mon Jun 1 16:05:12 2015 +0800

     genirq: Introduce struct irq_common_data to host shared irq data

     With the introduction of hierarchy irqdomain, struct irq_data becomes
     per-chip instead of per-irq and there may be multiple irq_datas
     associated with the same irq. Some per-irq data stored in struct
     irq_data now may get duplicated into multiple irq_datas, and causes
     inconsistent view.

     So introduce struct irq_common_data to host per-irq common data and to
     achieve consistent view among irq_chips.

     Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
     Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
     Cc: Tony Luck <tony.luck@intel.com>
     Cc: Bjorn Helgaas <bhelgaas@google.com>
     Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
     Cc: Randy Dunlap <rdunlap@infradead.org>
     Cc: Yinghai Lu <yinghai@kernel.org>
     Cc: Borislav Petkov <bp@alien8.de>
     Cc: Jason Cooper <jason@lakedaemon.net>
     Cc: Kevin Cernekee <cernekee@gmail.com>
     Cc: Arnd Bergmann <arnd@arndb.de>
     Cc: Marc Zyngier <marc.zyngier@arm.com>
     Link: 
http://lkml.kernel.org/r/1433145945-789-4-git-send-email-jiang.liu@linux.intel.com
     Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

:040000 040000 4cb60e0b1d4beb046834e75c66b5d0a0613935b9 
df0b465b70ec087560482267cca2d9ff54d92c49 M    include
:040000 040000 3808922cd797449f8f9b33300064a2ff1727f3a6 
25a75bf65be0ba9e397151de0ed1beb1695fddb2 M    kernel

----

Rgds,

Christian

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

* PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09 22:27           ` Christian Zigotzky
@ 2015-07-10  6:51             ` Christian Zigotzky
  2015-07-13  6:44             ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 29+ messages in thread
From: Christian Zigotzky @ 2015-07-10  6:51 UTC (permalink / raw)
  To: linuxppc-dev

Hi All,

The first bad commit: 
http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=0d0b4c866bcce647f40d73efe5e90aeeb079050a

I replaced the following irq files with the old kernel 4.1 irq files:

~/Downloads/linux-4.2/linux-4.2-nemo$ cp 
/home/christian/Downloads/linux-4.1/linux-4.1/include/linux/irq.h 
include/linux/irq.h
~/Downloads/linux-4.2/linux-4.2-nemo$ cp 
/home/christian/Downloads/linux-4.1/linux-4.1/include/linux/irqdesc.h 
include/linux/irqdesc.h
~/Downloads/linux-4.2/linux-4.2-nemo$ cp 
/home/christian/Downloads/linux-4.1/linux-4.1/kernel/irq/internals.h 
kernel/irq/internals.h
~/Downloads/linux-4.2/linux-4.2-nemo$ cp 
/home/christian/Downloads/linux-4.1/linux-4.1/kernel/irq/irqdesc.c 
kernel/irq/irqdesc.c
~/Downloads/linux-4.2/linux-4.2-nemo$ cp 
/home/christian/Downloads/linux-4.1/linux-4.1/kernel/irq/irqdomain.c 
kernel/irq/irqdomain.c
~/Downloads/linux-4.2/linux-4.2-nemo$ cp 
/home/christian/Downloads/linux-4.1/linux-4.1/kernel/irq/manage.c 
kernel/irq/manage.c
~/Downloads/linux-4.2/linux-4.2-nemo$ cp 
/home/christian/Downloads/linux-4.1/linux-4.1/kernel/irq/proc.c 
kernel/irq/proc.c

I compiled the RC1 of kernel 4.2 with these old irq source code today. 
I'm happy it boots. :-)

Rgds,

Christian

On 10 July 2015 at 00:27 AM, Christian Zigotzky wrote:
> Hi All,
>
> Many thanks for your help. You're right. It was something wrong with 
> my last bisect. I did another bisect. I evaluated the one "sometimes 
> boots" with good.
>
> Log:
>
> git clone 
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> linux-git
>
> git bisect start
>
> git bisect good b953c0d234bc72e8489d3bf51a276c5c4ec85345 (Linux 4.1)
>
> git bisect bad d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (Linux 4.2-rc1)
>
> Output:
>
> Bisecting: 6261 revisions left to test after this (roughly 13 steps)
> [4570a37169d4b44d316f40b2ccc681dc93fedc7b] Merge tag 'sound-4.2-rc1' 
> of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
>
> ----
>
> git bisect bad
>
> Output:
>
> Bisecting: 3295 revisions left to test after this (roughly 12 steps)
> [4e241557fc1cb560bd9e77ca1b4a9352732a5427] Merge tag 'for-linus' of 
> git://git.kernel.org/pub/scm/virt/kvm/kvm
>
> ----
>
> git bisect bad
>
> Output:
>
> Bisecting: 1625 revisions left to test after this (roughly 11 steps)
> [44d21c3f3a2ef2f58b18bda64c52c99e723f3f4a] Merge 
> git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
>
> ----
>
> git bisect bad
>
> Output:
>
> Bisecting: 712 revisions left to test after this (roughly 10 steps)
> [e75c73ad64478c12b3a44b86a3e7f62a4f65b93e] Merge branch 
> 'x86-fpu-for-linus' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
>
> ----
>
> git bisect good
>
> Output:
>
> Bisecting: 343 revisions left to test after this (roughly 9 steps)
> [43224b96af3154cedd7220f7b90094905f07ac78] Merge branch 
> 'timers-core-for-linus' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
>
> ----
>
> git bisect good
>
> Output:
>
> Bisecting: 171 revisions left to test after this (roughly 8 steps)
> [056c04ba8bbad4c563c05306cc8a8c66e713f280] crypto: seqiv - Fix module 
> unload/reload crash
>
> ----
>
> git bisect good
>
> Output:
>
> Bisecting: 85 revisions left to test after this (roughly 7 steps)
> [edf18b9108f5025f9e83b2c167c9122954acbc62] crypto: api - Add 
> CRYPTO_MINALIGN_ATTR to struct crypto_alg
>
> ----
>
> git bisect good
>
> Output:
>
> Bisecting: 41 revisions left to test after this (roughly 6 steps)
> [407a2c720556e8e340e06f6a7174f5d6d80cf9ea] Merge branch 
> 'irq-core-for-linus' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
>
> ----
>
> It didn't boot with the following error messages:
>
> Oops: Kernel access of bad area, sig: 11 [#1]
>
> .sb600_8259_cascade+0x4c/0xac (unreliable)
> .kmem_cache_alloc+0x5c/0x1c4 (unreliable)
>
> ----
>
> git bisect bad
>
> Output:
>
> Bisecting: 21 revisions left to test after this (roughly 5 steps)
> [3b0f95be143bea1aa47beb20134ef82e4e4068dc] irq: Add 
> irq_set_chained_handler_and_data()
>
> ----
>
> git bisect good
>
> Output:
>
> Bisecting: 12 revisions left to test after this (roughly 4 steps)
> [62a993df31f795d87bcb4c6cb005d36f32f6ad55] irqchip: atmel-aic5: Add 
> sama5d2 support
>
> ----
>
> git bisect good
>
> Output:
>
> Bisecting: 6 revisions left to test after this (roughly 3 steps)
> [a614a610ac9b28f195d790d25be72d26f345c53a] genirq: Remove bogus 
> restriction in irq_move_mask_irq()
>
> ----
>
> It didn't boot with the following error messages:
>
> Oops: Kernel access of bad area, sig: 11 [#1]
>
> .sb600_8259_cascade+0x4c/0xac (unreliable)
> .__kernfs_new_node+0x54/0xd8 (unreliable)
>
> ----
>
> git bisect bad
>
> Output:
>
> Bisecting: 2 revisions left to test after this (roughly 2 steps)
> [0d0b4c866bcce647f40d73efe5e90aeeb079050a] genirq: Introduce struct 
> irq_common_data to host shared irq data
>
> ----
>
> It didn't boot with the following error messages:
>
> Oops: Kernel access of bad area, sig: 11 [#1]
>
> .sb600_8259_cascade+0x4c/0xac (unreliable)
> .schedule+0x74/0x9c (unreliable)
>
> ----
>
> git bisect bad
>
> Output:
>
> Bisecting: 0 revisions left to test after this (roughly 1 step)
> [77ed42f18edd486e9994ccd1f174076309a6343f] genirq: Prevent crash in 
> irq_move_irq()
>
> ----
>
> git bisect good
>
> Output:
> 0d0b4c866bcce647f40d73efe5e90aeeb079050a is the first bad commit
> commit 0d0b4c866bcce647f40d73efe5e90aeeb079050a
> Author: Jiang Liu <jiang.liu@linux.intel.com>
> Date:   Mon Jun 1 16:05:12 2015 +0800
>
>     genirq: Introduce struct irq_common_data to host shared irq data
>
>     With the introduction of hierarchy irqdomain, struct irq_data becomes
>     per-chip instead of per-irq and there may be multiple irq_datas
>     associated with the same irq. Some per-irq data stored in struct
>     irq_data now may get duplicated into multiple irq_datas, and causes
>     inconsistent view.
>
>     So introduce struct irq_common_data to host per-irq common data 
> and to
>     achieve consistent view among irq_chips.
>
>     Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>     Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>     Cc: Tony Luck <tony.luck@intel.com>
>     Cc: Bjorn Helgaas <bhelgaas@google.com>
>     Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>     Cc: Randy Dunlap <rdunlap@infradead.org>
>     Cc: Yinghai Lu <yinghai@kernel.org>
>     Cc: Borislav Petkov <bp@alien8.de>
>     Cc: Jason Cooper <jason@lakedaemon.net>
>     Cc: Kevin Cernekee <cernekee@gmail.com>
>     Cc: Arnd Bergmann <arnd@arndb.de>
>     Cc: Marc Zyngier <marc.zyngier@arm.com>
>     Link: 
> http://lkml.kernel.org/r/1433145945-789-4-git-send-email-jiang.liu@linux.intel.com
>     Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>
> :040000 040000 4cb60e0b1d4beb046834e75c66b5d0a0613935b9 
> df0b465b70ec087560482267cca2d9ff54d92c49 M    include
> :040000 040000 3808922cd797449f8f9b33300064a2ff1727f3a6 
> 25a75bf65be0ba9e397151de0ed1beb1695fddb2 M    kernel
>
> ----
>
> Rgds,
>
> Christian
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09 22:27           ` Christian Zigotzky
  2015-07-10  6:51             ` Christian Zigotzky
@ 2015-07-13  6:44             ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 29+ messages in thread
From: Benjamin Herrenschmidt @ 2015-07-13  6:44 UTC (permalink / raw)
  To: Christian Zigotzky; +Cc: linuxppc-dev

On Fri, 2015-07-10 at 00:27 +0200, Christian Zigotzky wrote:
> Hi All,
> 
> Many thanks for your help. You're right. It was something wrong with my 
> last bisect. I did another bisect. I evaluated the one "sometimes boots" 
> with good.

 .../...

Now that makes more sense since the problem is around IRQ handling...
more specifically the SB600 code, so I suspect it's your SB600 patch
that has an issue. Look at how that series from Jiang modified the
irq handlers and see if the sb600 patch needs a similar change maybe ?

Ben.

> 
> Output:
> 0d0b4c866bcce647f40d73efe5e90aeeb079050a is the first bad commit
> commit 0d0b4c866bcce647f40d73efe5e90aeeb079050a
> Author: Jiang Liu <jiang.liu@linux.intel.com>
> Date:   Mon Jun 1 16:05:12 2015 +0800
> 
>      genirq: Introduce struct irq_common_data to host shared irq data
> 
>      With the introduction of hierarchy irqdomain, struct irq_data becomes
>      per-chip instead of per-irq and there may be multiple irq_datas
>      associated with the same irq. Some per-irq data stored in struct
>      irq_data now may get duplicated into multiple irq_datas, and causes
>      inconsistent view.
> 
>      So introduce struct irq_common_data to host per-irq common data and to
>      achieve consistent view among irq_chips.
> 
>      Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>      Cc: Tony Luck <tony.luck@intel.com>
>      Cc: Bjorn Helgaas <bhelgaas@google.com>
>      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>      Cc: Randy Dunlap <rdunlap@infradead.org>
>      Cc: Yinghai Lu <yinghai@kernel.org>
>      Cc: Borislav Petkov <bp@alien8.de>
>      Cc: Jason Cooper <jason@lakedaemon.net>
>      Cc: Kevin Cernekee <cernekee@gmail.com>
>      Cc: Arnd Bergmann <arnd@arndb.de>
>      Cc: Marc Zyngier <marc.zyngier@arm.com>
>      Link: 
> http://lkml.kernel.org/r/1433145945-789-4-git-send-email-jiang.liu@linux.intel.com
>      Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> 
> :040000 040000 4cb60e0b1d4beb046834e75c66b5d0a0613935b9 
> df0b465b70ec087560482267cca2d9ff54d92c49 M    include
> :040000 040000 3808922cd797449f8f9b33300064a2ff1727f3a6 
> 25a75bf65be0ba9e397151de0ed1beb1695fddb2 M    kernel
> 
> ----
> 
> Rgds,
> 
> Christian
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-09  9:52                   ` Denis Kirjanov
  2015-07-09 10:37                     ` Christian Zigotzky
@ 2015-07-13  6:47                     ` Benjamin Herrenschmidt
  2015-07-13  9:33                       ` Denis Kirjanov
  1 sibling, 1 reply; 29+ messages in thread
From: Benjamin Herrenschmidt @ 2015-07-13  6:47 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: Christian Zigotzky, linuxppc-dev

On Thu, 2015-07-09 at 12:52 +0300, Denis Kirjanov wrote:
> On 7/9/15, Christian Zigotzky <chzigotzky@xenosoft.de> wrote:
> > All
> >
> > I think you haven't received the SB600 patch yet. I have pasted it in
> > this email directly. Thank you for your help. I am sorry because of this
> > long patch but I hope you could help me a bit.
> 
> But the first thing then is to upstream the sb600 patch...

Well, the patch is gross ... That stuff needs to be mostly re-written,
randomly ifdef'ing things around isn't going to fly. There are also
some mentions of FW issues, can this be fixed in FW ?

Ben.
 
> >
> > Thanks
> >
> > Christian
> >
> > ------------- nemo_4.1-3.patch -------------
> >
> > diff -rupN linux-4.1/arch/powerpc/kernel/head_64.S
> > linux-4.1-nemo/arch/powerpc/kernel/head_64.S
> > --- linux-4.1/arch/powerpc/kernel/head_64.S    2015-06-22
> > 03:47:01.850778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/kernel/head_64.S    2015-06-22
> > 03:27:29.590650112 +0200
> > @@ -70,6 +70,13 @@ _GLOBAL(__start)
> >       /* NOP this out unconditionally */
> >   BEGIN_FTR_SECTION
> >       FIXUP_ENDIAN
> > +/* Hack for PWRficient platforms: Due to CFE(?) bug, the 64-bit
> > + * word at 0x8 needs to be set to 0. Patch it up here once we're
> > + * done executing it (we can be lazy and avoid invalidating
> > + * icache)
> > + */
> > +li     r0,0
> > +std    0,8(0)
> >       b    __start_initialization_multiplatform
> >   END_FTR_SECTION(0, 1)
> >
> > diff -rupN linux-4.1/arch/powerpc/kernel/pci-common.c
> > linux-4.1-nemo/arch/powerpc/kernel/pci-common.c
> > --- linux-4.1/arch/powerpc/kernel/pci-common.c    2015-06-22
> > 03:47:01.866778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/kernel/pci-common.c    2015-06-22
> > 03:27:29.603650164 +0200
> > @@ -721,6 +721,19 @@ void pci_process_bridge_OF_ranges(struct
> >                   isa_io_base =
> >                       (unsigned long)hose->io_base_virt;
> >   #endif /* CONFIG_PPC32 */
> > +
> > +
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +                       /* Workaround for lack of device tree. New for
> > kernel 3.17: range.cpu_addr instead of cpu_addr and range.size instead
> > of size Ch. Zigotzky */
> > +                       if (primary) {
> > +                               __ioremap_at(range.cpu_addr, (void
> > *)ISA_IO_BASE,
> > +                               range.size, _PAGE_NO_CACHE|_PAGE_GUARDED);
> > +                       hose->io_base_virt = (void *)_IO_BASE;
> > +               /* _IO_BASE needs unsigned long long for the kernel 3.17
> > Ch. Zigotzky */
> > +                       printk("Initialised io_base_virt 0x%lx _IO_BASE
> > 0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long long)_IO_BASE);
> > +                    }
> > +#endif
> > +
> >               /* pci_io_size and io_base_phys always represent IO
> >                * space starting at 0 so we factor in pci_addr
> >                */
> > @@ -1194,6 +1207,7 @@ static void pcibios_allocate_bus_resourc
> >                   &ioport_resource : &iomem_resource;
> >           else {
> >               pr = pci_find_parent_resource(bus->self, res);
> > +#ifndef CONFIG_PPC_PASEMI_SB600
> >               if (pr == res) {
> >                   /* this happens when the generic PCI
> >                    * code (wrongly) decides that this
> > @@ -1201,6 +1215,7 @@ static void pcibios_allocate_bus_resourc
> >                    */
> >                   continue;
> >               }
> > +#endif
> >           }
> >
> >           pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx "
> > @@ -1632,8 +1647,9 @@ void pcibios_scan_phb(struct pci_control
> >       pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
> >
> >       /* Get some IO space for the new PHB */
> > +#ifndef CONFIG_PPC_PASEMI_SB600
> >       pcibios_setup_phb_io_space(hose);
> > -
> > +#endif
> >       /* Wire up PHB bus resources */
> >       pcibios_setup_phb_resources(hose, &resources);
> >
> > diff -rupN linux-4.1/arch/powerpc/kernel/setup-common.c
> > linux-4.1-nemo/arch/powerpc/kernel/setup-common.c
> > --- linux-4.1/arch/powerpc/kernel/setup-common.c    2015-06-22
> > 03:47:01.879778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/kernel/setup-common.c    2015-06-22
> > 03:27:29.605650172 +0200
> > @@ -76,7 +76,15 @@ EXPORT_SYMBOL(ppc_md);
> >   struct machdep_calls *machine_id;
> >   EXPORT_SYMBOL(machine_id);
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +/* FIXME!!
> > + * Current PASemi code does not correctly update the value of boot_cpuid
> > + * As a temporary fix we use the default 0, which is known to work
> > + */
> > +int boot_cpuid = 0;
> > +#else
> >   int boot_cpuid = -1;
> > +#endif
> >   EXPORT_SYMBOL_GPL(boot_cpuid);
> >
> >   unsigned long klimit = (unsigned long) _end;
> > diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/iommu.c
> > linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c
> > --- linux-4.1/arch/powerpc/platforms/pasemi/iommu.c    2015-06-22
> > 03:47:02.018778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c 2015-06-22
> > 03:27:29.611650196 +0200
> > @@ -1,3 +1,9 @@
> > +/* This is a modified copy of
> > +* usr/src/linux-2.6.39.4/arch/powerpc/platforms/pasemi/iommu.c
> > +* The mod is on line 150
> > +* By Len Karpowicz <twotat2z@embarqmail.com
> > +*/
> > +
> >   /*
> >    * Copyright (C) 2005-2008, PA Semi, Inc
> >    *
> > @@ -143,8 +149,11 @@ static void iommu_table_iobmap_setup(voi
> >       iommu_table_iobmap.it_page_shift = IOBMAP_PAGE_SHIFT;
> >
> >       /* it_size is in number of entries */
> > -    iommu_table_iobmap.it_size =
> > -        0x80000000 >> iommu_table_iobmap.it_page_shift;
> > +
> > +/* Note: changed 0x80000000 to 0x7FFFFFFF for SBLive! SB0220 */
> > +/* out of range problem on A-EON AmigaOne X1000 */
> > +       iommu_table_iobmap.it_size = 0x7FFFFFFF >> IOBMAP_PAGE_SHIFT;
> > +
> >
> >       /* Initialize the common IOMMU code */
> >       iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
> > diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/Kconfig
> > linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig
> > --- linux-4.1/arch/powerpc/platforms/pasemi/Kconfig    2015-06-22
> > 03:47:02.017778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig 2015-06-22
> > 03:27:29.620650232 +0200
> > @@ -14,6 +14,13 @@ config PPC_PASEMI
> >   menu "PA Semi PWRficient options"
> >       depends on PPC_PASEMI
> >
> > +config PPC_PASEMI_SB600
> > +       bool "Nemo SB600 South Bridge Support"
> > +       depends on PPC_PASEMI
> > +       select PPC_I8259
> > +       help
> > +       Workarounds for the SB600 South Bridge.
> > +
> >   config PPC_PASEMI_IOMMU
> >       bool "PA Semi IOMMU support"
> >       depends on PPC_PASEMI
> > diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/pci.c
> > linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c
> > --- linux-4.1/arch/powerpc/platforms/pasemi/pci.c    2015-06-22
> > 03:47:02.019778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c    2015-06-22
> > 03:27:29.621650236 +0200
> > @@ -108,6 +108,69 @@ static int workaround_5945(struct pci_bu
> >       return 1;
> >   }
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +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, &val);
> > +
> > +               sb600_bus = val;
> > +
> > +               printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
> > +       }
> > +
> > +       if (iob_mapbase == NULL)
> > +       {
> > +        dn = of_find_compatible_node(NULL, "io-bridge",
> > "pasemi,1682m-iob");
> > +        if (!dn)
> > +        {
> > +               printk(KERN_CRIT "NEMO SB600 missing iob node\n");
> > +                       return;
> > +               }
> > +
> > +               err = of_address_to_resource(dn, 0, &res);
> > +        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 +189,10 @@ static int pa_pxp_read_config(struct pci
> >
> >       addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       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.
> > diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/setup.c
> > linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c
> > --- linux-4.1/arch/powerpc/platforms/pasemi/setup.c    2015-06-22
> > 03:47:02.019778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c 2015-06-22
> > 03:27:29.623650244 +0200
> > @@ -34,6 +34,7 @@
> >   #include <asm/prom.h>
> >   #include <asm/iommu.h>
> >   #include <asm/machdep.h>
> > +#include <asm/i8259.h>
> >   #include <asm/mpic.h>
> >   #include <asm/smp.h>
> >   #include <asm/time.h>
> > @@ -72,6 +73,17 @@ static void pas_restart(char *cmd)
> >           out_le32(reset_reg, 0x6000000);
> >   }
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +void pas_shutdown(void)
> > +{
> > +       /* (added by DStevens 19/06/13)
> > +          Set the PLD bit that makes the SB600 think the power button
> > is being pressed */
> > +       void __iomem *pld_map = ioremap(0xf5000000,4096);
> > +       while (1)
> > +               out_8(pld_map+7,0x01);
> > +}
> > +#endif
> > +
> >   #ifdef CONFIG_SMP
> >   static arch_spinlock_t timebase_lock;
> >   static unsigned long timebase;
> > @@ -183,6 +195,55 @@ static int __init pas_setup_mce_regs(voi
> >   }
> >   machine_device_initcall(pasemi, pas_setup_mce_regs);
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +static unsigned sb600_irq_to_vector(int irq)
> > +{
> > +       switch(irq) {
> > +       case 3: return 216;
> > +       case 4: return 217;
> > +       case 5: return 218;
> > +       case 6: return 219;
> > +       case 7: return 220;
> > +       case 8: return 222;
> > +       case 9: return 212;
> > +       case 10: return 213;
> > +       case 11: return 214;
> > +       case 12: return 215;
> > +       case 14: return 221;
> > +       default: return 0;
> > +       }
> > +}
> > +
> > +static void sb600_8259_cascade(unsigned int irq, struct irq_data *desc)
> > +{
> > +       unsigned int cascade_irq = i8259_irq();
> > +       unsigned vector = sb600_irq_to_vector(cascade_irq);
> > +       if (vector > 0)
> > +               generic_handle_irq(vector);
> > +       outb(0x20, 0xA0);       /* Non-specific EOI */
> > +       outb(0x20, 0x20);       /* Non-specific EOI to cascade */
> > +       desc->chip->irq_eoi(desc);
> > +}
> > +extern void i8259_unmask_irq(struct irq_data *d);
> > +
> > +__init void sb600_8259_init(void)
> > +{
> > +       int gpio_virq;
> > +
> > +       // Connect legacy i8259 controller in SB600
> > +       printk("Init i8259\n");
> > +       i8259_init(NULL, 0);
> > +
> > +       gpio_virq = irq_create_mapping(NULL, 3);
> > +       irq_set_irq_type(gpio_virq, IRQ_TYPE_LEVEL_HIGH);
> > +       irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
> > +       mpic_unmask_irq(irq_get_irq_data(gpio_virq));
> > +
> > +       // Initial mapping for RTC
> > +       irq_create_mapping(NULL, 222);
> > +}
> > +#endif
> > +
> >   static __init void pas_init_IRQ(void)
> >   {
> >       struct device_node *np;
> > @@ -246,6 +307,12 @@ static __init void pas_init_IRQ(void)
> >
> >       of_node_put(mpic_node);
> >       of_node_put(root);
> > +
> > +
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       sb600_8259_init();
> > +#endif
> > +
> >   }
> >
> >   static void __init pas_progress(char *s, unsigned short hex)
> > @@ -403,12 +470,39 @@ static const struct of_device_id pasemi_
> >       {},
> >   };
> >
> > -static int __init pasemi_publish_devices(void)
> > -{
> > -    pasemi_pcmcia_init();
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +
> > +/*
> > + This should come from OF tree. See sysdev/rtc_cmos_setup for details.
> > Need to get i8259 supported correctly first, so that
> > + as the standard support hard-codes IRQ 8.
> > + */
> > +
> > +
> > +static struct resource rtc_resource[] = {{
> > +       .name = "rtc",
> > +       .start = 0x70,
> > +       .end = 0x71,
> > +       .flags = IORESOURCE_IO,
> > +}, {
> > +       .name = "rtc",
> > +       .start = 222,
> > +       .end = 222,
> > +       .flags = IORESOURCE_IRQ,
> > +}};
> > +
> > +#endif
> > +
> > +
> > + static int __init pasemi_publish_devices(void)
> > + {
> > +        pasemi_pcmcia_init();
> > +
> > +        /* Publish OF platform devices for SDC and other non-PCI devices */
> > +        of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
> >
> > -    /* Publish OF platform devices for SDC and other non-PCI devices */
> > -    of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       platform_device_register_simple("rtc_cmos", -1, rtc_resource, 2);
> > +#endif
> >
> >       return 0;
> >   }
> > @@ -430,9 +524,20 @@ static int __init pas_probe(void)
> >
> >       alloc_iobmap_l2();
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       pm_power_off              = pas_shutdown;         // Varisys
> > provided a way to turn us off
> > +#endif
> >       return 1;
> >   }
> >
> > +
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +static int sb600_pci_probe_mode(struct pci_bus *bus)
> > +{
> > +       return PCI_PROBE_DEVTREE;
> > +}
> > +#endif
> > +
> >   define_machine(pasemi) {
> >       .name            = "PA Semi PWRficient",
> >       .probe            = pas_probe,
> > @@ -445,4 +550,7 @@ define_machine(pasemi) {
> >       .calibrate_decr        = generic_calibrate_decr,
> >       .progress        = pas_progress,
> >       .machine_check_exception = pas_machine_check_handler,
> > +#if 0 // def CONFIG_PPC_PASEMI_SB600
> > +       .pci_probe_mode = sb600_pci_probe_mode,
> > +#endif
> >   };
> > diff -rupN linux-4.1/arch/powerpc/sysdev/i8259.c
> > linux-4.1-nemo/arch/powerpc/sysdev/i8259.c
> > --- linux-4.1/arch/powerpc/sysdev/i8259.c    2015-06-22
> > 03:47:02.064778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/sysdev/i8259.c    2015-06-22
> > 03:27:29.631650275 +0200
> > @@ -103,11 +103,11 @@ static void i8259_set_irq_mask(int irq_n
> >       outb(cached_21,0x21);
> >   }
> >
> > -static void i8259_mask_irq(struct irq_data *d)
> > +void i8259_mask_irq(struct irq_data *d)
> >   {
> >       unsigned long flags;
> >
> > -    pr_debug("i8259_mask_irq(%d)\n", d->irq);
> > +    printk("i8259_mask_irq(%d)\n", d->irq);
> >
> >       raw_spin_lock_irqsave(&i8259_lock, flags);
> >       if (d->irq < 8)
> > @@ -118,11 +118,11 @@ static void i8259_mask_irq(struct irq_da
> >       raw_spin_unlock_irqrestore(&i8259_lock, flags);
> >   }
> >
> > -static void i8259_unmask_irq(struct irq_data *d)
> > +void i8259_unmask_irq(struct irq_data *d)
> >   {
> >       unsigned long flags;
> >
> > -    pr_debug("i8259_unmask_irq(%d)\n", d->irq);
> > +    printk("i8259_unmask_irq(%d)\n", d->irq);
> >
> >       raw_spin_lock_irqsave(&i8259_lock, flags);
> >       if (d->irq < 8)
> > @@ -229,6 +229,8 @@ void i8259_init(struct device_node *node
> >       /* initialize the controller */
> >       raw_spin_lock_irqsave(&i8259_lock, flags);
> >
> > +    printk("About to write to i8259\n");
> > +
> >       /* Mask all first */
> >       outb(0xff, 0xA1);
> >       outb(0xff, 0x21);
> > @@ -259,8 +261,12 @@ void i8259_init(struct device_node *node
> >       outb(cached_A1, 0xA1);
> >       outb(cached_21, 0x21);
> >
> > +    printk("Done write to i8259\n");
> > +
> >       raw_spin_unlock_irqrestore(&i8259_lock, flags);
> >
> > +#ifndef CONFIG_PPC_PASEMI_SB600
> > +
> >       /* create a legacy host */
> >       i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL);
> >       if (i8259_host == NULL) {
> > @@ -268,6 +274,8 @@ void i8259_init(struct device_node *node
> >           return;
> >       }
> >
> > +#endif
> > +
> >       /* reserve our resources */
> >       /* XXX should we continue doing that ? it seems to cause problems
> >        * with further requesting of PCI IO resources for that range...
> > diff -rupN linux-4.1/arch/powerpc/sysdev/mpic.c
> > linux-4.1-nemo/arch/powerpc/sysdev/mpic.c
> > --- linux-4.1/arch/powerpc/sysdev/mpic.c    2015-06-22
> > 03:47:02.067778538 +0200
> > +++ linux-4.1-nemo/arch/powerpc/sysdev/mpic.c    2015-06-22
> > 03:27:29.634650287 +0200
> > @@ -661,6 +661,56 @@ static inline void mpic_eoi(struct mpic
> >    * Linux descriptor level callbacks
> >    */
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +
> > +static int sb600_vector_to_irq(unsigned vector)
> > +{
> > +       switch(vector) {
> > +       case 212: return 9;
> > +       case 213: return 10;
> > +       case 214: return 11;
> > +       case 215: return 12;
> > +       case 216: return 3;
> > +       case 217: return 4;
> > +       case 218: return 5;
> > +       case 219: return 6;
> > +       case 220: return 7;
> > +       case 221: return 14;
> > +       case 222: return 8;
> > +       default: return -1;
> > +       }
> > +}
> > +
> > +extern void i8259_mask_irq(struct irq_data *d);
> > +extern void i8259_unmask_irq(struct irq_data *d);
> > +
> > +int sb600_unmask_irq(unsigned irq)
> > +{
> > +       int vector = sb600_vector_to_irq(irq);
> > +       if (vector >= 0) {
> > +               i8259_unmask_irq(irq_get_irq_data(vector));
> > +               return 1;
> > +       } else
> > +               return 0;
> > +}
> > +
> > +int sb600_mask_irq(unsigned irq)
> > +{
> > +       int vector = sb600_vector_to_irq(irq);
> > +       if (vector >= 0) {
> > +               i8259_mask_irq(irq_get_irq_data(vector));
> > +               return 1;
> > +       } else
> > +               return 0;
> > +}
> > +
> > +int sb600_end_irq(unsigned irq)
> > +{
> > +       int vector = sb600_vector_to_irq(irq);
> > +       return (vector >= 0);
> > +}
> > +
> > +#endif
> >
> >   void mpic_unmask_irq(struct irq_data *d)
> >   {
> > @@ -668,7 +718,12 @@ void mpic_unmask_irq(struct irq_data *d)
> >       struct mpic *mpic = mpic_from_irq_data(d);
> >       unsigned int src = irqd_to_hwirq(d);
> >
> > -    DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, d->irq,
> > src);
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       if (sb600_unmask_irq(src))
> > +               return;
> > +#endif
> > +
> > +       DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq,
> > src);
> >
> >       mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
> >                  mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) &
> > @@ -689,7 +744,12 @@ void mpic_mask_irq(struct irq_data *d)
> >       struct mpic *mpic = mpic_from_irq_data(d);
> >       unsigned int src = irqd_to_hwirq(d);
> >
> > -    DBG("%s: disable_irq: %d (src %d)\n", mpic->name, d->irq, src);
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       if (sb600_mask_irq(src))
> > +               return;
> > +#endif
> > +
> > +       DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);
> >
> >       mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
> >                  mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) |
> > @@ -709,6 +769,14 @@ void mpic_end_irq(struct irq_data *d)
> >   {
> >       struct mpic *mpic = mpic_from_irq_data(d);
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       unsigned int src = irqd_to_hwirq(d);
> > +
> > +       if (src >= 212 && src <= 222)
> > +               return;
> > +#endif
> > +
> > +
> >   #ifdef DEBUG_IRQ
> >       DBG("%s: end_irq: %d\n", mpic->name, d->irq);
> >   #endif
> > diff -rupN linux-4.1/drivers/ata/libata-sff.c
> > linux-4.1-nemo/drivers/ata/libata-sff.c
> > --- linux-4.1/drivers/ata/libata-sff.c    2015-06-22 03:47:03.376778537
> > +0200
> > +++ linux-4.1-nemo/drivers/ata/libata-sff.c    2015-06-22
> > 03:27:29.646650335 +0200
> > @@ -2438,9 +2438,9 @@ int ata_pci_sff_activate_host(struct ata
> >       if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
> >           u8 tmp8, mask;
> >
> > -        /* TODO: What if one channel is in native mode ... */
> > +        /* Don't look at dummy ports in the mask */
> >           pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
> > -        mask = (1 << 2) | (1 << 0);
> > +        mask = (! ata_port_is_dummy(host->ports[1]) << 2) | (!
> > ata_port_is_dummy(host->ports[0]) << 0);
> >           if ((tmp8 & mask) != mask)
> >               legacy_mode = 1;
> >       }
> > diff -rupN linux-4.1/drivers/ata/pata_atiixp.c
> > linux-4.1-nemo/drivers/ata/pata_atiixp.c
> > --- linux-4.1/drivers/ata/pata_atiixp.c    2015-06-22 03:47:03.384778537
> > +0200
> > +++ linux-4.1-nemo/drivers/ata/pata_atiixp.c    2015-06-22
> > 03:27:29.649650347 +0200
> > @@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_de
> >       };
> >       const struct ata_port_info *ppi[] = { &info, &info };
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       // Second port not wired on SB600, and config bit cannot be set
> > by BIOS
> > +       ppi[1] = &ata_dummy_port_info;
> > +#endif
> > +
> >       return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
> >                         ATA_HOST_PARALLEL_SCAN);
> >   }
> > diff -rupN linux-4.1/drivers/ata/pata_of_platform.c
> > linux-4.1-nemo/drivers/ata/pata_of_platform.c
> > --- linux-4.1/drivers/ata/pata_of_platform.c    2015-06-22
> > 03:47:03.400778537 +0200
> > +++ linux-4.1-nemo/drivers/ata/pata_of_platform.c    2015-06-22
> > 03:27:29.653650363 +0200
> > @@ -41,14 +41,36 @@ static int pata_of_platform_probe(struct
> >           return -EINVAL;
> >       }
> >
> > -    ret = of_address_to_resource(dn, 1, &ctl_res);
> > -    if (ret) {
> > -        dev_err(&ofdev->dev, "can't get CTL address from "
> > -            "device tree\n");
> > -        return -EINVAL;
> > +    if (of_device_is_compatible(dn, "electra-ide")) {
> > +        /* Altstatus is really at offset 0x3f6 from the primary window
> > +         * on electra-ide. Adjust ctl_res and io_res accordingly.
> > +         */
> > +        ctl_res = io_res;
> > +        ctl_res.start = ctl_res.start+0x3f6;
> > +        io_res.end = ctl_res.start-1;
> > +
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       } else if (of_device_is_compatible(dn, "electra-cf")) {
> > +               /* Task regs are at 0x800, with alt status @ 0x80e in
> > the primary window
> > +                * on electra-cf. Adjust ctl_res and io_res accordingly.
> > +                */
> > +               ctl_res = io_res;
> > +               io_res.start += 0x800;
> > +               ctl_res.start = ctl_res.start + 0x80e;
> > +               io_res.end = ctl_res.start-1;
> > +#endif
> > +    } else {
> > +        ret = of_address_to_resource(dn, 1, &ctl_res);
> > +        if (ret) {
> > +            dev_err(&ofdev->dev, "can't get CTL address from "
> > +                "device tree\n");
> > +            return -EINVAL;
> > +        }
> >       }
> >
> >       irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
> > +    if (irq_res)
> > +        irq_res->flags = 0;
> >
> >       prop = of_get_property(dn, "reg-shift", NULL);
> >       if (prop)
> > @@ -65,6 +87,11 @@ static int pata_of_platform_probe(struct
> >           dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0\n");
> >       }
> >
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       irq_res = 0;                    // force irq off (doesn't seem
> > to work)
> > +#endif
> > +
> > +
> >       pio_mask = 1 << pio_mode;
> >       pio_mask |= (1 << pio_mode) - 1;
> >
> > @@ -74,7 +101,11 @@ static int pata_of_platform_probe(struct
> >
> >   static struct of_device_id pata_of_platform_match[] = {
> >       { .compatible = "ata-generic", },
> > -    { },
> > +    { .compatible = "electra-ide", },
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       { .compatible = "electra-cf",},
> > +#endif
> > +    {},
> >   };
> >   MODULE_DEVICE_TABLE(of, pata_of_platform_match);
> >
> > diff -rupN linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c
> > linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c
> > --- linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22
> > 03:47:04.600778536 +0200
> > +++ linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22
> > 03:27:29.675650448 +0200
> > @@ -226,7 +226,10 @@ static void radeon_set_power_state(struc
> >           /* set memory clock */
> >           if (rdev->asic->pm.set_memory_clock && (mclk !=
> > rdev->pm.current_mclk)) {
> >               radeon_pm_debug_check_in_vbl(rdev, false);
> > +               /* D.Stevens 2012 for the A-EON AmigaOne X1000: Setting
> > memory clock only works on CAICOS and 6570, don't set for anything else
> > (We ignore 6570 here */
> > +               if (rdev->family == CHIP_CAICOS) {
> >               radeon_set_memory_clock(rdev, mclk);
> > +               }
> >               radeon_pm_debug_check_in_vbl(rdev, true);
> >               rdev->pm.current_mclk = mclk;
> >               DRM_DEBUG_DRIVER("Setting: m: %d\n", mclk);
> > @@ -1220,7 +1223,7 @@ static void radeon_pm_resume_old(struct
> >                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
> >           if (rdev->pm.default_sclk)
> >               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
> > -        if (rdev->pm.default_mclk)
> > +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
> > /* Fix for PPC systems HD6000 >6570 by A-EON Core Linux Support Team */
> >               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
> >       }
> >       /* asic init will reset the default power state */
> > @@ -1271,7 +1274,7 @@ dpm_resume_fail:
> >                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
> >           if (rdev->pm.default_sclk)
> >               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
> > -        if (rdev->pm.default_mclk)
> > +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
> > /* Fix for PPC & > HD6570 by A-EON Linux Core Support Team */
> >               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
> >       }
> >   }
> > @@ -1318,7 +1321,7 @@ static int radeon_pm_init_old(struct rad
> >                               SET_VOLTAGE_TYPE_ASIC_VDDCI);
> >               if (rdev->pm.default_sclk)
> >                   radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
> > -            if (rdev->pm.default_mclk)
> > +            if (rdev->pm.default_mclk && (rdev->family ==
> > CHIP_CAICOS))     // D.Stevens 2013: fix for >HD6570 on PPC
> >                   radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
> >           }
> >       }
> > @@ -1431,7 +1434,7 @@ dpm_failed:
> >                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
> >           if (rdev->pm.default_sclk)
> >               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
> > -        if (rdev->pm.default_mclk)
> > +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))  //
> > D.Stevens 2013: Fix for >HD6570 on ppc
> >               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
> >       }
> >       DRM_ERROR("radeon: dpm initialization failed\n");
> > diff -rupN linux-4.1/drivers/pci/pci.c linux-4.1-nemo/drivers/pci/pci.c
> > --- linux-4.1/drivers/pci/pci.c    2015-06-22 03:47:08.817778536 +0200
> > +++ linux-4.1-nemo/drivers/pci/pci.c    2015-06-22 03:27:29.717650601 +0200
> > @@ -421,7 +421,16 @@ struct resource *pci_find_parent_resourc
> >       pci_bus_for_each_resource(bus, r, i) {
> >           if (!r)
> >               continue;
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +    /* The new code here checks for resources that are not allocated,
> > and no longer
> > +     * returns these, however the SB600 code uses this feature to
> > allocate IO ranges
> > +     * in the ISA map, and this breaks booting on the AmigaOneX1000.
> > +     * Temporary fix to get the kernel working, remove the resource
> > allocated check.
> > +     */
> > +        if (resource_contains(r, res)) {
> > +#else
> >           if (res->start && resource_contains(r, res)) {
> > +#endif
> >
> >               /*
> >                * If the window is prefetchable but the BAR is
> > diff -rupN linux-4.1/drivers/pci/probe.c linux-4.1-nemo/drivers/pci/probe.c
> > --- linux-4.1/drivers/pci/probe.c    2015-06-22 03:47:08.824778536 +0200
> > +++ linux-4.1-nemo/drivers/pci/probe.c    2015-06-22 03:27:29.720650613
> > +0200
> > @@ -363,7 +363,11 @@ static void pci_read_bridge_io(struct pc
> >           limit |= ((unsigned long) io_limit_hi << 16);
> >       }
> >
> > -    if (base <= limit) {
> > +       if (base <= limit
> > +       #ifdef CONFIG_PPC_PASEMI_SB600
> > +               || child->busn_res.start == 5
> > +       #endif
> > +              ) {
> >           res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) |
> > IORESOURCE_IO;
> >           region.start = base;
> >           region.end = limit + io_granularity - 1;
> > @@ -1609,11 +1613,14 @@ static int only_one_child(struct pci_bus
> >
> >       if (!parent || !pci_is_pcie(parent))
> >           return 0;
> > +       #ifndef CONFIG_PPC_PASEMI_SB600
> > +       // SB600 has non-zero devices on non-root bus.
> >       if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
> >           return 1;
> >       if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM &&
> >           !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
> >           return 1;
> > +    #endif
> >       return 0;
> >   }
> >
> > diff -rupN linux-4.1/drivers/rtc/rtc-cmos.c
> > linux-4.1-nemo/drivers/rtc/rtc-cmos.c
> > --- linux-4.1/drivers/rtc/rtc-cmos.c    2015-06-22 03:47:09.156778536 +0200
> > +++ linux-4.1-nemo/drivers/rtc/rtc-cmos.c    2015-06-22
> > 03:27:29.742650701 +0200
> > @@ -242,6 +242,13 @@ static int cmos_read_alarm(struct device
> >       }
> >
> >       rtc_control = CMOS_READ(RTC_CONTROL);
> > +
> > +#ifdef CONFIG_PPC_PASEMI_SB600
> > +       // Nemo BIOS does not init RTC
> > +       rtc_control = rtc_control | RTC_24H;
> > +       CMOS_WRITE(rtc_control, RTC_CONTROL);
> > +#endif
> > +
> >       spin_unlock_irq(&rtc_lock);
> >
> >       if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
> > diff -rupN linux-4.1/sound/pci/hda/patch_sigmatel.c
> > linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c
> > --- linux-4.1/sound/pci/hda/patch_sigmatel.c    2015-06-22
> > 03:47:15.039778536 +0200
> > +++ linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c    2015-06-22
> > 03:27:29.768650804 +0200
> > @@ -166,6 +166,7 @@ enum {
> >       STAC_D965_VERBS,
> >       STAC_DELL_3ST,
> >       STAC_DELL_BIOS,
> > +    STAC_NEMO_DEFAULT,
> >       STAC_DELL_BIOS_AMIC,
> >       STAC_DELL_BIOS_SPDIF,
> >       STAC_927X_DELL_DMIC,
> > @@ -1359,6 +1360,23 @@ static const struct hda_pintbl oqo9200_p
> >       {}
> >   };
> >
> > +static const struct hda_pintbl nemo_pin_configs[] = {
> > +   { 0x0a, 0x02214020 },
> > +   { 0x0b, 0x02A19080 },
> > +   { 0x0c, 0x0181304E },
> > +   { 0x0d, 0x01014010 },
> > +   { 0x0e, 0x01A19040 },
> > +   { 0x0f, 0x01011012 },
> > +   { 0x10, 0x01016011 },
> > +   { 0x11, 0x01012014 },
> > +   { 0x12, 0x103301F0 },
> > +   { 0x13, 0x00000000 },
> > +   { 0x14, 0x00000000 },
> > +   { 0x21, 0x01442170 },
> > +   { 0x22, 0x00000000 },
> > +   { 0x23, 0x00000000 },
> > +   {}
> > +};
> >
> >   static void stac9200_fixup_panasonic(struct hda_codec *codec,
> >                        const struct hda_fixup *fix, int action)
> > @@ -3868,6 +3886,10 @@ static const struct hda_fixup stac927x_f
> >           .type = HDA_FIXUP_PINS,
> >           .v.pins = d965_5st_no_fp_pin_configs,
> >       },
> > +    [STAC_NEMO_DEFAULT] = {
> > +               .type = HDA_FIXUP_PINS,
> > +        .v.pins = nemo_pin_configs,
> > +    },
> >       [STAC_DELL_3ST] = {
> >           .type = HDA_FIXUP_PINS,
> >           .v.pins = dell_3st_pin_configs,
> > @@ -3924,6 +3946,7 @@ static const struct hda_model_fixup stac
> >       { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
> >       { .id = STAC_DELL_3ST, .name = "dell-3stack" },
> >       { .id = STAC_DELL_BIOS, .name = "dell-bios" },
> > +    { .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },
> >       { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
> >       { .id = STAC_927X_VOLKNOB, .name = "volknob" },
> >       {}
> > @@ -3962,6 +3985,8 @@ static const struct snd_pci_quirk stac92
> >                  "Intel D965", STAC_D965_5ST),
> >       SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
> >                  "Intel D965", STAC_D965_5ST),
> > +    /* Nemo */
> > +    SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000", STAC_NEMO_DEFAULT),
> >       /* volume-knob fixes */
> >       SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
> >       {} /* terminator */
> > @@ -5035,6 +5060,7 @@ static const struct hda_codec_preset snd
> >        { .id = 0x83847683, .name = "STAC9221D A2", .patch =
> > patch_stac922x },
> >        { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
> >        { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
> > +    { .id = 0x83847638, .name = "STAC92HD700", .patch = patch_stac927x },
> >        { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
> >        { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
> >        { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/linuxppc-dev
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore
  2015-07-13  6:47                     ` Benjamin Herrenschmidt
@ 2015-07-13  9:33                       ` Denis Kirjanov
  0 siblings, 0 replies; 29+ messages in thread
From: Denis Kirjanov @ 2015-07-13  9:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Christian Zigotzky, linuxppc-dev

On 7/13/15, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Thu, 2015-07-09 at 12:52 +0300, Denis Kirjanov wrote:
>> On 7/9/15, Christian Zigotzky <chzigotzky@xenosoft.de> wrote:
>> > All
>> >
>> > I think you haven't received the SB600 patch yet. I have pasted it in
>> > this email directly. Thank you for your help. I am sorry because of
>> > this
>> > long patch but I hope you could help me a bit.
>>
>> But the first thing then is to upstream the sb600 patch...
>
> Well, the patch is gross ... That stuff needs to be mostly re-written,
> randomly ifdef'ing things around isn't going to fly. There are also
> some mentions of FW issues, can this be fixed in FW ?

A good question. Unfortunately, I don't have the PA6T (
>
> Ben.
>
>> >
>> > Thanks
>> >
>> > Christian
>> >
>> > ------------- nemo_4.1-3.patch -------------
>> >
>> > diff -rupN linux-4.1/arch/powerpc/kernel/head_64.S
>> > linux-4.1-nemo/arch/powerpc/kernel/head_64.S
>> > --- linux-4.1/arch/powerpc/kernel/head_64.S    2015-06-22
>> > 03:47:01.850778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/kernel/head_64.S    2015-06-22
>> > 03:27:29.590650112 +0200
>> > @@ -70,6 +70,13 @@ _GLOBAL(__start)
>> >       /* NOP this out unconditionally */
>> >   BEGIN_FTR_SECTION
>> >       FIXUP_ENDIAN
>> > +/* Hack for PWRficient platforms: Due to CFE(?) bug, the 64-bit
>> > + * word at 0x8 needs to be set to 0. Patch it up here once we're
>> > + * done executing it (we can be lazy and avoid invalidating
>> > + * icache)
>> > + */
>> > +li     r0,0
>> > +std    0,8(0)
>> >       b    __start_initialization_multiplatform
>> >   END_FTR_SECTION(0, 1)
>> >
>> > diff -rupN linux-4.1/arch/powerpc/kernel/pci-common.c
>> > linux-4.1-nemo/arch/powerpc/kernel/pci-common.c
>> > --- linux-4.1/arch/powerpc/kernel/pci-common.c    2015-06-22
>> > 03:47:01.866778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/kernel/pci-common.c    2015-06-22
>> > 03:27:29.603650164 +0200
>> > @@ -721,6 +721,19 @@ void pci_process_bridge_OF_ranges(struct
>> >                   isa_io_base =
>> >                       (unsigned long)hose->io_base_virt;
>> >   #endif /* CONFIG_PPC32 */
>> > +
>> > +
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +                       /* Workaround for lack of device tree. New for
>> > kernel 3.17: range.cpu_addr instead of cpu_addr and range.size instead
>> > of size Ch. Zigotzky */
>> > +                       if (primary) {
>> > +                               __ioremap_at(range.cpu_addr, (void
>> > *)ISA_IO_BASE,
>> > +                               range.size,
>> > _PAGE_NO_CACHE|_PAGE_GUARDED);
>> > +                       hose->io_base_virt = (void *)_IO_BASE;
>> > +               /* _IO_BASE needs unsigned long long for the kernel
>> > 3.17
>> > Ch. Zigotzky */
>> > +                       printk("Initialised io_base_virt 0x%lx _IO_BASE
>> > 0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long
>> > long)_IO_BASE);
>> > +                    }
>> > +#endif
>> > +
>> >               /* pci_io_size and io_base_phys always represent IO
>> >                * space starting at 0 so we factor in pci_addr
>> >                */
>> > @@ -1194,6 +1207,7 @@ static void pcibios_allocate_bus_resourc
>> >                   &ioport_resource : &iomem_resource;
>> >           else {
>> >               pr = pci_find_parent_resource(bus->self, res);
>> > +#ifndef CONFIG_PPC_PASEMI_SB600
>> >               if (pr == res) {
>> >                   /* this happens when the generic PCI
>> >                    * code (wrongly) decides that this
>> > @@ -1201,6 +1215,7 @@ static void pcibios_allocate_bus_resourc
>> >                    */
>> >                   continue;
>> >               }
>> > +#endif
>> >           }
>> >
>> >           pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx "
>> > @@ -1632,8 +1647,9 @@ void pcibios_scan_phb(struct pci_control
>> >       pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
>> >
>> >       /* Get some IO space for the new PHB */
>> > +#ifndef CONFIG_PPC_PASEMI_SB600
>> >       pcibios_setup_phb_io_space(hose);
>> > -
>> > +#endif
>> >       /* Wire up PHB bus resources */
>> >       pcibios_setup_phb_resources(hose, &resources);
>> >
>> > diff -rupN linux-4.1/arch/powerpc/kernel/setup-common.c
>> > linux-4.1-nemo/arch/powerpc/kernel/setup-common.c
>> > --- linux-4.1/arch/powerpc/kernel/setup-common.c    2015-06-22
>> > 03:47:01.879778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/kernel/setup-common.c    2015-06-22
>> > 03:27:29.605650172 +0200
>> > @@ -76,7 +76,15 @@ EXPORT_SYMBOL(ppc_md);
>> >   struct machdep_calls *machine_id;
>> >   EXPORT_SYMBOL(machine_id);
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +/* FIXME!!
>> > + * Current PASemi code does not correctly update the value of
>> > boot_cpuid
>> > + * As a temporary fix we use the default 0, which is known to work
>> > + */
>> > +int boot_cpuid = 0;
>> > +#else
>> >   int boot_cpuid = -1;
>> > +#endif
>> >   EXPORT_SYMBOL_GPL(boot_cpuid);
>> >
>> >   unsigned long klimit = (unsigned long) _end;
>> > diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/iommu.c
>> > linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c
>> > --- linux-4.1/arch/powerpc/platforms/pasemi/iommu.c    2015-06-22
>> > 03:47:02.018778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/iommu.c 2015-06-22
>> > 03:27:29.611650196 +0200
>> > @@ -1,3 +1,9 @@
>> > +/* This is a modified copy of
>> > +* usr/src/linux-2.6.39.4/arch/powerpc/platforms/pasemi/iommu.c
>> > +* The mod is on line 150
>> > +* By Len Karpowicz <twotat2z@embarqmail.com
>> > +*/
>> > +
>> >   /*
>> >    * Copyright (C) 2005-2008, PA Semi, Inc
>> >    *
>> > @@ -143,8 +149,11 @@ static void iommu_table_iobmap_setup(voi
>> >       iommu_table_iobmap.it_page_shift = IOBMAP_PAGE_SHIFT;
>> >
>> >       /* it_size is in number of entries */
>> > -    iommu_table_iobmap.it_size =
>> > -        0x80000000 >> iommu_table_iobmap.it_page_shift;
>> > +
>> > +/* Note: changed 0x80000000 to 0x7FFFFFFF for SBLive! SB0220 */
>> > +/* out of range problem on A-EON AmigaOne X1000 */
>> > +       iommu_table_iobmap.it_size = 0x7FFFFFFF >> IOBMAP_PAGE_SHIFT;
>> > +
>> >
>> >       /* Initialize the common IOMMU code */
>> >       iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
>> > diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/Kconfig
>> > linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig
>> > --- linux-4.1/arch/powerpc/platforms/pasemi/Kconfig    2015-06-22
>> > 03:47:02.017778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/Kconfig 2015-06-22
>> > 03:27:29.620650232 +0200
>> > @@ -14,6 +14,13 @@ config PPC_PASEMI
>> >   menu "PA Semi PWRficient options"
>> >       depends on PPC_PASEMI
>> >
>> > +config PPC_PASEMI_SB600
>> > +       bool "Nemo SB600 South Bridge Support"
>> > +       depends on PPC_PASEMI
>> > +       select PPC_I8259
>> > +       help
>> > +       Workarounds for the SB600 South Bridge.
>> > +
>> >   config PPC_PASEMI_IOMMU
>> >       bool "PA Semi IOMMU support"
>> >       depends on PPC_PASEMI
>> > diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/pci.c
>> > linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c
>> > --- linux-4.1/arch/powerpc/platforms/pasemi/pci.c    2015-06-22
>> > 03:47:02.019778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/pci.c    2015-06-22
>> > 03:27:29.621650236 +0200
>> > @@ -108,6 +108,69 @@ static int workaround_5945(struct pci_bu
>> >       return 1;
>> >   }
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +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, &val);
>> > +
>> > +               sb600_bus = val;
>> > +
>> > +               printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
>> > +       }
>> > +
>> > +       if (iob_mapbase == NULL)
>> > +       {
>> > +        dn = of_find_compatible_node(NULL, "io-bridge",
>> > "pasemi,1682m-iob");
>> > +        if (!dn)
>> > +        {
>> > +               printk(KERN_CRIT "NEMO SB600 missing iob node\n");
>> > +                       return;
>> > +               }
>> > +
>> > +               err = of_address_to_resource(dn, 0, &res);
>> > +        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 +189,10 @@ static int pa_pxp_read_config(struct pci
>> >
>> >       addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       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.
>> > diff -rupN linux-4.1/arch/powerpc/platforms/pasemi/setup.c
>> > linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c
>> > --- linux-4.1/arch/powerpc/platforms/pasemi/setup.c    2015-06-22
>> > 03:47:02.019778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/platforms/pasemi/setup.c 2015-06-22
>> > 03:27:29.623650244 +0200
>> > @@ -34,6 +34,7 @@
>> >   #include <asm/prom.h>
>> >   #include <asm/iommu.h>
>> >   #include <asm/machdep.h>
>> > +#include <asm/i8259.h>
>> >   #include <asm/mpic.h>
>> >   #include <asm/smp.h>
>> >   #include <asm/time.h>
>> > @@ -72,6 +73,17 @@ static void pas_restart(char *cmd)
>> >           out_le32(reset_reg, 0x6000000);
>> >   }
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +void pas_shutdown(void)
>> > +{
>> > +       /* (added by DStevens 19/06/13)
>> > +          Set the PLD bit that makes the SB600 think the power button
>> > is being pressed */
>> > +       void __iomem *pld_map = ioremap(0xf5000000,4096);
>> > +       while (1)
>> > +               out_8(pld_map+7,0x01);
>> > +}
>> > +#endif
>> > +
>> >   #ifdef CONFIG_SMP
>> >   static arch_spinlock_t timebase_lock;
>> >   static unsigned long timebase;
>> > @@ -183,6 +195,55 @@ static int __init pas_setup_mce_regs(voi
>> >   }
>> >   machine_device_initcall(pasemi, pas_setup_mce_regs);
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +static unsigned sb600_irq_to_vector(int irq)
>> > +{
>> > +       switch(irq) {
>> > +       case 3: return 216;
>> > +       case 4: return 217;
>> > +       case 5: return 218;
>> > +       case 6: return 219;
>> > +       case 7: return 220;
>> > +       case 8: return 222;
>> > +       case 9: return 212;
>> > +       case 10: return 213;
>> > +       case 11: return 214;
>> > +       case 12: return 215;
>> > +       case 14: return 221;
>> > +       default: return 0;
>> > +       }
>> > +}
>> > +
>> > +static void sb600_8259_cascade(unsigned int irq, struct irq_data
>> > *desc)
>> > +{
>> > +       unsigned int cascade_irq = i8259_irq();
>> > +       unsigned vector = sb600_irq_to_vector(cascade_irq);
>> > +       if (vector > 0)
>> > +               generic_handle_irq(vector);
>> > +       outb(0x20, 0xA0);       /* Non-specific EOI */
>> > +       outb(0x20, 0x20);       /* Non-specific EOI to cascade */
>> > +       desc->chip->irq_eoi(desc);
>> > +}
>> > +extern void i8259_unmask_irq(struct irq_data *d);
>> > +
>> > +__init void sb600_8259_init(void)
>> > +{
>> > +       int gpio_virq;
>> > +
>> > +       // Connect legacy i8259 controller in SB600
>> > +       printk("Init i8259\n");
>> > +       i8259_init(NULL, 0);
>> > +
>> > +       gpio_virq = irq_create_mapping(NULL, 3);
>> > +       irq_set_irq_type(gpio_virq, IRQ_TYPE_LEVEL_HIGH);
>> > +       irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
>> > +       mpic_unmask_irq(irq_get_irq_data(gpio_virq));
>> > +
>> > +       // Initial mapping for RTC
>> > +       irq_create_mapping(NULL, 222);
>> > +}
>> > +#endif
>> > +
>> >   static __init void pas_init_IRQ(void)
>> >   {
>> >       struct device_node *np;
>> > @@ -246,6 +307,12 @@ static __init void pas_init_IRQ(void)
>> >
>> >       of_node_put(mpic_node);
>> >       of_node_put(root);
>> > +
>> > +
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       sb600_8259_init();
>> > +#endif
>> > +
>> >   }
>> >
>> >   static void __init pas_progress(char *s, unsigned short hex)
>> > @@ -403,12 +470,39 @@ static const struct of_device_id pasemi_
>> >       {},
>> >   };
>> >
>> > -static int __init pasemi_publish_devices(void)
>> > -{
>> > -    pasemi_pcmcia_init();
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +
>> > +/*
>> > + This should come from OF tree. See sysdev/rtc_cmos_setup for details.
>> > Need to get i8259 supported correctly first, so that
>> > + as the standard support hard-codes IRQ 8.
>> > + */
>> > +
>> > +
>> > +static struct resource rtc_resource[] = {{
>> > +       .name = "rtc",
>> > +       .start = 0x70,
>> > +       .end = 0x71,
>> > +       .flags = IORESOURCE_IO,
>> > +}, {
>> > +       .name = "rtc",
>> > +       .start = 222,
>> > +       .end = 222,
>> > +       .flags = IORESOURCE_IRQ,
>> > +}};
>> > +
>> > +#endif
>> > +
>> > +
>> > + static int __init pasemi_publish_devices(void)
>> > + {
>> > +        pasemi_pcmcia_init();
>> > +
>> > +        /* Publish OF platform devices for SDC and other non-PCI
>> > devices */
>> > +        of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
>> >
>> > -    /* Publish OF platform devices for SDC and other non-PCI devices
>> > */
>> > -    of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       platform_device_register_simple("rtc_cmos", -1, rtc_resource,
>> > 2);
>> > +#endif
>> >
>> >       return 0;
>> >   }
>> > @@ -430,9 +524,20 @@ static int __init pas_probe(void)
>> >
>> >       alloc_iobmap_l2();
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       pm_power_off              = pas_shutdown;         // Varisys
>> > provided a way to turn us off
>> > +#endif
>> >       return 1;
>> >   }
>> >
>> > +
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +static int sb600_pci_probe_mode(struct pci_bus *bus)
>> > +{
>> > +       return PCI_PROBE_DEVTREE;
>> > +}
>> > +#endif
>> > +
>> >   define_machine(pasemi) {
>> >       .name            = "PA Semi PWRficient",
>> >       .probe            = pas_probe,
>> > @@ -445,4 +550,7 @@ define_machine(pasemi) {
>> >       .calibrate_decr        = generic_calibrate_decr,
>> >       .progress        = pas_progress,
>> >       .machine_check_exception = pas_machine_check_handler,
>> > +#if 0 // def CONFIG_PPC_PASEMI_SB600
>> > +       .pci_probe_mode = sb600_pci_probe_mode,
>> > +#endif
>> >   };
>> > diff -rupN linux-4.1/arch/powerpc/sysdev/i8259.c
>> > linux-4.1-nemo/arch/powerpc/sysdev/i8259.c
>> > --- linux-4.1/arch/powerpc/sysdev/i8259.c    2015-06-22
>> > 03:47:02.064778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/sysdev/i8259.c    2015-06-22
>> > 03:27:29.631650275 +0200
>> > @@ -103,11 +103,11 @@ static void i8259_set_irq_mask(int irq_n
>> >       outb(cached_21,0x21);
>> >   }
>> >
>> > -static void i8259_mask_irq(struct irq_data *d)
>> > +void i8259_mask_irq(struct irq_data *d)
>> >   {
>> >       unsigned long flags;
>> >
>> > -    pr_debug("i8259_mask_irq(%d)\n", d->irq);
>> > +    printk("i8259_mask_irq(%d)\n", d->irq);
>> >
>> >       raw_spin_lock_irqsave(&i8259_lock, flags);
>> >       if (d->irq < 8)
>> > @@ -118,11 +118,11 @@ static void i8259_mask_irq(struct irq_da
>> >       raw_spin_unlock_irqrestore(&i8259_lock, flags);
>> >   }
>> >
>> > -static void i8259_unmask_irq(struct irq_data *d)
>> > +void i8259_unmask_irq(struct irq_data *d)
>> >   {
>> >       unsigned long flags;
>> >
>> > -    pr_debug("i8259_unmask_irq(%d)\n", d->irq);
>> > +    printk("i8259_unmask_irq(%d)\n", d->irq);
>> >
>> >       raw_spin_lock_irqsave(&i8259_lock, flags);
>> >       if (d->irq < 8)
>> > @@ -229,6 +229,8 @@ void i8259_init(struct device_node *node
>> >       /* initialize the controller */
>> >       raw_spin_lock_irqsave(&i8259_lock, flags);
>> >
>> > +    printk("About to write to i8259\n");
>> > +
>> >       /* Mask all first */
>> >       outb(0xff, 0xA1);
>> >       outb(0xff, 0x21);
>> > @@ -259,8 +261,12 @@ void i8259_init(struct device_node *node
>> >       outb(cached_A1, 0xA1);
>> >       outb(cached_21, 0x21);
>> >
>> > +    printk("Done write to i8259\n");
>> > +
>> >       raw_spin_unlock_irqrestore(&i8259_lock, flags);
>> >
>> > +#ifndef CONFIG_PPC_PASEMI_SB600
>> > +
>> >       /* create a legacy host */
>> >       i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops,
>> > NULL);
>> >       if (i8259_host == NULL) {
>> > @@ -268,6 +274,8 @@ void i8259_init(struct device_node *node
>> >           return;
>> >       }
>> >
>> > +#endif
>> > +
>> >       /* reserve our resources */
>> >       /* XXX should we continue doing that ? it seems to cause problems
>> >        * with further requesting of PCI IO resources for that range...
>> > diff -rupN linux-4.1/arch/powerpc/sysdev/mpic.c
>> > linux-4.1-nemo/arch/powerpc/sysdev/mpic.c
>> > --- linux-4.1/arch/powerpc/sysdev/mpic.c    2015-06-22
>> > 03:47:02.067778538 +0200
>> > +++ linux-4.1-nemo/arch/powerpc/sysdev/mpic.c    2015-06-22
>> > 03:27:29.634650287 +0200
>> > @@ -661,6 +661,56 @@ static inline void mpic_eoi(struct mpic
>> >    * Linux descriptor level callbacks
>> >    */
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +
>> > +static int sb600_vector_to_irq(unsigned vector)
>> > +{
>> > +       switch(vector) {
>> > +       case 212: return 9;
>> > +       case 213: return 10;
>> > +       case 214: return 11;
>> > +       case 215: return 12;
>> > +       case 216: return 3;
>> > +       case 217: return 4;
>> > +       case 218: return 5;
>> > +       case 219: return 6;
>> > +       case 220: return 7;
>> > +       case 221: return 14;
>> > +       case 222: return 8;
>> > +       default: return -1;
>> > +       }
>> > +}
>> > +
>> > +extern void i8259_mask_irq(struct irq_data *d);
>> > +extern void i8259_unmask_irq(struct irq_data *d);
>> > +
>> > +int sb600_unmask_irq(unsigned irq)
>> > +{
>> > +       int vector = sb600_vector_to_irq(irq);
>> > +       if (vector >= 0) {
>> > +               i8259_unmask_irq(irq_get_irq_data(vector));
>> > +               return 1;
>> > +       } else
>> > +               return 0;
>> > +}
>> > +
>> > +int sb600_mask_irq(unsigned irq)
>> > +{
>> > +       int vector = sb600_vector_to_irq(irq);
>> > +       if (vector >= 0) {
>> > +               i8259_mask_irq(irq_get_irq_data(vector));
>> > +               return 1;
>> > +       } else
>> > +               return 0;
>> > +}
>> > +
>> > +int sb600_end_irq(unsigned irq)
>> > +{
>> > +       int vector = sb600_vector_to_irq(irq);
>> > +       return (vector >= 0);
>> > +}
>> > +
>> > +#endif
>> >
>> >   void mpic_unmask_irq(struct irq_data *d)
>> >   {
>> > @@ -668,7 +718,12 @@ void mpic_unmask_irq(struct irq_data *d)
>> >       struct mpic *mpic = mpic_from_irq_data(d);
>> >       unsigned int src = irqd_to_hwirq(d);
>> >
>> > -    DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, d->irq,
>> > src);
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       if (sb600_unmask_irq(src))
>> > +               return;
>> > +#endif
>> > +
>> > +       DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq,
>> > src);
>> >
>> >       mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
>> >                  mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) &
>> > @@ -689,7 +744,12 @@ void mpic_mask_irq(struct irq_data *d)
>> >       struct mpic *mpic = mpic_from_irq_data(d);
>> >       unsigned int src = irqd_to_hwirq(d);
>> >
>> > -    DBG("%s: disable_irq: %d (src %d)\n", mpic->name, d->irq, src);
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       if (sb600_mask_irq(src))
>> > +               return;
>> > +#endif
>> > +
>> > +       DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);
>> >
>> >       mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
>> >                  mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) |
>> > @@ -709,6 +769,14 @@ void mpic_end_irq(struct irq_data *d)
>> >   {
>> >       struct mpic *mpic = mpic_from_irq_data(d);
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       unsigned int src = irqd_to_hwirq(d);
>> > +
>> > +       if (src >= 212 && src <= 222)
>> > +               return;
>> > +#endif
>> > +
>> > +
>> >   #ifdef DEBUG_IRQ
>> >       DBG("%s: end_irq: %d\n", mpic->name, d->irq);
>> >   #endif
>> > diff -rupN linux-4.1/drivers/ata/libata-sff.c
>> > linux-4.1-nemo/drivers/ata/libata-sff.c
>> > --- linux-4.1/drivers/ata/libata-sff.c    2015-06-22 03:47:03.376778537
>> > +0200
>> > +++ linux-4.1-nemo/drivers/ata/libata-sff.c    2015-06-22
>> > 03:27:29.646650335 +0200
>> > @@ -2438,9 +2438,9 @@ int ata_pci_sff_activate_host(struct ata
>> >       if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
>> >           u8 tmp8, mask;
>> >
>> > -        /* TODO: What if one channel is in native mode ... */
>> > +        /* Don't look at dummy ports in the mask */
>> >           pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
>> > -        mask = (1 << 2) | (1 << 0);
>> > +        mask = (! ata_port_is_dummy(host->ports[1]) << 2) | (!
>> > ata_port_is_dummy(host->ports[0]) << 0);
>> >           if ((tmp8 & mask) != mask)
>> >               legacy_mode = 1;
>> >       }
>> > diff -rupN linux-4.1/drivers/ata/pata_atiixp.c
>> > linux-4.1-nemo/drivers/ata/pata_atiixp.c
>> > --- linux-4.1/drivers/ata/pata_atiixp.c    2015-06-22
>> > 03:47:03.384778537
>> > +0200
>> > +++ linux-4.1-nemo/drivers/ata/pata_atiixp.c    2015-06-22
>> > 03:27:29.649650347 +0200
>> > @@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_de
>> >       };
>> >       const struct ata_port_info *ppi[] = { &info, &info };
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       // Second port not wired on SB600, and config bit cannot be set
>> > by BIOS
>> > +       ppi[1] = &ata_dummy_port_info;
>> > +#endif
>> > +
>> >       return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
>> >                         ATA_HOST_PARALLEL_SCAN);
>> >   }
>> > diff -rupN linux-4.1/drivers/ata/pata_of_platform.c
>> > linux-4.1-nemo/drivers/ata/pata_of_platform.c
>> > --- linux-4.1/drivers/ata/pata_of_platform.c    2015-06-22
>> > 03:47:03.400778537 +0200
>> > +++ linux-4.1-nemo/drivers/ata/pata_of_platform.c    2015-06-22
>> > 03:27:29.653650363 +0200
>> > @@ -41,14 +41,36 @@ static int pata_of_platform_probe(struct
>> >           return -EINVAL;
>> >       }
>> >
>> > -    ret = of_address_to_resource(dn, 1, &ctl_res);
>> > -    if (ret) {
>> > -        dev_err(&ofdev->dev, "can't get CTL address from "
>> > -            "device tree\n");
>> > -        return -EINVAL;
>> > +    if (of_device_is_compatible(dn, "electra-ide")) {
>> > +        /* Altstatus is really at offset 0x3f6 from the primary window
>> > +         * on electra-ide. Adjust ctl_res and io_res accordingly.
>> > +         */
>> > +        ctl_res = io_res;
>> > +        ctl_res.start = ctl_res.start+0x3f6;
>> > +        io_res.end = ctl_res.start-1;
>> > +
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       } else if (of_device_is_compatible(dn, "electra-cf")) {
>> > +               /* Task regs are at 0x800, with alt status @ 0x80e in
>> > the primary window
>> > +                * on electra-cf. Adjust ctl_res and io_res
>> > accordingly.
>> > +                */
>> > +               ctl_res = io_res;
>> > +               io_res.start += 0x800;
>> > +               ctl_res.start = ctl_res.start + 0x80e;
>> > +               io_res.end = ctl_res.start-1;
>> > +#endif
>> > +    } else {
>> > +        ret = of_address_to_resource(dn, 1, &ctl_res);
>> > +        if (ret) {
>> > +            dev_err(&ofdev->dev, "can't get CTL address from "
>> > +                "device tree\n");
>> > +            return -EINVAL;
>> > +        }
>> >       }
>> >
>> >       irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
>> > +    if (irq_res)
>> > +        irq_res->flags = 0;
>> >
>> >       prop = of_get_property(dn, "reg-shift", NULL);
>> >       if (prop)
>> > @@ -65,6 +87,11 @@ static int pata_of_platform_probe(struct
>> >           dev_info(&ofdev->dev, "pio-mode unspecified, assuming
>> > PIO0\n");
>> >       }
>> >
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       irq_res = 0;                    // force irq off (doesn't seem
>> > to work)
>> > +#endif
>> > +
>> > +
>> >       pio_mask = 1 << pio_mode;
>> >       pio_mask |= (1 << pio_mode) - 1;
>> >
>> > @@ -74,7 +101,11 @@ static int pata_of_platform_probe(struct
>> >
>> >   static struct of_device_id pata_of_platform_match[] = {
>> >       { .compatible = "ata-generic", },
>> > -    { },
>> > +    { .compatible = "electra-ide", },
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       { .compatible = "electra-cf",},
>> > +#endif
>> > +    {},
>> >   };
>> >   MODULE_DEVICE_TABLE(of, pata_of_platform_match);
>> >
>> > diff -rupN linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c
>> > linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c
>> > --- linux-4.1/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22
>> > 03:47:04.600778536 +0200
>> > +++ linux-4.1-nemo/drivers/gpu/drm/radeon/radeon_pm.c    2015-06-22
>> > 03:27:29.675650448 +0200
>> > @@ -226,7 +226,10 @@ static void radeon_set_power_state(struc
>> >           /* set memory clock */
>> >           if (rdev->asic->pm.set_memory_clock && (mclk !=
>> > rdev->pm.current_mclk)) {
>> >               radeon_pm_debug_check_in_vbl(rdev, false);
>> > +               /* D.Stevens 2012 for the A-EON AmigaOne X1000: Setting
>> > memory clock only works on CAICOS and 6570, don't set for anything else
>> > (We ignore 6570 here */
>> > +               if (rdev->family == CHIP_CAICOS) {
>> >               radeon_set_memory_clock(rdev, mclk);
>> > +               }
>> >               radeon_pm_debug_check_in_vbl(rdev, true);
>> >               rdev->pm.current_mclk = mclk;
>> >               DRM_DEBUG_DRIVER("Setting: m: %d\n", mclk);
>> > @@ -1220,7 +1223,7 @@ static void radeon_pm_resume_old(struct
>> >                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
>> >           if (rdev->pm.default_sclk)
>> >               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
>> > -        if (rdev->pm.default_mclk)
>> > +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
>> > /* Fix for PPC systems HD6000 >6570 by A-EON Core Linux Support Team */
>> >               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>> >       }
>> >       /* asic init will reset the default power state */
>> > @@ -1271,7 +1274,7 @@ dpm_resume_fail:
>> >                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
>> >           if (rdev->pm.default_sclk)
>> >               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
>> > -        if (rdev->pm.default_mclk)
>> > +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
>> > /* Fix for PPC & > HD6570 by A-EON Linux Core Support Team */
>> >               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>> >       }
>> >   }
>> > @@ -1318,7 +1321,7 @@ static int radeon_pm_init_old(struct rad
>> >                               SET_VOLTAGE_TYPE_ASIC_VDDCI);
>> >               if (rdev->pm.default_sclk)
>> >                   radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
>> > -            if (rdev->pm.default_mclk)
>> > +            if (rdev->pm.default_mclk && (rdev->family ==
>> > CHIP_CAICOS))     // D.Stevens 2013: fix for >HD6570 on PPC
>> >                   radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>> >           }
>> >       }
>> > @@ -1431,7 +1434,7 @@ dpm_failed:
>> >                           SET_VOLTAGE_TYPE_ASIC_VDDCI);
>> >           if (rdev->pm.default_sclk)
>> >               radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
>> > -        if (rdev->pm.default_mclk)
>> > +        if (rdev->pm.default_mclk && (rdev->family == CHIP_CAICOS))
>> > //
>> > D.Stevens 2013: Fix for >HD6570 on ppc
>> >               radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
>> >       }
>> >       DRM_ERROR("radeon: dpm initialization failed\n");
>> > diff -rupN linux-4.1/drivers/pci/pci.c linux-4.1-nemo/drivers/pci/pci.c
>> > --- linux-4.1/drivers/pci/pci.c    2015-06-22 03:47:08.817778536 +0200
>> > +++ linux-4.1-nemo/drivers/pci/pci.c    2015-06-22 03:27:29.717650601
>> > +0200
>> > @@ -421,7 +421,16 @@ struct resource *pci_find_parent_resourc
>> >       pci_bus_for_each_resource(bus, r, i) {
>> >           if (!r)
>> >               continue;
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +    /* The new code here checks for resources that are not allocated,
>> > and no longer
>> > +     * returns these, however the SB600 code uses this feature to
>> > allocate IO ranges
>> > +     * in the ISA map, and this breaks booting on the AmigaOneX1000.
>> > +     * Temporary fix to get the kernel working, remove the resource
>> > allocated check.
>> > +     */
>> > +        if (resource_contains(r, res)) {
>> > +#else
>> >           if (res->start && resource_contains(r, res)) {
>> > +#endif
>> >
>> >               /*
>> >                * If the window is prefetchable but the BAR is
>> > diff -rupN linux-4.1/drivers/pci/probe.c
>> > linux-4.1-nemo/drivers/pci/probe.c
>> > --- linux-4.1/drivers/pci/probe.c    2015-06-22 03:47:08.824778536
>> > +0200
>> > +++ linux-4.1-nemo/drivers/pci/probe.c    2015-06-22 03:27:29.720650613
>> > +0200
>> > @@ -363,7 +363,11 @@ static void pci_read_bridge_io(struct pc
>> >           limit |= ((unsigned long) io_limit_hi << 16);
>> >       }
>> >
>> > -    if (base <= limit) {
>> > +       if (base <= limit
>> > +       #ifdef CONFIG_PPC_PASEMI_SB600
>> > +               || child->busn_res.start == 5
>> > +       #endif
>> > +              ) {
>> >           res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) |
>> > IORESOURCE_IO;
>> >           region.start = base;
>> >           region.end = limit + io_granularity - 1;
>> > @@ -1609,11 +1613,14 @@ static int only_one_child(struct pci_bus
>> >
>> >       if (!parent || !pci_is_pcie(parent))
>> >           return 0;
>> > +       #ifndef CONFIG_PPC_PASEMI_SB600
>> > +       // SB600 has non-zero devices on non-root bus.
>> >       if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
>> >           return 1;
>> >       if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM &&
>> >           !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
>> >           return 1;
>> > +    #endif
>> >       return 0;
>> >   }
>> >
>> > diff -rupN linux-4.1/drivers/rtc/rtc-cmos.c
>> > linux-4.1-nemo/drivers/rtc/rtc-cmos.c
>> > --- linux-4.1/drivers/rtc/rtc-cmos.c    2015-06-22 03:47:09.156778536
>> > +0200
>> > +++ linux-4.1-nemo/drivers/rtc/rtc-cmos.c    2015-06-22
>> > 03:27:29.742650701 +0200
>> > @@ -242,6 +242,13 @@ static int cmos_read_alarm(struct device
>> >       }
>> >
>> >       rtc_control = CMOS_READ(RTC_CONTROL);
>> > +
>> > +#ifdef CONFIG_PPC_PASEMI_SB600
>> > +       // Nemo BIOS does not init RTC
>> > +       rtc_control = rtc_control | RTC_24H;
>> > +       CMOS_WRITE(rtc_control, RTC_CONTROL);
>> > +#endif
>> > +
>> >       spin_unlock_irq(&rtc_lock);
>> >
>> >       if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
>> > diff -rupN linux-4.1/sound/pci/hda/patch_sigmatel.c
>> > linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c
>> > --- linux-4.1/sound/pci/hda/patch_sigmatel.c    2015-06-22
>> > 03:47:15.039778536 +0200
>> > +++ linux-4.1-nemo/sound/pci/hda/patch_sigmatel.c    2015-06-22
>> > 03:27:29.768650804 +0200
>> > @@ -166,6 +166,7 @@ enum {
>> >       STAC_D965_VERBS,
>> >       STAC_DELL_3ST,
>> >       STAC_DELL_BIOS,
>> > +    STAC_NEMO_DEFAULT,
>> >       STAC_DELL_BIOS_AMIC,
>> >       STAC_DELL_BIOS_SPDIF,
>> >       STAC_927X_DELL_DMIC,
>> > @@ -1359,6 +1360,23 @@ static const struct hda_pintbl oqo9200_p
>> >       {}
>> >   };
>> >
>> > +static const struct hda_pintbl nemo_pin_configs[] = {
>> > +   { 0x0a, 0x02214020 },
>> > +   { 0x0b, 0x02A19080 },
>> > +   { 0x0c, 0x0181304E },
>> > +   { 0x0d, 0x01014010 },
>> > +   { 0x0e, 0x01A19040 },
>> > +   { 0x0f, 0x01011012 },
>> > +   { 0x10, 0x01016011 },
>> > +   { 0x11, 0x01012014 },
>> > +   { 0x12, 0x103301F0 },
>> > +   { 0x13, 0x00000000 },
>> > +   { 0x14, 0x00000000 },
>> > +   { 0x21, 0x01442170 },
>> > +   { 0x22, 0x00000000 },
>> > +   { 0x23, 0x00000000 },
>> > +   {}
>> > +};
>> >
>> >   static void stac9200_fixup_panasonic(struct hda_codec *codec,
>> >                        const struct hda_fixup *fix, int action)
>> > @@ -3868,6 +3886,10 @@ static const struct hda_fixup stac927x_f
>> >           .type = HDA_FIXUP_PINS,
>> >           .v.pins = d965_5st_no_fp_pin_configs,
>> >       },
>> > +    [STAC_NEMO_DEFAULT] = {
>> > +               .type = HDA_FIXUP_PINS,
>> > +        .v.pins = nemo_pin_configs,
>> > +    },
>> >       [STAC_DELL_3ST] = {
>> >           .type = HDA_FIXUP_PINS,
>> >           .v.pins = dell_3st_pin_configs,
>> > @@ -3924,6 +3946,7 @@ static const struct hda_model_fixup stac
>> >       { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
>> >       { .id = STAC_DELL_3ST, .name = "dell-3stack" },
>> >       { .id = STAC_DELL_BIOS, .name = "dell-bios" },
>> > +    { .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },
>> >       { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
>> >       { .id = STAC_927X_VOLKNOB, .name = "volknob" },
>> >       {}
>> > @@ -3962,6 +3985,8 @@ static const struct snd_pci_quirk stac92
>> >                  "Intel D965", STAC_D965_5ST),
>> >       SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
>> >                  "Intel D965", STAC_D965_5ST),
>> > +    /* Nemo */
>> > +    SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000",
>> > STAC_NEMO_DEFAULT),
>> >       /* volume-knob fixes */
>> >       SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
>> >       {} /* terminator */
>> > @@ -5035,6 +5060,7 @@ static const struct hda_codec_preset snd
>> >        { .id = 0x83847683, .name = "STAC9221D A2", .patch =
>> > patch_stac922x },
>> >        { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x
>> > },
>> >        { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x
>> > },
>> > +    { .id = 0x83847638, .name = "STAC92HD700", .patch = patch_stac927x
>> > },
>> >        { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x
>> > },
>> >        { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x
>> > },
>> >        { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x
>> > },
>> > _______________________________________________
>> > Linuxppc-dev mailing list
>> > Linuxppc-dev@lists.ozlabs.org
>> > https://lists.ozlabs.org/listinfo/linuxppc-dev
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
>
>

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

end of thread, other threads:[~2015-07-13  9:33 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
2015-04-14  4:27 ` [PATCH 01/10] powerpc: Add MSI operations to pci_controller_ops struct Daniel Axtens
2015-04-14  4:27 ` [PATCH 02/10] powerpc/powernv: Move MSI-related ops to pci_controller_ops Daniel Axtens
2015-04-14  4:27 ` [PATCH 03/10] powerpc/cell: " Daniel Axtens
2015-04-14  4:27 ` [PATCH 04/10] powerpc/pseries: " Daniel Axtens
2015-04-14  4:27 ` [PATCH 05/10] powerpc/fsl_msi: " Daniel Axtens
2015-04-14  4:27 ` [PATCH 06/10] powerpc/ppc4xx_msi: " Daniel Axtens
2015-04-14  4:28 ` [PATCH 07/10] powerpc/ppc4xx_hsta_msi: " Daniel Axtens
2015-04-14  4:28 ` [PATCH 08/10] powerpc/mpic_pasemi_msi: " Daniel Axtens
2015-07-07 10:50   ` PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore Christian Zigotzky
2015-07-07 11:25     ` Christian Zigotzky
2015-07-07 12:44       ` Christian Zigotzky
2015-07-08 18:00         ` Christian Zigotzky
2015-07-08 22:36           ` Benjamin Herrenschmidt
2015-07-09  1:42             ` Michael Ellerman
2015-07-09  5:19               ` Christian Zigotzky
2015-07-09  7:07                 ` Michael Ellerman
2015-07-09  7:53               ` Benjamin Herrenschmidt
2015-07-09  8:50                 ` Christian Zigotzky
2015-07-09  9:12                 ` Christian Zigotzky
2015-07-09  9:52                   ` Denis Kirjanov
2015-07-09 10:37                     ` Christian Zigotzky
2015-07-13  6:47                     ` Benjamin Herrenschmidt
2015-07-13  9:33                       ` Denis Kirjanov
2015-07-09 22:27           ` Christian Zigotzky
2015-07-10  6:51             ` Christian Zigotzky
2015-07-13  6:44             ` Benjamin Herrenschmidt
2015-04-14  4:28 ` [PATCH 09/10] powerpc/mpic_u3msi: Move MSI-related ops to pci_controller_ops Daniel Axtens
2015-04-14  4:28 ` [PATCH 10/10] powerpc: Remove MSI-related PCI controller ops from ppc_md Daniel Axtens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).