linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: akuster <akuster@dslextreme.com>
To: akuster@dslextreme.com
Cc: linuxppc-dev <linuxppc-dev@lists.linuxppc.org>
Subject: Re: [RFC/Patch] ppc4xx_pm.c
Date: Fri, 26 Jul 2002 16:35:16 -0700	[thread overview]
Message-ID: <3D41DCB4.90706@dslextreme.com> (raw)
In-Reply-To: 3D3DD903.3070300@dslextreme.com

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

akuster wrote:
>
> I am in the process of fixing the init of the pm for 4xx in ppc4xx_pm.c
> so that it can be used and I and others have discussed having the
> drivers enable/disable their own power managment bits at init & exit times.
>

>
> 2) update ocp drivers to enable/disable their pm settings and remove
> their enable bits from the default bitmap in the core headers.

Here are the ocp driver changes to help support enabling/disabling the
device clock.  currently these wount work on the 440 until a soon to
follow on 440 patch is checked in

armin


[-- Attachment #2: pm_drv_update_0726.patch.gz --]
[-- Type: application/x-gunzip, Size: 1831 bytes --]

[-- Attachment #3: pm_drv_update_0726.patch --]
[-- Type: text/plain, Size: 4841 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux 2.4 for PowerPC development tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1096  -> 1.1097
#	drivers/net/ibm_ocp/ibm_ocp_enet.c	1.53    -> 1.54
#	drivers/net/ibm_ocp/ibm_ocp_enet.h	1.29    -> 1.30
#	drivers/i2c/i2c-adap-ibm_ocp.c	1.9     -> 1.10
#	drivers/char/ibm_ocp_gpio.c	1.13    -> 1.14
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/26	armin@essen.mvista.com	1.1097
# udated drivers for CPM support
# --------------------------------------------
#
diff -Nru a/drivers/char/ibm_ocp_gpio.c b/drivers/char/ibm_ocp_gpio.c
--- a/drivers/char/ibm_ocp_gpio.c	Fri Jul 26 10:04:10 2002
+++ b/drivers/char/ibm_ocp_gpio.c	Fri Jul 26 10:04:10 2002
@@ -58,9 +58,12 @@
  *	an accessible area.  Add ioctl to configure
  *	multiplexed GPIO pins.
  *
+ *	1.7 07/25/02 - Armin
+ *	added CPM to enable/disable in init/exit
+ *
  */

-#define VUFX "06.04.02"
+#define VUFX "07.25.02"

 #include <linux/module.h>
 #include <linux/config.h>
@@ -283,7 +286,7 @@
 			return -EFAULT;

 		return ibm_gpio_config(ioctl_data.device,
-					 ioctl_data.mask, ioctl_data.data);
+				       ioctl_data.mask, ioctl_data.data);

 		break;

@@ -322,7 +325,12 @@
 			ibm_gpio_miscdev.fops = &ibm_gpio_fops;
 			misc_register(&ibm_gpio_miscdev);	/*ibm_gpio_miscdev); */

-			gpiop = (struct gpio_regs *)ioremap(gpio_dev->paddr, sizeof(struct gpio_regs));
+			gpiop =
+			    (struct gpio_regs *) ioremap(gpio_dev->paddr,
+							 sizeof (struct
+								 gpio_regs));
+			mtdcr(DCRN_CPMFR,
+			      mfdcr(DCRN_CPMFR) & ~ocp_get_pm(GPIO, curr_gpio));
 			printk("GPIO #%d at 0x%lx\n", curr_gpio,
 			       (unsigned long) gpiop);

@@ -341,6 +349,7 @@
 	for (i = 0; i < ocp_get_max(GPIO); i++) {
 		gpio_dev = ocp_get_dev(GPIO, i);
 		misc_deregister(&ibm_gpio_miscdev);
+		mtdcr(DCRN_CPMFR, mfdcr(DCRN_CPMFR) | ocp_get_pm(GPIO, i));
 		ocp_unregister(gpio_dev);
 	}
 }
diff -Nru a/drivers/i2c/i2c-adap-ibm_ocp.c b/drivers/i2c/i2c-adap-ibm_ocp.c
--- a/drivers/i2c/i2c-adap-ibm_ocp.c	Fri Jul 26 10:04:10 2002
+++ b/drivers/i2c/i2c-adap-ibm_ocp.c	Fri Jul 26 10:04:10 2002
@@ -66,6 +66,9 @@
     Version: 1.9 - Armin
        changed irq_resource to just irq

+    Version: 2.0 - Armin
+    	added CPM enable/disable in init/exit
+
    TODO: add PM hooks

 */
@@ -269,6 +272,7 @@
 			adap->dec_use = iic_ibmocp_dec_use;
 			adap->client_register = iic_ibmocp_reg;
 			adap->client_unregister = iic_ibmocp_unreg;
+			mtdcr(DCRN_CPMFR, mfdcr(DCRN_CPMFR) & ~ocp_get_pm(IIC, curr_iic));

 			init_waitqueue_head(&(iic_wait[curr_iic]));

@@ -312,6 +316,7 @@
 		iic_drv = ocp_get_dev(IIC, i);
 		adap = (struct i2c_adapter *) iic_drv->ocpdev;
 		i2c_iic_del_bus(adap);
+		mtdcr(DCRN_CPMFR, mfdcr(DCRN_CPMFR) | ocp_get_pm(IIC, i));
 	}

 	iic_ibmocp_release();
diff -Nru a/drivers/net/ibm_ocp/ibm_ocp_enet.c b/drivers/net/ibm_ocp/ibm_ocp_enet.c
--- a/drivers/net/ibm_ocp/ibm_ocp_enet.c	Fri Jul 26 10:04:10 2002
+++ b/drivers/net/ibm_ocp/ibm_ocp_enet.c	Fri Jul 26 10:04:10 2002
@@ -167,6 +167,8 @@
  *      removed need for irq_resource
  *	removed need for loop in request & free irq
  *	changed interrupt handles to static
+ *	 Version 4.7 07/25/02 - Armin
+ *	    added CPM enable/diable in init/exit
  *
  */
 #include <linux/module.h>
@@ -619,6 +621,10 @@
 	rx_virt_addr = (mal_desc_t *)
 	    consistent_alloc(GFP_KERNEL, PAGE_SIZE * emac_max, &rx_phys_addr);
 	for (curr_emac = 0; curr_emac < emac_max; curr_emac++) {
+		if(ocp_get_pm(EMAC, curr_emac)){
+			mtdcr(DCRN_CPMFR,
+			      mfdcr(DCRN_CPMFR) & ~IBM_CPM_EMAC(ocp_get_pm(EMAC, curr_emac)));
+		}
 		ocp_enet_probe(curr_emac);
 	}

@@ -1193,6 +1199,17 @@
 static void __exit
 exit_ppc405_enet(void)
 {
+	int i;
+	struct ocp_dev *emac_dev;
+
+	for (i = 0; i < ocp_get_max(EMAC); i++) {
+		emac_dev = ocp_get_dev(EMAC, i);
+		if(ocp_get_pm(EMAC, i)){
+			mtdcr(DCRN_CPMFR, mfdcr(DCRN_CPMFR) | IBM_CPM_EMAC(ocp_get_pm(EMAC, i)));
+			ocp_unregister(emac_dev);
+		}
+	}
+
 	/*
 	 * Unmap the non cached memory space.
 	 */
diff -Nru a/drivers/net/ibm_ocp/ibm_ocp_enet.h b/drivers/net/ibm_ocp/ibm_ocp_enet.h
--- a/drivers/net/ibm_ocp/ibm_ocp_enet.h	Fri Jul 26 10:04:10 2002
+++ b/drivers/net/ibm_ocp/ibm_ocp_enet.h	Fri Jul 26 10:04:10 2002
@@ -93,6 +93,11 @@
 #define MDIO_DELAY		2
 #define NMII				20

+/* Power managment shift registers */
+#define IBM_CPM_EMMII	0	/* Shift value for MII */
+#define IBM_CPM_EMRX	1	/* Shift value for recv */
+#define IBM_CPM_EMTX	2	/* Shift value for MAC */
+#define IBM_CPM_EMAC(x)	(((x)<<IBM_CPM_EMMII) | ((x)<<IBM_CPM_EMRX) | ((x)<<IBM_CPM_EMTX))

 #ifdef CONFIG_IBM_OCP_ENET_ERROR_MSG
 void ppc405_serr_dump_0(struct net_device *dev);

  parent reply	other threads:[~2002-07-26 23:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-23 22:30 [RFC/Patch] ppc4xx_pm.c akuster
2002-07-25 23:55 ` akuster
2002-07-26 23:35 ` akuster [this message]
2002-07-27  0:04   ` Todd Poynor
2002-07-27 17:00     ` akuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D41DCB4.90706@dslextreme.com \
    --to=akuster@dslextreme.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).