Received: from mail.onstor.com ([66.201.51.107]) by onstor-exch02.onstor.net with Microsoft SMTPSVC(6.0.3790.1830);
	 Mon, 19 May 2008 01:09:10 -0700
Received: from chiesmta2-1.messageone.com ([216.203.30.55]) by mail.onstor.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Mon, 19 May 2008 01:09:10 -0700
Received: from ftp.linux-mips.org (ftp.linux-mips.org [213.58.128.207])
	by chiesmta2-1.messageone.com (8.13.8/8.13.8) with ESMTP id m4J8966u007475
	for <andy.sharp@onstor.com>; Mon, 19 May 2008 03:09:09 -0500
Received: from localhost.localdomain ([127.0.0.1]:21485 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP
	id S20022316AbYESII4 (ORCPT <rfc822;andy.sharp@onstor.com>);
	Mon, 19 May 2008 09:08:56 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 19 May 2008 09:08:41 +0100 (BST)
Received: from fnoeppeil48.netpark.at ([217.175.205.176]:57300 "EHLO
	roarinelk.homelinux.net") by ftp.linux-mips.org with ESMTP
	id S20022424AbYESIIi (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 19 May 2008 09:08:38 +0100
Received: (qmail 22200 invoked by uid 1000); 19 May 2008 10:08:37 +0200
Date: 	Mon, 19 May 2008 10:08:37 +0200
From: Manuel Lauss <mano@roarinelk.homelinux.net>
To: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, drzeus@drzeus.cx,
        sshtylyov@ru.mvista.com
Subject: [PATCH 9/9] au1xmmc: Add back PB1200/DB1200 MMC activity LED
	support
Message-ID: <20080519080837.GJ21985@roarinelk.homelinux.net>
References: <20080519080339.GA21985@roarinelk.homelinux.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20080519080339.GA21985@roarinelk.homelinux.net>
User-Agent: Mutt/1.5.16 (2007-06-09)
X-archive-position: 19307
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: mano@roarinelk.homelinux.net
Precedence: bulk
X-list: 	linux-mips
X-MessageOne-Virus-Version: vendor=fsecure engine=4.65.7161:2.4.4,1.2.40,4.0.164 definitions=2008-05-19_02:2008-05-19,2008-05-19,2008-05-19 signatures=0
X-MessageOne-Virus-Scanned: Clean
X-MessageOne-Envelope-Sender: linux-mips-bounce@linux-mips.org
X-MessageOne-Spam-Details: rule=m773emszm_notspam policy=m773emszm score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=3.1.0-0805090000 definitions=main-0805190016
X-MessageOne-Spam-Score: 0
X-MessageOne-Spam-Bar: 
Return-Path: linux-mips-bounce@linux-mips.org
X-OriginalArrivalTime: 19 May 2008 08:09:10.0241 (UTC) FILETIME=[9DFD5D10:01C8B987]

From 5747bd6933bb212ab83044fa79adf185d248513f Mon Sep 17 00:00:00 2001
From: Manuel Lauss <mlau@msc-ge.com>
Date: Sun, 18 May 2008 16:05:56 +0200
Subject: [PATCH] au1xmmc: Add back PB1200/DB1200 MMC activity LED support.

Add back PB1200/DB1200 MMC activity LED support just the way
it was done in the original driver source.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
---
 arch/mips/au1000/pb1200/platform.c        |   15 +++++++++++++++
 drivers/mmc/host/au1xmmc.c                |   10 ++++++++++
 include/asm-mips/mach-au1x00/au1100_mmc.h |    1 +
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/mips/au1000/pb1200/platform.c b/arch/mips/au1000/pb1200/platform.c
index f329a38..f48723c 100644
--- a/arch/mips/au1000/pb1200/platform.c
+++ b/arch/mips/au1000/pb1200/platform.c
@@ -24,6 +24,8 @@
 #include <asm/mach-au1x00/au1xxx.h>
 #include <asm/mach-au1x00/au1100_mmc.h>
 
+static int mmc_activity = 0;
+
 static void pb1200mmc0_set_power(void *mmc_host, int state)
 {
 	if (state)
@@ -44,6 +46,17 @@ static int pb1200mmc0_card_inserted(void *mmc_host)
 	return (bcsr->sig_status & BCSR_INT_SD0INSERT) ? 1 : 0;
 }
 
+static void pb1200mmc_activity(int on)
+{
+	if (on) {
+		if (++mmc_activity == 1)
+			bcsr->disk_leds &= ~(1 << 8);
+	} else {
+		if (--mmc_activity == 0)
+			bcsr->disk_leds |= (1 << 8);
+	}
+}
+
 #ifndef CONFIG_MIPS_DB1200
 static void pb1200mmc1_set_power(void *mmc_host, int state)
 {
@@ -72,6 +85,7 @@ const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
 		.card_inserted	= pb1200mmc0_card_inserted,
 		.card_readonly	= pb1200mmc0_card_readonly,
 		.cd_setup	= NULL,		/* use poll-timer in driver */
+		.activity	= pb1200mmc_activity,
 	},
 #ifndef CONFIG_MIPS_DB1200
 	[1] = {
@@ -79,6 +93,7 @@ const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
 		.card_inserted	= pb1200mmc1_card_inserted,
 		.card_readonly	= pb1200mmc1_card_readonly,
 		.cd_setup	= NULL,		/* use poll-timer in driver */
+		.activity	= pb1200mmc_activity,
 	},
 #endif
 };
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index 0b30582..67df6fe 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -224,6 +224,12 @@ static int au1xmmc_card_readonly(struct mmc_host *mmc)
 	return ret;
 }
 
+static inline void au1xmmc_activity(struct au1xmmc_host *host, int on)
+{
+	if (host->platdata && host->platdata->activity)
+		host->platdata->activity(on);
+}
+
 static void au1xmmc_finish_request(struct au1xmmc_host *host)
 {
 	struct mmc_request *mrq = host->mrq;
@@ -240,6 +246,8 @@ static void au1xmmc_finish_request(struct au1xmmc_host *host)
 
 	host->status = HOST_S_IDLE;
 
+	au1xmmc_activity(host, 0);
+
 	mmc_request_done(host->mmc, mrq);
 }
 
@@ -696,6 +704,8 @@ static void au1xmmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
 		return;
 	}
 
+	au1xmmc_activity(host, 1);
+
 	if (mrq->data) {
 		FLUSH_FIFO(host);
 		ret = au1xmmc_prepare_data(host, mrq->data);
diff --git a/include/asm-mips/mach-au1x00/au1100_mmc.h b/include/asm-mips/mach-au1x00/au1100_mmc.h
index c79dec1..6433b19 100644
--- a/include/asm-mips/mach-au1x00/au1100_mmc.h
+++ b/include/asm-mips/mach-au1x00/au1100_mmc.h
@@ -43,6 +43,7 @@ struct au1xmmc_platform_data {
 	int(*card_inserted)(void *mmc_host);
 	int(*card_readonly)(void *mmc_host);
 	void(*set_power)(void *mmc_host, int state);
+	void(*activity)(int on);
 };
 
 #define SD0_BASE	0xB0600000
-- 
1.5.5.1


