LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* simple gpio driver
From: Heiko Schocher @ 2009-08-13  5:49 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: linuxppc-dev

Hello Anton,

i am trying to use the arch/powerpc/sysdev/simple_gpio.c driver,
for accessing some gpios, and found, that u8_gpio_get()
returns not only a 1 or a 0, instead it returns the real bit
position from the gpio:

gpio    return
base	value
0	0/0x01
1	0/0x02
2	0/0x04
3	0/0x08
4	0/0x10
5	0/0x20
6	0/0x40
7	0/0x80

I also use the arch/powerpc/platforms/52xx/mpc52xx_gpio.c and
mpc52xx_gpt.c drivers, they all return for a gpio just a 1 or 0,
which seems correct to me, because a gpio can have only 1 or 0
as state ... what do you think?

I solved this issue (if it is) with the following patch:

diff --git a/arch/powerpc/sysdev/simple_gpio.c b/arch/powerpc/sysdev/simple_gpio.c
index 43c4569..bb0d79c 100644
--- a/arch/powerpc/sysdev/simple_gpio.c
+++ b/arch/powerpc/sysdev/simple_gpio.c
@@ -46,7 +46,7 @@ static int u8_gpio_get(struct gpio_chip *gc, unsigned int gpio)
 {
 	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);

-	return in_8(mm_gc->regs) & u8_pin2mask(gpio);
+	return (in_8(mm_gc->regs) & u8_pin2mask(gpio) ? 1 : 0);
 }

 static void u8_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)

bye
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply related

* Re: [PATCH 1/1 v1] powerpc44x: Add Eiger AMCC (AppliedMicro) PPC460SX evaluation board support.
From: Felix Radensky @ 2009-08-13  6:14 UTC (permalink / raw)
  To: Feng Kan; +Cc: linuxppc-dev, Tai Tri Nguyen
In-Reply-To: <1250123927-29167-1-git-send-email-fkan@amcc.com>

Hi,

Feng Kan wrote:
> This patch adds support for the AMCC (AppliedMicro) PPC460SX Eiger evaluation board.
> 
> Signed-off-by: Tai Tri Nguyen <ttnguyen@amcc.com>
> Acked-by: Feng Kan <fkan@amcc.com>
> Acked-by: Tirumala Marri <tmarri@amcc.com>
> ---
>  arch/powerpc/boot/dts/eiger.dts            |  421 ++++++++++
>  arch/powerpc/configs/44x/eiger_defconfig   | 1200 ++++++++++++++++++++++++++++
>  arch/powerpc/platforms/44x/Kconfig         |   12 +
>  arch/powerpc/platforms/44x/ppc44x_simple.c |    1 +
>  4 files changed, 1634 insertions(+), 0 deletions(-)
>  create mode 100644 arch/powerpc/boot/dts/eiger.dts
>  create mode 100644 arch/powerpc/configs/44x/eiger_defconfig
> 
> diff --git a/arch/powerpc/boot/dts/eiger.dts b/arch/powerpc/boot/dts/eiger.dts
> new file mode 100644
> index 0000000..c4a934f
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/eiger.dts
> @@ -0,0 +1,421 @@
> +/*
> + * Device Tree Source for AMCC (AppliedMicro) Eiger(460SX)
> + *
> + * Copyright 2009 AMCC (AppliedMicro) <ttnguyen@amcc.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without
> + * any warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +/ {
> +	#address-cells = <2>;
> +	#size-cells = <1>;
> +	model = "amcc,eiger";
> +	compatible = "amcc,eiger";
> +	dcr-parent = <&{/cpus/cpu@0}>;
> +
> +	aliases {
> +		ethernet0 = &EMAC0;
> +		ethernet1 = &EMAC1;
> +		ethernet2 = &EMAC2;
> +		ethernet3 = &EMAC3;
> +		serial0 = &UART0;
> +		serial1 = &UART1;
> +	};
> +
> +	cpus {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		cpu@0 {
> +			device_type = "cpu";
> +			model = "PowerPC,460SX";
> +			reg = <0x00000000>;
> +			clock-frequency = <0>; /* Filled in by U-Boot */
> +			timebase-frequency = <0>; /* Filled in by U-Boot */
> +			i-cache-line-size = <32>;
> +			d-cache-line-size = <32>;
> +			i-cache-size = <32768>;
> +			d-cache-size = <32768>;
> +			dcr-controller;
> +			dcr-access-method = "native";
> +		};
> +	};
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x00000000 0x00000000>; /* Filled in by U-Boot */
> +	};
> +
> +	UIC0: interrupt-controller0 {
> +		compatible = "ibm,uic-460sx","ibm,uic";
> +		interrupt-controller;
> +		cell-index = <0>;
> +		dcr-reg = <0x0c0 0x009>;
> +		#address-cells = <0>;
> +		#size-cells = <0>;
> +		#interrupt-cells = <2>;
> +	};
> +
> +	UIC1: interrupt-controller1 {
> +		compatible = "ibm,uic-460sx","ibm,uic";
> +		interrupt-controller;
> +		cell-index = <1>;
> +		dcr-reg = <0x0d0 0x009>;
> +		#address-cells = <0>;
> +		#size-cells = <0>;
> +		#interrupt-cells = <2>;
> +		interrupts = <0x1e 0x4 0x1f 0x4>; /* cascade */
> +		interrupt-parent = <&UIC0>;
> +	};
> +
> +	UIC2: interrupt-controller2 {
> +		compatible = "ibm,uic-460sx","ibm,uic";
> +		interrupt-controller;
> +		cell-index = <2>;
> +		dcr-reg = <0x0e0 0x009>;
> +		#address-cells = <0>;
> +		#size-cells = <0>;
> +		#interrupt-cells = <2>;
> +		interrupts = <0xa 0x4 0xb 0x4>; /* cascade */
> +		interrupt-parent = <&UIC0>;
> +	};
> +
> +	UIC3: interrupt-controller3 {
> +		compatible = "ibm,uic-460sx","ibm,uic";
> +		interrupt-controller;
> +		cell-index = <3>;
> +		dcr-reg = <0x0f0 0x009>;
> +		#address-cells = <0>;
> +		#size-cells = <0>;
> +		#interrupt-cells = <2>;
> +		interrupts = <0x10 0x4 0x11 0x4>; /* cascade */
> +		interrupt-parent = <&UIC0>;
> +	};
> +
> +	SDR0: sdr {
> +		compatible = "ibm,sdr-460sx";
> +		dcr-reg = <0x00e 0x002>;
> +	};
> +
> +	CPR0: cpr {
> +		compatible = "ibm,cpr-460sx";
> +		dcr-reg = <0x00c 0x002>;
> +	};
> +
> +	plb {
> +		compatible = "ibm,plb-460sx", "ibm,plb4";
> +		#address-cells = <2>;
> +		#size-cells = <1>;
> +		ranges;
> +		clock-frequency = <0>; /* Filled in by U-Boot */
> +
> +		SDRAM0: sdram {
> +			compatible = "ibm,sdram-460sx", "ibm,sdram-405gp";
> +			dcr-reg = <0x010 0x002>;
> +		};
> +
> +		MAL0: mcmal {
> +			compatible = "ibm,mcmal-460sx", "ibm,mcmal2";
> +			dcr-reg = <0x180 0x62>;
> +			num-tx-chans = <4>;
> +			num-rx-chans = <32>;
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			interrupt-parent = <&UIC1>;
> +			interrupts = <	/*TXEOB*/ 0x6 0x4
> +					/*RXEOB*/ 0x7 0x4
> +					/*SERR*/  0x1 0x4
> +					/*TXDE*/  0x2 0x4
> +					/*RXDE*/  0x3 0x4
> +					/*COAL TX0*/ 0x18 0x2
> +					/*COAL TX1*/ 0x19 0x2
> +					/*COAL TX2*/ 0x1a 0x2
> +					/*COAL TX3*/ 0x1b 0x2
> +					/*COAL RX0*/ 0x1c 0x2
> +					/*COAL RX1*/ 0x1d 0x2
> +					/*COAL RX2*/ 0x1e 0x2
> +					/*COAL RX3*/ 0x1f 0x2>;
> +		};
> +
> +		POB0: opb {
> +			compatible = "ibm,opb-460sx", "ibm,opb";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			ranges = <0xb0000000 0x00000004 0xb0000000 0x50000000>;
> +			clock-frequency = <0>; /* Filled in by U-Boot */
> +
> +			EBC0: ebc {
> +				compatible = "ibm,ebc-460sx", "ibm,ebc";
> +				dcr-reg = <0x012 0x002>;
> +				#address-cells = <2>;
> +				#size-cells = <1>;
> +				clock-frequency = <0>; /* Filled in by U-Boot */
> +				/* ranges property is supplied by U-Boot */
> +				interrupts = <0x6 0x4>;
> +				interrupt-parent = <&UIC1>;
> +
> +				nor_flash@0,0 {
> +					compatible = "amd,s29gl512n", "cfi-flash";
> +					bank-width = <2>;
> +					/* reg property is supplied in by U-Boot */
> +					#address-cells = <1>;
> +					#size-cells = <1>;
> +					partition@0 {
> +						label = "kernel";
> +						reg = <0x00000000 0x001e0000>;
> +					};
> +					partition@1e0000 {
> +						label = "dtb";
> +						reg = <0x001e0000 0x00020000>;
> +					};
> +					partition@200000 {
> +						label = "ramdisk";
> +						reg = <0x00200000 0x01400000>;
> +					};
> +					partition@1600000 {
> +						label = "jffs2";
> +						reg = <0x01600000 0x00400000>;
> +					};
> +					partition@1a00000 {
> +						label = "user";
> +						reg = <0x01a00000 0x02560000>;
> +					};
> +					partition@3f60000 {
> +						label = "env";
> +						reg = <0x03f60000 0x00040000>;
> +					};
> +					partition@3fa0000 {
> +						label = "u-boot";
> +						reg = <0x03fa0000 0x00060000>;
> +					};
> +				};
> +
> +				ndfc@1,0 {
> +					compatible = "ibm,ndfc";
> +					/* reg property is supplied by U-boot */
> +					ccr = <0x00003000>;

Why don't you set EBCC bit in CCR ? It seems to be required for normal operation.


> +					bank-settings = <0x80002222>;
> +					#address-cells = <1>;
> +					#size-cells = <1>;
> +
> +					nand {
> +						#address-cells = <1>;
> +						#size-cells = <1>;
> +						partition@0 {
> +							label = "uboot";
> +							reg = <0x00000000 0x00200000>;
> +						};
> +						partition@200000 {
> +							label = "uboot-environment";
> +							reg = <0x00200000 0x00100000>;
> +						};
> +						partition@300000 {
> +							label = "linux";
> +							reg = <0x00300000 0x00300000>;
> +						};
> +						partition@600000 {
> +							label = "root-file-system";
> +							reg = <0x00600000 0x01900000>;
> +						};
> +						partition@1f00000 {
> +							label = "device-tree";
> +							reg = <0x01f00000 0x00020000>;
> +						};
> +						partition@1f20000 {
> +							label = "data";
> +							reg = <0x01f20000 0x060E0000>;
> +						};
> +					};
> +				};
> +			};
> +

Felix.

^ permalink raw reply

* Re: [PATCH] Disable PowerMac cpufreq on SMP kernels
From: Benjamin Herrenschmidt @ 2009-08-13  6:14 UTC (permalink / raw)
  To: Bastian Blank; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20090811093931.GA15940@wavehammer.waldi.eu.org>

On Tue, 2009-08-11 at 11:39 +0200, Bastian Blank wrote:
> The build of a PowerMac 32bit kernel currently fails with
> 
> error: #warning "WARNING, CPUFREQ not recommended on SMP kernels"
> 
> This patch just disables this driver on SMP kernels, as it is obviously
> not supported.
> 
> Signed-off-by: Bastian Blank <waldi@debian.org>

Why not remove the #error instead ? :-) I don't think it's still
meaningful, especially since we use the timebase for delays nowadays
which doesn't depend on the CPU frequency...

Ben.

> diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
> index 04a8061..99d3564 100644
> --- a/arch/powerpc/platforms/Kconfig
> +++ b/arch/powerpc/platforms/Kconfig
> @@ -149,7 +149,7 @@ menu "CPU Frequency drivers"
>  
>  config CPU_FREQ_PMAC
>  	bool "Support for Apple PowerBooks"
> -	depends on ADB_PMU && PPC32
> +	depends on ADB_PMU && PPC32 && !SMP
>  	select CPU_FREQ_TABLE
>  	help
>  	  This adds support for frequency switching on Apple PowerBooks,
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Benjamin Herrenschmidt @ 2009-08-13  5:48 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: mingo, linuxppc-dev, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

On Wed, 2009-08-05 at 14:08 +0900, FUJITA Tomonori wrote:

> The above swiotlb patchset was merged in -tip so I think that merging
> this patchset via -tip too is the easiest way to handle this patchset.
> 
> The patchset also is available via a git tree:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git powerpc

Hi !

While I generally agree here with the patches, I'm not sure it should be
merged via -tip since it mostly touches arch/powerpc files (and I need
to review it a bit more carefully, hopefully you'll have Ack's hitting
your mailbox later today).

Ben.

> =
>  arch/powerpc/Kconfig                       |    7 +-
>  arch/powerpc/include/asm/device.h          |    7 +-
>  arch/powerpc/include/asm/dma-mapping.h     |  318 +++-------------------------
>  arch/powerpc/include/asm/pci.h             |    4 +-
>  arch/powerpc/include/asm/swiotlb.h         |    8 +-
>  arch/powerpc/kernel/dma-iommu.c            |    2 +-
>  arch/powerpc/kernel/dma-swiotlb.c          |   53 ++---
>  arch/powerpc/kernel/dma.c                  |   13 +-
>  arch/powerpc/kernel/ibmebus.c              |    2 +-
>  arch/powerpc/kernel/pci-common.c           |    6 +-
>  arch/powerpc/kernel/vio.c                  |    2 +-
>  arch/powerpc/platforms/85xx/mpc8536_ds.c   |    3 +-
>  arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    3 +-
>  arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    3 +-
>  arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +-
>  arch/powerpc/platforms/cell/iommu.c        |    2 +-
>  arch/powerpc/platforms/ps3/system-bus.c    |    4 +-
>  include/linux/dma-mapping.h                |    1 +
>  18 files changed, 89 insertions(+), 352 deletions(-)
> 
> 
> 
> 
> 
> 
> 
> 

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Benjamin Herrenschmidt @ 2009-08-13  6:51 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: galak, Takashi Iwai, linux-kernel, mingo, linuxppc-dev
In-Reply-To: <1250142522.3587.110.camel@pasglop>

On Thu, 2009-08-13 at 16:44 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2009-08-05 at 14:08 +0900, FUJITA Tomonori wrote:
> 
> > The above swiotlb patchset was merged in -tip so I think that merging
> > this patchset via -tip too is the easiest way to handle this patchset.
> > 
> > The patchset also is available via a git tree:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git powerpc
> 
> Hi !
> 
> While I generally agree here with the patches, I'm not sure it should be
> merged via -tip since it mostly touches arch/powerpc files (and I need
> to review it a bit more carefully, hopefully you'll have Ack's hitting
> your mailbox later today).

Maybe best is that I pull your series too. Note that your patch clashes
with Takashi's addition of dma_mmap_coherent() :

http://patchwork.ozlabs.org/patch/29595/

Can you sort that out with Takashi as I'd like his patch in -next soon
too.

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH 3/3] agp/uninorth: Unify U3 and pre-U3 insert_memory and remove_memory hooks.
From: Benjamin Herrenschmidt @ 2009-08-13  7:05 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: Dave Airlie, linuxppc-dev
In-Reply-To: <1249422665-24437-3-git-send-email-michel@daenzer.net>

On Tue, 2009-08-04 at 23:51 +0200, Michel Dänzer wrote:
> From: Michel Dänzer <daenzer@vmware.com>
> 
> Signed-off-by: Michel Dänzer <daenzer@vmware.com>
> ---

Hi Michel !

While your two previous patches apply just fine, this one doesn't,
the uninorth_insert_memory() function seems to be slightly different
upstream. Does this depend on some separate yet unapplied patches ?

I'm putting 1/3 and 2/3 into my -test branch and they should hit my
-next branch in a couple of days.

Or do you prefer us to merge that via Dave ?

The thing is, stuff in -powerpc is much more likely to get some amount
of testing on actual ppc hardware than stuff in random other trees :-)

