Kernel 3.9

AmigaOne X1000 platform specific issues related to Linux only.
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Kernel 3.9

Post by xeno74 »

Hi,

I have created a nemo patch file for the new kernel 3.9. :)

http://paste.ubuntu.com/5623122/

http://pastebin.de/34146

Code: Select all

diff -upr linux-3.9/arch/powerpc/kernel/pci-common.c linux-3.9-nemo/arch/powerpc/kernel/pci-common.c
--- linux-3.9/arch/powerpc/kernel/pci-common.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/arch/powerpc/kernel/pci-common.c	2013-05-01 10:26:24.000000000 +0200
@@ -751,6 +751,17 @@ 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 */
+			if (primary) {
+				__ioremap_at(cpu_addr, (void *)ISA_IO_BASE,
+		     		size, _PAGE_NO_CACHE|_PAGE_GUARDED);
+		     	hose->io_base_virt = (void *)_IO_BASE;
+		     	printk("Initialised io_base_virt 0x%lx _IO_BASE 0x%llxn", (unsigned long)hose->io_base_virt, _IO_BASE);
+		     }
+#endif
+
 			/* pci_io_size and io_base_phys always represent IO
 			 * space starting at 0 so we factor in pci_addr
 			 */
@@ -1216,6 +1227,7 @@ void pcibios_allocate_bus_resources(stru
 				&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
@@ -1223,6 +1235,7 @@ void pcibios_allocate_bus_resources(stru
 				 */
 				continue;
 			}
+#endif
 		}
 
 		pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx "
