add ar7-2.6 fixes by Stefan Weil
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7487 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
43a7635fcf
commit
4bc7e0ca8a
|
@ -174,10 +174,12 @@ static int tnetd7300_get_clock(u32 shift, struct tnetd7300_clock *clock,
|
||||||
{
|
{
|
||||||
int product;
|
int product;
|
||||||
int base_clock = ar7_ref_clock;
|
int base_clock = ar7_ref_clock;
|
||||||
int prediv = ((clock->ctrl & PREDIV_MASK) >> PREDIV_SHIFT) + 1;
|
u32 ctrl = clock->ctrl;
|
||||||
int postdiv = (clock->ctrl & POSTDIV_MASK) + 1;
|
u32 pll = clock->pll;
|
||||||
|
int prediv = ((ctrl & PREDIV_MASK) >> PREDIV_SHIFT) + 1;
|
||||||
|
int postdiv = (ctrl & POSTDIV_MASK) + 1;
|
||||||
int divisor = prediv * postdiv;
|
int divisor = prediv * postdiv;
|
||||||
int mul = ((clock->pll & MUL_MASK) >> MUL_SHIFT) + 1;
|
int mul = ((pll & MUL_MASK) >> MUL_SHIFT) + 1;
|
||||||
|
|
||||||
switch ((*bootcr & (BOOT_PLL_SOURCE_MASK << shift)) >> shift) {
|
switch ((*bootcr & (BOOT_PLL_SOURCE_MASK << shift)) >> shift) {
|
||||||
case BOOT_PLL_SOURCE_BUS:
|
case BOOT_PLL_SOURCE_BUS:
|
||||||
|
@ -197,10 +199,10 @@ static int tnetd7300_get_clock(u32 shift, struct tnetd7300_clock *clock,
|
||||||
if (*bootcr & BOOT_PLL_BYPASS)
|
if (*bootcr & BOOT_PLL_BYPASS)
|
||||||
return base_clock / divisor;
|
return base_clock / divisor;
|
||||||
|
|
||||||
if ((clock->pll & PLL_MODE_MASK) == 0)
|
if ((pll & PLL_MODE_MASK) == 0)
|
||||||
return (base_clock >> (mul / 16 + 1)) / divisor;
|
return (base_clock >> (mul / 16 + 1)) / divisor;
|
||||||
|
|
||||||
if ((clock->pll & (PLL_NDIV | PLL_DIV)) == (PLL_NDIV | PLL_DIV)) {
|
if ((pll & (PLL_NDIV | PLL_DIV)) == (PLL_NDIV | PLL_DIV)) {
|
||||||
product = (mul & 1) ?
|
product = (mul & 1) ?
|
||||||
(base_clock * mul) >> 1 :
|
(base_clock * mul) >> 1 :
|
||||||
(base_clock * (mul - 1)) >> 2;
|
(base_clock * (mul - 1)) >> 2;
|
||||||
|
|
|
@ -33,17 +33,17 @@
|
||||||
|
|
||||||
#define REG_OFFSET(irq, reg) ((irq) / 32 * 0x4 + reg * 0x10)
|
#define REG_OFFSET(irq, reg) ((irq) / 32 * 0x4 + reg * 0x10)
|
||||||
#define SEC_REG_OFFSET(reg) (EXCEPT_OFFSET + reg * 0x8)
|
#define SEC_REG_OFFSET(reg) (EXCEPT_OFFSET + reg * 0x8)
|
||||||
#define SR_OFFSET (SEC_REG_OFFSET(0))
|
#define SEC_SR_OFFSET (SEC_REG_OFFSET(0)) /* 0x80 */
|
||||||
#define CR_OFFSET(irq) (REG_OFFSET(irq, 1))
|
#define CR_OFFSET(irq) (REG_OFFSET(irq, 1)) /* 0x10 */
|
||||||
#define SEC_CR_OFFSET (SEC_REG_OFFSET(1))
|
#define SEC_CR_OFFSET (SEC_REG_OFFSET(1)) /* 0x88 */
|
||||||
#define ESR_OFFSET(irq) (REG_OFFSET(irq, 2))
|
#define ESR_OFFSET(irq) (REG_OFFSET(irq, 2)) /* 0x20 */
|
||||||
#define SEC_ESR_OFFSET (SEC_REG_OFFSET(2))
|
#define SEC_ESR_OFFSET (SEC_REG_OFFSET(2)) /* 0x90 */
|
||||||
#define ECR_OFFSET(irq) (REG_OFFSET(irq, 3))
|
#define ECR_OFFSET(irq) (REG_OFFSET(irq, 3)) /* 0x30 */
|
||||||
#define SEC_ECR_OFFSET (SEC_REG_OFFSET(3))
|
#define SEC_ECR_OFFSET (SEC_REG_OFFSET(3)) /* 0x98 */
|
||||||
#define PIR_OFFSET (0x40)
|
#define PIR_OFFSET (0x40)
|
||||||
#define MSR_OFFSET (0x44)
|
#define MSR_OFFSET (0x44)
|
||||||
#define PM_OFFSET(irq) (REG_OFFSET(irq, 5))
|
#define PM_OFFSET(irq) (REG_OFFSET(irq, 5)) /* 0x50 */
|
||||||
#define TM_OFFSET(irq) (REG_OFFSET(irq, 6))
|
#define TM_OFFSET(irq) (REG_OFFSET(irq, 6)) /* 0x60 */
|
||||||
|
|
||||||
#define REG(addr) (*(volatile u32 *)(KSEG1ADDR(AR7_REGS_IRQ) + addr))
|
#define REG(addr) (*(volatile u32 *)(KSEG1ADDR(AR7_REGS_IRQ) + addr))
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ static void ar7_irq_init(int base);
|
||||||
static int ar7_irq_base;
|
static int ar7_irq_base;
|
||||||
|
|
||||||
static struct irq_chip ar7_irq_type = {
|
static struct irq_chip ar7_irq_type = {
|
||||||
|
.typename = "AR7",
|
||||||
.name = "AR7",
|
.name = "AR7",
|
||||||
.unmask = ar7_unmask_irq,
|
.unmask = ar7_unmask_irq,
|
||||||
.mask = ar7_mask_irq,
|
.mask = ar7_mask_irq,
|
||||||
|
@ -174,7 +175,7 @@ static irqreturn_t ar7_secondary_cascade(int interrupt, void *dev)
|
||||||
int irq = 0, i;
|
int irq = 0, i;
|
||||||
unsigned long status;
|
unsigned long status;
|
||||||
|
|
||||||
status = REG(SR_OFFSET);
|
status = REG(SEC_SR_OFFSET);
|
||||||
if (unlikely(!status)) {
|
if (unlikely(!status)) {
|
||||||
spurious_interrupt();
|
spurious_interrupt();
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
|
@ -246,7 +246,6 @@ static void __init console_config(void)
|
||||||
|
|
||||||
#ifdef CONFIG_KGDB
|
#ifdef CONFIG_KGDB
|
||||||
strcat(prom_getcmdline(), " console=kgdb");
|
strcat(prom_getcmdline(), " console=kgdb");
|
||||||
prom_printf("Please connect GDB to this port\n");
|
|
||||||
kgdb_enabled = 1;
|
kgdb_enabled = 1;
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -196,10 +196,11 @@ static irqreturn_t vlynq_irq(int irq, void *dev_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct irq_chip vlynq_irq_chip = {
|
static struct irq_chip vlynq_irq_chip = {
|
||||||
|
.typename = "VLYNQ",
|
||||||
.name = "vlynq",
|
.name = "vlynq",
|
||||||
.unmask = vlynq_irq_unmask,
|
.unmask = vlynq_irq_unmask,
|
||||||
.mask = vlynq_irq_mask,
|
.mask = vlynq_irq_mask,
|
||||||
.set_type = vlynq_irq_type,
|
.set_type = vlynq_irq_type,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int vlynq_setup_irq(struct vlynq_device *dev)
|
static int vlynq_setup_irq(struct vlynq_device *dev)
|
||||||
|
@ -235,7 +236,7 @@ static int vlynq_setup_irq(struct vlynq_device *dev)
|
||||||
dev->remote->int_device[i >> 2] = 0;
|
dev->remote->int_device[i >> 2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request_irq(dev->irq, vlynq_irq, SA_SHIRQ, "AR7 VLYNQ", dev)) {
|
if (request_irq(dev->irq, vlynq_irq, SA_SHIRQ, "vlynq", dev)) {
|
||||||
printk("%s: request_irq failed\n", dev->dev.bus_id);
|
printk("%s: request_irq failed\n", dev->dev.bus_id);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,7 @@ static void cpmac_hw_init(struct net_device *dev);
|
||||||
static int cpmac_stop(struct net_device *dev);
|
static int cpmac_stop(struct net_device *dev);
|
||||||
static int cpmac_open(struct net_device *dev);
|
static int cpmac_open(struct net_device *dev);
|
||||||
|
|
||||||
|
#undef CPMAC_DEBUG
|
||||||
#define CPMAC_LOW_THRESH 32
|
#define CPMAC_LOW_THRESH 32
|
||||||
#define CPMAC_ALLOC_SIZE 64
|
#define CPMAC_ALLOC_SIZE 64
|
||||||
#define CPMAC_SKB_SIZE 1518
|
#define CPMAC_SKB_SIZE 1518
|
||||||
|
@ -238,6 +239,18 @@ static void cpmac_dump_regs(u32 *base, int count)
|
||||||
}
|
}
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
|
static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
|
||||||
|
@ -446,6 +459,10 @@ static void cpmac_rx(struct net_device *dev)
|
||||||
|
|
||||||
desc = priv->rx_head;
|
desc = priv->rx_head;
|
||||||
dma_cache_inv((u32)desc, 16);
|
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));
|
||||||
|
#endif
|
||||||
|
|
||||||
while ((desc->dataflags & CPMAC_OWN) == 0) {
|
while ((desc->dataflags & CPMAC_OWN) == 0) {
|
||||||
skb = cpmac_rx_one(dev, priv, desc);
|
skb = cpmac_rx_one(dev, priv, desc);
|
||||||
|
@ -558,6 +575,9 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
struct cpmac_priv *priv = netdev_priv(dev);
|
struct cpmac_priv *priv = netdev_priv(dev);
|
||||||
|
|
||||||
len = skb->len;
|
len = skb->len;
|
||||||
|
#ifdef CPMAC_DEBUG
|
||||||
|
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(len < ETH_ZLEN)) {
|
||||||
if (unlikely(skb_padto(skb, ETH_ZLEN))) {
|
if (unlikely(skb_padto(skb, ETH_ZLEN))) {
|
||||||
if (printk_ratelimit())
|
if (printk_ratelimit())
|
||||||
|
@ -689,7 +709,9 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
|
||||||
priv->regs->mac_eoi_vector = 0;
|
priv->regs->mac_eoi_vector = 0;
|
||||||
|
|
||||||
if (unlikely(status & (INTST_HOST | INTST_STATUS))) {
|
if (unlikely(status & (INTST_HOST | INTST_STATUS))) {
|
||||||
printk(KERN_ERR "%s: hw error, resetting...\n", dev->name);
|
if (printk_ratelimit()) {
|
||||||
|
printk(KERN_ERR "%s: hw error, resetting...\n", dev->name);
|
||||||
|
}
|
||||||
spin_lock(&priv->lock);
|
spin_lock(&priv->lock);
|
||||||
phy_stop(priv->phy);
|
phy_stop(priv->phy);
|
||||||
cpmac_reset(dev);
|
cpmac_reset(dev);
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
* This handles the memory map.
|
* This handles the memory map.
|
||||||
* We handle pages at KSEG0 for kernels with 32 bit address space.
|
* We handle pages at KSEG0 for kernels with 32 bit address space.
|
||||||
*/
|
*/
|
||||||
#define PAGE_OFFSET 0x80000000UL
|
#define PAGE_OFFSET 0x94000000UL
|
||||||
#define PHYS_OFFSET 0x14000000UL
|
#define PHYS_OFFSET 0x14000000UL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory above this physical address will be considered highmem.
|
* Memory above this physical address will be considered highmem.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
diff -Nru linux-2.6.19.2/arch/mips/Kconfig linux-ar7/arch/mips/Kconfig
|
diff -Nru linux-2.6.19.2/arch/mips/Kconfig linux-ar7/arch/mips/Kconfig
|
||||||
--- linux-2.6.19.2/arch/mips/Kconfig 2006-12-12 02:32:53.000000000 +0700
|
--- linux-2.6.19.2/arch/mips/Kconfig 2006-12-12 02:32:53.000000000 +0700
|
||||||
+++ linux-ar7/arch/mips/Kconfig 2007-01-29 21:52:21.000000000 +0700
|
+++ linux-ar7/arch/mips/Kconfig 2007-01-29 21:52:21.000000000 +0700
|
||||||
@@ -12,6 +12,19 @@
|
@@ -16,6 +16,20 @@
|
||||||
prompt "System type"
|
prompt "System type"
|
||||||
default SGI_IP22
|
default SGI_IP22
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ diff -Nru linux-2.6.19.2/arch/mips/Kconfig linux-ar7/arch/mips/Kconfig
|
||||||
+ select IRQ_CPU
|
+ select IRQ_CPU
|
||||||
+ select SWAP_IO_SPACE
|
+ select SWAP_IO_SPACE
|
||||||
+ select SYS_HAS_CPU_MIPS32_R1
|
+ select SYS_HAS_CPU_MIPS32_R1
|
||||||
|
+ select SYS_HAS_EARLY_PRINTK
|
||||||
+ select SYS_SUPPORTS_32BIT_KERNEL
|
+ select SYS_SUPPORTS_32BIT_KERNEL
|
||||||
+ select SYS_SUPPORTS_LITTLE_ENDIAN
|
+ select SYS_SUPPORTS_LITTLE_ENDIAN
|
||||||
+ select NEED_MULTIPLE_NODES
|
+ select NEED_MULTIPLE_NODES
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
diff -urN linux-2.6.21.1.old/arch/mips/kernel/head.S linux-2.6.21.1.dev/arch/mips/kernel/head.S
|
diff -urN linux-2.6.21.1.old/arch/mips/kernel/head.S linux-2.6.21.1.dev/arch/mips/kernel/head.S
|
||||||
--- linux-2.6.21.1.old/arch/mips/kernel/head.S 2007-04-27 23:49:26.000000000 +0200
|
--- linux-2.6.21.1.old/arch/mips/kernel/head.S 2007-04-27 23:49:26.000000000 +0200
|
||||||
+++ linux-2.6.21.1.dev/arch/mips/kernel/head.S 2007-05-26 19:46:49.061952736 +0200
|
+++ linux-2.6.21.1.dev/arch/mips/kernel/head.S 2007-05-26 19:46:49.061952736 +0200
|
||||||
@@ -129,6 +129,10 @@
|
@@ -129,11 +129,15 @@
|
||||||
#endif
|
#endif
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ -12,3 +12,9 @@ diff -urN linux-2.6.21.1.old/arch/mips/kernel/head.S linux-2.6.21.1.dev/arch/mip
|
||||||
/*
|
/*
|
||||||
* Reserved space for exception handlers.
|
* Reserved space for exception handlers.
|
||||||
* Necessary for machines which link their kernels at KSEG0.
|
* Necessary for machines which link their kernels at KSEG0.
|
||||||
|
*/
|
||||||
|
- .fill 0x400
|
||||||
|
+ .align 10
|
||||||
|
|
||||||
|
EXPORT(stext) # used for profiling
|
||||||
|
EXPORT(_stext)
|
||||||
|
|
Loading…
Reference in New Issue