Cheers,
Ben.

>  drivers/char/agp/uninorth-agp.c |   64 +++++++--------------------------------
>  1 files changed, 11 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
> index bc8b43a..75aa33a 100644
> --- a/drivers/char/agp/uninorth-agp.c
> +++ b/drivers/char/agp/uninorth-agp.c
> @@ -144,53 +144,7 @@ static int uninorth_configure(void)
>  	return 0;
>  }
>  
> -static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
> -				int type)
> -{
> -	int i, j, num_entries;
> -	void *temp;
> -	int mask_type;
> -
> -	if (type != mem->type)
> -		return -EINVAL;
> -
> -	mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
> -	if (mask_type != 0) {
> -		/* We know nothing of memory types */
> -		return -EINVAL;
> -	}
> -
> -	if (mem->page_count == 0)
> -		return 0;
> -
> -	temp = agp_bridge->current_size;
> -	num_entries = A_SIZE_32(temp)->num_entries;
> -
> -	if ((pg_start + mem->page_count) > num_entries)
> -		return -EINVAL;
> -
> -	j = pg_start;
> -
> -	while (j < (pg_start + mem->page_count)) {
> -		if (agp_bridge->gatt_table[j])
> -			return -EBUSY;
> -		j++;
> -	}
> -
> -	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
> -		agp_bridge->gatt_table[j] =
> -			cpu_to_le32((page_to_phys(mem->pages[i]) & 0xFFFFF000UL) | 0x1UL);
> -		flush_dcache_range((unsigned long)__va(page_to_phys(mem->pages[i])),
> -				   (unsigned long)__va(page_to_phys(mem->pages[i]))+0x1000);
> -	}
> -	(void)in_le32((volatile u32*)&agp_bridge->gatt_table[pg_start]);
> -	mb();
> -
> -	uninorth_tlbflush(mem);
> -	return 0;
> -}
> -
> -static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
> +static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
>  {
>  	int i, num_entries;
>  	void *temp;
> @@ -219,14 +173,18 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
>  	for (i = 0; i < mem->page_count; ++i) {
>  		if (gp[i]) {
>  			dev_info(&agp_bridge->dev->dev,
> -				 "u3_insert_memory: entry 0x%x occupied (%x)\n",
> +				 "uninorth_insert_memory: entry 0x%x occupied (%x)\n",
>  				 i, gp[i]);
>  			return -EBUSY;
>  		}
>  	}
>  
>  	for (i = 0; i < mem->page_count; i++) {
> -		gp[i] = (page_to_phys(mem->pages[i]) >> PAGE_SHIFT) | 0x80000000UL;
> +		if (is_u3)
> +			gp[i] = (page_to_phys(mem->pages[i]) >> PAGE_SHIFT) | 0x80000000UL;
> +		else
> +			gp[i] =	cpu_to_le32((page_to_phys(mem->pages[i]) & 0xFFFFF000UL) |
> +					    0x1UL);
>  		flush_dcache_range((unsigned long)__va(page_to_phys(mem->pages[i])),
>  				   (unsigned long)__va(page_to_phys(mem->pages[i]))+0x1000);
>  	}
> @@ -236,7 +194,7 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
>  	return 0;
>  }
>  
> -int u3_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
> +int uninorth_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
>  {
>  	size_t i;
>  	u32 *gp;
> @@ -551,7 +509,7 @@ const struct agp_bridge_driver uninorth_agp_driver = {
>  	.create_gatt_table	= uninorth_create_gatt_table,
>  	.free_gatt_table	= uninorth_free_gatt_table,
>  	.insert_memory		= uninorth_insert_memory,
> -	.remove_memory		= agp_generic_remove_memory,
> +	.remove_memory		= uninorth_remove_memory,
>  	.alloc_by_type		= agp_generic_alloc_by_type,
>  	.free_by_type		= agp_generic_free_by_type,
>  	.agp_alloc_page		= agp_generic_alloc_page,
> @@ -577,8 +535,8 @@ const struct agp_bridge_driver u3_agp_driver = {
>  	.agp_enable		= uninorth_agp_enable,
>  	.create_gatt_table	= uninorth_create_gatt_table,
>  	.free_gatt_table	= uninorth_free_gatt_table,
> -	.insert_memory		= u3_insert_memory,
> -	.remove_memory		= u3_remove_memory,
> +	.insert_memory		= uninorth_insert_memory,
> +	.remove_memory		= uninorth_remove_memory,
>  	.alloc_by_type		= agp_generic_alloc_by_type,
>  	.free_by_type		= agp_generic_free_by_type,
>  	.agp_alloc_page		= agp_generic_alloc_page,
> -- 
> 1.6.3.3
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: FUJITA Tomonori @ 2009-08-13  7:07 UTC (permalink / raw)
  To: benh, mingo; +Cc: fujita.tomonori, linuxppc-dev, linux-kernel, galak
In-Reply-To: <1250142522.3587.110.camel@pasglop>

On Thu, 13 Aug 2009 15:48:42 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Wed, 2009-08-05 at 14:08 +0900, FUJITA Tomonori wrote:
> 
> > The above swiotlb patchset was merged in -tip so I think that merging
> > this patchset via -tip too is the easiest way to handle this patchset.
> > 
> > The patchset also is available via a git tree:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git powerpc
> 
> Hi !
> 
> While I generally agree here with the patches, I'm not sure it should be
> merged via -tip since it mostly touches arch/powerpc files (and I need
> to review it a bit more carefully, hopefully you'll have Ack's hitting
> your mailbox later today).

Thanks!

This patchset depends on my swiotlb cleanup patchset:

git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git swiotlb

http://marc.info/?l=linux-ia64&m=124718816520156&w=2


My swiotlb cleanup patchset has been in -tip. It might be easier to
merge both the swiotlb patchset and this patchset in powerpc tree?

^ permalink raw reply

* Re: [PATCH 2/5] Mechanism to enable use Generic NVRAM driver for different size chips
From: Benjamin Herrenschmidt @ 2009-08-13  7:15 UTC (permalink / raw)
  To: Martyn Welch; +Cc: linuxppc-dev
In-Reply-To: <20090702161224.31202.65236.stgit@ES-J7S4D2J.amer.consind.ge.com>

On Thu, 2009-07-02 at 17:12 +0100, Martyn Welch wrote:
> Remove the reliance on a staticly defined NVRAM size, allowing platforms to support NVRAMs with sizes differing from the standard. A fall back value is provided for platforms not supporting this extension.
> 
> Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>

I was about to stick 1/5 and 2/5 in -test (on the way to -next) but
I hit this when building 64-bit kernels:

/home/benh/linux-powerpc-test/arch/powerpc/platforms/pseries/nvram.c:26: error: ‘nvram_size’ redeclared as different kind of symbol
/home/benh/linux-powerpc-test/arch/powerpc/include/asm/nvram.h:111: error: previous declaration of ‘nvram_size’ was here
make[3]: *** [arch/powerpc/platforms/pseries/nvram.o] Error 1

Looks trivial enough, can you respin the patch ?

Cheers,
Ben.

> ---
> 
>  arch/powerpc/include/asm/nvram.h |    3 +++
>  arch/powerpc/kernel/setup_32.c   |    8 ++++++++
>  drivers/char/generic_nvram.c     |   27 ++++++++++++++++++++-------
>  3 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
> index efde5ac..71df8b2 100644
> --- a/arch/powerpc/include/asm/nvram.h
> +++ b/arch/powerpc/include/asm/nvram.h
> @@ -107,6 +107,9 @@ extern void	pmac_xpram_write(int xpaddr, u8 data);
>  /* Synchronize NVRAM */
>  extern void	nvram_sync(void);
>  
> +/* Determine NVRAM size */
> +extern ssize_t nvram_size(void);
> +
>  /* Normal access to NVRAM */
>  extern unsigned char nvram_read_byte(int i);
>  extern void nvram_write_byte(unsigned char c, int i);
> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
> index 1d15424..28f7570 100644
> --- a/arch/powerpc/kernel/setup_32.c
> +++ b/arch/powerpc/kernel/setup_32.c
> @@ -208,6 +208,14 @@ void nvram_write_byte(unsigned char val, int addr)
>  }
>  EXPORT_SYMBOL(nvram_write_byte);
>  
> +ssize_t nvram_size(void)
> +{
> +	if (ppc_md.nvram_size)
> +		return ppc_md.nvram_size();
> +	return -1;
> +}
> +EXPORT_SYMBOL(nvram_size);
> +
>  void nvram_sync(void)
>  {
>  	if (ppc_md.nvram_sync)
> diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
> index a00869c..e5f71f3 100644
> --- a/drivers/char/generic_nvram.c
> +++ b/drivers/char/generic_nvram.c
> @@ -2,7 +2,7 @@
>   * Generic /dev/nvram driver for architectures providing some
>   * "generic" hooks, that is :
>   *
> - * nvram_read_byte, nvram_write_byte, nvram_sync
> + * nvram_read_byte, nvram_write_byte, nvram_sync, nvram_size
>   *
>   * Note that an additional hook is supported for PowerMac only
>   * for getting the nvram "partition" informations
> @@ -28,6 +28,8 @@
>  
>  #define NVRAM_SIZE	8192
>  
> +static ssize_t nvram_len;
> +
>  static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
>  {
>  	lock_kernel();
> @@ -36,7 +38,7 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
>  		offset += file->f_pos;
>  		break;
>  	case 2:
> -		offset += NVRAM_SIZE;
> +		offset += nvram_len;
>  		break;
>  	}
>  	if (offset < 0) {
> @@ -56,9 +58,9 @@ static ssize_t read_nvram(struct file *file, char __user *buf,
>  
>  	if (!access_ok(VERIFY_WRITE, buf, count))
>  		return -EFAULT;
> -	if (*ppos >= NVRAM_SIZE)
> +	if (*ppos >= nvram_len)
>  		return 0;
> -	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count)
> +	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count)
>  		if (__put_user(nvram_read_byte(i), p))
>  			return -EFAULT;
>  	*ppos = i;
> @@ -74,9 +76,9 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
>  
>  	if (!access_ok(VERIFY_READ, buf, count))
>  		return -EFAULT;
> -	if (*ppos >= NVRAM_SIZE)
> +	if (*ppos >= nvram_len)
>  		return 0;
> -	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count) {
> +	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count) {
>  		if (__get_user(c, p))
>  			return -EFAULT;
>  		nvram_write_byte(c, i);
> @@ -133,9 +135,20 @@ static struct miscdevice nvram_dev = {
>  
>  int __init nvram_init(void)
>  {
> +	int ret = 0;
> +
>  	printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
>  		NVRAM_VERSION);
> -	return misc_register(&nvram_dev);
> +	ret = misc_register(&nvram_dev);
> +	if (ret != 0)
> +		goto out;
> +
> +	nvram_len = nvram_size();
> +	if (nvram_len < 0)
> +		nvram_len = NVRAM_SIZE;
> +
> +out:
> +	return ret;
>  }
>  
>  void __exit nvram_cleanup(void)

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Takashi Iwai @ 2009-08-13  7:11 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linux-kernel, FUJITA Tomonori, mingo, linuxppc-dev
In-Reply-To: <1250146313.3587.113.camel@pasglop>

At Thu, 13 Aug 2009 16:51:53 +1000,
Benjamin Herrenschmidt wrote:
> 
> On Thu, 2009-08-13 at 16:44 +1000, Benjamin Herrenschmidt wrote:
> > On Wed, 2009-08-05 at 14:08 +0900, FUJITA Tomonori wrote:
> > 
> > > The above swiotlb patchset was merged in -tip so I think that merging
> > > this patchset via -tip too is the easiest way to handle this patchset.
> > > 
> > > The patchset also is available via a git tree:
> > > 
> > > git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git powerpc
> > 
> > Hi !
> > 
> > While I generally agree here with the patches, I'm not sure it should be
> > merged via -tip since it mostly touches arch/powerpc files (and I need
> > to review it a bit more carefully, hopefully you'll have Ack's hitting
> > your mailbox later today).
> 
> Maybe best is that I pull your series too. Note that your patch clashes
> with Takashi's addition of dma_mmap_coherent() :
> 
> http://patchwork.ozlabs.org/patch/29595/
> 
> Can you sort that out with Takashi as I'd like his patch in -next soon
> too.

I'm willing to rebase my patches to the generic dma_ops, so feel free
to pull it first.

It might need to add mmap_coherent op to all platforms when generic
dma ops is used.  This would be more volume but less hackish than the
previous version, OTOH :)


thanks,

Takashi

^ permalink raw reply

* [PATCH v2] Mechanism to enable use Generic NVRAM driver for different size chips
From: Martyn Welch @ 2009-08-13  8:03 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev
In-Reply-To: <1250147730.3587.120.camel@pasglop>

Remove the reliance on a staticly defined NVRAM size, allowing platforms to support NVRAMs with sizes differing from the standard. A fall back value is provided for platforms not supporting this extension.

Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
---

Ben: Is this a suitable solution?

v2: rename nvram_size() to nvram_get_size(), thus avoiding the collision with the global
variables in arch/powerpc/platforms/pseries/nvram.c and
arch/powerpc/platforms/chrp/nvram.c of the same name.

 arch/powerpc/include/asm/nvram.h |    3 +++
 arch/powerpc/kernel/setup_32.c   |    8 ++++++++
 drivers/char/generic_nvram.c     |   27 ++++++++++++++++++++-------
 3 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
index efde5ac..6c587ed 100644
--- a/arch/powerpc/include/asm/nvram.h
+++ b/arch/powerpc/include/asm/nvram.h
@@ -107,6 +107,9 @@ extern void	pmac_xpram_write(int xpaddr, u8 data);
 /* Synchronize NVRAM */
 extern void	nvram_sync(void);
 
+/* Determine NVRAM size */
+extern ssize_t nvram_get_size(void);
+
 /* Normal access to NVRAM */
 extern unsigned char nvram_read_byte(int i);
 extern void nvram_write_byte(unsigned char c, int i);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index e1e3059..53bcf3d 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -210,6 +210,14 @@ void nvram_write_byte(unsigned char val, int addr)
 }
 EXPORT_SYMBOL(nvram_write_byte);
 
+ssize_t nvram_get_size(void)
+{
+	if (ppc_md.nvram_size)
+		return ppc_md.nvram_size();
+	return -1;
+}
+EXPORT_SYMBOL(nvram_get_size);
+
 void nvram_sync(void)
 {
 	if (ppc_md.nvram_sync)
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index a00869c..ef31738 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -2,7 +2,7 @@
  * Generic /dev/nvram driver for architectures providing some
  * "generic" hooks, that is :
  *
- * nvram_read_byte, nvram_write_byte, nvram_sync
+ * nvram_read_byte, nvram_write_byte, nvram_sync, nvram_get_size
  *
  * Note that an additional hook is supported for PowerMac only
  * for getting the nvram "partition" informations
@@ -28,6 +28,8 @@
 
 #define NVRAM_SIZE	8192
 
+static ssize_t nvram_len;
+
 static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
 {
 	lock_kernel();
@@ -36,7 +38,7 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
 		offset += file->f_pos;
 		break;
 	case 2:
-		offset += NVRAM_SIZE;
+		offset += nvram_len;
 		break;
 	}
 	if (offset < 0) {
@@ -56,9 +58,9 @@ static ssize_t read_nvram(struct file *file, char __user *buf,
 
 	if (!access_ok(VERIFY_WRITE, buf, count))
 		return -EFAULT;
-	if (*ppos >= NVRAM_SIZE)
+	if (*ppos >= nvram_len)
 		return 0;
-	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count)
+	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count)
 		if (__put_user(nvram_read_byte(i), p))
 			return -EFAULT;
 	*ppos = i;
@@ -74,9 +76,9 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
 
 	if (!access_ok(VERIFY_READ, buf, count))
 		return -EFAULT;
-	if (*ppos >= NVRAM_SIZE)
+	if (*ppos >= nvram_len)
 		return 0;
-	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count) {
+	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count) {
 		if (__get_user(c, p))
 			return -EFAULT;
 		nvram_write_byte(c, i);
@@ -133,9 +135,20 @@ static struct miscdevice nvram_dev = {
 
 int __init nvram_init(void)
 {
+	int ret = 0;
+
 	printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
 		NVRAM_VERSION);
-	return misc_register(&nvram_dev);
+	ret = misc_register(&nvram_dev);
+	if (ret != 0)
+		goto out;
+
+	nvram_len = nvram_get_size();
+	if (nvram_len < 0)
+		nvram_len = NVRAM_SIZE;
+
+out:
+	return ret;
 }
 
 void __exit nvram_cleanup(void)

^ permalink raw reply related

* Re: [PATCH v2] Mechanism to enable use Generic NVRAM driver for different size chips
From: Benjamin Herrenschmidt @ 2009-08-13  8:05 UTC (permalink / raw)
  To: Martyn Welch; +Cc: linuxppc-dev
In-Reply-To: <20090813075753.29726.28454.stgit@ES-J7S4D2J.amer.consind.ge.com>

On Thu, 2009-08-13 at 09:03 +0100, Martyn Welch wrote:
> Remove the reliance on a staticly defined NVRAM size, allowing platforms to support NVRAMs with sizes differing from the standard. A fall back value is provided for platforms not supporting this extension.
> 
> Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
> ---
> 
> Ben: Is this a suitable solution?

Yup. I'll have a closer look tomorrow. Thanks.

Cheers,
Ben.

> v2: rename nvram_size() to nvram_get_size(), thus avoiding the collision with the global
> variables in arch/powerpc/platforms/pseries/nvram.c and
> arch/powerpc/platforms/chrp/nvram.c of the same name.
> 
>  arch/powerpc/include/asm/nvram.h |    3 +++
>  arch/powerpc/kernel/setup_32.c   |    8 ++++++++
>  drivers/char/generic_nvram.c     |   27 ++++++++++++++++++++-------
>  3 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
> index efde5ac..6c587ed 100644
> --- a/arch/powerpc/include/asm/nvram.h
> +++ b/arch/powerpc/include/asm/nvram.h
> @@ -107,6 +107,9 @@ extern void	pmac_xpram_write(int xpaddr, u8 data);
>  /* Synchronize NVRAM */
>  extern void	nvram_sync(void);
>  
> +/* Determine NVRAM size */
> +extern ssize_t nvram_get_size(void);
> +
>  /* Normal access to NVRAM */
>  extern unsigned char nvram_read_byte(int i);
>  extern void nvram_write_byte(unsigned char c, int i);
> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
> index e1e3059..53bcf3d 100644
> --- a/arch/powerpc/kernel/setup_32.c
> +++ b/arch/powerpc/kernel/setup_32.c
> @@ -210,6 +210,14 @@ void nvram_write_byte(unsigned char val, int addr)
>  }
>  EXPORT_SYMBOL(nvram_write_byte);
>  
> +ssize_t nvram_get_size(void)
> +{
> +	if (ppc_md.nvram_size)
> +		return ppc_md.nvram_size();
> +	return -1;
> +}
> +EXPORT_SYMBOL(nvram_get_size);
> +
>  void nvram_sync(void)
>  {
>  	if (ppc_md.nvram_sync)
> diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
> index a00869c..ef31738 100644
> --- a/drivers/char/generic_nvram.c
> +++ b/drivers/char/generic_nvram.c
> @@ -2,7 +2,7 @@
>   * Generic /dev/nvram driver for architectures providing some
>   * "generic" hooks, that is :
>   *
> - * nvram_read_byte, nvram_write_byte, nvram_sync
> + * nvram_read_byte, nvram_write_byte, nvram_sync, nvram_get_size
>   *
>   * Note that an additional hook is supported for PowerMac only
>   * for getting the nvram "partition" informations
> @@ -28,6 +28,8 @@
>  
>  #define NVRAM_SIZE	8192
>  
> +static ssize_t nvram_len;
> +
>  static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
>  {
>  	lock_kernel();
> @@ -36,7 +38,7 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
>  		offset += file->f_pos;
>  		break;
>  	case 2:
> -		offset += NVRAM_SIZE;
> +		offset += nvram_len;
>  		break;
>  	}
>  	if (offset < 0) {
> @@ -56,9 +58,9 @@ static ssize_t read_nvram(struct file *file, char __user *buf,
>  
>  	if (!access_ok(VERIFY_WRITE, buf, count))
>  		return -EFAULT;
> -	if (*ppos >= NVRAM_SIZE)
> +	if (*ppos >= nvram_len)
>  		return 0;
> -	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count)
> +	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count)
>  		if (__put_user(nvram_read_byte(i), p))
>  			return -EFAULT;
>  	*ppos = i;
> @@ -74,9 +76,9 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
>  
>  	if (!access_ok(VERIFY_READ, buf, count))
>  		return -EFAULT;
> -	if (*ppos >= NVRAM_SIZE)
> +	if (*ppos >= nvram_len)
>  		return 0;
> -	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count) {
> +	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count) {
>  		if (__get_user(c, p))
>  			return -EFAULT;
>  		nvram_write_byte(c, i);
> @@ -133,9 +135,20 @@ static struct miscdevice nvram_dev = {
>  
>  int __init nvram_init(void)
>  {
> +	int ret = 0;
> +
>  	printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
>  		NVRAM_VERSION);
> -	return misc_register(&nvram_dev);
> +	ret = misc_register(&nvram_dev);
> +	if (ret != 0)
> +		goto out;
> +
> +	nvram_len = nvram_get_size();
> +	if (nvram_len < 0)
> +		nvram_len = NVRAM_SIZE;
> +
> +out:
> +	return ret;
>  }
>  
>  void __exit nvram_cleanup(void)

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Benjamin Herrenschmidt @ 2009-08-13  8:07 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, FUJITA Tomonori, mingo, linuxppc-dev
In-Reply-To: <s5h4osc429m.wl%tiwai@suse.de>

On Thu, 2009-08-13 at 09:11 +0200, Takashi Iwai wrote:
> I'm willing to rebase my patches to the generic dma_ops, so feel free
> to pull it first.

I think I'll end up pulling Ingo's iommu branch into powerpc-next to
get Fujita stuff, so if you rebase on top of his stuff, it will come
along just fine.

> It might need to add mmap_coherent op to all platforms when generic
> dma ops is used.  This would be more volume but less hackish than the
> previous version, OTOH :)
> 
Right :-)

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Benjamin Herrenschmidt @ 2009-08-13  8:09 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: FUJITA Tomonori, linuxppc-dev, linux-kernel, galak
In-Reply-To: <20090813074131.GH12143@elte.hu>


