1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-01-29 01:11:06 +02:00

cosmetic fixes for ar7: indent, use lowercase hex notation, format

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8656 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2007-09-06 19:35:08 +00:00
parent a8c9d0167e
commit 4aac3b42a2
10 changed files with 164 additions and 163 deletions

View File

@ -339,7 +339,7 @@ static int tnetd7200_get_clock_base(int clock_id, u32 *bootcr)
return AR7_AFE_CLOCK; return AR7_AFE_CLOCK;
} }
} else { } else {
// Sync // Sync
if (*bootcr & BOOT_PLL_2TO1_MODE) { if (*bootcr & BOOT_PLL_2TO1_MODE) {
// 2:1 // 2:1
switch (clock_id) { switch (clock_id) {
@ -348,7 +348,7 @@ static int tnetd7200_get_clock_base(int clock_id, u32 *bootcr)
default: default:
return AR7_AFE_CLOCK; return AR7_AFE_CLOCK;
} }
} else { } else {
// 1:1 // 1:1
return AR7_REF_CLOCK; return AR7_REF_CLOCK;
} }

View File

@ -98,14 +98,14 @@ static struct resource cpmac_low_res[] = {
.name = "regs", .name = "regs",
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
.start = AR7_REGS_MAC0, .start = AR7_REGS_MAC0,
.end = AR7_REGS_MAC0 + 0x7FF, .end = AR7_REGS_MAC0 + 0x7ff,
}, },
{ {
.name = "irq", .name = "irq",
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
.start = 27, .start = 27,
.end = 27, .end = 27,
}, },
}; };
static struct resource cpmac_high_res[] = { static struct resource cpmac_high_res[] = {
@ -113,14 +113,14 @@ static struct resource cpmac_high_res[] = {
.name = "regs", .name = "regs",
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
.start = AR7_REGS_MAC1, .start = AR7_REGS_MAC1,
.end = AR7_REGS_MAC1 + 0x7FF, .end = AR7_REGS_MAC1 + 0x7ff,
}, },
{ {
.name = "irq", .name = "irq",
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
.start = 41, .start = 41,
.end = 41, .end = 41,
}, },
}; };
static struct resource vlynq_low_res[] = { static struct resource vlynq_low_res[] = {
@ -135,7 +135,7 @@ static struct resource vlynq_low_res[] = {
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
.start = 29, .start = 29,
.end = 29, .end = 29,
}, },
{ {
.name = "mem", .name = "mem",
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
@ -155,14 +155,14 @@ static struct resource vlynq_high_res[] = {
.name = "regs", .name = "regs",
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
.start = AR7_REGS_VLYNQ1, .start = AR7_REGS_VLYNQ1,
.end = AR7_REGS_VLYNQ1 + 0xFF, .end = AR7_REGS_VLYNQ1 + 0xff,
}, },
{ {
.name = "irq", .name = "irq",
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
.start = 33, .start = 33,
.end = 33, .end = 33,
}, },
{ {
.name = "mem", .name = "mem",
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
@ -272,13 +272,13 @@ static struct plat_serial8250_port uart1_data =
}; };
static struct plat_serial8250_port uart_data[] = { static struct plat_serial8250_port uart_data[] = {
uart0_data, uart0_data,
uart1_data, uart1_data,
{ .flags = 0 } { .flags = 0 }
}; };
static struct plat_serial8250_port uart_data_single[] = { static struct plat_serial8250_port uart_data_single[] = {
uart0_data, uart0_data,
{ .flags = 0 } { .flags = 0 }
}; };
@ -346,30 +346,30 @@ static int __init ar7_register_devices(void)
return res; return res;
// Only TNETD73xx have a second serial port // Only TNETD73xx have a second serial port
if (ar7_has_second_uart()) { if (ar7_has_second_uart()) {
uart_port[1].type = PORT_AR7; uart_port[1].type = PORT_AR7;
uart_port[1].line = 1; uart_port[1].line = 1;
uart_port[1].irq = AR7_IRQ_UART1; uart_port[1].irq = AR7_IRQ_UART1;
uart_port[1].uartclk = ar7_bus_freq() / 2; uart_port[1].uartclk = ar7_bus_freq() / 2;
uart_port[1].iotype = UPIO_MEM; uart_port[1].iotype = UPIO_MEM;
uart_port[1].mapbase = UR8_REGS_UART1; uart_port[1].mapbase = UR8_REGS_UART1;
uart_port[1].membase = ioremap(uart_port[1].mapbase, 256); uart_port[1].membase = ioremap(uart_port[1].mapbase, 256);
uart_port[1].regshift = 2; uart_port[1].regshift = 2;
res = early_serial_setup(&uart_port[1]); res = early_serial_setup(&uart_port[1]);
if (res) if (res)
return res; return res;
} }
#else // !CONFIG_SERIAL_8250 #else // !CONFIG_SERIAL_8250
uart_data[0].uartclk = ar7_bus_freq() / 2; uart_data[0].uartclk = ar7_bus_freq() / 2;
uart_data[1].uartclk = uart_data[0].uartclk; uart_data[1].uartclk = uart_data[0].uartclk;
// Only TNETD73xx have a second serial port // Only TNETD73xx have a second serial port
if (ar7_has_second_uart()) { if (ar7_has_second_uart()) {
uart.dev.platform_data = uart_data; uart.dev.platform_data = uart_data;
} }
res = platform_device_register(&uart); res = platform_device_register(&uart);
if (res) if (res)

View File

@ -225,11 +225,10 @@ static void __init console_config(void)
return; return;
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
if (!strstr(prom_getcmdline(), "nokgdb")) if (!strstr(prom_getcmdline(), "nokgdb")) {
{ strcat(prom_getcmdline(), " console=kgdb");
strcat(prom_getcmdline(), " console=kgdb"); kgdb_enabled = 1;
kgdb_enabled = 1; return;
return;
} }
#endif #endif
@ -293,23 +292,23 @@ int prom_putchar(char c)
// from adm5120/prom.c // from adm5120/prom.c
void prom_printf(char *fmt, ...) void prom_printf(char *fmt, ...)
{ {
va_list args; va_list args;
int l; int l;
char *p, *buf_end; char *p, *buf_end;
char buf[1024]; char buf[1024];
va_start(args, fmt); va_start(args, fmt);
l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */ l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */
va_end(args); va_end(args);
buf_end = buf + l; buf_end = buf + l;
for (p = buf; p < buf_end; p++) { for (p = buf; p < buf_end; p++) {
/* Crude cr/nl handling is better than none */ /* Crude cr/nl handling is better than none */
if (*p == '\n') if (*p == '\n')
prom_putchar('\r'); prom_putchar('\r');
prom_putchar(*p); prom_putchar(*p);
} }
} }
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
@ -320,7 +319,7 @@ int putDebugChar(char c)
char getDebugChar(void) char getDebugChar(void)
{ {
return prom_getchar(); return prom_getchar();
} }
#endif #endif

View File

@ -61,7 +61,7 @@ static void ar7_machine_halt(void)
static void ar7_machine_power_off(void) static void ar7_machine_power_off(void)
{ {
volatile u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1); volatile u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1);
u32 power_state = *power_reg | (3 << 30); u32 power_state = *power_reg | (3 << 30);
*power_reg = power_state; *power_reg = power_state;
ar7_machine_halt(); ar7_machine_halt();

View File

@ -39,10 +39,10 @@
#define VLYNQ_CTRL_PM_ENABLE 0x80000000 #define VLYNQ_CTRL_PM_ENABLE 0x80000000
#define VLYNQ_CTRL_CLOCK_INT 0x00008000 #define VLYNQ_CTRL_CLOCK_INT 0x00008000
#define VLYNQ_CTRL_CLOCK_DIV(x) ((x & 7) << 16) #define VLYNQ_CTRL_CLOCK_DIV(x) (((x) & 7) << 16)
#define VLYNQ_CTRL_INT_LOCAL 0x00004000 #define VLYNQ_CTRL_INT_LOCAL 0x00004000
#define VLYNQ_CTRL_INT_ENABLE 0x00002000 #define VLYNQ_CTRL_INT_ENABLE 0x00002000
#define VLYNQ_CTRL_INT_VECTOR(x) ((x & 0x1f) << 8) #define VLYNQ_CTRL_INT_VECTOR(x) (((x) & 0x1f) << 8)
#define VLYNQ_CTRL_INT2CFG 0x00000080 #define VLYNQ_CTRL_INT2CFG 0x00000080
#define VLYNQ_CTRL_RESET 0x00000001 #define VLYNQ_CTRL_RESET 0x00000001
@ -197,11 +197,11 @@ static irqreturn_t vlynq_irq(int irq, void *dev_id)
} }
static struct irq_chip vlynq_irq_chip = { static struct irq_chip vlynq_irq_chip = {
.typename = "VLYNQ", .typename = "VLYNQ",
.name = "vlynq", .name = "vlynq",
.unmask = vlynq_irq_unmask, .unmask = vlynq_irq_unmask,
.mask = vlynq_irq_mask, .mask = vlynq_irq_mask,
.set_type = vlynq_irq_type, .set_type = vlynq_irq_type,
}; };
static int vlynq_setup_irq(struct vlynq_device *dev) static int vlynq_setup_irq(struct vlynq_device *dev)
@ -452,14 +452,14 @@ static int vlynq_probe(struct platform_device *pdev)
if (!request_mem_region(regs_res->start, len, dev->dev.bus_id)) { if (!request_mem_region(regs_res->start, len, dev->dev.bus_id)) {
printk("%s: Can't request vlynq registers\n", dev->dev.bus_id); printk("%s: Can't request vlynq registers\n", dev->dev.bus_id);
result = -ENXIO; result = -ENXIO;
goto fail_request; goto fail_request;
} }
dev->local = ioremap_nocache(regs_res->start, len); dev->local = ioremap_nocache(regs_res->start, len);
if (!dev->local) { if (!dev->local) {
printk("%s: Can't remap vlynq registers\n", dev->dev.bus_id); printk("%s: Can't remap vlynq registers\n", dev->dev.bus_id);
result = -ENXIO; result = -ENXIO;
goto fail_remap; goto fail_remap;
} }
dev->remote = (struct vlynq_regs *)((u32)dev->local + 128); dev->remote = (struct vlynq_regs *)((u32)dev->local + 128);

View File

@ -71,7 +71,7 @@ static struct semaphore open_semaphore;
static unsigned expect_close; static unsigned expect_close;
/* XXX currently fixed, allows max margin ~68.72 secs */ /* XXX currently fixed, allows max margin ~68.72 secs */
#define prescale_value 0xFFFF #define prescale_value 0xffff
// Offset of the WDT registers // Offset of the WDT registers
static unsigned long ar7_regs_wdt; static unsigned long ar7_regs_wdt;
@ -79,37 +79,37 @@ static unsigned long ar7_regs_wdt;
static ar7_wdt_t *ar7_wdt; static ar7_wdt_t *ar7_wdt;
static void ar7_wdt_get_regs(void) static void ar7_wdt_get_regs(void)
{ {
u16 chip_id = ar7_chip_id(); u16 chip_id = ar7_chip_id();
switch (chip_id) switch (chip_id)
{ {
case AR7_CHIP_7100: case AR7_CHIP_7100:
case AR7_CHIP_7200: case AR7_CHIP_7200:
ar7_regs_wdt = AR7_REGS_WDT; ar7_regs_wdt = AR7_REGS_WDT;
break; break;
default: default:
ar7_regs_wdt = UR8_REGS_WDT; ar7_regs_wdt = UR8_REGS_WDT;
break; break;
} }
} }
static void ar7_wdt_kick(u32 value) static void ar7_wdt_kick(u32 value)
{ {
ar7_wdt->kick_lock = 0x5555; ar7_wdt->kick_lock = 0x5555;
if ((ar7_wdt->kick_lock & 3) == 1) { if ((ar7_wdt->kick_lock & 3) == 1) {
ar7_wdt->kick_lock = 0xAAAA; ar7_wdt->kick_lock = 0xaaaa;
if ((ar7_wdt->kick_lock & 3) == 3) { if ((ar7_wdt->kick_lock & 3) == 3) {
ar7_wdt->kick = value; ar7_wdt->kick = value;
return; return;
} }
} }
printk(KERN_ERR DRVNAME ": failed to unlock WDT kick reg\n"); printk(KERN_ERR DRVNAME ": failed to unlock WDT kick reg\n");
} }
static void ar7_wdt_prescale(u32 value) static void ar7_wdt_prescale(u32 value)
{ {
ar7_wdt->prescale_lock = 0x5A5A; ar7_wdt->prescale_lock = 0x5a5a;
if ((ar7_wdt->prescale_lock & 3) == 1) { if ((ar7_wdt->prescale_lock & 3) == 1) {
ar7_wdt->prescale_lock = 0xA5A5; ar7_wdt->prescale_lock = 0xa5a5;
if ((ar7_wdt->prescale_lock & 3) == 3) { if ((ar7_wdt->prescale_lock & 3) == 3) {
ar7_wdt->prescale = value; ar7_wdt->prescale = value;
return; return;
@ -122,7 +122,7 @@ static void ar7_wdt_change(u32 value)
{ {
ar7_wdt->change_lock = 0x6666; ar7_wdt->change_lock = 0x6666;
if ((ar7_wdt->change_lock & 3) == 1) { if ((ar7_wdt->change_lock & 3) == 1) {
ar7_wdt->change_lock = 0xBBBB; ar7_wdt->change_lock = 0xbbbb;
if ((ar7_wdt->change_lock & 3) == 3) { if ((ar7_wdt->change_lock & 3) == 3) {
ar7_wdt->change = value; ar7_wdt->change = value;
return; return;
@ -135,9 +135,9 @@ static void ar7_wdt_disable(u32 value)
{ {
ar7_wdt->disable_lock = 0x7777; ar7_wdt->disable_lock = 0x7777;
if ((ar7_wdt->disable_lock & 3) == 1) { if ((ar7_wdt->disable_lock & 3) == 1) {
ar7_wdt->disable_lock = 0xCCCC; ar7_wdt->disable_lock = 0xcccc;
if ((ar7_wdt->disable_lock & 3) == 2) { if ((ar7_wdt->disable_lock & 3) == 2) {
ar7_wdt->disable_lock = 0xDDDD; ar7_wdt->disable_lock = 0xdddd;
if ((ar7_wdt->disable_lock & 3) == 3) { if ((ar7_wdt->disable_lock & 3) == 3) {
ar7_wdt->disable = value; ar7_wdt->disable = value;
return; return;
@ -153,7 +153,7 @@ static void ar7_wdt_update_margin(int new_margin)
change = new_margin * (ar7_vbus_freq() / prescale_value); change = new_margin * (ar7_vbus_freq() / prescale_value);
if (change < 1) change = 1; if (change < 1) change = 1;
if (change > 0xFFFF) change = 0xFFFF; if (change > 0xffff) change = 0xffff;
ar7_wdt_change(change); ar7_wdt_change(change);
margin = change * prescale_value / ar7_vbus_freq(); margin = change * prescale_value / ar7_vbus_freq();
printk(KERN_INFO DRVNAME printk(KERN_INFO DRVNAME
@ -192,19 +192,19 @@ static int ar7_wdt_release(struct inode *inode, struct file *file)
} else if (!nowayout) { } else if (!nowayout) {
ar7_wdt_disable_wdt(); ar7_wdt_disable_wdt();
} }
up(&open_semaphore); up(&open_semaphore);
return 0; return 0;
} }
static int ar7_wdt_notify_sys(struct notifier_block *this, static int ar7_wdt_notify_sys(struct notifier_block *this,
unsigned long code, void *unused) unsigned long code, void *unused)
{ {
if (code == SYS_HALT || code == SYS_POWER_OFF) if (code == SYS_HALT || code == SYS_POWER_OFF)
if (!nowayout) if (!nowayout)
ar7_wdt_disable_wdt(); ar7_wdt_disable_wdt();
return NOTIFY_DONE; return NOTIFY_DONE;
} }
static struct notifier_block ar7_wdt_notifier = static struct notifier_block ar7_wdt_notifier =
@ -213,7 +213,7 @@ static struct notifier_block ar7_wdt_notifier =
}; };
static ssize_t ar7_wdt_write(struct file *file, const char *data, static ssize_t ar7_wdt_write(struct file *file, const char *data,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
return -ESPIPE; return -ESPIPE;
@ -238,7 +238,7 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data,
} }
static int ar7_wdt_ioctl(struct inode *inode, struct file *file, static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
static struct watchdog_info ident = { static struct watchdog_info ident = {
.identity = LONGNAME, .identity = LONGNAME,
@ -248,8 +248,6 @@ static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
int new_margin; int new_margin;
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if(copy_to_user((struct watchdog_info *)arg, &ident, if(copy_to_user((struct watchdog_info *)arg, &ident,
sizeof(ident))) sizeof(ident)))
@ -276,6 +274,8 @@ static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
if (put_user(margin, (int *)arg)) if (put_user(margin, (int *)arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
default:
return -ENOTTY;
} }
} }
@ -297,7 +297,7 @@ static int __init ar7_wdt_init(void)
{ {
int rc; int rc;
ar7_wdt_get_regs(); ar7_wdt_get_regs();
if (!request_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t), LONGNAME)) { if (!request_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t), LONGNAME)) {
printk(KERN_WARNING DRVNAME ": watchdog I/O region busy\n"); printk(KERN_WARNING DRVNAME ": watchdog I/O region busy\n");
@ -314,15 +314,15 @@ static int __init ar7_wdt_init(void)
rc = misc_register(&ar7_wdt_miscdev); rc = misc_register(&ar7_wdt_miscdev);
if (rc) { if (rc) {
printk(KERN_ERR DRVNAME ": unable to register misc device\n"); printk(KERN_ERR DRVNAME ": unable to register misc device\n");
goto out_alloc; goto out_alloc;
} }
rc = register_reboot_notifier(&ar7_wdt_notifier); rc = register_reboot_notifier(&ar7_wdt_notifier);
if (rc) { if (rc) {
printk(KERN_ERR DRVNAME ": unable to register reboot notifier\n"); printk(KERN_ERR DRVNAME ": unable to register reboot notifier\n");
goto out_register; goto out_register;
} }
goto out; goto out;
out_register: out_register:
@ -335,9 +335,9 @@ out:
static void __exit ar7_wdt_cleanup(void) static void __exit ar7_wdt_cleanup(void)
{ {
unregister_reboot_notifier(&ar7_wdt_notifier); unregister_reboot_notifier(&ar7_wdt_notifier);
misc_deregister(&ar7_wdt_miscdev); misc_deregister(&ar7_wdt_miscdev);
iounmap(ar7_wdt); iounmap(ar7_wdt);
release_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t)); release_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t));
} }

View File

@ -242,14 +242,14 @@ static void cpmac_dump_regs(u32 *base, int count)
static const char *cpmac_dump_buf(const uint8_t * buf, unsigned size) static const char *cpmac_dump_buf(const uint8_t * buf, unsigned size)
{ {
static char buffer[3 * 25 + 1]; static char buffer[3 * 25 + 1];
char *p = &buffer[0]; char *p = &buffer[0];
if (size > 20) if (size > 20)
size = 20; size = 20;
while (size-- > 0) { while (size-- > 0) {
p += sprintf(p, " %02x", *buf++); p += sprintf(p, " %02x", *buf++);
} }
return buffer; return buffer;
} }
#endif #endif
@ -336,7 +336,7 @@ static void cpmac_set_multicast_list(struct net_device *dev)
if(dev->flags & IFF_PROMISC) { if(dev->flags & IFF_PROMISC) {
priv->regs->mbp &= ~MBP_PROMISCCHAN(0); /* promisc channel 0 */ priv->regs->mbp &= ~MBP_PROMISCCHAN(0); /* promisc channel 0 */
priv->regs->mbp |= MBP_RXPROMISC; priv->regs->mbp |= MBP_RXPROMISC;
} else { } else {
priv->regs->mbp &= ~MBP_RXPROMISC; priv->regs->mbp &= ~MBP_RXPROMISC;
if(dev->flags & IFF_ALLMULTI) { if(dev->flags & IFF_ALLMULTI) {
/* enable all multicast mode */ /* enable all multicast mode */
@ -460,8 +460,8 @@ static void cpmac_rx(struct net_device *dev)
desc = priv->rx_head; desc = priv->rx_head;
dma_cache_inv((u32)desc, 16); dma_cache_inv((u32)desc, 16);
#ifdef CPMAC_DEBUG #ifdef CPMAC_DEBUG
printk(KERN_DEBUG "%s: len=%d, %s\n", __func__, pkt->datalen, printk(KERN_DEBUG "%s: len=%d, %s\n", __func__, pkt->datalen,
cpmac_dump_buf(data, pkt->datalen)); cpmac_dump_buf(data, pkt->datalen));
#endif #endif
while ((desc->dataflags & CPMAC_OWN) == 0) { while ((desc->dataflags & CPMAC_OWN) == 0) {
@ -527,13 +527,13 @@ static int cpmac_poll(struct net_device *dev, int *budget)
static void static void
cpmac_alloc_skbs(struct work_struct *work) cpmac_alloc_skbs(struct work_struct *work)
{ {
struct cpmac_priv *priv = container_of(work, struct cpmac_priv, struct cpmac_priv *priv = container_of(work, struct cpmac_priv,
alloc_work); alloc_work);
#else #else
static void static void
cpmac_alloc_skbs(void *data) cpmac_alloc_skbs(void *data)
{ {
struct net_device *dev = (struct net_device*)data; struct net_device *dev = (struct net_device*)data;
struct cpmac_priv *priv = netdev_priv(dev); struct cpmac_priv *priv = netdev_priv(dev);
#endif #endif
unsigned long flags; unsigned long flags;
@ -576,7 +576,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
len = skb->len; len = skb->len;
#ifdef CPMAC_DEBUG #ifdef CPMAC_DEBUG
printk(KERN_DEBUG "%s: len=%d\n", __func__, len); //cpmac_dump_buf(const uint8_t * buf, unsigned size) printk(KERN_DEBUG "%s: len=%d\n", __func__, len); //cpmac_dump_buf(const uint8_t * buf, unsigned size)
#endif #endif
if (unlikely(len < ETH_ZLEN)) { if (unlikely(len < ETH_ZLEN)) {
if (unlikely(skb_padto(skb, ETH_ZLEN))) { if (unlikely(skb_padto(skb, ETH_ZLEN))) {
@ -753,42 +753,42 @@ static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static int cpmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int cpmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
struct cpmac_priv *priv = netdev_priv(dev); struct cpmac_priv *priv = netdev_priv(dev);
if (priv->phy) if (priv->phy)
return phy_ethtool_gset(priv->phy, cmd); return phy_ethtool_gset(priv->phy, cmd);
return -EINVAL; return -EINVAL;
} }
static int cpmac_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int cpmac_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
struct cpmac_priv *priv = netdev_priv(dev); struct cpmac_priv *priv = netdev_priv(dev);
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (priv->phy) if (priv->phy)
return phy_ethtool_sset(priv->phy, cmd); return phy_ethtool_sset(priv->phy, cmd);
return -EINVAL; return -EINVAL;
} }
static void cpmac_get_drvinfo(struct net_device *dev, static void cpmac_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "cpmac"); strcpy(info->driver, "cpmac");
strcpy(info->version, "0.0.3"); strcpy(info->version, "0.0.3");
info->fw_version[0] = '\0'; info->fw_version[0] = '\0';
sprintf(info->bus_info, "%s", "cpmac"); sprintf(info->bus_info, "%s", "cpmac");
info->regdump_len = 0; info->regdump_len = 0;
} }
static const struct ethtool_ops cpmac_ethtool_ops = { static const struct ethtool_ops cpmac_ethtool_ops = {
.get_settings = cpmac_get_settings, .get_settings = cpmac_get_settings,
.set_settings = cpmac_set_settings, .set_settings = cpmac_set_settings,
.get_drvinfo = cpmac_get_drvinfo, .get_drvinfo = cpmac_get_drvinfo,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
}; };
static struct net_device_stats *cpmac_stats(struct net_device *dev) static struct net_device_stats *cpmac_stats(struct net_device *dev)
@ -937,9 +937,9 @@ static int cpmac_open(struct net_device *dev)
priv->rx_head = &priv->desc_ring[CPMAC_TX_RING_SIZE]; priv->rx_head = &priv->desc_ring[CPMAC_TX_RING_SIZE];
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs); INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs);
#else #else
INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs, dev); INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs, dev);
#endif #endif
schedule_work(&priv->alloc_work); schedule_work(&priv->alloc_work);
flush_scheduled_work(); flush_scheduled_work();
@ -961,7 +961,7 @@ static int cpmac_open(struct net_device *dev)
} }
if((res = request_irq(dev->irq, cpmac_irq, SA_INTERRUPT, if((res = request_irq(dev->irq, cpmac_irq, SA_INTERRUPT,
dev->name, dev))) { dev->name, dev))) {
printk("%s: failed to obtain irq\n", dev->name); printk("%s: failed to obtain irq\n", dev->name);
goto fail_irq; goto fail_irq;
} }

View File

@ -33,9 +33,9 @@
#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00) #define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00)
#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600) #define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800) #define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1A00) #define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1C00) #define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
#define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1E00) #define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1e00)
#define AR7_REGS_IRQ (AR7_REGS_BASE + 0x2400) #define AR7_REGS_IRQ (AR7_REGS_BASE + 0x2400)
#define AR7_REGS_MAC1 (AR7_REGS_BASE + 0x2800) #define AR7_REGS_MAC1 (AR7_REGS_BASE + 0x2800)
@ -43,9 +43,9 @@
#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00) #define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00)
#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00) #define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00)
#define AR7_RESET_PEREPHERIAL 0x0 #define AR7_RESET_PEREPHERIAL 0x0
#define AR7_RESET_SOFTWARE 0x4 #define AR7_RESET_SOFTWARE 0x4
#define AR7_RESET_STATUS 0x8 #define AR7_RESET_STATUS 0x8
#define AR7_RESET_BIT_CPMAC_LO 17 #define AR7_RESET_BIT_CPMAC_LO 17
#define AR7_RESET_BIT_CPMAC_HI 21 #define AR7_RESET_BIT_CPMAC_HI 21
@ -53,10 +53,10 @@
#define AR7_RESET_BIT_EPHY 26 #define AR7_RESET_BIT_EPHY 26
/* GPIO control registers */ /* GPIO control registers */
#define AR7_GPIO_INPUT 0x0 #define AR7_GPIO_INPUT 0x0
#define AR7_GPIO_OUTPUT 0x4 #define AR7_GPIO_OUTPUT 0x4
#define AR7_GPIO_DIR 0x8 #define AR7_GPIO_DIR 0x8
#define AR7_GPIO_ENABLE 0xC #define AR7_GPIO_ENABLE 0xc
#define AR7_CHIP_7100 0x18 #define AR7_CHIP_7100 0x18
#define AR7_CHIP_7200 0x2b #define AR7_CHIP_7200 0x2b

View File

@ -7,20 +7,22 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk include $(INCLUDE_DIR)/image.mk
DROP_SECTIONS := .reginfo .mdebug .comment .note .pdr .options .MIPS.options DROP_SECTIONS:=.reginfo .mdebug .comment .note .pdr .options .MIPS.options
OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS)) OBJCOPY_SREC:=$(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
LOADADDR := 0x94600000 LOADADDR:=0x94600000
KERNEL_ENTRY := 0x94100000 KERNEL_ENTRY:=0x94100000
RAMSTART := 0x94000000 RAMSTART:=0x94000000
RAMSIZE := 0x00100000 RAMSIZE:=0x00100000
EVA_LOADADDR := 0x94100000
LOADER_MAKEOPTS= \ LOADER_MAKEOPTS= \
KDIR=$(KDIR) \ KDIR=$(KDIR) \
LOADADDR=$(LOADADDR) \ LOADADDR=$(LOADADDR) \
KERNEL_ENTRY=$(KERNEL_ENTRY) \ KERNEL_ENTRY=$(KERNEL_ENTRY) \
RAMSTART=$(RAMSTART) \ RAMSTART=$(RAMSTART) \
RAMSIZE=$(RAMSIZE) RAMSIZE=$(RAMSIZE)
CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \ CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
-fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \ -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \