summaryrefslogtreecommitdiff
path: root/target/linux/adm5120/files/arch
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2007-10-11 15:09:50 +0000
committerGabor Juhos <juhosg@openwrt.org>2007-10-11 15:09:50 +0000
commit0fa0801a3296e50fdc49c93373645ed5fa9d8639 (patch)
tree93d2d69a06e0d650bb830b4e4a95e40d7ecec678 /target/linux/adm5120/files/arch
parent7e54993042bb56d49f4fe8afd9d8c98a5202ae80 (diff)
downloadmtk-20170518-0fa0801a3296e50fdc49c93373645ed5fa9d8639.zip
mtk-20170518-0fa0801a3296e50fdc49c93373645ed5fa9d8639.tar.gz
mtk-20170518-0fa0801a3296e50fdc49c93373645ed5fa9d8639.tar.bz2
coding style fixes
SVN-Revision: 9263
Diffstat (limited to 'target/linux/adm5120/files/arch')
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c2
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/board.c18
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c26
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/clock.c12
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/gpio.c79
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/irq.c11
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/memory.c13
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/prom.c59
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c8
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c12
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c2
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c12
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/reset.c25
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/setup.c23
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/time.c4
-rw-r--r--target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c16
16 files changed, 161 insertions, 161 deletions
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c b/target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c
index 46d2c8e..0abb961 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c
@@ -24,8 +24,8 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/io.h>
-#include <asm/io.h>
#include <asm/bootinfo.h>
#include <asm/addrspace.h>
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/board.c b/target/linux/adm5120/files/arch/mips/adm5120/board.c
index 44e59aa..1d0cc66 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/board.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/board.c
@@ -37,6 +37,8 @@
#include <adm5120_board.h>
#include <adm5120_platform.h>
+#define PFX "adm5120: "
+
static LIST_HEAD(adm5120_boards);
static char adm5120_board_name[ADM5120_BOARD_NAMELEN];
@@ -70,14 +72,14 @@ static int __init adm5120_board_setup(void)
board = adm5120_board_find(mips_machtype);
if (board == NULL) {
- printk(KERN_ALERT "adm5120: no board registered for machtype %lu"
- ", trying generic\n", mips_machtype);
+ printk(KERN_ALERT PFX"no board registered for "
+ "machtype %lu, trying generic\n", mips_machtype);
board = adm5120_board_find(MACH_ADM5120_GENERIC);
if (board == NULL)
- panic("adm5120: unsupported board\n");
+ panic(PFX "unsupported board\n");
}
- printk(KERN_INFO "adm5120: setting up board '%s'\n", board->name);
+ printk(KERN_INFO PFX "setting up board '%s'\n", board->name);
memcpy(&adm5120_board_name, board->name, ADM5120_BOARD_NAMELEN);
@@ -100,10 +102,10 @@ static int __init adm5120_board_setup(void)
adm5120_pci_set_irq_map(board->pci_nr_irqs, board->pci_irq_map);
/* register board devices */
- if (board->num_devices > 0 && board->devices != NULL ) {
+ if (board->num_devices > 0 && board->devices != NULL) {
err = platform_add_devices(board->devices, board->num_devices);
if (err)
- printk(KERN_ALERT "adm5120: adding board devices failed\n");
+ printk(KERN_ALERT PFX "adding board devices failed\n");
}
return 0;
@@ -113,7 +115,7 @@ arch_initcall(adm5120_board_setup);
void __init adm5120_board_register(struct adm5120_board *board)
{
list_add(&board->list, &adm5120_boards);
- printk(KERN_INFO "adm5120: registered board '%s'\n", board->name);
+ printk(KERN_INFO PFX "registered board '%s'\n", board->name);
}
void __init adm5120_register_boards(struct adm5120_board **boards,
@@ -121,7 +123,7 @@ void __init adm5120_register_boards(struct adm5120_board **boards,
{
int i;
- for (i=0; i<num; i++)
+ for (i = 0; i < num; i++)
adm5120_board_register(boards[i]);
}
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c b/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
index fee9db8..64c32c6 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
@@ -56,7 +56,7 @@
#define RB150_NAND_DELAY 100
#define RB150_NAND_WRITE(v) \
- writeb((v),(void __iomem *)KSEG1ADDR(RB150_NAND_BASE))
+ writeb((v), (void __iomem *)KSEG1ADDR(RB150_NAND_BASE))
/*--------------------------------------------------------------------------*/
@@ -66,7 +66,7 @@ static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2)
};
-static struct mtd_partition rb1xx_nor_partitions[] = {
+static struct mtd_partition rb1xx_nor_parts[] = {
{
.name = "booter",
.offset = 0,
@@ -79,7 +79,7 @@ static struct mtd_partition rb1xx_nor_partitions[] = {
}
};
-static struct mtd_partition rb1xx_nand_partitions[] = {
+static struct mtd_partition rb1xx_nand_parts[] = {
{
.name = "kernel",
.offset = 0,
@@ -102,10 +102,10 @@ static struct platform_device *rb1xx_devices[] __initdata = {
* when creating the partitions
*/
static struct nand_ecclayout rb1xx_nand_ecclayout = {
- .eccbytes = 6,
- .eccpos = { 8, 9, 10, 13, 14, 15 },
- .oobavail = 9,
- .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }
+ .eccbytes = 6,
+ .eccpos = { 8, 9, 10, 13, 14, 15 },
+ .oobavail = 9,
+ .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }
};
static struct resource rb150_nand_resource[] = {
@@ -157,8 +157,8 @@ static unsigned char rb_vlans[6] __initdata = {
/*--------------------------------------------------------------------------*/
-static int rb150_nand_ready(struct mtd_info *mtd) {
-
+static int rb150_nand_ready(struct mtd_info *mtd)
+{
return gpio_get_value(RB150_GPIO_NAND_READY);
}
@@ -187,13 +187,13 @@ static void __init rb1xx_mac_setup(void)
static void __init rb1xx_flash_setup(void)
{
/* setup data for flash0 device */
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_partitions);
- adm5120_flash0_data.parts = rb1xx_nor_partitions;
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_parts);
+ adm5120_flash0_data.parts = rb1xx_nor_parts;
/* setup data for NAND device */
adm5120_nand_data.chip.nr_chips = 1;
- adm5120_nand_data.chip.nr_partitions = ARRAY_SIZE(rb1xx_nand_partitions);
- adm5120_nand_data.chip.partitions = rb1xx_nand_partitions;
+ adm5120_nand_data.chip.nr_partitions = ARRAY_SIZE(rb1xx_nand_parts);
+ adm5120_nand_data.chip.partitions = rb1xx_nand_parts;
adm5120_nand_data.chip.ecclayout = &rb1xx_nand_ecclayout;
adm5120_nand_data.chip.chip_delay = RB1XX_NAND_CHIP_DELAY;
adm5120_nand_data.chip.options = NAND_NO_AUTOINCR;
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/clock.c b/target/linux/adm5120/files/arch/mips/adm5120/clock.c
index 4a8b69b..d65fceb 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/clock.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/clock.c
@@ -34,7 +34,7 @@
#include <linux/err.h>
#include <linux/clk.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
+#include <adm5120_defs.h>
struct clk {
unsigned long rate;
@@ -46,16 +46,16 @@ static struct clk uart_clk = {
struct clk *clk_get(struct device *dev, const char *id)
{
- if (!strcmp(id, "UARTCLK"))
- return &uart_clk;
+ if (!strcmp(id, "UARTCLK"))
+ return &uart_clk;
- return ERR_PTR(-ENOENT);
+ return ERR_PTR(-ENOENT);
}
EXPORT_SYMBOL(clk_get);
int clk_enable(struct clk *clk)
{
- return 0;
+ return 0;
}
EXPORT_SYMBOL(clk_enable);
@@ -66,7 +66,7 @@ EXPORT_SYMBOL(clk_disable);
unsigned long clk_get_rate(struct clk *clk)
{
- return clk->rate;
+ return clk->rate;
}
EXPORT_SYMBOL(clk_get_rate);
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/gpio.c b/target/linux/adm5120/files/arch/mips/adm5120/gpio.c
index d073b65..075ea87 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/gpio.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/gpio.c
@@ -29,19 +29,19 @@
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/io.h>
#include <asm/addrspace.h>
-#include <asm/io.h>
#include <asm/gpio.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
+#include <adm5120_defs.h>
+#include <adm5120_info.h>
+#include <adm5120_switch.h>
-typedef void __iomem * gpio_reg_t;
-#define GPIO_READ(r) readl((r))
-#define GPIO_WRITE(v,r) writel((v),(r))
-#define GPIO_REG(r) (gpio_reg_t)(KSEG1ADDR(ADM5120_SWITCH_BASE)+r)
+
+#define GPIO_READ(r) readl((r))
+#define GPIO_WRITE(v, r) writel((v), (r))
+#define GPIO_REG(r) (void __iomem *)(KSEG1ADDR(ADM5120_SWITCH_BASE)+r)
struct adm5120_gpio_line {
u32 flags;
@@ -52,15 +52,15 @@ struct adm5120_gpio_line {
#define GPIO_FLAG_USED 0x02
struct led_desc {
- gpio_reg_t reg; /* LED register address */
- u8 iv_shift; /* shift amount for input bit */
- u8 mode_shift; /* shift amount for mode bits */
+ void __iomem *reg; /* LED register address */
+ u8 iv_shift; /* shift amount for input bit */
+ u8 mode_shift; /* shift amount for mode bits */
};
-#define LED_DESC(_port,_led) { \
- .reg = GPIO_REG(SWITCH_REG_PORT0_LED+_port*4), \
- .iv_shift = LED0_IV_SHIFT+_led, \
- .mode_shift = _led*4 \
+#define LED_DESC(p, l) { \
+ .reg = GPIO_REG(SWITCH_REG_PORT0_LED+((p) * 4)), \
+ .iv_shift = LED0_IV_SHIFT + (l), \
+ .mode_shift = (l) * 4 \
}
static struct led_desc led_table[15] = {
@@ -97,10 +97,8 @@ static struct adm5120_gpio_line adm5120_gpio_map[ADM5120_GPIO_COUNT] = {
[ADM5120_GPIO_P4L2] = {.flags = GPIO_FLAG_VALID}
};
-#define gpio_is_invalid(g) ( \
- (g) > ADM5120_GPIO_MAX || \
- ((adm5120_gpio_map[(g)].flags & GPIO_FLAG_VALID) == 0) \
- )
+#define gpio_is_invalid(g) ((g) > ADM5120_GPIO_MAX || \
+ ((adm5120_gpio_map[(g)].flags & GPIO_FLAG_VALID) == 0))
#define gpio_is_used(g) ((adm5120_gpio_map[(g)].flags & GPIO_FLAG_USED) != 0)
@@ -114,7 +112,7 @@ static struct adm5120_gpio_line adm5120_gpio_map[ADM5120_GPIO_COUNT] = {
static inline int pins_direction_input(unsigned pin)
{
- gpio_reg_t *reg;
+ void __iomem **reg;
u32 t;
reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
@@ -122,14 +120,14 @@ static inline int pins_direction_input(unsigned pin)
t = GPIO_READ(reg);
t &= ~(PIN_OE(pin));
t |= PIN_IM(pin);
- GPIO_WRITE(t,reg);
+ GPIO_WRITE(t, reg);
return 0;
}
static inline int pins_direction_output(unsigned pin, int value)
{
- gpio_reg_t *reg;
+ void __iomem **reg;
u32 t;
reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
@@ -141,14 +139,14 @@ static inline int pins_direction_output(unsigned pin, int value)
if (value)
t |= PIN_OV(pin);
- GPIO_WRITE(t,reg);
+ GPIO_WRITE(t, reg);
return 0;
}
static inline int pins_get_value(unsigned pin)
{
- gpio_reg_t *reg;
+ void __iomem **reg;
u32 t;
reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
@@ -164,7 +162,7 @@ static inline int pins_get_value(unsigned pin)
static inline void pins_set_value(unsigned pin, int value)
{
- gpio_reg_t *reg;
+ void __iomem **reg;
u32 t;
reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
@@ -175,7 +173,7 @@ static inline void pins_set_value(unsigned pin, int value)
else
t |= PIN_OV(pin);
- GPIO_WRITE(t,reg);
+ GPIO_WRITE(t, reg);
}
/*
@@ -183,20 +181,20 @@ static inline void pins_set_value(unsigned pin, int value)
*/
static inline int leds_direction_input(unsigned led)
{
- gpio_reg_t *reg;
+ void __iomem **reg;
u32 t;
reg = led_table[led].reg;
t = GPIO_READ(reg);
t &= ~(LED_MODE_MASK << led_table[led].mode_shift);
- GPIO_WRITE(t,reg);
+ GPIO_WRITE(t, reg);
return 0;
}
static inline int leds_direction_output(unsigned led, int value)
{
- gpio_reg_t *reg;
+ void __iomem **reg;
u32 t, s;
reg = led_table[led].reg;
@@ -226,14 +224,14 @@ static inline int leds_direction_output(unsigned led, int value)
break;
}
- GPIO_WRITE(t,reg);
+ GPIO_WRITE(t, reg);
return 0;
}
static inline int leds_get_value(unsigned led)
{
- gpio_reg_t *reg;
+ void __iomem **reg;
u32 t, m;
reg = led_table[led].reg;
@@ -263,6 +261,7 @@ int adm5120_gpio_direction_input(unsigned gpio)
gpio -= ADM5120_GPIO_P0L0;
return leds_direction_input(gpio);
}
+EXPORT_SYMBOL(adm5120_gpio_direction_input);
int adm5120_gpio_direction_output(unsigned gpio, int value)
{
@@ -275,6 +274,7 @@ int adm5120_gpio_direction_output(unsigned gpio, int value)
gpio -= ADM5120_GPIO_P0L0;
return leds_direction_output(gpio, value);
}
+EXPORT_SYMBOL(adm5120_gpio_direction_output);
int adm5120_gpio_get_value(unsigned gpio)
{
@@ -284,6 +284,7 @@ int adm5120_gpio_get_value(unsigned gpio)
gpio -= ADM5120_GPIO_P0L0;
return leds_get_value(gpio);
}
+EXPORT_SYMBOL(adm5120_gpio_get_value);
void adm5120_gpio_set_value(unsigned gpio, int value)
{
@@ -295,6 +296,7 @@ void adm5120_gpio_set_value(unsigned gpio, int value)
gpio -= ADM5120_GPIO_P0L0;
leds_direction_output(gpio, value);
}
+EXPORT_SYMBOL(adm5120_gpio_set_value);
int adm5120_gpio_request(unsigned gpio, const char *label)
{
@@ -309,6 +311,7 @@ int adm5120_gpio_request(unsigned gpio, const char *label)
return 0;
}
+EXPORT_SYMBOL(adm5120_gpio_request);
void adm5120_gpio_free(unsigned gpio)
{
@@ -318,18 +321,21 @@ void adm5120_gpio_free(unsigned gpio)
adm5120_gpio_map[gpio].flags &= ~GPIO_FLAG_USED;
adm5120_gpio_map[gpio].label = NULL;
}
+EXPORT_SYMBOL(adm5120_gpio_free);
int adm5120_gpio_to_irq(unsigned gpio)
{
/* FIXME: not yet implemented */
return -EINVAL;
}
+EXPORT_SYMBOL(adm5120_gpio_to_irq);
int adm5120_irq_to_gpio(unsigned irq)
{
/* FIXME: not yet implemented */
return -EINVAL;
}
+EXPORT_SYMBOL(adm5120_irq_to_gpio);
static int __init adm5120_gpio_init(void)
{
@@ -337,7 +343,7 @@ static int __init adm5120_gpio_init(void)
if (adm5120_package_pqfp()) {
/* GPIO pins 4-7 are unavailable in ADM5120P */
- for (i=ADM5120_GPIO_PIN4; i<=ADM5120_GPIO_PIN7; i++)
+ for (i = ADM5120_GPIO_PIN4; i <= ADM5120_GPIO_PIN7; i++)
adm5120_gpio_map[i].flags &= ~GPIO_FLAG_VALID;
}
@@ -345,12 +351,3 @@ static int __init adm5120_gpio_init(void)
}
pure_initcall(adm5120_gpio_init);
-
-EXPORT_SYMBOL(adm5120_gpio_direction_output);
-EXPORT_SYMBOL(adm5120_gpio_direction_input);
-EXPORT_SYMBOL(adm5120_gpio_get_value);
-EXPORT_SYMBOL(adm5120_gpio_set_value);
-EXPORT_SYMBOL(adm5120_gpio_request);
-EXPORT_SYMBOL(adm5120_gpio_free);
-EXPORT_SYMBOL(adm5120_gpio_to_irq);
-EXPORT_SYMBOL(adm5120_irq_to_gpio);
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/irq.c b/target/linux/adm5120/files/arch/mips/adm5120/irq.c
index 5838e5e..6e3fc62 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/irq.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/irq.c
@@ -29,19 +29,19 @@
#include <linux/interrupt.h>
#include <linux/ioport.h>
-#include <asm/io.h>
+#include <linux/io.h>
#include <asm/irq.h>
#include <asm/irq_cpu.h>
#include <asm/mipsregs.h>
#include <asm/bitops.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_irq.h>
+#include <adm5120_defs.h>
+#include <adm5120_irq.h>
#define INTC_WRITE(reg, val) __raw_writel((val), \
(void __iomem *)(KSEG1ADDR(ADM5120_INTC_BASE) + reg))
-#define INTC_READ(reg) __raw_readl( \
+#define INTC_READ(reg) __raw_readl(\
(void __iomem *)(KSEG1ADDR(ADM5120_INTC_BASE) + reg))
static void adm5120_intc_irq_unmask(unsigned int irq);
@@ -168,7 +168,8 @@ static void __init adm5120_intc_irq_init(int base)
/* disable usage of the TEST_SOURCE register */
INTC_WRITE(INTC_REG_IRQ_SOURCE_SELECT, 0);
- for (i = ADM5120_INTC_IRQ_BASE; i <= ADM5120_INTC_IRQ_BASE+INTC_IRQ_LAST;
+ for (i = ADM5120_INTC_IRQ_BASE;
+ i <= ADM5120_INTC_IRQ_BASE+INTC_IRQ_LAST;
i++) {
irq_desc[i].status = INTC_IRQ_STATUS;
set_irq_chip_and_handler(i, &adm5120_intc_irq_chip,
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/memory.c b/target/linux/adm5120/files/arch/mips/adm5120/memory.c
index 605df26..79e9cb4 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/memory.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/memory.c
@@ -24,8 +24,8 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/kernel.h>
+#include <linux/io.h>
-#include <asm/io.h>
#include <asm/bootinfo.h>
#include <asm/addrspace.h>
@@ -34,8 +34,8 @@
#include <adm5120_switch.h>
#include <adm5120_mpmc.h>
-#if 1
-# define mem_dbg(f, a...) printk("mem_detect: " f, ## a)
+#ifdef DEBUG
+# define mem_dbg(f, a...) printk(KERN_INFO "mem_detect: " f, ## a)
#else
# define mem_dbg(f, a...)
#endif
@@ -49,7 +49,7 @@ static int __init mem_check_pattern(u8 *addr, unsigned long offs)
{
u32 *p1 = (u32 *)addr;
u32 *p2 = (u32 *)(addr+offs);
- u32 t,u,v;
+ u32 t, u, v;
/* save original value */
t = MEM_READL(p1);
@@ -128,9 +128,8 @@ static void __init adm5120_detect_memsize(void)
mem_dbg("check presence of 2nd bank\n");
p = (u8 *)KSEG1ADDR(maxsize+size-4);
- if (mem_check_pattern(p, 0)) {
+ if (mem_check_pattern(p, 0))
adm5120_memsize += size;
- }
if (maxsize != size) {
/* adjusting MECTRL register */
@@ -154,7 +153,7 @@ static void __init adm5120_detect_memsize(void)
out:
mem_dbg("%dx%uMB memory found\n", (adm5120_memsize == size) ? 1 : 2 ,
- size >>20);
+ size>>20);
}
void __init adm5120_mem_init(void)
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom.c b/target/linux/adm5120/files/arch/mips/adm5120/prom.c
index 4c2f658..2f6fb91 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/prom.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/prom.c
@@ -27,8 +27,8 @@
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/mm.h>
+#include <linux/io.h>
-#include <asm/io.h>
#include <asm/bootinfo.h>
#include <asm/addrspace.h>
@@ -52,31 +52,31 @@ struct board_desc {
#define DEFBOARD(n, mt) { .mach_type = (mt), .name = (n)}
static struct board_desc common_boards[] __initdata = {
/* Cellvision/SparkLAN boards */
- DEFBOARD("CAS-630", MACH_ADM5120_CAS630),
- DEFBOARD("CAS-670", MACH_ADM5120_CAS670),
- DEFBOARD("CAS-771", MACH_ADM5120_CAS771),
- DEFBOARD("CAS-790", MACH_ADM5120_CAS790),
- DEFBOARD("CAS-861", MACH_ADM5120_CAS861),
+ DEFBOARD("CAS-630", MACH_ADM5120_CAS630),
+ DEFBOARD("CAS-670", MACH_ADM5120_CAS670),
+ DEFBOARD("CAS-771", MACH_ADM5120_CAS771),
+ DEFBOARD("CAS-790", MACH_ADM5120_CAS790),
+ DEFBOARD("CAS-861", MACH_ADM5120_CAS861),
/* Compex boards */
- DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT),
+ DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT),
/* Edimax boards */
- DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K),
- DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104K),
+ DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K),
+ DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104K),
/* Infineon boards */
DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA),
DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT),
DEFBOARD("EASY 5120-WVoIP", MACH_ADM5120_EASY5120WVOIP),
DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000),
/* Mikrotik RouterBOARDs */
- DEFBOARD("111", MACH_ADM5120_RB_111),
- DEFBOARD("112", MACH_ADM5120_RB_112),
- DEFBOARD("133", MACH_ADM5120_RB_133),
- DEFBOARD("133C", MACH_ADM5120_RB_133C),
- DEFBOARD("133C3", MACH_ADM5120_RB_133C),
- DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */
- DEFBOARD("153", MACH_ADM5120_RB_153),
- DEFBOARD("192", MACH_ADM5120_RB_192),
- DEFBOARD("miniROUTER", MACH_ADM5120_RB_150),
+ DEFBOARD("111", MACH_ADM5120_RB_111),
+ DEFBOARD("112", MACH_ADM5120_RB_112),
+ DEFBOARD("133", MACH_ADM5120_RB_133),
+ DEFBOARD("133C", MACH_ADM5120_RB_133C),
+ DEFBOARD("133C3", MACH_ADM5120_RB_133C),
+ DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */
+ DEFBOARD("153", MACH_ADM5120_RB_153),
+ DEFBOARD("192", MACH_ADM5120_RB_192),
+ DEFBOARD("miniROUTER", MACH_ADM5120_RB_150),
};
static unsigned long __init find_machtype_byname(char *name)
@@ -91,7 +91,7 @@ static unsigned long __init find_machtype_byname(char *name)
if (*name == '\0')
goto out;
- for (i=0; i<ARRAY_SIZE(common_boards); i++) {
+ for (i = 0; i < ARRAY_SIZE(common_boards); i++) {
if (strcmp(common_boards[i].name, name) == 0) {
ret = common_boards[i].mach_type;
break;
@@ -131,8 +131,8 @@ static struct {
u16 vendor_id;
u16 board_id;
} zynos_boards[] __initdata = {
-#define ZYNOS_BOARD(vi, bi, mt) { .vendor_id = (vi), .board_id = (bi), \
- .mach_type = (mt) }
+#define ZYNOS_BOARD(vi, bi, mt) \
+ {.vendor_id = (vi), .board_id = (bi), .mach_type = (mt)}
#define ZYXEL_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_ZYXEL, bi, mt)
#define DLINK_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_DLINK, bi, mt)
@@ -155,7 +155,7 @@ static unsigned long __init detect_machtype_bootbase(void)
int i;
ret = MACH_ADM5120_GENERIC;
- for (i=0; i<ARRAY_SIZE(zynos_boards); i++) {
+ for (i = 0; i < ARRAY_SIZE(zynos_boards); i++) {
if (zynos_boards[i].vendor_id == bootbase_info.vendor_id &&
zynos_boards[i].board_id == bootbase_info.board_id) {
ret = zynos_boards[i].mach_type;
@@ -173,9 +173,10 @@ static struct {
u16 svid;
u16 sdid;
} mylo_boards[] __initdata = {
-#define MYLO_BOARD(v,d,sv,sd,mt) { .vid = (v), .did = (d), .svid = (sv), \
- .sdid = (sd), .mach_type = (mt) }
-#define COMPEX_BOARD(d,mt) MYLO_BOARD(VENID_COMPEX,(d),VENID_COMPEX,(d),(mt))
+#define MYLO_BOARD(v, d, sv, sd, mt) \
+ {.vid = (v), .did = (d), .svid = (sv), .sdid = (sd), .mach_type = (mt)}
+#define COMPEX_BOARD(d, mt) \
+ MYLO_BOARD(VENID_COMPEX, (d), VENID_COMPEX, (d), (mt))
COMPEX_BOARD(DEVID_COMPEX_NP27G, MACH_ADM5120_NP27G),
COMPEX_BOARD(DEVID_COMPEX_NP28G, MACH_ADM5120_NP28G),
@@ -193,7 +194,7 @@ static unsigned long __init detect_machtype_myloader(void)
int i;
ret = MACH_ADM5120_GENERIC;
- for (i=0; i<ARRAY_SIZE(mylo_boards); i++) {
+ for (i = 0; i < ARRAY_SIZE(mylo_boards); i++) {
if (mylo_boards[i].vid == myloader_info.vid &&
mylo_boards[i].did == myloader_info.did &&
mylo_boards[i].svid == myloader_info.svid &&
@@ -249,8 +250,10 @@ static void __init prom_init_cmdline(void)
/* init command line, register a default kernel command line */
cmd = &_image_cmdline + 8;
- if( strlen(cmd) > 0) strcpy( &(arcs_cmdline[0]), cmd);
- else strcpy(&(arcs_cmdline[0]), CONFIG_CMDLINE);
+ if (strlen(cmd) > 0)
+ strcpy(arcs_cmdline, cmd);
+ else
+ strcpy(arcs_cmdline, CONFIG_CMDLINE);
}
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c b/target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c
index 7ab9d46..cb6479c 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c
@@ -41,7 +41,7 @@
#define BOOTEXT_ADDR_MIN KSEG1ADDR(ADM5120_SRAM0_BASE)
#define BOOTEXT_ADDR_MAX (BOOTEXT_ADDR_MIN + (2*1024*1024))
-static int bootbase_found = 0;
+static int bootbase_found;
static struct zynos_board_info *board_info;
struct bootbase_info bootbase_info;
@@ -68,12 +68,12 @@ static inline u32 bootbase_get_bootext_addr(void)
static inline u16 bootbase_get_vendor_id(void)
{
-#define CHECK_VENDOR(n) (strnicmp(board_info->vendor,(n),strlen(n)) == 0)
+#define CHECK_VENDOR(n) (strnicmp(board_info->vendor, (n), strlen(n)) == 0)
unsigned char vendor[ZYNOS_NAME_LEN];
int i;
- for (i=0; i<ZYNOS_NAME_LEN; i++)
- vendor[i]=board_info->vendor[i];
+ for (i = 0; i < ZYNOS_NAME_LEN; i++)
+ vendor[i] = board_info->vendor[i];
if CHECK_VENDOR(ZYNOS_VENDOR_ZYXEL)
return ZYNOS_VENDOR_ID_ZYXEL;
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c b/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c
index 6c03a4e..28b6120 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c
@@ -37,7 +37,7 @@
#define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE
from other bootloaders */
-static int cfe_found = 0;
+static int cfe_found;
static u32 cfe_handle;
static u32 cfe_entry;
@@ -58,20 +58,16 @@ int __init cfe_present(void)
cfe_seal = (u32) fw_arg3;
/* Check for CFE by finding the CFE magic number */
- if (cfe_seal != CFE_EPTSEAL) {
- /* We are not booted from CFE */
+ if (cfe_seal != CFE_EPTSEAL)
return 0;
- }
/* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */
- if (a1 != 0) {
+ if (a1 != 0)
return 0;
- }
/* The cfe_handle, and the cfe_entry must be kernel mode addresses */
- if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0)) {
+ if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0))
return 0;
- }
cfe_found = 1;
return 1;
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c b/target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c
index 8a44509..b7d992c 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c
@@ -40,7 +40,7 @@
#define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800)
#define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000)
-static int myloader_found = 0;
+static int myloader_found;
struct myloader_info myloader_info;
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c b/target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c
index 7116f41..4748345 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c
@@ -36,13 +36,13 @@
#include "prom_read.h"
static struct rb_hard_settings rb_hs;
-static int rb_found = 0;
+static int rb_found;
static int __init routerboot_load_hs(u8 *buf, u16 buflen)
{
- u16 id,len;
+ u16 id, len;
u8 *mac;
- int i,j;
+ int i, j;
memset(&rb_hs, 0, sizeof(rb_hs));
@@ -88,8 +88,8 @@ static int __init routerboot_load_hs(u8 *buf, u16 buflen)
if (rb_hs.mac_count > RB_MAX_MAC_COUNT)
rb_hs.mac_count = RB_MAX_MAC_COUNT;
mac = buf;
- for (i=0; i < rb_hs.mac_count; i++) {
- for (j=0; j < RB_MAC_SIZE; j++)
+ for (i = 0; i < rb_hs.mac_count; i++) {
+ for (j = 0; j < RB_MAC_SIZE; j++)
rb_hs.macs[i][j] = mac[j];
mac += RB_MAC_SIZE;
}
@@ -111,7 +111,7 @@ int __init routerboot_present(void)
{
struct rb_bios_settings *bs;
u8 *base;
- u32 off,len;
+ u32 off, len;
if (rb_found)
goto out;
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/reset.c b/target/linux/adm5120/files/arch/mips/adm5120/reset.c
index abcbb1c..aa278fd 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/reset.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/reset.c
@@ -29,14 +29,15 @@
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+
#include <asm/bootinfo.h>
#include <asm/addrspace.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-
-#define ADM5120_SOFTRESET 0x12000004
+#include <adm5120_info.h>
+#include <adm5120_defs.h>
+#include <adm5120_switch.h>
void (*adm5120_board_reset)(void);
@@ -47,16 +48,16 @@ void adm5120_restart(char *command)
if (adm5120_board_reset)
adm5120_board_reset();
- *(u32*)KSEG1ADDR(ADM5120_SOFTRESET)=1;
+ SW_WRITE_REG(SOFT_RESET, 1);
}
void adm5120_halt(void)
{
- printk(KERN_NOTICE "\n** You can safely turn off the power\n");
- while (1);
-}
+ local_irq_disable();
-void adm5120_power_off(void)
-{
- adm5120_halt();
+ printk(KERN_NOTICE "\n** You can safely turn off the power\n");
+ while (1) {
+ if (cpu_wait)
+ cpu_wait();
+ };
}
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/setup.c b/target/linux/adm5120/files/arch/mips/adm5120/setup.c
index ed7966b..e09a003 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/setup.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/setup.c
@@ -27,15 +27,15 @@
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/io.h>
#include <asm/reboot.h>
-#include <asm/io.h>
#include <asm/time.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-#include <asm/mach-adm5120/adm5120_board.h>
+#include <adm5120_info.h>
+#include <adm5120_defs.h>
+#include <adm5120_switch.h>
+#include <adm5120_board.h>
static char *prom_names[ADM5120_PROM_LAST+1] __initdata = {
[ADM5120_PROM_GENERIC] = "Generic",
@@ -48,12 +48,13 @@ static char *prom_names[ADM5120_PROM_LAST+1] __initdata = {
static void __init adm5120_report(void)
{
- printk(KERN_INFO "SoC : ADM%04X%s revision %d, running at %ldMHz\n",
+ printk(KERN_INFO "SoC : ADM%04X%s revision %d, running "
+ "at %ldMHz\n",
adm5120_product_code,
- (adm5120_package == ADM5120_PACKAGE_BGA) ? "" : "P",
- adm5120_revision, (adm5120_speed / 1000000)
- );
- printk(KERN_INFO "Bootdev : %s flash\n", adm5120_nand_boot ? "NAND":"NOR");
+ adm5120_package_bga() ? "" : "P",
+ adm5120_revision, (adm5120_speed / 1000000));
+ printk(KERN_INFO "Bootdev : %s flash\n",
+ adm5120_nand_boot ? "NAND":"NOR");
printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]);
}
@@ -67,7 +68,7 @@ void __init plat_mem_setup(void)
_machine_restart = adm5120_restart;
_machine_halt = adm5120_halt;
- pm_power_off = adm5120_power_off;
+ pm_power_off = adm5120_halt;
set_io_port_base(KSEG1);
}
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/time.c b/target/linux/adm5120/files/arch/mips/adm5120/time.c
index 27393d4..86aab23 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/time.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/time.c
@@ -37,8 +37,8 @@
#include <asm/cpu.h>
#include <asm/time.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_irq.h>
+#include <adm5120_info.h>
+#include <adm5120_irq.h>
void __init adm5120_time_init(void)
{
diff --git a/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c b/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c
index 5aa5a63..722d47c 100644
--- a/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c
+++ b/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c
@@ -28,12 +28,12 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/spinlock.h>
+#include <linux/io.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
#include <linux/pci_regs.h>
-#include <asm/io.h>
#include <asm/delay.h>
#include <asm/bootinfo.h>
@@ -45,7 +45,7 @@
#undef DEBUG
#ifdef DEBUG
-#define DBG(f, a...) printk(KERN_DEBUG f, ## a )
+#define DBG(f, a...) printk(KERN_DEBUG f, ## a)
#else
#define DBG(f, a...) do {} while (0)
#endif
@@ -54,8 +54,8 @@
/* -------------------------------------------------------------------------*/
-static unsigned int adm5120_pci_nr_irqs __initdata = 0;
-static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata = NULL;
+static unsigned int adm5120_pci_nr_irqs __initdata;
+static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata;
static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED;
@@ -93,7 +93,7 @@ static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where,
spin_lock_irqsave(&pci_lock, flags);
- write_cfgaddr(mkaddr(bus,devfn,where));
+ write_cfgaddr(mkaddr(bus, devfn, where));
data = read_cfgdata();
DBG("PCI: cfg_read %02u.%02u.%01u/%02X:%01d, cfg:0x%08X",
@@ -132,7 +132,7 @@ static int pci_config_write(struct pci_bus *bus, unsigned int devfn, int where,
spin_lock_irqsave(&pci_lock, flags);
- write_cfgaddr(mkaddr(bus,devfn,where));
+ write_cfgaddr(mkaddr(bus, devfn, where));
data = read_cfgdata();
DBG("PCI: cfg_write %02u.%02u.%01u/%02X:%01d, cfg:0x%08X",
@@ -226,10 +226,10 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
if (irq < 0) {
printk(KERN_ALERT "PCI: no irq found for %s pin:%u\n",
- pci_name(dev), pin);
+ pci_name((struct pci_dev *)dev), pin);
} else {
printk(KERN_INFO "PCI: mapping irq for %s pin:%u, irq:%d\n",
- pci_name(dev), pin, irq);
+ pci_name((struct pci_dev *)dev), pin, irq);
}
out: