Skip to content

Commit

Permalink
microblaze: convert all simple headers to use asm-generic
Browse files Browse the repository at this point in the history
All the simple microblaze header files were adapted to use their
asm-generic implementations. These files are more simple and were quite
straightforward to change.

fb.h, vga.h and parport.h previously did not exist, using
the generic version makes it possible to build more drivers
successfully in allyesonfig.

Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michal Simek <monstr@monstr.eu>
  • Loading branch information
Remis Lima Baima authored and Michal Simek committed Jul 6, 2009
1 parent 14f8738 commit 0a58458
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 266 deletions.
101 changes: 1 addition & 100 deletions arch/microblaze/include/asm/atomic.h
Original file line number Diff line number Diff line change
@@ -1,95 +1,7 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_ATOMIC_H
#define _ASM_MICROBLAZE_ATOMIC_H

#include <linux/types.h>
#include <linux/compiler.h> /* likely */
#include <asm/system.h> /* local_irq_XXX and friends */

#define ATOMIC_INIT(i) { (i) }
#define atomic_read(v) ((v)->counter)
#define atomic_set(v, i) (((v)->counter) = (i))

#define atomic_inc(v) (atomic_add_return(1, (v)))
#define atomic_dec(v) (atomic_sub_return(1, (v)))

#define atomic_add(i, v) (atomic_add_return(i, (v)))
#define atomic_sub(i, v) (atomic_sub_return(i, (v)))

#define atomic_inc_return(v) (atomic_add_return(1, (v)))
#define atomic_dec_return(v) (atomic_sub_return(1, (v)))

#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)

#define atomic_inc_not_zero(v) (atomic_add_unless((v), 1, 0))

#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)

static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
{
int ret;
unsigned long flags;

local_irq_save(flags);
ret = v->counter;
if (likely(ret == old))
v->counter = new;
local_irq_restore(flags);

return ret;
}

static inline int atomic_add_unless(atomic_t *v, int a, int u)
{
int c, old;

c = atomic_read(v);
while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c)
c = old;
return c != u;
}

static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
{
unsigned long flags;

local_irq_save(flags);
*addr &= ~mask;
local_irq_restore(flags);
}

/**
* atomic_add_return - add and return
* @i: integer value to add
* @v: pointer of type atomic_t
*
* Atomically adds @i to @v and returns @i + @v
*/
static inline int atomic_add_return(int i, atomic_t *v)
{
unsigned long flags;
int val;

local_irq_save(flags);
val = v->counter;
v->counter = val += i;
local_irq_restore(flags);

return val;
}

static inline int atomic_sub_return(int i, atomic_t *v)
{
return atomic_add_return(-i, v);
}
#include <asm-generic/atomic.h>

/*
* Atomically test *v and decrement if it is greater than 0.
Expand All @@ -109,15 +21,4 @@ static inline int atomic_dec_if_positive(atomic_t *v)
return res;
}

#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
#define atomic_xchg(v, new) (xchg(&((v)->counter), new))

/* Atomic operations are already serializing */
#define smp_mb__before_atomic_dec() barrier()
#define smp_mb__after_atomic_dec() barrier()
#define smp_mb__before_atomic_inc() barrier()
#define smp_mb__after_atomic_inc() barrier()

#include <asm-generic/atomic-long.h>

#endif /* _ASM_MICROBLAZE_ATOMIC_H */
26 changes: 0 additions & 26 deletions arch/microblaze/include/asm/bitops.h
Original file line number Diff line number Diff line change
@@ -1,27 +1 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_BITOPS_H
#define _ASM_MICROBLAZE_BITOPS_H

/*
* Copyright 1992, Linus Torvalds.
*/

#include <asm/byteorder.h> /* swab32 */
#include <asm/system.h> /* save_flags */

/*
* clear_bit() doesn't provide any barrier for the compiler.
*/
#define smp_mb__before_clear_bit() barrier()
#define smp_mb__after_clear_bit() barrier()
#include <asm-generic/bitops.h>
#include <asm-generic/bitops/__fls.h>

#endif /* _ASM_MICROBLAZE_BITOPS_H */
14 changes: 0 additions & 14 deletions arch/microblaze/include/asm/bug.h
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_BUG_H
#define _ASM_MICROBLAZE_BUG_H

#include <linux/kernel.h>
#include <asm-generic/bug.h>

#endif /* _ASM_MICROBLAZE_BUG_H */
18 changes: 1 addition & 17 deletions arch/microblaze/include/asm/bugs.h
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_BUGS_H
#define _ASM_MICROBLAZE_BUGS_H

static inline void check_bugs(void)
{
/* nothing to do */
}

#endif /* _ASM_MICROBLAZE_BUGS_H */
#include <asm-generic/bugs.h>
1 change: 1 addition & 0 deletions arch/microblaze/include/asm/fb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <asm-generic/fb.h>
14 changes: 2 additions & 12 deletions arch/microblaze/include/asm/hardirq.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,11 @@
#ifndef _ASM_MICROBLAZE_HARDIRQ_H
#define _ASM_MICROBLAZE_HARDIRQ_H

#include <linux/cache.h>
#include <linux/irq.h>
#include <asm/irq.h>
#include <asm/current.h>
#include <linux/ptrace.h>

