[uClinux-dev] [PATCH] Atmel CPU selection

Fabrice Gautier Fabrice_Gautier at sdesigns.com
Fri Nov 16 01:23:18 EST 2001


> -----Original Message-----
> From: David McCullough [mailto:davidm at snapgear.com]> 
> 
> Jivin Fabrice Gautier lays it down ...
> > Hi,
> > 
> > May i suggest the following patch, which allow to choose 
> the CPU on Atmel
> > board at config
> > 
> > (made against cvs today)
> 
> Just added this and your module support patch to CVS,


For the module support, you'll also need to update the three files I talk
about form the arm tree.

If you prefer to apply patch instead of copying files here they are.

I made the patch for two of them ( include/asm-armnommu/io.h and
include/asm-armnommu/module.h) against cvs. For the third
(arch/armnommu/mm/discontig.c) I still don't know how to generate a diff
with a new file (that's what "cvs diff -N" is supposed to do but it doesn't
work) so I made the diff against an empty file.


Index: include/asm-armnommu/io.h
===================================================================
RCS file: /var/cvs/uClinux-2.4.x/include/asm-armnommu/io.h,v
retrieving revision 1.2
diff -u -r1.2 io.h
--- include/asm-armnommu/io.h   2001/07/25 13:00:24     1.2
+++ include/asm-armnommu/io.h   2001/11/16 05:56:19
@@ -31,30 +31,67 @@
  * read/writes.  We define __arch_*[bl] here, and leave __arch_*w
  * to the architecture specific code.
  */
-#define __arch_getb(a)         (*(volatile unsigned char *)(a))
-#define __arch_getl(a)         (*(volatile unsigned int  *)(a))
+#define __arch_getb(a)                 (*(volatile unsigned char *)(a))
+#define __arch_getl(a)                 (*(volatile unsigned int  *)(a))
 
-#define __arch_putb(v,a)       (*(volatile unsigned char *)(a) = (v))
-#define __arch_putl(v,a)       (*(volatile unsigned int  *)(a) = (v))
+#define __arch_putb(v,a)               (*(volatile unsigned char *)(a) =
(v))
+#define __arch_putl(v,a)               (*(volatile unsigned int  *)(a) =
(v))
 
+extern void __raw_writesb(unsigned int addr, void *data, int bytelen);
+extern void __raw_writesw(unsigned int addr, void *data, int wordlen);
+extern void __raw_writesl(unsigned int addr, void *data, int longlen);
+
+extern void __raw_readsb(unsigned int addr, void *data, int bytelen);
+extern void __raw_readsw(unsigned int addr, void *data, int wordlen);
+extern void __raw_readsl(unsigned int addr, void *data, int longlen);
+
+#define __raw_writeb(v,a)              __arch_putb(v,a)
+#define __raw_writew(v,a)              __arch_putw(v,a)
+#define __raw_writel(v,a)              __arch_putl(v,a)
+
+#define __raw_readb(a)                 __arch_getb(a)
+#define __raw_readw(a)                 __arch_getw(a)
+#define __raw_readl(a)                 __arch_getl(a)
+
+/*
+ * The compiler seems to be incapable of optimising constants
+ * properly.  Spell it out to the compiler in some cases.
+ * These are only valid for small values of "off" (< 1<<12)
+ */
+#define __raw_base_writeb(val,base,off)
__arch_base_putb(val,base,off)
+#define __raw_base_writew(val,base,off)
__arch_base_putw(val,base,off)
+#define __raw_base_writel(val,base,off)
__arch_base_putl(val,base,off)
+
+#define __raw_base_readb(base,off)     __arch_base_getb(base,off)
+#define __raw_base_readw(base,off)     __arch_base_getw(base,off)
+#define __raw_base_readl(base,off)     __arch_base_getl(base,off)
+
 /*
  * Now, pick up the machine-defined IO definitions
  */
 #include <asm/arch/io.h>
 
 /*
- * IO definitions.  We define {out,in}[bwl] if __io is defined by
- * the machine.  Otherwise, these definitions are left for the
- * machine specific header files to pick up.
+ * IO definitions.  We define {out,in,outs,ins}[bwl] if __io is
+ * defined by the machine.  Otherwise, these definitions are left
+ * for the machine specific header files to pick up.
  */
 #ifdef __io
-#define outb(v,p)                      __arch_putb(v,__io(p))
-#define outw(v,p)                      __arch_putw(v,__io(p))
-#define outl(v,p)                      __arch_putl(v,__io(p))
-
-#define inb(p)                         __arch_getb(__io(p))
-#define inw(p)                         __arch_getw(__io(p))
-#define inl(p)                         __arch_getl(__io(p))
+#define outb(v,p)                      __raw_writeb(v,__io(p))
+#define outw(v,p)                      __raw_writew(v,__io(p))
+#define outl(v,p)                      __raw_writel(v,__io(p))
+
+#define inb(p)                         __raw_readb(__io(p))
+#define inw(p)                         __raw_readw(__io(p))
+#define inl(p)                         __raw_readl(__io(p))
+
+#define outsb(p,d,l)                   __raw_writesb(__io(p),d,l)
+#define outsw(p,d,l)                   __raw_writesw(__io(p),d,l)
+#define outsl(p,d,l)                   __raw_writesl(__io(p),d,l)
+
+#define insb(p,d,l)                    __raw_readsb(__io(p),d,l)
+#define insw(p,d,l)                    __raw_readsw(__io(p),d,l)
+#define insl(p,d,l)                    __raw_readsl(__io(p),d,l)
 #endif
 
 #define outb_p(val,port)               outb((val),(port))
@@ -64,13 +101,6 @@
 #define inw_p(port)                    inw((port))
 #define inl_p(port)                    inl((port))
 
-extern void outsb(unsigned int port, const void *from, int len);
-extern void outsw(unsigned int port, const void *from, int len);
-extern void outsl(unsigned int port, const void *from, int len);
-extern void insb(unsigned int port, void *from, int len);
-extern void insw(unsigned int port, void *from, int len);
-extern void insl(unsigned int port, void *from, int len);
-
 #define outsb_p(port,from,len)         outsb(port,from,len)
 #define outsw_p(port,from,len)         outsw(port,from,len)
 #define outsl_p(port,from,len)         outsl(port,from,len)
@@ -121,27 +151,6 @@
 extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle);
 extern void consistent_free(void *vaddr, size_t size, dma_addr_t handle);
 extern void consistent_sync(void *vaddr, size_t size, int rw);
-
-#define __raw_writeb(v,a)              __arch_putb(v,a)
-#define __raw_writew(v,a)              __arch_putw(v,a)
-#define __raw_writel(v,a)              __arch_putl(v,a)
-
-#define __raw_readb(a)                 __arch_getb(a)
-#define __raw_readw(a)                 __arch_getw(a)
-#define __raw_readl(a)                 __arch_getl(a)
-
-/*
- * The compiler seems to be incapable of optimising constants
- * properly.  Spell it out to the compiler in some cases.
- * These are only valid for small values of "off" (< 1<<12)
- */
-#define __raw_base_writeb(val,base,off)
__arch_base_putb(val,base,off)
-#define __raw_base_writew(val,base,off)
__arch_base_putw(val,base,off)
-#define __raw_base_writel(val,base,off)
__arch_base_putl(val,base,off)
-
-#define __raw_base_readb(base,off)     __arch_base_getb(base,off)
-#define __raw_base_readw(base,off)     __arch_base_getw(base,off)
-#define __raw_base_readl(base,off)     __arch_base_getl(base,off)
 
 /*
  * String version of IO memory access ops:
Index: include/asm-armnommu/module.h
===================================================================
RCS file: /var/cvs/uClinux-2.4.x/include/asm-armnommu/module.h,v
retrieving revision 1.1
diff -u -r1.1 module.h
--- include/asm-armnommu/module.h       2001/04/06 15:44:54     1.1
+++ include/asm-armnommu/module.h       2001/11/16 05:56:19
@@ -7,5 +7,6 @@
 #define module_map(x)          vmalloc(x)
 #define module_unmap(x)                vfree(x)
 #define module_arch_init(x)    (0)
+#define arch_init_modules(x)   do { } while (0)
 
 #endif /* _ASM_ARM_MODULE_H */



--- arch/armnommu/mm/discontig.c.orig	Thu Nov 15 22:07:14 2001
+++ arch/armnommu/mm/discontig.c	Fri Sep 28 03:19:02 2001
@@ -0,0 +1,36 @@
+/*
+ * linux/arch/arm/mm/discontig.c
+ *
+ * Discontiguous memory support.
+ *
+ * Initial code: Copyright (C) 1999-2000 Nicolas Pitre
+ *
+ * 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 NR_NODES != 4
+#error Fix Me Please
+#endif
+
+/*
+ * Our node_data structure for discontigous memory.
+ */
+
+static bootmem_data_t node_bootmem_data[NR_NODES];
+
+pg_data_t discontig_node_data[NR_NODES] = {
+  { 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);
+
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/



More information about the uClinux-dev mailing list