coding style fixes

SVN-Revision: 9263
owl
Gabor Juhos 2007-10-11 15:09:50 +00:00
parent 7e54993042
commit 0fa0801a32
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);
@ -100,10 +102,10 @@ static int __init adm5120_board_setup(void)
adm5120_pci_set_irq_map(board->pci_nr_irqs, board->pci_irq_map); adm5120_pci_set_irq_map(board->pci_nr_irqs, board->pci_irq_map);
/* register board devices */ /* 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); 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,
@ -121,7 +123,7 @@ void __init adm5120_register_boards(struct adm5120_board **boards,
{ {
int i; int i;
for (i=0; i<num; i++) for (i = 0; i < num; i++)
adm5120_board_register(boards[i]); adm5120_board_register(boards[i]);
} }

View File

@ -56,7 +56,7 @@
#define RB150_NAND_DELAY 100 #define RB150_NAND_DELAY 100
#define RB150_NAND_WRITE(v) \ #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) 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,
@ -102,10 +102,10 @@ static struct platform_device *rb1xx_devices[] __initdata = {
* when creating the partitions * when creating the partitions
*/ */
static struct nand_ecclayout rb1xx_nand_ecclayout = { static struct nand_ecclayout rb1xx_nand_ecclayout = {
.eccbytes = 6, .eccbytes = 6,
.eccpos = { 8, 9, 10, 13, 14, 15 }, .eccpos = { 8, 9, 10, 13, 14, 15 },
.oobavail = 9, .oobavail = 9,
.oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }
}; };
static struct resource rb150_nand_resource[] = { 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); 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;
@ -46,16 +46,16 @@ static struct clk uart_clk = {
struct clk *clk_get(struct device *dev, const char *id) struct clk *clk_get(struct device *dev, const char *id)
{ {
if (!strcmp(id, "UARTCLK")) if (!strcmp(id, "UARTCLK"))
return &uart_clk; return &uart_clk;
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
} }
EXPORT_SYMBOL(clk_get); EXPORT_SYMBOL(clk_get);
int clk_enable(struct clk *clk) int clk_enable(struct clk *clk)
{ {
return 0; return 0;
} }
EXPORT_SYMBOL(clk_enable); EXPORT_SYMBOL(clk_enable);
@ -66,7 +66,7 @@ EXPORT_SYMBOL(clk_disable);
unsigned long clk_get_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk)
{ {
return clk->rate; return clk->rate;
} }
EXPORT_SYMBOL(clk_get_rate); EXPORT_SYMBOL(clk_get_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);
@ -122,14 +120,14 @@ static inline int pins_direction_input(unsigned pin)
t = GPIO_READ(reg); t = GPIO_READ(reg);
t &= ~(PIN_OE(pin)); t &= ~(PIN_OE(pin));
t |= PIN_IM(pin); t |= PIN_IM(pin);
GPIO_WRITE(t,reg); GPIO_WRITE(t, reg);
return 0; return 0;
} }
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);
@ -141,14 +139,14 @@ static inline int pins_direction_output(unsigned pin, int value)
if (value) if (value)
t |= PIN_OV(pin); t |= PIN_OV(pin);
GPIO_WRITE(t,reg); GPIO_WRITE(t, reg);
return 0; return 0;
} }
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);
@ -175,7 +173,7 @@ static inline void pins_set_value(unsigned pin, int value)
else else
t |= PIN_OV(pin); 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) 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;
t = GPIO_READ(reg); t = GPIO_READ(reg);
t &= ~(LED_MODE_MASK << led_table[led].mode_shift); t &= ~(LED_MODE_MASK << led_table[led].mode_shift);
GPIO_WRITE(t,reg); GPIO_WRITE(t, reg);
return 0; return 0;
} }
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;
@ -226,14 +224,14 @@ static inline int leds_direction_output(unsigned led, int value)
break; break;
} }
GPIO_WRITE(t,reg); GPIO_WRITE(t, reg);
return 0; return 0;
} }
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)
{ {
@ -337,7 +343,7 @@ static int __init adm5120_gpio_init(void)
if (adm5120_package_pqfp()) { if (adm5120_package_pqfp()) {
/* GPIO pins 4-7 are unavailable in ADM5120P */ /* 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; adm5120_gpio_map[i].flags &= ~GPIO_FLAG_VALID;
} }
@ -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,19 +29,19 @@
#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))
#define INTC_READ(reg) __raw_readl( \ #define INTC_READ(reg) __raw_readl(\
(void __iomem *)(KSEG1ADDR(ADM5120_INTC_BASE) + reg)) (void __iomem *)(KSEG1ADDR(ADM5120_INTC_BASE) + reg))
static void adm5120_intc_irq_unmask(unsigned int irq); 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 */ /* 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
@ -49,7 +49,7 @@ static int __init mem_check_pattern(u8 *addr, unsigned long offs)
{ {
u32 *p1 = (u32 *)addr; u32 *p1 = (u32 *)addr;
u32 *p2 = (u32 *)(addr+offs); u32 *p2 = (u32 *)(addr+offs);
u32 t,u,v; u32 t, u, v;
/* save original value */ /* save original value */
t = MEM_READL(p1); t = MEM_READL(p1);
@ -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 */
@ -154,7 +153,7 @@ static void __init adm5120_detect_memsize(void)
out: out:
mem_dbg("%dx%uMB memory found\n", (adm5120_memsize == size) ? 1 : 2 , mem_dbg("%dx%uMB memory found\n", (adm5120_memsize == size) ? 1 : 2 ,
size >>20); size>>20);
} }
void __init adm5120_mem_init(void) void __init adm5120_mem_init(void)

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>
@ -52,31 +52,31 @@ struct board_desc {
#define DEFBOARD(n, mt) { .mach_type = (mt), .name = (n)} #define DEFBOARD(n, mt) { .mach_type = (mt), .name = (n)}
static struct board_desc common_boards[] __initdata = { static struct board_desc common_boards[] __initdata = {
/* Cellvision/SparkLAN boards */ /* Cellvision/SparkLAN boards */
DEFBOARD("CAS-630", MACH_ADM5120_CAS630), DEFBOARD("CAS-630", MACH_ADM5120_CAS630),
DEFBOARD("CAS-670", MACH_ADM5120_CAS670), DEFBOARD("CAS-670", MACH_ADM5120_CAS670),
DEFBOARD("CAS-771", MACH_ADM5120_CAS771), DEFBOARD("CAS-771", MACH_ADM5120_CAS771),
DEFBOARD("CAS-790", MACH_ADM5120_CAS790), DEFBOARD("CAS-790", MACH_ADM5120_CAS790),
DEFBOARD("CAS-861", MACH_ADM5120_CAS861), DEFBOARD("CAS-861", MACH_ADM5120_CAS861),
/* Compex boards */ /* Compex boards */
DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT), DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT),
/* Edimax boards */ /* Edimax boards */
DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K), DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K),
DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104K), DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104K),
/* Infineon boards */ /* Infineon boards */
DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA), DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA),
DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT), DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT),
DEFBOARD("EASY 5120-WVoIP", MACH_ADM5120_EASY5120WVOIP), DEFBOARD("EASY 5120-WVoIP", MACH_ADM5120_EASY5120WVOIP),
DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000), DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000),
/* Mikrotik RouterBOARDs */ /* Mikrotik RouterBOARDs */
DEFBOARD("111", MACH_ADM5120_RB_111), DEFBOARD("111", MACH_ADM5120_RB_111),
DEFBOARD("112", MACH_ADM5120_RB_112), DEFBOARD("112", MACH_ADM5120_RB_112),
DEFBOARD("133", MACH_ADM5120_RB_133), DEFBOARD("133", MACH_ADM5120_RB_133),
DEFBOARD("133C", MACH_ADM5120_RB_133C), DEFBOARD("133C", MACH_ADM5120_RB_133C),
DEFBOARD("133C3", MACH_ADM5120_RB_133C), DEFBOARD("133C3", MACH_ADM5120_RB_133C),
DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */ DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */
DEFBOARD("153", MACH_ADM5120_RB_153), DEFBOARD("153", MACH_ADM5120_RB_153),
DEFBOARD("192", MACH_ADM5120_RB_192), DEFBOARD("192", MACH_ADM5120_RB_192),
DEFBOARD("miniROUTER", MACH_ADM5120_RB_150), DEFBOARD("miniROUTER", MACH_ADM5120_RB_150),
}; };
static unsigned long __init find_machtype_byname(char *name) 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') if (*name == '\0')
goto out; 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) { if (strcmp(common_boards[i].name, name) == 0) {
ret = common_boards[i].mach_type; ret = common_boards[i].mach_type;
break; break;
@ -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)
@ -155,7 +155,7 @@ static unsigned long __init detect_machtype_bootbase(void)
int i; int i;
ret = MACH_ADM5120_GENERIC; 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 && if (zynos_boards[i].vendor_id == bootbase_info.vendor_id &&
zynos_boards[i].board_id == bootbase_info.board_id) { zynos_boards[i].board_id == bootbase_info.board_id) {
ret = zynos_boards[i].mach_type; ret = zynos_boards[i].mach_type;
@ -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),
@ -193,7 +194,7 @@ static unsigned long __init detect_machtype_myloader(void)
int i; int i;
ret = MACH_ADM5120_GENERIC; 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 && if (mylo_boards[i].vid == myloader_info.vid &&
mylo_boards[i].did == myloader_info.did && mylo_boards[i].did == myloader_info.did &&
mylo_boards[i].svid == myloader_info.svid && 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 */ /* 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;
@ -68,12 +68,12 @@ static inline u32 bootbase_get_bootext_addr(void)
static inline u16 bootbase_get_vendor_id(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]; unsigned char vendor[ZYNOS_NAME_LEN];
int i; int i;
for (i=0; i<ZYNOS_NAME_LEN; i++) for (i = 0; i < ZYNOS_NAME_LEN; i++)
vendor[i]=board_info->vendor[i]; vendor[i] = board_info->vendor[i];
if CHECK_VENDOR(ZYNOS_VENDOR_ZYXEL) if CHECK_VENDOR(ZYNOS_VENDOR_ZYXEL)
return ZYNOS_VENDOR_ID_ZYXEL; return ZYNOS_VENDOR_ID_ZYXEL;

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,13 +36,13 @@
#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)
{ {
u16 id,len; u16 id, len;
u8 *mac; u8 *mac;
int i,j; int i, j;
memset(&rb_hs, 0, sizeof(rb_hs)); 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) if (rb_hs.mac_count > RB_MAX_MAC_COUNT)
rb_hs.mac_count = RB_MAX_MAC_COUNT; rb_hs.mac_count = RB_MAX_MAC_COUNT;
mac = buf; mac = buf;
for (i=0; i < rb_hs.mac_count; i++) { for (i = 0; i < rb_hs.mac_count; i++) {
for (j=0; j < RB_MAC_SIZE; j++) for (j = 0; j < RB_MAC_SIZE; j++)
rb_hs.macs[i][j] = mac[j]; rb_hs.macs[i][j] = mac[j];
mac += RB_MAC_SIZE; mac += RB_MAC_SIZE;
} }
@ -111,7 +111,7 @@ int __init routerboot_present(void)
{ {
struct rb_bios_settings *bs; struct rb_bios_settings *bs;
u8 *base; u8 *base;
u32 off,len; u32 off, len;
if (rb_found) if (rb_found)
goto out; goto out;

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>
@ -45,7 +45,7 @@
#undef DEBUG #undef DEBUG
#ifdef DEBUG #ifdef DEBUG
#define DBG(f, a...) printk(KERN_DEBUG f, ## a ) #define DBG(f, a...) printk(KERN_DEBUG f, ## a)
#else #else
#define DBG(f, a...) do {} while (0) #define DBG(f, a...) do {} while (0)
#endif #endif
@ -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;
@ -93,7 +93,7 @@ static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where,
spin_lock_irqsave(&pci_lock, flags); spin_lock_irqsave(&pci_lock, flags);
write_cfgaddr(mkaddr(bus,devfn,where)); write_cfgaddr(mkaddr(bus, devfn, where));
data = read_cfgdata(); data = read_cfgdata();
DBG("PCI: cfg_read %02u.%02u.%01u/%02X:%01d, cfg:0x%08X", 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); spin_lock_irqsave(&pci_lock, flags);
write_cfgaddr(mkaddr(bus,devfn,where)); write_cfgaddr(mkaddr(bus, devfn, where));
data = read_cfgdata(); data = read_cfgdata();
DBG("PCI: cfg_write %02u.%02u.%01u/%02X:%01d, cfg:0x%08X", 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) { 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,80 +54,80 @@ 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)
#define LED_INV(g,n,t) LED_DATA((n),(t),(g), 1) #define LED_INV(g, n, t) LED_DATA((n), (t), (g), 1)
/* /*
* Compex boards * Compex boards
*/ */
#if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL)
LED_ARRAY(np27g) { /* FIXME: untested */ LED_ARRAY(np27g) { /* FIXME: untested */
LED_STD(ADM5120_GPIO_xxxx, "lan1", NULL ), LED_STD(ADM5120_GPIO_xxxx, "lan1", NULL),
LED_STD(ADM5120_GPIO_xxxx, "lan2", NULL ), LED_STD(ADM5120_GPIO_xxxx, "lan2", NULL),
LED_STD(ADM5120_GPIO_xxxx, "lan3", NULL ), LED_STD(ADM5120_GPIO_xxxx, "lan3", NULL),
LED_STD(ADM5120_GPIO_xxxx, "lan4", NULL ), LED_STD(ADM5120_GPIO_xxxx, "lan4", NULL),
LED_STD(ADM5120_GPIO_xxxx, "wan_cond", NULL ), LED_STD(ADM5120_GPIO_xxxx, "wan_cond", NULL),
LED_STD(ADM5120_GPIO_xxxx, "wlan", NULL ), LED_STD(ADM5120_GPIO_xxxx, "wlan", NULL),
LED_STD(ADM5120_GPIO_xxxx, "wan_act", NULL ), LED_STD(ADM5120_GPIO_xxxx, "wan_act", NULL),
LED_STD(ADM5120_GPIO_xxxx, "usb1", NULL ), LED_STD(ADM5120_GPIO_xxxx, "usb1", NULL),
LED_STD(ADM5120_GPIO_xxxx, "usb2", NULL ), LED_STD(ADM5120_GPIO_xxxx, "usb2", NULL),
LED_INV(ADM5120_GPIO_PIN2, "power", NULL ), LED_INV(ADM5120_GPIO_PIN2, "power", NULL),
LED_STD(ADM5120_GPIO_xxxx, "diag", NULL ), LED_STD(ADM5120_GPIO_xxxx, "diag", NULL),
}; };
#endif #endif
#if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL)
LED_ARRAY(np28g) { /* FIXME: untested */ LED_ARRAY(np28g) { /* FIXME: untested */
LED_STD(ADM5120_GPIO_xxxx, "lan1", NULL ), LED_STD(ADM5120_GPIO_xxxx, "lan1", NULL),
LED_STD(ADM5120_GPIO_xxxx, "lan2", NULL ), LED_STD(ADM5120_GPIO_xxxx, "lan2", NULL),
LED_STD(ADM5120_GPIO_xxxx, "lan3", NULL ), LED_STD(ADM5120_GPIO_xxxx, "lan3", NULL),
LED_STD(ADM5120_GPIO_xxxx, "wan", NULL ), LED_STD(ADM5120_GPIO_xxxx, "wan", NULL),
LED_STD(ADM5120_GPIO_xxxx, "wlan", NULL ), LED_STD(ADM5120_GPIO_xxxx, "wlan", NULL),
LED_STD(ADM5120_GPIO_xxxx, "usb1", NULL ), LED_STD(ADM5120_GPIO_xxxx, "usb1", NULL),
LED_STD(ADM5120_GPIO_xxxx, "usb2", NULL ), LED_STD(ADM5120_GPIO_xxxx, "usb2", NULL),
LED_STD(ADM5120_GPIO_xxxx, "usb3", NULL ), LED_STD(ADM5120_GPIO_xxxx, "usb3", NULL),
LED_STD(ADM5120_GPIO_xxxx, "usb4", NULL ), LED_STD(ADM5120_GPIO_xxxx, "usb4", NULL),
LED_INV(ADM5120_GPIO_PIN2, "power", NULL ), LED_INV(ADM5120_GPIO_PIN2, "power", NULL),
LED_STD(ADM5120_GPIO_xxxx, "diag", NULL ), LED_STD(ADM5120_GPIO_xxxx, "diag", NULL),
}; };
#endif #endif
LED_ARRAY(wp54g) { LED_ARRAY(wp54g) {
LED_INV(ADM5120_GPIO_PIN2, "diag", NULL ), LED_INV(ADM5120_GPIO_PIN2, "diag", NULL),
LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL ), LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL),
LED_INV(ADM5120_GPIO_PIN7, "wan", NULL ), LED_INV(ADM5120_GPIO_PIN7, "wan", NULL),
LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL ), LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL),
LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL ), LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL),
}; };
/* /*
* Edimax boards * Edimax boards
*/ */
LED_ARRAY(br6104k) { LED_ARRAY(br6104k) {
LED_STD(ADM5120_GPIO_PIN0, "power", NULL ), LED_STD(ADM5120_GPIO_PIN0, "power", NULL),
LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL ), LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL),
LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL ), LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL),
LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL ), LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL),
LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL ), LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL),
LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL ), LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL),
LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL ), LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL),
LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL ), LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL),
LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL ), LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL),
LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL ), LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL),
LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL ), LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL),
}; };
/* /*
@ -135,14 +135,14 @@ LED_ARRAY(br6104k) {
*/ */
#if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL)
LED_ARRAY(rb100) { /* FIXME: untested */ LED_ARRAY(rb100) { /* FIXME: untested */
LED_STD(ADM5120_GPIO_PIN6, "power", NULL ), LED_STD(ADM5120_GPIO_PIN6, "power", NULL),
LED_STD(ADM5120_GPIO_PIN3, "user", NULL ), LED_STD(ADM5120_GPIO_PIN3, "user", NULL),
}; };
#endif #endif
LED_ARRAY(rb133) { LED_ARRAY(rb133) {
LED_STD(ADM5120_GPIO_PIN6, "power", NULL ), LED_STD(ADM5120_GPIO_PIN6, "power", NULL),
LED_STD(ADM5120_GPIO_PIN5, "user", NULL ), LED_STD(ADM5120_GPIO_PIN5, "user", NULL),
}; };
/* /*
@ -150,38 +150,38 @@ LED_ARRAY(rb133) {
*/ */
#if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL)
LED_ARRAY(p334) { /* FIXME: untested */ LED_ARRAY(p334) { /* FIXME: untested */
LED_INV(ADM5120_GPIO_xxxx, "power", NULL ), LED_INV(ADM5120_GPIO_xxxx, "power", NULL),
LED_INV(ADM5120_GPIO_xxxx, "lan1", NULL ), LED_INV(ADM5120_GPIO_xxxx, "lan1", NULL),
LED_INV(ADM5120_GPIO_xxxx, "lan2", NULL ), LED_INV(ADM5120_GPIO_xxxx, "lan2", NULL),
LED_INV(ADM5120_GPIO_xxxx, "lan3", NULL ), LED_INV(ADM5120_GPIO_xxxx, "lan3", NULL),
LED_INV(ADM5120_GPIO_xxxx, "lan4", NULL ), LED_INV(ADM5120_GPIO_xxxx, "lan4", NULL),
LED_INV(ADM5120_GPIO_xxxx, "wan", NULL ), LED_INV(ADM5120_GPIO_xxxx, "wan", NULL),
}; };
#endif #endif
LED_ARRAY(p334wt) { LED_ARRAY(p334wt) {
LED_INV(ADM5120_GPIO_PIN2, "power", NULL ), LED_INV(ADM5120_GPIO_PIN2, "power", NULL),
LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL ), LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL),
LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL ), LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL),
LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL ), LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL),
LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL ), LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL),
LED_INV(ADM5120_GPIO_P4L0, "wan", NULL ), LED_INV(ADM5120_GPIO_P4L0, "wan", NULL),
LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL ), LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL),
LED_INV(ADM5120_GPIO_P2L2, "otist", NULL ), LED_INV(ADM5120_GPIO_P2L2, "otist", NULL),
LED_INV(ADM5120_GPIO_P1L2, "hidden", NULL ), LED_INV(ADM5120_GPIO_P1L2, "hidden", NULL),
}; };
#if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL)
LED_ARRAY(p335) { /* FIXME: untested */ LED_ARRAY(p335) { /* FIXME: untested */
LED_INV(ADM5120_GPIO_PIN2, "power", NULL ), LED_INV(ADM5120_GPIO_PIN2, "power", NULL),
LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL ), LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL),
LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL ), LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL),
LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL ), LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL),
LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL ), LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL),
LED_INV(ADM5120_GPIO_P4L0, "wan", NULL ), LED_INV(ADM5120_GPIO_P4L0, "wan", NULL),
LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL ), LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL),
LED_INV(ADM5120_GPIO_P2L2, "otist", NULL ), LED_INV(ADM5120_GPIO_P2L2, "otist", NULL),
LED_INV(ADM5120_GPIO_xxxx, "usb", NULL ), LED_INV(ADM5120_GPIO_xxxx, "usb", NULL),
}; };
#endif #endif
@ -190,36 +190,36 @@ LED_ARRAY(p335) { /* FIXME: untested */
*/ */
LED_ARRAY(generic) { LED_ARRAY(generic) {
#if defined(CONFIG_LEDS_ADM5120_DIAG) #if defined(CONFIG_LEDS_ADM5120_DIAG)
LED_STD(ADM5120_GPIO_PIN0, "gpio0", NULL ), LED_STD(ADM5120_GPIO_PIN0, "gpio0", NULL),
LED_STD(ADM5120_GPIO_PIN1, "gpio1", NULL ), LED_STD(ADM5120_GPIO_PIN1, "gpio1", NULL),
LED_STD(ADM5120_GPIO_PIN2, "gpio2", NULL ), LED_STD(ADM5120_GPIO_PIN2, "gpio2", NULL),
LED_STD(ADM5120_GPIO_PIN3, "gpio3", NULL ), LED_STD(ADM5120_GPIO_PIN3, "gpio3", NULL),
LED_STD(ADM5120_GPIO_PIN4, "gpio4", NULL ), LED_STD(ADM5120_GPIO_PIN4, "gpio4", NULL),
LED_STD(ADM5120_GPIO_PIN5, "gpio5", NULL ), LED_STD(ADM5120_GPIO_PIN5, "gpio5", NULL),
LED_STD(ADM5120_GPIO_PIN6, "gpio6", NULL ), LED_STD(ADM5120_GPIO_PIN6, "gpio6", NULL),
LED_STD(ADM5120_GPIO_PIN7, "gpio7", NULL ), LED_STD(ADM5120_GPIO_PIN7, "gpio7", NULL),
LED_STD(ADM5120_GPIO_P0L0, "port0led0", NULL ), LED_STD(ADM5120_GPIO_P0L0, "port0led0", NULL),
LED_STD(ADM5120_GPIO_P0L1, "port0led1", NULL ), LED_STD(ADM5120_GPIO_P0L1, "port0led1", NULL),
LED_STD(ADM5120_GPIO_P0L2, "port0led2", NULL ), LED_STD(ADM5120_GPIO_P0L2, "port0led2", NULL),
LED_STD(ADM5120_GPIO_P1L0, "port1led0", NULL ), LED_STD(ADM5120_GPIO_P1L0, "port1led0", NULL),
LED_STD(ADM5120_GPIO_P1L1, "port1led1", NULL ), LED_STD(ADM5120_GPIO_P1L1, "port1led1", NULL),
LED_STD(ADM5120_GPIO_P1L2, "port1led2", NULL ), LED_STD(ADM5120_GPIO_P1L2, "port1led2", NULL),
LED_STD(ADM5120_GPIO_P2L0, "port2led0", NULL ), LED_STD(ADM5120_GPIO_P2L0, "port2led0", NULL),
LED_STD(ADM5120_GPIO_P2L1, "port2led1", NULL ), LED_STD(ADM5120_GPIO_P2L1, "port2led1", NULL),
LED_STD(ADM5120_GPIO_P2L2, "port2led2", NULL ), LED_STD(ADM5120_GPIO_P2L2, "port2led2", NULL),
LED_STD(ADM5120_GPIO_P3L0, "port3led0", NULL ), LED_STD(ADM5120_GPIO_P3L0, "port3led0", NULL),
LED_STD(ADM5120_GPIO_P3L1, "port3led1", NULL ), LED_STD(ADM5120_GPIO_P3L1, "port3led1", NULL),
LED_STD(ADM5120_GPIO_P3L2, "port3led2", NULL ), LED_STD(ADM5120_GPIO_P3L2, "port3led2", NULL),
LED_STD(ADM5120_GPIO_P4L0, "port4led0", NULL ), LED_STD(ADM5120_GPIO_P4L0, "port4led0", NULL),
LED_STD(ADM5120_GPIO_P4L1, "port4led1", NULL ), LED_STD(ADM5120_GPIO_P4L1, "port4led1", NULL),
LED_STD(ADM5120_GPIO_P4L2, "port4led2", NULL ), LED_STD(ADM5120_GPIO_P4L2, "port4led2", NULL),
#endif #endif
}; };
#define MACH_DATA(m, n) { \ #define MACH_DATA(m, n) { \
.machtype = (m), \ .machtype = (m), \
.nr_leds = ARRAY_SIZE(n ## _leds), \ .nr_leds = ARRAY_SIZE(n ## _leds), \
.leds = n ## _leds \ .leds = n ## _leds \
} }
static struct mach_data machines[] __initdata = { static struct mach_data machines[] __initdata = {
@ -262,19 +262,12 @@ create_leddev(int id, struct gpio_led *led)
p->pdev.name = "leds-gpio"; p->pdev.name = "leds-gpio";
p->pdev.id = id; p->pdev.id = id;
p->pdev.dev.platform_data = &p->pdata; p->pdev.dev.platform_data = &p->pdata;
p->pdata.num_leds=1; p->pdata.num_leds = 1;
p->pdata.leds = &p->led; p->pdata.leds = &p->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)
{ {
@ -282,7 +275,7 @@ adm5120_leds_findmach(unsigned long machtype)
int i; int i;
mach = NULL; mach = NULL;
for (i=0; i<ARRAY_SIZE(machines); i++) { for (i = 0; i < ARRAY_SIZE(machines); i++) {
if (machines[i].machtype == machtype) { if (machines[i].machtype == machtype) {
mach = &machines[i]; mach = &machines[i];
break; break;
@ -315,7 +308,7 @@ adm5120_leds_init(void)
goto err; goto err;
} }
for (i=0; i < mach->nr_leds; i++) { for (i = 0; i < mach->nr_leds; i++) {
led_devs[i] = create_leddev(i, &mach->leds[i]); led_devs[i] = create_leddev(i, &mach->leds[i]);
if (led_devs[i] == NULL) { if (led_devs[i] == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
@ -323,7 +316,7 @@ adm5120_leds_init(void)
} }
} }
for (i=0; i < mach->nr_leds; i++) { for (i = 0; i < mach->nr_leds; i++) {
ret = platform_device_register(&led_devs[i]->pdev); ret = platform_device_register(&led_devs[i]->pdev);
if (ret) if (ret)
goto err_unregister; goto err_unregister;
@ -333,12 +326,12 @@ adm5120_leds_init(void)
return 0; return 0;
err_unregister: err_unregister:
for (i--; i>=0; i--) for (i--; i >= 0; i--)
platform_device_unregister(&led_devs[i]->pdev); platform_device_unregister(&led_devs[i]->pdev);
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;
} }
@ -348,9 +341,9 @@ adm5120_leds_exit(void)
{ {
int i; int i;
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>
@ -173,7 +172,7 @@ static void adm5120_flash_write(struct map_info *map, const map_word datum,
{ {
struct adm5120_map_info *amap = map_to_amap(map); struct adm5120_map_info *amap = map_to_amap(map);
MAP_DBG(map,"writing to ofs %lX\n", ofs); MAP_DBG(map, "writing to ofs %lX\n", ofs);
if (ofs > amap->window_size) if (ofs > amap->window_size)
return; return;
@ -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;
@ -357,7 +357,7 @@ static int adm5120_flash_initparts(struct adm5120_flash_info *info)
num_parsers = MAX_PARSED_PARTS; num_parsers = MAX_PARSED_PARTS;
parser[1] = NULL; parser[1] = NULL;
for (i=0; i<num_parsers; i++) { for (i = 0; i < num_parsers; i++) {
parser[0] = parse_types[i]; parser[0] = parse_types[i];
MAP_INFO(map, "parsing \"%s\" partitions\n", MAP_INFO(map, "parsing \"%s\" partitions\n",
@ -394,7 +394,7 @@ static void adm5120_flash_remove_mtd(struct adm5120_flash_info *info)
if (info->nr_parts) { if (info->nr_parts) {
del_mtd_partitions(info->mtd); del_mtd_partitions(info->mtd);
for (i=0; i<MAX_PARSED_PARTS; i++) for (i = 0; i < MAX_PARSED_PARTS; i++)
if (info->parts[i] != NULL) if (info->parts[i] != NULL)
kfree(info->parts[i]); kfree(info->parts[i]);
} else { } else {
@ -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,24 +38,24 @@
#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
struct trx_header { struct trx_header {
u32 magic; /* "HDR0" */ u32 magic; /* "HDR0" */
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;
@ -113,7 +114,7 @@ static void trxsplit_findtrx(struct mtd_info *mtd)
printk(KERN_INFO PFX "searching TRX header in '%s'\n", mtd->name); printk(KERN_INFO PFX "searching TRX header in '%s'\n", mtd->name);
err = 0; err = 0;
for (offset=0; offset < mtd->size; offset+=blocklen) { for (offset = 0; offset < mtd->size; offset += blocklen) {
err = trxsplit_checktrx(mtd, offset); err = trxsplit_checktrx(mtd, offset);
if (err == 0) if (err == 0)
break; break;
@ -134,7 +135,7 @@ static void trxsplit_create_partitions(struct mtd_info *mtd)
int err; int err;
int i; int i;
for (i=0; i<TRX_MAX_OFFSET;i++) { for (i = 0; i < TRX_MAX_OFFSET; i++) {
part = &trx_parts[i]; part = &trx_parts[i];
if (trx_hdr.offsets[i] == 0) if (trx_hdr.offsets[i] == 0)
continue; continue;
@ -142,12 +143,12 @@ 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;
part = &trx_parts[i]; part = &trx_parts[i];
if (part->size < TRX_MIN_KERNEL_SIZE) { if (part->size < TRX_MIN_KERNEL_SIZE) {
part->name = "loader"; part->name = "loader";
@ -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);