linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC/Patch] ppc4xx_pm.c
@ 2002-07-23 22:30 akuster
  2002-07-25 23:55 ` akuster
  2002-07-26 23:35 ` akuster
  0 siblings, 2 replies; 5+ messages in thread
From: akuster @ 2002-07-23 22:30 UTC (permalink / raw)
  To: linuxppc-dev


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.

So what I would like to do is have each core header define a default set
of what is required to be powered on and then have each driver enable
them selves.  These changes would be done in two stages

1) fix ppc4xx_pm.c init and have the default pm bitmap set to all ocp
drivers on.

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

armin


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/Patch] ppc4xx_pm.c
  2002-07-23 22:30 [RFC/Patch] ppc4xx_pm.c akuster
@ 2002-07-25 23:55 ` akuster
  2002-07-26 23:35 ` akuster
  1 sibling, 0 replies; 5+ messages in thread
From: akuster @ 2002-07-25 23:55 UTC (permalink / raw)
  To: akuster; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 843 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.
>
> So what I would like to do is have each core header define a default set
> of what is required to be powered on and then have each driver enable
> them selves.  These changes would be done in two stages
>
> 1) fix ppc4xx_pm.c init and have the default pm bitmap set to all ocp
> drivers on.

These patches are the changes to the core header files and for ppc4xx_pm.c.

  Please _note_ that if you enable the Power Managment in the config
that most kernels might hang if you use an ocp device since the drivers
are not updated yet. :)

If no one has an objection, then I will get it submitted

armin




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

[-- Attachment #3: ocp_pm_0724.patch.gz --]
[-- Type: application/x-gunzip, Size: 1093 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/Patch] ppc4xx_pm.c
  2002-07-23 22:30 [RFC/Patch] ppc4xx_pm.c akuster
  2002-07-25 23:55 ` akuster
@ 2002-07-26 23:35 ` akuster
  2002-07-27  0:04   ` Todd Poynor
  1 sibling, 1 reply; 5+ messages in thread
From: akuster @ 2002-07-26 23:35 UTC (permalink / raw)
  To: akuster; +Cc: linuxppc-dev

[-- 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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/Patch] ppc4xx_pm.c
  2002-07-26 23:35 ` akuster
@ 2002-07-27  0:04   ` Todd Poynor
  2002-07-27 17:00     ` akuster
  0 siblings, 1 reply; 5+ messages in thread
From: Todd Poynor @ 2002-07-27  0:04 UTC (permalink / raw)
  To: akuster; +Cc: linuxppc-dev


 > +++ b/drivers/net/ibm_ocp/ibm_ocp_enet.c
 >
>  	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);
> +		}
> +	}
> +

(1) Also do CPM on/off at open/close hooks, so that closed EMACs are
powered down and powered back up when re-opened?

(2) Move ocp_unregister() call outside "if(ocp_get_pm()" test.


--
Todd


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/Patch] ppc4xx_pm.c
  2002-07-27  0:04   ` Todd Poynor
@ 2002-07-27 17:00     ` akuster
  0 siblings, 0 replies; 5+ messages in thread
From: akuster @ 2002-07-27 17:00 UTC (permalink / raw)
  To: Todd Poynor; +Cc: linuxppc-dev


Todd Poynor wrote:
>  > +++ b/drivers/net/ibm_ocp/ibm_ocp_enet.c
>  >
>
>>      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);
>> +        }
>> +    }
>> +
>
>
> (1) Also do CPM on/off at open/close hooks, so that closed EMACs are
> powered down and powered back up when re-opened?

This idea should be applied to all ocp drivers.  I am not sure if
forcing (CPMFR) it the best method @ open/close or requesting/enabling
power down (CPMER).  mmm... gota think about :)

>
> (2) Move ocp_unregister() call outside "if(ocp_get_pm()" test.
Thanks

>
>


Armin


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-07-27 17:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-23 22:30 [RFC/Patch] ppc4xx_pm.c akuster
2002-07-25 23:55 ` akuster
2002-07-26 23:35 ` akuster
2002-07-27  0:04   ` Todd Poynor
2002-07-27 17:00     ` akuster

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).