LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix memory leak in arch/powerpc/sysdev/qe_lib/uuc_fast.c ucc_fast_init()
From: Tony Breeds @ 2008-08-18  4:00 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, danielm77

In kernel bugzilla 11364 Daniel Marjamäki notes that if the an the ioremap
fails we'll return -ENOMEM without kfree()ing uccf.

Add a kfree on the error path.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
 arch/powerpc/sysdev/qe_lib/ucc_fast.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
index 1aecb07..3455abc 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
@@ -208,6 +208,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
 	uccf->uf_regs = ioremap(uf_info->regs, sizeof(struct ucc_fast));
 	if (uccf->uf_regs == NULL) {
 		printk(KERN_ERR "%s: Cannot map UCC registers\n", __func__);
+		kfree(uccf);
 		return -ENOMEM;
 	}
 
-- 
1.5.6.3

^ permalink raw reply related

* [PATCH 1/2] powerpc: Turn get/set_hard_smp_proccessor_id into inlines
From: Benjamin Herrenschmidt @ 2008-08-18  4:23 UTC (permalink / raw)
  To: linuxppc-dev

They don't need to be macros, and having them as inline
functions avoids warnings about unused variables on some
configurations when the argument isn't evaluated.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 arch/powerpc/include/asm/smp.h |   39 +++++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)

--- linux-work.orig/arch/powerpc/include/asm/smp.h	2008-08-18 11:57:47.000000000 +1000
+++ linux-work/arch/powerpc/include/asm/smp.h	2008-08-18 12:03:55.000000000 +1000
@@ -56,9 +56,16 @@ extern int smp_hw_index[];
 
 #define raw_smp_processor_id()	(current_thread_info()->cpu)
 #define hard_smp_processor_id() 	(smp_hw_index[smp_processor_id()])
-#define get_hard_smp_processor_id(cpu)	(smp_hw_index[(cpu)])
-#define set_hard_smp_processor_id(cpu, phys)\
-					(smp_hw_index[(cpu)] = (phys))
+
+static inline int get_hard_smp_processor_id(int cpu)
+{
+	return smp_hw_index[cpu];
+}
+
+static inline void set_hard_smp_processor_id(int cpu, int phys)
+{
+	smp_hw_index[cpu] = phys;
+}
 #endif
 
 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
@@ -92,9 +99,15 @@ extern void __cpu_die(unsigned int cpu);
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_PPC64
-#define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id)
-#define set_hard_smp_processor_id(CPU, VAL) \
-	do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0)
+static inline int get_hard_smp_processor_id(int cpu)
+{
+	return paca[cpu].hw_cpu_id;
+}
+
+static inline void set_hard_smp_processor_id(int cpu, int phys)
+{
+	paca[cpu].hw_cpu_id = phys;
+}
 
 extern void smp_release_cpus(void);
 
@@ -102,10 +115,16 @@ extern void smp_release_cpus(void);
 /* 32-bit */
 #ifndef CONFIG_SMP
 extern int boot_cpuid_phys;
-#define get_hard_smp_processor_id(cpu) 	boot_cpuid_phys
-#define set_hard_smp_processor_id(cpu, phys)
-#endif
-#endif
+static inline int get_hard_smp_processor_id(int cpu)
+{
+	return boot_cpuid_phys;
+}
+
+static inline void set_hard_smp_processor_id(int cpu, int phys)
+{
+}
+#endif /* !CONFIG_SMP */
+#endif /* !CONFIG_PPC64 */
 
 extern int smt_enabled_at_boot;
 

^ permalink raw reply

* [PATCH 2/2] powerpc: Make CPU sysfs PMC & cache topology used on 32-bit
From: Benjamin Herrenschmidt @ 2008-08-18  4:23 UTC (permalink / raw)
  To: linuxppc-dev

The file arch/powerpc/kernel/sysfs.c is currently only compiled
for 64-bit kernels. It contain code to register CPU sysdevs in
sysfs and add various properties such as cache topology and
raw access by root to PMCs. A lot of that can be re-used as
is on 32-bits.

This makes the file built for both, with appropriate ifdef'ing
for the few bits that are really 64-bit specific, and adds some
support for the raw PMCs for 75x and 74xx processors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 arch/powerpc/include/asm/cputable.h     |    1 
 arch/powerpc/kernel/Makefile            |    4 -
 arch/powerpc/kernel/cputable.c          |   24 +++++++
 arch/powerpc/kernel/setup_32.c          |   11 ---
 arch/powerpc/kernel/sysfs.c             |  106 ++++++++++++++++++++++++++------
 arch/powerpc/oprofile/op_model_power4.c |    4 -
 6 files changed, 117 insertions(+), 33 deletions(-)

--- linux-work.orig/arch/powerpc/kernel/Makefile	2008-08-12 13:13:58.000000000 +1000
+++ linux-work/arch/powerpc/kernel/Makefile	2008-08-18 12:43:43.000000000 +1000
@@ -27,13 +27,13 @@ endif
 obj-y				:= cputable.o ptrace.o syscalls.o \
 				   irq.o align.o signal_32.o pmc.o vdso.o \
 				   init_task.o process.o systbl.o idle.o \
-				   signal.o
+				   signal.o sysfs.o
 obj-y				+= vdso32/
 obj-$(CONFIG_PPC64)		+= setup_64.o sys_ppc32.o \
 				   signal_64.o ptrace32.o \
 				   paca.o cpu_setup_ppc970.o \
 				   cpu_setup_pa6t.o \
-				   firmware.o sysfs.o nvram_64.o
+				   firmware.o nvram_64.o
 obj-$(CONFIG_PPC64)		+= vdso64/
 obj-$(CONFIG_ALTIVEC)		+= vecemu.o vector.o
 obj-$(CONFIG_PPC_970_NAP)	+= idle_power4.o
Index: linux-work/arch/powerpc/kernel/cputable.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/cputable.c	2008-07-28 09:48:39.000000000 +1000
+++ linux-work/arch/powerpc/kernel/cputable.c	2008-08-18 12:43:43.000000000 +1000
@@ -610,6 +610,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750cx,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -623,6 +624,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750cx,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -636,6 +638,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750cx,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -649,6 +652,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -662,6 +666,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -675,6 +680,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -688,6 +694,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -701,6 +708,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750fx,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -714,6 +722,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750fx,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -727,6 +736,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_IBM,
 		.cpu_setup		= __setup_cpu_750,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
@@ -741,6 +751,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_7400,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc7400",
@@ -755,6 +766,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_7400,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc7400",
@@ -769,6 +781,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_7410,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc7400",
@@ -783,6 +796,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -799,6 +813,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -815,6 +830,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -831,6 +847,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -847,6 +864,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -863,6 +881,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -879,6 +898,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -895,6 +915,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -910,6 +931,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -926,6 +948,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
@@ -942,6 +965,7 @@ static struct cpu_spec __initdata cpu_sp
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_G4,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
 		.oprofile_type		= PPC_OPROFILE_G4,
Index: linux-work/arch/powerpc/kernel/setup_32.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/setup_32.c	2008-07-24 14:05:58.000000000 +1000
+++ linux-work/arch/powerpc/kernel/setup_32.c	2008-08-18 12:43:43.000000000 +1000
@@ -209,23 +209,12 @@ EXPORT_SYMBOL(nvram_sync);
 
 #endif /* CONFIG_NVRAM */
 
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
-
 int __init ppc_init(void)
 {
-	int cpu;
-
 	/* clear the progress line */
 	if (ppc_md.progress)
 		ppc_md.progress("             ", 0xffff);
 
-	/* register CPU devices */
-	for_each_possible_cpu(cpu) {
-		struct cpu *c = &per_cpu(cpu_devices, cpu);
-		c->hotpluggable = 1;
-		register_cpu(c, cpu);
-	}
-
 	/* call platform init */
 	if (ppc_md.init != NULL) {
 		ppc_md.init();
Index: linux-work/arch/powerpc/kernel/sysfs.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/sysfs.c	2008-07-30 13:26:51.000000000 +1000
+++ linux-work/arch/powerpc/kernel/sysfs.c	2008-08-18 14:13:16.000000000 +1000
@@ -15,18 +15,24 @@
 #include <asm/firmware.h>
 #include <asm/hvcall.h>
 #include <asm/prom.h>
-#include <asm/paca.h>
-#include <asm/lppaca.h>
 #include <asm/machdep.h>
 #include <asm/smp.h>
 
+#ifdef CONFIG_PPC64
+#include <asm/paca.h>
+#include <asm/lppaca.h>
+#endif
+
 static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
 static DEFINE_PER_CPU(struct kobject *, cache_toplevel);
 
-/* SMT stuff */
+/*
+ * SMT snooze delay stuff, 64-bit only for now
+ */
+
+#ifdef CONFIG_PPC64
 
-#ifdef CONFIG_PPC_MULTIPLATFORM
 /* Time in microseconds we delay before sleeping in the idle loop */
 DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 };
 
@@ -106,7 +112,7 @@ static int __init setup_smt_snooze_delay
 }
 __setup("smt-snooze-delay=", setup_smt_snooze_delay);
 
-#endif /* CONFIG_PPC_MULTIPLATFORM */
+#endif /* CONFIG_PPC64 */
 
 /*
  * Enabling PMCs will slow partition context switch times so we only do
@@ -115,7 +121,7 @@ __setup("smt-snooze-delay=", setup_smt_s
 
 static DEFINE_PER_CPU(char, pmcs_enabled);
 
-void ppc64_enable_pmcs(void)
+void ppc_enable_pmcs(void)
 {
 	/* Only need to enable them once */
 	if (__get_cpu_var(pmcs_enabled))
@@ -126,7 +132,7 @@ void ppc64_enable_pmcs(void)
 	if (ppc_md.enable_pmcs)
 		ppc_md.enable_pmcs();
 }
-EXPORT_SYMBOL(ppc64_enable_pmcs);
+EXPORT_SYMBOL(ppc_enable_pmcs);
 
 /* XXX convert to rusty's on_one_cpu */
 static unsigned long run_on_cpu(unsigned long cpu,
@@ -154,7 +160,7 @@ static unsigned long read_##NAME(unsigne
 } \
 static unsigned long write_##NAME(unsigned long val) \
 { \
-	ppc64_enable_pmcs(); \
+	ppc_enable_pmcs(); \
 	mtspr(ADDRESS, val); \
 	return 0; \
 } \
@@ -184,28 +190,53 @@ static ssize_t __used \
  * that are implemented on the current processor
  */
 
+#ifdef CONFIG_PPC64
+#define HAS_PPC_PMC_CLASSIC	1
+#define HAS_PPC_PMC_IBM		1
+#define HAS_PPC_PMC_PA6T	1
+#elif CONFIG_6xx
+#define HAS_PPC_PMC_CLASSIC	1
+#define HAS_PPC_PMC_IBM		1
+#define HAS_PPC_PMC_G4		1
+#endif
+
+
+#ifdef HAS_PPC_PMC_CLASSIC
 SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0);
 SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1);
-SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
 SYSFS_PMCSETUP(pmc1, SPRN_PMC1);
 SYSFS_PMCSETUP(pmc2, SPRN_PMC2);
 SYSFS_PMCSETUP(pmc3, SPRN_PMC3);
 SYSFS_PMCSETUP(pmc4, SPRN_PMC4);
 SYSFS_PMCSETUP(pmc5, SPRN_PMC5);
 SYSFS_PMCSETUP(pmc6, SPRN_PMC6);
+
+#ifdef HAS_PPC_PMC_G4
+SYSFS_PMCSETUP(mmcr2, SPRN_MMCR2);
+#endif
+
+#ifdef CONFIG_PPC64
 SYSFS_PMCSETUP(pmc7, SPRN_PMC7);
 SYSFS_PMCSETUP(pmc8, SPRN_PMC8);
+
+SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
 SYSFS_PMCSETUP(purr, SPRN_PURR);
 SYSFS_PMCSETUP(spurr, SPRN_SPURR);
 SYSFS_PMCSETUP(dscr, SPRN_DSCR);
 
+static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
+static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL);
+static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr);
+static SYSDEV_ATTR(purr, 0600, show_purr, store_purr);
+#endif /* CONFIG_PPC64 */
+
+#ifdef HAS_PPC_PMC_PA6T
 SYSFS_PMCSETUP(pa6t_pmc0, SPRN_PA6T_PMC0);
 SYSFS_PMCSETUP(pa6t_pmc1, SPRN_PA6T_PMC1);
 SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2);
 SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
 SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
 SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
-
 #ifdef CONFIG_DEBUG_KERNEL
 SYSFS_PMCSETUP(hid0, SPRN_HID0);
 SYSFS_PMCSETUP(hid1, SPRN_HID1);
@@ -236,28 +267,37 @@ SYSFS_PMCSETUP(tsr1, SPRN_PA6T_TSR1);
 SYSFS_PMCSETUP(tsr2, SPRN_PA6T_TSR2);
 SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3);
 #endif /* CONFIG_DEBUG_KERNEL */
+#endif /* HAS_PPC_PMC_PA6T */
 
-static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
-static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL);
-static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr);
-static SYSDEV_ATTR(purr, 0600, show_purr, store_purr);
-
+#ifdef HAS_PPC_PMC_IBM
 static struct sysdev_attribute ibm_common_attrs[] = {
 	_SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
 	_SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
 };
+#endif /* HAS_PPC_PMC_G4 */
+
+#ifdef HAS_PPC_PMC_G4
+static struct sysdev_attribute g4_common_attrs[] = {
+	_SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
+	_SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
+	_SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2),
+};
+#endif /* HAS_PPC_PMC_G4 */
 
-static struct sysdev_attribute ibm_pmc_attrs[] = {
+static struct sysdev_attribute classic_pmc_attrs[] = {
 	_SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1),
 	_SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2),
 	_SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3),
 	_SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4),
 	_SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5),
 	_SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6),
+#ifdef CONFIG_PPC64
 	_SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7),
 	_SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8),
+#endif
 };
 
+#ifdef HAS_PPC_PMC_PA6T
 static struct sysdev_attribute pa6t_attrs[] = {
 	_SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
 	_SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
@@ -298,6 +338,8 @@ static struct sysdev_attribute pa6t_attr
 	_SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3),
 #endif /* CONFIG_DEBUG_KERNEL */
 };
+#endif /* HAS_PPC_PMC_PA6T */
+#endif /* HAS_PPC_PMC_CLASSIC */
 
 struct cache_desc {
 	struct kobject kobj;
@@ -588,23 +630,36 @@ static void __cpuinit register_cpu_onlin
 	struct sysdev_attribute *attrs, *pmc_attrs;
 	int i, nattrs;
 
+#ifdef CONFIG_PPC64
 	if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
 			cpu_has_feature(CPU_FTR_SMT))
 		sysdev_create_file(s, &attr_smt_snooze_delay);
+#endif
 
 	/* PMC stuff */
 	switch (cur_cpu_spec->pmc_type) {
+#ifdef HAS_PPC_PMC_IBM
 	case PPC_PMC_IBM:
 		attrs = ibm_common_attrs;
 		nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute);
-		pmc_attrs = ibm_pmc_attrs;
+		pmc_attrs = classic_pmc_attrs;
 		break;
