diff options
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r-- | arch/blackfin/kernel/bfin_dma_5xx.c | 223 | ||||
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 11 | ||||
-rw-r--r-- | arch/blackfin/kernel/setup.c | 32 | ||||
-rw-r--r-- | arch/blackfin/kernel/traps.c | 18 | ||||
-rw-r--r-- | arch/blackfin/kernel/vmlinux.lds.S | 4 |
5 files changed, 250 insertions, 38 deletions
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 8ea079ebecb5..0ccb0dc3f833 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c @@ -119,7 +119,7 @@ static void clear_dma_buffer(unsigned int channel) SSYNC(); } -int __init blackfin_dma_init(void) +static int __init blackfin_dma_init(void) { int i; @@ -130,7 +130,9 @@ int __init blackfin_dma_init(void) dma_ch[i].regs = base_addr[i]; mutex_init(&(dma_ch[i].dmalock)); } - + /* Mark MEMDMA Channel 0 as requested since we're using it internally */ + dma_ch[CH_MEM_STREAM0_DEST].chan_status = DMA_CHANNEL_REQUESTED; + dma_ch[CH_MEM_STREAM0_SRC].chan_status = DMA_CHANNEL_REQUESTED; return 0; } @@ -593,14 +595,17 @@ unsigned short get_dma_curr_ycount(unsigned int channel) } EXPORT_SYMBOL(get_dma_curr_ycount); -void *dma_memcpy(void *dest, const void *src, size_t size) +void *_dma_memcpy(void *dest, const void *src, size_t size) { int direction; /* 1 - address decrease, 0 - address increase */ int flag_align; /* 1 - address aligned, 0 - address unaligned */ int flag_2D; /* 1 - 2D DMA needed, 0 - 1D DMA needed */ + unsigned long flags; if (size <= 0) return NULL; + + local_irq_save(flags); if ((unsigned long)src < memory_end) blackfin_dcache_flush_range((unsigned int)src, @@ -725,18 +730,224 @@ void *dma_memcpy(void *dest, const void *src, size_t size) if ((unsigned long)dest < memory_end) blackfin_dcache_invalidate_range((unsigned int)dest, (unsigned int)(dest + size)); + local_irq_restore(flags); return dest; } + +void *dma_memcpy(void *dest, const void *src, size_t size) +{ + size_t bulk; + size_t rest; + void * addr; + + bulk = (size >> 16) << 16; + rest = size - bulk; + if (bulk) + _dma_memcpy(dest, src, bulk); + addr = _dma_memcpy(dest+bulk, src+bulk, rest); + return addr; +} + EXPORT_SYMBOL(dma_memcpy); void *safe_dma_memcpy(void *dest, const void *src, size_t size) { - int flags = 0; void *addr; - local_irq_save(flags); addr = dma_memcpy(dest, src, size); - local_irq_restore(flags); return addr; } EXPORT_SYMBOL(safe_dma_memcpy); + +void dma_outsb(void __iomem *addr, const void *buf, unsigned short len) +{ + + unsigned long flags; + + local_irq_save(flags); + + blackfin_dcache_flush_range((unsigned int)buf,(unsigned int)(buf) + len); + + bfin_write_MDMA_D0_START_ADDR(addr); + bfin_write_MDMA_D0_X_COUNT(len); + bfin_write_MDMA_D0_X_MODIFY(0); + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_START_ADDR(buf); + bfin_write_MDMA_S0_X_COUNT(len); + bfin_write_MDMA_S0_X_MODIFY(1); + bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_8); + bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_8); + + while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)); + + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(0); + bfin_write_MDMA_D0_CONFIG(0); + local_irq_restore(flags); + +} +EXPORT_SYMBOL(dma_outsb); + + +void dma_insb(const void __iomem *addr, void *buf, unsigned short len) +{ + unsigned long flags; + + local_irq_save(flags); + bfin_write_MDMA_D0_START_ADDR(buf); + bfin_write_MDMA_D0_X_COUNT(len); + bfin_write_MDMA_D0_X_MODIFY(1); + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_START_ADDR(addr); + bfin_write_MDMA_S0_X_COUNT(len); + bfin_write_MDMA_S0_X_MODIFY(0); + bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_8); + bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_8); + + blackfin_dcache_invalidate_range((unsigned int)buf, (unsigned int)(buf) + len); + + while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)); + + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(0); + bfin_write_MDMA_D0_CONFIG(0); + local_irq_restore(flags); + +} +EXPORT_SYMBOL(dma_insb); + +void dma_outsw(void __iomem *addr, const void *buf, unsigned short len) +{ + unsigned long flags; + + local_irq_save(flags); + + blackfin_dcache_flush_range((unsigned int)buf,(unsigned int)(buf) + len); + + bfin_write_MDMA_D0_START_ADDR(addr); + bfin_write_MDMA_D0_X_COUNT(len); + bfin_write_MDMA_D0_X_MODIFY(0); + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_START_ADDR(buf); + bfin_write_MDMA_S0_X_COUNT(len); + bfin_write_MDMA_S0_X_MODIFY(2); + bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_16); + bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_16); + + while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)); + + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(0); + bfin_write_MDMA_D0_CONFIG(0); + local_irq_restore(flags); + +} +EXPORT_SYMBOL(dma_outsw); + +void dma_insw(const void __iomem *addr, void *buf, unsigned short len) +{ + unsigned long flags; + + local_irq_save(flags); + + bfin_write_MDMA_D0_START_ADDR(buf); + bfin_write_MDMA_D0_X_COUNT(len); + bfin_write_MDMA_D0_X_MODIFY(2); + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_START_ADDR(addr); + bfin_write_MDMA_S0_X_COUNT(len); + bfin_write_MDMA_S0_X_MODIFY(0); + bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_16); + bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_16); + + blackfin_dcache_invalidate_range((unsigned int)buf, (unsigned int)(buf) + len); + + while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)); + + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(0); + bfin_write_MDMA_D0_CONFIG(0); + local_irq_restore(flags); + +} +EXPORT_SYMBOL(dma_insw); + +void dma_outsl(void __iomem *addr, const void *buf, unsigned short len) +{ + unsigned long flags; + + local_irq_save(flags); + + blackfin_dcache_flush_range((unsigned int)buf,(unsigned int)(buf) + len); + + bfin_write_MDMA_D0_START_ADDR(addr); + bfin_write_MDMA_D0_X_COUNT(len); + bfin_write_MDMA_D0_X_MODIFY(0); + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_START_ADDR(buf); + bfin_write_MDMA_S0_X_COUNT(len); + bfin_write_MDMA_S0_X_MODIFY(4); + bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_32); + bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_32); + + while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)); + + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(0); + bfin_write_MDMA_D0_CONFIG(0); + local_irq_restore(flags); + +} +EXPORT_SYMBOL(dma_outsl); + +void dma_insl(const void __iomem *addr, void *buf, unsigned short len) +{ + unsigned long flags; + + local_irq_save(flags); + + bfin_write_MDMA_D0_START_ADDR(buf); + bfin_write_MDMA_D0_X_COUNT(len); + bfin_write_MDMA_D0_X_MODIFY(4); + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_START_ADDR(addr); + bfin_write_MDMA_S0_X_COUNT(len); + bfin_write_MDMA_S0_X_MODIFY(0); + bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_32); + bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_32); + + blackfin_dcache_invalidate_range((unsigned int)buf, (unsigned int)(buf) + len); + + while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)); + + bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); + + bfin_write_MDMA_S0_CONFIG(0); + bfin_write_MDMA_D0_CONFIG(0); + local_irq_restore(flags); + +} +EXPORT_SYMBOL(dma_insl); diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index e9f24a9a46ba..3f49fae1cb1f 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c @@ -144,7 +144,7 @@ inline int check_gpio(unsigned short gpio) } #ifdef BF537_FAMILY -void port_setup(unsigned short gpio, unsigned short usage) +static void port_setup(unsigned short gpio, unsigned short usage) { if (usage == GPIO_USAGE) { if (*port_fer[gpio_bank(gpio)] & gpio_bit(gpio)) @@ -160,7 +160,7 @@ void port_setup(unsigned short gpio, unsigned short usage) #endif -void default_gpio(unsigned short gpio) +static void default_gpio(unsigned short gpio) { unsigned short bank,bitmask; @@ -177,8 +177,7 @@ void default_gpio(unsigned short gpio) gpio_bankb[bank]->edge &= ~bitmask; } - -int __init bfin_gpio_init(void) +static int __init bfin_gpio_init(void) { int i; @@ -189,9 +188,9 @@ int __init bfin_gpio_init(void) #if defined(BF537_FAMILY) && (defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) # if defined(CONFIG_BFIN_MAC_RMII) - reserved_map[PORT_H] = 0xC373; + reserved_map[gpio_bank(PORT_H)] = 0xC373; # else - reserved_map[PORT_H] = 0xFFFF; + reserved_map[gpio_bank(PORT_H)] = 0xFFFF; # endif #endif diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 342bb8dd56ac..02dc74301920 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c @@ -33,7 +33,6 @@ #include <linux/seq_file.h> #include <linux/cpu.h> #include <linux/module.h> -#include <linux/console.h> #include <linux/tty.h> #include <linux/ext2_fs.h> @@ -44,6 +43,8 @@ #include <asm/blackfin.h> #include <asm/cplbinit.h> +u16 _bfin_swrst; + unsigned long memory_start, memory_end, physical_mem_end; unsigned long reserved_mem_dcache_on; unsigned long reserved_mem_icache_on; @@ -175,6 +176,9 @@ void __init setup_arch(char **cmdline_p) unsigned long mtd_phys = 0; #endif +#ifdef CONFIG_DUMMY_CONSOLE + conswitchp = &dummy_con; +#endif cclk = get_cclk(); sclk = get_sclk(); @@ -379,37 +383,27 @@ void __init setup_arch(char **cmdline_p) if (l1_length > L1_DATA_A_LENGTH) panic("L1 memory overflow\n"); - bf53x_cache_init(); - -#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) -# if defined(CONFIG_BFIN_SHARED_FLASH_ENET) && defined(CONFIG_BFIN533_STAMP) - /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */ - bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN)); - bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN); - SSYNC(); -# endif -# if defined (CONFIG_BFIN561_EZKIT) - bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12)); - SSYNC(); -# endif /* defined (CONFIG_BFIN561_EZKIT) */ +#ifdef BF561_FAMILY + _bfin_swrst = bfin_read_SICA_SWRST(); +#else + _bfin_swrst = bfin_read_SWRST(); #endif + bf53x_cache_init(); + printk(KERN_INFO "Hardware Trace Enabled\n"); bfin_write_TBUFCTL(0x03); } -#if defined(CONFIG_BF561) -static struct cpu cpu[2]; -#else -static struct cpu cpu[1]; -#endif static int __init topology_init(void) { #if defined (CONFIG_BF561) + static struct cpu cpu[2]; register_cpu(&cpu[0], 0); register_cpu(&cpu[1], 1); return 0; #else + static struct cpu cpu[1]; return register_cpu(cpu, 0); #endif } diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index 9556b73de808..9932edee8cb4 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c @@ -59,9 +59,10 @@ static int printk_address(unsigned long address) struct vm_list_struct *vml; struct task_struct *p; struct mm_struct *mm; + unsigned long offset; #ifdef CONFIG_KALLSYMS - unsigned long offset = 0, symsize; + unsigned long symsize; const char *symname; char *modname; char *delim = ":"; @@ -106,12 +107,19 @@ static int printk_address(unsigned long address) sizeof(_tmpbuf)); } + /* FLAT does not have its text aligned to the start of + * the map while FDPIC ELF does ... + */ + if (current->mm && + (address > current->mm->start_code) && + (address < current->mm->end_code)) + offset = address - current->mm->start_code; + else + offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); + write_unlock_irq(&tasklist_lock); return printk("<0x%p> [ %s + 0x%lx ]", - (void*)address, name, - (unsigned long) - ((address - vma->vm_start) + - (vma->vm_pgoff << PAGE_SHIFT))); + (void*)address, name, offset); } vml = vml->next; diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S index 6ae9ebbd8e58..86fe67995802 100644 --- a/arch/blackfin/kernel/vmlinux.lds.S +++ b/arch/blackfin/kernel/vmlinux.lds.S @@ -54,7 +54,7 @@ SECTIONS { _text = .; __stext = .; - *(.text) + TEXT_TEXT SCHED_TEXT *(.text.lock) . = ALIGN(16); @@ -200,7 +200,7 @@ SECTIONS __sdata = .; . = ALIGN(0x2000); *(.data.init_task) - *(.data) + DATA_DATA . = ALIGN(32); *(.data.cacheline_aligned) |