From 937b6c47c159f7ed6431c1e8c7a6a762138d6808 Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 8 May 2008 07:18:51 +0000 Subject: bump ifxmips to 2.6.25.1 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11071 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ifxmips/files/arch/mips/ifxmips/dma-core.c | 2 +- .../linux/ifxmips/files/arch/mips/ifxmips/prom.c | 1 - .../linux/ifxmips/files/arch/mips/ifxmips/setup.c | 29 +- .../files/drivers/char/watchdog/ifxmips_wdt.c | 325 --------------------- .../ifxmips/files/drivers/watchdog/ifxmips_wdt.c | 325 +++++++++++++++++++++ .../files/include/asm-mips/mach-ifxmips/war.h | 24 ++ 6 files changed, 352 insertions(+), 354 deletions(-) delete mode 100644 target/linux/ifxmips/files/drivers/char/watchdog/ifxmips_wdt.c create mode 100644 target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c create mode 100644 target/linux/ifxmips/files/include/asm-mips/mach-ifxmips/war.h (limited to 'target/linux/ifxmips/files') diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/dma-core.c b/target/linux/ifxmips/files/arch/mips/ifxmips/dma-core.c index f2bbb3446..1c97b16eb 100644 --- a/target/linux/ifxmips/files/arch/mips/ifxmips/dma-core.c +++ b/target/linux/ifxmips/files/arch/mips/ifxmips/dma-core.c @@ -602,7 +602,7 @@ map_dma_chan(_dma_chan_map *map) for (i = 0; i < MAX_DMA_CHANNEL_NUM; i++) { dma_chan[i].irq = map[i].irq; - result = request_irq(dma_chan[i].irq, dma_interrupt, SA_INTERRUPT, "dma-core", (void*)&dma_chan[i]); + result = request_irq(dma_chan[i].irq, dma_interrupt, IRQF_DISABLED, "dma-core", (void*)&dma_chan[i]); if (result) { printk("error, cannot get dma_irq!\n"); diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c b/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c index 514c879df..d3009e443 100644 --- a/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c +++ b/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c @@ -67,7 +67,6 @@ prom_printf (const char * fmt, ...) void __init prom_init(void) { - mips_machgroup = MACH_GROUP_IFXMIPS; mips_machtype = MACH_INFINEON_IFXMIPS; strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/etc/preinit"); diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c b/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c index 4c25b585f..ade78d1bf 100644 --- a/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c +++ b/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c @@ -114,28 +114,9 @@ ifxmips_be_handler(struct pt_regs *regs, int is_fixup) return MIPS_BE_FATAL; } -/* ISR GPTU Timer 6 for high resolution timer */ -static irqreturn_t -ifxmips_timer6_interrupt(int irq, void *dev_id) -{ - timer_interrupt(IFXMIPS_TIMER6_INT, NULL); - - return IRQ_HANDLED; -} - -static struct irqaction hrt_irqaction = { - .handler = ifxmips_timer6_interrupt, - .flags = IRQF_DISABLED, - .name = "hrt", -}; - void __init -plat_timer_setup (struct irqaction *irq) +plat_time_init (void) { - unsigned int retval; - - setup_irq(MIPS_CPU_TIMER_IRQ, irq); - r4k_cur = (read_c0_count() + r4k_offset); write_c0_compare(r4k_cur); @@ -145,17 +126,11 @@ plat_timer_setup (struct irqaction *irq) writel(0xffff, IFXMIPS_GPTU_GPT_CAPREL); writel(0x80C0, IFXMIPS_GPTU_GPT_T6CON); - - //retval = setup_irq(IFXMIPS_TIMER6_INT, &hrt_irqaction); - - if (retval) - { - prom_printf("reqeust_irq failed %d. HIGH_RES_TIMER is diabled\n", IFXMIPS_TIMER6_INT); - } } extern const char* get_system_type (void); +void (*board_time_init)(void); void __init plat_mem_setup (void) { diff --git a/target/linux/ifxmips/files/drivers/char/watchdog/ifxmips_wdt.c b/target/linux/ifxmips/files/drivers/char/watchdog/ifxmips_wdt.c deleted file mode 100644 index d631f4aac..000000000 --- a/target/linux/ifxmips/files/drivers/char/watchdog/ifxmips_wdt.c +++ /dev/null @@ -1,325 +0,0 @@ -/* - * 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) 2006 infineon - * Copyright (C) 2007 John Crispin - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DRVNAME "ifxmips_wdt" - -// TODO remove magic numbers and weirdo macros -extern unsigned int ifxmips_get_fpi_hz (void); - -static int ifxmips_wdt_inuse = 0; -static int ifxmips_wdt_major = 0; - -int -ifxmips_wdt_enable (unsigned int timeout) -{ - unsigned int wdt_cr = 0; - unsigned int wdt_reload = 0; - unsigned int wdt_clkdiv, wdt_pwl, ffpi; - int retval = 0; - - /* clock divider & prewarning limit */ - wdt_clkdiv = 1 << (7 * IFXMIPS_BIU_WDT_CR_CLKDIV_GET(readl(IFXMIPS_BIU_WDT_CR))); - wdt_pwl = 0x8000 >> IFXMIPS_BIU_WDT_CR_PWL_GET(readl(IFXMIPS_BIU_WDT_CR)); - - //TODO - printk("WARNING FUNCTION CALL MISSING!!!"); - //ffpi = cgu_get_io_region_clock(); - printk("cpu clock = %d\n", ffpi); - - /* caculate reload value */ - wdt_reload = (timeout * (ffpi / wdt_clkdiv)) + wdt_pwl; - - printk(KERN_WARNING DRVNAME ": wdt_pwl=0x%x, wdt_clkdiv=%d, ffpi=%d, wdt_reload = 0x%x\n", - wdt_pwl, wdt_clkdiv, ffpi, wdt_reload); - - if (wdt_reload > 0xFFFF) - { - printk(KERN_WARNING DRVNAME ": timeout too large %d\n", timeout); - retval = -EINVAL; - goto out; - } - - /* Write first part of password access */ - writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); - - wdt_cr = readl(IFXMIPS_BIU_WDT_CR); - wdt_cr &= (!IFXMIPS_BIU_WDT_CR_PW_SET(0xff) & - !IFXMIPS_BIU_WDT_CR_PWL_SET(0x3) & - !IFXMIPS_BIU_WDT_CR_CLKDIV_SET(0x3) & - !IFXMIPS_BIU_WDT_CR_RELOAD_SET(0xffff)); - - wdt_cr |= (IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2) | - IFXMIPS_BIU_WDT_CR_PWL_SET(IFXMIPS_BIU_WDT_CR_PWL_GET(readl(IFXMIPS_BIU_WDT_CR))) | - IFXMIPS_BIU_WDT_CR_CLKDIV_SET(IFXMIPS_BIU_WDT_CR_CLKDIV_GET(readl(IFXMIPS_BIU_WDT_CR))) | - IFXMIPS_BIU_WDT_CR_RELOAD_SET(wdt_reload) | - IFXMIPS_BIU_WDT_CR_GEN); - - writel(wdt_cr, IFXMIPS_BIU_WDT_CR); - - printk("watchdog enabled\n"); - -out: - return retval; -} - -void -ifxmips_wdt_disable (void) -{ - writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); - writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2), IFXMIPS_BIU_WDT_CR); - - printk("watchdog disabled\n"); -} - -/* passed LPEN or DSEN */ -void -ifxmips_wdt_enable_feature (int en, int type) -{ - unsigned int wdt_cr = 0; - - writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); - - wdt_cr = readl(IFXMIPS_BIU_WDT_CR); - - if (en) - { - wdt_cr &= (~IFXMIPS_BIU_WDT_CR_PW_SET(0xff)); - wdt_cr |= (IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2) | type); - } else { - wdt_cr &= (~IFXMIPS_BIU_WDT_CR_PW_SET(0xff) & ~type); - wdt_cr |= IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2); - } - - writel(wdt_cr, IFXMIPS_BIU_WDT_CR); -} - -void -ifxmips_wdt_prewarning_limit (int pwl) -{ - unsigned int wdt_cr = 0; - - wdt_cr = readl(IFXMIPS_BIU_WDT_CR); - writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); - - wdt_cr &= 0xf300ffff; - wdt_cr |= (IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2) | IFXMIPS_BIU_WDT_CR_PWL_SET(pwl)); - - /* Set reload value in second password access */ - writel(wdt_cr, IFXMIPS_BIU_WDT_CR); -} - -void -ifxmips_wdt_set_clkdiv (int clkdiv) -{ - unsigned int wdt_cr = 0; - - wdt_cr = readl(IFXMIPS_BIU_WDT_CR); - writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); - - wdt_cr &= 0xfc00ffff; - wdt_cr |= (IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2) | IFXMIPS_BIU_WDT_CR_CLKDIV_SET(clkdiv)); - - /* Set reload value in second password access */ - writel(wdt_cr, IFXMIPS_BIU_WDT_CR); -} - -static int -ifxmips_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg) -{ - int result = 0; - static int timeout = -1; - unsigned int user_arg; - - if ((cmd != IFXMIPS_WDT_IOC_STOP) && (cmd != IFXMIPS_WDT_IOC_PING) && (cmd != IFXMIPS_WDT_IOC_GET_STATUS)) - { - if (copy_from_user((void *) &user_arg, (void *) arg, sizeof (int))){ - result = -EINVAL; - goto out; - } - } - - switch (cmd) - { - case IFXMIPS_WDT_IOC_START: - if ((result = ifxmips_wdt_enable(user_arg)) < 0) - timeout = -1; - else - timeout = user_arg; - break; - - case IFXMIPS_WDT_IOC_STOP: - printk(KERN_INFO DRVNAME ": disable watch dog timer\n"); - ifxmips_wdt_disable(); - break; - - case IFXMIPS_WDT_IOC_PING: - if (timeout < 0) - result = -EIO; - else - result = ifxmips_wdt_enable(timeout); - break; - - case IFXMIPS_WDT_IOC_GET_STATUS: - user_arg = readl(IFXMIPS_BIU_WDT_SR); - copy_to_user((int*)arg, (int*)&user_arg, sizeof(int)); - break; - - case IFXMIPS_WDT_IOC_SET_PWL: - ifxmips_wdt_prewarning_limit(user_arg); - break; - - case IFXMIPS_WDT_IOC_SET_DSEN: - ifxmips_wdt_enable_feature(user_arg, IFXMIPS_BIU_WDT_CR_DSEN); - break; - - case IFXMIPS_WDT_IOC_SET_LPEN: - ifxmips_wdt_enable_feature(user_arg, IFXMIPS_BIU_WDT_CR_LPEN); - break; - - case IFXMIPS_WDT_IOC_SET_CLKDIV: - ifxmips_wdt_set_clkdiv(user_arg); - break; - - default: - printk(KERN_WARNING DRVNAME ": unknown watchdog iotcl\n"); - } - -out: - return result; -} - -static int -ifxmips_wdt_open (struct inode *inode, struct file *file) -{ - if (ifxmips_wdt_inuse) - return -EBUSY; - - ifxmips_wdt_inuse = 1; - - return 0; -} - -static int -ifxmips_wdt_release (struct inode *inode, struct file *file) -{ - ifxmips_wdt_inuse = 0; - - return 0; -} - -int -ifxmips_wdt_register_proc_read (char *buf, char **start, off_t offset, int count, - int *eof, void *data) -{ - int len = 0; - - len += sprintf (buf + len, "IFXMIPS_BIU_WDT_PROC_READ\n"); - len += sprintf (buf + len, "IFXMIPS_BIU_WDT_CR(0x%08x) : 0x%08x\n", - (unsigned int)IFXMIPS_BIU_WDT_CR, readl(IFXMIPS_BIU_WDT_CR)); - len += sprintf (buf + len, "IFXMIPS_BIU_WDT_SR(0x%08x) : 0x%08x\n", - (unsigned int)IFXMIPS_BIU_WDT_SR, readl(IFXMIPS_BIU_WDT_SR)); - - *eof = 1; - - return len; -} - -static const struct file_operations ifxmips_wdt_fops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .ioctl = ifxmips_wdt_ioctl, - .open = ifxmips_wdt_open, - .release = ifxmips_wdt_release, -// .write = at91_wdt_write, -}; - -static struct miscdevice ifxmips_wdt_miscdev = { - .minor = WATCHDOG_MINOR, - .name = "ifxmips_wdt", - .fops = &ifxmips_wdt_fops, -}; - - -static int -ifxmips_wdt_probe (struct platform_device *pdev) -{ - int ret = misc_register(&ifxmips_wdt_miscdev); - if (ret) - return ret; - - create_proc_read_entry(DRVNAME, 0, NULL, ifxmips_wdt_register_proc_read, NULL); - - printk(KERN_INFO DRVNAME ": ifxmips watchdog loaded\n"); - - return 0; -} - -static int -ifxmips_wdt_remove (struct platform_device *pdev) -{ - misc_deregister(&ifxmips_wdt_miscdev); - remove_proc_entry(DRVNAME, NULL); - return 0; -} - -static struct -platform_driver ifxmips_wdt_driver = { - .probe = ifxmips_wdt_probe, - .remove = ifxmips_wdt_remove, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - }, -}; - -int __init -ifxmips_wdt_init_module (void) -{ - int ret = platform_driver_register(&ifxmips_wdt_driver); - if (ret) - printk(KERN_INFO DRVNAME ": Error registering platfom driver!"); - return ret; -} - -void -ifxmips_wdt_cleanup_module (void) -{ - platform_driver_unregister(&ifxmips_wdt_driver); -} - -module_init(ifxmips_wdt_init_module); -module_exit(ifxmips_wdt_cleanup_module); - -MODULE_AUTHOR("John Crispin "); -MODULE_DESCRIPTION("Watchdog driver for infineon ifxmips family"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); diff --git a/target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c b/target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c new file mode 100644 index 000000000..d631f4aac --- /dev/null +++ b/target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c @@ -0,0 +1,325 @@ +/* + * 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) 2006 infineon + * Copyright (C) 2007 John Crispin + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "ifxmips_wdt" + +// TODO remove magic numbers and weirdo macros +extern unsigned int ifxmips_get_fpi_hz (void); + +static int ifxmips_wdt_inuse = 0; +static int ifxmips_wdt_major = 0; + +int +ifxmips_wdt_enable (unsigned int timeout) +{ + unsigned int wdt_cr = 0; + unsigned int wdt_reload = 0; + unsigned int wdt_clkdiv, wdt_pwl, ffpi; + int retval = 0; + + /* clock divider & prewarning limit */ + wdt_clkdiv = 1 << (7 * IFXMIPS_BIU_WDT_CR_CLKDIV_GET(readl(IFXMIPS_BIU_WDT_CR))); + wdt_pwl = 0x8000 >> IFXMIPS_BIU_WDT_CR_PWL_GET(readl(IFXMIPS_BIU_WDT_CR)); + + //TODO + printk("WARNING FUNCTION CALL MISSING!!!"); + //ffpi = cgu_get_io_region_clock(); + printk("cpu clock = %d\n", ffpi); + + /* caculate reload value */ + wdt_reload = (timeout * (ffpi / wdt_clkdiv)) + wdt_pwl; + + printk(KERN_WARNING DRVNAME ": wdt_pwl=0x%x, wdt_clkdiv=%d, ffpi=%d, wdt_reload = 0x%x\n", + wdt_pwl, wdt_clkdiv, ffpi, wdt_reload); + + if (wdt_reload > 0xFFFF) + { + printk(KERN_WARNING DRVNAME ": timeout too large %d\n", timeout); + retval = -EINVAL; + goto out; + } + + /* Write first part of password access */ + writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); + + wdt_cr = readl(IFXMIPS_BIU_WDT_CR); + wdt_cr &= (!IFXMIPS_BIU_WDT_CR_PW_SET(0xff) & + !IFXMIPS_BIU_WDT_CR_PWL_SET(0x3) & + !IFXMIPS_BIU_WDT_CR_CLKDIV_SET(0x3) & + !IFXMIPS_BIU_WDT_CR_RELOAD_SET(0xffff)); + + wdt_cr |= (IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2) | + IFXMIPS_BIU_WDT_CR_PWL_SET(IFXMIPS_BIU_WDT_CR_PWL_GET(readl(IFXMIPS_BIU_WDT_CR))) | + IFXMIPS_BIU_WDT_CR_CLKDIV_SET(IFXMIPS_BIU_WDT_CR_CLKDIV_GET(readl(IFXMIPS_BIU_WDT_CR))) | + IFXMIPS_BIU_WDT_CR_RELOAD_SET(wdt_reload) | + IFXMIPS_BIU_WDT_CR_GEN); + + writel(wdt_cr, IFXMIPS_BIU_WDT_CR); + + printk("watchdog enabled\n"); + +out: + return retval; +} + +void +ifxmips_wdt_disable (void) +{ + writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); + writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2), IFXMIPS_BIU_WDT_CR); + + printk("watchdog disabled\n"); +} + +/* passed LPEN or DSEN */ +void +ifxmips_wdt_enable_feature (int en, int type) +{ + unsigned int wdt_cr = 0; + + writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); + + wdt_cr = readl(IFXMIPS_BIU_WDT_CR); + + if (en) + { + wdt_cr &= (~IFXMIPS_BIU_WDT_CR_PW_SET(0xff)); + wdt_cr |= (IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2) | type); + } else { + wdt_cr &= (~IFXMIPS_BIU_WDT_CR_PW_SET(0xff) & ~type); + wdt_cr |= IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2); + } + + writel(wdt_cr, IFXMIPS_BIU_WDT_CR); +} + +void +ifxmips_wdt_prewarning_limit (int pwl) +{ + unsigned int wdt_cr = 0; + + wdt_cr = readl(IFXMIPS_BIU_WDT_CR); + writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); + + wdt_cr &= 0xf300ffff; + wdt_cr |= (IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2) | IFXMIPS_BIU_WDT_CR_PWL_SET(pwl)); + + /* Set reload value in second password access */ + writel(wdt_cr, IFXMIPS_BIU_WDT_CR); +} + +void +ifxmips_wdt_set_clkdiv (int clkdiv) +{ + unsigned int wdt_cr = 0; + + wdt_cr = readl(IFXMIPS_BIU_WDT_CR); + writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR); + + wdt_cr &= 0xfc00ffff; + wdt_cr |= (IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW2) | IFXMIPS_BIU_WDT_CR_CLKDIV_SET(clkdiv)); + + /* Set reload value in second password access */ + writel(wdt_cr, IFXMIPS_BIU_WDT_CR); +} + +static int +ifxmips_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) +{ + int result = 0; + static int timeout = -1; + unsigned int user_arg; + + if ((cmd != IFXMIPS_WDT_IOC_STOP) && (cmd != IFXMIPS_WDT_IOC_PING) && (cmd != IFXMIPS_WDT_IOC_GET_STATUS)) + { + if (copy_from_user((void *) &user_arg, (void *) arg, sizeof (int))){ + result = -EINVAL; + goto out; + } + } + + switch (cmd) + { + case IFXMIPS_WDT_IOC_START: + if ((result = ifxmips_wdt_enable(user_arg)) < 0) + timeout = -1; + else + timeout = user_arg; + break; + + case IFXMIPS_WDT_IOC_STOP: + printk(KERN_INFO DRVNAME ": disable watch dog timer\n"); + ifxmips_wdt_disable(); + break; + + case IFXMIPS_WDT_IOC_PING: + if (timeout < 0) + result = -EIO; + else + result = ifxmips_wdt_enable(timeout); + break; + + case IFXMIPS_WDT_IOC_GET_STATUS: + user_arg = readl(IFXMIPS_BIU_WDT_SR); + copy_to_user((int*)arg, (int*)&user_arg, sizeof(int)); + break; + + case IFXMIPS_WDT_IOC_SET_PWL: + ifxmips_wdt_prewarning_limit(user_arg); + break; + + case IFXMIPS_WDT_IOC_SET_DSEN: + ifxmips_wdt_enable_feature(user_arg, IFXMIPS_BIU_WDT_CR_DSEN); + break; + + case IFXMIPS_WDT_IOC_SET_LPEN: + ifxmips_wdt_enable_feature(user_arg, IFXMIPS_BIU_WDT_CR_LPEN); + break; + + case IFXMIPS_WDT_IOC_SET_CLKDIV: + ifxmips_wdt_set_clkdiv(user_arg); + break; + + default: + printk(KERN_WARNING DRVNAME ": unknown watchdog iotcl\n"); + } + +out: + return result; +} + +static int +ifxmips_wdt_open (struct inode *inode, struct file *file) +{ + if (ifxmips_wdt_inuse) + return -EBUSY; + + ifxmips_wdt_inuse = 1; + + return 0; +} + +static int +ifxmips_wdt_release (struct inode *inode, struct file *file) +{ + ifxmips_wdt_inuse = 0; + + return 0; +} + +int +ifxmips_wdt_register_proc_read (char *buf, char **start, off_t offset, int count, + int *eof, void *data) +{ + int len = 0; + + len += sprintf (buf + len, "IFXMIPS_BIU_WDT_PROC_READ\n"); + len += sprintf (buf + len, "IFXMIPS_BIU_WDT_CR(0x%08x) : 0x%08x\n", + (unsigned int)IFXMIPS_BIU_WDT_CR, readl(IFXMIPS_BIU_WDT_CR)); + len += sprintf (buf + len, "IFXMIPS_BIU_WDT_SR(0x%08x) : 0x%08x\n", + (unsigned int)IFXMIPS_BIU_WDT_SR, readl(IFXMIPS_BIU_WDT_SR)); + + *eof = 1; + + return len; +} + +static const struct file_operations ifxmips_wdt_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .ioctl = ifxmips_wdt_ioctl, + .open = ifxmips_wdt_open, + .release = ifxmips_wdt_release, +// .write = at91_wdt_write, +}; + +static struct miscdevice ifxmips_wdt_miscdev = { + .minor = WATCHDOG_MINOR, + .name = "ifxmips_wdt", + .fops = &ifxmips_wdt_fops, +}; + + +static int +ifxmips_wdt_probe (struct platform_device *pdev) +{ + int ret = misc_register(&ifxmips_wdt_miscdev); + if (ret) + return ret; + + create_proc_read_entry(DRVNAME, 0, NULL, ifxmips_wdt_register_proc_read, NULL); + + printk(KERN_INFO DRVNAME ": ifxmips watchdog loaded\n"); + + return 0; +} + +static int +ifxmips_wdt_remove (struct platform_device *pdev) +{ + misc_deregister(&ifxmips_wdt_miscdev); + remove_proc_entry(DRVNAME, NULL); + return 0; +} + +static struct +platform_driver ifxmips_wdt_driver = { + .probe = ifxmips_wdt_probe, + .remove = ifxmips_wdt_remove, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +int __init +ifxmips_wdt_init_module (void) +{ + int ret = platform_driver_register(&ifxmips_wdt_driver); + if (ret) + printk(KERN_INFO DRVNAME ": Error registering platfom driver!"); + return ret; +} + +void +ifxmips_wdt_cleanup_module (void) +{ + platform_driver_unregister(&ifxmips_wdt_driver); +} + +module_init(ifxmips_wdt_init_module); +module_exit(ifxmips_wdt_cleanup_module); + +MODULE_AUTHOR("John Crispin "); +MODULE_DESCRIPTION("Watchdog driver for infineon ifxmips family"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); diff --git a/target/linux/ifxmips/files/include/asm-mips/mach-ifxmips/war.h b/target/linux/ifxmips/files/include/asm-mips/mach-ifxmips/war.h new file mode 100644 index 000000000..de3584ecf --- /dev/null +++ b/target/linux/ifxmips/files/include/asm-mips/mach-ifxmips/war.h @@ -0,0 +1,24 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ +#ifndef __ASM_MIPS_MACH_IFXMIPS_WAR_H +#define __ASM_MIPS_MACH_IFXMIPS_WAR_H + +#define R4600_V1_INDEX_ICACHEOP_WAR 0 +#define R4600_V1_HIT_CACHEOP_WAR 0 +#define R4600_V2_HIT_CACHEOP_WAR 0 +#define R5432_CP0_INTERRUPT_WAR 0 +#define BCM1250_M3_WAR 0 +#define SIBYTE_1956_WAR 0 +#define MIPS4K_ICACHE_REFILL_WAR 0 +#define MIPS_CACHE_SYNC_WAR 0 +#define TX49XX_ICACHE_INDEX_INV_WAR 0 +#define RM9000_CDEX_SMP_WAR 0 +#define ICACHE_REFILLS_WORKAROUND_WAR 0 +#define R10000_LLSC_WAR 0 +#define MIPS34K_MISSED_ITLB_WAR 0 + +#endif -- cgit v1.2.3