@@ -1652,7 +1665,9 @@ void pcibios_scan_phb(struct pci_control
 	pr_debug("PCI: Scanning PHB %sn", 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 -upr linux-3.9/arch/powerpc/platforms/pasemi/iommu.c linux-3.9-nemo/arch/powerpc/platforms/pasemi/iommu.c
--- linux-3.9/arch/powerpc/platforms/pasemi/iommu.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/arch/powerpc/platforms/pasemi/iommu.c	2013-05-01 10:44:34.000000000 +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
  *
@@ -139,7 +145,9 @@ static void iommu_table_iobmap_setup(voi
 	iommu_table_iobmap.it_busno = 0;
 	iommu_table_iobmap.it_offset = 0;
 	/* it_size is in number of entries */
-	iommu_table_iobmap.it_size = 0x80000000 >> IOBMAP_PAGE_SHIFT;
+/* Note: changed 0x80000000 to 0x7FFFFFFF for SBLive! SB0220 */
+/* out of range problem on 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 -upr linux-3.9/arch/powerpc/platforms/pasemi/Kconfig linux-3.9-nemo/arch/powerpc/platforms/pasemi/Kconfig
--- linux-3.9/arch/powerpc/platforms/pasemi/Kconfig	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/arch/powerpc/platforms/pasemi/Kconfig	2013-05-01 10:33:21.000000000 +0200
@@ -13,6 +13,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"
diff -upr linux-3.9/arch/powerpc/platforms/pasemi/pci.c linux-3.9-nemo/arch/powerpc/platforms/pasemi/pci.c
--- linux-3.9/arch/powerpc/platforms/pasemi/pci.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/arch/powerpc/platforms/pasemi/pci.c	2013-05-01 11:53:09.000000000 +0200
@@ -106,6 +106,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 noden");
+			return;
+		}
+			
+		err = of_address_to_resource(dn, 0, &res);
+        of_node_put(dn);
+	
+		if (err)
+		{
+        	printk(KERN_CRIT "NEMO SB600 missing resourcen");
+			return;
+		}
+		
+		printk(KERN_CRIT "NEMO SB600 IOB base %08lxn",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)
 {
@@ -123,6 +186,10 @@ static int pa_pxp_read_config(struct pci
 		return PCIBIOS_SUCCESSFUL;
 
 	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
@@ -157,6 +224,10 @@ static int pa_pxp_write_config(struct pc
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
 	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
diff -upr linux-3.9/arch/powerpc/platforms/pasemi/setup.c linux-3.9-nemo/arch/powerpc/platforms/pasemi/setup.c
--- linux-3.9/arch/powerpc/platforms/pasemi/setup.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/arch/powerpc/platforms/pasemi/setup.c	2013-05-01 12:10:18.000000000 +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>
@@ -183,6 +184,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 i8259n");
+	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 +296,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 +459,38 @@ static struct of_device_id pasemi_bus_id
 	{},
 };
 
+#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);
+	
+#ifdef CONFIG_PPC_PASEMI_SB600
+	platform_device_register_simple("rtc_cmos", -1, rtc_resource, 2);
+#endif
 
 	return 0;
 }
@@ -433,6 +515,14 @@ static int __init pas_probe(void)
 	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 +535,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 -upr linux-3.9/arch/powerpc/sysdev/i8259.c linux-3.9-nemo/arch/powerpc/sysdev/i8259.c
--- linux-3.9/arch/powerpc/sysdev/i8259.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/arch/powerpc/sysdev/i8259.c	2013-05-01 12:33:56.000000000 +0200
@@ -6,7 +6,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-#undef DEBUG
+#define DEBUG
 
 #include <linux/init.h>
 #include <linux/ioport.h>
@@ -104,11 +104,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)
@@ -119,11 +119,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)
@@ -230,6 +230,7 @@ void i8259_init(struct device_node *node
 	/* initialize the controller */
 	raw_spin_lock_irqsave(&i8259_lock, flags);
 
+printk("About to write to i8259n");
 	/* Mask all first */
 	outb(0xff, 0xA1);
 	outb(0xff, 0x21);
@@ -259,15 +260,18 @@ void i8259_init(struct device_node *node
 	/* Set interrupt masks */
 	outb(cached_A1, 0xA1);
 	outb(cached_21, 0x21);
-
+	
+	printk("Done write to i8259n");
 	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) {
 		printk(KERN_ERR "i8259: failed to allocate irq host !n");
 		return;
 	}
+#endif
 
 	/* reserve our resources */
 	/* XXX should we continue doing that ? it seems to cause problems
diff -upr linux-3.9/arch/powerpc/sysdev/mpic.c linux-3.9-nemo/arch/powerpc/sysdev/mpic.c
--- linux-3.9/arch/powerpc/sysdev/mpic.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/arch/powerpc/sysdev/mpic.c	2013-05-01 12:45:04.000000000 +0200
@@ -657,6 +657,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)
 {
@@ -664,7 +714,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)) &
@@ -685,7 +740,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)) |
@@ -704,6 +764,13 @@ void mpic_mask_irq(struct irq_data *d)
 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: %dn", mpic->name, d->irq);
diff -upr linux-3.9/drivers/ata/libata-sff.c linux-3.9-nemo/drivers/ata/libata-sff.c
--- linux-3.9/drivers/ata/libata-sff.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/drivers/ata/libata-sff.c	2013-05-01 12:48:54.000000000 +0200
@@ -2428,9 +2428,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;
 #if defined(CONFIG_NO_ATA_LEGACY)
diff -upr linux-3.9/drivers/ata/pata_atiixp.c linux-3.9-nemo/drivers/ata/pata_atiixp.c
--- linux-3.9/drivers/ata/pata_atiixp.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/drivers/ata/pata_atiixp.c	2013-05-01 12:57:15.000000000 +0200
@@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_de
 		.port_ops = &atiixp_port_ops
 	};
 	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 -upr linux-3.9/drivers/ata/pata_of_platform.c linux-3.9-nemo/drivers/ata/pata_of_platform.c
--- linux-3.9/drivers/ata/pata_of_platform.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/drivers/ata/pata_of_platform.c	2013-05-01 16:44:11.000000000 +0200
@@ -42,6 +42,16 @@ static int pata_of_platform_probe(struct
 		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) {
@@ -69,6 +79,11 @@ static int pata_of_platform_probe(struct
 	} else {
 		dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0n");
 	}
+	
+#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;
@@ -80,6 +95,9 @@ 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 -upr linux-3.9/drivers/gpu/drm/radeon/radeon_pm.c linux-3.9-nemo/drivers/gpu/drm/radeon/radeon_pm.c
--- linux-3.9/drivers/gpu/drm/radeon/radeon_pm.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/drivers/gpu/drm/radeon/radeon_pm.c	2013-05-01 13:17:15.000000000 +0200
@@ -214,7 +214,11 @@ 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);
+		/* 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: %dn", mclk);
@@ -552,7 +556,7 @@ void radeon_pm_resume(struct radeon_devi
 						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 */
 			radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
 	}
 	/* asic init will reset the default power state */
@@ -609,7 +613,7 @@ int radeon_pm_init(struct radeon_device
 							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 */
 				radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
 		}
 	}
diff -upr linux-3.9/drivers/pci/probe.c linux-3.9-nemo/drivers/pci/probe.c
--- linux-3.9/drivers/pci/probe.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/drivers/pci/probe.c	2013-05-01 13:24:15.000000000 +0200
@@ -336,7 +336,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;
@@ -1405,11 +1409,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 -upr linux-3.9/drivers/pcmcia/electra_cf.c linux-3.9-nemo/drivers/pcmcia/electra_cf.c
--- linux-3.9/drivers/pcmcia/electra_cf.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/drivers/pcmcia/electra_cf.c	2013-05-01 16:42:00.000000000 +0200
@@ -209,7 +209,7 @@ static int electra_cf_probe(struct platf
 
 	cf->ofdev = ofdev;
 	cf->mem_phys = mem.start;
-	cf->mem_size = PAGE_ALIGN(resource_size(&mem));
+	cf->mem_size = PAGE_ALIGN(resource_size(&mem)+0x800);
 	cf->mem_base = ioremap(cf->mem_phys, cf->mem_size);
 	cf->io_size = PAGE_ALIGN(resource_size(&io));
 
diff -upr linux-3.9/drivers/rtc/rtc-cmos.c linux-3.9-nemo/drivers/rtc/rtc-cmos.c
--- linux-3.9/drivers/rtc/rtc-cmos.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/drivers/rtc/rtc-cmos.c	2013-05-01 13:33:26.000000000 +0200
@@ -239,6 +239,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 -upr linux-3.9/sound/pci/hda/patch_sigmatel.c linux-3.9-nemo/sound/pci/hda/patch_sigmatel.c
--- linux-3.9/sound/pci/hda/patch_sigmatel.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/sound/pci/hda/patch_sigmatel.c	2013-05-01 16:31:05.000000000 +0200
@@ -158,6 +158,7 @@ enum {
 	STAC_D965_VERBS,
 	STAC_DELL_3ST,
 	STAC_DELL_BIOS,
+	STAC_NEMO_DEFAULT,
 	STAC_DELL_BIOS_SPDIF,
 	STAC_927X_DELL_DMIC,
 	STAC_927X_VOLKNOB,
@@ -1358,6 +1359,11 @@ static const struct hda_pintbl oqo9200_p
 	{}
 };
 
+static const unsigned int nemo_pin_configs[14] = {
+	0x02214020, 0x02A19080, 0x0181304E, 0x01014010, 0x01A19040,	// a b c d e
+	0x01011012, 0x01016011, 0x01012014, 0x103301F0, 0x00000000, // f g h cd dmic0 
+	0x00000000, 0x01442170, 0x00000000, 0x00000000			// dmic1 digout0 digin pcbeep
+};
 
 static void stac9200_fixup_panasonic(struct hda_codec *codec,
 				     const struct hda_fixup *fix, int action)
@@ -3216,11 +3222,15 @@ 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,
 		.chained = true,
-		.chain_id = STAC_927X_DELL_DMIC,
+		.chain_id = STAC_927X_DELL_DMIC,		
 	},
 	[STAC_DELL_BIOS] = {
 		.type = HDA_FIXUP_PINS,
@@ -3264,6 +3274,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_927X_VOLKNOB, .name = "volknob" },
 	{}
 };
