AVR32: Use auto.conf instead of MARKER
PATCH 1/6 AVR32: Use auto.conf instead of MARKER
include/config/MARKER was killed by the commit 'kconfig: integrate split config into silentoldconfig', which also updated all arches to use include/config/auto.conf instead.
This brings AVR32 in sync with everyone else.
--- arch/avr32/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/avr32/Makefile +1 -1
@@ -34,7 +34,7 @@ libs-y += arch/avr32/lib/ #$(LIBGCC) archincdir-$(CONFIG_PLATFORM_AT32AP) := arch-at32ap -include/asm-avr32/.arch: $(wildcard include/config/platform/*.h) include/config/MARKER +include/asm-avr32/.arch: $(wildcard include/config/platform/*.h) include/config/auto.conf @echo ' SYMLINK include/asm-avr32/arch -> include/asm-avr32/$(archincdir-y)' ifneq ($(KBUILD_SRC),) $(Q)mkdir -p include/asm-avr32
Signature · 1 line
1.4.0
PATCH 2/6 AVR32: Don't assume anything about MAX_NR_ZONES
Zero out zones_size with memset() and initialize just the zones we need. This should avoid breakage when zones come and go.
--- arch/avr32/mm/init.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/avr32/mm/init.c +2 -2
@@ -380,7 +380,7 @@ void __init paging_init(void)for_each_online_node (nid) {pg_data_t *pgdat =NODE_DATA (nid); -unsigned long zones_size[MAX_NR_ZONES ] = {0 ,0 ,0 }; +unsigned long zones_size[MAX_NR_ZONES ];unsigned long low, start_pfn; start_pfn = pgdat->bdata->node_boot_start;
@@ -388,8 +388,8 @@ void __init paging_init(void) low = pgdat->bdata->node_low_pfn;/* All memory is DMA-able */ +memset (zones_size,0 ,sizeof (zones_size)); zones_size[ZONE_DMA ] = low - start_pfn; - zones_size[ZONE_NORMAL ] =0 ;printk ("Node %u: start_pfn = 0x%lx, low = 0x%lx\n" , nid, start_pfn, low);
Signature · 1 line
1.4.0
PATCH 3/6 AVR32: Add nsproxy definition
The patch namespaces-add-nsproxy.patch defines nsproxy in all arches' init_task.c. This does the same for AVR32
--- arch/avr32/kernel/init_task.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/avr32/kernel/init_task.c +2 -0
@@ -10,6 +10,7 @@ #include <linux/fs.h>#include <linux/sched.h> #include <linux/init_task.h> #include <linux/mqueue.h> +#include <linux/nsproxy.h> #include <asm/pgtable.h>
@@ -18,6 +19,7 @@ static struct files_struct init_files =static struct signal_struct init_signals =INIT_SIGNALS (init_signals);static struct sighand_struct init_sighand =INIT_SIGHAND (init_sighand);struct mm_struct init_mm =INIT_MM (init_mm); +struct nsproxy init_nsproxy =INIT_NSPROXY (init_nsproxy);EXPORT_SYMBOL (init_mm);
Signature · 1 line
1.4.0
PATCH 4/6 AVR32: Add I/O port access primitives
This adds definitions of inb, outb and friends to include/asm-avr32/io.h
I'm still not sure about the best way to emulate I/O port access on AVR32, but we should be able to override the __io() macro from platform-specific headers in the future when we know better what the requirements really are.
--- include/asm-avr32/io.h | 84 ++++++++++++++++++++++++++---------------------- 1 files changed, 45 insertions(+), 39 deletions(-)
include/asm-avr32/io.h +45 -39
@@ -5,6 +5,24 @@ #include <linux/string.h>#ifdef __KERNEL__ +#include <asm/addrspace.h> + +/* virt_to_phys will only work when address is in P1 or P2 */ +static __inline__unsigned long virt_to_phys (volatile void *address) +{ +return PHYSADDR (address); +} + +static __inline__void *phys_to_virt (unsigned long address) +{ +return (void *)P1SEGADDR (address); +} + +#define cached_to_phys (addr) ((unsigned long)PHYSADDR(addr)) +#define uncached_to_phys (addr) ((unsigned long)PHYSADDR(addr)) +#define phys_to_cached (addr) ((void *)P1SEGADDR(addr)) +#define phys_to_uncached (addr) ((void *)P2SEGADDR(addr)) +/* * Generic IO read/write. These perform native-endian accesses. Note * that some architectures will want to re-define __raw_{read,write}w.
@@ -17,17 +35,6 @@ extern void __raw_readsb(unsigned int adextern void __raw_readsw (unsigned int addr,void *data,int wordlen);extern void __raw_readsl (unsigned int addr,void *data,int longlen); -#ifdef PCMCIA_HSMC_IO_HACK -#error Needs updating -/* The HMATRIX tries to byteswap the address for us, so we have to swap it back. */ -#define __raw_writeb (v,a) (*(volatile unsigned char *)((unsigned long)(a) ^ 3UL) = (v)) -#define __raw_writew (v,a) (*(volatile unsigned short *)((unsigned long)(a) ^ 2UL) = (v)) -#define __raw_writel (v,a) (*(volatile unsigned int *)(a) = (v)) - -#define __raw_readb (a) (*(volatile unsigned char *)((unsigned long)(a) ^ 3UL)) -#define __raw_readw (a) (*(volatile unsigned short *)((unsigned long)(a) ^ 2UL)) -#define __raw_readl (a) (*(volatile unsigned int *)(a)) -#else static inline void writeb (unsigned char b,volatile void __iomem *addr) { *(volatile unsigned char __force *)addr = b;
@@ -59,7 +66,6 @@ static inline unsigned int readl(const v#define __raw_readb readb#define __raw_readw readw#define __raw_readl readl -#endif #define writesb (p, d, l) __raw_writesb((unsigned int)p, d, l)#define writesw (p, d, l) __raw_writesw((unsigned int)p, d, l)
@@ -109,18 +115,36 @@ extern void __readwrite_bug(const char *#define IO_SPACE_LIMIT 0xffffffff +/* Convert I/O port address to virtual address */ +#define __io (p) ((void __iomem *)phys_to_uncached(p)) +/* -* All I/O is memory mapped, so these macros don't make very much -* sense. They are needed for PCMCIA support, however, so we'll have -* to implement them somehow. For now, they will cause linker errors. +* IO port access primitives +* ------------------------- +* +* The AVR32 doesn't have special IO access instructions; all IO is memory +* mapped. Note that these are defined to perform little endian accesses +* only. Their primary purpose is to access PCI and ISA peripherals. +* +* Note that for a big endian machine, this implies that the following +* big endian mode connectivity is in place. +* +* The machine specific io.h include defines __io to translate an "IO" +* address to a memory address. +* +* Note that we prevent GCC re-ordering or caching values in expressions +* by introducing sequence points into the in*() definitions. Note that +* __raw_* do not guarantee this behaviour. +* +* The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space. */ -extern void outb (unsigned char value,unsigned long port); -extern void outw (unsigned short value,unsigned long port); -extern void outl (unsigned long value,unsigned long port); +#define outb (v, p) __raw_writeb(v, __io(p)) +#define outw (v, p) __raw_writew(cpu_to_le16(v), __io(p)) +#define outl (v, p) __raw_writel(cpu_to_le32(v), __io(p)) -extern unsigned char inb (unsigned long port); -extern unsigned short inw (unsigned long port); -extern unsigned long inl (unsigned long port); +#define inb (p) __raw_readb(__io(p)) +#define inw (p) le16_to_cpu(__raw_readw(__io(p))) +#define inl (p) le32_to_cpu(__raw_readl(__io(p)))static inline void __outsb (unsigned long port,void *addr,unsigned int count) {
@@ -197,24 +221,6 @@ #define ioremap(offset, size) \#define iounmap (addr) \ __iounmap(addr) -#include <asm/addrspace.h> - -/* virt_to_phys will only work when address is in P1 or P2 */ -static __inline__unsigned long virt_to_phys (volatile void *address) -{ -return PHYSADDR (address); -} - -static __inline__void *phys_to_virt (unsigned long address) -{ -return (void *)P1SEGADDR (address); -} - -#define cached_to_phys (addr) ((unsigned long)PHYSADDR(addr)) -#define uncached_to_phys (addr) ((unsigned long)PHYSADDR(addr)) -#define phys_to_cached (addr) ((void *)P1SEGADDR(addr)) -#define phys_to_uncached (addr) ((void *)P2SEGADDR(addr)) -#define cached (addr) P1SEGADDR(addr)#define uncached (addr) P2SEGADDR(addr)
Signature · 1 line
1.4.0
PATCH 5/6 AVR32: Use linux/pfn.h
As pointed out by Dave Hansen, we should really use linux/pfn.h instead of our own PFN_UP/PFN_DOWN/PFN_PHYS definitions.
--- arch/avr32/mm/init.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
arch/avr32/mm/init.c +1 -4
@@ -14,6 +14,7 @@ #include <linux/initrd.h>#include <linux/mmzone.h> #include <linux/bootmem.h> #include <linux/pagemap.h> +#include <linux/pfn.h> #include <linux/nodemask.h> #include <asm/page.h>
@@ -90,10 +91,6 @@ static void __init print_memory_map(cons } } -#define PFN_UP (x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) -#define PFN_DOWN (x) ((x) >> PAGE_SHIFT) -#define PFN_PHYS (x) ((x) << PAGE_SHIFT) -#define MAX_LOWMEM HIGHMEM_START#define MAX_LOWMEM_PFN PFN_DOWN(MAX_LOWMEM)
Signature · 1 line
1.4.0
PATCH 6/6 AVR32: Kill CONFIG_DISCONTIGMEM support completely
Dave Hansen called discontigmem as "legacy", so since there are no AVR32 boards that actually need it, we might as well kill it completely. Which is what this patch does.
Whenever someone stumbles across a board with multiple memory banks, I'll implement sparsemem support instead, hopefully with help from Dave and Andy.
--- arch/avr32/mm/Makefile | 1 - arch/avr32/mm/discontig.c | 27 --------------------------- arch/avr32/mm/init.c | 28 +++++----------------------- include/asm-avr32/mmzone.h | 29 ----------------------------- 4 files changed, 5 insertions(+), 80 deletions(-)
arch/avr32/mm/Makefile +0 -1
@@ -4,4 +4,3 @@ # obj-y += init.o clear_page.o copy_page.o dma-coherent.o obj-y += ioremap.o cache.o fault.o tlb.o -obj-$(CONFIG_DISCONTIGMEM) += discontig.o
arch/avr32/mm/discontig.c deleted +0 -27
@@ -1,27 +0,0 @@ -/* -* Copyright (C) 2004-2006 Atmel Corporation -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ - -#include <linux/module.h> -#include <linux/mm.h> -#include <linux/init.h> -#include <linux/bootmem.h> - -#if MAX_NUMNODES !=4 -#error Fix Me Please -#endif - -static bootmem_data_t node_bootmem_data[MAX_NUMNODES ]; -pg_data_t discontig_node_data[MAX_NUMNODES ] = { - { .bdata = &node_bootmem_data[0 ] }, - { .bdata = &node_bootmem_data[1 ] }, - { .bdata = &node_bootmem_data[2 ] }, - { .bdata = &node_bootmem_data[3 ] } -}; - -EXPORT_SYMBOL (discontig_node_data); -
arch/avr32/mm/init.c +5 -23
@@ -36,10 +36,8 @@ struct page *empty_zero_page;*/ unsigned long mmu_context_cache =NO_CONTEXT ; -#if !defined(CONFIG_DISCONTIGMEM ) -# define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT) -# define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn) -#endif +#define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT) +#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn)void show_mem (void ) {
@@ -223,27 +221,15 @@ #else#endif } -#ifndef CONFIG_DISCONTIGMEM if (mem_phys->next) -printk (KERN_WARNING "Only using first memory bank " -"since CONFIG_DISCONTIGMEM is off\n" ); +printk (KERN_WARNING "Only using first memory bank\n" ); +for (bank = mem_phys; bank; bank =NULL ) { -#else -for (bank = mem_phys; bank; bank = bank->next, node++) { -#endif first_pfn =PFN_UP (bank->addr); max_low_pfn = max_pfn =PFN_DOWN (bank->addr + bank->size); bootmap_pfn =find_bootmap_pfn (bank); -if (bootmap_pfn > max_pfn) { -#ifndef CONFIG_DISCONTIGMEM +if (bootmap_pfn > max_pfn)panic ("No space for bootmem bitmap!\n" ); -#else -printk (KERN_WARNING -"Node %u: No space for bootmem bitmap\n" , - node); -continue ; -#endif - }if (max_low_pfn >MAX_LOWMEM_PFN ) { max_low_pfn =MAX_LOWMEM_PFN ;
@@ -397,9 +383,7 @@ void __init paging_init(void) pgdat->node_id, pgdat->node_mem_map); } -#ifndef CONFIG_DISCONTIGMEM mem_map =NODE_DATA (0 )->node_mem_map; -#endif memset (zero_page,0 ,PAGE_SIZE ); empty_zero_page =virt_to_page (zero_page);
@@ -438,9 +422,7 @@ void __init mem_init(void) high_memory = node_high_memory; } -#ifndef CONFIG_DISCONTIGMEM max_mapnr =MAP_NR (high_memory); -#endif codesize = (unsigned long )_etext - (unsigned long )_text; datasize = (unsigned long )_edata - (unsigned long )_data;
include/asm-avr32/mmzone.h deleted +0 -29
@@ -1,29 +0,0 @@ -/* -* Copyright (C) 2004-2006 Atmel Corporation -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ -#ifndef __ASM_AVR32_MMZONE_H -#define __ASM_AVR32_MMZONE_H - -#include <asm/page.h> - -#ifdef CONFIG_DISCONTIGMEM - -static inline int pfn_valid (unsigned long pfn) -{ -unsigned long __pfn = (pfn); -int __n =pfn_to_nid (__pfn); - -if (__n <0 ) -return 0 ; - -return __pfn < (NODE_DATA (__n)->node_start_pfn - +NODE_DATA (__n)->node_spanned_pages); -} - -#endif /* CONFIG_DISCONTIGMEM */ - -#endif /* __ASM_AVR32_MMZONE_H */
Signature · 1 line
1.4.0