mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
danube to ifxmips transition
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9825 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -53,13 +53,13 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <asm/danube/danube.h>
|
||||
#include <asm/danube/danube_irq.h>
|
||||
#include <asm/danube/ifx_ssc_defines.h>
|
||||
#include <asm/danube/ifx_ssc.h>
|
||||
#include <asm/ifxmips/ifxmips.h>
|
||||
#include <asm/ifxmips/ifxmips_irq.h>
|
||||
#include <asm/ifxmips/ifx_ssc_defines.h>
|
||||
#include <asm/ifxmips/ifx_ssc.h>
|
||||
|
||||
/* allow the user to set the major device number */
|
||||
static int danube_eeprom_maj = 0;
|
||||
static int ifxmips_eeprom_maj = 0;
|
||||
|
||||
extern int ifx_ssc_init (void);
|
||||
extern int ifx_ssc_open (struct inode *inode, struct file *filp);
|
||||
@@ -299,26 +299,26 @@ out:
|
||||
}
|
||||
|
||||
int
|
||||
danube_eeprom_open (struct inode *inode, struct file *filp)
|
||||
ifxmips_eeprom_open (struct inode *inode, struct file *filp)
|
||||
{
|
||||
filp->f_pos = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
danube_eeprom_close (struct inode *inode, struct file *filp)
|
||||
ifxmips_eeprom_close (struct inode *inode, struct file *filp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
danube_eeprom_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data)
|
||||
ifxmips_eeprom_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
danube_eeprom_read (char *buf, size_t len, unsigned int addr)
|
||||
ifxmips_eeprom_read (char *buf, size_t len, unsigned int addr)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int data;
|
||||
@@ -335,7 +335,7 @@ danube_eeprom_read (char *buf, size_t len, unsigned int addr)
|
||||
|
||||
if ((ret = ifx_ssc_open((struct inode *) 0, NULL)))
|
||||
{
|
||||
printk("danube_eeprom_open fails\n");
|
||||
printk("ifxmips_eeprom_open fails\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -361,14 +361,14 @@ danube_eeprom_read (char *buf, size_t len, unsigned int addr)
|
||||
|
||||
out:
|
||||
if (ifx_ssc_close((struct inode *) 0, NULL))
|
||||
printk("danube_eeprom_close fails\n");
|
||||
printk("ifxmips_eeprom_close fails\n");
|
||||
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_eeprom_read);
|
||||
EXPORT_SYMBOL(ifxmips_eeprom_read);
|
||||
|
||||
static ssize_t
|
||||
danube_eeprom_fops_read (struct file *filp, char *ubuf, size_t len, loff_t * off)
|
||||
ifxmips_eeprom_fops_read (struct file *filp, char *ubuf, size_t len, loff_t * off)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned char ssc_rx_buf[EEPROM_SIZE];
|
||||
@@ -385,7 +385,7 @@ danube_eeprom_fops_read (struct file *filp, char *ubuf, size_t len, loff_t * off
|
||||
|
||||
local_irq_save(flag);
|
||||
|
||||
if ((ret = danube_eeprom_read(ssc_rx_buf, len, *off)) < 0)
|
||||
if ((ret = ifxmips_eeprom_read(ssc_rx_buf, len, *off)) < 0)
|
||||
{
|
||||
printk("read fails, err=%x\n", ret);
|
||||
local_irq_restore(flag);
|
||||
@@ -405,14 +405,14 @@ danube_eeprom_fops_read (struct file *filp, char *ubuf, size_t len, loff_t * off
|
||||
}
|
||||
|
||||
ssize_t
|
||||
danube_eeprom_write (char *buf, size_t len, unsigned int addr)
|
||||
ifxmips_eeprom_write (char *buf, size_t len, unsigned int addr)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int data;
|
||||
|
||||
if ((ret = ifx_ssc_open ((struct inode *) 0, NULL)))
|
||||
{
|
||||
printk ("danube_eeprom_open fails\n");
|
||||
printk ("ifxmips_eeprom_open fails\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -436,14 +436,14 @@ danube_eeprom_write (char *buf, size_t len, unsigned int addr)
|
||||
|
||||
out:
|
||||
if (ifx_ssc_close ((struct inode *) 0, NULL))
|
||||
printk ("danube_eeprom_close fails\n");
|
||||
printk ("ifxmips_eeprom_close fails\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_eeprom_write);
|
||||
EXPORT_SYMBOL(ifxmips_eeprom_write);
|
||||
|
||||
static ssize_t
|
||||
danube_eeprom_fops_write (struct file *filp, const char *ubuf, size_t len, loff_t * off)
|
||||
ifxmips_eeprom_fops_write (struct file *filp, const char *ubuf, size_t len, loff_t * off)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned char ssc_tx_buf[EEPROM_SIZE];
|
||||
@@ -457,7 +457,7 @@ danube_eeprom_fops_write (struct file *filp, const char *ubuf, size_t len, loff_
|
||||
if ((ret = copy_from_user (ssc_tx_buf, ubuf, len)))
|
||||
return EFAULT;
|
||||
|
||||
ret = danube_eeprom_write (ssc_tx_buf, len, *off);
|
||||
ret = ifxmips_eeprom_write (ssc_tx_buf, len, *off);
|
||||
|
||||
if (ret > 0)
|
||||
*off = ret;
|
||||
@@ -466,7 +466,7 @@ danube_eeprom_fops_write (struct file *filp, const char *ubuf, size_t len, loff_
|
||||
}
|
||||
|
||||
loff_t
|
||||
danube_eeprom_llseek (struct file * filp, loff_t off, int whence)
|
||||
ifxmips_eeprom_llseek (struct file * filp, loff_t off, int whence)
|
||||
{
|
||||
loff_t newpos;
|
||||
switch (whence) {
|
||||
@@ -490,24 +490,24 @@ danube_eeprom_llseek (struct file * filp, loff_t off, int whence)
|
||||
return newpos;
|
||||
}
|
||||
|
||||
static struct file_operations danube_eeprom_fops = {
|
||||
static struct file_operations ifxmips_eeprom_fops = {
|
||||
owner:THIS_MODULE,
|
||||
llseek:danube_eeprom_llseek,
|
||||
read:danube_eeprom_fops_read,
|
||||
write:danube_eeprom_fops_write,
|
||||
ioctl:danube_eeprom_ioctl,
|
||||
open:danube_eeprom_open,
|
||||
release:danube_eeprom_close,
|
||||
llseek:ifxmips_eeprom_llseek,
|
||||
read:ifxmips_eeprom_fops_read,
|
||||
write:ifxmips_eeprom_fops_write,
|
||||
ioctl:ifxmips_eeprom_ioctl,
|
||||
open:ifxmips_eeprom_open,
|
||||
release:ifxmips_eeprom_close,
|
||||
};
|
||||
|
||||
int __init
|
||||
danube_eeprom_init (void)
|
||||
ifxmips_eeprom_init (void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
danube_eeprom_maj = register_chrdev(0, "eeprom", &danube_eeprom_fops);
|
||||
ifxmips_eeprom_maj = register_chrdev(0, "eeprom", &ifxmips_eeprom_fops);
|
||||
|
||||
if (danube_eeprom_maj < 0)
|
||||
if (ifxmips_eeprom_maj < 0)
|
||||
{
|
||||
printk("failed to register eeprom device\n");
|
||||
ret = -EINVAL;
|
||||
@@ -515,27 +515,27 @@ danube_eeprom_init (void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
printk("danube_eeprom : /dev/eeprom mayor %d\n", danube_eeprom_maj);
|
||||
printk("ifxmips_eeprom : /dev/eeprom mayor %d\n", ifxmips_eeprom_maj);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void __exit
|
||||
danube_eeprom_cleanup_module (void)
|
||||
ifxmips_eeprom_cleanup_module (void)
|
||||
{
|
||||
/*if (unregister_chrdev (danube_eeprom_maj, "eeprom")) {
|
||||
/*if (unregister_chrdev (ifxmips_eeprom_maj, "eeprom")) {
|
||||
printk ("Unable to unregister major %d for the EEPROM\n",
|
||||
maj);
|
||||
}*/
|
||||
}
|
||||
|
||||
module_exit (danube_eeprom_cleanup_module);
|
||||
module_init (danube_eeprom_init);
|
||||
module_exit (ifxmips_eeprom_cleanup_module);
|
||||
module_init (ifxmips_eeprom_init);
|
||||
|
||||
MODULE_LICENSE ("GPL");
|
||||
MODULE_AUTHOR ("Peng Liu");
|
||||
MODULE_DESCRIPTION ("IFAP EEPROM driver");
|
||||
MODULE_SUPPORTED_DEVICE ("danube_eeprom");
|
||||
MODULE_SUPPORTED_DEVICE ("ifxmips_eeprom");
|
||||
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
#include <linux/ioctl.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/danube/danube.h>
|
||||
#include <asm/danube/danube_ioctl.h>
|
||||
#include <asm/ifxmips/ifxmips.h>
|
||||
#include <asm/ifxmips/ifxmips_ioctl.h>
|
||||
|
||||
#define MAX_PORTS 2
|
||||
#define PINS_PER_PORT 16
|
||||
|
||||
static unsigned int danube_gpio_major = 0;
|
||||
static unsigned int ifxmips_gpio_major = 0;
|
||||
|
||||
/* TODO do we need this ? */
|
||||
static struct semaphore port_sem;
|
||||
@@ -41,147 +41,147 @@ static struct semaphore port_sem;
|
||||
#define IFXMIPS_GPIO_SANITY {if (port > MAX_PORTS || pin > PINS_PER_PORT) return -EINVAL; }
|
||||
|
||||
int
|
||||
danube_port_reserve_pin (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_reserve_pin (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
printk("%s : call to obseleted function\n", __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_reserve_pin);
|
||||
EXPORT_SYMBOL(ifxmips_port_reserve_pin);
|
||||
|
||||
int
|
||||
danube_port_free_pin (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_free_pin (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
printk("%s : call to obseleted function\n", __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_free_pin);
|
||||
EXPORT_SYMBOL(ifxmips_port_free_pin);
|
||||
|
||||
int
|
||||
danube_port_set_open_drain (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_open_drain (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_OD + (port * 0x30)) | (1 << pin), IFXMIPS_GPIO_P0_OD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_open_drain);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_open_drain);
|
||||
|
||||
int
|
||||
danube_port_clear_open_drain (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_clear_open_drain (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_OD + (port * 0x30)) & ~(1 << pin), IFXMIPS_GPIO_P0_OD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_clear_open_drain);
|
||||
EXPORT_SYMBOL(ifxmips_port_clear_open_drain);
|
||||
|
||||
int
|
||||
danube_port_set_pudsel (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_pudsel (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_PUDSEL + (port * 0x30)) | (1 << pin), IFXMIPS_GPIO_P0_PUDSEL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_pudsel);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_pudsel);
|
||||
|
||||
int
|
||||
danube_port_clear_pudsel (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_clear_pudsel (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_PUDSEL + (port * 0x30)) & ~(1 << pin), IFXMIPS_GPIO_P0_PUDSEL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_clear_pudsel);
|
||||
EXPORT_SYMBOL(ifxmips_port_clear_pudsel);
|
||||
|
||||
int
|
||||
danube_port_set_puden (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_puden (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_PUDEN + (port * 0x30)) | (1 << pin), IFXMIPS_GPIO_P0_PUDEN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_puden);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_puden);
|
||||
|
||||
int
|
||||
danube_port_clear_puden (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_clear_puden (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_PUDEN + (port * 0x30)) & ~(1 << pin), IFXMIPS_GPIO_P0_PUDEN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_clear_puden);
|
||||
EXPORT_SYMBOL(ifxmips_port_clear_puden);
|
||||
|
||||
int
|
||||
danube_port_set_stoff (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_stoff (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_STOFF + (port * 0x30)) | (1 << pin), IFXMIPS_GPIO_P0_STOFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_stoff);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_stoff);
|
||||
|
||||
int
|
||||
danube_port_clear_stoff (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_clear_stoff (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_STOFF + (port * 0x30)) & ~(1 << pin), IFXMIPS_GPIO_P0_STOFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_clear_stoff);
|
||||
EXPORT_SYMBOL(ifxmips_port_clear_stoff);
|
||||
|
||||
int
|
||||
danube_port_set_dir_out (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_dir_out (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_DIR + (port * 0x30)) | (1 << pin), IFXMIPS_GPIO_P0_DIR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_dir_out);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_dir_out);
|
||||
|
||||
int
|
||||
danube_port_set_dir_in (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_dir_in (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_DIR + (port * 0x30)) & ~(1 << pin), IFXMIPS_GPIO_P0_DIR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_dir_in);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_dir_in);
|
||||
|
||||
int
|
||||
danube_port_set_output (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_output (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_OUT + (port * 0x30)) | (1 << pin), IFXMIPS_GPIO_P0_OUT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_output);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_output);
|
||||
|
||||
int
|
||||
danube_port_clear_output (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_clear_output (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_OUT + (port * 0x30)) & ~(1 << pin), IFXMIPS_GPIO_P0_OUT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_clear_output);
|
||||
EXPORT_SYMBOL(ifxmips_port_clear_output);
|
||||
|
||||
int
|
||||
danube_port_get_input (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_get_input (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
|
||||
@@ -190,49 +190,49 @@ danube_port_get_input (unsigned int port, unsigned int pin)
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_get_input);
|
||||
EXPORT_SYMBOL(ifxmips_port_get_input);
|
||||
|
||||
int
|
||||
danube_port_set_altsel0 (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_altsel0 (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_ALTSEL0 + (port * 0x30)) | (1 << pin), IFXMIPS_GPIO_P0_ALTSEL0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_altsel0);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_altsel0);
|
||||
|
||||
int
|
||||
danube_port_clear_altsel0 (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_clear_altsel0 (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_ALTSEL0 + (port * 0x30)) & ~(1 << pin), IFXMIPS_GPIO_P0_ALTSEL0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_clear_altsel0);
|
||||
EXPORT_SYMBOL(ifxmips_port_clear_altsel0);
|
||||
|
||||
int
|
||||
danube_port_set_altsel1 (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_set_altsel1 (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_ALTSEL1 + (port * 0x30)) | (1 << pin), IFXMIPS_GPIO_P0_ALTSEL1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_set_altsel1);
|
||||
EXPORT_SYMBOL(ifxmips_port_set_altsel1);
|
||||
|
||||
int
|
||||
danube_port_clear_altsel1 (unsigned int port, unsigned int pin)
|
||||
ifxmips_port_clear_altsel1 (unsigned int port, unsigned int pin)
|
||||
{
|
||||
IFXMIPS_GPIO_SANITY;
|
||||
writel(readl(IFXMIPS_GPIO_P0_ALTSEL1 + (port * 0x30)) & ~(1 << pin), IFXMIPS_GPIO_P0_ALTSEL1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(danube_port_clear_altsel1);
|
||||
EXPORT_SYMBOL(ifxmips_port_clear_altsel1);
|
||||
|
||||
long danube_port_read_procmem_helper(char* tag, u32* in_reg, char *buf)
|
||||
long ifxmips_port_read_procmem_helper(char* tag, u32* in_reg, char *buf)
|
||||
{
|
||||
u32 reg, bit = 0;
|
||||
unsigned int len, t;
|
||||
@@ -252,10 +252,10 @@ long danube_port_read_procmem_helper(char* tag, u32* in_reg, char *buf)
|
||||
}
|
||||
|
||||
int
|
||||
danube_port_read_procmem (char *buf, char **start, off_t offset, int count,
|
||||
ifxmips_port_read_procmem (char *buf, char **start, off_t offset, int count,
|
||||
int *eof, void *data)
|
||||
{
|
||||
long len = sprintf (buf, "\nDanube Port Settings\n");
|
||||
long len = sprintf (buf, "\nIFXMips Port Settings\n");
|
||||
|
||||
len += sprintf (buf + len,
|
||||
" 3 2 1 0\n");
|
||||
@@ -264,24 +264,24 @@ danube_port_read_procmem (char *buf, char **start, off_t offset, int count,
|
||||
len += sprintf (buf + len,
|
||||
"----------------------------------------\n");
|
||||
|
||||
len += danube_port_read_procmem_helper("P0-OUT", IFXMIPS_GPIO_P0_OUT, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-OUT", IFXMIPS_GPIO_P1_OUT, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P0-IN ", IFXMIPS_GPIO_P0_IN, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-IN ", IFXMIPS_GPIO_P1_IN, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P0-DIR", IFXMIPS_GPIO_P0_DIR, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-DIR", IFXMIPS_GPIO_P1_DIR, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P0-STO ", IFXMIPS_GPIO_P0_STOFF, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-STO ", IFXMIPS_GPIO_P1_STOFF, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P0-PUDE", IFXMIPS_GPIO_P0_PUDEN, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-PUDE", IFXMIPS_GPIO_P1_PUDEN, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P0-OD ", IFXMIPS_GPIO_P0_OD, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-OD ", IFXMIPS_GPIO_P1_OD, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P0-PUDS", IFXMIPS_GPIO_P0_PUDSEL, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-PUDS", IFXMIPS_GPIO_P1_PUDSEL, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P0-ALT0", IFXMIPS_GPIO_P0_ALTSEL0, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-ALT0", IFXMIPS_GPIO_P1_ALTSEL0, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P0-ALT1", IFXMIPS_GPIO_P0_ALTSEL1, &buf[len]);
|
||||
len += danube_port_read_procmem_helper("P1-ALT1", IFXMIPS_GPIO_P1_ALTSEL1, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-OUT", IFXMIPS_GPIO_P0_OUT, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-OUT", IFXMIPS_GPIO_P1_OUT, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-IN ", IFXMIPS_GPIO_P0_IN, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-IN ", IFXMIPS_GPIO_P1_IN, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-DIR", IFXMIPS_GPIO_P0_DIR, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-DIR", IFXMIPS_GPIO_P1_DIR, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-STO ", IFXMIPS_GPIO_P0_STOFF, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-STO ", IFXMIPS_GPIO_P1_STOFF, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-PUDE", IFXMIPS_GPIO_P0_PUDEN, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-PUDE", IFXMIPS_GPIO_P1_PUDEN, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-OD ", IFXMIPS_GPIO_P0_OD, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-OD ", IFXMIPS_GPIO_P1_OD, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-PUDS", IFXMIPS_GPIO_P0_PUDSEL, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-PUDS", IFXMIPS_GPIO_P1_PUDSEL, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-ALT0", IFXMIPS_GPIO_P0_ALTSEL0, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-ALT0", IFXMIPS_GPIO_P1_ALTSEL0, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P0-ALT1", IFXMIPS_GPIO_P0_ALTSEL1, &buf[len]);
|
||||
len += ifxmips_port_read_procmem_helper("P1-ALT1", IFXMIPS_GPIO_P1_ALTSEL1, &buf[len]);
|
||||
len = len + sprintf (buf + len, "\n\n");
|
||||
|
||||
*eof = 1;
|
||||
@@ -290,23 +290,23 @@ danube_port_read_procmem (char *buf, char **start, off_t offset, int count,
|
||||
}
|
||||
|
||||
static int
|
||||
danube_port_open (struct inode *inode, struct file *filep)
|
||||
ifxmips_port_open (struct inode *inode, struct file *filep)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
danube_port_release (struct inode *inode, struct file *filelp)
|
||||
ifxmips_port_release (struct inode *inode, struct file *filelp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
danube_port_ioctl (struct inode *inode, struct file *filp,
|
||||
ifxmips_port_ioctl (struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int ret = 0;
|
||||
volatile struct danube_port_ioctl_parm parm;
|
||||
volatile struct ifxmips_port_ioctl_parm parm;
|
||||
|
||||
if (_IOC_TYPE (cmd) != IFXMIPS_PORT_IOC_MAGIC)
|
||||
return -EINVAL;
|
||||
@@ -314,15 +314,15 @@ danube_port_ioctl (struct inode *inode, struct file *filp,
|
||||
if (_IOC_DIR (cmd) & _IOC_WRITE) {
|
||||
if (!access_ok
|
||||
(VERIFY_READ, arg,
|
||||
sizeof (struct danube_port_ioctl_parm)))
|
||||
sizeof (struct ifxmips_port_ioctl_parm)))
|
||||
return -EFAULT;
|
||||
ret = copy_from_user ((void *) &parm, (void *) arg,
|
||||
sizeof (struct danube_port_ioctl_parm));
|
||||
sizeof (struct ifxmips_port_ioctl_parm));
|
||||
}
|
||||
if (_IOC_DIR (cmd) & _IOC_READ) {
|
||||
if (!access_ok
|
||||
(VERIFY_WRITE, arg,
|
||||
sizeof (struct danube_port_ioctl_parm)))
|
||||
sizeof (struct ifxmips_port_ioctl_parm)))
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
@@ -332,64 +332,64 @@ danube_port_ioctl (struct inode *inode, struct file *filp,
|
||||
switch (cmd) {
|
||||
case IFXMIPS_PORT_IOCOD:
|
||||
if (parm.value == 0x00)
|
||||
danube_port_clear_open_drain(parm.port, parm.pin);
|
||||
ifxmips_port_clear_open_drain(parm.port, parm.pin);
|
||||
else
|
||||
danube_port_set_open_drain(parm.port, parm.pin);
|
||||
ifxmips_port_set_open_drain(parm.port, parm.pin);
|
||||
break;
|
||||
|
||||
case IFXMIPS_PORT_IOCPUDSEL:
|
||||
if (parm.value == 0x00)
|
||||
danube_port_clear_pudsel(parm.port, parm.pin);
|
||||
ifxmips_port_clear_pudsel(parm.port, parm.pin);
|
||||
else
|
||||
danube_port_set_pudsel(parm.port, parm.pin);
|
||||
ifxmips_port_set_pudsel(parm.port, parm.pin);
|
||||
break;
|
||||
|
||||
case IFXMIPS_PORT_IOCPUDEN:
|
||||
if (parm.value == 0x00)
|
||||
danube_port_clear_puden(parm.port, parm.pin);
|
||||
ifxmips_port_clear_puden(parm.port, parm.pin);
|
||||
else
|
||||
danube_port_set_puden(parm.port, parm.pin);
|
||||
ifxmips_port_set_puden(parm.port, parm.pin);
|
||||
break;
|
||||
|
||||
case IFXMIPS_PORT_IOCSTOFF:
|
||||
if (parm.value == 0x00)
|
||||
danube_port_clear_stoff(parm.port, parm.pin);
|
||||
ifxmips_port_clear_stoff(parm.port, parm.pin);
|
||||
else
|
||||
danube_port_set_stoff(parm.port, parm.pin);
|
||||
ifxmips_port_set_stoff(parm.port, parm.pin);
|
||||
break;
|
||||
|
||||
case IFXMIPS_PORT_IOCDIR:
|
||||
if (parm.value == 0x00)
|
||||
danube_port_set_dir_in(parm.port, parm.pin);
|
||||
ifxmips_port_set_dir_in(parm.port, parm.pin);
|
||||
else
|
||||
danube_port_set_dir_out(parm.port, parm.pin);
|
||||
ifxmips_port_set_dir_out(parm.port, parm.pin);
|
||||
break;
|
||||
|
||||
case IFXMIPS_PORT_IOCOUTPUT:
|
||||
if (parm.value == 0x00)
|
||||
danube_port_clear_output(parm.port, parm.pin);
|
||||
ifxmips_port_clear_output(parm.port, parm.pin);
|
||||
else
|
||||
danube_port_set_output(parm.port, parm.pin);
|
||||
ifxmips_port_set_output(parm.port, parm.pin);
|
||||
break;
|
||||
|
||||
case IFXMIPS_PORT_IOCALTSEL0:
|
||||
if (parm.value == 0x00)
|
||||
danube_port_clear_altsel0(parm.port, parm.pin);
|
||||
ifxmips_port_clear_altsel0(parm.port, parm.pin);
|
||||
else
|
||||
danube_port_set_altsel0(parm.port, parm.pin);
|
||||
ifxmips_port_set_altsel0(parm.port, parm.pin);
|
||||
break;
|
||||
|
||||
case IFXMIPS_PORT_IOCALTSEL1:
|
||||
if (parm.value == 0x00)
|
||||
danube_port_clear_altsel1(parm.port, parm.pin);
|
||||
ifxmips_port_clear_altsel1(parm.port, parm.pin);
|
||||
else
|
||||
danube_port_set_altsel1(parm.port, parm.pin);
|
||||
ifxmips_port_set_altsel1(parm.port, parm.pin);
|
||||
break;
|
||||
|
||||
case IFXMIPS_PORT_IOCINPUT:
|
||||
parm.value = danube_port_get_input(parm.port, parm.pin);
|
||||
parm.value = ifxmips_port_get_input(parm.port, parm.pin);
|
||||
copy_to_user((void*)arg, (void*)&parm,
|
||||
sizeof(struct danube_port_ioctl_parm));
|
||||
sizeof(struct ifxmips_port_ioctl_parm));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -402,41 +402,41 @@ danube_port_ioctl (struct inode *inode, struct file *filp,
|
||||
}
|
||||
|
||||
static struct file_operations port_fops = {
|
||||
.open = danube_port_open,
|
||||
.release = danube_port_release,
|
||||
.ioctl = danube_port_ioctl
|
||||
.open = ifxmips_port_open,
|
||||
.release = ifxmips_port_release,
|
||||
.ioctl = ifxmips_port_ioctl
|
||||
};
|
||||
|
||||
int __init
|
||||
danube_gpio_init (void)
|
||||
ifxmips_gpio_init (void)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
sema_init (&port_sem, 1);
|
||||
|
||||
danube_gpio_major = register_chrdev(0, "danube_gpio", &port_fops);
|
||||
if (!danube_gpio_major)
|
||||
ifxmips_gpio_major = register_chrdev(0, "ifxmips_gpio", &port_fops);
|
||||
if (!ifxmips_gpio_major)
|
||||
{
|
||||
printk("danube-port: Error! Could not register port device. #%d\n", danube_gpio_major);
|
||||
printk("ifxmips-port: Error! Could not register port device. #%d\n", ifxmips_gpio_major);
|
||||
retval = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
create_proc_read_entry("danube_gpio", 0, NULL,
|
||||
danube_port_read_procmem, NULL);
|
||||
create_proc_read_entry("ifxmips_gpio", 0, NULL,
|
||||
ifxmips_port_read_procmem, NULL);
|
||||
|
||||
printk("registered danube gpio driver\n");
|
||||
printk("registered ifxmips gpio driver\n");
|
||||
|
||||
out:
|
||||
return retval;
|
||||
}
|
||||
|
||||
void __exit
|
||||
danube_gpio_exit (void)
|
||||
ifxmips_gpio_exit (void)
|
||||
{
|
||||
unregister_chrdev(danube_gpio_major, "danube_gpio");
|
||||
remove_proc_entry("danube_gpio", NULL);
|
||||
unregister_chrdev(ifxmips_gpio_major, "ifxmips_gpio");
|
||||
remove_proc_entry("ifxmips_gpio", NULL);
|
||||
}
|
||||
|
||||
module_init(danube_gpio_init);
|
||||
module_exit(danube_gpio_exit);
|
||||
module_init(ifxmips_gpio_init);
|
||||
module_exit(ifxmips_gpio_exit);
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <linux/errno.h>
|
||||
#include <asm/danube/danube.h>
|
||||
#include <asm/danube/danube_gpio.h>
|
||||
#include <asm/danube/danube_pmu.h>
|
||||
#include <asm/ifxmips/ifxmips.h>
|
||||
#include <asm/ifxmips/ifxmips_gpio.h>
|
||||
#include <asm/ifxmips/ifxmips_pmu.h>
|
||||
|
||||
#define IFXMIPS_LED_CLK_EDGE IFXMIPS_LED_FALLING
|
||||
//#define IFXMIPS_LED_CLK_EDGE IFXMIPS_LED_RISING
|
||||
@@ -38,52 +38,52 @@
|
||||
|
||||
#define IFXMIPS_LED_GPIO_PORT 0
|
||||
|
||||
static int danube_led_major;
|
||||
static int ifxmips_led_major;
|
||||
|
||||
void
|
||||
danube_led_set (unsigned int led)
|
||||
ifxmips_led_set (unsigned int led)
|
||||
{
|
||||
led &= 0xffffff;
|
||||
writel(readl(IFXMIPS_LED_CPU0) | led, IFXMIPS_LED_CPU0);
|
||||
}
|
||||
EXPORT_SYMBOL(danube_led_set);
|
||||
EXPORT_SYMBOL(ifxmips_led_set);
|
||||
|
||||
void
|
||||
danube_led_clear (unsigned int led)
|
||||
ifxmips_led_clear (unsigned int led)
|
||||
{
|
||||
led = ~(led & 0xffffff);
|
||||
writel(readl(IFXMIPS_LED_CPU0) & led, IFXMIPS_LED_CPU0);
|
||||
}
|
||||
EXPORT_SYMBOL(danube_led_clear);
|
||||
EXPORT_SYMBOL(ifxmips_led_clear);
|
||||
|
||||
void
|
||||
danube_led_blink_set (unsigned int led)
|
||||
ifxmips_led_blink_set (unsigned int led)
|
||||
{
|
||||
led &= 0xffffff;
|
||||
writel(readl(IFXMIPS_LED_CON0) | led, IFXMIPS_LED_CON0);
|
||||
}
|
||||
EXPORT_SYMBOL(danube_led_blink_set);
|
||||
EXPORT_SYMBOL(ifxmips_led_blink_set);
|
||||
|
||||
void
|
||||
danube_led_blink_clear (unsigned int led)
|
||||
ifxmips_led_blink_clear (unsigned int led)
|
||||
{
|
||||
led = ~(led & 0xffffff);
|
||||
writel(readl(IFXMIPS_LED_CON0) & led, IFXMIPS_LED_CON0);
|
||||
}
|
||||
EXPORT_SYMBOL(danube_led_blink_clear);
|
||||
EXPORT_SYMBOL(ifxmips_led_blink_clear);
|
||||
|
||||
void
|
||||
danube_led_setup_gpio (void)
|
||||
ifxmips_led_setup_gpio (void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
/* we need to setup pins SH,D,ST (4,5,6) */
|
||||
for (i = 4; i < 7; i++)
|
||||
{
|
||||
danube_port_set_altsel0(IFXMIPS_LED_GPIO_PORT, i);
|
||||
danube_port_clear_altsel1(IFXMIPS_LED_GPIO_PORT, i);
|
||||
danube_port_set_dir_out(IFXMIPS_LED_GPIO_PORT, i);
|
||||
danube_port_set_open_drain(IFXMIPS_LED_GPIO_PORT, i);
|
||||
ifxmips_port_set_altsel0(IFXMIPS_LED_GPIO_PORT, i);
|
||||
ifxmips_port_clear_altsel1(IFXMIPS_LED_GPIO_PORT, i);
|
||||
ifxmips_port_set_dir_out(IFXMIPS_LED_GPIO_PORT, i);
|
||||
ifxmips_port_set_open_drain(IFXMIPS_LED_GPIO_PORT, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ led_release (struct inode *inode, struct file *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations danube_led_fops = {
|
||||
static struct file_operations ifxmips_led_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = led_ioctl,
|
||||
.open = led_open,
|
||||
@@ -138,11 +138,11 @@ Map for hardware relay on reference board
|
||||
|
||||
|
||||
int __init
|
||||
danube_led_init (void)
|
||||
ifxmips_led_init (void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
danube_led_setup_gpio();
|
||||
ifxmips_led_setup_gpio();
|
||||
|
||||
writel(0, IFXMIPS_LED_AR);
|
||||
writel(0, IFXMIPS_LED_CPU0);
|
||||
@@ -169,29 +169,29 @@ danube_led_init (void)
|
||||
writel(readl(IFXMIPS_LED_CON0) | IFXMIPS_LED_ADSL_SRC, IFXMIPS_LED_CON0);
|
||||
|
||||
/* per default, the leds are turned on */
|
||||
danube_pmu_enable(IFXMIPS_PMU_PWDCR_LED);
|
||||
ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_LED);
|
||||
|
||||
danube_led_major = register_chrdev(0, "danube_led", &danube_led_fops);
|
||||
ifxmips_led_major = register_chrdev(0, "ifxmips_led", &ifxmips_led_fops);
|
||||
|
||||
if (!danube_led_major)
|
||||
if (!ifxmips_led_major)
|
||||
{
|
||||
printk("danube_led: Error! Could not register device. %d\n", danube_led_major);
|
||||
printk("ifxmips_led: Error! Could not register device. %d\n", ifxmips_led_major);
|
||||
ret = -EINVAL;
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "danube_led : device registered on major %d\n", danube_led_major);
|
||||
printk(KERN_INFO "ifxmips_led : device registered on major %d\n", ifxmips_led_major);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void __exit
|
||||
danube_led_exit (void)
|
||||
ifxmips_led_exit (void)
|
||||
{
|
||||
unregister_chrdev(danube_led_major, "danube_led");
|
||||
unregister_chrdev(ifxmips_led_major, "ifxmips_led");
|
||||
}
|
||||
|
||||
module_init(danube_led_init);
|
||||
module_exit(danube_led_exit);
|
||||
module_init(ifxmips_led_init);
|
||||
module_exit(ifxmips_led_exit);
|
||||
|
||||
@@ -54,10 +54,10 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <asm/danube/danube.h>
|
||||
#include <asm/danube/danube_irq.h>
|
||||
#include <asm/danube/ifx_ssc_defines.h>
|
||||
#include <asm/danube/ifx_ssc.h>
|
||||
#include <asm/ifxmips/ifxmips.h>
|
||||
#include <asm/ifxmips/ifxmips_irq.h>
|
||||
#include <asm/ifxmips/ifx_ssc_defines.h>
|
||||
#include <asm/ifxmips/ifx_ssc.h>
|
||||
|
||||
#ifdef SSC_FRAME_INT_ENABLE
|
||||
#undef SSC_FRAME_INT_ENABLE
|
||||
@@ -93,8 +93,8 @@ static unsigned int ifx_ssc_get_kernel_clk (struct ifx_ssc_port *info);
|
||||
static void tx_int (struct ifx_ssc_port *);
|
||||
static int ifx_ssc1_read_proc (char *, char **, off_t, int, int *, void *);
|
||||
|
||||
extern unsigned int danube_get_fpi_hz (void);
|
||||
extern void mask_and_ack_danube_irq (unsigned int irq_nr);
|
||||
extern unsigned int ifxmips_get_fpi_hz (void);
|
||||
extern void mask_and_ack_ifxmips_irq (unsigned int irq_nr);
|
||||
|
||||
static struct file_operations ifx_ssc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
@@ -116,7 +116,7 @@ ifx_ssc_get_kernel_clk (struct ifx_ssc_port *info)
|
||||
printk ("ifx_ssc_get_kernel_clk rmc==0 \n");
|
||||
return 0;
|
||||
}
|
||||
return danube_get_fpi_hz () / rmc;
|
||||
return ifxmips_get_fpi_hz () / rmc;
|
||||
}
|
||||
|
||||
#ifndef not_yet
|
||||
@@ -382,9 +382,9 @@ ifx_ssc_abort (struct ifx_ssc_port *info)
|
||||
wake_up_interruptible (&info->rwait);
|
||||
|
||||
// clear pending int's
|
||||
mask_and_ack_danube_irq(info->rxirq);
|
||||
mask_and_ack_danube_irq(info->txirq);
|
||||
mask_and_ack_danube_irq(info->errirq);
|
||||
mask_and_ack_ifxmips_irq(info->rxirq);
|
||||
mask_and_ack_ifxmips_irq(info->txirq);
|
||||
mask_and_ack_ifxmips_irq(info->errirq);
|
||||
|
||||
// clear error flags
|
||||
WRITE_PERIPHERAL_REGISTER (IFX_SSC_WHBSTATE_CLR_ALL_ERROR, info->mapbase + IFX_SSC_WHBSTATE);
|
||||
@@ -440,9 +440,9 @@ ifx_ssc_open (struct inode *inode, struct file *filp)
|
||||
WRITE_PERIPHERAL_REGISTER (IFX_SSC_WHBSTATE_CLR_ALL_ERROR, info->mapbase + IFX_SSC_WHBSTATE);
|
||||
|
||||
// clear pending interrupts
|
||||
mask_and_ack_danube_irq(info->rxirq);
|
||||
mask_and_ack_danube_irq(info->txirq);
|
||||
mask_and_ack_danube_irq(info->errirq);
|
||||
mask_and_ack_ifxmips_irq(info->rxirq);
|
||||
mask_and_ack_ifxmips_irq(info->txirq);
|
||||
mask_and_ack_ifxmips_irq(info->errirq);
|
||||
|
||||
WRITE_PERIPHERAL_REGISTER (IFX_SSC_WHBSTATE_SET_ENABLE, info->mapbase + IFX_SSC_WHBSTATE);
|
||||
|
||||
@@ -1529,5 +1529,5 @@ EXPORT_SYMBOL(ifx_ssc_rx);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
|
||||
MODULE_DESCRIPTION("danube ssc driver");
|
||||
MODULE_DESCRIPTION("ifxmips ssc driver");
|
||||
|
||||
|
||||
@@ -23,19 +23,19 @@
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/module.h>
|
||||
#include <asm-mips/danube/danube_wdt.h>
|
||||
#include <asm-mips/danube/danube.h>
|
||||
#include <asm-mips/ifxmips/ifxmips_wdt.h>
|
||||
#include <asm-mips/ifxmips/ifxmips.h>
|
||||
|
||||
|
||||
// TODO remove magic numbers and weirdo macros
|
||||
|
||||
extern unsigned int danube_get_fpi_hz (void);
|
||||
extern unsigned int ifxmips_get_fpi_hz (void);
|
||||
|
||||
static int danube_wdt_inuse = 0;
|
||||
static int danube_wdt_major = 0;
|
||||
static int ifxmips_wdt_inuse = 0;
|
||||
static int ifxmips_wdt_major = 0;
|
||||
|
||||
int
|
||||
danube_wdt_enable (unsigned int timeout)
|
||||
ifxmips_wdt_enable (unsigned int timeout)
|
||||
{
|
||||
unsigned int wdt_cr = 0;
|
||||
unsigned int wdt_reload = 0;
|
||||
@@ -88,7 +88,7 @@ out:
|
||||
}
|
||||
|
||||
void
|
||||
danube_wdt_disable (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);
|
||||
@@ -98,7 +98,7 @@ danube_wdt_disable (void)
|
||||
|
||||
/* passed LPEN or DSEN */
|
||||
void
|
||||
danube_wdt_enable_feature (int en, int type)
|
||||
ifxmips_wdt_enable_feature (int en, int type)
|
||||
{
|
||||
unsigned int wdt_cr = 0;
|
||||
|
||||
@@ -119,7 +119,7 @@ danube_wdt_enable_feature (int en, int type)
|
||||
}
|
||||
|
||||
void
|
||||
danube_wdt_prewarning_limit (int pwl)
|
||||
ifxmips_wdt_prewarning_limit (int pwl)
|
||||
{
|
||||
unsigned int wdt_cr = 0;
|
||||
|
||||
@@ -134,7 +134,7 @@ danube_wdt_prewarning_limit (int pwl)
|
||||
}
|
||||
|
||||
void
|
||||
danube_wdt_set_clkdiv (int clkdiv)
|
||||
ifxmips_wdt_set_clkdiv (int clkdiv)
|
||||
{
|
||||
unsigned int wdt_cr = 0;
|
||||
|
||||
@@ -149,7 +149,7 @@ danube_wdt_set_clkdiv (int clkdiv)
|
||||
}
|
||||
|
||||
static int
|
||||
danube_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
|
||||
ifxmips_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
int result = 0;
|
||||
@@ -167,7 +167,7 @@ danube_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
|
||||
switch (cmd)
|
||||
{
|
||||
case IFXMIPS_WDT_IOC_START:
|
||||
if ((result = danube_wdt_enable(user_arg)) < 0)
|
||||
if ((result = ifxmips_wdt_enable(user_arg)) < 0)
|
||||
timeout = -1;
|
||||
else
|
||||
timeout = user_arg;
|
||||
@@ -175,14 +175,14 @@ danube_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
|
||||
|
||||
case IFXMIPS_WDT_IOC_STOP:
|
||||
printk("disable watch dog timer\n");
|
||||
danube_wdt_disable();
|
||||
ifxmips_wdt_disable();
|
||||
break;
|
||||
|
||||
case IFXMIPS_WDT_IOC_PING:
|
||||
if (timeout < 0)
|
||||
result = -EIO;
|
||||
else
|
||||
result = danube_wdt_enable(timeout);
|
||||
result = ifxmips_wdt_enable(timeout);
|
||||
break;
|
||||
|
||||
case IFXMIPS_WDT_IOC_GET_STATUS:
|
||||
@@ -191,19 +191,19 @@ danube_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
|
||||
break;
|
||||
|
||||
case IFXMIPS_WDT_IOC_SET_PWL:
|
||||
danube_wdt_prewarning_limit(user_arg);
|
||||
ifxmips_wdt_prewarning_limit(user_arg);
|
||||
break;
|
||||
|
||||
case IFXMIPS_WDT_IOC_SET_DSEN:
|
||||
danube_wdt_enable_feature(user_arg, IFXMIPS_BIU_WDT_CR_DSEN);
|
||||
ifxmips_wdt_enable_feature(user_arg, IFXMIPS_BIU_WDT_CR_DSEN);
|
||||
break;
|
||||
|
||||
case IFXMIPS_WDT_IOC_SET_LPEN:
|
||||
danube_wdt_enable_feature(user_arg, IFXMIPS_BIU_WDT_CR_LPEN);
|
||||
ifxmips_wdt_enable_feature(user_arg, IFXMIPS_BIU_WDT_CR_LPEN);
|
||||
break;
|
||||
|
||||
case IFXMIPS_WDT_IOC_SET_CLKDIV:
|
||||
danube_wdt_set_clkdiv(user_arg);
|
||||
ifxmips_wdt_set_clkdiv(user_arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -215,26 +215,26 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
danube_wdt_open (struct inode *inode, struct file *file)
|
||||
ifxmips_wdt_open (struct inode *inode, struct file *file)
|
||||
{
|
||||
if (danube_wdt_inuse)
|
||||
if (ifxmips_wdt_inuse)
|
||||
return -EBUSY;
|
||||
|
||||
danube_wdt_inuse = 1;
|
||||
ifxmips_wdt_inuse = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
danube_wdt_release (struct inode *inode, struct file *file)
|
||||
ifxmips_wdt_release (struct inode *inode, struct file *file)
|
||||
{
|
||||
danube_wdt_inuse = 0;
|
||||
ifxmips_wdt_inuse = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
danube_wdt_register_proc_read (char *buf, char **start, off_t offset, int count,
|
||||
ifxmips_wdt_register_proc_read (char *buf, char **start, off_t offset, int count,
|
||||
int *eof, void *data)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -252,36 +252,36 @@ danube_wdt_register_proc_read (char *buf, char **start, off_t offset, int count,
|
||||
|
||||
static struct file_operations wdt_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = danube_wdt_ioctl,
|
||||
.open = danube_wdt_open,
|
||||
.release = danube_wdt_release,
|
||||
.ioctl = ifxmips_wdt_ioctl,
|
||||
.open = ifxmips_wdt_open,
|
||||
.release = ifxmips_wdt_release,
|
||||
};
|
||||
|
||||
int __init
|
||||
danube_wdt_init_module (void)
|
||||
ifxmips_wdt_init_module (void)
|
||||
{
|
||||
danube_wdt_major = register_chrdev(0, "wdt", &wdt_fops);
|
||||
ifxmips_wdt_major = register_chrdev(0, "wdt", &wdt_fops);
|
||||
|
||||
if (danube_wdt_major < 0)
|
||||
if (ifxmips_wdt_major < 0)
|
||||
{
|
||||
printk("cannot register watchdog device\n");
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
create_proc_read_entry("danube_wdt", 0, NULL, danube_wdt_register_proc_read, NULL);
|
||||
create_proc_read_entry("ifxmips_wdt", 0, NULL, ifxmips_wdt_register_proc_read, NULL);
|
||||
|
||||
printk("danube watchdog loaded\n");
|
||||
printk("ifxmips watchdog loaded\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
danube_wdt_cleanup_module (void)
|
||||
ifxmips_wdt_cleanup_module (void)
|
||||
{
|
||||
unregister_chrdev(danube_wdt_major, "wdt");
|
||||
remove_proc_entry("danube_wdt", NULL);
|
||||
unregister_chrdev(ifxmips_wdt_major, "wdt");
|
||||
remove_proc_entry("ifxmips_wdt", NULL);
|
||||
}
|
||||
|
||||
module_init(danube_wdt_init_module);
|
||||
module_exit(danube_wdt_cleanup_module);
|
||||
module_init(ifxmips_wdt_init_module);
|
||||
module_exit(ifxmips_wdt_cleanup_module);
|
||||
|
||||
Reference in New Issue
Block a user