> Ben, what's your preference? I waited for your reaction with these 
> bits, i.e. they are not in tip:core/iommu yet.

Oh I though they were... discard my previous private mail about
missing Ack's then :-)

I'll review them more in depth hopefully tomorrow but they look good.

> One variant would be what Fujita suggested: you could pull 
> core/iommu as a basis (it's a well-tested, problem-free tree at the 
> moment, with no big risky items), and then pull/apply the powerpc 
> specific bits from Fujita.

Or we can have the patches in core/iommu and I pull the whole thing
in powerpc-next. My main concern isn't which tree they go through but
that they are in powerpc-next for better testing.

Cheers,
Ben.

> A second variant would be that we could pull these bits into 
> core/iommu ... albeit you are right that the PowerPC tree is much 
> better at testing PowerPC patches.
> 
> A third variant would be to wait with these bits until the swiotlb 
> bits in core/iommu hit upstream. This would increase patch latency.
> 
> Any of these variants is good to me. What Fujita suggests seems to 
> be the best to me: #1 gets us the most testing and the lowest 
> latency - at the cost of tree dependency. We wont rebase core/iommu.
> 
> [ We've got three good tree properties: "tree independence",
>   "good testing", "low patch latency", but we cannot have all
>   three at once, we must pick two of them ;-) ]
> 
> 	Ingo

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Takashi Iwai @ 2009-08-13  8:11 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linux-kernel, FUJITA Tomonori, mingo, linuxppc-dev
In-Reply-To: <1250150877.3587.155.camel@pasglop>

