1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-02-16 14:04:42 +02:00

[adm5120] coding style fixes

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9263 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2007-10-11 15:09:50 +00:00
parent 818220b46c
commit ec6d32f924
21 changed files with 303 additions and 308 deletions

View File

@ -24,8 +24,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h>
#include <asm/io.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/addrspace.h> #include <asm/addrspace.h>

View File

@ -37,6 +37,8 @@
#include <adm5120_board.h> #include <adm5120_board.h>
#include <adm5120_platform.h> #include <adm5120_platform.h>
#define PFX "adm5120: "
static LIST_HEAD(adm5120_boards); static LIST_HEAD(adm5120_boards);
static char adm5120_board_name[ADM5120_BOARD_NAMELEN]; 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); board = adm5120_board_find(mips_machtype);
if (board == NULL) { if (board == NULL) {
printk(KERN_ALERT "adm5120: no board registered for machtype %lu" printk(KERN_ALERT PFX"no board registered for "
", trying generic\n", mips_machtype); "machtype %lu, trying generic\n", mips_machtype);
board = adm5120_board_find(MACH_ADM5120_GENERIC); board = adm5120_board_find(MACH_ADM5120_GENERIC);
if (board == NULL) 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); memcpy(&adm5120_board_name, board->name, ADM5120_BOARD_NAMELEN);
@ -103,7 +105,7 @@ static int __init adm5120_board_setup(void)
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); err = platform_add_devices(board->devices, board->num_devices);
if (err) if (err)
printk(KERN_ALERT "adm5120: adding board devices failed\n"); printk(KERN_ALERT PFX "adding board devices failed\n");
} }
return 0; return 0;
@ -113,7 +115,7 @@ arch_initcall(adm5120_board_setup);
void __init adm5120_board_register(struct adm5120_board *board) void __init adm5120_board_register(struct adm5120_board *board)
{ {
list_add(&board->list, &adm5120_boards); 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, void __init adm5120_register_boards(struct adm5120_board **boards,

View File

@ -66,7 +66,7 @@ static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2) PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2)
}; };
static struct mtd_partition rb1xx_nor_partitions[] = { static struct mtd_partition rb1xx_nor_parts[] = {
{ {
.name = "booter", .name = "booter",
.offset = 0, .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", .name = "kernel",
.offset = 0, .offset = 0,
@ -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); 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) static void __init rb1xx_flash_setup(void)
{ {
/* setup data for flash0 device */ /* setup data for flash0 device */
adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_partitions); adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_parts);
adm5120_flash0_data.parts = rb1xx_nor_partitions; adm5120_flash0_data.parts = rb1xx_nor_parts;
/* setup data for NAND device */ /* setup data for NAND device */
adm5120_nand_data.chip.nr_chips = 1; adm5120_nand_data.chip.nr_chips = 1;
adm5120_nand_data.chip.nr_partitions = ARRAY_SIZE(rb1xx_nand_partitions); adm5120_nand_data.chip.nr_partitions = ARRAY_SIZE(rb1xx_nand_parts);
adm5120_nand_data.chip.partitions = rb1xx_nand_partitions; adm5120_nand_data.chip.partitions = rb1xx_nand_parts;
adm5120_nand_data.chip.ecclayout = &rb1xx_nand_ecclayout; adm5120_nand_data.chip.ecclayout = &rb1xx_nand_ecclayout;
adm5120_nand_data.chip.chip_delay = RB1XX_NAND_CHIP_DELAY; adm5120_nand_data.chip.chip_delay = RB1XX_NAND_CHIP_DELAY;
adm5120_nand_data.chip.options = NAND_NO_AUTOINCR; adm5120_nand_data.chip.options = NAND_NO_AUTOINCR;

View File

@ -34,7 +34,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <asm/mach-adm5120/adm5120_defs.h> #include <adm5120_defs.h>
struct clk { struct clk {
unsigned long rate; unsigned long rate;

View File

@ -29,19 +29,19 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h>
#include <asm/addrspace.h> #include <asm/addrspace.h>
#include <asm/io.h>
#include <asm/gpio.h> #include <asm/gpio.h>
#include <asm/mach-adm5120/adm5120_defs.h> #include <adm5120_defs.h>
#include <asm/mach-adm5120/adm5120_info.h> #include <adm5120_info.h>
#include <asm/mach-adm5120/adm5120_switch.h> #include <adm5120_switch.h>
typedef void __iomem * gpio_reg_t;
#define GPIO_READ(r) readl((r)) #define GPIO_READ(r) readl((r))
#define GPIO_WRITE(v, r) writel((v), (r)) #define GPIO_WRITE(v, r) writel((v), (r))
#define GPIO_REG(r) (gpio_reg_t)(KSEG1ADDR(ADM5120_SWITCH_BASE)+r) #define GPIO_REG(r) (void __iomem *)(KSEG1ADDR(ADM5120_SWITCH_BASE)+r)
struct adm5120_gpio_line { struct adm5120_gpio_line {
u32 flags; u32 flags;
@ -52,15 +52,15 @@ struct adm5120_gpio_line {
#define GPIO_FLAG_USED 0x02 #define GPIO_FLAG_USED 0x02
struct led_desc { struct led_desc {
gpio_reg_t reg; /* LED register address */ void __iomem *reg; /* LED register address */
u8 iv_shift; /* shift amount for input bit */ u8 iv_shift; /* shift amount for input bit */
u8 mode_shift; /* shift amount for mode bits */ u8 mode_shift; /* shift amount for mode bits */
}; };
#define LED_DESC(_port,_led) { \ #define LED_DESC(p, l) { \
.reg = GPIO_REG(SWITCH_REG_PORT0_LED+_port*4), \ .reg = GPIO_REG(SWITCH_REG_PORT0_LED+((p) * 4)), \
.iv_shift = LED0_IV_SHIFT+_led, \ .iv_shift = LED0_IV_SHIFT + (l), \
.mode_shift = _led*4 \ .mode_shift = (l) * 4 \
} }
static struct led_desc led_table[15] = { 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} [ADM5120_GPIO_P4L2] = {.flags = GPIO_FLAG_VALID}
}; };
#define gpio_is_invalid(g) ( \ #define gpio_is_invalid(g) ((g) > ADM5120_GPIO_MAX || \
(g) > ADM5120_GPIO_MAX || \ ((adm5120_gpio_map[(g)].flags & GPIO_FLAG_VALID) == 0))
((adm5120_gpio_map[(g)].flags & GPIO_FLAG_VALID) == 0) \
)
#define gpio_is_used(g) ((adm5120_gpio_map[(g)].flags & GPIO_FLAG_USED) != 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) static inline int pins_direction_input(unsigned pin)
{ {
gpio_reg_t *reg; void __iomem **reg;
u32 t; u32 t;
reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
@ -129,7 +127,7 @@ static inline int pins_direction_input(unsigned pin)
static inline int pins_direction_output(unsigned pin, int value) static inline int pins_direction_output(unsigned pin, int value)
{ {
gpio_reg_t *reg; void __iomem **reg;
u32 t; u32 t;
reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
@ -148,7 +146,7 @@ static inline int pins_direction_output(unsigned pin, int value)
static inline int pins_get_value(unsigned pin) static inline int pins_get_value(unsigned pin)
{ {
gpio_reg_t *reg; void __iomem **reg;
u32 t; u32 t;
reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); 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) static inline void pins_set_value(unsigned pin, int value)
{ {
gpio_reg_t *reg; void __iomem **reg;
u32 t; u32 t;
reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
@ -183,7 +181,7 @@ static inline void pins_set_value(unsigned pin, int value)
*/ */
static inline int leds_direction_input(unsigned led) static inline int leds_direction_input(unsigned led)
{ {
gpio_reg_t *reg; void __iomem **reg;
u32 t; u32 t;
reg = led_table[led].reg; reg = led_table[led].reg;
@ -196,7 +194,7 @@ static inline int leds_direction_input(unsigned led)
static inline int leds_direction_output(unsigned led, int value) static inline int leds_direction_output(unsigned led, int value)
{ {
gpio_reg_t *reg; void __iomem **reg;
u32 t, s; u32 t, s;
reg = led_table[led].reg; reg = led_table[led].reg;
@ -233,7 +231,7 @@ static inline int leds_direction_output(unsigned led, int value)
static inline int leds_get_value(unsigned led) static inline int leds_get_value(unsigned led)
{ {
gpio_reg_t *reg; void __iomem **reg;
u32 t, m; u32 t, m;
reg = led_table[led].reg; reg = led_table[led].reg;
@ -263,6 +261,7 @@ int adm5120_gpio_direction_input(unsigned gpio)
gpio -= ADM5120_GPIO_P0L0; gpio -= ADM5120_GPIO_P0L0;
return leds_direction_input(gpio); return leds_direction_input(gpio);
} }
EXPORT_SYMBOL(adm5120_gpio_direction_input);
int adm5120_gpio_direction_output(unsigned gpio, int value) 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; gpio -= ADM5120_GPIO_P0L0;
return leds_direction_output(gpio, value); return leds_direction_output(gpio, value);
} }
EXPORT_SYMBOL(adm5120_gpio_direction_output);
int adm5120_gpio_get_value(unsigned gpio) int adm5120_gpio_get_value(unsigned gpio)
{ {
@ -284,6 +284,7 @@ int adm5120_gpio_get_value(unsigned gpio)
gpio -= ADM5120_GPIO_P0L0; gpio -= ADM5120_GPIO_P0L0;
return leds_get_value(gpio); return leds_get_value(gpio);
} }
EXPORT_SYMBOL(adm5120_gpio_get_value);
void adm5120_gpio_set_value(unsigned gpio, int 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; gpio -= ADM5120_GPIO_P0L0;
leds_direction_output(gpio, value); leds_direction_output(gpio, value);
} }
EXPORT_SYMBOL(adm5120_gpio_set_value);
int adm5120_gpio_request(unsigned gpio, const char *label) int adm5120_gpio_request(unsigned gpio, const char *label)
{ {
@ -309,6 +311,7 @@ int adm5120_gpio_request(unsigned gpio, const char *label)
return 0; return 0;
} }
EXPORT_SYMBOL(adm5120_gpio_request);
void adm5120_gpio_free(unsigned gpio) 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].flags &= ~GPIO_FLAG_USED;
adm5120_gpio_map[gpio].label = NULL; adm5120_gpio_map[gpio].label = NULL;
} }
EXPORT_SYMBOL(adm5120_gpio_free);
int adm5120_gpio_to_irq(unsigned gpio) int adm5120_gpio_to_irq(unsigned gpio)
{ {
/* FIXME: not yet implemented */ /* FIXME: not yet implemented */
return -EINVAL; return -EINVAL;
} }
EXPORT_SYMBOL(adm5120_gpio_to_irq);
int adm5120_irq_to_gpio(unsigned irq) int adm5120_irq_to_gpio(unsigned irq)
{ {
/* FIXME: not yet implemented */ /* FIXME: not yet implemented */
return -EINVAL; return -EINVAL;
} }
EXPORT_SYMBOL(adm5120_irq_to_gpio);
static int __init adm5120_gpio_init(void) static int __init adm5120_gpio_init(void)
{ {
@ -345,12 +351,3 @@ static int __init adm5120_gpio_init(void)
} }
pure_initcall(adm5120_gpio_init); 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);

View File

@ -29,14 +29,14 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/io.h> #include <linux/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/irq_cpu.h> #include <asm/irq_cpu.h>
#include <asm/mipsregs.h> #include <asm/mipsregs.h>
#include <asm/bitops.h> #include <asm/bitops.h>
#include <asm/mach-adm5120/adm5120_defs.h> #include <adm5120_defs.h>
#include <asm/mach-adm5120/adm5120_irq.h> #include <adm5120_irq.h>
#define INTC_WRITE(reg, val) __raw_writel((val), \ #define INTC_WRITE(reg, val) __raw_writel((val), \
(void __iomem *)(KSEG1ADDR(ADM5120_INTC_BASE) + reg)) (void __iomem *)(KSEG1ADDR(ADM5120_INTC_BASE) + reg))
@ -168,7 +168,8 @@ static void __init adm5120_intc_irq_init(int base)
/* disable usage of the TEST_SOURCE register */ /* disable usage of the TEST_SOURCE register */
INTC_WRITE(INTC_REG_IRQ_SOURCE_SELECT, 0); 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++) { i++) {
irq_desc[i].status = INTC_IRQ_STATUS; irq_desc[i].status = INTC_IRQ_STATUS;
set_irq_chip_and_handler(i, &adm5120_intc_irq_chip, set_irq_chip_and_handler(i, &adm5120_intc_irq_chip,

View File

@ -24,8 +24,8 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h>
#include <asm/io.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/addrspace.h> #include <asm/addrspace.h>
@ -34,8 +34,8 @@
#include <adm5120_switch.h> #include <adm5120_switch.h>
#include <adm5120_mpmc.h> #include <adm5120_mpmc.h>
#if 1 #ifdef DEBUG
# define mem_dbg(f, a...) printk("mem_detect: " f, ## a) # define mem_dbg(f, a...) printk(KERN_INFO "mem_detect: " f, ## a)
#else #else
# define mem_dbg(f, a...) # define mem_dbg(f, a...)
#endif #endif
@ -128,9 +128,8 @@ static void __init adm5120_detect_memsize(void)
mem_dbg("check presence of 2nd bank\n"); mem_dbg("check presence of 2nd bank\n");
p = (u8 *)KSEG1ADDR(maxsize+size-4); p = (u8 *)KSEG1ADDR(maxsize+size-4);
if (mem_check_pattern(p, 0)) { if (mem_check_pattern(p, 0))
adm5120_memsize += size; adm5120_memsize += size;
}
if (maxsize != size) { if (maxsize != size) {
/* adjusting MECTRL register */ /* adjusting MECTRL register */

View File

@ -27,8 +27,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/io.h>
#include <asm/io.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/addrspace.h> #include <asm/addrspace.h>
@ -131,8 +131,8 @@ static struct {
u16 vendor_id; u16 vendor_id;
u16 board_id; u16 board_id;
} zynos_boards[] __initdata = { } zynos_boards[] __initdata = {
#define ZYNOS_BOARD(vi, bi, mt) { .vendor_id = (vi), .board_id = (bi), \ #define ZYNOS_BOARD(vi, bi, mt) \
.mach_type = (mt) } {.vendor_id = (vi), .board_id = (bi), .mach_type = (mt)}
#define ZYXEL_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_ZYXEL, bi, 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) #define DLINK_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_DLINK, bi, mt)
@ -173,9 +173,10 @@ static struct {
u16 svid; u16 svid;
u16 sdid; u16 sdid;
} mylo_boards[] __initdata = { } mylo_boards[] __initdata = {
#define MYLO_BOARD(v,d,sv,sd,mt) { .vid = (v), .did = (d), .svid = (sv), \ #define MYLO_BOARD(v, d, sv, sd, mt) \
.sdid = (sd), .mach_type = (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 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_NP27G, MACH_ADM5120_NP27G),
COMPEX_BOARD(DEVID_COMPEX_NP28G, MACH_ADM5120_NP28G), COMPEX_BOARD(DEVID_COMPEX_NP28G, MACH_ADM5120_NP28G),
@ -249,8 +250,10 @@ static void __init prom_init_cmdline(void)
/* init command line, register a default kernel command line */ /* init command line, register a default kernel command line */
cmd = &_image_cmdline + 8; cmd = &_image_cmdline + 8;
if( strlen(cmd) > 0) strcpy( &(arcs_cmdline[0]), cmd); if (strlen(cmd) > 0)
else strcpy(&(arcs_cmdline[0]), CONFIG_CMDLINE); strcpy(arcs_cmdline, cmd);
else
strcpy(arcs_cmdline, CONFIG_CMDLINE);
} }

View File

@ -41,7 +41,7 @@
#define BOOTEXT_ADDR_MIN KSEG1ADDR(ADM5120_SRAM0_BASE) #define BOOTEXT_ADDR_MIN KSEG1ADDR(ADM5120_SRAM0_BASE)
#define BOOTEXT_ADDR_MAX (BOOTEXT_ADDR_MIN + (2*1024*1024)) #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; static struct zynos_board_info *board_info;
struct bootbase_info bootbase_info; struct bootbase_info bootbase_info;

View File

@ -37,7 +37,7 @@
#define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE #define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE
from other bootloaders */ from other bootloaders */
static int cfe_found = 0; static int cfe_found;
static u32 cfe_handle; static u32 cfe_handle;
static u32 cfe_entry; static u32 cfe_entry;
@ -58,20 +58,16 @@ int __init cfe_present(void)
cfe_seal = (u32) fw_arg3; cfe_seal = (u32) fw_arg3;
/* Check for CFE by finding the CFE magic number */ /* Check for CFE by finding the CFE magic number */
if (cfe_seal != CFE_EPTSEAL) { if (cfe_seal != CFE_EPTSEAL)
/* We are not booted from CFE */
return 0; return 0;
}
/* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */ /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */
if (a1 != 0) { if (a1 != 0)
return 0; return 0;
}
/* The cfe_handle, and the cfe_entry must be kernel mode addresses */ /* 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; return 0;
}
cfe_found = 1; cfe_found = 1;
return 1; return 1;

View File

@ -40,7 +40,7 @@
#define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800) #define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800)
#define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000) #define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000)
static int myloader_found = 0; static int myloader_found;
struct myloader_info myloader_info; struct myloader_info myloader_info;

View File

@ -36,7 +36,7 @@
#include "prom_read.h" #include "prom_read.h"
static struct rb_hard_settings rb_hs; 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) static int __init routerboot_load_hs(u8 *buf, u16 buflen)
{ {

View File

@ -29,14 +29,15 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/addrspace.h> #include <asm/addrspace.h>
#include <asm/mach-adm5120/adm5120_info.h> #include <adm5120_info.h>
#include <asm/mach-adm5120/adm5120_defs.h> #include <adm5120_defs.h>
#include <asm/mach-adm5120/adm5120_switch.h> #include <adm5120_switch.h>
#define ADM5120_SOFTRESET 0x12000004
void (*adm5120_board_reset)(void); void (*adm5120_board_reset)(void);
@ -47,16 +48,16 @@ void adm5120_restart(char *command)
if (adm5120_board_reset) if (adm5120_board_reset)
adm5120_board_reset(); adm5120_board_reset();
*(u32*)KSEG1ADDR(ADM5120_SOFTRESET)=1; SW_WRITE_REG(SOFT_RESET, 1);
} }
void adm5120_halt(void) void adm5120_halt(void)
{ {
printk(KERN_NOTICE "\n** You can safely turn off the power\n"); local_irq_disable();
while (1);
}
void adm5120_power_off(void) printk(KERN_NOTICE "\n** You can safely turn off the power\n");
{ while (1) {
adm5120_halt(); if (cpu_wait)
cpu_wait();
};
} }

View File

@ -27,15 +27,15 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h>
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/io.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/mach-adm5120/adm5120_info.h> #include <adm5120_info.h>
#include <asm/mach-adm5120/adm5120_defs.h> #include <adm5120_defs.h>
#include <asm/mach-adm5120/adm5120_switch.h> #include <adm5120_switch.h>
#include <asm/mach-adm5120/adm5120_board.h> #include <adm5120_board.h>
static char *prom_names[ADM5120_PROM_LAST+1] __initdata = { static char *prom_names[ADM5120_PROM_LAST+1] __initdata = {
[ADM5120_PROM_GENERIC] = "Generic", [ADM5120_PROM_GENERIC] = "Generic",
@ -48,12 +48,13 @@ static char *prom_names[ADM5120_PROM_LAST+1] __initdata = {
static void __init adm5120_report(void) 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_product_code,
(adm5120_package == ADM5120_PACKAGE_BGA) ? "" : "P", adm5120_package_bga() ? "" : "P",
adm5120_revision, (adm5120_speed / 1000000) adm5120_revision, (adm5120_speed / 1000000));
); printk(KERN_INFO "Bootdev : %s flash\n",
printk(KERN_INFO "Bootdev : %s flash\n", adm5120_nand_boot ? "NAND":"NOR"); adm5120_nand_boot ? "NAND":"NOR");
printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]); 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_restart = adm5120_restart;
_machine_halt = adm5120_halt; _machine_halt = adm5120_halt;
pm_power_off = adm5120_power_off; pm_power_off = adm5120_halt;
set_io_port_base(KSEG1); set_io_port_base(KSEG1);
} }

View File

@ -37,8 +37,8 @@
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/mach-adm5120/adm5120_info.h> #include <adm5120_info.h>
#include <asm/mach-adm5120/adm5120_irq.h> #include <adm5120_irq.h>
void __init adm5120_time_init(void) void __init adm5120_time_init(void)
{ {

View File

@ -28,12 +28,12 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pci_ids.h> #include <linux/pci_ids.h>
#include <linux/pci_regs.h> #include <linux/pci_regs.h>
#include <asm/io.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
@ -54,8 +54,8 @@
/* -------------------------------------------------------------------------*/ /* -------------------------------------------------------------------------*/
static unsigned int adm5120_pci_nr_irqs __initdata = 0; static unsigned int adm5120_pci_nr_irqs __initdata;
static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata = NULL; static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata;
static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED; static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED;
@ -226,10 +226,10 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
if (irq < 0) { if (irq < 0) {
printk(KERN_ALERT "PCI: no irq found for %s pin:%u\n", printk(KERN_ALERT "PCI: no irq found for %s pin:%u\n",
pci_name(dev), pin); pci_name((struct pci_dev *)dev), pin);
} else { } else {
printk(KERN_INFO "PCI: mapping irq for %s pin:%u, irq:%d\n", 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: out:

View File

@ -54,17 +54,17 @@ struct adm5120_leddev {
struct gpio_led_platform_data pdata; struct gpio_led_platform_data pdata;
}; };
static int led_count = 0; static int led_count;
static struct adm5120_leddev *led_devs[NUM_LEDS_MAX]; static struct adm5120_leddev *led_devs[NUM_LEDS_MAX];
#define LED_ARRAY(n) \ #define LED_ARRAY(n) \
static struct gpio_led n ## _leds [] __initdata = static struct gpio_led n ## _leds [] __initdata =
#define LED_DATA(n,t,g,al) { \ #define LED_DATA(n, t, g, a) { \
.name = (n), \ .name = (n), \
.default_trigger = (t), \ .default_trigger = (t), \
.gpio = (g), \ .gpio = (g), \
.active_low = (al) \ .active_low = (a) \
} }
#define LED_STD(g, n, t) LED_DATA((n), (t), (g), 0) #define LED_STD(g, n, t) LED_DATA((n), (t), (g), 0)
@ -268,13 +268,6 @@ create_leddev(int id, struct gpio_led *led)
return p; return p;
} }
static void
destroy_leddev(struct adm5120_leddev *leddev)
{
if (leddev)
kfree(leddev);
}
static struct mach_data * __init static struct mach_data * __init
adm5120_leds_findmach(unsigned long machtype) adm5120_leds_findmach(unsigned long machtype)
{ {
@ -338,7 +331,7 @@ err_unregister:
err_destroy: err_destroy:
for (i = 0; i < led_count; i++) for (i = 0; i < led_count; i++)
destroy_leddev(led_devs[i]); kfree(led_devs[i]);
err: err:
return ret; return ret;
} }
@ -350,7 +343,7 @@ adm5120_leds_exit(void)
for (i = 0; i < led_count; i++) { for (i = 0; i < led_count; i++) {
platform_device_unregister(&led_devs[i]->pdev); platform_device_unregister(&led_devs[i]->pdev);
destroy_leddev(led_devs[i]); kfree(led_devs[i]);
} }
} }

View File

@ -32,15 +32,14 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/io.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <adm5120_defs.h> #include <adm5120_defs.h>
#include <adm5120_switch.h> #include <adm5120_switch.h>
#include <adm5120_mpmc.h> #include <adm5120_mpmc.h>
@ -329,7 +328,7 @@ static void adm5120_flash_initbanks(struct adm5120_flash_info *info)
#ifdef CONFIG_MTD_PARTITIONS #ifdef CONFIG_MTD_PARTITIONS
static int adm5120_flash_initparts(struct adm5120_flash_info *info) static int adm5120_flash_initparts(struct adm5120_flash_info *info)
{ {
struct adm5120_flash_platform_data *pdata = info->dev->dev.platform_data; struct adm5120_flash_platform_data *pdata;
struct map_info *map = &info->amap.map; struct map_info *map = &info->amap.map;
int num_parsers; int num_parsers;
const char *parser[2]; const char *parser[2];
@ -339,6 +338,7 @@ static int adm5120_flash_initparts(struct adm5120_flash_info *info)
info->nr_parts = 0; info->nr_parts = 0;
pdata = info->dev->dev.platform_data;
if (pdata == NULL) if (pdata == NULL)
goto out; goto out;
@ -496,7 +496,8 @@ static int adm5120_flash_probe(struct platform_device *dev)
goto err_out; goto err_out;
if (info->nr_parts == 0) { if (info->nr_parts == 0) {
MAP_INFO(map, "no partitions available, registering whole flash\n"); MAP_INFO(map, "no partitions available, registering "
"whole flash\n");
add_mtd_device(info->mtd); add_mtd_device(info->mtd);
} }
@ -508,7 +509,8 @@ err_out:
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int adm5120_flash_suspend(struct platform_device *dev, pm_message_t state) static int adm5120_flash_suspend(struct platform_device *dev,
pm_message_t state)
{ {
struct adm5120_flash_info *info = platform_get_drvdata(dev); struct adm5120_flash_info *info = platform_get_drvdata(dev);
int ret = 0; int ret = 0;

View File

@ -54,7 +54,6 @@ int parse_myloader_partitions(struct mtd_info *master,
int num_parts; int num_parts;
int ret, i; int ret, i;
size_t retlen; size_t retlen;
size_t parts_len;
char *names; char *names;
unsigned long offset; unsigned long offset;
unsigned long blocklen; unsigned long blocklen;
@ -104,8 +103,8 @@ int parse_myloader_partitions(struct mtd_info *master,
num_parts++; num_parts++;
} }
mtd_parts = kzalloc((num_parts*sizeof(*mtd_part) + num_parts*NAME_LEN_MAX), mtd_parts = kzalloc((num_parts * sizeof(*mtd_part) +
GFP_KERNEL); num_parts * NAME_LEN_MAX), GFP_KERNEL);
if (!mtd_parts) { if (!mtd_parts) {
ret = -ENOMEM; ret = -ENOMEM;

View File

@ -38,8 +38,8 @@
#define TRX_MAGIC 0x30524448 /* "HDR0" */ #define TRX_MAGIC 0x30524448 /* "HDR0" */
#define TRX_VERSION 1 #define TRX_VERSION 1
#define TRX_MAX_LEN 0x3A0000 #define TRX_MAX_LEN 0x3A0000
#define TRX_NO_HEADER 1 /* Do not write TRX header */ #define TRX_NO_HEADER 0x1 /* do not write TRX header */
#define TRX_GZ_FILES 0x2 /* Contains up to TRX_MAX_OFFSET individual gzip files */ #define TRX_GZ_FILES 0x2 /* contains individual gzip files */
#define TRX_MAX_OFFSET 3 #define TRX_MAX_OFFSET 3
#define TRX_MIN_KERNEL_SIZE 256*1024 #define TRX_MIN_KERNEL_SIZE 256*1024
@ -48,14 +48,14 @@ struct trx_header {
u32 len; /* Length of file including header */ u32 len; /* Length of file including header */
u32 crc32; /* 32-bit CRC from flag_version to end of file */ u32 crc32; /* 32-bit CRC from flag_version to end of file */
u32 flag_version; /* 0:15 flags, 16:31 version */ u32 flag_version; /* 0:15 flags, 16:31 version */
u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of header */ u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions */
}; };
#define BLOCK_LEN_MIN 0x10000 #define BLOCK_LEN_MIN 0x10000
static struct mtd_info *trx_mtd = NULL; static int trx_nr_parts;
static unsigned long trx_offset = 0; static unsigned long trx_offset;
static int trx_nr_parts = 0; static struct mtd_info *trx_mtd;
static struct mtd_partition trx_parts[TRX_MAX_OFFSET]; static struct mtd_partition trx_parts[TRX_MAX_OFFSET];
static struct trx_header trx_hdr; static struct trx_header trx_hdr;
@ -66,7 +66,8 @@ static int trxsplit_checktrx(struct mtd_info *mtd, unsigned long offset)
size_t retlen; size_t retlen;
int err; int err;
err = mtd->read(mtd, offset, sizeof(trx_hdr), &retlen, (void *)&trx_hdr); err = mtd->read(mtd, offset, sizeof(trx_hdr), &retlen,
(void *)&trx_hdr);
if (err) { if (err) {
printk(KERN_ALERT PFX "unable to read from '%s'\n", mtd->name); printk(KERN_ALERT PFX "unable to read from '%s'\n", mtd->name);
goto err_out; goto err_out;
@ -142,9 +143,9 @@ static void trxsplit_create_partitions(struct mtd_info *mtd)
trx_nr_parts++; trx_nr_parts++;
} }
for (i=0; i<trx_nr_parts-1; i++) { for (i = 0; i < trx_nr_parts-1; i++)
trx_parts[i].size = trx_parts[i+1].offset - trx_parts[i].offset; trx_parts[i].size = trx_parts[i+1].offset - trx_parts[i].offset;
}
trx_parts[i].size = mtd->size - trx_parts[i].offset; trx_parts[i].size = mtd->size - trx_parts[i].offset;
i = 0; i = 0;
@ -216,8 +217,9 @@ static int __init trxsplit_init(void)
trxsplit_scan(); trxsplit_scan();
if (trx_mtd) { if (trx_mtd) {
printk(KERN_INFO PFX "creating TRX partitions in '%s' (%d,%d)\n", printk(KERN_INFO PFX "creating TRX partitions in '%s' "
trx_mtd->name, MTD_BLOCK_MAJOR, trx_mtd->index); "(%d,%d)\n", trx_mtd->name, MTD_BLOCK_MAJOR,
trx_mtd->index);
trxsplit_create_partitions(trx_mtd); trxsplit_create_partitions(trx_mtd);
} }

View File

@ -65,7 +65,6 @@ extern void adm5120_ndelay(u32 ns);
extern void adm5120_restart(char *command); extern void adm5120_restart(char *command);
extern void adm5120_halt(void); extern void adm5120_halt(void);
extern void adm5120_power_off(void);
extern void (*adm5120_board_reset)(void); extern void (*adm5120_board_reset)(void);