From ralf@linux-mips.org Tue Dec  1 01:49:33 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 01:49:36 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:51555 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493219AbZLAAtd (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 01:49:33 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB10nsj1004827;
        Tue, 1 Dec 2009 00:49:55 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB10ns5m004825;
        Tue, 1 Dec 2009 00:49:54 GMT
Date:   Tue, 1 Dec 2009 00:49:54 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Adam Nielsen <a.nielsen@shikadi.net>
Cc:     linux-mips@linux-mips.org
Subject: Re: Setting the physical RAM map
Message-ID: <20091201004954.GB31892@linux-mips.org>
References: <4B1135FF.9050908@shikadi.net>
 <20091130214118.GB27721@linux-mips.org>
 <4B14496F.1060108@shikadi.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4B14496F.1060108@shikadi.net>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25215
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 08:38:39AM +1000, Adam Nielsen wrote:

> >It's like a decade that I last read up on these but afair they have a
> >fixed mapping starting at 0x40000000.  It would make perfect sense to
> >use such a CPU in an X terminal.
> 
> Hmm, I'm not sure.  I'd have to peel off the heatsink to be sure I
> guess.  The very first kernel messages print this:
> 
>   CPU revision is: 00002020 (R4600)
>   FPU revision is: 00002020
> 
> So I guess these values would be more specific if the CPU was indeed
> one of those revisions.

No need to scratch off things.  The numbers above clearly identify an
R4600 v2.0.  R4640 and R4650 would return 0x000022xx where xx would be
the processor revision number.  Both are special embedded versions of the
R4600 without MMU.

  Ralf

From ralf@linux-mips.org Tue Dec  1 02:48:07 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 02:48:11 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:59658 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493242AbZLABsH (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 02:48:07 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB11mMSI006308;
        Tue, 1 Dec 2009 01:48:22 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB11mJqA006306;
        Tue, 1 Dec 2009 01:48:19 GMT
Date:   Tue, 1 Dec 2009 01:48:19 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        linux-mips@linux-mips.org, zhangfx@lemote.com, yanh@lemote.com,
        huhb@lemote.com, lm-sensors@lm-sensors.org
Subject: Re: [PATCH v5 5/8] Loongson: YeeLoong: add hwmon driver
Message-ID: <20091201014819.GA29728@linux-mips.org>
References: <cover.1259414649.git.wuzhangjin@gmail.com>
 <ed9926f7d6acbf2abd2eb172ec5147e578dc8fb7.1259414649.git.wuzhangjin@gmail.com>
 <1259558432.5516.8.camel@falcon.domain.org>
 <1259562294.5516.16.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259562294.5516.16.camel@falcon.domain.org>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25216
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 30, 2009 at 02:24:54PM +0800, Wu Zhangjin wrote:

> > > +config YEELOONG_HWMON
> > > +	tristate "Hardware Monitor Driver"
> > > +	select HWMON
> > 
> > Will use depend in the next version.
> > 
> 
> Sorry, This must be select, there is no other way to select this stuff.

Why that?

  Ralf

From wuzhangjin@gmail.com Tue Dec  1 03:06:35 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 03:06:38 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:49610 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493255AbZLACGf (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 03:06:35 +0100
Received: by pwi15 with SMTP id 15so2317008pwi.24
        for <multiple recipients>; Mon, 30 Nov 2009 18:06:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=AB5R2EqdxWRT+32k17d2yUY/SQZUz2J+snYCirYyft8=;
        b=KKWPlMRTWlQU7iBajoOr/kKaWr+/1SL08XFskPpbxaD2AOsChphkX9G3Mnt4+KJjsg
         eBWFi/Q96V3GhUAAiqVEF9NWWcFQLT5ttK+JyWgMiPMaK7+WFwnFEXkZ3Vohu62dq616
         N+R1EzIm7V8KcRkNTNIoa/3vuklOIwrNzklbE=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=BzKToS5xjM35u5LZ8bswmbxC49mgCpA8Dy5YGCzadBDYML8xs37RoFko5/mub/dpRw
         Ii6DO/uOTGEy12WrzU+/lIPLP5eVptdqk+/U0fXPoMuNLxc4vfE1lXrixbax6G2I6vcO
         3kiz0jv+5HKiFul/Xh5b7HXGIuvj9zSpKuLe4=
Received: by 10.114.249.4 with SMTP id w4mr9369290wah.186.1259633184448;
        Mon, 30 Nov 2009 18:06:24 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3321376pzk.5.2009.11.30.18.06.20
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 30 Nov 2009 18:06:23 -0800 (PST)
Subject: Re: [PATCH v5 5/8] Loongson: YeeLoong: add hwmon driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        linux-mips@linux-mips.org, zhangfx@lemote.com, yanh@lemote.com,
        huhb@lemote.com, lm-sensors@lm-sensors.org
In-Reply-To: <20091201014819.GA29728@linux-mips.org>
References: <cover.1259414649.git.wuzhangjin@gmail.com>
         <ed9926f7d6acbf2abd2eb172ec5147e578dc8fb7.1259414649.git.wuzhangjin@gmail.com>
         <1259558432.5516.8.camel@falcon.domain.org>
         <1259562294.5516.16.camel@falcon.domain.org>
         <20091201014819.GA29728@linux-mips.org>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 01 Dec 2009 10:06:03 +0800
Message-ID: <1259633163.1894.24.camel@falcon>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25217
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-01 at 01:48 +0000, Ralf Baechle wrote:
> On Mon, Nov 30, 2009 at 02:24:54PM +0800, Wu Zhangjin wrote:
> 
> > > > +config YEELOONG_HWMON
> > > > +	tristate "Hardware Monitor Driver"
> > > > +	select HWMON
> > > 
> > > Will use depend in the next version.
> > > 
> > 
> > Sorry, This must be select, there is no other way to select this stuff.
> 
> Why that?

Hmm, sorry, my old explanation is totally Wrong, it's better to select
it for us, just as the x86 platform drivers did:

$ cat drivers/platform/x86/Kconfig | grep " HWMON"
	select HWMON
	select HWMON

Because the HWMON stuff is put in the device drivers as a menuconfig,
but our platform driver is put in its own directory. it will not be
convenient for the users to select it themselves, and also, this select
have no side effect.

Best Regards,
	Wu Zhangjin


From ralf@linux-mips.org Tue Dec  1 03:14:14 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 03:14:18 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:35749 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493261AbZLACOO (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 03:14:14 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB12E9mw006971;
        Tue, 1 Dec 2009 02:14:09 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB12E8QU006969;
        Tue, 1 Dec 2009 02:14:08 GMT
Date:   Tue, 1 Dec 2009 02:14:08 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     David VomLehn <dvomlehn@cisco.com>
Cc:     linux-mips@linux-mips.org
Subject: Re: [PATCH 1/2] Set of fixes for DMA when dma_addr_t != physical
 address
Message-ID: <20091201021408.GB29728@linux-mips.org>
References: <20091125200024.GA13307@dvomlehn-lnx2.corp.sa.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091125200024.GA13307@dvomlehn-lnx2.corp.sa.net>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25218
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 25, 2009 at 03:00:24PM -0500, David VomLehn wrote:

> From: Jon Fraser <jfraser@broadcom.com>
> DMA changes from Jon Fraser, slightly tweaked for 2.6.30.
> 
> Signed-off-by: Jon Fraser <jfraser@broadcom.com>
> Signed-off-by: David VomLehn <dvomlehn@cisco.com>
> ---
>  arch/mips/mm/dma-default.c |   14 ++++++++++----
>  1 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
> index 4fdb7f5..70cff1f 100644
> --- a/arch/mips/mm/dma-default.c
> +++ b/arch/mips/mm/dma-default.c
> @@ -135,6 +135,9 @@ EXPORT_SYMBOL(dma_free_coherent);
>  static inline void __dma_sync(unsigned long addr, size_t size,
>  	enum dma_data_direction direction)
>  {
> +
> +	BUG_ON(addr < KSEG0);

This won't work right on 64-bit.

> +
>  	switch (direction) {
>  	case DMA_TO_DEVICE:
>  		dma_cache_wback(addr, size);
> @@ -188,11 +191,13 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
>  	for (i = 0; i < nents; i++, sg++) {
>  		unsigned long addr;
>  
> +		BUG_ON(!sg_page(sg));
> +

No need to test this; the sg_virt() in the next line will blow up if
a bad sg was passed in.

>  		addr = (unsigned long) sg_virt(sg);
> -		if (!plat_device_is_coherent(dev) && addr)
> +		if (!plat_device_is_coherent(dev) && (addr >= KSEG0))

Again this KSEG0 test won't work right on 64-bit.

>  			__dma_sync(addr, sg->length, direction);
> -		sg->dma_address = plat_map_dma_mem(dev,
> -				                   (void *)addr, sg->length);
> +
> +		sg->dma_address = sg_phys(sg);

This breaks anything with a non-trival DMA engine like Jazz.

>  	}
>  
>  	return nents;
> @@ -229,7 +234,7 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
>  		if (!plat_device_is_coherent(dev) &&
>  		    direction != DMA_TO_DEVICE) {
>  			addr = (unsigned long) sg_virt(sg);
> -			if (addr)
> +			if (addr >= KSEG0)
>  				__dma_sync(addr, sg->length, direction);

Ditto re. KSEG0.

>  		}
>  		plat_unmap_dma_mem(dev, sg->dma_address);
> @@ -359,6 +364,7 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
>  	       enum dma_data_direction direction)
>  {
>  	BUG_ON(direction == DMA_NONE);
> +	BUG_ON(vaddr < (void *)KSEG0);

Ditto.

>  
>  	plat_extra_sync_for_device(dev);
>  	if (!plat_device_is_coherent(dev))

  Ralf

From ralf@linux-mips.org Tue Dec  1 04:58:39 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 04:58:42 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:52760 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1491808AbZLAD6i (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 04:58:38 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB13wwNe015313;
        Tue, 1 Dec 2009 03:58:58 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB13wwCk015311;
        Tue, 1 Dec 2009 03:58:58 GMT
Date:   Tue, 1 Dec 2009 03:58:58 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     David VomLehn <dvomlehn@cisco.com>
Cc:     linux-mips@linux-mips.org
Subject: Re: [PATCH 2/2] Set of fixes for DMA when dma_addr_t != physical
 address
Message-ID: <20091201035857.GC29728@linux-mips.org>
References: <20091125200027.GA13748@dvomlehn-lnx2.corp.sa.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091125200027.GA13748@dvomlehn-lnx2.corp.sa.net>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25219
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 25, 2009 at 03:00:28PM -0500, David VomLehn wrote:

> Fixes for using DMA on systems where the DMA address and the physical address
> differ.
> 
> Signed-off-by: Dezhong Diao <dediao@cisco.com>
> Signed-off-by: David VomLehn <dvomlehn@cisco.com>
> ---
>  arch/mips/mm/dma-default.c |   22 ++++++++++++++--------
>  1 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
> index 414d7ff..eaa7fb4 100644
> --- a/arch/mips/mm/dma-default.c
> +++ b/arch/mips/mm/dma-default.c
> @@ -24,8 +24,11 @@ static inline unsigned long dma_addr_to_virt(struct device *dev,
>  	dma_addr_t dma_addr)
>  {
>  	unsigned long addr = plat_dma_addr_to_phys(dev, dma_addr);
> +	unsigned int offset = (dma_addr & ~PAGE_MASK);
> +	struct page *pg;
>  
> -	return (unsigned long)phys_to_virt(addr);
> +	pg = pfn_to_page(addr >> PAGE_SHIFT);
> +	return (unsigned long)(page_address(pg) + offset);

So this is the core of the two patches.

It'll make I/O to kmapped pages work - but you're not supposed to do that.
The burden to perform I/O on highmem pages is on the subsystem that does
the I/O, not the DMA layer!

>  }
>  
>  /*
> @@ -136,7 +139,6 @@ EXPORT_SYMBOL(dma_free_coherent);
>  static inline void __dma_sync(unsigned long addr, size_t size,
>  	enum dma_data_direction direction)
>  {
> -

This is the blank line the previous patch shouldn't have added.

>  	BUG_ON(addr < KSEG0);
>  
>  	switch (direction) {
> @@ -197,8 +199,8 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
>  		addr = (unsigned long) sg_virt(sg);
>  		if (!plat_device_is_coherent(dev) && (addr >= KSEG0))
>  			__dma_sync(addr, sg->length, direction);
> -
> -		sg->dma_address = sg_phys(sg);
> +		sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) +
> +			sg->offset;

Ah, this segment undoes the damage done by the previous patch.  If I apply
both and diff, the change looks like:

-               sg->dma_address = plat_map_dma_mem(dev,
-                                                  (void *)addr, sg->length);
+               sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) +
+                       sg->offset;

sg_page returns a struct page *.  Adding sg->offset yields nonense.  I think
you mean something like ((unsigned long) sg_page(sg)) + sg->offset.

>  	}
>  
>  	return nents;
> @@ -253,7 +255,8 @@ void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
>  		unsigned long addr;
>  
>  		addr = dma_addr_to_virt(dev, dma_handle);
> -		__dma_sync(addr, size, direction);
> +		if (addr >= KSEG0)
> +			__dma_sync(addr, size, direction);

Again this KSEG0 comparison will not work as intended on 64-bit.  And on 32-bit
I don't see why it would be required.  No userspace address should ever be
passed into this function.

>  	}
>  }
>  
> @@ -269,7 +272,8 @@ void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
>  		unsigned long addr;
>  
>  		addr = dma_addr_to_virt(dev, dma_handle);
> -		__dma_sync(addr, size, direction);
> +		if (addr >= KSEG0)
> +			__dma_sync(addr, size, direction);

Ditto.

>  	}
>  }
>  
> @@ -284,7 +288,8 @@ void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
>  		unsigned long addr;
>  
>  		addr = dma_addr_to_virt(dev, dma_handle);
> -		__dma_sync(addr + offset, size, direction);
> +		if (addr >= KSEG0)
> +			__dma_sync(addr + offset, size, direction);

Ditto.

>  	}
>  }
>  
> @@ -300,7 +305,8 @@ void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
>  		unsigned long addr;
>  
>  		addr = dma_addr_to_virt(dev, dma_handle);
> -		__dma_sync(addr + offset, size, direction);
> +		if (addr >= KSEG0)
> +			__dma_sync(addr + offset, size, direction);

Ditto.

>  	}
>  }
>  

  Ralf

From jacklu@allplus-cn.com Tue Dec  1 04:52:36 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 04:59:53 +0100 (CET)
Received: from 60-248-150-25.HINET-IP.hinet.net ([60.248.150.25]:43600 "EHLO
        dns.allplus-cn.com" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org
        with ESMTP id S1491756AbZLADwg convert rfc822-to-8bit (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 04:52:36 +0100
Received: from DELLPC (unknown [116.231.39.52])
        by dns.allplus-cn.com (Postfix) with ESMTP id 912192DBD5D
        for <linux-mips@linux-mips.org>; Tue,  1 Dec 2009 12:50:43 +0800 (CST)
From:   "jack_lu" <jacklu@allplus-cn.com>
To:     <linux-mips@linux-mips.org>
Subject:  hello! can you help me for compiling the linux kernel?
Date:   Tue, 1 Dec 2009 11:52:07 +0800
Message-ID: <74D96A2497124516897C6F4D06D8B5AB@DELLPC>
MIME-Version: 1.0
Content-Type: text/plain;
        charset="utf-8"
Content-Transfer-Encoding: 8BIT
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7600.16385
Thread-Index: AcpyNZYhWZbNIwZFQnuHM/f8qsMGWQAA/jsg
X-Allplus-MailScanner-Information: Please contact the ISP for more information
X-Allplus-MailScanner: Found to be clean
X-Allplus-MailScanner-From: jacklu@allplus-cn.com
Return-Path: <jacklu@allplus-cn.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25220
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: jacklu@allplus-cn.com
Precedence: bulk
X-list: linux-mips

Dear Sir,
　　hello! can you help me for compiling the linux kernel?
　　Linux version is linux-2.6.21.5.
　　CPU:mips
　　Cross-compilation tools is eldk and openwrt file packages.
　　Errors are the followings.
　　init/built-in.o: In function `init':
　　init/main.c:833: undefined reference to `opipmux_gel_init'
　　init/main.c:833: relocation truncated to fit: R_MIPS_26 against `opipmux_gel_init'
　　init/main.c:835: undefined reference to `ip_auto_config'
　　init/main.c:835: relocation truncated to fit: R_MIPS_26 against `ip_auto_config'
　　init/built-in.o: In function `start_kernel':
　　init/main.c:525: undefined reference to `setup_prom_printf'
　　init/main.c:525: relocation truncated to fit: R_MIPS_26 against `setup_prom_printf'
　　init/main.c:527: undefined reference to `prom_printf'
　　init/main.c:527: relocation truncated to fit: R_MIPS_26 against `prom_printf'
　　init/main.c:530: undefined reference to `prom_printf'
　　init/main.c:530: relocation truncated to fit: R_MIPS_26 against `prom_printf'
　　arch/mips/kernel/built-in.o: In function `test_setdata':
　　arch/mips/kernel/syscall.c:461: undefined reference to `set_ipmux_el_tx_buf_data'
　　arch/mips/kernel/syscall.c:461: relocation truncated to fit: R_MIPS_26 against `set_ipmux_el_tx_buf_data'
　　arch/mips/kernel/built-in.o: In function `test_getdata':
　　arch/mips/kernel/syscall.c:453: undefined reference to `get_ipmux_el_rx_buf_data'
　　arch/mips/kernel/syscall.c:453: relocation truncated to fit: R_MIPS_26 against `get_ipmux_el_rx_buf_data'
　　arch/mips/kernel/built-in.o: In function `test_waitinterrupt':
　　arch/mips/kernel/syscall.c:446: undefined reference to `wait_for_host_test_interrupt'
　　arch/mips/kernel/syscall.c:446: relocation truncated to fit: R_MIPS_26 against `wait_for_host_test_interrupt'
　　kernel/built-in.o: In function `free_module':
　　kernel/module.c:1231: undefined reference to `kfree1'
　　kernel/module.c:1231: relocation truncated to fit: R_MIPS_26 against `kfree1'
　　drivers/built-in.o: In function `snapshot_map':
　　drivers/md/dm-snap.c:900: undefined reference to `__cmpdi2'
　　drivers/md/dm-snap.c:900: relocation truncated to fit: R_MIPS_26 against `__cmpdi2'
　　make: *** [.tmp_vmlinux1] Error 1
　　make: *** No rule to make target `../vmlinux', needed by `piggy.lzma'.  Stop.
　　copyed to ../wrt_uImage
　　cp: cannot stat `uImageLzma': No such file or directory
　　ls: cannot access ../wrt_uImage: No such file or directory
　　===============================================================
　　    output files:                           
　　         wrt_uImage : the kernel image      
　　
　　
　　Thanks &Best Wishes,
　　Jack_Lu(鲁红刚)
   益满颖贸易（上海）有限公司
   上海市愚园路168号环球大厦A座2101室
   电话：+86 21 62495328/29/30/31 分机：820
   传真：+86 21 62490538
   MSN: luhongang@163.com

　　


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


From wuzhangjin@gmail.com Tue Dec  1 07:55:46 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 07:55:50 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:57941 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492130AbZLAGzq (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 07:55:46 +0100
Received: by pzk35 with SMTP id 35so3446600pzk.22
        for <multiple recipients>; Mon, 30 Nov 2009 22:55:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer;
        bh=FaHKPCCGS+EkoEUOTtJEUisoHXUNm02T3M6l+h9WLWo=;
        b=QrfxaWLm6LxXaq6ZYLKOlIO5GQZZ9+ClH1J/5qGX4gadf3WmMeuhGEHBj9ORBPaRyU
         zz3RsfQYzFCsEC7y37L43sAjwJOMluUp5lqBa3mb0aA/CQt33QJDKYuODPkTQnoxo/bJ
         ITrNd7gBCy1oXZgJIWSIQ5cjgJv0VR2IiP2MY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer;
        b=FjJWjTf24Wu4kPAylt4bgnRTw1u0xYrrYE7MRKhtrIq4RCHqMV4pqd9Aqf1UNEy/uU
         doa8S2QWqbiweZW1ScSJhQKyowX9dJGR1FwunhG2Nawhy66KbpKGk0ouWTcwkeCD/e9o
         F/hnOgEz2STxO+xFM/4z1bmXAVruhjcKCHxm4=
Received: by 10.115.26.2 with SMTP id d2mr10065670waj.14.1259650535418;
        Mon, 30 Nov 2009 22:55:35 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm3474092pzk.15.2009.11.30.22.55.32
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 30 Nov 2009 22:55:35 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH 1/2] Loongson: disable PAGE_SIZE_4KB
Date:   Tue,  1 Dec 2009 14:55:25 +0800
Message-Id: <1259650525-31884-1-git-send-email-wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25221
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

Currently, with PAGE_SIZE_4KB, the kernel for loongson will hang on:

Kernel panic - not syncing: Attempted to kill init!

The possible reason is the cache aliases problem:

Loongson 2F has 64kb, 4 way L1 Cache, the way size is 16kb, which is
bigger then 4kb. so, If using 4kb page size, there is cache aliases
problem(Documentation/cachetlb.txt), to avoid such problem, we may need
extra cache flushing. but with 16kb page size, there is no cache aliases
problem and no corresponding operations needed to cope with that
problem, so, it's better to disable 4kb page size directly before the
above problem is solved.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b03af82..8bf36d2 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1510,6 +1510,7 @@ choice
 
 config PAGE_SIZE_4KB
 	bool "4kB"
+	depends on !CPU_LOONGSON2
 	help
 	 This option select the standard 4kB Linux page size.  On some
 	 R3000-family processors this is the only available page size.  Using
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 07:56:08 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 07:56:11 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:44905 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492150AbZLAG4E (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 07:56:04 +0100
Received: by pwi15 with SMTP id 15so2461277pwi.24
        for <multiple recipients>; Mon, 30 Nov 2009 22:55:53 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer;
        bh=B//V9feMDCkW5htre6axPFXbRjuVbVmhm1RjhNp7kVg=;
        b=QdYx1HNlpOORWHaaolTFjJubLOBTdRtO4C6Pzppvlu9Ik2nWcFETBvTU9AW+3QJ1nk
         3ztlYtJrZw21/k4rw2EM9N/BSeJ9RUEsMki6KV5b6GU+1gdxWQ+sEMARJ7fezGoqA1d0
         1tovsnYoWBMSon9AjBPEy0C98AxuLNRw5p9RI=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer;
        b=g13fg5bicZjvpNuH6em0Cgxo6DLM0dhPjx3hG+FLbgzAOA9FnntxC2y02B0jtJUIgD
         Q0l3bPJTSda38iKXa4mtLC6FAb1+6Gh6fi7xc1heOh7m4Q3IfGZwTuoD6DnHIPBeKik8
         szXYvj9qnRNEF5Gey5QFgl1TPG87sKbz51GLk=
Received: by 10.114.214.36 with SMTP id m36mr9990175wag.172.1259650553684;
        Mon, 30 Nov 2009 22:55:53 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm67503pxi.6.2009.11.30.22.55.49
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 30 Nov 2009 22:55:53 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH 2/2] Loongson: disable FLATMEM
Date:   Tue,  1 Dec 2009 14:55:42 +0800
Message-Id: <1259650542-31922-1-git-send-email-wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25222
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

With FLATMEM, The STD(Hibernation) for Loongson will fail, and there are
also some other problems(break the files) when using NFS or CIFS(samba).

And as the config help of SPARSEMEM says:

"This option provides some potential performance benefits, along with
decreased code complexity."

So, to avoid the potential problems of FLATMEM, we disable FLATMEM
directly and use SPARSEMEM instead.

Relative Email thread:

http://groups.google.com/group/loongson-dev/browse_thread/thread/b6b65890ec2b0f24/feb43e5aa7f55d9b?show_docid=feb43e5aa7f55d9b

Reported-by: Tatu Kilappa <tatu.kilappa@gmail.com>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 8bf36d2..0be245d 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1835,7 +1835,7 @@ config SYS_SUPPORTS_SMARTMIPS
 
 config ARCH_FLATMEM_ENABLE
 	def_bool y
-	depends on !NUMA
+	depends on !NUMA && !CPU_LOONGSON2
 
 config ARCH_DISCONTIGMEM_ENABLE
 	bool
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:06:32 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:06:36 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:58223 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491888AbZLALGc (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:06:32 +0100
Received: by pwi15 with SMTP id 15so2581540pwi.24
        for <multiple recipients>; Tue, 01 Dec 2009 03:06:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer;
        bh=j2/FTmBB7SrTcBEHfax6N1ECzjpYf/o1bCyqNDPqYUs=;
        b=U8VY4JHJnl8Oc3WvMDYUG8geteXUB/Y1swm/mgVk7lSlsmEJMX3Jyk4duzzZtEqE/R
         9gEesX2ydPUpkhdzWDfGhV4g1uyZSr4WTXODs9CQQboP58ppN7bdoXsWjOEI1EFPOppF
         9CKBFwODf+8h0TP/F3eUcue1Cq5jcZQTrMAAU=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer;
        b=CcBlpar9KiQgv0LyF+5Ywt10UO86/X9dX+yHkibq3HGDVbQRe8ur7Cuq80Vjb7iUb8
         zkI/+nYBUOUTjDLTBkXXXVgCVwz3uB9UaAsd1EZXVbI0vh+inPtxsR5QlynO7Szlmx1M
         yFj+sCAlxNuG4AQfMTOByluCsJKwx6pI4vt1Y=
Received: by 10.114.214.24 with SMTP id m24mr10632458wag.93.1259665584985;
        Tue, 01 Dec 2009 03:06:24 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm484367pxi.12.2009.12.01.03.06.19
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:06:24 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        linux-mips@linux-mips.org, zhangfx@lemote.com,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 0/8] Loongson: YeeLoong: add platform specific drivers
Date:   Tue,  1 Dec 2009 19:06:13 +0800
Message-Id: <cover.1259660040.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25223
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patchset adds platform specific drivers for YeeLoong netbook. including
the backlight, battery, hwmon, video output, suspend and hotkey(input) drivers.
These drivers provide standard interfaces to the user-space applications to
manage the relative devices:
	
 	 Modules			Tools

	- backlight
	  /sys/class/backlight/		kpowersave, gnome-power-manager
	- battery
	  /proc/apm			kpowersave, gnome-power-manager
	- hwmon
	  /sys/class/hwmon/		lm-sensors, sensors-applet...
	- video output
	  /sys/class/video_output	?
	- suspend
	  /sys/power/state		kpowersave, gnome-power-manager
	- hotkey
	  /sys/class/input/		gnome-settings-daemon ?

To utilize the above interfaces, you are recommended to install the latest hal,
dbus.

This v6 revision incorporates with the feedbacks from Ralf, Pavel Machek,
Rafael J. Wysocki and Dmitry Torokhov.

Changes from the old v5 revision:

	- Cleanup the "select" and "depend" of the options
	  Replace some "select"s by "depend"s to avoid potential compiling
	  errors.

	- Cleanup the hotkey(input) driver
	  Merge several functions, Cleanup the comments, Use Switch...Case
	  instead of the array.

	- Fixup of the video output driver  
	  Seems the video output subsystem doesn't handle the input value, we
	  handle it outselves via !!od->request_state.

	- Append the yl_ prefix to the file names
	  yl_ prefix is needed to distinguish it with the next patchset for
	  lynloong pc platform drivers.

All changes have been tested again.

Best Regards,
     Wu Zhangjin

Wu Zhangjin (8):
  Loongson: Lemote-2F: add platform specific submenu
  Loongson: YeeLoong: add platform specific option
  Loongson: YeeLoong: add backlight driver
  Loongson: YeeLoong: add battery driver
  Loongson: YeeLoong: add hwmon driver
  Loongson: YeeLoong: add video output driver
  Loongson: YeeLoong: add suspend driver
  Loongson: YeeLoong: add hotkey driver

 arch/mips/kernel/setup.c                           |    1 +
 arch/mips/loongson/Kconfig                         |   21 +
 arch/mips/loongson/lemote-2f/Makefile              |    7 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c          |  130 ------
 arch/mips/loongson/lemote-2f/ec_kb3310b.h          |  188 --------
 arch/mips/loongson/lemote-2f/pm.c                  |    4 +-
 arch/mips/loongson/lemote-2f/reset.c               |    2 +-
 .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |   65 +++
 .../loongson/lemote-2f/yeeloong_laptop/Makefile    |   10 +
 .../lemote-2f/yeeloong_laptop/ec_kb3310b.c         |  126 ++++++
 .../lemote-2f/yeeloong_laptop/ec_kb3310b.h         |  193 +++++++++
 .../lemote-2f/yeeloong_laptop/yl_backlight.c       |   93 ++++
 .../lemote-2f/yeeloong_laptop/yl_battery.c         |  127 ++++++
 .../loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c |  452 ++++++++++++++++++++
 .../loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c  |  239 +++++++++++
 .../lemote-2f/yeeloong_laptop/yl_suspend.c         |  135 ++++++
 .../loongson/lemote-2f/yeeloong_laptop/yl_vo.c     |  164 +++++++
 17 files changed, 1635 insertions(+), 322 deletions(-)
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.c
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.c
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_backlight.c
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_battery.c
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_vo.c


From wuzhangjin@gmail.com Tue Dec  1 12:07:45 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:07:48 +0100 (CET)
Received: from mail-px0-f188.google.com ([209.85.216.188]:52040 "EHLO
        mail-px0-f188.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492159AbZLALHp (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:07:45 +0100
Received: by pxi26 with SMTP id 26so3678786pxi.21
        for <multiple recipients>; Tue, 01 Dec 2009 03:07:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=HFYSN0IXtJ50L6H3h1pPKd+UhjsWhfx1ZLTJaxlQp1s=;
        b=VeHT2WBHbnMIYahVSijcCv3VekQBp5WJN6T1ZUur6potoSMpM4yFJQ+80UCWK8KEIw
         /EW/5j+EEB3J+ryNG9ZLFm1ic+PkS7GGTUm0KWutlBLTT6o1ieP6KqEFtUBXunxCux3l
         f6iA7Ut24Hhys2kZUEN29VY+WGpP7/pEabqmo=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=bNvdcMkN9+wG6bZp4yZudOZHA1fUplVt8I8DAAZKrNtvoQ8JK7UyRAv7j1WzaA1RAE
         m32tv0A7poOKlFWCF2ORAlhGYX46fVQ1otyhz25u14TJinQla3KC8yAU3QKaUwnjNGiV
         68Kao1R4qMRsxLCZN/J4+XUWnPVKRvnlO6iJE=
Received: by 10.115.26.7 with SMTP id d7mr10624519waj.12.1259665658014;
        Tue, 01 Dec 2009 03:07:38 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm474250pxi.3.2009.12.01.03.07.34
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:07:37 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 1/8] Loongson: Lemote-2F: add platform specific submenu
Date:   Tue,  1 Dec 2009 19:07:23 +0800
Message-Id: <a67a4a2ab32fc0e3281845479f07adf69dbf0bb2.1259664573.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1259664573.git.wuzhangjin@gmail.com>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25224
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/loongson/Kconfig |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
index 3df1967..a34dfcc 100644
--- a/arch/mips/loongson/Kconfig
+++ b/arch/mips/loongson/Kconfig
@@ -83,3 +83,23 @@ config LOONGSON_UART_BASE
 	bool
 	default y
 	depends on EARLY_PRINTK || SERIAL_8250
+
+#
+# Loongson Platform Specific Drivers
+#
+
+menuconfig LOONGSON_PLATFORM_DEVICES
+	bool "Loongson Platform Drivers"
+	default y
+	help
+	  Say Y here to get to see options for device drivers of various
+	  loongson platforms, including vendor-specific laptop/pc extension
+	  drivers.  This option alone does not add any kernel code.
+
+	  If you say N, all options in this submenu will be skipped and disabled.
+
+if LOONGSON_PLATFORM_DEVICES
+# Put platform specific stuff here
+
+
+endif # LOONGSON_PLATFORM_DEVICES
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:08:18 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:08:22 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:57134 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492281AbZLALIS (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:08:18 +0100
Received: by pwi15 with SMTP id 15so2582441pwi.24
        for <multiple recipients>; Tue, 01 Dec 2009 03:08:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=GNM+Q001W2cN/4THSd+Xkxejs3T6m4qnuK42wQxLbrk=;
        b=UZZFneFot7h/ivnyEUxjTDCRhK5PNjJXOuSZYqdAU09q5A37q1/wHsexhh+QCizo4u
         zOmYvEWhPzAPD5QwJdqRx5y6UKH3Nl/YbNt8WP5oZ0CJWEZMieU78VsHjqA2nC/MHipa
         u76dqhe2+nlbopiWBZQPRluHtpEcAyx4zNIXY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=npum3LjTWa2cwebsCwZHLMwtCVzO1nHphUiYFQ16wltuZb+LFn0Cqu3YDWqe8FHYQS
         UsekMFAqw/zuS5GLCeHdV0zvzCTEk50zxMGAQzS8IOtIX+a4t1dwNJnGtLoJpnfuqDLS
         /Ylx/zH3zywpF3SPuax1l1snP2uYcpCA/1DV8=
Received: by 10.115.98.40 with SMTP id a40mr10598259wam.97.1259665691057;
        Tue, 01 Dec 2009 03:08:11 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm482047pxi.5.2009.12.01.03.08.07
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:08:10 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 2/8] Loongson: YeeLoong: add platform specific option
Date:   Tue,  1 Dec 2009 19:07:45 +0800
Message-Id: <e420b43bb54c33343e15cf53baf39806ba6583ae.1259664573.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1259664573.git.wuzhangjin@gmail.com>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25225
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch add a new LEMOTE_YEELOONG2F option, a yeeloong_laptop/
directory for the coming yeeloong specific support, and for the
ec_kb3310b belongs to yeeloong, so, move it to yeeloong_laptop/ too.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/loongson/Kconfig                         |    1 +
 arch/mips/loongson/lemote-2f/Makefile              |    7 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c          |  130 --------------
 arch/mips/loongson/lemote-2f/ec_kb3310b.h          |  188 --------------------
 arch/mips/loongson/lemote-2f/pm.c                  |    4 +-
 arch/mips/loongson/lemote-2f/reset.c               |    2 +-
 .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |   15 ++
 .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    3 +
 .../lemote-2f/yeeloong_laptop/ec_kb3310b.c         |  126 +++++++++++++
 .../lemote-2f/yeeloong_laptop/ec_kb3310b.h         |  187 +++++++++++++++++++
 10 files changed, 341 insertions(+), 322 deletions(-)
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.c
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.c
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h

diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
index a34dfcc..d440c32 100644
--- a/arch/mips/loongson/Kconfig
+++ b/arch/mips/loongson/Kconfig
@@ -101,5 +101,6 @@ menuconfig LOONGSON_PLATFORM_DEVICES
 if LOONGSON_PLATFORM_DEVICES
 # Put platform specific stuff here
 
+source "arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig"
 
 endif # LOONGSON_PLATFORM_DEVICES
diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson/lemote-2f/Makefile
index 4d84b27..0ada6c9 100644
--- a/arch/mips/loongson/lemote-2f/Makefile
+++ b/arch/mips/loongson/lemote-2f/Makefile
@@ -2,10 +2,15 @@
 # Makefile for lemote loongson2f family machines
 #
 
-obj-y += irq.o reset.o ec_kb3310b.o
+obj-y += irq.o reset.o
 
 #
 # Suspend Support
 #
 
 obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
+
+#
+# Platform Drivers
+#
+obj-y += yeeloong_laptop/
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.c b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
deleted file mode 100644
index 4d84111..0000000
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Basic KB3310B Embedded Controller support for the YeeLoong 2F netbook
- *
- *  Copyright (C) 2008 Lemote Inc.
- *  Author: liujl <liujl@lemote.com>, 2008-04-20
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <linux/delay.h>
-
-#include "ec_kb3310b.h"
-
-static DEFINE_SPINLOCK(index_access_lock);
-static DEFINE_SPINLOCK(port_access_lock);
-
-unsigned char ec_read(unsigned short addr)
-{
-	unsigned char value;
-	unsigned long flags;
-
-	spin_lock_irqsave(&index_access_lock, flags);
-	outb((addr & 0xff00) >> 8, EC_IO_PORT_HIGH);
-	outb((addr & 0x00ff), EC_IO_PORT_LOW);
-	value = inb(EC_IO_PORT_DATA);
-	spin_unlock_irqrestore(&index_access_lock, flags);
-
-	return value;
-}
-EXPORT_SYMBOL_GPL(ec_read);
-
-void ec_write(unsigned short addr, unsigned char val)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&index_access_lock, flags);
-	outb((addr & 0xff00) >> 8, EC_IO_PORT_HIGH);
-	outb((addr & 0x00ff), EC_IO_PORT_LOW);
-	outb(val, EC_IO_PORT_DATA);
-	/*  flush the write action */
-	inb(EC_IO_PORT_DATA);
-	spin_unlock_irqrestore(&index_access_lock, flags);
-
-	return;
-}
-EXPORT_SYMBOL_GPL(ec_write);
-
-/*
- * This function is used for EC command writes and corresponding status queries.
- */
-int ec_query_seq(unsigned char cmd)
-{
-	int timeout;
-	unsigned char status;
-	unsigned long flags;
-	int ret = 0;
-
-	spin_lock_irqsave(&port_access_lock, flags);
-
-	/* make chip goto reset mode */
-	udelay(EC_REG_DELAY);
-	outb(cmd, EC_CMD_PORT);
-	udelay(EC_REG_DELAY);
-
-	/* check if the command is received by ec */
-	timeout = EC_CMD_TIMEOUT;
-	status = inb(EC_STS_PORT);
-	while (timeout-- && (status & (1 << 1))) {
-		status = inb(EC_STS_PORT);
-		udelay(EC_REG_DELAY);
-	}
-
-	if (timeout <= 0) {
-		printk(KERN_ERR "%s: deadable error : timeout...\n", __func__);
-		ret = -EINVAL;
-	} else
-		printk(KERN_INFO
-			   "(%x/%d)ec issued command %d status : 0x%x\n",
-			   timeout, EC_CMD_TIMEOUT - timeout, cmd, status);
-
-	spin_unlock_irqrestore(&port_access_lock, flags);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(ec_query_seq);
-
-/*
- * Send query command to EC to get the proper event number
- */
-int ec_query_event_num(void)
-{
-	return ec_query_seq(CMD_GET_EVENT_NUM);
-}
-EXPORT_SYMBOL(ec_query_event_num);
-
-/*
- * Get event number from EC
- *
- * NOTE: This routine must follow the query_event_num function in the
- * interrupt.
- */
-int ec_get_event_num(void)
-{
-	int timeout = 100;
-	unsigned char value;
-	unsigned char status;
-
-	udelay(EC_REG_DELAY);
-	status = inb(EC_STS_PORT);
-	udelay(EC_REG_DELAY);
-	while (timeout-- && !(status & (1 << 0))) {
-		status = inb(EC_STS_PORT);
-		udelay(EC_REG_DELAY);
-	}
-	if (timeout <= 0) {
-		pr_info("%s: get event number timeout.\n", __func__);
-
-		return -EINVAL;
-	}
-	value = inb(EC_DAT_PORT);
-	udelay(EC_REG_DELAY);
-
-	return value;
-}
-EXPORT_SYMBOL(ec_get_event_num);
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/ec_kb3310b.h
deleted file mode 100644
index 1595a21..0000000
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * KB3310B Embedded Controller
- *
- *  Copyright (C) 2008 Lemote Inc.
- *  Author: liujl <liujl@lemote.com>, 2008-03-14
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _EC_KB3310B_H
-#define _EC_KB3310B_H
-
-extern unsigned char ec_read(unsigned short addr);
-extern void ec_write(unsigned short addr, unsigned char val);
-extern int ec_query_seq(unsigned char cmd);
-extern int ec_query_event_num(void);
-extern int ec_get_event_num(void);
-
-typedef int (*sci_handler) (int status);
-extern sci_handler yeeloong_report_lid_status;
-
-#define SCI_IRQ_NUM 0x0A
-
-/*
- * The following registers are determined by the EC index configuration.
- * 1, fill the PORT_HIGH as EC register high part.
- * 2, fill the PORT_LOW as EC register low part.
- * 3, fill the PORT_DATA as EC register write data or get the data from it.
- */
-#define	EC_IO_PORT_HIGH	0x0381
-#define	EC_IO_PORT_LOW	0x0382
-#define	EC_IO_PORT_DATA	0x0383
-
-/*
- * EC delay time is 500us for register and status access
- */
-#define	EC_REG_DELAY	500	/* unit : us */
-#define	EC_CMD_TIMEOUT	0x1000
-
-/*
- * EC access port for SCI communication
- */
-#define	EC_CMD_PORT		0x66
-#define	EC_STS_PORT		0x66
-#define	EC_DAT_PORT		0x62
-#define	CMD_INIT_IDLE_MODE	0xdd
-#define	CMD_EXIT_IDLE_MODE	0xdf
-#define	CMD_INIT_RESET_MODE	0xd8
-#define	CMD_REBOOT_SYSTEM	0x8c
-#define	CMD_GET_EVENT_NUM	0x84
-#define	CMD_PROGRAM_PIECE	0xda
-
-/* temperature & fan registers */
-#define	REG_TEMPERATURE_VALUE	0xF458
-#define	REG_FAN_AUTO_MAN_SWITCH 0xF459
-#define	BIT_FAN_AUTO		0
-#define	BIT_FAN_MANUAL		1
-#define	REG_FAN_CONTROL		0xF4D2
-#define	BIT_FAN_CONTROL_ON	(1 << 0)
-#define	BIT_FAN_CONTROL_OFF	(0 << 0)
-#define	REG_FAN_STATUS		0xF4DA
-#define	BIT_FAN_STATUS_ON	(1 << 0)
-#define	BIT_FAN_STATUS_OFF	(0 << 0)
-#define	REG_FAN_SPEED_HIGH	0xFE22
-#define	REG_FAN_SPEED_LOW	0xFE23
-#define	REG_FAN_SPEED_LEVEL	0xF4CC
-/* fan speed divider */
-#define	FAN_SPEED_DIVIDER	480000	/* (60*1000*1000/62.5/2)*/
-
-/* battery registers */
-#define	REG_BAT_DESIGN_CAP_HIGH		0xF77D
-#define	REG_BAT_DESIGN_CAP_LOW		0xF77E
-#define	REG_BAT_FULLCHG_CAP_HIGH	0xF780
-#define	REG_BAT_FULLCHG_CAP_LOW		0xF781
-#define	REG_BAT_DESIGN_VOL_HIGH		0xF782
-#define	REG_BAT_DESIGN_VOL_LOW		0xF783
-#define	REG_BAT_CURRENT_HIGH		0xF784
-#define	REG_BAT_CURRENT_LOW		0xF785
-#define	REG_BAT_VOLTAGE_HIGH		0xF786
-#define	REG_BAT_VOLTAGE_LOW		0xF787
-#define	REG_BAT_TEMPERATURE_HIGH	0xF788
-#define	REG_BAT_TEMPERATURE_LOW		0xF789
-#define	REG_BAT_RELATIVE_CAP_HIGH	0xF492
-#define	REG_BAT_RELATIVE_CAP_LOW	0xF493
-#define	REG_BAT_VENDOR			0xF4C4
-#define	FLAG_BAT_VENDOR_SANYO		0x01
-#define	FLAG_BAT_VENDOR_SIMPLO		0x02
-#define	REG_BAT_CELL_COUNT		0xF4C6
-#define	FLAG_BAT_CELL_3S1P		0x03
-#define	FLAG_BAT_CELL_3S2P		0x06
-#define	REG_BAT_CHARGE			0xF4A2
-#define	FLAG_BAT_CHARGE_DISCHARGE	0x01
-#define	FLAG_BAT_CHARGE_CHARGE		0x02
-#define	FLAG_BAT_CHARGE_ACPOWER		0x00
-#define	REG_BAT_STATUS			0xF4B0
-#define	BIT_BAT_STATUS_LOW		(1 << 5)
-#define	BIT_BAT_STATUS_DESTROY		(1 << 2)
-#define	BIT_BAT_STATUS_FULL		(1 << 1)
-#define	BIT_BAT_STATUS_IN		(1 << 0)
-#define	REG_BAT_CHARGE_STATUS		0xF4B1
-#define	BIT_BAT_CHARGE_STATUS_OVERTEMP	(1 << 2)
-#define	BIT_BAT_CHARGE_STATUS_PRECHG	(1 << 1)
-#define	REG_BAT_STATE			0xF482
-#define	BIT_BAT_STATE_CHARGING		(1 << 1)
-#define	BIT_BAT_STATE_DISCHARGING	(1 << 0)
-#define	REG_BAT_POWER			0xF440
-#define	BIT_BAT_POWER_S3		(1 << 2)
-#define	BIT_BAT_POWER_ON		(1 << 1)
-#define	BIT_BAT_POWER_ACIN		(1 << 0)
-
-/* other registers */
-/* Audio: rd/wr */
-#define	REG_AUDIO_VOLUME	0xF46C
-#define	REG_AUDIO_MUTE		0xF4E7
-#define	REG_AUDIO_BEEP		0xF4D0
-/* USB port power or not: rd/wr */
-#define	REG_USB0_FLAG		0xF461
-#define	REG_USB1_FLAG		0xF462
-#define	REG_USB2_FLAG		0xF463
-#define	BIT_USB_FLAG_ON		1
-#define	BIT_USB_FLAG_OFF	0
-/* LID */
-#define	REG_LID_DETECT		0xF4BD
-#define	BIT_LID_DETECT_ON	1
-#define	BIT_LID_DETECT_OFF	0
-/* CRT */
-#define	REG_CRT_DETECT		0xF4AD
-#define	BIT_CRT_DETECT_PLUG	1
-#define	BIT_CRT_DETECT_UNPLUG	0
-/* LCD backlight brightness adjust: 9 levels */
-#define	REG_DISPLAY_BRIGHTNESS	0xF4F5
-/* Black screen Status */
-#define	BIT_DISPLAY_LCD_ON	1
-#define	BIT_DISPLAY_LCD_OFF	0
-/* LCD backlight control: off/restore */
-#define	REG_BACKLIGHT_CTRL	0xF7BD
-#define	BIT_BACKLIGHT_ON	1
-#define	BIT_BACKLIGHT_OFF	0
-/* Reset the machine auto-clear: rd/wr */
-#define	REG_RESET		0xF4EC
-#define	BIT_RESET_ON		1
-/* Light the led: rd/wr */
-#define	REG_LED			0xF4C8
-#define	BIT_LED_RED_POWER	(1 << 0)
-#define	BIT_LED_ORANGE_POWER	(1 << 1)
-#define	BIT_LED_GREEN_CHARGE	(1 << 2)
-#define	BIT_LED_RED_CHARGE	(1 << 3)
-#define	BIT_LED_NUMLOCK		(1 << 4)
-/* Test led mode, all led on/off */
-#define	REG_LED_TEST		0xF4C2
-#define	BIT_LED_TEST_IN		1
-#define	BIT_LED_TEST_OUT	0
-/* Camera on/off */
-#define	REG_CAMERA_STATUS	0xF46A
-#define	BIT_CAMERA_STATUS_ON	1
-#define	BIT_CAMERA_STATUS_OFF	0
-#define	REG_CAMERA_CONTROL	0xF7B7
-#define	BIT_CAMERA_CONTROL_OFF	0
-#define	BIT_CAMERA_CONTROL_ON	1
-/* Wlan Status */
-#define	REG_WLAN		0xF4FA
-#define	BIT_WLAN_ON		1
-#define	BIT_WLAN_OFF		0
-#define	REG_DISPLAY_LCD		0xF79F
-
-/* SCI Event Number from EC */
-enum {
-	EVENT_LID = 0x23,	/*  LID open/close */
-	EVENT_DISPLAY_TOGGLE,	/*  Fn+F3 for display switch */
-	EVENT_SLEEP,		/*  Fn+F1 for entering sleep mode */
-	EVENT_OVERTEMP,		/*  Over-temperature happened */
-	EVENT_CRT_DETECT,	/*  CRT is connected */
-	EVENT_CAMERA,		/*  Camera on/off */
-	EVENT_USB_OC2,		/*  USB2 Over Current occurred */
-	EVENT_USB_OC0,		/*  USB0 Over Current occurred */
-	EVENT_BLACK_SCREEN,	/*  Turn on/off backlight */
-	EVENT_AUDIO_MUTE,	/*  Mute on/off */
-	EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
-	EVENT_AC_BAT,		/*  AC & Battery relative issue */
-	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
-	EVENT_WLAN,		/*  Wlan on/off */
-	EVENT_END
-};
-
-#endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/pm.c b/arch/mips/loongson/lemote-2f/pm.c
index d7af2e6..a3947aa 100644
--- a/arch/mips/loongson/lemote-2f/pm.c
+++ b/arch/mips/loongson/lemote-2f/pm.c
@@ -23,7 +23,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536_mfgpt.h>
-#include "ec_kb3310b.h"
+#include "yeeloong_laptop/ec_kb3310b.h"
 
 #define I8042_KBD_IRQ		1
 #define I8042_CTR_KBDINT	0x01
@@ -100,7 +100,7 @@ int wakeup_loongson(void)
 	if (irq < 0)
 		return 0;
 
-	printk(KERN_INFO "%s: irq = %d\n", __func__, irq);
+	pr_info("%s: irq = %d\n", __func__, irq);
 
 	if (irq == I8042_KBD_IRQ)
 		return 1;
diff --git a/arch/mips/loongson/lemote-2f/reset.c b/arch/mips/loongson/lemote-2f/reset.c
index 51d1a60..d996a55 100644
--- a/arch/mips/loongson/lemote-2f/reset.c
+++ b/arch/mips/loongson/lemote-2f/reset.c
@@ -20,7 +20,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536.h>
-#include "ec_kb3310b.h"
+#include "yeeloong_laptop/ec_kb3310b.h"
 
 static void reset_cpu(void)
 {
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
new file mode 100644
index 0000000..d6df9b7
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
@@ -0,0 +1,15 @@
+menuconfig LEMOTE_YEELOONG2F
+	bool "Lemote YeeLoong Laptop"
+	depends on LEMOTE_MACH2F
+	default y
+	help
+	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
+	  compatible to FuLoong2F mini PC, but it has an extra Embedded
+	  Controller(kb3310b) for battery, hotkey, backlight, temperature and
+	  fan management.
+
+if LEMOTE_YEELOONG2F
+
+
+
+endif
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
new file mode 100644
index 0000000..90c4ce5
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
@@ -0,0 +1,3 @@
+# YeeLoong Specific
+
+obj-y += ec_kb3310b.o
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.c
new file mode 100644
index 0000000..cefcc72
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.c
@@ -0,0 +1,126 @@
+/*
+ * Basic KB3310B Embedded Controller support for the YeeLoong 2F netbook
+ *
+ *  Copyright (C) 2008 Lemote Inc.
+ *  Author: liujl <liujl@lemote.com>, 2008-04-20
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+
+#include "ec_kb3310b.h"
+
+static DEFINE_SPINLOCK(index_access_lock);
+static DEFINE_SPINLOCK(port_access_lock);
+
+unsigned char ec_read(unsigned short addr)
+{
+	unsigned char value;
+	unsigned long flags;
+
+	spin_lock_irqsave(&index_access_lock, flags);
+	outb((addr & 0xff00) >> 8, EC_IO_PORT_HIGH);
+	outb((addr & 0x00ff), EC_IO_PORT_LOW);
+	value = inb(EC_IO_PORT_DATA);
+	spin_unlock_irqrestore(&index_access_lock, flags);
+
+	return value;
+}
+EXPORT_SYMBOL_GPL(ec_read);
+
+void ec_write(unsigned short addr, unsigned char val)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&index_access_lock, flags);
+	outb((addr & 0xff00) >> 8, EC_IO_PORT_HIGH);
+	outb((addr & 0x00ff), EC_IO_PORT_LOW);
+	outb(val, EC_IO_PORT_DATA);
+	/*  flush the write action */
+	inb(EC_IO_PORT_DATA);
+	spin_unlock_irqrestore(&index_access_lock, flags);
+
+	return;
+}
+EXPORT_SYMBOL_GPL(ec_write);
+
+/*
+ * This function is used for EC command writes and corresponding status queries.
+ */
+int ec_query_seq(unsigned char cmd)
+{
+	int timeout;
+	unsigned char status;
+	unsigned long flags;
+	int ret = 0;
+
+	spin_lock_irqsave(&port_access_lock, flags);
+
+	/* make chip goto reset mode */
+	udelay(EC_REG_DELAY);
+	outb(cmd, EC_CMD_PORT);
+	udelay(EC_REG_DELAY);
+
+	/* check if the command is received by ec */
+	timeout = EC_CMD_TIMEOUT;
+	status = inb(EC_STS_PORT);
+	while (timeout-- && (status & (1 << 1))) {
+		status = inb(EC_STS_PORT);
+		udelay(EC_REG_DELAY);
+	}
+
+	if (timeout <= 0) {
+		pr_err("%s: deadable error : timeout...\n", __func__);
+		ret = -EINVAL;
+	}
+
+	spin_unlock_irqrestore(&port_access_lock, flags);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(ec_query_seq);
+
+/*
+ * Send query command to EC to get the proper event number
+ */
+int ec_query_event_num(void)
+{
+	return ec_query_seq(CMD_GET_EVENT_NUM);
+}
+EXPORT_SYMBOL(ec_query_event_num);
+
+/*
+ * Get event number from EC
+ *
+ * NOTE: This routine must follow the query_event_num function in the
+ * interrupt.
+ */
+int ec_get_event_num(void)
+{
+	int timeout = 100;
+	unsigned char value;
+	unsigned char status;
+
+	udelay(EC_REG_DELAY);
+	status = inb(EC_STS_PORT);
+	udelay(EC_REG_DELAY);
+	while (timeout-- && !(status & (1 << 0))) {
+		status = inb(EC_STS_PORT);
+		udelay(EC_REG_DELAY);
+	}
+	if (timeout <= 0) {
+		pr_err("%s: get event number timeout.\n", __func__);
+		return -EINVAL;
+	}
+	value = inb(EC_DAT_PORT);
+	udelay(EC_REG_DELAY);
+
+	return value;
+}
+EXPORT_SYMBOL(ec_get_event_num);
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
new file mode 100644
index 0000000..762d888
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
@@ -0,0 +1,187 @@
+/*
+ * KB3310B Embedded Controller
+ *
+ *  Copyright (C) 2008 Lemote Inc.
+ *  Author: liujl <liujl@lemote.com>, 2008-03-14
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _EC_KB3310B_H
+#define _EC_KB3310B_H
+
+extern unsigned char ec_read(unsigned short addr);
+extern void ec_write(unsigned short addr, unsigned char val);
+extern int ec_query_seq(unsigned char cmd);
+extern int ec_query_event_num(void);
+extern int ec_get_event_num(void);
+
+typedef int (*sci_handler) (int status);
+extern sci_handler yeeloong_report_lid_status;
+
+#define SCI_IRQ_NUM 0x0A
+
+/*
+ * The following registers are determined by the EC index configuration.
+ * 1, fill the PORT_HIGH as EC register high part.
+ * 2, fill the PORT_LOW as EC register low part.
+ * 3, fill the PORT_DATA as EC register write data or get the data from it.
+ */
+#define	EC_IO_PORT_HIGH	0x0381
+#define	EC_IO_PORT_LOW	0x0382
+#define	EC_IO_PORT_DATA	0x0383
+
+/*
+ * EC delay time is 500us for register and status access
+ */
+#define	EC_REG_DELAY	500	/* unit : us */
+#define	EC_CMD_TIMEOUT	0x1000
+
+/*
+ * EC access port for SCI communication
+ */
+#define	EC_CMD_PORT		0x66
+#define	EC_STS_PORT		0x66
+#define	EC_DAT_PORT		0x62
+#define	CMD_INIT_IDLE_MODE	0xdd
+#define	CMD_EXIT_IDLE_MODE	0xdf
+#define	CMD_INIT_RESET_MODE	0xd8
+#define	CMD_REBOOT_SYSTEM	0x8c
+#define	CMD_GET_EVENT_NUM	0x84
+#define	CMD_PROGRAM_PIECE	0xda
+
+/* Temperature & Fan registers */
+#define	REG_TEMPERATURE_VALUE	0xF458
+#define	REG_FAN_AUTO_MAN_SWITCH 0xF459
+#define	BIT_FAN_AUTO		0
+#define	BIT_FAN_MANUAL		1
+#define	REG_FAN_CONTROL		0xF4D2
+#define	BIT_FAN_CONTROL_ON	(1 << 0)
+#define	BIT_FAN_CONTROL_OFF	(0 << 0)
+#define	REG_FAN_STATUS		0xF4DA
+#define	BIT_FAN_STATUS_ON	(1 << 0)
+#define	BIT_FAN_STATUS_OFF	(0 << 0)
+#define	REG_FAN_SPEED_HIGH	0xFE22
+#define	REG_FAN_SPEED_LOW	0xFE23
+#define	REG_FAN_SPEED_LEVEL	0xF4CC
+/* Fan speed divider */
+#define	FAN_SPEED_DIVIDER	480000	/* (60*1000*1000/62.5/2)*/
+
+/* Battery registers */
+#define	REG_BAT_DESIGN_CAP_HIGH		0xF77D
+#define	REG_BAT_DESIGN_CAP_LOW		0xF77E
+#define	REG_BAT_FULLCHG_CAP_HIGH	0xF780
+#define	REG_BAT_FULLCHG_CAP_LOW		0xF781
+#define	REG_BAT_DESIGN_VOL_HIGH		0xF782
+#define	REG_BAT_DESIGN_VOL_LOW		0xF783
+#define	REG_BAT_CURRENT_HIGH		0xF784
+#define	REG_BAT_CURRENT_LOW		0xF785
+#define	REG_BAT_VOLTAGE_HIGH		0xF786
+#define	REG_BAT_VOLTAGE_LOW		0xF787
+#define	REG_BAT_TEMPERATURE_HIGH	0xF788
+#define	REG_BAT_TEMPERATURE_LOW		0xF789
+#define	REG_BAT_RELATIVE_CAP_HIGH	0xF492
+#define	REG_BAT_RELATIVE_CAP_LOW	0xF493
+#define	REG_BAT_VENDOR			0xF4C4
+#define	FLAG_BAT_VENDOR_SANYO		0x01
+#define	FLAG_BAT_VENDOR_SIMPLO		0x02
+#define	REG_BAT_CELL_COUNT		0xF4C6
+#define	FLAG_BAT_CELL_3S1P		0x03
+#define	FLAG_BAT_CELL_3S2P		0x06
+#define	REG_BAT_CHARGE			0xF4A2
+#define	FLAG_BAT_CHARGE_DISCHARGE	0x01
+#define	FLAG_BAT_CHARGE_CHARGE		0x02
+#define	FLAG_BAT_CHARGE_ACPOWER		0x00
+#define	REG_BAT_STATUS			0xF4B0
+#define	BIT_BAT_STATUS_LOW		(1 << 5)
+#define	BIT_BAT_STATUS_DESTROY		(1 << 2)
+#define	BIT_BAT_STATUS_FULL		(1 << 1)
+#define	BIT_BAT_STATUS_IN		(1 << 0)
+#define	REG_BAT_CHARGE_STATUS		0xF4B1
+#define	BIT_BAT_CHARGE_STATUS_OVERTEMP	(1 << 2)
+#define	BIT_BAT_CHARGE_STATUS_PRECHG	(1 << 1)
+#define	REG_BAT_STATE			0xF482
+#define	BIT_BAT_STATE_CHARGING		(1 << 1)
+#define	BIT_BAT_STATE_DISCHARGING	(1 << 0)
+#define	REG_BAT_POWER			0xF440
+#define	BIT_BAT_POWER_S3		(1 << 2)
+#define	BIT_BAT_POWER_ON		(1 << 1)
+#define	BIT_BAT_POWER_ACIN		(1 << 0)
+
+/* Audio: rd/wr */
+#define	REG_AUDIO_VOLUME	0xF46C
+#define	REG_AUDIO_MUTE		0xF4E7
+#define	REG_AUDIO_BEEP		0xF4D0
+/* USB port power or not: rd/wr */
+#define	REG_USB0_FLAG		0xF461
+#define	REG_USB1_FLAG		0xF462
+#define	REG_USB2_FLAG		0xF463
+#define	BIT_USB_FLAG_ON		1
+#define	BIT_USB_FLAG_OFF	0
+/* LID */
+#define	REG_LID_DETECT		0xF4BD
+#define	BIT_LID_DETECT_ON	1
+#define	BIT_LID_DETECT_OFF	0
+/* CRT */
+#define	REG_CRT_DETECT		0xF4AD
+#define	BIT_CRT_DETECT_PLUG	1
+#define	BIT_CRT_DETECT_UNPLUG	0
+/* LCD backlight brightness adjust: 9 levels */
+#define	REG_DISPLAY_BRIGHTNESS	0xF4F5
+/* Black screen Status */
+#define	BIT_DISPLAY_LCD_ON	1
+#define	BIT_DISPLAY_LCD_OFF	0
+/* LCD backlight control: off/restore */
+#define	REG_BACKLIGHT_CTRL	0xF7BD
+#define	BIT_BACKLIGHT_ON	1
+#define	BIT_BACKLIGHT_OFF	0
+/* Reset the machine auto-clear: rd/wr */
+#define	REG_RESET		0xF4EC
+#define	BIT_RESET_ON		1
+/* Light the led: rd/wr */
+#define	REG_LED			0xF4C8
+#define	BIT_LED_RED_POWER	(1 << 0)
+#define	BIT_LED_ORANGE_POWER	(1 << 1)
+#define	BIT_LED_GREEN_CHARGE	(1 << 2)
+#define	BIT_LED_RED_CHARGE	(1 << 3)
+#define	BIT_LED_NUMLOCK		(1 << 4)
+/* Test led mode, all led on/off */
+#define	REG_LED_TEST		0xF4C2
+#define	BIT_LED_TEST_IN		1
+#define	BIT_LED_TEST_OUT	0
+/* Camera on/off */
+#define	REG_CAMERA_STATUS	0xF46A
+#define	BIT_CAMERA_STATUS_ON	1
+#define	BIT_CAMERA_STATUS_OFF	0
+#define	REG_CAMERA_CONTROL	0xF7B7
+#define	BIT_CAMERA_CONTROL_OFF	0
+#define	BIT_CAMERA_CONTROL_ON	1
+/* Wlan Status */
+#define	REG_WLAN		0xF4FA
+#define	BIT_WLAN_ON		1
+#define	BIT_WLAN_OFF		0
+#define	REG_DISPLAY_LCD		0xF79F
+
+/* SCI Event Number from EC */
+enum {
+	EVENT_LID = 0x23,	/*  Turn on/off LID */
+	EVENT_DISPLAY_TOGGLE,	/*  Fn+F3 for display switch */
+	EVENT_SLEEP,		/*  Fn+F1 for entering sleep mode */
+	EVENT_OVERTEMP,		/*  Over-temperature happened */
+	EVENT_CRT_DETECT,	/*  CRT is connected */
+	EVENT_CAMERA,		/*  Camera on/off */
+	EVENT_USB_OC2,		/*  USB2 Over Current occurred */
+	EVENT_USB_OC0,		/*  USB0 Over Current occurred */
+	EVENT_BLACK_SCREEN,	/*  Turn on/off backlight */
+	EVENT_AUDIO_MUTE,	/*  Mute on/off */
+	EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
+	EVENT_AC_BAT,		/*  AC & Battery relative issue */
+	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
+	EVENT_WLAN,		/*  Wlan on/off */
+	EVENT_END
+};
+
+#endif /* !_EC_KB3310B_H */
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:09:06 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:09:10 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:39152 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492281AbZLALJG (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:09:06 +0100
Received: by pzk35 with SMTP id 35so3579171pzk.22
        for <multiple recipients>; Tue, 01 Dec 2009 03:08:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=gI0BYRPfzPFqYctNhNUzu32Oj0NlToiWj47GrCzZ5oI=;
        b=ipV4OPjC+skGGBnE1fCE72ExxqpVgOKlUJVtvsm/c/A01zuB6kev7DCHXBehxfGmkf
         1xw3nvTjqI1OXHBtDksHAezfqSZJ9p4UTef5DcplQpTi3STK83H14yuxbYfRSbw4Cfln
         xpZns7XtvqyDnEyuONmr+a/Lh2f29UAur0wGg=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=CYSqJ1p9YFbClRWSNZJNBujIDeZ+NejLnw52P8+OSt8j/We6ma5SQiWTUfWixNN8BI
         GohapV98bR/rn1XJvxp4UHwHJUpDOGUZzhe1pJxKZR+DIpaZgthO1lqNS+g2yfBb3uFP
         B9nxXIcXXdEOSTMz4C2aOJzsp6x6Vsz8HKBcQ=
Received: by 10.114.252.2 with SMTP id z2mr10559799wah.156.1259665738032;
        Tue, 01 Dec 2009 03:08:58 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm478598pxi.1.2009.12.01.03.08.54
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:08:57 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Richard Purdie <rpurdie@rpsys.net>,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 3/8] Loongson: YeeLoong: add backlight driver
Date:   Tue,  1 Dec 2009 19:08:42 +0800
Message-Id: <4328ee6b15dce3cb600dddf4e7151532ddc77f17.1259664573.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1259664573.git.wuzhangjin@gmail.com>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25226
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds YeeLoong Backlight Driver, which provides standard
interface for user-space applications to control the brightness of the
backlight.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |    9 ++-
 .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    2 +
 .../lemote-2f/yeeloong_laptop/ec_kb3310b.h         |    1 +
 .../lemote-2f/yeeloong_laptop/yl_backlight.c       |   93 ++++++++++++++++++++
 4 files changed, 104 insertions(+), 1 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_backlight.c

diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
index d6df9b7..02d36d8 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
@@ -10,6 +10,13 @@ menuconfig LEMOTE_YEELOONG2F
 
 if LEMOTE_YEELOONG2F
 
-
+config YEELOONG_BACKLIGHT
+	tristate "Backlight Driver"
+	select BACKLIGHT_CLASS_DEVICE
+	default y
+	help
+	  This option adds YeeLoong Backlight Driver, which provides standard
+	  interface for user-space applications to control the brightness of
+	  the backlight.
 
 endif
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
index 90c4ce5..6c3d3dc 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
@@ -1,3 +1,5 @@
 # YeeLoong Specific
 
 obj-y += ec_kb3310b.o
+
+obj-$(CONFIG_YEELOONG_BACKLIGHT) += yl_backlight.o
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
index 762d888..0e3b5ad 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
@@ -23,6 +23,7 @@ typedef int (*sci_handler) (int status);
 extern sci_handler yeeloong_report_lid_status;
 
 #define SCI_IRQ_NUM 0x0A
+#define MAX_BRIGHTNESS 8
 
 /*
  * The following registers are determined by the EC index configuration.
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_backlight.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_backlight.c
new file mode 100644
index 0000000..481d2ca
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_backlight.c
@@ -0,0 +1,93 @@
+/*
+ * YeeLoong Backlight Driver
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+#include <linux/backlight.h>
+#include <linux/err.h>
+#include <linux/fb.h>
+
+#include <asm/bootinfo.h>
+
+#include "ec_kb3310b.h"
+
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop backlight driver");
+MODULE_LICENSE("GPL");
+
+static int yeeloong_set_brightness(struct backlight_device *bd)
+{
+	unsigned int level, current_level;
+	static unsigned int old_level;
+
+	level = (bd->props.fb_blank == FB_BLANK_UNBLANK &&
+		 bd->props.power == FB_BLANK_UNBLANK) ?
+	    bd->props.brightness : 0;
+
+	if (level > MAX_BRIGHTNESS)
+		level = MAX_BRIGHTNESS;
+	else if (level < 0)
+		level = 0;
+
+	/* Avoid to modify the brightness when EC is tuning it */
+	current_level = ec_read(REG_DISPLAY_BRIGHTNESS);
+	if ((old_level == current_level) && (old_level != level))
+		ec_write(REG_DISPLAY_BRIGHTNESS, level);
+	old_level = level;
+
+	return 0;
+}
+
+static int yeeloong_get_brightness(struct backlight_device *bd)
+{
+	return (int)ec_read(REG_DISPLAY_BRIGHTNESS);
+}
+
+static struct backlight_ops backlight_ops = {
+	.get_brightness = yeeloong_get_brightness,
+	.update_status = yeeloong_set_brightness,
+};
+
+static struct backlight_device *yeeloong_backlight_dev;
+
+static int __init yeeloong_backlight_init(void)
+{
+	int ret;
+
+	if (mips_machtype != MACH_LEMOTE_YL2F89) {
+		pr_err("This Driver is only for YeeLoong laptop\n");
+		return -EFAULT;
+	}
+
+	yeeloong_backlight_dev = backlight_device_register("backlight0", NULL,
+			NULL, &backlight_ops);
+
+	if (IS_ERR(yeeloong_backlight_dev)) {
+		ret = PTR_ERR(yeeloong_backlight_dev);
+		yeeloong_backlight_dev = NULL;
+		return ret;
+	}
+
+	yeeloong_backlight_dev->props.max_brightness = MAX_BRIGHTNESS;
+	yeeloong_backlight_dev->props.brightness =
+		yeeloong_get_brightness(yeeloong_backlight_dev);
+	backlight_update_status(yeeloong_backlight_dev);
+
+	return 0;
+}
+
+static void __exit yeeloong_backlight_exit(void)
+{
+	if (yeeloong_backlight_dev) {
+		backlight_device_unregister(yeeloong_backlight_dev);
+		yeeloong_backlight_dev = NULL;
+	}
+}
+
+module_init(yeeloong_backlight_init);
+module_exit(yeeloong_backlight_exit);
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:09:44 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:09:47 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:52374 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492288AbZLALJo (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:09:44 +0100
Received: by pwi15 with SMTP id 15so2583234pwi.24
        for <multiple recipients>; Tue, 01 Dec 2009 03:09:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=ByK8nyh0phks6Og6iMumiJyZ7TQGZbpyr9HDGlbaDqw=;
        b=oJ5l2UuOlHJJRljuiyQsd+yU1qKVV++rczQlPx53K/Z+5BHrqpkAZ9rXfxyGU5DOJA
         zj6EPGn7sO0QZWjkDKTMm98HoX7bIzx1QXDb/meUDCMwuZ4Zvdr+60kwKhSJ6y+QYysA
         y86cig/OT+M8MuiIZIiHabs2VHstq/dXPG+/s=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=wviGJwG5zKNXx2a3eSUU10Uap2t446ZxuFUnotMqeBQqW+OcSve+mcdxevyGuohMN9
         TIJgPwh2PwO7hyhhTphyQP1PA5Z6yA/wqDOVLQ2mqNB5JFTvDpUqR/OVjgNSYtYTPhz3
         pmKDcIbp0NOdbaDfSr+celxCLHxZOmAmSPf6g=
Received: by 10.115.100.20 with SMTP id c20mr10575628wam.160.1259665776194;
        Tue, 01 Dec 2009 03:09:36 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm3605579pzk.6.2009.12.01.03.09.32
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:09:35 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Stephen Rothwell <sfr@linuxcare.com>,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 4/8] Loongson: YeeLoong: add battery driver
Date:   Tue,  1 Dec 2009 19:09:19 +0800
Message-Id: <6a81bc182b684f94ebcffc562ee98fa7db759826.1259664573.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1259664573.git.wuzhangjin@gmail.com>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25227
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds APM_EMULATION based Battery Driver, which provides
standard interface for user-space applications to manage the battery.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |    9 ++
 .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    1 +
 .../lemote-2f/yeeloong_laptop/yl_battery.c         |  127 ++++++++++++++++++++
 3 files changed, 137 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_battery.c

diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
index 02d36d8..2401ed6 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
@@ -1,6 +1,7 @@
 menuconfig LEMOTE_YEELOONG2F
 	bool "Lemote YeeLoong Laptop"
 	depends on LEMOTE_MACH2F
+	select SYS_SUPPORTS_APM_EMULATION
 	default y
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
@@ -19,4 +20,12 @@ config YEELOONG_BACKLIGHT
 	  interface for user-space applications to control the brightness of
 	  the backlight.
 
+config YEELOONG_BATTERY
+	tristate "Battery Driver"
+	depends on APM_EMULATION
+	default y
+	help
+	  This option adds APM emulated Battery Driver, which provides standard
+	  interface for user-space applications to manage the battery.
+
 endif
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
index 6c3d3dc..31e2145 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
@@ -3,3 +3,4 @@
 obj-y += ec_kb3310b.o
 
 obj-$(CONFIG_YEELOONG_BACKLIGHT) += yl_backlight.o
+obj-$(CONFIG_YEELOONG_BATTERY) += yl_battery.o
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_battery.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_battery.c
new file mode 100644
index 0000000..2a94292
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_battery.c
@@ -0,0 +1,127 @@
+/*
+ * YeeLoong Battery Driver: APM emulated support
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Liu Junliang <liujl@lemote.com>
+ *          Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/apm-emulation.h>
+#include <linux/err.h>
+#include <linux/module.h>
+
+#include <asm/bootinfo.h>
+
+#include "ec_kb3310b.h"
+
+MODULE_AUTHOR("Liu Junliang <liujl@lemote.com>; Wu Zhangjin <wuzj@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop battery driver");
+MODULE_LICENSE("GPL");
+
+static void get_fixed_battery_info(void)
+{
+	int design_cap, full_charged_cap, design_vol, vendor, cell_count;
+
+	design_cap = (ec_read(REG_BAT_DESIGN_CAP_HIGH) << 8)
+	    | ec_read(REG_BAT_DESIGN_CAP_LOW);
+	full_charged_cap = (ec_read(REG_BAT_FULLCHG_CAP_HIGH) << 8)
+	    | ec_read(REG_BAT_FULLCHG_CAP_LOW);
+	design_vol = (ec_read(REG_BAT_DESIGN_VOL_HIGH) << 8)
+	    | ec_read(REG_BAT_DESIGN_VOL_LOW);
+	vendor = ec_read(REG_BAT_VENDOR);
+	cell_count = ec_read(REG_BAT_CELL_COUNT);
+
+	if (vendor != 0) {
+		pr_info("battery vendor(%s), cells count(%d), "
+		       "with designed capacity(%d),designed voltage(%d),"
+		       " full charged capacity(%d)\n",
+		       (vendor ==
+			FLAG_BAT_VENDOR_SANYO) ? "SANYO" : "SIMPLO",
+		       (cell_count == FLAG_BAT_CELL_3S1P) ? 3 : 6,
+		       design_cap, design_vol,
+		       full_charged_cap);
+	}
+}
+
+#define APM_CRITICAL		5
+
+static void get_power_status(struct apm_power_info *info)
+{
+	unsigned char bat_status;
+
+	info->battery_status = APM_BATTERY_STATUS_UNKNOWN;
+	info->battery_flag = APM_BATTERY_FLAG_UNKNOWN;
+	info->units = APM_UNITS_MINS;
+
+	info->battery_life = (ec_read(REG_BAT_RELATIVE_CAP_HIGH) << 8) |
+		(ec_read(REG_BAT_RELATIVE_CAP_LOW));
+
+	info->ac_line_status = (ec_read(REG_BAT_POWER) & BIT_BAT_POWER_ACIN) ?
+		APM_AC_ONLINE : APM_AC_OFFLINE;
+
+	bat_status = ec_read(REG_BAT_STATUS);
+
+	if (!(bat_status & BIT_BAT_STATUS_IN)) {
+		/* no battery inserted */
+		info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT;
+		info->battery_flag = APM_BATTERY_FLAG_NOT_PRESENT;
+		info->time = 0x00;
+		return;
+	}
+
+	/* adapter inserted */
+	if (info->ac_line_status == APM_AC_ONLINE) {
+		if (!(bat_status & BIT_BAT_STATUS_FULL)) {
+			/* battery is not fully charged */
+			info->battery_status = APM_BATTERY_STATUS_CHARGING;
+			info->battery_flag = APM_BATTERY_FLAG_CHARGING;
+		} else {
+			/* battery is fully charged */
+			info->battery_status = APM_BATTERY_STATUS_HIGH;
+			info->battery_flag = APM_BATTERY_FLAG_HIGH;
+			info->battery_life = 100;
+		}
+	} else {
+		/* battery is too low */
+		if (bat_status & BIT_BAT_STATUS_LOW) {
+			info->battery_status = APM_BATTERY_STATUS_LOW;
+			info->battery_flag = APM_BATTERY_FLAG_LOW;
+			if (info->battery_life <= APM_CRITICAL) {
+				/* we should power off the system now */
+				info->battery_status =
+					APM_BATTERY_STATUS_CRITICAL;
+				info->battery_flag = APM_BATTERY_FLAG_CRITICAL;
+			}
+		} else {
+			/* assume the battery is high enough. */
+			info->battery_status = APM_BATTERY_STATUS_HIGH;
+			info->battery_flag = APM_BATTERY_FLAG_HIGH;
+		}
+	}
+	info->time = ((info->battery_life - 3) * 54 + 142) / 60;
+}
+
+static int __init yeeloong_battery_init(void)
+{
+	if (mips_machtype != MACH_LEMOTE_YL2F89) {
+		pr_err("This Driver is only for YeeLoong laptop\n");
+		return -EFAULT;
+	}
+
+	get_fixed_battery_info();
+
+	apm_get_power_status = get_power_status;
+
+	return 0;
+}
+
+static void __exit yeeloong_battery_exit(void)
+{
+}
+
+module_init(yeeloong_battery_init);
+module_exit(yeeloong_battery_exit);
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:10:25 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:10:28 +0100 (CET)
Received: from mail-px0-f188.google.com ([209.85.216.188]:45951 "EHLO
        mail-px0-f188.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491817AbZLALKY (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:10:24 +0100
Received: by pxi26 with SMTP id 26so3680336pxi.21
        for <multiple recipients>; Tue, 01 Dec 2009 03:10:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=ZPndBdJtMvn0wyv61oW7jM/U1tTmJswDKkCksy8Ea7I=;
        b=m1SkiqOlBCXSPzzp1jqbt/jh+sR4wTRf2ayHGZT62cMPQfN65YEJEKhuM3Ibp79t8s
         S4spTNab3UgbVKUsTyB/U4xIv0PziL2mR/MAO4/7T9Mm3TeAWm3CP3f3aFBEQwj1vJja
         XpoKR/EPk5s9RNxVsBqSmVIoSBN2KCBjVCGKk=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=cB65Q1PqW3intHf+NSFRxZ9YEIhsvhkSiSLrMHgJ1qu/wRmqjESoWnzoQTaSUjNN3v
         ze/h/eE5xfSTUwIFJilB8O2Ix9c6RKA9OW+/SLd7UOH1riHqpb59UmOYk+p7vTkm4vku
         mC3IsRXfnGvqTFYe+/u1GHkVHEmweLKTwABaA=
Received: by 10.114.49.6 with SMTP id w6mr10580166waw.148.1259665817218;
        Tue, 01 Dec 2009 03:10:17 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm488751pxi.13.2009.12.01.03.10.11
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:10:16 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        lm-sensors@lm-sensors.org, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 5/8] Loongson: YeeLoong: add hwmon driver
Date:   Tue,  1 Dec 2009 19:09:59 +0800
Message-Id: <3973cc1fdb6ff2b2e540ed93ae92dac8d7b2a38f.1259664573.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1259664573.git.wuzhangjin@gmail.com>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25228
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds hwmon driver for managing the temperature of battery,
cpu and controlling the fan.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |    9 +
 .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    1 +
 .../loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c  |  239 ++++++++++++++++++++
 3 files changed, 249 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c

diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
index 2401ed6..d13e1ab 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
@@ -28,4 +28,13 @@ config YEELOONG_BATTERY
 	  This option adds APM emulated Battery Driver, which provides standard
 	  interface for user-space applications to manage the battery.
 
+config YEELOONG_HWMON
+	tristate "Hardware Monitor Driver"
+	select HWMON
+	default y
+	help
+	  This option adds hardware monitor driver, which provides standard
+	  interface for lm-sensors to monitor the temperatures of CPU and
+	  battery, the PWM of fan, the current, voltage of battery.
+
 endif
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
index 31e2145..b38fb2a 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
@@ -4,3 +4,4 @@ obj-y += ec_kb3310b.o
 
 obj-$(CONFIG_YEELOONG_BACKLIGHT) += yl_backlight.o
 obj-$(CONFIG_YEELOONG_BATTERY) += yl_battery.o
+obj-$(CONFIG_YEELOONG_HWMON) += yl_hwmon.o
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c
new file mode 100644
index 0000000..ed8b705
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c
@@ -0,0 +1,239 @@
+/*
+ * YeeLoong Hwmon Driver
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+#include <linux/err.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+
+#include <asm/bootinfo.h>
+
+#include "ec_kb3310b.h"
+
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop hwmon driver");
+MODULE_LICENSE("GPL");
+
+/* pwm(auto/manual) enable or not */
+static int get_fan_pwm_enable(void)
+{
+	return ec_read(REG_FAN_AUTO_MAN_SWITCH);
+}
+
+static void set_fan_pwm_enable(int manual)
+{
+	ec_write(REG_FAN_AUTO_MAN_SWITCH, !!manual);
+}
+
+static int get_fan_pwm(void)
+{
+	return ec_read(REG_FAN_SPEED_LEVEL);
+}
+
+static void set_fan_pwm(int value)
+{
+	int status;
+
+	value = SENSORS_LIMIT(value, 0, 3);
+
+	/* If value is not ZERO, We should ensure it is on */
+	if (value != 0) {
+		status = ec_read(REG_FAN_STATUS);
+		if (status == 0)
+			ec_write(REG_FAN_CONTROL, BIT_FAN_CONTROL_ON);
+	}
+	ec_write(REG_FAN_SPEED_LEVEL, value);
+}
+
+static int get_fan_rpm(void)
+{
+	int value = 0;
+
+	value = FAN_SPEED_DIVIDER /
+	    (((ec_read(REG_FAN_SPEED_HIGH) & 0x0f) << 8) |
+	     ec_read(REG_FAN_SPEED_LOW));
+
+	return value;
+}
+
+static int get_cpu_temp(void)
+{
+	int value;
+
+	value = ec_read(REG_TEMPERATURE_VALUE);
+
+	if (value & (1 << 7))
+		value = (value & 0x7f) - 128;
+	else
+		value = value & 0xff;
+
+	return value * 1000;
+}
+
+static int get_battery_temp(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_TEMPERATURE_HIGH) << 8) |
+		(ec_read(REG_BAT_TEMPERATURE_LOW));
+
+	return value * 1000;
+}
+
+static int get_battery_temp_alarm(void)
+{
+	int status;
+
+	status = (ec_read(REG_BAT_CHARGE_STATUS) &
+			BIT_BAT_CHARGE_STATUS_OVERTEMP);
+
+	return !!status;
+}
+
+static int get_battery_current(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
+		(ec_read(REG_BAT_CURRENT_LOW));
+
+	if (value & 0x8000)
+		value = 0xffff - value;
+
+	return value;
+}
+
+static int get_battery_voltage(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_VOLTAGE_HIGH) << 8) |
+		(ec_read(REG_BAT_VOLTAGE_LOW));
+
+	return value;
+}
+
+
+static int parse_arg(const char *buf, unsigned long count, int *val)
+{
+	if (!count)
+		return 0;
+	if (sscanf(buf, "%i", val) != 1)
+		return -EINVAL;
+	return count;
+}
+
+static ssize_t store_sys_hwmon(void (*set) (int), const char *buf, size_t count)
+{
+	int rv, value;
+
+	rv = parse_arg(buf, count, &value);
+	if (rv > 0)
+		set(value);
+	return rv;
+}
+
+static ssize_t show_sys_hwmon(int (*get) (void), char *buf)
+{
+	return sprintf(buf, "%d\n", get());
+}
+
+#define CREATE_SENSOR_ATTR(_name, _mode, _set, _get)		\
+	static ssize_t show_##_name(struct device *dev,			\
+				    struct device_attribute *attr,	\
+				    char *buf)				\
+	{								\
+		return show_sys_hwmon(_set, buf);			\
+	}								\
+	static ssize_t store_##_name(struct device *dev,		\
+				     struct device_attribute *attr,	\
+				     const char *buf, size_t count)	\
+	{								\
+		return store_sys_hwmon(_get, buf, count);		\
+	}								\
+	static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0);
+
+CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, get_fan_rpm, NULL);
+CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, get_fan_pwm, set_fan_pwm);
+CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, get_fan_pwm_enable,
+		set_fan_pwm_enable);
+CREATE_SENSOR_ATTR(temp1_input, S_IRUGO, get_cpu_temp, NULL);
+CREATE_SENSOR_ATTR(temp2_input, S_IRUGO, get_battery_temp, NULL);
+CREATE_SENSOR_ATTR(temp2_max_alarm, S_IRUGO, get_battery_temp_alarm, NULL);
+CREATE_SENSOR_ATTR(curr1_input, S_IRUGO, get_battery_current, NULL);
+CREATE_SENSOR_ATTR(in1_input, S_IRUGO, get_battery_voltage, NULL);
+
+static ssize_t
+show_name(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "yeeloong\n");
+}
+
+static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
+
+static struct attribute *hwmon_attributes[] = {
+	&sensor_dev_attr_pwm1.dev_attr.attr,
+	&sensor_dev_attr_pwm1_enable.dev_attr.attr,
+	&sensor_dev_attr_fan1_input.dev_attr.attr,
+	&sensor_dev_attr_temp1_input.dev_attr.attr,
+	&sensor_dev_attr_temp2_input.dev_attr.attr,
+	&sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
+	&sensor_dev_attr_curr1_input.dev_attr.attr,
+	&sensor_dev_attr_in1_input.dev_attr.attr,
+	&sensor_dev_attr_name.dev_attr.attr,
+	NULL
+};
+
+static struct attribute_group hwmon_attribute_group = {
+	.attrs = hwmon_attributes
+};
+
+struct device *yeeloong_hwmon_dev;
+
+static int __init yeeloong_hwmon_init(void)
+{
+	int ret;
+
+	if (mips_machtype != MACH_LEMOTE_YL2F89) {
+		pr_err("This Driver is only for YeeLoong laptop\n");
+		return -EFAULT;
+	}
+
+	yeeloong_hwmon_dev = hwmon_device_register(NULL);
+	if (IS_ERR(yeeloong_hwmon_dev)) {
+		pr_err("Fail to register yeeloong hwmon device\n");
+		yeeloong_hwmon_dev = NULL;
+		return PTR_ERR(yeeloong_hwmon_dev);
+	}
+	ret = sysfs_create_group(&yeeloong_hwmon_dev->kobj,
+				 &hwmon_attribute_group);
+	if (ret) {
+		sysfs_remove_group(&yeeloong_hwmon_dev->kobj,
+				   &hwmon_attribute_group);
+		hwmon_device_unregister(yeeloong_hwmon_dev);
+		yeeloong_hwmon_dev = NULL;
+	}
+	/* ensure fan is set to auto mode */
+	set_fan_pwm_enable(BIT_FAN_AUTO);
+
+	return 0;
+}
+
+static void __exit yeeloong_hwmon_exit(void)
+{
+	if (yeeloong_hwmon_dev) {
+		sysfs_remove_group(&yeeloong_hwmon_dev->kobj,
+				   &hwmon_attribute_group);
+		hwmon_device_unregister(yeeloong_hwmon_dev);
+		yeeloong_hwmon_dev = NULL;
+	}
+}
+
+module_init(yeeloong_hwmon_init);
+module_exit(yeeloong_hwmon_exit);
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:11:03 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:11:06 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:60881 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491817AbZLALLD (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:11:03 +0100
Received: by pwi15 with SMTP id 15so2583971pwi.24
        for <multiple recipients>; Tue, 01 Dec 2009 03:10:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=QOrgfpkj+uau3pjdWgZsPX8WvOPoz1E05WimBvtYCbY=;
        b=A9kCizc/ciP0eJblihTCs4LN0dSvwMNTYoAHfV0Syabbtr9EYNIbLSw1lZxZT5BAcR
         /xAphCODekwFbFgWnBxoSgHwVKdcDh+UXThf8/QHv4TYefuNyr1+8DLZbQ3MXfdibmix
         oQtPUyjV8qVy3pgbODcPdtihkRnkwHVULD39Y=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=WtN8K7tUS/pSfyfGBr0zwM38q5t2S8pkXnmDsycw53sXs3jxwIB0iFFda4HIkOEDBI
         M7+Pa/yhyP8Kr1DmmooKearJ/3EAXuzeBWGO4ghMBvsjSn4aKA8ON/MfqMKYRIF/XI7l
         ZLP4FXMsA0EpEQJ8mdMEW5pLy1F6iNqR8Yx4s=
Received: by 10.114.214.18 with SMTP id m18mr10578932wag.133.1259665855377;
        Tue, 01 Dec 2009 03:10:55 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm1604pzk.1.2009.12.01.03.10.49
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:10:54 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com, luming.yu@intel.com,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 6/8] Loongson: YeeLoong: add video output driver
Date:   Tue,  1 Dec 2009 19:10:38 +0800
Message-Id: <6447f36c749f513c3717c3bffdf21cbd8f416312.1259664573.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1259664573.git.wuzhangjin@gmail.com>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25229
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Video Output Driver, which provides standard interface
to turn on/off the video output of LCD, CRT.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |    8 +
 .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    1 +
 .../lemote-2f/yeeloong_laptop/ec_kb3310b.h         |    3 +
 .../loongson/lemote-2f/yeeloong_laptop/yl_vo.c     |  168 ++++++++++++++++++++
 4 files changed, 180 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_vo.c

diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
index d13e1ab..7cf6071 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
@@ -37,4 +37,12 @@ config YEELOONG_HWMON
 	  interface for lm-sensors to monitor the temperatures of CPU and
 	  battery, the PWM of fan, the current, voltage of battery.
 
+config YEELOONG_VO
+	tristate "Video Output Driver"
+	select VIDEO_OUTPUT_CONTROL
+	default y
+	help
+	  This option adds Video Output Driver, which provides standard
+	  interface to turn on/off the video output of LCD, CRT.
+
 endif
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
index b38fb2a..aa01140 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
@@ -5,3 +5,4 @@ obj-y += ec_kb3310b.o
 obj-$(CONFIG_YEELOONG_BACKLIGHT) += yl_backlight.o
 obj-$(CONFIG_YEELOONG_BATTERY) += yl_battery.o
 obj-$(CONFIG_YEELOONG_HWMON) += yl_hwmon.o
+obj-$(CONFIG_YEELOONG_VO) += yl_vo.o
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
index 0e3b5ad..9d06ad8 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
@@ -22,6 +22,9 @@ extern int ec_get_event_num(void);
 typedef int (*sci_handler) (int status);
 extern sci_handler yeeloong_report_lid_status;
 
+extern void yeeloong_lcd_vo_set(int status);
+extern void yeeloong_crt_vo_set(int status);
+
 #define SCI_IRQ_NUM 0x0A
 #define MAX_BRIGHTNESS 8
 
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_vo.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_vo.c
new file mode 100644
index 0000000..db19a25
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_vo.c
@@ -0,0 +1,168 @@
+/*
+ * YeeLoong Video Output Driver
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/video_output.h>
+
+#include <asm/bootinfo.h>
+
+#include "ec_kb3310b.h"
+
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop video output driver");
+MODULE_LICENSE("GPL");
+
+static int lcd_video_output_get(struct output_device *od)
+{
+	return ec_read(REG_DISPLAY_LCD);
+}
+
+static int lcd_video_output_set(struct output_device *od)
+{
+	int value;
+	unsigned long status;
+
+	status = !!od->request_state;
+
+	if (status == BIT_DISPLAY_LCD_ON) {
+		/* Turn on LCD */
+		outb(0x31, 0x3c4);
+		value = inb(0x3c5);
+		value = (value & 0xf8) | 0x03;
+		outb(0x31, 0x3c4);
+		outb(value, 0x3c5);
+		/* Turn on backlight */
+		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_ON);
+	} else {
+		/* Turn off backlight */
+		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_OFF);
+		/* Turn off LCD */
+		outb(0x31, 0x3c4);
+		value = inb(0x3c5);
+		value = (value & 0xf8) | 0x02;
+		outb(0x31, 0x3c4);
+		outb(value, 0x3c5);
+	}
+
+	return 0;
+}
+
+static struct output_properties lcd_output_properties = {
+	.set_state = lcd_video_output_set,
+	.get_status = lcd_video_output_get,
+};
+
+static int crt_video_output_get(struct output_device *od)
+{
+	return ec_read(REG_CRT_DETECT);
+}
+
+static int crt_video_output_set(struct output_device *od)
+{
+	int value;
+	unsigned long status;
+
+	status = !!od->request_state;
+
+	if (status == BIT_CRT_DETECT_PLUG) {
+		if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG) {
+			/* Turn on CRT */
+			outb(0x21, 0x3c4);
+			value = inb(0x3c5);
+			value &= ~(1 << 7);
+			outb(0x21, 0x3c4);
+			outb(value, 0x3c5);
+		}
+	} else {
+		/* Turn off CRT */
+		outb(0x21, 0x3c4);
+		value = inb(0x3c5);
+		value |= (1 << 7);
+		outb(0x21, 0x3c4);
+		outb(value, 0x3c5);
+	}
+
+	return 0;
+}
+
+static struct output_properties crt_output_properties = {
+	.set_state = crt_video_output_set,
+	.get_status = crt_video_output_get,
+};
+
+static struct output_device *lcd_output_dev, *crt_output_dev;
+
+void yeeloong_lcd_vo_set(int status)
+{
+	lcd_output_dev->request_state = status;
+	lcd_video_output_set(lcd_output_dev);
+}
+EXPORT_SYMBOL(yeeloong_lcd_vo_set);
+
+void yeeloong_crt_vo_set(int status)
+{
+	crt_output_dev->request_state = status;
+	crt_video_output_set(crt_output_dev);
+}
+EXPORT_SYMBOL(yeeloong_crt_vo_set);
+
+static int __init yeeloong_vo_init(void)
+{
+	int ret;
+
+	if (mips_machtype != MACH_LEMOTE_YL2F89) {
+		pr_err("This Driver is only for YeeLoong laptop\n");
+		return -EFAULT;
+	}
+
+
+	/* Register video output device: lcd, crt */
+	lcd_output_dev = video_output_register("LCD", NULL, NULL,
+			&lcd_output_properties);
+
+	if (IS_ERR(lcd_output_dev)) {
+		ret = PTR_ERR(lcd_output_dev);
+		lcd_output_dev = NULL;
+		return ret;
+	}
+	/* Ensure LCD is on by default */
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+
+	crt_output_dev = video_output_register("CRT", NULL, NULL,
+			&crt_output_properties);
+
+	if (IS_ERR(crt_output_dev)) {
+		ret = PTR_ERR(crt_output_dev);
+		crt_output_dev = NULL;
+		return ret;
+	}
+
+	/* Turn off CRT by default, and will be enabled when the CRT
+	 * connectting event reported by SCI */
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+
+	return 0;
+}
+
+static void __exit yeeloong_vo_exit(void)
+{
+	if (lcd_output_dev) {
+		video_output_unregister(lcd_output_dev);
+		lcd_output_dev = NULL;
+	}
+	if (crt_output_dev) {
+		video_output_unregister(crt_output_dev);
+		crt_output_dev = NULL;
+	}
+}
+
+module_init(yeeloong_vo_init);
+module_exit(yeeloong_vo_exit);
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:12:20 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:12:24 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:64446 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492367AbZLALMU (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:12:20 +0100
Received: by pwi15 with SMTP id 15so2584674pwi.24
        for <multiple recipients>; Tue, 01 Dec 2009 03:12:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=0tXEpxlUCsUiRm4F+/09mJygyMPvpqFXVKCTbLMF6H0=;
        b=eOfbzJvJqqa3mnED6v6BjTl1XKs1uSBBbjBQuE6WNgsgqyfOiG+nidIbHYfbmJaQip
         JfmKH4j3AcACi1nkAMbBgQ46x6Gtrn8IRRxloH8U9rTe1flxzMiFnhTqdZXzo8D1L4SB
         IsAiCPymQw/r8ZIr75fiXwJuc40pqUHQVYuVs=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=uSOAEThCSvnweR2qs6Mq2oEGKKsd+9o7FsjrI0JZcsT7JCmSKUVWvlJTo/Ei7vJleW
         EfSyLu1QP+YJp54W3m3AECX7b/aYYoH5ylgxlKEvss2DqypsOpPxzKMOM+DggL44G59s
         HMxbAzvKaowlM8IZVyzorODQyDiqwAfMcWwg8=
Received: by 10.115.85.16 with SMTP id n16mr10552265wal.123.1259665933585;
        Tue, 01 Dec 2009 03:12:13 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3615751pzk.9.2009.12.01.03.12.09
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:12:13 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        linux-pm@lists.linux-foundation.org,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 7/8] Loongson: YeeLoong: add suspend driver
Date:   Tue,  1 Dec 2009 19:11:55 +0800
Message-Id: <2574dde59f2e54ef9fa80423a7f02ed32eab7ab4.1259664573.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1259664573.git.wuzhangjin@gmail.com>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25230
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Suspend Driver, which will suspend the YeeLoong Platform
specific devices.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |    8 +
 .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    1 +
 .../lemote-2f/yeeloong_laptop/yl_suspend.c         |  135 ++++++++++++++++++++
 3 files changed, 144 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c

diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
index 7cf6071..f1211b4 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
@@ -45,4 +45,12 @@ config YEELOONG_VO
 	  This option adds Video Output Driver, which provides standard
 	  interface to turn on/off the video output of LCD, CRT.
 
+config YEELOONG_SUSPEND
+	tristate "Suspend Driver"
+	depends on YEELOONG_VO && LOONGSON_SUSPEND
+	default y
+	help
+	  This option adds Suspend Driver, which will suspend the YeeLoong
+	  Platform specific devices.
+
 endif
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
index aa01140..29f8050 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_YEELOONG_BACKLIGHT) += yl_backlight.o
 obj-$(CONFIG_YEELOONG_BATTERY) += yl_battery.o
 obj-$(CONFIG_YEELOONG_HWMON) += yl_hwmon.o
 obj-$(CONFIG_YEELOONG_VO) += yl_vo.o
+obj-$(CONFIG_YEELOONG_SUSPEND) += yl_suspend.o
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
new file mode 100644
index 0000000..9f53a69
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
@@ -0,0 +1,135 @@
+/*
+ * YeeLoong Platform Specific Suspend Driver
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+#include <asm/bootinfo.h>
+
+#include "ec_kb3310b.h"
+
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop suspend driver");
+MODULE_LICENSE("GPL");
+
+static struct platform_device *yeeloong_pdev;
+
+static void usb_ports_set(int status)
+{
+	status = !!status;
+
+	ec_write(REG_USB0_FLAG, status);
+	ec_write(REG_USB1_FLAG, status);
+	ec_write(REG_USB2_FLAG, status);
+}
+
+static int yeeloong_suspend(struct platform_device *pdev,
+		pm_message_t state)
+{
+	pr_info("yeeloong specific suspend\n");
+
+	/* Turn off LCD */
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	/* Turn off CRT */
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	/* Poweroff three usb ports */
+	usb_ports_set(BIT_USB_FLAG_OFF);
+
+	return 0;
+}
+
+static int yeeloong_resume(struct platform_device *pdev)
+{
+	pr_info("yeeloong specific resume\n");
+
+	/* Resume the status of lcd & crt */
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+
+	/* Poweron three usb ports */
+	usb_ports_set(BIT_USB_FLAG_ON);
+
+	return 0;
+}
+
+static struct platform_driver platform_driver = {
+	.driver = {
+		   .name = "yeeloong-laptop",
+		   .owner = THIS_MODULE,
+		   },
+	.suspend = yeeloong_suspend,
+	.resume = yeeloong_resume,
+};
+
+static ssize_t yeeloong_pdev_name_show(struct device *dev,
+				       struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "yeeloong laptop\n");
+}
+
+static struct device_attribute dev_attr_yeeloong_pdev_name =
+__ATTR(name, S_IRUGO, yeeloong_pdev_name_show, NULL);
+
+static int __init yeeloong_suspend_init(void)
+{
+	int ret;
+
+	if (mips_machtype != MACH_LEMOTE_YL2F89) {
+		pr_err("This Driver is only for YeeLoong laptop\n");
+		return -EFAULT;
+	}
+
+	/* Register platform stuff */
+	ret = platform_driver_register(&platform_driver);
+	if (ret)
+		return ret;
+
+	yeeloong_pdev = platform_device_alloc("yeeloong-laptop", -1);
+	if (!yeeloong_pdev) {
+		ret = -ENOMEM;
+		platform_driver_unregister(&platform_driver);
+		return ret;
+	}
+
+	ret = platform_device_add(yeeloong_pdev);
+	if (ret) {
+		platform_device_put(yeeloong_pdev);
+		return ret;
+	}
+
+	if (IS_ERR(yeeloong_pdev)) {
+		ret = PTR_ERR(yeeloong_pdev);
+		yeeloong_pdev = NULL;
+		pr_err("Fail to register platform device\n");
+		return ret;
+	}
+
+	ret = device_create_file(&yeeloong_pdev->dev,
+				 &dev_attr_yeeloong_pdev_name);
+	if (ret) {
+		pr_err("Fail to create sysfs device attributes\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static void __exit yeeloong_suspend_exit(void)
+{
+	if (yeeloong_pdev) {
+		platform_device_unregister(yeeloong_pdev);
+		yeeloong_pdev = NULL;
+		platform_driver_unregister(&platform_driver);
+	}
+}
+
+module_init(yeeloong_suspend_init);
+module_exit(yeeloong_suspend_exit);
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:13:02 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:13:07 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:34200 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492304AbZLALNC (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:13:02 +0100
Received: by pzk35 with SMTP id 35so3581400pzk.22
        for <multiple recipients>; Tue, 01 Dec 2009 03:12:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=CNygnBg/vNfpIwP6PHdJh7MqN7lDfROzo31qBzOrgOw=;
        b=BeJRRhfiGyXY8K2fP/2ihWSf8Wa3npVGIDQN3zWH0B/4YY7TN/050vn3G3EdnahBlu
         oL+wwVieMLSKugRpWNL2gf94JRk2I35w5gJgmzEZFBuoHJ1OCMZ7UPoVML1t7FvScZJO
         dIDUWUIH/VA4RSzEPiMRcpqwjRek6rwoJBWD4=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=V4FMpFygTkyF2XB/IAS8ee60N4URwM3Wm7b0D6Ep0VNlsh92SPpJUh+BnoNZ1Crg45
         tq+1Ad6cUPnQOco9dRY8BBBa74ukHi3AQcx5t+CXTYh3iB5BC8NBiY76XmuxYI5SIA8T
         1cp0Uhbm2wsGCY3ja16wjvbny5uCnXy0Bt1mc=
Received: by 10.115.112.40 with SMTP id p40mr10437324wam.182.1259665974026;
        Tue, 01 Dec 2009 03:12:54 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm477173pxi.3.2009.12.01.03.12.49
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:12:53 -0800 (PST)
From:   Wu Zhangin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v6 8/8] Loongson: YeeLoong: add hotkey driver
Date:   Tue,  1 Dec 2009 19:12:37 +0800
Message-Id: <939c1425f653e3bda05799345c53198dfd2c1dcc.1259664573.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1259664573.git.wuzhangjin@gmail.com>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25231
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Hotkey Driver, which will do relative actions for The
hotkey event and report the corresponding input keys to the user-space
applications.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/kernel/setup.c                           |    1 +
 .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |    9 +
 .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    1 +
 .../lemote-2f/yeeloong_laptop/ec_kb3310b.h         |    4 +-
 .../loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c |  448 ++++++++++++++++++++
 5 files changed, 462 insertions(+), 1 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index bd55f71..b1e1272 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -60,6 +60,7 @@ struct boot_mem_map boot_mem_map;
 
 static char command_line[COMMAND_LINE_SIZE];
        char arcs_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
+EXPORT_SYMBOL(arcs_cmdline);
 
 /*
  * mips_io_port_base is the begin of the address space to which x86 style
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
index f1211b4..7a8084e 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
@@ -53,4 +53,13 @@ config YEELOONG_SUSPEND
 	  This option adds Suspend Driver, which will suspend the YeeLoong
 	  Platform specific devices.
 
+config YEELOONG_HOTKEY
+	tristate "Hotkey Driver"
+	depends on YEELOONG_VO && INPUT
+	default y
+	help
+	  This option adds Hotkey Driver, which will do relative actions for
+	  The hotkey event and report the corresponding input keys to the
+	  user-space applications.
+
 endif
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
index 29f8050..31bfda6 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_YEELOONG_BATTERY) += yl_battery.o
 obj-$(CONFIG_YEELOONG_HWMON) += yl_hwmon.o
 obj-$(CONFIG_YEELOONG_VO) += yl_vo.o
 obj-$(CONFIG_YEELOONG_SUSPEND) += yl_suspend.o
+obj-$(CONFIG_YEELOONG_HOTKEY) += yl_hotkey.o
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
index 9d06ad8..021ce11 100644
--- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
@@ -185,7 +185,9 @@ enum {
 	EVENT_AC_BAT,		/*  AC & Battery relative issue */
 	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
 	EVENT_WLAN,		/*  Wlan on/off */
-	EVENT_END
 };
 
+#define EVENT_START	EVENT_LID
+#define EVENT_END	EVENT_WLAN
+
 #endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c
new file mode 100644
index 0000000..7a178b9
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c
@@ -0,0 +1,448 @@
+/*
+ * YeeLoong Hotkey Driver
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *          Liu Junliang <liujl@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+
+#include <asm/bootinfo.h>	/* for arcs_cmdline */
+
+#include <cs5536/cs5536.h>
+#include "ec_kb3310b.h"
+
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>; Liu Junliang <liujl@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop hotkey driver");
+MODULE_LICENSE("GPL");
+
+static struct input_dev *yeeloong_hotkey_dev;
+static int event, status;
+
+struct key_entry {
+	char type;		/* See KE_* below */
+	int event;		/* event from SCI */
+	u16 keycode;		/* KEY_* or SW_* */
+};
+
+enum { KE_KEY, KE_SW, KE_END };
+
+#define EVENT_UNKNOWN	0
+
+static struct key_entry yeeloong_keymap[] = {
+	{KE_SW, EVENT_LID, SW_LID},
+	{KE_KEY, EVENT_CAMERA, KEY_CAMERA},	/* Fn + ESC */
+	{KE_KEY, EVENT_SLEEP, KEY_SLEEP},	/* Fn + F1 */
+	{KE_KEY, EVENT_DISPLAY_TOGGLE, KEY_SWITCHVIDEOMODE},	/* Fn + F3 */
+	{KE_KEY, EVENT_AUDIO_MUTE, KEY_MUTE},	/* Fn + F4 */
+	{KE_KEY, EVENT_WLAN, KEY_WLAN},	/* Fn + F5 */
+	{KE_KEY, EVENT_DISPLAY_BRIGHTNESS, KEY_BRIGHTNESSUP},	/* Fn + up */
+	{KE_KEY, EVENT_DISPLAY_BRIGHTNESS, KEY_BRIGHTNESSDOWN},	/* Fn + down */
+	{KE_KEY, EVENT_AUDIO_VOLUME, KEY_VOLUMEUP},	/* Fn + right */
+	{KE_KEY, EVENT_AUDIO_VOLUME, KEY_VOLUMEDOWN},	/* Fn + left */
+	{KE_END, EVENT_UNKNOWN, KEY_UNKNOWN}
+};
+
+static int get_event_keycode(void)
+{
+	struct key_entry *key;
+
+	for (key = yeeloong_keymap; key->type != KE_END; key++) {
+		if (key->event != event)
+			continue;
+		else {
+			if (EVENT_DISPLAY_BRIGHTNESS == event) {
+				static int old_brightness_status = -1;
+				/* current status > old one, means up */
+				if ((status < old_brightness_status)
+				    || (0 == status))
+					key++;
+				old_brightness_status = status;
+			} else if (EVENT_AUDIO_VOLUME == event) {
+				static int old_volume_status = -1;
+				if ((status < old_volume_status)
+				    || (0 == status))
+					key++;
+				old_volume_status = status;
+			}
+			break;
+		}
+	}
+	return key->keycode;
+}
+
+static int report_lid_switch(int status)
+{
+	input_report_switch(yeeloong_hotkey_dev, SW_LID, !status);
+	input_sync(yeeloong_hotkey_dev);
+
+	return status;
+}
+
+void report_key(int keycode)
+{
+	if (keycode == SW_LID)
+		report_lid_switch(status);
+	else {
+		input_report_key(yeeloong_hotkey_dev, keycode, 1);
+		input_sync(yeeloong_hotkey_dev);
+		input_report_key(yeeloong_hotkey_dev, keycode, 0);
+		input_sync(yeeloong_hotkey_dev);
+	}
+}
+
+static int crt_detect_handler(int status)
+{
+	if (status == BIT_CRT_DETECT_PLUG) {
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	} else {
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	}
+	return status;
+}
+
+#define EC_VER_LEN 64
+
+static int black_screen_handler(int status)
+{
+	char *p, ec_ver[EC_VER_LEN];
+
+	p = strstr(arcs_cmdline, "EC_VER=");
+	if (!p)
+		memset(ec_ver, 0, EC_VER_LEN);
+	else {
+		strncpy(ec_ver, p, EC_VER_LEN);
+		p = strstr(ec_ver, " ");
+		if (p)
+			*p = '\0';
+	}
+
+	/* Seems EC(>=PQ1D26) does this job for us, we can not do it again,
+	 * otherwise, the brightness will not resume to the normal level! */
+	if (strncasecmp(ec_ver, "EC_VER=PQ1D26", 64) < 0)
+		yeeloong_lcd_vo_set(status);
+
+	return status;
+}
+
+static int display_toggle_handler(int status)
+{
+	static int video_output_status;
+
+	/* Only enable switch video output button
+	 * when CRT is connected */
+	if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_UNPLUG)
+		return 0;
+	/* 0. no CRT connected: LCD on, CRT off
+	 * 1. BOTH on
+	 * 2. LCD off, CRT on
+	 * 3. BOTH off
+	 * 4. LCD on, CRT off
+	 */
+	video_output_status++;
+	if (video_output_status > 4)
+		video_output_status = 1;
+
+	switch (video_output_status) {
+	case 1:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		break;
+	case 2:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		break;
+	case 3:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+		break;
+	case 4:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+		break;
+	default:
+		/* Ensure LCD is on */
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		break;
+	}
+	return video_output_status;
+}
+
+static int camera_handler(int status)
+{
+	int value;
+
+	value = ec_read(REG_CAMERA_CONTROL);
+	ec_write(REG_CAMERA_CONTROL, value | (1 << 1));
+
+	return status;
+}
+
+static int usb2_handler(int status)
+{
+	pr_emerg("USB2 Over Current occurred\n");
+
+	return status;
+}
+
+static int usb0_handler(int status)
+{
+	pr_emerg("USB0 Over Current occurred\n");
+
+	return status;
+}
+
+/* yeeloong_wifi_handler may be implemented in the wifi driver */
+sci_handler yeeloong_wifi_handler;
+EXPORT_SYMBOL(yeeloong_wifi_handler);
+
+#define NO_REG		0
+#define NO_HANDLER	NULL
+/* 2 maybe used to indicate the key as a switch button, such as EVENT_WLAN */
+#define NO_STATUS	2
+
+static void do_event_action(void)
+{
+	sci_handler handler;
+	int reg, keycode;
+
+	reg = NO_REG;
+	handler = NO_HANDLER;
+	status = NO_STATUS;
+
+	switch (event) {
+	case EVENT_LID:
+		reg = REG_LID_DETECT;
+		break;
+	case EVENT_DISPLAY_TOGGLE:
+		handler = display_toggle_handler;
+		break;
+	case EVENT_CRT_DETECT:
+		reg = REG_CRT_DETECT;
+		handler = crt_detect_handler;
+		break;
+	case EVENT_CAMERA:
+		reg = REG_CAMERA_STATUS;
+		handler = camera_handler;
+		break;
+	case EVENT_USB_OC2:
+		reg = REG_USB2_FLAG;
+		handler = usb2_handler;
+		break;
+	case EVENT_USB_OC0:
+		reg = REG_USB0_FLAG;
+		handler = usb0_handler;
+		break;
+	case EVENT_BLACK_SCREEN:
+		reg = REG_DISPLAY_LCD;
+		handler = black_screen_handler;
+		break;
+	case EVENT_AUDIO_MUTE:
+		reg = REG_AUDIO_MUTE;
+		break;
+	case EVENT_DISPLAY_BRIGHTNESS:
+		reg = REG_DISPLAY_BRIGHTNESS;
+		break;
+	case EVENT_AUDIO_VOLUME:
+		reg = REG_AUDIO_VOLUME;
+		break;
+	case EVENT_WLAN:
+		handler = yeeloong_wifi_handler;
+		break;
+	default:
+		break;
+	}
+
+	if (reg != NO_REG)
+		status = ec_read(reg);
+
+	if (handler != NO_HANDLER)
+		status = handler(status);
+
+	/* Report current key to user-space */
+	keycode = get_event_keycode();
+	if (keycode != KEY_UNKNOWN)
+		report_key(keycode);
+}
+
+/*
+ * SCI(system control interrupt) main interrupt routine
+ *
+ * We will do the query and get event number together so the interrupt routine
+ * should be longer than 120us now at least 3ms elpase for it.
+ */
+static irqreturn_t sci_irq_handler(int irq, void *dev_id)
+{
+	int ret;
+
+	if (SCI_IRQ_NUM != irq)
+		return IRQ_NONE;
+
+	/* Query the event number */
+	ret = ec_query_event_num();
+	if (ret < 0)
+		return IRQ_NONE;
+
+	event = ec_get_event_num();
+	if (event < EVENT_START || event > EVENT_END)
+		return IRQ_NONE;
+
+	/* Execute corresponding actions */
+	do_event_action();
+
+	return IRQ_HANDLED;
+}
+
+/*
+ * Config and init some msr and gpio register properly.
+ */
+static int sci_irq_init(void)
+{
+	u32 hi, lo;
+	u32 gpio_base;
+	unsigned long flags;
+	int ret;
+
+	/* Get gpio base */
+	_rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_GPIO), &hi, &lo);
+	gpio_base = lo & 0xff00;
+
+	/* Filter the former kb3310 interrupt for security */
+	ret = ec_query_event_num();
+	if (ret)
+		return ret;
+
+	/* For filtering next number interrupt */
+	udelay(10000);
+
+	/* Set gpio native registers and msrs for GPIO27 SCI EVENT PIN
+	 * gpio :
+	 *      input, pull-up, no-invert, event-count and value 0,
+	 *      no-filter, no edge mode
+	 *      gpio27 map to Virtual gpio0
+	 * msr :
+	 *      no primary and lpc
+	 *      Unrestricted Z input to IG10 from Virtual gpio 0.
+	 */
+	local_irq_save(flags);
+	_rdmsr(0x80000024, &hi, &lo);
+	lo &= ~(1 << 10);
+	_wrmsr(0x80000024, hi, lo);
+	_rdmsr(0x80000025, &hi, &lo);
+	lo &= ~(1 << 10);
+	_wrmsr(0x80000025, hi, lo);
+	_rdmsr(0x80000023, &hi, &lo);
+	lo |= (0x0a << 0);
+	_wrmsr(0x80000023, hi, lo);
+	local_irq_restore(flags);
+
+	/* Set gpio27 as sci interrupt
+	 *
+	 * input, pull-up, no-fliter, no-negedge, invert
+	 * the sci event is just about 120us
+	 */
+	asm(".set noreorder\n");
+	/*  input enable */
+	outl(0x00000800, (gpio_base | 0xA0));
+	/*  revert the input */
+	outl(0x00000800, (gpio_base | 0xA4));
+	/*  event-int enable */
+	outl(0x00000800, (gpio_base | 0xB8));
+	asm(".set reorder\n");
+
+	return 0;
+}
+
+static struct irqaction sci_irqaction = {
+	.handler = sci_irq_handler,
+	.name = "sci",
+	.flags = IRQF_SHARED,
+};
+
+static int __init yeeloong_hotkey_init(void)
+{
+	int ret;
+	struct key_entry *key;
+
+	if (mips_machtype != MACH_LEMOTE_YL2F89) {
+		pr_err("This Driver is only for YeeLoong laptop\n");
+		return -EFAULT;
+	}
+
+	ret = sci_irq_init();
+	if (ret)
+		return -EFAULT;
+
+	ret = setup_irq(SCI_IRQ_NUM, &sci_irqaction);
+	if (ret)
+		return -EFAULT;
+
+	yeeloong_hotkey_dev = input_allocate_device();
+
+	if (!yeeloong_hotkey_dev) {
+		remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+		return -ENOMEM;
+	}
+
+	yeeloong_hotkey_dev->name = "HotKeys";
+	yeeloong_hotkey_dev->phys = "button/input0";
+	yeeloong_hotkey_dev->id.bustype = BUS_HOST;
+	yeeloong_hotkey_dev->dev.parent = NULL;
+
+	for (key = yeeloong_keymap; key->type != KE_END; key++) {
+		switch (key->type) {
+		case KE_KEY:
+			set_bit(EV_KEY, yeeloong_hotkey_dev->evbit);
+			set_bit(key->keycode, yeeloong_hotkey_dev->keybit);
+			break;
+		case KE_SW:
+			set_bit(EV_SW, yeeloong_hotkey_dev->evbit);
+			set_bit(key->keycode, yeeloong_hotkey_dev->swbit);
+			break;
+		}
+	}
+
+	ret = input_register_device(yeeloong_hotkey_dev);
+	if (ret) {
+		input_free_device(yeeloong_hotkey_dev);
+		return ret;
+	}
+
+	/* Update the current status of LID */
+	report_lid_switch(BIT_LID_DETECT_ON);
+
+#ifdef CONFIG_LOONGSON_SUSPEND
+	/* Install the real yeeloong_report_lid_status for pm.c */
+	yeeloong_report_lid_status = report_lid_switch;
+#endif
+
+	return 0;
+}
+
+static void __exit yeeloong_hotkey_exit(void)
+{
+	/* Free irq */
+	remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+
+#ifdef CONFIG_LOONGSON_SUSPEND
+	/* Uninstall yeeloong_report_lid_status for pm.c */
+	yeeloong_report_lid_status = NULL;
+#endif
+
+	if (yeeloong_hotkey_dev) {
+		input_unregister_device(yeeloong_hotkey_dev);
+		yeeloong_hotkey_dev = NULL;
+	}
+}
+
+module_init(yeeloong_hotkey_init);
+module_exit(yeeloong_hotkey_exit);
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  1 12:17:16 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:17:19 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:39842 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492257AbZLALRQ (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 12:17:16 +0100
Received: by pzk35 with SMTP id 35so3583862pzk.22
        for <multiple recipients>; Tue, 01 Dec 2009 03:17:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=LkCofArmK7dwd2HGTz6gKeJsoTtytXbkQU90l2kII6M=;
        b=Gij/nukzgsAKQUjiM4QOBtxb2Hc4yEFP1+D2YNqPsooLuM6s8gYfKimfS+KnMv63E6
         ORKQ3LKXKb+kDHYfi+x6y7ti8nIBj3uBJdVBIEKtnzuUPXohtwc6+0P+oavl/5yP68wU
         DrlMBIc+xGMT3v/d85HR8XCWgVPVAt1iSPjiU=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=BSugQVKB9AKQwUj31oeO2yqeKXAYjQ+zFpq3rbVGnQir8S95E22ni+ROas36xTWA/G
         dHhZnAF1PFgWfLzk2XUnMn9YbfluyqV1dN0/vgJU1gqnzk4UxYBumPQe+FNUktVUw92h
         TVSTnciKRx7XUDtwvGQCOBXSv4C3+T1tBn/IM=
Received: by 10.114.188.17 with SMTP id l17mr10606869waf.135.1259666229368;
        Tue, 01 Dec 2009 03:17:09 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm4561pzk.3.2009.12.01.03.17.05
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 03:17:08 -0800 (PST)
Subject: Re: [PATCH v6 0/8] Loongson: YeeLoong: add platform specific
 drivers
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        linux-mips@linux-mips.org, zhangfx@lemote.com
In-Reply-To: <cover.1259660040.git.wuzhangjin@gmail.com>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 01 Dec 2009 19:16:46 +0800
Message-ID: <1259666206.7093.4.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25232
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

Sorry, I have sent this stuff 8 times, forgive me ;(

On Tue, 2009-12-01 at 19:06 +0800, Wu Zhangin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patchset adds platform specific drivers for YeeLoong netbook. including
> the backlight, battery, hwmon, video output, suspend and hotkey(input) drivers.
> These drivers provide standard interfaces to the user-space applications to
> manage the relative devices:
> 	
>  	 Modules			Tools
> 
> 	- backlight
> 	  /sys/class/backlight/		kpowersave, gnome-power-manager
> 	- battery
> 	  /proc/apm			kpowersave, gnome-power-manager
> 	- hwmon
> 	  /sys/class/hwmon/		lm-sensors, sensors-applet...
> 	- video output
> 	  /sys/class/video_output	?
> 	- suspend
> 	  /sys/power/state		kpowersave, gnome-power-manager
> 	- hotkey
> 	  /sys/class/input/		gnome-settings-daemon ?
> 
> To utilize the above interfaces, you are recommended to install the latest hal,
> dbus.
> 
> This v6 revision incorporates with the feedbacks from Ralf, Pavel Machek,
> Rafael J. Wysocki and Dmitry Torokhov.
> 
> Changes from the old v5 revision:
> 
> 	- Cleanup the "select" and "depend" of the options
> 	  Replace some "select"s by "depend"s to avoid potential compiling
> 	  errors.
> 
> 	- Cleanup the hotkey(input) driver
> 	  Merge several functions, Cleanup the comments, Use Switch...Case
> 	  instead of the array.
> 
> 	- Fixup of the video output driver  
> 	  Seems the video output subsystem doesn't handle the input value, we
> 	  handle it outselves via !!od->request_state.
> 
> 	- Append the yl_ prefix to the file names
> 	  yl_ prefix is needed to distinguish it with the next patchset for
> 	  lynloong pc platform drivers.
> 
> All changes have been tested again.
> 
> Best Regards,
>      Wu Zhangjin
> 
> Wu Zhangjin (8):
>   Loongson: Lemote-2F: add platform specific submenu
>   Loongson: YeeLoong: add platform specific option
>   Loongson: YeeLoong: add backlight driver
>   Loongson: YeeLoong: add battery driver
>   Loongson: YeeLoong: add hwmon driver
>   Loongson: YeeLoong: add video output driver
>   Loongson: YeeLoong: add suspend driver
>   Loongson: YeeLoong: add hotkey driver
> 
>  arch/mips/kernel/setup.c                           |    1 +
>  arch/mips/loongson/Kconfig                         |   21 +
>  arch/mips/loongson/lemote-2f/Makefile              |    7 +-
>  arch/mips/loongson/lemote-2f/ec_kb3310b.c          |  130 ------
>  arch/mips/loongson/lemote-2f/ec_kb3310b.h          |  188 --------
>  arch/mips/loongson/lemote-2f/pm.c                  |    4 +-
>  arch/mips/loongson/lemote-2f/reset.c               |    2 +-
>  .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |   65 +++
>  .../loongson/lemote-2f/yeeloong_laptop/Makefile    |   10 +
>  .../lemote-2f/yeeloong_laptop/ec_kb3310b.c         |  126 ++++++
>  .../lemote-2f/yeeloong_laptop/ec_kb3310b.h         |  193 +++++++++
>  .../lemote-2f/yeeloong_laptop/yl_backlight.c       |   93 ++++
>  .../lemote-2f/yeeloong_laptop/yl_battery.c         |  127 ++++++
>  .../loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c |  452 ++++++++++++++++++++
>  .../loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c  |  239 +++++++++++
>  .../lemote-2f/yeeloong_laptop/yl_suspend.c         |  135 ++++++
>  .../loongson/lemote-2f/yeeloong_laptop/yl_vo.c     |  164 +++++++
>  17 files changed, 1635 insertions(+), 322 deletions(-)
>  delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.c
>  delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.c
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_backlight.c
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_battery.c
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hotkey.c
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_hwmon.c
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_vo.c
> 



From wuzhangjin@gmail.com Tue Dec  1 06:14:05 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:24:52 +0100 (CET)
Received: from mail-px0-f188.google.com ([209.85.216.188]:57711 "EHLO
        mail-px0-f188.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491890AbZLAFOF (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 06:14:05 +0100
Received: by pxi26 with SMTP id 26so3482064pxi.21
        for <linux-mips@linux-mips.org>; Mon, 30 Nov 2009 21:13:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=biDWTKaGpxE7E8xz9W9tSmQ9Kx04Qa2WjIz6vqWIDXU=;
        b=aUf+/D+VT+cwAmrF16opwrsNBeTxT7YRzo1P/88Yg4zC9PuCxl3wb8bAyFci0QkeQr
         5HFpyb+sgoWfTYd4vSpNEmBfM/qLS8pMUTAL/lx3j4X80oWHWsmfLN0/Hol+1HVmNADM
         8oRDMEaO+HMKpU0zjHqlGQzShTIpfu5z1SAz8=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=qvgG2I5hbXvVrHNpamnm4ZlSt1OhmG5C4gpxJ2mqViUoeoUJjBxeJ/pnqgqWWn1Ggn
         0lG1ehw05/mzQu4N/QVWxHwtwkUYW6sGEtLRRNsFuOA4rzc/EofobfJ3rJrzWoViNRDU
         2ynlB+PP2ShO1LTePvbaWT9wd44TeZN15tVKc=
Received: by 10.115.134.40 with SMTP id l40mr9838187wan.41.1259644437268;
        Mon, 30 Nov 2009 21:13:57 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm306126pxi.12.2009.11.30.21.13.54
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 30 Nov 2009 21:13:56 -0800 (PST)
Subject: Re: hello! can you help me for compiling the linux kernel?
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     jack_lu <jacklu@allplus-cn.com>
Cc:     linux-mips@linux-mips.org
In-Reply-To: <74D96A2497124516897C6F4D06D8B5AB@DELLPC>
References: <74D96A2497124516897C6F4D06D8B5AB@DELLPC>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 01 Dec 2009 13:13:36 +0800
Message-ID: <1259644416.5139.11.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 8bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25233
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-01 at 11:52 +0800, jack_lu wrote:
> Dear Sir,
> 　　hello! can you help me for compiling the linux kernel?
> 　　Linux version is linux-2.6.21.5.
> 　　CPU:mips
> 　　Cross-compilation tools is eldk and openwrt file packages.

Hello,

Which board are you using? and did you try the corresponding defconfig
file under arch/mips/configs/.

Regards,
	Wu zhangjin

> 　　Errors are the followings.
> 　　init/built-in.o: In function `init':
> 　　init/main.c:833: undefined reference to `opipmux_gel_init'
> 　　init/main.c:833: relocation truncated to fit: R_MIPS_26 against `opipmux_gel_init'
> 　　init/main.c:835: undefined reference to `ip_auto_config'
> 　　init/main.c:835: relocation truncated to fit: R_MIPS_26 against `ip_auto_config'
> 　　init/built-in.o: In function `start_kernel':
> 　　init/main.c:525: undefined reference to `setup_prom_printf'
> 　　init/main.c:525: relocation truncated to fit: R_MIPS_26 against `setup_prom_printf'
> 　　init/main.c:527: undefined reference to `prom_printf'
> 　　init/main.c:527: relocation truncated to fit: R_MIPS_26 against `prom_printf'
> 　　init/main.c:530: undefined reference to `prom_printf'
> 　　init/main.c:530: relocation truncated to fit: R_MIPS_26 against `prom_printf'
> 　　arch/mips/kernel/built-in.o: In function `test_setdata':
> 　　arch/mips/kernel/syscall.c:461: undefined reference to `set_ipmux_el_tx_buf_data'
> 　　arch/mips/kernel/syscall.c:461: relocation truncated to fit: R_MIPS_26 against `set_ipmux_el_tx_buf_data'
> 　　arch/mips/kernel/built-in.o: In function `test_getdata':
> 　　arch/mips/kernel/syscall.c:453: undefined reference to `get_ipmux_el_rx_buf_data'
> 　　arch/mips/kernel/syscall.c:453: relocation truncated to fit: R_MIPS_26 against `get_ipmux_el_rx_buf_data'
> 　　arch/mips/kernel/built-in.o: In function `test_waitinterrupt':
> 　　arch/mips/kernel/syscall.c:446: undefined reference to `wait_for_host_test_interrupt'
> 　　arch/mips/kernel/syscall.c:446: relocation truncated to fit: R_MIPS_26 against `wait_for_host_test_interrupt'
> 　　kernel/built-in.o: In function `free_module':
> 　　kernel/module.c:1231: undefined reference to `kfree1'
> 　　kernel/module.c:1231: relocation truncated to fit: R_MIPS_26 against `kfree1'
> 　　drivers/built-in.o: In function `snapshot_map':
> 　　drivers/md/dm-snap.c:900: undefined reference to `__cmpdi2'
> 　　drivers/md/dm-snap.c:900: relocation truncated to fit: R_MIPS_26 against `__cmpdi2'
> 　　make: *** [.tmp_vmlinux1] Error 1
> 　　make: *** No rule to make target `../vmlinux', needed by `piggy.lzma'.  Stop.
> 　　copyed to ../wrt_uImage
> 　　cp: cannot stat `uImageLzma': No such file or directory
> 　　ls: cannot access ../wrt_uImage: No such file or directory
> 　　===============================================================
> 　　    output files:                           
> 　　         wrt_uImage : the kernel image      
> 　　
> 　　
> 　　Thanks &Best Wishes,
> 　　Jack_Lu(鲁红刚)
>    益满颖贸易（上海）有限公司
>    上海市愚园路168号环球大厦A座2101室
>    电话：+86 21 62495328/29/30/31 分机：820
>    传真：+86 21 62490538
>    MSN: luhongang@163.com
> 
> 　　
> 
> 



From jacklu@allplus-cn.com Tue Dec  1 06:30:02 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:25:23 +0100 (CET)
Received: from 60-248-150-25.HINET-IP.hinet.net ([60.248.150.25]:47728 "EHLO
        dns.allplus-cn.com" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org
        with ESMTP id S1492002AbZLAFaB convert rfc822-to-8bit (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 06:30:01 +0100
Received: from DELLPC (unknown [116.231.39.52])
        by dns.allplus-cn.com (Postfix) with ESMTP id C41B42DBB23;
        Tue,  1 Dec 2009 14:28:03 +0800 (CST)
From:   "jack_lu" <jacklu@allplus-cn.com>
To:     <wuzhangjin@gmail.com>
Cc:     <linux-mips@linux-mips.org>
References: <74D96A2497124516897C6F4D06D8B5AB@DELLPC> <1259644416.5139.11.camel@falcon.domain.org>
In-Reply-To: <1259644416.5139.11.camel@falcon.domain.org>
Subject: =?gb2312?B?tPC4tDogaGVsbG8hIGNhbiB5b3UgaGVscCBtZSBmb3IgY29tcGlsaQ==?=
        =?gb2312?B?bmcgdGhlIGxpbnV4IGtlcm5lbD8=?=
Date:   Tue, 1 Dec 2009 13:29:32 +0800
Message-ID: <1A667674F8FA4416BF13CA3E9B322994@DELLPC>
MIME-Version: 1.0
Content-Type: text/plain;
        charset="gb2312"
Content-Transfer-Encoding: 8BIT
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7600.16385
Thread-Index: AcpyTUIR86a5UbZCQDKxZPGeG8YtqgAB2Dmw
X-Allplus-MailScanner-Information: Please contact the ISP for more information
X-Allplus-MailScanner: Found to be clean
X-Allplus-MailScanner-From: jacklu@allplus-cn.com
Return-Path: <jacklu@allplus-cn.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25234
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: jacklu@allplus-cn.com
Precedence: bulk
X-list: linux-mips

Dear Wu
     The demo board is ONU. It is used in EPON systerm.
     I copy the cross-compilation to /opt,then modify CROSS_COMPILE
=/opt/openwrt/kamikaze_7.09/staging_dir_mips/bin/mips-linux-uclibc- in
mklzma.sh and Makefile.
     Then make config,and compile kernel.
     Use make command or sh mklzma.sh command can compile kernel.the same
errors come when excute one of two commands

Best Wishes
Jack Lu


-----ʼԭ-----
: Wu Zhangjin [mailto:wuzhangjin@gmail.com] 
ʱ: 2009121 13:14
ռ: jack_lu
: linux-mips@linux-mips.org
: Re: hello! can you help me for compiling the linux kernel?

On Tue, 2009-12-01 at 11:52 +0800, jack_lu wrote:
> Dear Sir,
> hello! can you help me for compiling the linux kernel?
> Linux version is linux-2.6.21.5.
> CPU:mips
> Cross-compilation tools is eldk and openwrt file packages.

Hello,

Which board are you using? and did you try the corresponding defconfig
file under arch/mips/configs/.

Regards,
	Wu zhangjin

> Errors are the followings.
> init/built-in.o: In function `init':
> init/main.c:833: undefined reference to `opipmux_gel_init'
> init/main.c:833: relocation truncated to fit: R_MIPS_26 against
`opipmux_gel_init'
> init/main.c:835: undefined reference to `ip_auto_config'
> init/main.c:835: relocation truncated to fit: R_MIPS_26 against
`ip_auto_config'
> init/built-in.o: In function `start_kernel':
> init/main.c:525: undefined reference to `setup_prom_printf'
> init/main.c:525: relocation truncated to fit: R_MIPS_26 against
`setup_prom_printf'
> init/main.c:527: undefined reference to `prom_printf'
> init/main.c:527: relocation truncated to fit: R_MIPS_26 against
`prom_printf'
> init/main.c:530: undefined reference to `prom_printf'
> init/main.c:530: relocation truncated to fit: R_MIPS_26 against
`prom_printf'
> arch/mips/kernel/built-in.o: In function `test_setdata':
> arch/mips/kernel/syscall.c:461: undefined reference to
`set_ipmux_el_tx_buf_data'
> arch/mips/kernel/syscall.c:461: relocation truncated to fit: R_MIPS_26
against `set_ipmux_el_tx_buf_data'
> arch/mips/kernel/built-in.o: In function `test_getdata':
> arch/mips/kernel/syscall.c:453: undefined reference to
`get_ipmux_el_rx_buf_data'
> arch/mips/kernel/syscall.c:453: relocation truncated to fit: R_MIPS_26
against `get_ipmux_el_rx_buf_data'
> arch/mips/kernel/built-in.o: In function `test_waitinterrupt':
> arch/mips/kernel/syscall.c:446: undefined reference to
`wait_for_host_test_interrupt'
> arch/mips/kernel/syscall.c:446: relocation truncated to fit: R_MIPS_26
against `wait_for_host_test_interrupt'
> kernel/built-in.o: In function `free_module':
> kernel/module.c:1231: undefined reference to `kfree1'
> kernel/module.c:1231: relocation truncated to fit: R_MIPS_26 against
`kfree1'
> drivers/built-in.o: In function `snapshot_map':
> drivers/md/dm-snap.c:900: undefined reference to `__cmpdi2'
> drivers/md/dm-snap.c:900: relocation truncated to fit: R_MIPS_26
against `__cmpdi2'
> make: *** [.tmp_vmlinux1] Error 1
> make: *** No rule to make target `../vmlinux', needed by `piggy.lzma'.
Stop.
> copyed to ../wrt_uImage
> cp: cannot stat `uImageLzma': No such file or directory
> ls: cannot access ../wrt_uImage: No such file or directory
> ===============================================================
>     output files:                           
>          wrt_uImage : the kernel image      
> 
> 
> Thanks &Best Wishes,
> Jack_Lu(³)
>    ӱóףϺ޹˾
>    Ϻ԰·168ŻA2101
>    绰+86 21 62495328/29/30/31 ֻ820
>    棺+86 21 62490538
>    MSN: luhongang@163.com
> 
> 
> 
> 



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


From jacklu@allplus-cn.com Tue Dec  1 06:33:30 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 12:25:41 +0100 (CET)
Received: from 60-248-150-25.HINET-IP.hinet.net ([60.248.150.25]:41294 "EHLO
        dns.allplus-cn.com" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org
        with ESMTP id S1492070AbZLAFd3 convert rfc822-to-8bit (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 06:33:29 +0100
Received: from DELLPC (unknown [116.231.39.52])
        by dns.allplus-cn.com (Postfix) with ESMTP id 7D60A2DBD5D;
        Tue,  1 Dec 2009 14:31:41 +0800 (CST)
From:   "jack_lu" <jacklu@allplus-cn.com>
To:     <wuzhangjin@gmail.com>
Cc:     <linux-mips@linux-mips.org>
References: <74D96A2497124516897C6F4D06D8B5AB@DELLPC> <1259644416.5139.11.camel@falcon.domain.org>
In-Reply-To: <1259644416.5139.11.camel@falcon.domain.org>
Subject: =?gb2312?B?tPC4tDogaGVsbG8hIGNhbiB5b3UgaGVscCBtZSBmb3IgY29tcGlsaQ==?=
        =?gb2312?B?bmcgdGhlIGxpbnV4IGtlcm5lbD8=?=
Date:   Tue, 1 Dec 2009 13:33:11 +0800
Message-ID: <505B44E810DF4EFDA65D25549FF81605@DELLPC>
MIME-Version: 1.0
Content-Type: text/plain;
        charset="gb2312"
Content-Transfer-Encoding: 8BIT
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7600.16385
Thread-Index: AcpyTUIR86a5UbZCQDKxZPGeG8YtqgABe7Wg
X-Allplus-MailScanner-Information: Please contact the ISP for more information
X-Allplus-MailScanner: Found to be clean
X-Allplus-MailScanner-From: jacklu@allplus-cn.com
Return-Path: <jacklu@allplus-cn.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25235
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: jacklu@allplus-cn.com
Precedence: bulk
X-list: linux-mips

Dear Wu,
     I tried to add #include <asm-mips/ipmux.h> or extern __init
opipmux_gel_init,but can not resolve these errors.
Thanks,
Jack Lu

-----ʼԭ-----
: Wu Zhangjin [mailto:wuzhangjin@gmail.com] 
ʱ: 2009121 13:14
ռ: jack_lu
: linux-mips@linux-mips.org
: Re: hello! can you help me for compiling the linux kernel?

On Tue, 2009-12-01 at 11:52 +0800, jack_lu wrote:
> Dear Sir,
> hello! can you help me for compiling the linux kernel?
> Linux version is linux-2.6.21.5.
> CPU:mips
> Cross-compilation tools is eldk and openwrt file packages.

Hello,

Which board are you using? and did you try the corresponding defconfig
file under arch/mips/configs/.

Regards,
	Wu zhangjin

> Errors are the followings.
> init/built-in.o: In function `init':
> init/main.c:833: undefined reference to `opipmux_gel_init'
> init/main.c:833: relocation truncated to fit: R_MIPS_26 against
`opipmux_gel_init'
> init/main.c:835: undefined reference to `ip_auto_config'
> init/main.c:835: relocation truncated to fit: R_MIPS_26 against
`ip_auto_config'
> init/built-in.o: In function `start_kernel':
> init/main.c:525: undefined reference to `setup_prom_printf'
> init/main.c:525: relocation truncated to fit: R_MIPS_26 against
`setup_prom_printf'
> init/main.c:527: undefined reference to `prom_printf'
> init/main.c:527: relocation truncated to fit: R_MIPS_26 against
`prom_printf'
> init/main.c:530: undefined reference to `prom_printf'
> init/main.c:530: relocation truncated to fit: R_MIPS_26 against
`prom_printf'
> arch/mips/kernel/built-in.o: In function `test_setdata':
> arch/mips/kernel/syscall.c:461: undefined reference to
`set_ipmux_el_tx_buf_data'
> arch/mips/kernel/syscall.c:461: relocation truncated to fit: R_MIPS_26
against `set_ipmux_el_tx_buf_data'
> arch/mips/kernel/built-in.o: In function `test_getdata':
> arch/mips/kernel/syscall.c:453: undefined reference to
`get_ipmux_el_rx_buf_data'
> arch/mips/kernel/syscall.c:453: relocation truncated to fit: R_MIPS_26
against `get_ipmux_el_rx_buf_data'
> arch/mips/kernel/built-in.o: In function `test_waitinterrupt':
> arch/mips/kernel/syscall.c:446: undefined reference to
`wait_for_host_test_interrupt'
> arch/mips/kernel/syscall.c:446: relocation truncated to fit: R_MIPS_26
against `wait_for_host_test_interrupt'
> kernel/built-in.o: In function `free_module':
> kernel/module.c:1231: undefined reference to `kfree1'
> kernel/module.c:1231: relocation truncated to fit: R_MIPS_26 against
`kfree1'
> drivers/built-in.o: In function `snapshot_map':
> drivers/md/dm-snap.c:900: undefined reference to `__cmpdi2'
> drivers/md/dm-snap.c:900: relocation truncated to fit: R_MIPS_26
against `__cmpdi2'
> make: *** [.tmp_vmlinux1] Error 1
> make: *** No rule to make target `../vmlinux', needed by `piggy.lzma'.
Stop.
> copyed to ../wrt_uImage
> cp: cannot stat `uImageLzma': No such file or directory
> ls: cannot access ../wrt_uImage: No such file or directory
> ===============================================================
>     output files:                           
>          wrt_uImage : the kernel image      
> 
> 
> Thanks &Best Wishes,
> Jack_Lu(³)
>    ӱóףϺ޹˾
>    Ϻ԰·168ŻA2101
>    绰+86 21 62495328/29/30/31 ֻ820
>    棺+86 21 62490538
>    MSN: luhongang@163.com
> 
> 
> 
> 



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


From rjw@sisk.pl Tue Dec  1 13:24:24 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 13:24:28 +0100 (CET)
Received: from ogre.sisk.pl ([217.79.144.158]:44617 "EHLO ogre.sisk.pl"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492404AbZLAMYY (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 13:24:24 +0100
Received: from localhost (localhost.localdomain [127.0.0.1])
        by ogre.sisk.pl (Postfix) with ESMTP id D1539167E41;
        Tue,  1 Dec 2009 13:05:21 +0100 (CET)
Received: from ogre.sisk.pl ([127.0.0.1])
 by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 22551-07; Tue,  1 Dec 2009 13:05:01 +0100 (CET)
Received: from tosh.localnet (iftwlan2.fuw.edu.pl [193.0.83.122])
        (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
        (No client certificate requested)
        by ogre.sisk.pl (Postfix) with ESMTP id 47AEA165583;
        Tue,  1 Dec 2009 13:05:01 +0100 (CET)
From:   "Rafael J. Wysocki" <rjw@sisk.pl>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Subject: Re: [PATCH v6 7/8] Loongson: YeeLoong: add suspend driver
Date:   Tue, 1 Dec 2009 13:24:29 +0100
User-Agent: KMail/1.12.3 (Linux/2.6.32-rc8-rjw; KDE/4.3.3; x86_64; ; )
Cc:     Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org,
        zhangfx@lemote.com, Pavel Machek <pavel@ucw.cz>,
        linux-pm@lists.linux-foundation.org
References: <cover.1259660040.git.wuzhangjin@gmail.com> <2574dde59f2e54ef9fa80423a7f02ed32eab7ab4.1259664573.git.wuzhangjin@gmail.com>
In-Reply-To: <2574dde59f2e54ef9fa80423a7f02ed32eab7ab4.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-2"
Content-Transfer-Encoding: 7bit
Message-Id: <200912011324.29486.rjw@sisk.pl>
X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux
Return-Path: <rjw@sisk.pl>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25236
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: rjw@sisk.pl
Precedence: bulk
X-list: linux-mips

On Tuesday 01 December 2009, Wu Zhangin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds Suspend Driver, which will suspend the YeeLoong Platform
> specific devices.
> 
> Acked-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>

I'm still not sure how useful it is to build it as a module, but otherwise

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>

> ---
>  .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |    8 +
>  .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    1 +
>  .../lemote-2f/yeeloong_laptop/yl_suspend.c         |  135 ++++++++++++++++++++
>  3 files changed, 144 insertions(+), 0 deletions(-)
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
> 
> diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
> index 7cf6071..f1211b4 100644
> --- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
> +++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
> @@ -45,4 +45,12 @@ config YEELOONG_VO
>  	  This option adds Video Output Driver, which provides standard
>  	  interface to turn on/off the video output of LCD, CRT.
>  
> +config YEELOONG_SUSPEND
> +	tristate "Suspend Driver"
> +	depends on YEELOONG_VO && LOONGSON_SUSPEND
> +	default y
> +	help
> +	  This option adds Suspend Driver, which will suspend the YeeLoong
> +	  Platform specific devices.
> +
>  endif
> diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
> index aa01140..29f8050 100644
> --- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
> +++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
> @@ -6,3 +6,4 @@ obj-$(CONFIG_YEELOONG_BACKLIGHT) += yl_backlight.o
>  obj-$(CONFIG_YEELOONG_BATTERY) += yl_battery.o
>  obj-$(CONFIG_YEELOONG_HWMON) += yl_hwmon.o
>  obj-$(CONFIG_YEELOONG_VO) += yl_vo.o
> +obj-$(CONFIG_YEELOONG_SUSPEND) += yl_suspend.o
> diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
> new file mode 100644
> index 0000000..9f53a69
> --- /dev/null
> +++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
> @@ -0,0 +1,135 @@
> +/*
> + * YeeLoong Platform Specific Suspend Driver
> + *
> + *  Copyright (C) 2009 Lemote Inc.
> + *  Author: Wu Zhangjin <wuzj@lemote.com>
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License version 2 as
> + *  published by the Free Software Foundation.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/platform_device.h>
> +
> +#include <asm/bootinfo.h>
> +
> +#include "ec_kb3310b.h"
> +
> +MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
> +MODULE_DESCRIPTION("YeeLoong laptop suspend driver");
> +MODULE_LICENSE("GPL");
> +
> +static struct platform_device *yeeloong_pdev;
> +
> +static void usb_ports_set(int status)
> +{
> +	status = !!status;
> +
> +	ec_write(REG_USB0_FLAG, status);
> +	ec_write(REG_USB1_FLAG, status);
> +	ec_write(REG_USB2_FLAG, status);
> +}
> +
> +static int yeeloong_suspend(struct platform_device *pdev,
> +		pm_message_t state)
> +{
> +	pr_info("yeeloong specific suspend\n");
> +
> +	/* Turn off LCD */
> +	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
> +	/* Turn off CRT */
> +	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
> +	/* Poweroff three usb ports */
> +	usb_ports_set(BIT_USB_FLAG_OFF);
> +
> +	return 0;
> +}
> +
> +static int yeeloong_resume(struct platform_device *pdev)
> +{
> +	pr_info("yeeloong specific resume\n");
> +
> +	/* Resume the status of lcd & crt */
> +	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
> +	yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
> +
> +	/* Poweron three usb ports */
> +	usb_ports_set(BIT_USB_FLAG_ON);
> +
> +	return 0;
> +}
> +
> +static struct platform_driver platform_driver = {
> +	.driver = {
> +		   .name = "yeeloong-laptop",
> +		   .owner = THIS_MODULE,
> +		   },
> +	.suspend = yeeloong_suspend,
> +	.resume = yeeloong_resume,
> +};
> +
> +static ssize_t yeeloong_pdev_name_show(struct device *dev,
> +				       struct device_attribute *attr, char *buf)
> +{
> +	return sprintf(buf, "yeeloong laptop\n");
> +}
> +
> +static struct device_attribute dev_attr_yeeloong_pdev_name =
> +__ATTR(name, S_IRUGO, yeeloong_pdev_name_show, NULL);
> +
> +static int __init yeeloong_suspend_init(void)
> +{
> +	int ret;
> +
> +	if (mips_machtype != MACH_LEMOTE_YL2F89) {
> +		pr_err("This Driver is only for YeeLoong laptop\n");
> +		return -EFAULT;
> +	}
> +
> +	/* Register platform stuff */
> +	ret = platform_driver_register(&platform_driver);
> +	if (ret)
> +		return ret;
> +
> +	yeeloong_pdev = platform_device_alloc("yeeloong-laptop", -1);
> +	if (!yeeloong_pdev) {
> +		ret = -ENOMEM;
> +		platform_driver_unregister(&platform_driver);
> +		return ret;
> +	}
> +
> +	ret = platform_device_add(yeeloong_pdev);
> +	if (ret) {
> +		platform_device_put(yeeloong_pdev);
> +		return ret;
> +	}
> +
> +	if (IS_ERR(yeeloong_pdev)) {
> +		ret = PTR_ERR(yeeloong_pdev);
> +		yeeloong_pdev = NULL;
> +		pr_err("Fail to register platform device\n");
> +		return ret;
> +	}
> +
> +	ret = device_create_file(&yeeloong_pdev->dev,
> +				 &dev_attr_yeeloong_pdev_name);
> +	if (ret) {
> +		pr_err("Fail to create sysfs device attributes\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static void __exit yeeloong_suspend_exit(void)
> +{
> +	if (yeeloong_pdev) {
> +		platform_device_unregister(yeeloong_pdev);
> +		yeeloong_pdev = NULL;
> +		platform_driver_unregister(&platform_driver);
> +	}
> +}
> +
> +module_init(yeeloong_suspend_init);
> +module_exit(yeeloong_suspend_exit);
> 


From ralf@linux-mips.org Tue Dec  1 14:32:12 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 14:32:16 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:59970 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492465AbZLANcM (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 14:32:12 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1DWPrK019390;
        Tue, 1 Dec 2009 13:32:25 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1DWNwk019379;
        Tue, 1 Dec 2009 13:32:23 GMT
Date:   Tue, 1 Dec 2009 13:32:23 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com
Subject: Re: [PATCH v6 1/8] Loongson: Lemote-2F: add platform specific submenu
Message-ID: <20091201133223.GA14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <a67a4a2ab32fc0e3281845479f07adf69dbf0bb2.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <a67a4a2ab32fc0e3281845479f07adf69dbf0bb2.1259664573.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25237
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 07:07:23PM +0800, Wu Zhangin wrote:

>  arch/mips/loongson/Kconfig |   20 ++++++++++++++++++++
>  1 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
> index 3df1967..a34dfcc 100644
> --- a/arch/mips/loongson/Kconfig
> +++ b/arch/mips/loongson/Kconfig
> @@ -83,3 +83,23 @@ config LOONGSON_UART_BASE
>  	bool
>  	default y
>  	depends on EARLY_PRINTK || SERIAL_8250
> +
> +#
> +# Loongson Platform Specific Drivers
> +#
> +
> +menuconfig LOONGSON_PLATFORM_DEVICES
> +	bool "Loongson Platform Drivers"
> +	default y
> +	help
> +	  Say Y here to get to see options for device drivers of various
> +	  loongson platforms, including vendor-specific laptop/pc extension
> +	  drivers.  This option alone does not add any kernel code.
> +
> +	  If you say N, all options in this submenu will be skipped and disabled.
> +
> +if LOONGSON_PLATFORM_DEVICES
> +# Put platform specific stuff here

Useless comment.  LOONGSON_PLATFORM_DEVICES already says exactly that.

> +
> +
> +endif # LOONGSON_PLATFORM_DEVICES

  Ralf

From ralf@linux-mips.org Tue Dec  1 14:34:18 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 14:34:21 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:59984 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492465AbZLANeS (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 14:34:18 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1DYRSn019473;
        Tue, 1 Dec 2009 13:34:27 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1DYRca019471;
        Tue, 1 Dec 2009 13:34:27 GMT
Date:   Tue, 1 Dec 2009 13:34:27 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com
Subject: Re: [PATCH v6 2/8] Loongson: YeeLoong: add platform specific option
Message-ID: <20091201133427.GB14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <e420b43bb54c33343e15cf53baf39806ba6583ae.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <e420b43bb54c33343e15cf53baf39806ba6583ae.1259664573.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25238
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 07:07:45PM +0800, Wu Zhangin wrote:

> This patch add a new LEMOTE_YEELOONG2F option, a yeeloong_laptop/
> directory for the coming yeeloong specific support, and for the
> ec_kb3310b belongs to yeeloong, so, move it to yeeloong_laptop/ too.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>

I suggest you fold this patch into patch 2/8.

  Ralf

From wuzhangjin@gmail.com Tue Dec  1 14:36:17 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 14:36:21 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:52056 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492465AbZLANgR (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 14:36:17 +0100
Received: by pwi15 with SMTP id 15so2663388pwi.24
        for <multiple recipients>; Tue, 01 Dec 2009 05:36:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=MT3c1Z04QHV4tHP/BL4MvzmLoLlsx7EBrdhI+ltI5F8=;
        b=JNkx+lkQSZAYpvEiYtSaQCnPnogQJK47gIr7h2zlG9LrnSPBW+6qNdeK6L08INev4D
         jrJz3r9GAZqWnIz1LBxCjHRbLUxqkZnLvGPCrjuEMVyyF7vckPioTJEFmVjhJfBVz4ls
         bG/eo74pvAkSTMGKp1RnFaWVRxnN2sOu/zfwo=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=F4GWKVHVTcRpi+DdzmDIbaN/OJVp9riPY/cDoFRGZuhLKWW5JBzi8mVL8as4V6l8U5
         n2Sh8N+XCDmZsGNL/3pqMffBA9HdpySFitfjhXy4PoMfxvOCvw8Nf5ySBZDQuCa9AIIY
         0sNZdr9wyWVPziP5epzXS8CgChI4rI1Vflwgw=
Received: by 10.115.61.16 with SMTP id o16mr10970902wak.15.1259674570440;
        Tue, 01 Dec 2009 05:36:10 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm556492pxi.5.2009.12.01.05.36.07
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 05:36:09 -0800 (PST)
Subject: Re: [PATCH v6 1/8] Loongson: Lemote-2F: add platform specific
 submenu
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com
In-Reply-To: <20091201133223.GA14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
         <a67a4a2ab32fc0e3281845479f07adf69dbf0bb2.1259664573.git.wuzhangjin@gmail.com>
         <20091201133223.GA14064@linux-mips.org>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 01 Dec 2009 21:35:38 +0800
Message-ID: <1259674538.11106.2.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25239
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-01 at 13:32 +0000, Ralf Baechle wrote:
> On Tue, Dec 01, 2009 at 07:07:23PM +0800, Wu Zhangin wrote:
> 
> >  arch/mips/loongson/Kconfig |   20 ++++++++++++++++++++
> >  1 files changed, 20 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
> > index 3df1967..a34dfcc 100644
> > --- a/arch/mips/loongson/Kconfig
> > +++ b/arch/mips/loongson/Kconfig
> > @@ -83,3 +83,23 @@ config LOONGSON_UART_BASE
> >  	bool
> >  	default y
> >  	depends on EARLY_PRINTK || SERIAL_8250
> > +
> > +#
> > +# Loongson Platform Specific Drivers
> > +#
> > +
> > +menuconfig LOONGSON_PLATFORM_DEVICES
> > +	bool "Loongson Platform Drivers"
> > +	default y
> > +	help
> > +	  Say Y here to get to see options for device drivers of various
> > +	  loongson platforms, including vendor-specific laptop/pc extension
> > +	  drivers.  This option alone does not add any kernel code.
> > +
> > +	  If you say N, all options in this submenu will be skipped and disabled.
> > +
> > +if LOONGSON_PLATFORM_DEVICES
> > +# Put platform specific stuff here
> 
> Useless comment.  LOONGSON_PLATFORM_DEVICES already says exactly that.
> 

Yep, Need to remove it  ;)

Thanks!
	Wu Zhangjin


From wuzhangjin@gmail.com Tue Dec  1 14:39:44 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 14:39:49 +0100 (CET)
Received: from mail-px0-f188.google.com ([209.85.216.188]:60383 "EHLO
        mail-px0-f188.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492465AbZLANjo (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 14:39:44 +0100
Received: by pxi26 with SMTP id 26so3768973pxi.21
        for <multiple recipients>; Tue, 01 Dec 2009 05:39:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=egZOucI2YJkQhWZenIZ2feceD8wlmSXzK8CRRlTaQWc=;
        b=B3Fwyt59UcU1Km2X4svou59PX9tEqf2kqD8OyQiaZ6mS2NCExE4EwY0xVDIRriy4TH
         L62Ix5VzSPVGwcx2hU48g56JZV87M7Z4ynYwOJKleZuuMx/h/+PEMTLZbg/QQsxq9KWS
         XlyhXvBQYqZTcw9anmdh318QbEGK0wu1p3qIE=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=SOetTkCqQ1t4A3JAjUNM67YUh0N5WB6o1S1p2MPVgeudJsl267tjBKc2yN3Lz5Xzet
         sPiS5D033+qm2AU9EPafqsKErziJh20ygT5jbXGwX6WsTrM3phAHYiVfK2rWJhRUSgQL
         NfwBvJX5Se5NhGcozn0MTHFd6naJfLPpH38Y4=
Received: by 10.115.67.24 with SMTP id u24mr10982815wak.59.1259674776723;
        Tue, 01 Dec 2009 05:39:36 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm80392pzk.14.2009.12.01.05.39.31
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 05:39:35 -0800 (PST)
Subject: Re: [PATCH v6 2/8] Loongson: YeeLoong: add platform specific option
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com
In-Reply-To: <20091201133427.GB14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
         <e420b43bb54c33343e15cf53baf39806ba6583ae.1259664573.git.wuzhangjin@gmail.com>
         <20091201133427.GB14064@linux-mips.org>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 01 Dec 2009 21:39:11 +0800
Message-ID: <1259674751.11106.5.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25240
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-01 at 13:34 +0000, Ralf Baechle wrote:
> On Tue, Dec 01, 2009 at 07:07:45PM +0800, Wu Zhangin wrote:
> 
> > This patch add a new LEMOTE_YEELOONG2F option, a yeeloong_laptop/
> > directory for the coming yeeloong specific support, and for the
> > ec_kb3310b belongs to yeeloong, so, move it to yeeloong_laptop/ too.
> > 
> > Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> I suggest you fold this patch into patch 2/8.

Sorry, do you mean merging the following two? for this patch itself is
2/8?

[PATCH v6 1/8] Loongson: Lemote-2F: add platform specific submenu
[PATCH v6 2/8] Loongson: YeeLoong: add platform specific option

Regards,
	Wu Zhangjin


From ralf@linux-mips.org Tue Dec  1 15:06:32 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 15:06:36 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:58673 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492583AbZLAOGc (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 15:06:32 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1E6kub020577;
        Tue, 1 Dec 2009 14:06:46 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1E6iTi020575;
        Tue, 1 Dec 2009 14:06:44 GMT
Date:   Tue, 1 Dec 2009 14:06:43 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Richard Purdie <rpurdie@rpsys.net>
Subject: Re: [PATCH v6 3/8] Loongson: YeeLoong: add backlight driver
Message-ID: <20091201140643.GC14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <4328ee6b15dce3cb600dddf4e7151532ddc77f17.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4328ee6b15dce3cb600dddf4e7151532ddc77f17.1259664573.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25241
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 07:08:42PM +0800, Wu Zhangin wrote:

> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds YeeLoong Backlight Driver, which provides standard
> interface for user-space applications to control the brightness of the
> backlight.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>

You split old, big driver into several individual drivers - good.

Now we can actually move things to their rightf place and for a backlight
drivers that should be drivers/video/backlight/.  Convert it to a platform
driver.

  Ralf

From ralf@linux-mips.org Tue Dec  1 15:17:31 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 15:17:33 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:57285 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492486AbZLAORb (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 15:17:31 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1EHkG0021012;
        Tue, 1 Dec 2009 14:17:46 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1EHi94021010;
        Tue, 1 Dec 2009 14:17:44 GMT
Date:   Tue, 1 Dec 2009 14:17:44 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com
Subject: Re: [PATCH v6 2/8] Loongson: YeeLoong: add platform specific option
Message-ID: <20091201141744.GD14195@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <e420b43bb54c33343e15cf53baf39806ba6583ae.1259664573.git.wuzhangjin@gmail.com>
 <20091201133427.GB14064@linux-mips.org>
 <1259674751.11106.5.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259674751.11106.5.camel@falcon.domain.org>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25242
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 09:39:11PM +0800, Wu Zhangjin wrote:

> On Tue, 2009-12-01 at 13:34 +0000, Ralf Baechle wrote:
> > On Tue, Dec 01, 2009 at 07:07:45PM +0800, Wu Zhangin wrote:
> > 
> > > This patch add a new LEMOTE_YEELOONG2F option, a yeeloong_laptop/
> > > directory for the coming yeeloong specific support, and for the
> > > ec_kb3310b belongs to yeeloong, so, move it to yeeloong_laptop/ too.
> > > 
> > > Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> > 
> > I suggest you fold this patch into patch 2/8.
> 
> Sorry, do you mean merging the following two? for this patch itself is
> 2/8?
> 
> [PATCH v6 1/8] Loongson: Lemote-2F: add platform specific submenu
> [PATCH v6 2/8] Loongson: YeeLoong: add platform specific option

Yes.

  Ralf

From ralf@linux-mips.org Tue Dec  1 15:20:15 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 15:20:18 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:46600 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492486AbZLAOUP (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 15:20:15 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1EKS95021096;
        Tue, 1 Dec 2009 14:20:28 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1EKSbP021093;
        Tue, 1 Dec 2009 14:20:28 GMT
Date:   Tue, 1 Dec 2009 14:20:28 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Stephen Rothwell <sfr@linuxcare.com>
Subject: Re: [PATCH v6 4/8] Loongson: YeeLoong: add battery driver
Message-ID: <20091201142028.GD14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <6a81bc182b684f94ebcffc562ee98fa7db759826.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <6a81bc182b684f94ebcffc562ee98fa7db759826.1259664573.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25243
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 07:09:19PM +0800, Wu Zhangin wrote:

> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds APM_EMULATION based Battery Driver, which provides
> standard interface for user-space applications to manage the battery.

This one as well is a candidate to become a platform driver.

  Ralf

From ralf@linux-mips.org Tue Dec  1 15:26:54 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 15:26:58 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:44395 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492643AbZLAO0y (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 15:26:54 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1ERBv4021322;
        Tue, 1 Dec 2009 14:27:11 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1ERAZu021320;
        Tue, 1 Dec 2009 14:27:10 GMT
Date:   Tue, 1 Dec 2009 14:27:10 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        lm-sensors@lm-sensors.org
Subject: Re: [PATCH v6 5/8] Loongson: YeeLoong: add hwmon driver
Message-ID: <20091201142710.GE14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <3973cc1fdb6ff2b2e540ed93ae92dac8d7b2a38f.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <3973cc1fdb6ff2b2e540ed93ae92dac8d7b2a38f.1259664573.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25244
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 07:09:59PM +0800, Wu Zhangin wrote:

> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds hwmon driver for managing the temperature of battery,
> cpu and controlling the fan.

And this one should now go to drivers/hwmon and become a platform driver
as well.

  Ralf

From ralf@linux-mips.org Tue Dec  1 15:51:30 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 15:51:37 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:48126 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492582AbZLAOva (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 15:51:30 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1EphNM022226;
        Tue, 1 Dec 2009 14:51:44 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1EpdKL022223;
        Tue, 1 Dec 2009 14:51:39 GMT
Date:   Tue, 1 Dec 2009 14:51:38 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        linux-pm@lists.linux-foundation.org
Subject: Re: [PATCH v6 7/8] Loongson: YeeLoong: add suspend driver
Message-ID: <20091201145138.GF14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <2574dde59f2e54ef9fa80423a7f02ed32eab7ab4.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <2574dde59f2e54ef9fa80423a7f02ed32eab7ab4.1259664573.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25245
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 07:11:55PM +0800, Wu Zhangin wrote:
> From: Wu Zhangin <wuzhangjin@gmail.com>
> Date:   Tue,  1 Dec 2009 19:11:55 +0800
> To: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org, zhangfx@lemote.com,
> 	Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
> 	linux-pm@lists.linux-foundation.org,
> 	Wu Zhangjin <wuzhangjin@gmail.com>
> Subject: [PATCH v6 7/8] Loongson: YeeLoong: add suspend driver
> 
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds Suspend Driver, which will suspend the YeeLoong Platform
> specific devices.
> 
> Acked-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  .../loongson/lemote-2f/yeeloong_laptop/Kconfig     |    8 +
>  .../loongson/lemote-2f/yeeloong_laptop/Makefile    |    1 +
>  .../lemote-2f/yeeloong_laptop/yl_suspend.c         |  135 ++++++++++++++++++++
>  3 files changed, 144 insertions(+), 0 deletions(-)
>  create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
> 
> diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
> index 7cf6071..f1211b4 100644
> --- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
> +++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Kconfig
> @@ -45,4 +45,12 @@ config YEELOONG_VO
>  	  This option adds Video Output Driver, which provides standard
>  	  interface to turn on/off the video output of LCD, CRT.
>  
> +config YEELOONG_SUSPEND
> +	tristate "Suspend Driver"
> +	depends on YEELOONG_VO && LOONGSON_SUSPEND
> +	default y
> +	help
> +	  This option adds Suspend Driver, which will suspend the YeeLoong
> +	  Platform specific devices.
> +
>  endif
> diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
> index aa01140..29f8050 100644
> --- a/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
> +++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/Makefile
> @@ -6,3 +6,4 @@ obj-$(CONFIG_YEELOONG_BACKLIGHT) += yl_backlight.o
>  obj-$(CONFIG_YEELOONG_BATTERY) += yl_battery.o
>  obj-$(CONFIG_YEELOONG_HWMON) += yl_hwmon.o
>  obj-$(CONFIG_YEELOONG_VO) += yl_vo.o
> +obj-$(CONFIG_YEELOONG_SUSPEND) += yl_suspend.o
> diff --git a/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
> new file mode 100644
> index 0000000..9f53a69
> --- /dev/null
> +++ b/arch/mips/loongson/lemote-2f/yeeloong_laptop/yl_suspend.c
> @@ -0,0 +1,135 @@
> +/*
> + * YeeLoong Platform Specific Suspend Driver
> + *
> + *  Copyright (C) 2009 Lemote Inc.
> + *  Author: Wu Zhangjin <wuzj@lemote.com>
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License version 2 as
> + *  published by the Free Software Foundation.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/platform_device.h>
> +
> +#include <asm/bootinfo.h>
> +
> +#include "ec_kb3310b.h"
> +
> +MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
> +MODULE_DESCRIPTION("YeeLoong laptop suspend driver");
> +MODULE_LICENSE("GPL");
> +
> +static struct platform_device *yeeloong_pdev;
> +
> +static void usb_ports_set(int status)
> +{
> +	status = !!status;
> +
> +	ec_write(REG_USB0_FLAG, status);
> +	ec_write(REG_USB1_FLAG, status);
> +	ec_write(REG_USB2_FLAG, status);
> +}
> +
> +static int yeeloong_suspend(struct platform_device *pdev,
> +		pm_message_t state)
> +{
> +	pr_info("yeeloong specific suspend\n");
> +
> +	/* Turn off LCD */
> +	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
> +	/* Turn off CRT */
> +	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
> +	/* Poweroff three usb ports */
> +	usb_ports_set(BIT_USB_FLAG_OFF);
> +
> +	return 0;
> +}
> +
> +static int yeeloong_resume(struct platform_device *pdev)
> +{
> +	pr_info("yeeloong specific resume\n");
> +
> +	/* Resume the status of lcd & crt */
> +	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
> +	yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
> +
> +	/* Poweron three usb ports */
> +	usb_ports_set(BIT_USB_FLAG_ON);
> +
> +	return 0;
> +}
> +
> +static struct platform_driver platform_driver = {
> +	.driver = {
> +		   .name = "yeeloong-laptop",
> +		   .owner = THIS_MODULE,
> +		   },
> +	.suspend = yeeloong_suspend,
> +	.resume = yeeloong_resume,
> +};
> +
> +static ssize_t yeeloong_pdev_name_show(struct device *dev,
> +				       struct device_attribute *attr, char *buf)
> +{
> +	return sprintf(buf, "yeeloong laptop\n");
> +}
> +
> +static struct device_attribute dev_attr_yeeloong_pdev_name =
> +__ATTR(name, S_IRUGO, yeeloong_pdev_name_show, NULL);
> +
> +static int __init yeeloong_suspend_init(void)
> +{
> +	int ret;
> +
> +	if (mips_machtype != MACH_LEMOTE_YL2F89) {
> +		pr_err("This Driver is only for YeeLoong laptop\n");
> +		return -EFAULT;
> +	}

No need to signal an error here.  A platform device should only be
registered on a platform that actually has the device.  If you handle
all that registration business in a central platform.c file which
always is compiled into the YeeLoong kernel, this check can go away and
you at the same time assure the actual driver module can only be loaded
into the right kernel.

> +
> +	/* Register platform stuff */
> +	ret = platform_driver_register(&platform_driver);
> +	if (ret)
> +		return ret;
> +
> +	yeeloong_pdev = platform_device_alloc("yeeloong-laptop", -1);
> +	if (!yeeloong_pdev) {
> +		ret = -ENOMEM;
> +		platform_driver_unregister(&platform_driver);
> +		return ret;
> +	}
> +
> +	ret = platform_device_add(yeeloong_pdev);
> +	if (ret) {
> +		platform_device_put(yeeloong_pdev);
> +		return ret;
> +	}
> +
> +	if (IS_ERR(yeeloong_pdev)) {
> +		ret = PTR_ERR(yeeloong_pdev);
> +		yeeloong_pdev = NULL;
> +		pr_err("Fail to register platform device\n");
> +		return ret;
> +	}
> +
> +	ret = device_create_file(&yeeloong_pdev->dev,
> +				 &dev_attr_yeeloong_pdev_name);
> +	if (ret) {
> +		pr_err("Fail to create sysfs device attributes\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static void __exit yeeloong_suspend_exit(void)
> +{
> +	if (yeeloong_pdev) {
> +		platform_device_unregister(yeeloong_pdev);
> +		yeeloong_pdev = NULL;
> +		platform_driver_unregister(&platform_driver);
> +	}
> +}
> +
> +module_init(yeeloong_suspend_init);
> +module_exit(yeeloong_suspend_exit);
> -- 
> 1.6.2.1

  Ralf

From wuzhangjin@gmail.com Tue Dec  1 15:53:04 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 15:53:08 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:56518 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492632AbZLAOxD (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 15:53:03 +0100
Received: by pwi15 with SMTP id 15so2711701pwi.24
        for <multiple recipients>; Tue, 01 Dec 2009 06:52:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=m7qcq7ehYhOGlYUTFTEXz1mHDzNsLvgX4Wf1P+r3qzM=;
        b=PTQNGsG5VF/+gvj6bWYdiSOss0iRf8Ui4F5J3R1g44GxnUBLyiMcrB3Mlkmx6HD/n8
         6tzINzZMloKh0lZGnovKOAJHp25GUjAYm1cIj6HH0Huf5/eHow8FcstgORZNpIj5ZFfj
         veetMZSFIR7gJsI7SZlivxi79IWoSov7b56dE=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=wuZr0+dA62glghYAN+ycxbO5+EAsPM2asWbE5Taz3e1blxEPXUv/dKOAxSIiddYdRI
         IE/B867trcw7U0vy/WIuPEl/KJeYLvwMVDd2kW1aqwG3puP8xRlmLxQWsPTI0VUdm671
         OPh4YuJmKMVqznlW7RDY5/ah5yv8nHnUdsh4Q=
Received: by 10.114.45.10 with SMTP id s10mr3449864was.76.1259679174146;
        Tue, 01 Dec 2009 06:52:54 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm306664pxi.14.2009.12.01.06.52.50
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 06:52:53 -0800 (PST)
Subject: Re: [PATCH v6 3/8] Loongson: YeeLoong: add backlight driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Richard Purdie <rpurdie@rpsys.net>
In-Reply-To: <20091201140643.GC14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
         <4328ee6b15dce3cb600dddf4e7151532ddc77f17.1259664573.git.wuzhangjin@gmail.com>
         <20091201140643.GC14064@linux-mips.org>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 01 Dec 2009 22:52:17 +0800
Message-ID: <1259679137.12571.4.camel@falcon>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25246
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-01 at 14:06 +0000, Ralf Baechle wrote:
> On Tue, Dec 01, 2009 at 07:08:42PM +0800, Wu Zhangin wrote:
> 
> > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > 
> > This patch adds YeeLoong Backlight Driver, which provides standard
> > interface for user-space applications to control the brightness of the
> > backlight.
> > 
> > Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> You split old, big driver into several individual drivers - good.
> 
> Now we can actually move things to their rightf place and for a backlight
> drivers that should be drivers/video/backlight/.  Convert it to a platform
> driver.

Okay, but for these drivers need the ec_kb3310b.h, so, we also need to
move it from arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
to arch/mips/include/asm/mach-loongson/ec_kb3310b.h.

and seems some subsystem have no maintainer, such as the hwmon driver:

HARDWARE MONITORING
L:      lm-sensors@lm-sensors.org
W:      http://www.lm-sensors.org/
S:      Orphan
F:      drivers/hwmon/

So, who should I send this patch to?

Best Regards,
	Wu Zhangjin


From ralf@linux-mips.org Tue Dec  1 15:55:25 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 15:55:30 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:50093 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492631AbZLAOzZ (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 15:55:25 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1EtdxA022368;
        Tue, 1 Dec 2009 14:55:39 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1EtdRj022366;
        Tue, 1 Dec 2009 14:55:39 GMT
Date:   Tue, 1 Dec 2009 14:55:39 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com, luming.yu@intel.com
Subject: Re: [PATCH v6 6/8] Loongson: YeeLoong: add video output driver
Message-ID: <20091201145538.GG14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <6447f36c749f513c3717c3bffdf21cbd8f416312.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <6447f36c749f513c3717c3bffdf21cbd8f416312.1259664573.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25247
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 07:10:38PM +0800, Wu Zhangin wrote:

> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds Video Output Driver, which provides standard interface
> to turn on/off the video output of LCD, CRT.

This one also should become a platform driver.

  Ralf

From ralf@linux-mips.org Tue Dec  1 15:57:28 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 15:57:30 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:50107 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492632AbZLAO51 (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 15:57:27 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1Evjh4022451;
        Tue, 1 Dec 2009 14:57:45 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1EvjY4022449;
        Tue, 1 Dec 2009 14:57:45 GMT
Date:   Tue, 1 Dec 2009 14:57:45 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Richard Purdie <rpurdie@rpsys.net>
Subject: Re: [PATCH v6 3/8] Loongson: YeeLoong: add backlight driver
Message-ID: <20091201145745.GH14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <4328ee6b15dce3cb600dddf4e7151532ddc77f17.1259664573.git.wuzhangjin@gmail.com>
 <20091201140643.GC14064@linux-mips.org>
 <1259679137.12571.4.camel@falcon>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259679137.12571.4.camel@falcon>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25248
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 10:52:17PM +0800, Wu Zhangjin wrote:

> On Tue, 2009-12-01 at 14:06 +0000, Ralf Baechle wrote:
> > On Tue, Dec 01, 2009 at 07:08:42PM +0800, Wu Zhangin wrote:
> > 
> > > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > > 
> > > This patch adds YeeLoong Backlight Driver, which provides standard
> > > interface for user-space applications to control the brightness of the
> > > backlight.
> > > 
> > > Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> > 
> > You split old, big driver into several individual drivers - good.
> > 
> > Now we can actually move things to their rightf place and for a backlight
> > drivers that should be drivers/video/backlight/.  Convert it to a platform
> > driver.
> 
> Okay, but for these drivers need the ec_kb3310b.h, so, we also need to
> move it from arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
> to arch/mips/include/asm/mach-loongson/ec_kb3310b.h.
> 
> and seems some subsystem have no maintainer, such as the hwmon driver:

Which is true and sometimes a bit of a nuisance but one we can live with.

> HARDWARE MONITORING
> L:      lm-sensors@lm-sensors.org
> W:      http://www.lm-sensors.org/
> S:      Orphan
> F:      drivers/hwmon/
> 
> So, who should I send this patch to?

I suggest you add Andrew Morton <akpm@linux-foundation.org> and linux-kernel
to the To: list.

  Ralf

From wuzhangjin@gmail.com Tue Dec  1 16:02:01 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 16:02:04 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:46214 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492631AbZLAPCB (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 16:02:01 +0100
Received: by pzk35 with SMTP id 35so3724005pzk.22
        for <multiple recipients>; Tue, 01 Dec 2009 07:01:53 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=GTT5MgCIVkjveDLCvRThQAdqS/NvzlynFLkK9oSPUdM=;
        b=bIkiNjaFWHWT9NRz/kJ7AZ0Mfv94QXuNvm98uF7Ob8Zga7PK5c5OliNPavOota0+GI
         242+To1GsXXY/UCJqL20BLcyZfPoep8Jjc6ji/jVoREj+1htnXLX+ykNBHGmEyA6553Q
         6SFbeEvLqhCNsI6EEMKuob2hm7E4biMZI3aI8=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=hHbe/HBqhxjLHeN/apMOGBqlrSUlSqvoW/g0CwN3mPPhRul7NLxsJZWsa0wBQeixXM
         WO+FaCeQJBXNLwf0W3rDWe7sM7GRN1mm6uL21CNN8eK8peBZKWWYbAaPYt/YscoO1Ewe
         P1xikmmKS8cOzHpFFXIDc7IK0kPPxsAzrglck=
Received: by 10.115.80.6 with SMTP id h6mr4426657wal.108.1259679713193;
        Tue, 01 Dec 2009 07:01:53 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm127644pzk.13.2009.12.01.07.01.50
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 07:01:52 -0800 (PST)
Subject: Re: [PATCH v6 3/8] Loongson: YeeLoong: add backlight driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Richard Purdie <rpurdie@rpsys.net>
In-Reply-To: <20091201145745.GH14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
         <4328ee6b15dce3cb600dddf4e7151532ddc77f17.1259664573.git.wuzhangjin@gmail.com>
         <20091201140643.GC14064@linux-mips.org> <1259679137.12571.4.camel@falcon>
         <20091201145745.GH14064@linux-mips.org>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 01 Dec 2009 23:01:33 +0800
Message-ID: <1259679693.12571.8.camel@falcon>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25249
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-01 at 14:57 +0000, Ralf Baechle wrote:
> On Tue, Dec 01, 2009 at 10:52:17PM +0800, Wu Zhangjin wrote:
> 
> > On Tue, 2009-12-01 at 14:06 +0000, Ralf Baechle wrote:
> > > On Tue, Dec 01, 2009 at 07:08:42PM +0800, Wu Zhangin wrote:
> > > 
> > > > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > > > 
> > > > This patch adds YeeLoong Backlight Driver, which provides standard
> > > > interface for user-space applications to control the brightness of the
> > > > backlight.
> > > > 
> > > > Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> > > 
> > > You split old, big driver into several individual drivers - good.
> > > 
> > > Now we can actually move things to their rightf place and for a backlight
> > > drivers that should be drivers/video/backlight/.  Convert it to a platform
> > > driver.
> > 
> > Okay, but for these drivers need the ec_kb3310b.h, so, we also need to
> > move it from arch/mips/loongson/lemote-2f/yeeloong_laptop/ec_kb3310b.h
> > to arch/mips/include/asm/mach-loongson/ec_kb3310b.h.
> > 
> > and seems some subsystem have no maintainer, such as the hwmon driver:
> 
> Which is true and sometimes a bit of a nuisance but one we can live with.
> 

This time, I like the folks did under drivers/platform/x86/ ;) which
will be better to maintain. for all of these drivers are really only
YeeLoong platform specific ;)

> > HARDWARE MONITORING
> > L:      lm-sensors@lm-sensors.org
> > W:      http://www.lm-sensors.org/
> > S:      Orphan
> > F:      drivers/hwmon/
> > 
> > So, who should I send this patch to?
> 
> I suggest you add Andrew Morton <akpm@linux-foundation.org> and linux-kernel
> to the To: list.
> 

Okay, later, thanks!

Regards,
	Wu Zhangjin


From ralf@linux-mips.org Tue Dec  1 16:17:51 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 16:17:55 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:52714 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492724AbZLAPRu (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 16:17:50 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1FI6dx023155;
        Tue, 1 Dec 2009 15:18:07 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1FI5s2023153;
        Tue, 1 Dec 2009 15:18:05 GMT
Date:   Tue, 1 Dec 2009 15:18:05 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     "Rafael J. Wysocki" <rjw@sisk.pl>
Cc:     Wu Zhangin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        zhangfx@lemote.com, Pavel Machek <pavel@ucw.cz>,
        linux-pm@lists.linux-foundation.org
Subject: Re: [PATCH v6 7/8] Loongson: YeeLoong: add suspend driver
Message-ID: <20091201151805.GA23019@linux-mips.org>
References: <cover.1259660040.git.wuzhangjin@gmail.com>
 <2574dde59f2e54ef9fa80423a7f02ed32eab7ab4.1259664573.git.wuzhangjin@gmail.com>
 <200912011324.29486.rjw@sisk.pl>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200912011324.29486.rjw@sisk.pl>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25250
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 01:24:29PM +0100, Rafael J. Wysocki wrote:

> On Tuesday 01 December 2009, Wu Zhangin wrote:
> > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > 
> > This patch adds Suspend Driver, which will suspend the YeeLoong Platform
> > specific devices.
> > 
> > Acked-by: Pavel Machek <pavel@ucw.cz>
> > Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> I'm still not sure how useful it is to build it as a module, but otherwise

I think I agree with that.  Maybe even one step further and just build
this code depending on CONFIG_PM or similar?

  Ralf

From ralf@linux-mips.org Tue Dec  1 16:23:21 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 16:23:24 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:45719 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492724AbZLAPXV (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 16:23:21 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1FNdv8023343;
        Tue, 1 Dec 2009 15:23:39 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1FNd5b023341;
        Tue, 1 Dec 2009 15:23:39 GMT
Date:   Tue, 1 Dec 2009 15:23:39 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Richard Purdie <rpurdie@rpsys.net>
Subject: Re: [PATCH v6 3/8] Loongson: YeeLoong: add backlight driver
Message-ID: <20091201152339.GB23019@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <4328ee6b15dce3cb600dddf4e7151532ddc77f17.1259664573.git.wuzhangjin@gmail.com>
 <20091201140643.GC14064@linux-mips.org>
 <1259679137.12571.4.camel@falcon>
 <20091201145745.GH14064@linux-mips.org>
 <1259679693.12571.8.camel@falcon>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259679693.12571.8.camel@falcon>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25251
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 11:01:33PM +0800, Wu Zhangjin wrote:

> This time, I like the folks did under drivers/platform/x86/ ;) which
> will be better to maintain. for all of these drivers are really only
> YeeLoong platform specific ;)

Experience has shown that drivers for a particular subsystem are best
combined in a single menu, in a single directory.  Otherwise any changes
to subsystem's internal APIs will become a major pain.  Which in the
end means arch/ is usually the place for drivers that don't fit into
any established cathegory.

  Ralf

From ralf@linux-mips.org Tue Dec  1 16:40:36 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 16:40:38 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:40474 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492598AbZLAPkf (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 16:40:35 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1Fepqc023955;
        Tue, 1 Dec 2009 15:40:51 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1FeovF023953;
        Tue, 1 Dec 2009 15:40:50 GMT
Date:   Tue, 1 Dec 2009 15:40:50 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH v6 8/8] Loongson: YeeLoong: add hotkey driver
Message-ID: <20091201154050.GJ14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <939c1425f653e3bda05799345c53198dfd2c1dcc.1259664573.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <939c1425f653e3bda05799345c53198dfd2c1dcc.1259664573.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25252
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 07:12:37PM +0800, Wu Zhangin wrote:

> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds Hotkey Driver, which will do relative actions for The
> hotkey event and report the corresponding input keys to the user-space
> applications.

This one also should become a platform driver.  And is probably a
candidate for drivers/input/keyboard.

  Ralf

From ralf@linux-mips.org Tue Dec  1 16:41:01 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 16:41:14 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:40478 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492598AbZLAPlA (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 16:41:00 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1FfIpo023962;
        Tue, 1 Dec 2009 15:41:18 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1FfIkI023961;
        Tue, 1 Dec 2009 15:41:18 GMT
Date:   Tue, 1 Dec 2009 15:41:18 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com,
        Richard Purdie <rpurdie@rpsys.net>
Subject: Re: [PATCH v6 3/8] Loongson: YeeLoong: add backlight driver
Message-ID: <20091201154118.GK14064@linux-mips.org>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
 <4328ee6b15dce3cb600dddf4e7151532ddc77f17.1259664573.git.wuzhangjin@gmail.com>
 <20091201140643.GC14064@linux-mips.org>
 <1259679137.12571.4.camel@falcon>
 <20091201145745.GH14064@linux-mips.org>
 <1259679693.12571.8.camel@falcon>
 <20091201152339.GB23019@linux-mips.org>
 <1259681303.13403.4.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259681303.13403.4.camel@falcon.domain.org>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25253
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 11:28:23PM +0800, Wu Zhangjin wrote:

> > any established cathegory.
> 
> Get it, thanks ;)
> 
> I will do it tomorrow, Good night!

I thought you never sleep :-)

  Ralf

From ralf@linux-mips.org Tue Dec  1 16:58:10 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 16:58:14 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:38032 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492779AbZLAP6K (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 16:58:10 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1FwOIj005920;
        Tue, 1 Dec 2009 15:58:25 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1FwMW2005919;
        Tue, 1 Dec 2009 15:58:22 GMT
Date:   Tue, 1 Dec 2009 15:58:21 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com
Subject: Re: [PATCH 1/2] Loongson: disable PAGE_SIZE_4KB
Message-ID: <20091201155821.GB23697@linux-mips.org>
References: <1259650525-31884-1-git-send-email-wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259650525-31884-1-git-send-email-wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25254
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 02:55:25PM +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> Date:   Tue,  1 Dec 2009 14:55:25 +0800
> To: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org, zhangfx@lemote.com,
> 	Wu Zhangjin <wuzhangjin@gmail.com>
> Subject: [PATCH 1/2] Loongson: disable PAGE_SIZE_4KB
> 
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> Currently, with PAGE_SIZE_4KB, the kernel for loongson will hang on:
> 
> Kernel panic - not syncing: Attempted to kill init!
> 
> The possible reason is the cache aliases problem:
> 
> Loongson 2F has 64kb, 4 way L1 Cache, the way size is 16kb, which is
> bigger then 4kb. so, If using 4kb page size, there is cache aliases
> problem(Documentation/cachetlb.txt), to avoid such problem, we may need
> extra cache flushing. but with 16kb page size, there is no cache aliases
> problem and no corresponding operations needed to cope with that
> problem, so, it's better to disable 4kb page size directly before the
> above problem is solved.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>

Applied - though I'm not so sure if I can get this one to Linus as
close to a release as we are now.

Thanks!

  Ralf

From ralf@linux-mips.org Tue Dec  1 16:58:36 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 16:58:39 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:38038 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492779AbZLAP6g (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 16:58:36 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB1Fwlbd005937;
        Tue, 1 Dec 2009 15:58:47 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB1FwkdH005936;
        Tue, 1 Dec 2009 15:58:46 GMT
Date:   Tue, 1 Dec 2009 15:58:46 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org, zhangfx@lemote.com
Subject: Re: [PATCH 2/2] Loongson: disable FLATMEM
Message-ID: <20091201155846.GC23697@linux-mips.org>
References: <1259650542-31922-1-git-send-email-wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259650542-31922-1-git-send-email-wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25255
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 02:55:42PM +0800, Wu Zhangjin wrote:

> With FLATMEM, The STD(Hibernation) for Loongson will fail, and there are
> also some other problems(break the files) when using NFS or CIFS(samba).
> 
> And as the config help of SPARSEMEM says:
> 
> "This option provides some potential performance benefits, along with
> decreased code complexity."
> 
> So, to avoid the potential problems of FLATMEM, we disable FLATMEM
> directly and use SPARSEMEM instead.
> 
> Relative Email thread:
> 
> http://groups.google.com/group/loongson-dev/browse_thread/thread/b6b65890ec2b0f24/feb43e5aa7f55d9b?show_docid=feb43e5aa7f55d9b
> 
> Reported-by: Tatu Kilappa <tatu.kilappa@gmail.com>
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>

Applied - though I'm not so sure if I can get this one to Linus as
close to a release as we are now.

Thanks!

  Ralf

From dmitry.torokhov@gmail.com Tue Dec  1 19:04:09 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 19:04:11 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:34982 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492943AbZLASEI (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 1 Dec 2009 19:04:08 +0100
Received: by pxi6 with SMTP id 6so470284pxi.0
        for <multiple recipients>; Tue, 01 Dec 2009 10:03:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:date:from:to:cc:subject
         :message-id:references:mime-version:content-type:content-disposition
         :in-reply-to:user-agent;
        bh=u1AliPVst7RdmfJDzZ7mr9CUBONmzPmQ6Gp1aCL3iPE=;
        b=tZ6M1JOgZU7k3QY3Ckt9iVAYoc5kk1+jJU1MprcpEMpvhNRPTRKt8uo28g4VwcL6yd
         9Hmbah1T5YLk2IqSoJ09HQiMUDqDKudGbuC/x5Z/M8xpsg4DwFvUNg7+CCm2PBVmLJlo
         tavc/xfygoTqF/0HH1k+ZzlTRTu29vsYs0seQ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=date:from:to:cc:subject:message-id:references:mime-version
         :content-type:content-disposition:in-reply-to:user-agent;
        b=bh7eXohTDOugVKK2/7F7JcQYH+shqyvMAH6FnFENhFJ4/Lb73tKmMUTdjzSX6Mqcn/
         xpIwTPNEBUeS3rjktL9QW888+MjbQJXL0pIyvTGr0Q8v5FtYehbbjzwll+ShtBepo73E
         mxK9OAEkZF14Opd39+FwzRVYM8XGKCRqu1MOs=
Received: by 10.114.214.24 with SMTP id m24mr11666600wag.93.1259690639846;
        Tue, 01 Dec 2009 10:03:59 -0800 (PST)
Received: from mailhub.coreip.homeip.net (c-24-6-153-137.hsd1.ca.comcast.net [24.6.153.137])
        by mx.google.com with ESMTPS id 22sm410727pxi.14.2009.12.01.10.03.58
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 10:03:58 -0800 (PST)
Date:   Tue, 1 Dec 2009 10:03:50 -0800
From:   Dmitry Torokhov <dmitry.torokhov@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     Wu Zhangin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        zhangfx@lemote.com
Subject: Re: [PATCH v6 8/8] Loongson: YeeLoong: add hotkey driver
Message-ID: <20091201180350.GB19259@core.coreip.homeip.net>
References: <cover.1259664573.git.wuzhangjin@gmail.com> <939c1425f653e3bda05799345c53198dfd2c1dcc.1259664573.git.wuzhangjin@gmail.com> <20091201154050.GJ14064@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091201154050.GJ14064@linux-mips.org>
User-Agent: Mutt/1.5.19 (2009-01-05)
Return-Path: <dmitry.torokhov@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25256
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: dmitry.torokhov@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, Dec 01, 2009 at 03:40:50PM +0000, Ralf Baechle wrote:
> On Tue, Dec 01, 2009 at 07:12:37PM +0800, Wu Zhangin wrote:
> 
> > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > 
> > This patch adds Hotkey Driver, which will do relative actions for The
> > hotkey event and report the corresponding input keys to the user-space
> > applications.
> 
> This one also should become a platform driver.  And is probably a
> candidate for drivers/input/keyboard.
> 

Umm, it still mixes up bunch of stuff not directly related to input. I'd
vote for drivers/platform/mips (since we have a few of kitchen-sink
style drivers for x86-based laptops in drivers/platform/x86).

Thanks.

-- 
Dmitry

From hector@marcansoft.com Tue Dec  1 23:23:29 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 01 Dec 2009 23:23:32 +0100 (CET)
Received: from marcansoft.com ([80.68.93.119]:41201 "EHLO smtp.marcansoft.com"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493429AbZLAWX3 (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 1 Dec 2009 23:23:29 +0100
Received: from [192.168.3.171] (141.Red-80-39-252.dynamicIP.rima-tde.net [80.39.252.141])
        (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
        (No client certificate requested)
        by smtp.marcansoft.com (Postfix) with ESMTPSA id 0E12E1E806D;
        Tue,  1 Dec 2009 23:23:19 +0100 (CET)
Message-ID: <4B15974E.1060505@marcansoft.com>
Date:   Tue, 01 Dec 2009 23:23:10 +0100
From:   Hector Martin <hector@marcansoft.com>
User-Agent: Thunderbird 2.0.0.23 (X11/20091005)
MIME-Version: 1.0
To:     Maxime Bizon <mbizon@freebox.fr>,
        Florian Fainelli <florian@openwrt.org>
CC:     linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: BCM63xx merge progress
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Return-Path: <hector@marcansoft.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25257
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: hector@marcansoft.com
Precedence: bulk
X-list: linux-mips

Hello, Maxime and Florian,

I saw that partial BCM63xx support has been merged into mainline. As I
am interested in developing a driver for this platform, I would like to
inquire as to the state of the remaining bits to merge. As it stands
now, the code merged into mainline is rather broken and incomplete.

I'll be happy to grab the code myself and get the patches in proper
merging order for mainline if nobody else is working / has time for it
at the moment, so I'm asking first.

I have a BCM63xx router and will be testing whatever I work on, both
compiling and running. My current reference is the OpenWRT patchset,
which is against an older kernel but seems to be working pretty well on
the actual hardware. I've also seen the linux-bcm63xx.git tree. Between
these I should be able to put together a decent set of commits that
cleanly apply onto current mainline.

Please let me know what your thoughts are, and whether I should proceed
and work on this myself or whether you have other plans.

-- 
Hector Martin (hector@marcansoft.com)
Public Key: http://www.marcansoft.com/marcan.asc


From f.fainelli@gmail.com Wed Dec  2 00:05:15 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 00:05:20 +0100 (CET)
Received: from mail-ew0-f223.google.com ([209.85.219.223]:35280 "EHLO
        mail-ew0-f223.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493350AbZLAXFP convert rfc822-to-8bit
        (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 00:05:15 +0100
Received: by ewy23 with SMTP id 23so2951100ewy.24
        for <multiple recipients>; Tue, 01 Dec 2009 15:05:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:from:reply-to:to
         :subject:date:user-agent:cc:references:in-reply-to:mime-version
         :content-type:content-transfer-encoding:message-id;
        bh=7LlNs2nqT4RE1ESpQ8iuYDgr+4QM6+Bb9ftDmpGnwk8=;
        b=L6ccUC+EFj91K57gUfSplyKFwzHKTxNPpL2OXcHqfIE/1T3Dn7ryVYojWxYXcVXp9f
         tTupMkK98kv+rd+IbttkFif2hh4mMqn+3ftve0fZnPBeaZe5DUTZVV8ON0YSrmOmTUpc
         Cv0YTpEiC2APTSBi453VafQd7mxhttnPbNspY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:from:reply-to:to:subject:date:user-agent:cc:references
         :in-reply-to:mime-version:content-type:content-transfer-encoding
         :message-id;
        b=P7hLvXT6+YEG465KNRlFPnKq+EOo4jIQV76wnaetu/tzwANEa4rLB0nHRI+AyG9eyi
         G8uj6jjlzbF6pQURgvUlu4IBBmPCQfnbRRm+oQWFAktQK6zyy5g3OWySP6LfyBfZM81j
         d15FwnF8vkTrUjrXUXFSLW7ggWlCk7lwesWdo=
Received: by 10.213.103.9 with SMTP id i9mr6845747ebo.16.1259708709359;
        Tue, 01 Dec 2009 15:05:09 -0800 (PST)
Received: from lenovo.localnet (florian.mimichou.net [88.178.11.95])
        by mx.google.com with ESMTPS id 13sm371667ewy.5.2009.12.01.15.05.07
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 01 Dec 2009 15:05:07 -0800 (PST)
From:   Florian Fainelli <florian@openwrt.org>
Reply-To: Florian Fainelli <florian@openwrt.org>
To:     Hector Martin <hector@marcansoft.com>
Subject: Re: BCM63xx merge progress
Date:   Wed, 2 Dec 2009 00:05:06 +0100
User-Agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.2; i686; ; )
Cc:     Maxime Bizon <mbizon@freebox.fr>, linux-mips@linux-mips.org,
        ralf@linux-mips.org
References: <4B15974E.1060505@marcansoft.com>
In-Reply-To: <4B15974E.1060505@marcansoft.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8BIT
Message-Id: <200912020005.07407.florian@openwrt.org>
Return-Path: <f.fainelli@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25258
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: florian@openwrt.org
Precedence: bulk
X-list: linux-mips

Hello Hector,

Le mardi 1 dcembre 2009 23:23:10, Hector Martin a crit :
> Hello, Maxime and Florian,
> 
> I saw that partial BCM63xx support has been merged into mainline. As I
> am interested in developing a driver for this platform, I would like to
> inquire as to the state of the remaining bits to merge. As it stands
> now, the code merged into mainline is rather broken and incomplete.
> 
> I'll be happy to grab the code myself and get the patches in proper
> merging order for mainline if nobody else is working / has time for it
> at the moment, so I'm asking first.

Everything that Maxime sent is, or will be merged either in 2.6.32 or in 
2.6.33, that includes:
- arch/mips/bcm63xx (will be in 2.6.32)
- USB driver bits (2.6.33)
- Ethernet MAC driver bits (2.6.32)
- Ethernet PHY driver bits (2.6.32)
- UART driver (2.6.32)
- PCMCIA support (2.6.32)

> 
> I have a BCM63xx router and will be testing whatever I work on, both
> compiling and running. My current reference is the OpenWRT patchset,
> which is against an older kernel but seems to be working pretty well on
> the actual hardware. I've also seen the linux-bcm63xx.git tree. Between
> these I should be able to put together a decent set of commits that
> cleanly apply onto current mainline.

We maintain a couple of different patches for OpenWrt, specifically the mtd 
partition parser since we provide images, so the box should boot from Flash. 
That driver is not in a mergable state at the moment. There is also a embryon 
of a SPI driver and a watchdog driver, which I will probably submit once 
cleaned up.

> 
> Please let me know what your thoughts are, and whether I should proceed
> and work on this myself or whether you have other plans.
> 

My plans are currently to maintain the bcm63xx board code and drivers in a 
working state for the community, probably not much.
-- 
Best regards, Florian Fainelli
Email: florian@openwrt.org
Web: http://openwrt.org
IRC: [florian] on irc.freenode.net
-------------------------------

From mbizon@freebox.fr Wed Dec  2 00:25:36 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 00:25:40 +0100 (CET)
Received: from smtp6-g21.free.fr ([212.27.42.6]:52349 "EHLO smtp6-g21.free.fr"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493471AbZLAXZg (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 00:25:36 +0100
Received: from smtp6-g21.free.fr (localhost [127.0.0.1])
        by smtp6-g21.free.fr (Postfix) with ESMTP id F3F5CE08073;
        Wed,  2 Dec 2009 00:25:30 +0100 (CET)
Received: from [213.228.1.107] (sakura.staff.proxad.net [213.228.1.107])
        by smtp6-g21.free.fr (Postfix) with ESMTP id 4E4C3E08053;
        Wed,  2 Dec 2009 00:25:27 +0100 (CET)
Subject: Re: BCM63xx merge progress
From:   Maxime Bizon <mbizon@freebox.fr>
Reply-To: mbizon@freebox.fr
To:     Hector Martin <hector@marcansoft.com>
Cc:     Florian Fainelli <florian@openwrt.org>, linux-mips@linux-mips.org,
        ralf@linux-mips.org
In-Reply-To: <4B15974E.1060505@marcansoft.com>
References: <4B15974E.1060505@marcansoft.com>
Content-Type: text/plain; charset="ANSI_X3.4-1968"
Organization: Freebox
Date:   Wed, 02 Dec 2009 00:25:27 +0100
Message-ID: <1259709927.2926.608.camel@sakura.staff.proxad.net>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <mbizon@freebox.fr>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25259
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: mbizon@freebox.fr
Precedence: bulk
X-list: linux-mips


On Tue, 2009-12-01 at 23:23 +0100, Hector Martin wrote:

Hi,

> I saw that partial BCM63xx support has been merged into mainline. As I
> am interested in developing a driver for this platform, I would like
> to inquire as to the state of the remaining bits to merge. As it
> stands now, the code merged into mainline is rather broken and
> incomplete. 

Nice & useful review, thanks ;)

Which part is broken/missing on your side ?

-- 
Maxime



From hector@marcansoft.com Wed Dec  2 01:26:01 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 01:26:05 +0100 (CET)
Received: from marcansoft.com ([80.68.93.119]:47940 "EHLO smtp.marcansoft.com"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493603AbZLBA0B (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 01:26:01 +0100
Received: from [192.168.3.171] (141.Red-80-39-252.dynamicIP.rima-tde.net [80.39.252.141])
        (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
        (No client certificate requested)
        by smtp.marcansoft.com (Postfix) with ESMTPSA id 46ECD1E806D;
        Wed,  2 Dec 2009 01:25:53 +0100 (CET)
Message-ID: <4B15B40D.70006@marcansoft.com>
Date:   Wed, 02 Dec 2009 01:25:49 +0100
From:   Hector Martin <hector@marcansoft.com>
User-Agent: Thunderbird 2.0.0.23 (X11/20091005)
MIME-Version: 1.0
To:     mbizon@freebox.fr, Florian Fainelli <florian@openwrt.org>
CC:     linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: BCM63xx merge progress
References: <4B15974E.1060505@marcansoft.com> <1259709927.2926.608.camel@sakura.staff.proxad.net>
In-Reply-To: <1259709927.2926.608.camel@sakura.staff.proxad.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <hector@marcansoft.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25260
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: hector@marcansoft.com
Precedence: bulk
X-list: linux-mips

Maxime Bizon wrote:
> Which part is broken/missing on your side ?
> 

Well, there's a commit (4059ddb4) that claims to "Add USB OHCI support",
yet it only adds a #include to ohci-hcd.c and a few .h bits. The actual
ohci-bcm63xx.c is missing, which means the OHCI driver probably won't
even compile. It's also missing the relevant platform device stuff in
arch/. This concerned me somewhat, it looked like something weird had
happened and the merge was incomplete.

Florian Fainelli wrote:
> Everything that Maxime sent is, or will be merged either in 2.6.32 or
> in 2.6.33, that includes:
> - arch/mips/bcm63xx (will be in 2.6.32)
> - USB driver bits (2.6.33)
> - Ethernet MAC driver bits (2.6.32)
> - Ethernet PHY driver bits (2.6.32)
> - UART driver (2.6.32)
> - PCMCIA support (2.6.32)

I can see the 2.6.32 stuff already. Regarding USB, is there a repo with
the commit that will be in .33? Otherwise I'll just have to merge it
locally and work from there for the moment. What's up with the weirdo
commit mentioned above?

> We maintain a couple of different patches for OpenWrt, specifically
> the mtd partition parser since we provide images, so the box should
> boot from Flash. That driver is not in a mergable state at the moment.
> There is also a embryon of a SPI driver and a watchdog driver, which I
> will probably submit once cleaned up.

Another tidbit I saw in the OpenWRT set is the reset button GPIO
support. I want to have that (eventually) too.

Basically, my dilemma is simply that I want to work off of mainline
(especially since stuff has been partially merged already and changes
have been made), yet I need the missing patches in order to make this
work completely. So eventually I need a tree that contains everything I
need, whether a few individual commits are not really ready for mainline
or not. In doing this, I obviously want to keep in sync with any work
that has been done already as much as possible. So please do tell if
there's a specific place I should be looking at for mainline-compatible
versions of these patches, or anything closer to what will eventually be
merged. As I said, I don't mind doing the merges myself, but then it
might make rebasing onto mainline harder if your official patches are
merged in a substantially different way once they do make it to
mainline. And if I do end up merging stuff, I might as well send it to
you to save you some time.

-- 
Hector Martin (hector@marcansoft.com)
Public Key: http://www.marcansoft.com/marcan.asc


From mbizon@freebox.fr Wed Dec  2 02:57:46 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 02:57:49 +0100 (CET)
Received: from smtp6-g21.free.fr ([212.27.42.6]:38826 "EHLO smtp6-g21.free.fr"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493649AbZLBB5q (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 02:57:46 +0100
Received: from smtp6-g21.free.fr (localhost [127.0.0.1])
        by smtp6-g21.free.fr (Postfix) with ESMTP id E4109E08033;
        Wed,  2 Dec 2009 02:57:37 +0100 (CET)
Received: from [127.0.0.1] (sakura.staff.proxad.net [213.228.1.107])
        by smtp6-g21.free.fr (Postfix) with ESMTP id A5D84E08030;
        Wed,  2 Dec 2009 02:57:33 +0100 (CET)
Subject: Re: BCM63xx merge progress
From:   Maxime Bizon <mbizon@freebox.fr>
Reply-To: mbizon@freebox.fr
To:     Hector Martin <hector@marcansoft.com>
Cc:     Florian Fainelli <florian@openwrt.org>, linux-mips@linux-mips.org,
        ralf@linux-mips.org
In-Reply-To: <4B15B40D.70006@marcansoft.com>
References: <4B15974E.1060505@marcansoft.com>
         <1259709927.2926.608.camel@sakura.staff.proxad.net>
         <4B15B40D.70006@marcansoft.com>
Content-Type: text/plain; charset="UTF-8"
Date:   Wed, 02 Dec 2009 02:57:32 +0100
Message-ID: <1259719052.2452.26.camel@kero>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <mbizon@freebox.fr>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25261
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: mbizon@freebox.fr
Precedence: bulk
X-list: linux-mips


On Wed, 2009-12-02 at 01:25 +0100, Hector Martin wrote:

> Well, there's a commit (4059ddb4) that claims to "Add USB OHCI support",
> yet it only adds a #include to ohci-hcd.c and a few .h bits. The actual
> ohci-bcm63xx.c is missing, which means the OHCI driver probably won't
> even compile. It's also missing the relevant platform device stuff in

I cannot find this commit in linus' tree nor linux-mips master, where
does it come from ?

The remaining two patches that were not merged in 2.6.32 are on top of
this tree: http://www.linux-mips.org/git?p=linux-bcm63xx.git

They should apply with little difficulty on current upstream kernel and
besides the *_be stuffs that need to be cleaned up, they were ACKed by
the usb maintainer.

-- 
Maxime


From macro@linux-mips.org Wed Dec  2 02:58:23 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 02:58:28 +0100 (CET)
Received: from localhost.localdomain ([127.0.0.1]:38039 "EHLO
        localhost.localdomain" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493657AbZLBB6X (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 02:58:23 +0100
Date:   Wed, 2 Dec 2009 01:58:23 +0000 (GMT)
From:   "Maciej W. Rozycki" <macro@linux-mips.org>
To:     Ingo Molnar <mingo@elte.hu>
cc:     Ralf Baechle <ralf@linux-mips.org>,
        Sergei Shtylyov <sshtylyov@ru.mvista.com>,
        Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        Thomas Gleixner <tglx@linutronix.de>,
        Michal Simek <monstr@monstr.eu>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] MIPS: Add a high resolution sched_clock() via
 cnt32_to_63().
In-Reply-To: <20091123084241.GA23635@elte.hu>
Message-ID: <alpine.LFD.2.00.0912020148200.23935@eddie.linux-mips.org>
References: <dae45f23b5d34f64fc60a445015e7dfe05aa0d07.1258875717.git.wuzhangjin@gmail.com> <20091122081328.GB24558@elte.hu> <4B0925BD.6070507@ru.mvista.com> <20091122180616.GB24711@elte.hu> <20091122202314.GB1941@linux-mips.org>
 <20091123084241.GA23635@elte.hu>
User-Agent: Alpine 2.00 (LFD 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25262
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, 23 Nov 2009, Ingo Molnar wrote:

> > > >   MIPS's is not really a proper English. :-)
> > > 
> > > AFAIK 'MIPS' is not the plural of 'MIP' (but an acronym ending with 
> > > 'S'), hence the possessive form would be MIPS's.
> > 
> > MIPS Technologies' IP lawyers insist that MIPS is a proper name and 
> > not an acronym - this position has certain advantages in trademark 
> > law.
> 
> That too seems to support my point that "MIPS's" is the right spelling.

 My understanding is that "MIPS" is actually meant (as far as IP law is 
concerned) to be an adjective, so you can't really make a possessive form 
out of it as it is irrelevant.  The correct form IMHO is thus simply: 
"MIPS sched_clock implementation" which happens to sound the best to me 
too.

  Maciej

From hector@marcansoft.com Wed Dec  2 03:46:13 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 03:46:17 +0100 (CET)
Received: from marcansoft.com ([80.68.93.119]:34765 "EHLO smtp.marcansoft.com"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493689AbZLBCqN (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 03:46:13 +0100
Received: from [192.168.3.171] (141.Red-80-39-252.dynamicIP.rima-tde.net [80.39.252.141])
        (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
        (No client certificate requested)
        by smtp.marcansoft.com (Postfix) with ESMTPSA id A06A11E806D;
        Wed,  2 Dec 2009 03:46:05 +0100 (CET)
Message-ID: <4B15D4E7.6060707@marcansoft.com>
Date:   Wed, 02 Dec 2009 03:45:59 +0100
From:   Hector Martin <hector@marcansoft.com>
User-Agent: Thunderbird 2.0.0.23 (X11/20091005)
MIME-Version: 1.0
To:     mbizon@freebox.fr
CC:     Florian Fainelli <florian@openwrt.org>, linux-mips@linux-mips.org,
        ralf@linux-mips.org
Subject: Re: BCM63xx merge progress
References: <4B15974E.1060505@marcansoft.com>    <1259709927.2926.608.camel@sakura.staff.proxad.net>     <4B15B40D.70006@marcansoft.com> <1259719052.2452.26.camel@kero>
In-Reply-To: <1259719052.2452.26.camel@kero>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Return-Path: <hector@marcansoft.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25263
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: hector@marcansoft.com
Precedence: bulk
X-list: linux-mips

Maxime Bizon wrote:
> On Wed, 2009-12-02 at 01:25 +0100, Hector Martin wrote:
> 
>> Well, there's a commit (4059ddb4) that claims to "Add USB OHCI support",
>> yet it only adds a #include to ohci-hcd.c and a few .h bits. The actual
>> ohci-bcm63xx.c is missing, which means the OHCI driver probably won't
>> even compile. It's also missing the relevant platform device stuff in
> 
> I cannot find this commit in linus' tree nor linux-mips master, where
> does it come from ?

Okay, nevermind, that was a screwup by me. At some point one of my
OpenWRT patch test commits made its way onto the wrong local branch, and
I didn't notice where it lived. Oops. (This commit was meant to be
incomplete, it comes straight from the OpenWRT patch). I think I found
the mips-bcm63xx (proper) patch, tried to search for it on my local
repo, and this thing popped up and I didn't look at it closely enough.
This is what I get for trying to work at 4am.

I take back the 'broken' then, we're just left with 'incomplete'. Makes
quite a bit more sense now, sorry for the confusion.

> The remaining two patches that were not merged in 2.6.32 are on top of
> this tree: http://www.linux-mips.org/git?p=linux-bcm63xx.git
> 
> They should apply with little difficulty on current upstream kernel and
> besides the *_be stuffs that need to be cleaned up, they were ACKed by
> the usb maintainer.

Cool, I'll see about applying them and working off of that. Thanks for
the confirmation.

FWIW, I'm trying to reverse engineer Broadcom's DSL driver, which I hope
will be useful so we can finally have a properly working OpenWRT
firmware for DSL routers based on this firmware.

-- 
Hector Martin (hector@marcansoft.com)
Public Key: http://www.marcansoft.com/marcan.asc


From f.fainelli@gmail.com Wed Dec  2 11:14:55 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 11:14:59 +0100 (CET)
Received: from mail-ew0-f212.google.com ([209.85.219.212]:43417 "EHLO
        mail-ew0-f212.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492414AbZLBKOz (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 11:14:55 +0100
Received: by ewy4 with SMTP id 4so39385ewy.27
        for <multiple recipients>; Wed, 02 Dec 2009 02:14:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:from:organization:to
         :subject:date:user-agent:cc:references:in-reply-to:mime-version
         :content-type:content-transfer-encoding:message-id;
        bh=gKG1ke0R22escYcGihul1c51Gg5SMIDL/g7XLYErLuk=;
        b=ApkLef2XNL6zM5PvF4kezq/b/vOSiQ1BZ3vxYu6BUEMz5u9KsJzQbAoLRYMpxG5C12
         vz6oluJxNMeBhpqvjktTpFUwefg0701QxiwSrZQuMrYD1a93Auv5OlpLhLdvVtAwsHWf
         Mqcge7NxYy0I24j89cVKdEXUfW6EgDuFKR3EM=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:from:organization:to:subject:date:user-agent:cc:references
         :in-reply-to:mime-version:content-type:content-transfer-encoding
         :message-id;
        b=TCTs+bKvmZGLtnBvJZF5yW2r3XdNjhNpawpJp4PWX77jFHsIYE+YLh1pCrUvc/Vvz/
         LrflDCZH4Ho3tRoOL3/om+rRx6GlBOSU+x6qnvgf/y7n+ZJjHpWd3Iddfhe9lR/s4HfV
         Gso7A6kUpi2e5eVtOIzorgL7BPjZLn05JrZuY=
Received: by 10.213.102.138 with SMTP id g10mr4287683ebo.19.1259748887726;
        Wed, 02 Dec 2009 02:14:47 -0800 (PST)
Received: from flexo.localnet (bobafett.staff.proxad.net [213.228.1.121])
        by mx.google.com with ESMTPS id 13sm639809ewy.5.2009.12.02.02.14.46
        (version=SSLv3 cipher=RC4-MD5);
        Wed, 02 Dec 2009 02:14:46 -0800 (PST)
From:   Florian Fainelli <florian@openwrt.org>
Organization: OpenWrt
To:     Hector Martin <hector@marcansoft.com>
Subject: Re: BCM63xx merge progress
Date:   Wed, 2 Dec 2009 11:14:21 +0100
User-Agent: KMail/1.12.2 (Linux/2.6.31-15-server; KDE/4.3.2; x86_64; ; )
Cc:     mbizon@freebox.fr, linux-mips@linux-mips.org, ralf@linux-mips.org
References: <4B15974E.1060505@marcansoft.com> <1259709927.2926.608.camel@sakura.staff.proxad.net> <4B15B40D.70006@marcansoft.com>
In-Reply-To: <4B15B40D.70006@marcansoft.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200912021114.22028.florian@openwrt.org>
Return-Path: <f.fainelli@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25264
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: florian@openwrt.org
Precedence: bulk
X-list: linux-mips

On Wednesday 02 December 2009 01:25:49 Hector Martin wrote:
> Maxime Bizon wrote:
> > Which part is broken/missing on your side ?
> 
> Well, there's a commit (4059ddb4) that claims to "Add USB OHCI support",
> yet it only adds a #include to ohci-hcd.c and a few .h bits. The actual
> ohci-bcm63xx.c is missing, which means the OHCI driver probably won't
> even compile. It's also missing the relevant platform device stuff in
> arch/. This concerned me somewhat, it looked like something weird had
> happened and the merge was incomplete.
> 
> Florian Fainelli wrote:
> > Everything that Maxime sent is, or will be merged either in 2.6.32 or
> > in 2.6.33, that includes:
> > - arch/mips/bcm63xx (will be in 2.6.32)
> > - USB driver bits (2.6.33)
> > - Ethernet MAC driver bits (2.6.32)
> > - Ethernet PHY driver bits (2.6.32)
> > - UART driver (2.6.32)
> > - PCMCIA support (2.6.32)
> 
> I can see the 2.6.32 stuff already. Regarding USB, is there a repo with
> the commit that will be in .33? Otherwise I'll just have to merge it
> locally and work from there for the moment. What's up with the weirdo
> commit mentioned above?
> 
> > We maintain a couple of different patches for OpenWrt, specifically
> > the mtd partition parser since we provide images, so the box should
> > boot from Flash. That driver is not in a mergable state at the moment.
> > There is also a embryon of a SPI driver and a watchdog driver, which I
> > will probably submit once cleaned up.
> 
> Another tidbit I saw in the OpenWRT set is the reset button GPIO
> support. I want to have that (eventually) too.

The gpio-buttons driver that we use in OpenWrt to do that is not that perfect 
and handling reset and other buttons is a distribution side problem since not 
evryone wants to map a button to a functionnality.

> 
> Basically, my dilemma is simply that I want to work off of mainline
> (especially since stuff has been partially merged already and changes
> have been made), yet I need the missing patches in order to make this
> work completely. So eventually I need a tree that contains everything I
> need, whether a few individual commits are not really ready for mainline
> or not. In doing this, I obviously want to keep in sync with any work
> that has been done already as much as possible. So please do tell if
> there's a specific place I should be looking at for mainline-compatible
> versions of these patches, or anything closer to what will eventually be
> merged. As I said, I don't mind doing the merges myself, but then it
> might make rebasing onto mainline harder if your official patches are
> merged in a substantially different way once they do make it to
> mainline. And if I do end up merging stuff, I might as well send it to
> you to save you some time.

2.6.33-rc will have the remaining bits, so if you should start working with 
something, better wait a for couple of days. Depending on what you are 
planning to work on, you really do not need to have everything merged.
-- 
WBR, Florian

From f.fainelli@gmail.com Wed Dec  2 11:16:33 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 11:16:36 +0100 (CET)
Received: from mail-ew0-f212.google.com ([209.85.219.212]:60441 "EHLO
        mail-ew0-f212.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492418AbZLBKQc (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 11:16:32 +0100
Received: by ewy4 with SMTP id 4so40969ewy.27
        for <multiple recipients>; Wed, 02 Dec 2009 02:16:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:from:organization:to
         :subject:date:user-agent:cc:references:in-reply-to:mime-version
         :content-type:content-transfer-encoding:message-id;
        bh=GDhhUFKbqkFHMdOOjUO9tS7mpIKErGDBxzCpKvRAKRQ=;
        b=noC7DjrnAD1A5byE7JmuM8RGzoGGSd6sqrBDivV4n0R1Zn4r9N/8rLWwR+5Q9akYT5
         vACnE0USrq6hEzVnMeTFaFMrHGkFErJmTjguczUQpmmKih1pBk+C4V0jFTrDpP+kcc1p
         PJcj/mMENh7Hlky0dBmaKiDby35wMWUziT7+k=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:from:organization:to:subject:date:user-agent:cc:references
         :in-reply-to:mime-version:content-type:content-transfer-encoding
         :message-id;
        b=JlMAJAxgeK4NZ5cC+kbaJsk+I5zSlcaB/q5Hnin8OHM529P2Ll1RHbqx2WblQIPi3i
         JWP3keSYc/1EHI19R4+N5+sKlix+7De7opMei6d0c3jyv32QPwjIBwRwlBBGBCnCJVMk
         C0BOPJE9ydfd6bthAbz5nM3eIzdcGW6BGlO88=
Received: by 10.213.107.16 with SMTP id z16mr7484580ebo.47.1259748987090;
        Wed, 02 Dec 2009 02:16:27 -0800 (PST)
Received: from flexo.localnet (bobafett.staff.proxad.net [213.228.1.121])
        by mx.google.com with ESMTPS id 13sm639574ewy.1.2009.12.02.02.16.25
        (version=SSLv3 cipher=RC4-MD5);
        Wed, 02 Dec 2009 02:16:26 -0800 (PST)
From:   Florian Fainelli <florian@openwrt.org>
Organization: OpenWrt
To:     Hector Martin <hector@marcansoft.com>
Subject: Re: BCM63xx merge progress
Date:   Wed, 2 Dec 2009 11:16:01 +0100
User-Agent: KMail/1.12.2 (Linux/2.6.31-15-server; KDE/4.3.2; x86_64; ; )
Cc:     mbizon@freebox.fr, linux-mips@linux-mips.org, ralf@linux-mips.org
References: <4B15974E.1060505@marcansoft.com> <1259719052.2452.26.camel@kero> <4B15D4E7.6060707@marcansoft.com>
In-Reply-To: <4B15D4E7.6060707@marcansoft.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <200912021116.01290.florian@openwrt.org>
Return-Path: <f.fainelli@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25265
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: florian@openwrt.org
Precedence: bulk
X-list: linux-mips

On Wednesday 02 December 2009 03:45:59 Hector Martin wrote:
> Maxime Bizon wrote:
> > On Wed, 2009-12-02 at 01:25 +0100, Hector Martin wrote:
> >> Well, there's a commit (4059ddb4) that claims to "Add USB OHCI support",
> >> yet it only adds a #include to ohci-hcd.c and a few .h bits. The actual
> >> ohci-bcm63xx.c is missing, which means the OHCI driver probably won't
> >> even compile. It's also missing the relevant platform device stuff in
> >
> > I cannot find this commit in linus' tree nor linux-mips master, where
> > does it come from ?
> 
> Okay, nevermind, that was a screwup by me. At some point one of my
> OpenWRT patch test commits made its way onto the wrong local branch, and
> I didn't notice where it lived. Oops. (This commit was meant to be
> incomplete, it comes straight from the OpenWRT patch). I think I found
> the mips-bcm63xx (proper) patch, tried to search for it on my local
> repo, and this thing popped up and I didn't look at it closely enough.
> This is what I get for trying to work at 4am.
> 
> I take back the 'broken' then, we're just left with 'incomplete'. Makes
> quite a bit more sense now, sorry for the confusion.
> 
> > The remaining two patches that were not merged in 2.6.32 are on top of
> > this tree: http://www.linux-mips.org/git?p=linux-bcm63xx.git
> >
> > They should apply with little difficulty on current upstream kernel and
> > besides the *_be stuffs that need to be cleaned up, they were ACKed by
> > the usb maintainer.
> 
> Cool, I'll see about applying them and working off of that. Thanks for
> the confirmation.
> 
> FWIW, I'm trying to reverse engineer Broadcom's DSL driver, which I hope
> will be useful so we can finally have a properly working OpenWRT
> firmware for DSL routers based on this firmware.

Good luck :)
-- 
WBR, Florian

From wuzhangjin@gmail.com Wed Dec  2 10:43:36 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 11:54:17 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:54954 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492297AbZLBJng (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 10:43:36 +0100
Received: by pxi6 with SMTP id 6so19680pxi.0
        for <multiple recipients>; Wed, 02 Dec 2009 01:43:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=/dFU7o7IW9jD7R+RUbEEXoUN1R26RqHlDSkmPSYKG2U=;
        b=OXHBhnW9bKiGgjuTEPCtO7shHmC3jfhkWdMvJ8/i0K7BZzoaN9z8nXVcamQnRXSIqd
         a6C3BnCqGABl85cqZm1o86hO8dDoYjwfhmLyx/LqjGRTpEAtD2nWTKfunZ9Xc/fFUfFQ
         a5ml8QC/NHbEO8z/OZXZgHliMgHyFs4sVI68c=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=uHsjj/D63ihVEhDJ+IBqKv4DmEShfHyG6YwM9kkRQc51vI1ke4ce3YExgv6mXJ2Jsx
         1CFTAZpLUzhE+lyIVlyVeP8J2tKAv1lvqGXpGfUoWFwQA3/UWeYwOzT6JxaH1OBc3gbe
         L4dbf/k4yUzyfN/eXzCBDOcJsnGDvUSnb2bKw=
Received: by 10.115.98.40 with SMTP id a40mr1749547wam.97.1259747006938;
        Wed, 02 Dec 2009 01:43:26 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm721931pzk.8.2009.12.02.01.43.20
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Wed, 02 Dec 2009 01:43:25 -0800 (PST)
Subject: Re: [PATCH v6 8/8] Loongson: YeeLoong: add hotkey driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org,
        zhangfx@lemote.com
In-Reply-To: <20091201180350.GB19259@core.coreip.homeip.net>
References: <cover.1259664573.git.wuzhangjin@gmail.com>
         <939c1425f653e3bda05799345c53198dfd2c1dcc.1259664573.git.wuzhangjin@gmail.com>
         <20091201154050.GJ14064@linux-mips.org>
         <20091201180350.GB19259@core.coreip.homeip.net>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Wed, 02 Dec 2009 17:43:00 +0800
Message-ID: <1259746980.7254.29.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25266
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-01 at 10:03 -0800, Dmitry Torokhov wrote: 
> On Tue, Dec 01, 2009 at 03:40:50PM +0000, Ralf Baechle wrote:
> > On Tue, Dec 01, 2009 at 07:12:37PM +0800, Wu Zhangin wrote:
> > 
> > > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > > 
> > > This patch adds Hotkey Driver, which will do relative actions for The
> > > hotkey event and report the corresponding input keys to the user-space
> > > applications.
> > 
> > This one also should become a platform driver.  And is probably a
> > candidate for drivers/input/keyboard.
> > 
> 
> Umm, it still mixes up bunch of stuff not directly related to input. I'd
> vote for drivers/platform/mips (since we have a few of kitchen-sink
> style drivers for x86-based laptops in drivers/platform/x86).
> 

Hello,

Do you mean we go back to drivers/platform/mips/yeeloong_laptop.c? (or
split the input stuff into yeeloong_input.c)

For considering the next platform support of LynLoong PC and the future
other MIPS netbooks/PC(e.g. gdium), perhaps drivers/platform/mips is
really the good place to put them in. and benefit from it, we maybe
easier to share the functions, variables. of course, the problem about
the API modification will also be there:

"Experience has shown that drivers for a particular subsystem are best
combined in a single menu, in a single directory.  Otherwise any changes
to subsystem's internal APIs will become a major pain.  Which in the end
means arch/ is usually the place for drivers that don't fit into any
established cathegory." -- Ralf

Best Regards,
	Wu Zhangjin


From ralf@linux-mips.org Wed Dec  2 12:38:59 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 12:39:02 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:55998 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492497AbZLBLi7 (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 12:38:59 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2BcvSM001880
        for <linux-mips@linux-mips.org>; Wed, 2 Dec 2009 11:38:57 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2BcuCQ001821
        for linux-mips@linux-mips.org; Wed, 2 Dec 2009 11:38:56 GMT
Date:   Wed, 2 Dec 2009 11:38:55 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     linux-mips@linux-mips.org
Subject: [PATCH] MIPS: Fix MIPS I build.
Message-ID: <20091202113855.GA32256@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25267
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

Broken by d63c63e889bbeeaa461a8addf1245f89f3ce4ece (lmo) rsp.
f1e39a4a616cd9981a9decfd5332fd07a01abb8b (kernel.org).

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 3fe1fcf..fe0d798 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -306,6 +306,7 @@ static inline int mips_atomic_set(struct pt_regs *regs,
 
 	if (cpu_has_llsc && R10000_LLSC_WAR) {
 		__asm__ __volatile__ (
+		"	.set	mips3					\n"
 		"	li	%[err], 0				\n"
 		"1:	ll	%[old], (%[addr])			\n"
 		"	move	%[tmp], %[new]				\n"
@@ -320,6 +321,7 @@ static inline int mips_atomic_set(struct pt_regs *regs,
 		"	"STR(PTR)"	1b, 4b				\n"
 		"	"STR(PTR)"	2b, 4b				\n"
 		"	.previous					\n"
+		"	.set	mips0					\n"
 		: [old] "=&r" (old),
 		  [err] "=&r" (err),
 		  [tmp] "=&r" (tmp)
@@ -329,6 +331,7 @@ static inline int mips_atomic_set(struct pt_regs *regs,
 		: "memory");
 	} else if (cpu_has_llsc) {
 		__asm__ __volatile__ (
+		"	.set	mips3					\n"
 		"	li	%[err], 0				\n"
 		"1:	ll	%[old], (%[addr])			\n"
 		"	move	%[tmp], %[new]				\n"
@@ -347,6 +350,7 @@ static inline int mips_atomic_set(struct pt_regs *regs,
 		"	"STR(PTR)"	1b, 5b				\n"
 		"	"STR(PTR)"	2b, 5b				\n"
 		"	.previous					\n"
+		"	.set	mips0					\n"
 		: [old] "=&r" (old),
 		  [err] "=&r" (err),
 		  [tmp] "=&r" (tmp)

From Ales.Mulej@HSTX.com Wed Dec  2 12:15:19 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 12:56:57 +0100 (CET)
Received: from mail.hstx.com ([64.95.133.106]:9615 "EHLO mail.hstx.com"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492435AbZLBLPT (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 12:15:19 +0100
Received: from edgecaus01.caus.global.vpn ([10.10.0.28]) by mail.hstx.com with Microsoft SMTPSVC(6.0.3790.3959);
         Wed, 2 Dec 2009 03:15:11 -0800
Received: from exchtxuk2.HSTX.global.vpn ([10.11.65.54]) by edgecaus01.caus.global.vpn with Microsoft SMTPSVC(6.0.3790.3959);
         Wed, 2 Dec 2009 03:15:11 -0800
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----_=_NextPart_001_01CA7340.B5457A50"
Subject: Reserved instruction in kernel code
Date:   Wed, 2 Dec 2009 11:15:06 -0000
Message-ID: <C5BD21D6E1A3114C8765C8FBBD0087BA330A85@exchtxuk2.HSTX.global.vpn>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Reserved instruction in kernel code
Thread-Index: AcpzQLP1sZJGDFhmS7mG82KGzLMtSw==
From:   "Ales Mulej" <Ales.Mulej@HSTX.com>
To:     <linux-mips@linux-mips.org>
X-OriginalArrivalTime: 02 Dec 2009 11:15:11.0878 (UTC) FILETIME=[B6FF8260:01CA7340]
Return-Path: <Ales.Mulej@HSTX.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25268
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: Ales.Mulej@HSTX.com
Precedence: bulk
X-list: linux-mips

This is a multi-part message in MIME format.

------_=_NextPart_001_01CA7340.B5457A50
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

I'm porting linux(2.6.31.6) to the Wintegra WINHDP2 refrence board.

As a refrence I already have an old BSP from Wintegra based on kernel
2.6.10.

=20

During the kernel start up process I receive following error:

=20

Reserved instruction in kernel code[#1]:

Cpu 0

$ 0   : 00000000 1000fc00 802be630 00000001

$ 4   : 802be670 802be674 ffffffff 802f4d4c

$ 8   : 1000fc01 1000001f 00000001 0000002b

$12   : 00000000 000001f5 07a0d380 00000000

$16   : 00000000 00000000 00000000 1000fc00

$20   : 802e9674 bd030f04 3e490000 00000a72

$24   : 00000008 8000167c                 =20

$28   : 802ba000 802bbd30 ffffffff 802f4d4c

Hi    : 000000fb

Lo    : 00000001

epc   : 801013a0 handle_ri_int+0x18/0x38

    Not tainted

ra    : 802f4d4c __log_buf+0x0/0x20000

Status: 1000fc03    KERNEL EXL IE=20

Cause : 50808000

PrId  : 00019365 (MIPS 24Kc)

Modules linked in:

Process swapper (pid: 0, threadinfo=3D802ba000, task=3D802bc000,
tls=3D00000000)

Stack : 1000fc00 1000001f 00000001 0000002b 00000000 000001f5 00000000
1000fc00

        802be630 00000001 802be670 802be674 ffffffff 802f4d4c 1000fc00
1000001f

        00000001 0000002b 00000000 000001f5 07a0d380 00000000 00000000
00000000

        00000000 1000fc00 802e9674 bd030f04 3e490000 00000a72 00000008
8000167c

        802bbe94 802a2954 802ba000 802bbde0 ffffffff 802f4d4c 1000fc02
000000fb

        ...

Call Trace:

[<801013a0>] handle_ri_int+0x18/0x38

=20

=20

Code: 01094025  3908001e  40886000 <00000040> 00000040  00000040
000000c0  03a02021  3c1f8010=20

Disabling lock debugging due to kernel taint

Kernel panic - not syncing: Attempted to kill the idle task!

=20

=20

Does anybody know where is the problem?

I suspect, that the problem is in my interrupt routine, because I
receive this error as soon as the tick timer start's up.

=20

Regards,

Ales

=20

=20

=20


------_=_NextPart_001_01CA7340.B5457A50
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DSL link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal>Hi,<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>I'm porting linux(2.6.31.6) to the Wintegra WINHDP2 =
refrence
board.<o:p></o:p></p>

<p class=3DMsoNormal>As a refrence I already have an old BSP from =
Wintegra based
on kernel 2.6.10.<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>During the kernel start up process I receive =
following
error:<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Reserved instruction in kernel =
code[#1]:<o:p></o:p></p>

<p class=3DMsoNormal>Cpu 0<o:p></o:p></p>

<p class=3DMsoNormal>$ 0&nbsp;&nbsp; : 00000000 1000fc00 802be630 =
00000001<o:p></o:p></p>

<p class=3DMsoNormal>$ 4&nbsp;&nbsp; : 802be670 802be674 ffffffff =
802f4d4c<o:p></o:p></p>

<p class=3DMsoNormal>$ 8&nbsp;&nbsp; : 1000fc01 1000001f 00000001 =
0000002b<o:p></o:p></p>

<p class=3DMsoNormal>$12&nbsp;&nbsp; : 00000000 000001f5 07a0d380 =
00000000<o:p></o:p></p>

<p class=3DMsoNormal>$16&nbsp;&nbsp; : 00000000 00000000 00000000 =
1000fc00<o:p></o:p></p>

<p class=3DMsoNormal>$20&nbsp;&nbsp; : 802e9674 bd030f04 3e490000 =
00000a72<o:p></o:p></p>

<p class=3DMsoNormal>$24&nbsp;&nbsp; : 00000008
8000167c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></p>

<p class=3DMsoNormal>$28&nbsp;&nbsp; : 802ba000 802bbd30 ffffffff =
802f4d4c<o:p></o:p></p>

<p class=3DMsoNormal>Hi&nbsp;&nbsp;&nbsp; : 000000fb<o:p></o:p></p>

<p class=3DMsoNormal>Lo&nbsp;&nbsp;&nbsp; : 00000001<o:p></o:p></p>

<p class=3DMsoNormal>epc&nbsp;&nbsp; : 801013a0 =
handle_ri_int+0x18/0x38<o:p></o:p></p>

<p class=3DMsoNormal>&nbsp;&nbsp;&nbsp; Not tainted<o:p></o:p></p>

<p class=3DMsoNormal>ra&nbsp;&nbsp;&nbsp; : 802f4d4c =
__log_buf+0x0/0x20000<o:p></o:p></p>

<p class=3DMsoNormal>Status: 1000fc03&nbsp;&nbsp;&nbsp; KERNEL EXL IE =
<o:p></o:p></p>

<p class=3DMsoNormal>Cause : 50808000<o:p></o:p></p>

<p class=3DMsoNormal>PrId&nbsp; : 00019365 (MIPS 24Kc)<o:p></o:p></p>

<p class=3DMsoNormal>Modules linked in:<o:p></o:p></p>

<p class=3DMsoNormal>Process swapper (pid: 0, threadinfo=3D802ba000, =
task=3D802bc000,
tls=3D00000000)<o:p></o:p></p>

<p class=3DMsoNormal>Stack : 1000fc00 1000001f 00000001 0000002b =
00000000
000001f5 00000000 1000fc00<o:p></o:p></p>

<p class=3DMsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 802be630 =
00000001
802be670 802be674 ffffffff 802f4d4c 1000fc00 1000001f<o:p></o:p></p>

<p class=3DMsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00000001 =
0000002b
00000000 000001f5 07a0d380 00000000 00000000 00000000<o:p></o:p></p>

<p class=3DMsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00000000 =
1000fc00
802e9674 bd030f04 3e490000 00000a72 00000008 8000167c<o:p></o:p></p>

<p class=3DMsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 802bbe94 =
802a2954
802ba000 802bbde0 ffffffff 802f4d4c 1000fc02 000000fb<o:p></o:p></p>

<p class=3DMsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
...<o:p></o:p></p>

<p class=3DMsoNormal>Call Trace:<o:p></o:p></p>

<p class=3DMsoNormal>[&lt;801013a0&gt;] =
handle_ri_int+0x18/0x38<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Code: 01094025&nbsp; 3908001e&nbsp; 40886000
&lt;00000040&gt; 00000040&nbsp; 00000040&nbsp; 000000c0&nbsp; =
03a02021&nbsp;
3c1f8010 <o:p></o:p></p>

<p class=3DMsoNormal>Disabling lock debugging due to kernel =
taint<o:p></o:p></p>

<p class=3DMsoNormal>Kernel panic - not syncing: Attempted to kill the =
idle task!<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Does anybody know where is the =
problem?<o:p></o:p></p>

<p class=3DMsoNormal>I suspect, that the problem is in my interrupt =
routine,
because I receive this error as soon as the tick timer start's =
up.<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Regards,<o:p></o:p></p>

<p class=3DMsoNormal>Ales<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>

------_=_NextPart_001_01CA7340.B5457A50--

From f.fainelli@gmail.com Wed Dec  2 13:07:28 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 13:07:31 +0100 (CET)
Received: from ey-out-1920.google.com ([74.125.78.149]:42939 "EHLO
        ey-out-1920.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492553AbZLBMH2 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 13:07:28 +0100
Received: by ey-out-1920.google.com with SMTP id 5so33480eyb.52
        for <multiple recipients>; Wed, 02 Dec 2009 04:07:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:from:date:subject
         :mime-version:x-uid:x-length:organization:to:cc:content-type
         :content-transfer-encoding:message-id;
        bh=anD/4BEIJvCegGY/KvZ9kxxPT7V+iTVEO5UShj60ILM=;
        b=nfiaA19kbpmwfdUs5ItmDERRZXjKKeU+q8KU8gPy4ju3GKHUEdJ12gvPjN4cHQJvtf
         QpK+4fsk64e2neua2hVOiqe2Ohg3XjTOh84rZxROP2a7g2gSsbmNCpd/N7QEecK8MiVu
         89ntscLqB0Q+zTJQhTAM7C2JSgCLgJqV06X8w=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:from:date:subject:mime-version:x-uid:x-length:organization
         :to:cc:content-type:content-transfer-encoding:message-id;
        b=RG5icN8ESZoqV2GayemgPlNtYhnG7nXREcEaulYSeYduKHrW3vtcmwxQQkNTTRo3I+
         kbWDM84LIQnkDzrt6V87VmQfbI03d6mY6WmuNmbb1TGfDmxFtEoPmldvMhVtvcFfSztZ
         w8+4/DYdfjVNsbjUdIuf6OsZQEfZ2eF6yg7o4=
Received: by 10.213.79.84 with SMTP id o20mr6920596ebk.62.1259755646074;
        Wed, 02 Dec 2009 04:07:26 -0800 (PST)
Received: from flexo.localnet (bobafett.staff.proxad.net [213.228.1.121])
        by mx.google.com with ESMTPS id 13sm692902ewy.1.2009.12.02.04.07.25
        (version=SSLv3 cipher=RC4-MD5);
        Wed, 02 Dec 2009 04:07:25 -0800 (PST)
From:   Florian Fainelli <florian@openwrt.org>
Date:   Wed, 2 Dec 2009 13:07:01 +0100
Subject: [PATCH] rb532: fix devices.c compilation
MIME-Version: 1.0
X-UID:  150
X-Length: 1609
Organization: OpenWrt
To:     linux-mips@linux-mips.org
Cc:     ralf@linux-mips.org
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <200912021307.02014.florian@openwrt.org>
Return-Path: <f.fainelli@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25269
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: florian@openwrt.org
Precedence: bulk
X-list: linux-mips

We should now use dev_set_drvdata to set the driver
driver_data field.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 9f40e1f..041fc1a 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -110,7 +110,6 @@ static struct korina_device korina_dev0_data = {
 static struct platform_device korina_dev0 = {
 	.id = -1,
 	.name = "korina",
-	.dev.driver_data = &korina_dev0_data,
 	.resource = korina_dev0_res,
 	.num_resources = ARRAY_SIZE(korina_dev0_res),
 };
@@ -332,6 +331,8 @@ static int __init plat_setup_devices(void)
 	/* set the uart clock to the current cpu frequency */
 	rb532_uart_res[0].uartclk = idt_cpu_freq;
 
+	dev_set_drvdata(&korina_dev0.dev, &korina_dev0_data);
+
 	return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));
 }
 

From f.fainelli@gmail.com Wed Dec  2 13:22:04 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 13:22:08 +0100 (CET)
Received: from mail-ew0-f223.google.com ([209.85.219.223]:58589 "EHLO
        mail-ew0-f223.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492337AbZLBMWE (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 13:22:04 +0100
Received: by ewy23 with SMTP id 23so153795ewy.24
        for <multiple recipients>; Wed, 02 Dec 2009 04:21:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:from:date:subject
         :mime-version:x-uid:x-length:organization:to:cc:content-type
         :content-transfer-encoding:message-id;
        bh=2GzoOAe2WUrdb5yI4ZrvyskojHq0XXoMX3q7VnT0UY4=;
        b=wcVPTKlBNK1oaPfp5eSSnCVrgx+ky+ZdtpDrt9A8HjU2ZhtZYyFUDpXwgiH61btGJZ
         pzm46Fro6Ngb2489msFrkzriWKgfIQfCF62ti/K8tDhlIoweU2c0WxzweiXD3/NuwXXO
         UbJEUFGfdaAfuwomd5YQCTdzDRijXfZWdmqHo=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:from:date:subject:mime-version:x-uid:x-length:organization
         :to:cc:content-type:content-transfer-encoding:message-id;
        b=cxVxW/9tp3p/BeZTv+t9J2Rm1quNTPYionKPyS+HWBYEmn2H6mByBaqArpFP8PtD3Z
         iXKHO5/lv6tpgU2pzqBzK2+bUVfAO9d4aDRBFBEYUjshycYGj2tX7AQU2YzCn1SZeatf
         z41KdzS5k9QZllLNkGhj6yP9cJwfoxqQ2W2Ik=
Received: by 10.213.110.4 with SMTP id l4mr7469237ebp.81.1259756511415;
        Wed, 02 Dec 2009 04:21:51 -0800 (PST)
Received: from flexo.localnet (bobafett.staff.proxad.net [213.228.1.121])
        by mx.google.com with ESMTPS id 16sm695140ewy.14.2009.12.02.04.21.47
        (version=SSLv3 cipher=RC4-MD5);
        Wed, 02 Dec 2009 04:21:50 -0800 (PST)
From:   Florian Fainelli <florian@openwrt.org>
Date:   Wed, 2 Dec 2009 13:21:23 +0100
Subject: [PATCH] rc32434_wdt: fix compilation failure
MIME-Version: 1.0
X-UID:  151
X-Length: 1439
Organization: OpenWrt
To:     Wim Van Sebroeck <wim@iguana.be>
Cc:     linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
        ralf@linux-mips.org
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <200912021321.24198.florian@openwrt.org>
Return-Path: <f.fainelli@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25270
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: florian@openwrt.org
Precedence: bulk
X-list: linux-mips

Hi Wim,

This is a pretty critical fix, please try to get it in 2.6.32. Thank you
very much!
---
From: Florian Fainelli <florian@openwrt.org>
Subject: [PATCH] rc32434_wdt: fix compilation failure

This patch fixes the compilation failure of
rc32434 due to a bad module parameter description.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
index f6cccc9..47588de 100644
--- a/drivers/watchdog/rc32434_wdt.c
+++ b/drivers/watchdog/rc32434_wdt.c
@@ -62,7 +62,7 @@ extern unsigned int idt_cpu_freq;
 static int timeout = WATCHDOG_TIMEOUT;
 module_param(timeout, int, 0);
 MODULE_PARM_DESC(timeout, "Watchdog timeout value, in seconds (default="
-		WATCHDOG_TIMEOUT ")");
+		__MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);

From ralf@linux-mips.org Wed Dec  2 13:38:54 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 13:38:57 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:52978 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492597AbZLBMiy (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 13:38:54 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2CcqAp019436;
        Wed, 2 Dec 2009 12:38:53 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2CcpiK019434;
        Wed, 2 Dec 2009 12:38:51 GMT
Date:   Wed, 2 Dec 2009 12:38:50 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Florian Fainelli <florian@openwrt.org>
Cc:     linux-mips@linux-mips.org
Subject: Re: [PATCH] rb532: fix devices.c compilation
Message-ID: <20091202123850.GA19401@linux-mips.org>
References: <200912021307.02014.florian@openwrt.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200912021307.02014.florian@openwrt.org>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25271
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Dec 02, 2009 at 01:07:01PM +0100, Florian Fainelli wrote:

> We should now use dev_set_drvdata to set the driver
> driver_data field.

Thanks, applied.

  Ralf

From ralf@linux-mips.org Wed Dec  2 13:57:05 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 13:57:10 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:56074 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492648AbZLBM5F (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 13:57:05 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2Cuueq020018;
        Wed, 2 Dec 2009 12:56:57 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2CuqDL020016;
        Wed, 2 Dec 2009 12:56:52 GMT
Date:   Wed, 2 Dec 2009 12:56:52 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Dave Airlie <airlied@linux.ie>,
        Thomas Hellstrom <thellstrom@vmware.com>,
        Jerome Glisse <jglisse@redhat.com>,
        Andrew Morton <akpm@linux-foundation.org>
Cc:     linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: [PATCH] DRM: Fix build error in include/drm/ttm/ttm_memory.h
Message-ID: <20091202125651.GA19748@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25272
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

include/drm/ttm/ttm_memory.h uses struct page * without having included
the required headers or a forward declaration resulting in the following
build error for mtx1_defconfig on Linus' master branch, possibly others:

  CC [M]  drivers/gpu/drm/ttm/ttm_memory.o
In file included from /home/ralf/src/linux/linux-mips/drivers/gpu/drm/ttm/ttm_memory.c:28:
/home/ralf/src/linux/linux-mips/include/drm/ttm/ttm_memory.h:154: warning: ‘struct page’ declared inside parameter list
/home/ralf/src/linux/linux-mips/include/drm/ttm/ttm_memory.h:154: warning: its scope is only this definition or declaration, which is probably not what you want
/home/ralf/src/linux/linux-mips/include/drm/ttm/ttm_memory.h:156: warning: ‘struct page’ declared inside parameter list
/home/ralf/src/linux/linux-mips/drivers/gpu/drm/ttm/ttm_memory.c:537: error: conflicting types for ‘ttm_mem_global_alloc_page’
/home/ralf/src/linux/linux-mips/include/drm/ttm/ttm_memory.h:152: note: previous declaration of ‘ttm_mem_global_alloc_page’ was here
/home/ralf/src/linux/linux-mips/drivers/gpu/drm/ttm/ttm_memory.c:560: error: conflicting types for ‘ttm_mem_global_free_page’
/home/ralf/src/linux/linux-mips/include/drm/ttm/ttm_memory.h:155: note: previous declaration of ‘ttm_mem_global_free_page’ was here
make[6]: *** [drivers/gpu/drm/ttm/ttm_memory.o] Error 1
make[5]: *** [drivers/gpu/drm/ttm] Error 2
make[4]: *** [drivers/gpu/drm] Error 2
make[3]: *** [drivers/gpu] Error 2
make[2]: *** [drivers] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2

Fixed by adding a forward declaration.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

 include/drm/ttm/ttm_memory.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
index 6983a7c..95355ee 100644
--- a/include/drm/ttm/ttm_memory.h
+++ b/include/drm/ttm/ttm_memory.h
@@ -143,6 +143,8 @@ static inline void ttm_mem_unregister_shrink(struct ttm_mem_global *glob,
 	spin_unlock(&glob->lock);
 }
 
+struct page;
+
 extern int ttm_mem_global_init(struct ttm_mem_global *glob);
 extern void ttm_mem_global_release(struct ttm_mem_global *glob);
 extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,

From ralf@linux-mips.org Wed Dec  2 14:02:28 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 14:02:33 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:51791 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492692AbZLBNC2 (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 14:02:28 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2D2RQp020250;
        Wed, 2 Dec 2009 13:02:27 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2D2RRu020248;
        Wed, 2 Dec 2009 13:02:27 GMT
Date:   Wed, 2 Dec 2009 13:02:27 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     nubi@linux-mips.org, linux-mips64@linux-mips.org
Cc:     linux-mips@linux-mips.org
Subject: Re: [ADMIN] Close NUBI and linux-mips64 lists?
Message-ID: <20091202130227.GA20225@linux-mips.org>
References: <20091127140636.GA28178@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091127140636.GA28178@linux-mips.org>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25273
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Fri, Nov 27, 2009 at 02:06:36PM +0000, Ralf Baechle wrote:

> This question is more of a formality required by netiquette than anything
> else I think.  The NUBI and linux-mips64 lists have not seen any activity
> in several years, so I suggest to delete both.  The archives will stay
> available on http://www.linux-mips.org/archives/ just as they are now.
> 
> Any objections?  Speak up now or forever hold your peace :-)

As I have not heared any objections I'm now going to close the lists.

  Ralf

From tbm@cyrius.com Wed Dec  2 14:22:01 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 14:22:05 +0100 (CET)
Received: from sorrow.cyrius.com ([65.19.161.204]:46443 "EHLO
        sorrow.cyrius.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org
        with ESMTP id S1492718AbZLBNWB (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 14:22:01 +0100
Received: by sorrow.cyrius.com (Postfix, from userid 10)
        id DE73ED8C7; Wed,  2 Dec 2009 13:21:58 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
        id 90EF61501AB; Wed,  2 Dec 2009 13:21:48 +0000 (GMT)
Date:   Wed, 2 Dec 2009 13:21:47 +0000
From:   Martin Michlmayr <tbm@cyrius.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     Dave Airlie <airlied@linux.ie>,
        Thomas Hellstrom <thellstrom@vmware.com>,
        Jerome Glisse <jglisse@redhat.com>,
        Andrew Morton <akpm@linux-foundation.org>,
        linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] DRM: Fix build error in include/drm/ttm/ttm_memory.h
Message-ID: <20091202132147.GM18101@deprecation.cyrius.com>
References: <20091202125651.GA19748@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091202125651.GA19748@linux-mips.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Return-Path: <tbm@cyrius.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25274
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: tbm@cyrius.com
Precedence: bulk
X-list: linux-mips

* Ralf Baechle <ralf@linux-mips.org> [2009-12-02 12:56]:
> include/drm/ttm/ttm_memory.h uses struct page * without having included
> the required headers or a forward declaration resulting in the following
> build error for mtx1_defconfig on Linus' master branch, possibly others:

I sent such a patch several weeks ago but unfortunately it hasn't been
applied yet:
http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg44711.html

-- 
Martin Michlmayr
http://www.cyrius.com/

From ralf@linux-mips.org Wed Dec  2 16:30:21 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 16:30:27 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:59098 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492693AbZLBPaV (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 16:30:21 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2FUIrm010647;
        Wed, 2 Dec 2009 15:30:19 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2FUHU2010645;
        Wed, 2 Dec 2009 15:30:17 GMT
Date:   Wed, 2 Dec 2009 15:30:16 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     linux-mips@linux-mips.org,
        Thomas Koeller <thomas.koeller@baslerweb.com>
Subject: RFC: Removal of Basler eXcite platform support
Message-ID: <20091202153016.GA9892@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25275
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

Support for the Basler eXcite was never fully merged and there seems to be
no push to complete that or any users.  So I'd like to remove the support
for it in the upcoming 2.6.33 cycle.  Any comments?

I'll post the patch which I already have sitting in the queue tree in a
a separate mail.

  Ralf

From ralf@linux-mips.org Wed Dec  2 16:57:14 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 17:08:29 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:51093 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493336AbZLBP5O (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 16:57:14 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2FaZ4F010915;
        Wed, 2 Dec 2009 15:36:35 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2FZZpH010878;
        Wed, 2 Dec 2009 15:35:35 GMT
Date:   Wed, 2 Dec 2009 15:35:35 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     linux-mips@linux-mips.org,
        Thomas Koeller <thomas.koeller@baslerweb.com>,
        David Woodhouse <dwmw2@infradead.org>,
        Wim Van Sebroeck <wim@iguana.be>,
        linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: [PATCH] eXcite: Remove platform support and drivers.
Message-ID: <20091202153534.GA10692@linux-mips.org>
References: <20091202153016.GA9892@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20091202153016.GA9892@linux-mips.org>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25276
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

The platform has never been fully merged.  Remove it including MTD and
watchdog drivers.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
I'd like acks from the watchdog and MTD maintainers please.

 arch/mips/Kconfig                                         |   18 
 arch/mips/Makefile                                        |    7 
 arch/mips/basler/excite/Kconfig                           |    9 
 arch/mips/basler/excite/Makefile                          |    8 
 arch/mips/basler/excite/excite_device.c                   |  403 ----
 arch/mips/basler/excite/excite_iodev.c                    |  178 -
 arch/mips/basler/excite/excite_iodev.h                    |   10 
 arch/mips/basler/excite/excite_irq.c                      |  122 -
 arch/mips/basler/excite/excite_procfs.c                   |   92 
 arch/mips/basler/excite/excite_prom.c                     |  144 -
 arch/mips/basler/excite/excite_setup.c                    |  302 ---
 arch/mips/configs/ar7_defconfig                           |    1 
 arch/mips/configs/bcm47xx_defconfig                       |    1 
 arch/mips/configs/bcm63xx_defconfig                       |    1 
 arch/mips/configs/bigsur_defconfig                        |    1 
 arch/mips/configs/capcella_defconfig                      |    1 
 arch/mips/configs/cavium-octeon_defconfig                 |    1 
 arch/mips/configs/cobalt_defconfig                        |    1 
 arch/mips/configs/db1000_defconfig                        |    1 
 arch/mips/configs/db1100_defconfig                        |    1 
 arch/mips/configs/db1200_defconfig                        |    1 
 arch/mips/configs/db1500_defconfig                        |    1 
 arch/mips/configs/db1550_defconfig                        |    1 
 arch/mips/configs/decstation_defconfig                    |    1 
 arch/mips/configs/e55_defconfig                           |    1 
 arch/mips/configs/excite_defconfig                        | 1335 --------------
 arch/mips/configs/fuloong2e_defconfig                     |    1 
 arch/mips/configs/ip22_defconfig                          |    1 
 arch/mips/configs/ip27_defconfig                          |    1 
 arch/mips/configs/ip28_defconfig                          |    1 
 arch/mips/configs/ip32_defconfig                          |    1 
 arch/mips/configs/jazz_defconfig                          |    1 
 arch/mips/configs/jmr3927_defconfig                       |    1 
 arch/mips/configs/lasat_defconfig                         |    1 
 arch/mips/configs/lemote2f_defconfig                      |    1 
 arch/mips/configs/malta_defconfig                         |    1 
 arch/mips/configs/markeins_defconfig                      |    1 
 arch/mips/configs/mipssim_defconfig                       |    1 
 arch/mips/configs/mpc30x_defconfig                        |    1 
 arch/mips/configs/msp71xx_defconfig                       |    1 
 arch/mips/configs/mtx1_defconfig                          |    1 
 arch/mips/configs/pb1100_defconfig                        |    1 
 arch/mips/configs/pb1500_defconfig                        |    1 
 arch/mips/configs/pb1550_defconfig                        |    1 
 arch/mips/configs/pnx8335-stb225_defconfig                |    1 
 arch/mips/configs/pnx8550-jbs_defconfig                   |    1 
 arch/mips/configs/pnx8550-stb810_defconfig                |    1 
 arch/mips/configs/powertv_defconfig                       |    1 
 arch/mips/configs/rb532_defconfig                         |    1 
 arch/mips/configs/rbtx49xx_defconfig                      |    1 
 arch/mips/configs/rm200_defconfig                         |    1 
 arch/mips/configs/sb1250-swarm_defconfig                  |    1 
 arch/mips/configs/tb0219_defconfig                        |    1 
 arch/mips/configs/tb0226_defconfig                        |    1 
 arch/mips/configs/tb0287_defconfig                        |    1 
 arch/mips/configs/workpad_defconfig                       |    1 
 arch/mips/configs/wrppmc_defconfig                        |    1 
 arch/mips/configs/yosemite_defconfig                      |    1 
 arch/mips/include/asm/mach-excite/cpu-feature-overrides.h |   48 
 arch/mips/include/asm/mach-excite/excite.h                |  154 -
 arch/mips/include/asm/mach-excite/excite_fpga.h           |   80 
 arch/mips/include/asm/mach-excite/excite_nandflash.h      |    7 
 arch/mips/include/asm/mach-excite/rm9k_eth.h              |   23 
 arch/mips/include/asm/mach-excite/rm9k_wdt.h              |   12 
 arch/mips/include/asm/mach-excite/rm9k_xicap.h            |   16 
 arch/mips/include/asm/mach-excite/war.h                   |   25 
 arch/mips/pci/Makefile                                    |    1 
 arch/mips/pci/fixup-excite.c                              |   36 
 arch/mips/pci/pci-excite.c                                |  149 -
 drivers/mtd/nand/Kconfig                                  |    8 
 drivers/mtd/nand/Makefile                                 |    1 
 drivers/mtd/nand/excite_nandflash.c                       |  248 --
 drivers/watchdog/Kconfig                                  |   10 
 drivers/watchdog/Makefile                                 |    1 
 drivers/watchdog/rm9k_wdt.c                               |  419 ----
 75 files changed, 3912 deletions(-)

Index: linux-queue/arch/mips/Kconfig
===================================================================
--- linux-queue.orig/arch/mips/Kconfig
+++ linux-queue/arch/mips/Kconfig
@@ -50,23 +50,6 @@ config AR7
 	  Support for the Texas Instruments AR7 System-on-a-Chip
 	  family: TNETD7100, 7200 and 7300.
 
-config BASLER_EXCITE
-	bool "Basler eXcite smart camera"
-	select CEVT_R4K
-	select CSRC_R4K
-	select DMA_COHERENT
-	select HW_HAS_PCI
-	select IRQ_CPU
-	select IRQ_CPU_RM7K
-	select IRQ_CPU_RM9K
-	select MIPS_RM9122
-	select SYS_HAS_CPU_RM9000
-	select SYS_SUPPORTS_32BIT_KERNEL
-	select SYS_SUPPORTS_BIG_ENDIAN
-	help
-	  The eXcite is a smart camera platform manufactured by
-	  Basler Vision Technologies AG.
-
 config BCM47XX
 	bool "BCM47XX based boards"
 	select CEVT_R4K
@@ -701,7 +684,6 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
 endchoice
 
 source "arch/mips/alchemy/Kconfig"
-source "arch/mips/basler/excite/Kconfig"
 source "arch/mips/bcm63xx/Kconfig"
 source "arch/mips/jazz/Kconfig"
 source "arch/mips/lasat/Kconfig"
Index: linux-queue/arch/mips/basler/excite/Kconfig
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/Kconfig
+++ /dev/null
@@ -1,9 +0,0 @@
-config BASLER_EXCITE_PROTOTYPE
-	bool "Support for pre-release units"
-	depends on BASLER_EXCITE
-	default n
-	help
-	  Pre-series (prototype) units are different from later ones in
-	  some ways. Select this option if you have one of these. Please
-	  note that a kernel built with this option selected will not be
-	  able to run on normal units.
Index: linux-queue/arch/mips/basler/excite/Makefile
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Makefile for Basler eXcite
-#
-
-obj-$(CONFIG_BASLER_EXCITE)	+= excite_irq.o excite_prom.o excite_setup.o \
-				   excite_device.o excite_procfs.o
-
-obj-m				+= excite_iodev.o
Index: linux-queue/arch/mips/basler/excite/excite_device.c
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/excite_device.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- *  Copyright (C) 2004 by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/ioport.h>
-#include <linux/err.h>
-#include <linux/jiffies.h>
-#include <linux/sched.h>
-#include <asm/types.h>
-#include <asm/rm9k-ocd.h>
-
-#include <excite.h>
-#include <rm9k_eth.h>
-#include <rm9k_wdt.h>
-#include <rm9k_xicap.h>
-#include <excite_nandflash.h>
-
-#include "excite_iodev.h"
-
-#define RM9K_GE_UNIT	0
-#define XICAP_UNIT	0
-#define NAND_UNIT	0
-
-#define DLL_TIMEOUT	3		/* seconds */
-
-
-#define RINIT(__start__, __end__, __name__, __parent__) {	\
-	.name	= __name__ "_0",				\
-	.start	= (__start__),					\
-	.end	= (__end__),					\
-	.flags	= 0,						\
-	.parent	= (__parent__)					\
-}
-
-#define RINIT_IRQ(__irq__, __name__) {	\
-	.name	= __name__ "_0",	\
-	.start	= (__irq__),		\
-	.end	= (__irq__),		\
-	.flags	= IORESOURCE_IRQ,	\
-	.parent	= NULL			\
-}
-
-
-
-enum {
-	slice_xicap,
-	slice_eth
-};
-
-
-
-static struct resource
-	excite_ctr_resource __maybe_unused = {
-		.name		= "GPI counters",
-		.start		= 0,
-		.end		= 5,
-		.flags		= 0,
-		.parent		= NULL,
-		.sibling	= NULL,
-		.child		= NULL
-	},
-	excite_gpislice_resource __maybe_unused = {
-		.name		= "GPI slices",
-		.start		= 0,
-		.end		= 1,
-		.flags		= 0,
-		.parent		= NULL,
-		.sibling	= NULL,
-		.child		= NULL
-	},
-	excite_mdio_channel_resource __maybe_unused = {
-		.name		= "MDIO channels",
-		.start		= 0,
-		.end		= 1,
-		.flags		= 0,
-		.parent		= NULL,
-		.sibling	= NULL,
-		.child		= NULL
-	},
-	excite_fifomem_resource __maybe_unused = {
-		.name		= "FIFO memory",
-		.start		= 0,
-		.end		= 767,
-		.flags		= 0,
-		.parent		= NULL,
-		.sibling	= NULL,
-		.child		= NULL
-	},
-	excite_scram_resource __maybe_unused = {
-		.name		= "Scratch RAM",
-		.start		= EXCITE_PHYS_SCRAM,
-		.end		= EXCITE_PHYS_SCRAM + EXCITE_SIZE_SCRAM - 1,
-		.flags		= IORESOURCE_MEM,
-		.parent		= NULL,
-		.sibling	= NULL,
-		.child		= NULL
-	},
-	excite_fpga_resource __maybe_unused = {
-		.name		= "System FPGA",
-		.start		= EXCITE_PHYS_FPGA,
-		.end		= EXCITE_PHYS_FPGA + EXCITE_SIZE_FPGA - 1,
-		.flags		= IORESOURCE_MEM,
-		.parent		= NULL,
-		.sibling	= NULL,
-		.child		= NULL
-	},
-	excite_nand_resource __maybe_unused = {
-		.name		= "NAND flash control",
-		.start		= EXCITE_PHYS_NAND,
-		.end		= EXCITE_PHYS_NAND + EXCITE_SIZE_NAND - 1,
-		.flags		= IORESOURCE_MEM,
-		.parent		= NULL,
-		.sibling	= NULL,
-		.child		= NULL
-	},
-	excite_titan_resource __maybe_unused = {
-		.name		= "TITAN registers",
-		.start		= EXCITE_PHYS_TITAN,
-		.end		= EXCITE_PHYS_TITAN + EXCITE_SIZE_TITAN - 1,
-		.flags		= IORESOURCE_MEM,
-		.parent		= NULL,
-		.sibling	= NULL,
-		.child		= NULL
-	};
-
-
-
-static void adjust_resources(struct resource *res, unsigned int n)
-{
-	struct resource *p;
-	const unsigned long mask = IORESOURCE_IO | IORESOURCE_MEM
-				   | IORESOURCE_IRQ | IORESOURCE_DMA;
-
-	for (p = res; p < res + n; p++) {
-		const struct resource * const parent = p->parent;
-		if (parent) {
-			p->start += parent->start;
-			p->end   += parent->start;
-			p->flags =  parent->flags & mask;
-		}
-	}
-}
-
-
-
-#if defined(CONFIG_EXCITE_FCAP_GPI) || defined(CONFIG_EXCITE_FCAP_GPI_MODULE)
-static struct resource xicap_rsrc[] = {
-	RINIT(0x4840, 0x486f, XICAP_RESOURCE_FIFO_RX, &excite_titan_resource),
-	RINIT(0x4940, 0x494b, XICAP_RESOURCE_FIFO_TX, &excite_titan_resource),
-	RINIT(0x5040, 0x5127, XICAP_RESOURCE_XDMA, &excite_titan_resource),
-	RINIT(0x1000, 0x112f, XICAP_RESOURCE_PKTPROC, &excite_titan_resource),
-	RINIT(0x1100, 0x110f, XICAP_RESOURCE_PKT_STREAM, &excite_fpga_resource),
-	RINIT(0x0800, 0x0bff, XICAP_RESOURCE_DMADESC, &excite_scram_resource),
-	RINIT(slice_xicap, slice_xicap, XICAP_RESOURCE_GPI_SLICE, &excite_gpislice_resource),
-	RINIT(0x0100, 0x02ff, XICAP_RESOURCE_FIFO_BLK, &excite_fifomem_resource),
-	RINIT_IRQ(TITAN_IRQ,  XICAP_RESOURCE_IRQ)
-};
-
-static struct platform_device xicap_pdev = {
-	.name		= XICAP_NAME,
-	.id		= XICAP_UNIT,
-	.num_resources	= ARRAY_SIZE(xicap_rsrc),
-	.resource	= xicap_rsrc
-};
-
-/*
- * Create a platform device for the GPI port that receives the
- * image data from the embedded camera.
- */
-static int __init xicap_devinit(void)
-{
-	unsigned long tend;
-	u32 reg;
-	int retval;
-
-	adjust_resources(xicap_rsrc, ARRAY_SIZE(xicap_rsrc));
-
-	/* Power up the slice and configure it. */
-	reg = titan_readl(CPTC1R);
-	reg &= ~(0x11100 << slice_xicap);
-	titan_writel(reg, CPTC1R);
-
-	/* Enable slice & DLL. */
-	reg= titan_readl(CPRR);
-	reg &= ~(0x00030003 << (slice_xicap * 2));
-	titan_writel(reg, CPRR);
-
-	/* Wait for DLLs to lock */
-	tend = jiffies + DLL_TIMEOUT * HZ;
-	while (time_before(jiffies, tend)) {
-		if (!(~titan_readl(CPDSR) & (0x1 << (slice_xicap * 4))))
-			break;
-		yield();
-	}
-
-	if (~titan_readl(CPDSR) & (0x1 << (slice_xicap * 4))) {
-		printk(KERN_ERR "%s: DLL not locked after %u seconds\n",
-		       xicap_pdev.name, DLL_TIMEOUT);
-		retval = -ETIME;
-	} else {
-		/* Register platform device */
-		retval = platform_device_register(&xicap_pdev);
-	}
-
-	return retval;
-}
-
-device_initcall(xicap_devinit);
-#endif /* defined(CONFIG_EXCITE_FCAP_GPI) || defined(CONFIG_EXCITE_FCAP_GPI_MODULE) */
-
-
-
-#if defined(CONFIG_WDT_RM9K_GPI) || defined(CONFIG_WDT_RM9K_GPI_MODULE)
-static struct resource wdt_rsrc[] = {
-	RINIT(0, 0, WDT_RESOURCE_COUNTER, &excite_ctr_resource),
-	RINIT(0x0084, 0x008f, WDT_RESOURCE_REGS, &excite_titan_resource),
-	RINIT_IRQ(TITAN_IRQ,  WDT_RESOURCE_IRQ)
-};
-
-static struct platform_device wdt_pdev = {
-	.name		= WDT_NAME,
-	.id		= -1,
-	.num_resources	= ARRAY_SIZE(wdt_rsrc),
-	.resource	= wdt_rsrc
-};
-
-/*
- * Create a platform device for the GPI port that receives the
- * image data from the embedded camera.
- */
-static int __init wdt_devinit(void)
-{
-	adjust_resources(wdt_rsrc, ARRAY_SIZE(wdt_rsrc));
-	return platform_device_register(&wdt_pdev);
-}
-
-device_initcall(wdt_devinit);
-#endif /* defined(CONFIG_WDT_RM9K_GPI) || defined(CONFIG_WDT_RM9K_GPI_MODULE) */
-
-
-
-static struct resource excite_nandflash_rsrc[] = {
- 	RINIT(0x2000, 0x201f, EXCITE_NANDFLASH_RESOURCE_REGS,  &excite_nand_resource)
-};
-
-static struct platform_device excite_nandflash_pdev = {
-	.name		= "excite_nand",
-	.id		= NAND_UNIT,
-	.num_resources	= ARRAY_SIZE(excite_nandflash_rsrc),
-	.resource	= excite_nandflash_rsrc
-};
-
-/*
- * Create a platform device for the access to the nand-flash
- * port
- */
-static int __init excite_nandflash_devinit(void)
-{
-	adjust_resources(excite_nandflash_rsrc, ARRAY_SIZE(excite_nandflash_rsrc));
-
-        /* nothing to be done here */
-
-        /* Register platform device */
-	return platform_device_register(&excite_nandflash_pdev);
-}
-
-device_initcall(excite_nandflash_devinit);
-
-
-
-static struct resource iodev_rsrc[] = {
-	RINIT_IRQ(FPGA1_IRQ,  IODEV_RESOURCE_IRQ)
-};
-
-static struct platform_device io_pdev = {
-	.name		= IODEV_NAME,
-	.id		= -1,
-	.num_resources	= ARRAY_SIZE(iodev_rsrc),
-	.resource	= iodev_rsrc
-};
-
-/*
- * Create a platform device for the external I/O ports.
- */
-static int __init io_devinit(void)
-{
-	adjust_resources(iodev_rsrc, ARRAY_SIZE(iodev_rsrc));
-	return platform_device_register(&io_pdev);
-}
-
-device_initcall(io_devinit);
-
-
-
-
-#if defined(CONFIG_RM9K_GE) || defined(CONFIG_RM9K_GE_MODULE)
-static struct resource rm9k_ge_rsrc[] = {
-	RINIT(0x2200, 0x27ff, RM9K_GE_RESOURCE_MAC, &excite_titan_resource),
-	RINIT(0x1800, 0x1fff, RM9K_GE_RESOURCE_MSTAT, &excite_titan_resource),
-	RINIT(0x2000, 0x212f, RM9K_GE_RESOURCE_PKTPROC, &excite_titan_resource),
-	RINIT(0x5140, 0x5227, RM9K_GE_RESOURCE_XDMA, &excite_titan_resource),
-	RINIT(0x4870, 0x489f, RM9K_GE_RESOURCE_FIFO_RX, &excite_titan_resource),
-	RINIT(0x494c, 0x4957, RM9K_GE_RESOURCE_FIFO_TX, &excite_titan_resource),
-	RINIT(0x0000, 0x007f, RM9K_GE_RESOURCE_FIFOMEM_RX, &excite_fifomem_resource),
-	RINIT(0x0080, 0x00ff, RM9K_GE_RESOURCE_FIFOMEM_TX, &excite_fifomem_resource),
-	RINIT(0x0180, 0x019f, RM9K_GE_RESOURCE_PHY, &excite_titan_resource),
-	RINIT(0x0000, 0x03ff, RM9K_GE_RESOURCE_DMADESC_RX, &excite_scram_resource),
-	RINIT(0x0400, 0x07ff, RM9K_GE_RESOURCE_DMADESC_TX, &excite_scram_resource),
-	RINIT(slice_eth, slice_eth, RM9K_GE_RESOURCE_GPI_SLICE, &excite_gpislice_resource),
-	RINIT(0, 0, RM9K_GE_RESOURCE_MDIO_CHANNEL, &excite_mdio_channel_resource),
-	RINIT_IRQ(TITAN_IRQ,  RM9K_GE_RESOURCE_IRQ_MAIN),
-	RINIT_IRQ(PHY_IRQ, RM9K_GE_RESOURCE_IRQ_PHY)
-};
-
-static struct platform_device rm9k_ge_pdev = {
-	.name		= RM9K_GE_NAME,
-	.id		= RM9K_GE_UNIT,
-	.num_resources	= ARRAY_SIZE(rm9k_ge_rsrc),
-	.resource	= rm9k_ge_rsrc
-};
-
-
-
-/*
- * Create a platform device for the Ethernet port.
- */
-static int __init rm9k_ge_devinit(void)
-{
-	u32 reg;
-
-	adjust_resources(rm9k_ge_rsrc, ARRAY_SIZE(rm9k_ge_rsrc));
-
-	/* Power up the slice and configure it. */
-	reg = titan_readl(CPTC1R);
-	reg &= ~(0x11000 << slice_eth);
-	reg |= 0x100 << slice_eth;
-	titan_writel(reg, CPTC1R);
-
-	/* Take the MAC out of reset, reset the DLLs. */
-	reg = titan_readl(CPRR);
-	reg &= ~(0x00030000 << (slice_eth * 2));
-	reg |= 0x3 << (slice_eth * 2);
-	titan_writel(reg, CPRR);
-
-	return platform_device_register(&rm9k_ge_pdev);
-}
-
-device_initcall(rm9k_ge_devinit);
-#endif /* defined(CONFIG_RM9K_GE) || defined(CONFIG_RM9K_GE_MODULE) */
-
-
-
-static int __init excite_setup_devs(void)
-{
-	int res;
-	u32 reg;
-
-	/* Enable xdma and fifo interrupts */
-	reg = titan_readl(0x0050);
-	titan_writel(reg | 0x18000000, 0x0050);
-
-	res = request_resource(&iomem_resource, &excite_titan_resource);
-	if (res)
-		return res;
-	res = request_resource(&iomem_resource, &excite_scram_resource);
-	if (res)
-		return res;
-	res = request_resource(&iomem_resource, &excite_fpga_resource);
-	if (res)
-		return res;
-	res = request_resource(&iomem_resource, &excite_nand_resource);
-	if (res)
-		return res;
-	excite_fpga_resource.flags = excite_fpga_resource.parent->flags &
-				   ( IORESOURCE_IO | IORESOURCE_MEM
-				   | IORESOURCE_IRQ | IORESOURCE_DMA);
-	excite_nand_resource.flags = excite_nand_resource.parent->flags &
-				   ( IORESOURCE_IO | IORESOURCE_MEM
-				   | IORESOURCE_IRQ | IORESOURCE_DMA);
-
-	return 0;
-}
-
-arch_initcall(excite_setup_devs);
-
Index: linux-queue/arch/mips/basler/excite/excite_iodev.c
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/excite_iodev.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- *  Copyright (C) 2005 by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/compiler.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/wait.h>
-#include <linux/poll.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/miscdevice.h>
-#include <linux/smp_lock.h>
-
-#include "excite_iodev.h"
-
-
-
-static const struct resource *iodev_get_resource(struct platform_device *, const char *, unsigned int);
-static int __init iodev_probe(struct platform_device *);
-static int __devexit iodev_remove(struct platform_device *);
-static int iodev_open(struct inode *, struct file *);
-static int iodev_release(struct inode *, struct file *);
-static ssize_t iodev_read(struct file *, char __user *, size_t s, loff_t *);
-static unsigned int iodev_poll(struct file *, struct poll_table_struct *);
-static irqreturn_t iodev_irqhdl(int, void *);
-
-
-
-static const char iodev_name[] = "iodev";
-static unsigned int iodev_irq;
-static DECLARE_WAIT_QUEUE_HEAD(wq);
-
-
-
-static const struct file_operations fops =
-{
-	.owner		= THIS_MODULE,
-	.open		= iodev_open,
-	.release	= iodev_release,
-	.read		= iodev_read,
-	.poll		= iodev_poll
-};
-
-static struct miscdevice miscdev =
-{
-	.minor		= MISC_DYNAMIC_MINOR,
-	.name		= iodev_name,
-	.fops		= &fops
-};
-
-static struct platform_driver iodev_driver = {
-	.driver = {
-		.name		= iodev_name,
-		.owner		= THIS_MODULE,
-	},
-	.probe		= iodev_probe,
-	.remove		= __devexit_p(iodev_remove),
-};
-
-
-
-static const struct resource *
-iodev_get_resource(struct platform_device *pdv, const char *name,
-		     unsigned int type)
-{
-	char buf[80];
-	if (snprintf(buf, sizeof buf, "%s_0", name) >= sizeof buf)
-		return NULL;
-	return platform_get_resource_byname(pdv, type, buf);
-}
-
-
-
-/* No hotplugging on the platform bus - use __init */
-static int __init iodev_probe(struct platform_device *dev)
-{
-	const struct resource * const ri =
-		iodev_get_resource(dev, IODEV_RESOURCE_IRQ, IORESOURCE_IRQ);
-
-	if (unlikely(!ri))
-		return -ENXIO;
-
-	iodev_irq = ri->start;
-	return misc_register(&miscdev);
-}
-
-
-
-static int __devexit iodev_remove(struct platform_device *dev)
-{
-	return misc_deregister(&miscdev);
-}
-
-static int iodev_open(struct inode *i, struct file *f)
-{
-	int ret;
-
-	ret = request_irq(iodev_irq, iodev_irqhdl, IRQF_DISABLED,
-			   iodev_name, &miscdev);
-
-	return ret;
-}
-
-static int iodev_release(struct inode *i, struct file *f)
-{
-	free_irq(iodev_irq, &miscdev);
-	return 0;
-}
-
-
-
-
-static ssize_t
-iodev_read(struct file *f, char __user *d, size_t s, loff_t *o)
-{
-	ssize_t ret;
-	DEFINE_WAIT(w);
-
-	prepare_to_wait(&wq, &w, TASK_INTERRUPTIBLE);
-	if (!signal_pending(current))
-		schedule();
-	ret = signal_pending(current) ? -ERESTARTSYS : 0;
-	finish_wait(&wq, &w);
-	return ret;
-}
-
-
-static unsigned int iodev_poll(struct file *f, struct poll_table_struct *p)
-{
-	poll_wait(f, &wq, p);
-	return POLLOUT | POLLWRNORM;
-}
-
-static irqreturn_t iodev_irqhdl(int irq, void *ctxt)
-{
-	wake_up(&wq);
-
-	return IRQ_HANDLED;
-}
-
-static int __init iodev_init_module(void)
-{
-	return platform_driver_register(&iodev_driver);
-}
-
-
-
-static void __exit iodev_cleanup_module(void)
-{
-	platform_driver_unregister(&iodev_driver);
-}
-
-module_init(iodev_init_module);
-module_exit(iodev_cleanup_module);
-
-
-
-MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
-MODULE_DESCRIPTION("Basler eXcite i/o interrupt handler");
-MODULE_VERSION("0.0");
-MODULE_LICENSE("GPL");
Index: linux-queue/arch/mips/basler/excite/excite_iodev.h
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/excite_iodev.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __EXCITE_IODEV_H__
-#define __EXCITE_IODEV_H__
-
-/* Device name */
-#define IODEV_NAME		"iodev"
-
-/* Resource names */
-#define IODEV_RESOURCE_IRQ	"excite_iodev_irq"
-
-#endif /* __EXCITE_IODEV_H__ */
Index: linux-queue/arch/mips/basler/excite/excite_irq.c
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/excite_irq.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *  Copyright (C) by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslereb.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/kernel_stat.h>
-#include <linux/module.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/timex.h>
-#include <linux/slab.h>
-#include <linux/random.h>
-#include <linux/bitops.h>
-#include <asm/bootinfo.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/irq_cpu.h>
-#include <asm/mipsregs.h>
-#include <asm/system.h>
-#include <asm/rm9k-ocd.h>
-
-#include <excite.h>
-
-extern asmlinkage void excite_handle_int(void);
-
-/*
- * Initialize the interrupt handler
- */
-void __init arch_init_irq(void)
-{
-	mips_cpu_irq_init();
-	rm7k_cpu_irq_init();
-	rm9k_cpu_irq_init();
-}
-
-asmlinkage void plat_irq_dispatch(void)
-{
-	const u32
-		interrupts = read_c0_cause() >> 8,
-		mask = ((read_c0_status() >> 8) & 0x000000ff) |
-		       (read_c0_intcontrol() & 0x0000ff00),
-		pending = interrupts & mask;
-	u32 msgintflags, msgintmask, msgint;
-
-	/* process timer interrupt */
-	if (pending & (1 << TIMER_IRQ)) {
-		do_IRQ(TIMER_IRQ);
-		return;
-	}
-
-	/* Process PCI interrupts */
-#if USB_IRQ < 10
-	msgintflags = ocd_readl(INTP0Status0 + (USB_MSGINT / 0x20 * 0x10));
-	msgintmask  = ocd_readl(INTP0Mask0 + (USB_MSGINT / 0x20 * 0x10));
-	msgint	    = msgintflags & msgintmask & (0x1 << (USB_MSGINT % 0x20));
-	if ((pending & (1 << USB_IRQ)) && msgint) {
-#else
-	if (pending & (1 << USB_IRQ)) {
-#endif
-		do_IRQ(USB_IRQ);
-		return;
-	}
-
-	/* Process TITAN interrupts */
-	msgintflags = ocd_readl(INTP0Status0 + (TITAN_MSGINT / 0x20 * 0x10));
-	msgintmask  = ocd_readl(INTP0Mask0 + (TITAN_MSGINT / 0x20 * 0x10));
-	msgint	    = msgintflags & msgintmask & (0x1 << (TITAN_MSGINT % 0x20));
-	if ((pending & (1 << TITAN_IRQ)) && msgint) {
-		ocd_writel(msgint, INTP0Clear0 + (TITAN_MSGINT / 0x20 * 0x10));
-		do_IRQ(TITAN_IRQ);
-		return;
-	}
-
-	/* Process FPGA line #0 interrupts */
-	msgintflags = ocd_readl(INTP0Status0 + (FPGA0_MSGINT / 0x20 * 0x10));
-	msgintmask  = ocd_readl(INTP0Mask0 + (FPGA0_MSGINT / 0x20 * 0x10));
-	msgint	    = msgintflags & msgintmask & (0x1 << (FPGA0_MSGINT % 0x20));
-	if ((pending & (1 << FPGA0_IRQ)) && msgint) {
-		do_IRQ(FPGA0_IRQ);
-		return;
-	}
-
-	/* Process FPGA line #1 interrupts */
-	msgintflags = ocd_readl(INTP0Status0 + (FPGA1_MSGINT / 0x20 * 0x10));
-	msgintmask  = ocd_readl(INTP0Mask0 + (FPGA1_MSGINT / 0x20 * 0x10));
-	msgint	    = msgintflags & msgintmask & (0x1 << (FPGA1_MSGINT % 0x20));
-	if ((pending & (1 << FPGA1_IRQ)) && msgint) {
-		do_IRQ(FPGA1_IRQ);
-		return;
-	}
-
-	/* Process PHY interrupts */
-	msgintflags = ocd_readl(INTP0Status0 + (PHY_MSGINT / 0x20 * 0x10));
-	msgintmask  = ocd_readl(INTP0Mask0 + (PHY_MSGINT / 0x20 * 0x10));
-	msgint	    = msgintflags & msgintmask & (0x1 << (PHY_MSGINT % 0x20));
-	if ((pending & (1 << PHY_IRQ)) && msgint) {
-		do_IRQ(PHY_IRQ);
-		return;
-	}
-
-	/* Process spurious interrupts */
-	spurious_interrupt();
-}
Index: linux-queue/arch/mips/basler/excite/excite_procfs.c
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/excite_procfs.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Copyright (C) 2004, 2005 by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
- *
- *  Procfs support for Basler eXcite
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#include <linux/module.h>
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/stat.h>
-#include <asm/page.h>
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/rm9k-ocd.h>
-
-#include <excite.h>
-
-static int excite_unit_id_proc_show(struct seq_file *m, void *v)
-{
-	seq_printf(m, "%06x", unit_id);
-	return 0;
-}
-
-static int excite_unit_id_proc_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, excite_unit_id_proc_show, NULL);
-}
-
-static const struct file_operations excite_unit_id_proc_fops = {
-	.owner		= THIS_MODULE,
-	.open		= excite_unit_id_proc_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
-static int
-excite_bootrom_read(char *page, char **start, off_t off, int count,
-		  int *eof, void *data)
-{
-	void __iomem * src;
-
-	if (off >= EXCITE_SIZE_BOOTROM) {
-		*eof = 1;
-		return 0;
-	}
-
-	if ((off + count) > EXCITE_SIZE_BOOTROM)
-		count = EXCITE_SIZE_BOOTROM - off;
-
-	src = ioremap(EXCITE_PHYS_BOOTROM + off, count);
-	if (src) {
-		memcpy_fromio(page, src, count);
-		iounmap(src);
-		*start = page;
-	} else {
-		count = -ENOMEM;
-	}
-
-	return count;
-}
-
-void excite_procfs_init(void)
-{
-	/* Create & populate /proc/excite */
-	struct proc_dir_entry * const pdir = proc_mkdir("excite", NULL);
-	if (pdir) {
-		struct proc_dir_entry * e;
-
-		e = proc_create("unit_id", S_IRUGO, pdir,
-				&excite_unit_id_proc_fops);
-		if (e) e->size = 6;
-
-		e = create_proc_read_entry("bootrom", S_IRUGO, pdir,
-					   excite_bootrom_read, NULL);
-		if (e) e->size = EXCITE_SIZE_BOOTROM;
-	}
-}
Index: linux-queue/arch/mips/basler/excite/excite_prom.c
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/excite_prom.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *  Copyright (C) 2004, 2005 by Thomas Koeller (thomas.koeller@baslerweb.com)
- *  Based on the PMC-Sierra Yosemite board support by Ralf Baechle and
- *  Manish Lachwani.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/delay.h>
-#include <linux/smp.h>
-#include <linux/module.h>
-#include <asm/io.h>
-#include <asm/pgtable.h>
-#include <asm/processor.h>
-#include <asm/reboot.h>
-#include <asm/system.h>
-#include <asm/bootinfo.h>
-#include <asm/string.h>
-
-#include <excite.h>
-
-/* This struct is used by Redboot to pass arguments to the kernel */
-typedef struct
-{
-	char *name;
-	char *val;
-} t_env_var;
-
-struct parmblock {
-	t_env_var memsize;
-	t_env_var modetty0;
-	t_env_var ethaddr;
-	t_env_var env_end;
-	char *argv[2];
-	char text[0];
-};
-
-static unsigned int prom_argc;
-static const char ** prom_argv;
-static const t_env_var * prom_env;
-
-static void prom_halt(void) __attribute__((noreturn));
-static void prom_exit(void) __attribute__((noreturn));
-
-
-
-const char *get_system_type(void)
-{
-	return "Basler eXcite";
-}
-
-/*
- * Halt the system
- */
-static void prom_halt(void)
-{
-	printk(KERN_NOTICE "\n** System halted.\n");
-	while (1)
-		asm volatile (
-			"\t.set\tmips3\n"
-			"\twait\n"
-			"\t.set\tmips0\n"
-		);
-}
-
-/*
- * Reset the CPU and re-enter Redboot
- */
-static void prom_exit(void)
-{
-	unsigned int i;
-	volatile unsigned char * const flg =
-		(volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_DPR);
-
-	/* Clear the watchdog reset flag, set the reboot flag */
-	*flg &= ~0x01;
-	*flg |= 0x80;
-
-	for (i = 0; i < 10; i++) {
-		*(volatile unsigned char *)  (EXCITE_ADDR_FPGA + EXCITE_FPGA_SYSCTL) = 0x02;
-		iob();
-		mdelay(1000);
-	}
-
-	printk(KERN_NOTICE "Reset failed\n");
-	prom_halt();
-}
-
-static const char __init *prom_getenv(char *name)
-{
-	const t_env_var * p;
-	for (p = prom_env; p->name != NULL; p++)
-		if(strcmp(name, p->name) == 0)
-			break;
-	return p->val;
-}
-
-/*
- * Init routine which accepts the variables from Redboot
- */
-void __init prom_init(void)
-{
-	const struct parmblock * const pb = (struct parmblock *) fw_arg2;
-
-	prom_argc = fw_arg0;
-	prom_argv = (const char **) fw_arg1;
-	prom_env = &pb->memsize;
-
-	/* Callbacks for halt, restart */
-	_machine_restart = (void (*)(char *)) prom_exit;
-	_machine_halt = prom_halt;
-
-#ifdef CONFIG_32BIT
-	/* copy command line */
-	strcpy(arcs_cmdline, prom_argv[1]);
-	memsize = simple_strtol(prom_getenv("memsize"), NULL, 16);
-	strcpy(modetty, prom_getenv("modetty0"));
-#endif /* CONFIG_32BIT */
-
-#ifdef CONFIG_64BIT
-#	error 64 bit support not implemented
-#endif /* CONFIG_64BIT */
-}
-
-/* This is called from free_initmem(), so we need to provide it */
-void __init prom_free_prom_memory(void)
-{
-	/* Nothing to do */
-}
Index: linux-queue/arch/mips/basler/excite/excite_setup.c
===================================================================
--- linux-queue.orig/arch/mips/basler/excite/excite_setup.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- *  Copyright (C) 2004, 2005 by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
- *  Based on the PMC-Sierra Yosemite board support by Ralf Baechle and
- *  Manish Lachwani.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/tty.h>
-#include <linux/serial_core.h>
-#include <linux/serial.h>
-#include <linux/serial_8250.h>
-#include <linux/ioport.h>
-#include <linux/spinlock.h>
-#include <asm/bootinfo.h>
-#include <asm/mipsregs.h>
-#include <asm/pgtable-32.h>
-#include <asm/io.h>
-#include <asm/time.h>
-#include <asm/rm9k-ocd.h>
-
-#include <excite.h>
-
-#define TITAN_UART_CLK	25000000
-
-#if 1
-/* normal serial port assignment */
-#define REGBASE_SER0	0x0208
-#define REGBASE_SER1	0x0238
-#define MASK_SER0	0x1
-#define MASK_SER1	0x2
-#else
-/* serial ports swapped */
-#define REGBASE_SER0	0x0238
-#define REGBASE_SER1	0x0208
-#define MASK_SER0	0x2
-#define MASK_SER1	0x1
-#endif
-
-unsigned long memsize;
-char modetty[30];
-unsigned int titan_irq = TITAN_IRQ;
-static void __iomem * ctl_regs;
-u32 unit_id;
-
-volatile void __iomem * const ocd_base = (void *) (EXCITE_ADDR_OCD);
-volatile void __iomem * const titan_base = (void *) (EXCITE_ADDR_TITAN);
-
-/* Protect access to shared GPI registers */
-DEFINE_SPINLOCK(titan_lock);
-int titan_irqflags;
-
-
-/*
- * The eXcite platform uses the alternate timer interrupt
- *
- * Fixme: At the time of this writing cevt-r4k.c doesn't yet know about how
- * to handle the alternate timer interrupt of the RM9000.
- */
-void __init plat_time_init(void)
-{
-	const u32 modebit5 = ocd_readl(0x00e4);
-	unsigned int mult = ((modebit5 >> 11) & 0x1f) + 2;
-	unsigned int div = ((modebit5 >> 16) & 0x1f) + 2;
-
-	if (div == 33)
-		div = 1;
-	mips_hpt_frequency = EXCITE_CPU_EXT_CLOCK * mult / div / 2;
-}
-
-static int __init excite_init_console(void)
-{
-#if defined(CONFIG_SERIAL_8250)
-	static __initdata char serr[] =
-		KERN_ERR "Serial port #%u setup failed\n";
-	struct uart_port up;
-
-	/* Take the DUART out of reset */
-	titan_writel(0x00ff1cff, CPRR);
-
-#if (CONFIG_SERIAL_8250_NR_UARTS > 1)
-	/* Enable both ports */
-	titan_writel(MASK_SER0 | MASK_SER1, UACFG);
-#else
-	/* Enable port #0 only */
-	titan_writel(MASK_SER0, UACFG);
-#endif
-
- 	/*
-	 * Set up serial port #0. Do not use autodetection; the result is
-	 * not what we want.
- 	 */
-	memset(&up, 0, sizeof(up));
-	up.membase	= (char *) titan_addr(REGBASE_SER0);
-	up.irq		= TITAN_IRQ;
-	up.uartclk	= TITAN_UART_CLK;
-	up.regshift	= 0;
-	up.iotype	= UPIO_RM9000;
-	up.type		= PORT_RM9000;
-	up.flags	= UPF_SHARE_IRQ;
-	up.line		= 0;
-	if (early_serial_setup(&up))
-		printk(serr, up.line);
-
-#if CONFIG_SERIAL_8250_NR_UARTS > 1
-	/* And now for port #1. */
-	up.membase	= (char *) titan_addr(REGBASE_SER1);
-	up.line		= 1;
- 	if (early_serial_setup(&up))
-		printk(serr, up.line);
-#endif /* CONFIG_SERIAL_8250_NR_UARTS > 1 */
-#else
-	/* Leave the DUART in reset */
-	titan_writel(0x00ff3cff, CPRR);
-#endif  /* defined(CONFIG_SERIAL_8250) */
-
-	return 0;
-}
-
-static int __init excite_platform_init(void)
-{
-	unsigned int i;
-	unsigned char buf[3];
-	u8 reg;
-	void __iomem * dpr;
-
-	/* BIU buffer allocations */
-	ocd_writel(8, CPURSLMT);	/* CPU */
-	titan_writel(4, CPGRWL);	/* GPI / Ethernet */
-
-	/* Map control registers located in FPGA */
-	ctl_regs = ioremap_nocache(EXCITE_PHYS_FPGA + EXCITE_FPGA_SYSCTL, 16);
-	if (!ctl_regs)
-		panic("eXcite: failed to map platform control registers\n");
-	memcpy_fromio(buf, ctl_regs + 2, ARRAY_SIZE(buf));
-	unit_id = buf[0] | (buf[1] << 8) | (buf[2] << 16);
-
-	/* Clear the reboot flag */
-	dpr = ioremap_nocache(EXCITE_PHYS_FPGA + EXCITE_FPGA_DPR, 1);
-	reg = __raw_readb(dpr);
-	__raw_writeb(reg & 0x7f, dpr);
-	iounmap(dpr);
-
-	/* Interrupt controller setup */
-	for (i = INTP0Status0; i < INTP0Status0 + 0x80; i += 0x10) {
-		ocd_writel(0x00000000, i + 0x04);
-		ocd_writel(0xffffffff, i + 0x0c);
-	}
-	ocd_writel(0x2, NMICONFIG);
-
-	ocd_writel(0x1 << (TITAN_MSGINT % 0x20),
-		   INTP0Mask0 + (0x10 * (TITAN_MSGINT / 0x20)));
-	ocd_writel((0x1 << (FPGA0_MSGINT % 0x20))
-		   | ocd_readl(INTP0Mask0 + (0x10 * (FPGA0_MSGINT / 0x20))),
-		   INTP0Mask0 + (0x10 * (FPGA0_MSGINT / 0x20)));
-	ocd_writel((0x1 << (FPGA1_MSGINT % 0x20))
-		   | ocd_readl(INTP0Mask0 + (0x10 * (FPGA1_MSGINT / 0x20))),
-		   INTP0Mask0 + (0x10 * (FPGA1_MSGINT / 0x20)));
-	ocd_writel((0x1 << (PHY_MSGINT % 0x20))
-		   | ocd_readl(INTP0Mask0 + (0x10 * (PHY_MSGINT / 0x20))),
-		   INTP0Mask0 + (0x10 * (PHY_MSGINT / 0x20)));
-#if USB_IRQ < 10
-	ocd_writel((0x1 << (USB_MSGINT % 0x20))
-		   | ocd_readl(INTP0Mask0 + (0x10 * (USB_MSGINT / 0x20))),
-		   INTP0Mask0 + (0x10 * (USB_MSGINT / 0x20)));
-#endif
-	/* Enable the packet FIFO, XDMA and XDMA arbiter */
-	titan_writel(0x00ff18ff, CPRR);
-
-	/*
-	 * Set up the PADMUX. Power down all ethernet slices,
-	 * they will be powered up and configured at device startup.
-	 */
-	titan_writel(0x00878206, CPTC1R);
-	titan_writel(0x00001100, CPTC0R); /* latch PADMUX, enable WCIMODE */
-
-	/* Reset and enable the FIFO block */
-	titan_writel(0x00000001, SDRXFCIE);
-	titan_writel(0x00000001, SDTXFCIE);
-	titan_writel(0x00000100, SDRXFCIE);
-	titan_writel(0x00000000, SDTXFCIE);
-
-	/*
-	 * Initialize the common interrupt shared by all components of
-	 * the GPI/Ethernet subsystem.
-	 */
-	titan_writel((EXCITE_PHYS_OCD >> 12), CPCFG0);
-	titan_writel(TITAN_MSGINT, CPCFG1);
-
-	/*
-	 * XDMA configuration.
-	 * In order for the XDMA to be sharable among multiple drivers,
-	 * the setup must be done here in the platform. The reason is that
-	 * this setup can only be done while the XDMA is in reset. If this
-	 * were done in a driver, it would interrupt all other drivers
-	 * using the XDMA.
-	 */
-	titan_writel(0x80021dff, GXCFG);	/* XDMA reset */
-	titan_writel(0x00000000, CPXCISRA);
-	titan_writel(0x00000000, CPXCISRB);	/* clear pending interrupts */
-#if defined(CONFIG_HIGHMEM)
-#	error change for HIGHMEM support!
-#else
-	titan_writel(0x00000000, GXDMADRPFX);	/* buffer address prefix */
-#endif
-	titan_writel(0, GXDMA_DESCADR);
-
-	for (i = 0x5040; i <= 0x5300; i += 0x0040)
-		titan_writel(0x80080000, i);	/* reset channel */
-
-	titan_writel((0x1 << 29)			/* no sparse tx descr. */
-		     | (0x1 << 28)			/* no sparse rx descr. */
-		     | (0x1 << 23) | (0x1 << 24)	/* descriptor coherency */
-		     | (0x1 << 21) | (0x1 << 22)	/* data coherency */
-		     | (0x1 << 17)
-		     | 0x1dff,
-		     GXCFG);
-
-#if defined(CONFIG_SMP)
-#	error No SMP support
-#else
-	/* All interrupts go to core #0 only. */
-	titan_writel(0x1f007fff, CPDST0A);
-	titan_writel(0x00000000, CPDST0B);
-	titan_writel(0x0000ff3f, CPDST1A);
-	titan_writel(0x00000000, CPDST1B);
-	titan_writel(0x00ffffff, CPXDSTA);
-	titan_writel(0x00000000, CPXDSTB);
-#endif
-
-	/* Enable DUART interrupts, disable everything else. */
-	titan_writel(0x04000000, CPGIG0ER);
-	titan_writel(0x000000c0, CPGIG1ER);
-
-	excite_procfs_init();
-	return 0;
-}
-
-void __init plat_mem_setup(void)
-{
-	volatile u32 * const boot_ocd_base = (u32 *) 0xbf7fc000;
-
-	/* Announce RAM to system */
-	add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
-
-	/* Set up the peripheral address map */
-	*(boot_ocd_base + (LKB9 / sizeof(u32))) = 0;
-	*(boot_ocd_base + (LKB10 / sizeof(u32))) = 0;
-	*(boot_ocd_base + (LKB11 / sizeof(u32))) = 0;
-	*(boot_ocd_base + (LKB12 / sizeof(u32))) = 0;
-	wmb();
-	*(boot_ocd_base + (LKB0 / sizeof(u32))) = EXCITE_PHYS_OCD >> 4;
-	wmb();
-
-	ocd_writel((EXCITE_PHYS_TITAN >> 4) | 0x1UL, LKB5);
-	ocd_writel(((EXCITE_SIZE_TITAN >> 4) & 0x7fffff00) - 0x100, LKM5);
-	ocd_writel((EXCITE_PHYS_SCRAM >> 4) | 0x1UL, LKB13);
-	ocd_writel(((EXCITE_SIZE_SCRAM >> 4) & 0xffffff00) - 0x100, LKM13);
-
-	/* Local bus slot #0 */
-	ocd_writel(0x00040510, LDP0);
-	ocd_writel((EXCITE_PHYS_BOOTROM >> 4) | 0x1UL, LKB9);
-	ocd_writel(((EXCITE_SIZE_BOOTROM >> 4) & 0x03ffff00) - 0x100, LKM9);
-
-	/* Local bus slot #2 */
-	ocd_writel(0x00000330, LDP2);
-	ocd_writel((EXCITE_PHYS_FPGA >> 4) | 0x1, LKB11);
-	ocd_writel(((EXCITE_SIZE_FPGA >> 4) - 0x100) & 0x03ffff00, LKM11);
-
-	/* Local bus slot #3 */
-	ocd_writel(0x00123413, LDP3);
-	ocd_writel((EXCITE_PHYS_NAND >> 4) | 0x1, LKB12);
-	ocd_writel(((EXCITE_SIZE_NAND >> 4) - 0x100) & 0x03ffff00, LKM12);
-}
-
-
-
-console_initcall(excite_init_console);
-arch_initcall(excite_platform_init);
-
-EXPORT_SYMBOL(titan_lock);
-EXPORT_SYMBOL(titan_irqflags);
-EXPORT_SYMBOL(titan_irq);
-EXPORT_SYMBOL(ocd_base);
-EXPORT_SYMBOL(titan_base);
Index: linux-queue/arch/mips/include/asm/mach-excite/cpu-feature-overrides.h
===================================================================
--- linux-queue.orig/arch/mips/include/asm/mach-excite/cpu-feature-overrides.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2004 Thomas Koeller <thomas.koeller@baslerweb.com>
- * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
- */
-#ifndef __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
-#define __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
-
-/*
- * Basler eXcite has an RM9122 processor.
- */
-#define cpu_has_watch		1
-#define cpu_has_mips16		0
-#define cpu_has_divec		0
-#define cpu_has_vce		0
-#define cpu_has_cache_cdex_p	0
-#define cpu_has_cache_cdex_s	0
-#define cpu_has_prefetch	1
-#define cpu_has_mcheck		0
-#define cpu_has_ejtag		0
-
-#define cpu_has_llsc		1
-#define cpu_has_vtag_icache	0
-#define cpu_has_dc_aliases	0
-#define cpu_has_ic_fills_f_dc	0
-#define cpu_has_dsp		0
-#define cpu_icache_snoops_remote_store	0
-#define cpu_has_mipsmt		0
-#define cpu_has_userlocal	0
-
-#define cpu_has_nofpuex		0
-#define cpu_has_64bits		1
-
-#define cpu_has_mips32r1	0
-#define cpu_has_mips32r2	0
-#define cpu_has_mips64r1	0
-#define cpu_has_mips64r2	0
-
-#define cpu_has_inclusive_pcaches	0
-
-#define cpu_dcache_line_size()	32
-#define cpu_icache_line_size()	32
-#define cpu_scache_line_size()	32
-
-#endif /* __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H */
Index: linux-queue/arch/mips/include/asm/mach-excite/excite.h
===================================================================
--- linux-queue.orig/arch/mips/include/asm/mach-excite/excite.h
+++ /dev/null
@@ -1,154 +0,0 @@
-#ifndef __EXCITE_H__
-#define __EXCITE_H__
-
-#include <linux/init.h>
-#include <asm/addrspace.h>
-#include <asm/types.h>
-
-#define EXCITE_CPU_EXT_CLOCK 100000000
-
-#if !defined(__ASSEMBLY__)
-void __init excite_kgdb_init(void);
-void excite_procfs_init(void);
-extern unsigned long memsize;
-extern char modetty[];
-extern u32 unit_id;
-#endif
-
-/* Base name for XICAP devices */
-#define XICAP_NAME	"xicap_gpi"
-
-/* OCD register offsets */
-#define LKB0		0x0038
-#define LKB5		0x0128
-#define LKM5		0x012C
-#define LKB7		0x0138
-#define LKM7		0x013c
-#define LKB8		0x0140
-#define LKM8		0x0144
-#define LKB9		0x0148
-#define LKM9		0x014c
-#define LKB10		0x0150
-#define LKM10		0x0154
-#define LKB11		0x0158
-#define LKM11		0x015c
-#define LKB12		0x0160
-#define LKM12		0x0164
-#define LKB13		0x0168
-#define LKM13		0x016c
-#define LDP0		0x0200
-#define LDP1		0x0210
-#define LDP2		0x0220
-#define LDP3		0x0230
-#define INTPIN0		0x0A40
-#define INTPIN1		0x0A44
-#define INTPIN2		0x0A48
-#define INTPIN3		0x0A4C
-#define INTPIN4		0x0A50
-#define INTPIN5		0x0A54
-#define INTPIN6		0x0A58
-#define INTPIN7		0x0A5C
-
-
-
-
-/* TITAN register offsets */
-#define CPRR		0x0004
-#define CPDSR		0x0008
-#define CPTC0R		0x000c
-#define CPTC1R		0x0010
-#define CPCFG0		0x0020
-#define CPCFG1		0x0024
-#define CPDST0A		0x0028
-#define CPDST0B		0x002c
-#define CPDST1A		0x0030
-#define CPDST1B		0x0034
-#define CPXDSTA		0x0038
-#define CPXDSTB		0x003c
-#define CPXCISRA	0x0048
-#define CPXCISRB	0x004c
-#define CPGIG0ER	0x0050
-#define CPGIG1ER	0x0054
-#define CPGRWL		0x0068
-#define CPURSLMT	0x00f8
-#define UACFG		0x0200
-#define UAINTS		0x0204
-#define SDRXFCIE	0x4828
-#define SDTXFCIE	0x4928
-#define INTP0Status0	0x1B00
-#define INTP0Mask0	0x1B04
-#define INTP0Set0	0x1B08
-#define INTP0Clear0	0x1B0C
-#define GXCFG		0x5000
-#define GXDMADRPFX	0x5018
-#define GXDMA_DESCADR	0x501c
-#define GXCH0TDESSTRT	0x5054
-
-/* IRQ definitions */
-#define NMICONFIG		0xac0
-#define TITAN_MSGINT	0xc4
-#define TITAN_IRQ	((TITAN_MSGINT / 0x20) + 2)
-#define FPGA0_MSGINT	0x5a
-#define FPGA0_IRQ	((FPGA0_MSGINT / 0x20) + 2)
-#define FPGA1_MSGINT	0x7b
-#define FPGA1_IRQ	((FPGA1_MSGINT / 0x20) + 2)
-#define PHY_MSGINT	0x9c
-#define PHY_IRQ		((PHY_MSGINT   / 0x20) + 2)
-
-#if defined(CONFIG_BASLER_EXCITE_PROTOTYPE)
-/* Pre-release units used interrupt pin #9 */
-#define USB_IRQ		11
-#else
-/* Re-designed units use interrupt pin #1 */
-#define USB_MSGINT	0x39
-#define USB_IRQ		((USB_MSGINT / 0x20) + 2)
-#endif
-#define TIMER_IRQ	12
-
-
-/* Device address ranges */
-#define EXCITE_OFFS_OCD		0x1fffc000
-#define	EXCITE_SIZE_OCD		(16 * 1024)
-#define EXCITE_PHYS_OCD		CPHYSADDR(EXCITE_OFFS_OCD)
-#define EXCITE_ADDR_OCD		CKSEG1ADDR(EXCITE_OFFS_OCD)
-
-#define EXCITE_OFFS_SCRAM 	0x1fffa000
-#define	EXCITE_SIZE_SCRAM	(8 << 10)
-#define EXCITE_PHYS_SCRAM 	CPHYSADDR(EXCITE_OFFS_SCRAM)
-#define EXCITE_ADDR_SCRAM 	CKSEG1ADDR(EXCITE_OFFS_SCRAM)
-
-#define EXCITE_OFFS_PCI_IO	0x1fff8000
-#define	EXCITE_SIZE_PCI_IO	(8 << 10)
-#define EXCITE_PHYS_PCI_IO	CPHYSADDR(EXCITE_OFFS_PCI_IO)
-#define EXCITE_ADDR_PCI_IO 	CKSEG1ADDR(EXCITE_OFFS_PCI_IO)
-
-#define EXCITE_OFFS_TITAN	0x1fff0000
-#define EXCITE_SIZE_TITAN	(32 << 10)
-#define EXCITE_PHYS_TITAN	CPHYSADDR(EXCITE_OFFS_TITAN)
-#define EXCITE_ADDR_TITAN	CKSEG1ADDR(EXCITE_OFFS_TITAN)
-
-#define EXCITE_OFFS_PCI_MEM	0x1ffe0000
-#define EXCITE_SIZE_PCI_MEM	(64 << 10)
-#define EXCITE_PHYS_PCI_MEM	CPHYSADDR(EXCITE_OFFS_PCI_MEM)
-#define EXCITE_ADDR_PCI_MEM	CKSEG1ADDR(EXCITE_OFFS_PCI_MEM)
-
-#define EXCITE_OFFS_FPGA	0x1ffdc000
-#define EXCITE_SIZE_FPGA	(16 << 10)
-#define EXCITE_PHYS_FPGA	CPHYSADDR(EXCITE_OFFS_FPGA)
-#define EXCITE_ADDR_FPGA	CKSEG1ADDR(EXCITE_OFFS_FPGA)
-
-#define EXCITE_OFFS_NAND	0x1ffd8000
-#define EXCITE_SIZE_NAND	(16 << 10)
-#define EXCITE_PHYS_NAND	CPHYSADDR(EXCITE_OFFS_NAND)
-#define EXCITE_ADDR_NAND	CKSEG1ADDR(EXCITE_OFFS_NAND)
-
-#define EXCITE_OFFS_BOOTROM	0x1f000000
-#define EXCITE_SIZE_BOOTROM	(8 << 20)
-#define EXCITE_PHYS_BOOTROM	CPHYSADDR(EXCITE_OFFS_BOOTROM)
-#define EXCITE_ADDR_BOOTROM	CKSEG1ADDR(EXCITE_OFFS_BOOTROM)
-
-/* FPGA address offsets */
-#define EXCITE_FPGA_DPR		0x0104	/* dual-ported ram */
-#define EXCITE_FPGA_SYSCTL	0x0200	/* system control register block */
-
-#endif /* __EXCITE_H__ */
Index: linux-queue/arch/mips/include/asm/mach-excite/excite_fpga.h
===================================================================
--- linux-queue.orig/arch/mips/include/asm/mach-excite/excite_fpga.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef EXCITE_FPGA_H_INCLUDED
-#define EXCITE_FPGA_H_INCLUDED
-
-
-/**
- * Address alignment of the individual FPGA bytes.
- * The address arrangement of the individual bytes of the FPGA is two
- * byte aligned at the embedded MK2 platform.
- */
-#ifdef EXCITE_CCI_FPGA_MK2
-typedef unsigned char excite_cci_fpga_align_t __attribute__ ((aligned(2)));
-#else
-typedef unsigned char excite_cci_fpga_align_t;
-#endif
-
-
-/**
- * Size of Dual Ported RAM.
- */
-#define EXCITE_DPR_SIZE 263
-
-
-/**
- * Size of Reserved Status Fields in Dual Ported RAM.
- */
-#define EXCITE_DPR_STATUS_SIZE 7
-
-
-
-/**
- * FPGA.
- * Hardware register layout of the FPGA interface. The FPGA must accessed
- * byte wise solely.
- * @see EXCITE_CCI_DPR_MK2
- */
-typedef struct excite_fpga {
-
-	/**
-	 * Dual Ported RAM.
-	 */
-	excite_cci_fpga_align_t dpr[EXCITE_DPR_SIZE];
-
-	/**
-	 * Status.
-	 */
-	excite_cci_fpga_align_t status[EXCITE_DPR_STATUS_SIZE];
-
-#ifdef EXCITE_CCI_FPGA_MK2
-	/**
-	 * RM9000 Interrupt.
-	 * Write access initiates interrupt at the RM9000 (MIPS) processor of the eXcite.
-	 */
-	excite_cci_fpga_align_t rm9k_int;
-#else
-	/**
-	 * MK2 Interrupt.
-	 * Write access initiates interrupt at the ARM processor of the MK2.
-	 */
-	excite_cci_fpga_align_t mk2_int;
-
-	excite_cci_fpga_align_t gap[0x1000-0x10f];
-
-	/**
-	 * IRQ Source/Acknowledge.
-	 */
-	excite_cci_fpga_align_t rm9k_irq_src;
-
-	/**
-	 * IRQ Mask.
-	 * Set bits enable the related interrupt.
-	 */
-	excite_cci_fpga_align_t rm9k_irq_mask;
-#endif
-
-
-} excite_fpga;
-
-
-
-#endif	/* ndef EXCITE_FPGA_H_INCLUDED */
Index: linux-queue/arch/mips/include/asm/mach-excite/excite_nandflash.h
===================================================================
--- linux-queue.orig/arch/mips/include/asm/mach-excite/excite_nandflash.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __EXCITE_NANDFLASH_H__
-#define __EXCITE_NANDFLASH_H__
-
-/* Resource names */
-#define EXCITE_NANDFLASH_RESOURCE_REGS	"excite_nandflash_regs"
-
-#endif /* __EXCITE_NANDFLASH_H__ */
Index: linux-queue/arch/mips/include/asm/mach-excite/rm9k_eth.h
===================================================================
--- linux-queue.orig/arch/mips/include/asm/mach-excite/rm9k_eth.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#if !defined(__RM9K_ETH_H__)
-#define __RM9K_ETH_H__
-
-#define RM9K_GE_NAME			"rm9k_ge"
-
-/* Resource names */
-#define RM9K_GE_RESOURCE_MAC      	"rm9k_ge_mac"
-#define RM9K_GE_RESOURCE_MSTAT      	"rm9k_ge_mstat"
-#define RM9K_GE_RESOURCE_PKTPROC	"rm9k_ge_pktproc"
-#define RM9K_GE_RESOURCE_XDMA		"rm9k_ge_xdma"
-#define RM9K_GE_RESOURCE_FIFO_RX  	"rm9k_ge_fifo_rx"
-#define RM9K_GE_RESOURCE_FIFO_TX  	"rm9k_ge_fifo_tx"
-#define RM9K_GE_RESOURCE_FIFOMEM_RX  	"rm9k_ge_fifo_memory_rx"
-#define RM9K_GE_RESOURCE_FIFOMEM_TX  	"rm9k_ge_fifo_memory_tx"
-#define RM9K_GE_RESOURCE_PHY      	"rm9k_ge_phy"
-#define RM9K_GE_RESOURCE_DMADESC_RX  	"rm9k_ge_dmadesc_rx"
-#define RM9K_GE_RESOURCE_DMADESC_TX  	"rm9k_ge_dmadesc_tx"
-#define RM9K_GE_RESOURCE_IRQ_MAIN	"rm9k_ge_irq_main"
-#define RM9K_GE_RESOURCE_IRQ_PHY	"rm9k_ge_irq_phy"
-#define RM9K_GE_RESOURCE_GPI_SLICE	"rm9k_ge_gpi_slice"
-#define RM9K_GE_RESOURCE_MDIO_CHANNEL	"rm9k_ge_mdio_channel"
-
-#endif /* !defined(__RM9K_ETH_H__) */
Index: linux-queue/arch/mips/include/asm/mach-excite/rm9k_wdt.h
===================================================================
--- linux-queue.orig/arch/mips/include/asm/mach-excite/rm9k_wdt.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __RM9K_WDT_H__
-#define __RM9K_WDT_H__
-
-/* Device name */
-#define WDT_NAME		"wdt_gpi"
-
-/* Resource names */
-#define WDT_RESOURCE_REGS	"excite_watchdog_regs"
-#define WDT_RESOURCE_IRQ	"excite_watchdog_irq"
-#define WDT_RESOURCE_COUNTER	"excite_watchdog_counter"
-
-#endif /* __RM9K_WDT_H__ */
Index: linux-queue/arch/mips/include/asm/mach-excite/rm9k_xicap.h
===================================================================
--- linux-queue.orig/arch/mips/include/asm/mach-excite/rm9k_xicap.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef __EXCITE_XICAP_H__
-#define __EXCITE_XICAP_H__
-
-
-/* Resource names */
-#define XICAP_RESOURCE_FIFO_RX		"xicap_fifo_rx"
-#define XICAP_RESOURCE_FIFO_TX		"xicap_fifo_tx"
-#define XICAP_RESOURCE_XDMA 		"xicap_xdma"
-#define XICAP_RESOURCE_DMADESC		"xicap_dmadesc"
-#define XICAP_RESOURCE_PKTPROC  	"xicap_pktproc"
-#define XICAP_RESOURCE_IRQ		"xicap_irq"
-#define XICAP_RESOURCE_GPI_SLICE	"xicap_gpi_slice"
-#define XICAP_RESOURCE_FIFO_BLK		"xicap_fifo_blocks"
-#define XICAP_RESOURCE_PKT_STREAM	"xicap_pkt_stream"
-
-#endif /* __EXCITE_XICAP_H__ */
Index: linux-queue/arch/mips/include/asm/mach-excite/war.h
===================================================================
--- linux-queue.orig/arch/mips/include/asm/mach-excite/war.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
- */
-#ifndef __ASM_MIPS_MACH_EXCITE_WAR_H
-#define __ASM_MIPS_MACH_EXCITE_WAR_H
-
-#define R4600_V1_INDEX_ICACHEOP_WAR	0
-#define R4600_V1_HIT_CACHEOP_WAR	0
-#define R4600_V2_HIT_CACHEOP_WAR	0
-#define R5432_CP0_INTERRUPT_WAR		0
-#define BCM1250_M3_WAR			0
-#define SIBYTE_1956_WAR			0
-#define MIPS4K_ICACHE_REFILL_WAR	0
-#define MIPS_CACHE_SYNC_WAR		0
-#define TX49XX_ICACHE_INDEX_INV_WAR	0
-#define RM9000_CDEX_SMP_WAR		1
-#define ICACHE_REFILLS_WORKAROUND_WAR   1
-#define R10000_LLSC_WAR			0
-#define MIPS34K_MISSED_ITLB_WAR	0
-
-#endif /* __ASM_MIPS_MACH_EXCITE_WAR_H */
Index: linux-queue/drivers/mtd/nand/Makefile
===================================================================
--- linux-queue.orig/drivers/mtd/nand/Makefile
+++ linux-queue/drivers/mtd/nand/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_MTD_NAND_ATMEL)		+= atmel_n
 obj-$(CONFIG_MTD_NAND_GPIO)		+= gpio.o
 obj-$(CONFIG_MTD_NAND_OMAP2) 		+= omap2.o
 obj-$(CONFIG_MTD_NAND_CM_X270)		+= cmx270_nand.o
-obj-$(CONFIG_MTD_NAND_BASLER_EXCITE)	+= excite_nandflash.o
 obj-$(CONFIG_MTD_NAND_PXA3xx)		+= pxa3xx_nand.o
 obj-$(CONFIG_MTD_NAND_TMIO)		+= tmio_nand.o
 obj-$(CONFIG_MTD_NAND_PLATFORM)		+= plat_nand.o
Index: linux-queue/drivers/mtd/nand/excite_nandflash.c
===================================================================
--- linux-queue.orig/drivers/mtd/nand/excite_nandflash.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
-*  Copyright (C) 2005 - 2007 by Basler Vision Technologies AG
-*  Author: Thomas Koeller <thomas.koeller.qbaslerweb.com>
-*  Original code by Thies Moeller <thies.moeller@baslerweb.com>
-*
-*  This program is free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  This program is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  You should have received a copy of the GNU General Public License
-*  along with this program; if not, write to the Free Software
-*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/ioport.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-#include <linux/err.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/nand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <asm/io.h>
-#include <asm/rm9k-ocd.h>
-
-#include <excite_nandflash.h>
-
-#define EXCITE_NANDFLASH_VERSION "0.1"
-
-/* I/O register offsets */
-#define EXCITE_NANDFLASH_DATA_BYTE   0x00
-#define EXCITE_NANDFLASH_STATUS_BYTE 0x0c
-#define EXCITE_NANDFLASH_ADDR_BYTE   0x10
-#define EXCITE_NANDFLASH_CMD_BYTE    0x14
-
-/* prefix for debug output */
-static const char module_id[] = "excite_nandflash";
-
-/*
- * partition definition
- */
-static const struct mtd_partition partition_info[] = {
-	{
-		.name = "eXcite RootFS",
-		.offset = 0,
-		.size = MTDPART_SIZ_FULL
-	}
-};
-
-static inline const struct resource *
-excite_nand_get_resource(struct platform_device *d, unsigned long flags,
-			 const char *basename)
-{
-	char buf[80];
-
-	if (snprintf(buf, sizeof buf, "%s_%u", basename, d->id) >= sizeof buf)
-		return NULL;
-	return platform_get_resource_byname(d, flags, buf);
-}
-
-static inline void __iomem *
-excite_nand_map_regs(struct platform_device *d, const char *basename)
-{
-	void *result = NULL;
-	const struct resource *const r =
-	    excite_nand_get_resource(d, IORESOURCE_MEM, basename);
-
-	if (r)
-		result = ioremap_nocache(r->start, r->end + 1 - r->start);
-	return result;
-}
-
-/* controller and mtd information */
-struct excite_nand_drvdata {
-	struct mtd_info board_mtd;
-	struct nand_chip board_chip;
-	void __iomem *regs;
-	void __iomem *tgt;
-};
-
-/* Control function */
-static void excite_nand_control(struct mtd_info *mtd, int cmd,
-				       unsigned int ctrl)
-{
-	struct excite_nand_drvdata * const d =
-	    container_of(mtd, struct excite_nand_drvdata, board_mtd);
-
-	switch (ctrl) {
-	case NAND_CTRL_CHANGE | NAND_CTRL_CLE:
-		d->tgt = d->regs + EXCITE_NANDFLASH_CMD_BYTE;
-		break;
-	case NAND_CTRL_CHANGE | NAND_CTRL_ALE:
-		d->tgt = d->regs + EXCITE_NANDFLASH_ADDR_BYTE;
-		break;
-	case NAND_CTRL_CHANGE | NAND_NCE:
-		d->tgt = d->regs + EXCITE_NANDFLASH_DATA_BYTE;
-		break;
-	}
-
-	if (cmd != NAND_CMD_NONE)
-		__raw_writeb(cmd, d->tgt);
-}
-
-/* Return 0 if flash is busy, 1 if ready */
-static int excite_nand_devready(struct mtd_info *mtd)
-{
-	struct excite_nand_drvdata * const drvdata =
-	    container_of(mtd, struct excite_nand_drvdata, board_mtd);
-
-	return __raw_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS_BYTE);
-}
-
-/*
- * Called by device layer to remove the driver.
- * The binding to the mtd and all allocated
- * resources are released.
- */
-static int __exit excite_nand_remove(struct platform_device *dev)
-{
-	struct excite_nand_drvdata * const this = platform_get_drvdata(dev);
-
-	platform_set_drvdata(dev, NULL);
-
-	if (unlikely(!this)) {
-		printk(KERN_ERR "%s: called %s without private data!!",
-		       module_id, __func__);
-		return -EINVAL;
-	}
-
-	/* first thing we need to do is release our mtd
-	 * then go through freeing the resource used
-	 */
-	nand_release(&this->board_mtd);
-
-	/* free the common resources */
-	iounmap(this->regs);
-	kfree(this);
-
-	DEBUG(MTD_DEBUG_LEVEL1, "%s: removed\n", module_id);
-	return 0;
-}
-
-/*
- * Called by device layer when it finds a device matching
- * one our driver can handle. This code checks to see if
- * it can allocate all necessary resources then calls the
- * nand layer to look for devices.
-*/
-static int __init excite_nand_probe(struct platform_device *pdev)
-{
-	struct excite_nand_drvdata *drvdata;	/* private driver data */
-	struct nand_chip *board_chip;	/* private flash chip data */
-	struct mtd_info *board_mtd;	/* mtd info for this board */
-	int scan_res;
-
-	drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
-	if (unlikely(!drvdata)) {
-		printk(KERN_ERR "%s: no memory for drvdata\n",
-		       module_id);
-		return -ENOMEM;
-	}
-
-	/* bind private data into driver */
-	platform_set_drvdata(pdev, drvdata);
-
-	/* allocate and map the resource */
-	drvdata->regs =
-		excite_nand_map_regs(pdev, EXCITE_NANDFLASH_RESOURCE_REGS);
-
-	if (unlikely(!drvdata->regs)) {
-		printk(KERN_ERR "%s: cannot reserve register region\n",
-		       module_id);
-		kfree(drvdata);
-		return -ENXIO;
-	}
-	
-	drvdata->tgt = drvdata->regs + EXCITE_NANDFLASH_DATA_BYTE;
-
-	/* initialise our chip */
-	board_chip = &drvdata->board_chip;
-	board_chip->IO_ADDR_R = board_chip->IO_ADDR_W =
-		drvdata->regs + EXCITE_NANDFLASH_DATA_BYTE;
-	board_chip->cmd_ctrl = excite_nand_control;
-	board_chip->dev_ready = excite_nand_devready;
-	board_chip->chip_delay = 25;
-	board_chip->ecc.mode = NAND_ECC_SOFT;
-
-	/* link chip to mtd */
-	board_mtd = &drvdata->board_mtd;
-	board_mtd->priv = board_chip;
-
-	DEBUG(MTD_DEBUG_LEVEL2, "%s: device scan\n", module_id);
-	scan_res = nand_scan(&drvdata->board_mtd, 1);
-
-	if (likely(!scan_res)) {
-		DEBUG(MTD_DEBUG_LEVEL2, "%s: register partitions\n", module_id);
-		add_mtd_partitions(&drvdata->board_mtd, partition_info,
-				   ARRAY_SIZE(partition_info));
-	} else {
-		iounmap(drvdata->regs);
-		kfree(drvdata);
-		printk(KERN_ERR "%s: device scan failed\n", module_id);
-		return -EIO;
-	}
-	return 0;
-}
-
-static struct platform_driver excite_nand_driver = {
-	.driver = {
-		.name = "excite_nand",
-		.owner		= THIS_MODULE,
-	},
-	.probe = excite_nand_probe,
-	.remove = __devexit_p(excite_nand_remove)
-};
-
-static int __init excite_nand_init(void)
-{
-	pr_info("Basler eXcite nand flash driver Version "
-		EXCITE_NANDFLASH_VERSION "\n");
-	return platform_driver_register(&excite_nand_driver);
-}
-
-static void __exit excite_nand_exit(void)
-{
-	platform_driver_unregister(&excite_nand_driver);
-}
-
-module_init(excite_nand_init);
-module_exit(excite_nand_exit);
-
-MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
-MODULE_DESCRIPTION("Basler eXcite NAND-Flash driver");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(EXCITE_NANDFLASH_VERSION)
Index: linux-queue/drivers/mtd/nand/Kconfig
===================================================================
--- linux-queue.orig/drivers/mtd/nand/Kconfig
+++ linux-queue/drivers/mtd/nand/Kconfig
@@ -277,14 +277,6 @@ config MTD_NAND_SHARPSL
 	tristate "Support for NAND Flash on Sharp SL Series (C7xx + others)"
 	depends on ARCH_PXA
 
-config MTD_NAND_BASLER_EXCITE
-	tristate  "Support for NAND Flash on Basler eXcite"
-	depends on BASLER_EXCITE
-	help
-          This enables the driver for the NAND flash device found on the
-          Basler eXcite Smart Camera. If built as a module, the driver
-          will be named excite_nandflash.
-
 config MTD_NAND_CAFE
 	tristate "NAND support for OLPC CAF chip"
 	depends on PCI
Index: linux-queue/arch/mips/configs/ar7_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/ar7_defconfig
+++ linux-queue/arch/mips/configs/ar7_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
 #
 # CONFIG_MACH_ALCHEMY is not set
 CONFIG_AR7=y
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/bcm47xx_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/bcm47xx_defconfig
+++ linux-queue/arch/mips/configs/bcm47xx_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 CONFIG_BCM47XX=y
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/bcm63xx_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/bcm63xx_defconfig
+++ linux-queue/arch/mips/configs/bcm63xx_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 CONFIG_BCM63XX=y
 # CONFIG_MIPS_COBALT is not set
Index: linux-queue/arch/mips/configs/bigsur_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/bigsur_defconfig
+++ linux-queue/arch/mips/configs/bigsur_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/capcella_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/capcella_defconfig
+++ linux-queue/arch/mips/configs/capcella_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/cavium-octeon_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/cavium-octeon_defconfig
+++ linux-queue/arch/mips/configs/cavium-octeon_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/cobalt_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/cobalt_defconfig
+++ linux-queue/arch/mips/configs/cobalt_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 CONFIG_MIPS_COBALT=y
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/db1000_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/db1000_defconfig
+++ linux-queue/arch/mips/configs/db1000_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_DB1000=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/db1100_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/db1100_defconfig
+++ linux-queue/arch/mips/configs/db1100_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_DB1100=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/db1200_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/db1200_defconfig
+++ linux-queue/arch/mips/configs/db1200_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
 #
 CONFIG_MACH_ALCHEMY=y
 # CONFIG_AR7 is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
Index: linux-queue/arch/mips/configs/db1500_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/db1500_defconfig
+++ linux-queue/arch/mips/configs/db1500_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_DB1500=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/db1550_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/db1550_defconfig
+++ linux-queue/arch/mips/configs/db1550_defconfig
@@ -23,7 +23,6 @@ CONFIG_MACH_ALCHEMY=y
 CONFIG_MIPS_DB1550=y
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/decstation_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/decstation_defconfig
+++ linux-queue/arch/mips/configs/decstation_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 CONFIG_MACH_DECSTATION=y
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/e55_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/e55_defconfig
+++ linux-queue/arch/mips/configs/e55_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/excite_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/excite_defconfig
+++ /dev/null
@@ -1,1335 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:31 2007
-#
-CONFIG_MIPS=y
-
-#
-# Machine selection
-#
-CONFIG_ZONE_DMA=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
-CONFIG_BASLER_EXCITE=y
-# CONFIG_BASLER_EXCITE_PROTOTYPE is not set
-# CONFIG_MIPS_COBALT is not set
-# CONFIG_MACH_DECSTATION is not set
-# CONFIG_MACH_JAZZ is not set
-# CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
-# CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
-# CONFIG_PNX8550_JBS is not set
-# CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
-# CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
-# CONFIG_SGI_IP22 is not set
-# CONFIG_SGI_IP27 is not set
-# CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
-# CONFIG_SIBYTE_CRHINE is not set
-# CONFIG_SIBYTE_CRHONE is not set
-# CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_ARCH_HAS_ILOG2_U32 is not set
-# CONFIG_ARCH_HAS_ILOG2_U64 is not set
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
-CONFIG_DMA_COHERENT=y
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_LITTLE_ENDIAN is not set
-CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
-CONFIG_IRQ_CPU=y
-CONFIG_IRQ_CPU_RM7K=y
-CONFIG_IRQ_CPU_RM9K=y
-CONFIG_MIPS_RM9122=y
-CONFIG_SERIAL_RM9000=y
-CONFIG_GPI_RM9000=y
-CONFIG_WDT_RM9000=y
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-
-#
-# CPU selection
-#
-# CONFIG_CPU_MIPS32_R1 is not set
-# CONFIG_CPU_MIPS32_R2 is not set
-# CONFIG_CPU_MIPS64_R1 is not set
-# CONFIG_CPU_MIPS64_R2 is not set
-# CONFIG_CPU_R3000 is not set
-# CONFIG_CPU_TX39XX is not set
-# CONFIG_CPU_VR41XX is not set
-# CONFIG_CPU_R4300 is not set
-# CONFIG_CPU_R4X00 is not set
-# CONFIG_CPU_TX49XX is not set
-# CONFIG_CPU_R5000 is not set
-# CONFIG_CPU_R5432 is not set
-# CONFIG_CPU_R6000 is not set
-# CONFIG_CPU_NEVADA is not set
-# CONFIG_CPU_R8000 is not set
-# CONFIG_CPU_R10000 is not set
-# CONFIG_CPU_RM7000 is not set
-CONFIG_CPU_RM9000=y
-# CONFIG_CPU_SB1 is not set
-CONFIG_SYS_HAS_CPU_RM9000=y
-CONFIG_WEAK_ORDERING=y
-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
-
-#
-# Kernel type
-#
-CONFIG_32BIT=y
-# CONFIG_64BIT is not set
-CONFIG_PAGE_SIZE_4KB=y
-# CONFIG_PAGE_SIZE_8KB is not set
-# CONFIG_PAGE_SIZE_16KB is not set
-# CONFIG_PAGE_SIZE_64KB is not set
-CONFIG_CPU_HAS_PREFETCH=y
-CONFIG_MIPS_MT_DISABLED=y
-# CONFIG_MIPS_MT_SMP is not set
-# CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
-# CONFIG_64BIT_PHYS_ADDR is not set
-CONFIG_CPU_HAS_SYNC=y
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_IRQ_PROBE=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-CONFIG_ARCH_FLATMEM_ENABLE=y
-CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
-CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=1
-# CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
-# CONFIG_HZ_128 is not set
-# CONFIG_HZ_250 is not set
-# CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
-# CONFIG_HZ_1024 is not set
-CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
-# CONFIG_PREEMPT_NONE is not set
-# CONFIG_PREEMPT_VOLUNTARY is not set
-CONFIG_PREEMPT=y
-CONFIG_PREEMPT_BKL=y
-# CONFIG_KEXEC is not set
-CONFIG_LOCKDEP_SUPPORT=y
-CONFIG_STACKTRACE_SUPPORT=y
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_LOCK_KERNEL=y
-CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
-# CONFIG_LOCALVERSION_AUTO is not set
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
-CONFIG_SYSVIPC_SYSCTL=y
-CONFIG_POSIX_MQUEUE=y
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
-# CONFIG_AUDIT is not set
-# CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-# CONFIG_RELAY is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_SYSCTL=y
-CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
-CONFIG_HOTPLUG=y
-CONFIG_PRINTK=y
-CONFIG_BUG=y
-CONFIG_ELF_CORE=y
-CONFIG_BASE_FULL=y
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_SHMEM=y
-CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_MODULE_FORCE_UNLOAD is not set
-# CONFIG_MODVERSIONS is not set
-# CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
-CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
-# CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-
-#
-# Bus options (PCI, PCMCIA, EISA, ISA, TC)
-#
-CONFIG_HW_HAS_PCI=y
-CONFIG_PCI=y
-CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-# CONFIG_PCCARD is not set
-
-#
-# PCI Hotplug Support
-#
-# CONFIG_HOTPLUG_PCI is not set
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_MISC is not set
-CONFIG_TRAD_SIGNALS=y
-
-#
-# Power management options
-#
-CONFIG_PM=y
-# CONFIG_PM_LEGACY is not set
-# CONFIG_PM_DEBUG is not set
-# CONFIG_PM_SYSFS_DEPRECATED is not set
-
-#
-# Networking
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-# CONFIG_NETDEBUG is not set
-CONFIG_PACKET=y
-CONFIG_PACKET_MMAP=y
-CONFIG_UNIX=y
-CONFIG_XFRM=y
-# CONFIG_XFRM_USER is not set
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-# CONFIG_NET_KEY is not set
-CONFIG_INET=y
-# CONFIG_IP_MULTICAST is not set
-# CONFIG_IP_ADVANCED_ROUTER is not set
-CONFIG_IP_FIB_HASH=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-# CONFIG_IP_PNP_BOOTP is not set
-# CONFIG_IP_PNP_RARP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_ARPD is not set
-# CONFIG_SYN_COOKIES is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_XFRM_TUNNEL is not set
-# CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
-# CONFIG_TCP_CONG_ADVANCED is not set
-CONFIG_TCP_CONG_CUBIC=y
-CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-# CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-# CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
-# CONFIG_TIPC is not set
-# CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-# CONFIG_ECONET is not set
-# CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
-# CONFIG_NET_SCHED is not set
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
-# CONFIG_BT is not set
-# CONFIG_IEEE80211 is not set
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
-# CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-# CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-CONFIG_MTD=y
-# CONFIG_MTD_DEBUG is not set
-# CONFIG_MTD_CONCAT is not set
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-
-#
-# User Modules And Translation Layers
-#
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
-# CONFIG_FTL is not set
-# CONFIG_NFTL is not set
-# CONFIG_INFTL is not set
-# CONFIG_RFD_FTL is not set
-# CONFIG_SSFDC is not set
-
-#
-# RAM/ROM/Flash chip drivers
-#
-# CONFIG_MTD_CFI is not set
-# CONFIG_MTD_JEDECPROBE is not set
-CONFIG_MTD_MAP_BANK_WIDTH_1=y
-CONFIG_MTD_MAP_BANK_WIDTH_2=y
-CONFIG_MTD_MAP_BANK_WIDTH_4=y
-# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
-CONFIG_MTD_CFI_I1=y
-CONFIG_MTD_CFI_I2=y
-# CONFIG_MTD_CFI_I4 is not set
-# CONFIG_MTD_CFI_I8 is not set
-# CONFIG_MTD_RAM is not set
-# CONFIG_MTD_ROM is not set
-# CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
-
-#
-# Mapping drivers for chip access
-#
-# CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PLATRAM is not set
-
-#
-# Self-contained MTD device drivers
-#
-# CONFIG_MTD_PMC551 is not set
-# CONFIG_MTD_SLRAM is not set
-# CONFIG_MTD_PHRAM is not set
-# CONFIG_MTD_MTDRAM is not set
-# CONFIG_MTD_BLOCK2MTD is not set
-
-#
-# Disk-On-Chip Device Drivers
-#
-# CONFIG_MTD_DOC2000 is not set
-# CONFIG_MTD_DOC2001 is not set
-# CONFIG_MTD_DOC2001PLUS is not set
-
-#
-# NAND Flash Device Drivers
-#
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_VERIFY_WRITE=y
-# CONFIG_MTD_NAND_ECC_SMC is not set
-CONFIG_MTD_NAND_IDS=y
-# CONFIG_MTD_NAND_DISKONCHIP is not set
-# CONFIG_MTD_NAND_BASLER_EXCITE is not set
-# CONFIG_MTD_NAND_CAFE is not set
-# CONFIG_MTD_NAND_NANDSIM is not set
-
-#
-# OneNAND Flash Device Drivers
-#
-# CONFIG_MTD_ONENAND is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
-#
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_BLK_DEV_DAC960 is not set
-# CONFIG_BLK_DEV_UMEM is not set
-# CONFIG_BLK_DEV_COW_COMMON is not set
-CONFIG_BLK_DEV_LOOP=m
-# CONFIG_BLK_DEV_CRYPTOLOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_SX8 is not set
-# CONFIG_BLK_DEV_UB is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-# CONFIG_CDROM_PKTCDVD is not set
-# CONFIG_ATA_OVER_ETH is not set
-
-#
-# Misc devices
-#
-CONFIG_SGI_IOC4=m
-# CONFIG_TIFM_CORE is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# SCSI device support
-#
-# CONFIG_RAID_ATTRS is not set
-CONFIG_SCSI=y
-CONFIG_SCSI_TGT=m
-# CONFIG_SCSI_NETLINK is not set
-# CONFIG_SCSI_PROC_FS is not set
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
-CONFIG_BLK_DEV_SD=y
-# CONFIG_CHR_DEV_ST is not set
-# CONFIG_CHR_DEV_OSST is not set
-# CONFIG_BLK_DEV_SR is not set
-# CONFIG_CHR_DEV_SG is not set
-# CONFIG_CHR_DEV_SCH is not set
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
-# CONFIG_SCSI_MULTI_LUN is not set
-# CONFIG_SCSI_CONSTANTS is not set
-# CONFIG_SCSI_LOGGING is not set
-CONFIG_SCSI_SCAN_ASYNC=y
-
-#
-# SCSI Transports
-#
-# CONFIG_SCSI_SPI_ATTRS is not set
-# CONFIG_SCSI_FC_ATTRS is not set
-# CONFIG_SCSI_ISCSI_ATTRS is not set
-CONFIG_SCSI_SAS_ATTRS=m
-CONFIG_SCSI_SAS_LIBSAS=m
-# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
-
-#
-# SCSI low-level drivers
-#
-# CONFIG_ISCSI_TCP is not set
-# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
-# CONFIG_SCSI_3W_9XXX is not set
-# CONFIG_SCSI_ACARD is not set
-# CONFIG_SCSI_AACRAID is not set
-# CONFIG_SCSI_AIC7XXX is not set
-# CONFIG_SCSI_AIC7XXX_OLD is not set
-# CONFIG_SCSI_AIC79XX is not set
-CONFIG_SCSI_AIC94XX=m
-# CONFIG_AIC94XX_DEBUG is not set
-# CONFIG_SCSI_DPT_I2O is not set
-# CONFIG_SCSI_ARCMSR is not set
-# CONFIG_MEGARAID_NEWGEN is not set
-# CONFIG_MEGARAID_LEGACY is not set
-# CONFIG_MEGARAID_SAS is not set
-# CONFIG_SCSI_HPTIOP is not set
-# CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_FUTURE_DOMAIN is not set
-# CONFIG_SCSI_IPS is not set
-# CONFIG_SCSI_INITIO is not set
-# CONFIG_SCSI_INIA100 is not set
-# CONFIG_SCSI_STEX is not set
-# CONFIG_SCSI_SYM53C8XX_2 is not set
-# CONFIG_SCSI_QLOGIC_1280 is not set
-# CONFIG_SCSI_QLA_FC is not set
-# CONFIG_SCSI_QLA_ISCSI is not set
-# CONFIG_SCSI_LPFC is not set
-# CONFIG_SCSI_DC395x is not set
-# CONFIG_SCSI_DC390T is not set
-# CONFIG_SCSI_NSP32 is not set
-# CONFIG_SCSI_DEBUG is not set
-# CONFIG_SCSI_SRP is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
-# CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-# CONFIG_FUSION is not set
-# CONFIG_FUSION_SPI is not set
-# CONFIG_FUSION_FC is not set
-# CONFIG_FUSION_SAS is not set
-
-#
-# IEEE 1394 (FireWire) support
-#
-# CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
-# CONFIG_I2O is not set
-
-#
-# Network device support
-#
-CONFIG_NETDEVICES=y
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
-
-#
-# Ethernet (10 or 100Mbit)
-#
-# CONFIG_NET_ETHERNET is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_ACENIC is not set
-# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
-# CONFIG_NS83820 is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
-# CONFIG_SKGE is not set
-# CONFIG_SKY2 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_TIGON3 is not set
-# CONFIG_BNX2 is not set
-CONFIG_QLA3XXX=m
-# CONFIG_ATL1 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-# CONFIG_CHELSIO_T1 is not set
-CONFIG_CHELSIO_T3=m
-# CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
-# CONFIG_MYRI10GE is not set
-CONFIG_NETXEN_NIC=m
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
-# CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-# CONFIG_INPUT_FF_MEMLESS is not set
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=m
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-CONFIG_INPUT_EVDEV=m
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input Device Drivers
-#
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Hardware I/O ports
-#
-# CONFIG_SERIO is not set
-# CONFIG_GAMEPORT is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-CONFIG_VT_HW_CONSOLE_BINDING=y
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_PCI=y
-CONFIG_SERIAL_8250_NR_UARTS=2
-CONFIG_SERIAL_8250_RUNTIME_UARTS=2
-CONFIG_SERIAL_8250_EXTENDED=y
-# CONFIG_SERIAL_8250_MANY_PORTS is not set
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-# CONFIG_SERIAL_8250_DETECT_IRQ is not set
-# CONFIG_SERIAL_8250_RSA is not set
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-# CONFIG_SERIAL_JSM is not set
-CONFIG_UNIX98_PTYS=y
-# CONFIG_LEGACY_PTYS is not set
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-
-#
-# Watchdog Device Drivers
-#
-# CONFIG_SOFT_WATCHDOG is not set
-CONFIG_WDT_RM9K_GPI=m
-
-#
-# PCI-based Watchdog Cards
-#
-# CONFIG_PCIPCWATCHDOG is not set
-# CONFIG_WDTPCI is not set
-
-#
-# USB-based Watchdog Cards
-#
-# CONFIG_USBPCWATCHDOG is not set
-# CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-# CONFIG_APPLICOM is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
-# CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# SPI support
-#
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
-# CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
-# CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-# CONFIG_USB_DABUSB is not set
-
-#
-# Graphics support
-#
-# CONFIG_FIRMWARE_EDID is not set
-CONFIG_FB=y
-# CONFIG_FB_CFB_FILLRECT is not set
-# CONFIG_FB_CFB_COPYAREA is not set
-# CONFIG_FB_CFB_IMAGEBLIT is not set
-# CONFIG_FB_SVGALIB is not set
-# CONFIG_FB_MACMODES is not set
-# CONFIG_FB_BACKLIGHT is not set
-# CONFIG_FB_MODE_HELPERS is not set
-# CONFIG_FB_TILEBLITTING is not set
-# CONFIG_FB_CIRRUS is not set
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_ASILIANT is not set
-# CONFIG_FB_IMSTT is not set
-# CONFIG_FB_S1D13XXX is not set
-# CONFIG_FB_NVIDIA is not set
-# CONFIG_FB_RIVA is not set
-# CONFIG_FB_MATROX is not set
-# CONFIG_FB_RADEON is not set
-# CONFIG_FB_ATY128 is not set
-# CONFIG_FB_ATY is not set
-# CONFIG_FB_S3 is not set
-# CONFIG_FB_SAVAGE is not set
-# CONFIG_FB_SIS is not set
-# CONFIG_FB_NEOMAGIC is not set
-# CONFIG_FB_KYRO is not set
-# CONFIG_FB_3DFX is not set
-# CONFIG_FB_VOODOO1 is not set
-# CONFIG_FB_SMIVGX is not set
-# CONFIG_FB_TRIDENT is not set
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=m
-# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
-# CONFIG_FONTS is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
-
-#
-# Logo configuration
-#
-# CONFIG_LOGO is not set
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
-CONFIG_HID=y
-# CONFIG_HID_DEBUG is not set
-
-#
-# USB support
-#
-CONFIG_USB_ARCH_HAS_HCD=y
-CONFIG_USB_ARCH_HAS_OHCI=y
-CONFIG_USB_ARCH_HAS_EHCI=y
-CONFIG_USB=y
-# CONFIG_USB_DEBUG is not set
-
-#
-# Miscellaneous USB options
-#
-CONFIG_USB_DEVICEFS=y
-# CONFIG_USB_DYNAMIC_MINORS is not set
-# CONFIG_USB_SUSPEND is not set
-# CONFIG_USB_OTG is not set
-
-#
-# USB Host Controller Drivers
-#
-CONFIG_USB_EHCI_HCD=y
-# CONFIG_USB_EHCI_SPLIT_ISO is not set
-# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
-# CONFIG_USB_EHCI_TT_NEWSCHED is not set
-# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
-# CONFIG_USB_ISP116X_HCD is not set
-CONFIG_USB_OHCI_HCD=y
-# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
-# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
-CONFIG_USB_OHCI_LITTLE_ENDIAN=y
-# CONFIG_USB_UHCI_HCD is not set
-# CONFIG_USB_SL811_HCD is not set
-
-#
-# USB Device Class drivers
-#
-# CONFIG_USB_ACM is not set
-# CONFIG_USB_PRINTER is not set
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
-#
-
-#
-# may also be needed; see USB_STORAGE Help for more information
-#
-CONFIG_USB_STORAGE=y
-# CONFIG_USB_STORAGE_DEBUG is not set
-# CONFIG_USB_STORAGE_DATAFAB is not set
-# CONFIG_USB_STORAGE_FREECOM is not set
-# CONFIG_USB_STORAGE_DPCM is not set
-# CONFIG_USB_STORAGE_USBAT is not set
-# CONFIG_USB_STORAGE_SDDR09 is not set
-# CONFIG_USB_STORAGE_SDDR55 is not set
-# CONFIG_USB_STORAGE_JUMPSHOT is not set
-# CONFIG_USB_STORAGE_ALAUDA is not set
-# CONFIG_USB_STORAGE_KARMA is not set
-# CONFIG_USB_LIBUSUAL is not set
-
-#
-# USB Input Devices
-#
-CONFIG_USB_HID=m
-# CONFIG_USB_HIDINPUT_POWERBOOK is not set
-# CONFIG_HID_FF is not set
-# CONFIG_USB_HIDDEV is not set
-
-#
-# USB HID Boot Protocol drivers
-#
-# CONFIG_USB_KBD is not set
-# CONFIG_USB_MOUSE is not set
-# CONFIG_USB_AIPTEK is not set
-# CONFIG_USB_WACOM is not set
-# CONFIG_USB_ACECAD is not set
-# CONFIG_USB_KBTAB is not set
-# CONFIG_USB_POWERMATE is not set
-# CONFIG_USB_TOUCHSCREEN is not set
-# CONFIG_USB_YEALINK is not set
-# CONFIG_USB_XPAD is not set
-# CONFIG_USB_ATI_REMOTE is not set
-# CONFIG_USB_ATI_REMOTE2 is not set
-# CONFIG_USB_KEYSPAN_REMOTE is not set
-# CONFIG_USB_APPLETOUCH is not set
-# CONFIG_USB_GTCO is not set
-
-#
-# USB Imaging devices
-#
-# CONFIG_USB_MDC800 is not set
-# CONFIG_USB_MICROTEK is not set
-
-#
-# USB Network Adapters
-#
-# CONFIG_USB_CATC is not set
-# CONFIG_USB_KAWETH is not set
-# CONFIG_USB_PEGASUS is not set
-# CONFIG_USB_RTL8150 is not set
-# CONFIG_USB_USBNET_MII is not set
-# CONFIG_USB_USBNET is not set
-# CONFIG_USB_MON is not set
-
-#
-# USB port drivers
-#
-
-#
-# USB Serial Converter support
-#
-# CONFIG_USB_SERIAL is not set
-
-#
-# USB Miscellaneous drivers
-#
-# CONFIG_USB_EMI62 is not set
-# CONFIG_USB_EMI26 is not set
-# CONFIG_USB_ADUTUX is not set
-# CONFIG_USB_AUERSWALD is not set
-# CONFIG_USB_RIO500 is not set
-# CONFIG_USB_LEGOTOWER is not set
-# CONFIG_USB_LCD is not set
-# CONFIG_USB_BERRY_CHARGE is not set
-# CONFIG_USB_LED is not set
-# CONFIG_USB_CYPRESS_CY7C63 is not set
-# CONFIG_USB_CYTHERM is not set
-# CONFIG_USB_PHIDGET is not set
-# CONFIG_USB_IDMOUSE is not set
-# CONFIG_USB_FTDI_ELAN is not set
-# CONFIG_USB_APPLEDISPLAY is not set
-# CONFIG_USB_SISUSBVGA is not set
-# CONFIG_USB_LD is not set
-# CONFIG_USB_TRANCEVIBRATOR is not set
-# CONFIG_USB_TEST is not set
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
-# CONFIG_MMC is not set
-
-#
-# LED devices
-#
-# CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
-# CONFIG_INFINIBAND is not set
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
-# CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Auxiliary Display support
-#
-
-#
-# Virtualization
-#
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT2_FS_XIP is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_EXT4DEV_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
-CONFIG_FS_POSIX_ACL=y
-# CONFIG_XFS_FS is not set
-# CONFIG_GFS2_FS is not set
-# CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_INOTIFY=y
-CONFIG_INOTIFY_USER=y
-# CONFIG_QUOTA is not set
-# CONFIG_DNOTIFY is not set
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-# CONFIG_FUSE_FS is not set
-CONFIG_GENERIC_ACL=y
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-CONFIG_FAT_DEFAULT_CODEPAGE=437
-CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_PROC_SYSCTL=y
-CONFIG_SYSFS=y
-CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-CONFIG_JFFS2_FS=y
-CONFIG_JFFS2_FS_DEBUG=0
-CONFIG_JFFS2_FS_WRITEBUFFER=y
-# CONFIG_JFFS2_SUMMARY is not set
-# CONFIG_JFFS2_FS_XATTR is not set
-# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
-CONFIG_JFFS2_ZLIB=y
-CONFIG_JFFS2_RTIME=y
-# CONFIG_JFFS2_RUBIN is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
-# CONFIG_NFS_V3_ACL is not set
-# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
-# CONFIG_NFSD is not set
-CONFIG_ROOT_NFS=y
-CONFIG_LOCKD=y
-CONFIG_LOCKD_V4=y
-CONFIG_NFS_COMMON=y
-CONFIG_SUNRPC=y
-# CONFIG_RPCSEC_GSS_KRB5 is not set
-# CONFIG_RPCSEC_GSS_SPKM3 is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_CIFS is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
-
-#
-# Partition Types
-#
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_ACORN_PARTITION is not set
-# CONFIG_OSF_PARTITION is not set
-# CONFIG_AMIGA_PARTITION is not set
-# CONFIG_ATARI_PARTITION is not set
-# CONFIG_MAC_PARTITION is not set
-CONFIG_MSDOS_PARTITION=y
-# CONFIG_BSD_DISKLABEL is not set
-# CONFIG_MINIX_SUBPARTITION is not set
-# CONFIG_SOLARIS_X86_PARTITION is not set
-# CONFIG_UNIXWARE_DISKLABEL is not set
-# CONFIG_LDM_PARTITION is not set
-# CONFIG_SGI_PARTITION is not set
-# CONFIG_ULTRIX_PARTITION is not set
-# CONFIG_SUN_PARTITION is not set
-# CONFIG_KARMA_PARTITION is not set
-# CONFIG_EFI_PARTITION is not set
-
-#
-# Native Language Support
-#
-CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="iso8859-1"
-CONFIG_NLS_CODEPAGE_437=m
-# CONFIG_NLS_CODEPAGE_737 is not set
-# CONFIG_NLS_CODEPAGE_775 is not set
-CONFIG_NLS_CODEPAGE_850=m
-# CONFIG_NLS_CODEPAGE_852 is not set
-# CONFIG_NLS_CODEPAGE_855 is not set
-# CONFIG_NLS_CODEPAGE_857 is not set
-# CONFIG_NLS_CODEPAGE_860 is not set
-# CONFIG_NLS_CODEPAGE_861 is not set
-# CONFIG_NLS_CODEPAGE_862 is not set
-# CONFIG_NLS_CODEPAGE_863 is not set
-# CONFIG_NLS_CODEPAGE_864 is not set
-# CONFIG_NLS_CODEPAGE_865 is not set
-# CONFIG_NLS_CODEPAGE_866 is not set
-# CONFIG_NLS_CODEPAGE_869 is not set
-# CONFIG_NLS_CODEPAGE_936 is not set
-# CONFIG_NLS_CODEPAGE_950 is not set
-# CONFIG_NLS_CODEPAGE_932 is not set
-# CONFIG_NLS_CODEPAGE_949 is not set
-# CONFIG_NLS_CODEPAGE_874 is not set
-# CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-CONFIG_NLS_ISO8859_1=m
-# CONFIG_NLS_ISO8859_2 is not set
-# CONFIG_NLS_ISO8859_3 is not set
-# CONFIG_NLS_ISO8859_4 is not set
-# CONFIG_NLS_ISO8859_5 is not set
-# CONFIG_NLS_ISO8859_6 is not set
-# CONFIG_NLS_ISO8859_7 is not set
-# CONFIG_NLS_ISO8859_9 is not set
-# CONFIG_NLS_ISO8859_13 is not set
-# CONFIG_NLS_ISO8859_14 is not set
-# CONFIG_NLS_ISO8859_15 is not set
-# CONFIG_NLS_KOI8_R is not set
-# CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-CONFIG_TRACE_IRQFLAGS_SUPPORT=y
-# CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_MUST_CHECK=y
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_FS is not set
-# CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
-CONFIG_CMDLINE=""
-
-#
-# Security options
-#
-# CONFIG_KEYS is not set
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=m
-CONFIG_CRYPTO_MANAGER=m
-# CONFIG_CRYPTO_HMAC is not set
-CONFIG_CRYPTO_XCBC=m
-# CONFIG_CRYPTO_NULL is not set
-# CONFIG_CRYPTO_MD4 is not set
-CONFIG_CRYPTO_MD5=y
-# CONFIG_CRYPTO_SHA1 is not set
-# CONFIG_CRYPTO_SHA256 is not set
-# CONFIG_CRYPTO_SHA512 is not set
-# CONFIG_CRYPTO_WP512 is not set
-# CONFIG_CRYPTO_TGR192 is not set
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-# CONFIG_CRYPTO_DES is not set
-CONFIG_CRYPTO_FCRYPT=m
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT is not set
-# CONFIG_CRYPTO_AES is not set
-# CONFIG_CRYPTO_CAST5 is not set
-# CONFIG_CRYPTO_CAST6 is not set
-# CONFIG_CRYPTO_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
-# CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_DEFLATE is not set
-# CONFIG_CRYPTO_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-CONFIG_CRYPTO_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
-
-#
-# Library routines
-#
-CONFIG_BITREVERSE=y
-# CONFIG_CRC_CCITT is not set
-# CONFIG_CRC16 is not set
-CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_PLIST=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
Index: linux-queue/arch/mips/configs/fuloong2e_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/fuloong2e_defconfig
+++ linux-queue/arch/mips/configs/fuloong2e_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
 #
 # CONFIG_MACH_ALCHEMY is not set
 # CONFIG_AR7 is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
Index: linux-queue/arch/mips/configs/ip22_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/ip22_defconfig
+++ linux-queue/arch/mips/configs/ip22_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/ip27_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/ip27_defconfig
+++ linux-queue/arch/mips/configs/ip27_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/ip28_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/ip28_defconfig
+++ linux-queue/arch/mips/configs/ip28_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/ip32_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/ip32_defconfig
+++ linux-queue/arch/mips/configs/ip32_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/jazz_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/jazz_defconfig
+++ linux-queue/arch/mips/configs/jazz_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 CONFIG_MACH_JAZZ=y
Index: linux-queue/arch/mips/configs/jmr3927_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/jmr3927_defconfig
+++ linux-queue/arch/mips/configs/jmr3927_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/lasat_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/lasat_defconfig
+++ linux-queue/arch/mips/configs/lasat_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/lemote2f_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/lemote2f_defconfig
+++ linux-queue/arch/mips/configs/lemote2f_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
 #
 # CONFIG_MACH_ALCHEMY is not set
 # CONFIG_AR7 is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
Index: linux-queue/arch/mips/configs/malta_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/malta_defconfig
+++ linux-queue/arch/mips/configs/malta_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
 #
 CONFIG_ZONE_DMA=y
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/markeins_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/markeins_defconfig
+++ linux-queue/arch/mips/configs/markeins_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/mipssim_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/mipssim_defconfig
+++ linux-queue/arch/mips/configs/mipssim_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/mpc30x_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/mpc30x_defconfig
+++ linux-queue/arch/mips/configs/mpc30x_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/msp71xx_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/msp71xx_defconfig
+++ linux-queue/arch/mips/configs/msp71xx_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/mtx1_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/mtx1_defconfig
+++ linux-queue/arch/mips/configs/mtx1_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/pb1100_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/pb1100_defconfig
+++ linux-queue/arch/mips/configs/pb1100_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_PB1100=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/pb1500_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/pb1500_defconfig
+++ linux-queue/arch/mips/configs/pb1500_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_PB1500=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/pb1550_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/pb1550_defconfig
+++ linux-queue/arch/mips/configs/pb1550_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_PB1550=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/pnx8335-stb225_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/pnx8335-stb225_defconfig
+++ linux-queue/arch/mips/configs/pnx8335-stb225_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/pnx8550-jbs_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/pnx8550-jbs_defconfig
+++ linux-queue/arch/mips/configs/pnx8550-jbs_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/pnx8550-stb810_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/pnx8550-stb810_defconfig
+++ linux-queue/arch/mips/configs/pnx8550-stb810_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/powertv_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/powertv_defconfig
+++ linux-queue/arch/mips/configs/powertv_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
 #
 # CONFIG_MACH_ALCHEMY is not set
 # CONFIG_AR7 is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/rb532_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/rb532_defconfig
+++ linux-queue/arch/mips/configs/rb532_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/rbtx49xx_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/rbtx49xx_defconfig
+++ linux-queue/arch/mips/configs/rbtx49xx_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
 #
 # CONFIG_MACH_ALCHEMY is not set
 # CONFIG_AR7 is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
Index: linux-queue/arch/mips/configs/rm200_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/rm200_defconfig
+++ linux-queue/arch/mips/configs/rm200_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/sb1250-swarm_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/sb1250-swarm_defconfig
+++ linux-queue/arch/mips/configs/sb1250-swarm_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/tb0219_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/tb0219_defconfig
+++ linux-queue/arch/mips/configs/tb0219_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/tb0226_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/tb0226_defconfig
+++ linux-queue/arch/mips/configs/tb0226_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/tb0287_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/tb0287_defconfig
+++ linux-queue/arch/mips/configs/tb0287_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_BCM47XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
Index: linux-queue/arch/mips/configs/workpad_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/workpad_defconfig
+++ linux-queue/arch/mips/configs/workpad_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/wrppmc_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/wrppmc_defconfig
+++ linux-queue/arch/mips/configs/wrppmc_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/configs/yosemite_defconfig
===================================================================
--- linux-queue.orig/arch/mips/configs/yosemite_defconfig
+++ linux-queue/arch/mips/configs/yosemite_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_DB1200 is not set
 # CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
Index: linux-queue/arch/mips/Makefile
===================================================================
--- linux-queue.orig/arch/mips/Makefile
+++ linux-queue/arch/mips/Makefile
@@ -369,13 +369,6 @@ cflags-$(CONFIG_PMC_YOSEMITE)	+= -I$(src
 load-$(CONFIG_PMC_YOSEMITE)	+= 0xffffffff80100000
 
 #
-# Basler eXcite
-#
-core-$(CONFIG_BASLER_EXCITE)	+= arch/mips/basler/excite/
-cflags-$(CONFIG_BASLER_EXCITE)	+= -I$(srctree)/arch/mips/include/asm/mach-excite
-load-$(CONFIG_BASLER_EXCITE)	+= 0x80100000
-
-#
 # LASAT platforms
 #
 core-$(CONFIG_LASAT)		+= arch/mips/lasat/
Index: linux-queue/arch/mips/pci/Makefile
===================================================================
--- linux-queue.orig/arch/mips/pci/Makefile
+++ linux-queue/arch/mips/pci/Makefile
@@ -22,7 +22,6 @@ obj-$(CONFIG_BCM63XX)		+= pci-bcm63xx.o 
 #
 # These are still pretty much in the old state, watch, go blind.
 #
-obj-$(CONFIG_BASLER_EXCITE)	+= ops-titan.o pci-excite.o fixup-excite.o
 obj-$(CONFIG_LASAT)		+= pci-lasat.o
 obj-$(CONFIG_MIPS_COBALT)	+= fixup-cobalt.o
 obj-$(CONFIG_SOC_AU1500)	+= fixup-au1000.o ops-au1000.o
Index: linux-queue/arch/mips/pci/fixup-excite.c
===================================================================
--- linux-queue.orig/arch/mips/pci/fixup-excite.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Copyright (C) 2004 by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <excite.h>
-
-int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-{
-	if (pin == 0)
-		return -1;
-
-	return USB_IRQ;		/* USB controller is the only PCI device */
-}
-
-/* Do platform specific device initialization at pci_enable_device() time */
-int pcibios_plat_dev_init(struct pci_dev *dev)
-{
-	return 0;
-}
Index: linux-queue/drivers/watchdog/Makefile
===================================================================
--- linux-queue.orig/drivers/watchdog/Makefile
+++ linux-queue/drivers/watchdog/Makefile
@@ -109,7 +109,6 @@ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt
 obj-$(CONFIG_INDYDOG) += indydog.o
 obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
 obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o
-obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
 obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
 obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
 obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
Index: linux-queue/drivers/watchdog/rm9k_wdt.c
===================================================================
--- linux-queue.orig/drivers/watchdog/rm9k_wdt.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- *  Watchdog implementation for GPI h/w found on PMC-Sierra RM9xxx
- *  chips.
- *
- *  Copyright (C) 2004 by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/platform_device.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/interrupt.h>
-#include <linux/fs.h>
-#include <linux/reboot.h>
-#include <linux/notifier.h>
-#include <linux/miscdevice.h>
-#include <linux/watchdog.h>
-#include <linux/io.h>
-#include <linux/uaccess.h>
-#include <asm/atomic.h>
-#include <asm/processor.h>
-#include <asm/system.h>
-#include <asm/rm9k-ocd.h>
-
-#include <rm9k_wdt.h>
-
-
-#define CLOCK                  125000000
-#define MAX_TIMEOUT_SECONDS    32
-#define CPCCR                  0x0080
-#define CPGIG1SR               0x0044
-#define CPGIG1ER               0x0054
-
-
-/* Function prototypes */
-static irqreturn_t wdt_gpi_irqhdl(int, void *);
-static void wdt_gpi_start(void);
-static void wdt_gpi_stop(void);
-static void wdt_gpi_set_timeout(unsigned int);
-static int wdt_gpi_open(struct inode *, struct file *);
-static int wdt_gpi_release(struct inode *, struct file *);
-static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t,
-								loff_t *);
-static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long);
-static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *);
-static const struct resource *wdt_gpi_get_resource(struct platform_device *,
-						const char *, unsigned int);
-static int __init wdt_gpi_probe(struct platform_device *);
-static int __exit wdt_gpi_remove(struct platform_device *);
-
-
-static const char wdt_gpi_name[] = "wdt_gpi";
-static atomic_t opencnt;
-static int expect_close;
-static int locked;
-
-
-/* These are set from device resources */
-static void __iomem *wd_regs;
-static unsigned int wd_irq, wd_ctr;
-
-
-/* Module arguments */
-static int timeout = MAX_TIMEOUT_SECONDS;
-module_param(timeout, int, 0444);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds");
-
-static unsigned long resetaddr = 0xbffdc200;
-module_param(resetaddr, ulong, 0444);
-MODULE_PARM_DESC(resetaddr, "Address to write to to force a reset");
-
-static unsigned long flagaddr = 0xbffdc104;
-module_param(flagaddr, ulong, 0444);
-MODULE_PARM_DESC(flagaddr, "Address to write to boot flags to");
-
-static int powercycle;
-module_param(powercycle, bool, 0444);
-MODULE_PARM_DESC(powercycle, "Cycle power if watchdog expires");
-
-static int nowayout = WATCHDOG_NOWAYOUT;
-module_param(nowayout, bool, 0444);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be disabled once started");
-
-
-/* Kernel interfaces */
-static const struct file_operations fops = {
-	.owner		= THIS_MODULE,
-	.open		= wdt_gpi_open,
-	.release	= wdt_gpi_release,
-	.write		= wdt_gpi_write,
-	.unlocked_ioctl	= wdt_gpi_ioctl,
-};
-
-static struct miscdevice miscdev = {
-	.minor		= WATCHDOG_MINOR,
-	.name		= wdt_gpi_name,
-	.fops		= &fops,
-};
-
-static struct notifier_block wdt_gpi_shutdown = {
-	.notifier_call	= wdt_gpi_notify,
-};
-
-
-/* Interrupt handler */
-static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt)
-{
-	if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1))
-		return IRQ_NONE;
-	__raw_writel(0x1, wd_regs + 0x0008);
-
-
-	printk(KERN_CRIT "%s: watchdog expired - resetting system\n",
-		wdt_gpi_name);
-
-	*(volatile char *) flagaddr |= 0x01;
-	*(volatile char *) resetaddr = powercycle ? 0x01 : 0x2;
-	iob();
-	while (1)
-		cpu_relax();
-}
-
-
-/* Watchdog functions */
-static void wdt_gpi_start(void)
-{
-	u32 reg;
-
-	lock_titan_regs();
-	reg = titan_readl(CPGIG1ER);
-	titan_writel(reg | (0x100 << wd_ctr), CPGIG1ER);
-	iob();
-	unlock_titan_regs();
-}
-
-static void wdt_gpi_stop(void)
-{
-	u32 reg;
-
-	lock_titan_regs();
-	reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
-	titan_writel(reg, CPCCR);
-	reg = titan_readl(CPGIG1ER);
-	titan_writel(reg & ~(0x100 << wd_ctr), CPGIG1ER);
-	iob();
-	unlock_titan_regs();
-}
-
-static void wdt_gpi_set_timeout(unsigned int to)
-{
-	u32 reg;
-	const u32 wdval = (to * CLOCK) & ~0x0000000f;
-
-	lock_titan_regs();
-	reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
-	titan_writel(reg, CPCCR);
-	wmb();
-	__raw_writel(wdval, wd_regs + 0x0000);
-	wmb();
-	titan_writel(reg | (0x2 << (wd_ctr * 4)), CPCCR);
-	wmb();
-	titan_writel(reg | (0x5 << (wd_ctr * 4)), CPCCR);
-	iob();
-	unlock_titan_regs();
-}
-
-
-/* /dev/watchdog operations */
-static int wdt_gpi_open(struct inode *inode, struct file *file)
-{
-	int res;
-
-	if (unlikely(atomic_dec_if_positive(&opencnt) < 0))
-		return -EBUSY;
-
-	expect_close = 0;
-	if (locked) {
-		module_put(THIS_MODULE);
-		free_irq(wd_irq, &miscdev);
-		locked = 0;
-	}
-
-	res = request_irq(wd_irq, wdt_gpi_irqhdl, IRQF_SHARED | IRQF_DISABLED,
-			  wdt_gpi_name, &miscdev);
-	if (unlikely(res))
-		return res;
-
-	wdt_gpi_set_timeout(timeout);
-	wdt_gpi_start();
-
-	printk(KERN_INFO "%s: watchdog started, timeout = %u seconds\n",
-		wdt_gpi_name, timeout);
-	return nonseekable_open(inode, file);
-}
-
-static int wdt_gpi_release(struct inode *inode, struct file *file)
-{
-	if (nowayout) {
-		printk(KERN_INFO "%s: no way out - watchdog left running\n",
-			wdt_gpi_name);
-		__module_get(THIS_MODULE);
-		locked = 1;
-	} else {
-		if (expect_close) {
-			wdt_gpi_stop();
-			free_irq(wd_irq, &miscdev);
-			printk(KERN_INFO "%s: watchdog stopped\n",
-							wdt_gpi_name);
-		} else {
-			printk(KERN_CRIT "%s: unexpected close() -"
-				" watchdog left running\n",
-				wdt_gpi_name);
-			wdt_gpi_set_timeout(timeout);
-			__module_get(THIS_MODULE);
-			locked = 1;
-		}
-	}
-
-	atomic_inc(&opencnt);
-	return 0;
-}
-
-static ssize_t wdt_gpi_write(struct file *f, const char __user *d, size_t s,
-								loff_t *o)
-{
-	char val;
-
-	wdt_gpi_set_timeout(timeout);
-	expect_close = (s > 0) && !get_user(val, d) && (val == 'V');
-	return s ? 1 : 0;
-}
-
-static long wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
-{
-	long res = -ENOTTY;
-	const long size = _IOC_SIZE(cmd);
-	int stat;
-	void __user *argp = (void __user *)arg;
-	static struct watchdog_info wdinfo = {
-		.identity               = "RM9xxx/GPI watchdog",
-		.firmware_version       = 0,
-		.options                = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING
-	};
-
-	if (unlikely(_IOC_TYPE(cmd) != WATCHDOG_IOCTL_BASE))
-		return -ENOTTY;
-
-	if ((_IOC_DIR(cmd) & _IOC_READ)
-	    && !access_ok(VERIFY_WRITE, arg, size))
-		return -EFAULT;
-
-	if ((_IOC_DIR(cmd) & _IOC_WRITE)
-	    && !access_ok(VERIFY_READ, arg, size))
-		return -EFAULT;
-
-	expect_close = 0;
-
-	switch (cmd) {
-	case WDIOC_GETSUPPORT:
-		wdinfo.options = nowayout ?
-			WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING :
-			WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
-			WDIOF_MAGICCLOSE;
-		res = __copy_to_user(argp, &wdinfo, size) ?  -EFAULT : size;
-		break;
-
-	case WDIOC_GETSTATUS:
-		break;
-
-	case WDIOC_GETBOOTSTATUS:
-		stat = (*(volatile char *) flagaddr & 0x01)
-			? WDIOF_CARDRESET : 0;
-		res = __copy_to_user(argp, &stat, size) ?
-			-EFAULT : size;
-		break;
-
-	case WDIOC_SETOPTIONS:
-		break;
-
-	case WDIOC_KEEPALIVE:
-		wdt_gpi_set_timeout(timeout);
-		res = size;
-		break;
-
-	case WDIOC_SETTIMEOUT:
-		{
-			int val;
-			if (unlikely(__copy_from_user(&val, argp, size))) {
-				res = -EFAULT;
-				break;
-			}
-
-			if (val > MAX_TIMEOUT_SECONDS)
-				val = MAX_TIMEOUT_SECONDS;
-			timeout = val;
-			wdt_gpi_set_timeout(val);
-			res = size;
-			printk(KERN_INFO "%s: timeout set to %u seconds\n",
-				wdt_gpi_name, timeout);
-		}
-		break;
-
-	case WDIOC_GETTIMEOUT:
-		res = __copy_to_user(argp, &timeout, size) ?
-			-EFAULT : size;
-		break;
-	}
-
-	return res;
-}
-
-
-/* Shutdown notifier */
-static int wdt_gpi_notify(struct notifier_block *this, unsigned long code,
-			  void *unused)
-{
-	if (code == SYS_DOWN || code == SYS_HALT)
-		wdt_gpi_stop();
-
-	return NOTIFY_DONE;
-}
-
-
-/* Init & exit procedures */
-static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv,
-					const char *name, unsigned int type)
-{
-	char buf[80];
-	if (snprintf(buf, sizeof(buf), "%s_0", name) >= sizeof(buf))
-		return NULL;
-	return platform_get_resource_byname(pdv, type, buf);
-}
-
-/* No hotplugging on the platform bus - use __devinit */
-static int __devinit wdt_gpi_probe(struct platform_device *pdv)
-{
-	int res;
-	const struct resource
-		* const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS,
-						  IORESOURCE_MEM),
-		* const ri = wdt_gpi_get_resource(pdv, WDT_RESOURCE_IRQ,
-						  IORESOURCE_IRQ),
-		* const rc = wdt_gpi_get_resource(pdv, WDT_RESOURCE_COUNTER,
-						  0);
-
-	if (unlikely(!rr || !ri || !rc))
-		return -ENXIO;
-
-	wd_regs = ioremap_nocache(rr->start, rr->end + 1 - rr->start);
-	if (unlikely(!wd_regs))
-		return -ENOMEM;
-	wd_irq = ri->start;
-	wd_ctr = rc->start;
-	res = misc_register(&miscdev);
-	if (res)
-		iounmap(wd_regs);
-	else
-		register_reboot_notifier(&wdt_gpi_shutdown);
-	return res;
-}
-
-static int __devexit wdt_gpi_remove(struct platform_device *dev)
-{
-	int res;
-
-	unregister_reboot_notifier(&wdt_gpi_shutdown);
-	res = misc_deregister(&miscdev);
-	iounmap(wd_regs);
-	wd_regs = NULL;
-	return res;
-}
-
-
-/* Device driver init & exit */
-static struct platform_driver wgt_gpi_driver = {
-	.driver = {
-		.name		= wdt_gpi_name,
-		.owner		= THIS_MODULE,
-	},
-	.probe		= wdt_gpi_probe,
-	.remove		= __devexit_p(wdt_gpi_remove),
-};
-
-static int __init wdt_gpi_init_module(void)
-{
-	atomic_set(&opencnt, 1);
-	if (timeout > MAX_TIMEOUT_SECONDS)
-		timeout = MAX_TIMEOUT_SECONDS;
-	return platform_driver_register(&wdt_gpi_driver);
-}
-
-static void __exit wdt_gpi_cleanup_module(void)
-{
-	platform_driver_unregister(&wdt_gpi_driver);
-}
-
-module_init(wdt_gpi_init_module);
-module_exit(wdt_gpi_cleanup_module);
-
-MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
-MODULE_DESCRIPTION("Basler eXcite watchdog driver for gpi devices");
-MODULE_VERSION("0.1");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-
Index: linux-queue/drivers/watchdog/Kconfig
===================================================================
--- linux-queue.orig/drivers/watchdog/Kconfig
+++ linux-queue/drivers/watchdog/Kconfig
@@ -815,16 +815,6 @@ config PNX833X_WDT
 	  timer has expired and no process has written to /dev/watchdog during
 	  that time.
 
-config WDT_RM9K_GPI
-	tristate "RM9000/GPI hardware watchdog"
-	depends on CPU_RM9000
-	help
-	  Watchdog implementation using the GPI hardware found on
-	  PMC-Sierra RM9xxx CPUs.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called rm9k_wdt.
-
 config SIBYTE_WDOG
 	tristate "Sibyte SoC hardware watchdog"
 	depends on CPU_SB1
Index: linux-queue/arch/mips/pci/pci-excite.c
===================================================================
--- linux-queue.orig/arch/mips/pci/pci-excite.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *  Copyright (C) 2004 by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
- *  Based on the PMC-Sierra Yosemite board support by Ralf Baechle.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/pci.h>
-#include <linux/bitops.h>
-#include <asm/rm9k-ocd.h>
-#include <excite.h>
-
-
-extern struct pci_ops titan_pci_ops;
-
-
-static struct resource
-	mem_resource = 	{
-		.name	= "PCI memory",
-		.start	= EXCITE_PHYS_PCI_MEM,
-		.end	= EXCITE_PHYS_PCI_MEM + EXCITE_SIZE_PCI_MEM - 1,
-		.flags	= IORESOURCE_MEM
-	},
-	io_resource = {
-		.name	= "PCI I/O",
-		.start	= EXCITE_PHYS_PCI_IO,
-		.end	= EXCITE_PHYS_PCI_IO + EXCITE_SIZE_PCI_IO - 1,
-		.flags	= IORESOURCE_IO
-	};
-
-
-static struct pci_controller bx_controller = {
-	.pci_ops	= &titan_pci_ops,
-	.mem_resource	= &mem_resource,
-	.mem_offset	= 0x00000000UL,
-	.io_resource	= &io_resource,
-	.io_offset	= 0x00000000UL
-};
-
-
-static char
-	iopage_failed[] __initdata   = "Cannot allocate PCI I/O page",
-	modebits_no_pci[] __initdata = "PCI is not configured in mode bits";
-
-#define RM9000x2_OCD_HTSC	0x0604
-#define RM9000x2_OCD_HTBHL	0x060c
-#define RM9000x2_OCD_PCIHRST	0x078c
-
-#define RM9K_OCD_MODEBIT1	0x00d4 /* (MODEBIT1) Mode Bit 1 */
-#define RM9K_OCD_CPHDCR		0x00f4 /* CPU-PCI/HT Data Control. */
-
-#define PCISC_FB2B 		0x00000200
-#define PCISC_MWICG		0x00000010
-#define PCISC_EMC		0x00000004
-#define PCISC_ERMA		0x00000002
-
-
-
-static int __init basler_excite_pci_setup(void)
-{
-	const unsigned int fullbars = memsize / (256 << 20);
-	unsigned int i;
-
-	/* Check modebits to see if PCI is really enabled. */
-	if (!((ocd_readl(RM9K_OCD_MODEBIT1) >> (47-32)) & 0x1))
-		panic(modebits_no_pci);
-
-	if (NULL == request_mem_region(EXCITE_PHYS_PCI_IO, EXCITE_SIZE_PCI_IO,
-				       "Memory-mapped PCI I/O page"))
-		panic(iopage_failed);
-
-	/* Enable PCI 0 as master for config cycles */
-	ocd_writel(PCISC_EMC | PCISC_ERMA, RM9000x2_OCD_HTSC);
-
-
-	/* Set up latency timer */
-	ocd_writel(0x8008, RM9000x2_OCD_HTBHL);
-
-	/*  Setup host IO and Memory space */
-	ocd_writel((EXCITE_PHYS_PCI_IO >> 4) | 1, LKB7);
-	ocd_writel(((EXCITE_SIZE_PCI_IO >> 4) & 0x7fffff00) - 0x100, LKM7);
-	ocd_writel((EXCITE_PHYS_PCI_MEM >> 4) | 1, LKB8);
-	ocd_writel(((EXCITE_SIZE_PCI_MEM >> 4) & 0x7fffff00) - 0x100, LKM8);
-
-	/* Set up PCI BARs to map all installed memory */
-	for (i = 0; i < 6; i++) {
-		const unsigned int bar = 0x610 + i * 4;
-
-	     	if (i < fullbars) {
-			ocd_writel(0x10000000 * i, bar);
-			ocd_writel(0x01000000 * i, bar + 0x140);
-			ocd_writel(0x0ffff029, bar + 0x100);
-			continue;
-		}
-
-	     	if (i == fullbars) {
-			int o;
-			u32 mask;
-
-			const unsigned long rem = memsize - i * 0x10000000;
-			if (!rem) {
-				ocd_writel(0x00000000, bar + 0x100);
-				continue;
-			}
-
-			o = ffs(rem) - 1;
-			if (rem & ~(0x1 << o))
-				o++;
-			mask = ((0x1 << o) & 0x0ffff000) - 0x1000;
-			ocd_writel(0x10000000 * i, bar);
-			ocd_writel(0x01000000 * i, bar + 0x140);
-			ocd_writel(0x00000029 | mask, bar + 0x100);
-			continue;
-		}
-
-		ocd_writel(0x00000000, bar + 0x100);
-	}
-
-	/* Finally, enable the PCI interrupt */
-#if USB_IRQ > 7
-	set_c0_intcontrol(1 << USB_IRQ);
-#else
-	set_c0_status(1 << (USB_IRQ + 8));
-#endif
-
-	ioport_resource.start = EXCITE_PHYS_PCI_IO;
-	ioport_resource.end = EXCITE_PHYS_PCI_IO + EXCITE_SIZE_PCI_IO - 1;
-	set_io_port_base((unsigned long) ioremap_nocache(EXCITE_PHYS_PCI_IO, EXCITE_SIZE_PCI_IO));
-	register_pci_controller(&bx_controller);
-	return 0;
-}
-
-
-arch_initcall(basler_excite_pci_setup);

From ralf@linux-mips.org Wed Dec  2 18:08:31 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 18:08:34 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:57564 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493467AbZLBRIb (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 18:08:31 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2H8TJr032484;
        Wed, 2 Dec 2009 17:08:30 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2H8TuH032482;
        Wed, 2 Dec 2009 17:08:29 GMT
Date:   Wed, 2 Dec 2009 17:08:28 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Dmitri Vorobiev <dmitri.vorobiev@movial.com>
Cc:     linux-mips@linux-mips.org
Subject: Re: [PATCH] [MIPS] Fix and enhance built-in kernel command line
Message-ID: <20091202170828.GA13441@linux-mips.org>
References: <1258835681-32200-1-git-send-email-dmitri.vorobiev@movial.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1258835681-32200-1-git-send-email-dmitri.vorobiev@movial.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25277
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Sat, Nov 21, 2009 at 10:34:41PM +0200, Dmitri Vorobiev wrote:

> Currently, MIPS kernels silently overwrite kernel command-line
> parameters hardcoded in CONFIG_CMDLINE by the ones received
> from firmware.  Therefore, using firmware remains the only
> reliable method to transfer the command-line parameters, which
> is not always desirable or convenient, and the CONFIG_CMDLINE
> option is thereby effectively rendered useless.
> 
> This patch fixes the problem described above and introduces
> a more flexible scheme of handling the kernel command line,
> in a manner identical to what is currently used for x86.
> The default behavior, i.e. when CONFIG_CMDLINE_BOOL is not
> defined, retains the existing semantics, and firmware
> command-line arguments override the hardcoded ones.

Queued for 2.6.33.  I also patched up the defconfig files to use the
right settings for CONFIG_CMDLINE_BOOL and CONFIG_CMDLINE_OVERRIDE.

Thanks,

  Ralf

From ralf@linux-mips.org Wed Dec  2 18:19:31 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 18:19:33 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:48966 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493472AbZLBRTa (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 18:19:30 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2HJSu5000373;
        Wed, 2 Dec 2009 17:19:28 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2HJRuK000371;
        Wed, 2 Dec 2009 17:19:27 GMT
Date:   Wed, 2 Dec 2009 17:19:27 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Ales Mulej <Ales.Mulej@HSTX.com>
Cc:     linux-mips@linux-mips.org
Subject: Re: Reserved instruction in kernel code
Message-ID: <20091202171927.GB13441@linux-mips.org>
References: <C5BD21D6E1A3114C8765C8FBBD0087BA330A85@exchtxuk2.HSTX.global.vpn>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <C5BD21D6E1A3114C8765C8FBBD0087BA330A85@exchtxuk2.HSTX.global.vpn>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25278
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Dec 02, 2009 at 11:15:06AM -0000, Ales Mulej wrote:

> 
> I'm porting linux(2.6.31.6) to the Wintegra WINHDP2 refrence board.
> 
> As a refrence I already have an old BSP from Wintegra based on kernel
> 2.6.10.
> 
>  
> 
> During the kernel start up process I receive following error:
> 
>  
> 
> Reserved instruction in kernel code[#1]:

The CPU is taking an exception because of an instruction it doesn't know.
One reason for this might be an incorrect CPU type setting in the kernel
configuration resulting in the generation of such code.

  Ralf

From dmitri.vorobiev@gmail.com Wed Dec  2 18:40:44 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 18:40:48 +0100 (CET)
Received: from mail-fx0-f225.google.com ([209.85.220.225]:61742 "EHLO
        mail-fx0-f225.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492001AbZLBRko convert rfc822-to-8bit
        (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 18:40:44 +0100
Received: by mail-fx0-f225.google.com with SMTP id 25so497551fxm.26
        for <multiple recipients>; Wed, 02 Dec 2009 09:40:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :date:message-id:subject:from:to:cc:content-type
         :content-transfer-encoding;
        bh=OgwRzilwzzv05ykIRJ+Z5uggB7+R/TH6zeIGH1A2XO4=;
        b=wfucZ9ow/cwc88sIixlxTDtqEAWXqnO0MNQxi/7ztE5KC5+9GiJ5eUAKK73AuUyzML
         T5kdHYL2En1nU/Kp7Stnal29L9V5Pmg1tLN4aGHrdLWF42z3q9lj26US8jjd0F/QAybj
         eF6w8YA8PX9efDfcpj4eeILOIiJNyS+K0JEqI=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc:content-type:content-transfer-encoding;
        b=N17OO/Fd/llocXn6eXu4A0R7kpsaEKdi40Cf8PTpabi7O6RBv0srxUvQP6EnPVn6bN
         SEMMetMVZsvIeJg2rHjq+BWp2ChDuFqsn0VmtDnUM8GodZVjjJMwJ6o+t6BbRFw1T+tk
         98UwOoTtFa4sEQywJV7RMWraoB9fR9RYj9SpQ=
MIME-Version: 1.0
Received: by 10.223.164.104 with SMTP id d40mr58149fay.98.1259775644522; Wed, 
        02 Dec 2009 09:40:44 -0800 (PST)
In-Reply-To: <20091202170828.GA13441@linux-mips.org>
References: <1258835681-32200-1-git-send-email-dmitri.vorobiev@movial.com>
         <20091202170828.GA13441@linux-mips.org>
Date:   Wed, 2 Dec 2009 19:40:44 +0200
Message-ID: <90edad820912020940s3ac3aa18j4abf60922937f0b7@mail.gmail.com>
Subject: Re: [PATCH] [MIPS] Fix and enhance built-in kernel command line
From:   Dmitri Vorobiev <dmitri.vorobiev@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     Dmitri Vorobiev <dmitri.vorobiev@movial.com>,
        linux-mips@linux-mips.org
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8BIT
Return-Path: <dmitri.vorobiev@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25279
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: dmitri.vorobiev@gmail.com
Precedence: bulk
X-list: linux-mips

On Wed, Dec 2, 2009 at 7:08 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> I also patched up the defconfig files to use the
> right settings for CONFIG_CMDLINE_BOOL and CONFIG_CMDLINE_OVERRIDE.
>

Thanks, Ralf!

Dmitri

> Thanks,
>
> Ralf
>
>

From David.Daney@caviumnetworks.com Wed Dec  2 18:47:52 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 18:47:56 +0100 (CET)
Received: from mail3.caviumnetworks.com ([12.108.191.235]:10088 "EHLO
        mail3.caviumnetworks.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493472AbZLBRrw (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 18:47:52 +0100
Received: from caexch01.caveonetworks.com (Not Verified[192.168.16.9]) by mail3.caviumnetworks.com with MailMarshal (v6,5,4,7535)
        id <B4b16a83c0001>; Wed, 02 Dec 2009 09:47:42 -0800
Received: from caexch01.caveonetworks.com ([192.168.16.9]) by caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);
         Wed, 2 Dec 2009 09:45:50 -0800
Received: from dd1.caveonetworks.com ([12.108.191.236]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959);
         Wed, 2 Dec 2009 09:45:50 -0800
Message-ID: <4B16A7CC.3090305@caviumnetworks.com>
Date:   Wed, 02 Dec 2009 09:45:48 -0800
From:   David Daney <ddaney@caviumnetworks.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090320)
MIME-Version: 1.0
To:     Ales Mulej <Ales.Mulej@HSTX.com>
CC:     linux-mips@linux-mips.org
Subject: Re: Reserved instruction in kernel code
References: <C5BD21D6E1A3114C8765C8FBBD0087BA330A85@exchtxuk2.HSTX.global.vpn>
In-Reply-To: <C5BD21D6E1A3114C8765C8FBBD0087BA330A85@exchtxuk2.HSTX.global.vpn>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 02 Dec 2009 17:45:50.0331 (UTC) FILETIME=[49679CB0:01CA7377]
Return-Path: <David.Daney@caviumnetworks.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25280
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ddaney@caviumnetworks.com
Precedence: bulk
X-list: linux-mips

Ales Mulej wrote:
> Hi,
> 
>  
> 
> I'm porting linux(2.6.31.6) to the Wintegra WINHDP2 refrence board.
> 
> As a refrence I already have an old BSP from Wintegra based on kernel 
> 2.6.10.
> 
>  
> 
> During the kernel start up process I receive following error:
> 
>  
> 
> Reserved instruction in kernel code[#1]:
> 
> Cpu 0
> 
> $ 0   : 00000000 1000fc00 802be630 00000001
> 
> $ 4   : 802be670 802be674 ffffffff 802f4d4c
> 
> $ 8   : 1000fc01 1000001f 00000001 0000002b
> 
> $12   : 00000000 000001f5 07a0d380 00000000
> 
> $16   : 00000000 00000000 00000000 1000fc00
> 
> $20   : 802e9674 bd030f04 3e490000 00000a72
> 
> $24   : 00000008 8000167c                 
> 
> $28   : 802ba000 802bbd30 ffffffff 802f4d4c
> 
> Hi    : 000000fb
> 
> Lo    : 00000001
> 
> epc   : 801013a0 handle_ri_int+0x18/0x38
> 
>     Not tainted
> 
> ra    : 802f4d4c __log_buf+0x0/0x20000
> 
> Status: 1000fc03    KERNEL EXL IE
> 
> Cause : 50808000
> 
> PrId  : 00019365 (MIPS 24Kc)
> 
> Modules linked in:
> 
> Process swapper (pid: 0, threadinfo=802ba000, task=802bc000, tls=00000000)
> 
> Stack : 1000fc00 1000001f 00000001 0000002b 00000000 000001f5 00000000 
> 1000fc00
> 
>         802be630 00000001 802be670 802be674 ffffffff 802f4d4c 1000fc00 
> 1000001f
> 
>         00000001 0000002b 00000000 000001f5 07a0d380 00000000 00000000 
> 00000000
> 
>         00000000 1000fc00 802e9674 bd030f04 3e490000 00000a72 00000008 
> 8000167c
> 
>         802bbe94 802a2954 802ba000 802bbde0 ffffffff 802f4d4c 1000fc02 
> 000000fb
> 
>         ...
> 
> Call Trace:
> 
> [<801013a0>] handle_ri_int+0x18/0x38
> 
>  
> 
>  
> 
> Code: 01094025  3908001e  40886000 <00000040> 00000040  00000040  

       ...   ssnop ssnop ssnop ...

One would think a 'PrId  : 00019365 (MIPS 24Kc)' would execute those.

The cause value indicates an 'Interrupt' but you are somehow executing 
in handle_ri_int, so it could be that multiple exceptions are messing up 
the OOPS output...



> 
> Disabling lock debugging due to kernel taint
> 
> Kernel panic - not syncing: Attempted to kill the idle task!
> 
>  
> 
>  
> 
> Does anybody know where is the problem?
> 
> I suspect, that the problem is in my interrupt routine, because I 
> receive this error as soon as the tick timer start's up.
> 
>  
> 
> Regards,
> 
> Ales
> 
>  
> 
>  
> 
>  
> 


From macro@linux-mips.org Wed Dec  2 19:52:39 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 19:52:42 +0100 (CET)
Received: from localhost.localdomain ([127.0.0.1]:44038 "EHLO
        localhost.localdomain" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493726AbZLBSwj (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 2 Dec 2009 19:52:39 +0100
Date:   Wed, 2 Dec 2009 18:52:39 +0000 (GMT)
From:   "Maciej W. Rozycki" <macro@linux-mips.org>
To:     David Daney <ddaney@caviumnetworks.com>
cc:     Ales Mulej <Ales.Mulej@HSTX.com>, linux-mips@linux-mips.org
Subject: Re: Reserved instruction in kernel code
In-Reply-To: <4B16A7CC.3090305@caviumnetworks.com>
Message-ID: <alpine.LFD.2.00.0912021831270.7385@eddie.linux-mips.org>
References: <C5BD21D6E1A3114C8765C8FBBD0087BA330A85@exchtxuk2.HSTX.global.vpn> <4B16A7CC.3090305@caviumnetworks.com>
User-Agent: Alpine 2.00 (LFD 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25281
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, 2 Dec 2009, David Daney wrote:

> > Reserved instruction in kernel code[#1]:
> > 
> > Cpu 0
> > 
> > $ 0   : 00000000 1000fc00 802be630 00000001
> > 
> > $ 4   : 802be670 802be674 ffffffff 802f4d4c
> > 
> > $ 8   : 1000fc01 1000001f 00000001 0000002b
> > 
> > $12   : 00000000 000001f5 07a0d380 00000000
> > 
> > $16   : 00000000 00000000 00000000 1000fc00
> > 
> > $20   : 802e9674 bd030f04 3e490000 00000a72
> > 
> > $24   : 00000008 8000167c                 
> > $28   : 802ba000 802bbd30 ffffffff 802f4d4c
> > 
> > Hi    : 000000fb
> > 
> > Lo    : 00000001
> > 
> > epc   : 801013a0 handle_ri_int+0x18/0x38
> > 
> >     Not tainted
> > 
> > ra    : 802f4d4c __log_buf+0x0/0x20000
> > 
> > Status: 1000fc03    KERNEL EXL IE
> > 
> > Cause : 50808000
> > 
> > PrId  : 00019365 (MIPS 24Kc)
> > 
> > Modules linked in:
> > 
> > Process swapper (pid: 0, threadinfo=802ba000, task=802bc000, tls=00000000)
> > 
> > Stack : 1000fc00 1000001f 00000001 0000002b 00000000 000001f5 00000000
> > 1000fc00
> > 
> >         802be630 00000001 802be670 802be674 ffffffff 802f4d4c 1000fc00
> > 1000001f
> > 
> >         00000001 0000002b 00000000 000001f5 07a0d380 00000000 00000000
> > 00000000
> > 
> >         00000000 1000fc00 802e9674 bd030f04 3e490000 00000a72 00000008
> > 8000167c
> > 
> >         802bbe94 802a2954 802ba000 802bbde0 ffffffff 802f4d4c 1000fc02
> > 000000fb
> > 
> >         ...
> > 
> > Call Trace:
> > 
> > [<801013a0>] handle_ri_int+0x18/0x38
> > 
> >  
> >  
> > Code: 01094025  3908001e  40886000 <00000040> 00000040  00000040  
> 
>       ...   ssnop ssnop ssnop ...
> 
> One would think a 'PrId  : 00019365 (MIPS 24Kc)' would execute those.
> 
> The cause value indicates an 'Interrupt' but you are somehow executing in
> handle_ri_int, so it could be that multiple exceptions are messing up the OOPS
> output...

 Look at the preceding code -- the EXL bit has just been cleared (while 
executing handle_ri_int()) and the interrupt exception has been 
immediately taken, overwriting the EPC and Cause registers with what you 
can see above.  So either the original RI exception happened earlier 
elsewhere, or there is something completely broken somewhere resulting in 
this misleading dump (like stack corruption resulting in a jump to 
handle_ri() or whatever).

 To figure out which is the case I'd suggest running the RI handler with 
interrupts disabled for debugging and see if the correct values from EPC 
and Cause are reported.  If this runs correctly, then obviously the 
causing place of the RI exception has to be fixed, but also the interrupt 
exception handler has to be investigated to see why the values from EPC 
and Cause stored on the stack get corrupted.  Otherwise the new symptoms 
will (hopefully) suggest what to do next.

  Maciej

From ralf@linux-mips.org Wed Dec  2 20:22:49 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 02 Dec 2009 20:22:53 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:53891 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493744AbZLBTWt (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Wed, 2 Dec 2009 20:22:49 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB2JMj0h013491;
        Wed, 2 Dec 2009 19:22:45 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB2JMi2J013488;
        Wed, 2 Dec 2009 19:22:44 GMT
Date:   Wed, 2 Dec 2009 19:22:43 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Martin Michlmayr <tbm@cyrius.com>
Cc:     linux-mips@linux-mips.org
Subject: Re: [RFC] [PATCH] Disable EMBEDDED on MIPS
Message-ID: <20091202192243.GA3485@linux-mips.org>
References: <20091119164632.GA15279@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091119164632.GA15279@deprecation.cyrius.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25282
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Nov 19, 2009 at 04:46:32PM +0000, Martin Michlmayr wrote:

> There's no reason for MIPS to select EMBEDDED.  In fact, EMBEDDED
> makes MIPS more awkward to deal with because it makes it different
> to the majority of architectures for no good reason.

Historically disabling EMBEDDED had hid essential options for many MIPS
platforms such as serial console and forced crap like VGA support
or power managment enabled for platforms where those don't make any sense.

The name of the option is also _very_ missleading so many users don't
select it even where is was required for a functioning kernel.

After reviewing the current Kconfig files it seems this is no longer the
case, so I'll queue this patch for 2.6.33.

  Ralf

From wuzhangjin@gmail.com Thu Dec  3 02:55:57 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 02:56:01 +0100 (CET)
Received: from mail-gx0-f210.google.com ([209.85.217.210]:34040 "EHLO
        mail-gx0-f210.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494255AbZLCBz4 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 02:55:56 +0100
Received: by gxk2 with SMTP id 2so755477gxk.4
        for <multiple recipients>; Wed, 02 Dec 2009 17:55:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer;
        bh=xgKRLfnovxtK4d6Lc689pYEGGX8JwWTvdoOrGozrHgY=;
        b=lhy2kxdworoFSNU/BmnZ7dwjnw+Cf0EXEmGp+JLt+7WOsnuHuIwIHLphkjIvWAl9f+
         e2bY0tMMfregdpRJ+gXneECfIlGFysCVq/7oje/kGUEkMimFynHxfFn2sJnHh/ywiIFF
         zHbnfCv47BNJ7lNyTiWIwsYZ0XzT8MfB1R1W0=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer;
        b=bApjx7v6BhDhgHkAC8xJ+la1XFwns0fcKN7h7eh8+j+LqH3cnt8Tc99vsaDI+vxjQw
         HphCq2dQY7U7JZQsTzvpniqKRPiKhR9zeKdnkKUwGVRX3U/w/UXON7gK1/zcuylrAO8J
         Er1KP1GuJnwlyhGV/N/A2a0EpgamEIczFjAho=
Received: by 10.151.1.32 with SMTP id d32mr1616968ybi.333.1259805348084;
        Wed, 02 Dec 2009 17:55:48 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm649059ywh.0.2009.12.02.17.55.42
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Wed, 02 Dec 2009 17:55:47 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org,
        Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
        Dave Jones <davej@redhat.com>,
        Dominik Brodowski <linux@dominikbrodowski.net>,
        cpufreq@vger.kernel.org, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v0] Loongson2: CPUFreq: add support to load module automatically
Date:   Thu,  3 Dec 2009 09:55:33 +0800
Message-Id: <8421507f5dfc1a70d1dba92ad7604a8bfaa5a447.1259805106.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25283
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

This patch registers a loongson2_cpufreq platform device, make the
CPUFreq support for loongson2 as a platform driver, and then bind them
together via the platform_device_id to allow it be loaded automatically
when booting. With this support, there is no need to add the module name
into /etc/modules.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/cpu.h                  |    2 +
 arch/mips/kernel/cpufreq/loongson2_cpufreq.c |   35 ++++++++++++++++++++++---
 arch/mips/loongson/common/Makefile           |    2 +-
 arch/mips/loongson/common/platform.c         |   32 +++++++++++++++++++++++
 4 files changed, 65 insertions(+), 6 deletions(-)
 create mode 100644 arch/mips/loongson/common/platform.c

diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index 4b96d1a..cf373a9 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -154,6 +154,8 @@
 #define PRID_REV_VR4181A	0x0070	/* Same as VR4122 */
 #define PRID_REV_VR4130		0x0080
 #define PRID_REV_34K_V1_0_2	0x0022
+#define PRID_REV_LOONGSON2E	0x0002
+#define PRID_REV_LOONGSON2F	0x0003
 
 /*
  * Older processors used to encode processor version and revision in two
diff --git a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
index 7232dcb..2f6a0b1 100644
--- a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
+++ b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
@@ -15,6 +15,7 @@
 #include <linux/err.h>
 #include <linux/sched.h>	/* set_cpus_allowed() */
 #include <linux/delay.h>
+#include <linux/platform_device.h>
 
 #include <asm/clock.h>
 
@@ -163,23 +164,45 @@ static struct cpufreq_driver loongson2_cpufreq_driver = {
 	.attr = loongson2_table_attr,
 };
 
+static struct platform_device_id platform_device_ids[] = {
+	{
+		.name = "loongson2_cpufreq",
+	},
+	{}
+};
+
+MODULE_DEVICE_TABLE(platform, platform_device_ids);
+
+static struct platform_driver platform_driver = {
+	.driver = {
+		.name = "loongson2_cpufreq",
+		.owner = THIS_MODULE,
+	},
+	.id_table = platform_device_ids,
+};
+
 static int __init cpufreq_init(void)
 {
-	int result;
+	int ret;
+
+	/* Register platform stuff */
+	ret = platform_driver_register(&platform_driver);
+	if (ret)
+		return ret;
 
-	printk(KERN_INFO "cpufreq: Loongson-2F CPU frequency driver.\n");
+	pr_info("cpufreq: Loongson-2F CPU frequency driver.\n");
 
 	cpufreq_register_notifier(&loongson2_cpufreq_notifier_block,
 				  CPUFREQ_TRANSITION_NOTIFIER);
 
-	result = cpufreq_register_driver(&loongson2_cpufreq_driver);
+	ret = cpufreq_register_driver(&loongson2_cpufreq_driver);
 
-	if (!result && !nowait) {
+	if (!ret && !nowait) {
 		saved_cpu_wait = cpu_wait;
 		cpu_wait = loongson2_cpu_wait;
 	}
 
-	return result;
+	return ret;
 }
 
 static void __exit cpufreq_exit(void)
@@ -189,6 +212,8 @@ static void __exit cpufreq_exit(void)
 	cpufreq_unregister_driver(&loongson2_cpufreq_driver);
 	cpufreq_unregister_notifier(&loongson2_cpufreq_notifier_block,
 				    CPUFREQ_TRANSITION_NOTIFIER);
+
+	platform_driver_unregister(&platform_driver);
 }
 
 module_init(cpufreq_init);
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile
index 01fc2f3..7668c4d 100644
--- a/arch/mips/loongson/common/Makefile
+++ b/arch/mips/loongson/common/Makefile
@@ -3,7 +3,7 @@
 #
 
 obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \
-    pci.o bonito-irq.o mem.o machtype.o
+    pci.o bonito-irq.o mem.o machtype.o platform.o
 
 #
 # Serial port support
diff --git a/arch/mips/loongson/common/platform.c b/arch/mips/loongson/common/platform.c
new file mode 100644
index 0000000..fdb24fd
--- /dev/null
+++ b/arch/mips/loongson/common/platform.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzj@lemote.com
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+#include <asm/bootinfo.h>
+
+static struct platform_device loongson2_cpufreq_device = {
+	.name = "loongson2_cpufreq",
+	.id = -1,
+};
+
+static int __init loongson2_cpufreq_init(void)
+{
+	struct cpuinfo_mips *c = &current_cpu_data;
+
+	/* Only 2F revision and it's successors support CPUFreq */
+	if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON2F)
+		return platform_device_register(&loongson2_cpufreq_device);
+
+	return -ENODEV;
+}
+
+arch_initcall(loongson2_cpufreq_init);
-- 
1.6.2.1


From wuzhangjin@gmail.com Thu Dec  3 05:50:28 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 05:50:31 +0100 (CET)
Received: from mail-pz0-f203.google.com ([209.85.222.203]:58018 "EHLO
        mail-pz0-f203.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491950AbZLCEu2 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 05:50:28 +0100
Received: by pzk41 with SMTP id 41so1498427pzk.0
        for <multiple recipients>; Wed, 02 Dec 2009 20:50:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=gKoLoWmBvtSdWNBcSFxsoYdDuRidrXIZXVQMJ5HQtIU=;
        b=luN3Um5vKQj8mBfigdFT++xURjeg0hCu/5/nC3O22bkTX6NhjURkZ35HEUi/93iD1U
         qd3s9kQa6O5a/9sLyiztY311CUpZu6txUjPX4sVKUhLCb5cvjH2sgRHHeokqOQnlaWBt
         CtNogha3dvjUmjzIReEd15mS/rZh68WYjZjWY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=KLHT6fJfgFYNYg+h9RVE95EzDl4KDx5FZgkSxtsts9qOt787XsABg732aP2UX3QJii
         PZ6+KQoQMXVMZRGkBJet0x+bkPMsL85YOx2SKCOiIf/FCv4EfmjmgnY8Tr6qvgVvPAi0
         XouB/UNTjm0P+xOKHoV/dufQJnwHEWVCat2VA=
Received: by 10.114.10.4 with SMTP id 4mr1820951waj.105.1259815818374;
        Wed, 02 Dec 2009 20:50:18 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm1385355pzk.12.2009.12.02.20.50.14
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Wed, 02 Dec 2009 20:50:17 -0800 (PST)
Subject: Re: [PATCH v0] Loongson2: CPUFreq: add support to load module
 automatically
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     linux-mips@linux-mips.org,
        Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
        Dave Jones <davej@redhat.com>,
        Dominik Brodowski <linux@dominikbrodowski.net>,
        cpufreq@vger.kernel.org
In-Reply-To: <8421507f5dfc1a70d1dba92ad7604a8bfaa5a447.1259805106.git.wuzhangjin@gmail.com>
References: <8421507f5dfc1a70d1dba92ad7604a8bfaa5a447.1259805106.git.wuzhangjin@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Thu, 03 Dec 2009 12:49:55 +0800
Message-ID: <1259815795.4474.34.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25284
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

[...]
> diff --git a/arch/mips/loongson/common/platform.c b/arch/mips/loongson/common/platform.c
> new file mode 100644
> index 0000000..fdb24fd
> --- /dev/null
> +++ b/arch/mips/loongson/common/platform.c
> @@ -0,0 +1,32 @@
> +/*
> + * Copyright (C) 2009 Lemote Inc.
> + * Author: Wu Zhangjin, wuzj@lemote.com
> + *
> + * This program is free software; you can redistribute  it and/or modify it
> + * under  the terms of  the GNU General  Public License as published by the
> + * Free Software Foundation;  either version 2 of the  License, or (at your
> + * option) any later version.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/platform_device.h>
> +
> +#include <asm/bootinfo.h>

The above header file is not needed.

Regards,
	Wu Zhangjin


From BATV+27164d45208a24c6f88d+2293+infradead.org+dwmw2@casper.srs.infradead.org Thu Dec  3 08:10:23 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 08:10:27 +0100 (CET)
Received: from casper.infradead.org ([85.118.1.10]:56926 "EHLO
        casper.infradead.org" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org
        with ESMTP id S1492175AbZLCHKX (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 08:10:23 +0100
Received: from [89.193.139.6] (helo=[10.36.82.250])
        by casper.infradead.org with esmtpsa (Exim 4.69 #1 (Red Hat Linux))
        id 1NG5pP-0003Ly-Nk; Thu, 03 Dec 2009 07:10:18 +0000
Date:   Thu, 3 Dec 2009 07:10:00 +0000 (GMT)
From:   David Woodhouse <dwmw2@infradead.org>
To:     Ralf Baechle <ralf@linux-mips.org>
cc:     linux-mips@linux-mips.org,
        Thomas Koeller <thomas.koeller@baslerweb.com>,
        Wim Van Sebroeck <wim@iguana.be>,
        linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] eXcite: Remove platform support and drivers.
In-Reply-To: <20091202153534.GA10692@linux-mips.org>
Message-ID: <alpine.LFD.2.00.0912030709230.10116@macbook.infradead.org>
References: <20091202153016.GA9892@linux-mips.org> <20091202153534.GA10692@linux-mips.org>
User-Agent: Alpine 2.00 (LFD 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-SRS-Rewrite: SMTP reverse-path rewritten from <dwmw2@infradead.org> by casper.infradead.org
        See http://www.infradead.org/rpr.html
Return-Path: <BATV+27164d45208a24c6f88d+2293+infradead.org+dwmw2@casper.srs.infradead.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25285
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: dwmw2@infradead.org
Precedence: bulk
X-list: linux-mips

On Wed, 2 Dec 2009, Ralf Baechle wrote:

> The platform has never been fully merged.  Remove it including MTD and
> watchdog drivers.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> ---
> I'd like acks from the watchdog and MTD maintainers please.

Acked-by: David Woodhouse <David.Woodhouse@intel.com>

-- 
dwmw2


From Thomas.Koeller@baslerweb.com Thu Dec  3 09:37:05 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 09:37:08 +0100 (CET)
Received: from mail01.baslerweb.com ([80.156.24.166]:58975 "EHLO
        mail01.baslerweb.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org
        with ESMTP id S1492315AbZLCIhF convert rfc822-to-8bit (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 09:37:05 +0100
Received: from unknown (HELO AHR075S.basler.corp) ([172.16.20.75])
  by mail01-out.baslerweb.com with ESMTP; 03 Dec 2009 09:39:45 +0100
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 8BIT
X-MimeOLE: Produced By Microsoft Exchange V6.5
Subject: RE: Removal of Basler eXcite platform support
Date:   Thu, 3 Dec 2009 09:37:04 +0100
Message-ID: <C5A8FDEFF7647F4C9CB927D7DEB307730DA2D38C@ahr075s.basler.corp>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Removal of Basler eXcite platform support
Thread-Index: AcpzZFxSn8Mb99v2QnaNT5FPGxTx5AAjvgcw
References: <20091202153016.GA9892@linux-mips.org>
From:   "Koeller, T." <Thomas.Koeller@baslerweb.com>
To:     "Ralf Baechle" <ralf@linux-mips.org>, <linux-mips@linux-mips.org>
Return-Path: <Thomas.Koeller@baslerweb.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25286
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: Thomas.Koeller@baslerweb.com
Precedence: bulk
X-list: linux-mips

> From: Ralf Baechle [mailto:ralf@linux-mips.org] 
> Sent: Wednesday, December 02, 2009 4:30 PM
> To: linux-mips@linux-mips.org; Koeller, T.
> Subject: RFC: Removal of Basler eXcite platform support
> 
> Support for the Basler eXcite was never fully merged and 
> there seems to be
> no push to complete that or any users.  So I'd like to remove 
> the support
> for it in the upcoming 2.6.33 cycle.  Any comments?
> 
> I'll post the patch which I already have sitting in the queue 
> tree in a
> a separate mail.
> 
>   Ralf

The eXcite hardware is no longer available. So for me it is
o.k. to remove support for it.


_______________________________

Thomas Kller, Software Developer

Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany

Tel. +49 (0) 4102 463-390
Fax  +49 (0) 4102 463-46390

mailto:thomas.koeller@baslerweb.com
http://www.baslerweb.com

Vorstand: Dr.-Ing. Dietmar Ley (Vorsitzender)  John P. Jennings  Aufsichtsratsvorsitzender: Norbert Basler
Basler AG  Amtsgericht Ahrensburg HRB 4090  Ust-IdNr.: DE 135 098 121  Steuer-Nr.: 30 292 04497  WEEE-Reg.-Nr. DE 83888045

_______________________________


 

From wim@iguana.be Thu Dec  3 10:02:23 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 10:02:26 +0100 (CET)
Received: from mailrelay009.isp.belgacom.be ([195.238.6.176]:1207 "EHLO
        mailrelay009.isp.belgacom.be" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492291AbZLCJCX (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 10:02:23 +0100
X-Belgacom-Dynamic: yes
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApoEABsNF0tR9cXB/2dsb2JhbADXIAqEJwQ
Received: from 193.197-245-81.adsl-dyn.isp.belgacom.be (HELO infomag) ([81.245.197.193])
  by relay.skynet.be with ESMTP; 03 Dec 2009 10:02:17 +0100
Received: from wim by infomag with local (Exim 4.69)
        (envelope-from <wim@infomag.iguana.be>)
        id 1NG7Zp-0004fZ-B3; Thu, 03 Dec 2009 10:02:17 +0100
Date:   Thu, 3 Dec 2009 10:02:17 +0100
From:   Wim Van Sebroeck <wim@iguana.be>
To:     David Woodhouse <dwmw2@infradead.org>
Cc:     Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org,
        Thomas Koeller <thomas.koeller@baslerweb.com>,
        linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] eXcite: Remove platform support and drivers.
Message-ID: <20091203090217.GT3772@infomag.iguana.be>
References: <20091202153016.GA9892@linux-mips.org> <20091202153534.GA10692@linux-mips.org> <alpine.LFD.2.00.0912030709230.10116@macbook.infradead.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <alpine.LFD.2.00.0912030709230.10116@macbook.infradead.org>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <wim@iguana.be>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25287
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wim@iguana.be
Precedence: bulk
X-list: linux-mips

Hi Ralf,

>> The platform has never been fully merged.  Remove it including MTD and
>> watchdog drivers.
>>
>> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
>> ---
>> I'd like acks from the watchdog and MTD maintainers please.
>
> Acked-by: David Woodhouse <David.Woodhouse@intel.com>

Acked-by: Wim Van Sebroeck <wim@iguana.be>

Kind regards,
Wim.


From ralf@linux-mips.org Thu Dec  3 15:55:00 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 15:55:03 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:36834 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493114AbZLCOy7 (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Thu, 3 Dec 2009 15:54:59 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB3Estbv016360;
        Thu, 3 Dec 2009 14:54:56 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB3EsrFk016358;
        Thu, 3 Dec 2009 14:54:53 GMT
Date:   Thu, 3 Dec 2009 14:54:53 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     linux-mips@linux-mips.org,
        Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
        Dave Jones <davej@redhat.com>,
        Dominik Brodowski <linux@dominikbrodowski.net>,
        cpufreq@vger.kernel.org
Subject: Re: [PATCH v0] Loongson2: CPUFreq: add support to load module
 automatically
Message-ID: <20091203145452.GA28957@linux-mips.org>
References: <8421507f5dfc1a70d1dba92ad7604a8bfaa5a447.1259805106.git.wuzhangjin@gmail.com>
 <1259815795.4474.34.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259815795.4474.34.camel@falcon.domain.org>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25288
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Dec 03, 2009 at 12:49:55PM +0800, Wu Zhangjin wrote:

> > +++ b/arch/mips/loongson/common/platform.c
> > @@ -0,0 +1,32 @@
> > +/*
> > + * Copyright (C) 2009 Lemote Inc.
> > + * Author: Wu Zhangjin, wuzj@lemote.com
> > + *
> > + * This program is free software; you can redistribute  it and/or modify it
> > + * under  the terms of  the GNU General  Public License as published by the
> > + * Free Software Foundation;  either version 2 of the  License, or (at your
> > + * option) any later version.
> > + */
> > +
> > +#include <linux/err.h>
> > +#include <linux/platform_device.h>
> > +
> > +#include <asm/bootinfo.h>
> 
> The above header file is not needed.

I folded your patch into "MIPS: Loongson 2F: Add CPU frequency scaling
support" and removed that line.  Thanks!

  Ralf

From ralf@linux-mips.org Thu Dec  3 16:56:15 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 16:56:18 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:44987 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493318AbZLCP4P (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Thu, 3 Dec 2009 16:56:15 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB3Fu6ll028395;
        Thu, 3 Dec 2009 15:56:06 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB3Fu4XS028392;
        Thu, 3 Dec 2009 15:56:04 GMT
Date:   Thu, 3 Dec 2009 15:56:04 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Paul Gortmaker <p_gortmaker@yahoo.com>,
        Alessandro Zummo <a.zummo@towertech.it>,
        linux-mips@linux-mips.org, rtc-linux@googlegroups.com,
        Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v1 1/3] RTC: rtc-cmos.c: fix warning for MIPS
Message-ID: <20091203155604.GC28957@linux-mips.org>
References: <cover.1257383766.git.wuzhangjin@gmail.com>
 <a91e34bf2595157830d599cb66becd52247b1819.1257383766.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <a91e34bf2595157830d599cb66becd52247b1819.1257383766.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25289
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Nov 05, 2009 at 09:21:54AM +0800, Wu Zhangjin wrote:

> This patch fixes the following warning with RTC_LIB on MIPS:
> 
> drivers/rtc/rtc-cmos.c:697:2: warning: #warning Assuming 128 bytes of
> RTC+NVRAM address space, not 64 bytes.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  drivers/rtc/rtc-cmos.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
> index f7a4701..21e48f7 100644
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -691,7 +691,8 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
>  	 */
>  #if	defined(CONFIG_ATARI)
>  	address_space = 64;
> -#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__sparc__)
> +#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) \
> +			|| defined(__sparc__) || defined(__mips__)
>  	address_space = 128;
>  #else
>  #warning Assuming 128 bytes of RTC+NVRAM address space, not 64 bytes.

Ping.

This patch is now nearly a month old and I haven't yet heared anything.
This was actually meant to be 2.6.32 material.

  Ralf

From a.zummo@towertech.it Thu Dec  3 17:14:02 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 17:14:05 +0100 (CET)
Received: from elettra.colt-to.towertech.it ([213.215.222.70]:59667 "EHLO
        elettra.colt-to.towertech.it" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493523AbZLCQOC (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 17:14:02 +0100
Received: from linux.lan.towertech.it (93-39-58-60.ip74.fastwebnet.it [93.39.58.60])
        by elettra.colt-to.towertech.it (Postfix) with ESMTPSA id C2F06116649;
        Thu,  3 Dec 2009 17:14:01 +0100 (CET)
Date:   Thu, 3 Dec 2009 17:14:00 +0100
From:   Alessandro Zummo <a.zummo@towertech.it>
To:     rtc-linux@googlegroups.com
Cc:     ralf@linux-mips.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        Paul Gortmaker <p_gortmaker@yahoo.com>,
        linux-mips@linux-mips.org,
        Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [rtc-linux] Re: [PATCH v1 1/3] RTC: rtc-cmos.c: fix warning for
 MIPS
Message-ID: <20091203171400.163e6f66@linux.lan.towertech.it>
In-Reply-To: <20091203155604.GC28957@linux-mips.org>
References: <cover.1257383766.git.wuzhangjin@gmail.com>
        <a91e34bf2595157830d599cb66becd52247b1819.1257383766.git.wuzhangjin@gmail.com>
        <20091203155604.GC28957@linux-mips.org>
Organization: Tower Technologies
X-Mailer: Sylpheed
X-This-Is-A-Real-Message: Yes
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.95.2 at elettra
X-Virus-Status: Clean
Return-Path: <a.zummo@towertech.it>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25290
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: a.zummo@towertech.it
Precedence: bulk
X-list: linux-mips

On Thu, 3 Dec 2009 15:56:04 +0000
Ralf Baechle <ralf@linux-mips.org> wrote:

> Ping.
> 
> This patch is now nearly a month old and I haven't yet heared anything.
> This was actually meant to be 2.6.32 material.

 I supposed MIPS things were handled by the MIPS tree. If there's
 urgency a submitter should specify the intended delivery path
 (trivial, mips, rtc, directly to Andrew) and kernel release.
 
 Acked-by: Alessandro Zummo <a.zummo@towertech.it>


-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


From a.zummo@towertech.it Thu Dec  3 17:21:12 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 17:21:16 +0100 (CET)
Received: from elettra.colt-to.towertech.it ([213.215.222.70]:47341 "EHLO
        elettra.colt-to.towertech.it" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493526AbZLCQVM (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 17:21:12 +0100
Received: from linux.lan.towertech.it (93-39-58-60.ip74.fastwebnet.it [93.39.58.60])
        by elettra.colt-to.towertech.it (Postfix) with ESMTPSA id E8EF8116649;
        Thu,  3 Dec 2009 17:21:10 +0100 (CET)
Date:   Thu, 3 Dec 2009 17:21:10 +0100
From:   Alessandro Zummo <a.zummo@towertech.it>
To:     rtc-linux@googlegroups.com
Cc:     wuzhangjin@gmail.com, Ralf Baechle <ralf@linux-mips.org>,
        Arnaud Patard <apatard@mandriva.com>,
        linux-mips@linux-mips.org, Paul Gortmaker <p_gortmaker@yahoo.com>
Subject: Re: [rtc-linux] [PATCH v1 3/3] [loongson] RTC: Registration of
 Loongson RTC platform device
Message-ID: <20091203172110.30fb0635@linux.lan.towertech.it>
In-Reply-To: <a597312c16b5cf32621a25e8444d15d23726727f.1257383766.git.wuzhangjin@gmail.com>
References: <cover.1257383766.git.wuzhangjin@gmail.com>
        <a597312c16b5cf32621a25e8444d15d23726727f.1257383766.git.wuzhangjin@gmail.com>
Organization: Tower Technologies
X-Mailer: Sylpheed
X-This-Is-A-Real-Message: Yes
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.95.2 at elettra
X-Virus-Status: Clean
Return-Path: <a.zummo@towertech.it>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25291
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: a.zummo@towertech.it
Precedence: bulk
X-list: linux-mips

On Thu,  5 Nov 2009 09:24:10 +0800
Wu Zhangjin <wuzhangjin@gmail.com> wrote:

> user-space configuration:
> 
> $ mknod /dev/rtc0 c 254 0

 That's not guaranteed. 

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


From wuzhangjin@gmail.com Thu Dec  3 17:22:17 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 17:22:20 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:57307 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493523AbZLCQWR (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 17:22:17 +0100
Received: by pwi18 with SMTP id 18so163210pwi.24
        for <multiple recipients>; Thu, 03 Dec 2009 08:22:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=T0My0j9+uGkzY71mXA8b8lJxPCm1236YpIVf1RI2404=;
        b=Ex8ygWNpwscXKGDy9lwTkMTggXSFViEMqnT0pq0a10iT1CtEVlKXfA852UTfIow9oN
         48JCt0mUNEcfVNjNq4pc6wtmWUnTCTaPJglu9B8fiAUeapuRN0JkWzn4tBTApzyuswYp
         VSshb2vRrwarPCHYyUYO4XlRps+JBclFMAyG0=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=ojvbU/+kOeX1K56eHSoY3PrfQ0zeUpLQTyBPmNn91oNoAHODjarLxrHSkJJs8bNtfh
         idmnmfx13W5F4zvX/rrCPQ5w37M3heRnJSelGs7rgngESzH/i8/A2gqk1GFUr+g4jrkV
         8WD6tQipGqtGdLIyAvNPQq22816BT9elOJVuQ=
Received: by 10.115.39.8 with SMTP id r8mr2573919waj.104.1259857330058;
        Thu, 03 Dec 2009 08:22:10 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm1784822pzk.10.2009.12.03.08.22.06
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Thu, 03 Dec 2009 08:22:09 -0800 (PST)
Subject: Re: [rtc-linux] Re: [PATCH v1 1/3] RTC: rtc-cmos.c: fix warning
 for MIPS
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Alessandro Zummo <a.zummo@towertech.it>
Cc:     rtc-linux@googlegroups.com, ralf@linux-mips.org,
        Paul Gortmaker <p_gortmaker@yahoo.com>,
        linux-mips@linux-mips.org,
        Andrew Morton <akpm@linux-foundation.org>
In-Reply-To: <20091203171400.163e6f66@linux.lan.towertech.it>
References: <cover.1257383766.git.wuzhangjin@gmail.com>
         <a91e34bf2595157830d599cb66becd52247b1819.1257383766.git.wuzhangjin@gmail.com>
         <20091203155604.GC28957@linux-mips.org>
         <20091203171400.163e6f66@linux.lan.towertech.it>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Fri, 04 Dec 2009 00:21:45 +0800
Message-ID: <1259857305.7536.20.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25292
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Thu, 2009-12-03 at 17:14 +0100, Alessandro Zummo wrote:
> On Thu, 3 Dec 2009 15:56:04 +0000
> Ralf Baechle <ralf@linux-mips.org> wrote:
> 
> > Ping.
> > 
> > This patch is now nearly a month old and I haven't yet heared anything.
> > This was actually meant to be 2.6.32 material.
> 
>  I supposed MIPS things were handled by the MIPS tree. If there's
>  urgency a submitter should specify the intended delivery path
>  (trivial, mips, rtc, directly to Andrew) and kernel release.
>  
>  Acked-by: Alessandro Zummo <a.zummo@towertech.it>

Hi, Alessandro Zummo

Could you please review the left two(only patch 2/3 for rtc tree) for
2.6.33 in http://patchwork.linux-mips.org/bundle/ralf/rtc/ ?

[v1,2/3] RTC: rtc-cmos.c: enable RTC_DM_BINARY of RTC_LIB for fuloong2e
and fuloong2f
[v1,3/3,loongson] RTC: Registration of Loongson RTC platform device

(Sorry, I can not find them in my Email client currently, so can not
reply the old Email thread directly, If necessary, I will resend them,
thanks!)

Best Regards,
	Wu Zhangjin


From a.zummo@towertech.it Thu Dec  3 17:27:37 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 17:27:40 +0100 (CET)
Received: from elettra.colt-to.towertech.it ([213.215.222.70]:35275 "EHLO
        elettra.colt-to.towertech.it" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493537AbZLCQ1h (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 17:27:37 +0100
Received: from linux.lan.towertech.it (93-39-58-60.ip74.fastwebnet.it [93.39.58.60])
        by elettra.colt-to.towertech.it (Postfix) with ESMTPSA id 9A1DA116649;
        Thu,  3 Dec 2009 17:27:36 +0100 (CET)
Date:   Thu, 3 Dec 2009 17:27:35 +0100
From:   Alessandro Zummo <a.zummo@towertech.it>
To:     rtc-linux@googlegroups.com
Cc:     wuzhangjin@gmail.com, Paul Gortmaker <p_gortmaker@yahoo.com>,
        linux-mips@linux-mips.org
Subject: Re: [rtc-linux] [PATCH v1 2/3] RTC: rtc-cmos.c: enable
 RTC_DM_BINARY of RTC_LIB for fuloong2e and fuloong2f
Message-ID: <20091203172735.7c934f61@linux.lan.towertech.it>
In-Reply-To: <f05318584db5160d73af2cfb36b4e3e481a7e7a4.1257383766.git.wuzhangjin@gmail.com>
References: <cover.1257383766.git.wuzhangjin@gmail.com>
        <f05318584db5160d73af2cfb36b4e3e481a7e7a4.1257383766.git.wuzhangjin@gmail.com>
Organization: Tower Technologies
X-Mailer: Sylpheed
X-This-Is-A-Real-Message: Yes
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.95.2 at elettra
X-Virus-Status: Clean
Return-Path: <a.zummo@towertech.it>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25293
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: a.zummo@towertech.it
Precedence: bulk
X-list: linux-mips

On Thu,  5 Nov 2009 09:22:09 +0800
Wu Zhangjin <wuzhangjin@gmail.com> wrote:

>  	 */
> -	if (is_valid_irq(rtc_irq) &&
> -	    (!(rtc_control & RTC_24H) || (rtc_control & (RTC_DM_BINARY)))) {
> -		dev_dbg(dev, "only 24-hr BCD mode supported\n");
> +	if (is_valid_irq(rtc_irq) && !(rtc_control & RTC_24H)) {
> +		dev_dbg(dev, "only 24-hr supported\n");

 If this check was there it's probably because there are problems
 in some other parts of the driver. I'm not keen to add this without
 some feedback by the original author or porter.

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


From wuzhangjin@gmail.com Thu Dec  3 17:45:26 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 17:45:32 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:57478 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493530AbZLCQpZ (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 17:45:25 +0100
Received: by pwi18 with SMTP id 18so184638pwi.24
        for <linux-mips@linux-mips.org>; Thu, 03 Dec 2009 08:45:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=VDq6w8GMKaQTSKuRgUgOMOd+wgaI9kvlq27e7EhUChM=;
        b=mOjaOmmT9+2SYpu72dB/WX9yXXQqDsMBowMP98LcKJj46w+Lx0dQoPqPYFt4uwHNA5
         y9V4jryNvPvJk0wdsPx6Z6kGchZCXUSCzMD5gFrTrDPbgWxDDs0H+MtQzHQfjeCk6tZy
         hFIXLQarYhN/MIFyjI0oSZ9gnXDVFM5/MEt0s=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=HK60iBTNHjBBtZrKvtkQImpnhFNTV/v60Q3cPUu3e5EZXsa+r/X1uZdMVUa8f8d/22
         7d3jbHb6XJQUtZkR6lyKoLs+PCUFvL6PPwlnE/tB05XIj7GgeVofqOo9R91S0zCUa9Jl
         KDSIHBq24vjIDZGwUqHF595a5rbrigADVYKsw=
Received: by 10.114.164.38 with SMTP id m38mr2495064wae.219.1259858718446;
        Thu, 03 Dec 2009 08:45:18 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm1800401pzk.10.2009.12.03.08.45.15
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Thu, 03 Dec 2009 08:45:17 -0800 (PST)
Subject: Re: [rtc-linux] [PATCH v1 2/3] RTC: rtc-cmos.c: enable
 RTC_DM_BINARY of RTC_LIB for fuloong2e and fuloong2f
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Alessandro Zummo <a.zummo@towertech.it>
Cc:     rtc-linux@googlegroups.com, Paul Gortmaker <p_gortmaker@yahoo.com>,
        linux-mips@linux-mips.org,
        David Brownell <dbrownell@users.sourceforge.net>
In-Reply-To: <20091203172735.7c934f61@linux.lan.towertech.it>
References: <cover.1257383766.git.wuzhangjin@gmail.com>
         <f05318584db5160d73af2cfb36b4e3e481a7e7a4.1257383766.git.wuzhangjin@gmail.com>
         <20091203172735.7c934f61@linux.lan.towertech.it>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Fri, 04 Dec 2009 00:44:56 +0800
Message-ID: <1259858696.7536.28.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25294
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Thu, 2009-12-03 at 17:27 +0100, Alessandro Zummo wrote:
> On Thu,  5 Nov 2009 09:22:09 +0800
> Wu Zhangjin <wuzhangjin@gmail.com> wrote:
> 
> >  	 */
> > -	if (is_valid_irq(rtc_irq) &&
> > -	    (!(rtc_control & RTC_24H) || (rtc_control & (RTC_DM_BINARY)))) {
> > -		dev_dbg(dev, "only 24-hr BCD mode supported\n");
> > +	if (is_valid_irq(rtc_irq) && !(rtc_control & RTC_24H)) {
> > +		dev_dbg(dev, "only 24-hr supported\n");
> 
>  If this check was there it's probably because there are problems
>  in some other parts of the driver. I'm not keen to add this without
>  some feedback by the original author or porter.
> 

Just found two authors or porters from the file: drivers/rtc/rtc-cmos.c

/*
 * RTC class driver for "CMOS RTC":  PCs, ACPI, etc
 *
 * Copyright (C) 1996 Paul Gortmaker (drivers/char/rtc.c)
 * Copyright (C) 2006 David Brownell (convert to new framework)
[...]

and found out their names in MAINTAINERS and put them in the CC list ;)

Regards,
	Wu Zhangjin



From ralf@linux-mips.org Thu Dec  3 18:11:16 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 18:11:22 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:40452 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493569AbZLCRLQ (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Thu, 3 Dec 2009 18:11:16 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB3HBD6o006228;
        Thu, 3 Dec 2009 17:11:13 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB3HBCIo006226;
        Thu, 3 Dec 2009 17:11:12 GMT
Date:   Thu, 3 Dec 2009 17:11:12 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Alessandro Zummo <a.zummo@towertech.it>
Cc:     rtc-linux@googlegroups.com, wuzhangjin@gmail.com,
        Arnaud Patard <apatard@mandriva.com>,
        linux-mips@linux-mips.org, Paul Gortmaker <p_gortmaker@yahoo.com>
Subject: Re: [rtc-linux] [PATCH v1 3/3] [loongson] RTC: Registration of
 Loongson RTC platform device
Message-ID: <20091203171112.GA24493@linux-mips.org>
References: <cover.1257383766.git.wuzhangjin@gmail.com>
 <a597312c16b5cf32621a25e8444d15d23726727f.1257383766.git.wuzhangjin@gmail.com>
 <20091203172110.30fb0635@linux.lan.towertech.it>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091203172110.30fb0635@linux.lan.towertech.it>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25295
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Dec 03, 2009 at 05:21:10PM +0100, Alessandro Zummo wrote:

> > user-space configuration:
> > 
> > $ mknod /dev/rtc0 c 254 0
> 
>  That's not guaranteed. 

Thanks, I've fixed that comment.

  Ralf

From rostedt@goodmis.org Thu Dec  3 18:45:23 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 18:45:26 +0100 (CET)
Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:62576 "EHLO
        hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493618AbZLCRpX (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 18:45:23 +0100
Received: from [192.168.23.10] (really [74.67.89.75])
          by hrndva-omta04.mail.rr.com with ESMTP
          id <20091203174515542.GLGK18441@hrndva-omta04.mail.rr.com>;
          Thu, 3 Dec 2009 17:45:15 +0000
Subject: Re: [PATCH v9 03/10] tracing: add an endian argument to
 scripts/recordmcount.pl
From:   Steven Rostedt <rostedt@goodmis.org>
Reply-To: rostedt@goodmis.org
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>,
        Nicholas Mc Guire <der.herr@hofr.at>, zhangfx@lemote.com,
        Ingo Molnar <mingo@elte.hu>,
        Thomas Gleixner <tglx@linutronix.de>,
        Frederic Weisbecker <fweisbec@gmail.com>,
        linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
        Wu Zhangjin <wuzj@lemote.com>
In-Reply-To: <267c0824194b659b46fc038ba43492df30369fec.1258719323.git.wuzhangjin@gmail.com>
References: <adf867c5a6864fa196c667d3f09a6a694f3903c5.1258719323.git.wuzhangjin@gmail.com>
         <51e30436a435480f1f0dec146a82f2b250900690.1258719323.git.wuzhangjin@gmail.com>
         <267c0824194b659b46fc038ba43492df30369fec.1258719323.git.wuzhangjin@gmail.com>
Content-Type: text/plain
Organization: Kihon Technologies Inc.
Date:   Thu, 03 Dec 2009 12:45:14 -0500
Message-Id: <1259862314.12870.138.camel@gandalf.stny.rr.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.26.3 
Content-Transfer-Encoding: 7bit
Return-Path: <rostedt@goodmis.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25296
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: rostedt@goodmis.org
Precedence: bulk
X-list: linux-mips

On Fri, 2009-11-20 at 20:34 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> MIPS and some other architectures need this argument to handle
> big/little endian respectively.
> 
> Signed-off-by: Wu Zhangjin <wuzj@lemote.com>

I don't think I acked this version. But just to make it official:

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> ---
>  scripts/Makefile.build  |    1 +
>  scripts/recordmcount.pl |    6 +++---
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 341b589..0b94d2f 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -207,6 +207,7 @@ endif
>  
>  ifdef CONFIG_FTRACE_MCOUNT_RECORD
>  cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
> +	"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
>  	"$(if $(CONFIG_64BIT),64,32)" \
>  	"$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
>  	"$(if $(part-of-module),1,0)" "$(@)";
> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index f0d1445..24604d4 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -113,13 +113,13 @@ $P =~ s@.*/@@g;
>  
>  my $V = '0.1';
>  
> -if ($#ARGV != 10) {
> -	print "usage: $P arch bits objdump objcopy cc ld nm rm mv is_module inputfile\n";
> +if ($#ARGV != 11) {
> +	print "usage: $P arch endian bits objdump objcopy cc ld nm rm mv is_module inputfile\n";
>  	print "version: $V\n";
>  	exit(1);
>  }
>  
> -my ($arch, $bits, $objdump, $objcopy, $cc,
> +my ($arch, $endian, $bits, $objdump, $objcopy, $cc,
>      $ld, $nm, $rm, $mv, $is_module, $inputfile) = @ARGV;
>  
>  # This file refers to mcount and shouldn't be ftraced, so lets' ignore it


From rostedt@goodmis.org Thu Dec  3 18:55:07 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Dec 2009 18:55:10 +0100 (CET)
Received: from hrndva-omtalb.mail.rr.com ([71.74.56.125]:52274 "EHLO
        hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493244AbZLCRzG (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Thu, 3 Dec 2009 18:55:06 +0100
Received: from [192.168.23.10] (really [74.67.89.75])
          by hrndva-omta01.mail.rr.com with ESMTP
          id <20091203175454480.KXKO3094@hrndva-omta01.mail.rr.com>;
          Thu, 3 Dec 2009 17:54:54 +0000
Subject: Re: [PATCH v9 04/10] tracing: add dynamic function tracer support
 for MIPS
From:   Steven Rostedt <rostedt@goodmis.org>
Reply-To: rostedt@goodmis.org
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>,
        Nicholas Mc Guire <der.herr@hofr.at>, zhangfx@lemote.com,
        Ingo Molnar <mingo@elte.hu>,
        Thomas Gleixner <tglx@linutronix.de>,
        Frederic Weisbecker <fweisbec@gmail.com>,
        linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
In-Reply-To: <6a25a6132d64830bbd7339fe8b3841a51d02ac6d.1258719323.git.wuzhangjin@gmail.com>
References: <adf867c5a6864fa196c667d3f09a6a694f3903c5.1258719323.git.wuzhangjin@gmail.com>
         <51e30436a435480f1f0dec146a82f2b250900690.1258719323.git.wuzhangjin@gmail.com>
         <267c0824194b659b46fc038ba43492df30369fec.1258719323.git.wuzhangjin@gmail.com>
         <6a25a6132d64830bbd7339fe8b3841a51d02ac6d.1258719323.git.wuzhangjin@gmail.com>
Content-Type: text/plain
Organization: Kihon Technologies Inc.
Date:   Thu, 03 Dec 2009 12:54:53 -0500
Message-Id: <1259862893.12870.141.camel@gandalf.stny.rr.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.26.3 
Content-Transfer-Encoding: 7bit
Return-Path: <rostedt@goodmis.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25297
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: rostedt@goodmis.org
Precedence: bulk
X-list: linux-mips

On Fri, 2009-11-20 at 20:34 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 

> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  arch/mips/Kconfig              |    2 +
>  arch/mips/include/asm/ftrace.h |    9 +++
>  arch/mips/kernel/Makefile      |    3 +-
>  arch/mips/kernel/ftrace.c      |  112 ++++++++++++++++++++++++++++++++++++++++
>  arch/mips/kernel/mcount.S      |   29 ++++++++++


>  scripts/recordmcount.pl        |   54 +++++++++++++++++++


>  6 files changed, 208 insertions(+), 1 deletions(-)
>  create mode 100644 arch/mips/kernel/ftrace.c
> 



> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index 24604d4..9d80d0d 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -295,6 +295,60 @@ if ($arch eq "x86_64") {
>      $ld .= " -m elf64_sparc";
>      $cc .= " -m64";
>      $objcopy .= " -O elf64-sparc";
> +
> +} elsif ($arch eq "mips") {
> +    # To enable module support, we need to enable the -mlong-calls option
> +    # of gcc for module, after using this option, we can not get the real
> +    # offset of the calling to _mcount, but the offset of the lui
> +    # instruction or the addiu one. herein, we record the address of the
> +    # first one, and then we can replace this instruction by a branch
> +    # instruction to jump over the profiling function to filter the
> +    # indicated functions, or swith back to the lui instruction to trace
> +    # them, which means dynamic tracing.
> +    #
> +    #       c:	3c030000 	lui	v1,0x0
> +    #			c: R_MIPS_HI16	_mcount
> +    #			c: R_MIPS_NONE	*ABS*
> +    #			c: R_MIPS_NONE	*ABS*
> +    #      10:	64630000 	daddiu	v1,v1,0
> +    #			10: R_MIPS_LO16	_mcount
> +    #			10: R_MIPS_NONE	*ABS*
> +    #			10: R_MIPS_NONE	*ABS*
> +    #      14:	03e0082d 	move	at,ra
> +    #      18:	0060f809 	jalr	v1
> +    #
> +    # for the kernel:
> +    #
> +    #     10:   03e0082d        move    at,ra
> +    #	  14:   0c000000        jal     0 <loongson_halt>
> +    #                    14: R_MIPS_26   _mcount
> +    #                    14: R_MIPS_NONE *ABS*
> +    #                    14: R_MIPS_NONE *ABS*
> +    #	 18:   00020021        nop
> +    if ($is_module eq "0") {
> +	    $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";
> +    } else {
> +	    $mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_HI16\\s+_mcount\$";
> +    }
> +    $objdump .= " -Melf-trad".$endian."mips ";
> +
> +    if ($endian eq "big") {
> +	    $endian = " -EB ";
> +	    $ld .= " -melf".$bits."btsmip";
> +    } else {
> +	    $endian = " -EL ";
> +	    $ld .= " -melf".$bits."ltsmip";
> +    }
> +
> +    $cc .= " -mno-abicalls -fno-pic -mabi=" . $bits . $endian;
> +    $ld .= $endian;
> +
> +    if ($bits == 64) {
> +	    $function_regex =
> +		"^([0-9a-fA-F]+)\\s+<(.|[^\$]L.*?|\$[^L].*?|[^\$][^L].*?)>:";
> +	    $type = ".dword";
> +    }
> +
>  } else {
>      die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
>  }

This only adds MIPS arch support to recordmcount.pl, and does not touch
any other arch or generic code. Thus, I consider this arch specific
code.

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve



From David.Daney@caviumnetworks.com Fri Dec  4 02:44:04 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 02:44:08 +0100 (CET)
Received: from smtp2.caviumnetworks.com ([209.113.159.134]:14882 "EHLO
        smtp2.caviumnetworks.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494402AbZLDBoE (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 02:44:04 +0100
Received: from maexch1.caveonetworks.com (Not Verified[192.168.14.20]) by smtp2.caviumnetworks.com with MailMarshal (v6,5,4,7535)
        id <B4b1868790000>; Thu, 03 Dec 2009 20:40:09 -0500
Received: from caexch01.caveonetworks.com ([192.168.16.9]) by maexch1.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);
         Thu, 3 Dec 2009 20:44:00 -0500
Received: from dd1.caveonetworks.com ([12.108.191.236]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959);
         Thu, 3 Dec 2009 17:43:58 -0800
Received: from dd1.caveonetworks.com (localhost.localdomain [127.0.0.1])
        by dd1.caveonetworks.com (8.14.2/8.14.2) with ESMTP id nB41htE2015112;
        Thu, 3 Dec 2009 17:43:56 -0800
Received: (from ddaney@localhost)
        by dd1.caveonetworks.com (8.14.2/8.14.2/Submit) id nB41hsOn015110;
        Thu, 3 Dec 2009 17:43:54 -0800
From:   David Daney <ddaney@caviumnetworks.com>
To:     linux-mips@linux-mips.org, ralf@linux-mips.org
Cc:     David Daney <ddaney@caviumnetworks.com>
Subject: [PATCH] MIPS: Cleanup forgotten label_module_alloc in tlbex.c
Date:   Thu,  3 Dec 2009 17:43:54 -0800
Message-Id: <1259891034-15086-1-git-send-email-ddaney@caviumnetworks.com>
X-Mailer: git-send-email 1.6.0.6
X-OriginalArrivalTime: 04 Dec 2009 01:43:58.0737 (UTC) FILETIME=[3F70B810:01CA7483]
Return-Path: <David.Daney@caviumnetworks.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25298
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ddaney@caviumnetworks.com
Precedence: bulk
X-list: linux-mips

commit e0cc87f59490d7d62a8ab2a76498dc8a2b64927a left
label_module_alloc unused.  Remove it now.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/mm/tlbex.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 571f92f..3d6f48a 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -73,9 +73,6 @@ static int __cpuinit m4kc_tlbp_war(void)
 enum label_id {
 	label_second_part = 1,
 	label_leave,
-#ifdef MODULE_START
-	label_module_alloc,
-#endif
 	label_vmalloc,
 	label_vmalloc_done,
 	label_tlbw_hazard,
@@ -92,9 +89,6 @@ enum label_id {
 
 UASM_L_LA(_second_part)
 UASM_L_LA(_leave)
-#ifdef MODULE_START
-UASM_L_LA(_module_alloc)
-#endif
 UASM_L_LA(_vmalloc)
 UASM_L_LA(_vmalloc_done)
 UASM_L_LA(_tlbw_hazard)
@@ -821,8 +815,6 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
 	} else {
 #if defined(CONFIG_HUGETLB_PAGE)
 		const enum label_id ls = label_tlb_huge_update;
-#elif defined(MODULE_START)
-		const enum label_id ls = label_module_alloc;
 #else
 		const enum label_id ls = label_vmalloc;
 #endif
-- 
1.6.0.6


From myuboot@fastmail.fm Fri Dec  4 02:52:38 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 02:52:42 +0100 (CET)
Received: from out1.smtp.messagingengine.com ([66.111.4.25]:38442 "EHLO
        out1.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494401AbZLDBwi (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 02:52:38 +0100
Received: from compute2.internal (compute2.internal [10.202.2.42])
        by gateway1.messagingengine.com (Postfix) with ESMTP id DCA64C549B;
        Thu,  3 Dec 2009 20:52:30 -0500 (EST)
Received: from web8.messagingengine.com ([10.202.2.217])
  by compute2.internal (MEProxy); Thu, 03 Dec 2009 20:52:30 -0500
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:from:to:mime-version:content-transfer-encoding:content-type:references:subject:in-reply-to:date; s=smtpout; bh=ju6bCbA9v+KRDc8UnRIBvBhpNPI=; b=slUBbppV5/AVxOLnjCsoLmyx6ZM1bD6/N8c2/q9n7QBB+6+8UEST/cZM86W5Cs66Wf3Hw8d/XwxJKHuiaVmRKYL71ntP1F+ZsVFsFxZ2OznzJu98k3Zjj3qDHyF4Sax1tHEWKh6bRLo9TgstVgLL2PphbJTQpVRHm2Bz8yj03+Q=
Received: by web8.messagingengine.com (Postfix, from userid 99)
        id C15581F755; Thu,  3 Dec 2009 20:52:30 -0500 (EST)
Message-Id: <1259891550.19943.1348372917@webmail.messagingengine.com>
X-Sasl-Enc: Ats8HmdO8YkLEd2IIl9WWRXGcLgT2cIc4ICBg8qDAIKp 1259891550
From:   myuboot@fastmail.fm
To:     linux-kernel@vger.kernel.org,
        "linux-mips" <linux-mips@linux-mips.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
X-Mailer: MessagingEngine.com Webmail Interface
References: <1255735395.30097.1340523469@webmail.messagingengine.com><4AD906D8.3020404@caviumnetworks.com><1255996564.10560.1340920621@webmail.messagingengine.com><200910200817.24018.florian@openwrt.org><1256676013.24305.1342273367@webmail.messagingengine.com>
 <20091028103551.0b4052d8@pixies.home.jungo.com>
Subject: PIR OFFSET for AR7
In-Reply-To: <20091028103551.0b4052d8@pixies.home.jungo.com>
Date:   Thu, 03 Dec 2009 19:52:30 -0600
Return-Path: <myuboot@fastmail.fm>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25299
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: myuboot@fastmail.fm
Precedence: bulk
X-list: linux-mips

Hi, What is the use of PIR register for AR7 board in file
arch/mips/ar7/irq.c? If I understand it right, PIR is used to define the
polarity of the interrupts. It seems to me that it needs to initialized?

Best regards, Andrew

From wuzhangjin@gmail.com Fri Dec  4 14:30:33 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:30:37 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:50845 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492914AbZLDNad (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:30:33 +0100
Received: by pxi6 with SMTP id 6so504438pxi.0
        for <multiple recipients>; Fri, 04 Dec 2009 05:30:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer;
        bh=JAznP27pg43oXIr2HmrSJJsApl1++Rh6bbcXndfZ0aQ=;
        b=N0wZ+OACQkYx6NggN/BikBXCoW3z/BWRoW3njMeHfyFH5yrQkIOCh5PE7Heli/Dvqc
         Xy47crSBJoLKfFQR+OwSziZUK57XqovH04xzZFx/WUX2oMuXgisOhUEWrJkGXi7yOm0e
         eTD6V7RugSRnK5KeCZ+Y20X9x8OhFZZhn8cPQ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer;
        b=vq424wypQ823yGFrjQhXQximLXGQl3D++Na51VtCZNYmxVG6mVjlEC5aYSpzSQLeBf
         5uU6sQbHVkGRXmmCQgx8qhFzAAuPoSlfx4BqhDZH2NeC0oyiW4/eOocakNDJExClZ+4y
         ihk3D3ngYAjqd3hUN5/4VzJ+mRQLt4jw7TetQ=
Received: by 10.115.66.9 with SMTP id t9mr4134315wak.56.1259933423877;
        Fri, 04 Dec 2009 05:30:23 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm2524514pzk.0.2009.12.04.05.30.16
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:30:23 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 0/8] Loongson: YeeLoong: add platform specific driver
Date:   Fri,  4 Dec 2009 21:30:09 +0800
Message-Id: <cover.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25300
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patchset adds platform specific drivers for YeeLoong netbook. including
the backlight, battery, hwmon, video output, suspend and hotkey(input)
subdrivers. These drivers provide standard interfaces to the user-space
applications to manage the related devices:

	 Subdrivers                     Applicatioins.

        - backlight
          /sys/class/backlight/         kpowersave, gnome-power-manager
        - battery
          /proc/apm                     kpowersave, gnome-power-manager
        - hwmon
          /sys/class/hwmon/             lm-sensors, sensors-applet...
        - video output
          /sys/class/video_output       ?
        - hotkey
          /sys/class/input/             gnome-settings-daemon ?
        - platform(suspend) 
          /sys/power/state              kpowersave, gnome-power-manager

Changes from v6:

	- Move the whole stuff back to drivers/platform/mips/

	  It's very difficult to find a good place to put it in, so, just did
	  what the folks have done under drivers/platform/x86/

	- Rebase the hotkey driver on the sparse keymap library from Dmitry
	Torokhov.

	- Load this module automatically
	  Register a platform device, bind it with this module.

	- Fixup of battery subdriver
	  Ensure apm_get_power_status is NULL when exit.

Wu Zhangjin (8):
  MIPS: add subdirectory for platform extension drivers
  Loongson: YeeLoong: add platform driver
  Loongson: YeeLoong: add backlight driver
  Loongson: YeeLoong: add battery driver
  Loongson: YeeLoong: add hardware monitoring driver
  Loongson: YeeLoong: add video output driver
  Loongson: YeeLoong: add suspend support
  Loongson: YeeLoong: add input/hotkey driver

 arch/mips/include/asm/mach-loongson/ec_kb3310b.h |  191 ++++
 arch/mips/include/asm/mach-loongson/loongson.h   |    6 +
 arch/mips/loongson/common/cmdline.c              |    8 +
 arch/mips/loongson/lemote-2f/Makefile            |    2 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c        |   12 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.h        |  188 ----
 arch/mips/loongson/lemote-2f/platform.c          |   40 +
 arch/mips/loongson/lemote-2f/pm.c                |    4 +-
 arch/mips/loongson/lemote-2f/reset.c             |    2 +-
 drivers/platform/Kconfig                         |    4 +
 drivers/platform/Makefile                        |    1 +
 drivers/platform/mips/Kconfig                    |   33 +
 drivers/platform/mips/Makefile                   |    5 +
 drivers/platform/mips/yeeloong_laptop.c          | 1067 ++++++++++++++++++++++
 14 files changed, 1363 insertions(+), 200 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-loongson/ec_kb3310b.h
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/platform.c
 create mode 100644 drivers/platform/mips/Kconfig
 create mode 100644 drivers/platform/mips/Makefile
 create mode 100644 drivers/platform/mips/yeeloong_laptop.c


From wuzhangjin@gmail.com Fri Dec  4 14:30:55 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:31:00 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:38889 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492920AbZLDNas (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:30:48 +0100
Received: by pwi18 with SMTP id 18so1055264pwi.24
        for <multiple recipients>; Fri, 04 Dec 2009 05:30:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references;
        bh=PNF4dJpdw1GFSGioxoxLVbk5cfqDx1ILIbM+Fq9ACSo=;
        b=sXkJ0NZBRhZZzNFCNt2rn2gAPPQOmzjE/XEeH6kO4kFctmNPiTXrokB4X/oc+h3NbG
         F1c+jiXz0S0liqQlEQ9B6edEkOdzsWZpnXqSCCgb5itMCEeQC8dkcrUEeq0J9hr0LoWO
         zcHpeaewAa2c6VetrKN9SShHJj+2hWB//oAcU=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=fVAD3v46Kb/p/h5UVTmiNySX3LomI/NghO4pR9gOAPnelMbhPpZ0+smsK1QR2kp/71
         pyIelfZSmZgOaDIqVBWX2KnLMg1bRZODK++aY2hewZpPe1sDyS6NSXTovUf5F/sLW6GJ
         QcKDmfvt2ldBcpR6d3EWb2TC/KyOPSz7IiHbU=
Received: by 10.115.103.17 with SMTP id f17mr4033707wam.166.1259933441791;
        Fri, 04 Dec 2009 05:30:41 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm924678pxi.6.2009.12.04.05.30.37
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:30:41 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 1/8] MIPS: add subdirectory for platform extension drivers
Date:   Fri,  4 Dec 2009 21:30:30 +0800
Message-Id: <d6bb11d33fe01abd6de945117ce647af73841f00.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25301
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

It is really hard to split the platform specific subdrivers into
different subsystems, which will generate lots of duplicated source
code, break the whole support into several pieces and also will make the
users be difficult to choose the suitable subdrivers in different
places.

So, I did like the forks have done under drivers/platform/x86, created
the drivers/platform/mips/ for putting the future MIPS netbook/laptop/pc
extension drivers in.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/Kconfig      |    4 ++++
 drivers/platform/mips/Kconfig |   18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 drivers/platform/mips/Kconfig

diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig
index 9652c3f..2319c0b 100644
--- a/drivers/platform/Kconfig
+++ b/drivers/platform/Kconfig
@@ -3,3 +3,7 @@
 if X86
 source "drivers/platform/x86/Kconfig"
 endif
+
+if MIPS
+source "drivers/platform/mips/Kconfig"
+endif
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
new file mode 100644
index 0000000..2f77693
--- /dev/null
+++ b/drivers/platform/mips/Kconfig
@@ -0,0 +1,18 @@
+#
+# MIPS Platform Specific Drivers
+#
+
+menuconfig MIPS_PLATFORM_DEVICES
+	bool "MIPS Platform Specific Device Drivers"
+	default y
+	help
+	  Say Y here to get to see options for device drivers of various
+	  MIPS platforms, including vendor-specific netbook/laptop/pc extension
+	  drivers.  This option alone does not add any kernel code.
+
+	  If you say N, all options in this submenu will be skipped and disabled.
+
+if MIPS_PLATFORM_DEVICES
+
+
+endif # MIPS_PLATFORM_DEVICES
-- 
1.6.2.1


From wuzhangjin@gmail.com Fri Dec  4 14:32:01 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:32:08 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:64372 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492920AbZLDNcB (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:32:01 +0100
Received: by pxi6 with SMTP id 6so506140pxi.0
        for <multiple recipients>; Fri, 04 Dec 2009 05:31:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references;
        bh=YCHd7I53FK8s1A5IpECneUgMvioyxSFhByVu9cejhz0=;
        b=Sr6Wkb006PBMiYk0DmNInqkadYgzIDwrinC5r2RoBlsLfvXeb6e8mCf77fkD7bWjRI
         UOJEcfHA8MLA/huQxb33Vde2EB7ThMGMvLQUb5T1VN7wNZOeqA+dZhJzvq3rkZBXh8Zx
         ayqDCZtYIMSP1YVzhQ8ssoOianv2QdUn5HhxU=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=b+R3NdJml7fDOMH6HdGhgbuPfu+INf1qSIrYHGjG+iUToUZZlcqB2sdCxn6P/uHdV9
         NicADprziX0z2K1DbtTqWFOrVo8Tcfap72fsmZ/L0+mtS6xOMq3tiurxEoliidL7DIeE
         wzFDExLCMJDhKV0xmego9OHCRTJN+WVvJpoOU=
Received: by 10.114.251.5 with SMTP id y5mr3920304wah.215.1259933513973;
        Fri, 04 Dec 2009 05:31:53 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm18589pxi.9.2009.12.04.05.31.48
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:31:53 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 2/8] Loongson: YeeLoong: add platform driver
Date:   Fri,  4 Dec 2009 21:31:38 +0800
Message-Id: <f1d0646fd16af1aae99ba6718248cdb2a7f6e6b3.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25302
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds platform driver for YeeLoong, Currently, This driver is
"empty", the subdrivers will be added in the coming patches.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/mach-loongson/ec_kb3310b.h |  191 ++++++++++++++++++++++
 arch/mips/loongson/lemote-2f/Makefile            |    2 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c        |   12 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.h        |  188 ---------------------
 arch/mips/loongson/lemote-2f/platform.c          |   40 +++++
 arch/mips/loongson/lemote-2f/pm.c                |    4 +-
 arch/mips/loongson/lemote-2f/reset.c             |    2 +-
 drivers/platform/Makefile                        |    1 +
 drivers/platform/mips/Kconfig                    |    9 +
 drivers/platform/mips/Makefile                   |    5 +
 drivers/platform/mips/yeeloong_laptop.c          |   60 +++++++
 11 files changed, 314 insertions(+), 200 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-loongson/ec_kb3310b.h
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/platform.c
 create mode 100644 drivers/platform/mips/Makefile
 create mode 100644 drivers/platform/mips/yeeloong_laptop.c

diff --git a/arch/mips/include/asm/mach-loongson/ec_kb3310b.h b/arch/mips/include/asm/mach-loongson/ec_kb3310b.h
new file mode 100644
index 0000000..4fccb5d
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/ec_kb3310b.h
@@ -0,0 +1,191 @@
+/*
+ * KB3310B Embedded Controller
+ *
+ *  Copyright (C) 2008 Lemote Inc.
+ *  Author: liujl <liujl@lemote.com>, 2008-03-14
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzhangjin@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _EC_KB3310B_H
+#define _EC_KB3310B_H
+
+extern unsigned char ec_read(unsigned short addr);
+extern void ec_write(unsigned short addr, unsigned char val);
+extern int ec_query_seq(unsigned char cmd);
+extern int ec_query_event_num(void);
+extern int ec_get_event_num(void);
+
+typedef int (*sci_handler) (int status);
+extern sci_handler yeeloong_report_lid_status;
+
+#define SCI_IRQ_NUM 0x0A
+
+/*
+ * The following registers are determined by the EC index configuration.
+ * 1, fill the PORT_HIGH as EC register high part.
+ * 2, fill the PORT_LOW as EC register low part.
+ * 3, fill the PORT_DATA as EC register write data or get the data from it.
+ */
+#define	EC_IO_PORT_HIGH	0x0381
+#define	EC_IO_PORT_LOW	0x0382
+#define	EC_IO_PORT_DATA	0x0383
+
+/*
+ * EC delay time is 500us for register and status access
+ */
+#define	EC_REG_DELAY	500	/* unit : us */
+#define	EC_CMD_TIMEOUT	0x1000
+
+/*
+ * EC access port for SCI communication
+ */
+#define	EC_CMD_PORT		0x66
+#define	EC_STS_PORT		0x66
+#define	EC_DAT_PORT		0x62
+#define	CMD_INIT_IDLE_MODE	0xdd
+#define	CMD_EXIT_IDLE_MODE	0xdf
+#define	CMD_INIT_RESET_MODE	0xd8
+#define	CMD_REBOOT_SYSTEM	0x8c
+#define	CMD_GET_EVENT_NUM	0x84
+#define	CMD_PROGRAM_PIECE	0xda
+
+/* Temperature & Fan registers */
+#define	REG_TEMPERATURE_VALUE	0xF458
+#define	REG_FAN_AUTO_MAN_SWITCH 0xF459
+#define	BIT_FAN_AUTO		0
+#define	BIT_FAN_MANUAL		1
+#define	REG_FAN_CONTROL		0xF4D2
+#define	BIT_FAN_CONTROL_ON	(1 << 0)
+#define	BIT_FAN_CONTROL_OFF	(0 << 0)
+#define	REG_FAN_STATUS		0xF4DA
+#define	BIT_FAN_STATUS_ON	(1 << 0)
+#define	BIT_FAN_STATUS_OFF	(0 << 0)
+#define	REG_FAN_SPEED_HIGH	0xFE22
+#define	REG_FAN_SPEED_LOW	0xFE23
+#define	REG_FAN_SPEED_LEVEL	0xF4CC
+/* Fan speed divider */
+#define	FAN_SPEED_DIVIDER	480000	/* (60*1000*1000/62.5/2)*/
+
+/* Battery registers */
+#define	REG_BAT_DESIGN_CAP_HIGH		0xF77D
+#define	REG_BAT_DESIGN_CAP_LOW		0xF77E
+#define	REG_BAT_FULLCHG_CAP_HIGH	0xF780
+#define	REG_BAT_FULLCHG_CAP_LOW		0xF781
+#define	REG_BAT_DESIGN_VOL_HIGH		0xF782
+#define	REG_BAT_DESIGN_VOL_LOW		0xF783
+#define	REG_BAT_CURRENT_HIGH		0xF784
+#define	REG_BAT_CURRENT_LOW		0xF785
+#define	REG_BAT_VOLTAGE_HIGH		0xF786
+#define	REG_BAT_VOLTAGE_LOW		0xF787
+#define	REG_BAT_TEMPERATURE_HIGH	0xF788
+#define	REG_BAT_TEMPERATURE_LOW		0xF789
+#define	REG_BAT_RELATIVE_CAP_HIGH	0xF492
+#define	REG_BAT_RELATIVE_CAP_LOW	0xF493
+#define	REG_BAT_VENDOR			0xF4C4
+#define	FLAG_BAT_VENDOR_SANYO		0x01
+#define	FLAG_BAT_VENDOR_SIMPLO		0x02
+#define	REG_BAT_CELL_COUNT		0xF4C6
+#define	FLAG_BAT_CELL_3S1P		0x03
+#define	FLAG_BAT_CELL_3S2P		0x06
+#define	REG_BAT_CHARGE			0xF4A2
+#define	FLAG_BAT_CHARGE_DISCHARGE	0x01
+#define	FLAG_BAT_CHARGE_CHARGE		0x02
+#define	FLAG_BAT_CHARGE_ACPOWER		0x00
+#define	REG_BAT_STATUS			0xF4B0
+#define	BIT_BAT_STATUS_LOW		(1 << 5)
+#define	BIT_BAT_STATUS_DESTROY		(1 << 2)
+#define	BIT_BAT_STATUS_FULL		(1 << 1)
+#define	BIT_BAT_STATUS_IN		(1 << 0)
+#define	REG_BAT_CHARGE_STATUS		0xF4B1
+#define	BIT_BAT_CHARGE_STATUS_OVERTEMP	(1 << 2)
+#define	BIT_BAT_CHARGE_STATUS_PRECHG	(1 << 1)
+#define	REG_BAT_STATE			0xF482
+#define	BIT_BAT_STATE_CHARGING		(1 << 1)
+#define	BIT_BAT_STATE_DISCHARGING	(1 << 0)
+#define	REG_BAT_POWER			0xF440
+#define	BIT_BAT_POWER_S3		(1 << 2)
+#define	BIT_BAT_POWER_ON		(1 << 1)
+#define	BIT_BAT_POWER_ACIN		(1 << 0)
+
+/* Audio: rd/wr */
+#define	REG_AUDIO_VOLUME	0xF46C
+#define	REG_AUDIO_MUTE		0xF4E7
+#define	REG_AUDIO_BEEP		0xF4D0
+/* USB port power or not: rd/wr */
+#define	REG_USB0_FLAG		0xF461
+#define	REG_USB1_FLAG		0xF462
+#define	REG_USB2_FLAG		0xF463
+#define	BIT_USB_FLAG_ON		1
+#define	BIT_USB_FLAG_OFF	0
+/* LID */
+#define	REG_LID_DETECT		0xF4BD
+#define	BIT_LID_DETECT_ON	1
+#define	BIT_LID_DETECT_OFF	0
+/* CRT */
+#define	REG_CRT_DETECT		0xF4AD
+#define	BIT_CRT_DETECT_PLUG	1
+#define	BIT_CRT_DETECT_UNPLUG	0
+/* LCD backlight brightness adjust: 9 levels */
+#define	REG_DISPLAY_BRIGHTNESS	0xF4F5
+/* Black screen Status */
+#define	BIT_DISPLAY_LCD_ON	1
+#define	BIT_DISPLAY_LCD_OFF	0
+/* LCD backlight control: off/restore */
+#define	REG_BACKLIGHT_CTRL	0xF7BD
+#define	BIT_BACKLIGHT_ON	1
+#define	BIT_BACKLIGHT_OFF	0
+/* Reset the machine auto-clear: rd/wr */
+#define	REG_RESET		0xF4EC
+#define	BIT_RESET_ON		1
+/* Light the led: rd/wr */
+#define	REG_LED			0xF4C8
+#define	BIT_LED_RED_POWER	(1 << 0)
+#define	BIT_LED_ORANGE_POWER	(1 << 1)
+#define	BIT_LED_GREEN_CHARGE	(1 << 2)
+#define	BIT_LED_RED_CHARGE	(1 << 3)
+#define	BIT_LED_NUMLOCK		(1 << 4)
+/* Test led mode, all led on/off */
+#define	REG_LED_TEST		0xF4C2
+#define	BIT_LED_TEST_IN		1
+#define	BIT_LED_TEST_OUT	0
+/* Camera on/off */
+#define	REG_CAMERA_STATUS	0xF46A
+#define	BIT_CAMERA_STATUS_ON	1
+#define	BIT_CAMERA_STATUS_OFF	0
+#define	REG_CAMERA_CONTROL	0xF7B7
+#define	BIT_CAMERA_CONTROL_OFF	0
+#define	BIT_CAMERA_CONTROL_ON	1
+/* Wlan Status */
+#define	REG_WLAN		0xF4FA
+#define	BIT_WLAN_ON		1
+#define	BIT_WLAN_OFF		0
+#define	REG_DISPLAY_LCD		0xF79F
+
+/* SCI Event Number from EC */
+enum {
+	EVENT_LID = 0x23,	/*  Turn on/off LID */
+	EVENT_DISPLAY_TOGGLE,	/*  Fn+F3 for display switch */
+	EVENT_SLEEP,		/*  Fn+F1 for entering sleep mode */
+	EVENT_OVERTEMP,		/*  Over-temperature happened */
+	EVENT_CRT_DETECT,	/*  CRT is connected */
+	EVENT_CAMERA,		/*  Camera on/off */
+	EVENT_USB_OC2,		/*  USB2 Over Current occurred */
+	EVENT_USB_OC0,		/*  USB0 Over Current occurred */
+	EVENT_BLACK_SCREEN,	/*  Turn on/off backlight */
+	EVENT_AUDIO_MUTE,	/*  Mute on/off */
+	EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
+	EVENT_AC_BAT,		/*  AC & Battery relative issue */
+	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
+	EVENT_WLAN,		/*  Wlan on/off */
+};
+
+#define EVENT_START	EVENT_LID
+#define EVENT_END	EVENT_WLAN
+
+#endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson/lemote-2f/Makefile
index 4d84b27..470156e 100644
--- a/arch/mips/loongson/lemote-2f/Makefile
+++ b/arch/mips/loongson/lemote-2f/Makefile
@@ -2,7 +2,7 @@
 # Makefile for lemote loongson2f family machines
 #
 
-obj-y += irq.o reset.o ec_kb3310b.o
+obj-y += irq.o reset.o ec_kb3310b.o platform.o
 
 #
 # Suspend Support
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.c b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
index 4d84111..734d2d0 100644
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.c
+++ b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
@@ -14,7 +14,7 @@
 #include <linux/spinlock.h>
 #include <linux/delay.h>
 
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 static DEFINE_SPINLOCK(index_access_lock);
 static DEFINE_SPINLOCK(port_access_lock);
@@ -76,12 +76,9 @@ int ec_query_seq(unsigned char cmd)
 	}
 
 	if (timeout <= 0) {
-		printk(KERN_ERR "%s: deadable error : timeout...\n", __func__);
+		pr_err("%s: deadable error : timeout...\n", __func__);
 		ret = -EINVAL;
-	} else
-		printk(KERN_INFO
-			   "(%x/%d)ec issued command %d status : 0x%x\n",
-			   timeout, EC_CMD_TIMEOUT - timeout, cmd, status);
+	}
 
 	spin_unlock_irqrestore(&port_access_lock, flags);
 
@@ -118,8 +115,7 @@ int ec_get_event_num(void)
 		udelay(EC_REG_DELAY);
 	}
 	if (timeout <= 0) {
-		pr_info("%s: get event number timeout.\n", __func__);
-
+		pr_err("%s: get event number timeout.\n", __func__);
 		return -EINVAL;
 	}
 	value = inb(EC_DAT_PORT);
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/ec_kb3310b.h
deleted file mode 100644
index 1595a21..0000000
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * KB3310B Embedded Controller
- *
- *  Copyright (C) 2008 Lemote Inc.
- *  Author: liujl <liujl@lemote.com>, 2008-03-14
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _EC_KB3310B_H
-#define _EC_KB3310B_H
-
-extern unsigned char ec_read(unsigned short addr);
-extern void ec_write(unsigned short addr, unsigned char val);
-extern int ec_query_seq(unsigned char cmd);
-extern int ec_query_event_num(void);
-extern int ec_get_event_num(void);
-
-typedef int (*sci_handler) (int status);
-extern sci_handler yeeloong_report_lid_status;
-
-#define SCI_IRQ_NUM 0x0A
-
-/*
- * The following registers are determined by the EC index configuration.
- * 1, fill the PORT_HIGH as EC register high part.
- * 2, fill the PORT_LOW as EC register low part.
- * 3, fill the PORT_DATA as EC register write data or get the data from it.
- */
-#define	EC_IO_PORT_HIGH	0x0381
-#define	EC_IO_PORT_LOW	0x0382
-#define	EC_IO_PORT_DATA	0x0383
-
-/*
- * EC delay time is 500us for register and status access
- */
-#define	EC_REG_DELAY	500	/* unit : us */
-#define	EC_CMD_TIMEOUT	0x1000
-
-/*
- * EC access port for SCI communication
- */
-#define	EC_CMD_PORT		0x66
-#define	EC_STS_PORT		0x66
-#define	EC_DAT_PORT		0x62
-#define	CMD_INIT_IDLE_MODE	0xdd
-#define	CMD_EXIT_IDLE_MODE	0xdf
-#define	CMD_INIT_RESET_MODE	0xd8
-#define	CMD_REBOOT_SYSTEM	0x8c
-#define	CMD_GET_EVENT_NUM	0x84
-#define	CMD_PROGRAM_PIECE	0xda
-
-/* temperature & fan registers */
-#define	REG_TEMPERATURE_VALUE	0xF458
-#define	REG_FAN_AUTO_MAN_SWITCH 0xF459
-#define	BIT_FAN_AUTO		0
-#define	BIT_FAN_MANUAL		1
-#define	REG_FAN_CONTROL		0xF4D2
-#define	BIT_FAN_CONTROL_ON	(1 << 0)
-#define	BIT_FAN_CONTROL_OFF	(0 << 0)
-#define	REG_FAN_STATUS		0xF4DA
-#define	BIT_FAN_STATUS_ON	(1 << 0)
-#define	BIT_FAN_STATUS_OFF	(0 << 0)
-#define	REG_FAN_SPEED_HIGH	0xFE22
-#define	REG_FAN_SPEED_LOW	0xFE23
-#define	REG_FAN_SPEED_LEVEL	0xF4CC
-/* fan speed divider */
-#define	FAN_SPEED_DIVIDER	480000	/* (60*1000*1000/62.5/2)*/
-
-/* battery registers */
-#define	REG_BAT_DESIGN_CAP_HIGH		0xF77D
-#define	REG_BAT_DESIGN_CAP_LOW		0xF77E
-#define	REG_BAT_FULLCHG_CAP_HIGH	0xF780
-#define	REG_BAT_FULLCHG_CAP_LOW		0xF781
-#define	REG_BAT_DESIGN_VOL_HIGH		0xF782
-#define	REG_BAT_DESIGN_VOL_LOW		0xF783
-#define	REG_BAT_CURRENT_HIGH		0xF784
-#define	REG_BAT_CURRENT_LOW		0xF785
-#define	REG_BAT_VOLTAGE_HIGH		0xF786
-#define	REG_BAT_VOLTAGE_LOW		0xF787
-#define	REG_BAT_TEMPERATURE_HIGH	0xF788
-#define	REG_BAT_TEMPERATURE_LOW		0xF789
-#define	REG_BAT_RELATIVE_CAP_HIGH	0xF492
-#define	REG_BAT_RELATIVE_CAP_LOW	0xF493
-#define	REG_BAT_VENDOR			0xF4C4
-#define	FLAG_BAT_VENDOR_SANYO		0x01
-#define	FLAG_BAT_VENDOR_SIMPLO		0x02
-#define	REG_BAT_CELL_COUNT		0xF4C6
-#define	FLAG_BAT_CELL_3S1P		0x03
-#define	FLAG_BAT_CELL_3S2P		0x06
-#define	REG_BAT_CHARGE			0xF4A2
-#define	FLAG_BAT_CHARGE_DISCHARGE	0x01
-#define	FLAG_BAT_CHARGE_CHARGE		0x02
-#define	FLAG_BAT_CHARGE_ACPOWER		0x00
-#define	REG_BAT_STATUS			0xF4B0
-#define	BIT_BAT_STATUS_LOW		(1 << 5)
-#define	BIT_BAT_STATUS_DESTROY		(1 << 2)
-#define	BIT_BAT_STATUS_FULL		(1 << 1)
-#define	BIT_BAT_STATUS_IN		(1 << 0)
-#define	REG_BAT_CHARGE_STATUS		0xF4B1
-#define	BIT_BAT_CHARGE_STATUS_OVERTEMP	(1 << 2)
-#define	BIT_BAT_CHARGE_STATUS_PRECHG	(1 << 1)
-#define	REG_BAT_STATE			0xF482
-#define	BIT_BAT_STATE_CHARGING		(1 << 1)
-#define	BIT_BAT_STATE_DISCHARGING	(1 << 0)
-#define	REG_BAT_POWER			0xF440
-#define	BIT_BAT_POWER_S3		(1 << 2)
-#define	BIT_BAT_POWER_ON		(1 << 1)
-#define	BIT_BAT_POWER_ACIN		(1 << 0)
-
-/* other registers */
-/* Audio: rd/wr */
-#define	REG_AUDIO_VOLUME	0xF46C
-#define	REG_AUDIO_MUTE		0xF4E7
-#define	REG_AUDIO_BEEP		0xF4D0
-/* USB port power or not: rd/wr */
-#define	REG_USB0_FLAG		0xF461
-#define	REG_USB1_FLAG		0xF462
-#define	REG_USB2_FLAG		0xF463
-#define	BIT_USB_FLAG_ON		1
-#define	BIT_USB_FLAG_OFF	0
-/* LID */
-#define	REG_LID_DETECT		0xF4BD
-#define	BIT_LID_DETECT_ON	1
-#define	BIT_LID_DETECT_OFF	0
-/* CRT */
-#define	REG_CRT_DETECT		0xF4AD
-#define	BIT_CRT_DETECT_PLUG	1
-#define	BIT_CRT_DETECT_UNPLUG	0
-/* LCD backlight brightness adjust: 9 levels */
-#define	REG_DISPLAY_BRIGHTNESS	0xF4F5
-/* Black screen Status */
-#define	BIT_DISPLAY_LCD_ON	1
-#define	BIT_DISPLAY_LCD_OFF	0
-/* LCD backlight control: off/restore */
-#define	REG_BACKLIGHT_CTRL	0xF7BD
-#define	BIT_BACKLIGHT_ON	1
-#define	BIT_BACKLIGHT_OFF	0
-/* Reset the machine auto-clear: rd/wr */
-#define	REG_RESET		0xF4EC
-#define	BIT_RESET_ON		1
-/* Light the led: rd/wr */
-#define	REG_LED			0xF4C8
-#define	BIT_LED_RED_POWER	(1 << 0)
-#define	BIT_LED_ORANGE_POWER	(1 << 1)
-#define	BIT_LED_GREEN_CHARGE	(1 << 2)
-#define	BIT_LED_RED_CHARGE	(1 << 3)
-#define	BIT_LED_NUMLOCK		(1 << 4)
-/* Test led mode, all led on/off */
-#define	REG_LED_TEST		0xF4C2
-#define	BIT_LED_TEST_IN		1
-#define	BIT_LED_TEST_OUT	0
-/* Camera on/off */
-#define	REG_CAMERA_STATUS	0xF46A
-#define	BIT_CAMERA_STATUS_ON	1
-#define	BIT_CAMERA_STATUS_OFF	0
-#define	REG_CAMERA_CONTROL	0xF7B7
-#define	BIT_CAMERA_CONTROL_OFF	0
-#define	BIT_CAMERA_CONTROL_ON	1
-/* Wlan Status */
-#define	REG_WLAN		0xF4FA
-#define	BIT_WLAN_ON		1
-#define	BIT_WLAN_OFF		0
-#define	REG_DISPLAY_LCD		0xF79F
-
-/* SCI Event Number from EC */
-enum {
-	EVENT_LID = 0x23,	/*  LID open/close */
-	EVENT_DISPLAY_TOGGLE,	/*  Fn+F3 for display switch */
-	EVENT_SLEEP,		/*  Fn+F1 for entering sleep mode */
-	EVENT_OVERTEMP,		/*  Over-temperature happened */
-	EVENT_CRT_DETECT,	/*  CRT is connected */
-	EVENT_CAMERA,		/*  Camera on/off */
-	EVENT_USB_OC2,		/*  USB2 Over Current occurred */
-	EVENT_USB_OC0,		/*  USB0 Over Current occurred */
-	EVENT_BLACK_SCREEN,	/*  Turn on/off backlight */
-	EVENT_AUDIO_MUTE,	/*  Mute on/off */
-	EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
-	EVENT_AC_BAT,		/*  AC & Battery relative issue */
-	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
-	EVENT_WLAN,		/*  Wlan on/off */
-	EVENT_END
-};
-
-#endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/platform.c b/arch/mips/loongson/lemote-2f/platform.c
new file mode 100644
index 0000000..0e7b27d
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/platform.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzj@lemote.com
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+#include <asm/bootinfo.h>
+
+static struct platform_device yeeloong_pdev = {
+	.name = "yeeloong_laptop",
+	.id = -1,
+};
+
+static int __init lemote2f_platform_init(void)
+{
+	struct platform_device *pdev = NULL;
+
+	switch (mips_machtype) {
+	case MACH_LEMOTE_YL2F89:
+		pdev = &yeeloong_pdev;
+		break;
+	default:
+		break;
+
+	}
+
+	if (pdev != NULL)
+		return platform_device_register(pdev);
+
+	return -ENODEV;
+}
+
+arch_initcall(lemote2f_platform_init);
diff --git a/arch/mips/loongson/lemote-2f/pm.c b/arch/mips/loongson/lemote-2f/pm.c
index d7af2e6..0d5698a 100644
--- a/arch/mips/loongson/lemote-2f/pm.c
+++ b/arch/mips/loongson/lemote-2f/pm.c
@@ -23,7 +23,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536_mfgpt.h>
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 #define I8042_KBD_IRQ		1
 #define I8042_CTR_KBDINT	0x01
@@ -100,7 +100,7 @@ int wakeup_loongson(void)
 	if (irq < 0)
 		return 0;
 
-	printk(KERN_INFO "%s: irq = %d\n", __func__, irq);
+	pr_info("%s: irq = %d\n", __func__, irq);
 
 	if (irq == I8042_KBD_IRQ)
 		return 1;
diff --git a/arch/mips/loongson/lemote-2f/reset.c b/arch/mips/loongson/lemote-2f/reset.c
index 51d1a60..4627659 100644
--- a/arch/mips/loongson/lemote-2f/reset.c
+++ b/arch/mips/loongson/lemote-2f/reset.c
@@ -20,7 +20,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536.h>
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 static void reset_cpu(void)
 {
diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile
index 782953a..8bdc97c 100644
--- a/drivers/platform/Makefile
+++ b/drivers/platform/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_X86)		+= x86/
+obj-$(CONFIG_MIPS)		+= mips/
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 2f77693..76f0250 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -14,5 +14,14 @@ menuconfig MIPS_PLATFORM_DEVICES
 
 if MIPS_PLATFORM_DEVICES
 
+config LEMOTE_YEELOONG2F
+	tristate "Lemote YeeLoong Laptop"
+	depends on LEMOTE_MACH2F
+	default m
+	help
+	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
+	  compatible to FuLoong2F mini PC, but it has an extra Embedded
+	  Controller(kb3310b) for battery, hotkey, backlight, temperature and
+	  fan management.
 
 endif # MIPS_PLATFORM_DEVICES
diff --git a/drivers/platform/mips/Makefile b/drivers/platform/mips/Makefile
new file mode 100644
index 0000000..506f920
--- /dev/null
+++ b/drivers/platform/mips/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for MIPS Platform-Specific Drivers
+#
+
+obj-$(CONFIG_LEMOTE_YEELOONG2F)	+= yeeloong_laptop.o
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
new file mode 100644
index 0000000..85fc7ed
--- /dev/null
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -0,0 +1,60 @@
+/*
+ * Driver for YeeLoong laptop extras
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+static struct platform_device_id platform_device_ids[] = {
+	{
+		.name = "yeeloong_laptop",
+	},
+	{}
+};
+
+MODULE_DEVICE_TABLE(platform, platform_device_ids);
+
+static struct platform_driver platform_driver = {
+	.driver = {
+		   .name = "yeeloong_laptop",
+		   .owner = THIS_MODULE,
+		   },
+	.id_table = platform_device_ids,
+};
+
+static int __init yeeloong_init(void)
+{
+	int ret;
+
+	pr_info("Load YeeLoong Laptop Platform Specific Driver.\n");
+
+	/* Register platform stuff */
+	ret = platform_driver_register(&platform_driver);
+	if (ret) {
+		pr_err("Fail to register yeeloong platform driver.\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static void __exit yeeloong_exit(void)
+{
+	platform_driver_unregister(&platform_driver);
+
+	pr_info("Unload YeeLoong Platform Specific Driver.\n");
+}
+
+module_init(yeeloong_init);
+module_exit(yeeloong_exit);
+
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop driver");
+MODULE_LICENSE("GPL");
-- 
1.6.2.1


From wuzhangjin@gmail.com Fri Dec  4 14:33:29 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:33:32 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:57818 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492968AbZLDNd3 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:33:29 +0100
Received: by pwi18 with SMTP id 18so1056692pwi.24
        for <multiple recipients>; Fri, 04 Dec 2009 05:33:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references;
        bh=mlHuI1DOS99RXr0UCj/+wKdtDmGxvoLDdQKNmsiew9c=;
        b=lPOpF+bb7FmTzBAQNYLGoidXjQG1GqonGl0SzBQsfZh+wNxeBAjYNCoxfcP7WN0Xtr
         SEmeQ88b1OWRgLfWoosY1U2X6+oxktrhEi8kTyaOJCTyY2YJVBwNqYVX1504ur1/hB8V
         zmCjoUjb9xR4l5+HKthQa45z5WcbVX/+Mwing=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=RAOz+yINSpK1YnMRnw8tvWn9QFpM5lN0yq+zDso3BMhN32UUa2jkLUy/FSV/UTXc26
         r2YwDQYvDEenzpmGehoQ9zUg1ZffbcnocQaq0gusgjo03JH0AKiQzmcmPgIrdztmy/ki
         uRGg5/dqYmjFNL/l6tFiWCrt0P4ZmLRp/UriA=
Received: by 10.114.215.36 with SMTP id n36mr4055367wag.110.1259933601941;
        Fri, 04 Dec 2009 05:33:21 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm2514250pzk.10.2009.12.04.05.33.12
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:33:21 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, Richard Purdie <rpurdie@rpsys.net>,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 3/8] Loongson: YeeLoong: add backlight driver
Date:   Fri,  4 Dec 2009 21:32:40 +0800
Message-Id: <c2b33b22356136a0cc528c877762a7ae00b4ac08.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25303
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds YeeLoong Backlight Driver, it provides standard
interface(/sys/class/backlight/) for user-space applications(e.g.
kpowersave, gnome-power-manager) to control the brightness of the
backlight.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |   79 +++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 76f0250..f7a3705 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -17,6 +17,7 @@ if MIPS_PLATFORM_DEVICES
 config LEMOTE_YEELOONG2F
 	tristate "Lemote YeeLoong Laptop"
 	depends on LEMOTE_MACH2F
+	select BACKLIGHT_CLASS_DEVICE
 	default m
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 85fc7ed..fbc4ebb 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -11,6 +11,77 @@
 
 #include <linux/err.h>
 #include <linux/platform_device.h>
+#include <linux/backlight.h>	/* for backlight subdriver */
+#include <linux/fb.h>
+
+#include <ec_kb3310b.h>
+
+/* backlight subdriver */
+#define MAX_BRIGHTNESS	8
+
+static int yeeloong_set_brightness(struct backlight_device *bd)
+{
+	unsigned int level, current_level;
+	static unsigned int old_level;
+
+	level = (bd->props.fb_blank == FB_BLANK_UNBLANK &&
+		 bd->props.power == FB_BLANK_UNBLANK) ?
+	    bd->props.brightness : 0;
+
+	if (level > MAX_BRIGHTNESS)
+		level = MAX_BRIGHTNESS;
+	else if (level < 0)
+		level = 0;
+
+	/* Avoid to modify the brightness when EC is tuning it */
+	current_level = ec_read(REG_DISPLAY_BRIGHTNESS);
+	if ((old_level == current_level) && (old_level != level))
+		ec_write(REG_DISPLAY_BRIGHTNESS, level);
+	old_level = level;
+
+	return 0;
+}
+
+static int yeeloong_get_brightness(struct backlight_device *bd)
+{
+	return (int)ec_read(REG_DISPLAY_BRIGHTNESS);
+}
+
+static struct backlight_ops backlight_ops = {
+	.get_brightness = yeeloong_get_brightness,
+	.update_status = yeeloong_set_brightness,
+};
+
+static struct backlight_device *yeeloong_backlight_dev;
+
+static int yeeloong_backlight_init(void)
+{
+	int ret;
+
+	yeeloong_backlight_dev = backlight_device_register("backlight0", NULL,
+			NULL, &backlight_ops);
+
+	if (IS_ERR(yeeloong_backlight_dev)) {
+		ret = PTR_ERR(yeeloong_backlight_dev);
+		yeeloong_backlight_dev = NULL;
+		return ret;
+	}
+
+	yeeloong_backlight_dev->props.max_brightness = MAX_BRIGHTNESS;
+	yeeloong_backlight_dev->props.brightness =
+		yeeloong_get_brightness(yeeloong_backlight_dev);
+	backlight_update_status(yeeloong_backlight_dev);
+
+	return 0;
+}
+
+static void yeeloong_backlight_exit(void)
+{
+	if (yeeloong_backlight_dev) {
+		backlight_device_unregister(yeeloong_backlight_dev);
+		yeeloong_backlight_dev = NULL;
+	}
+}
 
 static struct platform_device_id platform_device_ids[] = {
 	{
@@ -42,11 +113,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_backlight_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong backlight driver.\n");
+		yeeloong_backlight_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
 
 	pr_info("Unload YeeLoong Platform Specific Driver.\n");
-- 
1.6.2.1


From wuzhangjin@gmail.com Fri Dec  4 14:34:43 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:34:46 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:45981 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492335AbZLDNen (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:34:43 +0100
Received: by pxi6 with SMTP id 6so509268pxi.0
        for <multiple recipients>; Fri, 04 Dec 2009 05:34:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references;
        bh=u/tIqaehChNypTk7mUOWlTQstK6eCnJaichBV4x0i9I=;
        b=t5P//KHXMyepMcjQen64VwdKux/WoFVuzPjvwvx4650l/kVFnmnyDLB5FGmzfpXrTA
         +KWiovLL+Kfo9jHXDF3y/L5OHoxDtwPhRno/uYtHhSUGimM0sfaPytgZL5tbeNLUxwde
         W4nrzZjVwiuMZVyNy3AlZTuYCcB/2ff4uuRj8=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=hP+xl3Xff6KIqs14vroKQAhnpXDFIjxQHoLRGhZ7Ir7JZlkNIIYEupHrm4JZchrXO0
         CJqQ4sEeLKAsZ7LAG9VR0Hk9KZmXZpyHHzCsPOgzHO9tN70+l/p4gC3XoRw/QUc2K+Ne
         LM9kMYwScdyB+UZaxH7ntrydARbWRLuLTkxro=
Received: by 10.114.119.6 with SMTP id r6mr4151904wac.45.1259933676927;
        Fri, 04 Dec 2009 05:34:36 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm2512952pzk.9.2009.12.04.05.34.30
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:34:36 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, Stephen Rothwell <sfr@canb.auug.org.au>,
        linux-laptop@vger.kernel.org, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 4/8] Loongson: YeeLoong: add battery driver
Date:   Fri,  4 Dec 2009 21:34:17 +0800
Message-Id: <059fa216d70771a6341edb2db4cc559e958273e9.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25304
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds APM emulated Battery Driver, it provides standard
interface(/proc/apm) for user-space applications(e.g. kpowersave,
gnome-power-manager) to manage the battery.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    2 +
 drivers/platform/mips/yeeloong_laptop.c |  104 +++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index f7a3705..0c6b5ad 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -18,6 +18,8 @@ config LEMOTE_YEELOONG2F
 	tristate "Lemote YeeLoong Laptop"
 	depends on LEMOTE_MACH2F
 	select BACKLIGHT_CLASS_DEVICE
+	select SYS_SUPPORTS_APM_EMULATION
+	select APM_EMULATION
 	default m
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index fbc4ebb..729e368 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -13,6 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/backlight.h>	/* for backlight subdriver */
 #include <linux/fb.h>
+#include <linux/apm-emulation.h>/* for battery subdriver */
 
 #include <ec_kb3310b.h>
 
@@ -83,6 +84,106 @@ static void yeeloong_backlight_exit(void)
 	}
 }
 
+/* battery subdriver */
+
+static void get_fixed_battery_info(void)
+{
+	int design_cap, full_charged_cap, design_vol, vendor, cell_count;
+
+	design_cap = (ec_read(REG_BAT_DESIGN_CAP_HIGH) << 8)
+	    | ec_read(REG_BAT_DESIGN_CAP_LOW);
+	full_charged_cap = (ec_read(REG_BAT_FULLCHG_CAP_HIGH) << 8)
+	    | ec_read(REG_BAT_FULLCHG_CAP_LOW);
+	design_vol = (ec_read(REG_BAT_DESIGN_VOL_HIGH) << 8)
+	    | ec_read(REG_BAT_DESIGN_VOL_LOW);
+	vendor = ec_read(REG_BAT_VENDOR);
+	cell_count = ec_read(REG_BAT_CELL_COUNT);
+
+	if (vendor != 0) {
+		pr_info("battery vendor(%s), cells count(%d), "
+		       "with designed capacity(%d),designed voltage(%d),"
+		       " full charged capacity(%d)\n",
+		       (vendor ==
+			FLAG_BAT_VENDOR_SANYO) ? "SANYO" : "SIMPLO",
+		       (cell_count == FLAG_BAT_CELL_3S1P) ? 3 : 6,
+		       design_cap, design_vol,
+		       full_charged_cap);
+	}
+}
+
+#define APM_CRITICAL		5
+
+static void get_power_status(struct apm_power_info *info)
+{
+	unsigned char bat_status;
+
+	info->battery_status = APM_BATTERY_STATUS_UNKNOWN;
+	info->battery_flag = APM_BATTERY_FLAG_UNKNOWN;
+	info->units = APM_UNITS_MINS;
+
+	info->battery_life = (ec_read(REG_BAT_RELATIVE_CAP_HIGH) << 8) |
+		(ec_read(REG_BAT_RELATIVE_CAP_LOW));
+
+	info->ac_line_status = (ec_read(REG_BAT_POWER) & BIT_BAT_POWER_ACIN) ?
+		APM_AC_ONLINE : APM_AC_OFFLINE;
+
+	bat_status = ec_read(REG_BAT_STATUS);
+
+	if (!(bat_status & BIT_BAT_STATUS_IN)) {
+		/* no battery inserted */
+		info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT;
+		info->battery_flag = APM_BATTERY_FLAG_NOT_PRESENT;
+		info->time = 0x00;
+		return;
+	}
+
+	/* adapter inserted */
+	if (info->ac_line_status == APM_AC_ONLINE) {
+		if (!(bat_status & BIT_BAT_STATUS_FULL)) {
+			/* battery is not fully charged */
+			info->battery_status = APM_BATTERY_STATUS_CHARGING;
+			info->battery_flag = APM_BATTERY_FLAG_CHARGING;
+		} else {
+			/* battery is fully charged */
+			info->battery_status = APM_BATTERY_STATUS_HIGH;
+			info->battery_flag = APM_BATTERY_FLAG_HIGH;
+			info->battery_life = 100;
+		}
+	} else {
+		/* battery is too low */
+		if (bat_status & BIT_BAT_STATUS_LOW) {
+			info->battery_status = APM_BATTERY_STATUS_LOW;
+			info->battery_flag = APM_BATTERY_FLAG_LOW;
+			if (info->battery_life <= APM_CRITICAL) {
+				/* we should power off the system now */
+				info->battery_status =
+					APM_BATTERY_STATUS_CRITICAL;
+				info->battery_flag = APM_BATTERY_FLAG_CRITICAL;
+			}
+		} else {
+			/* assume the battery is high enough. */
+			info->battery_status = APM_BATTERY_STATUS_HIGH;
+			info->battery_flag = APM_BATTERY_FLAG_HIGH;
+		}
+	}
+	info->time = ((info->battery_life - 3) * 54 + 142) / 60;
+}
+
+static int yeeloong_battery_init(void)
+{
+	get_fixed_battery_info();
+
+	apm_get_power_status = get_power_status;
+
+	return 0;
+}
+
+static void yeeloong_battery_exit(void)
+{
+	if (apm_get_power_status == get_power_status)
+		apm_get_power_status = NULL;
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -120,11 +221,14 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	yeeloong_battery_init();
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
 
-- 
1.6.2.1


From wuzhangjin@gmail.com Fri Dec  4 14:35:59 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:36:02 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:33685 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492335AbZLDNf6 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:35:58 +0100
Received: by pzk35 with SMTP id 35so2349056pzk.22
        for <multiple recipients>; Fri, 04 Dec 2009 05:35:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references;
        bh=vTTWvflNT3LN5bbI+XkzpkjScQ+RZ44stQaRS0dV5j4=;
        b=DpAlSrKDPDTcYsUCMCa0CoOTe7jToHb8PlfozOp1B2yEDeuCneiVS6tM458eXwZjLY
         91HHMl2i046sl9EqSOW/5iqSRBWQBycQKicScobil2qiFVqkwlMQcdhChekmJawu4MAU
         sRif1+Uf0yF4VE5E9Hiw08Iil5Q3SNwvFH+FQ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=nQm7m421u5KPn9BM5kuEdod1lehTrKm2xp7pzaQt503ZNDNZsRogx2E3nBpGRnGiKO
         z1s3mDKOqQx61YD/OLWcH5aCq1BGHiMoyTHtGOLKfy8WjZHMBloJr0jKfatMZOV4c1fS
         Sn65IU7xSFs42HQqeujywmQz2tPTB/Hc/V0ck=
Received: by 10.114.2.12 with SMTP id 12mr4127586wab.52.1259933751798;
        Fri, 04 Dec 2009 05:35:51 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm2513694pzk.1.2009.12.04.05.35.38
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:35:51 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, linux-laptop@vger.kernel.org,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 5/8] Loongson: YeeLoong: add hardware monitoring driver
Date:   Fri,  4 Dec 2009 21:35:28 +0800
Message-Id: <102732263f647e47216c1f2cb121c30226cc995e.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25305
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds hardware monitoring driver, it provides standard
interface(/sys/class/hwmon/) for lm-sensors/sensors-applet to monitor
the temperatures of CPU and battery, the PWM of fan, the current,
voltage of battery.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |  221 +++++++++++++++++++++++++++++++
 2 files changed, 222 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 0c6b5ad..9c8385c 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -20,6 +20,7 @@ config LEMOTE_YEELOONG2F
 	select BACKLIGHT_CLASS_DEVICE
 	select SYS_SUPPORTS_APM_EMULATION
 	select APM_EMULATION
+	select HWMON
 	default m
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 729e368..644aaa7 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -14,6 +14,8 @@
 #include <linux/backlight.h>	/* for backlight subdriver */
 #include <linux/fb.h>
 #include <linux/apm-emulation.h>/* for battery subdriver */
+#include <linux/hwmon.h>	/* for hwmon subdriver */
+#include <linux/hwmon-sysfs.h>
 
 #include <ec_kb3310b.h>
 
@@ -184,6 +186,217 @@ static void yeeloong_battery_exit(void)
 		apm_get_power_status = NULL;
 }
 
+/* hwmon subdriver */
+
+/* pwm(auto/manual) enable or not */
+static int get_fan_pwm_enable(void)
+{
+	return ec_read(REG_FAN_AUTO_MAN_SWITCH);
+}
+
+static void set_fan_pwm_enable(int manual)
+{
+	ec_write(REG_FAN_AUTO_MAN_SWITCH, !!manual);
+}
+
+static int get_fan_pwm(void)
+{
+	return ec_read(REG_FAN_SPEED_LEVEL);
+}
+
+static void set_fan_pwm(int value)
+{
+	int status;
+
+	value = SENSORS_LIMIT(value, 0, 3);
+
+	/* If value is not ZERO, We should ensure it is on */
+	if (value != 0) {
+		status = ec_read(REG_FAN_STATUS);
+		if (status == 0)
+			ec_write(REG_FAN_CONTROL, BIT_FAN_CONTROL_ON);
+	}
+	ec_write(REG_FAN_SPEED_LEVEL, value);
+}
+
+static int get_fan_rpm(void)
+{
+	int value;
+
+	value = FAN_SPEED_DIVIDER /
+	    (((ec_read(REG_FAN_SPEED_HIGH) & 0x0f) << 8) |
+	     ec_read(REG_FAN_SPEED_LOW));
+
+	return value;
+}
+
+static int get_cpu_temp(void)
+{
+	int value;
+
+	value = ec_read(REG_TEMPERATURE_VALUE);
+
+	if (value & (1 << 7))
+		value = (value & 0x7f) - 128;
+	else
+		value = value & 0xff;
+
+	return value * 1000;
+}
+
+static int get_battery_temp(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_TEMPERATURE_HIGH) << 8) |
+		(ec_read(REG_BAT_TEMPERATURE_LOW));
+
+	return value * 1000;
+}
+
+static int get_battery_temp_alarm(void)
+{
+	int status;
+
+	status = (ec_read(REG_BAT_CHARGE_STATUS) &
+			BIT_BAT_CHARGE_STATUS_OVERTEMP);
+
+	return !!status;
+}
+
+static int get_battery_current(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
+		(ec_read(REG_BAT_CURRENT_LOW));
+
+	if (value & 0x8000)
+		value = 0xffff - value;
+
+	return value;
+}
+
+static int get_battery_voltage(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_VOLTAGE_HIGH) << 8) |
+		(ec_read(REG_BAT_VOLTAGE_LOW));
+
+	return value;
+}
+
+
+static int parse_arg(const char *buf, unsigned long count, int *val)
+{
+	if (!count)
+		return 0;
+	if (sscanf(buf, "%i", val) != 1)
+		return -EINVAL;
+	return count;
+}
+
+static ssize_t store_sys_hwmon(void (*set) (int), const char *buf, size_t count)
+{
+	int rv, value;
+
+	rv = parse_arg(buf, count, &value);
+	if (rv > 0)
+		set(value);
+	return rv;
+}
+
+static ssize_t show_sys_hwmon(int (*get) (void), char *buf)
+{
+	return sprintf(buf, "%d\n", get());
+}
+
+#define CREATE_SENSOR_ATTR(_name, _mode, _set, _get)		\
+	static ssize_t show_##_name(struct device *dev,			\
+				    struct device_attribute *attr,	\
+				    char *buf)				\
+	{								\
+		return show_sys_hwmon(_set, buf);			\
+	}								\
+	static ssize_t store_##_name(struct device *dev,		\
+				     struct device_attribute *attr,	\
+				     const char *buf, size_t count)	\
+	{								\
+		return store_sys_hwmon(_get, buf, count);		\
+	}								\
+	static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0);
+
+CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, get_fan_rpm, NULL);
+CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, get_fan_pwm, set_fan_pwm);
+CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, get_fan_pwm_enable,
+		set_fan_pwm_enable);
+CREATE_SENSOR_ATTR(temp1_input, S_IRUGO, get_cpu_temp, NULL);
+CREATE_SENSOR_ATTR(temp2_input, S_IRUGO, get_battery_temp, NULL);
+CREATE_SENSOR_ATTR(temp2_max_alarm, S_IRUGO, get_battery_temp_alarm, NULL);
+CREATE_SENSOR_ATTR(curr1_input, S_IRUGO, get_battery_current, NULL);
+CREATE_SENSOR_ATTR(in1_input, S_IRUGO, get_battery_voltage, NULL);
+
+static ssize_t
+show_name(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "yeeloong\n");
+}
+
+static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
+
+static struct attribute *hwmon_attributes[] = {
+	&sensor_dev_attr_pwm1.dev_attr.attr,
+	&sensor_dev_attr_pwm1_enable.dev_attr.attr,
+	&sensor_dev_attr_fan1_input.dev_attr.attr,
+	&sensor_dev_attr_temp1_input.dev_attr.attr,
+	&sensor_dev_attr_temp2_input.dev_attr.attr,
+	&sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
+	&sensor_dev_attr_curr1_input.dev_attr.attr,
+	&sensor_dev_attr_in1_input.dev_attr.attr,
+	&sensor_dev_attr_name.dev_attr.attr,
+	NULL
+};
+
+static struct attribute_group hwmon_attribute_group = {
+	.attrs = hwmon_attributes
+};
+
+static struct device *yeeloong_hwmon_dev;
+
+static int yeeloong_hwmon_init(void)
+{
+	int ret;
+
+	yeeloong_hwmon_dev = hwmon_device_register(NULL);
+	if (IS_ERR(yeeloong_hwmon_dev)) {
+		pr_err("Fail to register yeeloong hwmon device\n");
+		yeeloong_hwmon_dev = NULL;
+		return PTR_ERR(yeeloong_hwmon_dev);
+	}
+	ret = sysfs_create_group(&yeeloong_hwmon_dev->kobj,
+				 &hwmon_attribute_group);
+	if (ret) {
+		hwmon_device_unregister(yeeloong_hwmon_dev);
+		yeeloong_hwmon_dev = NULL;
+		return ret;
+	}
+	/* ensure fan is set to auto mode */
+	set_fan_pwm_enable(BIT_FAN_AUTO);
+
+	return 0;
+}
+
+static void yeeloong_hwmon_exit(void)
+{
+	if (yeeloong_hwmon_dev) {
+		sysfs_remove_group(&yeeloong_hwmon_dev->kobj,
+				   &hwmon_attribute_group);
+		hwmon_device_unregister(yeeloong_hwmon_dev);
+		yeeloong_hwmon_dev = NULL;
+	}
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -223,11 +436,19 @@ static int __init yeeloong_init(void)
 
 	yeeloong_battery_init();
 
+	ret = yeeloong_hwmon_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong hwmon driver.\n");
+		yeeloong_hwmon_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
-- 
1.6.2.1


From wuzhangjin@gmail.com Fri Dec  4 14:37:17 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:37:21 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:43206 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492335AbZLDNhR (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:37:17 +0100
Received: by pxi6 with SMTP id 6so511992pxi.0
        for <multiple recipients>; Fri, 04 Dec 2009 05:37:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references;
        bh=S4Cxq+nKFMhSEwFrAo2ZI6IbgtB4o4YUPLqRfp6bylY=;
        b=Ed+HDsg+E+DWOi+QDggS7UtPHiPCN9b0rHhuphw1rbs6dwjODzVb3639w6r7u/QqyO
         4b574YikRD+eMV4QhhiRrb9v7cMgvHyUxI25f7jc5FlRP9KcdiU0vBVRJyEsdaDMD+Ty
         L7DbRS/ovYM7900qywmGyc3YGDN91Xoc+eK4U=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=k/qjnWXZVQhBwT1gw1jDgmb+QZ+g7/diTs9q/sU56yzRq+PxNYSjRV+7Asb/ZXi2Tz
         NDVltpyNHtCCyxqtjlzid/OYhWJzSecFM7LWmEuTwPqu1Q7UqPPNuQFeCa8/c59/JoVX
         b2MOKV1YLk/FGz/9KfS7dNtQGdtSXiJ+stiMM=
Received: by 10.114.6.28 with SMTP id 28mr4051210waf.115.1259933829802;
        Fri, 04 Dec 2009 05:37:09 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm927246pxi.6.2009.12.04.05.36.59
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:37:09 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, linux-laptop@vger.kernel.org,
        luming.yu@intel.com, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 6/8] Loongson: YeeLoong: add video output driver
Date:   Fri,  4 Dec 2009 21:36:43 +0800
Message-Id: <5fd87c1f64a3c6d3e51fc6b0224cc1be3cb0d9d5.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25306
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Video Output Driver, it provides standard
interface(/sys/class/video_output) to turn on/off the video output of
LCD, CRT.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |  147 +++++++++++++++++++++++++++++++
 2 files changed, 148 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 9c8385c..4a89c01 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -21,6 +21,7 @@ config LEMOTE_YEELOONG2F
 	select SYS_SUPPORTS_APM_EMULATION
 	select APM_EMULATION
 	select HWMON
+	select VIDEO_OUTPUT_CONTROL
 	default m
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 644aaa7..8378926 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -16,6 +16,7 @@
 #include <linux/apm-emulation.h>/* for battery subdriver */
 #include <linux/hwmon.h>	/* for hwmon subdriver */
 #include <linux/hwmon-sysfs.h>
+#include <linux/video_output.h>	/* for video output subdriver */
 
 #include <ec_kb3310b.h>
 
@@ -397,6 +398,144 @@ static void yeeloong_hwmon_exit(void)
 	}
 }
 
+/* video output subdriver */
+
+static int lcd_video_output_get(struct output_device *od)
+{
+	return ec_read(REG_DISPLAY_LCD);
+}
+
+static int lcd_video_output_set(struct output_device *od)
+{
+	int value;
+	unsigned long status;
+
+	status = !!od->request_state;
+
+	if (status == BIT_DISPLAY_LCD_ON) {
+		/* Turn on LCD */
+		outb(0x31, 0x3c4);
+		value = inb(0x3c5);
+		value = (value & 0xf8) | 0x03;
+		outb(0x31, 0x3c4);
+		outb(value, 0x3c5);
+		/* Turn on backlight */
+		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_ON);
+	} else {
+		/* Turn off backlight */
+		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_OFF);
+		/* Turn off LCD */
+		outb(0x31, 0x3c4);
+		value = inb(0x3c5);
+		value = (value & 0xf8) | 0x02;
+		outb(0x31, 0x3c4);
+		outb(value, 0x3c5);
+	}
+
+	return 0;
+}
+
+static struct output_properties lcd_output_properties = {
+	.set_state = lcd_video_output_set,
+	.get_status = lcd_video_output_get,
+};
+
+static int crt_video_output_get(struct output_device *od)
+{
+	return ec_read(REG_CRT_DETECT);
+}
+
+static int crt_video_output_set(struct output_device *od)
+{
+	int value;
+	unsigned long status;
+
+	status = !!od->request_state;
+
+	if (status == BIT_CRT_DETECT_PLUG) {
+		if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG) {
+			/* Turn on CRT */
+			outb(0x21, 0x3c4);
+			value = inb(0x3c5);
+			value &= ~(1 << 7);
+			outb(0x21, 0x3c4);
+			outb(value, 0x3c5);
+		}
+	} else {
+		/* Turn off CRT */
+		outb(0x21, 0x3c4);
+		value = inb(0x3c5);
+		value |= (1 << 7);
+		outb(0x21, 0x3c4);
+		outb(value, 0x3c5);
+	}
+
+	return 0;
+}
+
+static struct output_properties crt_output_properties = {
+	.set_state = crt_video_output_set,
+	.get_status = crt_video_output_get,
+};
+
+static struct output_device *lcd_output_dev, *crt_output_dev;
+
+static void yeeloong_lcd_vo_set(int status)
+{
+	lcd_output_dev->request_state = status;
+	lcd_video_output_set(lcd_output_dev);
+}
+
+static void yeeloong_crt_vo_set(int status)
+{
+	crt_output_dev->request_state = status;
+	crt_video_output_set(crt_output_dev);
+}
+
+static int yeeloong_vo_init(void)
+{
+	int ret;
+
+	/* Register video output device: lcd, crt */
+	lcd_output_dev = video_output_register("LCD", NULL, NULL,
+			&lcd_output_properties);
+
+	if (IS_ERR(lcd_output_dev)) {
+		ret = PTR_ERR(lcd_output_dev);
+		lcd_output_dev = NULL;
+		return ret;
+	}
+	/* Ensure LCD is on by default */
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+
+	crt_output_dev = video_output_register("CRT", NULL, NULL,
+			&crt_output_properties);
+
+	if (IS_ERR(crt_output_dev)) {
+		ret = PTR_ERR(crt_output_dev);
+		crt_output_dev = NULL;
+		return ret;
+	}
+
+	/* Turn off CRT by default, and will be enabled when the CRT
+	 * connectting event reported by SCI */
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+
+	return 0;
+}
+
+static void yeeloong_vo_exit(void)
+{
+	if (lcd_output_dev) {
+		video_output_unregister(lcd_output_dev);
+		lcd_output_dev = NULL;
+	}
+	if (crt_output_dev) {
+		video_output_unregister(crt_output_dev);
+		crt_output_dev = NULL;
+	}
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -443,11 +582,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_vo_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong video output driver.\n");
+		yeeloong_vo_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_vo_exit();
 	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
-- 
1.6.2.1


From wuzhangjin@gmail.com Fri Dec  4 14:38:19 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:38:23 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:46548 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492335AbZLDNiT (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:38:19 +0100
Received: by pxi6 with SMTP id 6so513170pxi.0
        for <multiple recipients>; Fri, 04 Dec 2009 05:38:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references;
        bh=aF16QHvsve/DyHG97+B8dhtjD7zlc2OteiLXq3gf4W0=;
        b=pvNP3qCNr/ht7/Yxd+TIv30uwgjAZlbt83JxdyKYIc5GEOoRHtuv8GejXMpXcXZfB2
         9o9q4VGPIZhwcX6rHhp6+kwyxWK9nHyRI0vEkt453pkJvbbIi1q0mVNafNzoXTFY6/ha
         VdKxgEcdCqakismcl1ThZmnQdrXPARgVrrLJM=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=uFZ8kfyFD7QiZix/GF6joKSdjGTw3CU23ulOo+rMrIH2Donl5tTzVu4ItVklvdf+ZP
         KRbLFPItUk/XaUs2SH9krX7MlDIV9rMZSZ2Tc9psTRH9FAWli8LAcwdBZK+b99lTg/3w
         WOT7yLagz9ud8BmGIt+u8alzLWkNAYQyd7EBs=
Received: by 10.115.87.33 with SMTP id p33mr4127047wal.101.1259933892502;
        Fri, 04 Dec 2009 05:38:12 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm2512895pzk.3.2009.12.04.05.38.01
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:38:11 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, linux-laptop@vger.kernel.org,
        Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 7/8] Loongson: YeeLoong: add suspend support
Date:   Fri,  4 Dec 2009 21:37:41 +0800
Message-Id: <1811181c553c2c8e7e841540e57444e54c33d65f.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25307
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch add support to suspend the yeeloong platform specific
devices(LCD, CRT, USB...).

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/yeeloong_laptop.c |   41 +++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 8378926..d31824b 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -536,6 +536,45 @@ static void yeeloong_vo_exit(void)
 	}
 }
 
+#ifdef CONFIG_LOONGSON_SUSPEND
+static void usb_ports_set(int status)
+{
+	status = !!status;
+
+	ec_write(REG_USB0_FLAG, status);
+	ec_write(REG_USB1_FLAG, status);
+	ec_write(REG_USB2_FLAG, status);
+}
+
+static int yeeloong_suspend(struct platform_device *dev, pm_message_t state)
+
+{
+	/* Turn off LCD */
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	/* Turn off CRT */
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	/* Poweroff three usb ports */
+	usb_ports_set(BIT_USB_FLAG_OFF);
+
+	return 0;
+}
+
+static int yeeloong_resume(struct platform_device *pdev)
+{
+	/* Resume the status of lcd & crt */
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+
+	/* Poweron three usb ports */
+	usb_ports_set(BIT_USB_FLAG_ON);
+
+	return 0;
+}
+#else	/* !CONFIG_LOONGSON_SUSPEND */
+#define yeeloong_suspend NULL
+#define yeeloong_resume NULL
+#endif
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -551,6 +590,8 @@ static struct platform_driver platform_driver = {
 		   .owner = THIS_MODULE,
 		   },
 	.id_table = platform_device_ids,
+	.suspend = yeeloong_suspend,
+	.resume = yeeloong_resume,
 };
 
 static int __init yeeloong_init(void)
-- 
1.6.2.1


From wuzhangjin@gmail.com Fri Dec  4 14:39:35 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:39:39 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:34537 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493005AbZLDNjf (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:39:35 +0100
Received: by pxi6 with SMTP id 6so514566pxi.0
        for <multiple recipients>; Fri, 04 Dec 2009 05:39:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references;
        bh=r5eobMuwvHVxXeP7FcmA0HIhYWcbCxuXhjSkyfqJnQ4=;
        b=sxBzMGHSpmB+AVzutu6PVFh4mfKrnsfKzvC1B7+6UW31lrQrqPynn5h7kNMNh332W9
         rvkfUE8erZzI3sXprsBVz2IAEKgo3+W7qHePmzx0SZgnGulN8JWmi0TdEfyAPZp8akeR
         /jdDp9k4U4PxQas+LmKJAtH977sgCsp0iNFqQ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=lP44e0o+yW3n0JNzNy7x3VPTS8ScGYZ+Fd0q4sH0ZjTxjavUS0enmwTBKiY9rwg2uA
         erx+fkO5aFmFQBbHfJupQpKq6Q00ywUDhRrXjtf53S+kKnD68I+kd9FwRekri1rTMQ1v
         /zCqGICbL9b6BiYE++ul0LeAbpgLrlNskdPT0=
Received: by 10.114.188.1 with SMTP id l1mr4077924waf.193.1259933967715;
        Fri, 04 Dec 2009 05:39:27 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm21644pxi.5.2009.12.04.05.39.20
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:39:25 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc:     Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, linux-laptop@vger.kernel.org,
        linux-input@vger.kernel.org, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH v7 8/8] Loongson: YeeLoong: add input/hotkey driver
Date:   Fri,  4 Dec 2009 21:39:04 +0800
Message-Id: <7e96d37889c49c2d6d284e21773aef90dd3aac25.1259932036.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25308
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Hotkey Driver, which will do relative actions for The
hotkey event(/sys/class/input) and report the corresponding input keys
to the user-space applications.

Changes from the old revision:
	- Rebase on the sparse keymap library from Dmitry Torokhov.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/mach-loongson/loongson.h |    6 +
 arch/mips/loongson/common/cmdline.c            |    8 +
 drivers/platform/mips/Kconfig                  |    1 +
 drivers/platform/mips/yeeloong_laptop.c        |  415 ++++++++++++++++++++++++
 4 files changed, 430 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h
index ee8bc83..13e208e 100644
--- a/arch/mips/include/asm/mach-loongson/loongson.h
+++ b/arch/mips/include/asm/mach-loongson/loongson.h
@@ -43,6 +43,12 @@ static inline void prom_init_uart_base(void)
 #endif
 }
 
+/*
+ * Copy kernel command line from arcs_cmdline
+ */
+#include <asm/setup.h>
+extern char loongson_cmdline[COMMAND_LINE_SIZE];
+
 /* irq operation functions */
 extern void bonito_irqdispatch(void);
 extern void __init bonito_irq_init(void);
diff --git a/arch/mips/loongson/common/cmdline.c b/arch/mips/loongson/common/cmdline.c
index 7ad47f2..617faee 100644
--- a/arch/mips/loongson/common/cmdline.c
+++ b/arch/mips/loongson/common/cmdline.c
@@ -17,6 +17,7 @@
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */
+#include <linux/module.h>
 #include <asm/bootinfo.h>
 
 #include <loongson.h>
@@ -25,6 +26,10 @@ int prom_argc;
 /* pmon passes arguments in 32bit pointers */
 int *_prom_argv;
 
+/* the kernel command line copied from arcs_cmdline */
+char loongson_cmdline[COMMAND_LINE_SIZE];
+EXPORT_SYMBOL(loongson_cmdline);
+
 void __init prom_init_cmdline(void)
 {
 	int i;
@@ -51,4 +56,7 @@ void __init prom_init_cmdline(void)
 		strcat(arcs_cmdline, " root=/dev/hda1");
 
 	prom_init_machtype();
+
+	/* copy arcs_cmdline into loongson_cmdline */
+	strncpy(loongson_cmdline, arcs_cmdline, COMMAND_LINE_SIZE);
 }
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 4a89c01..7c81c4c 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -22,6 +22,7 @@ config LEMOTE_YEELOONG2F
 	select APM_EMULATION
 	select HWMON
 	select VIDEO_OUTPUT_CONTROL
+	select INPUT_SPARSEKMAP
 	default m
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index d31824b..d8cd94b 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -17,7 +17,14 @@
 #include <linux/hwmon.h>	/* for hwmon subdriver */
 #include <linux/hwmon-sysfs.h>
 #include <linux/video_output.h>	/* for video output subdriver */
+#include <linux/input.h>	/* for hotkey subdriver */
+#include <linux/input/sparse-keymap.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
 
+#include <cs5536/cs5536.h>
+
+#include <loongson.h>		/* for loongson_cmdline */
 #include <ec_kb3310b.h>
 
 /* backlight subdriver */
@@ -536,6 +543,406 @@ static void yeeloong_vo_exit(void)
 	}
 }
 
+/* hotkey subdriver */
+
+static struct input_dev *yeeloong_hotkey_dev;
+
+static const struct key_entry yeeloong_keymap[] = {
+	{KE_SW, EVENT_LID, { SW_LID } },
+	{KE_KEY, EVENT_CAMERA, { KEY_CAMERA } }, /* Fn + ESC */
+	{KE_KEY, EVENT_SLEEP, { KEY_SLEEP } }, /* Fn + F1 */
+	{KE_KEY, EVENT_DISPLAY_TOGGLE, { KEY_SWITCHVIDEOMODE } }, /* Fn + F3 */
+	{KE_KEY, EVENT_AUDIO_MUTE, { KEY_MUTE } }, /* Fn + F4 */
+	{KE_KEY, EVENT_WLAN, { KEY_WLAN } }, /* Fn + F5 */
+	{KE_KEY, EVENT_DISPLAY_BRIGHTNESS, { KEY_BRIGHTNESSUP } }, /* Fn + up */
+	{KE_KEY, EVENT_DISPLAY_BRIGHTNESS, { KEY_BRIGHTNESSDOWN } }, /* Fn + down */
+	{KE_KEY, EVENT_AUDIO_VOLUME, { KEY_VOLUMEUP } }, /* Fn + right */
+	{KE_KEY, EVENT_AUDIO_VOLUME, { KEY_VOLUMEDOWN } }, /* Fn + left */
+	{KE_END, 0}
+};
+
+static struct key_entry *get_event_key_entry(int event, int status)
+{
+	struct key_entry *ke;
+	static int old_brightness_status = -1;
+	static int old_volume_status = -1;
+
+	ke = sparse_keymap_entry_from_scancode(yeeloong_hotkey_dev, event);
+	if (!ke)
+		return NULL;
+
+	switch (event) {
+	case EVENT_DISPLAY_BRIGHTNESS:
+		/* current status > old one, means up */
+		if ((status < old_brightness_status) || (0 == status))
+			ke++;
+		old_brightness_status = status;
+		break;
+	case EVENT_AUDIO_VOLUME:
+		if ((status < old_volume_status) || (0 == status))
+			ke++;
+		old_volume_status = status;
+		break;
+	default:
+		break;
+	}
+
+	return ke;
+}
+
+static int report_lid_switch(int status)
+{
+	input_report_switch(yeeloong_hotkey_dev, SW_LID, !status);
+	input_sync(yeeloong_hotkey_dev);
+
+	return status;
+}
+
+static int crt_detect_handler(int status)
+{
+	if (status == BIT_CRT_DETECT_PLUG) {
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	} else {
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	}
+	return status;
+}
+
+#define EC_VER_LEN 64
+
+static int black_screen_handler(int status)
+{
+	char *p, ec_ver[EC_VER_LEN];
+
+	p = strstr(loongson_cmdline, "EC_VER=");
+	if (!p)
+		memset(ec_ver, 0, EC_VER_LEN);
+	else {
+		strncpy(ec_ver, p, EC_VER_LEN);
+		p = strstr(ec_ver, " ");
+		if (p)
+			*p = '\0';
+	}
+
+	/* Seems EC(>=PQ1D26) does this job for us, we can not do it again,
+	 * otherwise, the brightness will not resume to the normal level! */
+	if (strncasecmp(ec_ver, "EC_VER=PQ1D26", 64) < 0)
+		yeeloong_lcd_vo_set(status);
+
+	return status;
+}
+
+static int display_toggle_handler(int status)
+{
+	static int video_output_status;
+
+	/* Only enable switch video output button
+	 * when CRT is connected */
+	if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_UNPLUG)
+		return 0;
+	/* 0. no CRT connected: LCD on, CRT off
+	 * 1. BOTH on
+	 * 2. LCD off, CRT on
+	 * 3. BOTH off
+	 * 4. LCD on, CRT off
+	 */
+	video_output_status++;
+	if (video_output_status > 4)
+		video_output_status = 1;
+
+	switch (video_output_status) {
+	case 1:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		break;
+	case 2:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		break;
+	case 3:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+		break;
+	case 4:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+		break;
+	default:
+		/* Ensure LCD is on */
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		break;
+	}
+	return video_output_status;
+}
+
+static int camera_handler(int status)
+{
+	int value;
+
+	value = ec_read(REG_CAMERA_CONTROL);
+	ec_write(REG_CAMERA_CONTROL, value | (1 << 1));
+
+	return status;
+}
+
+static int usb2_handler(int status)
+{
+	pr_emerg("USB2 Over Current occurred\n");
+
+	return status;
+}
+
+static int usb0_handler(int status)
+{
+	pr_emerg("USB0 Over Current occurred\n");
+
+	return status;
+}
+
+/* yeeloong_wifi_handler may be implemented in the wifi driver */
+sci_handler yeeloong_wifi_handler;
+EXPORT_SYMBOL(yeeloong_wifi_handler);
+
+#define NO_REG		0
+#define NO_HANDLER	NULL
+/* 2 maybe used to indicate the key as a switch button, such as EVENT_WLAN */
+#define NO_STATUS	2
+
+static void do_event_action(int event)
+{
+	sci_handler handler;
+	int reg, status;
+	struct key_entry *ke;
+
+	reg = NO_REG;
+	handler = NO_HANDLER;
+	status = NO_STATUS;
+
+	switch (event) {
+	case EVENT_LID:
+		reg = REG_LID_DETECT;
+		break;
+	case EVENT_DISPLAY_TOGGLE:
+		handler = display_toggle_handler;
+		break;
+	case EVENT_CRT_DETECT:
+		reg = REG_CRT_DETECT;
+		handler = crt_detect_handler;
+		break;
+	case EVENT_CAMERA:
+		reg = REG_CAMERA_STATUS;
+		handler = camera_handler;
+		break;
+	case EVENT_USB_OC2:
+		reg = REG_USB2_FLAG;
+		handler = usb2_handler;
+		break;
+	case EVENT_USB_OC0:
+		reg = REG_USB0_FLAG;
+		handler = usb0_handler;
+		break;
+	case EVENT_BLACK_SCREEN:
+		reg = REG_DISPLAY_LCD;
+		handler = black_screen_handler;
+		break;
+	case EVENT_AUDIO_MUTE:
+		reg = REG_AUDIO_MUTE;
+		break;
+	case EVENT_DISPLAY_BRIGHTNESS:
+		reg = REG_DISPLAY_BRIGHTNESS;
+		break;
+	case EVENT_AUDIO_VOLUME:
+		reg = REG_AUDIO_VOLUME;
+		break;
+	case EVENT_WLAN:
+		handler = yeeloong_wifi_handler;
+		break;
+	default:
+		break;
+	}
+
+	if (reg != NO_REG)
+		status = ec_read(reg);
+
+	if (handler != NO_HANDLER)
+		status = handler(status);
+
+	pr_info("%s: event: %d status: %d\n", __func__, event, status);
+
+	/* Report current key to user-space */
+	ke = get_event_key_entry(event, status);
+	if (ke) {
+		if (ke->keycode == SW_LID)
+			report_lid_switch(status);
+		else
+			sparse_keymap_report_entry(yeeloong_hotkey_dev, ke, 1,
+					true);
+	}
+}
+
+/*
+ * SCI(system control interrupt) main interrupt routine
+ *
+ * We will do the query and get event number together so the interrupt routine
+ * should be longer than 120us now at least 3ms elpase for it.
+ */
+static irqreturn_t sci_irq_handler(int irq, void *dev_id)
+{
+	int ret, event;
+
+	if (SCI_IRQ_NUM != irq)
+		return IRQ_NONE;
+
+	/* Query the event number */
+	ret = ec_query_event_num();
+	if (ret < 0)
+		return IRQ_NONE;
+
+	event = ec_get_event_num();
+	if (event < EVENT_START || event > EVENT_END)
+		return IRQ_NONE;
+
+	/* Execute corresponding actions */
+	do_event_action(event);
+
+	return IRQ_HANDLED;
+}
+
+/*
+ * Config and init some msr and gpio register properly.
+ */
+static int sci_irq_init(void)
+{
+	u32 hi, lo;
+	u32 gpio_base;
+	unsigned long flags;
+	int ret;
+
+	/* Get gpio base */
+	_rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_GPIO), &hi, &lo);
+	gpio_base = lo & 0xff00;
+
+	/* Filter the former kb3310 interrupt for security */
+	ret = ec_query_event_num();
+	if (ret)
+		return ret;
+
+	/* For filtering next number interrupt */
+	udelay(10000);
+
+	/* Set gpio native registers and msrs for GPIO27 SCI EVENT PIN
+	 * gpio :
+	 *      input, pull-up, no-invert, event-count and value 0,
+	 *      no-filter, no edge mode
+	 *      gpio27 map to Virtual gpio0
+	 * msr :
+	 *      no primary and lpc
+	 *      Unrestricted Z input to IG10 from Virtual gpio 0.
+	 */
+	local_irq_save(flags);
+	_rdmsr(0x80000024, &hi, &lo);
+	lo &= ~(1 << 10);
+	_wrmsr(0x80000024, hi, lo);
+	_rdmsr(0x80000025, &hi, &lo);
+	lo &= ~(1 << 10);
+	_wrmsr(0x80000025, hi, lo);
+	_rdmsr(0x80000023, &hi, &lo);
+	lo |= (0x0a << 0);
+	_wrmsr(0x80000023, hi, lo);
+	local_irq_restore(flags);
+
+	/* Set gpio27 as sci interrupt
+	 *
+	 * input, pull-up, no-fliter, no-negedge, invert
+	 * the sci event is just about 120us
+	 */
+	asm(".set noreorder\n");
+	/*  input enable */
+	outl(0x00000800, (gpio_base | 0xA0));
+	/*  revert the input */
+	outl(0x00000800, (gpio_base | 0xA4));
+	/*  event-int enable */
+	outl(0x00000800, (gpio_base | 0xB8));
+	asm(".set reorder\n");
+
+	return 0;
+}
+
+static struct irqaction sci_irqaction = {
+	.handler = sci_irq_handler,
+	.name = "sci",
+	.flags = IRQF_SHARED,
+};
+
+static int yeeloong_hotkey_init(void)
+{
+	int ret;
+
+	ret = sci_irq_init();
+	if (ret)
+		return -EFAULT;
+
+	ret = setup_irq(SCI_IRQ_NUM, &sci_irqaction);
+	if (ret)
+		return -EFAULT;
+
+	yeeloong_hotkey_dev = input_allocate_device();
+
+	if (!yeeloong_hotkey_dev) {
+		remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+		return -ENOMEM;
+	}
+
+	yeeloong_hotkey_dev->name = "HotKeys";
+	yeeloong_hotkey_dev->phys = "button/input0";
+	yeeloong_hotkey_dev->id.bustype = BUS_HOST;
+	yeeloong_hotkey_dev->dev.parent = NULL;
+
+	ret = sparse_keymap_setup(yeeloong_hotkey_dev, yeeloong_keymap, NULL);
+	if (ret) {
+		pr_err("Fail to setup input device keymap\n");
+		input_free_device(yeeloong_hotkey_dev);
+		return ret;
+	}
+
+	ret = input_register_device(yeeloong_hotkey_dev);
+	if (ret) {
+		sparse_keymap_free(yeeloong_hotkey_dev);
+		input_free_device(yeeloong_hotkey_dev);
+		return ret;
+	}
+
+	/* Update the current status of LID */
+	report_lid_switch(BIT_LID_DETECT_ON);
+
+#ifdef CONFIG_LOONGSON_SUSPEND
+	/* Install the real yeeloong_report_lid_status for pm.c */
+	yeeloong_report_lid_status = report_lid_switch;
+#endif
+
+	return 0;
+}
+
+static void yeeloong_hotkey_exit(void)
+{
+	/* Free irq */
+	remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+
+#ifdef CONFIG_LOONGSON_SUSPEND
+	/* Uninstall yeeloong_report_lid_status for pm.c */
+	if (yeeloong_report_lid_status == report_lid_switch)
+		yeeloong_report_lid_status = NULL;
+#endif
+
+	if (yeeloong_hotkey_dev) {
+		sparse_keymap_free(yeeloong_hotkey_dev);
+		input_unregister_device(yeeloong_hotkey_dev);
+		yeeloong_hotkey_dev = NULL;
+	}
+}
+
 #ifdef CONFIG_LOONGSON_SUSPEND
 static void usb_ports_set(int status)
 {
@@ -630,11 +1037,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_hotkey_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong hotkey driver.\n");
+		yeeloong_hotkey_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_hotkey_exit();
 	yeeloong_vo_exit();
 	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
-- 
1.6.2.1


From figo1802@gmail.com Fri Dec  4 14:42:51 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 14:42:55 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:36700 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492335AbZLDNmv (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 14:42:51 +0100
Received: by pwi18 with SMTP id 18so1061535pwi.24
        for <multiple recipients>; Fri, 04 Dec 2009 05:42:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:to:cc
         :content-type:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        bh=/yZGfbXHp+yR+SloRTBHYK8tM1LOKZlpYl4X/L4X3Tw=;
        b=EKOykCQXOs1oHHKeUW+QLL6sounVk0IbpLfN75vtEF/amxlY7U0mOHsubHYmTpKPgn
         0N8SuOFqslitPjbx4nnq9oYnpSAO2o19DgZExH59346M/WNbGHwe+L7oRgFpSAquwkcc
         cr846o+BtBJjymU+8sH2QM9qt2wg71R4nWTxs=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:to:cc:content-type:date:message-id:mime-version
         :x-mailer:content-transfer-encoding;
        b=cgIfse2D2UiiYJzlUwovAAqw8RFU3UrJA9E/+ONXwcFM7yRJispriTpZaGlFRH/CPo
         gOIS1C6X+jzafkSBmA381F3Uy3JyZ4RGy1hy4xoUFMtj40bDPiEo/Qlh56JITAcQI3Gf
         v3w9+LgFH5C2VOKVXxMTG48RDuPV0ayN+GZxw=
Received: by 10.114.187.20 with SMTP id k20mr3971344waf.213.1259934164446;
        Fri, 04 Dec 2009 05:42:44 -0800 (PST)
Received: from ?192.168.1.100? ([118.132.131.118])
        by mx.google.com with ESMTPS id 22sm954020pxi.10.2009.12.04.05.42.40
        (version=SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 05:42:43 -0800 (PST)
Subject: is it some issue about HIGHMEM for mips32?
From:   "Figo.zhang" <figo1802@gmail.com>
To:     linux-mips@linux-mips.org
Cc:     linux-mips@linux-mips.org
Content-Type: text/plain; charset="UTF-8"
Date:   Fri, 04 Dec 2009 21:44:59 +0800
Message-ID: <1259934299.2070.3.camel@myhost>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <figo1802@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25309
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: figo1802@gmail.com
Precedence: bulk
X-list: linux-mips



hi,
i am using 24KC soc, and linux2.6.21.5 kernel and set CONFIG_HIGHMEM
enable. if my realy physic RAM is not more than HIGHMEM, such as only
32MB, it is some issue about kernel, i dont know how to fix it? I try
linux-2.6.31.4, it is no this issue, is it some change , how to fix it?
 
here is my kernel log:
Linux version 2.6.21.5 (figo@myhost) (gcc version 4.1.2) #22 Fri Dec 4
10:33:25 CST 2009
CPU revision is: 00019655
Determined physical RAM map:
memory: start:0x0,size=0x2000000,type=0x1
(usable)
User-defined physical RAM map:
memory: start:0x0,size=0x2000000,type=0x1
(usable)
Initrd not found or empty - disabling initrd
Built 1 zonelists.  Total pages: 8128
Kernel command line: console=ttyS0,115200 rdinit=/linuxrc mem=32M nofpu
mac=00:aa:aa:bb:bb:99
Updated MAC address from u-boot: 8024ff24M
Primary instruction cache 32kB, physically tagged, 4-way, linesize 32
bytes.
Primary data cache 32kB, 4-way, linesize 32 bytes.
Synthesized TLB refill handler (20 instructions).
Synthesized TLB load handler fastpath (32 instructions).
Synthesized TLB store handler fastpath (32 instructions).
Synthesized TLB modify handler fastpath (31 instructions).
Cache parity protection disabled
arch/mips/mach-opulan/optrann/irq.c,arch_init_irq
PID hash table entries: 128 (order: 7, 512 bytes)
Using 150.000 MHz high precision timer.
arch/mips/mach-opulan/optrann/time.c,plat_timer_setup
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 29012k/32768k available (1798k kernel code, 3756k reserved, 369k
data, 900k init, 0k highmem)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Generic PHY: Registered new driver
Time: MIPS clocksource has been installed.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: optrann serial driver $Revision: 1.0
uart_register_driver finished
ttyS0 at MMIO map 0xbf004000 mem 0xbf004000 (irq = 23) is a UART 0
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
nbd: registered device at major 43
optrann_fe_ether Ethernet driver, V1.00
FE:dmac_regs =0xbf014000,msg_regs=0xbf028000, irq=26
FE MAC: 00:aa:aa:bb:bb:99
TCP cubic registered
Freeing unused kernel memory: 900k freed
ramdisk_execute_command=/linuxrc, execute_command=<NULL>
Bad pte = 0135c79f, process = linuxrc, vm_flags = 100073, vaddr =
2aaae000
Call Trace:
[<80048d70>] dump_stack+0x8/0x34
[<8009ebb0>] vm_normal_page+0x68/0x90
[<8009f850>] unmap_vmas+0x1e8/0x5e8
[<800a3428>] unmap_region+0x9c/0x184
[<800a4268>] do_munmap+0x1b0/0x25c
[<800a4358>] sys_munmap+0x44/0x70
[<8004af40>] stack_done+0x20/0x3c
Bad pte = 0135e79f, process = linuxrc, vm_flags = 100073, vaddr =
2aaae000
Call Trace:
[<80048d70>] dump_stack+0x8/0x34
[<8009ebb0>] vm_normal_page+0x68/0x90
[<8009f850>] unmap_vmas+0x1e8/0x5e8
[<800a3428>] unmap_region+0x9c/0x184
[<800a4268>] do_munmap+0x1b0/0x25c
[<800a4358>] sys_munmap+0x44/0x70
[<8004af40>] stack_done+0x20/0x3c
Bad pte = 0026079f, process = linuxrc, vm_flags = 100073, vaddr =
2aaae000
Call Trace:
[<80048d70>] dump_stack+0x8/0x34
[<8009ebb0>] vm_normal_page+0x68/0x90
[<8009f850>] unmap_vmas+0x1e8/0x5e8
[<800a3428>] unmap_region+0x9c/0x184
[<800a4268>] do_munmap+0x1b0/0x25c
[<800a4358>] sys_munmap+0x44/0x70
[<8004af40>] stack_done+0x20/0x3c
 
.........
 
 
Best,
Figo.zhang




From f.fainelli@gmail.com Fri Dec  4 15:01:39 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 15:01:42 +0100 (CET)
Received: from mail-ew0-f224.google.com ([209.85.219.224]:50536 "EHLO
        mail-ew0-f224.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492977AbZLDOBj (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 15:01:39 +0100
Received: by ewy24 with SMTP id 24so2807717ewy.26
        for <linux-mips@linux-mips.org>; Fri, 04 Dec 2009 06:01:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:from:to:subject:date
         :user-agent:cc:references:in-reply-to:organization:mime-version
         :content-type:content-transfer-encoding:message-id;
        bh=3x5XUb50hKPduza7puEywm1+jxuUzILSxAkD47KWqe4=;
        b=p3nqNpIj2xGx4HAOaMwnPh1TfOSBU+jktaLWKqg5qPP4hlfqDX2t8GhvOBuhI876T6
         DHA9HVXaPzTZuu2MYCOWFgMZzw6CO1ywmmegVJH1qcfx88frPF48V16/gtdmPi/V+eNz
         hJHGnyJ/vswKyrWuZBcMB8FQKh6a3xKPkKU/A=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:from:to:subject:date:user-agent:cc:references:in-reply-to
         :organization:mime-version:content-type:content-transfer-encoding
         :message-id;
        b=GQ3ck+raEDnokwvfXSQZ4VYwzXNSn/02G+9n4T3SP4HukFvW6lKqr24Ogbrh9/uXhT
         g91CAl8gnXWMrNksCRouYtt4l270rivvdh/0iMkIPV1r7MXFkolCbmjFvdSbbdO+cWtU
         NUp/PqnMITPBD2Fpo+QC20bNtRdqMO6gzHpfw=
Received: by 10.213.0.139 with SMTP id 11mr10703663ebb.36.1259935293479;
        Fri, 04 Dec 2009 06:01:33 -0800 (PST)
Received: from flexo.localnet (bobafett.staff.proxad.net [213.228.1.121])
        by mx.google.com with ESMTPS id 16sm1897182ewy.2.2009.12.04.06.01.31
        (version=SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 06:01:31 -0800 (PST)
From:   Florian Fainelli <florian@openwrt.org>
To:     Richard Purdie <rpurdie@rpsys.net>
Subject: Re: [PATCH] leds: use default-on trigger for Cobalt Qube
Date:   Fri, 4 Dec 2009 15:01:37 +0100
User-Agent: KMail/1.12.2 (Linux/2.6.31-15-server; KDE/4.3.2; x86_64; ; )
Cc:     linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
        Martin Michlmayr <tbm@cyrius.com>,
        Sameer Verma <sverma@sfsu.edu>
References: <200911261941.02431.florian@openwrt.org>
In-Reply-To: <200911261941.02431.florian@openwrt.org>
Organization: OpenWrt
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <200912041501.37415.florian@openwrt.org>
Return-Path: <f.fainelli@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25310
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: florian@openwrt.org
Precedence: bulk
X-list: linux-mips

Richard,

Did you get this patch? Thanks.

On Thursday 26 November 2009 19:41:02 Regards, Florian Fainelli wrote:
> This patch changes the default trigger from "ide-disk"
> to "default-on". Users updating from kernels not having this
> LED driver will prefer having the same LED behavior as they
> used to.
> 
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> diff --git a/drivers/leds/leds-cobalt-qube.c
>  b/drivers/leds/leds-cobalt-qube.c index 8816806..81b2014 100644
> --- a/drivers/leds/leds-cobalt-qube.c
> +++ b/drivers/leds/leds-cobalt-qube.c
> @@ -31,7 +31,7 @@ static struct led_classdev qube_front_led = {
>  	.name			= "qube::front",
>  	.brightness		= LED_FULL,
>  	.brightness_set		= qube_front_led_set,
> -	.default_trigger	= "ide-disk",
> +	.default_trigger	= "default-on",
>  };
> 
>  static int __devinit cobalt_qube_led_probe(struct platform_device *pdev)
> 

-- 
Regards, Florian

From pavel@ucw.cz Fri Dec  4 15:40:47 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 15:40:50 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:58682 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492956AbZLDOkr (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 15:40:47 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id CDCD4F0497; Fri,  4 Dec 2009 15:40:43 +0100 (CET)
Date:   Fri, 4 Dec 2009 09:04:08 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J. Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        linux-laptop@vger.kernel.org
Subject: Re: [PATCH v7 4/8] Loongson: YeeLoong: add battery driver
Message-ID: <20091204080408.GA1540@ucw.cz>
References: <cover.1259932036.git.wuzhangjin@gmail.com> <059fa216d70771a6341edb2db4cc559e958273e9.1259932036.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <059fa216d70771a6341edb2db4cc559e958273e9.1259932036.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25311
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

On Fri 2009-12-04 21:34:17, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds APM emulated Battery Driver, it provides standard
> interface(/proc/apm) for user-space applications(e.g. kpowersave,
> gnome-power-manager) to manage the battery.

It would be nicer if this went to drivers/power, and used its
interface -- providing not only percentage but also other values.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From pavel@ucw.cz Fri Dec  4 15:44:50 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 15:44:54 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:43004 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493005AbZLDOou (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 15:44:50 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id 8A94EF04E2; Fri,  4 Dec 2009 15:44:49 +0100 (CET)
Date:   Fri, 4 Dec 2009 09:08:13 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J. Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org
Subject: Re: [PATCH v7 5/8] Loongson: YeeLoong: add hardware monitoring
        driver
Message-ID: <20091204080813.GB1540@ucw.cz>
References: <cover.1259932036.git.wuzhangjin@gmail.com> <102732263f647e47216c1f2cb121c30226cc995e.1259932036.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <102732263f647e47216c1f2cb121c30226cc995e.1259932036.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25312
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

Hi!

> +static int get_cpu_temp(void)
> +{
> +	int value;
> +
> +	value = ec_read(REG_TEMPERATURE_VALUE);
> +
> +	if (value & (1 << 7))
> +		value = (value & 0x7f) - 128;
> +	else
> +		value = value & 0xff;

wtf?

Maybe value should be 's8'?

> +static int get_battery_current(void)
> +{
> +	int value;
> +
> +	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> +		(ec_read(REG_BAT_CURRENT_LOW));
> +
> +	if (value & 0x8000)
> +		value = 0xffff - value;

Another version of  pair-complement conversion; this one is broken --
off by 1.

> +static int parse_arg(const char *buf, unsigned long count, int *val)
> +{
> +	if (!count)
> +		return 0;
> +	if (sscanf(buf, "%i", val) != 1)
> +		return -EINVAL;
> +	return count;
> +}

We have strict_strtoul for a reason...

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From pavel@ucw.cz Fri Dec  4 15:48:02 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 15:48:08 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:43136 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493126AbZLDOsC (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 15:48:02 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id 7C59DF0463; Fri,  4 Dec 2009 15:48:01 +0100 (CET)
Date:   Fri, 4 Dec 2009 09:11:25 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J. Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org, luming.yu@intel.com
Subject: Re: [PATCH v7 6/8] Loongson: YeeLoong: add video output driver
Message-ID: <20091204081124.GC1540@ucw.cz>
References: <cover.1259932036.git.wuzhangjin@gmail.com> <5fd87c1f64a3c6d3e51fc6b0224cc1be3cb0d9d5.1259932036.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <5fd87c1f64a3c6d3e51fc6b0224cc1be3cb0d9d5.1259932036.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25313
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

On Fri 2009-12-04 21:36:43, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds Video Output Driver, it provides standard
> interface(/sys/class/video_output) to turn on/off the video output of
> LCD, CRT.
> 

> diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
> index 9c8385c..4a89c01 100644
> --- a/drivers/platform/mips/Kconfig
> +++ b/drivers/platform/mips/Kconfig
> @@ -21,6 +21,7 @@ config LEMOTE_YEELOONG2F
>  	select SYS_SUPPORTS_APM_EMULATION
>  	select APM_EMULATION
>  	select HWMON
> +	select VIDEO_OUTPUT_CONTROL
>  	default m
>  	help
>  	  YeeLoong netbook is a mini laptop made by Lemote, which is basically

default m is evil.

> +	if (status == BIT_DISPLAY_LCD_ON) {
> +		/* Turn on LCD */
> +		outb(0x31, 0x3c4);
> +		value = inb(0x3c5);
> +		value = (value & 0xf8) | 0x03;
> +		outb(0x31, 0x3c4);
> +		outb(value, 0x3c5);
> +		/* Turn on backlight */
> +		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_ON);
> +	} else {
> +		/* Turn off backlight */
> +		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_OFF);
> +		/* Turn off LCD */
> +		outb(0x31, 0x3c4);
> +		value = inb(0x3c5);
> +		value = (value & 0xf8) | 0x02;
> +		outb(0x31, 0x3c4);
> +		outb(value, 0x3c5);
> +	}

IIRC this is opencoded in suspend support; should that get common
helpers?

> +	if (status == BIT_CRT_DETECT_PLUG) {
> +		if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG) {
> +			/* Turn on CRT */
> +			outb(0x21, 0x3c4);
> +			value = inb(0x3c5);
> +			value &= ~(1 << 7);
> +			outb(0x21, 0x3c4);
> +			outb(value, 0x3c5);
> +		}
> +	} else {
> +		/* Turn off CRT */
> +		outb(0x21, 0x3c4);
> +		value = inb(0x3c5);
> +		value |= (1 << 7);
> +		outb(0x21, 0x3c4);
> +		outb(value, 0x3c5);
> +	}

This looks suspiciously similar to one another and to code
above. Perhaps some more helpers?

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From pavel@ucw.cz Fri Dec  4 15:50:37 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 15:50:43 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:39347 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493126AbZLDOuh (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 15:50:37 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id 6EAEAF0463; Fri,  4 Dec 2009 15:50:37 +0100 (CET)
Date:   Fri, 4 Dec 2009 09:14:02 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J. Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH v7 8/8] Loongson: YeeLoong: add input/hotkey driver
Message-ID: <20091204081402.GD1540@ucw.cz>
References: <cover.1259932036.git.wuzhangjin@gmail.com> <7e96d37889c49c2d6d284e21773aef90dd3aac25.1259932036.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <7e96d37889c49c2d6d284e21773aef90dd3aac25.1259932036.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25314
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

Hi!


> +#define NO_REG		0
> +#define NO_HANDLER	NULL

Don't obfuscate code like that.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From wuzhangjin@gmail.com Fri Dec  4 15:57:38 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 15:57:41 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:48890 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493126AbZLDO5h (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 15:57:37 +0100
Received: by pzk35 with SMTP id 35so2396052pzk.22
        for <multiple recipients>; Fri, 04 Dec 2009 06:57:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=XjyTHMJSFyf90Rinkj9NvvBvMf04c9cqRuyH2J8n0XE=;
        b=M7gs3+oSNnFqdrHOEJ114o4ZTMUDSsnPqydUQq+4QCPTmxguKUaysGV+QnJqUEJiLw
         9Lj0EPOMLFX079hmbo+E2HUfsSyfFLTV7Kaf8ybhgVfFjyvw0lYAFMWQeFTWWiljrBsY
         18g5wLxez+qeguIdJmRD5gIWfecgkQAlBM65I=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=KHcsB1oqf6TG1swTmld3i6ApEtURPxP/3BHRU69x+5qQzIul16/tiriuQr017MbODn
         luIYtfQiGvgup9tblyjx6uONT2gwCm73dLhbEX6Aos9567phpxs12suQeJJz9V4MhpJT
         cWXyBOJAKFKcejdXNpgmIre64ohy0VuOexZuw=
Received: by 10.114.2.40 with SMTP id 40mr4190289wab.181.1259938648948;
        Fri, 04 Dec 2009 06:57:28 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm2555395pzk.6.2009.12.04.06.57.21
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 06:57:28 -0800 (PST)
Subject: Re: [PATCH v7 4/8] Loongson: YeeLoong: add battery driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J. Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        linux-laptop@vger.kernel.org, Hongbing Hu <huhb@lemote.com>
In-Reply-To: <20091204080408.GA1540@ucw.cz>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
         <059fa216d70771a6341edb2db4cc559e958273e9.1259932036.git.wuzhangjin@gmail.com>
         <20091204080408.GA1540@ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Fri, 04 Dec 2009 22:56:54 +0800
Message-ID: <1259938614.9554.2.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25315
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Fri, 2009-12-04 at 09:04 +0100, Pavel Machek wrote:
> On Fri 2009-12-04 21:34:17, Wu Zhangjin wrote:
> > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > 
> > This patch adds APM emulated Battery Driver, it provides standard
> > interface(/proc/apm) for user-space applications(e.g. kpowersave,
> > gnome-power-manager) to manage the battery.
> 
> It would be nicer if this went to drivers/power, and used its
> interface -- providing not only percentage but also other values.

There is a version basic on the power supply interface, but it is buggy.

Regards,
	Wu Zhangjin



From wuzhangjin@gmail.com Fri Dec  4 15:58:28 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 15:58:33 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:40568 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493126AbZLDO62 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 15:58:28 +0100
Received: by pzk35 with SMTP id 35so2396582pzk.22
        for <multiple recipients>; Fri, 04 Dec 2009 06:58:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=0X4PB8dLtgTx1Cf3U8eQuOxnB7xriRauhhJHNpQ/IYI=;
        b=NQAGY0VAuKPMfMSfY8xOLpklTHhtxgAl+FKOgVAcO4thJ/eWOr6cSP6NOkMT75D4qY
         hFICR4oxUTKu9u3hjK1/Ey6My0/0gMtwPLepy+HZipcK4wnKJ+fVtUEaruk03T1YFzdA
         MxerEA2v/D39qPDlq93K0dcPalsQqsWityeb0=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=EPZPEzkB3o795LYQpfs0BZ8eseFgujXpogQsUkaR4qMrd/bEtEefCSI0xHQhxhnk6L
         BH9+puMokwGSVY4xWDSXyjDZ8Lx4HctoDeqFK81RKTGe937pJcEuAS7PCgD6LsPqSH4X
         NmFGe58TaFcndi9J4UwgjjlxZ7gigOXbuASAY=
Received: by 10.115.38.32 with SMTP id q32mr4294224waj.8.1259938701966;
        Fri, 04 Dec 2009 06:58:21 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm59451pxi.9.2009.12.04.06.58.15
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 06:58:21 -0800 (PST)
Subject: Re: [PATCH v7 8/8] Loongson: YeeLoong: add input/hotkey driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J. Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org, linux-input@vger.kernel.org
In-Reply-To: <20091204081402.GD1540@ucw.cz>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
         <7e96d37889c49c2d6d284e21773aef90dd3aac25.1259932036.git.wuzhangjin@gmail.com>
         <20091204081402.GD1540@ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Fri, 04 Dec 2009 22:57:52 +0800
Message-ID: <1259938672.9554.3.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25316
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Fri, 2009-12-04 at 09:14 +0100, Pavel Machek wrote:
> Hi!
> 
> 
> > +#define NO_REG		0
> > +#define NO_HANDLER	NULL
> 
> Don't obfuscate code like that.

Will remove it later, thanks!



From wuzhangjin@gmail.com Fri Dec  4 16:05:27 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 16:05:31 +0100 (CET)
Received: from [209.85.222.197] ([209.85.222.197]:52766 "EHLO
        mail-pz0-f197.google.com" rhost-flags-FAIL-FAIL-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493126AbZLDPF1 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 16:05:27 +0100
Received: by pzk35 with SMTP id 35so2400822pzk.22
        for <multiple recipients>; Fri, 04 Dec 2009 07:05:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=l8EsSlb2aImqQx1YbPtnsurQeBRtJIUeoc8BrZgnErc=;
        b=V5IuDmhk71TosHMGwIwtypiqtLjreXcswCR7Bn8XDEM43rNLrgaVqbIZR4iUbmE7Bu
         SwsiU63QmXmzEozuSOmyM8kr90qvLGlICTGuH04z3QKEx9GdVXxVwhpRA9DfcOrjF5JS
         RZ9gHcPTNRFLRLXF5XY0tu1cRTbcOUE7HIniY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=WiP2EgrcT4Ncd3fDLzEJcoslQr4bb3P6cG9FAqjlfvCOLrvcUJxd3VToIy8DyP1w5B
         lhJj1MjL5op6A230boXYkDG6aH9DCl3vi2zYHiQs+WBJol+dwPdC/d8ZrWEDXhx8y+l+
         RRMRZCdMXbYpYhSSxGqd5AZwWPimwwX/mYE3Y=
Received: by 10.114.7.9 with SMTP id 9mr4277155wag.71.1259939109323;
        Fri, 04 Dec 2009 07:05:09 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm2562532pzk.10.2009.12.04.07.05.01
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 07:05:08 -0800 (PST)
Subject: Re: [PATCH v7 6/8] Loongson: YeeLoong: add video output driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J. Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org, luming.yu@intel.com
In-Reply-To: <20091204081124.GC1540@ucw.cz>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
         <5fd87c1f64a3c6d3e51fc6b0224cc1be3cb0d9d5.1259932036.git.wuzhangjin@gmail.com>
         <20091204081124.GC1540@ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Fri, 04 Dec 2009 23:04:36 +0800
Message-ID: <1259939076.9554.7.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25317
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Fri, 2009-12-04 at 09:11 +0100, Pavel Machek wrote:
> On Fri 2009-12-04 21:36:43, Wu Zhangjin wrote:
> > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > 
> > This patch adds Video Output Driver, it provides standard
> > interface(/sys/class/video_output) to turn on/off the video output of
> > LCD, CRT.
> > 
> 
> > diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
> > index 9c8385c..4a89c01 100644
> > --- a/drivers/platform/mips/Kconfig
> > +++ b/drivers/platform/mips/Kconfig
> > @@ -21,6 +21,7 @@ config LEMOTE_YEELOONG2F
> >  	select SYS_SUPPORTS_APM_EMULATION
> >  	select APM_EMULATION
> >  	select HWMON
> > +	select VIDEO_OUTPUT_CONTROL
> >  	default m
> >  	help
> >  	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
> 
> default m is evil.
> 

why? this module can be loaded automatically, so, I let it be a module
by default.

> > +	if (status == BIT_DISPLAY_LCD_ON) {
> > +		/* Turn on LCD */
> > +		outb(0x31, 0x3c4);
> > +		value = inb(0x3c5);
> > +		value = (value & 0xf8) | 0x03;
> > +		outb(0x31, 0x3c4);
> > +		outb(value, 0x3c5);
> > +		/* Turn on backlight */
> > +		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_ON);
> > +	} else {
> > +		/* Turn off backlight */
> > +		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_OFF);
> > +		/* Turn off LCD */
> > +		outb(0x31, 0x3c4);
> > +		value = inb(0x3c5);
> > +		value = (value & 0xf8) | 0x02;
> > +		outb(0x31, 0x3c4);
> > +		outb(value, 0x3c5);
> > +	}
> 
> IIRC this is opencoded in suspend support; should that get common
> helpers?
> 
> > +	if (status == BIT_CRT_DETECT_PLUG) {
> > +		if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG) {
> > +			/* Turn on CRT */
> > +			outb(0x21, 0x3c4);
> > +			value = inb(0x3c5);
> > +			value &= ~(1 << 7);
> > +			outb(0x21, 0x3c4);
> > +			outb(value, 0x3c5);
> > +		}
> > +	} else {
> > +		/* Turn off CRT */
> > +		outb(0x21, 0x3c4);
> > +		value = inb(0x3c5);
> > +		value |= (1 << 7);
> > +		outb(0x21, 0x3c4);
> > +		outb(value, 0x3c5);
> > +	}
> 
> This looks suspiciously similar to one another and to code
> above. Perhaps some more helpers?
> 

Yes, lots of duplicated source code above, thanks!

Regards,
	Wu Zhangjin


From figo1802@gmail.com Fri Dec  4 16:17:59 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 16:58:47 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:48143 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493372AbZLDPR7 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 16:17:59 +0100
Received: by pzk35 with SMTP id 35so2409006pzk.22
        for <linux-mips@linux-mips.org>; Fri, 04 Dec 2009 07:17:53 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:to:cc
         :in-reply-to:references:content-type:date:message-id:mime-version
         :x-mailer:content-transfer-encoding;
        bh=TkrHbyrfYOqePPCm59DD9R64nbovofg3ns9yPjcPGYg=;
        b=mu1iZTu6ESM3eYFQsQszGqmHdsCSpr8S8rYd+u1q8EiNbDfwhRKwVUnFPWHNvGFOgD
         pbCY7fE/Rgh7g9bdSHBHkUdqEhdAi1vVo5OD2E/tGP3RXfx9euECfmYYy++rvIxH9byB
         /wtfEoSezHbU+oZvL20eGJkx4RqRSPQaV0BBg=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:to:cc:in-reply-to:references:content-type:date
         :message-id:mime-version:x-mailer:content-transfer-encoding;
        b=crpaVyc9KFwuo6gxT31ux2UxqIWHPgRR2jrSAVaD8PlN4AKKIPGZ3TTunqLf8PQc8W
         SfeRRqxCavvzMmOEMEeIf2xocjOIgCv06e0EnYWpm4XnkrkR9TUhpDXxisvzyg2aQIzV
         R9waWoou5tc7hSJl5V3edecsAzEUwAJHdo0ME=
Received: by 10.114.236.23 with SMTP id j23mr4232904wah.164.1259939872767;
        Fri, 04 Dec 2009 07:17:52 -0800 (PST)
Received: from ?192.168.1.100? ([118.132.131.118])
        by mx.google.com with ESMTPS id 23sm68341pxi.1.2009.12.04.07.17.47
        (version=SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 07:17:51 -0800 (PST)
Subject: Re: [HELP] is it some issue about HIGHMEM for mips32?
From:   "Figo.zhang" <figo1802@gmail.com>
To:     wuzhangjin@gmail.com
Cc:     wuzhangjin@gmail.com, rostedt@goodmis.org, zhangfx@lemote.com,
        "Thomas.Koeller" <Thomas.Koeller@baslerweb.com>,
        linux-mips@linux-mips.org
In-Reply-To: <1259935679.8314.0.camel@falcon.domain.org>
References: <1259935069.2070.8.camel@myhost>
         <1259935679.8314.0.camel@falcon.domain.org>
Content-Type: text/plain; charset="UTF-8"
Date:   Fri, 04 Dec 2009 23:20:07 +0800
Message-ID: <1259940007.2070.48.camel@myhost>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <figo1802@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25318
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: figo1802@gmail.com
Precedence: bulk
X-list: linux-mips

On Fri, 2009-12-04 at 22:07 +0800, Wu Zhangjin wrote:
> On Fri, 2009-12-04 at 21:57 +0800, Figo.zhang wrote:
> > hi,
> > i am using 24KC soc, and linux2.6.21.5 kernel and set CONFIG_HIGHMEM
> > enable. if my realy physic RAM is not more than HIGHMEM, such as only
> > 32MB, it is some issue about kernel, i dont know how to fix it? I try
> > linux-2.6.31.4, it is no this issue, is it some change , how to fix it?
> 
> Hello, here is the unique commit about the higmem I can found:
> 
> commit bb86bf28aec6d0a207ae09f38a43e94133d4d6db
> Author: Ralf Baechle <ralf@linux-mips.org>
> Date:   Sat Apr 25 11:25:34 2009 +0200
> 
>     MIPS: Fix highmem.
>     
>     Commit 351336929ccf222ae38ff0cb7a8dd5fd5c6236a0 (kernel.org) rsp.
>     b3594a089f1c17ff919f8f78505c3f20e1f6f8ce (linux-mips.org):
>     
>     > From: Chris Dearman <chris@mips.com>
>     > Date: Wed, 19 Sep 2007 00:58:24 +0100
>     > Subject: [PATCH] [MIPS] Allow setting of the cache attribute at
> run time.
>     >
>     > Slightly tacky, but there is a precedent in the sparc archirecture
> code.
>     
>     introduces the variable _page_cachable_default, which defaults to
> zero and.
>     is used to create the prototype PTE for __kmap_atomic in
>     arch/mips/mm/init.c:kmap_init before initialization in
>     arch/mips/mm/c-r4k.c:coherency_setup, so the default value of 0 will
> be
>     used as the CCA of kmap atomic pages which on many processors is not
> a
>     defined CCA value and may result in writes to kmap_atomic pages
> getting
>     corrupted.  Debugged by Jon Fraser (jfraser@broadcom.com).
> 
> Could you please try to apply it, and test it again?

hi , i have apply the patch by manual,

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bb86bf28aec6d0a207ae09f38a43e94133d4d6db
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=351336929ccf222ae38ff0cb7a8dd5fd5c6236a0
 

but the issue still. so what is the problem?

Best,
Figo.zhang


> 
> >  
> > here is my kernel log:
> > Linux version 2.6.21.5 (figo@myhost) (gcc version 4.1.2) #22 Fri Dec 4
> > 10:33:25 CST 2009
> > CPU revision is: 00019655
> > Determined physical RAM map:
> > memory: start:0x0,size=0x2000000,type=0x1
> > (usable)
> > User-defined physical RAM map:
> > memory: start:0x0,size=0x2000000,type=0x1
> > (usable)
> > Initrd not found or empty - disabling initrd
> > Built 1 zonelists.  Total pages: 8128
> > Kernel command line: console=ttyS0,115200 rdinit=/linuxrc mem=32M nofpu
> > mac=00:aa:aa:bb:bb:99
> > Updated MAC address from u-boot: 8024ff24M
> > Primary instruction cache 32kB, physically tagged, 4-way, linesize 32
> > bytes.
> > Primary data cache 32kB, 4-way, linesize 32 bytes.
> > Synthesized TLB refill handler (20 instructions).
> > Synthesized TLB load handler fastpath (32 instructions).
> > Synthesized TLB store handler fastpath (32 instructions).
> > Synthesized TLB modify handler fastpath (31 instructions).
> > Cache parity protection disabled
> > arch/mips/mach-opulan/optrann/irq.c,arch_init_irq
> > PID hash table entries: 128 (order: 7, 512 bytes)
> > Using 150.000 MHz high precision timer.
> > arch/mips/mach-opulan/optrann/time.c,plat_timer_setup
> > Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
> > Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
> > Memory: 29012k/32768k available (1798k kernel code, 3756k reserved, 369k
> > data, 900k init, 0k highmem)
> > Mount-cache hash table entries: 512
> > NET: Registered protocol family 16
> > Generic PHY: Registered new driver
> > Time: MIPS clocksource has been installed.
> > NET: Registered protocol family 2
> > IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
> > TCP established hash table entries: 1024 (order: 1, 8192 bytes)
> > TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
> > TCP: Hash tables configured (established 1024 bind 1024)
> > TCP reno registered
> > Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
> > io scheduler noop registered
> > io scheduler anticipatory registered (default)
> > io scheduler deadline registered
> > io scheduler cfq registered
> > Serial: optrann serial driver $Revision: 1.0
> > uart_register_driver finished
> > ttyS0 at MMIO map 0xbf004000 mem 0xbf004000 (irq = 23) is a UART 0
> > RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
> > loop: loaded (max 8 devices)
> > nbd: registered device at major 43
> > optrann_fe_ether Ethernet driver, V1.00
> > FE:dmac_regs =0xbf014000,msg_regs=0xbf028000, irq=26
> > FE MAC: 00:aa:aa:bb:bb:99
> > TCP cubic registered
> > Freeing unused kernel memory: 900k freed
> > ramdisk_execute_command=/linuxrc, execute_command=<NULL>
> > Bad pte = 0135c79f, process = linuxrc, vm_flags = 100073, vaddr =
> > 2aaae000
> > Call Trace:
> > [<80048d70>] dump_stack+0x8/0x34
> > [<8009ebb0>] vm_normal_page+0x68/0x90
> > [<8009f850>] unmap_vmas+0x1e8/0x5e8
> > [<800a3428>] unmap_region+0x9c/0x184
> > [<800a4268>] do_munmap+0x1b0/0x25c
> > [<800a4358>] sys_munmap+0x44/0x70
> > [<8004af40>] stack_done+0x20/0x3c
> > Bad pte = 0135e79f, process = linuxrc, vm_flags = 100073, vaddr =
> > 2aaae000
> > Call Trace:
> > [<80048d70>] dump_stack+0x8/0x34
> > [<8009ebb0>] vm_normal_page+0x68/0x90
> > [<8009f850>] unmap_vmas+0x1e8/0x5e8
> > [<800a3428>] unmap_region+0x9c/0x184
> > [<800a4268>] do_munmap+0x1b0/0x25c
> > [<800a4358>] sys_munmap+0x44/0x70
> > [<8004af40>] stack_done+0x20/0x3c
> > Bad pte = 0026079f, process = linuxrc, vm_flags = 100073, vaddr =
> > 2aaae000
> > Call Trace:
> > [<80048d70>] dump_stack+0x8/0x34
> > [<8009ebb0>] vm_normal_page+0x68/0x90
> > [<8009f850>] unmap_vmas+0x1e8/0x5e8
> > [<800a3428>] unmap_region+0x9c/0x184
> > [<800a4268>] do_munmap+0x1b0/0x25c
> > [<800a4358>] sys_munmap+0x44/0x70
> > [<8004af40>] stack_done+0x20/0x3c
> >  
> > .........
> >  
> > 
> > Best,
> > Figo.zhang
> > 
> 
> 



From tsbogend@alpha.franken.de Fri Dec  4 17:03:53 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 17:03:56 +0100 (CET)
Received: from elvis.franken.de ([193.175.24.41]:43765 "EHLO elvis.franken.de"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492994AbZLDQDx (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Fri, 4 Dec 2009 17:03:53 +0100
Received: from uucp (helo=solo.franken.de)
        by elvis.franken.de with local-bsmtp (Exim 3.36 #1)
        id 1NGadJ-0006bq-00; Fri, 04 Dec 2009 17:03:49 +0100
Received: by solo.franken.de (Postfix, from userid 1000)
        id E1F32DE1DF; Fri,  4 Dec 2009 17:03:33 +0100 (CET)
Date:   Fri, 4 Dec 2009 17:03:33 +0100
From:   Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To:     myuboot@fastmail.fm
Cc:     linux-kernel@vger.kernel.org,
        linux-mips <linux-mips@linux-mips.org>
Subject: Re: PIR OFFSET for AR7
Message-ID: <20091204160333.GA8842@alpha.franken.de>
References: <20091028103551.0b4052d8@pixies.home.jungo.com> <1259891550.19943.1348372917@webmail.messagingengine.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1259891550.19943.1348372917@webmail.messagingengine.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <tsbogend@alpha.franken.de>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25319
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: tsbogend@alpha.franken.de
Precedence: bulk
X-list: linux-mips

On Thu, Dec 03, 2009 at 07:52:30PM -0600, myuboot@fastmail.fm wrote:
> Hi, What is the use of PIR register for AR7 board in file
> arch/mips/ar7/irq.c?

it gives back the channel and line of the pending interrupt with the
highest priority.

> If I understand it right, PIR is used to define the
> polarity of the interrupts. It seems to me that it needs to initialized?

no, it's a read only register. Why do you think it has something to do
with interrupt polarity ?

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]

From wuzhangjin@gmail.com Fri Dec  4 17:30:22 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 17:30:26 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:36285 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492914AbZLDQaW (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 17:30:22 +0100
Received: by pxi6 with SMTP id 6so714019pxi.0
        for <multiple recipients>; Fri, 04 Dec 2009 08:30:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=u2gLDyxrC9BjabwZXR9sf061r5jwuKspjFs+3ivl4bc=;
        b=mHmDFi37Qc8w9Ts860jywncImBgmXN3dv2zhsG3RelHfGMb/k45f+bMnABAS82aQRW
         GcxITNjqv7LFjjDsoFmPuHiTxDqziUb2kOir76MnGX0jZ1udFdE7MrxrVNDpUt9/M9t+
         abB9kCYDcu0gvOQDSc1NRhVH8pHOY5znAKAxE=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=cUTVwVLcr5IiRqDEQPePYG+aRXe0tULyr4Uf0alfMDLsjsr0+gAALF/MkbOHSZ+q4Z
         fZNyrr/JFccdCyNbuD3X4uFpnq4RiQ7qVa9TsqTvuGZV6cJxZTtAZmRZJJNR1Un/3wcz
         FTNTKprxWTgTnpFuZgVpPrLOjFL1Wg2IXPcZY=
Received: by 10.114.237.19 with SMTP id k19mr4353492wah.69.1259944213206;
        Fri, 04 Dec 2009 08:30:13 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm2602676pzk.15.2009.12.04.08.30.07
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Fri, 04 Dec 2009 08:30:12 -0800 (PST)
Subject: Re: [PATCH v7 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J. Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org
In-Reply-To: <20091204080813.GB1540@ucw.cz>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
         <102732263f647e47216c1f2cb121c30226cc995e.1259932036.git.wuzhangjin@gmail.com>
         <20091204080813.GB1540@ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Sat, 05 Dec 2009 00:29:45 +0800
Message-ID: <1259944185.9554.8.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25320
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Fri, 2009-12-04 at 09:08 +0100, Pavel Machek wrote:
> Hi!
> 
> > +static int get_cpu_temp(void)
> > +{
> > +	int value;
> > +
> > +	value = ec_read(REG_TEMPERATURE_VALUE);
> > +
> > +	if (value & (1 << 7))
> > +		value = (value & 0x7f) - 128;
> > +	else
> > +		value = value & 0xff;
> 
> wtf?
> 
> Maybe value should be 's8'?
> 
> > +static int get_battery_current(void)
> > +{
> > +	int value;
> > +
> > +	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> > +		(ec_read(REG_BAT_CURRENT_LOW));
> > +
> > +	if (value & 0x8000)
> > +		value = 0xffff - value;
> 
> Another version of  pair-complement conversion; this one is broken --
> off by 1.
> 
> > +static int parse_arg(const char *buf, unsigned long count, int *val)
> > +{
> > +	if (!count)
> > +		return 0;
> > +	if (sscanf(buf, "%i", val) != 1)
> > +		return -EINVAL;
> > +	return count;
> > +}
> 
> We have strict_strtoul for a reason...
> 

Done, thanks!

Regards,
	Wu Zhangjin


From myuboot@fastmail.fm Fri Dec  4 18:30:58 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 18:31:05 +0100 (CET)
Received: from out1.smtp.messagingengine.com ([66.111.4.25]:46426 "EHLO
        out1.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493402AbZLDRa6 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 18:30:58 +0100
Received: from compute2.internal (compute2.internal [10.202.2.42])
        by gateway1.messagingengine.com (Postfix) with ESMTP id 34EB5C4F8D;
        Fri,  4 Dec 2009 12:30:57 -0500 (EST)
Received: from web8.messagingengine.com ([10.202.2.217])
  by compute2.internal (MEProxy); Fri, 04 Dec 2009 12:30:57 -0500
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:from:to:cc:mime-version:content-transfer-encoding:content-type:in-reply-to:references:subject:date; s=smtpout; bh=jGDdHI/SKkc95aZSRhlkrL8K8ls=; b=XVrpsORb26GCaYuPKVOLW1qOPGX7hER44gmNmM134kN5M3pi79PC60YmlYwNus74cI4JhEJh8VspIBOtX+1cSqq0iUjfffdUiGGiwg4Rq5oXPimbPc6EBvSzFTHpECM3pXauzfa1a12khXMlKBwRlHVLblXZv3+R3c42cyT0Bn8=
Received: by web8.messagingengine.com (Postfix, from userid 99)
        id 18656134BAE; Fri,  4 Dec 2009 12:30:57 -0500 (EST)
Message-Id: <1259947857.14965.1348483153@webmail.messagingengine.com>
X-Sasl-Enc: vghcyFVCki5Hc+7gJ3ka12vQo0IH1e+0Kz9FMgnH62f/ 1259947857
From:   myuboot@fastmail.fm
To:     "Thomas Bogendoerfer" <tsbogend@alpha.franken.de>
Cc:     linux-kernel@vger.kernel.org,
        "linux-mips" <linux-mips@linux-mips.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
X-Mailer: MessagingEngine.com Webmail Interface
In-Reply-To: <20091204160333.GA8842@alpha.franken.de>
References: <20091028103551.0b4052d8@pixies.home.jungo.com>
 <1259891550.19943.1348372917@webmail.messagingengine.com>
 <20091204160333.GA8842@alpha.franken.de>
Subject: Re: PIR OFFSET for AR7
Date:   Fri, 04 Dec 2009 11:30:57 -0600
Return-Path: <myuboot@fastmail.fm>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25321
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: myuboot@fastmail.fm
Precedence: bulk
X-list: linux-mips

Thomas,

Sorry, you are right. I mistook PM_OFFSET for PIR_OFFSET.

Thanks, Andrew
On Fri, 04 Dec 2009 17:03 +0100, "Thomas Bogendoerfer"
<tsbogend@alpha.franken.de> wrote:
> On Thu, Dec 03, 2009 at 07:52:30PM -0600, myuboot@fastmail.fm wrote:
> > Hi, What is the use of PIR register for AR7 board in file
> > arch/mips/ar7/irq.c?
> 
> it gives back the channel and line of the pending interrupt with the
> highest priority.
> 
> > If I understand it right, PIR is used to define the
> > polarity of the interrupts. It seems to me that it needs to initialized?
> 
> no, it's a read only register. Why do you think it has something to do
> with interrupt polarity ?
> 
> Thomas.
> 
> -- 
> Crap can work. Given enough thrust pigs will fly, but it's not necessary
> a
> good idea.                                                [ RFC1925, 2.3
> ]

From ed.okerson@gmail.com Fri Dec  4 18:52:09 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 18:52:12 +0100 (CET)
Received: from mail-ew0-f224.google.com ([209.85.219.224]:54767 "EHLO
        mail-ew0-f224.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493554AbZLDRwJ (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 18:52:09 +0100
Received: by ewy24 with SMTP id 24so3080820ewy.26
        for <linux-mips@linux-mips.org>; Fri, 04 Dec 2009 09:52:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:date:message-id:subject
         :from:to:content-type;
        bh=uD/1LGam3sEYdOqwV9fy57iswMHxH+9QYr37ksAUfWE=;
        b=WQDiggAhJH54rtpBcx7V1VkKQCylckM+F/q4njEvyW8lDnpA5NMaBJYkcVemWYlj7P
         V7yTy6GcnQqTrrs9AiA2NS5Ady1yM0Hb96zxOOKlDENBbv/Iejp9UxQHsUTA36Ba23tm
         eDtaPiCzDd543dAe9fIzXkxwIy6Le8Dr4zzFw=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:date:message-id:subject:from:to:content-type;
        b=n/AM1gNbeWluynaU1WRKD/M1dGvuTGgjT53umAGFUljhPOsl6GRfqnzobLMW31JWPC
         jop2H6lp/gMypP6mtbCJmKy6VG1cssLNE043r25LVkPtTYA8Gh+EkSWq5dXb7qEyjq1Y
         Z8kiotEqv4mODaPLbRMkivkdlsasHRIy+KeWI=
MIME-Version: 1.0
Received: by 10.216.88.144 with SMTP id a16mr1148039wef.208.1259949123901; 
        Fri, 04 Dec 2009 09:52:03 -0800 (PST)
Date:   Fri, 4 Dec 2009 11:52:03 -0600
Message-ID: <83f0348b0912040952h40d4d151n79ca5fc33a830ee2@mail.gmail.com>
Subject: mmap KSEG1
From:   Ed Okerson <ed.okerson@gmail.com>
To:     linux-mips@linux-mips.org
Content-Type: text/plain; charset=ISO-8859-1
Return-Path: <ed.okerson@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25322
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ed.okerson@gmail.com
Precedence: bulk
X-list: linux-mips

Is it possible to mmap an address in KSEG1 so a user space app can
read/write to an IO device uncached?

Ed

From David.Daney@caviumnetworks.com Fri Dec  4 19:12:27 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 19:12:30 +0100 (CET)
Received: from smtp2.caviumnetworks.com ([209.113.159.134]:18728 "EHLO
        smtp2.caviumnetworks.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493676AbZLDSM1 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 19:12:27 +0100
Received: from maexch1.caveonetworks.com (Not Verified[192.168.14.20]) by smtp2.caviumnetworks.com with MailMarshal (v6,5,4,7535)
        id <B4b19501e0001>; Fri, 04 Dec 2009 13:08:30 -0500
Received: from caexch01.caveonetworks.com ([192.168.16.9]) by maexch1.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);
         Fri, 4 Dec 2009 13:12:23 -0500
Received: from dd1.caveonetworks.com ([12.108.191.236]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959);
         Fri, 4 Dec 2009 10:12:21 -0800
Message-ID: <4B195102.1020606@caviumnetworks.com>
Date:   Fri, 04 Dec 2009 10:12:18 -0800
From:   David Daney <ddaney@caviumnetworks.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090320)
MIME-Version: 1.0
To:     Ed Okerson <ed.okerson@gmail.com>
CC:     linux-mips@linux-mips.org
Subject: Re: mmap KSEG1
References: <83f0348b0912040952h40d4d151n79ca5fc33a830ee2@mail.gmail.com>
In-Reply-To: <83f0348b0912040952h40d4d151n79ca5fc33a830ee2@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 04 Dec 2009 18:12:21.0366 (UTC) FILETIME=[528FC960:01CA750D]
Return-Path: <David.Daney@caviumnetworks.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25323
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ddaney@caviumnetworks.com
Precedence: bulk
X-list: linux-mips

Ed Okerson wrote:
> Is it possible to mmap an address in KSEG1 so a user space app can
> read/write to an IO device uncached?
> 

It depends on your definition of 'possible'.  The mips32/64 architecture 
specification has a 'C' field in the EntryLo register that controls 
cachability, so given an appropriate device driver it should be doable.

Calling  __ioremap() with the appropriate flags should allow you to set 
the 'C' bits.

Depending on your requirements, you might be able to get by using 
/dev/mem and some 'sync' instructions, instead of establishing an 
uncached mapping.


David Daney

From tsbogend@alpha.franken.de Fri Dec  4 19:33:26 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 19:33:28 +0100 (CET)
Received: from elvis.franken.de ([193.175.24.41]:45658 "EHLO elvis.franken.de"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1490960AbZLDSdZ (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Fri, 4 Dec 2009 19:33:25 +0100
Received: from uucp (helo=solo.franken.de)
        by elvis.franken.de with local-bsmtp (Exim 3.36 #1)
        id 1NGcy5-0003nJ-00; Fri, 04 Dec 2009 19:33:25 +0100
Received: by solo.franken.de (Postfix, from userid 1000)
        id 9538FDE1DF; Fri,  4 Dec 2009 19:33:09 +0100 (CET)
Date:   Fri, 4 Dec 2009 19:33:09 +0100
From:   Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To:     Ed Okerson <ed.okerson@gmail.com>
Cc:     linux-mips@linux-mips.org
Subject: Re: mmap KSEG1
Message-ID: <20091204183309.GA10383@alpha.franken.de>
References: <83f0348b0912040952h40d4d151n79ca5fc33a830ee2@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <83f0348b0912040952h40d4d151n79ca5fc33a830ee2@mail.gmail.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <tsbogend@alpha.franken.de>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25324
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: tsbogend@alpha.franken.de
Precedence: bulk
X-list: linux-mips

On Fri, Dec 04, 2009 at 11:52:03AM -0600, Ed Okerson wrote:
> Is it possible to mmap an address in KSEG1 so a user space app can
> read/write to an IO device uncached?

well not exactly to KSEG1, since that is kernel exclusive address space,
but it's possible to map the physical address of the device:

Try

fd = open("/dev/mem", O_RDWR|O_SYNC);
io = mmap (NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, ioaddr);

where ioaddr is the physical address of the io device.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]

From David.Daney@caviumnetworks.com Fri Dec  4 22:56:21 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 04 Dec 2009 22:56:26 +0100 (CET)
Received: from mail3.caviumnetworks.com ([12.108.191.235]:7667 "EHLO
        mail3.caviumnetworks.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493991AbZLDV4V (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Fri, 4 Dec 2009 22:56:21 +0100
Received: from caexch01.caveonetworks.com (Not Verified[192.168.16.9]) by mail3.caviumnetworks.com with MailMarshal (v6,5,4,7535)
        id <B4b19856f0000>; Fri, 04 Dec 2009 13:56:03 -0800
Received: from caexch01.caveonetworks.com ([192.168.16.9]) by caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);
         Fri, 4 Dec 2009 13:52:40 -0800
Received: from dd1.caveonetworks.com ([12.108.191.236]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959);
         Fri, 4 Dec 2009 13:52:40 -0800
Received: from dd1.caveonetworks.com (localhost.localdomain [127.0.0.1])
        by dd1.caveonetworks.com (8.14.2/8.14.2) with ESMTP id nB4Lqbiu006902;
        Fri, 4 Dec 2009 13:52:38 -0800
Received: (from ddaney@localhost)
        by dd1.caveonetworks.com (8.14.2/8.14.2/Submit) id nB4Lqadb006900;
        Fri, 4 Dec 2009 13:52:36 -0800
From:   David Daney <ddaney@caviumnetworks.com>
To:     linux-mips@linux-mips.org, ralf@linux-mips.org
Cc:     David Daney <ddaney@caviumnetworks.com>
Subject: [PATCH] MIPS: Two-level pagetables for 64-bit kernels with 64KB pages.
Date:   Fri,  4 Dec 2009 13:52:36 -0800
Message-Id: <1259963556-6876-1-git-send-email-ddaney@caviumnetworks.com>
X-Mailer: git-send-email 1.6.0.6
X-OriginalArrivalTime: 04 Dec 2009 21:52:40.0515 (UTC) FILETIME=[19C9D930:01CA752C]
Return-Path: <David.Daney@caviumnetworks.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25325
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ddaney@caviumnetworks.com
Precedence: bulk
X-list: linux-mips

For 64-bit kernels with 64KB pages and two level page tables, there
are 42 bits worth of virtual address space This is larger than the 40
bits of virtual address space obtained with the default 4KB Page size
and three levels, so there are no draw backs for using two level
tables with this configuration.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/include/asm/page.h       |   12 ---------
 arch/mips/include/asm/pgalloc.h    |    4 +-
 arch/mips/include/asm/pgtable-64.h |   36 +++++++++++++++++++++++++++-
 arch/mips/include/asm/pgtable.h    |    2 +-
 arch/mips/kernel/asm-offsets.c     |    4 +++
 arch/mips/mm/init.c                |    2 +-
 arch/mips/mm/pgtable-64.c          |   44 ++++++++++++++++++++++--------------
 arch/mips/mm/tlbex.c               |    2 +
 8 files changed, 71 insertions(+), 35 deletions(-)

diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index f266295..ac32572 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -107,18 +107,6 @@ typedef struct { unsigned long pte; } pte_t;
 typedef struct page *pgtable_t;
 
 /*
- * For 3-level pagetables we defines these ourselves, for 2-level the
- * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
- */
-#ifdef CONFIG_64BIT
-
-typedef struct { unsigned long pmd; } pmd_t;
-#define pmd_val(x)	((x).pmd)
-#define __pmd(x)	((pmd_t) { (x) } )
-
-#endif
-
-/*
  * Right now we don't support 4-level pagetables, so all pud-related
  * definitions come from <asm-generic/pgtable-nopud.h>.
  */
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index 3738f4b..881d18b 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -31,7 +31,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
  */
 extern void pmd_init(unsigned long page, unsigned long pagetable);
 
-#ifdef CONFIG_64BIT
+#ifndef __PAGETABLE_PMD_FOLDED
 
 static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
 {
@@ -104,7 +104,7 @@ do {							\
 	tlb_remove_page((tlb), pte);			\
 } while (0)
 
-#ifdef CONFIG_64BIT
+#ifndef __PAGETABLE_PMD_FOLDED
 
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index 9cd5089..073a393 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -16,7 +16,11 @@
 #include <asm/cachectl.h>
 #include <asm/fixmap.h>
 
+#ifdef CONFIG_PAGE_SIZE_64KB
+#include <asm-generic/pgtable-nopmd.h>
+#else
 #include <asm-generic/pgtable-nopud.h>
+#endif
 
 /*
  * Each address space has 2 4K pages as its page directory, giving 1024
@@ -37,13 +41,20 @@
  * fault address - VMALLOC_START.
  */
 
+
+/* PGDIR_SHIFT determines what a third-level page table entry can map */
+#ifdef __PAGETABLE_PMD_FOLDED
+#define PGDIR_SHIFT	(PAGE_SHIFT + PAGE_SHIFT + PTE_ORDER - 3)
+#else
+
 /* PMD_SHIFT determines the size of the area a second-level page table can map */
 #define PMD_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
 #define PMD_SIZE	(1UL << PMD_SHIFT)
 #define PMD_MASK	(~(PMD_SIZE-1))
 
-/* PGDIR_SHIFT determines what a third-level page table entry can map */
+
 #define PGDIR_SHIFT	(PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3))
+#endif
 #define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
 #define PGDIR_MASK	(~(PGDIR_SIZE-1))
 
@@ -92,12 +103,14 @@
 #ifdef CONFIG_PAGE_SIZE_64KB
 #define PGD_ORDER		0
 #define PUD_ORDER		aieeee_attempt_to_allocate_pud
-#define PMD_ORDER		0
+#define PMD_ORDER		aieeee_attempt_to_allocate_pmd
 #define PTE_ORDER		0
 #endif
 
 #define PTRS_PER_PGD	((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
+#ifndef __PAGETABLE_PMD_FOLDED
 #define PTRS_PER_PMD	((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t))
+#endif
 #define PTRS_PER_PTE	((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
 
 #if PGDIR_SIZE >= TASK_SIZE
@@ -120,15 +133,30 @@
 
 #define pte_ERROR(e) \
 	printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
+#ifndef __PAGETABLE_PMD_FOLDED
 #define pmd_ERROR(e) \
 	printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
+#endif
 #define pgd_ERROR(e) \
 	printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
 
 extern pte_t invalid_pte_table[PTRS_PER_PTE];
 extern pte_t empty_bad_page_table[PTRS_PER_PTE];
+
+
+#ifndef __PAGETABLE_PMD_FOLDED
+/*
+ * For 3-level pagetables we defines these ourselves, for 2-level the
+ * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
+ */
+typedef struct { unsigned long pmd; } pmd_t;
+#define pmd_val(x)	((x).pmd)
+#define __pmd(x)	((pmd_t) { (x) } )
+
+
 extern pmd_t invalid_pmd_table[PTRS_PER_PMD];
 extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD];
+#endif
 
 /*
  * Empty pgd/pmd entries point to the invalid_pte_table.
@@ -149,6 +177,7 @@ static inline void pmd_clear(pmd_t *pmdp)
 {
 	pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
 }
+#ifndef __PAGETABLE_PMD_FOLDED
 
 /*
  * Empty pud entries point to the invalid_pmd_table.
@@ -172,6 +201,7 @@ static inline void pud_clear(pud_t *pudp)
 {
 	pud_val(*pudp) = ((unsigned long) invalid_pmd_table);
 }
+#endif
 
 #define pte_page(x)		pfn_to_page(pte_pfn(x))
 
@@ -196,6 +226,7 @@ static inline void pud_clear(pud_t *pudp)
 /* to find an entry in a page-table-directory */
 #define pgd_offset(mm, addr)	((mm)->pgd + pgd_index(addr))
 
+#ifndef __PAGETABLE_PMD_FOLDED
 static inline unsigned long pud_page_vaddr(pud_t pud)
 {
 	return pud_val(pud);
@@ -208,6 +239,7 @@ static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
 {
 	return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address);
 }
+#endif
 
 /* Find an entry in the third-level page table.. */
 #define __pte_offset(address)						\
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 1854336..02335fd 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -177,7 +177,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
  */
 #define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
 
-#ifdef CONFIG_64BIT
+#ifndef __PAGETABLE_PMD_FOLDED
 /*
  * (puds are folded into pgds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 2c1e1d0..ca6c832 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -188,11 +188,15 @@ void output_mm_defines(void)
 	DEFINE(_PTE_T_SIZE, sizeof(pte_t));
 	BLANK();
 	DEFINE(_PGD_T_LOG2, PGD_T_LOG2);
+#ifndef __PAGETABLE_PMD_FOLDED
 	DEFINE(_PMD_T_LOG2, PMD_T_LOG2);
+#endif
 	DEFINE(_PTE_T_LOG2, PTE_T_LOG2);
 	BLANK();
 	DEFINE(_PGD_ORDER, PGD_ORDER);
+#ifndef __PAGETABLE_PMD_FOLDED
 	DEFINE(_PMD_ORDER, PMD_ORDER);
+#endif
 	DEFINE(_PTE_ORDER, PTE_ORDER);
 	BLANK();
 	DEFINE(_PMD_SHIFT, PMD_SHIFT);
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 9e8d003..d070aae 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -477,7 +477,7 @@ unsigned long pgd_current[NR_CPUS];
  * will officially be retired.
  */
 pgd_t swapper_pg_dir[_PTRS_PER_PGD] __page_aligned(_PGD_ORDER);
-#ifdef CONFIG_64BIT
+#ifndef __PAGETABLE_PMD_FOLDED
 pmd_t invalid_pmd_table[PTRS_PER_PMD] __page_aligned(PMD_ORDER);
 #endif
 pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned(PTE_ORDER);
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
index 1121019..78eaa4f 100644
--- a/arch/mips/mm/pgtable-64.c
+++ b/arch/mips/mm/pgtable-64.c
@@ -15,23 +15,31 @@
 void pgd_init(unsigned long page)
 {
 	unsigned long *p, *end;
+	unsigned long entry;
+
+#ifdef __PAGETABLE_PMD_FOLDED
+	entry = (unsigned long)invalid_pte_table;
+#else
+	entry = (unsigned long)invalid_pmd_table;
+#endif
 
  	p = (unsigned long *) page;
 	end = p + PTRS_PER_PGD;
 
 	while (p < end) {
-		p[0] = (unsigned long) invalid_pmd_table;
-		p[1] = (unsigned long) invalid_pmd_table;
-		p[2] = (unsigned long) invalid_pmd_table;
-		p[3] = (unsigned long) invalid_pmd_table;
-		p[4] = (unsigned long) invalid_pmd_table;
-		p[5] = (unsigned long) invalid_pmd_table;
-		p[6] = (unsigned long) invalid_pmd_table;
-		p[7] = (unsigned long) invalid_pmd_table;
+		p[0] = entry;
+		p[1] = entry;
+		p[2] = entry;
+		p[3] = entry;
+		p[4] = entry;
+		p[5] = entry;
+		p[6] = entry;
+		p[7] = entry;
 		p += 8;
 	}
 }
 
+#ifndef __PAGETABLE_PMD_FOLDED
 void pmd_init(unsigned long addr, unsigned long pagetable)
 {
 	unsigned long *p, *end;
@@ -40,17 +48,18 @@ void pmd_init(unsigned long addr, unsigned long pagetable)
 	end = p + PTRS_PER_PMD;
 
 	while (p < end) {
-		p[0] = (unsigned long)pagetable;
-		p[1] = (unsigned long)pagetable;
-		p[2] = (unsigned long)pagetable;
-		p[3] = (unsigned long)pagetable;
-		p[4] = (unsigned long)pagetable;
-		p[5] = (unsigned long)pagetable;
-		p[6] = (unsigned long)pagetable;
-		p[7] = (unsigned long)pagetable;
+		p[0] = pagetable;
+		p[1] = pagetable;
+		p[2] = pagetable;
+		p[3] = pagetable;
+		p[4] = pagetable;
+		p[5] = pagetable;
+		p[6] = pagetable;
+		p[7] = pagetable;
 		p += 8;
 	}
 }
+#endif
 
 void __init pagetable_init(void)
 {
@@ -59,8 +68,9 @@ void __init pagetable_init(void)
 
 	/* Initialize the entire pgd.  */
 	pgd_init((unsigned long)swapper_pg_dir);
+#ifndef __PAGETABLE_PMD_FOLDED
 	pmd_init((unsigned long)invalid_pmd_table, (unsigned long)invalid_pte_table);
-
+#endif
 	pgd_base = swapper_pg_dir;
 	/*
 	 * Fixed mappings:
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index badcf5e..eae45f0 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -549,11 +549,13 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
 
 	uasm_i_andi(p, tmp, tmp, (PTRS_PER_PGD - 1)<<3);
 	uasm_i_daddu(p, ptr, ptr, tmp); /* add in pgd offset */
+#ifndef __PAGETABLE_PMD_FOLDED
 	uasm_i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */
 	uasm_i_ld(p, ptr, 0, ptr); /* get pmd pointer */
 	uasm_i_dsrl(p, tmp, tmp, PMD_SHIFT-3); /* get pmd offset in bytes */
 	uasm_i_andi(p, tmp, tmp, (PTRS_PER_PMD - 1)<<3);
 	uasm_i_daddu(p, ptr, ptr, tmp); /* add in pmd offset */
+#endif
 }
 
 /*
-- 
1.6.0.6


From myuboot@fastmail.fm Sat Dec  5 01:18:36 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 05 Dec 2009 01:18:39 +0100 (CET)
Received: from out1.smtp.messagingengine.com ([66.111.4.25]:39786 "EHLO
        out1.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494058AbZLEASg (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sat, 5 Dec 2009 01:18:36 +0100
Received: from compute2.internal (compute2.internal [10.202.2.42])
        by gateway1.messagingengine.com (Postfix) with ESMTP id 3FA2AC5E27;
        Fri,  4 Dec 2009 19:18:29 -0500 (EST)
Received: from web8.messagingengine.com ([10.202.2.217])
  by compute2.internal (MEProxy); Fri, 04 Dec 2009 19:18:29 -0500
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:from:to:cc:mime-version:content-transfer-encoding:content-type:references:subject:in-reply-to:date; s=smtpout; bh=1AAkkxUWuwkBGwvzJVA+0drXT/I=; b=jENwqKROUpPXGe+PvLbzjso4uEApXbe/rUSd33z3clT5hAEPYBy2KZzwq19czVZCJfwEQpN0Yv+YqKw4j5SIq0/4azfe+BNUP7K4+yGp3w5A1z3hyizmMxs299IdvR9NZN9zCuUUI7z58oSL4Er/4DpnS9yo7SpObt6G4vi3mJo=
Received: by web8.messagingengine.com (Postfix, from userid 99)
        id 1B8D1F4D7A; Fri,  4 Dec 2009 19:18:29 -0500 (EST)
Message-Id: <1259972309.7597.1348536401@webmail.messagingengine.com>
X-Sasl-Enc: 5dB/xGLuUzDfrBYmGOLPPhW3EgyxoMPxet0AVroUuJFF 1259972309
From:   myuboot@fastmail.fm
To:     "Florian Fainelli" <florian@openwrt.org>
Cc:     "David VomLehn" <dvomlehn@cisco.com>,
        "Chris Dearman" <chris@mips.com>,
        "linux-mips" <linux-mips@linux-mips.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: multipart/mixed; boundary="_----------=_125997230975970"
X-Mailer: MessagingEngine.com Webmail Interface
References: <1255735395.30097.1340523469@webmail.messagingengine.com>
 <20091118010351.GA21728@dvomlehn-lnx2.corp.sa.net>
 <1259195053.31777.1347090923@webmail.messagingengine.com>
 <200911260945.59751.florian@openwrt.org>
Subject: Re: problem bring up initramfs and busybox
In-Reply-To: <200911260945.59751.florian@openwrt.org>
Date:   Fri, 04 Dec 2009 18:18:29 -0600
Return-Path: <myuboot@fastmail.fm>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25326
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: myuboot@fastmail.fm
Precedence: bulk
X-list: linux-mips

This is a multi-part message in MIME format.

--_----------=_125997230975970
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="ISO-8859-1"
Date: Fri, 4 Dec 2009 19:18:29 -0500
X-Mailer: MessagingEngine.com Webmail Interface

Finally, I figured out the problem. The main issue is in file irq.c, in
which the register starting at CHNL_OFFSET() is not set correctly in big
endian mode. With that problem, even though the serial port 8250 is
generating interrupt,  the interrupt controller blocks it.

In  big endian mode, the value written at line=20
writel(i, REG(CHNL_OFFSET(i)));

should be=20
writel(i << 24, REG(CHNL_OFFSET(i)));

I suspect this problem is applicable to AR7 running in big endian mode
since my board is almost the same to AR7. I am attaching a patch for
anyone's reference. Thanks to Florian, Kevin, Chris and Ralf for your
advise.

Best regards, Andrew



On Thu, 26 Nov 2009 09:45 +0100, "Florian Fainelli"
<florian@openwrt.org> wrote:
> Hi Andrew.
>=20
> Le jeudi 26 novembre 2009 01:24:13, myuboot@fastmail.fm a =E9crit :
> > On Tue, 17 Nov 2009 20:03 -0500, "David VomLehn" <dvomlehn@cisco.com>
> >=20
> > wrote:
> > > On Tue, Nov 17, 2009 at 06:58:35PM -0600, myuboot@fastmail.fm wrote:
> > > > On Wed, 18 Nov 2009 01:39 +0100, "Florian Fainelli"
> > > >
> > > > <florian@openwrt.org> wrote:
> > > > > -------------------------------
> > > >
> > > > Actually I already got this patch for the board in little endian mo=
de,
> > > > and it is still there for the big endian mode. And this is one of t=
he
> > > > place I have been wondering if that needs to be changed for big end=
ian.
> > >
> > > It sounds like you've done a good job getting the bootloader and kern=
el
> > > to work, so this may be a silly suggestion, but are you sure your root
> > > filesystem and busybox are little-endian? It would be an easy mistake=
 to
> > > make...
> > >
> > > > thanks. Andrew
> > >
> > > David VL
> >=20
> > I have some clue on this issue now. It seems there is some problem with
> > the serial console operating in interrupt mode. If the 8250 is in
> > polling mode(set the IRQ for the 8250 serial port to 0), the output on
> > the console is fine. But with 8250 in interrupt mode, 8250 serial driver
> > does not receive any interrupt in serial8250_interrupt(). The same board
> > works just fine when operating in little endian mode with interruption.
> > I probably need to change something in IRQ initialization for big
> > endian. I will post my solution when I can get it to work. In the
> > meantime, any suggestion will be welcome.
>=20
> Do you need that patch to work in little-endian:=20
> https://dev.openwrt.org/browser/trunk/target/linux/ar7/patches-2.6.30/500-
> serial_kludge.patch ? If so, you are likely to need it in big-endian too
> since=20
> it works around a silicon issue.
> --=20
> Best regards, Florian Fainelli
> Email: florian@openwrt.org
> Web: http://openwrt.org
> IRC: [florian] on irc.freenode.net
> -------------------------------

--_----------=_125997230975970
MIME-Version: 1.0
Content-Disposition: attachment; filename="irq.patch"
Content-Id: Etia+ZiQISXr/wTo6yvX0zG3U5E@messagingengine.com
Content-Transfer-Encoding: base64
Content-Type: text/x-patch; name="irq.patch"
X-Mailer: MIME::Lite 3.021 (F2.76; T1.24; A2.03; B3.07_01; Q3.07)
Date: Fri, 4 Dec 2009 19:18:29 -0500

LS0tIGlycS5jCTIwMDktMDktMjEgMTk6MjQ6MzAuMDAwMDAwMDAwIC0wNTAw
CisrKyBpcnEuYwkyMDA5LTEyLTA0IDE3OjUyOjU5LjAwMDAwMDAwMCAtMDYw
MApAQCAtNDUsNyArNDUsOCBAQAogCiAjZGVmaW5lIFJFRyhhZGRyKSAoKHUz
MiAqKShLU0VHMUFERFIoQVI3X1JFR1NfSVJRKSArIGFkZHIpKQogCi0jZGVm
aW5lIENITkxfT0ZGU0VUKGNobmwpIChDSE5MU19PRkZTRVQgKyAoY2hubCAq
IDQpKQorI2RlZmluZSBDSE5MX09GRlNFVChjaG5sKSAoQ0hOTFNfT0ZGU0VU
ICsgKGNobmwgKiA0KSkgIC8qIHByaW9yaXR5IGZvciBpbnRlcnJ1cHQgY2hu
bCAqLworI2RlZmluZSBMSVRUTEVfVE9fQklHX0VORElBTihpKSAgKDI0LShp
KS84KjggKyAoKGkpJTgpKSAgLyogY29udmVydCB0aGUgYml0IG51bWJlciBm
cm9tIGxpdHRsZSB0byBiaWcgZW5kaW4gd2l0aGluIDMyIGJpdCovCiAKIHN0
YXRpYyB2b2lkIGFyN191bm1hc2tfaXJxKHVuc2lnbmVkIGludCBpcnFfbnIp
Owogc3RhdGljIHZvaWQgYXI3X21hc2tfaXJxKHVuc2lnbmVkIGludCBpcnFf
bnIpOwpAQCAtNzgsMzUgKzc5LDM1IEBACiAKIHN0YXRpYyB2b2lkIGFyN191
bm1hc2tfaXJxKHVuc2lnbmVkIGludCBpcnEpCiB7Ci0Jd3JpdGVsKDEgPDwg
KChpcnEgLSBhcjdfaXJxX2Jhc2UpICUgMzIpLAorCXdyaXRlbCgxPDwgTElU
VExFX1RPX0JJR19FTkRJQU4oaXJxIC0gYXI3X2lycV9iYXNlKSwgCiAJICAg
ICAgIFJFRyhFU1JfT0ZGU0VUKGlycSAtIGFyN19pcnFfYmFzZSkpKTsKIH0K
IAogc3RhdGljIHZvaWQgYXI3X21hc2tfaXJxKHVuc2lnbmVkIGludCBpcnEp
CiB7Ci0Jd3JpdGVsKDEgPDwgKChpcnEgLSBhcjdfaXJxX2Jhc2UpICUgMzIp
LAorCXdyaXRlbCgxPDwgTElUVExFX1RPX0JJR19FTkRJQU4oaXJxIC0gYXI3
X2lycV9iYXNlKSwKIAkgICAgICAgUkVHKEVDUl9PRkZTRVQoaXJxIC0gYXI3
X2lycV9iYXNlKSkpOwogfQogCiBzdGF0aWMgdm9pZCBhcjdfYWNrX2lycSh1
bnNpZ25lZCBpbnQgaXJxKQogewotCXdyaXRlbCgxIDw8ICgoaXJxIC0gYXI3
X2lycV9iYXNlKSAlIDMyKSwKKwl3cml0ZWwoMTw8TElUVExFX1RPX0JJR19F
TkRJQU4oaXJxIC0gYXI3X2lycV9iYXNlKSwKIAkgICAgICAgUkVHKENSX09G
RlNFVChpcnEgLSBhcjdfaXJxX2Jhc2UpKSk7CiB9CiAKIHN0YXRpYyB2b2lk
IGFyN191bm1hc2tfc2VjX2lycSh1bnNpZ25lZCBpbnQgaXJxKQogewotCXdy
aXRlbCgxIDw8IChpcnEgLSBhcjdfaXJxX2Jhc2UgLSA0MCksIFJFRyhTRUNf
RVNSX09GRlNFVCkpOworCXdyaXRlbCgxIDw8IExJVFRMRV9UT19CSUdfRU5E
SUFOKGlycSAtIGFyN19pcnFfYmFzZSAtIDQwKSwgUkVHKFNFQ19FU1JfT0ZG
U0VUKSk7CiB9CiAKIHN0YXRpYyB2b2lkIGFyN19tYXNrX3NlY19pcnEodW5z
aWduZWQgaW50IGlycSkKIHsKLQl3cml0ZWwoMSA8PCAoaXJxIC0gYXI3X2ly
cV9iYXNlIC0gNDApLCBSRUcoU0VDX0VDUl9PRkZTRVQpKTsKKwl3cml0ZWwo
MSA8PCBMSVRUTEVfVE9fQklHX0VORElBTihpcnEgLSBhcjdfaXJxX2Jhc2Ug
LSA0MCksIFJFRyhTRUNfRUNSX09GRlNFVCkpOwogfQogCiBzdGF0aWMgdm9p
ZCBhcjdfYWNrX3NlY19pcnEodW5zaWduZWQgaW50IGlycSkKIHsKLQl3cml0
ZWwoMSA8PCAoaXJxIC0gYXI3X2lycV9iYXNlIC0gNDApLCBSRUcoU0VDX0NS
X09GRlNFVCkpOworCXdyaXRlbCgxIDw8IExJVFRMRV9UT19CSUdfRU5ESUFO
KGlycSAtIGFyN19pcnFfYmFzZSAtIDQwKSwgUkVHKFNFQ19DUl9PRkZTRVQp
KTsKIH0KIAogdm9pZCBfX2luaXQgYXJjaF9pbml0X2lycSh2b2lkKQpAQCAt
MTIzLDE2ICsxMjQsMTYgQEAKIAkgKiBEaXNhYmxlIGludGVycnVwdHMgYW5k
IGNsZWFyIHBlbmRpbmcKIAkgKi8KIAl3cml0ZWwoMHhmZmZmZmZmZiwgUkVH
KEVDUl9PRkZTRVQoMCkpKTsKLQl3cml0ZWwoMHhmZiwgUkVHKEVDUl9PRkZT
RVQoMzIpKSk7CisJd3JpdGVsKDB4ZmYwMDAwMDAsIFJFRyhFQ1JfT0ZGU0VU
KDMyKSkpOwogCXdyaXRlbCgweGZmZmZmZmZmLCBSRUcoU0VDX0VDUl9PRkZT
RVQpKTsKIAl3cml0ZWwoMHhmZmZmZmZmZiwgUkVHKENSX09GRlNFVCgwKSkp
OwotCXdyaXRlbCgweGZmLCBSRUcoQ1JfT0ZGU0VUKDMyKSkpOworCXdyaXRl
bCgweGZmMDAwMDAwLCBSRUcoQ1JfT0ZGU0VUKDMyKSkpOwogCXdyaXRlbCgw
eGZmZmZmZmZmLCBSRUcoU0VDX0NSX09GRlNFVCkpOwogCiAJYXI3X2lycV9i
YXNlID0gYmFzZTsKIAogCWZvciAoaSA9IDA7IGkgPCA0MDsgaSsrKSB7Ci0J
CXdyaXRlbChpLCBSRUcoQ0hOTF9PRkZTRVQoaSkpKTsKKwkJd3JpdGVsKGk8
PDI0LCBSRUcoQ0hOTF9PRkZTRVQoaSkpKTsKIAkJLyogUHJpbWFyeSBJUlEn
cyAqLwogCQlzZXRfaXJxX2NoaXBfYW5kX2hhbmRsZXIoYmFzZSArIGksICZh
cjdfaXJxX3R5cGUsCiAJCQkJCSBoYW5kbGVfZWRnZV9pcnEpOwpAQCAtMTU2
LDE4ICsxNTcsMTggQEAKIAlpbnQgaSwgaXJxOwogCiAJLyogUHJpbWFyeSBJ
UlEncyAqLwotCWlycSA9IHJlYWRsKFJFRyhQSVJfT0ZGU0VUKSkgJiAweDNm
OworCWlycSA9IChyZWFkbChSRUcoUElSX09GRlNFVCkpICYgMHgzZjAwMDAw
MCk+PjI0OwogCWlmIChpcnEpIHsKIAkJZG9fSVJRKGFyN19pcnFfYmFzZSAr
IGlycSk7CiAJCXJldHVybjsKIAl9CiAKIAkvKiBTZWNvbmRhcnkgSVJRJ3Mg
YXJlIGNhc2NhZGVkIHRocm91Z2ggcHJpbWFyeSAnMCcgKi8KLQl3cml0ZWwo
MSwgUkVHKENSX09GRlNFVChpcnEpKSk7CisJd3JpdGVsKDB4MDEwMDAwMDAs
IFJFRyhDUl9PRkZTRVQoaXJxKSkpOwogCXN0YXR1cyA9IHJlYWRsKFJFRyhT
RUNfU1JfT0ZGU0VUKSk7CiAJZm9yIChpID0gMDsgaSA8IDMyOyBpKyspIHsK
IAkJaWYgKHN0YXR1cyAmIDEpIHsKLQkJCWRvX0lSUShhcjdfaXJxX2Jhc2Ug
KyBpICsgNDApOworCQkJZG9fSVJRKGFyN19pcnFfYmFzZSArIExJVFRMRV9U
T19CSUdfRU5ESUFOKGkpICsgNDApOwogCQkJcmV0dXJuOwogCQl9CiAJCXN0
YXR1cyA+Pj0gMTsK

--_----------=_125997230975970--


From David.Daney@caviumnetworks.com Sat Dec  5 02:51:28 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 05 Dec 2009 02:51:32 +0100 (CET)
Received: from smtp2.caviumnetworks.com ([209.113.159.134]:1293 "EHLO
        smtp2.caviumnetworks.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494089AbZLEBv2 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sat, 5 Dec 2009 02:51:28 +0100
Received: from maexch1.caveonetworks.com (Not Verified[192.168.14.20]) by smtp2.caviumnetworks.com with MailMarshal (v6,5,4,7535)
        id <B4b19bbb10001>; Fri, 04 Dec 2009 20:47:29 -0500
Received: from caexch01.caveonetworks.com ([192.168.16.9]) by maexch1.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);
         Fri, 4 Dec 2009 20:51:22 -0500
Received: from caexch01.caveonetworks.com ([192.168.16.9]) by caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);
         Fri, 4 Dec 2009 17:45:02 -0800
Received: from dd1.caveonetworks.com ([12.108.191.236]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959);
         Fri, 4 Dec 2009 17:45:02 -0800
Received: from dd1.caveonetworks.com (localhost.localdomain [127.0.0.1])
        by dd1.caveonetworks.com (8.14.2/8.14.2) with ESMTP id nB51ivKH024669;
        Fri, 4 Dec 2009 17:44:57 -0800
Received: (from ddaney@localhost)
        by dd1.caveonetworks.com (8.14.2/8.14.2/Submit) id nB51iv4b024668;
        Fri, 4 Dec 2009 17:44:57 -0800
From:   David Daney <ddaney@caviumnetworks.com>
To:     torvalds@linux-foundation.org, akpm@linux-foundation.org
Cc:     linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
        David Daney <ddaney@caviumnetworks.com>,
        Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: [PATCH 3/5] MIPS: Convert BUG() to use unreachable()
Date:   Fri,  4 Dec 2009 17:44:52 -0800
Message-Id: <1259977494-24636-3-git-send-email-ddaney@caviumnetworks.com>
X-Mailer: git-send-email 1.6.0.6
In-Reply-To: <4B19BAD3.1000808@caviumnetworks.com>
References: <4B19BAD3.1000808@caviumnetworks.com>
X-OriginalArrivalTime: 05 Dec 2009 01:45:02.0146 (UTC) FILETIME=[8FA5EA20:01CA754C]
Return-Path: <David.Daney@caviumnetworks.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25327
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ddaney@caviumnetworks.com
Precedence: bulk
X-list: linux-mips

Use the new unreachable() macro instead of while(1);

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
---
 arch/mips/include/asm/bug.h |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/bug.h b/arch/mips/include/asm/bug.h
index 6cf29c2..540c98a 100644
--- a/arch/mips/include/asm/bug.h
+++ b/arch/mips/include/asm/bug.h
@@ -11,9 +11,7 @@
 static inline void __noreturn BUG(void)
 {
 	__asm__ __volatile__("break %0" : : "i" (BRK_BUG));
-	/* Fool GCC into thinking the function doesn't return. */
-	while (1)
-		;
+	unreachable();
 }
 
 #define HAVE_ARCH_BUG
-- 
1.6.2.5


From ralf@linux-mips.org Sat Dec  5 11:41:59 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 05 Dec 2009 11:42:03 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:48426 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1492230AbZLEKl7 (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Sat, 5 Dec 2009 11:41:59 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB5AfwmJ011844;
        Sat, 5 Dec 2009 10:41:58 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB5Afw3Y011842;
        Sat, 5 Dec 2009 10:41:58 GMT
Date:   Sat, 5 Dec 2009 10:41:58 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Dmitri Vorobiev <dmitri.vorobiev@movial.com>
Cc:     linux-mips@linux-mips.org
Subject: Re: [PATCH 1/3] [MIPS] mipssim: remove unused code
Message-ID: <20091205104158.GA11800@linux-mips.org>
References: <1255546939-3302-1-git-send-email-dmitri.vorobiev@movial.com>
 <1255546939-3302-2-git-send-email-dmitri.vorobiev@movial.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1255546939-3302-2-git-send-email-dmitri.vorobiev@movial.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25328
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Oct 14, 2009 at 10:02:17PM +0300, Dmitri Vorobiev wrote:

> The function prom_init_cmdline() doesn't do anything, and nobody calls
> the prom_getcmdline() function. Since these two are the only functions
> in the file arch/mips/mipssim/sim_cmdline.c, the whole file can be
> removed now along with the call to the no-op prom_init_cmdline()
> routine.
> 
> Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@movial.com>

And obviously not compile tested:

  CC      arch/mips/mipssim/sim_int.o
make[3]: *** No rule to make target `arch/mips/mipssim/sim_cmdline.o', needed by `arch/mips/mipssim/built-in.o'.  Stop.
make[2]: *** [arch/mips/mipssim] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2

  Ralf

From dmitri.vorobiev@movial.com Sat Dec  5 13:10:23 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 05 Dec 2009 13:10:26 +0100 (CET)
Received: from gw03.mail.saunalahti.fi ([195.197.172.111]:58566 "EHLO
        gw03.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491137AbZLEMKX (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sat, 5 Dec 2009 13:10:23 +0100
Received: from localhost.localdomain (a88-114-227-145.elisa-laajakaista.fi [88.114.227.145])
        by gw03.mail.saunalahti.fi (Postfix) with ESMTP id 6271A2166F6;
        Sat,  5 Dec 2009 14:10:18 +0200 (EET)
From:   Dmitri Vorobiev <dmitri.vorobiev@movial.com>
To:     linux-mips@linux-mips.org, ralf@linux-mips.org
Cc:     Dmitri Vorobiev <dmitri.vorobiev@movial.com>
Subject: [PATCH] [MIPS] Fix MIPSsim build after command-line cleanup
Date:   Sat,  5 Dec 2009 14:09:20 +0200
Message-Id: <1260014960-16415-1-git-send-email-dmitri.vorobiev@movial.com>
X-Mailer: git-send-email 1.6.3.3
In-Reply-To: <20091205104158.GA11800@linux-mips.org>
References: <20091205104158.GA11800@linux-mips.org>
Return-Path: <dmitri.vorobiev@movial.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25329
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: dmitri.vorobiev@movial.com
Precedence: bulk
X-list: linux-mips

Commit `MIPSsim: Remove unused code' removed the file
arch/mips/mipssim/sim_cmdline.c but did not clean the
reference to the corresponding object file.  This patch
is to fix the build breakage resulted from the above.

Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@movial.com>
---
 arch/mips/mipssim/Makefile |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/mips/mipssim/Makefile b/arch/mips/mipssim/Makefile
index 57f43c1..41b9657 100644
--- a/arch/mips/mipssim/Makefile
+++ b/arch/mips/mipssim/Makefile
@@ -17,8 +17,7 @@
 # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 
-obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o \
-	 sim_cmdline.o
+obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o
 
 obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
 obj-$(CONFIG_MIPS_MT_SMTC) += sim_smtc.o
-- 
1.6.3.3


From wuzhangjin@gmail.com Sun Dec  6 08:05:07 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:05:10 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:38190 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492205AbZLFHFH (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:07 +0100
Received: by pzk35 with SMTP id 35so3285699pzk.22
        for <multiple recipients>; Sat, 05 Dec 2009 23:04:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer;
        bh=yq9kr6E3UVH3ILMGv6CSjtPZq7gH80WBhZaqzNDw1ek=;
        b=BE7LgLFidT8ylpA4v+FBT8oikSAPkFrpXFwQ2gJv64hIRIvodT89sMMVbgJ2x0zqMp
         7nwfN2EJprgPtVCOstdra5HSXKJhprXqCvI0CrdhYhyV4kG3GYDxBe7hls2TH3iB6fXV
         tj2IL0B9cpLrJ2Gw3qkpxC+asP19BmnGm+Kxw=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer;
        b=ZmAETzC20VVoobcXgsvcLOIIUj73MxqzKsdzQiMt6Ke8YtnZeEwh9AUyryFejqxqxO
         94fUHEaMCpFcQCfSLQOTJZvPMCAoxvmYvZu7SnTIeKjzgSXJO9/18djqipvgd4DIahSB
         0kroY68B31uGK4ylXpSTsI/bL5ziSLFOXkxZo=
Received: by 10.115.66.24 with SMTP id t24mr8156297wak.188.1260083099386;
        Sat, 05 Dec 2009 23:04:59 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.04.53
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:04:58 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 0/8] Loongson: YeeLoong: add platform drivers 
Date:   Sun,  6 Dec 2009 15:01:40 +0800
Message-Id: <cover.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25330
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patchset adds platform specific drivers for YeeLoong netbook. including
the backlight, battery, hwmon, video output, suspend and hotkey(input)
subdrivers. These drivers provide standard interfaces to the user-space
applications to manage the related devices.

This v8 revision incorporates with the feedbacks from Pavel Machek, add the
cleanups of the hwmon, video output and input/hotkey drivers.

Hi, Ralf and Andrew Morton

Could you please queue this patchset for 2.6.33? of course, any new feedbacks
are welcome, thanks!

Best Regards,
	Wu Zhangjin

Wu Zhangjin (8):
  MIPS: add subdirectory for platform extension drivers
  Loongson: YeeLoong: add platform driver
  Loongson: YeeLoong: add backlight driver
  Loongson: YeeLoong: add battery driver
  Loongson: YeeLoong: add hardware monitoring driver
  Loongson: YeeLoong: add video output driver
  Loongson: YeeLoong: add suspend support
  Loongson: YeeLoong: add input/hotkey driver

 arch/mips/include/asm/mach-loongson/ec_kb3310b.h |  191 ++++
 arch/mips/include/asm/mach-loongson/loongson.h   |    6 +
 arch/mips/loongson/common/cmdline.c              |    8 +
 arch/mips/loongson/lemote-2f/Makefile            |    2 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c        |   12 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.h        |  188 ----
 arch/mips/loongson/lemote-2f/platform.c          |   40 +
 arch/mips/loongson/lemote-2f/pm.c                |    4 +-
 arch/mips/loongson/lemote-2f/reset.c             |    2 +-
 drivers/platform/Kconfig                         |    4 +
 drivers/platform/Makefile                        |    1 +
 drivers/platform/mips/Kconfig                    |   33 +
 drivers/platform/mips/Makefile                   |    5 +
 drivers/platform/mips/yeeloong_laptop.c          | 1038 ++++++++++++++++++++++
 14 files changed, 1334 insertions(+), 200 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-loongson/ec_kb3310b.h
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/platform.c
 create mode 100644 drivers/platform/mips/Kconfig
 create mode 100644 drivers/platform/mips/Makefile
 create mode 100644 drivers/platform/mips/yeeloong_laptop.c


From wuzhangjin@gmail.com Sun Dec  6 08:05:28 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:05:34 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:34471 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492213AbZLFHFP (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:15 +0100
Received: by pwi18 with SMTP id 18so1914974pwi.24
        for <multiple recipients>; Sat, 05 Dec 2009 23:05:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=PNF4dJpdw1GFSGioxoxLVbk5cfqDx1ILIbM+Fq9ACSo=;
        b=m86M+R6sWMjjF9XrOabsLAck2gWy4XJv08VEJI1eWTkQlAbtOJR21sh27mAglQGBgd
         HpKbYezkoG+MISzJdQyEg1tDUVV5hgHrx8sGperEJrSeafLfMz/9Cs2mE81pJDNIGyD9
         bMnVDH9x5Vy43x2wq4bEyyQNGfSJi+gv/qCTg=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=W1rQE+mK1nqqibDK83IsPNJb/zhp4rHk3v1BeDNLIB787GIOAt0Qfgn1xyEWnDFxlG
         lEMnKHvcIKzCKqxfqjrh0bve7A/9k1mROahr9fbnKcjCe26XHjXzdAj2si46M4h/XIpo
         QgACTjlNRQYTEZSKaG/dk0JuNxO7dcUuUD1nQ=
Received: by 10.115.103.7 with SMTP id f7mr8398095wam.1.1260083108007;
        Sat, 05 Dec 2009 23:05:08 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.05.02
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:05:07 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 1/8] MIPS: add subdirectory for platform extension drivers
Date:   Sun,  6 Dec 2009 15:01:41 +0800
Message-Id: <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25331
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

It is really hard to split the platform specific subdrivers into
different subsystems, which will generate lots of duplicated source
code, break the whole support into several pieces and also will make the
users be difficult to choose the suitable subdrivers in different
places.

So, I did like the forks have done under drivers/platform/x86, created
the drivers/platform/mips/ for putting the future MIPS netbook/laptop/pc
extension drivers in.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/Kconfig      |    4 ++++
 drivers/platform/mips/Kconfig |   18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 drivers/platform/mips/Kconfig

diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig
index 9652c3f..2319c0b 100644
--- a/drivers/platform/Kconfig
+++ b/drivers/platform/Kconfig
@@ -3,3 +3,7 @@
 if X86
 source "drivers/platform/x86/Kconfig"
 endif
+
+if MIPS
+source "drivers/platform/mips/Kconfig"
+endif
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
new file mode 100644
index 0000000..2f77693
--- /dev/null
+++ b/drivers/platform/mips/Kconfig
@@ -0,0 +1,18 @@
+#
+# MIPS Platform Specific Drivers
+#
+
+menuconfig MIPS_PLATFORM_DEVICES
+	bool "MIPS Platform Specific Device Drivers"
+	default y
+	help
+	  Say Y here to get to see options for device drivers of various
+	  MIPS platforms, including vendor-specific netbook/laptop/pc extension
+	  drivers.  This option alone does not add any kernel code.
+
+	  If you say N, all options in this submenu will be skipped and disabled.
+
+if MIPS_PLATFORM_DEVICES
+
+
+endif # MIPS_PLATFORM_DEVICES
-- 
1.6.2.1


From wuzhangjin@gmail.com Sun Dec  6 08:05:52 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:05:57 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:34471 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492216AbZLFHFQ (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:16 +0100
Received: by mail-pw0-f45.google.com with SMTP id 18so1914974pwi.24
        for <multiple recipients>; Sat, 05 Dec 2009 23:05:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=xwI/7guCwvfjeeBll+idPxoe1Dre8JItubBi9oFj5Lk=;
        b=v8ydOSbbR+Lf7pfSfQHFjA1QQtdtVJdWy/iVb25D3MybDpisjaDVIykx2nA8vw7jYX
         txkP7dPBW/H2iJMkrjo1raf1TBkFRwjVvK0cmW70qPZJBdiJqR2caxXwFFGjTYRjAzyH
         H3/7E6A49iO4ZnFpj/gMYEhG12qzTJM5Zoaek=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=vK+/ZULEPcOJcRdiEvbgSGiuQi4x596vY5zcmSDl/Q4uDBHfKAsUz+6iKoATJ/cCf8
         eU8znkyMWCxTqe1i87X2cx2oFjrHkBZf0elY/Z4nw+obFRywldolCLfsAIDdjgwM8Wbw
         UFgMuOEqZQQgd3L/GdYVMsNfsGAU9ljhEFxlE=
Received: by 10.114.29.15 with SMTP id c15mr8318068wac.16.1260083115409;
        Sat, 05 Dec 2009 23:05:15 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.05.08
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:05:14 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 2/8] Loongson: YeeLoong: add platform driver
Date:   Sun,  6 Dec 2009 15:01:42 +0800
Message-Id: <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25332
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds platform driver for YeeLoong, Currently, This driver is
"empty", the subdrivers will be added in the coming patches.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/mach-loongson/ec_kb3310b.h |  191 ++++++++++++++++++++++
 arch/mips/loongson/lemote-2f/Makefile            |    2 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c        |   12 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.h        |  188 ---------------------
 arch/mips/loongson/lemote-2f/platform.c          |   40 +++++
 arch/mips/loongson/lemote-2f/pm.c                |    4 +-
 arch/mips/loongson/lemote-2f/reset.c             |    2 +-
 drivers/platform/Makefile                        |    1 +
 drivers/platform/mips/Kconfig                    |    8 +
 drivers/platform/mips/Makefile                   |    5 +
 drivers/platform/mips/yeeloong_laptop.c          |   60 +++++++
 11 files changed, 313 insertions(+), 200 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-loongson/ec_kb3310b.h
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/platform.c
 create mode 100644 drivers/platform/mips/Makefile
 create mode 100644 drivers/platform/mips/yeeloong_laptop.c

diff --git a/arch/mips/include/asm/mach-loongson/ec_kb3310b.h b/arch/mips/include/asm/mach-loongson/ec_kb3310b.h
new file mode 100644
index 0000000..4fccb5d
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/ec_kb3310b.h
@@ -0,0 +1,191 @@
+/*
+ * KB3310B Embedded Controller
+ *
+ *  Copyright (C) 2008 Lemote Inc.
+ *  Author: liujl <liujl@lemote.com>, 2008-03-14
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzhangjin@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _EC_KB3310B_H
+#define _EC_KB3310B_H
+
+extern unsigned char ec_read(unsigned short addr);
+extern void ec_write(unsigned short addr, unsigned char val);
+extern int ec_query_seq(unsigned char cmd);
+extern int ec_query_event_num(void);
+extern int ec_get_event_num(void);
+
+typedef int (*sci_handler) (int status);
+extern sci_handler yeeloong_report_lid_status;
+
+#define SCI_IRQ_NUM 0x0A
+
+/*
+ * The following registers are determined by the EC index configuration.
+ * 1, fill the PORT_HIGH as EC register high part.
+ * 2, fill the PORT_LOW as EC register low part.
+ * 3, fill the PORT_DATA as EC register write data or get the data from it.
+ */
+#define	EC_IO_PORT_HIGH	0x0381
+#define	EC_IO_PORT_LOW	0x0382
+#define	EC_IO_PORT_DATA	0x0383
+
+/*
+ * EC delay time is 500us for register and status access
+ */
+#define	EC_REG_DELAY	500	/* unit : us */
+#define	EC_CMD_TIMEOUT	0x1000
+
+/*
+ * EC access port for SCI communication
+ */
+#define	EC_CMD_PORT		0x66
+#define	EC_STS_PORT		0x66
+#define	EC_DAT_PORT		0x62
+#define	CMD_INIT_IDLE_MODE	0xdd
+#define	CMD_EXIT_IDLE_MODE	0xdf
+#define	CMD_INIT_RESET_MODE	0xd8
+#define	CMD_REBOOT_SYSTEM	0x8c
+#define	CMD_GET_EVENT_NUM	0x84
+#define	CMD_PROGRAM_PIECE	0xda
+
+/* Temperature & Fan registers */
+#define	REG_TEMPERATURE_VALUE	0xF458
+#define	REG_FAN_AUTO_MAN_SWITCH 0xF459
+#define	BIT_FAN_AUTO		0
+#define	BIT_FAN_MANUAL		1
+#define	REG_FAN_CONTROL		0xF4D2
+#define	BIT_FAN_CONTROL_ON	(1 << 0)
+#define	BIT_FAN_CONTROL_OFF	(0 << 0)
+#define	REG_FAN_STATUS		0xF4DA
+#define	BIT_FAN_STATUS_ON	(1 << 0)
+#define	BIT_FAN_STATUS_OFF	(0 << 0)
+#define	REG_FAN_SPEED_HIGH	0xFE22
+#define	REG_FAN_SPEED_LOW	0xFE23
+#define	REG_FAN_SPEED_LEVEL	0xF4CC
+/* Fan speed divider */
+#define	FAN_SPEED_DIVIDER	480000	/* (60*1000*1000/62.5/2)*/
+
+/* Battery registers */
+#define	REG_BAT_DESIGN_CAP_HIGH		0xF77D
+#define	REG_BAT_DESIGN_CAP_LOW		0xF77E
+#define	REG_BAT_FULLCHG_CAP_HIGH	0xF780
+#define	REG_BAT_FULLCHG_CAP_LOW		0xF781
+#define	REG_BAT_DESIGN_VOL_HIGH		0xF782
+#define	REG_BAT_DESIGN_VOL_LOW		0xF783
+#define	REG_BAT_CURRENT_HIGH		0xF784
+#define	REG_BAT_CURRENT_LOW		0xF785
+#define	REG_BAT_VOLTAGE_HIGH		0xF786
+#define	REG_BAT_VOLTAGE_LOW		0xF787
+#define	REG_BAT_TEMPERATURE_HIGH	0xF788
+#define	REG_BAT_TEMPERATURE_LOW		0xF789
+#define	REG_BAT_RELATIVE_CAP_HIGH	0xF492
+#define	REG_BAT_RELATIVE_CAP_LOW	0xF493
+#define	REG_BAT_VENDOR			0xF4C4
+#define	FLAG_BAT_VENDOR_SANYO		0x01
+#define	FLAG_BAT_VENDOR_SIMPLO		0x02
+#define	REG_BAT_CELL_COUNT		0xF4C6
+#define	FLAG_BAT_CELL_3S1P		0x03
+#define	FLAG_BAT_CELL_3S2P		0x06
+#define	REG_BAT_CHARGE			0xF4A2
+#define	FLAG_BAT_CHARGE_DISCHARGE	0x01
+#define	FLAG_BAT_CHARGE_CHARGE		0x02
+#define	FLAG_BAT_CHARGE_ACPOWER		0x00
+#define	REG_BAT_STATUS			0xF4B0
+#define	BIT_BAT_STATUS_LOW		(1 << 5)
+#define	BIT_BAT_STATUS_DESTROY		(1 << 2)
+#define	BIT_BAT_STATUS_FULL		(1 << 1)
+#define	BIT_BAT_STATUS_IN		(1 << 0)
+#define	REG_BAT_CHARGE_STATUS		0xF4B1
+#define	BIT_BAT_CHARGE_STATUS_OVERTEMP	(1 << 2)
+#define	BIT_BAT_CHARGE_STATUS_PRECHG	(1 << 1)
+#define	REG_BAT_STATE			0xF482
+#define	BIT_BAT_STATE_CHARGING		(1 << 1)
+#define	BIT_BAT_STATE_DISCHARGING	(1 << 0)
+#define	REG_BAT_POWER			0xF440
+#define	BIT_BAT_POWER_S3		(1 << 2)
+#define	BIT_BAT_POWER_ON		(1 << 1)
+#define	BIT_BAT_POWER_ACIN		(1 << 0)
+
+/* Audio: rd/wr */
+#define	REG_AUDIO_VOLUME	0xF46C
+#define	REG_AUDIO_MUTE		0xF4E7
+#define	REG_AUDIO_BEEP		0xF4D0
+/* USB port power or not: rd/wr */
+#define	REG_USB0_FLAG		0xF461
+#define	REG_USB1_FLAG		0xF462
+#define	REG_USB2_FLAG		0xF463
+#define	BIT_USB_FLAG_ON		1
+#define	BIT_USB_FLAG_OFF	0
+/* LID */
+#define	REG_LID_DETECT		0xF4BD
+#define	BIT_LID_DETECT_ON	1
+#define	BIT_LID_DETECT_OFF	0
+/* CRT */
+#define	REG_CRT_DETECT		0xF4AD
+#define	BIT_CRT_DETECT_PLUG	1
+#define	BIT_CRT_DETECT_UNPLUG	0
+/* LCD backlight brightness adjust: 9 levels */
+#define	REG_DISPLAY_BRIGHTNESS	0xF4F5
+/* Black screen Status */
+#define	BIT_DISPLAY_LCD_ON	1
+#define	BIT_DISPLAY_LCD_OFF	0
+/* LCD backlight control: off/restore */
+#define	REG_BACKLIGHT_CTRL	0xF7BD
+#define	BIT_BACKLIGHT_ON	1
+#define	BIT_BACKLIGHT_OFF	0
+/* Reset the machine auto-clear: rd/wr */
+#define	REG_RESET		0xF4EC
+#define	BIT_RESET_ON		1
+/* Light the led: rd/wr */
+#define	REG_LED			0xF4C8
+#define	BIT_LED_RED_POWER	(1 << 0)
+#define	BIT_LED_ORANGE_POWER	(1 << 1)
+#define	BIT_LED_GREEN_CHARGE	(1 << 2)
+#define	BIT_LED_RED_CHARGE	(1 << 3)
+#define	BIT_LED_NUMLOCK		(1 << 4)
+/* Test led mode, all led on/off */
+#define	REG_LED_TEST		0xF4C2
+#define	BIT_LED_TEST_IN		1
+#define	BIT_LED_TEST_OUT	0
+/* Camera on/off */
+#define	REG_CAMERA_STATUS	0xF46A
+#define	BIT_CAMERA_STATUS_ON	1
+#define	BIT_CAMERA_STATUS_OFF	0
+#define	REG_CAMERA_CONTROL	0xF7B7
+#define	BIT_CAMERA_CONTROL_OFF	0
+#define	BIT_CAMERA_CONTROL_ON	1
+/* Wlan Status */
+#define	REG_WLAN		0xF4FA
+#define	BIT_WLAN_ON		1
+#define	BIT_WLAN_OFF		0
+#define	REG_DISPLAY_LCD		0xF79F
+
+/* SCI Event Number from EC */
+enum {
+	EVENT_LID = 0x23,	/*  Turn on/off LID */
+	EVENT_DISPLAY_TOGGLE,	/*  Fn+F3 for display switch */
+	EVENT_SLEEP,		/*  Fn+F1 for entering sleep mode */
+	EVENT_OVERTEMP,		/*  Over-temperature happened */
+	EVENT_CRT_DETECT,	/*  CRT is connected */
+	EVENT_CAMERA,		/*  Camera on/off */
+	EVENT_USB_OC2,		/*  USB2 Over Current occurred */
+	EVENT_USB_OC0,		/*  USB0 Over Current occurred */
+	EVENT_BLACK_SCREEN,	/*  Turn on/off backlight */
+	EVENT_AUDIO_MUTE,	/*  Mute on/off */
+	EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
+	EVENT_AC_BAT,		/*  AC & Battery relative issue */
+	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
+	EVENT_WLAN,		/*  Wlan on/off */
+};
+
+#define EVENT_START	EVENT_LID
+#define EVENT_END	EVENT_WLAN
+
+#endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson/lemote-2f/Makefile
index 4d84b27..470156e 100644
--- a/arch/mips/loongson/lemote-2f/Makefile
+++ b/arch/mips/loongson/lemote-2f/Makefile
@@ -2,7 +2,7 @@
 # Makefile for lemote loongson2f family machines
 #
 
-obj-y += irq.o reset.o ec_kb3310b.o
+obj-y += irq.o reset.o ec_kb3310b.o platform.o
 
 #
 # Suspend Support
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.c b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
index 4d84111..734d2d0 100644
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.c
+++ b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
@@ -14,7 +14,7 @@
 #include <linux/spinlock.h>
 #include <linux/delay.h>
 
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 static DEFINE_SPINLOCK(index_access_lock);
 static DEFINE_SPINLOCK(port_access_lock);
@@ -76,12 +76,9 @@ int ec_query_seq(unsigned char cmd)
 	}
 
 	if (timeout <= 0) {
-		printk(KERN_ERR "%s: deadable error : timeout...\n", __func__);
+		pr_err("%s: deadable error : timeout...\n", __func__);
 		ret = -EINVAL;
-	} else
-		printk(KERN_INFO
-			   "(%x/%d)ec issued command %d status : 0x%x\n",
-			   timeout, EC_CMD_TIMEOUT - timeout, cmd, status);
+	}
 
 	spin_unlock_irqrestore(&port_access_lock, flags);
 
@@ -118,8 +115,7 @@ int ec_get_event_num(void)
 		udelay(EC_REG_DELAY);
 	}
 	if (timeout <= 0) {
-		pr_info("%s: get event number timeout.\n", __func__);
-
+		pr_err("%s: get event number timeout.\n", __func__);
 		return -EINVAL;
 	}
 	value = inb(EC_DAT_PORT);
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/ec_kb3310b.h
deleted file mode 100644
index 1595a21..0000000
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * KB3310B Embedded Controller
- *
- *  Copyright (C) 2008 Lemote Inc.
- *  Author: liujl <liujl@lemote.com>, 2008-03-14
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _EC_KB3310B_H
-#define _EC_KB3310B_H
-
-extern unsigned char ec_read(unsigned short addr);
-extern void ec_write(unsigned short addr, unsigned char val);
-extern int ec_query_seq(unsigned char cmd);
-extern int ec_query_event_num(void);
-extern int ec_get_event_num(void);
-
-typedef int (*sci_handler) (int status);
-extern sci_handler yeeloong_report_lid_status;
-
-#define SCI_IRQ_NUM 0x0A
-
-/*
- * The following registers are determined by the EC index configuration.
- * 1, fill the PORT_HIGH as EC register high part.
- * 2, fill the PORT_LOW as EC register low part.
- * 3, fill the PORT_DATA as EC register write data or get the data from it.
- */
-#define	EC_IO_PORT_HIGH	0x0381
-#define	EC_IO_PORT_LOW	0x0382
-#define	EC_IO_PORT_DATA	0x0383
-
-/*
- * EC delay time is 500us for register and status access
- */
-#define	EC_REG_DELAY	500	/* unit : us */
-#define	EC_CMD_TIMEOUT	0x1000
-
-/*
- * EC access port for SCI communication
- */
-#define	EC_CMD_PORT		0x66
-#define	EC_STS_PORT		0x66
-#define	EC_DAT_PORT		0x62
-#define	CMD_INIT_IDLE_MODE	0xdd
-#define	CMD_EXIT_IDLE_MODE	0xdf
-#define	CMD_INIT_RESET_MODE	0xd8
-#define	CMD_REBOOT_SYSTEM	0x8c
-#define	CMD_GET_EVENT_NUM	0x84
-#define	CMD_PROGRAM_PIECE	0xda
-
-/* temperature & fan registers */
-#define	REG_TEMPERATURE_VALUE	0xF458
-#define	REG_FAN_AUTO_MAN_SWITCH 0xF459
-#define	BIT_FAN_AUTO		0
-#define	BIT_FAN_MANUAL		1
-#define	REG_FAN_CONTROL		0xF4D2
-#define	BIT_FAN_CONTROL_ON	(1 << 0)
-#define	BIT_FAN_CONTROL_OFF	(0 << 0)
-#define	REG_FAN_STATUS		0xF4DA
-#define	BIT_FAN_STATUS_ON	(1 << 0)
-#define	BIT_FAN_STATUS_OFF	(0 << 0)
-#define	REG_FAN_SPEED_HIGH	0xFE22
-#define	REG_FAN_SPEED_LOW	0xFE23
-#define	REG_FAN_SPEED_LEVEL	0xF4CC
-/* fan speed divider */
-#define	FAN_SPEED_DIVIDER	480000	/* (60*1000*1000/62.5/2)*/
-
-/* battery registers */
-#define	REG_BAT_DESIGN_CAP_HIGH		0xF77D
-#define	REG_BAT_DESIGN_CAP_LOW		0xF77E
-#define	REG_BAT_FULLCHG_CAP_HIGH	0xF780
-#define	REG_BAT_FULLCHG_CAP_LOW		0xF781
-#define	REG_BAT_DESIGN_VOL_HIGH		0xF782
-#define	REG_BAT_DESIGN_VOL_LOW		0xF783
-#define	REG_BAT_CURRENT_HIGH		0xF784
-#define	REG_BAT_CURRENT_LOW		0xF785
-#define	REG_BAT_VOLTAGE_HIGH		0xF786
-#define	REG_BAT_VOLTAGE_LOW		0xF787
-#define	REG_BAT_TEMPERATURE_HIGH	0xF788
-#define	REG_BAT_TEMPERATURE_LOW		0xF789
-#define	REG_BAT_RELATIVE_CAP_HIGH	0xF492
-#define	REG_BAT_RELATIVE_CAP_LOW	0xF493
-#define	REG_BAT_VENDOR			0xF4C4
-#define	FLAG_BAT_VENDOR_SANYO		0x01
-#define	FLAG_BAT_VENDOR_SIMPLO		0x02
-#define	REG_BAT_CELL_COUNT		0xF4C6
-#define	FLAG_BAT_CELL_3S1P		0x03
-#define	FLAG_BAT_CELL_3S2P		0x06
-#define	REG_BAT_CHARGE			0xF4A2
-#define	FLAG_BAT_CHARGE_DISCHARGE	0x01
-#define	FLAG_BAT_CHARGE_CHARGE		0x02
-#define	FLAG_BAT_CHARGE_ACPOWER		0x00
-#define	REG_BAT_STATUS			0xF4B0
-#define	BIT_BAT_STATUS_LOW		(1 << 5)
-#define	BIT_BAT_STATUS_DESTROY		(1 << 2)
-#define	BIT_BAT_STATUS_FULL		(1 << 1)
-#define	BIT_BAT_STATUS_IN		(1 << 0)
-#define	REG_BAT_CHARGE_STATUS		0xF4B1
-#define	BIT_BAT_CHARGE_STATUS_OVERTEMP	(1 << 2)
-#define	BIT_BAT_CHARGE_STATUS_PRECHG	(1 << 1)
-#define	REG_BAT_STATE			0xF482
-#define	BIT_BAT_STATE_CHARGING		(1 << 1)
-#define	BIT_BAT_STATE_DISCHARGING	(1 << 0)
-#define	REG_BAT_POWER			0xF440
-#define	BIT_BAT_POWER_S3		(1 << 2)
-#define	BIT_BAT_POWER_ON		(1 << 1)
-#define	BIT_BAT_POWER_ACIN		(1 << 0)
-
-/* other registers */
-/* Audio: rd/wr */
-#define	REG_AUDIO_VOLUME	0xF46C
-#define	REG_AUDIO_MUTE		0xF4E7
-#define	REG_AUDIO_BEEP		0xF4D0
-/* USB port power or not: rd/wr */
-#define	REG_USB0_FLAG		0xF461
-#define	REG_USB1_FLAG		0xF462
-#define	REG_USB2_FLAG		0xF463
-#define	BIT_USB_FLAG_ON		1
-#define	BIT_USB_FLAG_OFF	0
-/* LID */
-#define	REG_LID_DETECT		0xF4BD
-#define	BIT_LID_DETECT_ON	1
-#define	BIT_LID_DETECT_OFF	0
-/* CRT */
-#define	REG_CRT_DETECT		0xF4AD
-#define	BIT_CRT_DETECT_PLUG	1
-#define	BIT_CRT_DETECT_UNPLUG	0
-/* LCD backlight brightness adjust: 9 levels */
-#define	REG_DISPLAY_BRIGHTNESS	0xF4F5
-/* Black screen Status */
-#define	BIT_DISPLAY_LCD_ON	1
-#define	BIT_DISPLAY_LCD_OFF	0
-/* LCD backlight control: off/restore */
-#define	REG_BACKLIGHT_CTRL	0xF7BD
-#define	BIT_BACKLIGHT_ON	1
-#define	BIT_BACKLIGHT_OFF	0
-/* Reset the machine auto-clear: rd/wr */
-#define	REG_RESET		0xF4EC
-#define	BIT_RESET_ON		1
-/* Light the led: rd/wr */
-#define	REG_LED			0xF4C8
-#define	BIT_LED_RED_POWER	(1 << 0)
-#define	BIT_LED_ORANGE_POWER	(1 << 1)
-#define	BIT_LED_GREEN_CHARGE	(1 << 2)
-#define	BIT_LED_RED_CHARGE	(1 << 3)
-#define	BIT_LED_NUMLOCK		(1 << 4)
-/* Test led mode, all led on/off */
-#define	REG_LED_TEST		0xF4C2
-#define	BIT_LED_TEST_IN		1
-#define	BIT_LED_TEST_OUT	0
-/* Camera on/off */
-#define	REG_CAMERA_STATUS	0xF46A
-#define	BIT_CAMERA_STATUS_ON	1
-#define	BIT_CAMERA_STATUS_OFF	0
-#define	REG_CAMERA_CONTROL	0xF7B7
-#define	BIT_CAMERA_CONTROL_OFF	0
-#define	BIT_CAMERA_CONTROL_ON	1
-/* Wlan Status */
-#define	REG_WLAN		0xF4FA
-#define	BIT_WLAN_ON		1
-#define	BIT_WLAN_OFF		0
-#define	REG_DISPLAY_LCD		0xF79F
-
-/* SCI Event Number from EC */
-enum {
-	EVENT_LID = 0x23,	/*  LID open/close */
-	EVENT_DISPLAY_TOGGLE,	/*  Fn+F3 for display switch */
-	EVENT_SLEEP,		/*  Fn+F1 for entering sleep mode */
-	EVENT_OVERTEMP,		/*  Over-temperature happened */
-	EVENT_CRT_DETECT,	/*  CRT is connected */
-	EVENT_CAMERA,		/*  Camera on/off */
-	EVENT_USB_OC2,		/*  USB2 Over Current occurred */
-	EVENT_USB_OC0,		/*  USB0 Over Current occurred */
-	EVENT_BLACK_SCREEN,	/*  Turn on/off backlight */
-	EVENT_AUDIO_MUTE,	/*  Mute on/off */
-	EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
-	EVENT_AC_BAT,		/*  AC & Battery relative issue */
-	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
-	EVENT_WLAN,		/*  Wlan on/off */
-	EVENT_END
-};
-
-#endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/platform.c b/arch/mips/loongson/lemote-2f/platform.c
new file mode 100644
index 0000000..0e7b27d
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/platform.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzj@lemote.com
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+#include <asm/bootinfo.h>
+
+static struct platform_device yeeloong_pdev = {
+	.name = "yeeloong_laptop",
+	.id = -1,
+};
+
+static int __init lemote2f_platform_init(void)
+{
+	struct platform_device *pdev = NULL;
+
+	switch (mips_machtype) {
+	case MACH_LEMOTE_YL2F89:
+		pdev = &yeeloong_pdev;
+		break;
+	default:
+		break;
+
+	}
+
+	if (pdev != NULL)
+		return platform_device_register(pdev);
+
+	return -ENODEV;
+}
+
+arch_initcall(lemote2f_platform_init);
diff --git a/arch/mips/loongson/lemote-2f/pm.c b/arch/mips/loongson/lemote-2f/pm.c
index d7af2e6..0d5698a 100644
--- a/arch/mips/loongson/lemote-2f/pm.c
+++ b/arch/mips/loongson/lemote-2f/pm.c
@@ -23,7 +23,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536_mfgpt.h>
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 #define I8042_KBD_IRQ		1
 #define I8042_CTR_KBDINT	0x01
@@ -100,7 +100,7 @@ int wakeup_loongson(void)
 	if (irq < 0)
 		return 0;
 
-	printk(KERN_INFO "%s: irq = %d\n", __func__, irq);
+	pr_info("%s: irq = %d\n", __func__, irq);
 
 	if (irq == I8042_KBD_IRQ)
 		return 1;
diff --git a/arch/mips/loongson/lemote-2f/reset.c b/arch/mips/loongson/lemote-2f/reset.c
index 51d1a60..4627659 100644
--- a/arch/mips/loongson/lemote-2f/reset.c
+++ b/arch/mips/loongson/lemote-2f/reset.c
@@ -20,7 +20,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536.h>
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 static void reset_cpu(void)
 {
diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile
index 782953a..8bdc97c 100644
--- a/drivers/platform/Makefile
+++ b/drivers/platform/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_X86)		+= x86/
+obj-$(CONFIG_MIPS)		+= mips/
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 2f77693..5ac5215 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -14,5 +14,13 @@ menuconfig MIPS_PLATFORM_DEVICES
 
 if MIPS_PLATFORM_DEVICES
 
+config LEMOTE_YEELOONG2F
+	tristate "Lemote YeeLoong Laptop"
+	depends on LEMOTE_MACH2F
+	help
+	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
+	  compatible to FuLoong2F mini PC, but it has an extra Embedded
+	  Controller(kb3310b) for battery, hotkey, backlight, temperature and
+	  fan management.
 
 endif # MIPS_PLATFORM_DEVICES
diff --git a/drivers/platform/mips/Makefile b/drivers/platform/mips/Makefile
new file mode 100644
index 0000000..506f920
--- /dev/null
+++ b/drivers/platform/mips/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for MIPS Platform-Specific Drivers
+#
+
+obj-$(CONFIG_LEMOTE_YEELOONG2F)	+= yeeloong_laptop.o
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
new file mode 100644
index 0000000..85fc7ed
--- /dev/null
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -0,0 +1,60 @@
+/*
+ * Driver for YeeLoong laptop extras
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+static struct platform_device_id platform_device_ids[] = {
+	{
+		.name = "yeeloong_laptop",
+	},
+	{}
+};
+
+MODULE_DEVICE_TABLE(platform, platform_device_ids);
+
+static struct platform_driver platform_driver = {
+	.driver = {
+		   .name = "yeeloong_laptop",
+		   .owner = THIS_MODULE,
+		   },
+	.id_table = platform_device_ids,
+};
+
+static int __init yeeloong_init(void)
+{
+	int ret;
+
+	pr_info("Load YeeLoong Laptop Platform Specific Driver.\n");
+
+	/* Register platform stuff */
+	ret = platform_driver_register(&platform_driver);
+	if (ret) {
+		pr_err("Fail to register yeeloong platform driver.\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static void __exit yeeloong_exit(void)
+{
+	platform_driver_unregister(&platform_driver);
+
+	pr_info("Unload YeeLoong Platform Specific Driver.\n");
+}
+
+module_init(yeeloong_init);
+module_exit(yeeloong_exit);
+
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop driver");
+MODULE_LICENSE("GPL");
-- 
1.6.2.1


From wuzhangjin@gmail.com Sun Dec  6 08:06:16 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:06:21 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:38190 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492227AbZLFHF1 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:27 +0100
Received: by mail-pz0-f197.google.com with SMTP id 35so3285699pzk.22
        for <multiple recipients>; Sat, 05 Dec 2009 23:05:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=iXdsk6nDQF2cuKR6mFuFayPQMRX+rg+n+fBSTHXgP7Q=;
        b=reEVBQkCwz1arN6nWqhUCEb2wsqjkt22qX7yN+U2q4KVl3avqvKpRiacjGBooSdXUm
         zgY1N01d3bB0W9dDHj2yKpS5KhUiJWqIY3xoN6m4hCzerGUCIaRTklYqPqkfTped8o6c
         MLucUuSpJYL6OrWK7uwGdcUFZEoseUA9Msszg=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=Ulqa1+zmA1sJa27CSiTxH8BfpJlTOsGTlqzT8xWQaI+8sbnUmvbIYxxbD1lKTYoPqv
         DzcsTmcGVSzcYUteA7/QuLWF0vA4EZ5/LuMlGvfCZwWldHTY2GFUeKc1iWYFQFiN8Wop
         GHMJfGI3U3IFhFKoXYiIjb9PFFQSi7QnYLBu8=
Received: by 10.114.23.4 with SMTP id 4mr8353932waw.28.1260083126732;
        Sat, 05 Dec 2009 23:05:26 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.05.21
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:05:26 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 4/8] Loongson: YeeLoong: add battery driver
Date:   Sun,  6 Dec 2009 15:01:44 +0800
Message-Id: <57ed2090c7f1a1a9c0e31d457617c7473b9e29ad.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
 <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
 <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25333
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds APM emulated Battery Driver, it provides standard
interface(/proc/apm) for user-space applications(e.g. kpowersave,
gnome-power-manager) to manage the battery.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    2 +
 drivers/platform/mips/yeeloong_laptop.c |  108 ++++++++++++++++++++++++++++++-
 2 files changed, 108 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index c1ba03d..965933b 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -18,6 +18,8 @@ config LEMOTE_YEELOONG2F
 	tristate "Lemote YeeLoong Laptop"
 	depends on LEMOTE_MACH2F
 	select BACKLIGHT_CLASS_DEVICE
+	select SYS_SUPPORTS_APM_EMULATION
+	select APM_EMULATION
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index f04a7e2..0d9f2a6 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -2,7 +2,7 @@
  * Driver for YeeLoong laptop extras
  *
  *  Copyright (C) 2009 Lemote Inc.
- *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *  Author: Wu Zhangjin <wuzj@lemote.com>, Liu Junliang <liujl@lemote.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -13,6 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/backlight.h>	/* for backlight subdriver */
 #include <linux/fb.h>
+#include <linux/apm-emulation.h>/* for battery subdriver */
 
 #include <ec_kb3310b.h>
 
@@ -85,6 +86,106 @@ static void yeeloong_backlight_exit(void)
 	}
 }
 
+/* battery subdriver */
+
+static void get_fixed_battery_info(void)
+{
+	int design_cap, full_charged_cap, design_vol, vendor, cell_count;
+
+	design_cap = (ec_read(REG_BAT_DESIGN_CAP_HIGH) << 8)
+	    | ec_read(REG_BAT_DESIGN_CAP_LOW);
+	full_charged_cap = (ec_read(REG_BAT_FULLCHG_CAP_HIGH) << 8)
+	    | ec_read(REG_BAT_FULLCHG_CAP_LOW);
+	design_vol = (ec_read(REG_BAT_DESIGN_VOL_HIGH) << 8)
+	    | ec_read(REG_BAT_DESIGN_VOL_LOW);
+	vendor = ec_read(REG_BAT_VENDOR);
+	cell_count = ec_read(REG_BAT_CELL_COUNT);
+
+	if (vendor != 0) {
+		pr_info("battery vendor(%s), cells count(%d), "
+		       "with designed capacity(%d),designed voltage(%d),"
+		       " full charged capacity(%d)\n",
+		       (vendor ==
+			FLAG_BAT_VENDOR_SANYO) ? "SANYO" : "SIMPLO",
+		       (cell_count == FLAG_BAT_CELL_3S1P) ? 3 : 6,
+		       design_cap, design_vol,
+		       full_charged_cap);
+	}
+}
+
+#define APM_CRITICAL		5
+
+static void get_power_status(struct apm_power_info *info)
+{
+	unsigned char bat_status;
+
+	info->battery_status = APM_BATTERY_STATUS_UNKNOWN;
+	info->battery_flag = APM_BATTERY_FLAG_UNKNOWN;
+	info->units = APM_UNITS_MINS;
+
+	info->battery_life = (ec_read(REG_BAT_RELATIVE_CAP_HIGH) << 8) |
+		(ec_read(REG_BAT_RELATIVE_CAP_LOW));
+
+	info->ac_line_status = (ec_read(REG_BAT_POWER) & BIT_BAT_POWER_ACIN) ?
+		APM_AC_ONLINE : APM_AC_OFFLINE;
+
+	bat_status = ec_read(REG_BAT_STATUS);
+
+	if (!(bat_status & BIT_BAT_STATUS_IN)) {
+		/* no battery inserted */
+		info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT;
+		info->battery_flag = APM_BATTERY_FLAG_NOT_PRESENT;
+		info->time = 0x00;
+		return;
+	}
+
+	/* adapter inserted */
+	if (info->ac_line_status == APM_AC_ONLINE) {
+		if (!(bat_status & BIT_BAT_STATUS_FULL)) {
+			/* battery is not fully charged */
+			info->battery_status = APM_BATTERY_STATUS_CHARGING;
+			info->battery_flag = APM_BATTERY_FLAG_CHARGING;
+		} else {
+			/* battery is fully charged */
+			info->battery_status = APM_BATTERY_STATUS_HIGH;
+			info->battery_flag = APM_BATTERY_FLAG_HIGH;
+			info->battery_life = 100;
+		}
+	} else {
+		/* battery is too low */
+		if (bat_status & BIT_BAT_STATUS_LOW) {
+			info->battery_status = APM_BATTERY_STATUS_LOW;
+			info->battery_flag = APM_BATTERY_FLAG_LOW;
+			if (info->battery_life <= APM_CRITICAL) {
+				/* we should power off the system now */
+				info->battery_status =
+					APM_BATTERY_STATUS_CRITICAL;
+				info->battery_flag = APM_BATTERY_FLAG_CRITICAL;
+			}
+		} else {
+			/* assume the battery is high enough. */
+			info->battery_status = APM_BATTERY_STATUS_HIGH;
+			info->battery_flag = APM_BATTERY_FLAG_HIGH;
+		}
+	}
+	info->time = ((info->battery_life - 3) * 54 + 142) / 60;
+}
+
+static int yeeloong_battery_init(void)
+{
+	get_fixed_battery_info();
+
+	apm_get_power_status = get_power_status;
+
+	return 0;
+}
+
+static void yeeloong_battery_exit(void)
+{
+	if (apm_get_power_status == get_power_status)
+		apm_get_power_status = NULL;
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -122,11 +223,14 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	yeeloong_battery_init();
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
 
@@ -136,6 +240,6 @@ static void __exit yeeloong_exit(void)
 module_init(yeeloong_init);
 module_exit(yeeloong_exit);
 
-MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>; Liu Junliang <liujl@lemote.com>");
 MODULE_DESCRIPTION("YeeLoong laptop driver");
 MODULE_LICENSE("GPL");
-- 
1.6.2.1


From wuzhangjin@gmail.com Sun Dec  6 08:06:39 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:06:45 +0100 (CET)
Received: from mail-px0-f188.google.com ([209.85.216.188]:63385 "EHLO
        mail-px0-f188.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492205AbZLFHFa (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:30 +0100
Received: by pxi26 with SMTP id 26so1367800pxi.21
        for <multiple recipients>; Sat, 05 Dec 2009 23:05:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=vK6D361y+JwaD6Dzqg+3PAWSkOx9H4gFym52emRSCTQ=;
        b=pOYK19FeqxFLYLFmheBqddekj+f4VkWOhp+Stl5wN9MrAuXNY5p7LUP2CaqAOwGlya
         +G4LcaTg/re006hb3DfQd4E4u7EOynxMeiUN55DFHt1LrVFVbDU6oNYjLmeOtZJ/Y8pi
         zGjXr+4217pUYBWvKPzMXNBZwGcbephy3WHcY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=aciTarY1S7vZ0oqHH9o0FbgMBcYeEpJ/NMjW/Ez5QCgr2rBhd9and/0htglvlizdGm
         LUbZw5X1XGoNWMS4t6mvYXxvK+l3nUMRzp66aESTCha+KysJmK1vSS33DHRqLkJ/zliE
         rLkiB/vLCwuJF529NhsQE6oiE4ZM8aaERrNB0=
Received: by 10.115.101.5 with SMTP id d5mr8408692wam.23.1260083121191;
        Sat, 05 Dec 2009 23:05:21 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.05.15
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:05:20 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 3/8] Loongson: YeeLoong: add backlight driver
Date:   Sun,  6 Dec 2009 15:01:43 +0800
Message-Id: <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
 <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25334
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds YeeLoong Backlight Driver, it provides standard
interface(/sys/class/backlight/) for user-space applications(e.g.
kpowersave, gnome-power-manager) to control the brightness of the
backlight.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |   81 +++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 5ac5215..c1ba03d 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -17,6 +17,7 @@ if MIPS_PLATFORM_DEVICES
 config LEMOTE_YEELOONG2F
 	tristate "Lemote YeeLoong Laptop"
 	depends on LEMOTE_MACH2F
+	select BACKLIGHT_CLASS_DEVICE
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 85fc7ed..f04a7e2 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -11,6 +11,79 @@
 
 #include <linux/err.h>
 #include <linux/platform_device.h>
+#include <linux/backlight.h>	/* for backlight subdriver */
+#include <linux/fb.h>
+
+#include <ec_kb3310b.h>
+
+/* backlight subdriver */
+#define MAX_BRIGHTNESS	8
+
+static int yeeloong_set_brightness(struct backlight_device *bd)
+{
+	unsigned int level, current_level;
+	static unsigned int old_level;
+
+	level = (bd->props.fb_blank == FB_BLANK_UNBLANK &&
+		 bd->props.power == FB_BLANK_UNBLANK) ?
+	    bd->props.brightness : 0;
+
+	if (level > MAX_BRIGHTNESS)
+		level = MAX_BRIGHTNESS;
+	else if (level < 0)
+		level = 0;
+
+	/* Avoid to modify the brightness when EC is tuning it */
+	if (old_level != level) {
+		current_level = ec_read(REG_DISPLAY_BRIGHTNESS);
+		if (old_level == current_level)
+			ec_write(REG_DISPLAY_BRIGHTNESS, level);
+	}
+	old_level = level;
+
+	return 0;
+}
+
+static int yeeloong_get_brightness(struct backlight_device *bd)
+{
+	return ec_read(REG_DISPLAY_BRIGHTNESS);
+}
+
+static struct backlight_ops backlight_ops = {
+	.get_brightness = yeeloong_get_brightness,
+	.update_status = yeeloong_set_brightness,
+};
+
+static struct backlight_device *yeeloong_backlight_dev;
+
+static int yeeloong_backlight_init(void)
+{
+	int ret;
+
+	yeeloong_backlight_dev = backlight_device_register("backlight0", NULL,
+			NULL, &backlight_ops);
+
+	if (IS_ERR(yeeloong_backlight_dev)) {
+		ret = PTR_ERR(yeeloong_backlight_dev);
+		yeeloong_backlight_dev = NULL;
+		return ret;
+	}
+
+	yeeloong_backlight_dev->props.max_brightness = MAX_BRIGHTNESS;
+	yeeloong_backlight_dev->props.brightness =
+		yeeloong_get_brightness(yeeloong_backlight_dev);
+	backlight_update_status(yeeloong_backlight_dev);
+
+	return 0;
+}
+
+static void yeeloong_backlight_exit(void)
+{
+	if (yeeloong_backlight_dev) {
+		backlight_device_unregister(yeeloong_backlight_dev);
+		yeeloong_backlight_dev = NULL;
+	}
+}
 
 static struct platform_device_id platform_device_ids[] = {
 	{
@@ -42,11 +115,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_backlight_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong backlight driver.\n");
+		yeeloong_backlight_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
 
 	pr_info("Unload YeeLoong Platform Specific Driver.\n");
-- 
1.6.2.1


From wuzhangjin@gmail.com Sun Dec  6 08:07:02 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:07:09 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:34471 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492232AbZLFHFe (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:34 +0100
Received: by mail-pw0-f45.google.com with SMTP id 18so1914974pwi.24
        for <multiple recipients>; Sat, 05 Dec 2009 23:05:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=2YFxo6jKnJLvwx05QfAVM3eYlLa4ycaHWmKM2zDrFPQ=;
        b=oai8qqnci7JPVj1bjjurmaJe0gkqmwQj7luOGuvgwrcrdJC7IKurnxWiCgqQ9v6s2B
         kitBpgvF1e8MeCPVG8CH2I1KqLs7Gal+6fiAfBnvHmCDTD/+yfE1IHApH2uW3D3LjBHm
         +6+dVravWcPUGEwAfPdLdQI8ATeewxIxMWJqs=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=q34AjexX6FhUxyuTpHfdemjPzUxgRH/biD9yTBoG4mVmuruLS3qK7neaanC8lOEq+7
         4Ul/SsqLzNuXDx555zk/7Y0Q43yKhMe4pgheGCicbptKrBsLfUtPODWIRP5K3MYgywLM
         NjjNCphr8QAa5n6brqA7m6XAQxw3zdAVb69wY=
Received: by 10.114.83.17 with SMTP id g17mr8301430wab.38.1260083133460;
        Sat, 05 Dec 2009 23:05:33 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.05.27
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:05:33 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring driver
Date:   Sun,  6 Dec 2009 15:01:45 +0800
Message-Id: <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <57ed2090c7f1a1a9c0e31d457617c7473b9e29ad.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
 <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
 <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
 <57ed2090c7f1a1a9c0e31d457617c7473b9e29ad.1260082252.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25335
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds hardware monitoring driver, it provides standard
interface(/sys/class/hwmon/) for lm-sensors/sensors-applet to monitor
the temperatures of CPU and battery, the PWM of fan, the current,
voltage of battery.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |  214 ++++++++++++++++++++++++++++++-
 2 files changed, 211 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 965933b..352594c 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -20,6 +20,7 @@ config LEMOTE_YEELOONG2F
 	select BACKLIGHT_CLASS_DEVICE
 	select SYS_SUPPORTS_APM_EMULATION
 	select APM_EMULATION
+	select HWMON
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 0d9f2a6..78ddfad 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -14,6 +14,8 @@
 #include <linux/backlight.h>	/* for backlight subdriver */
 #include <linux/fb.h>
 #include <linux/apm-emulation.h>/* for battery subdriver */
+#include <linux/hwmon.h>	/* for hwmon subdriver */
+#include <linux/hwmon-sysfs.h>
 
 #include <ec_kb3310b.h>
 
@@ -29,10 +31,7 @@ static int yeeloong_set_brightness(struct backlight_device *bd)
 		 bd->props.power == FB_BLANK_UNBLANK) ?
 	    bd->props.brightness : 0;
 
-	if (level > MAX_BRIGHTNESS)
-		level = MAX_BRIGHTNESS;
-	else if (level < 0)
-		level = 0;
+	level = SENSORS_LIMIT(level, 0, MAX_BRIGHTNESS);
 
 	/* Avoid to modify the brightness when EC is tuning it */
 	if (old_level != level) {
@@ -186,6 +185,205 @@ static void yeeloong_battery_exit(void)
 		apm_get_power_status = NULL;
 }
 
+/* hwmon subdriver */
+
+/* pwm(auto/manual) enable or not */
+static int get_fan_pwm_enable(void)
+{
+	return ec_read(REG_FAN_AUTO_MAN_SWITCH);
+}
+
+static void set_fan_pwm_enable(int manual)
+{
+	ec_write(REG_FAN_AUTO_MAN_SWITCH, !!manual);
+}
+
+static int get_fan_pwm(void)
+{
+	return ec_read(REG_FAN_SPEED_LEVEL);
+}
+
+static void set_fan_pwm(int value)
+{
+	value = SENSORS_LIMIT(value, 0, 3);
+
+	/* We must ensure the fan is on */
+	if (value > 0)
+		ec_write(REG_FAN_CONTROL, BIT_FAN_CONTROL_ON);
+
+	ec_write(REG_FAN_SPEED_LEVEL, value);
+}
+
+static int get_fan_rpm(void)
+{
+	int value;
+
+	value = FAN_SPEED_DIVIDER /
+	    (((ec_read(REG_FAN_SPEED_HIGH) & 0x0f) << 8) |
+	     ec_read(REG_FAN_SPEED_LOW));
+
+	return value;
+}
+
+static int get_cpu_temp(void)
+{
+	s8 value;
+
+	value = ec_read(REG_TEMPERATURE_VALUE);
+
+	return value * 1000;
+}
+
+static int get_battery_temp(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_TEMPERATURE_HIGH) << 8) |
+		(ec_read(REG_BAT_TEMPERATURE_LOW));
+
+	return value * 1000;
+}
+
+static int get_battery_temp_alarm(void)
+{
+	int status;
+
+	status = (ec_read(REG_BAT_CHARGE_STATUS) &
+			BIT_BAT_CHARGE_STATUS_OVERTEMP);
+
+	return !!status;
+}
+
+static int get_battery_current(void)
+{
+	s16 value;
+
+	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
+		(ec_read(REG_BAT_CURRENT_LOW));
+
+	if (value < 0)
+		value = ~value + 1;
+
+	return value;
+}
+
+static int get_battery_voltage(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_VOLTAGE_HIGH) << 8) |
+		(ec_read(REG_BAT_VOLTAGE_LOW));
+
+	return value;
+}
+
+static ssize_t store_sys_hwmon(void (*set) (int), const char *buf, size_t count)
+{
+	int ret;
+	unsigned long value;
+
+	if (!count)
+		return 0;
+
+	ret = strict_strtoul(buf, 10, &value);
+	if (ret)
+		return ret;
+
+	set(value);
+
+	return count;
+}
+
+static ssize_t show_sys_hwmon(int (*get) (void), char *buf)
+{
+	return sprintf(buf, "%d\n", get());
+}
+
+#define CREATE_SENSOR_ATTR(_name, _mode, _set, _get)		\
+	static ssize_t show_##_name(struct device *dev,			\
+				    struct device_attribute *attr,	\
+				    char *buf)				\
+	{								\
+		return show_sys_hwmon(_set, buf);			\
+	}								\
+	static ssize_t store_##_name(struct device *dev,		\
+				     struct device_attribute *attr,	\
+				     const char *buf, size_t count)	\
+	{								\
+		return store_sys_hwmon(_get, buf, count);		\
+	}								\
+	static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0);
+
+CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, get_fan_rpm, NULL);
+CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, get_fan_pwm, set_fan_pwm);
+CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, get_fan_pwm_enable,
+		set_fan_pwm_enable);
+CREATE_SENSOR_ATTR(temp1_input, S_IRUGO, get_cpu_temp, NULL);
+CREATE_SENSOR_ATTR(temp2_input, S_IRUGO, get_battery_temp, NULL);
+CREATE_SENSOR_ATTR(temp2_max_alarm, S_IRUGO, get_battery_temp_alarm, NULL);
+CREATE_SENSOR_ATTR(curr1_input, S_IRUGO, get_battery_current, NULL);
+CREATE_SENSOR_ATTR(in1_input, S_IRUGO, get_battery_voltage, NULL);
+
+static ssize_t
+show_name(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "yeeloong\n");
+}
+
+static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
+
+static struct attribute *hwmon_attributes[] = {
+	&sensor_dev_attr_pwm1.dev_attr.attr,
+	&sensor_dev_attr_pwm1_enable.dev_attr.attr,
+	&sensor_dev_attr_fan1_input.dev_attr.attr,
+	&sensor_dev_attr_temp1_input.dev_attr.attr,
+	&sensor_dev_attr_temp2_input.dev_attr.attr,
+	&sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
+	&sensor_dev_attr_curr1_input.dev_attr.attr,
+	&sensor_dev_attr_in1_input.dev_attr.attr,
+	&sensor_dev_attr_name.dev_attr.attr,
+	NULL
+};
+
+static struct attribute_group hwmon_attribute_group = {
+	.attrs = hwmon_attributes
+};
+
+static struct device *yeeloong_hwmon_dev;
+
+static int yeeloong_hwmon_init(void)
+{
+	int ret;
+
+	yeeloong_hwmon_dev = hwmon_device_register(NULL);
+	if (IS_ERR(yeeloong_hwmon_dev)) {
+		pr_err("Fail to register yeeloong hwmon device\n");
+		yeeloong_hwmon_dev = NULL;
+		return PTR_ERR(yeeloong_hwmon_dev);
+	}
+	ret = sysfs_create_group(&yeeloong_hwmon_dev->kobj,
+				 &hwmon_attribute_group);
+	if (ret) {
+		hwmon_device_unregister(yeeloong_hwmon_dev);
+		yeeloong_hwmon_dev = NULL;
+		return ret;
+	}
+	/* ensure fan is set to auto mode */
+	set_fan_pwm_enable(BIT_FAN_AUTO);
+
+	return 0;
+}
+
+static void yeeloong_hwmon_exit(void)
+{
+	if (yeeloong_hwmon_dev) {
+		sysfs_remove_group(&yeeloong_hwmon_dev->kobj,
+				   &hwmon_attribute_group);
+		hwmon_device_unregister(yeeloong_hwmon_dev);
+		yeeloong_hwmon_dev = NULL;
+	}
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -225,11 +423,19 @@ static int __init yeeloong_init(void)
 
 	yeeloong_battery_init();
 
+	ret = yeeloong_hwmon_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong hwmon driver.\n");
+		yeeloong_hwmon_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
-- 
1.6.2.1


From wuzhangjin@gmail.com Sun Dec  6 08:07:27 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:07:31 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:34471 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492284AbZLFHFk (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:40 +0100
Received: by mail-pw0-f45.google.com with SMTP id 18so1914974pwi.24
        for <multiple recipients>; Sat, 05 Dec 2009 23:05:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=82CXq8jmLCVoDOkS96QDaJ2mshjn/0z00WIYBjYskO4=;
        b=uvkQogPl0iFVv+PNQx+ITQl5724w9v+DNGi2W4s56nof2xWr36WD1I8eQyOTivIVb5
         jBcVMJXf7zNZ6kOmA0t3UmIQgFPOj3ipLIZRxCTyHBq2vyDOHRuvBpmecg/bR026MNhh
         qq8vB5nqr2zQIcP/pMAJcSdkHLVh2AA972VU4=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=bi4awd2MhVnsYmYo6yd9qlBT8YhqIUn+QoRLRIZ1AxXpmNatGgZTSdxPHO9OYXbghp
         EvXEZhrSTPD+tWsDkdq4TolDrZ2lIYKmN+PtwZKP9ksQqp4/ufvUKxFMeD70V7onrOw4
         XfRcWH7R8vZkqQQPdFYqyAK35et9oesmoWIaU=
Received: by 10.114.54.34 with SMTP id c34mr8278491waa.47.1260083139142;
        Sat, 05 Dec 2009 23:05:39 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.05.33
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:05:38 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 6/8] Loongson: YeeLoong: add video output driver
Date:   Sun,  6 Dec 2009 15:01:46 +0800
Message-Id: <a9309478df85d80c970bfc1632c1cc0147596c1c.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
 <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
 <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
 <57ed2090c7f1a1a9c0e31d457617c7473b9e29ad.1260082252.git.wuzhangjin@gmail.com>
 <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25336
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Video Output Driver, it provides standard
interface(/sys/class/video_output) to turn on/off the video output of
LCD, CRT.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |  139 +++++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 352594c..e2dbe28 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -21,6 +21,7 @@ config LEMOTE_YEELOONG2F
 	select SYS_SUPPORTS_APM_EMULATION
 	select APM_EMULATION
 	select HWMON
+	select VIDEO_OUTPUT_CONTROL
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 78ddfad..180dbb1 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -16,6 +16,7 @@
 #include <linux/apm-emulation.h>/* for battery subdriver */
 #include <linux/hwmon.h>	/* for hwmon subdriver */
 #include <linux/hwmon-sysfs.h>
+#include <linux/video_output.h>	/* for video output subdriver */
 
 #include <ec_kb3310b.h>
 
@@ -384,6 +385,136 @@ static void yeeloong_hwmon_exit(void)
 	}
 }
 
+/* video output subdriver */
+
+static int lcd_video_output_get(struct output_device *od)
+{
+	return ec_read(REG_DISPLAY_LCD);
+}
+
+#define LCD	0
+#define CRT	1
+
+static void display_vo_set(int display, int on)
+{
+	int addr;
+	unsigned long value;
+
+	addr = (display == LCD) ? 0x31 : 0x21;
+
+	outb(addr, 0x3c4);
+	value = inb(0x3c5);
+
+	if (display == LCD)
+		value |= (on ? 0x03 : 0x02);
+	else {
+		if (on)
+			clear_bit(7, &value);
+		else
+			set_bit(7, &value);
+	}
+
+	outb(addr, 0x3c4);
+	outb(value, 0x3c5);
+}
+
+static int lcd_video_output_set(struct output_device *od)
+{
+	unsigned long status;
+
+	status = !!od->request_state;
+
+	display_vo_set(LCD, status);
+	ec_write(REG_BACKLIGHT_CTRL, status);
+
+	return 0;
+}
+
+static struct output_properties lcd_output_properties = {
+	.set_state = lcd_video_output_set,
+	.get_status = lcd_video_output_get,
+};
+
+static int crt_video_output_get(struct output_device *od)
+{
+	return ec_read(REG_CRT_DETECT);
+}
+
+static int crt_video_output_set(struct output_device *od)
+{
+	unsigned long status;
+
+	status = !!od->request_state;
+
+	if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG)
+		display_vo_set(CRT, status);
+
+	return 0;
+}
+
+static struct output_properties crt_output_properties = {
+	.set_state = crt_video_output_set,
+	.get_status = crt_video_output_get,
+};
+
+static struct output_device *lcd_output_dev, *crt_output_dev;
+
+static void yeeloong_lcd_vo_set(int status)
+{
+	lcd_output_dev->request_state = status;
+	lcd_video_output_set(lcd_output_dev);
+}
+
+static void yeeloong_crt_vo_set(int status)
+{
+	crt_output_dev->request_state = status;
+	crt_video_output_set(crt_output_dev);
+}
+
+static int yeeloong_vo_init(void)
+{
+	int ret;
+
+	/* Register video output device: lcd, crt */
+	lcd_output_dev = video_output_register("LCD", NULL, NULL,
+			&lcd_output_properties);
+
+	if (IS_ERR(lcd_output_dev)) {
+		ret = PTR_ERR(lcd_output_dev);
+		lcd_output_dev = NULL;
+		return ret;
+	}
+	/* Ensure LCD is on by default */
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+
+	crt_output_dev = video_output_register("CRT", NULL, NULL,
+			&crt_output_properties);
+
+	if (IS_ERR(crt_output_dev)) {
+		ret = PTR_ERR(crt_output_dev);
+		crt_output_dev = NULL;
+		return ret;
+	}
+
+	/* Turn off CRT by default, and will be enabled when the CRT
+	 * connectting event reported by SCI */
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+
+	return 0;
+}
+
+static void yeeloong_vo_exit(void)
+{
+	if (lcd_output_dev) {
+		video_output_unregister(lcd_output_dev);
+		lcd_output_dev = NULL;
+	}
+	if (crt_output_dev) {
+		video_output_unregister(crt_output_dev);
+		crt_output_dev = NULL;
+	}
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -430,11 +561,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_vo_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong video output driver.\n");
+		yeeloong_vo_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_vo_exit();
 	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
-- 
1.6.2.1


From wuzhangjin@gmail.com Sun Dec  6 08:07:49 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:07:55 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:34471 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492270AbZLFHFs (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:48 +0100
Received: by mail-pw0-f45.google.com with SMTP id 18so1914974pwi.24
        for <multiple recipients>; Sat, 05 Dec 2009 23:05:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=tf+AIlYly9A5EewRXOtutHTn7lIQmt28QkTrRj4pwRI=;
        b=JcRjI8D+OMrbeiOIk/OarhbDIuoaPUwL/XTX+UzMso7vpBpj19tiHpv6kMuB4AI+nG
         pkKy25xwpnI1ETWCHIs7+fLfd7BM+TOm6NgSMlq/Zv5rwrvJZ4uQ6WNzn4lWiCT9W3QM
         gH0O83S6VyQxbaK4gNkIdXKamVpvWWese5rkg=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=lnHNTOsZonPs/QWW+H7Ve53HreZzWOZKzokJxGGAqN5EkPDTuGPeNYNQatMXMu37WY
         rGHH+MAgouSopvo3vPho8w9rdwdiR/DnnWVTGAUULwnxAQpJD3JX4M1gecWdkAmxHYwX
         hniq97UlabmPfplTncwmJpIIH/ScH2GoB4gNE=
Received: by 10.115.67.24 with SMTP id u24mr8286236wak.59.1260083147559;
        Sat, 05 Dec 2009 23:05:47 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.05.40
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:05:47 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 7/8] Loongson: YeeLoong: add suspend support
Date:   Sun,  6 Dec 2009 15:01:47 +0800
Message-Id: <0d43bc3ef83540f8420a66741560e8ee817758c3.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <a9309478df85d80c970bfc1632c1cc0147596c1c.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
 <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
 <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
 <57ed2090c7f1a1a9c0e31d457617c7473b9e29ad.1260082252.git.wuzhangjin@gmail.com>
 <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
 <a9309478df85d80c970bfc1632c1cc0147596c1c.1260082252.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25337
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch add support to suspend the yeeloong platform specific
devices(LCD, CRT, USB...).

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/yeeloong_laptop.c |   42 ++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 180dbb1..5e83788 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -515,6 +515,39 @@ static void yeeloong_vo_exit(void)
 	}
 }
 
+#ifdef CONFIG_PM
+static void usb_ports_set(int status)
+{
+	status = !!status;
+
+	ec_write(REG_USB0_FLAG, status);
+	ec_write(REG_USB1_FLAG, status);
+	ec_write(REG_USB2_FLAG, status);
+}
+
+static int yeeloong_suspend(struct device *dev)
+
+{
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	usb_ports_set(BIT_USB_FLAG_OFF);
+
+	return 0;
+}
+
+static int yeeloong_resume(struct device *dev)
+{
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+	usb_ports_set(BIT_USB_FLAG_ON);
+
+	return 0;
+}
+
+static const SIMPLE_DEV_PM_OPS(yeeloong_pm_ops, yeeloong_suspend,
+	yeeloong_resume);
+#endif
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -526,9 +559,12 @@ MODULE_DEVICE_TABLE(platform, platform_device_ids);
 
 static struct platform_driver platform_driver = {
 	.driver = {
-		   .name = "yeeloong_laptop",
-		   .owner = THIS_MODULE,
-		   },
+		.name = "yeeloong_laptop",
+		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm = &yeeloong_pm_ops,
+#endif
+	},
 	.id_table = platform_device_ids,
 };
 
-- 
1.6.2.1


From wuzhangjin@gmail.com Sun Dec  6 08:08:13 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 08:08:18 +0100 (CET)
Received: from mail-px0-f188.google.com ([209.85.216.188]:63385 "EHLO
        mail-px0-f188.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492213AbZLFHFz (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 08:05:55 +0100
Received: by mail-px0-f188.google.com with SMTP id 26so1367800pxi.21
        for <multiple recipients>; Sat, 05 Dec 2009 23:05:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=j+AdKAWhkaozTDTmzAph37MBLijAhEziXPn6uPLHcCQ=;
        b=Sic/cPDf2qwNMnNYMBk2ygVZMPdb2smVYd4NvK7dqAe4Y2/3lmrr4KTv04NU6QlxKX
         Y8UlHhOq3Bw5vHhPsNI3UJvEr5cWPOhnU8ouwjLafLVfeFNtr3q7B9RWZAPKofczYL2v
         RRAB61bVGgJLtzdL/fEikGRJl7UzSTWxKFXKw=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=NpXo111l+z0dn+g+bEv673s0TV29wP7kVbZ4e/b2q56CvS26mqHeZHhd39yKONIKen
         otbm3+b5+y+7J8sxuUNq/34mBZY4l3NMyHmkTTQlFO4nTfTtty4v0q3cSPG5O7H/AKy6
         PRbPPl389L+e5LhnRONBES+fpx8c2VmoOuVNk=
Received: by 10.115.101.31 with SMTP id d31mr8314834wam.68.1260083154148;
        Sat, 05 Dec 2009 23:05:54 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3974972pzk.5.2009.12.05.23.05.47
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sat, 05 Dec 2009 23:05:53 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org
Cc:     Wu Zhangjin <wuzhangjin@gmail.com>, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v8 8/8] Loongson: YeeLoong: add input/hotkey driver
Date:   Sun,  6 Dec 2009 15:01:48 +0800
Message-Id: <b164d5bb79963a57621d024c22e5664de0ff8662.1260082252.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <0d43bc3ef83540f8420a66741560e8ee817758c3.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
 <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
 <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
 <57ed2090c7f1a1a9c0e31d457617c7473b9e29ad.1260082252.git.wuzhangjin@gmail.com>
 <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
 <a9309478df85d80c970bfc1632c1cc0147596c1c.1260082252.git.wuzhangjin@gmail.com>
 <0d43bc3ef83540f8420a66741560e8ee817758c3.1260082252.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25338
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Hotkey Driver, which will do relative actions for The
hotkey event(/sys/class/input) and report the corresponding input keys
to the user-space applications.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/mach-loongson/loongson.h |    6 +
 arch/mips/loongson/common/cmdline.c            |    8 +
 drivers/platform/mips/Kconfig                  |    2 +
 drivers/platform/mips/yeeloong_laptop.c        |  412 ++++++++++++++++++++++++
 4 files changed, 428 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h
index ee8bc83..13e208e 100644
--- a/arch/mips/include/asm/mach-loongson/loongson.h
+++ b/arch/mips/include/asm/mach-loongson/loongson.h
@@ -43,6 +43,12 @@ static inline void prom_init_uart_base(void)
 #endif
 }
 
+/*
+ * Copy kernel command line from arcs_cmdline
+ */
+#include <asm/setup.h>
+extern char loongson_cmdline[COMMAND_LINE_SIZE];
+
 /* irq operation functions */
 extern void bonito_irqdispatch(void);
 extern void __init bonito_irq_init(void);
diff --git a/arch/mips/loongson/common/cmdline.c b/arch/mips/loongson/common/cmdline.c
index 7ad47f2..617faee 100644
--- a/arch/mips/loongson/common/cmdline.c
+++ b/arch/mips/loongson/common/cmdline.c
@@ -17,6 +17,7 @@
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */
+#include <linux/module.h>
 #include <asm/bootinfo.h>
 
 #include <loongson.h>
@@ -25,6 +26,10 @@ int prom_argc;
 /* pmon passes arguments in 32bit pointers */
 int *_prom_argv;
 
+/* the kernel command line copied from arcs_cmdline */
+char loongson_cmdline[COMMAND_LINE_SIZE];
+EXPORT_SYMBOL(loongson_cmdline);
+
 void __init prom_init_cmdline(void)
 {
 	int i;
@@ -51,4 +56,7 @@ void __init prom_init_cmdline(void)
 		strcat(arcs_cmdline, " root=/dev/hda1");
 
 	prom_init_machtype();
+
+	/* copy arcs_cmdline into loongson_cmdline */
+	strncpy(loongson_cmdline, arcs_cmdline, COMMAND_LINE_SIZE);
 }
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index e2dbe28..8262dff 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -22,6 +22,8 @@ config LEMOTE_YEELOONG2F
 	select APM_EMULATION
 	select HWMON
 	select VIDEO_OUTPUT_CONTROL
+	select INPUT_SPARSEKMAP
+	depends on INPUT
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 5e83788..516312e 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -17,7 +17,14 @@
 #include <linux/hwmon.h>	/* for hwmon subdriver */
 #include <linux/hwmon-sysfs.h>
 #include <linux/video_output.h>	/* for video output subdriver */
+#include <linux/input.h>	/* for hotkey subdriver */
+#include <linux/input/sparse-keymap.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
 
+#include <cs5536/cs5536.h>
+
+#include <loongson.h>		/* for loongson_cmdline */
 #include <ec_kb3310b.h>
 
 /* backlight subdriver */
@@ -515,6 +522,403 @@ static void yeeloong_vo_exit(void)
 	}
 }
 
+/* hotkey subdriver */
+
+static struct input_dev *yeeloong_hotkey_dev;
+
+static const struct key_entry yeeloong_keymap[] = {
+	{KE_SW, EVENT_LID, { SW_LID } },
+	{KE_KEY, EVENT_CAMERA, { KEY_CAMERA } }, /* Fn + ESC */
+	{KE_KEY, EVENT_SLEEP, { KEY_SLEEP } }, /* Fn + F1 */
+	{KE_KEY, EVENT_DISPLAY_TOGGLE, { KEY_SWITCHVIDEOMODE } }, /* Fn + F3 */
+	{KE_KEY, EVENT_AUDIO_MUTE, { KEY_MUTE } }, /* Fn + F4 */
+	{KE_KEY, EVENT_WLAN, { KEY_WLAN } }, /* Fn + F5 */
+	{KE_KEY, EVENT_DISPLAY_BRIGHTNESS, { KEY_BRIGHTNESSUP } }, /* Fn + up */
+	{KE_KEY, EVENT_DISPLAY_BRIGHTNESS, { KEY_BRIGHTNESSDOWN } }, /* Fn + down */
+	{KE_KEY, EVENT_AUDIO_VOLUME, { KEY_VOLUMEUP } }, /* Fn + right */
+	{KE_KEY, EVENT_AUDIO_VOLUME, { KEY_VOLUMEDOWN } }, /* Fn + left */
+	{KE_END, 0}
+};
+
+static struct key_entry *get_event_key_entry(int event, int status)
+{
+	struct key_entry *ke;
+	static int old_brightness_status = -1;
+	static int old_volume_status = -1;
+
+	ke = sparse_keymap_entry_from_scancode(yeeloong_hotkey_dev, event);
+	if (!ke)
+		return NULL;
+
+	switch (event) {
+	case EVENT_DISPLAY_BRIGHTNESS:
+		/* current status > old one, means up */
+		if ((status < old_brightness_status) || (0 == status))
+			ke++;
+		old_brightness_status = status;
+		break;
+	case EVENT_AUDIO_VOLUME:
+		if ((status < old_volume_status) || (0 == status))
+			ke++;
+		old_volume_status = status;
+		break;
+	default:
+		break;
+	}
+
+	return ke;
+}
+
+static int report_lid_switch(int status)
+{
+	input_report_switch(yeeloong_hotkey_dev, SW_LID, !status);
+	input_sync(yeeloong_hotkey_dev);
+
+	return status;
+}
+
+static int crt_detect_handler(int status)
+{
+	if (status) {
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	} else {
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	}
+	return status;
+}
+
+#define EC_VER_LEN 64
+
+static int black_screen_handler(int status)
+{
+	char *p, ec_ver[EC_VER_LEN];
+
+	p = strstr(loongson_cmdline, "EC_VER=");
+	if (!p)
+		memset(ec_ver, 0, EC_VER_LEN);
+	else {
+		strncpy(ec_ver, p, EC_VER_LEN);
+		p = strstr(ec_ver, " ");
+		if (p)
+			*p = '\0';
+	}
+
+	/* Seems EC(>=PQ1D26) does this job for us, we can not do it again,
+	 * otherwise, the brightness will not resume to the normal level! */
+	if (strncasecmp(ec_ver, "EC_VER=PQ1D26", 64) < 0)
+		yeeloong_lcd_vo_set(status);
+
+	return status;
+}
+
+static int display_toggle_handler(int status)
+{
+	static int video_output_status;
+
+	/* Only enable switch video output button
+	 * when CRT is connected */
+	if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_UNPLUG)
+		return 0;
+	/* 0. no CRT connected: LCD on, CRT off
+	 * 1. BOTH on
+	 * 2. LCD off, CRT on
+	 * 3. BOTH off
+	 * 4. LCD on, CRT off
+	 */
+	video_output_status++;
+	if (video_output_status > 4)
+		video_output_status = 1;
+
+	switch (video_output_status) {
+	case 1:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		break;
+	case 2:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		break;
+	case 3:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+		break;
+	case 4:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+		break;
+	default:
+		/* Ensure LCD is on */
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		break;
+	}
+	return video_output_status;
+}
+
+static int camera_handler(int status)
+{
+	int value;
+
+	value = ec_read(REG_CAMERA_CONTROL);
+	ec_write(REG_CAMERA_CONTROL, value | (1 << 1));
+
+	return status;
+}
+
+static int usb2_handler(int status)
+{
+	pr_emerg("USB2 Over Current occurred\n");
+
+	return status;
+}
+
+static int usb0_handler(int status)
+{
+	pr_emerg("USB0 Over Current occurred\n");
+
+	return status;
+}
+
+/* yeeloong_wifi_handler may be implemented in the wifi driver */
+sci_handler yeeloong_wifi_handler;
+EXPORT_SYMBOL(yeeloong_wifi_handler);
+
+
+static void do_event_action(int event)
+{
+	sci_handler handler;
+	int reg, status;
+	struct key_entry *ke;
+
+	reg = 0;
+	handler = NULL;
+
+	switch (event) {
+	case EVENT_LID:
+		reg = REG_LID_DETECT;
+		break;
+	case EVENT_DISPLAY_TOGGLE:
+		handler = display_toggle_handler;
+		break;
+	case EVENT_CRT_DETECT:
+		reg = REG_CRT_DETECT;
+		handler = crt_detect_handler;
+		break;
+	case EVENT_CAMERA:
+		reg = REG_CAMERA_STATUS;
+		handler = camera_handler;
+		break;
+	case EVENT_USB_OC2:
+		reg = REG_USB2_FLAG;
+		handler = usb2_handler;
+		break;
+	case EVENT_USB_OC0:
+		reg = REG_USB0_FLAG;
+		handler = usb0_handler;
+		break;
+	case EVENT_BLACK_SCREEN:
+		reg = REG_DISPLAY_LCD;
+		handler = black_screen_handler;
+		break;
+	case EVENT_AUDIO_MUTE:
+		reg = REG_AUDIO_MUTE;
+		break;
+	case EVENT_DISPLAY_BRIGHTNESS:
+		reg = REG_DISPLAY_BRIGHTNESS;
+		break;
+	case EVENT_AUDIO_VOLUME:
+		reg = REG_AUDIO_VOLUME;
+		break;
+	case EVENT_WLAN:
+		/* We use 2 to indicate it as a switch */
+		status = 2;
+		handler = yeeloong_wifi_handler;
+		break;
+	default:
+		break;
+	}
+
+	if (reg != 0)
+		status = ec_read(reg);
+
+	if (handler != NULL)
+		status = handler(status);
+
+	pr_info("%s: event: %d status: %d\n", __func__, event, status);
+
+	/* Report current key to user-space */
+	ke = get_event_key_entry(event, status);
+	if (ke) {
+		if (ke->keycode == SW_LID)
+			report_lid_switch(status);
+		else
+			sparse_keymap_report_entry(yeeloong_hotkey_dev, ke, 1,
+					true);
+	}
+}
+
+/*
+ * SCI(system control interrupt) main interrupt routine
+ *
+ * We will do the query and get event number together so the interrupt routine
+ * should be longer than 120us now at least 3ms elpase for it.
+ */
+static irqreturn_t sci_irq_handler(int irq, void *dev_id)
+{
+	int ret, event;
+
+	if (SCI_IRQ_NUM != irq)
+		return IRQ_NONE;
+
+	/* Query the event number */
+	ret = ec_query_event_num();
+	if (ret < 0)
+		return IRQ_NONE;
+
+	event = ec_get_event_num();
+	if (event < EVENT_START || event > EVENT_END)
+		return IRQ_NONE;
+
+	/* Execute corresponding actions */
+	do_event_action(event);
+
+	return IRQ_HANDLED;
+}
+
+/*
+ * Config and init some msr and gpio register properly.
+ */
+static int sci_irq_init(void)
+{
+	u32 hi, lo;
+	u32 gpio_base;
+	unsigned long flags;
+	int ret;
+
+	/* Get gpio base */
+	_rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_GPIO), &hi, &lo);
+	gpio_base = lo & 0xff00;
+
+	/* Filter the former kb3310 interrupt for security */
+	ret = ec_query_event_num();
+	if (ret)
+		return ret;
+
+	/* For filtering next number interrupt */
+	udelay(10000);
+
+	/* Set gpio native registers and msrs for GPIO27 SCI EVENT PIN
+	 * gpio :
+	 *      input, pull-up, no-invert, event-count and value 0,
+	 *      no-filter, no edge mode
+	 *      gpio27 map to Virtual gpio0
+	 * msr :
+	 *      no primary and lpc
+	 *      Unrestricted Z input to IG10 from Virtual gpio 0.
+	 */
+	local_irq_save(flags);
+	_rdmsr(0x80000024, &hi, &lo);
+	lo &= ~(1 << 10);
+	_wrmsr(0x80000024, hi, lo);
+	_rdmsr(0x80000025, &hi, &lo);
+	lo &= ~(1 << 10);
+	_wrmsr(0x80000025, hi, lo);
+	_rdmsr(0x80000023, &hi, &lo);
+	lo |= (0x0a << 0);
+	_wrmsr(0x80000023, hi, lo);
+	local_irq_restore(flags);
+
+	/* Set gpio27 as sci interrupt
+	 *
+	 * input, pull-up, no-fliter, no-negedge, invert
+	 * the sci event is just about 120us
+	 */
+	asm(".set noreorder\n");
+	/*  input enable */
+	outl(0x00000800, (gpio_base | 0xA0));
+	/*  revert the input */
+	outl(0x00000800, (gpio_base | 0xA4));
+	/*  event-int enable */
+	outl(0x00000800, (gpio_base | 0xB8));
+	asm(".set reorder\n");
+
+	return 0;
+}
+
+static struct irqaction sci_irqaction = {
+	.handler = sci_irq_handler,
+	.name = "sci",
+	.flags = IRQF_SHARED,
+};
+
+static int yeeloong_hotkey_init(void)
+{
+	int ret;
+
+	ret = sci_irq_init();
+	if (ret)
+		return -EFAULT;
+
+	ret = setup_irq(SCI_IRQ_NUM, &sci_irqaction);
+	if (ret)
+		return -EFAULT;
+
+	yeeloong_hotkey_dev = input_allocate_device();
+
+	if (!yeeloong_hotkey_dev) {
+		remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+		return -ENOMEM;
+	}
+
+	yeeloong_hotkey_dev->name = "HotKeys";
+	yeeloong_hotkey_dev->phys = "button/input0";
+	yeeloong_hotkey_dev->id.bustype = BUS_HOST;
+	yeeloong_hotkey_dev->dev.parent = NULL;
+
+	ret = sparse_keymap_setup(yeeloong_hotkey_dev, yeeloong_keymap, NULL);
+	if (ret) {
+		pr_err("Fail to setup input device keymap\n");
+		input_free_device(yeeloong_hotkey_dev);
+		return ret;
+	}
+
+	ret = input_register_device(yeeloong_hotkey_dev);
+	if (ret) {
+		sparse_keymap_free(yeeloong_hotkey_dev);
+		input_free_device(yeeloong_hotkey_dev);
+		return ret;
+	}
+
+	/* Update the current status of LID */
+	report_lid_switch(BIT_LID_DETECT_ON);
+
+#ifdef CONFIG_LOONGSON_SUSPEND
+	/* Install the real yeeloong_report_lid_status for pm.c */
+	yeeloong_report_lid_status = report_lid_switch;
+#endif
+
+	return 0;
+}
+
+static void yeeloong_hotkey_exit(void)
+{
+	/* Free irq */
+	remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+
+#ifdef CONFIG_LOONGSON_SUSPEND
+	/* Uninstall yeeloong_report_lid_status for pm.c */
+	if (yeeloong_report_lid_status == report_lid_switch)
+		yeeloong_report_lid_status = NULL;
+#endif
+
+	if (yeeloong_hotkey_dev) {
+		sparse_keymap_free(yeeloong_hotkey_dev);
+		input_unregister_device(yeeloong_hotkey_dev);
+		yeeloong_hotkey_dev = NULL;
+	}
+}
+
 #ifdef CONFIG_PM
 static void usb_ports_set(int status)
 {
@@ -604,11 +1008,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_hotkey_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong hotkey driver.\n");
+		yeeloong_hotkey_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_hotkey_exit();
 	yeeloong_vo_exit();
 	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
-- 
1.6.2.1


From pavel@ucw.cz Sun Dec  6 21:26:44 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 06 Dec 2009 21:26:47 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:52896 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493274AbZLFU0o (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 6 Dec 2009 21:26:44 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id 79D46F01D7; Sun,  6 Dec 2009 21:26:42 +0100 (CET)
Date:   Sun, 6 Dec 2009 09:47:17 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
        driver
Message-ID: <20091206084717.GD2766@ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com> <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25339
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

Hi!

> +static int get_battery_current(void)
> +{
> +	s16 value;
> +
> +	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> +		(ec_read(REG_BAT_CURRENT_LOW));
> +
> +	if (value < 0)
> +		value = ~value + 1;
> +
> +	return value;
> +}

What is going on here? I thought the value is already in two's
complement... Is the above equivalent of

	      if (value < 0)
	      	 value = -value; 

? If so, why? If not, can you add a comment?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From wuzhangjin@gmail.com Mon Dec  7 01:55:38 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 01:55:40 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:62825 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494145AbZLGAzh (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 01:55:37 +0100
Received: by pzk35 with SMTP id 35so3580512pzk.22
        for <multiple recipients>; Sun, 06 Dec 2009 16:55:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=bvUsoT+1Us6JY8GoEkBBRF4TMCISNFxR5cqkWDFWmO0=;
        b=Joo6PhUNwNj8jV5ASjnqLKiO/CBiojLnUJqDLCPjx9Omb1IL+o48RTgNuYoT56ihip
         HMa93nFQ/MdKJYb+OS51x5cUrv8o7D67ZSc+FSs5H9b3sw+H+SNJ+EWHIQVTs3McxlH6
         9/KX7y/iqf4jVYDCZNGgwEzozxpZfn7xEo4p8=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=I6uvZ2PaPM6y7ndiKCLZkEpzoJWk30r+wPwtscZ2JQAK5po1400Luc5yEAz7LlXANO
         OVLNqkqbH97j9IzY4INpPBZF1QGx8b6f8hEkqMOLOMud+C/gd4lfrmbKT9RxD8eOPjWg
         VOs3PO9WPPM+AOfqZblK2wgdoZa61AAwLFjqc=
Received: by 10.114.187.8 with SMTP id k8mr9981889waf.220.1260147328962;
        Sun, 06 Dec 2009 16:55:28 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm4737233pzk.9.2009.12.06.16.55.24
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sun, 06 Dec 2009 16:55:28 -0800 (PST)
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
In-Reply-To: <20091206084717.GD2766@ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
         <20091206084717.GD2766@ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Mon, 07 Dec 2009 08:54:58 +0800
Message-ID: <1260147298.3126.2.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25340
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Sun, 2009-12-06 at 09:47 +0100, Pavel Machek wrote: 
> Hi!
> 
> > +static int get_battery_current(void)
> > +{
> > +	s16 value;
> > +
> > +	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> > +		(ec_read(REG_BAT_CURRENT_LOW));
> > +
> > +	if (value < 0)
> > +		value = ~value + 1;
> > +
> > +	return value;
> > +}
> 
> What is going on here? I thought the value is already in two's
> complement... Is the above equivalent of
> 
> 	      if (value < 0)
> 	      	 value = -value; 
> 
> ? If so, why? If not, can you add a comment?

Right, then, will use this instead:

static int get_battery_current(void)
{ 
	s16 value;

	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
		(ec_read(REG_BAT_CURRENT_LOW));

	return abs(value);
}

Thanks & Best Regards,
	Wu Zhangjin



From dmitry.torokhov@gmail.com Mon Dec  7 07:49:14 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 07:49:18 +0100 (CET)
Received: from mail-yx0-f204.google.com ([209.85.210.204]:55646 "EHLO
        mail-yx0-f204.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492062AbZLGGtO (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 07:49:14 +0100
Received: by yxe42 with SMTP id 42so4087083yxe.22
        for <multiple recipients>; Sun, 06 Dec 2009 22:49:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:date:from:to:cc:subject
         :message-id:references:mime-version:content-type:content-disposition
         :in-reply-to:user-agent;
        bh=mUdwY+WJZb2/T4IMyl19WROuF0jPy3BxUd8/NmH02fU=;
        b=lnvG4U4maSPP2PcBOF6XHwymgAzX/8Xw//F5nxnIMs6n+EL2BCg7rpVVqyRH0PoDir
         GvnwC1lcMVe3QlaHe75k4A4gTnUkxC6GvaUVXEobg3v6NDG8FXW03qhlvi/CcLT2mfm8
         wulf/gqwz8WswlaoB4gLVN5TuPBmPwGUiCp8Q=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=date:from:to:cc:subject:message-id:references:mime-version
         :content-type:content-disposition:in-reply-to:user-agent;
        b=NsGhP62BIU7rMU77428bagzQeHPYbMPcyPmFUW4n3VBgDGc7KcD/1h5SGc2kzk6vAs
         lj+r/fYtcAAhmWf0YwIr+RIH0GagmV2bQV3gFbTGgm6NIncqIiOvG6bWZmHw6XQGzZch
         uxss7dyC9HqsrHyUoaLzymDQhQaaoZk5LPvFE=
Received: by 10.150.42.30 with SMTP id p30mr10121534ybp.122.1260168542569;
        Sun, 06 Dec 2009 22:49:02 -0800 (PST)
Received: from mailhub.coreip.homeip.net (c-24-6-153-137.hsd1.ca.comcast.net [24.6.153.137])
        by mx.google.com with ESMTPS id 7sm1916826ywc.21.2009.12.06.22.49.00
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sun, 06 Dec 2009 22:49:01 -0800 (PST)
Date:   Sun, 6 Dec 2009 22:48:57 -0800
From:   Dmitry Torokhov <dmitry.torokhov@gmail.com>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH v8 8/8] Loongson: YeeLoong: add input/hotkey driver
Message-ID: <20091207064857.GG21451@core.coreip.homeip.net>
References: <cover.1260082252.git.wuzhangjin@gmail.com> <b164d5bb79963a57621d024c22e5664de0ff8662.1260082252.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <b164d5bb79963a57621d024c22e5664de0ff8662.1260082252.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.19 (2009-01-05)
Return-Path: <dmitry.torokhov@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25341
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: dmitry.torokhov@gmail.com
Precedence: bulk
X-list: linux-mips

Hi Wu,

On Sun, Dec 06, 2009 at 03:01:48PM +0800, Wu Zhangjin wrote:
> +
> +#define EC_VER_LEN 64
> +
> +static int black_screen_handler(int status)
> +{
> +	char *p, ec_ver[EC_VER_LEN];
> +
> +	p = strstr(loongson_cmdline, "EC_VER=");
> +	if (!p)
> +		memset(ec_ver, 0, EC_VER_LEN);
> +	else {
> +		strncpy(ec_ver, p, EC_VER_LEN);
> +		p = strstr(ec_ver, " ");
> +		if (p)
> +			*p = '\0';
> +	}
> +

Hmm, why do you copy and parse command lineinstead of using module
param and also doing it just once?

> +	/* Seems EC(>=PQ1D26) does this job for us, we can not do it again,
> +	 * otherwise, the brightness will not resume to the normal level! */
> +	if (strncasecmp(ec_ver, "EC_VER=PQ1D26", 64) < 0)
> +		yeeloong_lcd_vo_set(status);
> +
> +	return status;
> +}

Thanks.

-- 
Dmitry

From wuzhangjin@gmail.com Mon Dec  7 08:27:41 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 08:27:45 +0100 (CET)
Received: from mail-yw0-f203.google.com ([209.85.211.203]:46047 "EHLO
        mail-yw0-f203.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492223AbZLGH1l (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 08:27:41 +0100
Received: by ywh41 with SMTP id 41so6387460ywh.0
        for <multiple recipients>; Sun, 06 Dec 2009 23:27:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=gY10Y5P5PtTxoMnu3fNKCuILSNmTRPAyXe2y8bCMHAQ=;
        b=d1nG2gCN2s9rbTYKbV5TewhwPRSRc2stjE2l7gLM1bB+Jgt7aXajwYpPl164lNbgOE
         fpXo0fgJK6pVK6Qfd44Kp3pv+jBonfWRM9u+O3Gx7VNpMKLo90j/A28aoIwJWR3HPEBC
         3fMY5ccsYHhf+YMRBLYwuX8YRRCkeM1WSnVqE=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=Ct70tVd3UzdW56B5DOxNjcdSIVOB0HQEjBUNC/JV5ufYgR9CZiVIWT/nWzkDHS6ztn
         OdhyFrMZ/NGZf97c1HRe84Cl1xYi8FGQrwzRFFr1Zt1lxctdPxcrLEvz80tkxzlFdqiM
         WgGGg40MKHaKDriw+tbm8A29XVVRybm6hZ4Bo=
Received: by 10.91.157.1 with SMTP id j1mr3111648ago.21.1260170853585;
        Sun, 06 Dec 2009 23:27:33 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm3466185iwn.12.2009.12.06.23.27.27
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sun, 06 Dec 2009 23:27:32 -0800 (PST)
Subject: Re: [PATCH v8 8/8] Loongson: YeeLoong: add input/hotkey driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
In-Reply-To: <20091207064857.GG21451@core.coreip.homeip.net>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <b164d5bb79963a57621d024c22e5664de0ff8662.1260082252.git.wuzhangjin@gmail.com>
         <20091207064857.GG21451@core.coreip.homeip.net>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Mon, 07 Dec 2009 15:26:47 +0800
Message-ID: <1260170807.9092.9.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25342
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Sun, 2009-12-06 at 22:48 -0800, Dmitry Torokhov wrote:
> Hi Wu,
> 
> On Sun, Dec 06, 2009 at 03:01:48PM +0800, Wu Zhangjin wrote:
> > +
> > +#define EC_VER_LEN 64
> > +
> > +static int black_screen_handler(int status)
> > +{
> > +	char *p, ec_ver[EC_VER_LEN];
> > +
> > +	p = strstr(loongson_cmdline, "EC_VER=");
> > +	if (!p)
> > +		memset(ec_ver, 0, EC_VER_LEN);
> > +	else {
> > +		strncpy(ec_ver, p, EC_VER_LEN);
> > +		p = strstr(ec_ver, " ");
> > +		if (p)
> > +			*p = '\0';
> > +	}
> > +
> 
> Hmm, why do you copy and parse command lineinstead of using module
> param and also doing it just once?
> 

The kernel command line (EC_VER=blabla) is passed by bootloader(PMON)
automatically, so, I think it's better to use it.

Using an extra module param is good, but may make the users confused and
will also add extra jobs to the distribution developers ;) in the
future, the information of the EC and the other information of the
devices will be passed to kernel from BIOS via something like
FDT(Flattened Device Tree, used on PowerPC machines) as Ralf introduced,
so, the above method is a temp solution.

Thanks & Regards,
	Wu Zhangjin

> > +	/* Seems EC(>=PQ1D26) does this job for us, we can not do it again,
> > +	 * otherwise, the brightness will not resume to the normal level! */
> > +	if (strncasecmp(ec_ver, "EC_VER=PQ1D26", 64) < 0)
> > +		yeeloong_lcd_vo_set(status);
> > +
> > +	return status;
> > +}
> 
> Thanks.
> 



From dennis.yxun@gmail.com Mon Dec  7 08:39:21 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 08:39:24 +0100 (CET)
Received: from mail-bw0-f221.google.com ([209.85.218.221]:60140 "EHLO
        mail-bw0-f221.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492375AbZLGHjV (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 08:39:21 +0100
Received: by bwz21 with SMTP id 21so3221519bwz.24
        for <linux-mips@linux-mips.org>; Sun, 06 Dec 2009 23:39:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:date:message-id:subject
         :from:to:content-type;
        bh=rrB6iqrsspkvWD09xu0DGxKmbycwnyF/NNXck+c4+ao=;
        b=beTUz4EIwwIfvMJyS0umrJM2Ec+TO4jDVdyBtfKakzrQVoj6WbJVEq3uZvsr5rpB6M
         RXXW8qsdfLVAs59tFxFhH7jY2Y5Q4xuISOoANSqNRTc9u7JysrkO8bkmgsKE+CAabnI7
         hrE6MTh3wQB+obbKLtPhROT9sNINpaQ9waDrs=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:date:message-id:subject:from:to:content-type;
        b=F6RZ290/fQmt1vKuo5Owj72/uxvr7lInDUJwGjXYej/zVUexYUATEJhL9pSQfvQAxI
         IeO3RIhUXZBcTdtMJlKRuGhJlvHKmkkjnJM/9I3pB29f/byKi+xL+y7n1J2rw+zVWzU4
         3NBIVxHr/uiKCyYn+ABadJ/3jbVmjNXZ3HCqY=
MIME-Version: 1.0
Received: by 10.204.34.71 with SMTP id k7mr6523203bkd.206.1260171556004; Sun, 
        06 Dec 2009 23:39:16 -0800 (PST)
Date:   Mon, 7 Dec 2009 15:39:15 +0800
Message-ID: <7b09df4c0912062339g418f432cr28d92c18ed273d2@mail.gmail.com>
Subject: Question: about Physical Address mapping
From:   "Dennis.Yxun" <dennis.yxun@gmail.com>
To:     linux-mips@linux-mips.org
Content-Type: multipart/alternative; boundary=00032555b73ef3a5a6047a1e8d1f
Return-Path: <dennis.yxun@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25343
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: dennis.yxun@gmail.com
Precedence: bulk
X-list: linux-mips

--00032555b73ef3a5a6047a1e8d1f
Content-Type: text/plain; charset=ISO-8859-1

HI ALL:
   I have a problem, that our MIPS hardware put registers location from
0x7000,0000 -0x7040,0000.
So, I need to init TLB to access those registers.
   My question is: can I map those range to Kseg2 (mapped,uncached)? I found
"add_wired_entry" sit in
kernel code, seems I should use this function.

   I found code in arch/mips/jazz/irq.c, and the comment tells me
/* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
   add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);

does that mean after add_wired_entry, virtual address 0xe400,0000 map to
physical address 0x600005C0?
why the address is 0x6000,05C0, not 0x6000,0000

Thanks

Dennis

--00032555b73ef3a5a6047a1e8d1f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

HI ALL:<br>=A0=A0 I have a problem, that our MIPS hardware put registers lo=
cation from 0x7000,0000 -0x7040,0000.<br>So, I need to init TLB to access t=
hose registers.<br>=A0=A0 My question is: can I map those range to Kseg2 (m=
apped,uncached)? I found &quot;add_wired_entry&quot; sit in<br>

kernel code, seems I should use this function. <br><br>=A0=A0 I found code =
in arch/mips/jazz/irq.c, and the comment tells me<br>/* Map 0xe4000000 -&gt=
; 0x0:600005C0, 0xe4100000 -&gt; 400005C0 */<br>=A0=A0 add_wired_entry(0x01=
800017, 0x01000017, 0xe4000000, PM_4M);<br>

<br>does that mean after add_wired_entry, virtual address 0xe400,0000 map t=
o physical address 0x600005C0?<br>why the address is 0x6000,05C0, not 0x600=
0,0000<br><br>Thanks<br><br>Dennis<br>

--00032555b73ef3a5a6047a1e8d1f--

From pavel@ucw.cz Mon Dec  7 09:04:52 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 09:04:55 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:52304 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492467AbZLGIEw (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 09:04:52 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id EDA61F01A6; Mon,  7 Dec 2009 09:04:51 +0100 (CET)
Date:   Mon, 7 Dec 2009 09:04:46 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
Message-ID: <20091207080446.GB23088@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
 <20091206084717.GD2766@ucw.cz>
 <1260147298.3126.2.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1260147298.3126.2.camel@falcon.domain.org>
X-Warning: Reading this can be dangerous to your mental health.
User-Agent: Mutt/1.5.20 (2009-06-14)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25344
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips


> > What is going on here? I thought the value is already in two's
> > complement... Is the above equivalent of
> > 
> > 	      if (value < 0)
> > 	      	 value = -value; 
> > 
> > ? If so, why? If not, can you add a comment?
> 
> Right, then, will use this instead:
> 
> static int get_battery_current(void)
> { 
> 	s16 value;
> 
> 	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> 		(ec_read(REG_BAT_CURRENT_LOW));
> 
> 	return abs(value);
> }

That's certainly better. But... why not return signed value? Current
flowing from the battery is certainly very different from current
flowing into it...
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From wuzhangjin@gmail.com Mon Dec  7 10:41:47 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 10:41:51 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:60378 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492929AbZLGJlr (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 10:41:47 +0100
Received: by pzk35 with SMTP id 35so3807419pzk.22
        for <multiple recipients>; Mon, 07 Dec 2009 01:41:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=iueJ1ZW90iKbeFUGWAPugb/6njng6PWnLl9laIu155A=;
        b=wq44n3qQQ0JoGWw8fDiKXwriH9TLrrqLRqo5MfbpKW0238mC2cZgn23QKQVdS23SIN
         8rOsOgnfyMB+p9DzJWoanZlLrGBGS5FjWWo56TE2rmaL78DaK/9ZgNUvsoeqFIyODE62
         UI5zWim8MkzCx9633mMO3Cw1FpT87AaTJW30c=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=H6FQwCvgvdQVIp3vxc3nqFCFO98BG1sYujLquQqpLeCoQUn/+MaIIj6nQN14dlY6nf
         iIPn1kGE6Pe4trvKp87bfGrzM/2wyifvOorxRsItmms097aiKuzE+z3Ih30YgFOg6ZuM
         dq7KXM/w9EUCLOZ2PzqeM1iQYLWfnxkZXrdJY=
Received: by 10.114.49.6 with SMTP id w6mr11161027waw.148.1260178900188;
        Mon, 07 Dec 2009 01:41:40 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm5030721pzk.7.2009.12.07.01.41.34
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 01:41:39 -0800 (PST)
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
In-Reply-To: <20091207080446.GB23088@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
         <20091206084717.GD2766@ucw.cz> <1260147298.3126.2.camel@falcon.domain.org>
         <20091207080446.GB23088@elf.ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Mon, 07 Dec 2009 17:41:10 +0800
Message-ID: <1260178870.9092.34.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25345
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Mon, 2009-12-07 at 09:04 +0100, Pavel Machek wrote:
> > > What is going on here? I thought the value is already in two's
> > > complement... Is the above equivalent of
> > > 
> > > 	      if (value < 0)
> > > 	      	 value = -value; 
> > > 
> > > ? If so, why? If not, can you add a comment?
> > 
> > Right, then, will use this instead:
> > 
> > static int get_battery_current(void)
> > { 
> > 	s16 value;
> > 
> > 	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> > 		(ec_read(REG_BAT_CURRENT_LOW));
> > 
> > 	return abs(value);
> > }
> 
> That's certainly better. But... why not return signed value? Current
> flowing from the battery is certainly very different from current
> flowing into it...

You are totally right ;)

Just test it, when flowing from the battery, the value is negative, and
when flowing into the battery, the value is positive, so, no abs()
needed. thanks!

BTW: This part of source code was written by another EC guy, not checked
it carefully, sorry ;)

Best Regards,
	Wu Zhangjin


From pavel@ucw.cz Mon Dec  7 10:49:17 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 10:49:20 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:55058 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1492978AbZLGJtR (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 10:49:17 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id C6F24F0212; Mon,  7 Dec 2009 10:49:16 +0100 (CET)
Date:   Mon, 7 Dec 2009 10:49:10 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
Message-ID: <20091207094909.GD23088@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
 <20091206084717.GD2766@ucw.cz>
 <1260147298.3126.2.camel@falcon.domain.org>
 <20091207080446.GB23088@elf.ucw.cz>
 <1260178870.9092.34.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1260178870.9092.34.camel@falcon.domain.org>
X-Warning: Reading this can be dangerous to your mental health.
User-Agent: Mutt/1.5.20 (2009-06-14)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25346
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

On Mon 2009-12-07 17:41:10, Wu Zhangjin wrote:
> On Mon, 2009-12-07 at 09:04 +0100, Pavel Machek wrote:
> > > > What is going on here? I thought the value is already in two's
> > > > complement... Is the above equivalent of
> > > > 
> > > > 	      if (value < 0)
> > > > 	      	 value = -value; 
> > > > 
> > > > ? If so, why? If not, can you add a comment?
> > > 
> > > Right, then, will use this instead:
> > > 
> > > static int get_battery_current(void)
> > > { 
> > > 	s16 value;
> > > 
> > > 	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> > > 		(ec_read(REG_BAT_CURRENT_LOW));
> > > 
> > > 	return abs(value);
> > > }
> > 
> > That's certainly better. But... why not return signed value? Current
> > flowing from the battery is certainly very different from current
> > flowing into it...
> 
> You are totally right ;)
> 
> Just test it, when flowing from the battery, the value is negative, and
> when flowing into the battery, the value is positive, so, no abs()
> needed. thanks!

Make it return -value, then. I believe other code uses >0 values for
discharge.
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From wuzhangjin@gmail.com Mon Dec  7 12:01:40 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 12:01:43 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:55022 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493547AbZLGLBk (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 12:01:40 +0100
Received: by pzk35 with SMTP id 35so3841743pzk.22
        for <multiple recipients>; Mon, 07 Dec 2009 03:01:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=jtnOkXIMgedGirpDhioY0DU/ZUSkz9YUkSjMrlGwo40=;
        b=wWHfUGz+WiVZepbH+uMIo9yYC0H7hkwGuN0yqRKNgMlT2WDQaTQlTDYdTdePiRSsdN
         D7w9Qp7kvmSuTD/E2pipcQ/LCeHMZ5rh94MC19IunrNmMZmZCv1yipze1xOz2lvwWBIE
         Emac1OrClpnH6aDQ4sxuY7oQ0V3Fm5o6jejcg=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=ClHG3AMu540gHA4ezSe3pFIw6t8Ua1AX179dvii5mtWT41/xGttlHGBeOVTl+OPqN5
         /Kx5/ripjFQD4f90rWpwzGQ2O1AzyzVyKvvZNRUGHqLnxWz4hiqCOAtlNqS2AKzO1riW
         W9b+2rB8zV57ey5ZAE3/XzN9Y0yX0Y4Vdc5V8=
Received: by 10.114.6.28 with SMTP id 28mr11339181waf.115.1260183691857;
        Mon, 07 Dec 2009 03:01:31 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm5073985pzk.6.2009.12.07.03.01.26
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 03:01:31 -0800 (PST)
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
In-Reply-To: <20091207094909.GD23088@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
         <20091206084717.GD2766@ucw.cz> <1260147298.3126.2.camel@falcon.domain.org>
         <20091207080446.GB23088@elf.ucw.cz>
         <1260178870.9092.34.camel@falcon.domain.org>
         <20091207094909.GD23088@elf.ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Mon, 07 Dec 2009 19:01:03 +0800
Message-ID: <1260183663.9092.51.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25347
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Mon, 2009-12-07 at 10:49 +0100, Pavel Machek wrote:
> On Mon 2009-12-07 17:41:10, Wu Zhangjin wrote:
> > On Mon, 2009-12-07 at 09:04 +0100, Pavel Machek wrote:
> > > > > What is going on here? I thought the value is already in two's
> > > > > complement... Is the above equivalent of
> > > > > 
> > > > > 	      if (value < 0)
> > > > > 	      	 value = -value; 
> > > > > 
> > > > > ? If so, why? If not, can you add a comment?
> > > > 
> > > > Right, then, will use this instead:
> > > > 
> > > > static int get_battery_current(void)
> > > > { 
> > > > 	s16 value;
> > > > 
> > > > 	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> > > > 		(ec_read(REG_BAT_CURRENT_LOW));
> > > > 
> > > > 	return abs(value);
> > > > }
> > > 
> > > That's certainly better. But... why not return signed value? Current
> > > flowing from the battery is certainly very different from current
> > > flowing into it...
> > 
> > You are totally right ;)
> > 
> > Just test it, when flowing from the battery, the value is negative, and
> > when flowing into the battery, the value is positive, so, no abs()
> > needed. thanks!
> 
> Make it return -value, then. I believe other code uses >0 values for
> discharge.
> 	

Done, but any document/standard about it?

Regards,
	Wu Zhangjin


From figo1802@gmail.com Mon Dec  7 13:55:21 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 13:58:45 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:57440 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493770AbZLGMzV (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Mon, 7 Dec 2009 13:55:21 +0100
Received: by pwi18 with SMTP id 18so2477030pwi.24
        for <multiple recipients>; Mon, 07 Dec 2009 04:55:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:date:message-id:subject
         :from:to:cc:content-type;
        bh=rxjNrjYi7BwsSgoC3zO9Y5BlEF23URNA5DiaarGeTro=;
        b=TOUr3nWxktX5NyPlslRH9DQltANRMFEhK40M8zweUfYEYHej/P6Sk9/2bfWaHgkXJs
         EdBPz1rR3dwJD+xkxL24vIzxex4O8cNzXMauO+kP0L3tmC82nFAIda+WURbn9FN5alUb
         3MGuPGf8RdoeDtvqBrc+BnE1cXEIfEcq0LqW8=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:date:message-id:subject:from:to:cc:content-type;
        b=UTgZz4HWSxgU3XFCEAlJiA9ta9Rh4TYmzGe9pYBBUKROi9IuZgTYRf5vOY6l/UQsJz
         b2i0k9XwZNyQt+eXz1dMRkkDcdMpLhYnzqqoP5k8qjmfU8xlGF1bEi8N+J7uPxQa1n29
         +YpBQSRW5YptTWzExTksnGqF87LV8T5yoGfvM=
MIME-Version: 1.0
Received: by 10.115.81.24 with SMTP id i24mr11623414wal.194.1260190512545; 
        Mon, 07 Dec 2009 04:55:12 -0800 (PST)
Date:   Mon, 7 Dec 2009 20:55:12 +0800
Message-ID: <c6ed1ac50912070455n736af31fuf2c981fc182b494f@mail.gmail.com>
Subject: Dma addr should use Kuseg1 for MIPS32?
From:   figo zhang <figo1802@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>,
        David Daney <ddaney@caviumnetworks.com>, macro@linux-mips.org
Cc:     linux-mips@linux-mips.org
Content-Type: multipart/alternative; boundary=0016e64de622d98132047a22f79c
Return-Path: <figo1802@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25348
X-Approved-By: ralf@linux-mips.org
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: figo1802@gmail.com
Precedence: bulk
X-list: linux-mips

--0016e64de622d98132047a22f79c
Content-Type: text/plain; charset=ISO-8859-1

hi,

I am writing a driver for MIPS32. i wirte this code for DMA addr:

dma_vaddr =(char*) __get_free_pages(GFP_KERNEL|
GFP_DMA, order);
dma_phy = virt_to_phy(dma_vaddr);

i write dma_phy to DMA base register, but why it cannot work? it should
write Kseg1 space to DMA register?
I remember that it is ok for ARM/X86 .


Best,
Figo.zhang

--0016e64de622d98132047a22f79c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

hi,<br><br>I am writing a driver for MIPS32. i wirte this code for DMA addr=
:<br><br>dma_vaddr =3D(char*) __get_free_pages(GFP_KERNEL|<div class=3D"im"=
>GFP_DMA, order);<br>dma_phy =3D virt_to_phy(dma_vaddr);<br><br>i write dma=
_phy to DMA base register, but why it cannot work? it should write Kseg1 sp=
ace to DMA register? <br>

I remember that it is ok for ARM/X86 .<br><br><br>Best,<br>Figo.zhang</div>

--0016e64de622d98132047a22f79c--

From ralf@linux-mips.org Mon Dec  7 14:10:37 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 14:10:40 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:47902 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493836AbZLGNKh (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Mon, 7 Dec 2009 14:10:37 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB7DAZaO021002;
        Mon, 7 Dec 2009 13:10:35 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB7DAYjv021000;
        Mon, 7 Dec 2009 13:10:34 GMT
Date:   Mon, 7 Dec 2009 13:10:34 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     "Dennis.Yxun" <dennis.yxun@gmail.com>
Cc:     linux-mips@linux-mips.org
Subject: Re: Question: about Physical Address mapping
Message-ID: <20091207131034.GA5119@linux-mips.org>
References: <7b09df4c0912062339g418f432cr28d92c18ed273d2@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <7b09df4c0912062339g418f432cr28d92c18ed273d2@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25349
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Dec 07, 2009 at 03:39:15PM +0800, Dennis.Yxun wrote:

> HI ALL:
>    I have a problem, that our MIPS hardware put registers location from
> 0x7000,0000 -0x7040,0000.
> So, I need to init TLB to access those registers.
>    My question is: can I map those range to Kseg2 (mapped,uncached)? I found
> "add_wired_entry" sit in
> kernel code, seems I should use this function.
> 
>    I found code in arch/mips/jazz/irq.c, and the comment tells me
> /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
>    add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
> 
> does that mean after add_wired_entry, virtual address 0xe400,0000 map to
> physical address 0x600005C0?
> why the address is 0x6000,05C0, not 0x6000,0000

I probably knew 15 years ago when I wrote this code :)

add_wired_entry() is a very awkard API and its use in the Jazz code is
broken so I suggest you use ioremap() instead.

  Ralf

From zhangfx@lemote.com Mon Dec  7 14:34:12 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 14:34:15 +0100 (CET)
Received: from [222.92.8.141] ([222.92.8.141]:50673 "EHLO lemote.com"
        rhost-flags-FAIL-FAIL-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493664AbZLGNeM (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Mon, 7 Dec 2009 14:34:12 +0100
Received: from localhost (localhost [127.0.0.1])
        by lemote.com (Postfix) with ESMTP id E810731CAF9;
        Mon,  7 Dec 2009 21:20:00 +0800 (CST)
X-Virus-Scanned: Debian amavisd-new at lemote.com
Received: from lemote.com ([127.0.0.1])
        by localhost (www.lemote.com [127.0.0.1]) (amavisd-new, port 10024)
        with ESMTP id TuQzA4zjt0Yl; Mon,  7 Dec 2009 21:19:44 +0800 (CST)
Received: from localhost.localdomain (unknown [222.92.8.142])
        by lemote.com (Postfix) with ESMTP id C3A2D31CAEB;
        Mon,  7 Dec 2009 21:19:43 +0800 (CST)
Message-ID: <4B1D038B.5080801@lemote.com>
Date:   Mon, 07 Dec 2009 21:30:51 +0800
From:   zhangfx <zhangfx@lemote.com>
User-Agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)
MIME-Version: 1.0
To:     figo zhang <figo1802@gmail.com>
CC:     wuzhangjin@gmail.com, linux-mips@linux-mips.org,
        rostedt@goodmis.org
Subject: Re: Dma addr should use Kuseg1 for MIPS32?
References: <c6ed1ac50912062352u227c28e1me2107dbf7bd8a0ea@mail.gmail.com>
In-Reply-To: <c6ed1ac50912062352u227c28e1me2107dbf7bd8a0ea@mail.gmail.com>
Content-Type: multipart/mixed;
 boundary="------------070202050902040205000906"
Return-Path: <zhangfx@lemote.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25350
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: zhangfx@lemote.com
Precedence: bulk
X-list: linux-mips

This is a multi-part message in MIME format.
--------------070202050902040205000906
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

physical address (address comes out of the CPU bus to memory) can be=20
different with bus address(used by DMA) in MIPS boards.

figo zhang =E5=86=99=E9=81=93:
> hi,
>
> I am writing a driver for MIPS32. i wirte this code for DMA addr:
>
> dma_vaddr =3D(char*) __get_free_pages(GFP_KERNEL|GFP_DMA, order);
> dma_phy =3D virt_to_phy(dma_vaddr);
>
> i write dma_phy to DMA base register, but why it cannot work? it=20
> should write Kseg1 space to DMA register?
> I remember that it is ok for ARM/X86 .
>
>
> Best,
> Figo.zhang

--------------070202050902040205000906
Content-Type: text/x-vcard; charset=utf-8;
 name="zhangfx.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="zhangfx.vcf"

YmVnaW46dmNhcmQNCmZuO3F1b3RlZC1wcmludGFibGU6PUU1PUJDPUEwPUU3PUE2PThGPUU2
PTk2PUIwDQpuO3F1b3RlZC1wcmludGFibGU7cXVvdGVkLXByaW50YWJsZTo9RTU9QkM9QTA7
PUU3PUE2PThGPUU2PTk2PUIwDQpvcmc7cXVvdGVkLXByaW50YWJsZTo7PUU3PUFFPUExPUU3
PTkwPTg2PUU5PTgzPUE4DQphZHI7cXVvdGVkLXByaW50YWJsZTtkb206Ozs9RTY9QjE9OUY9
RTg9OEI9OEY9RTc9OUM9ODE9RTU9Qjg9Qjg9RTc9ODY9OUY9RTU9Qjg9ODI9RTg9OTk9OUU9
RTU9QjE9QjE9RTk9DQoJPTk1PTg3PUU2PUEyPUE2PUU1PTg1PUIwPUU1PUI3PUE1PUU0PUI4
PTlBPUU1PTlCPUFEOzs7MjE1NTAwDQplbWFpbDtpbnRlcm5ldDp6aGFuZ2Z4QGxlbW90ZS5j
b20NCnRpdGxlO3F1b3RlZC1wcmludGFibGU6PUU2PTgwPUJCPUU3PUJCPThGPUU3PTkwPTg2
DQp0ZWw7d29yazowNTEyLTUyMzA4Njc5DQp1cmw6aHR0cDovL3d3dy5sZW1vdGUuY29tDQp2
ZXJzaW9uOjIuMQ0KZW5kOnZjYXJkDQoNCg==
--------------070202050902040205000906--

From ralf@linux-mips.org Mon Dec  7 14:45:08 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 14:45:11 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:55696 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493900AbZLGNpI (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Mon, 7 Dec 2009 14:45:08 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB7Dj3Jd022229;
        Mon, 7 Dec 2009 13:45:03 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB7Dj2Zp022227;
        Mon, 7 Dec 2009 13:45:02 GMT
Date:   Mon, 7 Dec 2009 13:45:02 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     figo zhang <figo1802@gmail.com>
Cc:     David Daney <ddaney@caviumnetworks.com>, macro@linux-mips.org,
        linux-mips@linux-mips.org
Subject: Re: Dma addr should use Kuseg1 for MIPS32?
Message-ID: <20091207134502.GB5119@linux-mips.org>
References: <c6ed1ac50912070455n736af31fuf2c981fc182b494f@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <c6ed1ac50912070455n736af31fuf2c981fc182b494f@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25351
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Dec 07, 2009 at 08:55:12PM +0800, figo zhang wrote:

> I am writing a driver for MIPS32. i wirte this code for DMA addr:
> 
> dma_vaddr =(char*) __get_free_pages(GFP_KERNEL|
> GFP_DMA, order);

You probably don't want to use GFP_DMA - unless your hardware has DMA
restrictions such as the ISA's bus's 16MB limit.

> dma_phy = virt_to_phy(dma_vaddr);

Ouch.  Don't.  See Documentation/DMA-API.txt for how to do it.

> i write dma_phy to DMA base register, but why it cannot work? it should
> write Kseg1 space to DMA register?
> I remember that it is ok for ARM/X86 .

It's only happens to work on some systems.

  Ralf

From ralf@linux-mips.org Mon Dec  7 16:02:37 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 16:02:40 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:47975 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493918AbZLGPCh (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Mon, 7 Dec 2009 16:02:37 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB7F2abu024960
        for <linux-mips@linux-mips.org>; Mon, 7 Dec 2009 15:02:37 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB7F2aaq024958
        for linux-mips@linux-mips.org; Mon, 7 Dec 2009 15:02:36 GMT
Date:   Mon, 7 Dec 2009 15:02:36 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     linux-mips@linux-mips.org
Subject: Warning about add_wired_entry
Message-ID: <20091207150236.GD19269@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25352
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

The earlier posting wrt. add_wired_entry reminded my of this long standing
issue.

The kernel does not reserve any address space for use by add_wired_entry().
In other words there is the possibility that vmalloc, ioremap or other
kernel APIs will use the same address space resulting in a crash or worse.

Currently there are three users of add_wired_entry:

 - Alchemy
 - Cavium
 - Jazz

The interface itself also is hostile as it directly exposes the MIPS TLB
registers to the C programmer so should die.  And often wiring a TLB entry
is a bad idea.  TLB entries are a scarce resource and wasting them unwisely
may impact performance.  Especially on the lowest-end CPUs with just
16 TLB entries this can be significant but even on the high-end TLBs with
64 entries it's not always clear if wiring entries is a good idea.  And
there are a few core types that don't even have the capability of wiring
entries.

  Ralf

From sgi-linux-mips@m.gmane.org Mon Dec  7 16:41:48 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Dec 2009 16:41:51 +0100 (CET)
Received: from lo.gmane.org ([80.91.229.12]:59866 "EHLO lo.gmane.org"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493939AbZLGPls (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Mon, 7 Dec 2009 16:41:48 +0100
Received: from list by lo.gmane.org with local (Exim 4.50)
        id 1NHfiY-0002Su-LC
        for linux-mips@linux-mips.org; Mon, 07 Dec 2009 16:41:42 +0100
Received: from rob92-6-82-231-243-221.fbx.proxad.net ([82.231.243.221])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <linux-mips@linux-mips.org>; Mon, 07 Dec 2009 16:41:42 +0100
Received: from pascal by rob92-6-82-231-243-221.fbx.proxad.net with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <linux-mips@linux-mips.org>; Mon, 07 Dec 2009 16:41:42 +0100
X-Injected-Via-Gmane: http://gmane.org/
To:     linux-mips@linux-mips.org
From:   "pascal@pabr.org" <pascal@pabr.org>
Subject:  Re: Warning about add_wired_entry
Date:   Mon, 07 Dec 2009 16:41:04 +0100
Lines:  17
Message-ID: <hfj7mr$lde$1@ger.gmane.org>
References:  <20091207150236.GD19269@linux-mips.org>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1
Content-Transfer-Encoding:  7bit
X-Complaints-To: usenet@ger.gmane.org
X-Gmane-NNTP-Posting-Host: rob92-6-82-231-243-221.fbx.proxad.net
In-Reply-To: <20091207150236.GD19269@linux-mips.org>
Return-Path: <sgi-linux-mips@m.gmane.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25353
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pascal@pabr.org
Precedence: bulk
X-list: linux-mips

Ralf Baechle wrote:
> The kernel does not reserve any address space for use by add_wired_entry().
> In other words there is the possibility that vmalloc, ioremap or other
> kernel APIs will use the same address space resulting in a crash or worse.

Thanks, I was not aware of that.

But what is the alternative ?  I have an Alchemy 1550 board with
an ethernet chip at 0xD-1000-0000, and last time I tried, enabling
  CONFIG_64BIT_PHYS_ADDR,
  CONFIG_ARCH_PHYS_ADDR_T_64BIT and
  CONFIG_PHYS_ADDR_T_64BIT
did not seem to allow access to the 36-bit I/O address space
through the platform_get_resource/request_mem_region machinery.
Is this supposed to work now ?

Pascal


From figo1802@gmail.com Tue Dec  8 02:49:44 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 02:49:48 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:61252 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494562AbZLHBto (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 02:49:44 +0100
Received: by pwj1 with SMTP id 1so400986pwj.24
        for <multiple recipients>; Mon, 07 Dec 2009 17:49:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :date:message-id:subject:from:to:cc:content-type;
        bh=XKXWg8dmOQz/aFW9Ia6RDliGwEBycBvJXX6uUmncVqQ=;
        b=lBbTdrLUPJW/AzOiMVAeoEZQBMm6ItIcXodLYtDjDzfuEK6orXwAar0ZdzNelYxK8f
         c/WN/tjn5U36H5TunUeN5ERums/usggcebXkov7xi1NQk6ramvQ/Wamxs0qD9EBjJGaT
         FjoRUlTXBocEFUrGqP1s9pmG/+plc3ct01jT8=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc:content-type;
        b=vlOkVJXlpNONdLvfrMF6nNykCAZgbwMRZIupv3l09Jyp2C4VciOUUwJbf35BWaEPq8
         ySCm9cSk5CljVB+qJNOU+rn7X50L407QJ0YaiyoZpI2mlsO8JhnWujTDWQg5Dapw9oIl
         8aTIzmbO/oG4FMqv/9mFNvigY6E6eUoXqvrco=
MIME-Version: 1.0
Received: by 10.115.117.4 with SMTP id u4mr13666518wam.43.1260236974784; Mon, 
        07 Dec 2009 17:49:34 -0800 (PST)
In-Reply-To: <20091207134502.GB5119@linux-mips.org>
References: <c6ed1ac50912070455n736af31fuf2c981fc182b494f@mail.gmail.com>
         <20091207134502.GB5119@linux-mips.org>
Date:   Tue, 8 Dec 2009 09:49:34 +0800
Message-ID: <c6ed1ac50912071749m49b1e5f5m7ae53384389338d9@mail.gmail.com>
Subject: Re: Dma addr should use Kuseg1 for MIPS32?
From:   figo zhang <figo1802@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     David Daney <ddaney@caviumnetworks.com>, macro@linux-mips.org,
        linux-mips@linux-mips.org
Content-Type: multipart/alternative; boundary=0016e64e9098384a61047a2dc9a0
Return-Path: <figo1802@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25354
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: figo1802@gmail.com
Precedence: bulk
X-list: linux-mips

--0016e64e9098384a61047a2dc9a0
Content-Type: text/plain; charset=ISO-8859-1

2009/12/7 Ralf Baechle <ralf@linux-mips.org>

> On Mon, Dec 07, 2009 at 08:55:12PM +0800, figo zhang wrote:
>
> > I am writing a driver for MIPS32. i wirte this code for DMA addr:
> >
> > dma_vaddr =(char*) __get_free_pages(GFP_KERNEL|
> > GFP_DMA, order);
>
> You probably don't want to use GFP_DMA - unless your hardware has DMA
> restrictions such as the ISA's bus's 16MB limit.
>
> > dma_phy = virt_to_phy(dma_vaddr);
>

> Ouch.  Don't.  See Documentation/DMA-API.txt for how to do it.
>

hi Ralf,
is it using dma_alloc_coherent()? i see the this funtion in
arch/mips/mm/dma_default.c, it also invork the
__get_free_pages() and return the dma_addr by
plat_map_dma_mem()->virt_to_phy() , see
include/asm-mips/mach-genric/dma-coherent.h. so i think, i see use
__get_free_pages() alloce buffer for DMA.

>
> > i write dma_phy to DMA base register, but why it cannot work? it should
> > write Kseg1 space to DMA register?
> > I remember that it is ok for ARM/X86 .
>
> It's only happens to work on some systems.
>

in my puzzle, if i run
dma_vaddr =(char*) __get_free_pages(GFP_KERNEL,  order);
dma_phy = virt_to_phy(dma_vaddr);

if the result is:
dma_vaddr = 0x801b00000;
dma_phy = 0x1b00000;

so i should write 0x1b00000 to my DMA Base register or wirte (0x1b000000 |
0xa0000000) to DMA?

2. If my system have HIGHMEM, so i alloc highmem pages by :
  page = alloc_pages(__GFP_HIGHMEM, order);
  phy = page_to_phys(page);

how i write this highmem phy addr to DMA base register?

Best,
Figo.zhang



>  Ralf
>

--0016e64e9098384a61047a2dc9a0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br><div class=3D"gmail_quote">2009/12/7 Ralf Baechle <span dir=3D"ltr"=
>&lt;<a href=3D"mailto:ralf@linux-mips.org">ralf@linux-mips.org</a>&gt;</sp=
an><br><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rg=
b(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class=3D"im">On Mon, Dec 07, 2009 at 08:55:12PM +0800, figo zhang wrot=
e:<br>
<br>
&gt; I am writing a driver for MIPS32. i wirte this code for DMA addr:<br>
&gt;<br>
&gt; dma_vaddr =3D(char*) __get_free_pages(GFP_KERNEL|<br>
&gt; GFP_DMA, order);<br>
<br>
</div>You probably don&#39;t want to use GFP_DMA - unless your hardware has=
 DMA<br>
restrictions such as the ISA&#39;s bus&#39;s 16MB limit.<br>
<div><br>
&gt; dma_phy =3D virt_to_phy(dma_vaddr); <br></div></blockquote><blockquote=
 class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); =
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class=3D"im">
<br>
</div>Ouch. =A0Don&#39;t. =A0See Documentation/DMA-API.txt for how to do it=
.<br></blockquote><div><br>hi Ralf, <br>is it using dma_alloc_coherent()? i=
 see the this funtion in arch/mips/mm/dma_default.c, it also invork the=A0 =
<br>
__get_free_pages() and return the dma_addr by plat_map_dma_mem()-&gt;virt_t=
o_phy() , see include/asm-mips/mach-genric/dma-coherent.h. so i think, i se=
e use __get_free_pages() alloce buffer for DMA.<br></div><blockquote class=
=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin=
: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class=3D"im"><br>
&gt; i write dma_phy to DMA base register, but why it cannot work? it shoul=
d<br>
&gt; write Kseg1 space to DMA register?<br>
&gt; I remember that it is ok for ARM/X86 .<br>
<br>
</div>It&#39;s only happens to work on some systems.<br></blockquote><div><=
br>in my puzzle, if i run=A0 <br>dma_vaddr =3D(char*) __get_free_pages(GFP_=
KERNEL,=A0 order);<br>dma_phy =3D virt_to_phy(dma_vaddr); <br><br>if the re=
sult is:<br>
dma_vaddr =3D 0x801b00000;<br>dma_phy =3D 0x1b00000;<br><br>so i should wri=
te 0x1b00000 to my DMA Base register or wirte (0x1b000000 | 0xa0000000) to =
DMA?<br><br>2. If my system have HIGHMEM, so i alloc highmem pages by :<br>
=A0 page =3D alloc_pages(__GFP_HIGHMEM, order);<br>=A0 phy =3D page_to_phys=
(page);<br><br>how i write this highmem phy addr to DMA base register?<br><=
br>Best,<br>Figo.zhang<br>=A0 <br><br></div><blockquote class=3D"gmail_quot=
e" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt =
0.8ex; padding-left: 1ex;">

<font color=3D"#888888"><br>
 =A0Ralf<br>
</font></blockquote></div><br>

--0016e64e9098384a61047a2dc9a0--

From wuzhangjin@gmail.com Tue Dec  8 07:51:37 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 07:51:40 +0100 (CET)
Received: from mail-yw0-f203.google.com ([209.85.211.203]:65521 "EHLO
        mail-yw0-f203.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491036AbZLHGvh (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 07:51:37 +0100
Received: by ywh41 with SMTP id 41so7394148ywh.0
        for <multiple recipients>; Mon, 07 Dec 2009 22:51:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=EtAEBQV8n0GY8JzHypYEVZXP+R2oo7mma7FaJgup1L4=;
        b=EOAb0iN07i/YeORR6XuxZFy9SAsb2dh6h1Sum9p0ns1ABAo8cPQsgoITS+C/VoodbN
         ryKrA7JSvVaZg2+ZzeatmfZY88kIBmk2IT7ZWJAoTiANrZlW7f/wWfz8ZTRZX/7HBhnI
         p14xiBLZXfE7A7zVzOZM4G4RST3dVI9cbFx20=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=AJUjP9wk8l+WV3InT9Sq1jIkMlUA3zdhN73j/lys+IPlbdhYJJQIeu71PTGBlyVEMB
         wBSttF5g18OHlu0q49E/fuMVesQYT7dDahjy4c9Fzg0/a6oSgugouM7YY3CCPCyz3bGd
         gL1RzLyX1HgAexVC1C5dlUbfHyAO32l45lRS0=
Received: by 10.90.21.8 with SMTP id 8mr1816536agu.35.1260255088635;
        Mon, 07 Dec 2009 22:51:28 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm3985032iwn.12.2009.12.07.22.51.21
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 22:51:26 -0800 (PST)
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
In-Reply-To: <20091207094909.GD23088@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
         <20091206084717.GD2766@ucw.cz> <1260147298.3126.2.camel@falcon.domain.org>
         <20091207080446.GB23088@elf.ucw.cz>
         <1260178870.9092.34.camel@falcon.domain.org>
         <20091207094909.GD23088@elf.ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 14:50:56 +0800
Message-ID: <1260255056.3315.23.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25355
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

Hi, Pavel Machek

After fixing the get_battery_current(), can I get your Acked-by: for the
next revision of this patch?

Thanks!
	Wu Zhangjin

On Mon, 2009-12-07 at 10:49 +0100, Pavel Machek wrote:
> On Mon 2009-12-07 17:41:10, Wu Zhangjin wrote:
> > On Mon, 2009-12-07 at 09:04 +0100, Pavel Machek wrote:
> > > > > What is going on here? I thought the value is already in two's
> > > > > complement... Is the above equivalent of
> > > > > 
> > > > > 	      if (value < 0)
> > > > > 	      	 value = -value; 
> > > > > 
> > > > > ? If so, why? If not, can you add a comment?
> > > > 
> > > > Right, then, will use this instead:
> > > > 
> > > > static int get_battery_current(void)
> > > > { 
> > > > 	s16 value;
> > > > 
> > > > 	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> > > > 		(ec_read(REG_BAT_CURRENT_LOW));
> > > > 
> > > > 	return abs(value);
> > > > }
> > > 
> > > That's certainly better. But... why not return signed value? Current
> > > flowing from the battery is certainly very different from current
> > > flowing into it...
> > 
> > You are totally right ;)
> > 
> > Just test it, when flowing from the battery, the value is negative, and
> > when flowing into the battery, the value is positive, so, no abs()
> > needed. thanks!
> 
> Make it return -value, then. I believe other code uses >0 values for
> discharge.
> 									Pavel
> 



From wuzhangjin@gmail.com Tue Dec  8 07:53:00 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 07:53:03 +0100 (CET)
Received: from mail-yx0-f204.google.com ([209.85.210.204]:56888 "EHLO
        mail-yx0-f204.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491036AbZLHGxA (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 07:53:00 +0100
Received: by yxe42 with SMTP id 42so5169455yxe.22
        for <multiple recipients>; Mon, 07 Dec 2009 22:52:53 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=4DMXwcnf5DHuVLR0NDW43emnVxj4TE+CnE7lEzomZBo=;
        b=kuIx6krXo8y3FaouxSmR9NVGSmM1KSL/z12ldLkMlVG0lf56+KoXGADlirYGZ2cW1l
         VsB/gj1FsTY/L1OGKOaPT9SO5ewOzMDnSGx9QQy2BuwLFEte5tIZ6HiAaKEOvnFtSWED
         K87U0be3KGeStsyJZUw0kZBO25NYb5G4AMyxs=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=EfxRhkYH9GtE2DXw82g+dGfkHQqt2wrjk60EmytRA91YE1JJQ9QFh3Olil9j8UF6BI
         bkjDBDna0OZZzSJNX8r+gRXc0cEoz/ErFQruwJCs/j0FXajC3YUlgiK7cMoiM1GVOCqx
         5Cfbw1ixlgimuaW7YzH/l4YsY5eBvgyx4hBV0=
Received: by 10.90.253.16 with SMTP id a16mr12452855agi.3.1260255172769;
        Mon, 07 Dec 2009 22:52:52 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 34sm2906935yxf.65.2009.12.07.22.52.39
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 22:52:51 -0800 (PST)
Subject: Re: [PATCH v8 8/8] Loongson: YeeLoong: add input/hotkey driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
In-Reply-To: <20091207064857.GG21451@core.coreip.homeip.net>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <b164d5bb79963a57621d024c22e5664de0ff8662.1260082252.git.wuzhangjin@gmail.com>
         <20091207064857.GG21451@core.coreip.homeip.net>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 14:52:11 +0800
Message-ID: <1260255131.3315.25.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25356
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

Hi, Dmitry Torokhov

I plan to send another revision of this patchset, Can I get your
Acked-by: for this patch?

Thanks!
	Wu Zhangjin

On Sun, 2009-12-06 at 22:48 -0800, Dmitry Torokhov wrote:
> Hi Wu,
> 
> On Sun, Dec 06, 2009 at 03:01:48PM +0800, Wu Zhangjin wrote:
> > +
> > +#define EC_VER_LEN 64
> > +
> > +static int black_screen_handler(int status)
> > +{
> > +	char *p, ec_ver[EC_VER_LEN];
> > +
> > +	p = strstr(loongson_cmdline, "EC_VER=");
> > +	if (!p)
> > +		memset(ec_ver, 0, EC_VER_LEN);
> > +	else {
> > +		strncpy(ec_ver, p, EC_VER_LEN);
> > +		p = strstr(ec_ver, " ");
> > +		if (p)
> > +			*p = '\0';
> > +	}
> > +
> 
> Hmm, why do you copy and parse command lineinstead of using module
> param and also doing it just once?
> 
> > +	/* Seems EC(>=PQ1D26) does this job for us, we can not do it again,
> > +	 * otherwise, the brightness will not resume to the normal level! */
> > +	if (strncasecmp(ec_ver, "EC_VER=PQ1D26", 64) < 0)
> > +		yeeloong_lcd_vo_set(status);
> > +
> > +	return status;
> > +}
> 
> Thanks.
> 



From wuzhangjin@gmail.com Tue Dec  8 07:54:51 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 07:54:54 +0100 (CET)
Received: from mail-iw0-f180.google.com ([209.85.223.180]:38911 "EHLO
        mail-iw0-f180.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491036AbZLHGyv (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 07:54:51 +0100
Received: by iwn10 with SMTP id 10so3633109iwn.22
        for <multiple recipients>; Mon, 07 Dec 2009 22:54:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=ERSqZNqGRLDEztAuCsjgwAa6Elbvg8DH51MUNB+ANCE=;
        b=x0RKevPUTEstUql19qwS1uA1FmTrAag64MkfZ5NGY7L24k70mSrR1LhmVNmE9gVLia
         ZLUt7Hwa1oBBEMfVfYhaOv/3gjlyWLWhbj0ofJXaSv4ejDLOniYcezqgxqlNhSVsnArx
         gjtrxzIes+V8cmTCQZx4HxAB+y7Dz+I+6ctEY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=Wf6EDkUL+Ca3/OrrN9m7sGkODkDYhCekuC5YmorgnFyyE7N7rR0Rb1IWaUvotRl6bQ
         o2xtwL46HhrBKGnFqiKD+x7SI5t3EpbQdbG31poqYsKnulpDZtb+szspFlOifzEyi4B1
         n5gpIXsXq+qBlGiU/AD2SWKvzQav/6JgD0Bxg=
Received: by 10.231.20.230 with SMTP id g38mr192267ibb.49.1260255280571;
        Mon, 07 Dec 2009 22:54:40 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm3959054iwn.13.2009.12.07.22.54.32
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 22:54:39 -0800 (PST)
Subject: Re: [PATCH v7 6/8] Loongson: YeeLoong: add video output driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, linux-laptop@vger.kernel.org,
        luming.yu@intel.com
In-Reply-To: <5fd87c1f64a3c6d3e51fc6b0224cc1be3cb0d9d5.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
         <5fd87c1f64a3c6d3e51fc6b0224cc1be3cb0d9d5.1259932036.git.wuzhangjin@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 14:54:08 +0800
Message-ID: <1260255248.3315.28.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25357
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

Hi, Pavel

Can I get your Acked-by: for this patch?

Thanks!
	Wu Zhangjin

On Fri, 2009-12-04 at 21:36 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds Video Output Driver, it provides standard
> interface(/sys/class/video_output) to turn on/off the video output of
> LCD, CRT.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  drivers/platform/mips/Kconfig           |    1 +
>  drivers/platform/mips/yeeloong_laptop.c |  147 +++++++++++++++++++++++++++++++
>  2 files changed, 148 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
> index 9c8385c..4a89c01 100644
> --- a/drivers/platform/mips/Kconfig
> +++ b/drivers/platform/mips/Kconfig
> @@ -21,6 +21,7 @@ config LEMOTE_YEELOONG2F
>  	select SYS_SUPPORTS_APM_EMULATION
>  	select APM_EMULATION
>  	select HWMON
> +	select VIDEO_OUTPUT_CONTROL
>  	default m
>  	help
>  	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
> diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
> index 644aaa7..8378926 100644
> --- a/drivers/platform/mips/yeeloong_laptop.c
> +++ b/drivers/platform/mips/yeeloong_laptop.c
> @@ -16,6 +16,7 @@
>  #include <linux/apm-emulation.h>/* for battery subdriver */
>  #include <linux/hwmon.h>	/* for hwmon subdriver */
>  #include <linux/hwmon-sysfs.h>
> +#include <linux/video_output.h>	/* for video output subdriver */
>  
>  #include <ec_kb3310b.h>
>  
> @@ -397,6 +398,144 @@ static void yeeloong_hwmon_exit(void)
>  	}
>  }
>  
> +/* video output subdriver */
> +
> +static int lcd_video_output_get(struct output_device *od)
> +{
> +	return ec_read(REG_DISPLAY_LCD);
> +}
> +
> +static int lcd_video_output_set(struct output_device *od)
> +{
> +	int value;
> +	unsigned long status;
> +
> +	status = !!od->request_state;
> +
> +	if (status == BIT_DISPLAY_LCD_ON) {
> +		/* Turn on LCD */
> +		outb(0x31, 0x3c4);
> +		value = inb(0x3c5);
> +		value = (value & 0xf8) | 0x03;
> +		outb(0x31, 0x3c4);
> +		outb(value, 0x3c5);
> +		/* Turn on backlight */
> +		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_ON);
> +	} else {
> +		/* Turn off backlight */
> +		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_OFF);
> +		/* Turn off LCD */
> +		outb(0x31, 0x3c4);
> +		value = inb(0x3c5);
> +		value = (value & 0xf8) | 0x02;
> +		outb(0x31, 0x3c4);
> +		outb(value, 0x3c5);
> +	}
> +
> +	return 0;
> +}
> +
> +static struct output_properties lcd_output_properties = {
> +	.set_state = lcd_video_output_set,
> +	.get_status = lcd_video_output_get,
> +};
> +
> +static int crt_video_output_get(struct output_device *od)
> +{
> +	return ec_read(REG_CRT_DETECT);
> +}
> +
> +static int crt_video_output_set(struct output_device *od)
> +{
> +	int value;
> +	unsigned long status;
> +
> +	status = !!od->request_state;
> +
> +	if (status == BIT_CRT_DETECT_PLUG) {
> +		if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG) {
> +			/* Turn on CRT */
> +			outb(0x21, 0x3c4);
> +			value = inb(0x3c5);
> +			value &= ~(1 << 7);
> +			outb(0x21, 0x3c4);
> +			outb(value, 0x3c5);
> +		}
> +	} else {
> +		/* Turn off CRT */
> +		outb(0x21, 0x3c4);
> +		value = inb(0x3c5);
> +		value |= (1 << 7);
> +		outb(0x21, 0x3c4);
> +		outb(value, 0x3c5);
> +	}
> +
> +	return 0;
> +}
> +
> +static struct output_properties crt_output_properties = {
> +	.set_state = crt_video_output_set,
> +	.get_status = crt_video_output_get,
> +};
> +
> +static struct output_device *lcd_output_dev, *crt_output_dev;
> +
> +static void yeeloong_lcd_vo_set(int status)
> +{
> +	lcd_output_dev->request_state = status;
> +	lcd_video_output_set(lcd_output_dev);
> +}
> +
> +static void yeeloong_crt_vo_set(int status)
> +{
> +	crt_output_dev->request_state = status;
> +	crt_video_output_set(crt_output_dev);
> +}
> +
> +static int yeeloong_vo_init(void)
> +{
> +	int ret;
> +
> +	/* Register video output device: lcd, crt */
> +	lcd_output_dev = video_output_register("LCD", NULL, NULL,
> +			&lcd_output_properties);
> +
> +	if (IS_ERR(lcd_output_dev)) {
> +		ret = PTR_ERR(lcd_output_dev);
> +		lcd_output_dev = NULL;
> +		return ret;
> +	}
> +	/* Ensure LCD is on by default */
> +	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
> +
> +	crt_output_dev = video_output_register("CRT", NULL, NULL,
> +			&crt_output_properties);
> +
> +	if (IS_ERR(crt_output_dev)) {
> +		ret = PTR_ERR(crt_output_dev);
> +		crt_output_dev = NULL;
> +		return ret;
> +	}
> +
> +	/* Turn off CRT by default, and will be enabled when the CRT
> +	 * connectting event reported by SCI */
> +	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
> +
> +	return 0;
> +}
> +
> +static void yeeloong_vo_exit(void)
> +{
> +	if (lcd_output_dev) {
> +		video_output_unregister(lcd_output_dev);
> +		lcd_output_dev = NULL;
> +	}
> +	if (crt_output_dev) {
> +		video_output_unregister(crt_output_dev);
> +		crt_output_dev = NULL;
> +	}
> +}
> +
>  static struct platform_device_id platform_device_ids[] = {
>  	{
>  		.name = "yeeloong_laptop",
> @@ -443,11 +582,19 @@ static int __init yeeloong_init(void)
>  		return ret;
>  	}
>  
> +	ret = yeeloong_vo_init();
> +	if (ret) {
> +		pr_err("Fail to register yeeloong video output driver.\n");
> +		yeeloong_vo_exit();
> +		return ret;
> +	}
> +
>  	return 0;
>  }
>  
>  static void __exit yeeloong_exit(void)
>  {
> +	yeeloong_vo_exit();
>  	yeeloong_hwmon_exit();
>  	yeeloong_battery_exit();
>  	yeeloong_backlight_exit();



From wuzhangjin@gmail.com Tue Dec  8 07:57:59 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 07:58:04 +0100 (CET)
Received: from mail-gx0-f210.google.com ([209.85.217.210]:38967 "EHLO
        mail-gx0-f210.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491037AbZLHG57 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 07:57:59 +0100
Received: by gxk2 with SMTP id 2so4608412gxk.4
        for <multiple recipients>; Mon, 07 Dec 2009 22:57:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=VegzTiCpu8F50+DhLpnGs+6ehx7jQ+C3NPtp5EJL7Cw=;
        b=CQoyI5kw9bKQG97/pb3TFv9Q6x8raobsrhC+G7slm7Z9LC1XYlS92M15i+eFL2ebYp
         06qN8SVj4ZK3/iHPnsOa7uq3Q5XmRD98z6GFWdeop+zde/Pk7hof8WWc8K/WU1LAlELu
         eWBcIBQUmZNexiiBcljFo5YsEQel7PgoXPC64=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=NFRM90g46VJ53OOqjTxgvMZYv/le3qNpTghaRcATD6yjIEVjMHvBY6YFGLnStUIq5+
         hc20i8CZU28cui8iR/Sly31Qvm0ak7+o5ObW82vHZ2+LEfZ0mG+Arip0r3DZ6gQX0XrI
         ksNVzO/h4Mi1oJA3u/kTFXz6DEfcDQnPe+Mfs=
Received: by 10.150.39.1 with SMTP id m1mr13314624ybm.100.1260255469668;
        Mon, 07 Dec 2009 22:57:49 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm2327962ywh.16.2009.12.07.22.57.41
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 22:57:48 -0800 (PST)
Subject: Re: [PATCH v7 4/8] Loongson: YeeLoong: add battery driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     akpm@linux-foundation.org, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        Pavel Machek <pavel@ucw.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
        zhangfx@lemote.com, Stephen Rothwell <sfr@canb.auug.org.au>,
        linux-laptop@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>
In-Reply-To: <059fa216d70771a6341edb2db4cc559e958273e9.1259932036.git.wuzhangjin@gmail.com>
References: <cover.1259932036.git.wuzhangjin@gmail.com>
         <059fa216d70771a6341edb2db4cc559e958273e9.1259932036.git.wuzhangjin@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 14:57:17 +0800
Message-ID: <1260255437.3315.35.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25358
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

Hi, Pavel

Seems you have reviewed this patch, can I get your Acked-by:?

Thanks!
	Wu Zhangjin

On Fri, 2009-12-04 at 21:34 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds APM emulated Battery Driver, it provides standard
> interface(/proc/apm) for user-space applications(e.g. kpowersave,
> gnome-power-manager) to manage the battery.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  drivers/platform/mips/Kconfig           |    2 +
>  drivers/platform/mips/yeeloong_laptop.c |  104 +++++++++++++++++++++++++++++++
>  2 files changed, 106 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
> index f7a3705..0c6b5ad 100644
> --- a/drivers/platform/mips/Kconfig
> +++ b/drivers/platform/mips/Kconfig
> @@ -18,6 +18,8 @@ config LEMOTE_YEELOONG2F
>  	tristate "Lemote YeeLoong Laptop"
>  	depends on LEMOTE_MACH2F
>  	select BACKLIGHT_CLASS_DEVICE
> +	select SYS_SUPPORTS_APM_EMULATION
> +	select APM_EMULATION
>  	default m
>  	help
>  	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
> diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
> index fbc4ebb..729e368 100644
> --- a/drivers/platform/mips/yeeloong_laptop.c
> +++ b/drivers/platform/mips/yeeloong_laptop.c
> @@ -13,6 +13,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/backlight.h>	/* for backlight subdriver */
>  #include <linux/fb.h>
> +#include <linux/apm-emulation.h>/* for battery subdriver */
>  
>  #include <ec_kb3310b.h>
>  
> @@ -83,6 +84,106 @@ static void yeeloong_backlight_exit(void)
>  	}
>  }
>  
> +/* battery subdriver */
> +
> +static void get_fixed_battery_info(void)
> +{
> +	int design_cap, full_charged_cap, design_vol, vendor, cell_count;
> +
> +	design_cap = (ec_read(REG_BAT_DESIGN_CAP_HIGH) << 8)
> +	    | ec_read(REG_BAT_DESIGN_CAP_LOW);
> +	full_charged_cap = (ec_read(REG_BAT_FULLCHG_CAP_HIGH) << 8)
> +	    | ec_read(REG_BAT_FULLCHG_CAP_LOW);
> +	design_vol = (ec_read(REG_BAT_DESIGN_VOL_HIGH) << 8)
> +	    | ec_read(REG_BAT_DESIGN_VOL_LOW);
> +	vendor = ec_read(REG_BAT_VENDOR);
> +	cell_count = ec_read(REG_BAT_CELL_COUNT);
> +
> +	if (vendor != 0) {
> +		pr_info("battery vendor(%s), cells count(%d), "
> +		       "with designed capacity(%d),designed voltage(%d),"
> +		       " full charged capacity(%d)\n",
> +		       (vendor ==
> +			FLAG_BAT_VENDOR_SANYO) ? "SANYO" : "SIMPLO",
> +		       (cell_count == FLAG_BAT_CELL_3S1P) ? 3 : 6,
> +		       design_cap, design_vol,
> +		       full_charged_cap);
> +	}
> +}
> +
> +#define APM_CRITICAL		5
> +
> +static void get_power_status(struct apm_power_info *info)
> +{
> +	unsigned char bat_status;
> +
> +	info->battery_status = APM_BATTERY_STATUS_UNKNOWN;
> +	info->battery_flag = APM_BATTERY_FLAG_UNKNOWN;
> +	info->units = APM_UNITS_MINS;
> +
> +	info->battery_life = (ec_read(REG_BAT_RELATIVE_CAP_HIGH) << 8) |
> +		(ec_read(REG_BAT_RELATIVE_CAP_LOW));
> +
> +	info->ac_line_status = (ec_read(REG_BAT_POWER) & BIT_BAT_POWER_ACIN) ?
> +		APM_AC_ONLINE : APM_AC_OFFLINE;
> +
> +	bat_status = ec_read(REG_BAT_STATUS);
> +
> +	if (!(bat_status & BIT_BAT_STATUS_IN)) {
> +		/* no battery inserted */
> +		info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT;
> +		info->battery_flag = APM_BATTERY_FLAG_NOT_PRESENT;
> +		info->time = 0x00;
> +		return;
> +	}
> +
> +	/* adapter inserted */
> +	if (info->ac_line_status == APM_AC_ONLINE) {
> +		if (!(bat_status & BIT_BAT_STATUS_FULL)) {
> +			/* battery is not fully charged */
> +			info->battery_status = APM_BATTERY_STATUS_CHARGING;
> +			info->battery_flag = APM_BATTERY_FLAG_CHARGING;
> +		} else {
> +			/* battery is fully charged */
> +			info->battery_status = APM_BATTERY_STATUS_HIGH;
> +			info->battery_flag = APM_BATTERY_FLAG_HIGH;
> +			info->battery_life = 100;
> +		}
> +	} else {
> +		/* battery is too low */
> +		if (bat_status & BIT_BAT_STATUS_LOW) {
> +			info->battery_status = APM_BATTERY_STATUS_LOW;
> +			info->battery_flag = APM_BATTERY_FLAG_LOW;
> +			if (info->battery_life <= APM_CRITICAL) {
> +				/* we should power off the system now */
> +				info->battery_status =
> +					APM_BATTERY_STATUS_CRITICAL;
> +				info->battery_flag = APM_BATTERY_FLAG_CRITICAL;
> +			}
> +		} else {
> +			/* assume the battery is high enough. */
> +			info->battery_status = APM_BATTERY_STATUS_HIGH;
> +			info->battery_flag = APM_BATTERY_FLAG_HIGH;
> +		}
> +	}
> +	info->time = ((info->battery_life - 3) * 54 + 142) / 60;
> +}
> +
> +static int yeeloong_battery_init(void)
> +{
> +	get_fixed_battery_info();
> +
> +	apm_get_power_status = get_power_status;
> +
> +	return 0;
> +}
> +
> +static void yeeloong_battery_exit(void)
> +{
> +	if (apm_get_power_status == get_power_status)
> +		apm_get_power_status = NULL;
> +}
> +
>  static struct platform_device_id platform_device_ids[] = {
>  	{
>  		.name = "yeeloong_laptop",
> @@ -120,11 +221,14 @@ static int __init yeeloong_init(void)
>  		return ret;
>  	}
>  
> +	yeeloong_battery_init();
> +
>  	return 0;
>  }
>  
>  static void __exit yeeloong_exit(void)
>  {
> +	yeeloong_battery_exit();
>  	yeeloong_backlight_exit();
>  	platform_driver_unregister(&platform_driver);
>  



From pavel@ucw.cz Tue Dec  8 08:06:52 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:06:55 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:37772 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491033AbZLHHGw (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:06:52 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id 5CADAF025A; Tue,  8 Dec 2009 08:06:52 +0100 (CET)
Date:   Tue, 8 Dec 2009 08:06:44 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
Message-ID: <20091208070643.GB12264@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
 <20091206084717.GD2766@ucw.cz>
 <1260147298.3126.2.camel@falcon.domain.org>
 <20091207080446.GB23088@elf.ucw.cz>
 <1260178870.9092.34.camel@falcon.domain.org>
 <20091207094909.GD23088@elf.ucw.cz>
 <1260255056.3315.23.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1260255056.3315.23.camel@falcon.domain.org>
X-Warning: Reading this can be dangerous to your mental health.
User-Agent: Mutt/1.5.20 (2009-06-14)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25359
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

On Tue 2009-12-08 14:50:56, Wu Zhangjin wrote:
> Hi, Pavel Machek
> 
> After fixing the get_battery_current(), can I get your Acked-by: for the
> next revision of this patch?

Yes... you can add my ack for 4-6/8.
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From pavel@ucw.cz Tue Dec  8 08:09:23 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:09:27 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:41716 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491037AbZLHHJX (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:09:23 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id 96B61F02FE; Tue,  8 Dec 2009 08:09:23 +0100 (CET)
Date:   Tue, 8 Dec 2009 08:09:15 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
Message-ID: <20091208070915.GC12264@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
 <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
 <20091206084717.GD2766@ucw.cz>
 <1260147298.3126.2.camel@falcon.domain.org>
 <20091207080446.GB23088@elf.ucw.cz>
 <1260178870.9092.34.camel@falcon.domain.org>
 <20091207094909.GD23088@elf.ucw.cz>
 <1260183663.9092.51.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1260183663.9092.51.camel@falcon.domain.org>
X-Warning: Reading this can be dangerous to your mental health.
User-Agent: Mutt/1.5.20 (2009-06-14)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25360
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

> > > > That's certainly better. But... why not return signed value? Current
> > > > flowing from the battery is certainly very different from current
> > > > flowing into it...
> > > 
> > > You are totally right ;)
> > > 
> > > Just test it, when flowing from the battery, the value is negative, and
> > > when flowing into the battery, the value is positive, so, no abs()
> > > needed. thanks!
> > 
> > Make it return -value, then. I believe other code uses >0 values for
> > discharge.
> 
> Done, but any document/standard about it?

Not sure, feel free to patch the documentation, too :-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From wuzhangjin@gmail.com Tue Dec  8 08:18:37 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:18:40 +0100 (CET)
Received: from mail-gx0-f210.google.com ([209.85.217.210]:41686 "EHLO
        mail-gx0-f210.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491038AbZLHHSh (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:18:37 +0100
Received: by gxk2 with SMTP id 2so4616706gxk.4
        for <multiple recipients>; Mon, 07 Dec 2009 23:18:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=xo93w+wTVQGNGLw9rJoV2rEM1jHwT7Txodgu503bGRU=;
        b=kMYdpYclPsbT4OCB+xpM5m3ymhE8C/kPLkJK06bqzWS++MtK6VtXKJul0+I3Bl5PWE
         Ky5qY0YxEBJwJ0Q+rm4kV0lIXL0FQxIryDXVo0Vzph0jovDBxqapOsmjjPuO7KCxwgDM
         eJZVLglnoWFRkUI6Slxctyh9aED/+uEF0N7Dg=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=Jkum7aRvZyzYxxlsf6l4dshJgDuBx2uo4ryvGCwWNpbXOsgSPRwl4GtoKjhgjH0XHt
         cmrP/YNJdbM1YElSC2HQ6aqh+6XQT9t3Wm19khOIf+h12NIM1Mo1wZj2O+GBpjYUACoE
         r8tbm683ooI70+WbmngqAzoxZIFyb1qAA8VRI=
Received: by 10.91.81.18 with SMTP id i18mr12550542agl.47.1260256711291;
        Mon, 07 Dec 2009 23:18:31 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 39sm2905858yxd.63.2009.12.07.23.18.25
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 23:18:30 -0800 (PST)
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
In-Reply-To: <20091208070643.GB12264@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
         <20091206084717.GD2766@ucw.cz> <1260147298.3126.2.camel@falcon.domain.org>
         <20091207080446.GB23088@elf.ucw.cz>
         <1260178870.9092.34.camel@falcon.domain.org>
         <20091207094909.GD23088@elf.ucw.cz>
         <1260255056.3315.23.camel@falcon.domain.org>
         <20091208070643.GB12264@elf.ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 15:18:01 +0800
Message-ID: <1260256681.3315.54.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25361
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-08 at 08:06 +0100, Pavel Machek wrote:
> On Tue 2009-12-08 14:50:56, Wu Zhangjin wrote:
> > Hi, Pavel Machek
> > 
> > After fixing the get_battery_current(), can I get your Acked-by: for the
> > next revision of this patch?
> 
> Yes... you can add my ack for 4-6/8.

Thanks, will add your ack and resend the patchset later ;)

Regards,
	Wu Zhangjin


From dmitry.torokhov@gmail.com Tue Dec  8 08:24:01 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:24:04 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:61601 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491038AbZLHHYB (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:24:01 +0100
Received: by pwj1 with SMTP id 1so560018pwj.24
        for <multiple recipients>; Mon, 07 Dec 2009 23:23:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:date:from:to:cc:subject
         :message-id:references:mime-version:content-type:content-disposition
         :in-reply-to:user-agent;
        bh=9Azll/cri+PmH84SlqOfxxcldTFkyAX/9I1WJuJEunQ=;
        b=JM1wv0vmxdZL3UNHDY0/6z+VY8c56S3xg3+7xV2LfcnOe+s/GhystTakGF91W29pWC
         dzRANrb2uLIaOyF4rjFzXn/OeK2rwXFnt7/u6fvacnDFHRIO3YaUq4FAcdvu7tBuWv9J
         k4xpFxjC2jNjluPfAccBEQ15O4/GUY8Czi8/I=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=date:from:to:cc:subject:message-id:references:mime-version
         :content-type:content-disposition:in-reply-to:user-agent;
        b=TRuO+TsH5dThIkZWPiy+sdlAEU/lkKd//0W6OS1G8S7B3Jv72P7mWR+LF4SZFXNbnk
         Uj4k5VJ9coCp191TOHwE/KJ54dBq60+WS86zMU/K060MxHahcR1Cuy/TN6AMjg8UNwZL
         csDz5rf/4Q/DKQoHvbK4B6ijecNFtggIgeU0E=
Received: by 10.115.86.7 with SMTP id o7mr14312754wal.50.1260257032395;
        Mon, 07 Dec 2009 23:23:52 -0800 (PST)
Received: from mailhub.coreip.homeip.net (c-24-6-153-137.hsd1.ca.comcast.net [24.6.153.137])
        by mx.google.com with ESMTPS id 20sm5768379pzk.13.2009.12.07.23.23.50
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 23:23:51 -0800 (PST)
Date:   Mon, 7 Dec 2009 23:23:47 -0800
From:   Dmitry Torokhov <dmitry.torokhov@gmail.com>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH v8 8/8] Loongson: YeeLoong: add input/hotkey driver
Message-ID: <20091208072347.GH11147@core.coreip.homeip.net>
References: <cover.1260082252.git.wuzhangjin@gmail.com> <b164d5bb79963a57621d024c22e5664de0ff8662.1260082252.git.wuzhangjin@gmail.com> <20091207064857.GG21451@core.coreip.homeip.net> <1260255131.3315.25.camel@falcon.domain.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1260255131.3315.25.camel@falcon.domain.org>
User-Agent: Mutt/1.5.19 (2009-01-05)
Return-Path: <dmitry.torokhov@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25362
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: dmitry.torokhov@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, Dec 08, 2009 at 02:52:11PM +0800, Wu Zhangjin wrote:
> Hi, Dmitry Torokhov
> 
> I plan to send another revision of this patchset, Can I get your
> Acked-by: for this patch?
> 

Yes, as far as the input code goes:

	Acked-by: Dmitry Torokhov <dtor@mail.ru>

Thanks.

-- 
Dmitry

From wuzhangjin@gmail.com Tue Dec  8 08:27:34 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:27:37 +0100 (CET)
Received: from mail-iw0-f180.google.com ([209.85.223.180]:49905 "EHLO
        mail-iw0-f180.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491033AbZLHH1e (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:27:34 +0100
Received: by iwn10 with SMTP id 10so3644347iwn.22
        for <multiple recipients>; Mon, 07 Dec 2009 23:27:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=SJmYjLX9hl67WFHmt0albR4iYsJIgOqjwYigMd5b57o=;
        b=ohJnKsM4PdDqA4MBEZbtxxRhZeb0Z8Lmx0nVnhPPp1kH7o4droy7MlosFxyC0tEY4h
         x0e3WVO5KANUUvBVTC2Fo8LoWvDhm6aH4PeZkPTF2lco1A5fvxx937TNEW5DehsXkPQ1
         U8RfZX17T2aP/TrsEpvILDgG4m9JH1khuN+ok=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=ldCjAY3Y9IdUujuuHcAn3vcXEUWtNnXl7HOsx9S1I+qMFCRBkCWrTxB0HwEsm8YJyb
         FG5Hge3zWHSlRx9fGEGtfmN0k5doYDMMs92s0ng6TcxrIJoDFLl8FqtV+5nQdQRuGmvf
         +t+gneMvBa6fSfI6Fv9THfUrnnw7UVAAJZkBI=
Received: by 10.231.48.210 with SMTP id s18mr2501291ibf.3.1260257246903;
        Mon, 07 Dec 2009 23:27:26 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 23sm3962529iwn.3.2009.12.07.23.27.14
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 23:27:25 -0800 (PST)
Subject: Re: [PATCH v8 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
In-Reply-To: <20091208070915.GC12264@elf.ucw.cz>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <d8789fa7e97d8a170c4e2516d7ef2d2fbbe42cc6.1260082252.git.wuzhangjin@gmail.com>
         <20091206084717.GD2766@ucw.cz> <1260147298.3126.2.camel@falcon.domain.org>
         <20091207080446.GB23088@elf.ucw.cz>
         <1260178870.9092.34.camel@falcon.domain.org>
         <20091207094909.GD23088@elf.ucw.cz>
         <1260183663.9092.51.camel@falcon.domain.org>
         <20091208070915.GC12264@elf.ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 15:26:50 +0800
Message-ID: <1260257210.3315.63.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25363
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-08 at 08:09 +0100, Pavel Machek wrote:
> > > > > That's certainly better. But... why not return signed value? Current
> > > > > flowing from the battery is certainly very different from current
> > > > > flowing into it...
> > > > 
> > > > You are totally right ;)
> > > > 
> > > > Just test it, when flowing from the battery, the value is negative, and
> > > > when flowing into the battery, the value is positive, so, no abs()
> > > > needed. thanks!
> > > 
> > > Make it return -value, then. I believe other code uses >0 values for
> > > discharge.
> > 
> > Done, but any document/standard about it?
> 
> Not sure, feel free to patch the documentation, too :-).

Okay, I will send a documentation(as a separate patch) like them:

$ ls Documentation/ABI/testing/sysfs-platform-*
Documentation/ABI/testing/sysfs-platform-asus-laptop
Documentation/ABI/testing/sysfs-platform-eeepc-laptop 

Thanks & Regards,
	Wu Zhangjin


From wuzhangjin@gmail.com Tue Dec  8 08:34:57 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:35:01 +0100 (CET)
Received: from mail-yx0-f204.google.com ([209.85.210.204]:56325 "EHLO
        mail-yx0-f204.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491042AbZLHHe5 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:34:57 +0100
Received: by yxe42 with SMTP id 42so5188562yxe.22
        for <multiple recipients>; Mon, 07 Dec 2009 23:34:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=ZeryFTn0xkSrOBJezzPmXau2gbPboPYJS9ddbaxqXfs=;
        b=pvSibhdrl/0JVUSO9iK+dEEaK9pfdy1X5n/0dGhROiNOcIKYte4zCCizoi2+WTjt9a
         sPjUpvAz08kQ4TSZmRw53vW+M09prJ8rmvE5m0VeD3ktqWbDHXA6hn4zzHY/DPSJXuTT
         KeKGqRTi4NjiMBNrlOvtNNNeIQkaYdY1zbBMs=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=JKWywRXUaYGSyMmbHPVUO6Yo4g0/WgwGcJQMk0C1buvRxzrVxcQbDp/Yzgjsgi+98H
         Tc+0GYeKbYwwLwAKwUd6hQUgwn9JubKwgnbIl7kNSf29BdLEvrnHNZF4NRqSrwc09pHj
         ojjDZUFv3qbrcgn4aO2cGkZtGhX5s8NE/Wi2o=
Received: by 10.90.16.35 with SMTP id 35mr12485179agp.54.1260257691397;
        Mon, 07 Dec 2009 23:34:51 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm3983455iwn.14.2009.12.07.23.34.43
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 23:34:50 -0800 (PST)
Subject: Re: [PATCH v8 8/8] Loongson: YeeLoong: add input/hotkey driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
In-Reply-To: <20091208072347.GH11147@core.coreip.homeip.net>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <b164d5bb79963a57621d024c22e5664de0ff8662.1260082252.git.wuzhangjin@gmail.com>
         <20091207064857.GG21451@core.coreip.homeip.net>
         <1260255131.3315.25.camel@falcon.domain.org>
         <20091208072347.GH11147@core.coreip.homeip.net>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 15:34:18 +0800
Message-ID: <1260257658.3315.74.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25364
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Mon, 2009-12-07 at 23:23 -0800, Dmitry Torokhov wrote:
> On Tue, Dec 08, 2009 at 02:52:11PM +0800, Wu Zhangjin wrote:
> > Hi, Dmitry Torokhov
> > 
> > I plan to send another revision of this patchset, Can I get your
> > Acked-by: for this patch?
> > 
> 
> Yes, as far as the input code goes:
> 
> 	Acked-by: Dmitry Torokhov <dtor@mail.ru>

Added, thanks!

To Ralf:

This patch is based on the sparse keymap library in:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input next

from Dmitry Torokhov. that sparse keymap support is also queued for
2.6.33.

Before that support going into mainline, this patch can not be compiled,
so, Ralf, this patch is not appliable before Dmitry's next branch is
pulled by linus.

Thanks!
	Wu Zhangjin


From wuzhangjin@gmail.com Tue Dec  8 08:38:26 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:38:29 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:39854 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491038AbZLHHi0 (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:38:26 +0100
Received: by pzk35 with SMTP id 35so4535227pzk.22
        for <multiple recipients>; Mon, 07 Dec 2009 23:38:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=zTQnfOkxKLvLw/fgTG23uX1WjT7TuwX2YfPtEY/ywsE=;
        b=Sqz0fcMSFFcDIgfozQy/+UtcbOuhzryIjN9aWPwmWof0pbnEO0PCWvm2KSJiFg6tYU
         MciRmTwigL+Y3TARDjPEtKvy0XhRN1rok0ot3dU6fQCOCn7bwMtbAK5rKBi0PzbuWYvK
         KK2kfPX3rIWowxIqEk64dNkbAWTZXunD80occ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=HcHCuBcZ8mqwcBBBmuc2SfMYayODGGU37ktjYxg4GDzxh5Eg4Vx3XTsqA2eIeepbu+
         I0DSJXWm2L1+u/Eq/anQOaoC1aCKSAT/17JENtQksi7A9yyotKwrPqSdbVEea0kRMLHq
         Yt14RsjzgQr41mG2ZvgsMwx+axyXlXu/uxFbI=
Received: by 10.115.66.28 with SMTP id t28mr14270793wak.177.1260257898949;
        Mon, 07 Dec 2009 23:38:18 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm5777909pzk.2.2009.12.07.23.38.13
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 23:38:18 -0800 (PST)
Subject: Re: [PATCH v8 1/8] MIPS: add subdirectory for platform extension
 drivers
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
In-Reply-To: <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 15:37:45 +0800
Message-ID: <1260257865.3315.79.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25365
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

Hi, Ralf

I plan to send a new revision of this patchset, Can I get your Acked-by:
for patch 1-3/8?

Thanks!
	Wu Zhangjin

On Sun, 2009-12-06 at 15:01 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> It is really hard to split the platform specific subdrivers into
> different subsystems, which will generate lots of duplicated source
> code, break the whole support into several pieces and also will make the
> users be difficult to choose the suitable subdrivers in different
> places.
> 
> So, I did like the forks have done under drivers/platform/x86, created
> the drivers/platform/mips/ for putting the future MIPS netbook/laptop/pc
> extension drivers in.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  drivers/platform/Kconfig      |    4 ++++
>  drivers/platform/mips/Kconfig |   18 ++++++++++++++++++
>  2 files changed, 22 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/platform/mips/Kconfig
> 
> diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig
> index 9652c3f..2319c0b 100644
> --- a/drivers/platform/Kconfig
> +++ b/drivers/platform/Kconfig
> @@ -3,3 +3,7 @@
>  if X86
>  source "drivers/platform/x86/Kconfig"
>  endif
> +
> +if MIPS
> +source "drivers/platform/mips/Kconfig"
> +endif
> diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
> new file mode 100644
> index 0000000..2f77693
> --- /dev/null
> +++ b/drivers/platform/mips/Kconfig
> @@ -0,0 +1,18 @@
> +#
> +# MIPS Platform Specific Drivers
> +#
> +
> +menuconfig MIPS_PLATFORM_DEVICES
> +	bool "MIPS Platform Specific Device Drivers"
> +	default y
> +	help
> +	  Say Y here to get to see options for device drivers of various
> +	  MIPS platforms, including vendor-specific netbook/laptop/pc extension
> +	  drivers.  This option alone does not add any kernel code.
> +
> +	  If you say N, all options in this submenu will be skipped and disabled.
> +
> +if MIPS_PLATFORM_DEVICES
> +
> +
> +endif # MIPS_PLATFORM_DEVICES



From wuzhangjin@gmail.com Tue Dec  8 08:53:22 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:53:25 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:38576 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491045AbZLHHxW (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:53:22 +0100
Received: by pxi6 with SMTP id 6so3906415pxi.0
        for <multiple recipients>; Mon, 07 Dec 2009 23:53:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=4Xhz3xF/WU4xG71WNh8ATKGonFefN/OgssnrD1YvgBU=;
        b=Q2xNomNxrj+GFJOFzcfUormKMFvWYPuc2zrMRLOqBiXL7EtelKTlDRvhShTisLefhy
         Ano1Ii0QFBoeDUsHNSJWV046oGFS0BqmUQVU99LFENoQ+sN3YX3yt4J+jLBZyLwGdymI
         IbLiNdGKLySgjPYQ3wH/xiQlytU7XJlsSTwM4=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=aE4AlpJwZnCoe1m/2nVV1ehlsnMY92k9Q3HEOAhndYXMqMdYlwGI/69n1Uv7LaUSuQ
         D+dKk3yr1jaSeJxlLeKf2KOnH0M8K1WXVzSELG3y7Kbi1B5EDlnrRAqnDntzGC4kQZAW
         z9dTVKpdeHvKWCk12FIpNXIVJxTWR6bh+Kdog=
Received: by 10.114.188.37 with SMTP id l37mr8044012waf.221.1260258795301;
        Mon, 07 Dec 2009 23:53:15 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 21sm5787320pzk.15.2009.12.07.23.53.08
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 23:53:12 -0800 (PST)
Subject: Re: [PATCH v8 3/8] Loongson: YeeLoong: add backlight driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, linux-mips@linux-mips.org,
        linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
In-Reply-To: <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
References: <cover.1260082252.git.wuzhangjin@gmail.com>
         <d6bb11d33fe01abd6de945117ce647af73841f00.1260082252.git.wuzhangjin@gmail.com>
         <5a8742a71e96ba40bee34fb37478cc8339e76530.1260082252.git.wuzhangjin@gmail.com>
         <3c77f3891e73e189cceef7155dc9cb6503084a4b.1260082252.git.wuzhangjin@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Tue, 08 Dec 2009 15:52:44 +0800
Message-ID: <1260258764.3315.82.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25366
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Sun, 2009-12-06 at 15:01 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds YeeLoong Backlight Driver, it provides standard
> interface(/sys/class/backlight/) for user-space applications(e.g.
> kpowersave, gnome-power-manager) to control the brightness of the
> backlight.
[...]
> +static int yeeloong_set_brightness(struct backlight_device *bd)
> +{
> +	unsigned int level, current_level;
> +	static unsigned int old_level;
> +
> +	level = (bd->props.fb_blank == FB_BLANK_UNBLANK &&
> +		 bd->props.power == FB_BLANK_UNBLANK) ?
> +	    bd->props.brightness : 0;
> +
> +	if (level > MAX_BRIGHTNESS)
> +		level = MAX_BRIGHTNESS;
> +	else if (level < 0)
> +		level = 0;
> +
> +	/* Avoid to modify the brightness when EC is tuning it */
> +	if (old_level != level) {
> +		current_level = ec_read(REG_DISPLAY_BRIGHTNESS);
> +		if (old_level == current_level)
> +			ec_write(REG_DISPLAY_BRIGHTNESS, level);
> +	}
> +	old_level = level;

Will move the above line into the end of "if { ... }".

Regards,
	Wu Zhangjin


From yuasa.linux@gmail.com Tue Dec  8 08:59:51 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 08:59:54 +0100 (CET)
Received: from mail-yw0-f203.google.com ([209.85.211.203]:32921 "EHLO
        mail-yw0-f203.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491043AbZLHH7u (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 08:59:50 +0100
Received: by ywh41 with SMTP id 41so7421637ywh.0
        for <multiple recipients>; Mon, 07 Dec 2009 23:59:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:date:from:to:cc
         :subject:message-id:x-mailer:mime-version:content-type
         :content-transfer-encoding;
        bh=zQJcHYoCGkxyRT2AyuPdySDebDEQSiladZ7f0pTL0tY=;
        b=TymEX+aCddqHVMF+DTTFQ5VLnIroD+/nGSdc2OnHhnqyIS/BxMDFOMwMhMtRnqYaiP
         LDVyjjkiR9Cp6jxdYI4TG6P6KqxIMSs1tGafHUYaTwqXXpchj5LXmRJ4cxD2NRX3cVCG
         x/Rj8P3X3VeG0t5XKn7zwxmFnADzp/ar9ZKa4=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:date:from:to:cc:subject:message-id:x-mailer:mime-version
         :content-type:content-transfer-encoding;
        b=PNR9oC7XAc/InFf/GNzbDx3h9xO45Fz3i3hX+P3auwVImoGxFlDwzepYyxAwlipboK
         sfJEXKVX9CKr1V33Pmqquu1WalR+xxvNhz6ARXasSY5znrpQ/qIvgyG/mOHpx6DkOsGN
         id9ziGrO+xeJDIcEAuRxdJdcONrhw6qsFa9TM=
Received: by 10.150.235.5 with SMTP id i5mr13277742ybh.271.1260259183606;
        Mon, 07 Dec 2009 23:59:43 -0800 (PST)
Received: from ypsilon.skybright.jp (sannin29006.nirai.ne.jp [203.160.29.6])
        by mx.google.com with ESMTPS id 15sm3312492gxk.12.2009.12.07.23.59.40
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Mon, 07 Dec 2009 23:59:42 -0800 (PST)
Date:   Tue, 8 Dec 2009 16:58:44 +0900
From:   Yoichi Yuasa <yuasa@linux-mips.org>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     yuasa@linux-mips.org, linux-mips@linux-mips.org
Subject: [PATCH] MIPS: more replace CL_SIZE by COMMAND_LINE_SIZE
Message-Id: <20091208165844.ddd9106f.yuasa@linux-mips.org>
X-Mailer: Sylpheed 2.7.1 (GTK+ 2.16.6; i686-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Return-Path: <yuasa.linux@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25367
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: yuasa@linux-mips.org
Precedence: bulk
X-list: linux-mips


Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
---
 arch/mips/powertv/asic/asic_devices.c |    4 ++--
 arch/mips/powertv/memory.c            |    2 +-
 arch/mips/rb532/prom.c                |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c
index 5f20cee..bae8288 100644
--- a/arch/mips/powertv/asic/asic_devices.c
+++ b/arch/mips/powertv/asic/asic_devices.c
@@ -187,7 +187,7 @@ static void __init fs_update(int pe, int md, int sdiv, int disable_div_by_3)
 /*
  * Allow override of bootloader-specified model
  */
-static char __initdata cmdline[CL_SIZE];
+static char __initdata cmdline[COMMAND_LINE_SIZE];
 
 #define	FORCEFAMILY_PARAM	"forcefamily"
 
@@ -199,7 +199,7 @@ static __init int check_forcefamily(unsigned char forced_family[2])
 	forced_family[1] = '\0';
 
 	/* Check the command line for a forcefamily directive */
-	strncpy(cmdline, arcs_cmdline, CL_SIZE - 1);
+	strncpy(cmdline, arcs_cmdline, COMMAND_LINE_SIZE - 1);
 	p = strstr(cmdline, FORCEFAMILY_PARAM);
 	if (p && (p != cmdline) && (*(p - 1) != ' '))
 		p = strstr(p, " " FORCEFAMILY_PARAM "=");
diff --git a/arch/mips/powertv/memory.c b/arch/mips/powertv/memory.c
index c63620a..28d0660 100644
--- a/arch/mips/powertv/memory.c
+++ b/arch/mips/powertv/memory.c
@@ -44,7 +44,7 @@
 
 unsigned long ptv_memsize;
 
-char __initdata cmdline[CL_SIZE];
+char __initdata cmdline[COMMAND_LINE_SIZE];
 
 void __init prom_meminit(void)
 {
diff --git a/arch/mips/rb532/prom.c b/arch/mips/rb532/prom.c
index f4f3f2e..13f350c 100644
--- a/arch/mips/rb532/prom.c
+++ b/arch/mips/rb532/prom.c
@@ -69,7 +69,7 @@ static inline unsigned long tag2ul(char *arg, const char *tag)
 
 void __init prom_setup_cmdline(void)
 {
-	static char cmd_line[CL_SIZE] __initdata;
+	static char cmd_line[COMMAND_LINE_SIZE] __initdata;
 	char *cp, *board;
 	int prom_argc;
 	char **prom_argv, **prom_envp;
-- 
1.6.5.4


From yuasa.linux@gmail.com Tue Dec  8 09:25:49 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 09:25:53 +0100 (CET)
Received: from mail-yx0-f204.google.com ([209.85.210.204]:46297 "EHLO
        mail-yx0-f204.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491922AbZLHIZt (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 09:25:49 +0100
Received: by yxe42 with SMTP id 42so5211467yxe.22
        for <multiple recipients>; Tue, 08 Dec 2009 00:25:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:date:from:to:cc
         :subject:message-id:in-reply-to:references:x-mailer:mime-version
         :content-type:content-transfer-encoding;
        bh=dHDDc/7z2Aame5bdsWdPYbhgDBPEuJ9cIUhpgXM06yE=;
        b=a5erPesJ5Q2gLz6/c1Orhj2kdViC8SRPR+BiKUmjFC/gcWirj4gfA4MEHJV6ljkZBX
         W9AWy8aaxY52wuV6yZAIqP4wUq4RI6poeG7iSGIAUc/I9NT2E600LlWHeqsZpkwxXAEg
         LKC/7grRvTTvkJNCjWPDciwhhaJkzfICr4zts=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:date:from:to:cc:subject:message-id:in-reply-to:references
         :x-mailer:mime-version:content-type:content-transfer-encoding;
        b=UNoSlut25XQqP6/qB8mt6pZ23apC5RFyic7un4AohmIGhCS11VSZs6uLmbM+Uq+8SO
         yAOScrDFJ9wD//ZHDtnXaRu42QQ/4BLWCNGV1+0Dp0nIWjOCFdmZ2vVNDKDCadKUZkRo
         JX82DYxWdgAF7ZpLLItbeqhbjyWOh2HVDSHFA=
Received: by 10.150.24.2 with SMTP id 2mr13387819ybx.172.1260260742829;
        Tue, 08 Dec 2009 00:25:42 -0800 (PST)
Received: from ypsilon.skybright.jp (sannin29006.nirai.ne.jp [203.160.29.6])
        by mx.google.com with ESMTPS id 15sm3320252gxk.12.2009.12.08.00.25.39
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 00:25:41 -0800 (PST)
Date:   Tue, 8 Dec 2009 17:24:44 +0900
From:   Yoichi Yuasa <yuasa@linux-mips.org>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     yuasa@linux-mips.org, linux-mips@linux-mips.org
Subject: [PATCH resend] MIPS: more replace CL_SIZE by COMMAND_LINE_SIZE
Message-Id: <20091208172444.9e48afe7.yuasa@linux-mips.org>
In-Reply-To: <20091208165844.ddd9106f.yuasa@linux-mips.org>
References: <20091208165844.ddd9106f.yuasa@linux-mips.org>
X-Mailer: Sylpheed 2.7.1 (GTK+ 2.16.6; i686-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Return-Path: <yuasa.linux@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25368
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: yuasa@linux-mips.org
Precedence: bulk
X-list: linux-mips

Sorry, I forgot one more CL_SIZE.

Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
---
 arch/mips/powertv/asic/asic_devices.c |    4 ++--
 arch/mips/powertv/cmdline.c           |    2 +-
 arch/mips/powertv/memory.c            |    2 +-
 arch/mips/rb532/prom.c                |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c
index 5f20cee..bae8288 100644
--- a/arch/mips/powertv/asic/asic_devices.c
+++ b/arch/mips/powertv/asic/asic_devices.c
@@ -187,7 +187,7 @@ static void __init fs_update(int pe, int md, int sdiv, int disable_div_by_3)
 /*
  * Allow override of bootloader-specified model
  */
-static char __initdata cmdline[CL_SIZE];
+static char __initdata cmdline[COMMAND_LINE_SIZE];
 
 #define	FORCEFAMILY_PARAM	"forcefamily"
 
@@ -199,7 +199,7 @@ static __init int check_forcefamily(unsigned char forced_family[2])
 	forced_family[1] = '\0';
 
 	/* Check the command line for a forcefamily directive */
-	strncpy(cmdline, arcs_cmdline, CL_SIZE - 1);
+	strncpy(cmdline, arcs_cmdline, COMMAND_LINE_SIZE - 1);
 	p = strstr(cmdline, FORCEFAMILY_PARAM);
 	if (p && (p != cmdline) && (*(p - 1) != ' '))
 		p = strstr(p, " " FORCEFAMILY_PARAM "=");
diff --git a/arch/mips/powertv/cmdline.c b/arch/mips/powertv/cmdline.c
index 3bc4334..98d73cb 100644
--- a/arch/mips/powertv/cmdline.c
+++ b/arch/mips/powertv/cmdline.c
@@ -48,5 +48,5 @@ void  __init prom_init_cmdline(void)
 	arcs_cmdline[len] = ' ';
 
 	strlcpy(arcs_cmdline + len + 1, (char *)_prom_argv,
-		CL_SIZE - len - 1);
+		COMMAND_LINE_SIZE - len - 1);
 }
diff --git a/arch/mips/powertv/memory.c b/arch/mips/powertv/memory.c
index c63620a..28d0660 100644
--- a/arch/mips/powertv/memory.c
+++ b/arch/mips/powertv/memory.c
@@ -44,7 +44,7 @@
 
 unsigned long ptv_memsize;
 
-char __initdata cmdline[CL_SIZE];
+char __initdata cmdline[COMMAND_LINE_SIZE];
 
 void __init prom_meminit(void)
 {
diff --git a/arch/mips/rb532/prom.c b/arch/mips/rb532/prom.c
index f4f3f2e..13f350c 100644
--- a/arch/mips/rb532/prom.c
+++ b/arch/mips/rb532/prom.c
@@ -69,7 +69,7 @@ static inline unsigned long tag2ul(char *arg, const char *tag)
 
 void __init prom_setup_cmdline(void)
 {
-	static char cmd_line[CL_SIZE] __initdata;
+	static char cmd_line[COMMAND_LINE_SIZE] __initdata;
 	char *cp, *board;
 	int prom_argc;
 	char **prom_argv, **prom_envp;
-- 
1.6.5.4


From sshtylyov@ru.mvista.com Tue Dec  8 12:34:41 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 12:34:45 +0100 (CET)
Received: from gateway-1237.mvista.com ([206.112.117.35]:52921 "HELO
        imap.sh.mvista.com" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org
        with SMTP id S1492628AbZLHLel (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 12:34:41 +0100
Received: from [127.0.0.1] (unknown [10.150.0.9])
        by imap.sh.mvista.com (Postfix) with SMTP
        id E8A163ED9; Tue,  8 Dec 2009 03:34:25 -0800 (PST)
Message-ID: <4B1E39B3.5000207@ru.mvista.com>
Date:   Tue, 08 Dec 2009 14:34:11 +0300
From:   Sergei Shtylyov <sshtylyov@ru.mvista.com>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To:     Yoichi Yuasa <yuasa@linux-mips.org>
Cc:     Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [PATCH resend] MIPS: more replace CL_SIZE by COMMAND_LINE_SIZE
References: <20091208165844.ddd9106f.yuasa@linux-mips.org> <20091208172444.9e48afe7.yuasa@linux-mips.org>
In-Reply-To: <20091208172444.9e48afe7.yuasa@linux-mips.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <sshtylyov@ru.mvista.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25369
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: sshtylyov@ru.mvista.com
Precedence: bulk
X-list: linux-mips

Hello.

Yoichi Yuasa wrote:
> Sorry, I forgot one more CL_SIZE.
>   

   You should put such notes under the --- tearline, not into the patch 
description.

> Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
> ---

WBR, Sergei



From sshtylyov@ru.mvista.com Tue Dec  8 12:37:22 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 12:37:26 +0100 (CET)
Received: from gateway-1237.mvista.com ([206.112.117.35]:15036 "HELO
        imap.sh.mvista.com" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org
        with SMTP id S1492628AbZLHLhW (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 12:37:22 +0100
Received: from [127.0.0.1] (unknown [10.150.0.9])
        by imap.sh.mvista.com (Postfix) with SMTP
        id 8EAD93ED9; Tue,  8 Dec 2009 03:37:13 -0800 (PST)
Message-ID: <4B1E3A5A.9050100@ru.mvista.com>
Date:   Tue, 08 Dec 2009 14:36:58 +0300
From:   Sergei Shtylyov <sshtylyov@ru.mvista.com>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To:     figo zhang <figo1802@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>,
        David Daney <ddaney@caviumnetworks.com>, macro@linux-mips.org,
        linux-mips@linux-mips.org
Subject: Re: Dma addr should use Kuseg1 for MIPS32?
References: <c6ed1ac50912070455n736af31fuf2c981fc182b494f@mail.gmail.com>         <20091207134502.GB5119@linux-mips.org> <c6ed1ac50912071749m49b1e5f5m7ae53384389338d9@mail.gmail.com>
In-Reply-To: <c6ed1ac50912071749m49b1e5f5m7ae53384389338d9@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <sshtylyov@ru.mvista.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25370
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: sshtylyov@ru.mvista.com
Precedence: bulk
X-list: linux-mips

Hello.

figo zhang wrote:

>
>     > i write dma_phy to DMA base register, but why it cannot work? it
>     should
>     > write Kseg1 space to DMA register?
>     > I remember that it is ok for ARM/X86 .
>
>     It's only happens to work on some systems.
>
>
> in my puzzle, if i run 
> dma_vaddr =(char*) __get_free_pages(GFP_KERNEL,  order);
> dma_phy = virt_to_phy(dma_vaddr);
>
> if the result is:
> dma_vaddr = 0x801b00000;
> dma_phy = 0x1b00000;
>
> so i should write 0x1b00000 to my DMA Base register or wirte 
> (0x1b000000 | 0xa0000000) to DMA?

   You must always use the physical addresses when programming DMA, i.e. 
0x1b00000 in this case.

WBR, Sergei



From ralf@linux-mips.org Tue Dec  8 13:36:59 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 13:37:02 +0100 (CET)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:39100 "EHLO h5.dl5rb.org.uk"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP
        id S1493974AbZLHMg6 (ORCPT <rfc822;linux-mips@linux-mips.org>);
        Tue, 8 Dec 2009 13:36:58 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])
        by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id nB8CavEG021569;
        Tue, 8 Dec 2009 12:36:57 GMT
Received: (from ralf@localhost)
        by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id nB8CavdB021567;
        Tue, 8 Dec 2009 12:36:57 GMT
Date:   Tue, 8 Dec 2009 12:36:57 +0000
From:   Ralf Baechle <ralf@linux-mips.org>
To:     Yoichi Yuasa <yuasa@linux-mips.org>
Cc:     linux-mips@linux-mips.org
Subject: Re: [PATCH resend] MIPS: more replace CL_SIZE by COMMAND_LINE_SIZE
Message-ID: <20091208123657.GB20624@linux-mips.org>
References: <20091208165844.ddd9106f.yuasa@linux-mips.org>
 <20091208172444.9e48afe7.yuasa@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091208172444.9e48afe7.yuasa@linux-mips.org>
User-Agent: Mutt/1.5.20 (2009-08-17)
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25371
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Dec 08, 2009 at 05:24:44PM +0900, Yoichi Yuasa wrote:

> Sorry, I forgot one more CL_SIZE.
> 
> Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>

I fixed these in the pull tree for Linus a few days ago along with a few
other issues and I was planning to get these fixes into the main tree
indirectly by just pulling from Linus.

Thanks!

  Ralf

From wuzhangjin@gmail.com Tue Dec  8 15:16:16 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:16:20 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:47541 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494186AbZLHOQQ (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:16:16 +0100
Received: by pxi6 with SMTP id 6so4090402pxi.0
        for <multiple recipients>; Tue, 08 Dec 2009 06:16:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer;
        bh=zmVR5OBUBjCw+ZU02rSMDSCNYnP2Fhip3Bbz1EdFlwM=;
        b=xWeDIuv446GQIKWGk5rtB7/iBd013JFDS4R++tMmloDTVJmDrNm2/T3RV2KWkjR5Mf
         a/ePZWGtrx2Qp2VpCecIxh/7yWPjuEctLFDHKIFK/JL9/v9HTD87kuVcFA7Kx6lGU9B/
         5NEgTUzrS4Z4/V+i2qvVJ0UrEFMvFrpWCpCGQ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer;
        b=vdu3NIsYFZZM4gqcYXUT/34fM+5JAwd/BJ+3ipN7ZTMDajrTuQESm9GmxC5PcEf09w
         QVGoZZ8wnsIkjz86nnZ2i5xIzsRGNjjVbD5yTCuwRvy4JoVFszB4QTmzqoQls2Byi4Dp
         B9eoXEZQquPlyPm+Lx92g6QSNOJNMaMiPTlYA=
Received: by 10.115.99.11 with SMTP id b11mr2418459wam.17.1260281768690;
        Tue, 08 Dec 2009 06:16:08 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.16.03
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:16:08 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 0/8] Loongson: YeeLoong: add platform drivers
Date:   Tue,  8 Dec 2009 22:15:48 +0800
Message-Id: <cover.1260254344.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25372
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

Hi, Ralf and Andrew Morton

Could you please queue this patchset for 2.6.33?

Of course, any new feedbacks are welcome, thanks!

Best Regards,
        Wu Zhangjin

------------------

This patchset adds platform specific drivers for YeeLoong netbook. including
the backlight, battery, hwmon, video output, suspend and hotkey(input)
subdrivers. These drivers provide standard interfaces to the user-space
applications to manage the related devices.

Changes from v8:

  o Cleanup of the get_battery_current()

  We need to return the signed value directly for the current flowing
  into and from the battery are totally different, and since the other
  platforms use value>0 indicates the discharge, so, we return -value
  here. (Thanks to Pavel Machek for giving this feedback!)

Wu Zhangjin (8):
  MIPS: add subdirectory for platform extension drivers
  Loongson: YeeLoong: add platform driver
  Loongson: YeeLoong: add backlight driver
  Loongson: YeeLoong: add battery driver
  Loongson: YeeLoong: add hardware monitoring driver
  Loongson: YeeLoong: add video output driver
  Loongson: YeeLoong: add suspend support
  Loongson: YeeLoong: add input/hotkey driver

 arch/mips/include/asm/mach-loongson/ec_kb3310b.h |  191 ++++
 arch/mips/include/asm/mach-loongson/loongson.h   |    6 +
 arch/mips/loongson/common/cmdline.c              |    8 +
 arch/mips/loongson/lemote-2f/Makefile            |    2 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c        |   12 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.h        |  188 ----
 arch/mips/loongson/lemote-2f/platform.c          |   40 +
 arch/mips/loongson/lemote-2f/pm.c                |    4 +-
 arch/mips/loongson/lemote-2f/reset.c             |    2 +-
 drivers/platform/Kconfig                         |    4 +
 drivers/platform/Makefile                        |    1 +
 drivers/platform/mips/Kconfig                    |   33 +
 drivers/platform/mips/Makefile                   |    5 +
 drivers/platform/mips/yeeloong_laptop.c          | 1035 ++++++++++++++++++++++
 14 files changed, 1331 insertions(+), 200 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-loongson/ec_kb3310b.h
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/platform.c
 create mode 100644 drivers/platform/mips/Kconfig
 create mode 100644 drivers/platform/mips/Makefile
 create mode 100644 drivers/platform/mips/yeeloong_laptop.c


From wuzhangjin@gmail.com Tue Dec  8 15:16:38 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:16:43 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:40284 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494195AbZLHOQZ (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:16:25 +0100
Received: by pzk35 with SMTP id 35so4728625pzk.22
        for <multiple recipients>; Tue, 08 Dec 2009 06:16:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=PNF4dJpdw1GFSGioxoxLVbk5cfqDx1ILIbM+Fq9ACSo=;
        b=eTp9InywUynOEBcGZOqDTdkGkl9KW3IhiF99NiGoiMeA0OcTvHFs67WusqMrkvKW0p
         cqBrhxxdK11NC9Y/pzrpeB3t/CLlpVqwN3jY9HyaEeCMm+rWMHoaoGESXE8oKzqDBCf+
         4vyMVMkNO0CWcjd8XEMT0JQYLEIen4p/blVjk=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=YyzGdWo1OKOW+a9Z5pM1757na1MOeeKW4xmmKt4WYUdn9g0yz18TLuwfNtfNk6lrWs
         +lGd/a/xU7oASJd2LooWH4+OTUV7IkIjz0TMaACIyWIt5T/Nc5WidVWMMPNr3YKbUUyd
         AeMb07R45oUC0lgC93K0x/yOof5Bn/fECPdaE=
Received: by 10.114.9.6 with SMTP id 6mr5141487wai.35.1260281776493;
        Tue, 08 Dec 2009 06:16:16 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.16.09
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:16:15 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 1/8] MIPS: add subdirectory for platform extension drivers
Date:   Tue,  8 Dec 2009 22:15:49 +0800
Message-Id: <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <cover.1260254344.git.wuzhangjin@gmail.com>
References: <cover.1260254344.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25373
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

It is really hard to split the platform specific subdrivers into
different subsystems, which will generate lots of duplicated source
code, break the whole support into several pieces and also will make the
users be difficult to choose the suitable subdrivers in different
places.

So, I did like the forks have done under drivers/platform/x86, created
the drivers/platform/mips/ for putting the future MIPS netbook/laptop/pc
extension drivers in.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/Kconfig      |    4 ++++
 drivers/platform/mips/Kconfig |   18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 drivers/platform/mips/Kconfig

diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig
index 9652c3f..2319c0b 100644
--- a/drivers/platform/Kconfig
+++ b/drivers/platform/Kconfig
@@ -3,3 +3,7 @@
 if X86
 source "drivers/platform/x86/Kconfig"
 endif
+
+if MIPS
+source "drivers/platform/mips/Kconfig"
+endif
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
new file mode 100644
index 0000000..2f77693
--- /dev/null
+++ b/drivers/platform/mips/Kconfig
@@ -0,0 +1,18 @@
+#
+# MIPS Platform Specific Drivers
+#
+
+menuconfig MIPS_PLATFORM_DEVICES
+	bool "MIPS Platform Specific Device Drivers"
+	default y
+	help
+	  Say Y here to get to see options for device drivers of various
+	  MIPS platforms, including vendor-specific netbook/laptop/pc extension
+	  drivers.  This option alone does not add any kernel code.
+
+	  If you say N, all options in this submenu will be skipped and disabled.
+
+if MIPS_PLATFORM_DEVICES
+
+
+endif # MIPS_PLATFORM_DEVICES
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  8 15:17:01 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:17:07 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:37489 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494193AbZLHOQe (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:16:34 +0100
Received: by pwj1 with SMTP id 1so743667pwj.24
        for <multiple recipients>; Tue, 08 Dec 2009 06:16:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=xwI/7guCwvfjeeBll+idPxoe1Dre8JItubBi9oFj5Lk=;
        b=Hl4Mir92MIaNq+ydCntRGitkts5Ps9Q0QydiKqWM9G3wPAAM+ehviaNMCk06mBoxVf
         wpYIvpyiCXZn8dn+KSA+n6/bFEfxXMej5IwL91SsDmoitbDa4OFdEsWsd+2Obhi7F5+x
         eQHtvJNVHCDOlrqq9T1IZyO6nupTHdxPaIWKQ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=dwpS2wDEF2oXa9JlhSB+JrwKSPyiwODarsYybS/FROOlz/RkTNwvYEaBK8t/QdFqnN
         kClIFcxtT/YZtc/mwapVk7L/hjwCNNAyVLH5wbjsOrEq0vzOyCfA8dIqCOq+dGxNLodE
         +nGySBBD0sf2T0BzDGDN7YRfG9SDccJduRip8=
Received: by 10.114.18.33 with SMTP id 33mr15409991war.51.1260281787414;
        Tue, 08 Dec 2009 06:16:27 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.16.16
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:16:26 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 2/8] Loongson: YeeLoong: add platform driver
Date:   Tue,  8 Dec 2009 22:15:50 +0800
Message-Id: <7676d8397e593dbec0d40e24429b7ccbcecfa588.1260281599.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260254344.git.wuzhangjin@gmail.com>
 <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25374
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds platform driver for YeeLoong, Currently, This driver is
"empty", the subdrivers will be added in the coming patches.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/mach-loongson/ec_kb3310b.h |  191 ++++++++++++++++++++++
 arch/mips/loongson/lemote-2f/Makefile            |    2 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c        |   12 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.h        |  188 ---------------------
 arch/mips/loongson/lemote-2f/platform.c          |   40 +++++
 arch/mips/loongson/lemote-2f/pm.c                |    4 +-
 arch/mips/loongson/lemote-2f/reset.c             |    2 +-
 drivers/platform/Makefile                        |    1 +
 drivers/platform/mips/Kconfig                    |    8 +
 drivers/platform/mips/Makefile                   |    5 +
 drivers/platform/mips/yeeloong_laptop.c          |   60 +++++++
 11 files changed, 313 insertions(+), 200 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-loongson/ec_kb3310b.h
 delete mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
 create mode 100644 arch/mips/loongson/lemote-2f/platform.c
 create mode 100644 drivers/platform/mips/Makefile
 create mode 100644 drivers/platform/mips/yeeloong_laptop.c

diff --git a/arch/mips/include/asm/mach-loongson/ec_kb3310b.h b/arch/mips/include/asm/mach-loongson/ec_kb3310b.h
new file mode 100644
index 0000000..4fccb5d
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/ec_kb3310b.h
@@ -0,0 +1,191 @@
+/*
+ * KB3310B Embedded Controller
+ *
+ *  Copyright (C) 2008 Lemote Inc.
+ *  Author: liujl <liujl@lemote.com>, 2008-03-14
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzhangjin@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _EC_KB3310B_H
+#define _EC_KB3310B_H
+
+extern unsigned char ec_read(unsigned short addr);
+extern void ec_write(unsigned short addr, unsigned char val);
+extern int ec_query_seq(unsigned char cmd);
+extern int ec_query_event_num(void);
+extern int ec_get_event_num(void);
+
+typedef int (*sci_handler) (int status);
+extern sci_handler yeeloong_report_lid_status;
+
+#define SCI_IRQ_NUM 0x0A
+
+/*
+ * The following registers are determined by the EC index configuration.
+ * 1, fill the PORT_HIGH as EC register high part.
+ * 2, fill the PORT_LOW as EC register low part.
+ * 3, fill the PORT_DATA as EC register write data or get the data from it.
+ */
+#define	EC_IO_PORT_HIGH	0x0381
+#define	EC_IO_PORT_LOW	0x0382
+#define	EC_IO_PORT_DATA	0x0383
+
+/*
+ * EC delay time is 500us for register and status access
+ */
+#define	EC_REG_DELAY	500	/* unit : us */
+#define	EC_CMD_TIMEOUT	0x1000
+
+/*
+ * EC access port for SCI communication
+ */
+#define	EC_CMD_PORT		0x66
+#define	EC_STS_PORT		0x66
+#define	EC_DAT_PORT		0x62
+#define	CMD_INIT_IDLE_MODE	0xdd
+#define	CMD_EXIT_IDLE_MODE	0xdf
+#define	CMD_INIT_RESET_MODE	0xd8
+#define	CMD_REBOOT_SYSTEM	0x8c
+#define	CMD_GET_EVENT_NUM	0x84
+#define	CMD_PROGRAM_PIECE	0xda
+
+/* Temperature & Fan registers */
+#define	REG_TEMPERATURE_VALUE	0xF458
+#define	REG_FAN_AUTO_MAN_SWITCH 0xF459
+#define	BIT_FAN_AUTO		0
+#define	BIT_FAN_MANUAL		1
+#define	REG_FAN_CONTROL		0xF4D2
+#define	BIT_FAN_CONTROL_ON	(1 << 0)
+#define	BIT_FAN_CONTROL_OFF	(0 << 0)
+#define	REG_FAN_STATUS		0xF4DA
+#define	BIT_FAN_STATUS_ON	(1 << 0)
+#define	BIT_FAN_STATUS_OFF	(0 << 0)
+#define	REG_FAN_SPEED_HIGH	0xFE22
+#define	REG_FAN_SPEED_LOW	0xFE23
+#define	REG_FAN_SPEED_LEVEL	0xF4CC
+/* Fan speed divider */
+#define	FAN_SPEED_DIVIDER	480000	/* (60*1000*1000/62.5/2)*/
+
+/* Battery registers */
+#define	REG_BAT_DESIGN_CAP_HIGH		0xF77D
+#define	REG_BAT_DESIGN_CAP_LOW		0xF77E
+#define	REG_BAT_FULLCHG_CAP_HIGH	0xF780
+#define	REG_BAT_FULLCHG_CAP_LOW		0xF781
+#define	REG_BAT_DESIGN_VOL_HIGH		0xF782
+#define	REG_BAT_DESIGN_VOL_LOW		0xF783
+#define	REG_BAT_CURRENT_HIGH		0xF784
+#define	REG_BAT_CURRENT_LOW		0xF785
+#define	REG_BAT_VOLTAGE_HIGH		0xF786
+#define	REG_BAT_VOLTAGE_LOW		0xF787
+#define	REG_BAT_TEMPERATURE_HIGH	0xF788
+#define	REG_BAT_TEMPERATURE_LOW		0xF789
+#define	REG_BAT_RELATIVE_CAP_HIGH	0xF492
+#define	REG_BAT_RELATIVE_CAP_LOW	0xF493
+#define	REG_BAT_VENDOR			0xF4C4
+#define	FLAG_BAT_VENDOR_SANYO		0x01
+#define	FLAG_BAT_VENDOR_SIMPLO		0x02
+#define	REG_BAT_CELL_COUNT		0xF4C6
+#define	FLAG_BAT_CELL_3S1P		0x03
+#define	FLAG_BAT_CELL_3S2P		0x06
+#define	REG_BAT_CHARGE			0xF4A2
+#define	FLAG_BAT_CHARGE_DISCHARGE	0x01
+#define	FLAG_BAT_CHARGE_CHARGE		0x02
+#define	FLAG_BAT_CHARGE_ACPOWER		0x00
+#define	REG_BAT_STATUS			0xF4B0
+#define	BIT_BAT_STATUS_LOW		(1 << 5)
+#define	BIT_BAT_STATUS_DESTROY		(1 << 2)
+#define	BIT_BAT_STATUS_FULL		(1 << 1)
+#define	BIT_BAT_STATUS_IN		(1 << 0)
+#define	REG_BAT_CHARGE_STATUS		0xF4B1
+#define	BIT_BAT_CHARGE_STATUS_OVERTEMP	(1 << 2)
+#define	BIT_BAT_CHARGE_STATUS_PRECHG	(1 << 1)
+#define	REG_BAT_STATE			0xF482
+#define	BIT_BAT_STATE_CHARGING		(1 << 1)
+#define	BIT_BAT_STATE_DISCHARGING	(1 << 0)
+#define	REG_BAT_POWER			0xF440
+#define	BIT_BAT_POWER_S3		(1 << 2)
+#define	BIT_BAT_POWER_ON		(1 << 1)
+#define	BIT_BAT_POWER_ACIN		(1 << 0)
+
+/* Audio: rd/wr */
+#define	REG_AUDIO_VOLUME	0xF46C
+#define	REG_AUDIO_MUTE		0xF4E7
+#define	REG_AUDIO_BEEP		0xF4D0
+/* USB port power or not: rd/wr */
+#define	REG_USB0_FLAG		0xF461
+#define	REG_USB1_FLAG		0xF462
+#define	REG_USB2_FLAG		0xF463
+#define	BIT_USB_FLAG_ON		1
+#define	BIT_USB_FLAG_OFF	0
+/* LID */
+#define	REG_LID_DETECT		0xF4BD
+#define	BIT_LID_DETECT_ON	1
+#define	BIT_LID_DETECT_OFF	0
+/* CRT */
+#define	REG_CRT_DETECT		0xF4AD
+#define	BIT_CRT_DETECT_PLUG	1
+#define	BIT_CRT_DETECT_UNPLUG	0
+/* LCD backlight brightness adjust: 9 levels */
+#define	REG_DISPLAY_BRIGHTNESS	0xF4F5
+/* Black screen Status */
+#define	BIT_DISPLAY_LCD_ON	1
+#define	BIT_DISPLAY_LCD_OFF	0
+/* LCD backlight control: off/restore */
+#define	REG_BACKLIGHT_CTRL	0xF7BD
+#define	BIT_BACKLIGHT_ON	1
+#define	BIT_BACKLIGHT_OFF	0
+/* Reset the machine auto-clear: rd/wr */
+#define	REG_RESET		0xF4EC
+#define	BIT_RESET_ON		1
+/* Light the led: rd/wr */
+#define	REG_LED			0xF4C8
+#define	BIT_LED_RED_POWER	(1 << 0)
+#define	BIT_LED_ORANGE_POWER	(1 << 1)
+#define	BIT_LED_GREEN_CHARGE	(1 << 2)
+#define	BIT_LED_RED_CHARGE	(1 << 3)
+#define	BIT_LED_NUMLOCK		(1 << 4)
+/* Test led mode, all led on/off */
+#define	REG_LED_TEST		0xF4C2
+#define	BIT_LED_TEST_IN		1
+#define	BIT_LED_TEST_OUT	0
+/* Camera on/off */
+#define	REG_CAMERA_STATUS	0xF46A
+#define	BIT_CAMERA_STATUS_ON	1
+#define	BIT_CAMERA_STATUS_OFF	0
+#define	REG_CAMERA_CONTROL	0xF7B7
+#define	BIT_CAMERA_CONTROL_OFF	0
+#define	BIT_CAMERA_CONTROL_ON	1
+/* Wlan Status */
+#define	REG_WLAN		0xF4FA
+#define	BIT_WLAN_ON		1
+#define	BIT_WLAN_OFF		0
+#define	REG_DISPLAY_LCD		0xF79F
+
+/* SCI Event Number from EC */
+enum {
+	EVENT_LID = 0x23,	/*  Turn on/off LID */
+	EVENT_DISPLAY_TOGGLE,	/*  Fn+F3 for display switch */
+	EVENT_SLEEP,		/*  Fn+F1 for entering sleep mode */
+	EVENT_OVERTEMP,		/*  Over-temperature happened */
+	EVENT_CRT_DETECT,	/*  CRT is connected */
+	EVENT_CAMERA,		/*  Camera on/off */
+	EVENT_USB_OC2,		/*  USB2 Over Current occurred */
+	EVENT_USB_OC0,		/*  USB0 Over Current occurred */
+	EVENT_BLACK_SCREEN,	/*  Turn on/off backlight */
+	EVENT_AUDIO_MUTE,	/*  Mute on/off */
+	EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
+	EVENT_AC_BAT,		/*  AC & Battery relative issue */
+	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
+	EVENT_WLAN,		/*  Wlan on/off */
+};
+
+#define EVENT_START	EVENT_LID
+#define EVENT_END	EVENT_WLAN
+
+#endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson/lemote-2f/Makefile
index 4d84b27..470156e 100644
--- a/arch/mips/loongson/lemote-2f/Makefile
+++ b/arch/mips/loongson/lemote-2f/Makefile
@@ -2,7 +2,7 @@
 # Makefile for lemote loongson2f family machines
 #
 
-obj-y += irq.o reset.o ec_kb3310b.o
+obj-y += irq.o reset.o ec_kb3310b.o platform.o
 
 #
 # Suspend Support
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.c b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
index 4d84111..734d2d0 100644
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.c
+++ b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
@@ -14,7 +14,7 @@
 #include <linux/spinlock.h>
 #include <linux/delay.h>
 
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 static DEFINE_SPINLOCK(index_access_lock);
 static DEFINE_SPINLOCK(port_access_lock);
@@ -76,12 +76,9 @@ int ec_query_seq(unsigned char cmd)
 	}
 
 	if (timeout <= 0) {
-		printk(KERN_ERR "%s: deadable error : timeout...\n", __func__);
+		pr_err("%s: deadable error : timeout...\n", __func__);
 		ret = -EINVAL;
-	} else
-		printk(KERN_INFO
-			   "(%x/%d)ec issued command %d status : 0x%x\n",
-			   timeout, EC_CMD_TIMEOUT - timeout, cmd, status);
+	}
 
 	spin_unlock_irqrestore(&port_access_lock, flags);
 
@@ -118,8 +115,7 @@ int ec_get_event_num(void)
 		udelay(EC_REG_DELAY);
 	}
 	if (timeout <= 0) {
-		pr_info("%s: get event number timeout.\n", __func__);
-
+		pr_err("%s: get event number timeout.\n", __func__);
 		return -EINVAL;
 	}
 	value = inb(EC_DAT_PORT);
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/ec_kb3310b.h
deleted file mode 100644
index 1595a21..0000000
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * KB3310B Embedded Controller
- *
- *  Copyright (C) 2008 Lemote Inc.
- *  Author: liujl <liujl@lemote.com>, 2008-03-14
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _EC_KB3310B_H
-#define _EC_KB3310B_H
-
-extern unsigned char ec_read(unsigned short addr);
-extern void ec_write(unsigned short addr, unsigned char val);
-extern int ec_query_seq(unsigned char cmd);
-extern int ec_query_event_num(void);
-extern int ec_get_event_num(void);
-
-typedef int (*sci_handler) (int status);
-extern sci_handler yeeloong_report_lid_status;
-
-#define SCI_IRQ_NUM 0x0A
-
-/*
- * The following registers are determined by the EC index configuration.
- * 1, fill the PORT_HIGH as EC register high part.
- * 2, fill the PORT_LOW as EC register low part.
- * 3, fill the PORT_DATA as EC register write data or get the data from it.
- */
-#define	EC_IO_PORT_HIGH	0x0381
-#define	EC_IO_PORT_LOW	0x0382
-#define	EC_IO_PORT_DATA	0x0383
-
-/*
- * EC delay time is 500us for register and status access
- */
-#define	EC_REG_DELAY	500	/* unit : us */
-#define	EC_CMD_TIMEOUT	0x1000
-
-/*
- * EC access port for SCI communication
- */
-#define	EC_CMD_PORT		0x66
-#define	EC_STS_PORT		0x66
-#define	EC_DAT_PORT		0x62
-#define	CMD_INIT_IDLE_MODE	0xdd
-#define	CMD_EXIT_IDLE_MODE	0xdf
-#define	CMD_INIT_RESET_MODE	0xd8
-#define	CMD_REBOOT_SYSTEM	0x8c
-#define	CMD_GET_EVENT_NUM	0x84
-#define	CMD_PROGRAM_PIECE	0xda
-
-/* temperature & fan registers */
-#define	REG_TEMPERATURE_VALUE	0xF458
-#define	REG_FAN_AUTO_MAN_SWITCH 0xF459
-#define	BIT_FAN_AUTO		0
-#define	BIT_FAN_MANUAL		1
-#define	REG_FAN_CONTROL		0xF4D2
-#define	BIT_FAN_CONTROL_ON	(1 << 0)
-#define	BIT_FAN_CONTROL_OFF	(0 << 0)
-#define	REG_FAN_STATUS		0xF4DA
-#define	BIT_FAN_STATUS_ON	(1 << 0)
-#define	BIT_FAN_STATUS_OFF	(0 << 0)
-#define	REG_FAN_SPEED_HIGH	0xFE22
-#define	REG_FAN_SPEED_LOW	0xFE23
-#define	REG_FAN_SPEED_LEVEL	0xF4CC
-/* fan speed divider */
-#define	FAN_SPEED_DIVIDER	480000	/* (60*1000*1000/62.5/2)*/
-
-/* battery registers */
-#define	REG_BAT_DESIGN_CAP_HIGH		0xF77D
-#define	REG_BAT_DESIGN_CAP_LOW		0xF77E
-#define	REG_BAT_FULLCHG_CAP_HIGH	0xF780
-#define	REG_BAT_FULLCHG_CAP_LOW		0xF781
-#define	REG_BAT_DESIGN_VOL_HIGH		0xF782
-#define	REG_BAT_DESIGN_VOL_LOW		0xF783
-#define	REG_BAT_CURRENT_HIGH		0xF784
-#define	REG_BAT_CURRENT_LOW		0xF785
-#define	REG_BAT_VOLTAGE_HIGH		0xF786
-#define	REG_BAT_VOLTAGE_LOW		0xF787
-#define	REG_BAT_TEMPERATURE_HIGH	0xF788
-#define	REG_BAT_TEMPERATURE_LOW		0xF789
-#define	REG_BAT_RELATIVE_CAP_HIGH	0xF492
-#define	REG_BAT_RELATIVE_CAP_LOW	0xF493
-#define	REG_BAT_VENDOR			0xF4C4
-#define	FLAG_BAT_VENDOR_SANYO		0x01
-#define	FLAG_BAT_VENDOR_SIMPLO		0x02
-#define	REG_BAT_CELL_COUNT		0xF4C6
-#define	FLAG_BAT_CELL_3S1P		0x03
-#define	FLAG_BAT_CELL_3S2P		0x06
-#define	REG_BAT_CHARGE			0xF4A2
-#define	FLAG_BAT_CHARGE_DISCHARGE	0x01
-#define	FLAG_BAT_CHARGE_CHARGE		0x02
-#define	FLAG_BAT_CHARGE_ACPOWER		0x00
-#define	REG_BAT_STATUS			0xF4B0
-#define	BIT_BAT_STATUS_LOW		(1 << 5)
-#define	BIT_BAT_STATUS_DESTROY		(1 << 2)
-#define	BIT_BAT_STATUS_FULL		(1 << 1)
-#define	BIT_BAT_STATUS_IN		(1 << 0)
-#define	REG_BAT_CHARGE_STATUS		0xF4B1
-#define	BIT_BAT_CHARGE_STATUS_OVERTEMP	(1 << 2)
-#define	BIT_BAT_CHARGE_STATUS_PRECHG	(1 << 1)
-#define	REG_BAT_STATE			0xF482
-#define	BIT_BAT_STATE_CHARGING		(1 << 1)
-#define	BIT_BAT_STATE_DISCHARGING	(1 << 0)
-#define	REG_BAT_POWER			0xF440
-#define	BIT_BAT_POWER_S3		(1 << 2)
-#define	BIT_BAT_POWER_ON		(1 << 1)
-#define	BIT_BAT_POWER_ACIN		(1 << 0)
-
-/* other registers */
-/* Audio: rd/wr */
-#define	REG_AUDIO_VOLUME	0xF46C
-#define	REG_AUDIO_MUTE		0xF4E7
-#define	REG_AUDIO_BEEP		0xF4D0
-/* USB port power or not: rd/wr */
-#define	REG_USB0_FLAG		0xF461
-#define	REG_USB1_FLAG		0xF462
-#define	REG_USB2_FLAG		0xF463
-#define	BIT_USB_FLAG_ON		1
-#define	BIT_USB_FLAG_OFF	0
-/* LID */
-#define	REG_LID_DETECT		0xF4BD
-#define	BIT_LID_DETECT_ON	1
-#define	BIT_LID_DETECT_OFF	0
-/* CRT */
-#define	REG_CRT_DETECT		0xF4AD
-#define	BIT_CRT_DETECT_PLUG	1
-#define	BIT_CRT_DETECT_UNPLUG	0
-/* LCD backlight brightness adjust: 9 levels */
-#define	REG_DISPLAY_BRIGHTNESS	0xF4F5
-/* Black screen Status */
-#define	BIT_DISPLAY_LCD_ON	1
-#define	BIT_DISPLAY_LCD_OFF	0
-/* LCD backlight control: off/restore */
-#define	REG_BACKLIGHT_CTRL	0xF7BD
-#define	BIT_BACKLIGHT_ON	1
-#define	BIT_BACKLIGHT_OFF	0
-/* Reset the machine auto-clear: rd/wr */
-#define	REG_RESET		0xF4EC
-#define	BIT_RESET_ON		1
-/* Light the led: rd/wr */
-#define	REG_LED			0xF4C8
-#define	BIT_LED_RED_POWER	(1 << 0)
-#define	BIT_LED_ORANGE_POWER	(1 << 1)
-#define	BIT_LED_GREEN_CHARGE	(1 << 2)
-#define	BIT_LED_RED_CHARGE	(1 << 3)
-#define	BIT_LED_NUMLOCK		(1 << 4)
-/* Test led mode, all led on/off */
-#define	REG_LED_TEST		0xF4C2
-#define	BIT_LED_TEST_IN		1
-#define	BIT_LED_TEST_OUT	0
-/* Camera on/off */
-#define	REG_CAMERA_STATUS	0xF46A
-#define	BIT_CAMERA_STATUS_ON	1
-#define	BIT_CAMERA_STATUS_OFF	0
-#define	REG_CAMERA_CONTROL	0xF7B7
-#define	BIT_CAMERA_CONTROL_OFF	0
-#define	BIT_CAMERA_CONTROL_ON	1
-/* Wlan Status */
-#define	REG_WLAN		0xF4FA
-#define	BIT_WLAN_ON		1
-#define	BIT_WLAN_OFF		0
-#define	REG_DISPLAY_LCD		0xF79F
-
-/* SCI Event Number from EC */
-enum {
-	EVENT_LID = 0x23,	/*  LID open/close */
-	EVENT_DISPLAY_TOGGLE,	/*  Fn+F3 for display switch */
-	EVENT_SLEEP,		/*  Fn+F1 for entering sleep mode */
-	EVENT_OVERTEMP,		/*  Over-temperature happened */
-	EVENT_CRT_DETECT,	/*  CRT is connected */
-	EVENT_CAMERA,		/*  Camera on/off */
-	EVENT_USB_OC2,		/*  USB2 Over Current occurred */
-	EVENT_USB_OC0,		/*  USB0 Over Current occurred */
-	EVENT_BLACK_SCREEN,	/*  Turn on/off backlight */
-	EVENT_AUDIO_MUTE,	/*  Mute on/off */
-	EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
-	EVENT_AC_BAT,		/*  AC & Battery relative issue */
-	EVENT_AUDIO_VOLUME,	/*  Volume adjust */
-	EVENT_WLAN,		/*  Wlan on/off */
-	EVENT_END
-};
-
-#endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/platform.c b/arch/mips/loongson/lemote-2f/platform.c
new file mode 100644
index 0000000..0e7b27d
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/platform.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzj@lemote.com
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+#include <asm/bootinfo.h>
+
+static struct platform_device yeeloong_pdev = {
+	.name = "yeeloong_laptop",
+	.id = -1,
+};
+
+static int __init lemote2f_platform_init(void)
+{
+	struct platform_device *pdev = NULL;
+
+	switch (mips_machtype) {
+	case MACH_LEMOTE_YL2F89:
+		pdev = &yeeloong_pdev;
+		break;
+	default:
+		break;
+
+	}
+
+	if (pdev != NULL)
+		return platform_device_register(pdev);
+
+	return -ENODEV;
+}
+
+arch_initcall(lemote2f_platform_init);
diff --git a/arch/mips/loongson/lemote-2f/pm.c b/arch/mips/loongson/lemote-2f/pm.c
index d7af2e6..0d5698a 100644
--- a/arch/mips/loongson/lemote-2f/pm.c
+++ b/arch/mips/loongson/lemote-2f/pm.c
@@ -23,7 +23,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536_mfgpt.h>
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 #define I8042_KBD_IRQ		1
 #define I8042_CTR_KBDINT	0x01
@@ -100,7 +100,7 @@ int wakeup_loongson(void)
 	if (irq < 0)
 		return 0;
 
-	printk(KERN_INFO "%s: irq = %d\n", __func__, irq);
+	pr_info("%s: irq = %d\n", __func__, irq);
 
 	if (irq == I8042_KBD_IRQ)
 		return 1;
diff --git a/arch/mips/loongson/lemote-2f/reset.c b/arch/mips/loongson/lemote-2f/reset.c
index 51d1a60..4627659 100644
--- a/arch/mips/loongson/lemote-2f/reset.c
+++ b/arch/mips/loongson/lemote-2f/reset.c
@@ -20,7 +20,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536.h>
-#include "ec_kb3310b.h"
+#include <ec_kb3310b.h>
 
 static void reset_cpu(void)
 {
diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile
index 782953a..8bdc97c 100644
--- a/drivers/platform/Makefile
+++ b/drivers/platform/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_X86)		+= x86/
+obj-$(CONFIG_MIPS)		+= mips/
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 2f77693..5ac5215 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -14,5 +14,13 @@ menuconfig MIPS_PLATFORM_DEVICES
 
 if MIPS_PLATFORM_DEVICES
 
+config LEMOTE_YEELOONG2F
+	tristate "Lemote YeeLoong Laptop"
+	depends on LEMOTE_MACH2F
+	help
+	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
+	  compatible to FuLoong2F mini PC, but it has an extra Embedded
+	  Controller(kb3310b) for battery, hotkey, backlight, temperature and
+	  fan management.
 
 endif # MIPS_PLATFORM_DEVICES
diff --git a/drivers/platform/mips/Makefile b/drivers/platform/mips/Makefile
new file mode 100644
index 0000000..506f920
--- /dev/null
+++ b/drivers/platform/mips/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for MIPS Platform-Specific Drivers
+#
+
+obj-$(CONFIG_LEMOTE_YEELOONG2F)	+= yeeloong_laptop.o
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
new file mode 100644
index 0000000..85fc7ed
--- /dev/null
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -0,0 +1,60 @@
+/*
+ * Driver for YeeLoong laptop extras
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+static struct platform_device_id platform_device_ids[] = {
+	{
+		.name = "yeeloong_laptop",
+	},
+	{}
+};
+
+MODULE_DEVICE_TABLE(platform, platform_device_ids);
+
+static struct platform_driver platform_driver = {
+	.driver = {
+		   .name = "yeeloong_laptop",
+		   .owner = THIS_MODULE,
+		   },
+	.id_table = platform_device_ids,
+};
+
+static int __init yeeloong_init(void)
+{
+	int ret;
+
+	pr_info("Load YeeLoong Laptop Platform Specific Driver.\n");
+
+	/* Register platform stuff */
+	ret = platform_driver_register(&platform_driver);
+	if (ret) {
+		pr_err("Fail to register yeeloong platform driver.\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static void __exit yeeloong_exit(void)
+{
+	platform_driver_unregister(&platform_driver);
+
+	pr_info("Unload YeeLoong Platform Specific Driver.\n");
+}
+
+module_init(yeeloong_init);
+module_exit(yeeloong_exit);
+
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_DESCRIPTION("YeeLoong laptop driver");
+MODULE_LICENSE("GPL");
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  8 15:17:25 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:17:31 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:47541 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494196AbZLHOQf (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:16:35 +0100
Received: by mail-px0-f176.google.com with SMTP id 6so4090402pxi.0
        for <multiple recipients>; Tue, 08 Dec 2009 06:16:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=98C3ZgXwlkFjaRCwUIJy9wrLHylzok1hdiAhXCzdMGw=;
        b=pvGSDhikkJNRZ8zMqZsc/umDdx46dAG5NNXiac5MCIbWePrz/FX2m4KCVYflxQ7Z+U
         PHtI0tNM3Uhk9cDHFtdClGnqBoMrmlsAbO5+VsaKIc8+6AtmZhNKomGUF6oqbk8Tbyez
         WT1FQtOJWF0G4LKM73eWF+4mcTu5Y26NjxSeY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=BNa0/DUA5lb+R6GsEzei8XMaeyJ/GWVZrnVTjYmvINghsUlxQzl4tHSiaAzELCcZfL
         2/GvotVN1Zd5KiCN/99/Uh4dB+iuZJxIxr0Y1eeWhTQh9v8WY+ubV8wuozNRX79nn+yj
         ObP0XjrmxyZRP4/j/Bx5vo7TbyO4oEf0UMoHI=
Received: by 10.114.237.18 with SMTP id k18mr15428642wah.63.1260281794692;
        Tue, 08 Dec 2009 06:16:34 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.16.28
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:16:34 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 3/8] Loongson: YeeLoong: add backlight driver
Date:   Tue,  8 Dec 2009 22:15:51 +0800
Message-Id: <4d821efaecc3dee0b9124119507a694e81572437.1260281599.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <7676d8397e593dbec0d40e24429b7ccbcecfa588.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260254344.git.wuzhangjin@gmail.com>
 <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
 <7676d8397e593dbec0d40e24429b7ccbcecfa588.1260281599.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25375
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds YeeLoong Backlight Driver, it provides standard
interface(/sys/class/backlight/) for user-space applications(e.g.
kpowersave, gnome-power-manager) to control the brightness of the
backlight.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |   81 +++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 5ac5215..c1ba03d 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -17,6 +17,7 @@ if MIPS_PLATFORM_DEVICES
 config LEMOTE_YEELOONG2F
 	tristate "Lemote YeeLoong Laptop"
 	depends on LEMOTE_MACH2F
+	select BACKLIGHT_CLASS_DEVICE
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index 85fc7ed..be674c5 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -11,6 +11,79 @@
 
 #include <linux/err.h>
 #include <linux/platform_device.h>
+#include <linux/backlight.h>	/* for backlight subdriver */
+#include <linux/fb.h>
+
+#include <ec_kb3310b.h>
+
+/* backlight subdriver */
+#define MAX_BRIGHTNESS	8
+
+static int yeeloong_set_brightness(struct backlight_device *bd)
+{
+	unsigned int level, current_level;
+	static unsigned int old_level;
+
+	level = (bd->props.fb_blank == FB_BLANK_UNBLANK &&
+		 bd->props.power == FB_BLANK_UNBLANK) ?
+	    bd->props.brightness : 0;
+
+	if (level > MAX_BRIGHTNESS)
+		level = MAX_BRIGHTNESS;
+	else if (level < 0)
+		level = 0;
+
+	/* Avoid to modify the brightness when EC is tuning it */
+	if (old_level != level) {
+		current_level = ec_read(REG_DISPLAY_BRIGHTNESS);
+		if (old_level == current_level)
+			ec_write(REG_DISPLAY_BRIGHTNESS, level);
+		old_level = level;
+	}
+
+	return 0;
+}
+
+static int yeeloong_get_brightness(struct backlight_device *bd)
+{
+	return ec_read(REG_DISPLAY_BRIGHTNESS);
+}
+
+static struct backlight_ops backlight_ops = {
+	.get_brightness = yeeloong_get_brightness,
+	.update_status = yeeloong_set_brightness,
+};
+
+static struct backlight_device *yeeloong_backlight_dev;
+
+static int yeeloong_backlight_init(void)
+{
+	int ret;
+
+	yeeloong_backlight_dev = backlight_device_register("backlight0", NULL,
+			NULL, &backlight_ops);
+
+	if (IS_ERR(yeeloong_backlight_dev)) {
+		ret = PTR_ERR(yeeloong_backlight_dev);
+		yeeloong_backlight_dev = NULL;
+		return ret;
+	}
+
+	yeeloong_backlight_dev->props.max_brightness = MAX_BRIGHTNESS;
+	yeeloong_backlight_dev->props.brightness =
+		yeeloong_get_brightness(yeeloong_backlight_dev);
+	backlight_update_status(yeeloong_backlight_dev);
+
+	return 0;
+}
+
+static void yeeloong_backlight_exit(void)
+{
+	if (yeeloong_backlight_dev) {
+		backlight_device_unregister(yeeloong_backlight_dev);
+		yeeloong_backlight_dev = NULL;
+	}
+}
 
 static struct platform_device_id platform_device_ids[] = {
 	{
@@ -42,11 +115,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_backlight_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong backlight driver.\n");
+		yeeloong_backlight_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
 
 	pr_info("Unload YeeLoong Platform Specific Driver.\n");
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  8 15:17:50 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:17:56 +0100 (CET)
Received: from mail-px0-f176.google.com ([209.85.216.176]:47541 "EHLO
        mail-px0-f176.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494186AbZLHOQm (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:16:42 +0100
Received: by mail-px0-f176.google.com with SMTP id 6so4090402pxi.0
        for <multiple recipients>; Tue, 08 Dec 2009 06:16:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=yZIL1ia0HN7aXoP2yXash9qwbPpDq3HjCJleZ9CWtKc=;
        b=lkr+kXjnbnTpK7oSFxCjAfk56dxJATA9QSSLP3LywRFgEcZF+GtRVnlDE2vW+SBiK4
         gXQXdAwIZwnxSEMGNhEC5EGqk5DNqczMjY1qy9PBQ+mKMj5hHJDclXTuHaXFZ86E82Kd
         PZF/A4QEwhuXTsqWZh+sXxrS34m6QQUld9U2A=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=ScMrD3/hHkI1k9yN5Jz1i61l0Dyog4zLj83cvIGanp4Uhfeyg4fmq5/L6uLZ0Xf/Ye
         svVnxxXEVRYDs1ZLot7v2sIhVrBfrX3sa9pcP1mKrtLieCJTgku+IMSCSRQP5Pk2LBp3
         FCQDd+v+E2tt+EFtbkt2fkVLxjVgn+pTyL9Z4=
Received: by 10.114.45.10 with SMTP id s10mr2501509was.76.1260281801713;
        Tue, 08 Dec 2009 06:16:41 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.16.35
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:16:41 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 4/8] Loongson: YeeLoong: add battery driver
Date:   Tue,  8 Dec 2009 22:15:52 +0800
Message-Id: <5c426a5091bee3e4483fc0b93f26359e2840428b.1260281599.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <4d821efaecc3dee0b9124119507a694e81572437.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260254344.git.wuzhangjin@gmail.com>
 <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
 <7676d8397e593dbec0d40e24429b7ccbcecfa588.1260281599.git.wuzhangjin@gmail.com>
 <4d821efaecc3dee0b9124119507a694e81572437.1260281599.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25376
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds APM emulated Battery Driver, it provides standard
interface(/proc/apm) for user-space applications(e.g. kpowersave,
gnome-power-manager) to manage the battery.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    2 +
 drivers/platform/mips/yeeloong_laptop.c |  108 ++++++++++++++++++++++++++++++-
 2 files changed, 108 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index c1ba03d..965933b 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -18,6 +18,8 @@ config LEMOTE_YEELOONG2F
 	tristate "Lemote YeeLoong Laptop"
 	depends on LEMOTE_MACH2F
 	select BACKLIGHT_CLASS_DEVICE
+	select SYS_SUPPORTS_APM_EMULATION
+	select APM_EMULATION
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index be674c5..b265674 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -2,7 +2,7 @@
  * Driver for YeeLoong laptop extras
  *
  *  Copyright (C) 2009 Lemote Inc.
- *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *  Author: Wu Zhangjin <wuzj@lemote.com>, Liu Junliang <liujl@lemote.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -13,6 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/backlight.h>	/* for backlight subdriver */
 #include <linux/fb.h>
+#include <linux/apm-emulation.h>/* for battery subdriver */
 
 #include <ec_kb3310b.h>
 
@@ -85,6 +86,106 @@ static void yeeloong_backlight_exit(void)
 	}
 }
 
+/* battery subdriver */
+
+static void get_fixed_battery_info(void)
+{
+	int design_cap, full_charged_cap, design_vol, vendor, cell_count;
+
+	design_cap = (ec_read(REG_BAT_DESIGN_CAP_HIGH) << 8)
+	    | ec_read(REG_BAT_DESIGN_CAP_LOW);
+	full_charged_cap = (ec_read(REG_BAT_FULLCHG_CAP_HIGH) << 8)
+	    | ec_read(REG_BAT_FULLCHG_CAP_LOW);
+	design_vol = (ec_read(REG_BAT_DESIGN_VOL_HIGH) << 8)
+	    | ec_read(REG_BAT_DESIGN_VOL_LOW);
+	vendor = ec_read(REG_BAT_VENDOR);
+	cell_count = ec_read(REG_BAT_CELL_COUNT);
+
+	if (vendor != 0) {
+		pr_info("battery vendor(%s), cells count(%d), "
+		       "with designed capacity(%d),designed voltage(%d),"
+		       " full charged capacity(%d)\n",
+		       (vendor ==
+			FLAG_BAT_VENDOR_SANYO) ? "SANYO" : "SIMPLO",
+		       (cell_count == FLAG_BAT_CELL_3S1P) ? 3 : 6,
+		       design_cap, design_vol,
+		       full_charged_cap);
+	}
+}
+
+#define APM_CRITICAL		5
+
+static void get_power_status(struct apm_power_info *info)
+{
+	unsigned char bat_status;
+
+	info->battery_status = APM_BATTERY_STATUS_UNKNOWN;
+	info->battery_flag = APM_BATTERY_FLAG_UNKNOWN;
+	info->units = APM_UNITS_MINS;
+
+	info->battery_life = (ec_read(REG_BAT_RELATIVE_CAP_HIGH) << 8) |
+		(ec_read(REG_BAT_RELATIVE_CAP_LOW));
+
+	info->ac_line_status = (ec_read(REG_BAT_POWER) & BIT_BAT_POWER_ACIN) ?
+		APM_AC_ONLINE : APM_AC_OFFLINE;
+
+	bat_status = ec_read(REG_BAT_STATUS);
+
+	if (!(bat_status & BIT_BAT_STATUS_IN)) {
+		/* no battery inserted */
+		info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT;
+		info->battery_flag = APM_BATTERY_FLAG_NOT_PRESENT;
+		info->time = 0x00;
+		return;
+	}
+
+	/* adapter inserted */
+	if (info->ac_line_status == APM_AC_ONLINE) {
+		if (!(bat_status & BIT_BAT_STATUS_FULL)) {
+			/* battery is not fully charged */
+			info->battery_status = APM_BATTERY_STATUS_CHARGING;
+			info->battery_flag = APM_BATTERY_FLAG_CHARGING;
+		} else {
+			/* battery is fully charged */
+			info->battery_status = APM_BATTERY_STATUS_HIGH;
+			info->battery_flag = APM_BATTERY_FLAG_HIGH;
+			info->battery_life = 100;
+		}
+	} else {
+		/* battery is too low */
+		if (bat_status & BIT_BAT_STATUS_LOW) {
+			info->battery_status = APM_BATTERY_STATUS_LOW;
+			info->battery_flag = APM_BATTERY_FLAG_LOW;
+			if (info->battery_life <= APM_CRITICAL) {
+				/* we should power off the system now */
+				info->battery_status =
+					APM_BATTERY_STATUS_CRITICAL;
+				info->battery_flag = APM_BATTERY_FLAG_CRITICAL;
+			}
+		} else {
+			/* assume the battery is high enough. */
+			info->battery_status = APM_BATTERY_STATUS_HIGH;
+			info->battery_flag = APM_BATTERY_FLAG_HIGH;
+		}
+	}
+	info->time = ((info->battery_life - 3) * 54 + 142) / 60;
+}
+
+static int yeeloong_battery_init(void)
+{
+	get_fixed_battery_info();
+
+	apm_get_power_status = get_power_status;
+
+	return 0;
+}
+
+static void yeeloong_battery_exit(void)
+{
+	if (apm_get_power_status == get_power_status)
+		apm_get_power_status = NULL;
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -122,11 +223,14 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	yeeloong_battery_init();
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
 
@@ -136,6 +240,6 @@ static void __exit yeeloong_exit(void)
 module_init(yeeloong_init);
 module_exit(yeeloong_exit);
 
-MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>");
+MODULE_AUTHOR("Wu Zhangjin <wuzj@lemote.com>; Liu Junliang <liujl@lemote.com>");
 MODULE_DESCRIPTION("YeeLoong laptop driver");
 MODULE_LICENSE("GPL");
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  8 15:18:14 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:18:19 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:40284 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494207AbZLHOQu (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:16:50 +0100
Received: by mail-pz0-f197.google.com with SMTP id 35so4728625pzk.22
        for <multiple recipients>; Tue, 08 Dec 2009 06:16:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=PPca3vEq5wlO7sgW3Vf/aQnGe00QpbJ07THNTe7wyKM=;
        b=t/yRqauOO1U3sm+IYP25IgJoS8/dS09fPN53t+aYl0ZOzWeCMsKXxE9d5YJvhPD3cL
         zZfrxaUVdwT+kCgT3ogGl73r3vfQpxZ8R8wwGVLI+1pZfk8PsjtAPOpYL9XNB17MFmLI
         vVlo0bCs/wIwyadATn7P8MUSFwXv4jn6OP54U=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=qdRzp2Hsk1DTHLYQnkSDAvw4pWekQRmo75FY9IrhZKLg8nZl5ktbOnnHOp5VmHlu1/
         DRnvYuZQDPKNMopBMhf8rilOO+XS84i12tnp96+uv1E+/gl4NH1hBqoNEL7kudCnZY33
         Cqmka9U3ZKzd1jVd++c2yWJX0IMbS3SArra4g=
Received: by 10.114.188.31 with SMTP id l31mr15222462waf.201.1260281809407;
        Tue, 08 Dec 2009 06:16:49 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.16.42
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:16:48 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 5/8] Loongson: YeeLoong: add hardware monitoring driver
Date:   Tue,  8 Dec 2009 22:15:53 +0800
Message-Id: <5e9acb4cd757075f617daa45cbd6f5fad94678ac.1260281599.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <5c426a5091bee3e4483fc0b93f26359e2840428b.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260254344.git.wuzhangjin@gmail.com>
 <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
 <7676d8397e593dbec0d40e24429b7ccbcecfa588.1260281599.git.wuzhangjin@gmail.com>
 <4d821efaecc3dee0b9124119507a694e81572437.1260281599.git.wuzhangjin@gmail.com>
 <5c426a5091bee3e4483fc0b93f26359e2840428b.1260281599.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25377
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds hardware monitoring driver, it provides standard
interface(/sys/class/hwmon/) for lm-sensors/sensors-applet to monitor
the temperatures of CPU and battery, the PWM of fan, the current,
voltage of battery.

Please refer to Documentation/hwmon/userspace-tools to get more
information about the hwmon.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |  211 ++++++++++++++++++++++++++++++-
 2 files changed, 208 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 965933b..352594c 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -20,6 +20,7 @@ config LEMOTE_YEELOONG2F
 	select BACKLIGHT_CLASS_DEVICE
 	select SYS_SUPPORTS_APM_EMULATION
 	select APM_EMULATION
+	select HWMON
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index b265674..becda4f 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -14,6 +14,8 @@
 #include <linux/backlight.h>	/* for backlight subdriver */
 #include <linux/fb.h>
 #include <linux/apm-emulation.h>/* for battery subdriver */
+#include <linux/hwmon.h>	/* for hwmon subdriver */
+#include <linux/hwmon-sysfs.h>
 
 #include <ec_kb3310b.h>
 
@@ -29,10 +31,7 @@ static int yeeloong_set_brightness(struct backlight_device *bd)
 		 bd->props.power == FB_BLANK_UNBLANK) ?
 	    bd->props.brightness : 0;
 
-	if (level > MAX_BRIGHTNESS)
-		level = MAX_BRIGHTNESS;
-	else if (level < 0)
-		level = 0;
+	level = SENSORS_LIMIT(level, 0, MAX_BRIGHTNESS);
 
 	/* Avoid to modify the brightness when EC is tuning it */
 	if (old_level != level) {
@@ -186,6 +185,202 @@ static void yeeloong_battery_exit(void)
 		apm_get_power_status = NULL;
 }
 
+/* hwmon subdriver */
+
+/* pwm(auto/manual) enable or not */
+static int get_fan_pwm_enable(void)
+{
+	return ec_read(REG_FAN_AUTO_MAN_SWITCH);
+}
+
+static void set_fan_pwm_enable(int manual)
+{
+	ec_write(REG_FAN_AUTO_MAN_SWITCH, !!manual);
+}
+
+static int get_fan_pwm(void)
+{
+	return ec_read(REG_FAN_SPEED_LEVEL);
+}
+
+static void set_fan_pwm(int value)
+{
+	value = SENSORS_LIMIT(value, 0, 3);
+
+	/* We must ensure the fan is on */
+	if (value > 0)
+		ec_write(REG_FAN_CONTROL, BIT_FAN_CONTROL_ON);
+
+	ec_write(REG_FAN_SPEED_LEVEL, value);
+}
+
+static int get_fan_rpm(void)
+{
+	int value;
+
+	value = FAN_SPEED_DIVIDER /
+	    (((ec_read(REG_FAN_SPEED_HIGH) & 0x0f) << 8) |
+	     ec_read(REG_FAN_SPEED_LOW));
+
+	return value;
+}
+
+static int get_cpu_temp(void)
+{
+	s8 value;
+
+	value = ec_read(REG_TEMPERATURE_VALUE);
+
+	return value * 1000;
+}
+
+static int get_battery_temp(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_TEMPERATURE_HIGH) << 8) |
+		(ec_read(REG_BAT_TEMPERATURE_LOW));
+
+	return value * 1000;
+}
+
+static int get_battery_temp_alarm(void)
+{
+	int status;
+
+	status = (ec_read(REG_BAT_CHARGE_STATUS) &
+			BIT_BAT_CHARGE_STATUS_OVERTEMP);
+
+	return !!status;
+}
+
+static int get_battery_current(void)
+{
+	s16 value;
+
+	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
+		(ec_read(REG_BAT_CURRENT_LOW));
+
+	return -value;
+}
+
+static int get_battery_voltage(void)
+{
+	int value;
+
+	value = (ec_read(REG_BAT_VOLTAGE_HIGH) << 8) |
+		(ec_read(REG_BAT_VOLTAGE_LOW));
+
+	return value;
+}
+
+static ssize_t store_sys_hwmon(void (*set) (int), const char *buf, size_t count)
+{
+	int ret;
+	unsigned long value;
+
+	if (!count)
+		return 0;
+
+	ret = strict_strtoul(buf, 10, &value);
+	if (ret)
+		return ret;
+
+	set(value);
+
+	return count;
+}
+
+static ssize_t show_sys_hwmon(int (*get) (void), char *buf)
+{
+	return sprintf(buf, "%d\n", get());
+}
+
+#define CREATE_SENSOR_ATTR(_name, _mode, _set, _get)		\
+	static ssize_t show_##_name(struct device *dev,			\
+				    struct device_attribute *attr,	\
+				    char *buf)				\
+	{								\
+		return show_sys_hwmon(_set, buf);			\
+	}								\
+	static ssize_t store_##_name(struct device *dev,		\
+				     struct device_attribute *attr,	\
+				     const char *buf, size_t count)	\
+	{								\
+		return store_sys_hwmon(_get, buf, count);		\
+	}								\
+	static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0);
+
+CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, get_fan_rpm, NULL);
+CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, get_fan_pwm, set_fan_pwm);
+CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, get_fan_pwm_enable,
+		set_fan_pwm_enable);
+CREATE_SENSOR_ATTR(temp1_input, S_IRUGO, get_cpu_temp, NULL);
+CREATE_SENSOR_ATTR(temp2_input, S_IRUGO, get_battery_temp, NULL);
+CREATE_SENSOR_ATTR(temp2_max_alarm, S_IRUGO, get_battery_temp_alarm, NULL);
+CREATE_SENSOR_ATTR(curr1_input, S_IRUGO, get_battery_current, NULL);
+CREATE_SENSOR_ATTR(in1_input, S_IRUGO, get_battery_voltage, NULL);
+
+static ssize_t
+show_name(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "yeeloong\n");
+}
+
+static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
+
+static struct attribute *hwmon_attributes[] = {
+	&sensor_dev_attr_pwm1.dev_attr.attr,
+	&sensor_dev_attr_pwm1_enable.dev_attr.attr,
+	&sensor_dev_attr_fan1_input.dev_attr.attr,
+	&sensor_dev_attr_temp1_input.dev_attr.attr,
+	&sensor_dev_attr_temp2_input.dev_attr.attr,
+	&sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
+	&sensor_dev_attr_curr1_input.dev_attr.attr,
+	&sensor_dev_attr_in1_input.dev_attr.attr,
+	&sensor_dev_attr_name.dev_attr.attr,
+	NULL
+};
+
+static struct attribute_group hwmon_attribute_group = {
+	.attrs = hwmon_attributes
+};
+
+static struct device *yeeloong_hwmon_dev;
+
+static int yeeloong_hwmon_init(void)
+{
+	int ret;
+
+	yeeloong_hwmon_dev = hwmon_device_register(NULL);
+	if (IS_ERR(yeeloong_hwmon_dev)) {
+		pr_err("Fail to register yeeloong hwmon device\n");
+		yeeloong_hwmon_dev = NULL;
+		return PTR_ERR(yeeloong_hwmon_dev);
+	}
+	ret = sysfs_create_group(&yeeloong_hwmon_dev->kobj,
+				 &hwmon_attribute_group);
+	if (ret) {
+		hwmon_device_unregister(yeeloong_hwmon_dev);
+		yeeloong_hwmon_dev = NULL;
+		return ret;
+	}
+	/* ensure fan is set to auto mode */
+	set_fan_pwm_enable(BIT_FAN_AUTO);
+
+	return 0;
+}
+
+static void yeeloong_hwmon_exit(void)
+{
+	if (yeeloong_hwmon_dev) {
+		sysfs_remove_group(&yeeloong_hwmon_dev->kobj,
+				   &hwmon_attribute_group);
+		hwmon_device_unregister(yeeloong_hwmon_dev);
+		yeeloong_hwmon_dev = NULL;
+	}
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -225,11 +420,19 @@ static int __init yeeloong_init(void)
 
 	yeeloong_battery_init();
 
+	ret = yeeloong_hwmon_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong hwmon driver.\n");
+		yeeloong_hwmon_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
 	platform_driver_unregister(&platform_driver);
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  8 15:18:38 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:18:42 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:40284 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494195AbZLHORC (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:17:02 +0100
Received: by mail-pz0-f197.google.com with SMTP id 35so4728625pzk.22
        for <multiple recipients>; Tue, 08 Dec 2009 06:17:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=HWbleMQTWkyICrk7Cwepvs+tJX25vw3FV48JsZt9mas=;
        b=NqaU68nJfxFPlN7YBtMl1sOv/t8tKzr53f9AVlFfnH6Mr4F9AjAvKHw8S0+GXrqWFW
         FpZtOUhMVBG3b3lJbeFZQxm3aZ3yhrWDbrwk9KaFn0KBDnPESVtftFdrhXqRQpt7kOr8
         bpb7BSxTS+lzWIXyOcVmq5c225xMstovzSY+Y=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=glMFOPG+FcVUUEZyKTxyeHGnvnMClD4oGB8ol2FMEsE6j0fyaJxG1535iH9QBFMcHm
         VadPeD6dgcm/Y9zElnA2S3ivWHikb2oO5ABtJ9ewfPAmDBOmPx5vKoMkBpJK2Dm/TfFl
         yOdo2nupfZN7fdB2druuGFPVvRes9JewHZuek=
Received: by 10.115.39.8 with SMTP id r8mr11202035waj.104.1260281821901;
        Tue, 08 Dec 2009 06:17:01 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.16.56
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:17:01 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 7/8] Loongson: YeeLoong: add suspend support
Date:   Tue,  8 Dec 2009 22:15:55 +0800
Message-Id: <6af33d6c42ba4de9eea27316c64f81b96e01c948.1260281599.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <234c5ecd475b05e3eb17ead3ae107cfe3426e0e0.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260254344.git.wuzhangjin@gmail.com>
 <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
 <7676d8397e593dbec0d40e24429b7ccbcecfa588.1260281599.git.wuzhangjin@gmail.com>
 <4d821efaecc3dee0b9124119507a694e81572437.1260281599.git.wuzhangjin@gmail.com>
 <5c426a5091bee3e4483fc0b93f26359e2840428b.1260281599.git.wuzhangjin@gmail.com>
 <5e9acb4cd757075f617daa45cbd6f5fad94678ac.1260281599.git.wuzhangjin@gmail.com>
 <234c5ecd475b05e3eb17ead3ae107cfe3426e0e0.1260281599.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25378
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch add support to suspend the yeeloong platform specific
devices(LCD, CRT, USB...).

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/yeeloong_laptop.c |   42 ++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index f8907da..baf3e81 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -512,6 +512,39 @@ static void yeeloong_vo_exit(void)
 	}
 }
 
+#ifdef CONFIG_PM
+static void usb_ports_set(int status)
+{
+	status = !!status;
+
+	ec_write(REG_USB0_FLAG, status);
+	ec_write(REG_USB1_FLAG, status);
+	ec_write(REG_USB2_FLAG, status);
+}
+
+static int yeeloong_suspend(struct device *dev)
+
+{
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	usb_ports_set(BIT_USB_FLAG_OFF);
+
+	return 0;
+}
+
+static int yeeloong_resume(struct device *dev)
+{
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+	usb_ports_set(BIT_USB_FLAG_ON);
+
+	return 0;
+}
+
+static const SIMPLE_DEV_PM_OPS(yeeloong_pm_ops, yeeloong_suspend,
+	yeeloong_resume);
+#endif
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -523,9 +556,12 @@ MODULE_DEVICE_TABLE(platform, platform_device_ids);
 
 static struct platform_driver platform_driver = {
 	.driver = {
-		   .name = "yeeloong_laptop",
-		   .owner = THIS_MODULE,
-		   },
+		.name = "yeeloong_laptop",
+		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm = &yeeloong_pm_ops,
+#endif
+	},
 	.id_table = platform_device_ids,
 };
 
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  8 15:19:00 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:19:06 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:40284 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494209AbZLHORL (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:17:11 +0100
Received: by mail-pz0-f197.google.com with SMTP id 35so4728625pzk.22
        for <multiple recipients>; Tue, 08 Dec 2009 06:17:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=L/3Wu/n3ERCnB4gzHpWkFmA70BwTl/xbcGFiG/THb5E=;
        b=xvFJ5sNx7o1rsmVbxHfcsL767WD7DmmgPIo0SgUauAwvtvlUBTa1HQauFtu4DrqjJO
         s3WN3pySZILzvWFxOqZmSnScuzAiUPg8iDkQHoubHSbo4ew/dXclxHB1BBAZNxGNiVGU
         RAuUhe+Vp5ZvCf4bBGxUh/gX6K0a1Sdq2+oVA=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=ieQTJanYGX48uuyocrSToB6ME7Q2BL5TAHp3wiAP9ByMc+eUAAiySCCCmz4KIGx3JC
         8k1vH/pmYFTBsuyMR3/oPyP3baW8XWncgHpLK+J8EtkL5QV17Hje9qAQTZ2iNTrtuGK4
         hHWC8wkhUQNaOt7a4v4utgQpma+M0ekdLz6gI=
Received: by 10.114.33.14 with SMTP id g14mr15249724wag.124.1260281829829;
        Tue, 08 Dec 2009 06:17:09 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.17.02
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:17:09 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 8/8] Loongson: YeeLoong: add input/hotkey driver
Date:   Tue,  8 Dec 2009 22:15:56 +0800
Message-Id: <e6d590fa37e6003dd482918fdef02c1fc127d6c8.1260281599.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <6af33d6c42ba4de9eea27316c64f81b96e01c948.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260254344.git.wuzhangjin@gmail.com>
 <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
 <7676d8397e593dbec0d40e24429b7ccbcecfa588.1260281599.git.wuzhangjin@gmail.com>
 <4d821efaecc3dee0b9124119507a694e81572437.1260281599.git.wuzhangjin@gmail.com>
 <5c426a5091bee3e4483fc0b93f26359e2840428b.1260281599.git.wuzhangjin@gmail.com>
 <5e9acb4cd757075f617daa45cbd6f5fad94678ac.1260281599.git.wuzhangjin@gmail.com>
 <234c5ecd475b05e3eb17ead3ae107cfe3426e0e0.1260281599.git.wuzhangjin@gmail.com>
 <6af33d6c42ba4de9eea27316c64f81b96e01c948.1260281599.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25379
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Hotkey Driver, which will do related actions for The
hotkey event(/sys/class/input) and report the corresponding input keys
to the user-space applications.

[NOTE:

This patch is based on the sparse keymap library in:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input next

of Dmitry Torokhov. that sparse keymap support is also queued for
2.6.33. Before the above branch is pulled by linus, this patch is not
appliable.]

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/mach-loongson/loongson.h |    6 +
 arch/mips/loongson/common/cmdline.c            |    8 +
 drivers/platform/mips/Kconfig                  |    2 +
 drivers/platform/mips/yeeloong_laptop.c        |  412 ++++++++++++++++++++++++
 4 files changed, 428 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h
index ee8bc83..13e208e 100644
--- a/arch/mips/include/asm/mach-loongson/loongson.h
+++ b/arch/mips/include/asm/mach-loongson/loongson.h
@@ -43,6 +43,12 @@ static inline void prom_init_uart_base(void)
 #endif
 }
 
+/*
+ * Copy kernel command line from arcs_cmdline
+ */
+#include <asm/setup.h>
+extern char loongson_cmdline[COMMAND_LINE_SIZE];
+
 /* irq operation functions */
 extern void bonito_irqdispatch(void);
 extern void __init bonito_irq_init(void);
diff --git a/arch/mips/loongson/common/cmdline.c b/arch/mips/loongson/common/cmdline.c
index 7ad47f2..617faee 100644
--- a/arch/mips/loongson/common/cmdline.c
+++ b/arch/mips/loongson/common/cmdline.c
@@ -17,6 +17,7 @@
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */
+#include <linux/module.h>
 #include <asm/bootinfo.h>
 
 #include <loongson.h>
@@ -25,6 +26,10 @@ int prom_argc;
 /* pmon passes arguments in 32bit pointers */
 int *_prom_argv;
 
+/* the kernel command line copied from arcs_cmdline */
+char loongson_cmdline[COMMAND_LINE_SIZE];
+EXPORT_SYMBOL(loongson_cmdline);
+
 void __init prom_init_cmdline(void)
 {
 	int i;
@@ -51,4 +56,7 @@ void __init prom_init_cmdline(void)
 		strcat(arcs_cmdline, " root=/dev/hda1");
 
 	prom_init_machtype();
+
+	/* copy arcs_cmdline into loongson_cmdline */
+	strncpy(loongson_cmdline, arcs_cmdline, COMMAND_LINE_SIZE);
 }
diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index e2dbe28..8262dff 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -22,6 +22,8 @@ config LEMOTE_YEELOONG2F
 	select APM_EMULATION
 	select HWMON
 	select VIDEO_OUTPUT_CONTROL
+	select INPUT_SPARSEKMAP
+	depends on INPUT
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index baf3e81..ce3a7e8 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -17,7 +17,14 @@
 #include <linux/hwmon.h>	/* for hwmon subdriver */
 #include <linux/hwmon-sysfs.h>
 #include <linux/video_output.h>	/* for video output subdriver */
+#include <linux/input.h>	/* for hotkey subdriver */
+#include <linux/input/sparse-keymap.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
 
+#include <cs5536/cs5536.h>
+
+#include <loongson.h>		/* for loongson_cmdline */
 #include <ec_kb3310b.h>
 
 /* backlight subdriver */
@@ -512,6 +519,403 @@ static void yeeloong_vo_exit(void)
 	}
 }
 
+/* hotkey subdriver */
+
+static struct input_dev *yeeloong_hotkey_dev;
+
+static const struct key_entry yeeloong_keymap[] = {
+	{KE_SW, EVENT_LID, { SW_LID } },
+	{KE_KEY, EVENT_CAMERA, { KEY_CAMERA } }, /* Fn + ESC */
+	{KE_KEY, EVENT_SLEEP, { KEY_SLEEP } }, /* Fn + F1 */
+	{KE_KEY, EVENT_DISPLAY_TOGGLE, { KEY_SWITCHVIDEOMODE } }, /* Fn + F3 */
+	{KE_KEY, EVENT_AUDIO_MUTE, { KEY_MUTE } }, /* Fn + F4 */
+	{KE_KEY, EVENT_WLAN, { KEY_WLAN } }, /* Fn + F5 */
+	{KE_KEY, EVENT_DISPLAY_BRIGHTNESS, { KEY_BRIGHTNESSUP } }, /* Fn + up */
+	{KE_KEY, EVENT_DISPLAY_BRIGHTNESS, { KEY_BRIGHTNESSDOWN } }, /* Fn + down */
+	{KE_KEY, EVENT_AUDIO_VOLUME, { KEY_VOLUMEUP } }, /* Fn + right */
+	{KE_KEY, EVENT_AUDIO_VOLUME, { KEY_VOLUMEDOWN } }, /* Fn + left */
+	{KE_END, 0}
+};
+
+static struct key_entry *get_event_key_entry(int event, int status)
+{
+	struct key_entry *ke;
+	static int old_brightness_status = -1;
+	static int old_volume_status = -1;
+
+	ke = sparse_keymap_entry_from_scancode(yeeloong_hotkey_dev, event);
+	if (!ke)
+		return NULL;
+
+	switch (event) {
+	case EVENT_DISPLAY_BRIGHTNESS:
+		/* current status > old one, means up */
+		if ((status < old_brightness_status) || (0 == status))
+			ke++;
+		old_brightness_status = status;
+		break;
+	case EVENT_AUDIO_VOLUME:
+		if ((status < old_volume_status) || (0 == status))
+			ke++;
+		old_volume_status = status;
+		break;
+	default:
+		break;
+	}
+
+	return ke;
+}
+
+static int report_lid_switch(int status)
+{
+	input_report_switch(yeeloong_hotkey_dev, SW_LID, !status);
+	input_sync(yeeloong_hotkey_dev);
+
+	return status;
+}
+
+static int crt_detect_handler(int status)
+{
+	if (status) {
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	} else {
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	}
+	return status;
+}
+
+#define EC_VER_LEN 64
+
+static int black_screen_handler(int status)
+{
+	char *p, ec_ver[EC_VER_LEN];
+
+	p = strstr(loongson_cmdline, "EC_VER=");
+	if (!p)
+		memset(ec_ver, 0, EC_VER_LEN);
+	else {
+		strncpy(ec_ver, p, EC_VER_LEN);
+		p = strstr(ec_ver, " ");
+		if (p)
+			*p = '\0';
+	}
+
+	/* Seems EC(>=PQ1D26) does this job for us, we can not do it again,
+	 * otherwise, the brightness will not resume to the normal level! */
+	if (strncasecmp(ec_ver, "EC_VER=PQ1D26", 64) < 0)
+		yeeloong_lcd_vo_set(status);
+
+	return status;
+}
+
+static int display_toggle_handler(int status)
+{
+	static int video_output_status;
+
+	/* Only enable switch video output button
+	 * when CRT is connected */
+	if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_UNPLUG)
+		return 0;
+	/* 0. no CRT connected: LCD on, CRT off
+	 * 1. BOTH on
+	 * 2. LCD off, CRT on
+	 * 3. BOTH off
+	 * 4. LCD on, CRT off
+	 */
+	video_output_status++;
+	if (video_output_status > 4)
+		video_output_status = 1;
+
+	switch (video_output_status) {
+	case 1:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		break;
+	case 2:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+		break;
+	case 3:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+		break;
+	case 4:
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+		break;
+	default:
+		/* Ensure LCD is on */
+		yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+		break;
+	}
+	return video_output_status;
+}
+
+static int camera_handler(int status)
+{
+	int value;
+
+	value = ec_read(REG_CAMERA_CONTROL);
+	ec_write(REG_CAMERA_CONTROL, value | (1 << 1));
+
+	return status;
+}
+
+static int usb2_handler(int status)
+{
+	pr_emerg("USB2 Over Current occurred\n");
+
+	return status;
+}
+
+static int usb0_handler(int status)
+{
+	pr_emerg("USB0 Over Current occurred\n");
+
+	return status;
+}
+
+/* yeeloong_wifi_handler may be implemented in the wifi driver */
+sci_handler yeeloong_wifi_handler;
+EXPORT_SYMBOL(yeeloong_wifi_handler);
+
+
+static void do_event_action(int event)
+{
+	sci_handler handler;
+	int reg, status;
+	struct key_entry *ke;
+
+	reg = 0;
+	handler = NULL;
+
+	switch (event) {
+	case EVENT_LID:
+		reg = REG_LID_DETECT;
+		break;
+	case EVENT_DISPLAY_TOGGLE:
+		handler = display_toggle_handler;
+		break;
+	case EVENT_CRT_DETECT:
+		reg = REG_CRT_DETECT;
+		handler = crt_detect_handler;
+		break;
+	case EVENT_CAMERA:
+		reg = REG_CAMERA_STATUS;
+		handler = camera_handler;
+		break;
+	case EVENT_USB_OC2:
+		reg = REG_USB2_FLAG;
+		handler = usb2_handler;
+		break;
+	case EVENT_USB_OC0:
+		reg = REG_USB0_FLAG;
+		handler = usb0_handler;
+		break;
+	case EVENT_BLACK_SCREEN:
+		reg = REG_DISPLAY_LCD;
+		handler = black_screen_handler;
+		break;
+	case EVENT_AUDIO_MUTE:
+		reg = REG_AUDIO_MUTE;
+		break;
+	case EVENT_DISPLAY_BRIGHTNESS:
+		reg = REG_DISPLAY_BRIGHTNESS;
+		break;
+	case EVENT_AUDIO_VOLUME:
+		reg = REG_AUDIO_VOLUME;
+		break;
+	case EVENT_WLAN:
+		/* We use 2 to indicate it as a switch */
+		status = 2;
+		handler = yeeloong_wifi_handler;
+		break;
+	default:
+		break;
+	}
+
+	if (reg != 0)
+		status = ec_read(reg);
+
+	if (handler != NULL)
+		status = handler(status);
+
+	pr_info("%s: event: %d status: %d\n", __func__, event, status);
+
+	/* Report current key to user-space */
+	ke = get_event_key_entry(event, status);
+	if (ke) {
+		if (ke->keycode == SW_LID)
+			report_lid_switch(status);
+		else
+			sparse_keymap_report_entry(yeeloong_hotkey_dev, ke, 1,
+					true);
+	}
+}
+
+/*
+ * SCI(system control interrupt) main interrupt routine
+ *
+ * We will do the query and get event number together so the interrupt routine
+ * should be longer than 120us now at least 3ms elpase for it.
+ */
+static irqreturn_t sci_irq_handler(int irq, void *dev_id)
+{
+	int ret, event;
+
+	if (SCI_IRQ_NUM != irq)
+		return IRQ_NONE;
+
+	/* Query the event number */
+	ret = ec_query_event_num();
+	if (ret < 0)
+		return IRQ_NONE;
+
+	event = ec_get_event_num();
+	if (event < EVENT_START || event > EVENT_END)
+		return IRQ_NONE;
+
+	/* Execute corresponding actions */
+	do_event_action(event);
+
+	return IRQ_HANDLED;
+}
+
+/*
+ * Config and init some msr and gpio register properly.
+ */
+static int sci_irq_init(void)
+{
+	u32 hi, lo;
+	u32 gpio_base;
+	unsigned long flags;
+	int ret;
+
+	/* Get gpio base */
+	_rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_GPIO), &hi, &lo);
+	gpio_base = lo & 0xff00;
+
+	/* Filter the former kb3310 interrupt for security */
+	ret = ec_query_event_num();
+	if (ret)
+		return ret;
+
+	/* For filtering next number interrupt */
+	udelay(10000);
+
+	/* Set gpio native registers and msrs for GPIO27 SCI EVENT PIN
+	 * gpio :
+	 *      input, pull-up, no-invert, event-count and value 0,
+	 *      no-filter, no edge mode
+	 *      gpio27 map to Virtual gpio0
+	 * msr :
+	 *      no primary and lpc
+	 *      Unrestricted Z input to IG10 from Virtual gpio 0.
+	 */
+	local_irq_save(flags);
+	_rdmsr(0x80000024, &hi, &lo);
+	lo &= ~(1 << 10);
+	_wrmsr(0x80000024, hi, lo);
+	_rdmsr(0x80000025, &hi, &lo);
+	lo &= ~(1 << 10);
+	_wrmsr(0x80000025, hi, lo);
+	_rdmsr(0x80000023, &hi, &lo);
+	lo |= (0x0a << 0);
+	_wrmsr(0x80000023, hi, lo);
+	local_irq_restore(flags);
+
+	/* Set gpio27 as sci interrupt
+	 *
+	 * input, pull-up, no-fliter, no-negedge, invert
+	 * the sci event is just about 120us
+	 */
+	asm(".set noreorder\n");
+	/*  input enable */
+	outl(0x00000800, (gpio_base | 0xA0));
+	/*  revert the input */
+	outl(0x00000800, (gpio_base | 0xA4));
+	/*  event-int enable */
+	outl(0x00000800, (gpio_base | 0xB8));
+	asm(".set reorder\n");
+
+	return 0;
+}
+
+static struct irqaction sci_irqaction = {
+	.handler = sci_irq_handler,
+	.name = "sci",
+	.flags = IRQF_SHARED,
+};
+
+static int yeeloong_hotkey_init(void)
+{
+	int ret;
+
+	ret = sci_irq_init();
+	if (ret)
+		return -EFAULT;
+
+	ret = setup_irq(SCI_IRQ_NUM, &sci_irqaction);
+	if (ret)
+		return -EFAULT;
+
+	yeeloong_hotkey_dev = input_allocate_device();
+
+	if (!yeeloong_hotkey_dev) {
+		remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+		return -ENOMEM;
+	}
+
+	yeeloong_hotkey_dev->name = "HotKeys";
+	yeeloong_hotkey_dev->phys = "button/input0";
+	yeeloong_hotkey_dev->id.bustype = BUS_HOST;
+	yeeloong_hotkey_dev->dev.parent = NULL;
+
+	ret = sparse_keymap_setup(yeeloong_hotkey_dev, yeeloong_keymap, NULL);
+	if (ret) {
+		pr_err("Fail to setup input device keymap\n");
+		input_free_device(yeeloong_hotkey_dev);
+		return ret;
+	}
+
+	ret = input_register_device(yeeloong_hotkey_dev);
+	if (ret) {
+		sparse_keymap_free(yeeloong_hotkey_dev);
+		input_free_device(yeeloong_hotkey_dev);
+		return ret;
+	}
+
+	/* Update the current status of LID */
+	report_lid_switch(BIT_LID_DETECT_ON);
+
+#ifdef CONFIG_LOONGSON_SUSPEND
+	/* Install the real yeeloong_report_lid_status for pm.c */
+	yeeloong_report_lid_status = report_lid_switch;
+#endif
+
+	return 0;
+}
+
+static void yeeloong_hotkey_exit(void)
+{
+	/* Free irq */
+	remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+
+#ifdef CONFIG_LOONGSON_SUSPEND
+	/* Uninstall yeeloong_report_lid_status for pm.c */
+	if (yeeloong_report_lid_status == report_lid_switch)
+		yeeloong_report_lid_status = NULL;
+#endif
+
+	if (yeeloong_hotkey_dev) {
+		sparse_keymap_free(yeeloong_hotkey_dev);
+		input_unregister_device(yeeloong_hotkey_dev);
+		yeeloong_hotkey_dev = NULL;
+	}
+}
+
 #ifdef CONFIG_PM
 static void usb_ports_set(int status)
 {
@@ -601,11 +1005,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_hotkey_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong hotkey driver.\n");
+		yeeloong_hotkey_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_hotkey_exit();
 	yeeloong_vo_exit();
 	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
-- 
1.6.2.1


From wuzhangjin@gmail.com Tue Dec  8 15:19:24 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 15:19:29 +0100 (CET)
Received: from mail-pw0-f45.google.com ([209.85.160.45]:52744 "EHLO
        mail-pw0-f45.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494214AbZLHORY (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 15:17:24 +0100
Received: by pwj1 with SMTP id 1so744139pwj.24
        for <multiple recipients>; Tue, 08 Dec 2009 06:17:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer:in-reply-to:references:in-reply-to:references;
        bh=UyxDKEy0qZK+bDlLkq8SJcEL4DEUSmMcltuIwPF0rJU=;
        b=x5jTV4I/cEXCnX0yMeqzStPtJ25O6kFVPEuX52nt/SCFJ7YscBRW9FhecRgFggKwrY
         pzaZFLP/2DgsL2TPOGtrwIy7wKc0sENKFluTGsa6HeHqSNpKyZaA3GsMuAhwWNHdgA83
         p5OEx+AXXeDW3svAQJhq3aE8FEwQO3RnBBKnI=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
        b=iV4Sr0JjNs7csqUQsnTa9PvFivvC6QeZAjFJCQo6Oecz3tuzRIHvsQsP/MH6TdHTNl
         +JAnPvNwBx5v2c13XfP9a4Zb8JiVqDDOeY23u2xvB79KvCo0dP+8sKgnnKj4f9+rzyNo
         Kbb66LIJRG4P66Nfu+D9BcP8gJYkT24q7+bxI=
Received: by 10.114.236.22 with SMTP id j22mr618561wah.217.1260281815738;
        Tue, 08 Dec 2009 06:16:55 -0800 (PST)
Received: from localhost.localdomain ([222.92.8.142])
        by mx.google.com with ESMTPS id 22sm6030062pzk.2.2009.12.08.06.16.49
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 06:16:54 -0800 (PST)
From:   Wu Zhangjin <wuzhangjin@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>,
        Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 6/8] Loongson: YeeLoong: add video output driver
Date:   Tue,  8 Dec 2009 22:15:54 +0800
Message-Id: <234c5ecd475b05e3eb17ead3ae107cfe3426e0e0.1260281599.git.wuzhangjin@gmail.com>
X-Mailer: git-send-email 1.6.2.1
In-Reply-To: <5e9acb4cd757075f617daa45cbd6f5fad94678ac.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260254344.git.wuzhangjin@gmail.com>
 <39d232e3f8359e9c11bad7536f0162444401ec94.1260281599.git.wuzhangjin@gmail.com>
 <7676d8397e593dbec0d40e24429b7ccbcecfa588.1260281599.git.wuzhangjin@gmail.com>
 <4d821efaecc3dee0b9124119507a694e81572437.1260281599.git.wuzhangjin@gmail.com>
 <5c426a5091bee3e4483fc0b93f26359e2840428b.1260281599.git.wuzhangjin@gmail.com>
 <5e9acb4cd757075f617daa45cbd6f5fad94678ac.1260281599.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25380
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch adds Video Output Driver, it provides standard
interface(/sys/class/video_output) to turn on/off the video output of
LCD, CRT.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/Kconfig           |    1 +
 drivers/platform/mips/yeeloong_laptop.c |  139 +++++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
index 352594c..e2dbe28 100644
--- a/drivers/platform/mips/Kconfig
+++ b/drivers/platform/mips/Kconfig
@@ -21,6 +21,7 @@ config LEMOTE_YEELOONG2F
 	select SYS_SUPPORTS_APM_EMULATION
 	select APM_EMULATION
 	select HWMON
+	select VIDEO_OUTPUT_CONTROL
 	help
 	  YeeLoong netbook is a mini laptop made by Lemote, which is basically
 	  compatible to FuLoong2F mini PC, but it has an extra Embedded
diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index becda4f..f8907da 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -16,6 +16,7 @@
 #include <linux/apm-emulation.h>/* for battery subdriver */
 #include <linux/hwmon.h>	/* for hwmon subdriver */
 #include <linux/hwmon-sysfs.h>
+#include <linux/video_output.h>	/* for video output subdriver */
 
 #include <ec_kb3310b.h>
 
@@ -381,6 +382,136 @@ static void yeeloong_hwmon_exit(void)
 	}
 }
 
+/* video output subdriver */
+
+static int lcd_video_output_get(struct output_device *od)
+{
+	return ec_read(REG_DISPLAY_LCD);
+}
+
+#define LCD	0
+#define CRT	1
+
+static void display_vo_set(int display, int on)
+{
+	int addr;
+	unsigned long value;
+
+	addr = (display == LCD) ? 0x31 : 0x21;
+
+	outb(addr, 0x3c4);
+	value = inb(0x3c5);
+
+	if (display == LCD)
+		value |= (on ? 0x03 : 0x02);
+	else {
+		if (on)
+			clear_bit(7, &value);
+		else
+			set_bit(7, &value);
+	}
+
+	outb(addr, 0x3c4);
+	outb(value, 0x3c5);
+}
+
+static int lcd_video_output_set(struct output_device *od)
+{
+	unsigned long status;
+
+	status = !!od->request_state;
+
+	display_vo_set(LCD, status);
+	ec_write(REG_BACKLIGHT_CTRL, status);
+
+	return 0;
+}
+
+static struct output_properties lcd_output_properties = {
+	.set_state = lcd_video_output_set,
+	.get_status = lcd_video_output_get,
+};
+
+static int crt_video_output_get(struct output_device *od)
+{
+	return ec_read(REG_CRT_DETECT);
+}
+
+static int crt_video_output_set(struct output_device *od)
+{
+	unsigned long status;
+
+	status = !!od->request_state;
+
+	if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG)
+		display_vo_set(CRT, status);
+
+	return 0;
+}
+
+static struct output_properties crt_output_properties = {
+	.set_state = crt_video_output_set,
+	.get_status = crt_video_output_get,
+};
+
+static struct output_device *lcd_output_dev, *crt_output_dev;
+
+static void yeeloong_lcd_vo_set(int status)
+{
+	lcd_output_dev->request_state = status;
+	lcd_video_output_set(lcd_output_dev);
+}
+
+static void yeeloong_crt_vo_set(int status)
+{
+	crt_output_dev->request_state = status;
+	crt_video_output_set(crt_output_dev);
+}
+
+static int yeeloong_vo_init(void)
+{
+	int ret;
+
+	/* Register video output device: lcd, crt */
+	lcd_output_dev = video_output_register("LCD", NULL, NULL,
+			&lcd_output_properties);
+
+	if (IS_ERR(lcd_output_dev)) {
+		ret = PTR_ERR(lcd_output_dev);
+		lcd_output_dev = NULL;
+		return ret;
+	}
+	/* Ensure LCD is on by default */
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+
+	crt_output_dev = video_output_register("CRT", NULL, NULL,
+			&crt_output_properties);
+
+	if (IS_ERR(crt_output_dev)) {
+		ret = PTR_ERR(crt_output_dev);
+		crt_output_dev = NULL;
+		return ret;
+	}
+
+	/* Turn off CRT by default, and will be enabled when the CRT
+	 * connectting event reported by SCI */
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+
+	return 0;
+}
+
+static void yeeloong_vo_exit(void)
+{
+	if (lcd_output_dev) {
+		video_output_unregister(lcd_output_dev);
+		lcd_output_dev = NULL;
+	}
+	if (crt_output_dev) {
+		video_output_unregister(crt_output_dev);
+		crt_output_dev = NULL;
+	}
+}
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -427,11 +558,19 @@ static int __init yeeloong_init(void)
 		return ret;
 	}
 
+	ret = yeeloong_vo_init();
+	if (ret) {
+		pr_err("Fail to register yeeloong video output driver.\n");
+		yeeloong_vo_exit();
+		return ret;
+	}
+
 	return 0;
 }
 
 static void __exit yeeloong_exit(void)
 {
+	yeeloong_vo_exit();
 	yeeloong_hwmon_exit();
 	yeeloong_battery_exit();
 	yeeloong_backlight_exit();
-- 
1.6.2.1


From pavel@ucw.cz Tue Dec  8 16:02:39 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 16:02:42 +0100 (CET)
Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:33595 "EHLO
        atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1493114AbZLHPCj (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 16:02:39 +0100
Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512)
        id 97EB8F02F5; Tue,  8 Dec 2009 16:02:36 +0100 (CET)
Date:   Tue, 8 Dec 2009 16:02:30 +0100
From:   Pavel Machek <pavel@ucw.cz>
To:     Wu Zhangjin <wuzhangjin@gmail.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH v9 5/8] Loongson: YeeLoong: add hardware monitoring
        driver
Message-ID: <20091208150229.GA1375@ucw.cz>
References: <cover.1260281599.git.wuzhangjin@gmail.com> <5e9acb4cd757075f617daa45cbd6f5fad94678ac.1260281599.git.wuzhangjin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <5e9acb4cd757075f617daa45cbd6f5fad94678ac.1260281599.git.wuzhangjin@gmail.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
Return-Path: <pavel@ucw.cz>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25381
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: pavel@ucw.cz
Precedence: bulk
X-list: linux-mips

Hi!

> This patch adds hardware monitoring driver, it provides standard
> interface(/sys/class/hwmon/) for lm-sensors/sensors-applet to monitor
> the temperatures of CPU and battery, the PWM of fan, the current,
> voltage of battery.

It is probably ok for now, but in future current/voltage of battery
should be exported as power_supply class (drivers/power)...
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

From manuel.lauss@googlemail.com Tue Dec  8 19:18:01 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Dec 2009 19:18:05 +0100 (CET)
Received: from ey-out-1920.google.com ([74.125.78.148]:32834 "EHLO
        ey-out-1920.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494654AbZLHSSB (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Tue, 8 Dec 2009 19:18:01 +0100
Received: by ey-out-1920.google.com with SMTP id 5so582357eyb.52
        for <linux-mips@linux-mips.org>; Tue, 08 Dec 2009 10:18:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlemail.com; s=gamma;
        h=domainkey-signature:received:received:from:to:cc:subject:date
         :message-id:x-mailer;
        bh=zQgUpPqJpn2LlFXa9INAiQgZVggFfxBzo4PFynAzw4w=;
        b=au5lFkH1VuRdDrEZXEtmmMOdau/GK2Cnbw85ZX4yjPfDlSNQA5m9gNJdNYU+wkt7xc
         FMQ3nWQyaB8dSsTUgGnCrW6oOB6XaS0mHw7XqhMzwnMCvcR3WN43M5WkC5q69dy5Kek+
         f0IjgmwsTbEROoUyv28PP1b77uSvMDwFV8YIs=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=googlemail.com; s=gamma;
        h=from:to:cc:subject:date:message-id:x-mailer;
        b=sbkXcd53sRgTfdy8DAet1JjYmxCDN1pCbCvfROpBTC0yThmyDjyvzYUhNOkmCsM6AI
         Xjt0QoEb3S/GtOpWmEMj5wgnBW1sp7n77WFnMA2/w2n1Lspmm4o5nXsRA75ufnuBjstE
         /F7lVS9nRgBggyhZbvLVgkz0G4lhjbJMjnrdE=
Received: by 10.216.89.84 with SMTP id b62mr249008wef.227.1260296280546;
        Tue, 08 Dec 2009 10:18:00 -0800 (PST)
Received: from localhost.localdomain (p5496D98F.dip.t-dialin.net [84.150.217.143])
        by mx.google.com with ESMTPS id m5sm16688067gve.27.2009.12.08.10.17.58
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 10:17:59 -0800 (PST)
From:   Manuel Lauss <manuel.lauss@googlemail.com>
To:     Linux-MIPS <linux-mips@linux-mips.org>
Cc:     Manuel Lauss <manuel.lauss@gmail.com>
Subject: [PATCH -queue] MIPS: Alchemy: get rid of common/reset.c
Date:   Tue,  8 Dec 2009 19:18:13 +0100
Message-Id: <1260296294-18904-1-git-send-email-manuel.lauss@gmail.com>
X-Mailer: git-send-email 1.6.5.3
Return-Path: <manuel.lauss@googlemail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25382
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: manuel.lauss@googlemail.com
Precedence: bulk
X-list: linux-mips

Implement reset/poweroff in the board code instead.  The peripheral
reset code is gone too since YAMON (which all in-tree boards use)
does the same work when it boots.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
Run-tested on DB1200, compiled tested on all other boards.
Applies on top of all the other Alchemy stuff in mips-queue.


 arch/mips/alchemy/common/Makefile                |    3 +-
 arch/mips/alchemy/common/reset.c                 |  185 ----------------------
 arch/mips/alchemy/common/setup.c                 |    9 -
 arch/mips/alchemy/devboards/db1200/setup.c       |   19 ---
 arch/mips/alchemy/devboards/db1x00/board_setup.c |   49 +++++-
 arch/mips/alchemy/devboards/platform.c           |   29 ++++
 arch/mips/alchemy/mtx-1/board_setup.c            |   15 ++-
 arch/mips/alchemy/xxs1500/board_setup.c          |   15 ++-
 8 files changed, 99 insertions(+), 225 deletions(-)
 delete mode 100644 arch/mips/alchemy/common/reset.c

diff --git a/arch/mips/alchemy/common/Makefile b/arch/mips/alchemy/common/Makefile
index f46b351..06c0e65 100644
--- a/arch/mips/alchemy/common/Makefile
+++ b/arch/mips/alchemy/common/Makefile
@@ -5,8 +5,7 @@
 # Makefile for the Alchemy Au1xx0 CPUs, generic files.
 #
 
-obj-y += prom.o time.o reset.o \
-	clocks.o platform.o power.o setup.o \
+obj-y += prom.o time.o clocks.o platform.o power.o setup.o \
 	sleeper.o dma.o dbdma.o
 
 obj-$(CONFIG_ALCHEMY_GPIOINT_AU1000) += irq.o
diff --git a/arch/mips/alchemy/common/reset.c b/arch/mips/alchemy/common/reset.c
deleted file mode 100644
index 266afd4..0000000
--- a/arch/mips/alchemy/common/reset.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- *
- * BRIEF MODULE DESCRIPTION
- *	Au1xx0 reset routines.
- *
- * Copyright 2001, 2006, 2008 MontaVista Software Inc.
- * Author: MontaVista Software, Inc. <source@mvista.com>
- *
- *  This program is free software; you can redistribute  it and/or modify it
- *  under  the terms of  the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/gpio.h>
-
-#include <asm/cacheflush.h>
-#include <asm/mach-au1x00/au1000.h>
-
-void au1000_restart(char *command)
-{
-	/* Set all integrated peripherals to disabled states */
-	extern void board_reset(void);
-	u32 prid = read_c0_prid();
-
-	printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n");
-
-	switch (prid & 0xFF000000) {
-	case 0x00000000: /* Au1000 */
-		au_writel(0x02, 0xb0000010); /* ac97_enable */
-		au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
-		asm("sync");
-		au_writel(0x00, 0xb017fffc); /* usbh_enable */
-		au_writel(0x00, 0xb0200058); /* usbd_enable */
-		au_writel(0x00, 0xb0300040); /* ir_enable */
-		au_writel(0x00, 0xb4004104); /* mac dma */
-		au_writel(0x00, 0xb4004114); /* mac dma */
-		au_writel(0x00, 0xb4004124); /* mac dma */
-		au_writel(0x00, 0xb4004134); /* mac dma */
-		au_writel(0x00, 0xb0520000); /* macen0 */
-		au_writel(0x00, 0xb0520004); /* macen1 */
-		au_writel(0x00, 0xb1000008); /* i2s_enable  */
-		au_writel(0x00, 0xb1100100); /* uart0_enable */
-		au_writel(0x00, 0xb1200100); /* uart1_enable */
-		au_writel(0x00, 0xb1300100); /* uart2_enable */
-		au_writel(0x00, 0xb1400100); /* uart3_enable */
-		au_writel(0x02, 0xb1600100); /* ssi0_enable */
-		au_writel(0x02, 0xb1680100); /* ssi1_enable */
-		au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
-		au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
-		au_writel(0x00, 0xb1900028); /* sys_clksrc */
-		au_writel(0x10, 0xb1900060); /* sys_cpupll */
-		au_writel(0x00, 0xb1900064); /* sys_auxpll */
-		au_writel(0x00, 0xb1900100); /* sys_pininputen */
-		break;
-	case 0x01000000: /* Au1500 */
-		au_writel(0x02, 0xb0000010); /* ac97_enable */
-		au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
-		asm("sync");
-		au_writel(0x00, 0xb017fffc); /* usbh_enable */
-		au_writel(0x00, 0xb0200058); /* usbd_enable */
-		au_writel(0x00, 0xb4004104); /* mac dma */
-		au_writel(0x00, 0xb4004114); /* mac dma */
-		au_writel(0x00, 0xb4004124); /* mac dma */
-		au_writel(0x00, 0xb4004134); /* mac dma */
-		au_writel(0x00, 0xb1520000); /* macen0 */
-		au_writel(0x00, 0xb1520004); /* macen1 */
-		au_writel(0x00, 0xb1100100); /* uart0_enable */
-		au_writel(0x00, 0xb1400100); /* uart3_enable */
-		au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
-		au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
-		au_writel(0x00, 0xb1900028); /* sys_clksrc */
-		au_writel(0x10, 0xb1900060); /* sys_cpupll */
-		au_writel(0x00, 0xb1900064); /* sys_auxpll */
-		au_writel(0x00, 0xb1900100); /* sys_pininputen */
-		break;
-	case 0x02000000: /* Au1100 */
-		au_writel(0x02, 0xb0000010); /* ac97_enable */
-		au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
-		asm("sync");
-		au_writel(0x00, 0xb017fffc); /* usbh_enable */
-		au_writel(0x00, 0xb0200058); /* usbd_enable */
-		au_writel(0x00, 0xb0300040); /* ir_enable */
-		au_writel(0x00, 0xb4004104); /* mac dma */
-		au_writel(0x00, 0xb4004114); /* mac dma */
-		au_writel(0x00, 0xb4004124); /* mac dma */
-		au_writel(0x00, 0xb4004134); /* mac dma */
-		au_writel(0x00, 0xb0520000); /* macen0 */
-		au_writel(0x00, 0xb1000008); /* i2s_enable  */
-		au_writel(0x00, 0xb1100100); /* uart0_enable */
-		au_writel(0x00, 0xb1200100); /* uart1_enable */
-		au_writel(0x00, 0xb1400100); /* uart3_enable */
-		au_writel(0x02, 0xb1600100); /* ssi0_enable */
-		au_writel(0x02, 0xb1680100); /* ssi1_enable */
-		au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
-		au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
-		au_writel(0x00, 0xb1900028); /* sys_clksrc */
-		au_writel(0x10, 0xb1900060); /* sys_cpupll */
-		au_writel(0x00, 0xb1900064); /* sys_auxpll */
-		au_writel(0x00, 0xb1900100); /* sys_pininputen */
-		break;
-	case 0x03000000: /* Au1550 */
-		au_writel(0x00, 0xb1a00004); /* psc 0 */
-		au_writel(0x00, 0xb1b00004); /* psc 1 */
-		au_writel(0x00, 0xb0a00004); /* psc 2 */
-		au_writel(0x00, 0xb0b00004); /* psc 3 */
-		au_writel(0x00, 0xb017fffc); /* usbh_enable */
-		au_writel(0x00, 0xb0200058); /* usbd_enable */
-		au_writel(0x00, 0xb4004104); /* mac dma */
-		au_writel(0x00, 0xb4004114); /* mac dma */
-		au_writel(0x00, 0xb4004124); /* mac dma */
-		au_writel(0x00, 0xb4004134); /* mac dma */
-		au_writel(0x00, 0xb1520000); /* macen0 */
-		au_writel(0x00, 0xb1520004); /* macen1 */
-		au_writel(0x00, 0xb1100100); /* uart0_enable */
-		au_writel(0x00, 0xb1200100); /* uart1_enable */
-		au_writel(0x00, 0xb1400100); /* uart3_enable */
-		au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
-		au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
-		au_writel(0x00, 0xb1900028); /* sys_clksrc */
-		au_writel(0x10, 0xb1900060); /* sys_cpupll */
-		au_writel(0x00, 0xb1900064); /* sys_auxpll */
-		au_writel(0x00, 0xb1900100); /* sys_pininputen */
-		break;
-	}
-
-	set_c0_status(ST0_BEV | ST0_ERL);
-	change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
-	flush_cache_all();
-	write_c0_wired(0);
-
-	/* Give board a chance to do a hardware reset */
-	board_reset();
-
-	/* Jump to the beggining in case board_reset() is empty */
-	__asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
-}
-
-void au1000_halt(void)
-{
-#if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550)
-	/* Power off system */
-	printk(KERN_NOTICE "\n** Powering off...\n");
-	au_writew(au_readw(0xAF00001C) | (3 << 14), 0xAF00001C);
-	au_sync();
-	while (1); /* should not get here */
-#else
-	printk(KERN_NOTICE "\n** You can safely turn off the power\n");
-#ifdef CONFIG_MIPS_MIRAGE
-	gpio_direction_output(210, 1);
-#endif
-#ifdef CONFIG_PM
-	au_sleep();
-
-	/* Should not get here */
-	printk(KERN_ERR "Unable to put CPU in sleep mode\n");
-	while (1);
-#else
-	while (1)
-		__asm__(".set\tmips3\n\t"
-	                "wait\n\t"
-			".set\tmips0");
-#endif
-#endif /* defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550) */
-}
-
-void au1000_power_off(void)
-{
-	au1000_halt();
-}
diff --git a/arch/mips/alchemy/common/setup.c b/arch/mips/alchemy/common/setup.c
index 375984e..193ba16 100644
--- a/arch/mips/alchemy/common/setup.c
+++ b/arch/mips/alchemy/common/setup.c
@@ -29,18 +29,13 @@
 #include <linux/ioport.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
-#include <linux/pm.h>
 
 #include <asm/mipsregs.h>
-#include <asm/reboot.h>
 #include <asm/time.h>
 
 #include <au1000.h>
 
 extern void __init board_setup(void);
-extern void au1000_restart(char *);
-extern void au1000_halt(void);
-extern void au1000_power_off(void);
 extern void set_cpuspec(void);
 
 void __init plat_mem_setup(void)
@@ -57,10 +52,6 @@ void __init plat_mem_setup(void)
 	/* this is faster than wasting cycles trying to approximate it */
 	preset_lpj = (est_freq >> 1) / HZ;
 
-	_machine_restart = au1000_restart;
-	_machine_halt = au1000_halt;
-	pm_power_off = au1000_power_off;
-
 	board_setup();  /* board specific setup */
 
 	if (au1xxx_cpu_needs_config_od())
diff --git a/arch/mips/alchemy/devboards/db1200/setup.c b/arch/mips/alchemy/devboards/db1200/setup.c
index a3458c0..379536e 100644
--- a/arch/mips/alchemy/devboards/db1200/setup.c
+++ b/arch/mips/alchemy/devboards/db1200/setup.c
@@ -9,30 +9,15 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
-#include <linux/pm.h>
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-db1x00/bcsr.h>
 #include <asm/mach-db1x00/db1200.h>
-#include <asm/processor.h>
-#include <asm/reboot.h>
 
 const char *get_system_type(void)
 {
 	return "Alchemy Db1200";
 }
 
-static void board_power_off(void)
-{
-	bcsr_write(BCSR_RESETS, 0);
-	bcsr_write(BCSR_SYSTEM, BCSR_SYSTEM_PWROFF | BCSR_SYSTEM_RESET);
-}
-
-void board_reset(void)
-{
-	bcsr_write(BCSR_RESETS, 0);
-	bcsr_write(BCSR_SYSTEM, 0);
-}
-
 void __init board_setup(void)
 {
 	unsigned long freq0, clksrc, div, pfc;
@@ -73,10 +58,6 @@ void __init board_setup(void)
 	clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT;
 	__raw_writel(clksrc, (void __iomem *)SYS_CLKSRC);
 	wmb();
-
-	pm_power_off = board_power_off;
-	_machine_halt = board_power_off;
-	_machine_restart = (void(*)(char *))board_reset;
 }
 
 /* use the hexleds to count the number of times the cpu has entered
diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c
index 7aee14d..99ace3c 100644
--- a/arch/mips/alchemy/devboards/db1x00/board_setup.c
+++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c
@@ -30,10 +30,12 @@
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/pm.h>
 
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-db1x00/db1x00.h>
 #include <asm/mach-db1x00/bcsr.h>
+#include <asm/reboot.h>
 
 #include <prom.h>
 
@@ -50,6 +52,18 @@ char irq_tab_alchemy[][5] __initdata = {
 	[12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - SN1741   */
 	[13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */
 };
+
+static void bosporus_power_off(void)
+{
+	printk(KERN_INFO "It's now safe to turn off power\n");
+	while (1)
+		asm volatile (".set mips3 ; wait ; .set mips0");
+}
+
+const char *get_system_type(void)
+{
+	return "Alchemy Bosporus Gateway Reference";
+}
 #endif
 
 #ifdef CONFIG_MIPS_MIRAGE
@@ -58,6 +72,16 @@ char irq_tab_alchemy[][5] __initdata = {
 	[12] = { -1, 0xff, 0xff, AU1500_PCI_INTC, 0xff }, /* IDSEL 12 - PNX1300 */
 	[13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 13 - miniPCI */
 };
+
+static void mirage_power_off(void)
+{
+	alchemy_gpio_direction_output(210, 1);
+}
+
+const char *get_system_type(void)
+{
+	return "Alchemy Mirage";
+}
 #endif
 
 #ifdef CONFIG_MIPS_DB1550
@@ -68,19 +92,19 @@ char irq_tab_alchemy[][5] __initdata = {
 };
 #endif
 
-const char *get_system_type(void)
+#if defined(CONFIG_MIPS_BOSPORUS) || defined(CONFIG_MIPS_MIRAGE)
+static void mips_softreset(void)
 {
-#ifdef CONFIG_MIPS_BOSPORUS
-	return "Alchemy Bosporus Gateway Reference";
-#else
-	return "Alchemy Db1x00";
-#endif
+	asm volatile ("jr\t%0" : : "r"(0xbfc00000));
 }
 
-void board_reset(void)
+#else
+
+const char *get_system_type(void)
 {
-	bcsr_write(BCSR_SYSTEM, 0);
+	return "Alchemy Db1x00";
 }
+#endif
 
 void __init board_setup(void)
 {
@@ -179,8 +203,17 @@ void __init board_setup(void)
 	 * be part of the audio driver.
 	 */
 	alchemy_gpio_direction_output(209, 1);
+
+	pm_power_off = mirage_power_off;
+	_machine_halt = mirage_power_off;
+	_machine_restart = (void(*)(char *))mips_softreset;
 #endif
 
+#ifdef CONFIG_MIPS_BOSPORUS
+	pm_power_off = bosporus_power_off;
+	_machine_halt = bosporus_power_off;
+	_machine_restart = (void(*)(char *))mips_softreset;
+#endif
 	au_sync();
 }
 
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c
index 7f2bcee..febf4e0 100644
--- a/arch/mips/alchemy/devboards/platform.c
+++ b/arch/mips/alchemy/devboards/platform.c
@@ -8,6 +8,35 @@
 #include <linux/mtd/physmap.h>
 #include <linux/slab.h>
 #include <linux/platform_device.h>
+#include <linux/pm.h>
+
+#include <asm/reboot.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+static void db1x_power_off(void)
+{
+	bcsr_write(BCSR_RESETS, 0);
+	bcsr_write(BCSR_SYSTEM, BCSR_SYSTEM_PWROFF | BCSR_SYSTEM_RESET);
+}
+
+static void db1x_reset(char *c)
+{
+	bcsr_write(BCSR_RESETS, 0);
+	bcsr_write(BCSR_SYSTEM, 0);
+}
+
+static int __init db1x_poweroff_setup(void)
+{
+	if (!pm_power_off)
+		pm_power_off = db1x_power_off;
+	if (!_machine_halt)
+		_machine_halt = db1x_power_off;
+	if (!_machine_restart)
+		_machine_restart = db1x_reset;
+
+	return 0;
+}
+late_initcall(db1x_poweroff_setup);
 
 /* register a pcmcia socket */
 int __init db1x_register_pcmcia_socket(unsigned long pseudo_attr_start,
diff --git a/arch/mips/alchemy/mtx-1/board_setup.c b/arch/mips/alchemy/mtx-1/board_setup.c
index 13577ee..e2838c6 100644
--- a/arch/mips/alchemy/mtx-1/board_setup.c
+++ b/arch/mips/alchemy/mtx-1/board_setup.c
@@ -31,7 +31,9 @@
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/pm.h>
 
+#include <asm/reboot.h>
 #include <asm/mach-au1x00/au1000.h>
 
 #include <prom.h>
@@ -50,12 +52,19 @@ char irq_tab_alchemy[][5] __initdata = {
 extern int (*board_pci_idsel)(unsigned int devsel, int assert);
 int mtx1_pci_idsel(unsigned int devsel, int assert);
 
-void board_reset(void)
+static void mtx1_reset(char *c)
 {
 	/* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
 	au_writel(0x00000000, 0xAE00001C);
 }
 
+static void mtx1_power_off(void)
+{
+	printk(KERN_ALERT "It's now safe to remove power\n");
+	while (1)
+		asm volatile (".set mips3 ; wait ; .set mips1");
+}
+
 void __init board_setup(void)
 {
 #ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -98,6 +107,10 @@ void __init board_setup(void)
 	alchemy_gpio_direction_output(211, 1);	/* green on */
 	alchemy_gpio_direction_output(212, 0);	/* red off */
 
+	pm_power_off = mtx1_power_off;
+	_machine_halt = mtx1_power_off;
+	_machine_restart = mtx1_reset;
+
 	printk(KERN_INFO "4G Systems MTX-1 Board\n");
 }
 
diff --git a/arch/mips/alchemy/xxs1500/board_setup.c b/arch/mips/alchemy/xxs1500/board_setup.c
index 21bef8d..7956afa 100644
--- a/arch/mips/alchemy/xxs1500/board_setup.c
+++ b/arch/mips/alchemy/xxs1500/board_setup.c
@@ -27,17 +27,26 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/pm.h>
 
+#include <asm/reboot.h>
 #include <asm/mach-au1x00/au1000.h>
 
 #include <prom.h>
 
-void board_reset(void)
+static void xxs1500_reset(char *c)
 {
 	/* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
 	au_writel(0x00000000, 0xAE00001C);
 }
 
+static void xxs1500_power_off(void)
+{
+	printk(KERN_ALERT "It's now safe to remove power\n");
+	while (1)
+		asm volatile (".set mips3 ; wait ; .set mips1");
+}
+
 void __init board_setup(void)
 {
 	u32 pin_func;
@@ -52,6 +61,10 @@ void __init board_setup(void)
 	}
 #endif
 
+	pm_power_off = xxs1500_power_off;
+	_machine_halt = xxs1500_power_off;
+	_machine_restart = xxs1500_reset;
+
 	alchemy_gpio1_input_enable();
 	alchemy_gpio2_enable();
 
-- 
1.6.5.3


From dennis.yxun@gmail.com Wed Dec  9 02:58:31 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 09 Dec 2009 02:58:34 +0100 (CET)
Received: from mail-bw0-f221.google.com ([209.85.218.221]:44185 "EHLO
        mail-bw0-f221.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494395AbZLIB6b (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 9 Dec 2009 02:58:31 +0100
Received: by bwz21 with SMTP id 21so4833245bwz.24
        for <linux-mips@linux-mips.org>; Tue, 08 Dec 2009 17:58:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :date:message-id:subject:from:to:content-type;
        bh=8w1kWHiVqUBQakr8iN6vmd9d/yK4h5kZly9AFD6Luzw=;
        b=avjfvxS9qsZejKKkD5kCOXFq6wETvyXxpXphX/IYEYJJ8tJWZMSeiLqCIRYqg7kjgr
         f+Ptu0/sK8yHTG27xEgYuf/XydaxwaZ5NMe+F/+K4fkuwbsilqmyEZGMHdzY9SpeStYj
         cGAtnUIjZSs38UKRBE8K28OkSO1b7+KXXgpWk=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        b=HBbk/mWuf8dD2lEvSmBhvxnD/zDpy8AsrCoWSdEP2kBqg6rl8YFAZR+MqvZKH9Q8aC
         5qem+jGfzkacTgKO0ODM/VbdaNeftoOEnrEc0gT3p8N8xrqkzcbYEXlGK/eX/mJ78wJR
         DC2J3jfWVY7fMZMYuUSVPDXKCqgA/nq+nZktQ=
MIME-Version: 1.0
Received: by 10.204.20.79 with SMTP id e15mr9655955bkb.11.1260323906106; Tue, 
        08 Dec 2009 17:58:26 -0800 (PST)
In-Reply-To: <20091207131034.GA5119@linux-mips.org>
References: <7b09df4c0912062339g418f432cr28d92c18ed273d2@mail.gmail.com>
         <20091207131034.GA5119@linux-mips.org>
Date:   Wed, 9 Dec 2009 09:58:26 +0800
Message-ID: <7b09df4c0912081758u794511cdl5a6f103b2303aa52@mail.gmail.com>
Subject: Re: Question: about Physical Address mapping
From:   "Dennis.Yxun" <dennis.yxun@gmail.com>
To:     linux-mips@linux-mips.org
Content-Type: multipart/alternative; boundary=00032555819eb9b63b047a420692
Return-Path: <dennis.yxun@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25383
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: dennis.yxun@gmail.com
Precedence: bulk
X-list: linux-mips

--00032555819eb9b63b047a420692
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Dec 7, 2009 at 9:10 PM, Ralf Baechle <ralf@linux-mips.org> wrote:

> On Mon, Dec 07, 2009 at 03:39:15PM +0800, Dennis.Yxun wrote:
>
> > HI ALL:
> >    I have a problem, that our MIPS hardware put registers location from
> > 0x7000,0000 -0x7040,0000.
> > So, I need to init TLB to access those registers.
> >    My question is: can I map those range to Kseg2 (mapped,uncached)? I
> found
> > "add_wired_entry" sit in
> > kernel code, seems I should use this function.
> >
> >    I found code in arch/mips/jazz/irq.c, and the comment tells me
> > /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
> >    add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
> >
> > does that mean after add_wired_entry, virtual address 0xe400,0000 map to
> > physical address 0x600005C0?
> > why the address is 0x6000,05C0, not 0x6000,0000
>
> I probably knew 15 years ago when I wrote this code :)
>
> add_wired_entry() is a very awkard API and its use in the Jazz code is
> broken so I suggest you use ioremap() instead.
>
>  Ralf
>

As you suggested, I plan to use ioremap()
it generally works if I use in my driver code after kernel initialization
finished
but I still have a problem:

How can I access hardware register very early?
say that, use early_printk() to access UART registers,
And I try to put ioremap() at prom_init() to try to remap UART register
but, found that kernel will hang..
the UART register is start from physical address 0x700007c0 (> 512M)
but address below 512M can be remaped successfully

I spend a few minutes digging into the ioremap() function
it simply remap <512M space to KSEG1,
while other physical space use different scheme (map to KSEG2), quite
complicated....

--00032555819eb9b63b047a420692
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div class=3D"gmail_quote">On Mon, Dec 7, 2009 at 9:10 PM, Ralf Baechle <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:ralf@linux-mips.org">ralf@linux-mips.o=
rg</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"bord=
er-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-l=
eft: 1ex;">
<div><div></div><div class=3D"h5">On Mon, Dec 07, 2009 at 03:39:15PM +0800,=
 Dennis.Yxun wrote:<br>
<br>
&gt; HI ALL:<br>
&gt; =A0 =A0I have a problem, that our MIPS hardware put registers location=
 from<br>
&gt; 0x7000,0000 -0x7040,0000.<br>
&gt; So, I need to init TLB to access those registers.<br>
&gt; =A0 =A0My question is: can I map those range to Kseg2 (mapped,uncached=
)? I found<br>
&gt; &quot;add_wired_entry&quot; sit in<br>
&gt; kernel code, seems I should use this function.<br>
&gt;<br>
&gt; =A0 =A0I found code in arch/mips/jazz/irq.c, and the comment tells me<=
br>
&gt; /* Map 0xe4000000 -&gt; 0x0:600005C0, 0xe4100000 -&gt; 400005C0 */<br>
&gt; =A0 =A0add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);<br>
&gt;<br>
&gt; does that mean after add_wired_entry, virtual address 0xe400,0000 map =
to<br>
&gt; physical address 0x600005C0?<br>
&gt; why the address is 0x6000,05C0, not 0x6000,0000<br>
<br>
</div></div>I probably knew 15 years ago when I wrote this code :)<br>
<br>
add_wired_entry() is a very awkard API and its use in the Jazz code is<br>
broken so I suggest you use ioremap() instead.<br>
<font color=3D"#888888"><br>
 =A0Ralf<br>
</font></blockquote></div><br>As you suggested, I plan to use ioremap()<br>=
it generally works if I use in my driver code after kernel initialization f=
inished<br> but I still have a problem:<br><br>How can I  access hardware r=
egister very early?<br>

say that, use early_printk() to access UART registers,<br>And I try to put =
ioremap() at prom_init() to try to remap UART register<br>but, found that k=
ernel will hang..<br>the UART register is start from physical address 0x700=
007c0 (&gt; 512M)<br>

but address below 512M can be remaped successfully<br><br>I spend a few min=
utes digging into the ioremap() function<br>it simply remap &lt;512M space =
to KSEG1, <br>while other physical space use different scheme (map to KSEG2=
), quite complicated....<br>

--00032555819eb9b63b047a420692--

From yuasa.linux@gmail.com Wed Dec  9 02:59:33 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 09 Dec 2009 02:59:36 +0100 (CET)
Received: from mail-yw0-f203.google.com ([209.85.211.203]:45218 "EHLO
        mail-yw0-f203.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1494395AbZLIB7d (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 9 Dec 2009 02:59:33 +0100
Received: by ywh41 with SMTP id 41so8238454ywh.0
        for <multiple recipients>; Tue, 08 Dec 2009 17:59:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:sender:date:from:to:cc
         :subject:message-id:in-reply-to:references:x-mailer:mime-version
         :content-type:content-transfer-encoding;
        bh=B9JLO0NSfvKq5ezVPEcHF6i2pYPkeab78yHibEVEltU=;
        b=EbZq3s5EbzdYB53bT0rGLu/N2XlpCByVzFvIJbeb7oAPAUhAeGOFcts49bZCkmtbV3
         5LM1JZ35q+6nmkVXNXuMI26Ryq00xsbCy29l7+noR7M23PaIR22mqoSDA5x+fT11Xbor
         XNB42xnXt3RYGnHYmIdN1tpE0QCAXhftzEhNE=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=sender:date:from:to:cc:subject:message-id:in-reply-to:references
         :x-mailer:mime-version:content-type:content-transfer-encoding;
        b=GktlTjfCy5ly6bZH5gN9D/KQTLDe1kIFUApYIiphisIIjmsSo3uKzKlXa9I3VF8i9o
         rFMukZHJspKEdMkZyLVqB4z00WuYdUhHo9fO+EHmzwPsdjgD9NxIWjW44+iNNU4ixAiL
         zLJl2DfX9XYApqcNFjlYv3qfEn0e0CYO3FYDo=
Received: by 10.150.77.24 with SMTP id z24mr15383530yba.41.1260323966550;
        Tue, 08 Dec 2009 17:59:26 -0800 (PST)
Received: from ypsilon.skybright.jp (sannin29006.nirai.ne.jp [203.160.29.6])
        by mx.google.com with ESMTPS id 15sm3693174gxk.12.2009.12.08.17.59.22
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Tue, 08 Dec 2009 17:59:24 -0800 (PST)
Date:   Wed, 9 Dec 2009 10:58:26 +0900
From:   Yoichi Yuasa <yuasa@linux-mips.org>
To:     Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc:     yuasa@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
        linux-mips@linux-mips.org
Subject: Re: [PATCH resend] MIPS: more replace CL_SIZE by COMMAND_LINE_SIZE
Message-Id: <20091209105826.e114cde8.yuasa@linux-mips.org>
In-Reply-To: <4B1E39B3.5000207@ru.mvista.com>
References: <20091208165844.ddd9106f.yuasa@linux-mips.org>
        <20091208172444.9e48afe7.yuasa@linux-mips.org>
        <4B1E39B3.5000207@ru.mvista.com>
X-Mailer: Sylpheed 2.7.1 (GTK+ 2.16.6; i686-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Return-Path: <yuasa.linux@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25384
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: yuasa@linux-mips.org
Precedence: bulk
X-list: linux-mips

Hi Sergei,

On Tue, 08 Dec 2009 14:34:11 +0300
Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:

> Hello.
> 
> Yoichi Yuasa wrote:
> > Sorry, I forgot one more CL_SIZE.
> >   
> 
>    You should put such notes under the --- tearline, not into the patch 
> description.

I'll be careful.

Thanks,
Yoichi

From wuzhangjin@gmail.com Wed Dec  9 12:00:39 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 09 Dec 2009 12:00:42 +0100 (CET)
Received: from mail-px0-f202.google.com ([209.85.216.202]:64349 "EHLO
        mail-px0-f202.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491205AbZLILAj (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 9 Dec 2009 12:00:39 +0100
Received: by pxi40 with SMTP id 40so666038pxi.21
        for <multiple recipients>; Wed, 09 Dec 2009 03:00:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:subject:from:reply-to:to:cc
         :in-reply-to:references:content-type:organization:date:message-id
         :mime-version:x-mailer:content-transfer-encoding;
        bh=857nE80KHgfbd2GB1vwxiyEimJlR66TOYfgwOmGsb8Q=;
        b=DwUxOeRzf06Ovhl2DMEPYSHHWsxrdpc5sTPHE7GDwDz3lWTc6wtzay0P6LQfF1NZkH
         AfNVut74JXG3ti6BaXkNFWkjgRx4AGKGBo+alT0S4RxPQ0Y/4x8o3V/rx9PcqgAVUdO3
         xRgrcepxGhBQXaYMtt/QseYSM8SzGKJ1RlXJ4=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=subject:from:reply-to:to:cc:in-reply-to:references:content-type
         :organization:date:message-id:mime-version:x-mailer
         :content-transfer-encoding;
        b=spsgyYR8TiNOYPLc7X67OJiDF6MS66XiBmJJzfnm+TtBTWm5WkdVJ5Tor2P/3Pm4Tc
         KjXhr7/h/yv1AaGDACbyW4qlAvH5PTe0U3yh+b6wVUinJ+XRn60Pwwxuhbl2AfmZTsit
         cxABb/5rqnlMfA08rXEQqw36pzhaDOm8yxPqQ=
Received: by 10.115.134.40 with SMTP id l40mr18452260wan.41.1260356429532;
        Wed, 09 Dec 2009 03:00:29 -0800 (PST)
Received: from ?172.16.2.101? ([222.92.8.142])
        by mx.google.com with ESMTPS id 20sm6858944pzk.13.2009.12.09.03.00.24
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Wed, 09 Dec 2009 03:00:28 -0800 (PST)
Subject: Re: [PATCH v9 5/8] Loongson: YeeLoong: add hardware monitoring
 driver
From:   Wu Zhangjin <wuzhangjin@gmail.com>
Reply-To: wuzhangjin@gmail.com
To:     Pavel Machek <pavel@ucw.cz>
Cc:     Ralf Baechle <ralf@linux-mips.org>, akpm@linux-foundation.org,
        linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@gmail.com>,
        "Rafael J . Wysocki" <rjw@sisk.pl>, zhangfx@lemote.com,
        linux-laptop@vger.kernel.org,
        Stephen Rothwell <sfr@canb.auug.org.au>
In-Reply-To: <20091208150229.GA1375@ucw.cz>
References: <cover.1260281599.git.wuzhangjin@gmail.com>
         <5e9acb4cd757075f617daa45cbd6f5fad94678ac.1260281599.git.wuzhangjin@gmail.com>
         <20091208150229.GA1375@ucw.cz>
Content-Type: text/plain; charset="UTF-8"
Organization: DSLab, Lanzhou University, China
Date:   Wed, 09 Dec 2009 18:59:52 +0800
Message-ID: <1260356392.3926.2.camel@falcon.domain.org>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.1 
Content-Transfer-Encoding: 7bit
Return-Path: <wuzhangjin@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25385
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: wuzhangjin@gmail.com
Precedence: bulk
X-list: linux-mips

On Tue, 2009-12-08 at 16:02 +0100, Pavel Machek wrote:
> Hi!
> 
> > This patch adds hardware monitoring driver, it provides standard
> > interface(/sys/class/hwmon/) for lm-sensors/sensors-applet to monitor
> > the temperatures of CPU and battery, the PWM of fan, the current,
> > voltage of battery.
> 
> It is probably ok for now, but in future current/voltage of battery
> should be exported as power_supply class (drivers/power)...

Currently, the version based on the power_supply class have some
problems when using with gnome-power-manager(the whole system will hang
there), but works well with kpowersave, after fixing the bug, we will
use it instead of this APM Emulated one.

Thanks & Regards!
	Wu Zhangjin


From figo1802@gmail.com Wed Dec  9 12:46:24 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 09 Dec 2009 12:46:30 +0100 (CET)
Received: from mail-pz0-f197.google.com ([209.85.222.197]:42159 "EHLO
        mail-pz0-f197.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491978AbZLILqY (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 9 Dec 2009 12:46:24 +0100
Received: by pzk35 with SMTP id 35so5462736pzk.22
        for <multiple recipients>; Wed, 09 Dec 2009 03:46:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :date:message-id:subject:from:to:cc:content-type;
        bh=+IR+/hVZIXeyFUMO03UeX32rKxjo6HV2C49LJRRasVk=;
        b=kW/5M4bzvwioukJRvFId+g+/zJ/4OcnG8+dG3Mnew5rZTDY9NWtQoFcWpNSMvQdL4w
         MebUkNyw9L4jIdHUSHPQacHP0GD9d6QpmLKrlgW20dtKXLUFe2wyFx1qb48y/Yoc6qpm
         I60YY/wmZHV96k+S+PJwBRWDOBKzfq19+CYA0=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc:content-type;
        b=Ywfpu1+uqSA0MXucSvMavWrL8TeOmXsqOyxITZOd5jjV7ncn4ehhs6tEwYgYpxjFsA
         jmbe1+rednUBRcrPLNGc32+2efGOLchD/PdraeNH2iTvhDuqRIXIr7qSz3wS/afizIFR
         K+aN9YhMZ+gxj/2AUDR69iyu67MCINumGUvYU=
MIME-Version: 1.0
Received: by 10.114.252.14 with SMTP id z14mr5972230wah.84.1260359175411; Wed, 
        09 Dec 2009 03:46:15 -0800 (PST)
In-Reply-To: <4B1E3A5A.9050100@ru.mvista.com>
References: <c6ed1ac50912070455n736af31fuf2c981fc182b494f@mail.gmail.com>
         <20091207134502.GB5119@linux-mips.org>
         <c6ed1ac50912071749m49b1e5f5m7ae53384389338d9@mail.gmail.com>
         <4B1E3A5A.9050100@ru.mvista.com>
Date:   Wed, 9 Dec 2009 19:46:15 +0800
Message-ID: <c6ed1ac50912090346p1109b095p5b4c26be5308f80a@mail.gmail.com>
Subject: Re: Dma addr should use Kuseg1 for MIPS32?
From:   figo zhang <figo1802@gmail.com>
To:     Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc:     Ralf Baechle <ralf@linux-mips.org>,
        David Daney <ddaney@caviumnetworks.com>, macro@linux-mips.org,
        linux-mips@linux-mips.org
Content-Type: multipart/alternative; boundary=0016e687872af09a7c047a4a3ccb
Return-Path: <figo1802@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25386
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: figo1802@gmail.com
Precedence: bulk
X-list: linux-mips

--0016e687872af09a7c047a4a3ccb
Content-Type: text/plain; charset=ISO-8859-1

2009/12/8 Sergei Shtylyov <sshtylyov@ru.mvista.com>

> Hello.
>
>
> figo zhang wrote:
>
>
>>    > i write dma_phy to DMA base register, but why it cannot work? it
>>    should
>>    > write Kseg1 space to DMA register?
>>    > I remember that it is ok for ARM/X86 .
>>
>>    It's only happens to work on some systems.
>>
>>
>> in my puzzle, if i run dma_vaddr =(char*) __get_free_pages(GFP_KERNEL,
>>  order);
>> dma_phy = virt_to_phy(dma_vaddr);
>>
>> if the result is:
>> dma_vaddr = 0x801b00000;
>> dma_phy = 0x1b00000;
>>
>> so i should write 0x1b00000 to my DMA Base register or wirte (0x1b000000 |
>> 0xa0000000) to DMA?
>>
>
>  You must always use the physical addresses when programming DMA, i.e.
> 0x1b00000 in this case.
>

I  write  0x1b00000 to my DMA Base register, the driver donot work.  write
(0x1b00000 | 0xa000000) it work, why?

>
> WBR, Sergei
>
>
>

--0016e687872af09a7c047a4a3ccb
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br><div class=3D"gmail_quote">2009/12/8 Sergei Shtylyov <span dir=3D"l=
tr">&lt;<a href=3D"mailto:sshtylyov@ru.mvista.com">sshtylyov@ru.mvista.com<=
/a>&gt;</span><br><blockquote class=3D"gmail_quote" style=3D"border-left: 1=
px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"=
>
Hello.<div class=3D"im"><br>
<br>
figo zhang wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
 =A0 =A0&gt; i write dma_phy to DMA base register, but why it cannot work? =
it<br>
 =A0 =A0should<br>
 =A0 =A0&gt; write Kseg1 space to DMA register?<br>
 =A0 =A0&gt; I remember that it is ok for ARM/X86 .<br>
<br>
 =A0 =A0It&#39;s only happens to work on some systems.<br>
<br>
<br>
in my puzzle, if i run dma_vaddr =3D(char*) __get_free_pages(GFP_KERNEL, =
=A0order);<br>
dma_phy =3D virt_to_phy(dma_vaddr);<br>
<br>
if the result is:<br>
dma_vaddr =3D 0x801b00000;<br>
dma_phy =3D 0x1b00000;<br>
<br>
so i should write 0x1b00000 to my DMA Base register or wirte (0x1b000000 | =
0xa0000000) to DMA?<br>
</blockquote>
<br></div>
 =A0You must always use the physical addresses when programming DMA, i.e. 0=
x1b00000 in this case.<br></blockquote><div><br>I=A0 write=A0 0x1b00000 to =
my DMA Base register, the driver donot work.=A0 write (0x1b00000 | 0xa00000=
0) it work, why?<br>
</div><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb=
(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
WBR, Sergei<br>
<br>
<br>
</blockquote></div><br>

--0016e687872af09a7c047a4a3ccb--

From figo1802@gmail.com Wed Dec  9 12:47:19 2009
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 09 Dec 2009 12:47:24 +0100 (CET)
Received: from mail-px0-f202.google.com ([209.85.216.202]:60892 "EHLO
        mail-px0-f202.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1491978AbZLILrT (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Wed, 9 Dec 2009 12:47:19 +0100
Received: by pxi40 with SMTP id 40so689087pxi.21
        for <multiple recipients>; Wed, 09 Dec 2009 03:47:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :date:message-id:subject:from:to:cc:content-type;
        bh=4eWKAXQFOkOjBFTAz7qgc6aPrrDof4uKC4QJdjMcQaM=;
        b=SYAcdXFm4DA+HHaPPWL6H4xdUTyMFADWwUOgfC6XG+JfSsS1lu4OdLkIxjXIMCtJgA
         gloHkddR0IG6jCzkFBEhh60jfiWQiYWJnxsORZlxUBsIB3SnB5anContk1gwII6Ixv9I
         AYjpFldt07/LAee3i10vOao5CLcIoRVY5SQsU=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc:content-type;
        b=yDvgb4wB5/0LVagoigSM4j97VhjPxBZY0Nd8EBGOsGLeDvC8JSiEYhFNGBTpM0Ol4W
         eXetl2/GoglPbD7PeYuHmaHoJw3EYsY0i+4dJ7at3x3y1mcaIMLZ/wsrpX9zJdg2G20c
         GfRpjRM1XQ2MKXqoZhjm+XXU2SeI6mwQC8PZ4=
MIME-Version: 1.0
Received: by 10.115.100.30 with SMTP id c30mr6726771wam.211.1260359230632; 
        Wed, 09 Dec 2009 03:47:10 -0800 (PST)
In-Reply-To: <c6ed1ac50912071749m49b1e5f5m7ae53384389338d9@mail.gmail.com>
References: <c6ed1ac50912070455n736af31fuf2c981fc182b494f@mail.gmail.com>
         <20091207134502.GB5119@linux-mips.org>
         <c6ed1ac50912071749m49b1e5f5m7ae53384389338d9@mail.gmail.com>
Date:   Wed, 9 Dec 2009 19:47:10 +0800
Message-ID: <c6ed1ac50912090347y49213892u4d05c6ed3f5aa30a@mail.gmail.com>
Subject: Re: Dma addr should use Kuseg1 for MIPS32?
From:   figo zhang <figo1802@gmail.com>
To:     Ralf Baechle <ralf@linux-mips.org>
Cc:     David Daney <ddaney@caviumnetworks.com>, macro@linux-mips.org,
        linux-mips@linux-mips.org
Content-Type: multipart/alternative; boundary=0016e64b90463b31cc047a4a4067
Return-Path: <figo1802@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 25387
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: figo1802@gmail.com
Precedence: bulk
X-list: linux-mips

--0016e64b90463b31cc047a4a4067
Content-Type: text/plain; charset=ISO-8859-1

2009/12/8 figo zhang <figo1802@gmail.com>

>
>
> 2009/12/7 Ralf Baechle <ralf@linux-mips.org>
>
> On Mon, Dec 07, 2009 at 08:55:12PM +0800, figo zhang wrote:
>>
>> > I am writing a driver for MIPS32. i wirte this code for DMA addr:
>> >
>> > dma_vaddr =(char*) __get_free_pages(GFP_KERNEL|
>> > GFP_DMA, order);
>>
>> You probably don't want to use GFP_DMA - unless your hardware has DMA
>> restrictions such as the ISA's bus's 16MB limit.
>>
>> > dma_phy = virt_to_phy(dma_vaddr);
>>
>
>> Ouch.  Don't.  See Documentation/DMA-API.txt for how to do it.
>>
>
> hi Ralf,
> is it using dma_alloc_coherent()? i see the this funtion in
> arch/mips/mm/dma_default.c, it also invork the
> __get_free_pages() and return the dma_addr by
> plat_map_dma_mem()->virt_to_phy() , see
> include/asm-mips/mach-genric/dma-coherent.h. so i think, i see use
> __get_free_pages() alloce buffer for DMA.
>
>>
>> > i write dma_phy to DMA base register, but why it cannot work? it should
>> > write Kseg1 space to DMA register?
>> > I remember that it is ok for ARM/X86 .
>>
>> It's only happens to work on some systems.
>>
>
> in my puzzle