At Thu, 13 Aug 2009 18:07:57 +1000,
Benjamin Herrenschmidt wrote:
> 
> On Thu, 2009-08-13 at 09:11 +0200, Takashi Iwai wrote:
> > I'm willing to rebase my patches to the generic dma_ops, so feel free
> > to pull it first.
> 
> I think I'll end up pulling Ingo's iommu branch into powerpc-next to
> get Fujita stuff, so if you rebase on top of his stuff, it will come
> along just fine.

OK, I'll work on it later.


thanks,

Takashi

^ permalink raw reply

* Re: [PATCH 3/3] agp/uninorth: Unify U3 and pre-U3 insert_memory and remove_memory hooks.
From: Michel Dänzer @ 2009-08-13  8:15 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Dave Airlie, linuxppc-dev
In-Reply-To: <1250147148.3587.115.camel@pasglop>

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

On Thu, 2009-08-13 at 17:05 +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2009-08-04 at 23:51 +0200, Michel Dänzer wrote:
> > From: Michel Dänzer <daenzer@vmware.com>
> > 
> > Signed-off-by: Michel Dänzer <daenzer@vmware.com>
> > ---
> 
> Hi Michel !
> 
> While your two previous patches apply just fine, this one doesn't,
> the uninorth_insert_memory() function seems to be slightly different
> upstream. Does this depend on some separate yet unapplied patches ?