@@ -3301,6 +3312,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 */
@@ -4353,6 +4366,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 },

http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 3.9

Post by xeno74 »

http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 3.9

Post by xeno74 »

http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
daz
Beta Tester
Beta Tester
Posts: 329
Joined: Tue Dec 21, 2010 7:32 pm

Re: Kernel 3.9

Post by daz »

xeno74 wrote:Hi,

I have created a nemo patch file for the new kernel 3.9. :)

http://paste.ubuntu.com/5623122/

http://pastebin.de/34146

Code: Select all

iff -upr linux-3.9/sound/pci/hda/patch_sigmatel.c linux-3.9-nemo/sound/pci/hda/patch_sigmatel.c
--- linux-3.9/sound/pci/hda/patch_sigmatel.c	2013-04-29 02:36:01.000000000 +0200
+++ linux-3.9-nemo/sound/pci/hda/patch_sigmatel.c	2013-05-01 16:31:05.000000000 +0200
@@ -158,6 +158,7 @@ enum {
 	STAC_D965_VERBS,
 	STAC_DELL_3ST,
 	STAC_DELL_BIOS,
+	STAC_NEMO_DEFAULT,
 	STAC_DELL_BIOS_SPDIF,
 	STAC_927X_DELL_DMIC,
 	STAC_927X_VOLKNOB,
@@ -1358,6 +1359,11 @@ static const struct hda_pintbl oqo9200_p
 	{}
 };
 
