summaryrefslogtreecommitdiffstats
path: root/package/platform/lantiq/ltq-vmmc/patches/000-portability.patch
blob: 48602476f4f86a8cd81b79acc93722e34ea5af85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -228,7 +228,7 @@ drv_vmmc_CFLAGS += -fno-common
 drv_vmmc_OBJS = "$(subst .c,.o, $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES))"
 
 drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA_DIST)
-	@echo -e "Making Linux 2.6.x kernel object"
+	@echo "Making Linux 2.6.x kernel object"
 	@for f in $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES) ; do \
 		if test ! -e $(PWD)/$$f; then \
 			echo "  LN      $$f" ; \
@@ -236,10 +236,10 @@ drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA
 			ln -s @abs_srcdir@/$$f $(PWD)/$$f; \
 		fi; \
 	done;
-	@echo -e "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
-	@echo -e "obj-m := $(subst .ko,.o,$@)"			>> $(PWD)/Kbuild
-	@echo -e "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)"	>> $(PWD)/Kbuild
-	@echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H  $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)"	>> $(PWD)/Kbuild
+	@echo "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
+	@echo "obj-m := $(subst .ko,.o,$@)"			>> $(PWD)/Kbuild
+	@echo "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)"	>> $(PWD)/Kbuild
+	@echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H  $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)"	>> $(PWD)/Kbuild
 	$(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
 
 clean-generic:
--- a/src/drv_vmmc_linux.c
+++ b/src/drv_vmmc_linux.c
@@ -27,11 +27,18 @@
 #include <linux/proc_fs.h>
 #include <linux/wait.h>
 #include <linux/vmalloc.h>
+#include <linux/sched.h>
 
 #ifdef LINUX_2_6
 #include <linux/version.h>
 #ifndef UTS_RELEASE
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
+#include <linux/autoconf.h>
 #include <linux/utsrelease.h>
+#else
+#include <generated/autoconf.h>
+#include <generated/utsrelease.h>
+#endif
 #endif /* UTC_RELEASE */
 #undef CONFIG_DEVFS_FS
 #endif /* LINUX_2_6 */
--- a/src/mps/drv_mps_vmmc_linux.c
+++ b/src/mps/drv_mps_vmmc_linux.c
@@ -19,11 +19,22 @@
 #include "drv_config.h"
 
 #include "drv_mps_version.h"
+#include <linux/version.h>
 
 #ifdef CONFIG_DEBUG_MINI_BOOT
 #define IKOS_MINI_BOOT
 #endif /* */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
 #include <linux/autoconf.h>
+#ifndef UTS_RELEASE
+#include <linux/utsrelease.h>
+#endif
+#else
+#include <generated/autoconf.h>
+#ifndef UTS_RELEASE
+#include <generated/utsrelease.h>
+#endif
+#endif
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/poll.h>
@@ -34,7 +45,13 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #ifdef LINUX_2_6
+#ifndef UTS_RELEASE
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
 #include <linux/utsrelease.h>
+#else
+#include <generated/utsrelease.h>
+#endif
+#endif /* UTC_RELEASE */
 #else /* */
 #include <linux/uts.h>
 #include <linux/moduleparam.h>
@@ -94,8 +111,13 @@ IFX_int32_t ifx_mps_get_status_proc (IFX
 #ifndef __KERNEL__
 IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p);
 IFX_int32_t ifx_mps_close (struct inode *inode, struct file *file_p);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
 IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p,
                            IFX_uint32_t nCmd, IFX_ulong_t arg);
+#else
+long ifx_mps_ioctl (struct file *file_p,
+                           IFX_uint32_t nCmd, IFX_ulong_t arg);
+#endif
 IFX_int32_t ifx_mps_read_mailbox (mps_devices type, mps_message * rw);
 IFX_int32_t ifx_mps_write_mailbox (mps_devices type, mps_message * rw);
 IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir,