I previously sent the attached patches to Dave in the course of the
radeon KMS issues thread. Not sure which of these he's picked up yet, if
any.


> I'm putting 1/3 and 2/3 into my -test branch and they should hit my
> -next branch in a couple of days.
> 
> Or do you prefer us to merge that via Dave ?
> 
> The thing is, stuff in -powerpc is much more likely to get some amount
> of testing on actual ppc hardware than stuff in random other trees :-)

I'm fine with either way.


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer

[-- Attachment #2: 0001-uninorth-Handle-user-memory-types.patch --]
[-- Type: text/x-patch, Size: 1771 bytes --]

From b73acc1a48cbea4d9ba9caa41451b38223bed516 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Michel=20D=C3=A4nzer?= <daenzer@vmware.com>
Date: Thu, 13 Aug 2009 08:42:36 +0200
Subject: [PATCH] uninorth: Handle user memory types.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
---
 drivers/char/agp/uninorth-agp.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 03f95ec..880d3f6 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -146,13 +146,20 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
 {
 	int i, j, num_entries;
 	void *temp;
+	int mask_type;
 
 	temp = agp_bridge->current_size;
 	num_entries = A_SIZE_32(temp)->num_entries;
 
-	if (type != 0 || mem->type != 0)
+	if (type != mem->type)
+		return -EINVAL;
+
+	mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
+	if (mask_type != 0) {
 		/* We know nothing of memory types */
 		return -EINVAL;
+	}
+
 	if ((pg_start + mem->page_count) > num_entries)
 		return -EINVAL;
 
@@ -184,13 +191,20 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
 	int i, num_entries;
 	void *temp;
 	u32 *gp;
+	int mask_type;
 
 	temp = agp_bridge->current_size;
 	num_entries = A_SIZE_32(temp)->num_entries;
 
-	if (type != 0 || mem->type != 0)
+	if (type != mem->type)
+		return -EINVAL;
+
+	mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
+	if (mask_type != 0) {
 		/* We know nothing of memory types */
 		return -EINVAL;
+	}
+
 	if ((pg_start + mem->page_count) > num_entries)
 		return -EINVAL;
 
-- 
1.6.3.3


[-- Attachment #3: 0002-uninorth-Also-handle-user-memory-types-in-u3_remove_.patch --]
[-- Type: text/x-patch, Size: 2507 bytes --]

From 0e4f25a616fdb5136372ab0523a43af39ff7fcd6 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Michel=20D=C3=A4nzer?= <daenzer@vmware.com>
Date: Thu, 13 Aug 2009 08:42:38 +0200
Subject: [PATCH] uninorth: Also handle user memory types in u3_remove_memory().
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Also short-circuit empty updates.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
---
 drivers/char/agp/uninorth-agp.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 880d3f6..cd63d76 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -148,9 +148,6 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
 	void *temp;
 	int mask_type;
 
-	temp = agp_bridge->current_size;
-	num_entries = A_SIZE_32(temp)->num_entries;
-
 	if (type != mem->type)
 		return -EINVAL;
 
@@ -160,6 +157,12 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
 		return -EINVAL;
 	}
 
+	if (mem->page_count == 0)
+		return 0;
+
+	temp = agp_bridge->current_size;
+	num_entries = A_SIZE_32(temp)->num_entries;
+
 	if ((pg_start + mem->page_count) > num_entries)
 		return -EINVAL;
 
@@ -193,9 +196,6 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
 	u32 *gp;
 	int mask_type;
 
-	temp = agp_bridge->current_size;
-	num_entries = A_SIZE_32(temp)->num_entries;
-
 	if (type != mem->type)
 		return -EINVAL;
 
@@ -205,6 +205,12 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
 		return -EINVAL;
 	}
 
+	if (mem->page_count == 0)
+		return 0;
+
+	temp = agp_bridge->current_size;
+	num_entries = A_SIZE_32(temp)->num_entries;
+
 	if ((pg_start + mem->page_count) > num_entries)
 		return -EINVAL;
 
@@ -234,10 +240,19 @@ int u3_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
 {
 	size_t i;
 	u32 *gp;
+	int mask_type;
+
+	if (type != mem->type)
+		return -EINVAL;
 
-	if (type != 0 || mem->type != 0)
+	mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
+	if (mask_type != 0) {
 		/* We know nothing of memory types */
 		return -EINVAL;
+	}
+
+	if (mem->page_count == 0)
+		return 0;
 
 	gp = (u32 *) &agp_bridge->gatt_table[pg_start];
 	for (i = 0; i < mem->page_count; ++i)
-- 
1.6.3.3


^ permalink raw reply related

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Ingo Molnar @ 2009-08-13  7:41 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linuxppc-dev, linux-kernel, galak
In-Reply-To: <20090813160625B.fujita.tomonori@lab.ntt.co.jp>


* FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:

> On Thu, 13 Aug 2009 15:48:42 +1000
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> 
> > On Wed, 2009-08-05 at 14:08 +0900, FUJITA Tomonori wrote:
> > 
> > > The above swiotlb patchset was merged in -tip so I think that merging
> > > this patchset via -tip too is the easiest way to handle this patchset.
> > > 
> > > The patchset also is available via a git tree:
> > > 
> > > git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git powerpc
> > 
> > Hi !
> > 
> > While I generally agree here with the patches, I'm not sure it should be
> > merged via -tip since it mostly touches arch/powerpc files (and I need
> > to review it a bit more carefully, hopefully you'll have Ack's hitting
> > your mailbox later today).
> 
> Thanks!
> 
> This patchset depends on my swiotlb cleanup patchset:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git swiotlb
> 
> http://marc.info/?l=linux-ia64&m=124718816520156&w=2
> 
> My swiotlb cleanup patchset has been in -tip. It might be easier 
> to merge both the swiotlb patchset and this patchset in powerpc 
> tree?

Ben, what's your preference? I waited for your reaction with these 
bits, i.e. they are not in tip:core/iommu yet.

One variant would be what Fujita suggested: you could pull 
core/iommu as a basis (it's a well-tested, problem-free tree at the 
moment, with no big risky items), and then pull/apply the powerpc 
specific bits from Fujita.

A second variant would be that we could pull these bits into 
core/iommu ... albeit you are right that the PowerPC tree is much 
better at testing PowerPC patches.

A third variant would be to wait with these bits until the swiotlb 
bits in core/iommu hit upstream. This would increase patch latency.

Any of these variants is good to me. What Fujita suggests seems to 
be the best to me: #1 gets us the most testing and the lowest 
latency - at the cost of tree dependency. We wont rebase core/iommu.

[ We've got three good tree properties: "tree independence",
  "good testing", "low patch latency", but we cannot have all
  three at once, we must pick two of them ;-) ]

	Ingo

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Ingo Molnar @ 2009-08-13  8:55 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: FUJITA Tomonori, linuxppc-dev, linux-kernel, galak
In-Reply-To: <1250150981.3587.157.camel@pasglop>


* Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> 
> > Ben, what's your preference? I waited for your reaction with these 
> > bits, i.e. they are not in tip:core/iommu yet.
> 
> Oh I though they were... discard my previous private mail about 
> missing Ack's then :-)
> 
> I'll review them more in depth hopefully tomorrow but they look 
> good.

Sure - take your time.

> > One variant would be what Fujita suggested: you could pull 
> > core/iommu as a basis (it's a well-tested, problem-free tree at 
> > the moment, with no big risky items), and then pull/apply the 
> > powerpc specific bits from Fujita.
> 
> Or we can have the patches in core/iommu and I pull the whole 
> thing in powerpc-next. [...]

Ok! We could also stage it a bit (one or two weeks) in a separate 
branch and allow a rebase, should you find any bugs during testing?

	Ingo

^ permalink raw reply

* RE: ARM clock API to PowerPC
From: Li Yang-R58472 @ 2009-08-13  8:59 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Kumar Gala
  Cc: John Jacques, linuxppc-dev list, devicetree-discuss, Torez Smith,
	Russell King
In-Reply-To: <1250112599.3587.21.camel@pasglop>


>Now, I know there is at least one person on earth=20
>contemplating sharing some drivers between PPC and ARM. I=20
>won't tell much more at this stage, but it makes sense in the=20
>grand scheme of things to see SoC vendors put similar IO cores=20
>into either PPC or ARM and providing that clock API is a good=20
>way to also allow these drivers to work since the drivers in=20
>questions make use of it.

Freescale USB UDC driver is another example that shared between PowerPC
and ARM(i.mx).  Currently, the imx part of the driver uses clk API, but
PowerPC part uses static initialization.  It will be better if we can
unify the clk setting part of the driver.

- Leo

^ permalink raw reply

* Using dmatest driver with FSL DMA engine
From: Felix Radensky @ 2009-08-13  7:55 UTC (permalink / raw)
  To: linuxppc-dev, leoli, zw

Hi,

I'm trying to use dmatest driver on MPC8536DS running linux 2.6.31-rc5.
The loading of driver fails, as it is unable to allocate DMA channel.
Is this driver supposed to work with FSL DMA engine ?

Thanks.

Felix.

^ permalink raw reply

* Re: Using dmatest driver with FSL DMA engine
From: Felix Radensky @ 2009-08-13  9:06 UTC (permalink / raw)
  To: linuxppc-dev, leoli, zw
In-Reply-To: <4A83C6DC.8090405@embedded-sol.com>

Felix Radensky wrote:
> Hi,
>
> I'm trying to use dmatest driver on MPC8536DS running linux 2.6.31-rc5.
> The loading of driver fails, as it is unable to allocate DMA channel.
> Is this driver supposed to work with FSL DMA engine ?
>

I should have disabled "TCP receive copy offload" DMA client.
dmatest works now as expected. Sorry for the noise.

Felix.

^ permalink raw reply

* [PATCH] Remove SMP warning from PowerMac cpufreq
From: Bastian Blank @ 2009-08-13  9:30 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1250144098.3587.111.camel@pasglop>

On Thu, Aug 13, 2009 at 04:14:58PM +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2009-08-11 at 11:39 +0200, Bastian Blank wrote:
> > This patch just disables this driver on SMP kernels, as it is obviously
> > not supported.
> Why not remove the #error instead ? :-) I don't think it's still
> meaningful, especially since we use the timebase for delays nowadays
> which doesn't depend on the CPU frequency...

Your call. Take this one:

The build of a PowerMac 32bit kernel currently fails with

error: #warning "WARNING, CPUFREQ not recommended on SMP kernels"

Thie patch removes the not longer applicable SMP warning from the
PowerMac cpufreq code.

Signed-off-by: Bastian Blank <waldi@debian.org>

diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 65c585b..08d94e4 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -44,14 +44,6 @@
  */
 #undef DEBUG_FREQ
 
-/*
- * There is a problem with the core cpufreq code on SMP kernels,
- * it won't recalculate the Bogomips properly
- */
-#ifdef CONFIG_SMP
-#warning "WARNING, CPUFREQ not recommended on SMP kernels"
-#endif
-
 extern void low_choose_7447a_dfs(int dfs);
 extern void low_choose_750fx_pll(int pll);
 extern void low_sleep_handler(void);
-- 
Those who hate and fight must stop themselves -- otherwise it is not stopped.
		-- Spock, "Day of the Dove", stardate unknown

^ permalink raw reply related

* Re: The infamous ppc_spurious_interrupt
From: Anton Blanchard @ 2009-08-13  9:39 UTC (permalink / raw)
  To: Leonardo Chiquitto; +Cc: linuxppc-dev
In-Reply-To: <c2d0b6ec0908121240v60446ebdjc9dc35fe1b5b544e@mail.gmail.com>

 
Hi,

> I'm trying to understand the rationale behind "ppc_spurious_interrupts"
> without luck so far. I'm seeing the BAD interrupt counter incrementing with
> kernels of different ages (2.6.5, 2.6.16, 2.6.27) and on different hardware
> (IBM P5 and P6 64 bit, Apple PPC 32 bit). 

On IBM POWER5 and POWER6 systems there are cases where an interrupt will
be presented to the partition but the hypervisor will handle it and
return NO_IRQ.

...

> If the "bad interrupts" are harmless (I suppose they are), why are we counting
> them and displaying the counter as BAD in /proc/interrupts?

Considering these interrupts are expected (at least on IBM platforms), I
agree it is a bit dramatic to call them BAD. Unfortunately it's been that way
forever and changing /proc/interrupts will more than likely break some tools.

Anton

^ permalink raw reply

* test branch update
From: Benjamin Herrenschmidt @ 2009-08-13  9:43 UTC (permalink / raw)
  To: linuxppc-dev list

I've pushed a few more things to my -test branch (in addition to some
-next updates that I may have forgotten to mention yesterday).