/* should be defined in each interrupt controller driver */
extern unsigned int get_irq(struct pt_regs *regs);

typedef struct {
unsigned int __softirq_pending;
} ____cacheline_aligned irq_cpustat_t;

#define ack_bad_irq ack_bad_irq
void ack_bad_irq(unsigned int irq);

#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
#include <asm-generic/hardirq.h>

#endif /* _ASM_MICROBLAZE_HARDIRQ_H */
6 changes: 1 addition & 5 deletions arch/microblaze/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@
#define _ASM_MICROBLAZE_IRQ_H

#define NR_IRQS 32
#include <asm-generic/irq.h>

#include <linux/interrupt.h>

extern unsigned int nr_irq;

#define NO_IRQ (-1)

static inline int irq_canonicalize(int irq)
{
return irq;
}

struct pt_regs;
extern void do_IRQ(struct pt_regs *regs);

Expand Down
7 changes: 1 addition & 6 deletions arch/microblaze/include/asm/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
#define _ASM_MICROBLAZE_MMU_H

# ifndef CONFIG_MMU
# ifndef __ASSEMBLY__
typedef struct {
struct vm_list_struct *vmlist;
unsigned long end_brk;
} mm_context_t;
# endif /* __ASSEMBLY__ */
# include <asm-generic/mmu.h>
# else /* CONFIG_MMU */
# ifdef __KERNEL__
# ifndef __ASSEMBLY__
Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/include/asm/mmu_context.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef CONFIG_MMU
# include "mmu_context_mm.h"
#else
# include "mmu_context_no.h"
# include <asm-generic/mmu_context.h>
#endif
23 changes: 0 additions & 23 deletions arch/microblaze/include/asm/mmu_context_no.h

This file was deleted.

10 changes: 2 additions & 8 deletions arch/microblaze/include/asm/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef _ASM_MICROBLAZE_MODULE_H
#define _ASM_MICROBLAZE_MODULE_H

#include <asm-generic/module.h>

/* Microblaze Relocations */
#define R_MICROBLAZE_NONE 0
#define R_MICROBLAZE_32 1
Expand All @@ -24,14 +26,6 @@
/* Keep this the last entry. */
#define R_MICROBLAZE_NUM 11

struct mod_arch_specific {
int foo;
};

#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Ehdr Elf32_Ehdr

typedef struct { volatile int counter; } module_t;

#endif /* _ASM_MICROBLAZE_MODULE_H */
1 change: 1 addition & 0 deletions arch/microblaze/include/asm/parport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <asm-generic/parport.h>
2 changes: 1 addition & 1 deletion arch/microblaze/include/asm/pci.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#include <linux/io.h>
#include <asm-generic/pci.h>
29 changes: 1 addition & 28 deletions arch/microblaze/include/asm/scatterlist.h
Original file line number Diff line number Diff line change
@@ -1,28 +1 @@
/*
* Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_SCATTERLIST_H
#define _ASM_MICROBLAZE_SCATTERLIST_H

struct scatterlist {
#ifdef CONFIG_DEBUG_SG
unsigned long sg_magic;
#endif
unsigned long page_link;
dma_addr_t dma_address;
unsigned int offset;
unsigned int length;
};

#define sg_dma_address(sg) ((sg)->dma_address)
#define sg_dma_len(sg) ((sg)->length)

#define ISA_DMA_THRESHOLD (~0UL)

#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
#include <asm-generic/scatterlist.h>
15 changes: 1 addition & 14 deletions arch/microblaze/include/asm/serial.h
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
/*
* Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_SERIAL_H
#define _ASM_MICROBLAZE_SERIAL_H

# define BASE_BAUD (1843200 / 16)

#endif /* _ASM_MICROBLAZE_SERIAL_H */
#include <asm-generic/serial.h>
7 changes: 1 addition & 6 deletions arch/microblaze/include/asm/shmparam.h
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
#ifndef _ASM_MICROBLAZE_SHMPARAM_H
#define _ASM_MICROBLAZE_SHMPARAM_H

#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */

#endif /* _ASM_MICROBLAZE_SHMPARAM_H */
#include <asm-generic/shmparam.h>
3 changes: 3 additions & 0 deletions arch/microblaze/include/asm/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include <asm/setup.h>
#include <asm/irqflags.h>

#include <asm-generic/cmpxchg.h>
#include <asm-generic/cmpxchg-local.h>

struct task_struct;
struct thread_info;

Expand Down
6 changes: 2 additions & 4 deletions arch/microblaze/include/asm/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
#ifndef _ASM_MICROBLAZE_TIMEX_H
#define _ASM_MICROBLAZE_TIMEX_H

#define CLOCK_TICK_RATE 1000 /* Timer input freq. */

typedef unsigned long cycles_t;
#include <asm-generic/timex.h>

#define get_cycles() (0)
#define CLOCK_TICK_RATE 1000 /* Timer input freq. */

#endif /* _ASM_TIMEX_H */
2 changes: 1 addition & 1 deletion arch/microblaze/include/asm/vga.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@

#include <asm-generic/vga.h>

0 comments on commit 0a58458

Please sign in to comment.