[FE training-materials-updates] Remove power management lab data
Michael Opdenacker
michael.opdenacker at free-electrons.com
Mon Oct 28 06:08:45 CET 2013
Repository : git://git.free-electrons.com/training-materials.git
On branch : master
Link : http://git.free-electrons.com/training-materials/commit/?id=eb6c899370351d6284d5a135125e757bfcae9ec5
>---------------------------------------------------------------
commit eb6c899370351d6284d5a135125e757bfcae9ec5
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date: Mon Oct 28 06:00:33 2013 +0100
Remove power management lab data
- No longer used
Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>
>---------------------------------------------------------------
eb6c899370351d6284d5a135125e757bfcae9ec5
.../usage/data/0001-at91-add-cpufreq-support.patch | 274 --------------------
...el_serial-adaptations-for-cpufreq-support.patch | 138 ----------
...0003-macb-adaptations-for-cpufreq-support.patch | 233 -----------------
3 files changed, 645 deletions(-)
diff --git a/lab-data/powermgt/usage/data/0001-at91-add-cpufreq-support.patch b/lab-data/powermgt/usage/data/0001-at91-add-cpufreq-support.patch
deleted file mode 100644
index 978610a..0000000
--- a/lab-data/powermgt/usage/data/0001-at91-add-cpufreq-support.patch
+++ /dev/null
@@ -1,274 +0,0 @@
-From adfd4aa31226e56b9cbdca145243619a7e685b7e Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-Date: Thu, 17 Nov 2011 11:18:30 +0100
-Subject: [PATCH 1/3] at91: add cpufreq support
-
-Work initially done by Albin Tonnerre
-<albin.tonnerre at free-electrons.com>.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
----
- arch/arm/Kconfig | 9 ++
- arch/arm/mach-at91/Makefile | 1 +
- arch/arm/mach-at91/cpufreq-at91.c | 210 +++++++++++++++++++++++++++++++++++++
- 3 files changed, 220 insertions(+), 0 deletions(-)
- create mode 100644 arch/arm/mach-at91/cpufreq-at91.c
-
-diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
-index 3146ed3..2675fca 100644
---- a/arch/arm/Kconfig
-+++ b/arch/arm/Kconfig
-@@ -302,6 +302,7 @@ config ARCH_AT91
- select HAVE_CLK
- select CLKDEV_LOOKUP
- select ARM_PATCH_PHYS_VIRT if MMU
-+ select ARCH_HAS_CPUFREQ
- help
- This enables support for systems based on the Atmel AT91RM9200,
- AT91SAM9 and AT91CAP9 processors.
-@@ -2001,6 +2002,14 @@ config CPU_FREQ_S3C24XX_DEBUGFS
- help
- Export status information via debugfs.
-
-+config CPU_FREQ_AT91
-+ bool "CPUfreq driver from ATMEL AT91 ARM CPUs (EXPERIMENTAL)"
-+ depends on CPU_FREQ && ARCH_AT91 && EXPERIMENTAL
-+ help
-+ This enables the CPUfreq driver for ARM AT91 CPUs.
-+
-+ If in doubt, say N.
-+
- endif
-
- source "drivers/cpuidle/Kconfig"
-diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
-index bf57e8b..5c89f67 100644
---- a/arch/arm/mach-at91/Makefile
-+++ b/arch/arm/mach-at91/Makefile
-@@ -87,6 +87,7 @@ obj-y += leds.o
- obj-$(CONFIG_PM) += pm.o
- obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o
- obj-$(CONFIG_CPU_IDLE) += cpuidle.o
-+obj-$(CONFIG_CPU_FREQ_AT91) += cpufreq-at91.o
-
- ifeq ($(CONFIG_PM_DEBUG),y)
- CFLAGS_pm.o += -DDEBUG
-diff --git a/arch/arm/mach-at91/cpufreq-at91.c b/arch/arm/mach-at91/cpufreq-at91.c
-new file mode 100644
-index 0000000..8c41f3b
---- /dev/null
-+++ b/arch/arm/mach-at91/cpufreq-at91.c
-@@ -0,0 +1,210 @@
-+/*
-+ * Copyright (C) 2009
-+ * Albin Tonnerre, Free Electrons <albin.tonnerre at free-electrons.com>
-+ *
-+ * Based on linux/arch/arm/mach-pxa/cpufreq-pxa3xx.c
-+ * Copyright (C) 2008 Marvell International Ltd.
-+ *
-+ * 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/kernel.h>
-+#include <linux/init.h>
-+#include <linux/errno.h>
-+#include <linux/io.h>
-+#include <linux/cpufreq.h>
-+#include <linux/clk.h>
-+
-+#include <mach/hardware.h>
-+#include <mach/at91_pmc.h>
-+#include <mach/cpu.h>
-+#include <linux/delay.h>
-+#include "clock.h"
-+
-+struct at91_freq_info {
-+ unsigned int cpufreq_khz;
-+ u32 mckr_pres;
-+};
-+
-+static struct at91_freq_info *at91_freqs;
-+static struct cpufreq_frequency_table *at91_freqs_table;
-+
-+static int setup_freqs_table(struct cpufreq_policy *policy,
-+ struct at91_freq_info *freqs, int num)
-+{
-+ struct cpufreq_frequency_table *table;
-+ int i;
-+
-+ table = kzalloc((num + 1) * sizeof(*table), GFP_KERNEL);
-+ if (table == NULL)
-+ return -ENOMEM;
-+
-+ for (i = 0; i < num; i++) {
-+ table[i].index = i;
-+ table[i].frequency = freqs[i].cpufreq_khz;
-+ }
-+ table[num].frequency = i;
-+ table[num].frequency = CPUFREQ_TABLE_END;
-+
-+ at91_freqs = freqs;
-+ at91_freqs_table = table;
-+
-+ return cpufreq_frequency_table_cpuinfo(policy, table);
-+}
-+
-+static void __update_core_freq(struct clk *clk, struct at91_freq_info *info)
-+{
-+ u32 mckr, cur_mdiv;
-+
-+ cur_mdiv = at91_sys_read(AT91_PMC_MCKR) & AT91_PMC_MDIV;
-+ mckr = info->mckr_pres | cur_mdiv | AT91_PMC_CSS_PLLA;
-+
-+ at91_sys_write(AT91_PMC_MCKR, mckr);
-+ while(!(at91_sys_read(AT91_PMC_SR) & AT91_PMC_MCKRDY))
-+ cpu_relax();
-+
-+ clk->rate_hz = (info->cpufreq_khz * 1000) >> (cur_mdiv >> 8);
-+}
-+
-+static int at91_cpufreq_verify(struct cpufreq_policy *policy)
-+{
-+ return cpufreq_frequency_table_verify(policy, at91_freqs_table);
-+}
-+
-+static unsigned int at91_cpufreq_get(unsigned int cpu)
-+{
-+ u32 mdiv;
-+
-+ mdiv = 1 << ((at91_sys_read(AT91_PMC_MCKR) & AT91_PMC_MDIV) >> 8);
-+ return mdiv * clk_get_rate(clk_get(NULL, "mck")) / 1000;
-+}
-+
-+static int at91_cpufreq_set(struct cpufreq_policy *policy,
-+ unsigned int target_freq,
-+ unsigned int relation)
-+{
-+ struct at91_freq_info *next;
-+ struct cpufreq_freqs freqs;
-+ unsigned long flags;
-+ int idx;
-+ struct clk *clk;
-+
-+ if (policy->cpu != 0)
-+ return -EINVAL;
-+
-+ /* don't do anything if the master clock source is not PLLA */
-+ clk = clk_get(NULL, "mck");
-+ if (strcmp(clk->parent->name, "plla"))
-+ return -EINVAL;
-+
-+ /* Lookup the next frequency */
-+ if (cpufreq_frequency_table_target(policy, at91_freqs_table,
-+ target_freq, relation, &idx))
-+ return -EINVAL;
-+
-+ next = &at91_freqs[idx];
-+
-+ freqs.old = policy->cur;
-+ freqs.new = next->cpufreq_khz;
-+ freqs.cpu = policy->cpu;
-+
-+ printk("CPU frequency from %d MHz to %d MHz%s\n",
-+ freqs.old / 1000, freqs.new / 1000,
-+ (freqs.old == freqs.new) ? " (skipped)" : "");
-+
-+ if (freqs.old == target_freq)
-+ return 0;
-+
-+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
-+
-+ local_irq_save(flags);
-+ __update_core_freq(clk, next);
-+ local_irq_restore(flags);
-+
-+ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
-+
-+ return 0;
-+}
-+
-+static __init int at91_cpufreq_init(struct cpufreq_policy *policy)
-+{
-+ int ret = -EINVAL, nfreqs, i;
-+ u32 pres, max_div = -1, mdiv;
-+ struct clk *clk;
-+ struct at91_freq_info *at91_freqs;
-+
-+ /* don't do anything if the master clock source is not PLLA */
-+ clk = clk_get(NULL, "mck");
-+ if (strcmp(clk->parent->name, "plla"))
-+ return -EINVAL;
-+
-+ pres = at91_sys_read(AT91_PMC_MCKR) & AT91_PMC_PRES;
-+ mdiv = (at91_sys_read(AT91_PMC_MCKR) & AT91_PMC_MDIV) >> 8;
-+
-+ for (i = AT91_PMC_PRES_64; i > AT91_PMC_PRES_1; i -= 1 << 2)
-+ {
-+ u32 speed = (clk->rate_hz >> (i >> 2)) / mdiv;
-+ if (speed > 25000000) {
-+ max_div = i;
-+ break;
-+ }
-+ }
-+ if (max_div == -1)
-+ max_div = AT91_PMC_PRES_1;
-+
-+ /* set default policy and cpuinfo */
-+ policy->cpuinfo.min_freq = (clk->rate_hz / 1000) >> (max_div >> 2);
-+ policy->cpuinfo.max_freq = clk->rate_hz / 1000;
-+ policy->cpuinfo.transition_latency = 1000000; /* FIXME: 1 ms, assumed */
-+ policy->cur = policy->min = policy->max = at91_cpufreq_get(policy->cpu);
-+
-+ nfreqs = (max_div - pres) >> 2;
-+ nfreqs = (nfreqs > 0) ? nfreqs + 1 : 1;
-+ at91_freqs = kmalloc(sizeof(struct at91_freq_info) * nfreqs, GFP_KERNEL);
-+
-+ for(i = 0; i < nfreqs; i++)
-+ {
-+ at91_freqs[i].cpufreq_khz = policy->cur >> (pres >> 2);
-+ at91_freqs[i].mckr_pres = pres;
-+ pres += 1 << 2;
-+ }
-+
-+ ret = setup_freqs_table(policy, at91_freqs, nfreqs);
-+
-+ if (ret) {
-+ pr_err("failed to setup frequency table\n");
-+ kfree(at91_freqs);
-+ return ret;
-+ }
-+
-+ pr_info("CPUFREQ support for AT91 initialized\n");
-+ return 0;
-+}
-+
-+static struct cpufreq_driver at91_cpufreq_driver = {
-+ .verify = at91_cpufreq_verify,
-+ .target = at91_cpufreq_set,
-+ .init = at91_cpufreq_init,
-+ .get = at91_cpufreq_get,
-+ .name = "at91-cpufreq",
-+};
-+
-+static int __init cpufreq_init(void)
-+{
-+ return cpufreq_register_driver(&at91_cpufreq_driver);
-+}
-+module_init(cpufreq_init);
-+
-+static void __exit cpufreq_exit(void)
-+{
-+ kfree(at91_freqs);
-+ cpufreq_unregister_driver(&at91_cpufreq_driver);
-+}
-+module_exit(cpufreq_exit);
-+
-+MODULE_DESCRIPTION("CPU frequency scaling driver for AT91");
-+MODULE_LICENSE("GPL");
---
-1.7.4.1
-
diff --git a/lab-data/powermgt/usage/data/0002-atmel_serial-adaptations-for-cpufreq-support.patch b/lab-data/powermgt/usage/data/0002-atmel_serial-adaptations-for-cpufreq-support.patch
deleted file mode 100644
index 7f5fe9c..0000000
--- a/lab-data/powermgt/usage/data/0002-atmel_serial-adaptations-for-cpufreq-support.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From 40bde66f2484ceaa74369b4dc8aea2e03c934832 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-Date: Thu, 17 Nov 2011 21:57:55 +0100
-Subject: [PATCH 2/3] atmel_serial: adaptations for cpufreq support
-
-Work initially done by Albin Tonnerre
-<albin.tonnerre at free-electrons.com>.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
----
- drivers/tty/serial/atmel_serial.c | 83 +++++++++++++++++++++++++++++++++++++
- 1 files changed, 83 insertions(+), 0 deletions(-)
-
-diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
-index b922f5d..a3c05cb 100644
---- a/drivers/tty/serial/atmel_serial.c
-+++ b/drivers/tty/serial/atmel_serial.c
-@@ -37,6 +37,7 @@
- #include <linux/atmel_pdc.h>
- #include <linux/atmel_serial.h>
- #include <linux/uaccess.h>
-+#include <linux/cpufreq.h>
-
- #include <asm/io.h>
- #include <asm/ioctls.h>
-@@ -154,6 +155,10 @@ struct atmel_uart_port {
-
- struct serial_rs485 rs485; /* rs485 settings */
- unsigned int tx_done_mask;
-+
-+#ifdef CONFIG_CPU_FREQ
-+ struct notifier_block freq_transition;
-+#endif
- };
-
- static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART];
-@@ -1708,6 +1713,79 @@ static int atmel_serial_resume(struct platform_device *pdev)
- #define atmel_serial_resume NULL
- #endif
-
-+#ifdef CONFIG_CPU_FREQ
-+static int atmel_serial_cpufreq_transition(struct notifier_block *nb,
-+ unsigned long val, void *data)
-+{
-+ struct atmel_uart_port *port;
-+ struct uart_port *uport;
-+
-+ port = container_of(nb, struct atmel_uart_port, freq_transition);
-+ uport = &port->uart;
-+
-+ /* try and work out if the baudrate is changing, we can detect
-+ * a change in rate, but we do not have support for detecting
-+ * a disturbance in the clock-rate over the change.
-+ */
-+
-+ if (IS_ERR(port->clk))
-+ goto exit;
-+
-+ if (val == CPUFREQ_PRECHANGE) {
-+ /* we should really shut the port down whilst the
-+ * frequency change is in progress. */
-+
-+ } else if (val == CPUFREQ_POSTCHANGE) {
-+ struct ktermios *termios;
-+ struct tty_struct *tty;
-+
-+ if (uport->state == NULL)
-+ goto exit;
-+
-+ tty = uport->state->port.tty;
-+
-+ if (tty == NULL)
-+ goto exit;
-+
-+ termios = tty->termios;
-+
-+ if (termios == NULL) {
-+ printk(KERN_WARNING "%s: no termios?\n", __func__);
-+ goto exit;
-+ }
-+ uport->uartclk = clk_get_rate(port->clk);
-+ atmel_set_termios(uport, termios, NULL);
-+ }
-+ return NOTIFY_OK;
-+
-+ exit:
-+ return NOTIFY_BAD;
-+}
-+
-+static inline int atmel_serial_cpufreq_register(struct atmel_uart_port *port)
-+{
-+ port->freq_transition.notifier_call = atmel_serial_cpufreq_transition;
-+
-+ return cpufreq_register_notifier(&port->freq_transition,
-+ CPUFREQ_TRANSITION_NOTIFIER);
-+}
-+
-+static inline void atmel_serial_cpufreq_deregister(struct atmel_uart_port *port)
-+{
-+ cpufreq_unregister_notifier(&port->freq_transition,
-+ CPUFREQ_TRANSITION_NOTIFIER);
-+}
-+#else
-+static inline int atmel_serial_cpufreq_register(struct atmel_uart_port *port)
-+{
-+ return 0;
-+}
-+
-+static inline void atmel_serial_cpufreq_deregister(struct atmel_uart_port *port)
-+{
-+}
-+#endif
-+
- static int __devinit atmel_serial_probe(struct platform_device *pdev)
- {
- struct atmel_uart_port *port;
-@@ -1746,6 +1824,10 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
- }
- #endif
-
-+ ret = atmel_serial_cpufreq_register(port);
-+ if (ret < 0)
-+ dev_err(&pdev->dev, "failed to add cpufreq notifier\n");
-+
- device_init_wakeup(&pdev->dev, 1);
- platform_set_drvdata(pdev, port);
-
-@@ -1778,6 +1860,7 @@ static int __devexit atmel_serial_remove(struct platform_device *pdev)
- platform_set_drvdata(pdev, NULL);
-
- ret = uart_remove_one_port(&atmel_uart, port);
-+ atmel_serial_cpufreq_deregister(atmel_port);
-
- tasklet_kill(&atmel_port->tasklet);
- kfree(atmel_port->rx_ring.buf);
---
-1.7.4.1
-
diff --git a/lab-data/powermgt/usage/data/0003-macb-adaptations-for-cpufreq-support.patch b/lab-data/powermgt/usage/data/0003-macb-adaptations-for-cpufreq-support.patch
deleted file mode 100644
index 834145f..0000000
--- a/lab-data/powermgt/usage/data/0003-macb-adaptations-for-cpufreq-support.patch
+++ /dev/null
@@ -1,233 +0,0 @@
-From a27be52e1841fca908fd9aa6ef45707813762ecf Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-Date: Thu, 17 Nov 2011 21:58:09 +0100
-Subject: [PATCH 3/3] macb: adaptations for cpufreq support
-
-Work initially done by Albin Tonnerre
-<albin.tonnerre at free-electrons.com>.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
----
- drivers/net/macb.c | 138 ++++++++++++++++++++++++++++++++++++++--------------
- drivers/net/macb.h | 3 +
- 2 files changed, 105 insertions(+), 36 deletions(-)
-
-diff --git a/drivers/net/macb.c b/drivers/net/macb.c
-index dc4e305..31c28b1 100644
---- a/drivers/net/macb.c
-+++ b/drivers/net/macb.c
-@@ -21,6 +21,7 @@
- #include <linux/dma-mapping.h>
- #include <linux/platform_device.h>
- #include <linux/phy.h>
-+#include <linux/cpufreq.h>
-
- #include <mach/board.h>
- #include <mach/cpu.h>
-@@ -222,7 +223,6 @@ static int macb_mii_probe(struct net_device *dev)
- bp->speed = 0;
- bp->duplex = -1;
- bp->phy_dev = phydev;
--
- return 0;
- }
-
-@@ -1117,6 +1117,100 @@ static const struct net_device_ops macb_netdev_ops = {
- #endif
- };
-
-+/* Set MII management clock divider */
-+static void macb_set_mii_clkdiv(struct macb *bp)
-+{
-+ unsigned long pclk_hz;
-+ u32 config, ncfgr;
-+
-+ ncfgr = macb_readl(bp, NCFGR);
-+ pclk_hz = clk_get_rate(bp->pclk);
-+
-+ if (pclk_hz <= 20000000)
-+ config = MACB_BF(CLK, MACB_CLK_DIV8);
-+ else if (pclk_hz <= 40000000)
-+ config = MACB_BF(CLK, MACB_CLK_DIV16);
-+ else if (pclk_hz <= 80000000)
-+ config = MACB_BF(CLK, MACB_CLK_DIV32);
-+ else
-+ config = MACB_BF(CLK, MACB_CLK_DIV64);
-+
-+ ncfgr = MACB_BFINS(CLK, config, ncfgr);
-+ macb_writel(bp, NCFGR, ncfgr);
-+}
-+
-+#if defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ)
-+static int _macb_suspend(struct platform_device *pdev)
-+{
-+ struct net_device *netdev = platform_get_drvdata(pdev);
-+ struct macb *bp = netdev_priv(netdev);
-+
-+ netif_device_detach(netdev);
-+
-+#ifndef CONFIG_ARCH_AT91
-+ clk_disable(bp->hclk);
-+#endif
-+ clk_disable(bp->pclk);
-+
-+ return 0;
-+}
-+
-+static int _macb_resume(struct platform_device *pdev)
-+{
-+ struct net_device *netdev = platform_get_drvdata(pdev);
-+ struct macb *bp = netdev_priv(netdev);
-+
-+ clk_enable(bp->pclk);
-+#ifndef CONFIG_ARCH_AT91
-+ clk_enable(bp->hclk);
-+#endif
-+
-+ netif_device_attach(netdev);
-+
-+ return 0;
-+}
-+#endif
-+
-+#ifdef CONFIG_CPU_FREQ
-+static int macb_cpufreq_transition(struct notifier_block *nb,
-+ unsigned long val, void *data)
-+{
-+ struct macb *bp = container_of(nb, struct macb, freq_transition);
-+
-+ /* Ugly, but necessary if we don't want to lose the connection */
-+ if (val == CPUFREQ_PRECHANGE) {
-+ _macb_suspend(bp->pdev);
-+ } else if (val == CPUFREQ_POSTCHANGE) {
-+ macb_set_mii_clkdiv(bp);
-+ _macb_resume(bp->pdev);
-+ }
-+ return NOTIFY_OK;
-+}
-+
-+static inline int macb_cpufreq_register(struct macb *bp)
-+{
-+ bp->freq_transition.notifier_call = macb_cpufreq_transition;
-+
-+ return cpufreq_register_notifier(&bp->freq_transition,
-+ CPUFREQ_TRANSITION_NOTIFIER);
-+}
-+
-+static inline void macb_cpufreq_deregister(struct macb *bp)
-+{
-+ cpufreq_unregister_notifier(&bp->freq_transition,
-+ CPUFREQ_TRANSITION_NOTIFIER);
-+}
-+#else
-+static inline int macb_cpufreq_register(struct macb *bp)
-+{
-+ return 0;
-+}
-+
-+static inline void macb_cpufreq_deregister(struct macb *bp)
-+{
-+}
-+#endif
-+
- static int __init macb_probe(struct platform_device *pdev)
- {
- struct eth_platform_data *pdata;
-@@ -1124,8 +1218,6 @@ static int __init macb_probe(struct platform_device *pdev)
- struct net_device *dev;
- struct macb *bp;
- struct phy_device *phydev;
-- unsigned long pclk_hz;
-- u32 config;
- int err = -ENXIO;
-
- regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-@@ -1197,17 +1289,7 @@ static int __init macb_probe(struct platform_device *pdev)
-
- dev->base_addr = regs->start;
-
-- /* Set MII management clock divider */
-- pclk_hz = clk_get_rate(bp->pclk);
-- if (pclk_hz <= 20000000)
-- config = MACB_BF(CLK, MACB_CLK_DIV8);
-- else if (pclk_hz <= 40000000)
-- config = MACB_BF(CLK, MACB_CLK_DIV16);
-- else if (pclk_hz <= 80000000)
-- config = MACB_BF(CLK, MACB_CLK_DIV32);
-- else
-- config = MACB_BF(CLK, MACB_CLK_DIV64);
-- macb_writel(bp, NCFGR, config);
-+ macb_set_mii_clkdiv(bp);
-
- macb_get_hwaddr(bp);
- pdata = pdev->dev.platform_data;
-@@ -1247,6 +1329,9 @@ static int __init macb_probe(struct platform_device *pdev)
- "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
- phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
-
-+ if(macb_cpufreq_register(bp) < 0)
-+ dev_err(&pdev->dev, "failed to add cpufreq notifier\n");
-+
- return 0;
-
- err_out_unregister_netdev:
-@@ -1281,6 +1366,7 @@ static int __exit macb_remove(struct platform_device *pdev)
-
- if (dev) {
- bp = netdev_priv(dev);
-+ macb_cpufreq_deregister(bp);
- if (bp->phy_dev)
- phy_disconnect(bp->phy_dev);
- mdiobus_unregister(bp->mii_bus);
-@@ -1305,32 +1391,12 @@ static int __exit macb_remove(struct platform_device *pdev)
- #ifdef CONFIG_PM
- static int macb_suspend(struct platform_device *pdev, pm_message_t state)
- {
-- struct net_device *netdev = platform_get_drvdata(pdev);
-- struct macb *bp = netdev_priv(netdev);
--
-- netif_device_detach(netdev);
--
--#ifndef CONFIG_ARCH_AT91
-- clk_disable(bp->hclk);
--#endif
-- clk_disable(bp->pclk);
--
-- return 0;
-+ return _macb_suspend(pdev);
- }
-
- static int macb_resume(struct platform_device *pdev)
- {
-- struct net_device *netdev = platform_get_drvdata(pdev);
-- struct macb *bp = netdev_priv(netdev);
--
-- clk_enable(bp->pclk);
--#ifndef CONFIG_ARCH_AT91
-- clk_enable(bp->hclk);
--#endif
--
-- netif_device_attach(netdev);
--
-- return 0;
-+ return _macb_resume(pdev);
- }
- #else
- #define macb_suspend NULL
-diff --git a/drivers/net/macb.h b/drivers/net/macb.h
-index d3212f6..c6b00cb 100644
---- a/drivers/net/macb.h
-+++ b/drivers/net/macb.h
-@@ -389,6 +389,9 @@ struct macb {
- unsigned int link;
- unsigned int speed;
- unsigned int duplex;
-+#ifdef CONFIG_CPU_FREQ
-+ struct notifier_block freq_transition;
-+#endif
- };
-
- #endif /* _MACB_H */
---
-1.7.4.1
-
More information about the training-materials-updates
mailing list