So here's the whole lot of stuff that's in there today vs. upstream.

Please give it a spin, it's really only compile tested here (and I
haven't scrubbed the warnings yet in case they show something bad), so
things will simmer there for a couple of days I think before I'm
confident enough to put them into -next.

Anton Blanchard (3):
      powerpc: Move 64bit VDSO to improve context switch performance
      powerpc: Rearrange SLB preload code
      powerpc: Preload application text segment instead of TASK_UNMAPPED_BASE

Anton Vorontsov (3):
      powerpc/83xx: Add support for MPC8377E-WLAN boards
      powerpc/85xx: Add support for I2C EEPROMs on MPC8548CDS boards
      powerpc/83xx: Add eSDHC support for MPC837xE-RDB/WLAN boards

Benjamin Herrenschmidt (29):
      powerpc: Rename exception.h to exception-64s.h
      powerpc: Use names rather than numbers for SPRGs (v2)
      powerpc: Remove use of a second scratch SPRG in STAB code
      powerpc/mm: Fix definitions of FORCE_MAX_ZONEORDER in Kconfig
      powerpc/pmac: Fix PowerSurge SMP IPI allocation
      powerpc: Change PACA from SPRG3 to SPRG1
      powerpc: Add compat_sys_truncate
      powerpc/mm: Fix misplaced #endif in pgtable-ppc64-64k.h
      powerpc/of: Remove useless register save/restore when calling OF back
      powerpc/mm: Add HW threads support to no_hash TLB management
      powerpc/mm: Add opcode definitions for tlbivax and tlbsrx.
      powerpc/mm: Add more bit definitions for Book3E MMU registers
      powerpc/mm: Add support for early ioremap on non-hash 64-bit processors
      powerpc: Modify some ppc_asm.h macros to accomodate 64-bits Book3E
      powerpc/mm: Make low level TLB flush ops on BookE take additional args
      powerpc/mm: Call mmu_context_init() from ppc64
      powerpc: Clean ifdef usage in copy_thread()
      powerpc: Move definitions of secondary CPU spinloop to header file
      powerpc/mm: Rework & cleanup page table freeing code path
      powerpc: Add SPR definitions for new 64-bit BookE
      powerpc: Add memory management headers for new 64-bit BookE
      powerpc: Add definitions used by exception handling on 64-bit Book3E
      powerpc: Add PACA fields specific to 64-bit Book3E processors
      powerpc/mm: Move around mmu_gathers definition on 64-bit
      powerpc: Add TLB management code for 64-bit Book3E
      powerpc/mm: Add support for SPARSEMEM_VMEMMAP on 64-bit Book3E
      powerpc: Remaining 64-bit Book3E support
      powerpc/mm: Fix encoding of page table cache numbers
      powerpc/mm: Cleanup handling of execute permission

Benjamin Krill (1):
      powerpc/prom_init: Evaluate mem kernel parameter for early allocation

Christoph Hellwig (2):
      powerpc/sputrace: Use the generic event tracer
      powerpc: Switch to asm-generic/hardirq.h

Frans Pop (1):
      powerpc: Makefile simplification through use of cc-ifversion

Geert Uytterhoeven (1):
      powerpc/cell: Move CBE_IOPTE_* to <asm/cell-regs.h>

Geoff Thorpe (1):
      powerpc: expose the multi-bit ops that underlie single-bit ops.

Gerhard Pircher (1):
      powerpc/amigaone: Convert amigaone_init() to a machine_device_initcall()

Heiko Schocher (1):
      powerpc/82xx: mgcoge - updates for 2.6.32

Julia Lawall (5):
      powerpc/fsl_rio: Add kmalloc NULL tests
      powerpc/ipic: introduce missing kfree
      powerpc/qe: introduce missing kfree
      hvc_console: Drop unnecessary NULL test
      powerpc: Use DIV_ROUND_CLOSEST in time init code

Kumar Gala (3):
      powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus
      powerpc/85xx: Move mpc8536ds.dts to address-cells/size-cells = <2>
      powerpc/85xx: Added 36-bit physical device tree for mpc8572ds board

Lucian Adrian Grijincu (1):
      powerpc: Update boot wrapper script with the new location of dtc

Martyn Welch (4):
      powerpc/86xx: Correct reading of information presented in cpuinfo
      powerpc/86xx: Enable XMC site on GE Fanuc SBC310
      powerpc/86xx: Update GE Fanuc sbc310 DTS
      powerpc/nvram: Allow byte length reads from mmio NVRAM driver

Michael Ellerman (5):
      powerpc/mpic: Fix MPIC_BROKEN_REGREAD on non broken MPICs
      kmemleak: Allow kmemleak to be built on powerpc
      powerpc: Enable GCOV
      powerpc/vmlinux.lds: Move _edata down
      powerpc: Add kmemleak annotations to lmb.c

Michel Dänzer (2):
      agp/uninorth: Allow larger aperture sizes on pre-U3 bridges.
      agp/uninorth: Simplify cache flushing.

Roel Kluin (2):
      powerpc/fsl-booke: read buffer overflow
      powerpc/hvsi: Avoid calculating possibly-invalid address

Sebastian Andrzej Siewior (1):
      powerpc/ipic: unmask all interrupt sources

Stefan Roese (5):
      powerpc: Add AMCC 460EX/460GT Rev. B support to cputable.c
      powerpc/44x: Add NAND support to Canyonlands dts
      powerpc/40x: Update Kilauea dts to support NAND, RTC and HWMON
      powerpc/44x: Update Canyonlands defconfig to support NOR, NAND and RTC
      powerpc/40x: Update kilauea defconfig to support NAND, RTC and HWMON

Stephen Rothwell (1):
      powerpc: use consistent types in mktree

Stoyan Gaydarov (1):
      powerpc: ARRAY_SIZE changes in pasemi and powermac code

roel kluin (3):
      powerpc/cell: Replace strncpy by strlcpy
      powerpc: Missing tests for NULL after ioremap()
      powerpc/macio: Don't the address of an array element before boundchecking

^ permalink raw reply

* Re: [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: Benjamin Herrenschmidt @ 2009-08-13 10:38 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: FUJITA Tomonori, linuxppc-dev, linux-kernel, galak
In-Reply-To: <20090813085505.GA10671@elte.hu>

On Thu, 2009-08-13 at 10:55 +0200, Ingo Molnar wrote:

> > Or we can have the patches in core/iommu and I pull the whole 
> > thing in powerpc-next. [...]
> 
> Ok! We could also stage it a bit (one or two weeks) in a separate 
> branch and allow a rebase, should you find any bugs during testing?

Sounds like a plan.

I'll try to sort that out tomorrow, I can stick them in my -test branch
(which is rebase friendly) for a while too.

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH] viotape: Fix memory and semaphore leak
From: Michael Buesch @ 2009-08-13 13:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Dave Boutcher, Ryan Arnold, linuxppc-dev, Colin Devilbiss
In-Reply-To: <1250139603.3587.106.camel@pasglop>

On Thursday 13 August 2009 07:00:03 Benjamin Herrenschmidt wrote:
> On Sat, 2009-07-18 at 15:06 +0200, Michael Buesch wrote:
> > This patch fixes a memory and semaphore leak in the viotape driver's
> > char device write op. It leaks the DMA memory and the semaphore lock
> > in case the device was opened with O_NONBLOCK.
> > 
> > This patch is only compile tested, because I do not have the hardware.
> > 
> > Signed-off-by: Michael Buesch <mb@bu3sch.de>
> 
> (going trough my backlog ...)
> 
> Thanks Michael, but I don't think that's right...
> 
> IE. We aren't waiting for the write to complete, which means that it can
> be happening asynchronously, thus we must not free the DMA memory until
> it has actually complete.
> 
> Now, if you look at vioHandleTapeEvent(), it does appear that when the
> completion happens, the DMA memory will eventually be released and the
> mutex up'ed. 
> 
> Or am I missing something ?

I think you are right.


-- 
Greetings, Michael.

^ 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