@@ -155,7 +177,11 @@ IFX_char_t voice_channel_int_name[NUM_VO
 static struct file_operations ifx_mps_fops = {
  owner:THIS_MODULE,
  poll:ifx_mps_poll,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  ioctl:ifx_mps_ioctl,
+#else
+ unlocked_ioctl:ifx_mps_ioctl,
+#endif
  open:ifx_mps_open,
  release:ifx_mps_close
 };
@@ -598,8 +624,13 @@ static IFX_uint32_t ifx_mps_poll (struct
  * \return  -ENOIOCTLCMD Invalid command
  * \ingroup API
  */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
 IFX_int32_t ifx_mps_ioctl (struct inode * inode, struct file * file_p,
                            IFX_uint32_t nCmd, IFX_ulong_t arg)
+#else
+long ifx_mps_ioctl (struct file *file_p,
+                           IFX_uint32_t nCmd, IFX_ulong_t arg)
+#endif
 {
    IFX_int32_t retvalue = -EINVAL;
    mps_message rw_struct;
@@ -613,17 +644,30 @@ IFX_int32_t ifx_mps_ioctl (struct inode 
       'mps_devices' enum type, which in fact is [0..8]; So, if inode value is
       [0..NUM_VOICE_CHANNEL+1], then we make sure that we are calling from
       kernel space. */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
    if (((IFX_int32_t) inode >= 0) &&
        ((IFX_int32_t) inode < NUM_VOICE_CHANNEL + 1))
+#else
+   if (((IFX_int32_t) file_p >= 0) &&
+       ((IFX_int32_t) file_p < NUM_VOICE_CHANNEL + 1))
+#endif
    {
       from_kernel = 1;
 
       /* Get corresponding mailbox device structure */
       if ((pMBDev =
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
            ifx_mps_get_device ((mps_devices) ((IFX_int32_t) inode))) == 0)
+#else
+           ifx_mps_get_device ((mps_devices) ((IFX_int32_t) file_p))) == 0)
+#endif
       {
          return (-EINVAL);
       }
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
+#else
+      file_p = NULL;
+#endif
    }
    else
    {
--- a/src/mps/drv_mps_vmmc_common.c
+++ b/src/mps/drv_mps_vmmc_common.c
@@ -21,7 +21,11 @@
 #undef USE_PLAIN_VOICE_FIRMWARE
 #undef PRINT_ON_ERR_INTERRUPT
 #undef FAIL_ON_ERR_INTERRUPT
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
 #include <linux/autoconf.h>
+#else
+#include <generated/autoconf.h>
+#endif
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 
@@ -92,7 +96,9 @@ extern IFX_uint32_t danube_get_cpu_ver (
 extern mps_mbx_dev *ifx_mps_get_device (mps_devices type);
 
 #ifdef LINUX_2_6
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
 extern IFX_void_t bsp_mask_and_ack_irq (IFX_uint32_t irq_nr);
+#endif
 
 #else /* */
 extern IFX_void_t mask_and_ack_danube_irq (IFX_uint32_t irq_nr);
--- a/src/mps/drv_mps_vmmc_danube.c
+++ b/src/mps/drv_mps_vmmc_danube.c
@@ -20,7 +20,11 @@
 
 #ifdef SYSTEM_DANUBE            /* defined in drv_mps_vmmc_config.h */
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
 #include <linux/autoconf.h>
+#else
+#include <generated/autoconf.h>
+#endif
 
 /* lib_ifxos headers */
 #include "ifx_types.h"
--- a/configure.in
+++ b/configure.in
@@ -112,7 +112,7 @@ dnl Set kernel build path
 AC_ARG_ENABLE(kernelbuild,
         AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path),
         [
-                if test -r $enableval/include/linux/autoconf.h; then
+                if test -e $enableval/include/linux/autoconf.h -o -e $enableval/include/generated/autoconf.h; then
                         AC_SUBST([KERNEL_BUILD_PATH],[$enableval])
                 else
                         AC_MSG_ERROR([The kernel build directory is not valid or not configured!])
--- a/src/drv_vmmc_bbd.c
+++ b/src/drv_vmmc_bbd.c
@@ -1072,7 +1072,11 @@ static IFX_int32_t vmmc_BBD_DownloadChCr
    IFX_uint8_t  padBytes = 0;
 #endif
    IFX_uint16_t cram_offset, cram_crc,
-                pCmd [MAX_CMD_WORD]  = {0};
+                pCmd [MAX_CMD_WORD]
+#if defined (__GNUC__) || defined (__GNUG__)
+                   __attribute__ ((aligned(4)))
+#endif
+                   = {0};
 
    /* read offset */
    cpb2w (&cram_offset, &bbd_cram->pData[0], sizeof (IFX_uint16_t));
--- a/src/drv_vmmc_init.c
+++ b/src/drv_vmmc_init.c
@@ -776,8 +776,13 @@ IFX_int32_t VMMC_TAPI_LL_FW_Start(IFX_TA
       dwld.fwDwld.length = IoInit.pram_size;
 
      /* download firmware */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
       ret = ifx_mps_ioctl((IFX_void_t *) command, IFX_NULL, FIO_MPS_DOWNLOAD,
                           (IFX_uint32_t) &dwld.fwDwld);
+#else
+      ret = ifx_mps_ioctl((IFX_void_t *) command, FIO_MPS_DOWNLOAD,
+                          (IFX_uint32_t) &dwld.fwDwld);
+#endif
    }
 
    if (VMMC_SUCCESS(ret))
--- a/src/drv_vmmc_ioctl.c
+++ b/src/drv_vmmc_ioctl.c
@@ -426,18 +426,31 @@ IFX_int32_t VMMC_Dev_Spec_Ioctl (IFX_TAP
          /* MPS driver will do the USR2KERN so just pass on the pointer. */
          dwnld_struct.data = (IFX_void_t *)IoInit.pPRAMfw;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
          ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL,
                              FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct);
+#else
+         ret = ifx_mps_ioctl((IFX_void_t *)command,
+                             FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct);
+#endif
          break;
       }
       case FIO_DEV_RESET:
       {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
          ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESET, 0);
+#else
+         ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESET, 0);
+#endif
          break;
       }
       case FIO_DEV_RESTART:
       {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
          ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESTART, 0);
+#else
+         ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESTART, 0);
+#endif
          break;
       }
       case FIO_LASTERR:
--- a/src/mps/drv_mps_vmmc.h
+++ b/src/mps/drv_mps_vmmc.h
@@ -279,8 +279,13 @@ typedef struct
 #include <linux/fs.h>
 IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p);
 IFX_int32_t ifx_mps_close (struct inode *inode, struct file *filp);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
 IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p,
                            IFX_uint32_t nCmd, unsigned long arg);
+#else
+long ifx_mps_ioctl (struct file *filp,
+                           IFX_uint32_t nCmd, unsigned long arg);
+#endif
 IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir,
                                             IFX_void_t (*callback) (mps_devices
                                                                     type));