]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/nslu2-kernel/2.6.13/90-little-endian.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / nslu2-kernel / 2.6.13 / 90-little-endian.patch
1 diff -urpN linux-2.6.11.12/arch/arm/boot/compressed/Makefile linux-2.6.11.12-le2/arch/arm/boot/compressed/Makefile
2 --- linux-2.6.11.12/arch/arm/boot/compressed/Makefile   2005-06-12 04:45:37.000000000 +0200
3 +++ linux-2.6.11.12-le2/arch/arm/boot/compressed/Makefile       2005-07-17 12:13:55.000000000 +0200
4 @@ -56,6 +56,8 @@ endif
5  
6  ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
7  OBJS           += big-endian.o
8 +else
9 +OBJS           += little-endian.o
10  endif
11  
12  #
13 diff -urpN linux-2.6.11.12/arch/arm/boot/compressed/little-endian.S linux-2.6.11.12-le2/arch/arm/boot/compressed/little-endian.S
14 --- linux-2.6.11.12/arch/arm/boot/compressed/little-endian.S    1970-01-01 01:00:00.000000000 +0100
15 +++ linux-2.6.11.12-le2/arch/arm/boot/compressed/little-endian.S        2005-07-17 12:13:55.000000000 +0200
16 @@ -0,0 +1,13 @@
17 +/*
18 + *  linux/arch/arm/boot/compressed/little-endian.S
19 + *
20 + *  Switch CPU into little endian mode.
21 + *  Author: Nicolas Pitre
22 + */
23 +
24 +       .section ".start", #alloc, #execinstr
25 +
26 +       mrc     p15, 0, r0, c1, c0, 0   @ read control reg
27 +       bic     r0, r0, #(1 << 7)       @ enable little endian mode
28 +       mcr     p15, 0, r0, c1, c0, 0   @ write control reg
29 +
30 diff -urpN linux-2.6.11.12/arch/arm/mach-ixp4xx/common-pci.c linux-2.6.11.12-le2/arch/arm/mach-ixp4xx/common-pci.c
31 --- linux-2.6.11.12/arch/arm/mach-ixp4xx/common-pci.c   2005-06-12 04:45:37.000000000 +0200
32 +++ linux-2.6.11.12-le2/arch/arm/mach-ixp4xx/common-pci.c       2005-07-17 12:13:55.000000000 +0200
33 @@ -427,7 +427,7 @@ void __init ixp4xx_pci_preinit(void)
34  #ifdef __ARMEB__
35         *PCI_CSR = PCI_CSR_IC | PCI_CSR_ABE | PCI_CSR_PDS | PCI_CSR_ADS;
36  #else
37 -       *PCI_CSR = PCI_CSR_IC;
38 +       *PCI_CSR = PCI_CSR_IC | PCI_CSR_ABE;
39  #endif
40  
41         pr_debug("DONE\n");
42 diff -urpN linux-2.6.11.12/drivers/mtd/maps/ixp4xx.c linux-2.6.11.12-le2/drivers/mtd/maps/ixp4xx.c
43 --- linux-2.6.11.12/drivers/mtd/maps/ixp4xx.c   2005-07-17 12:13:05.000000000 +0200
44 +++ linux-2.6.11.12-le2/drivers/mtd/maps/ixp4xx.c       2005-07-17 12:13:55.000000000 +0200
45 @@ -28,12 +28,12 @@
46  #include <asm/io.h>
47  #include <asm/mach-types.h>
48  #include <asm/mach/flash.h>
49 -
50 +#include <asm/byteorder.h>
51  #include <asm/unaligned.h>
52  
53  #include <linux/reboot.h>
54  
55 -#ifndef __ARMEB__
56 +#if !defined(__ARMEB__) && !defined(CONFIG_ARCH_NSLU2)
57  #define        BYTE0(h)        ((h) & 0xFF)
58  #define        BYTE1(h)        (((h) >> 8) & 0xFF)
59  #else
60 @@ -44,6 +44,10 @@
61  static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
62  {
63         map_word val;
64 +
65 +#ifndef __ARMEB__
66 +       ofs ^= 2;
67 +#endif
68         val.x[0] = *(__u16 *) (map->map_priv_1 + ofs);
69         return val;
70  }
71 @@ -53,6 +57,21 @@ static map_word ixp4xx_read16(struct map
72   * when attached to a 16-bit wide device (such as the 28F128J3A),
73   * so we can't just memcpy_fromio().
74   */
75 +
76 +#if !defined(__ARMEB__) && defined(CONFIG_MTD_REDBOOT_PARTS)
77 +struct fis_image_desc {
78 +       unsigned char name[16];      // Null terminated name
79 +       unsigned long flash_base;    // Address within FLASH of image
80 +       unsigned long mem_base;      // Address in memory where it executes
81 +       unsigned long size;          // Length of image
82 +       unsigned long entry_point;   // Execution entry point
83 +       unsigned long data_length;   // Length of actual data
84 +       unsigned char _pad[256-(16+7*sizeof(unsigned long))];
85 +       unsigned long desc_cksum;    // Checksum over image descriptor
86 +       unsigned long file_cksum;    // Checksum over image data
87 +};
88 +#endif
89 +
90  static void ixp4xx_copy_from(struct map_info *map, void *to,
91                              unsigned long from, ssize_t len)
92  {
93 @@ -62,13 +81,34 @@ static void ixp4xx_copy_from(struct map_
94         u16 data;
95  
96         for (i = 0; i < (len / 2); i++) {
97 -               data = get_unaligned((u16*)(src + i));
98 +               int j = i;
99 +#ifndef __ARMEB__
100 +               j ^= 1;
101 +#endif
102 +               data = get_unaligned((u16*)(src + j));
103                 dest[i * 2] = BYTE0(data);
104                 dest[i * 2 + 1] = BYTE1(data);
105         }
106  
107 +#ifndef __ARMEB__
108 +       i ^= 1;
109 +#endif
110 +
111         if (len & 1)
112                 dest[len - 1] = BYTE0(get_unaligned((u16*)(src + i)));
113 +
114 +       /* Hack: Last sector contains RedBoot FIS table in big-endian format.
115 +          Convert into little endian format so we can use RedBoot parser */
116 +#if !defined(__ARMEB__) && defined(CONFIG_MTD_REDBOOT_PARTS)
117 +       if (from == 0x7e0000) {
118 +               struct fis_image_desc *desc = (struct fis_image_desc *)to;
119 +               for (i=0; i < (len/sizeof(struct fis_image_desc)); i++) {
120 +                       desc[i].flash_base = be32_to_cpu(desc[i].flash_base);
121 +                       desc[i].mem_base   = be32_to_cpu(desc[i].mem_base);
122 +                       desc[i].size       = be32_to_cpu(desc[i].size);
123 +               }
124 +       }
125 +#endif
126  }
127  
128  /* 
129 @@ -77,6 +117,9 @@ static void ixp4xx_copy_from(struct map_
130   */
131  static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
132  {
133 +#ifndef __ARMEB__
134 +       adr ^= 2;
135 +#endif
136         if (!(adr & 1))
137                *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
138  }
139 @@ -86,6 +129,9 @@ static void ixp4xx_probe_write16(struct 
140   */
141  static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)
142  {
143 +#ifndef __ARMEB__
144 +       adr ^= 2;
145 +#endif
146         *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
147  }
148