return AR7_AFE_CLOCK;
}
} else {
- // Sync
+ // Sync
if (*bootcr & BOOT_PLL_2TO1_MODE) {
// 2:1
switch (clock_id) {
default:
return AR7_AFE_CLOCK;
}
- } else {
+ } else {
// 1:1
return AR7_REF_CLOCK;
}
.name = "regs",
.flags = IORESOURCE_MEM,
.start = AR7_REGS_MAC0,
- .end = AR7_REGS_MAC0 + 0x7FF,
+ .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,
+ .end = AR7_REGS_MAC1 + 0x7ff,
},
{
.name = "irq",
.flags = IORESOURCE_IRQ,
.start = 41,
.end = 41,
- },
+ },
};
static struct resource vlynq_low_res[] = {
.flags = IORESOURCE_IRQ,
.start = 29,
.end = 29,
- },
+ },
{
.name = "mem",
.flags = IORESOURCE_MEM,
.name = "regs",
.flags = IORESOURCE_MEM,
.start = AR7_REGS_VLYNQ1,
- .end = AR7_REGS_VLYNQ1 + 0xFF,
+ .end = AR7_REGS_VLYNQ1 + 0xff,
},
{
.name = "irq",
.flags = IORESOURCE_IRQ,
.start = 33,
.end = 33,
- },
+ },
{
.name = "mem",
.flags = IORESOURCE_MEM,
};
static struct plat_serial8250_port uart_data[] = {
- uart0_data,
- uart1_data,
+ uart0_data,
+ uart1_data,
{ .flags = 0 }
};
static struct plat_serial8250_port uart_data_single[] = {
- uart0_data,
+ uart0_data,
{ .flags = 0 }
};
return res;
- // Only TNETD73xx have a second serial port
- if (ar7_has_second_uart()) {
- uart_port[1].type = PORT_AR7;
- uart_port[1].line = 1;
- uart_port[1].irq = AR7_IRQ_UART1;
- uart_port[1].uartclk = ar7_bus_freq() / 2;
- uart_port[1].iotype = UPIO_MEM;
- uart_port[1].mapbase = UR8_REGS_UART1;
- uart_port[1].membase = ioremap(uart_port[1].mapbase, 256);
- uart_port[1].regshift = 2;
- res = early_serial_setup(&uart_port[1]);
- if (res)
- return res;
- }
-
+ // Only TNETD73xx have a second serial port
+ if (ar7_has_second_uart()) {
+ uart_port[1].type = PORT_AR7;
+ uart_port[1].line = 1;
+ uart_port[1].irq = AR7_IRQ_UART1;
+ uart_port[1].uartclk = ar7_bus_freq() / 2;
+ uart_port[1].iotype = UPIO_MEM;
+ uart_port[1].mapbase = UR8_REGS_UART1;
+ uart_port[1].membase = ioremap(uart_port[1].mapbase, 256);
+ uart_port[1].regshift = 2;
+ res = early_serial_setup(&uart_port[1]);
+ if (res)
+ return res;
+ }
+
#else // !CONFIG_SERIAL_8250
uart_data[0].uartclk = ar7_bus_freq() / 2;
uart_data[1].uartclk = uart_data[0].uartclk;
- // Only TNETD73xx have a second serial port
- if (ar7_has_second_uart()) {
- uart.dev.platform_data = uart_data;
- }
+ // Only TNETD73xx have a second serial port
+ if (ar7_has_second_uart()) {
+ uart.dev.platform_data = uart_data;
+ }
res = platform_device_register(&uart);
if (res)
return res;
-
+
#endif // CONFIG_SERIAL_8250
res = platform_device_register(&physmap_flash);
return;
#ifdef CONFIG_KGDB
- if (!strstr(prom_getcmdline(), "nokgdb"))
- {
- strcat(prom_getcmdline(), " console=kgdb");
- kgdb_enabled = 1;
- return;
+ if (!strstr(prom_getcmdline(), "nokgdb")) {
+ strcat(prom_getcmdline(), " console=kgdb");
+ kgdb_enabled = 1;
+ return;
}
#endif
// from adm5120/prom.c
void prom_printf(char *fmt, ...)
{
- va_list args;
- int l;
- char *p, *buf_end;
- char buf[1024];
-
- va_start(args, fmt);
- l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */
- va_end(args);
-
- buf_end = buf + l;
-
- for (p = buf; p < buf_end; p++) {
- /* Crude cr/nl handling is better than none */
- if (*p == '\n')
- prom_putchar('\r');
- prom_putchar(*p);
- }
+ va_list args;
+ int l;
+ char *p, *buf_end;
+ char buf[1024];
+
+ va_start(args, fmt);
+ l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */
+ va_end(args);
+
+ buf_end = buf + l;
+
+ for (p = buf; p < buf_end; p++) {
+ /* Crude cr/nl handling is better than none */
+ if (*p == '\n')
+ prom_putchar('\r');
+ prom_putchar(*p);
+ }
}
#ifdef CONFIG_KGDB
char getDebugChar(void)
{
- return prom_getchar();
+ return prom_getchar();
}
#endif
static void ar7_machine_power_off(void)
{
- volatile u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1);
+ volatile u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1);
u32 power_state = *power_reg | (3 << 30);
*power_reg = power_state;
ar7_machine_halt();
return vlynq_virq_to_irq(dev, priv->config->irq);
}
-
+
/* Do platform specific device initialization at pci_enable_device() time */
int pcibios_plat_dev_init(struct pci_dev *dev)
{
#define VLYNQ_CTRL_PM_ENABLE 0x80000000
#define VLYNQ_CTRL_CLOCK_INT 0x00008000
-#define VLYNQ_CTRL_CLOCK_DIV(x) ((x & 7) << 16)
+#define VLYNQ_CTRL_CLOCK_DIV(x) (((x) & 7) << 16)
#define VLYNQ_CTRL_INT_LOCAL 0x00004000
#define VLYNQ_CTRL_INT_ENABLE 0x00002000
-#define VLYNQ_CTRL_INT_VECTOR(x) ((x & 0x1f) << 8)
+#define VLYNQ_CTRL_INT_VECTOR(x) (((x) & 0x1f) << 8)
#define VLYNQ_CTRL_INT2CFG 0x00000080
#define VLYNQ_CTRL_RESET 0x00000001
}
static struct irq_chip vlynq_irq_chip = {
- .typename = "VLYNQ",
- .name = "vlynq",
- .unmask = vlynq_irq_unmask,
- .mask = vlynq_irq_mask,
- .set_type = vlynq_irq_type,
+ .typename = "VLYNQ",
+ .name = "vlynq",
+ .unmask = vlynq_irq_unmask,
+ .mask = vlynq_irq_mask,
+ .set_type = vlynq_irq_type,
};
static int vlynq_setup_irq(struct vlynq_device *dev)
if (!request_mem_region(regs_res->start, len, dev->dev.bus_id)) {
printk("%s: Can't request vlynq registers\n", dev->dev.bus_id);
result = -ENXIO;
- goto fail_request;
+ goto fail_request;
}
dev->local = ioremap_nocache(regs_res->start, len);
- if (!dev->local) {
+ if (!dev->local) {
printk("%s: Can't remap vlynq registers\n", dev->dev.bus_id);
result = -ENXIO;
- goto fail_remap;
+ goto fail_remap;
}
dev->remote = (struct vlynq_regs *)((u32)dev->local + 128);
static unsigned expect_close;
/* XXX currently fixed, allows max margin ~68.72 secs */
-#define prescale_value 0xFFFF
+#define prescale_value 0xffff
// Offset of the WDT registers
static unsigned long ar7_regs_wdt;
static ar7_wdt_t *ar7_wdt;
static void ar7_wdt_get_regs(void)
{
- u16 chip_id = ar7_chip_id();
- switch (chip_id)
- {
- case AR7_CHIP_7100:
- case AR7_CHIP_7200:
- ar7_regs_wdt = AR7_REGS_WDT;
- break;
- default:
- ar7_regs_wdt = UR8_REGS_WDT;
- break;
- }
+ u16 chip_id = ar7_chip_id();
+ switch (chip_id)
+ {
+ case AR7_CHIP_7100:
+ case AR7_CHIP_7200:
+ ar7_regs_wdt = AR7_REGS_WDT;
+ break;
+ default:
+ ar7_regs_wdt = UR8_REGS_WDT;
+ break;
+ }
}
-
+
static void ar7_wdt_kick(u32 value)
{
ar7_wdt->kick_lock = 0x5555;
if ((ar7_wdt->kick_lock & 3) == 1) {
- ar7_wdt->kick_lock = 0xAAAA;
+ ar7_wdt->kick_lock = 0xaaaa;
if ((ar7_wdt->kick_lock & 3) == 3) {
ar7_wdt->kick = value;
return;
}
- }
- printk(KERN_ERR DRVNAME ": failed to unlock WDT kick reg\n");
+ }
+ printk(KERN_ERR DRVNAME ": failed to unlock WDT kick reg\n");
}
static void ar7_wdt_prescale(u32 value)
{
- ar7_wdt->prescale_lock = 0x5A5A;
+ ar7_wdt->prescale_lock = 0x5a5a;
if ((ar7_wdt->prescale_lock & 3) == 1) {
- ar7_wdt->prescale_lock = 0xA5A5;
+ ar7_wdt->prescale_lock = 0xa5a5;
if ((ar7_wdt->prescale_lock & 3) == 3) {
ar7_wdt->prescale = value;
return;
{
ar7_wdt->change_lock = 0x6666;
if ((ar7_wdt->change_lock & 3) == 1) {
- ar7_wdt->change_lock = 0xBBBB;
+ ar7_wdt->change_lock = 0xbbbb;
if ((ar7_wdt->change_lock & 3) == 3) {
ar7_wdt->change = value;
return;
{
ar7_wdt->disable_lock = 0x7777;
if ((ar7_wdt->disable_lock & 3) == 1) {
- ar7_wdt->disable_lock = 0xCCCC;
+ ar7_wdt->disable_lock = 0xcccc;
if ((ar7_wdt->disable_lock & 3) == 2) {
- ar7_wdt->disable_lock = 0xDDDD;
+ ar7_wdt->disable_lock = 0xdddd;
if ((ar7_wdt->disable_lock & 3) == 3) {
ar7_wdt->disable = value;
return;
change = new_margin * (ar7_vbus_freq() / prescale_value);
if (change < 1) change = 1;
- if (change > 0xFFFF) change = 0xFFFF;
+ if (change > 0xffff) change = 0xffff;
ar7_wdt_change(change);
margin = change * prescale_value / ar7_vbus_freq();
printk(KERN_INFO DRVNAME
} else if (!nowayout) {
ar7_wdt_disable_wdt();
}
- up(&open_semaphore);
+ up(&open_semaphore);
return 0;
}
static int ar7_wdt_notify_sys(struct notifier_block *this,
- unsigned long code, void *unused)
+ unsigned long code, void *unused)
{
if (code == SYS_HALT || code == SYS_POWER_OFF)
if (!nowayout)
ar7_wdt_disable_wdt();
- return NOTIFY_DONE;
+ return NOTIFY_DONE;
}
static struct notifier_block ar7_wdt_notifier =
};
static ssize_t ar7_wdt_write(struct file *file, const char *data,
- size_t len, loff_t *ppos)
+ size_t len, loff_t *ppos)
{
if (ppos != &file->f_pos)
return -ESPIPE;
}
static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+ unsigned int cmd, unsigned long arg)
{
static struct watchdog_info ident = {
.identity = LONGNAME,
int new_margin;
switch (cmd) {
- default:
- return -ENOTTY;
case WDIOC_GETSUPPORT:
if(copy_to_user((struct watchdog_info *)arg, &ident,
sizeof(ident)))
if (put_user(margin, (int *)arg))
return -EFAULT;
return 0;
+ default:
+ return -ENOTTY;
}
}
static int __init ar7_wdt_init(void)
{
int rc;
-
- ar7_wdt_get_regs();
+
+ ar7_wdt_get_regs();
if (!request_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t), LONGNAME)) {
printk(KERN_WARNING DRVNAME ": watchdog I/O region busy\n");
rc = misc_register(&ar7_wdt_miscdev);
if (rc) {
- printk(KERN_ERR DRVNAME ": unable to register misc device\n");
+ printk(KERN_ERR DRVNAME ": unable to register misc device\n");
goto out_alloc;
}
rc = register_reboot_notifier(&ar7_wdt_notifier);
- if (rc) {
- printk(KERN_ERR DRVNAME ": unable to register reboot notifier\n");
+ if (rc) {
+ printk(KERN_ERR DRVNAME ": unable to register reboot notifier\n");
goto out_register;
- }
+ }
goto out;
out_register:
static void __exit ar7_wdt_cleanup(void)
{
- unregister_reboot_notifier(&ar7_wdt_notifier);
+ unregister_reboot_notifier(&ar7_wdt_notifier);
misc_deregister(&ar7_wdt_miscdev);
- iounmap(ar7_wdt);
+ iounmap(ar7_wdt);
release_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t));
}
static const char *cpmac_dump_buf(const uint8_t * buf, unsigned size)
{
- static char buffer[3 * 25 + 1];
- char *p = &buffer[0];
- if (size > 20)
- size = 20;
- while (size-- > 0) {
- p += sprintf(p, " %02x", *buf++);
- }
- return buffer;
+ static char buffer[3 * 25 + 1];
+ char *p = &buffer[0];
+ if (size > 20)
+ size = 20;
+ while (size-- > 0) {
+ p += sprintf(p, " %02x", *buf++);
+ }
+ return buffer;
}
#endif
if(dev->flags & IFF_PROMISC) {
priv->regs->mbp &= ~MBP_PROMISCCHAN(0); /* promisc channel 0 */
priv->regs->mbp |= MBP_RXPROMISC;
- } else {
+ } else {
priv->regs->mbp &= ~MBP_RXPROMISC;
if(dev->flags & IFF_ALLMULTI) {
/* enable all multicast mode */
desc = priv->rx_head;
dma_cache_inv((u32)desc, 16);
#ifdef CPMAC_DEBUG
- printk(KERN_DEBUG "%s: len=%d, %s\n", __func__, pkt->datalen,
- cpmac_dump_buf(data, pkt->datalen));
+ printk(KERN_DEBUG "%s: len=%d, %s\n", __func__, pkt->datalen,
+ cpmac_dump_buf(data, pkt->datalen));
#endif
while ((desc->dataflags & CPMAC_OWN) == 0) {
static void
cpmac_alloc_skbs(struct work_struct *work)
{
- struct cpmac_priv *priv = container_of(work, struct cpmac_priv,
- alloc_work);
+ struct cpmac_priv *priv = container_of(work, struct cpmac_priv,
+ alloc_work);
#else
static void
cpmac_alloc_skbs(void *data)
{
- struct net_device *dev = (struct net_device*)data;
+ struct net_device *dev = (struct net_device*)data;
struct cpmac_priv *priv = netdev_priv(dev);
#endif
unsigned long flags;
len = skb->len;
#ifdef CPMAC_DEBUG
- printk(KERN_DEBUG "%s: len=%d\n", __func__, len); //cpmac_dump_buf(const uint8_t * buf, unsigned size)
+ printk(KERN_DEBUG "%s: len=%d\n", __func__, len); //cpmac_dump_buf(const uint8_t * buf, unsigned size)
#endif
if (unlikely(len < ETH_ZLEN)) {
if (unlikely(skb_padto(skb, ETH_ZLEN))) {
static int cpmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
- struct cpmac_priv *priv = netdev_priv(dev);
+ struct cpmac_priv *priv = netdev_priv(dev);
- if (priv->phy)
- return phy_ethtool_gset(priv->phy, cmd);
+ if (priv->phy)
+ return phy_ethtool_gset(priv->phy, cmd);
- return -EINVAL;
+ return -EINVAL;
}
static int cpmac_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
- struct cpmac_priv *priv = netdev_priv(dev);
+ struct cpmac_priv *priv = netdev_priv(dev);
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
- if (priv->phy)
- return phy_ethtool_sset(priv->phy, cmd);
+ if (priv->phy)
+ return phy_ethtool_sset(priv->phy, cmd);
- return -EINVAL;
+ return -EINVAL;
}
static void cpmac_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
- strcpy(info->driver, "cpmac");
- strcpy(info->version, "0.0.3");
- info->fw_version[0] = '\0';
- sprintf(info->bus_info, "%s", "cpmac");
- info->regdump_len = 0;
+ strcpy(info->driver, "cpmac");
+ strcpy(info->version, "0.0.3");
+ info->fw_version[0] = '\0';
+ sprintf(info->bus_info, "%s", "cpmac");
+ info->regdump_len = 0;
}
static const struct ethtool_ops cpmac_ethtool_ops = {
- .get_settings = cpmac_get_settings,
- .set_settings = cpmac_set_settings,
- .get_drvinfo = cpmac_get_drvinfo,
- .get_link = ethtool_op_get_link,
+ .get_settings = cpmac_get_settings,
+ .set_settings = cpmac_set_settings,
+ .get_drvinfo = cpmac_get_drvinfo,
+ .get_link = ethtool_op_get_link,
};
static struct net_device_stats *cpmac_stats(struct net_device *dev)
unsigned long flags;
struct cpmac_priv *priv = netdev_priv(dev);
spinlock_t *lock = &priv->lock;
-
+
if ((mtu < 68) || (mtu > 1500))
return -EINVAL;
priv->rx_head = &priv->desc_ring[CPMAC_TX_RING_SIZE];
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
- INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs);
+ INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs);
#else
- INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs, dev);
+ INIT_WORK(&priv->alloc_work, cpmac_alloc_skbs, dev);
#endif
schedule_work(&priv->alloc_work);
flush_scheduled_work();
}
if((res = request_irq(dev->irq, cpmac_irq, SA_INTERRUPT,
- dev->name, dev))) {
+ dev->name, dev))) {
printk("%s: failed to obtain irq\n", dev->name);
goto fail_irq;
}
#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00)
#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
-#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1A00)
-#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1C00)
-#define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1E00)
+#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
+#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
+#define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1e00)
#define AR7_REGS_IRQ (AR7_REGS_BASE + 0x2400)
#define AR7_REGS_MAC1 (AR7_REGS_BASE + 0x2800)
#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00)
#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00)
-#define AR7_RESET_PEREPHERIAL 0x0
-#define AR7_RESET_SOFTWARE 0x4
-#define AR7_RESET_STATUS 0x8
+#define AR7_RESET_PEREPHERIAL 0x0
+#define AR7_RESET_SOFTWARE 0x4
+#define AR7_RESET_STATUS 0x8
#define AR7_RESET_BIT_CPMAC_LO 17
#define AR7_RESET_BIT_CPMAC_HI 21
#define AR7_RESET_BIT_EPHY 26
/* GPIO control registers */
-#define AR7_GPIO_INPUT 0x0
-#define AR7_GPIO_OUTPUT 0x4
-#define AR7_GPIO_DIR 0x8
-#define AR7_GPIO_ENABLE 0xC
+#define AR7_GPIO_INPUT 0x0
+#define AR7_GPIO_OUTPUT 0x4
+#define AR7_GPIO_DIR 0x8
+#define AR7_GPIO_ENABLE 0xc
#define AR7_CHIP_7100 0x18
#define AR7_CHIP_7200 0x2b
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
-DROP_SECTIONS := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
-OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
+DROP_SECTIONS:=.reginfo .mdebug .comment .note .pdr .options .MIPS.options
+OBJCOPY_SREC:=$(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
-LOADADDR := 0x94600000
-KERNEL_ENTRY := 0x94100000
-RAMSTART := 0x94000000
-RAMSIZE := 0x00100000
+LOADADDR:=0x94600000
+KERNEL_ENTRY:=0x94100000
+RAMSTART:=0x94000000
+RAMSIZE:=0x00100000
+
+EVA_LOADADDR := 0x94100000
LOADER_MAKEOPTS= \
- KDIR=$(KDIR) \
- LOADADDR=$(LOADADDR) \
- KERNEL_ENTRY=$(KERNEL_ENTRY) \
- RAMSTART=$(RAMSTART) \
- RAMSIZE=$(RAMSIZE)
+ KDIR=$(KDIR) \
+ LOADADDR=$(LOADADDR) \
+ KERNEL_ENTRY=$(KERNEL_ENTRY) \
+ RAMSTART=$(RAMSTART) \
+ RAMSIZE=$(RAMSIZE)
CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
-fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \