parent
ddec515a09
commit
0efffbaf30
20 changed files with 439 additions and 475 deletions
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -96,7 +94,7 @@ int ar7_cpu_clock = 150000000;
|
|||
EXPORT_SYMBOL(ar7_cpu_clock);
|
||||
int ar7_bus_clock = 125000000;
|
||||
EXPORT_SYMBOL(ar7_bus_clock);
|
||||
int ar7_dsp_clock = 0;
|
||||
int ar7_dsp_clock;
|
||||
EXPORT_SYMBOL(ar7_dsp_clock);
|
||||
|
||||
static int gcd(int a, int b)
|
||||
|
@ -261,7 +259,10 @@ static void tnetd7300_set_clock(u32 shift, struct tnetd7300_clock *clock,
|
|||
static void __init tnetd7300_init_clocks(void)
|
||||
{
|
||||
u32 *bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
|
||||
struct tnetd7300_clocks *clocks = (struct tnetd7300_clocks *)ioremap_nocache(AR7_REGS_POWER + 0x20, sizeof(struct tnetd7300_clocks));
|
||||
struct tnetd7300_clocks *clocks =
|
||||
(struct tnetd7300_clocks *)
|
||||
ioremap_nocache(AR7_REGS_POWER + 0x20,
|
||||
sizeof(struct tnetd7300_clocks));
|
||||
|
||||
ar7_bus_clock = tnetd7300_get_clock(BUS_PLL_SOURCE_SHIFT,
|
||||
&clocks->bus, bootcr, AR7_AFE_CLOCK);
|
||||
|
@ -272,10 +273,10 @@ static void __init tnetd7300_init_clocks(void)
|
|||
} else {
|
||||
ar7_cpu_clock = ar7_bus_clock;
|
||||
}
|
||||
#if 0
|
||||
/*
|
||||
tnetd7300_set_clock(USB_PLL_SOURCE_SHIFT, &clocks->usb,
|
||||
bootcr, 48000000);
|
||||
#endif
|
||||
*/
|
||||
if (ar7_dsp_clock == 250000000)
|
||||
tnetd7300_set_clock(DSP_PLL_SOURCE_SHIFT, &clocks->dsp,
|
||||
bootcr, ar7_dsp_clock);
|
||||
|
@ -300,7 +301,9 @@ static int tnetd7200_get_clock(int base, struct tnetd7200_clock *clock,
|
|||
static void tnetd7200_set_clock(int base, struct tnetd7200_clock *clock,
|
||||
int prediv, int postdiv, int postdiv2, int mul, u32 frequency)
|
||||
{
|
||||
printk("Clocks: base = %d, frequency = %u, prediv = %d, postdiv = %d, postdiv2 = %d, mul = %d\n",
|
||||
printk(KERN_INFO
|
||||
"Clocks: base = %d, frequency = %u, prediv = %d, "
|
||||
"postdiv = %d, postdiv2 = %d, mul = %d\n",
|
||||
base, frequency, prediv, postdiv, postdiv2, mul);
|
||||
|
||||
clock->ctrl = 0;
|
||||
|
@ -331,7 +334,7 @@ static void tnetd7200_set_clock(int base, struct tnetd7200_clock *clock,
|
|||
static int tnetd7200_get_clock_base(int clock_id, u32 *bootcr)
|
||||
{
|
||||
if (*bootcr & BOOT_PLL_ASYNC_MODE) {
|
||||
// Async
|
||||
/* Async */
|
||||
switch (clock_id) {
|
||||
case TNETD7200_CLOCK_ID_DSP:
|
||||
return AR7_REF_CLOCK;
|
||||
|
@ -339,9 +342,9 @@ static int tnetd7200_get_clock_base(int clock_id, u32 *bootcr)
|
|||
return AR7_AFE_CLOCK;
|
||||
}
|
||||
} else {
|
||||
// Sync
|
||||
/* Sync */
|
||||
if (*bootcr & BOOT_PLL_2TO1_MODE) {
|
||||
// 2:1
|
||||
/* 2:1 */
|
||||
switch (clock_id) {
|
||||
case TNETD7200_CLOCK_ID_DSP:
|
||||
return AR7_REF_CLOCK;
|
||||
|
@ -349,7 +352,7 @@ static int tnetd7200_get_clock_base(int clock_id, u32 *bootcr)
|
|||
return AR7_AFE_CLOCK;
|
||||
}
|
||||
} else {
|
||||
// 1:1
|
||||
/* 1:1 */
|
||||
return AR7_REF_CLOCK;
|
||||
}
|
||||
}
|
||||
|
@ -359,7 +362,10 @@ static int tnetd7200_get_clock_base(int clock_id, u32 *bootcr)
|
|||
static void __init tnetd7200_init_clocks(void)
|
||||
{
|
||||
u32 *bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
|
||||
struct tnetd7200_clocks *clocks = (struct tnetd7200_clocks *)ioremap_nocache(AR7_REGS_POWER + 0x80, sizeof(struct tnetd7200_clocks));
|
||||
struct tnetd7200_clocks *clocks =
|
||||
(struct tnetd7200_clocks *)
|
||||
ioremap_nocache(AR7_REGS_POWER + 0x80,
|
||||
sizeof(struct tnetd7200_clocks));
|
||||
int cpu_base, cpu_mul, cpu_prediv, cpu_postdiv;
|
||||
int dsp_base, dsp_mul, dsp_prediv, dsp_postdiv;
|
||||
int usb_base, usb_mul, usb_prediv, usb_postdiv;
|
||||
|
@ -371,79 +377,94 @@ static void __init tnetd7200_init_clocks(void)
|
|||
Clocks: Async mode
|
||||
Clocks: Setting DSP clock
|
||||
Clocks: prediv: 1, postdiv: 1, mul: 5
|
||||
Clocks: base = 25000000, frequency = 125000000, prediv = 1, postdiv = 2, postdiv2 = 1, mul = 10
|
||||
Clocks: base = 25000000, frequency = 125000000, prediv = 1,
|
||||
postdiv = 2, postdiv2 = 1, mul = 10
|
||||
Clocks: Setting CPU clock
|
||||
Adjusted requested frequency 211000000 to 211968000
|
||||
Clocks: prediv: 1, postdiv: 1, mul: 6
|
||||
Clocks: base = 35328000, frequency = 211968000, prediv = 1, postdiv = 1, postdiv2 = -1, mul = 6
|
||||
Clocks: base = 35328000, frequency = 211968000, prediv = 1,
|
||||
postdiv = 1, postdiv2 = -1, mul = 6
|
||||
Clocks: Setting USB clock
|
||||
Adjusted requested frequency 48000000 to 48076920
|
||||
Clocks: prediv: 13, postdiv: 1, mul: 5
|
||||
Clocks: base = 125000000, frequency = 48000000, prediv = 13, postdiv = 1, postdiv2 = -1, mul = 5
|
||||
Clocks: base = 125000000, frequency = 48000000, prediv = 13,
|
||||
postdiv = 1, postdiv2 = -1, mul = 5
|
||||
|
||||
DSL didn't work if you didn't set the postdiv 2:1 postdiv2 combination, driver hung on startup.
|
||||
Haven't tested this on a synchronous board, neither do i know what to do with ar7_dsp_clock
|
||||
DSL didn't work if you didn't set the postdiv 2:1 postdiv2 combination,
|
||||
driver hung on startup.
|
||||
Haven't tested this on a synchronous board,
|
||||
neither do i know what to do with ar7_dsp_clock
|
||||
*/
|
||||
|
||||
cpu_base = tnetd7200_get_clock_base(TNETD7200_CLOCK_ID_CPU, bootcr);
|
||||
dsp_base = tnetd7200_get_clock_base(TNETD7200_CLOCK_ID_DSP, bootcr);
|
||||
|
||||
if (*bootcr & BOOT_PLL_ASYNC_MODE) {
|
||||
printk("Clocks: Async mode\n");
|
||||
printk(KERN_INFO "Clocks: Async mode\n");
|
||||
|
||||
printk("Clocks: Setting DSP clock\n");
|
||||
calculate(dsp_base, TNETD7200_DEF_DSP_CLK, &dsp_prediv, &dsp_postdiv, &dsp_mul);
|
||||
ar7_bus_clock = ((dsp_base / dsp_prediv) * dsp_mul) / dsp_postdiv;
|
||||
printk(KERN_INFO "Clocks: Setting DSP clock\n");
|
||||
calculate(dsp_base, TNETD7200_DEF_DSP_CLK,
|
||||
&dsp_prediv, &dsp_postdiv, &dsp_mul);
|
||||
ar7_bus_clock =
|
||||
((dsp_base / dsp_prediv) * dsp_mul) / dsp_postdiv;
|
||||
tnetd7200_set_clock(dsp_base, &clocks->dsp,
|
||||
dsp_prediv, dsp_postdiv * 2, dsp_postdiv, dsp_mul * 2,
|
||||
ar7_bus_clock);
|
||||
|
||||
printk("Clocks: Setting CPU clock\n");
|
||||
calculate(cpu_base, TNETD7200_DEF_CPU_CLK, &cpu_prediv, &cpu_postdiv, &cpu_mul);
|
||||
ar7_cpu_clock = ((cpu_base / cpu_prediv) * cpu_mul) / cpu_postdiv;
|
||||
printk(KERN_INFO "Clocks: Setting CPU clock\n");
|
||||
calculate(cpu_base, TNETD7200_DEF_CPU_CLK, &cpu_prediv,
|
||||
&cpu_postdiv, &cpu_mul);
|
||||
ar7_cpu_clock =
|
||||
((cpu_base / cpu_prediv) * cpu_mul) / cpu_postdiv;
|
||||
tnetd7200_set_clock(cpu_base, &clocks->cpu,
|
||||
cpu_prediv, cpu_postdiv, -1, cpu_mul,
|
||||
ar7_cpu_clock);
|
||||
|
||||
} else {
|
||||
if (*bootcr & BOOT_PLL_2TO1_MODE) {
|
||||
printk("Clocks: Sync 2:1 mode\n");
|
||||
printk(KERN_INFO "Clocks: Sync 2:1 mode\n");
|
||||
|
||||
printk("Clocks: Setting CPU clock\n");
|
||||
calculate(cpu_base, TNETD7200_DEF_CPU_CLK, &cpu_prediv, &cpu_postdiv, &cpu_mul);
|
||||
ar7_cpu_clock = ((cpu_base / cpu_prediv) * cpu_mul) / cpu_postdiv;
|
||||
printk(KERN_INFO "Clocks: Setting CPU clock\n");
|
||||
calculate(cpu_base, TNETD7200_DEF_CPU_CLK, &cpu_prediv,
|
||||
&cpu_postdiv, &cpu_mul);
|
||||
ar7_cpu_clock = ((cpu_base / cpu_prediv) * cpu_mul)
|
||||
/ cpu_postdiv;
|
||||
tnetd7200_set_clock(cpu_base, &clocks->cpu,
|
||||
cpu_prediv, cpu_postdiv, -1, cpu_mul,
|
||||
ar7_cpu_clock);
|
||||
|
||||
printk("Clocks: Setting DSP clock\n");
|
||||
calculate(dsp_base, TNETD7200_DEF_DSP_CLK, &dsp_prediv, &dsp_postdiv, &dsp_mul);
|
||||
printk(KERN_INFO "Clocks: Setting DSP clock\n");
|
||||
calculate(dsp_base, TNETD7200_DEF_DSP_CLK, &dsp_prediv,
|
||||
&dsp_postdiv, &dsp_mul);
|
||||
ar7_bus_clock = ar7_cpu_clock / 2;
|
||||
tnetd7200_set_clock(dsp_base, &clocks->dsp,
|
||||
dsp_prediv, dsp_postdiv * 2, dsp_postdiv, dsp_mul * 2,
|
||||
ar7_bus_clock);
|
||||
dsp_prediv, dsp_postdiv * 2, dsp_postdiv,
|
||||
dsp_mul * 2, ar7_bus_clock);
|
||||
} else {
|
||||
printk("Clocks: Sync 1:1 mode\n");
|
||||
printk(KERN_INFO "Clocks: Sync 1:1 mode\n");
|
||||
|
||||
printk("Clocks: Setting DSP clock\n");
|
||||
calculate(dsp_base, TNETD7200_DEF_CPU_CLK, &dsp_prediv, &dsp_postdiv, &dsp_mul);
|
||||
ar7_bus_clock = ((dsp_base / dsp_prediv) * dsp_mul) / dsp_postdiv;
|
||||
printk(KERN_INFO "Clocks: Setting DSP clock\n");
|
||||
calculate(dsp_base, TNETD7200_DEF_CPU_CLK, &dsp_prediv,
|
||||
&dsp_postdiv, &dsp_mul);
|
||||
ar7_bus_clock = ((dsp_base / dsp_prediv) * dsp_mul)
|
||||
/ dsp_postdiv;
|
||||
tnetd7200_set_clock(dsp_base, &clocks->dsp,
|
||||
dsp_prediv, dsp_postdiv * 2, dsp_postdiv, dsp_mul * 2,
|
||||
ar7_bus_clock);
|
||||
dsp_prediv, dsp_postdiv * 2, dsp_postdiv,
|
||||
dsp_mul * 2, ar7_bus_clock);
|
||||
|
||||
ar7_cpu_clock = ar7_bus_clock;
|
||||
}
|
||||
}
|
||||
|
||||
printk("Clocks: Setting USB clock\n");
|
||||
printk(KERN_INFO "Clocks: Setting USB clock\n");
|
||||
usb_base = ar7_bus_clock;
|
||||
calculate(usb_base, TNETD7200_DEF_USB_CLK, &usb_prediv, &usb_postdiv, &usb_mul);
|
||||
calculate(usb_base, TNETD7200_DEF_USB_CLK, &usb_prediv,
|
||||
&usb_postdiv, &usb_mul);
|
||||
tnetd7200_set_clock(usb_base, &clocks->usb,
|
||||
usb_prediv, usb_postdiv, -1, usb_mul,
|
||||
TNETD7200_DEF_USB_CLK);
|
||||
|
||||
#warning FIXME: ????! Hrmm
|
||||
#warning FIXME
|
||||
ar7_dsp_clock = ar7_cpu_clock;
|
||||
|
||||
iounmap(clocks);
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -73,6 +71,7 @@ static struct irq_chip ar7_sec_irq_type = {
|
|||
|
||||
static struct irqaction ar7_cascade_action = {
|
||||
.handler = no_action,
|
||||
|
||||
.name = "AR7 cascade interrupt"
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2007 OpenWrt.org
|
||||
*
|
||||
* Based on arch/mips/mm/init.c
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -28,8 +26,9 @@
|
|||
#include <linux/serial.h>
|
||||
#include <linux/serial_8250.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/ar7/ar7.h>
|
||||
#include <asm/ar7/gpio.h>
|
||||
#include <asm/ar7/prom.h>
|
||||
|
@ -253,8 +252,7 @@ static struct platform_device vlynq_high = {
|
|||
*/
|
||||
#if !defined(CONFIG_SERIAL_8250)
|
||||
|
||||
static struct plat_serial8250_port uart0_data =
|
||||
{
|
||||
static struct plat_serial8250_port uart0_data = {
|
||||
.mapbase = AR7_REGS_UART0,
|
||||
.irq = AR7_IRQ_UART0,
|
||||
.regshift = 2,
|
||||
|
@ -262,8 +260,7 @@ static struct plat_serial8250_port uart0_data =
|
|||
.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
|
||||
};
|
||||
|
||||
static struct plat_serial8250_port uart1_data =
|
||||
{
|
||||
static struct plat_serial8250_port uart1_data = {
|
||||
.mapbase = UR8_REGS_UART1,
|
||||
.irq = AR7_IRQ_UART1,
|
||||
.regshift = 2,
|
||||
|
@ -346,7 +343,7 @@ static int __init ar7_register_devices(void)
|
|||
return res;
|
||||
|
||||
|
||||
// Only TNETD73xx have a second serial port
|
||||
/* Only TNETD73xx have a second serial port */
|
||||
if (ar7_has_second_uart()) {
|
||||
uart_port[1].type = PORT_AR7;
|
||||
uart_port[1].line = 1;
|
||||
|
@ -361,21 +358,20 @@ static int __init ar7_register_devices(void)
|
|||
return res;
|
||||
}
|
||||
|
||||
#else // !CONFIG_SERIAL_8250
|
||||
#else /* !CONFIG_SERIAL_8250 */
|
||||
|
||||
uart_data[0].uartclk = ar7_bus_freq() / 2;
|
||||
uart_data[1].uartclk = uart_data[0].uartclk;
|
||||
|
||||
// Only TNETD73xx have a second serial port
|
||||
if (ar7_has_second_uart()) {
|
||||
/* Only TNETD73xx have a second serial port */
|
||||
if (ar7_has_second_uart())
|
||||
uart.dev.platform_data = uart_data;
|
||||
}
|
||||
|
||||
res = platform_device_register(&uart);
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
#endif // CONFIG_SERIAL_8250
|
||||
#endif /* CONFIG_SERIAL_8250 */
|
||||
|
||||
res = platform_device_register(&physmap_flash);
|
||||
if (res)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* Carsten Langgaard, carstenl@mips.com
|
||||
|
@ -27,9 +25,8 @@
|
|||
#include <linux/spinlock.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/io.h>
|
||||
#include <asm/bootinfo.h>
|
||||
#include <asm/mips-boards/prom.h>
|
||||
#include <asm/gdb-stub.h>
|
||||
|
||||
#include <asm/ar7/ar7.h>
|
||||
|
@ -53,6 +50,7 @@ char * prom_getenv(char *name)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(prom_getenv);
|
||||
|
||||
char * __init prom_getcmdline(void)
|
||||
{
|
||||
|
@ -119,23 +117,23 @@ static struct psp_var_map_entry psp_var_map[] = {
|
|||
|
||||
Well-known variable (num is looked up in table above for matching variable name)
|
||||
Example: cpufrequency=211968000
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
| 01 |CTRL|CHECKSUM | 01 | _2 | _1 | _1 | _9 | _6 | _8 | _0 | _0 | _0 | \0 | FF |
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
|
||||
| 01 |CTRL|CHECKSUM | 01 | _2 | _1 | _1 | _9 | _6 | _8 | _0 | _0 | _0 | \0 | FF
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
|
||||
|
||||
Name=Value pair in a single chunk
|
||||
Example: NAME=VALUE
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
| 00 |CTRL|CHECKSUM | 01 | _N | _A | _M | _E | _0 | _V | _A | _L | _U | _E | \0 |
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
|
||||
| 00 |CTRL|CHECKSUM | 01 | _N | _A | _M | _E | _0 | _V | _A | _L | _U | _E | \0
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
|
||||
|
||||
Name=Value pair in 2 chunks (len is the number of chunks)
|
||||
Example: bootloaderVersion=1.3.7.15
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
| 00 |CTRL|CHECKSUM | 02 | _b | _o | _o | _t | _l | _o | _a | _d | _e | _r | _V |
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
| _e | _r | _s | _i | _o | _n | \0 | _1 | _. | _3 | _. | _7 | _. | _1 | _5 | \0 |
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
|
||||
| 00 |CTRL|CHECKSUM | 02 | _b | _o | _o | _t | _l | _o | _a | _d | _e | _r | _V
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
|
||||
| _e | _r | _s | _i | _o | _n | \0 | _1 | _. | _3 | _. | _7 | _. | _1 | _5 | \0
|
||||
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
|
||||
|
||||
Data is padded with 0xFF
|
||||
|
||||
|
@ -289,7 +287,7 @@ int prom_putchar(char c)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// from adm5120/prom.c
|
||||
/* from adm5120/prom.c */
|
||||
void prom_printf(char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
@ -322,5 +320,3 @@ char getDebugChar(void)
|
|||
return prom_getchar();
|
||||
}
|
||||
#endif
|
||||
|
||||
EXPORT_SYMBOL(prom_getenv);
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* Carsten Langgaard, carstenl@mips.com
|
||||
|
@ -102,7 +100,8 @@ void __init plat_mem_setup(void)
|
|||
iomem_resource.start = 0;
|
||||
iomem_resource.end = ~0;
|
||||
|
||||
printk("%s, ID: 0x%04x, Revision: 0x%02x\n", get_system_type(),
|
||||
printk(KERN_INFO "%s, ID: 0x%04x, Revision: 0x%02x\n",
|
||||
get_system_type(),
|
||||
ar7_chip_id(), ar7_chip_rev());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* Carsten Langgaard, carstenl@mips.com
|
||||
|
@ -22,30 +20,7 @@
|
|||
* Setting up the clock on the MIPS boards.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/mc146818rtc.h>
|
||||
|
||||
#include <asm/mipsregs.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/hardirq.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/div64.h>
|
||||
#include <asm/cpu.h>
|
||||
#include <asm/time.h>
|
||||
#include <asm/mc146818-time.h>
|
||||
#include <asm/msc01_ic.h>
|
||||
|
||||
#include <asm/mips-boards/generic.h>
|
||||
#include <asm/mips-boards/prom.h>
|
||||
#include <asm/mips-boards/maltaint.h>
|
||||
#include <asm/mc146818-time.h>
|
||||
#include <asm/ar7/ar7.h>
|
||||
|
||||
void __init ar7_time_init(void)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -30,8 +28,9 @@
|
|||
#include <linux/irq.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/ar7/ar7.h>
|
||||
#include <asm/ar7/vlynq.h>
|
||||
|
||||
|
@ -81,10 +80,13 @@ struct vlynq_regs {
|
|||
static void vlynq_dump_regs(struct vlynq_device *dev)
|
||||
{
|
||||
int i;
|
||||
printk("VLYNQ local=%p remote=%p\n", dev->local, dev->remote);
|
||||
printk(KERN_DEBUG "VLYNQ local=%p remote=%p\n",
|
||||
dev->local, dev->remote);
|
||||
for (i = 0; i < 32; i++) {
|
||||
printk("VLYNQ: local %d: %08x\n", i + 1, ((u32 *)dev->local)[i]);
|
||||
printk("VLYNQ: remote %d: %08x\n", i + 1, ((u32 *)dev->remote)[i]);
|
||||
printk(KERN_DEBUG "VLYNQ: local %d: %08x\n",
|
||||
i + 1, ((u32 *)dev->local)[i]);
|
||||
printk(KERN_DEBUG "VLYNQ: remote %d: %08x\n",
|
||||
i + 1, ((u32 *)dev->remote)[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,10 +94,10 @@ static void vlynq_dump_mem(u32 *base, int count)
|
|||
{
|
||||
int i;
|
||||
for (i = 0; i < (count + 3) / 4; i++) {
|
||||
if (i % 4 == 0) printk("\nMEM[0x%04x]:", i * 4);
|
||||
printk(" 0x%08x", *(base + i));
|
||||
if (i % 4 == 0) printk(KERN_DEBUG "\nMEM[0x%04x]:", i * 4);
|
||||
printk(KERN_DEBUG " 0x%08x", *(base + i));
|
||||
}
|
||||
printk("\n");
|
||||
printk(KERN_DEBUG "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -212,7 +214,8 @@ static int vlynq_setup_irq(struct vlynq_device *dev)
|
|||
int i;
|
||||
|
||||
if (dev->local_irq == dev->remote_irq) {
|
||||
printk("%s: local vlynq irq should be different from remote\n",
|
||||
printk(KERN_WARNING
|
||||
"%s: local vlynq irq should be different from remote\n",
|
||||
dev->dev.bus_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -239,7 +242,7 @@ static int vlynq_setup_irq(struct vlynq_device *dev)
|
|||
}
|
||||
|
||||
if (request_irq(dev->irq, vlynq_irq, SA_SHIRQ, "vlynq", dev)) {
|
||||
printk("%s: request_irq failed\n", dev->dev.bus_id);
|
||||
printk(KERN_ERR "%s: request_irq failed\n", dev->dev.bus_id);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
|
@ -450,14 +453,16 @@ static int vlynq_probe(struct platform_device *pdev)
|
|||
|
||||
len = regs_res->end - regs_res->start;
|
||||
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(KERN_ERR "%s: Can't request vlynq registers\n",
|
||||
dev->dev.bus_id);
|
||||
result = -ENXIO;
|
||||
goto fail_request;
|
||||
}
|
||||
|
||||
dev->local = ioremap_nocache(regs_res->start, len);
|
||||
if (!dev->local) {
|
||||
printk("%s: Can't remap vlynq registers\n", dev->dev.bus_id);
|
||||
printk(KERN_ERR "%s: Can't remap vlynq registers\n",
|
||||
dev->dev.bus_id);
|
||||
result = -ENXIO;
|
||||
goto fail_remap;
|
||||
}
|
||||
|
@ -474,7 +479,7 @@ static int vlynq_probe(struct platform_device *pdev)
|
|||
goto fail_register;
|
||||
platform_set_drvdata(pdev, dev);
|
||||
|
||||
printk("%s: regs 0x%p, irq %d, mem 0x%p\n",
|
||||
printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n",
|
||||
dev->dev.bus_id, (void *)dev->regs_start, dev->irq,
|
||||
(void *)dev->mem_start);
|
||||
|
||||
|
|
|
@ -25,9 +25,8 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <gpio.h>
|
||||
|
@ -39,7 +38,7 @@ MODULE_AUTHOR("Nicolas Thill <nico@openwrt.org>");
|
|||
MODULE_DESCRIPTION(LONGNAME);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int ar7_gpio_major = 0;
|
||||
static int ar7_gpio_major;
|
||||
|
||||
static ssize_t ar7_gpio_write(struct file *file, const char __user *buf,
|
||||
size_t len, loff_t *ppos)
|
||||
|
|
|
@ -33,11 +33,10 @@
|
|||
#include <linux/reboot.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include <asm/ar7/ar7.h>
|
||||
|
||||
#define DRVNAME "ar7_wdt"
|
||||
|
@ -56,7 +55,7 @@ static int nowayout = WATCHDOG_NOWAYOUT;
|
|||
module_param(nowayout, int, 0);
|
||||
MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
|
||||
|
||||
typedef struct {
|
||||
struct ar7_wdt {
|
||||
u32 kick_lock;
|
||||
u32 kick;
|
||||
u32 change_lock;
|
||||
|
@ -65,7 +64,7 @@ typedef struct {
|
|||
u32 disable;
|
||||
u32 prescale_lock;
|
||||
u32 prescale;
|
||||
} ar7_wdt_t;
|
||||
};
|
||||
|
||||
static struct semaphore open_semaphore;
|
||||
static unsigned expect_close;
|
||||
|
@ -73,15 +72,14 @@ static unsigned expect_close;
|
|||
/* XXX currently fixed, allows max margin ~68.72 secs */
|
||||
#define prescale_value 0xffff
|
||||
|
||||
// Offset of the WDT registers
|
||||
/* Offset of the WDT registers */
|
||||
static unsigned long ar7_regs_wdt;
|
||||
// Pointer to the remapped WDT IO space
|
||||
static ar7_wdt_t *ar7_wdt;
|
||||
/* Pointer to the remapped WDT IO space */
|
||||
static struct ar7_wdt *ar7_wdt;
|
||||
static void ar7_wdt_get_regs(void)
|
||||
{
|
||||
u16 chip_id = ar7_chip_id();
|
||||
switch (chip_id)
|
||||
{
|
||||
switch (chip_id) {
|
||||
case AR7_CHIP_7100:
|
||||
case AR7_CHIP_7200:
|
||||
ar7_regs_wdt = AR7_REGS_WDT;
|
||||
|
@ -92,6 +90,7 @@ static void ar7_wdt_get_regs(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void ar7_wdt_kick(u32 value)
|
||||
{
|
||||
ar7_wdt->kick_lock = 0x5555;
|
||||
|
@ -188,7 +187,9 @@ static int ar7_wdt_open(struct inode *inode, struct file *file)
|
|||
static int ar7_wdt_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
if (!expect_close) {
|
||||
printk(KERN_WARNING DRVNAME ": watchdog device closed unexpectedly, will not disable the watchdog timer\n");
|
||||
printk(KERN_WARNING DRVNAME
|
||||
": watchdog device closed unexpectedly,"
|
||||
"will not disable the watchdog timer\n");
|
||||
} else if (!nowayout) {
|
||||
ar7_wdt_disable_wdt();
|
||||
}
|
||||
|
@ -207,8 +208,7 @@ static int ar7_wdt_notify_sys(struct notifier_block *this,
|
|||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static struct notifier_block ar7_wdt_notifier =
|
||||
{
|
||||
static struct notifier_block ar7_wdt_notifier = {
|
||||
.notifier_call = ar7_wdt_notify_sys
|
||||
};
|
||||
|
||||
|
@ -248,6 +248,8 @@ static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
|
|||
int new_margin;
|
||||
|
||||
switch (cmd) {
|
||||
default:
|
||||
return -ENOTTY;
|
||||
case WDIOC_GETSUPPORT:
|
||||
if (copy_to_user((struct watchdog_info *)arg, &ident,
|
||||
sizeof(ident)))
|
||||
|
@ -274,8 +276,6 @@ static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
|
|||
if (put_user(margin, (int *)arg))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
default:
|
||||
return -ENOTTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,12 +299,14 @@ static int __init ar7_wdt_init(void)
|
|||
|
||||
ar7_wdt_get_regs();
|
||||
|
||||
if (!request_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t), LONGNAME)) {
|
||||
if (!request_mem_region(ar7_regs_wdt, sizeof(struct ar7_wdt),
|
||||
LONGNAME)) {
|
||||
printk(KERN_WARNING DRVNAME ": watchdog I/O region busy\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
ar7_wdt = (ar7_wdt_t *)ioremap(ar7_regs_wdt, sizeof(ar7_wdt_t));
|
||||
ar7_wdt = (struct ar7_wdt *)
|
||||
ioremap(ar7_regs_wdt, sizeof(struct ar7_wdt));
|
||||
|
||||
ar7_wdt_disable_wdt();
|
||||
ar7_wdt_prescale(prescale_value);
|
||||
|
@ -320,7 +322,8 @@ static int __init ar7_wdt_init(void)
|
|||
|
||||
rc = register_reboot_notifier(&ar7_wdt_notifier);
|
||||
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;
|
||||
|
@ -328,7 +331,7 @@ static int __init ar7_wdt_init(void)
|
|||
out_register:
|
||||
misc_deregister(&ar7_wdt_miscdev);
|
||||
out_alloc:
|
||||
release_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t));
|
||||
release_mem_region(ar7_regs_wdt, sizeof(struct ar7_wdt));
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
|
@ -338,7 +341,7 @@ static void __exit ar7_wdt_cleanup(void)
|
|||
unregister_reboot_notifier(&ar7_wdt_notifier);
|
||||
misc_deregister(&ar7_wdt_miscdev);
|
||||
iounmap(ar7_wdt);
|
||||
release_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t));
|
||||
release_mem_region(ar7_regs_wdt, sizeof(struct ar7_wdt));
|
||||
}
|
||||
|
||||
module_init(ar7_wdt_init);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/err.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/io.h>
|
||||
#include <gpio.h>
|
||||
|
||||
#define DRVNAME "ar7-leds"
|
||||
|
|
|
@ -61,7 +61,8 @@ static int create_mtd_partitions(struct mtd_info *master,
|
|||
|
||||
do {
|
||||
offset = pre_size;
|
||||
master->read(master, offset, sizeof(header), &len, (u_char *)&header);
|
||||
master->read(master, offset,
|
||||
sizeof(header), &len, (u_char *)&header);
|
||||
if (!strncmp((char *)&header, "TIENV0.8", 8))
|
||||
ar7_parts[1].offset = pre_size;
|
||||
if (header.checksum == 0xfeedfa42)
|
||||
|
@ -101,7 +102,8 @@ static int create_mtd_partitions(struct mtd_info *master,
|
|||
break;
|
||||
}
|
||||
|
||||
master->read(master, root_offset, sizeof(header), &len, (u_char *)&header);
|
||||
master->read(master, root_offset,
|
||||
sizeof(header), &len, (u_char *)&header);
|
||||
if (header.checksum != SQUASHFS_MAGIC) {
|
||||
root_offset += master->erasesize - 1;
|
||||
root_offset &= ~(master->erasesize - 1);
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -23,7 +21,7 @@
|
|||
#include <linux/moduleparam.h>
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/kernel.h> /* printk() */
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/types.h>
|
||||
|
@ -45,7 +43,7 @@ MODULE_DESCRIPTION("TI AR7 ethernet driver (CPMAC)");
|
|||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int rx_ring_size = 64;
|
||||
static int disable_napi = 0;
|
||||
static int disable_napi;
|
||||
module_param(rx_ring_size, int, 64);
|
||||
module_param(disable_napi, int, 0);
|
||||
MODULE_PARM_DESC(rx_ring_size, "Size of rx ring (in skbs)");
|
||||
|
@ -53,40 +51,40 @@ MODULE_PARM_DESC(disable_napi, "Disable NAPI polling");
|
|||
|
||||
/* Register definitions */
|
||||
struct cpmac_control_regs {
|
||||
volatile u32 revision;
|
||||
volatile u32 control;
|
||||
volatile u32 teardown;
|
||||
volatile u32 unused;
|
||||
u32 revision;
|
||||
u32 control;
|
||||
u32 teardown;
|
||||
u32 unused;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct cpmac_int_regs {
|
||||
volatile u32 stat_raw;
|
||||
volatile u32 stat_masked;
|
||||
volatile u32 enable;
|
||||
volatile u32 clear;
|
||||
u32 stat_raw;
|
||||
u32 stat_masked;
|
||||
u32 enable;
|
||||
u32 clear;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct cpmac_stats {
|
||||
volatile u32 good;
|
||||
volatile u32 bcast;
|
||||
volatile u32 mcast;
|
||||
volatile u32 pause;
|
||||
volatile u32 crc_error;
|
||||
volatile u32 align_error;
|
||||
volatile u32 oversized;
|
||||
volatile u32 jabber;
|
||||
volatile u32 undersized;
|
||||
volatile u32 fragment;
|
||||
volatile u32 filtered;
|
||||
volatile u32 qos_filtered;
|
||||
volatile u32 octets;
|
||||
u32 good;
|
||||
u32 bcast;
|
||||
u32 mcast;
|
||||
u32 pause;
|
||||
u32 crc_error;
|
||||
u32 align_error;
|
||||
u32 oversized;
|
||||
u32 jabber;
|
||||
u32 undersized;
|
||||
u32 fragment;
|
||||
u32 filtered;
|
||||
u32 qos_filtered;
|
||||
u32 octets;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct cpmac_regs {
|
||||
struct cpmac_control_regs tx_ctrl;
|
||||
struct cpmac_control_regs rx_ctrl;
|
||||
volatile u32 unused1[56];
|
||||
volatile u32 mbp;
|
||||
u32 unused1[56];
|
||||
u32 mbp;
|
||||
/* MBP bits */
|
||||
#define MBP_RXPASSCRC 0x40000000
|
||||
#define MBP_RXQOS 0x20000000
|
||||
|
@ -100,15 +98,15 @@ struct cpmac_regs {
|
|||
#define MBP_BCASTCHAN(chan) (((chan) & 0x7) << 8)
|
||||
#define MBP_RXMCAST 0x00000020
|
||||
#define MBP_MCASTCHAN(chan) ((chan) & 0x7)
|
||||
volatile u32 unicast_enable;
|
||||
volatile u32 unicast_clear;
|
||||
volatile u32 max_len;
|
||||
volatile u32 buffer_offset;
|
||||
volatile u32 filter_flow_threshold;
|
||||
volatile u32 unused2[2];
|
||||
volatile u32 flow_thre[8];
|
||||
volatile u32 free_buffer[8];
|
||||
volatile u32 mac_control;
|
||||
u32 unicast_enable;
|
||||
u32 unicast_clear;
|
||||
u32 max_len;
|
||||
u32 buffer_offset;
|
||||
u32 filter_flow_threshold;
|
||||
u32 unused2[2];
|
||||
u32 flow_thre[8];
|
||||
u32 free_buffer[8];
|
||||
u32 mac_control;
|
||||
#define MAC_TXPTYPE 0x00000200
|
||||
#define MAC_TXPACE 0x00000040
|
||||
#define MAC_MII 0x00000020
|
||||
|
@ -117,48 +115,48 @@ struct cpmac_regs {
|
|||
#define MAC_MTEST 0x00000004
|
||||
#define MAC_LOOPBACK 0x00000002
|
||||
#define MAC_FDX 0x00000001
|
||||
volatile u32 mac_status;
|
||||
u32 mac_status;
|
||||
#define MACST_QOS 0x4
|
||||
#define MACST_RXFLOW 0x2
|
||||
#define MACST_TXFLOW 0x1
|
||||
volatile u32 emc_control;
|
||||
volatile u32 unused3;
|
||||
u32 emc_control;
|
||||
u32 unused3;
|
||||
struct cpmac_int_regs tx_int;
|
||||
volatile u32 mac_int_vector;
|
||||
u32 mac_int_vector;
|
||||
/* Int Status bits */
|
||||
#define INTST_STATUS 0x80000
|
||||
#define INTST_HOST 0x40000
|
||||
#define INTST_RX 0x20000
|
||||
#define INTST_TX 0x10000
|
||||
volatile u32 mac_eoi_vector;
|
||||
volatile u32 unused4[2];
|
||||
u32 mac_eoi_vector;
|
||||
u32 unused4[2];
|
||||
struct cpmac_int_regs rx_int;
|
||||
volatile u32 mac_int_stat_raw;
|
||||
volatile u32 mac_int_stat_masked;
|
||||
volatile u32 mac_int_enable;
|
||||
volatile u32 mac_int_clear;
|
||||
volatile u32 mac_addr_low[8];
|
||||
volatile u32 mac_addr_mid;
|
||||
volatile u32 mac_addr_high;
|
||||
volatile u32 mac_hash_low;
|
||||
volatile u32 mac_hash_high;
|
||||
volatile u32 boff_test;
|
||||
volatile u32 pac_test;
|
||||
volatile u32 rx_pause;
|
||||
volatile u32 tx_pause;
|
||||
volatile u32 unused5[2];
|
||||
u32 mac_int_stat_raw;
|
||||
u32 mac_int_stat_masked;
|
||||
u32 mac_int_enable;
|
||||
u32 mac_int_clear;
|
||||
u32 mac_addr_low[8];
|
||||
u32 mac_addr_mid;
|
||||
u32 mac_addr_high;
|
||||
u32 mac_hash_low;
|
||||
u32 mac_hash_high;
|
||||
u32 boff_test;
|
||||
u32 pac_test;
|
||||
u32 rx_pause;
|
||||
u32 tx_pause;
|
||||
u32 unused5[2];
|
||||
struct cpmac_stats rx_stats;
|
||||
struct cpmac_stats tx_stats;
|
||||
volatile u32 unused6[232];
|
||||
volatile u32 tx_ptr[8];
|
||||
volatile u32 rx_ptr[8];
|
||||
volatile u32 tx_ack[8];
|
||||
volatile u32 rx_ack[8];
|
||||
u32 unused6[232];
|
||||
u32 tx_ptr[8];
|
||||
u32 rx_ptr[8];
|
||||
u32 tx_ack[8];
|
||||
u32 rx_ack[8];
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct cpmac_mdio_regs {
|
||||
volatile u32 version;
|
||||
u32 version;
|
||||
volatile u32 control;
|
||||
#define MDIOC_IDLE 0x80000000
|
||||
#define MDIOC_ENABLE 0x40000000
|
||||
|
@ -168,7 +166,7 @@ struct cpmac_mdio_regs {
|
|||
#define MDIOC_INTTEST 0x00020000
|
||||
#define MDIOC_CLKDIV(div) ((div) & 0xff)
|
||||
volatile u32 alive;
|
||||
volatile u32 link;
|
||||
u32 link;
|
||||
struct cpmac_int_regs link_int;
|
||||
struct cpmac_int_regs user_int;
|
||||
u32 unused[20];
|
||||
|
@ -178,7 +176,7 @@ struct cpmac_mdio_regs {
|
|||
#define MDIO_REG(reg) (((reg) & 0x1f) << 21)
|
||||
#define MDIO_PHY(phy) (((phy) & 0x1f) << 16)
|
||||
#define MDIO_DATA(data) ((data) & 0xffff)
|
||||
volatile u32 physel;
|
||||
u32 physel;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Descriptor */
|
||||
|
@ -200,7 +198,7 @@ struct cpmac_desc {
|
|||
|
||||
struct cpmac_priv {
|
||||
struct net_device_stats stats;
|
||||
spinlock_t lock;
|
||||
spinlock_t lock; /* irq{save,restore} */
|
||||
struct sk_buff *skb_pool;
|
||||
int free_skbs;
|
||||
struct cpmac_desc *rx_head;
|
||||
|
@ -234,10 +232,10 @@ static void cpmac_dump_regs(u32 *base, int count)
|
|||
{
|
||||
int i;
|
||||
for (i = 0; i < (count + 3) / 4; i++) {
|
||||
if (i % 4 == 0) printk("\nCPMAC[0x%04x]:", i * 4);
|
||||
printk(" 0x%08x", *(base + i));
|
||||
if (i % 4 == 0) printk(KERN_DEBUG "\nCPMAC[0x%04x]:", i * 4);
|
||||
printk(KERN_DEBUG " 0x%08x", *(base + i));
|
||||
}
|
||||
printk("\n");
|
||||
printk(KERN_DEBUG "\n");
|
||||
}
|
||||
|
||||
static const char *cpmac_dump_buf(const uint8_t *buf, unsigned size)
|
||||
|
@ -246,17 +244,16 @@ static const char *cpmac_dump_buf(const uint8_t * buf, unsigned size)
|
|||
char *p = &buffer[0];
|
||||
if (size > 20)
|
||||
size = 20;
|
||||
while (size-- > 0) {
|
||||
while (size-- > 0)
|
||||
p += sprintf(p, " %02x", *buf++);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
|
||||
{
|
||||
struct cpmac_mdio_regs *regs = (struct cpmac_mdio_regs *)bus->priv;
|
||||
volatile u32 val;
|
||||
struct cpmac_mdio_regs *regs = bus->priv;
|
||||
u32 val;
|
||||
|
||||
while ((val = regs->access) & MDIO_BUSY);
|
||||
regs->access = MDIO_BUSY | MDIO_REG(regnum & 0x1f) |
|
||||
|
@ -266,10 +263,11 @@ static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
|
|||
return val & 0xffff;
|
||||
}
|
||||
|
||||
static int cpmac_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 val)
|
||||
static int cpmac_mdio_write(struct mii_bus *bus, int phy_id,
|
||||
int regnum, u16 val)
|
||||
{
|
||||
struct cpmac_mdio_regs *regs = (struct cpmac_mdio_regs *)bus->priv;
|
||||
volatile u32 tmp;
|
||||
struct cpmac_mdio_regs *regs = bus->priv;
|
||||
u32 tmp;
|
||||
|
||||
while ((tmp = regs->access) & MDIO_BUSY);
|
||||
regs->access = MDIO_BUSY | MDIO_WRITE |
|
||||
|
@ -281,7 +279,7 @@ static int cpmac_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 val
|
|||
|
||||
static int cpmac_mdio_reset(struct mii_bus *bus)
|
||||
{
|
||||
struct cpmac_mdio_regs *regs = (struct cpmac_mdio_regs *)bus->priv;
|
||||
struct cpmac_mdio_regs *regs = bus->priv;
|
||||
|
||||
ar7_device_reset(AR7_RESET_BIT_MDIO);
|
||||
regs->control = MDIOC_ENABLE |
|
||||
|
@ -378,9 +376,9 @@ static struct sk_buff *cpmac_get_skb(struct net_device *dev)
|
|||
struct cpmac_priv *priv = netdev_priv(dev);
|
||||
|
||||
skb = priv->skb_pool;
|
||||
if (likely(skb)) {
|
||||
if (likely(skb))
|
||||
priv->skb_pool = skb->next;
|
||||
} else {
|
||||
else {
|
||||
skb = dev_alloc_skb(CPMAC_SKB_SIZE + 2);
|
||||
if (skb) {
|
||||
skb->next = NULL;
|
||||
|
@ -398,7 +396,7 @@ static struct sk_buff *cpmac_get_skb(struct net_device *dev)
|
|||
return skb;
|
||||
}
|
||||
|
||||
static inline struct sk_buff *cpmac_rx_one(struct net_device *dev,
|
||||
static struct sk_buff *cpmac_rx_one(struct net_device *dev,
|
||||
struct cpmac_priv *priv,
|
||||
struct cpmac_desc *desc)
|
||||
{
|
||||
|
@ -430,7 +428,7 @@ static inline struct sk_buff *cpmac_rx_one(struct net_device *dev,
|
|||
} else {
|
||||
#ifdef CPMAC_DEBUG
|
||||
if (printk_ratelimit())
|
||||
printk("%s: low on skbs, dropping packet\n",
|
||||
printk(KERN_NOTICE "%s: low on skbs, dropping packet\n",
|
||||
dev->name);
|
||||
#endif
|
||||
priv->stats.rx_dropped++;
|
||||
|
@ -466,9 +464,8 @@ static void cpmac_rx(struct net_device *dev)
|
|||
|
||||
while ((desc->dataflags & CPMAC_OWN) == 0) {
|
||||
skb = cpmac_rx_one(dev, priv, desc);
|
||||
if (likely(skb)) {
|
||||
if (likely(skb))
|
||||
netif_rx(skb);
|
||||
}
|
||||
desc = desc->next;
|
||||
dma_cache_inv((u32)desc, 16);
|
||||
}
|
||||
|
@ -487,7 +484,7 @@ static int cpmac_poll(struct net_device *dev, int *budget)
|
|||
|
||||
if (unlikely(!priv->rx_head)) {
|
||||
if (printk_ratelimit())
|
||||
printk(KERN_WARNING "%s: rx: polling, but no queue\n",
|
||||
printk(KERN_NOTICE "%s: rx: polling, but no queue\n",
|
||||
dev->name);
|
||||
netif_rx_complete(dev);
|
||||
return 0;
|
||||
|
@ -510,7 +507,7 @@ static int cpmac_poll(struct net_device *dev, int *budget)
|
|||
*budget -= received;
|
||||
dev->quota -= received;
|
||||
#ifdef CPMAC_DEBUG
|
||||
printk("%s: processed %d packets\n", dev->name, received);
|
||||
printk(KERN_DEBUG "%s: processed %d packets\n", dev->name, received);
|
||||
#endif
|
||||
if (desc->dataflags & CPMAC_OWN) {
|
||||
priv->regs->rx_ptr[0] = virt_to_phys(desc);
|
||||
|
@ -523,19 +520,11 @@ static int cpmac_poll(struct net_device *dev, int *budget)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
|
||||
static void
|
||||
cpmac_alloc_skbs(struct work_struct *work)
|
||||
{
|
||||
struct cpmac_priv *priv = container_of(work, struct cpmac_priv,
|
||||
alloc_work);
|
||||
#else
|
||||
static void
|
||||
cpmac_alloc_skbs(void *data)
|
||||
{
|
||||
struct net_device *dev = (struct net_device*)data;
|
||||
struct cpmac_priv *priv = netdev_priv(dev);
|
||||
#endif
|
||||
unsigned long flags;
|
||||
int i, num_skbs = 0;
|
||||
struct sk_buff *skb, *skbs = NULL;
|
||||
|
@ -554,15 +543,15 @@ cpmac_alloc_skbs(void *data)
|
|||
if (skbs) {
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
for (skb = priv->skb_pool; skb && skb->next; skb = skb->next);
|
||||
if (!skb) {
|
||||
if (!skb)
|
||||
priv->skb_pool = skbs;
|
||||
} else {
|
||||
else
|
||||
skb->next = skbs;
|
||||
}
|
||||
priv->free_skbs += num_skbs;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
#ifdef CPMAC_DEBUG
|
||||
printk("%s: allocated %d skbs\n", priv->dev->name, num_skbs);
|
||||
printk(KERN_DEBUG "%s: allocated %d skbs\n",
|
||||
priv->dev->name, num_skbs);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -576,12 +565,14 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
|
||||
len = skb->len;
|
||||
#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
|
||||
if (unlikely(len < ETH_ZLEN)) {
|
||||
if (unlikely(skb_padto(skb, ETH_ZLEN))) {
|
||||
if (printk_ratelimit())
|
||||
printk(KERN_NOTICE "%s: padding failed, dropping\n",
|
||||
printk(KERN_NOTICE
|
||||
"%s: padding failed, dropping\n",
|
||||
dev->name);
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
priv->stats.tx_dropped++;
|
||||
|
@ -599,7 +590,8 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
desc = &priv->desc_ring[chan];
|
||||
dma_cache_inv((u32)desc, 16);
|
||||
if (desc->dataflags & CPMAC_OWN) {
|
||||
printk(KERN_NOTICE "%s: tx dma ring full, dropping\n", dev->name);
|
||||
printk(KERN_NOTICE "%s: tx dma ring full, dropping\n",
|
||||
dev->name);
|
||||
priv->stats.tx_dropped++;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
return -ENOMEM;
|
||||
|
@ -634,11 +626,10 @@ static void cpmac_end_xmit(struct net_device *dev, int channel)
|
|||
dev_kfree_skb_irq(desc->skb);
|
||||
if (netif_queue_stopped(dev))
|
||||
netif_wake_queue(dev);
|
||||
} else {
|
||||
} else
|
||||
if (printk_ratelimit())
|
||||
printk(KERN_NOTICE "%s: end_xmit: spurious interrupt\n",
|
||||
dev->name);
|
||||
}
|
||||
spin_unlock(&priv->lock);
|
||||
}
|
||||
|
||||
|
@ -683,7 +674,7 @@ static inline void cpmac_free_rx_ring(struct net_device *dev)
|
|||
|
||||
static irqreturn_t cpmac_irq(int irq, void *dev_id)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)dev_id;
|
||||
struct net_device *dev = dev_id;
|
||||
struct cpmac_priv *priv = netdev_priv(dev);
|
||||
u32 status;
|
||||
|
||||
|
@ -692,14 +683,13 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
|
|||
|
||||
status = priv->regs->mac_int_vector;
|
||||
|
||||
if (status & INTST_TX) {
|
||||
if (status & INTST_TX)
|
||||
cpmac_end_xmit(dev, (status & 7));
|
||||
}
|
||||
|
||||
if (status & INTST_RX) {
|
||||
if (disable_napi) {
|
||||
if (disable_napi)
|
||||
cpmac_rx(dev);
|
||||
} else {
|
||||
else {
|
||||
priv->regs->rx_int.enable = 0;
|
||||
priv->regs->rx_int.clear = 0xff;
|
||||
netif_rx_schedule(dev);
|
||||
|
@ -709,9 +699,9 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
|
|||
priv->regs->mac_eoi_vector = 0;
|
||||
|
||||
if (unlikely(status & (INTST_HOST | INTST_STATUS))) {
|
||||
if (printk_ratelimit()) {
|
||||
printk(KERN_ERR "%s: hw error, resetting...\n", dev->name);
|
||||
}
|
||||
if (printk_ratelimit())
|
||||
printk(KERN_ERR "%s: hw error, resetting...\n",
|
||||
dev->name);
|
||||
spin_lock(&priv->lock);
|
||||
phy_stop(priv->phy);
|
||||
cpmac_reset(dev);
|
||||
|
@ -731,7 +721,7 @@ static void cpmac_tx_timeout(struct net_device *dev)
|
|||
priv->stats.tx_errors++;
|
||||
desc = &priv->desc_ring[priv->tx_head++];
|
||||
priv->tx_head %= 8;
|
||||
printk("%s: transmit timeout\n", dev->name);
|
||||
printk(KERN_NOTICE "%s: transmit timeout\n", dev->name);
|
||||
if (desc->skb)
|
||||
dev_kfree_skb(desc->skb);
|
||||
netif_wake_queue(dev);
|
||||
|
@ -894,12 +884,8 @@ static int cpmac_open(struct net_device *dev)
|
|||
struct cpmac_desc *desc;
|
||||
struct sk_buff *skb;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
|
||||
priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link,
|
||||
0, PHY_INTERFACE_MODE_MII);
|
||||
#else
|
||||
priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0);
|
||||
#endif
|
||||
if (IS_ERR(priv->phy)) {
|
||||
printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
|
||||
return PTR_ERR(priv->phy);
|
||||
|
@ -907,7 +893,7 @@ static int cpmac_open(struct net_device *dev)
|
|||
|
||||
if (!request_mem_region(dev->mem_start, dev->mem_end -
|
||||
dev->mem_start, dev->name)) {
|
||||
printk("%s: failed to request registers\n",
|
||||
printk(KERN_ERR "%s: failed to request registers\n",
|
||||
dev->name);
|
||||
res = -ENXIO;
|
||||
goto fail_reserve;
|
||||
|
@ -916,7 +902,7 @@ static int cpmac_open(struct net_device *dev)
|
|||
priv->regs = ioremap_nocache(dev->mem_start, dev->mem_end -
|
||||
dev->mem_start);
|
||||
if (!priv->regs) {
|
||||
printk("%s: failed to remap registers\n", dev->name);
|
||||
printk(KERN_ERR "%s: failed to remap registers\n", dev->name);
|
||||
res = -ENXIO;
|
||||
goto fail_remap;
|
||||
}
|
||||
|
@ -936,11 +922,7 @@ static int cpmac_open(struct net_device *dev)
|
|||
priv->free_skbs = 0;
|
||||
priv->rx_head = &priv->desc_ring[CPMAC_TX_RING_SIZE];
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs);
|
||||
#else
|
||||
INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs, dev);
|
||||
#endif
|
||||
schedule_work(&priv->alloc_work);
|
||||
flush_scheduled_work();
|
||||
|
||||
|
@ -962,7 +944,7 @@ static int cpmac_open(struct net_device *dev)
|
|||
|
||||
if ((res = request_irq(dev->irq, cpmac_irq, SA_INTERRUPT,
|
||||
dev->name, dev))) {
|
||||
printk("%s: failed to obtain irq\n", dev->name);
|
||||
printk(KERN_ERR "%s: failed to obtain irq\n", dev->name);
|
||||
goto fail_irq;
|
||||
}
|
||||
|
||||
|
@ -1039,7 +1021,7 @@ static int cpmac_stop(struct net_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int external_switch = 0;
|
||||
static int external_switch;
|
||||
|
||||
static int __devinit cpmac_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
@ -1049,9 +1031,6 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
|
|||
struct net_device *dev;
|
||||
struct plat_cpmac_data *pdata;
|
||||
|
||||
if (strcmp(pdev->name, "cpmac") != 0)
|
||||
return -ENODEV;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
|
||||
for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
|
||||
|
@ -1063,10 +1042,10 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
if (phy_id == PHY_MAX_ADDR) {
|
||||
if (external_switch) {
|
||||
if (external_switch)
|
||||
phy_id = 0;
|
||||
} else {
|
||||
printk("cpmac: no PHY present\n");
|
||||
else {
|
||||
printk(KERN_ERR "cpmac: no PHY present\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
@ -1074,7 +1053,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
|
|||
dev = alloc_etherdev(sizeof(struct cpmac_priv));
|
||||
|
||||
if (!dev) {
|
||||
printk(KERN_ERR "cpmac: Unable to allocate net_device structure!\n");
|
||||
printk(KERN_ERR
|
||||
"cpmac: Unable to allocate net_device structure!\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -1115,27 +1095,23 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
|
|||
priv->config = pdata;
|
||||
priv->dev = dev;
|
||||
memcpy(dev->dev_addr, priv->config->dev_addr, sizeof(dev->dev_addr));
|
||||
if (phy_id == 31) {
|
||||
if (phy_id == 31)
|
||||
snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT,
|
||||
cpmac_mii.id, phy_id);
|
||||
} else {
|
||||
else
|
||||
snprintf(priv->phy_name, BUS_ID_SIZE, "fixed@%d:%d", 100, 1);
|
||||
}
|
||||
|
||||
if ((rc = register_netdev(dev))) {
|
||||
printk("cpmac: error %i registering device %s\n",
|
||||
printk(KERN_ERR "cpmac: error %i registering device %s\n",
|
||||
rc, dev->name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
printk("cpmac: device %s (regs: %p, irq: %d, phy: %s, mac: ",
|
||||
printk(KERN_INFO "cpmac: device %s (regs: %p, irq: %d, phy: %s, mac: ",
|
||||
dev->name, (u32 *)dev->mem_start, dev->irq,
|
||||
priv->phy_name);
|
||||
for (i = 0; i < 6; i++) {
|
||||
printk("%02x", dev->dev_addr[i]);
|
||||
if (i < 5) printk(":");
|
||||
else printk(")\n");
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
printk("%02x%s", dev->dev_addr[i], i < 5 ? ":" : ")\n");
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -1160,13 +1136,13 @@ static struct platform_driver cpmac_driver = {
|
|||
|
||||
int __devinit cpmac_init(void)
|
||||
{
|
||||
volatile u32 mask;
|
||||
u32 mask;
|
||||
int i, res;
|
||||
cpmac_mii.priv = (struct cpmac_mdio_regs *)
|
||||
cpmac_mii.priv =
|
||||
ioremap_nocache(AR7_REGS_MDIO, sizeof(struct cpmac_mdio_regs));
|
||||
|
||||
if (!cpmac_mii.priv) {
|
||||
printk("Can't ioremap mdio registers\n");
|
||||
printk(KERN_ERR "Can't ioremap mdio registers\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -23,13 +21,14 @@
|
|||
|
||||
#include <linux/delay.h>
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#define AR7_REGS_BASE 0x08610000
|
||||
|
||||
#define AR7_REGS_MAC0 (AR7_REGS_BASE + 0x0000)
|
||||
#define AR7_REGS_GPIO (AR7_REGS_BASE + 0x0900)
|
||||
#define AR7_REGS_POWER (AR7_REGS_BASE + 0x0a00) // 0x08610A00 - 0x08610BFF (512 bytes, 128 bytes / clock)
|
||||
/* 0x08610A00 - 0x08610BFF (512 bytes, 128 bytes / clock) */
|
||||
#define AR7_REGS_POWER (AR7_REGS_BASE + 0x0a00)
|
||||
#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00)
|
||||
#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
|
||||
#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
|
||||
|
@ -132,14 +131,16 @@ static inline int ar7_has_high_cpmac(void)
|
|||
|
||||
static inline void ar7_device_enable(u32 bit)
|
||||
{
|
||||
void *reset_reg = (void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PEREPHERIAL);
|
||||
void *reset_reg =
|
||||
(void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PEREPHERIAL);
|
||||
writel(readl(reset_reg) | (1 << bit), reset_reg);
|
||||
mdelay(20);
|
||||
}
|
||||
|
||||
static inline void ar7_device_disable(u32 bit)
|
||||
{
|
||||
void *reset_reg = (void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PEREPHERIAL);
|
||||
void *reset_reg =
|
||||
(void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PEREPHERIAL);
|
||||
writel(readl(reset_reg) & ~(1 << bit), reset_reg);
|
||||
mdelay(20);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id: gpio.h 6693 2007-03-25 05:42:16Z ejka $
|
||||
*
|
||||
* Copyright (C) 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -30,7 +28,8 @@ extern void gpio_free(unsigned gpio);
|
|||
/* Common GPIO layer */
|
||||
static inline int gpio_direction_input(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_dir = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
|
||||
void __iomem *gpio_dir =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
|
@ -42,7 +41,8 @@ static inline int gpio_direction_input(unsigned gpio)
|
|||
|
||||
static inline int gpio_direction_output(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_dir = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
|
||||
void __iomem *gpio_dir =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
|
@ -54,7 +54,8 @@ static inline int gpio_direction_output(unsigned gpio)
|
|||
|
||||
static inline int gpio_get_value(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_in = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_INPUT);
|
||||
void __iomem *gpio_in =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_INPUT);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
|
@ -64,7 +65,8 @@ static inline int gpio_get_value(unsigned gpio)
|
|||
|
||||
static inline void gpio_set_value(unsigned gpio, int value)
|
||||
{
|
||||
void __iomem *gpio_out = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_OUTPUT);
|
||||
void __iomem *gpio_out =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_OUTPUT);
|
||||
volatile unsigned tmp;
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
|
@ -89,7 +91,8 @@ static inline int irq_to_gpio(unsigned irq)
|
|||
/* Board specific GPIO functions */
|
||||
static inline int ar7_gpio_enable(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_en = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
|
||||
void __iomem *gpio_en =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
|
@ -101,7 +104,8 @@ static inline int ar7_gpio_enable(unsigned gpio)
|
|||
|
||||
static inline int ar7_gpio_disable(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_en = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
|
||||
void __iomem *gpio_en =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
Loading…
Reference in a new issue