+#endif /* HAS_PPC_PMC_IBM */
+#ifdef HAS_PPC_PMC_G4
+	case PPC_PMC_G4:
+		attrs = g4_common_attrs;
+		nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute);
+		pmc_attrs = classic_pmc_attrs;
+		break;
+#endif /* HAS_PPC_PMC_G4 */
+#ifdef HAS_PPC_PMC_PA6T
 	case PPC_PMC_PA6T:
 		/* PA Semi starts counting at PMC0 */
 		attrs = pa6t_attrs;
 		nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute);
 		pmc_attrs = NULL;
 		break;
+#endif /* HAS_PPC_PMC_PA6T */
 	default:
 		attrs = NULL;
 		nattrs = 0;
@@ -618,6 +673,7 @@ static void __cpuinit register_cpu_onlin
 		for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
 			sysdev_create_file(s, &pmc_attrs[i]);
 
+#ifdef CONFIG_PPC64
 	if (cpu_has_feature(CPU_FTR_MMCRA))
 		sysdev_create_file(s, &attr_mmcra);
 
@@ -629,6 +685,7 @@ static void __cpuinit register_cpu_onlin
 
 	if (cpu_has_feature(CPU_FTR_DSCR))
 		sysdev_create_file(s, &attr_dscr);
+#endif /* CONFIG_PPC64 */
 
 	create_cache_info(s);
 }
@@ -671,17 +728,28 @@ static void unregister_cpu_online(unsign
 
 	/* PMC stuff */
 	switch (cur_cpu_spec->pmc_type) {
+#ifdef HAS_PPC_PMC_IBM
 	case PPC_PMC_IBM:
 		attrs = ibm_common_attrs;
 		nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute);
-		pmc_attrs = ibm_pmc_attrs;
+		pmc_attrs = classic_pmc_attrs;
+		break;
+#endif /* HAS_PPC_PMC_IBM */
+#ifdef HAS_PPC_PMC_G4
+	case PPC_PMC_G4:
+		attrs = g4_common_attrs;
+		nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute);
+		pmc_attrs = classic_pmc_attrs;
 		break;
+#endif /* HAS_PPC_PMC_G4 */
+#ifdef HAS_PPC_PMC_PA6T
 	case PPC_PMC_PA6T:
 		/* PA Semi starts counting at PMC0 */
 		attrs = pa6t_attrs;
 		nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute);
 		pmc_attrs = NULL;
 		break;
+#endif /* HAS_PPC_PMC_PA6T */
 	default:
 		attrs = NULL;
 		nattrs = 0;
@@ -695,6 +763,7 @@ static void unregister_cpu_online(unsign
 		for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
 			sysdev_remove_file(s, &pmc_attrs[i]);
 
+#ifdef CONFIG_PPC64
 	if (cpu_has_feature(CPU_FTR_MMCRA))
 		sysdev_remove_file(s, &attr_mmcra);
 
@@ -706,6 +775,7 @@ static void unregister_cpu_online(unsign
 
 	if (cpu_has_feature(CPU_FTR_DSCR))
 		sysdev_remove_file(s, &attr_dscr);
+#endif /* CONFIG_PPC64 */
 
 	remove_cache_info(s);
 }
Index: linux-work/arch/powerpc/oprofile/op_model_power4.c
===================================================================
--- linux-work.orig/arch/powerpc/oprofile/op_model_power4.c	2008-07-07 13:43:08.000000000 +1000
+++ linux-work/arch/powerpc/oprofile/op_model_power4.c	2008-08-18 12:43:43.000000000 +1000
@@ -64,7 +64,7 @@ static int power4_reg_setup(struct op_co
 	return 0;
 }
 
-extern void ppc64_enable_pmcs(void);
+extern void ppc_enable_pmcs(void);
 
 /*
  * Older CPUs require the MMCRA sample bit to be always set, but newer 
@@ -91,7 +91,7 @@ static int power4_cpu_setup(struct op_co
 	unsigned int mmcr0 = mmcr0_val;
 	unsigned long mmcra = mmcra_val;
 
-	ppc64_enable_pmcs();
+	ppc_enable_pmcs();
 
 	/* set the freeze bit */
 	mmcr0 |= MMCR0_FC;
Index: linux-work/arch/powerpc/include/asm/cputable.h
===================================================================
--- linux-work.orig/arch/powerpc/include/asm/cputable.h	2008-08-12 13:13:58.000000000 +1000
+++ linux-work/arch/powerpc/include/asm/cputable.h	2008-08-18 12:43:43.000000000 +1000
@@ -62,6 +62,7 @@ enum powerpc_pmc_type {
 	PPC_PMC_DEFAULT = 0,
 	PPC_PMC_IBM = 1,
 	PPC_PMC_PA6T = 2,
+	PPC_PMC_G4 = 3,
 };
 
 struct pt_regs;

^ permalink raw reply

* Re: [Bugme-new] [Bug 11027] New: random forward time jumps
From: Tony Breeds @ 2008-08-18  4:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linuxppc-dev, anton, Martin Bligh
In-Reply-To: <20080703190220.a92d02fa.akpm@linux-foundation.org>

On Thu, Jul 03, 2008 at 07:02:20PM -0700, Andrew Morton wrote:
> On Fri, 4 Jul 2008 11:50:22 +1000 Tony Breeds <tony@bakeyournoodle.com> wrote:
> 
> > On Thu, Jul 03, 2008 at 05:59:32PM -0700, Andrew Morton wrote:
> >  
> > > Nope, the only account matching .*ppc.* and .*power.* is
> > > platform_ppc-32@kernel-bugs.osdl.org.  (I have elevated bugzilla perms
> > > so I can can query the users list) (everyone should have this - it's
> > > handy).
> > > 
> > > There is a category "Platform Specific/Hardware"/PPC-64.  Those go to
> > > anton@samba.org.
> > 
> > Can you get this changed to platform_ppc-64@kernel-bugs.osdl.org
> > (obvisouly this'll need to be created)?
> >  
> > > There is a category "Platform Specific/Hardware"/PPC-62.  Those go to
> > > platform_ppc-32@kernel-bugs.osdl.org.
> > > 
> > > So setting a watch on both those accounts would suit.
> > 
> > Then the linuxppc-dev "person" can watch both of them.  Seems slightly
> > more "offical".
> > 
> > > Or you can just ignore it all.  I screen all bugzilla reports and will
> > > ensure that suitable people know about them.
> > 
> > Yeah we could but it'd be easier for you if we didn't :)
> > 
> 
> umm, Martin, can you please advise?

Did we get anywhere with this?  I'm currently watching
anton@samba.org and platform_ppc-32@kernel-bugs.osdl.org but I feel a little
like a perv ;P

Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!

^ permalink raw reply

* [git pull] Please pull powerpc.git merge branch
From: Paul Mackerras @ 2008-08-18  5:01 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, akpm, linux-kernel

Linus,

Please pull from the 'merge' branch of

git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git merge

to get fixes for various bugs on powerpc, as listed below.

Thanks,
Paul.

 arch/powerpc/include/asm/hvcall.h               |   22 +++++++++
 arch/powerpc/include/asm/irqflags.h             |    5 +-
 arch/powerpc/include/asm/mmu_context.h          |    1 
 arch/powerpc/include/asm/systbl.h               |    2 -
 arch/powerpc/kernel/head_32.S                   |    2 -
 arch/powerpc/kernel/lparcfg.c                   |    5 ++
 arch/powerpc/kernel/misc_32.S                   |    2 -
 arch/powerpc/kernel/module.c                    |   15 ------
 arch/powerpc/kernel/sys_ppc32.c                 |   57 -----------------------
 arch/powerpc/platforms/pseries/plpar_wrappers.h |   27 ++++++++++-
 arch/powerpc/platforms/pseries/setup.c          |   28 ++++++++---
 11 files changed, 78 insertions(+), 88 deletions(-)

Benjamin Herrenschmidt (2):
      powerpc: Fix loss of vdso on fork on 32-bit
      powerpc: Fix lockdep IRQ tracing bug

Brian King (1):
      powerpc: Fix CMM page loaning on 64k page kernel with 4k hardware pages

Christoph Hellwig (1):
      powerpc: Use generic compat_sys_old_readdir

Paul Collins (1):
      powerpc/kexec: Fix up KEXEC_CONTROL_CODE_SIZE missed during conversion

Robert Jennings (2):
      powerpc: Make CMO paging space pool ID and page size available
      powerpc: Add CMO enabled flag and paging space data to lparcfg

Rocky Craig (1):
      powerpc: Fix TLB invalidation on boot on 32-bit

Steven Rostedt (1):
      powerpc: Remove dead module_find_bug code

^ permalink raw reply

* Re: How to use ttyUL0 as input and use VGA as display?
From: wangyanlong @ 2008-08-18  6:18 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <48A6CE85.2060207@denx.de>


Hi,
   Thanks for all your replies :)
   if  i set console like this " console=tty0 console=ttyUL0,9600 