+static const unsigned int nemo_pin_configs[14] = {
+	0x02214020, 0x02A19080, 0x0181304E, 0x01014010, 0x01A19040,	// a b c d e
+	0x01011012, 0x01016011, 0x01012014, 0x103301F0, 0x00000000, // f g h cd dmic0 
+	0x00000000, 0x01442170, 0x00000000, 0x00000000			// dmic1 digout0 digin pcbeep
+};
 
 static void stac9200_fixup_panasonic(struct hda_codec *codec,
 				     const struct hda_fixup *fix, int action)
@@ -3216,11 +3222,15 @@ 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,
 		.chained = true,
-		.chain_id = STAC_927X_DELL_DMIC,
+		.chain_id = STAC_927X_DELL_DMIC,		
 	},
 	[STAC_DELL_BIOS] = {
 		.type = HDA_FIXUP_PINS,
@@ -3264,6 +3274,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_927X_VOLKNOB, .name = "volknob" },
 	{}
 };
@@ -3301,6 +3312,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 */
@@ -4353,6 +4366,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 },

Hmmm... does your onboard audio work with this kernel? - I notice that the diff's for patch_sigmatel.c are different from the ones I have. The pin config structures have been significantly changed. These still look like the old ones (I've left the patch above)

Still giving mine a work out, a compiled kernel and patch will follow (if needed.)
Regards
Darren
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 3.9

Post by xeno74 »

I have updated the nemo patch. Download above :)
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 3.9

Post by xeno74 »

It works :)

Image
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 3.9

Post by xeno74 »

Image
tux-3.9.png
tux-3.9.png (27.81 KiB) Viewed 10674 times
Download: kernel-3.9x1000.tar.gz
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
zappa2009
Posts: 230
Joined: Tue Jun 21, 2011 12:17 pm

Re: Kernel 3.9

Post by zappa2009 »

OnBoard HD-Audio works with the New-Kernel.

I can record and play with the Onboard Audio.
Testet with some FLACs and Audacious -> Fine
Record with Audacity -> Fine
Play Digital-Out with the Tos-Link is funktional ;)

So the Patch is good ;)
X1000 RadeonHD5450 4GB (2x2GB) DDR2-PC2-8500 Kingston HyperX 5-5-5-5-15 OS4.1.6 & Lubuntu13.04/mintppc11 with Kernel 3.8.7/3.9
daz
Beta Tester
Beta Tester
Posts: 329
Joined: Tue Dec 21, 2010 7:32 pm

Re: Kernel 3.9

Post by daz »

zappa2009 wrote:OnBoard HD-Audio works with the New-Kernel.

I can record and play with the Onboard Audio.
Testet with some FLACs and Audacious -> Fine
Record with Audacity -> Fine
Play Digital-Out with the Tos-Link is funktional ;)

So the Patch is good ;)
The patch may work, but is definitely wrong. When moving to 3.9 from 3.8 sound/pci/hda/patch_sigmatel.c changed significantly. Xeno74 didn't correct the rejected hunks. Why it still works I don''t know,

FYI here is what the pin tables should look like:

Code: Select all

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 stac927x_fixup_ref_no_jd(struct hda_codec *codec,
And here is what Xeno74's patch is putting in:

Code: Select all

 
+static const unsigned int nemo_pin_configs[14] = {
+	0x02214020, 0x02A19080, 0x0181304E, 0x01014010, 0x01A19040,	// a b c d e
+	0x01011012, 0x01016011, 0x01012014, 0x103301F0, 0x00000000, // f g h cd dmic0 
+	0x00000000, 0x01442170, 0x00000000, 0x00000000			// dmic1 digout0 digin pcbeep
+};
 
 static void stac9200_fixup_panasonic(struct hda_codec *codec,
If Xeno's kernel is working fine for you, then use it, just be aware something subtle may break it.

Regards
Darren
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 3.9

Post by xeno74 »

Hi Darren,

Thank you for your answer. You're right with the patch of patch_sigmatel.c. I've created a new patch and a new kernel :)

Downloads:

kernel-3.9.0-2-x1000.tar.gz

nemo_3.9v2.patch.tar.gz

Regards,
Xeno
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Post Reply