From 9f5ad54b69092d88862a9fc48f26384303368981 Mon Sep 17 00:00:00 2001 From: blogic Date: Fri, 14 Dec 2007 21:49:03 +0000 Subject: made the danube pmu f00 generic git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9759 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/danube/files/arch/mips/danube/dma-core.c | 3 +- target/linux/danube/files/arch/mips/danube/pmu.c | 45 ++++++++++++++++++++++ target/linux/danube/files/arch/mips/danube/setup.c | 3 +- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 target/linux/danube/files/arch/mips/danube/pmu.c (limited to 'target/linux/danube/files/arch') diff --git a/target/linux/danube/files/arch/mips/danube/dma-core.c b/target/linux/danube/files/arch/mips/danube/dma-core.c index d9520c550..7d29dbdc0 100644 --- a/target/linux/danube/files/arch/mips/danube/dma-core.c +++ b/target/linux/danube/files/arch/mips/danube/dma-core.c @@ -22,6 +22,7 @@ #include #include #include +#include /*25 descriptors for each dma channel,4096/8/20=25.xx*/ #define DANUBE_DMA_DESCRIPTOR_OFFSET 25 @@ -684,7 +685,7 @@ dma_chip_init(void) int i; // enable DMA from PMU - writel(readl(DANUBE_PMU_PWDCR) & ~DANUBE_PMU_PWDCR_DMA, DANUBE_PMU_PWDCR); + danube_pmu_enable(DANUBE_PMU_PWDCR_DMA); // reset DMA writel(readl(DANUBE_DMA_CTRL) | 1, DANUBE_DMA_CTRL); diff --git a/target/linux/danube/files/arch/mips/danube/pmu.c b/target/linux/danube/files/arch/mips/danube/pmu.c new file mode 100644 index 000000000..5bb66dbe5 --- /dev/null +++ b/target/linux/danube/files/arch/mips/danube/pmu.c @@ -0,0 +1,45 @@ +/* + * arch/mips/danube/pmu.c + * + * 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. + * + * Copyright (C) 2007 John Crispin + * + */ + +#include +#include +#include +#include + +void +danube_pmu_enable (unsigned int module) +{ + int err = 1000000; + + writel(readl(DANUBE_PMU_PWDCR) & ~module, DANUBE_PMU_PWDCR); + while (--err && (readl(DANUBE_PMU_PWDSR) & module)) {} + + if (!err) + panic("activating PMU module failed!"); +} +EXPORT_SYMBOL(danube_pmu_enable); + +void +danube_pmu_disable (unsigned int module) +{ + writel(readl(DANUBE_PMU_PWDCR) | module, DANUBE_PMU_PWDCR); +} +EXPORT_SYMBOL(danube_pmu_disable); diff --git a/target/linux/danube/files/arch/mips/danube/setup.c b/target/linux/danube/files/arch/mips/danube/setup.c index 7df1ed2ef..60b0ce28e 100644 --- a/target/linux/danube/files/arch/mips/danube/setup.c +++ b/target/linux/danube/files/arch/mips/danube/setup.c @@ -32,6 +32,7 @@ #include #include #include +#include static unsigned int r4k_offset; /* Amount to increment compare reg each time */ static unsigned int r4k_cur; /* What counter should be at next timer irq */ @@ -138,7 +139,7 @@ plat_timer_setup (struct irqaction *irq) r4k_cur = (read_c0_count() + r4k_offset); write_c0_compare(r4k_cur); - writel(readl(DANUBE_PMU_PWDCR) & ~(DANUBE_PMU_PWDCR_GPT|DANUBE_PMU_PWDCR_FPI), DANUBE_PMU_PWDCR); + danube_pmu_enable(DANUBE_PMU_PWDCR_GPT | DANUBE_PMU_PWDCR_FPI); writel(0x100, DANUBE_GPTU_GPT_CLC); -- cgit v1.2.3