root=/dev/ram". The boot message display on both of  serial port and VGA.
But when the system come to the "sh", the VGA display no change at all ,and
all message comeout on serial port.The words i type only show on the serial
port , the VGA is no change:(
   regards:)
yanlong
-- 
View this message in context: http://www.nabble.com/How-to-use-ttyUL0-as-input-and-use-VGA-as-display--tp19010756p19026472.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply

* WARNING: "setup_irq" [/home/misbah/driver_Hwtimer/omap_timer.ko] undefined!
From: Misbah khan @ 2008-08-18  6:23 UTC (permalink / raw)
  To: linuxppc-embedded


Hi all,

I am compiling a driver code which is giving the compilation error for
"setup_irq" function not defined. I am including all the header file for for
its declaration. Other inbuilt drivers which are already there with the
kernel source is also giving error if i compile seperatly. 

I have no idea why it is not able to find the setup_irq function where in it
has the extern declaration in the file /linux/irq.h 

Insted if this function if i use request_irq to hook the interrupt it
compiles but it does not gets the interrupt 

can any one suggest me where am i going wrong :(

What could be the possible reason to such problem ...


--- Misbah <><
-- 
View this message in context: http://www.nabble.com/WARNING%3A-%22setup_irq%22---home-misbah-driver_Hwtimer-omap_timer.ko--undefined%21-tp19026508p19026508.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply

* how to measure usb data transfer rate.
From: paddy @ 2008-08-18  6:30 UTC (permalink / raw)
  To: linuxppc-embedded

Hi,

I need to measure USB data transfer  rate ( target is USB peripheral & 
running on Linux 2.6.21 ) . Can any one suggest me  how to measure USB 
data transfer rate ?.

Thanks & Regards,
Padmanabha.s

^ permalink raw reply

* [MPC7448] machdep_calls
From: Sébastien Chrétien @ 2008-08-18  8:45 UTC (permalink / raw)
  To: Linuxppc-dev

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

Hello,

I am developping a Linux for my PPC Board. I must write a define_machine
structure (marchdep_calls). Where can I find some Information about
functions of this structure ?

Thanx
Sébastien Chrétien

[-- Attachment #2: Type: text/html, Size: 237 bytes --]

^ permalink raw reply

* Kernel panic : No Init Found
From: Fabien Oriede @ 2008-08-18  9:11 UTC (permalink / raw)
  To: linuxppc-embedded

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

Hi all,
I have downloaded the SELF pRamdisk image from the DENX website and I placed it in FLASH at 0xFFC00000. The init file is in /sbin/init. When I try to boot Linux with "bootm ffa00000 ffc00000", Linux mounts the initrd image and next, it shows the message "No Init Found" even if I have "init=/sbin/init" in the kernel command line.
Does I need to activate MTD options in the kernel to use an initrd image ?
Thanks,
Fabien.


      _____________________________________________________________________________ 
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr

[-- Attachment #2: Type: text/html, Size: 975 bytes --]

^ permalink raw reply

* Re: [MPC7448] machdep_calls
From: Benjamin Herrenschmidt @ 2008-08-18  9:27 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: Linuxppc-dev
In-Reply-To: <319b0ac50808180145r44a1b64fhd09c038ce45bb206@mail.gmail.com>

On Mon, 2008-08-18 at 10:45 +0200, Sébastien Chrétien wrote:
> Hello,
> 
> I am developping a Linux for my PPC Board. I must write a
> define_machine structure (marchdep_calls). Where can I find some
> Information about functions of this structure ?

It isn't well documented unfortunately. Best is to look at what others
do... and then find your way through.

I agree somebody should write dome doco one day ... in the meantime,
feel free to ask questions here.

Cheers,
Ben.

^ permalink raw reply

* [PATCH] MPC52XX: Don't touch pipelining for MPC5200B
From: Wolfram Sang @ 2008-08-18  9:31 UTC (permalink / raw)
  To: linuxppc-embedded

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


MPC5200 needs to have pipelining disabled for ATA to work. MPC5200B does not.
So, for the latter, don't touch the original setting from the bootloader.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---

This needs some testing IMHO. Most configs in U-Boot tend to enable pipelining,
which then used to be disabled by the kernel. So, on the one hand, this change
would enable what is originally wanted; on the other hand, systems may run
under a new configuration and need to be checked for regressions. Especially as
there can be puzzling effects, like for one setup here, FEC only works reliably
with pipelining enabled.

 arch/powerpc/platforms/52xx/mpc52xx_common.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: playground/arch/powerpc/platforms/52xx/mpc52xx_common.c
===================================================================
--- playground.orig/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ playground/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -99,12 +99,13 @@
 	out_be32(&xlb->master_pri_enable, 0xff);
 	out_be32(&xlb->master_priority, 0x11111111);
 
+#if defined(CONFIG_PPC_MPC5200_BUGFIX)
 	/* Disable XLB pipelining
 	 * (cfr errate 292. We could do this only just before ATA PIO
 	 *  transaction and re-enable it afterwards ...)
 	 */
 	out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
-
+#endif
 	iounmap(xlb);
 }
 
-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] MPC52XX: Don't touch pipelining for MPC5200B
From: Arnd Bergmann @ 2008-08-18 10:49 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: Wolfram Sang
In-Reply-To: <20080818093132.GA4282@pengutronix.de>

On Monday 18 August 2008, Wolfram Sang wrote:
> MPC5200 needs to have pipelining disabled for ATA to work. MPC5200B does =
not.
> So, for the latter, don't touch the original setting from the bootloader.

> +#if defined(CONFIG_PPC_MPC5200_BUGFIX)
> =A0=A0=A0=A0=A0=A0=A0=A0/* Disable XLB pipelining

Please make this a run-time conditional instead of compile-time.
Your current patch is still broken if you want to have a common
kernel for MPC5200 and MPC5200B.

	Arnd <><

^ permalink raw reply

* Re: [MPC7448] machdep_calls
From: Sébastien Chrétien @ 2008-08-18 11:22 UTC (permalink / raw)
  To: benh; +Cc: Linuxppc-dev
In-Reply-To: <1219051624.28339.39.camel@pasglop>

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

Ok I am going to copy some examples.

2008/8/18, Benjamin Herrenschmidt <benh@kernel.crashing.org>:
>
> On Mon, 2008-08-18 at 10:45 +0200, Sébastien Chrétien wrote:
> > Hello,
> >
> > I am developping a Linux for my PPC Board. I must write a
> > define_machine structure (marchdep_calls). Where can I find some
> > Information about functions of this structure ?
>
>
> It isn't well documented unfortunately. Best is to look at what others
> do... and then find your way through.
>
> I agree somebody should write dome doco one day ... in the meantime,
> feel free to ask questions here.
>
> Cheers,
> Ben.
>
>
>

[-- Attachment #2: Type: text/html, Size: 924 bytes --]

^ permalink raw reply

* Re: [MPC7448] machdep_calls
From: Sébastien Chrétien @ 2008-08-18 11:35 UTC (permalink / raw)
  To: benh; +Cc: Linuxppc-dev
In-Reply-To: <319b0ac50808180422r504a012djb971bf80e819a6d2@mail.gmail.com>

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

Can somebody explain me the aim of the function  "setup_arch" in the
machine_call structure ?

2008/8/18, Sébastien Chrétien <sebastien.chretien.enseirb@gmail.com>:
>
> Ok I am going to copy some examples.
>
> 2008/8/18, Benjamin Herrenschmidt <benh@kernel.crashing.org>:
>>
>> On Mon, 2008-08-18 at 10:45 +0200, Sébastien Chrétien wrote:
>> > Hello,
>> >
>> > I am developping a Linux for my PPC Board. I must write a
>> > define_machine structure (marchdep_calls). Where can I find some
>> > Information about functions of this structure ?
>>
>>
>> It isn't well documented unfortunately. Best is to look at what others
>> do... and then find your way through.
>>
>> I agree somebody should write dome doco one day ... in the meantime,
>> feel free to ask questions here.
>>
>> Cheers,
>> Ben.
>>
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 1504 bytes --]

^ permalink raw reply

* Clock / Timebase / Bus Frequencies Help
From: richw @ 2008-08-18 11:52 UTC (permalink / raw)
  To: linuxppc-dev

We've got an 8347 based board very similar to the A&M asp8347=2E Core cloc=
k
is 400MHz=2E Bus clock is 266666666Hz=2E
According to the data sheet for the 8347, the decrementer clock runs at a
quarter of the rate of the bus clock=2E I have two questions:
In arch/powerpc/boot/redboot-83xx=2Ec, the timebase clock is passed to
dt=5Ffixup=5Fcpu=5Fclocks() as bi=5Fbusfreq / 16=2E If I leave it like thi=
s, my
system clock runs approximately 4 times too fast=2E=20
Can anyone point me in the direction of an explanation for the div by 16
rather than 4=3F

If I change the call to dt=5Ffixup=5Fcpu=5Fclocks so that bi=5Fbusfreq/4 i=
s passed
in, then the clock runs more accurately=2E However, its still not correct=2E=

This gives a decrementer frequency of 66666666Hz, but if I hard code the
value to 66000000Hz, the clock runs accurately=2E
Can anyone shed any light on why the value passed in by the boot loader
(redboot) seems to be inaccurate=2E

Cheers,


Richard=2E



--------------------------------------------------------------------
mail2web LIVE =96 Free email based on Microsoft=AE Exchange technology -
http://link=2Email2web=2Ecom/LIVE

^ permalink raw reply

* Re: [MPC7448] machdep_calls
From: Michael Ellerman @ 2008-08-18 12:20 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: Linuxppc-dev
In-Reply-To: <319b0ac50808180435o4a8e5bebr79f86e17ba2fb9af@mail.gmail.com>

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

On Mon, 2008-08-18 at 13:35 +0200, Sébastien Chrétien wrote:
> Can somebody explain me the aim of the function  "setup_arch" in the
> machine_call structure ?

Is this MPC7448 anything like an mpc7448hpc2 ?

If so maybe you should start by looking at the code for it in:

arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c

Even if it's not related, that will give you some idea of what the
callbacks are for.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] Linux Device Driver for Xilinx LL TEMAC 10/100/1000 Ethernet NIC
From: Ben Hutchings @ 2008-08-18 12:30 UTC (permalink / raw)
  To: David H. Lynch Jr.; +Cc: netdev, linuxppc-embedded
In-Reply-To: <48A7B01C.2070403@dlasys.net>

David H. Lynch Jr. wrote:
[...]
>  drivers/net/Kconfig            |    5
>  drivers/net/Makefile           |    1
>  drivers/net/xps_lltemac.c      | 1283
> ++++++++++++++++++++++++++++++++++++++++

You need to disable line-wrapping for posted patches.  If your mailer
always wraps the body of a message, send the patch as an attachment.

Some of the code appears to be indented wrongly but that may also have
been broken by your mailer.  Use scripts/checkpatch.pl to find the
formatting errors.

[...]
> diff --git a/drivers/net/xps_lltemac.c b/drivers/net/xps_lltemac.c
> new file mode 100644
> index 0000000..1f2c158
> --- /dev/null
> +++ b/drivers/net/xps_lltemac.c
> @@ -0,0 +1,1283 @@
> +/*======================================================================
> +
> + Driver for Xilinx temac ethernet NIC's
> +
> + Author: Yoshio Kashiwagi
> + Copyright (c) 2008 Nissin Systems Co.,Ltd.
> +
> + Revisons: David H. Lynch Jr. <dhlii@dlasys.net>
> + Copyright (C) 2005-2008 DLA Systems
> +
> +======================================================================*/
> +
> +#define DRV_NAME        "xilinx_lltemac"

Should be "xps_lltemac" to match the module name.

[...]
> +#include <asm/io.h>

Should be <linux/io.h>; <asm/io.h> doesn't define the same things on every
architecture.

> +/* register access modes */
> +typedef enum { REG_DCR = 1, REG_IND, REG_DIR} REG_MODE;

typedef'd names are deprecated, and enum/struct/union names should be
lower-case.

[...]
> +/* packet size info */
> +#define XTE_MTU                     1500        /* max MTU size of
> Ethernet frame */
> +#define XTE_HDR_SIZE                14          /* size of Ethernet
> header */
> +#define XTE_TRL_SIZE                4           /* size of Ethernet
> trailer (FCS) */
> +#define XTE_MAX_FRAME_SIZE          (XTE_MTU + XTE_HDR_SIZE + XTE_TRL_SIZE)

What about VLAN tags?

[...]
> This option defaults to enabled (set) */
> +#define XTE_OPTION_TXEN                         (1 << 11)   /**< Enable
> the transmitter.  This option defaults to enabled (set) */
> +#define XTE_OPTION_RXEN                         (1 << 12)   /**< Enable
> the receiver This option defaults to enabled (set) */
> +#define XTE_OPTION_DEFAULTS                     \
> +    (XTE_OPTION_TXEN |            \
> +     XTE_OPTION_FLOW_CONTROL |                  \
> +     XTE_OPTION_RXEN)                /**< Default options set when
> device is initialized or reset */

"/**<" looks like the start of a doxygen comment.  You should use kernel-
doc format for structured comments.

[...]
> +#define ALIGNMENT       32

That name is a bit generic and might result in a clash later.  How about
using XTE_ALIGNMENT instead?

[...]
> +static u32
> +_ior(u32 offset)
> +{
> +    u32 value;
> +    value = (*(volatile u32 *)(offset));
> +    __asm__ __volatile__("eieio");
> +    return value;
> +}
> +
> +static void
> +_iow(u32 offset, u32 value)
> +{
> +    (*(volatile u32 *)(offset) = value);
> +    __asm__ __volatile__("eieio");
> +}

Why aren't you using the generic I/O functions?

If this driver is PowerPC specific, you need to declare that dependency
in Kconfig.

[...]
> +/***************************************************************************
> + * Reads an MII register from the MII PHY attached to the Xilinx Temac.
> + *
> + * Parameters:
> + *   dev      - the temac device.
> + *   phy_addr - the address of the PHY [0..31]
> + *   reg_num  - the number of the register to read. 0-6 are defined by
> + *              the MII spec, but most PHYs have more.
> + *   reg_value - this is set to the specified register's value
> + *
> + * Returns:
> + *   Success or Failure
> + */

Again, use kernel-doc for structured comments.

The "Returns" description is wrong.

> +static unsigned int
> +mdio_read(struct net_device *ndev, int phy_id, int reg_num)
> +{
> +	struct temac_local *lp = netdev_priv(ndev);
> +    u32 timeout = PHY_TIMEOUT;
> +    u32 rv = 0;
> +    unsigned long flags;
> +
> +    if (lp->mii) {
> +        spin_lock_irqsave(&lp->lock, flags);
> +
> +        tiow(ndev, XTE_LSW0_OFFSET, ((phy_id << 5) | (reg_num)));

You need to range-check reg_num before this point.

> +        tiow(ndev, XTE_CTL0_OFFSET, XTE_MIIMAI_OFFSET | (lp->emac_num
> << 10));
> +        while(!(tior(ndev, XTE_RDY0_OFFSET) & XTE_RSE_MIIM_RR_MASK) &&
> timeout--);

You must not use a simple counter for timing loops.  Use udelay() to wait
between polling attempts.  Also, never put a semi-colon on the same line
as the while-statement.

> +        rv = tior(ndev, XTE_LSW0_OFFSET);
> +
> +        spin_unlock_irqrestore(&lp->lock, flags);
> +    }
> +    return rv;
> +}

The same problems apply to mdio_write(), emac_cfg_read() and
emac_cfg_write().

> +static u32
> +emac_cfg_setclr(struct net_device *ndev, u32 reg_num, u32 val, int flg)
> +{
> +        u32 Reg = emac_cfg_read(ndev, reg_num) & ~val;
> +        if (flg)
> +            Reg |= val;
> +        emac_cfg_write(ndev, reg_num, Reg);
> +        return 0;
> +}
> +
> +/*
> +Changes the mac address if the controller is not running.
> +
> +static int (*set_mac_address)(struct net_device *dev, void *addr);
> +Function that can be implemented if the interface supports the ability
> to change its
> +hardware address. Many interfaces don't support this ability at all.
> Others use the
> +default eth_mac_addr implementation (from drivers/net/net_init.c).
> eth_mac_addr
> +only copies the new address into dev->dev_addr, and it does so only if
> the interface
> +is not running. Drivers that use eth_mac_addr should set the hardware MAC
> +address from dev->dev_addr in their open method.
> +
> +*/

This comment and several others following it appear to be copied from some
tutorial documentation and are not very useful for this specific
implementation.  Please remove them.

[...]
> +static void
> +temac_set_multicast_list(struct net_device *ndev)
> +{
> +	struct temac_local *lp = netdev_priv(ndev);
> +    u32 multi_addr_msw, multi_addr_lsw;
> +    int i;
> +
> +    spin_lock(&lp->lock);
> +
> +    if(ndev->flags & IFF_PROMISC) {
> +        printk(KERN_NOTICE "%s: Promiscuos mode enabled.\n", ndev->name);

Typo: the word is "promiscuous".

> +        emac_cfg_write(ndev, XTE_AFM_OFFSET, 0x80000000);
> +    }  else {
> +        struct dev_mc_list *mclist;
> +        for(i = 0, mclist = ndev->mc_list; mclist && i <
> ndev->mc_count; i++, mclist = mclist->next) {
> +
> +            if(i >= MULTICAST_CAM_TABLE_NUM) break;

So you just ignore the remaining addresses?!

Surely you should add "|| ndev->mc_count > MULTICAST_CAM_TABLE_NUM" to the
condition for setting the MAC to be promiscuous?

> +            multi_addr_msw = ((mclist->dmi_addr[3] << 24) |
> (mclist->dmi_addr[2] << 16) | (mclist->dmi_addr[1] << 8) |
> mclist->dmi_addr[0]);
> +            emac_cfg_write(ndev, XTE_MAW0_OFFSET, multi_addr_msw);
> +            multi_addr_lsw = ((mclist->dmi_addr[5] << 8) |
> mclist->dmi_addr[4]);
> +            multi_addr_lsw |= (i << 16);
> +            emac_cfg_write(ndev, XTE_MAW1_OFFSET, multi_addr_lsw);
> +        }
> +    }
> +    spin_unlock(&lp->lock);
> +}
> +
> +static void
> +temac_phy_init(struct net_device *ndev)
> +{
> +	struct temac_local *lp = netdev_priv(ndev);
> +    unsigned int ret, Reg;
> +    int ii;
> +
> +    /* Set default MDIO divisor */
> +    /* Set up MII management registers to write to PHY  */
> +    emac_cfg_write(ndev, XTE_MC_OFFSET, XTE_MC_MDIO_MASK |
> XTE_MDIO_DIV_DFT);
> +
> +    /*
> +       Set A-N Advertisement Regs for Full Duplex modes ONLY
> +       address 4 = Autonegotiate Advertise Register
> +       Disable 1000 Mbps for negotiation if not built for GEth

There's no conditional here so this last line doesn't make sense.

> +     */
> +    mdio_write(ndev, PHY_NUM, MII_ADVERTISE, mdio_read(ndev, PHY_NUM,
> MII_ADVERTISE) | ADVERTISE_10FULL | ADVERTISE_100FULL | ADVERTISE_CSMA);
> +    mdio_write(ndev, PHY_NUM, MII_CTRL1000, ADVERTISE_1000FULL);
> +
> +    /*
> +       Soft reset the PHY
> +       address 0 = Basic Mode Control Register

You're using MII_BMCR so this line of the comment is unneeded.

> +     */
> +    mdio_write(ndev, PHY_NUM, MII_BMCR, mdio_read(ndev, PHY_NUM,
> MII_BMCR) | BMCR_RESET | BMCR_ANENABLE | BMCR_ANRESTART);
> +
> +    /* Wait for a PHY Link (auto-negotiation to complete)...  */

Why?  You should handle AN using a delayed work item or PHY interrupts.

[...]
> +/* this is how to get skb's aligned !!! */

We know.

> +        align = BUFFER_ALIGN(skb->data);
> +        if(align)
> +            skb_reserve(skb, align);

There's no harm in passing 0 to skb_reserve; remove the test and combine
the remaining two lines.

[...]
> +    sd_iow(ndev, TX_CHNL_CTRL, 0x10220400 | CHNL_CTRL_IRQ_EN |
> CHNL_CTRL_IRQ_DLY_EN | CHNL_CTRL_IRQ_COAL_EN);
> +    /* sd_iow(ndev, TX_CHNL_CTRL, 0x10220483); */
> +    /*sd_iow(ndev, TX_CHNL_CTRL, 0x00100483); */
> +    sd_iow(ndev, RX_CHNL_CTRL, 0xff010000 | CHNL_CTRL_IRQ_EN |
> CHNL_CTRL_IRQ_DLY_EN | CHNL_CTRL_IRQ_COAL_EN | CHNL_CTRL_IRQ_IOE);
> +    /* sd_iow(ndev, RX_CHNL_CTRL, 0xff010283); */

Don't comment-out code.  If it's wrong, delete it.

[...]
> +/*****************************************************************************/
> +/**
> + * Set options for the driver/device. The driver should be stopped with
> + * XTemac_Stop() before changing options.
> + *
> + * @param InstancePtr is a pointer to the instance to be worked on.
> + * @param Options are the options to set. Multiple options can be set
> by OR'ing
> + *        XTE_*_OPTIONS constants together. Options not specified are not
> + *        affected.
> + *
> + * @return
> + * - 0 if the options were set successfully
> + * - XST_DEVICE_IS_STARTED if the device has not yet been stopped
> + * - XST_NO_FEATURE if setting an option requires HW support not present
> + *
> + * @note
> + * See xtemac.h for a description of the available options.
> +
> ******************************************************************************/

Kill this comment; it's in the wrong format and full of misinformation.

> +static void
> +temac_hard_start_xmit_done(struct net_device *ndev)
> +{
[...]
> +    if(netif_queue_stopped(ndev)) {
> +        netif_wake_queue(ndev);

Remove the test; netif_wake_queue() does that itself.

> +    }
> +}
> +
> +static int
> +temac_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> +{
> +	struct temac_local *lp = netdev_priv(ndev);
> +    struct cdmac_bd *cur_p, *start_p, *tail_p;
> +    int i;
> +    unsigned long num_frag;
> +    skb_frag_t *frag;
> +
> +    spin_lock(&lp->tx_lock);

The kernel has its own TX lock so you shouldn't need this.  Use
netif_tx_lock() to synchronise TX reconfiguration with this.

> +    num_frag = skb_shinfo(skb)->nr_frags;
> +    frag = &skb_shinfo(skb)->frags[0];
> +    start_p = &lp->tx_bd_p[lp->tx_bd_tail];
> +    cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
> +
> +    if(cur_p->app0 & STS_CTRL_APP0_CMPLT) {
> +        if(!netif_queue_stopped(ndev)) {
> +            netif_stop_queue(ndev);
> +            spin_unlock(&lp->tx_lock);
> +            return NETDEV_TX_BUSY;
> +        }
> +        return NETDEV_TX_BUSY;

Here tx_lock is left locked if you stop the queue.  What are you trying
to do here?

[...]
> +/*
> +Stop the interface.
> +Stops the interface. The interface is stopped when it is brought down.
> +This function should reverse operations performed at open time.
> +*/
> +static int
> +temac_stop(struct net_device *ndev)
> +{
> +    return 0;

You are missing some code here...

[...]
> +static struct net_device_stats *
> +temac_get_stats(struct net_device *ndev)
> +{
> +    return netdev_priv(ndev);

Not even the right type.  Do you read your compiler warnings?

> +}
> +
> +static int
> +temac_open(struct net_device *ndev)
> +{
> +
> +    return 0;

You have got to be kidding.

[...]
> +static int
> +temac_change_mtu(struct net_device *ndev, int newmtu)
> +{
> +    dev_info(ndev, "new MTU %d\n", newmtu);
> +    ndev->mtu = newmtu; /* change mtu in net_device structure */

Needs range-checking.  Or you can just use the default implementation.

> +    return 0;
> +}
[...]

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
From: Laurent Pinchart @ 2008-08-18 13:58 UTC (permalink / raw)
  To: avorontsov
  Cc: David Brownell, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linuxppc-dev, Li Yang, Timur Tabi
In-Reply-To: <20080814151022.GA9885@oksana.dev.rtsoft.ru>

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

On Thursday 14 August 2008, Anton Vorontsov wrote:
> On Thu, Aug 14, 2008 at 04:45:52PM +0200, Laurent Pinchart wrote:
> > On Thursday 14 August 2008, Anton Vorontsov wrote:
> > > On Thu, Aug 14, 2008 at 04:04:18PM +0200, Laurent Pinchart wrote:
> > > > On Friday 08 August 2008, Anton Vorontsov wrote:
> > > > > We'll need this function to write platform-specific hooks to deal
> > > > > with pin's dedicated functions. Quite obviously this will work only
> > > > > for the platforms with 1-to-1 GPIO to PIN mapping.
> > > > > 
> > > > > This is stopgap solution till we think out and implement a proper
> > > > > api (pinlib?).
> > > > 
> > > > How do you support reverting the GPIO mode to non-dedicated ?
> > > 
> > > As we always do with the GPIO API: gpio_direction_*() calls.
> > 
> > So the proper sequence to configure a pin in dedicated mode is to set
> > the direction first (which will unset the dedicated mode bit) and
> > then set dedicated mode (which will not touch the direction bit) ?
> 
> Not exactly. But you can do this way, if you need to preserve
> a direction. What I did is a bit different though.
> 
> qe_gpio_set_dedicated() actually just restores a mode that
> firmware had set up, including direction (since direction could
> be a part of dedicated configuration).
> 
> That is, upon GPIO controller registration, we save all registers,
> then driver can set up a pin to a GPIO mode via standard API, and
> then it can _revert_ a pin to a dedicated function via
> qe_gpio_set_dedicated() call. Dedicated function is specified by
> the firmware (or board file), we're just restoring it.

The semantic of the set_dedicated() operation needs to be clearly defined then. I can live with this behaviour, but it might not be acceptable for everybody.

Your patch requires the firmware to set a pin in dedicated mode at bootup in order to be used later in dedicated mode. If, for some reason (driver not loaded, ...), no GPIO user shows up for that pin, it will stay configured in dedicated mode.

It might be better to set the PAR bit unconditionally in qe_gpio_set_dedicated() instead of restoring its value. That way the board initialization code could just set the DIR, DAT and ODR bits for dedicated mode but still configure the pin in GPIO mode.

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [MPC7448] machdep_calls
From: Sébastien Chrétien @ 2008-08-18 14:17 UTC (permalink / raw)
  To: michael; +Cc: Linuxppc-dev
In-Reply-To: <1219062004.7946.5.camel@localhost>

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

The mpc7448hpc2 uses a tsi108-bridge. My board uses an IP on a FPGA.. I read
the code of mpc7448_hpc2.c.
It uses a ioremap in order to iniatilize the tsi108 registers. But I have
already initialized MMU with my registers in HEAD_32.S. Do I need to use
ioremap in setup_arch() ?




2008/8/18, Michael Ellerman <michael@ellerman.id.au>:
>
> On Mon, 2008-08-18 at 13:35 +0200, Sébastien Chrétien wrote:
> > Can somebody explain me the aim of the function  "setup_arch" in the
> > machine_call structure ?
>
>
> Is this MPC7448 anything like an mpc7448hpc2 ?
>
> If so maybe you should start by looking at the code for it in:
>
> arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
>
> Even if it's not related, that will give you some idea of what the
> callbacks are for.
>
> cheers
>
> --
> Michael Ellerman
> OzLabs, IBM Australia Development Lab
>
> wwweb: http://michael.ellerman.id.au
> phone: +61 2 6212 1183 (tie line 70 21183)
>
> We do not inherit the earth from our ancestors,
> we borrow it from our children. - S.M.A.R.T Person
>
>

[-- Attachment #2: Type: text/html, Size: 1448 bytes --]

^ permalink raw reply

* [PATCH V2] MPC52XX: Don't touch pipelining for MPC5200B
From: Wolfram Sang @ 2008-08-18 14:18 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-embedded
In-Reply-To: <200808181249.37220.arnd@arndb.de>

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


MPC5200 needs to have pipelining disabled for ATA to work. MPC5200B does not.
So, for the latter, don't touch the original setting from the bootloader.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
Hello Arnd,

On Mon, Aug 18, 2008 at 12:49:36PM +0200, Arnd Bergmann wrote:

> Please make this a run-time conditional instead of compile-time.
Like this?

..................................................................

This needs some testing IMHO. Most configs in U-Boot tend to enable pipelining,
which then used to be disabled by the kernel. So, on the one hand, this change
would enable what is originally wanted; on the other hand, systems may run
under a new configuration and need to be checked for regressions. Especially as
there can be puzzling effects, like for one setup here, FEC only works reliably
with pipelining enabled.

 arch/powerpc/platforms/52xx/mpc52xx_common.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Index: arch/powerpc/platforms/52xx/mpc52xx_common.c
===================================================================
--- arch/powerpc/platforms/52xx/mpc52xx_common.c.orig
+++ arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -99,11 +99,14 @@
 	out_be32(&xlb->master_pri_enable, 0xff);
 	out_be32(&xlb->master_priority, 0x11111111);
 
-	/* Disable XLB pipelining
+	/*
+	 * Disable XLB pipelining
 	 * (cfr errate 292. We could do this only just before ATA PIO
 	 *  transaction and re-enable it afterwards ...)
+	 * Not needed on MPC5200B.
 	 */
-	out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
+	if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR)
+		out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
 
 	iounmap(xlb);
 }

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
From: Anton Vorontsov @ 2008-08-18 14:33 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: David Brownell, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linuxppc-dev, Li Yang, Timur Tabi
In-Reply-To: <200808181558.50182.laurentp@cse-semaphore.com>

On Mon, Aug 18, 2008 at 03:58:46PM +0200, Laurent Pinchart wrote:
[...]
> > Not exactly. But you can do this way, if you need to preserve
> > a direction. What I did is a bit different though.
> > 
> > qe_gpio_set_dedicated() actually just restores a mode that
> > firmware had set up, including direction (since direction could
> > be a part of dedicated configuration).
> > 
> > That is, upon GPIO controller registration, we save all registers,
> > then driver can set up a pin to a GPIO mode via standard API, and
> > then it can _revert_ a pin to a dedicated function via
> > qe_gpio_set_dedicated() call. Dedicated function is specified by
> > the firmware (or board file), we're just restoring it.
> 
> The semantic of the set_dedicated() operation needs to be clearly
> defined then.

It is. We set up a dedicated function that firmware (or board file)
has configured.

> I can live with this behaviour, but it might not be
> acceptable for everybody.

For example?

> Your patch requires the firmware to set a pin in dedicated mode at
> bootup in order to be used later in dedicated mode.

Yes. On a PowerPC this is always true: firmware should set up PIO
config. Linux' board file could fixup the firmware though.

Another option would be to add some argument to the set_dedicated
call, thus the software could specify arbitrary dedicated
function (thus no need to save/restore anything). But this would
be SOC-model specific, thus no driver can use this argument anyway.

> If, for some
> reason (driver not loaded, ...), no GPIO user shows up for that
> pin, it will stay configured in dedicated mode.

Yes.

> It might be better to set the PAR bit unconditionally in

Why it might be better? That way you may set up wrong _GPIO_
mode, because you didn't set PAR bit (when PAR bit set
DIR/ODR/DAT bits are losing their meanings).

> qe_gpio_set_dedicated() instead of restoring its value. That way
> the board initialization code could just set the DIR, DAT and ODR
> bits for dedicated mode but still configure the pin in GPIO mode.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply

* Re: [PATCH] [fs_enet] powerpc: Fix SCC Ethernet on CPM2, and crash in fs_enet_rx_napi()
From: Kumar Gala @ 2008-08-18 14:34 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev, jeff, netdev
In-Reply-To: <20080612003219.12670.66981.stgit@vitb-lp>


On Jun 11, 2008, at 7:32 PM, Vitaly Bordug wrote:

> From: Heiko Schocher <hs@denx.de>
>
> Initially posted on:
> http://ozlabs.org/pipermail/linuxppc-dev/2008-January/049682.html
> Feedback is addressed in this version (yes, this patch was floating  
> around for a while...)
>
> Signed-off-by: Heiko Schocher <hs@denx.de>
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> ---
>
> drivers/net/fs_enet/fs_enet-main.c |   10 +++++++++-
> drivers/net/fs_enet/mac-scc.c      |    8 +++++++-
> include/asm-powerpc/cpm2.h         |    5 +++++
> 3 files changed, 21 insertions(+), 2 deletions(-)

Jeff, any reason this wasn't picked up ?

- k

^ permalink raw reply

* Re: [PATCH] Linux Device Driver for Xilinx LL TEMAC 10/100/1000 Ethernet NIC
From: Ben Hutchings @ 2008-08-18 14:36 UTC (permalink / raw)
  To: David H. Lynch Jr.; +Cc: netdev, linuxppc-embedded
In-Reply-To: <20080818123056.GA7908@solarflare.com>

I wrote:
> > +static struct net_device_stats *
> > +temac_get_stats(struct net_device *ndev)
> > +{
> > +    return netdev_priv(ndev);
> 
> Not even the right type.  Do you read your compiler warnings?

Sorry, I now see that this is correct, though it's very fragile - it will
silently break if struct temac_local is reordered.

struct net_device includes a stats buffer which you should be able to use
instead of adding your own in struct temac_local.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* [PATCH 1/3 v2] powerpc: make CMO paging space pool ID and page size available
From: Robert Jennings @ 2008-08-18 14:40 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev list, Benjamin Herrenschmidt
In-Reply-To: <20080815190730.GB20629@austin.ibm.com>

During platform setup, save off the primary/secondary paging space pool IDs
and the page size.  Added accessors in hvcall.h for these variables.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>

---
I wrote "Submitted-by" on the last patch for some strange reason, that't
the only thing changed here.

---
 arch/powerpc/include/asm/hvcall.h      |   21 +++++++++++++++++++++
 arch/powerpc/platforms/pseries/setup.c |   28 ++++++++++++++++++++--------
 2 files changed, 41 insertions(+), 8 deletions(-)

Index: b/arch/powerpc/include/asm/hvcall.h
===================================================================
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -292,6 +292,27 @@ struct hvcall_mpp_data {

 int h_get_mpp(struct hvcall_mpp_data *);

+#ifdef CONFIG_PPC_PSERIES
+extern int CMO_PrPSP;
+extern int CMO_SecPSP;
+extern unsigned long CMO_PageSize;
+
+static inline int cmo_get_primary_psp(void)
+{
+	return CMO_PrPSP;
+}
+
+static inline int cmo_get_secondary_psp(void)
+{
+	return CMO_SecPSP;
+}
+
+static inline unsigned long cmo_get_page_size(void)
+{
+	return CMO_PageSize;
+}
+#endif /* CONFIG_PPC_PSERIES */
+
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_HVCALL_H */
Index: b/arch/powerpc/platforms/pseries/setup.c
===================================================================
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -68,6 +68,9 @@
 #include "plpar_wrappers.h"
 #include "pseries.h"

+int CMO_PrPSP = -1;
+int CMO_SecPSP = -1;
+unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT);

 int fwnmi_active;  /* TRUE if an FWNMI handler is present */

@@ -325,8 +328,7 @@ void pSeries_cmo_feature_init(void)
 {
 	char *ptr, *key, *value, *end;
 	int call_status;
-	int PrPSP = -1;
-	int SecPSP = -1;
+	int page_order = IOMMU_PAGE_SHIFT;

 	pr_debug(" -> fw_cmo_feature_init()\n");
 	spin_lock(&rtas_data_buf_lock);
@@ -365,21 +367,31 @@ void pSeries_cmo_feature_init(void)
 				break;
 			}

-			if (0 == strcmp(key, "PrPSP"))
-				PrPSP = simple_strtol(value, NULL, 10);
+			if (0 == strcmp(key, "CMOPageSize"))
+				page_order = simple_strtol(value, NULL, 10);
+			else if (0 == strcmp(key, "PrPSP"))
+				CMO_PrPSP = simple_strtol(value, NULL, 10);
 			else if (0 == strcmp(key, "SecPSP"))
-				SecPSP = simple_strtol(value, NULL, 10);
+				CMO_SecPSP = simple_strtol(value, NULL, 10);
 			value = key = ptr + 1;
 		}
 		ptr++;
 	}

-	if (PrPSP != -1 || SecPSP != -1) {
+	/* Page size is returned as the power of 2 of the page size,
+	 * convert to the page size in bytes before returning
+	 */
+	CMO_PageSize = 1 << page_order;
+	pr_debug("CMO_PageSize = %lu\n", CMO_PageSize);
+
+	if (CMO_PrPSP != -1 || CMO_SecPSP != -1) {
 		pr_info("CMO enabled\n");
-		pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", PrPSP, SecPSP);
+		pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP,
+		         CMO_SecPSP);
 		powerpc_firmware_features |= FW_FEATURE_CMO;
 	} else
-		pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", PrPSP, SecPSP);
+		pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP,
+		         CMO_SecPSP);
 	spin_unlock(&rtas_data_buf_lock);
 	pr_debug(" <- fw_cmo_feature_init()\n");
 }

----- End forwarded message -----

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox