MIPS: AR7: Whitespace hacking
[Ralf: Fixed up reject and Wu's complaints about comment style.] Signed-off-by: Alexander Clouter <alex@digriz.org.uk> To: linux-mips@linux-mips.org Patchwork: http://patchwork.linux-mips.org/patch/921/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
committed by
Ralf Baechle
parent
10229f3761
commit
4d1da8c296
@@ -24,8 +24,8 @@
|
|||||||
#include <asm/mach-ar7/gpio.h>
|
#include <asm/mach-ar7/gpio.h>
|
||||||
|
|
||||||
struct ar7_gpio_chip {
|
struct ar7_gpio_chip {
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
struct gpio_chip chip;
|
struct gpio_chip chip;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ar7_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
static int ar7_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
||||||
@@ -77,7 +77,7 @@ static int ar7_gpio_direction_output(struct gpio_chip *chip,
|
|||||||
|
|
||||||
static struct ar7_gpio_chip ar7_gpio_chip = {
|
static struct ar7_gpio_chip ar7_gpio_chip = {
|
||||||
.chip = {
|
.chip = {
|
||||||
.label = "ar7-gpio",
|
.label = "ar7-gpio",
|
||||||
.direction_input = ar7_gpio_direction_input,
|
.direction_input = ar7_gpio_direction_input,
|
||||||
.direction_output = ar7_gpio_direction_output,
|
.direction_output = ar7_gpio_direction_output,
|
||||||
.set = ar7_gpio_set_value,
|
.set = ar7_gpio_set_value,
|
||||||
|
@@ -62,8 +62,7 @@ void __init prom_meminit(void)
|
|||||||
unsigned long pages;
|
unsigned long pages;
|
||||||
|
|
||||||
pages = memsize() >> PAGE_SHIFT;
|
pages = memsize() >> PAGE_SHIFT;
|
||||||
add_memory_region(PHYS_OFFSET, pages << PAGE_SHIFT,
|
add_memory_region(PHYS_OFFSET, pages << PAGE_SHIFT, BOOT_MEM_RAM);
|
||||||
BOOT_MEM_RAM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init prom_free_prom_memory(void)
|
void __init prom_free_prom_memory(void)
|
||||||
|
@@ -42,39 +42,42 @@
|
|||||||
#include <asm/mach-ar7/gpio.h>
|
#include <asm/mach-ar7/gpio.h>
|
||||||
#include <asm/mach-ar7/prom.h>
|
#include <asm/mach-ar7/prom.h>
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* VLYNQ Bus
|
||||||
|
****************************************************************************/
|
||||||
struct plat_vlynq_data {
|
struct plat_vlynq_data {
|
||||||
struct plat_vlynq_ops ops;
|
struct plat_vlynq_ops ops;
|
||||||
int gpio_bit;
|
int gpio_bit;
|
||||||
int reset_bit;
|
int reset_bit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int vlynq_on(struct vlynq_device *dev)
|
static int vlynq_on(struct vlynq_device *dev)
|
||||||
{
|
{
|
||||||
int result;
|
int ret;
|
||||||
struct plat_vlynq_data *pdata = dev->dev.platform_data;
|
struct plat_vlynq_data *pdata = dev->dev.platform_data;
|
||||||
|
|
||||||
result = gpio_request(pdata->gpio_bit, "vlynq");
|
ret = gpio_request(pdata->gpio_bit, "vlynq");
|
||||||
if (result)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ar7_device_reset(pdata->reset_bit);
|
ar7_device_reset(pdata->reset_bit);
|
||||||
|
|
||||||
result = ar7_gpio_disable(pdata->gpio_bit);
|
ret = ar7_gpio_disable(pdata->gpio_bit);
|
||||||
if (result)
|
if (ret)
|
||||||
goto out_enabled;
|
goto out_enabled;
|
||||||
|
|
||||||
result = ar7_gpio_enable(pdata->gpio_bit);
|
ret = ar7_gpio_enable(pdata->gpio_bit);
|
||||||
if (result)
|
if (ret)
|
||||||
goto out_enabled;
|
goto out_enabled;
|
||||||
|
|
||||||
result = gpio_direction_output(pdata->gpio_bit, 0);
|
ret = gpio_direction_output(pdata->gpio_bit, 0);
|
||||||
if (result)
|
if (ret)
|
||||||
goto out_gpio_enabled;
|
goto out_gpio_enabled;
|
||||||
|
|
||||||
msleep(50);
|
msleep(50);
|
||||||
|
|
||||||
gpio_set_value(pdata->gpio_bit, 1);
|
gpio_set_value(pdata->gpio_bit, 1);
|
||||||
|
|
||||||
msleep(50);
|
msleep(50);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -85,352 +88,208 @@ out_enabled:
|
|||||||
ar7_device_disable(pdata->reset_bit);
|
ar7_device_disable(pdata->reset_bit);
|
||||||
gpio_free(pdata->gpio_bit);
|
gpio_free(pdata->gpio_bit);
|
||||||
out:
|
out:
|
||||||
return result;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vlynq_off(struct vlynq_device *dev)
|
static void vlynq_off(struct vlynq_device *dev)
|
||||||
{
|
{
|
||||||
struct plat_vlynq_data *pdata = dev->dev.platform_data;
|
struct plat_vlynq_data *pdata = dev->dev.platform_data;
|
||||||
|
|
||||||
ar7_gpio_disable(pdata->gpio_bit);
|
ar7_gpio_disable(pdata->gpio_bit);
|
||||||
gpio_free(pdata->gpio_bit);
|
gpio_free(pdata->gpio_bit);
|
||||||
ar7_device_disable(pdata->reset_bit);
|
ar7_device_disable(pdata->reset_bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct resource physmap_flash_resource = {
|
|
||||||
.name = "mem",
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
.start = 0x10000000,
|
|
||||||
.end = 0x107fffff,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct resource cpmac_low_res[] = {
|
|
||||||
{
|
|
||||||
.name = "regs",
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
.start = AR7_REGS_MAC0,
|
|
||||||
.end = AR7_REGS_MAC0 + 0x7ff,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "irq",
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
.start = 27,
|
|
||||||
.end = 27,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct resource cpmac_high_res[] = {
|
|
||||||
{
|
|
||||||
.name = "regs",
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
.start = AR7_REGS_MAC1,
|
|
||||||
.end = AR7_REGS_MAC1 + 0x7ff,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "irq",
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
.start = 41,
|
|
||||||
.end = 41,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct resource vlynq_low_res[] = {
|
static struct resource vlynq_low_res[] = {
|
||||||
{
|
{
|
||||||
.name = "regs",
|
.name = "regs",
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
.start = AR7_REGS_VLYNQ0,
|
.start = AR7_REGS_VLYNQ0,
|
||||||
.end = AR7_REGS_VLYNQ0 + 0xff,
|
.end = AR7_REGS_VLYNQ0 + 0xff,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "irq",
|
.name = "irq",
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
.start = 29,
|
.start = 29,
|
||||||
.end = 29,
|
.end = 29,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "mem",
|
.name = "mem",
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
.start = 0x04000000,
|
.start = 0x04000000,
|
||||||
.end = 0x04ffffff,
|
.end = 0x04ffffff,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "devirq",
|
.name = "devirq",
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
.start = 80,
|
.start = 80,
|
||||||
.end = 111,
|
.end = 111,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct resource vlynq_high_res[] = {
|
static struct resource vlynq_high_res[] = {
|
||||||
{
|
{
|
||||||
.name = "regs",
|
.name = "regs",
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
.start = AR7_REGS_VLYNQ1,
|
.start = AR7_REGS_VLYNQ1,
|
||||||
.end = AR7_REGS_VLYNQ1 + 0xff,
|
.end = AR7_REGS_VLYNQ1 + 0xff,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "irq",
|
.name = "irq",
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
.start = 33,
|
.start = 33,
|
||||||
.end = 33,
|
.end = 33,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "mem",
|
.name = "mem",
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
.start = 0x0c000000,
|
.start = 0x0c000000,
|
||||||
.end = 0x0cffffff,
|
.end = 0x0cffffff,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "devirq",
|
.name = "devirq",
|
||||||
.flags = IORESOURCE_IRQ,
|
.flags = IORESOURCE_IRQ,
|
||||||
.start = 112,
|
.start = 112,
|
||||||
.end = 143,
|
.end = 143,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct resource usb_res[] = {
|
|
||||||
{
|
|
||||||
.name = "regs",
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
.start = AR7_REGS_USB,
|
|
||||||
.end = AR7_REGS_USB + 0xff,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "irq",
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
.start = 32,
|
|
||||||
.end = 32,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "mem",
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
.start = 0x03400000,
|
|
||||||
.end = 0x03401fff,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct physmap_flash_data physmap_flash_data = {
|
|
||||||
.width = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct fixed_phy_status fixed_phy_status __initdata = {
|
|
||||||
.link = 1,
|
|
||||||
.speed = 100,
|
|
||||||
.duplex = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct plat_cpmac_data cpmac_low_data = {
|
|
||||||
.reset_bit = 17,
|
|
||||||
.power_bit = 20,
|
|
||||||
.phy_mask = 0x80000000,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct plat_cpmac_data cpmac_high_data = {
|
|
||||||
.reset_bit = 21,
|
|
||||||
.power_bit = 22,
|
|
||||||
.phy_mask = 0x7fffffff,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct plat_vlynq_data vlynq_low_data = {
|
static struct plat_vlynq_data vlynq_low_data = {
|
||||||
.ops.on = vlynq_on,
|
.ops = {
|
||||||
.ops.off = vlynq_off,
|
.on = vlynq_on,
|
||||||
.reset_bit = 20,
|
.off = vlynq_off,
|
||||||
.gpio_bit = 18,
|
},
|
||||||
|
.reset_bit = 20,
|
||||||
|
.gpio_bit = 18,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct plat_vlynq_data vlynq_high_data = {
|
static struct plat_vlynq_data vlynq_high_data = {
|
||||||
.ops.on = vlynq_on,
|
.ops = {
|
||||||
.ops.off = vlynq_off,
|
.on = vlynq_on,
|
||||||
.reset_bit = 16,
|
.off = vlynq_off,
|
||||||
.gpio_bit = 19,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_device physmap_flash = {
|
|
||||||
.id = 0,
|
|
||||||
.name = "physmap-flash",
|
|
||||||
.dev.platform_data = &physmap_flash_data,
|
|
||||||
.resource = &physmap_flash_resource,
|
|
||||||
.num_resources = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static u64 cpmac_dma_mask = DMA_BIT_MASK(32);
|
|
||||||
static struct platform_device cpmac_low = {
|
|
||||||
.id = 0,
|
|
||||||
.name = "cpmac",
|
|
||||||
.dev = {
|
|
||||||
.dma_mask = &cpmac_dma_mask,
|
|
||||||
.coherent_dma_mask = DMA_BIT_MASK(32),
|
|
||||||
.platform_data = &cpmac_low_data,
|
|
||||||
},
|
},
|
||||||
.resource = cpmac_low_res,
|
.reset_bit = 26,
|
||||||
.num_resources = ARRAY_SIZE(cpmac_low_res),
|
.gpio_bit = 19,
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_device cpmac_high = {
|
|
||||||
.id = 1,
|
|
||||||
.name = "cpmac",
|
|
||||||
.dev = {
|
|
||||||
.dma_mask = &cpmac_dma_mask,
|
|
||||||
.coherent_dma_mask = DMA_BIT_MASK(32),
|
|
||||||
.platform_data = &cpmac_high_data,
|
|
||||||
},
|
|
||||||
.resource = cpmac_high_res,
|
|
||||||
.num_resources = ARRAY_SIZE(cpmac_high_res),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device vlynq_low = {
|
static struct platform_device vlynq_low = {
|
||||||
.id = 0,
|
.id = 0,
|
||||||
.name = "vlynq",
|
.name = "vlynq",
|
||||||
.dev.platform_data = &vlynq_low_data,
|
.dev = {
|
||||||
.resource = vlynq_low_res,
|
.platform_data = &vlynq_low_data,
|
||||||
.num_resources = ARRAY_SIZE(vlynq_low_res),
|
},
|
||||||
|
.resource = vlynq_low_res,
|
||||||
|
.num_resources = ARRAY_SIZE(vlynq_low_res),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device vlynq_high = {
|
static struct platform_device vlynq_high = {
|
||||||
.id = 1,
|
.id = 1,
|
||||||
.name = "vlynq",
|
.name = "vlynq",
|
||||||
.dev.platform_data = &vlynq_high_data,
|
|
||||||
.resource = vlynq_high_res,
|
|
||||||
.num_resources = ARRAY_SIZE(vlynq_high_res),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static struct gpio_led default_leds[] = {
|
|
||||||
{
|
|
||||||
.name = "status",
|
|
||||||
.gpio = 8,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct gpio_led dsl502t_leds[] = {
|
|
||||||
{
|
|
||||||
.name = "status",
|
|
||||||
.gpio = 9,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "ethernet",
|
|
||||||
.gpio = 7,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "usb",
|
|
||||||
.gpio = 12,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct gpio_led dg834g_leds[] = {
|
|
||||||
{
|
|
||||||
.name = "ppp",
|
|
||||||
.gpio = 6,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "status",
|
|
||||||
.gpio = 7,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "adsl",
|
|
||||||
.gpio = 8,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "wifi",
|
|
||||||
.gpio = 12,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "power",
|
|
||||||
.gpio = 14,
|
|
||||||
.active_low = 1,
|
|
||||||
.default_trigger = "default-on",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct gpio_led fb_sl_leds[] = {
|
|
||||||
{
|
|
||||||
.name = "1",
|
|
||||||
.gpio = 7,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "2",
|
|
||||||
.gpio = 13,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "3",
|
|
||||||
.gpio = 10,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "4",
|
|
||||||
.gpio = 12,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "5",
|
|
||||||
.gpio = 9,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct gpio_led fb_fon_leds[] = {
|
|
||||||
{
|
|
||||||
.name = "1",
|
|
||||||
.gpio = 8,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "2",
|
|
||||||
.gpio = 3,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "3",
|
|
||||||
.gpio = 5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "4",
|
|
||||||
.gpio = 4,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "5",
|
|
||||||
.gpio = 11,
|
|
||||||
.active_low = 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct gpio_led_platform_data ar7_led_data;
|
|
||||||
|
|
||||||
static struct platform_device ar7_gpio_leds = {
|
|
||||||
.name = "leds-gpio",
|
|
||||||
.id = -1,
|
|
||||||
.dev = {
|
.dev = {
|
||||||
.platform_data = &ar7_led_data,
|
.platform_data = &vlynq_high_data,
|
||||||
}
|
},
|
||||||
|
.resource = vlynq_high_res,
|
||||||
|
.num_resources = ARRAY_SIZE(vlynq_high_res),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device ar7_udc = {
|
/*****************************************************************************
|
||||||
.id = -1,
|
* Flash
|
||||||
.name = "ar7_udc",
|
****************************************************************************/
|
||||||
.resource = usb_res,
|
static struct resource physmap_flash_resource = {
|
||||||
.num_resources = ARRAY_SIZE(usb_res),
|
.name = "mem",
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
.start = 0x10000000,
|
||||||
|
.end = 0x107fffff,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct resource ar7_wdt_res = {
|
static struct physmap_flash_data physmap_flash_data = {
|
||||||
.name = "regs",
|
.width = 2,
|
||||||
.start = -1, /* Filled at runtime */
|
|
||||||
.end = -1, /* Filled at runtime */
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device ar7_wdt = {
|
static struct platform_device physmap_flash = {
|
||||||
.id = -1,
|
.name = "physmap-flash",
|
||||||
.name = "ar7_wdt",
|
.dev = {
|
||||||
.resource = &ar7_wdt_res,
|
.platform_data = &physmap_flash_data,
|
||||||
.num_resources = 1,
|
},
|
||||||
|
.resource = &physmap_flash_resource,
|
||||||
|
.num_resources = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Ethernet
|
||||||
|
****************************************************************************/
|
||||||
|
static struct resource cpmac_low_res[] = {
|
||||||
|
{
|
||||||
|
.name = "regs",
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
.start = AR7_REGS_MAC0,
|
||||||
|
.end = AR7_REGS_MAC0 + 0x7ff,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "irq",
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
.start = 27,
|
||||||
|
.end = 27,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct resource cpmac_high_res[] = {
|
||||||
|
{
|
||||||
|
.name = "regs",
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
.start = AR7_REGS_MAC1,
|
||||||
|
.end = AR7_REGS_MAC1 + 0x7ff,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "irq",
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
.start = 41,
|
||||||
|
.end = 41,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct fixed_phy_status fixed_phy_status __initdata = {
|
||||||
|
.link = 1,
|
||||||
|
.speed = 100,
|
||||||
|
.duplex = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct plat_cpmac_data cpmac_low_data = {
|
||||||
|
.reset_bit = 17,
|
||||||
|
.power_bit = 20,
|
||||||
|
.phy_mask = 0x80000000,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct plat_cpmac_data cpmac_high_data = {
|
||||||
|
.reset_bit = 21,
|
||||||
|
.power_bit = 22,
|
||||||
|
.phy_mask = 0x7fffffff,
|
||||||
|
};
|
||||||
|
|
||||||
|
static u64 cpmac_dma_mask = DMA_BIT_MASK(32);
|
||||||
|
|
||||||
|
static struct platform_device cpmac_low = {
|
||||||
|
.id = 0,
|
||||||
|
.name = "cpmac",
|
||||||
|
.dev = {
|
||||||
|
.dma_mask = &cpmac_dma_mask,
|
||||||
|
.coherent_dma_mask = DMA_BIT_MASK(32),
|
||||||
|
.platform_data = &cpmac_low_data,
|
||||||
|
},
|
||||||
|
.resource = cpmac_low_res,
|
||||||
|
.num_resources = ARRAY_SIZE(cpmac_low_res),
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct platform_device cpmac_high = {
|
||||||
|
.id = 1,
|
||||||
|
.name = "cpmac",
|
||||||
|
.dev = {
|
||||||
|
.dma_mask = &cpmac_dma_mask,
|
||||||
|
.coherent_dma_mask = DMA_BIT_MASK(32),
|
||||||
|
.platform_data = &cpmac_high_data,
|
||||||
|
},
|
||||||
|
.resource = cpmac_high_res,
|
||||||
|
.num_resources = ARRAY_SIZE(cpmac_high_res),
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline unsigned char char2hex(char h)
|
static inline unsigned char char2hex(char h)
|
||||||
@@ -469,6 +328,156 @@ static void cpmac_get_mac(int instance, unsigned char *dev_addr)
|
|||||||
char2hex(mac[i * 3 + 1]);
|
char2hex(mac[i * 3 + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* USB
|
||||||
|
****************************************************************************/
|
||||||
|
static struct resource usb_res[] = {
|
||||||
|
{
|
||||||
|
.name = "regs",
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
.start = AR7_REGS_USB,
|
||||||
|
.end = AR7_REGS_USB + 0xff,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "irq",
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
.start = 32,
|
||||||
|
.end = 32,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "mem",
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
.start = 0x03400000,
|
||||||
|
.end = 0x034001fff,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct platform_device ar7_udc = {
|
||||||
|
.name = "ar7_udc",
|
||||||
|
.resource = usb_res,
|
||||||
|
.num_resources = ARRAY_SIZE(usb_res),
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* LEDs
|
||||||
|
****************************************************************************/
|
||||||
|
static struct gpio_led default_leds[] = {
|
||||||
|
{
|
||||||
|
.name = "status",
|
||||||
|
.gpio = 8,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct gpio_led dsl502t_leds[] = {
|
||||||
|
{
|
||||||
|
.name = "status",
|
||||||
|
.gpio = 9,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "ethernet",
|
||||||
|
.gpio = 7,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "usb",
|
||||||
|
.gpio = 12,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct gpio_led dg834g_leds[] = {
|
||||||
|
{
|
||||||
|
.name = "ppp",
|
||||||
|
.gpio = 6,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "status",
|
||||||
|
.gpio = 7,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "adsl",
|
||||||
|
.gpio = 8,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "wifi",
|
||||||
|
.gpio = 12,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "power",
|
||||||
|
.gpio = 14,
|
||||||
|
.active_low = 1,
|
||||||
|
.default_trigger = "default-on",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct gpio_led fb_sl_leds[] = {
|
||||||
|
{
|
||||||
|
.name = "1",
|
||||||
|
.gpio = 7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "2",
|
||||||
|
.gpio = 13,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "3",
|
||||||
|
.gpio = 10,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "4",
|
||||||
|
.gpio = 12,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "5",
|
||||||
|
.gpio = 9,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct gpio_led fb_fon_leds[] = {
|
||||||
|
{
|
||||||
|
.name = "1",
|
||||||
|
.gpio = 8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "2",
|
||||||
|
.gpio = 3,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "3",
|
||||||
|
.gpio = 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "4",
|
||||||
|
.gpio = 4,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "5",
|
||||||
|
.gpio = 11,
|
||||||
|
.active_low = 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct gpio_led_platform_data ar7_led_data;
|
||||||
|
|
||||||
|
static struct platform_device ar7_gpio_leds = {
|
||||||
|
.name = "leds-gpio",
|
||||||
|
.dev = {
|
||||||
|
.platform_data = &ar7_led_data,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static void __init detect_leds(void)
|
static void __init detect_leds(void)
|
||||||
{
|
{
|
||||||
char *prid, *usb_prod;
|
char *prid, *usb_prod;
|
||||||
@@ -501,6 +510,25 @@ static void __init detect_leds(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Watchdog
|
||||||
|
****************************************************************************/
|
||||||
|
static struct resource ar7_wdt_res = {
|
||||||
|
.name = "regs",
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
.start = -1, /* Filled at runtime */
|
||||||
|
.end = -1, /* Filled at runtime */
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct platform_device ar7_wdt = {
|
||||||
|
.name = "ar7_wdt",
|
||||||
|
.resource = &ar7_wdt_res,
|
||||||
|
.num_resources = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Init
|
||||||
|
****************************************************************************/
|
||||||
static int __init ar7_register_devices(void)
|
static int __init ar7_register_devices(void)
|
||||||
{
|
{
|
||||||
u16 chip_id;
|
u16 chip_id;
|
||||||
@@ -516,29 +544,28 @@ static int __init ar7_register_devices(void)
|
|||||||
if (IS_ERR(bus_clk))
|
if (IS_ERR(bus_clk))
|
||||||
panic("unable to get bus clk\n");
|
panic("unable to get bus clk\n");
|
||||||
|
|
||||||
uart_port[0].type = PORT_16550A;
|
uart_port[0].type = PORT_16550A;
|
||||||
uart_port[0].line = 0;
|
uart_port[0].line = 0;
|
||||||
uart_port[0].irq = AR7_IRQ_UART0;
|
uart_port[0].irq = AR7_IRQ_UART0;
|
||||||
uart_port[0].uartclk = clk_get_rate(bus_clk) / 2;
|
uart_port[0].uartclk = clk_get_rate(bus_clk) / 2;
|
||||||
uart_port[0].iotype = UPIO_MEM32;
|
uart_port[0].iotype = UPIO_MEM32;
|
||||||
uart_port[0].mapbase = AR7_REGS_UART0;
|
uart_port[0].mapbase = AR7_REGS_UART0;
|
||||||
uart_port[0].membase = ioremap(uart_port[0].mapbase, 256);
|
uart_port[0].membase = ioremap(uart_port[0].mapbase, 256);
|
||||||
uart_port[0].regshift = 2;
|
uart_port[0].regshift = 2;
|
||||||
res = early_serial_setup(&uart_port[0]);
|
res = early_serial_setup(&uart_port[0]);
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
||||||
/* Only TNETD73xx have a second serial port */
|
/* Only TNETD73xx have a second serial port */
|
||||||
if (ar7_has_second_uart()) {
|
if (ar7_has_second_uart()) {
|
||||||
uart_port[1].type = PORT_16550A;
|
uart_port[1].type = PORT_16550A;
|
||||||
uart_port[1].line = 1;
|
uart_port[1].line = 1;
|
||||||
uart_port[1].irq = AR7_IRQ_UART1;
|
uart_port[1].irq = AR7_IRQ_UART1;
|
||||||
uart_port[1].uartclk = clk_get_rate(bus_clk) / 2;
|
uart_port[1].uartclk = clk_get_rate(bus_clk) / 2;
|
||||||
uart_port[1].iotype = UPIO_MEM32;
|
uart_port[1].iotype = UPIO_MEM32;
|
||||||
uart_port[1].mapbase = UR8_REGS_UART1;
|
uart_port[1].mapbase = UR8_REGS_UART1;
|
||||||
uart_port[1].membase = ioremap(uart_port[1].mapbase, 256);
|
uart_port[1].membase = ioremap(uart_port[1].mapbase, 256);
|
||||||
uart_port[1].regshift = 2;
|
uart_port[1].regshift = 2;
|
||||||
res = early_serial_setup(&uart_port[1]);
|
res = early_serial_setup(&uart_port[1]);
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
@@ -32,8 +32,8 @@
|
|||||||
#define MAX_ENTRY 80
|
#define MAX_ENTRY 80
|
||||||
|
|
||||||
struct env_var {
|
struct env_var {
|
||||||
char *name;
|
char *name;
|
||||||
char *value;
|
char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct env_var adam2_env[MAX_ENTRY];
|
static struct env_var adam2_env[MAX_ENTRY];
|
||||||
@@ -41,6 +41,7 @@ static struct env_var adam2_env[MAX_ENTRY];
|
|||||||
char *prom_getenv(const char *name)
|
char *prom_getenv(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; (i < MAX_ENTRY) && adam2_env[i].name; i++)
|
for (i = 0; (i < MAX_ENTRY) && adam2_env[i].name; i++)
|
||||||
if (!strcmp(name, adam2_env[i].name))
|
if (!strcmp(name, adam2_env[i].name))
|
||||||
return adam2_env[i].value;
|
return adam2_env[i].value;
|
||||||
@@ -61,38 +62,38 @@ static void __init ar7_init_cmdline(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct psbl_rec {
|
struct psbl_rec {
|
||||||
u32 psbl_size;
|
u32 psbl_size;
|
||||||
u32 env_base;
|
u32 env_base;
|
||||||
u32 env_size;
|
u32 env_size;
|
||||||
u32 ffs_base;
|
u32 ffs_base;
|
||||||
u32 ffs_size;
|
u32 ffs_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
static __initdata char psp_env_version[] = "TIENV0.8";
|
static __initdata char psp_env_version[] = "TIENV0.8";
|
||||||
|
|
||||||
struct psp_env_chunk {
|
struct psp_env_chunk {
|
||||||
u8 num;
|
u8 num;
|
||||||
u8 ctrl;
|
u8 ctrl;
|
||||||
u16 csum;
|
u16 csum;
|
||||||
u8 len;
|
u8 len;
|
||||||
char data[11];
|
char data[11];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct psp_var_map_entry {
|
struct psp_var_map_entry {
|
||||||
u8 num;
|
u8 num;
|
||||||
char *value;
|
char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct psp_var_map_entry psp_var_map[] = {
|
static struct psp_var_map_entry psp_var_map[] = {
|
||||||
{ 1, "cpufrequency" },
|
{ 1, "cpufrequency" },
|
||||||
{ 2, "memsize" },
|
{ 2, "memsize" },
|
||||||
{ 3, "flashsize" },
|
{ 3, "flashsize" },
|
||||||
{ 4, "modetty0" },
|
{ 4, "modetty0" },
|
||||||
{ 5, "modetty1" },
|
{ 5, "modetty1" },
|
||||||
{ 8, "maca" },
|
{ 8, "maca" },
|
||||||
{ 9, "macb" },
|
{ 9, "macb" },
|
||||||
{ 28, "sysfrequency" },
|
{ 28, "sysfrequency" },
|
||||||
{ 38, "mipsfrequency" },
|
{ 38, "mipsfrequency" },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -139,6 +140,7 @@ static char * __init lookup_psp_var_map(u8 num)
|
|||||||
static void __init add_adam2_var(char *name, char *value)
|
static void __init add_adam2_var(char *name, char *value)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ENTRY; i++) {
|
for (i = 0; i < MAX_ENTRY; i++) {
|
||||||
if (!adam2_env[i].name) {
|
if (!adam2_env[i].name) {
|
||||||
adam2_env[i].name = name;
|
adam2_env[i].name = name;
|
||||||
|
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
static void ar7_machine_restart(char *command)
|
static void ar7_machine_restart(char *command)
|
||||||
{
|
{
|
||||||
u32 *softres_reg = ioremap(AR7_REGS_RESET +
|
u32 *softres_reg = ioremap(AR7_REGS_RESET + AR7_RESET_SOFTWARE, 1);
|
||||||
AR7_RESET_SOFTWARE, 1);
|
|
||||||
writel(1, softres_reg);
|
writel(1, softres_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +41,7 @@ static void ar7_machine_power_off(void)
|
|||||||
{
|
{
|
||||||
u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1);
|
u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1);
|
||||||
u32 power_state = readl(power_reg) | (3 << 30);
|
u32 power_state = readl(power_reg) | (3 << 30);
|
||||||
|
|
||||||
writel(power_state, power_reg);
|
writel(power_state, power_reg);
|
||||||
ar7_machine_halt();
|
ar7_machine_halt();
|
||||||
}
|
}
|
||||||
@@ -49,14 +50,14 @@ const char *get_system_type(void)
|
|||||||
{
|
{
|
||||||
u16 chip_id = ar7_chip_id();
|
u16 chip_id = ar7_chip_id();
|
||||||
switch (chip_id) {
|
switch (chip_id) {
|
||||||
case AR7_CHIP_7300:
|
|
||||||
return "TI AR7 (TNETD7300)";
|
|
||||||
case AR7_CHIP_7100:
|
case AR7_CHIP_7100:
|
||||||
return "TI AR7 (TNETD7100)";
|
return "TI AR7 (TNETD7100)";
|
||||||
case AR7_CHIP_7200:
|
case AR7_CHIP_7200:
|
||||||
return "TI AR7 (TNETD7200)";
|
return "TI AR7 (TNETD7200)";
|
||||||
|
case AR7_CHIP_7300:
|
||||||
|
return "TI AR7 (TNETD7300)";
|
||||||
default:
|
default:
|
||||||
return "TI AR7 (Unknown)";
|
return "TI AR7 (unknown)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +71,6 @@ console_initcall(ar7_init_console);
|
|||||||
* Initializes basic routines and structures pointers, memory size (as
|
* Initializes basic routines and structures pointers, memory size (as
|
||||||
* given by the bios and saves the command line.
|
* given by the bios and saves the command line.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void __init plat_mem_setup(void)
|
void __init plat_mem_setup(void)
|
||||||
{
|
{
|
||||||
unsigned long io_base;
|
unsigned long io_base;
|
||||||
@@ -88,6 +88,5 @@ void __init plat_mem_setup(void)
|
|||||||
prom_meminit();
|
prom_meminit();
|
||||||
|
|
||||||
printk(KERN_INFO "%s, ID: 0x%04x, Revision: 0x%02x\n",
|
printk(KERN_INFO "%s, ID: 0x%04x, Revision: 0x%02x\n",
|
||||||
get_system_type(),
|
get_system_type(), ar7_chip_id(), ar7_chip_rev());
|
||||||
ar7_chip_id(), ar7_chip_rev());
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user