100-target.patch 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. --- a/src/drv_vmmc_access.h
  2. +++ b/src/drv_vmmc_access.h
  3. @@ -24,6 +24,10 @@
  4. #include "drv_mps_vmmc.h"
  5. #endif
  6. +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
  7. +# define IFX_MPS IFXMIPS_MPS_BASE_ADDR
  8. +#endif
  9. +
  10. /* ============================= */
  11. /* Global Defines */
  12. /* ============================= */
  13. --- a/src/drv_vmmc_danube.h
  14. +++ b/src/drv_vmmc_danube.h
  15. @@ -15,56 +15,18 @@
  16. */
  17. #if defined SYSTEM_DANUBE
  18. -#include <asm/ifx/ifx_gpio.h>
  19. +#include <lantiq_soc.h>
  20. +
  21. #else
  22. #error no system selected
  23. #endif
  24. -#define VMMC_TAPI_GPIO_MODULE_ID IFX_GPIO_MODULE_TAPI_VMMC
  25. +#define VMMC_TAPI_GPIO_MODULE_ID IFX_GPIO_MODULE_TAPI_VMMC
  26. /**
  27. */
  28. #define VMMC_PCM_IF_CFG_HOOK(mode, GPIOreserved, ret) \
  29. do { \
  30. - ret = VMMC_statusOk; \
  31. - /* Reserve P0.0 as TDM/FSC */ \
  32. - if (!GPIOreserved) \
  33. - ret |= ifx_gpio_pin_reserve(IFX_GPIO_PIN_ID(0, 0), VMMC_TAPI_GPIO_MODULE_ID); \
  34. - ret |= ifx_gpio_altsel0_set(IFX_GPIO_PIN_ID(0, 0), VMMC_TAPI_GPIO_MODULE_ID); \
  35. - ret |= ifx_gpio_altsel1_set(IFX_GPIO_PIN_ID(0, 0), VMMC_TAPI_GPIO_MODULE_ID); \
  36. - ret |= ifx_gpio_open_drain_set(IFX_GPIO_PIN_ID(0, 0), VMMC_TAPI_GPIO_MODULE_ID);\
  37. - \
  38. - /* Reserve P1.9 as TDM/DO */ \
  39. - if (!GPIOreserved) \
  40. - ret |= ifx_gpio_pin_reserve(IFX_GPIO_PIN_ID(1, 9), VMMC_TAPI_GPIO_MODULE_ID); \
  41. - ret |= ifx_gpio_altsel0_set(IFX_GPIO_PIN_ID(1, 9), VMMC_TAPI_GPIO_MODULE_ID); \
  42. - ret |= ifx_gpio_altsel1_clear(IFX_GPIO_PIN_ID(1, 9), VMMC_TAPI_GPIO_MODULE_ID); \
  43. - ret |= ifx_gpio_dir_out_set(IFX_GPIO_PIN_ID(1, 9), VMMC_TAPI_GPIO_MODULE_ID); \
  44. - ret |= ifx_gpio_open_drain_set(IFX_GPIO_PIN_ID(1, 9), VMMC_TAPI_GPIO_MODULE_ID); \
  45. - \
  46. - /* Reserve P1.10 as TDM/DI */ \
  47. - if (!GPIOreserved) \
  48. - ret |= ifx_gpio_pin_reserve(IFX_GPIO_PIN_ID(1,10), VMMC_TAPI_GPIO_MODULE_ID); \
  49. - ret |= ifx_gpio_altsel0_clear(IFX_GPIO_PIN_ID(1,10), VMMC_TAPI_GPIO_MODULE_ID); \
  50. - ret |= ifx_gpio_altsel1_set(IFX_GPIO_PIN_ID(1,10), VMMC_TAPI_GPIO_MODULE_ID);\
  51. - ret |= ifx_gpio_dir_in_set(IFX_GPIO_PIN_ID(1,10), VMMC_TAPI_GPIO_MODULE_ID); \
  52. - \
  53. - /* Reserve P1.11 as TDM/DCL */ \
  54. - if (!GPIOreserved) \
  55. - ret |= ifx_gpio_pin_reserve(IFX_GPIO_PIN_ID(1,11), VMMC_TAPI_GPIO_MODULE_ID); \
  56. - ret |= ifx_gpio_altsel0_set(IFX_GPIO_PIN_ID(1,11), VMMC_TAPI_GPIO_MODULE_ID); \
  57. - ret |= ifx_gpio_altsel1_clear(IFX_GPIO_PIN_ID(1,11), VMMC_TAPI_GPIO_MODULE_ID); \
  58. - ret |= ifx_gpio_open_drain_set(IFX_GPIO_PIN_ID(1,11), VMMC_TAPI_GPIO_MODULE_ID); \
  59. - \
  60. - if (mode == 2) { \
  61. - /* TDM/FSC+DCL Master */ \
  62. - ret |= ifx_gpio_dir_out_set(IFX_GPIO_PIN_ID(0, 0), VMMC_TAPI_GPIO_MODULE_ID); \
  63. - ret |= ifx_gpio_dir_out_set(IFX_GPIO_PIN_ID(1,11), VMMC_TAPI_GPIO_MODULE_ID); \
  64. - } else { \
  65. - /* TDM/FSC+DCL Slave */ \
  66. - ret |= ifx_gpio_dir_in_set(IFX_GPIO_PIN_ID(0, 0), VMMC_TAPI_GPIO_MODULE_ID); \
  67. - ret |= ifx_gpio_dir_in_set(IFX_GPIO_PIN_ID(1,11), VMMC_TAPI_GPIO_MODULE_ID); \
  68. - } \
  69. } while(0);
  70. /**
  71. @@ -72,11 +34,6 @@
  72. */
  73. #define VMMC_DRIVER_UNLOAD_HOOK(ret) \
  74. do { \
  75. - ret = VMMC_statusOk; \
  76. - ret |= ifx_gpio_pin_free(IFX_GPIO_PIN_ID(0, 0), VMMC_TAPI_GPIO_MODULE_ID); \
  77. - ret |= ifx_gpio_pin_free(IFX_GPIO_PIN_ID(1, 9), VMMC_TAPI_GPIO_MODULE_ID); \
  78. - ret |= ifx_gpio_pin_free(IFX_GPIO_PIN_ID(1,10), VMMC_TAPI_GPIO_MODULE_ID); \
  79. - ret |= ifx_gpio_pin_free(IFX_GPIO_PIN_ID(1,11), VMMC_TAPI_GPIO_MODULE_ID); \
  80. } while (0)
  81. #endif /* _DRV_VMMC_AMAZON_S_H */
  82. --- a/src/drv_vmmc_init.c
  83. +++ b/src/drv_vmmc_init.c
  84. @@ -52,6 +52,14 @@
  85. #include "ifx_pmu.h"
  86. #endif /* PMU_SUPPORTED */
  87. +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
  88. +# define IFX_MPS_CAD0SR IFXMIPS_MPS_CAD0SR
  89. +# define IFX_MPS_CAD1SR IFXMIPS_MPS_CAD1SR
  90. +# define IFX_MPS_CVC0SR IFXMIPS_MPS_CVC0SR
  91. +# define IFX_MPS_CVC1SR IFXMIPS_MPS_CVC1SR
  92. +# define IFX_MPS_CVC2SR IFXMIPS_MPS_CVC2SR
  93. +# define IFX_MPS_CVC3SR IFXMIPS_MPS_CVC3SR
  94. +#endif
  95. /* ============================= */
  96. /* Local Macros & Definitions */
  97. @@ -1591,7 +1599,7 @@
  98. #ifdef VMMC_DRIVER_UNLOAD_HOOK
  99. if (VDevices[0].nDevState & DS_GPIO_RESERVED)
  100. {
  101. - IFX_int32_t ret;
  102. + IFX_int32_t ret = 0;
  103. VMMC_DRIVER_UNLOAD_HOOK(ret);
  104. if (!VMMC_SUCCESS(ret))
  105. {
  106. --- a/src/drv_vmmc_init_cap.c
  107. +++ b/src/drv_vmmc_init_cap.c
  108. @@ -22,6 +22,11 @@
  109. #include "drv_mps_vmmc.h"
  110. #include "drv_mps_vmmc_device.h"
  111. +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
  112. +# define IFX_MPS_CHIPID_VERSION_GET IFXMIPS_MPS_CHIPID_VERSION_GET
  113. +# define IFX_MPS_CHIPID IFXMIPS_MPS_CHIPID
  114. +#endif
  115. +
  116. /* ============================= */
  117. /* Configuration defintions */
  118. /* ============================= */
  119. --- a/src/mps/drv_mps_vmmc_common.c
  120. +++ b/src/mps/drv_mps_vmmc_common.c
  121. @@ -17,6 +17,7 @@
  122. /* Includes */
  123. /* ============================= */
  124. #include "drv_config.h"
  125. +#include "drv_vmmc_init.h"
  126. #undef USE_PLAIN_VOICE_FIRMWARE
  127. #undef PRINT_ON_ERR_INTERRUPT
  128. @@ -39,8 +40,32 @@
  129. #include "ifxos_interrupt.h"
  130. #include "ifxos_time.h"
  131. -#include <asm/ifx/ifx_regs.h>
  132. -#include <asm/ifx/ifx_gptu.h>
  133. +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
  134. +# include <lantiq.h>
  135. +# include <linux/irq.h>
  136. +# include <lantiq_timer.h>
  137. +
  138. +# define ifx_gptu_timer_request lq_request_timer
  139. +# define ifx_gptu_timer_start lq_start_timer
  140. +# define ifx_gptu_countvalue_get lq_get_count_value
  141. +# define ifx_gptu_timer_free lq_free_timer
  142. +
  143. +
  144. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
  145. +# define bsp_mask_and_ack_irq ltq_mask_and_ack_irq
  146. +#else
  147. +extern void ltq_mask_and_ack_irq(struct irq_data *d);
  148. +static void inline bsp_mask_and_ack_irq(int x)
  149. +{
  150. + struct irq_data d;
  151. + d.hwirq = x;
  152. + ltq_mask_and_ack_irq(&d);
  153. +}
  154. +#endif
  155. +#else
  156. +# include <asm/ifx/ifx_regs.h>
  157. +# include <asm/ifx/ifx_gptu.h>
  158. +#endif
  159. #include "drv_mps_vmmc.h"
  160. #include "drv_mps_vmmc_dbg.h"
  161. @@ -104,6 +129,9 @@
  162. extern IFX_void_t mask_and_ack_danube_irq (IFX_uint32_t irq_nr);
  163. #endif /* */
  164. +
  165. +extern void sys_hw_setup (void);
  166. +
  167. extern IFXOS_event_t fw_ready_evt;
  168. /* callback function to free all data buffers currently used by voice FW */
  169. IFX_void_t (*ifx_mps_bufman_freeall)(IFX_void_t) = IFX_NULL;
  170. @@ -207,7 +235,8 @@
  171. */
  172. IFX_void_t *ifx_mps_fastbuf_malloc (IFX_size_t size, IFX_int32_t priority)
  173. {
  174. - IFX_uint32_t ptr, flags;
  175. + IFXOS_INTSTAT flags;
  176. + IFX_uint32_t ptr;
  177. IFX_int32_t index = fastbuf_index;
  178. if (fastbuf_initialized == 0)
  179. @@ -261,7 +290,7 @@
  180. */
  181. IFX_void_t ifx_mps_fastbuf_free (const IFX_void_t * ptr)
  182. {
  183. - IFX_uint32_t flags;
  184. + IFXOS_INTSTAT flags;
  185. IFX_int32_t index = fastbuf_index;
  186. IFXOS_LOCKINT (flags);
  187. @@ -457,7 +486,7 @@
  188. */
  189. static IFX_int32_t ifx_mps_bufman_inc_level (IFX_uint32_t value)
  190. {
  191. - IFX_uint32_t flags;
  192. + IFXOS_INTSTAT flags;
  193. if (mps_buffer.buf_level + value > MPS_BUFFER_MAX_LEVEL)
  194. {
  195. @@ -484,7 +513,7 @@
  196. */
  197. static IFX_int32_t ifx_mps_bufman_dec_level (IFX_uint32_t value)
  198. {
  199. - IFX_uint32_t flags;
  200. + IFXOS_INTSTAT flags;
  201. if (mps_buffer.buf_level < value)
  202. {
  203. @@ -636,7 +665,7 @@
  204. mem_seg_ptr[i] =
  205. (IFX_uint32_t *) CPHYSADDR ((IFX_uint32_t) mps_buffer.
  206. malloc (segment_size, FASTBUF_FW_OWNED));
  207. - if (mem_seg_ptr[i] == CPHYSADDR (IFX_NULL))
  208. + if (mem_seg_ptr[i] == (IFX_uint32_t *)CPHYSADDR (IFX_NULL))
  209. {
  210. TRACE (MPS, DBG_LEVEL_HIGH,
  211. ("%s(): cannot allocate buffer\n", __FUNCTION__));
  212. @@ -952,7 +981,7 @@
  213. mps_mbx_dev * pMBDev, IFX_int32_t bcommand,
  214. IFX_boolean_t from_kernel)
  215. {
  216. - IFX_uint32_t flags;
  217. + IFXOS_INTSTAT flags;
  218. IFXOS_LOCKINT (flags);
  219. @@ -1068,7 +1097,7 @@
  220. IFX_void_t ifx_mps_release_structures (mps_comm_dev * pDev)
  221. {
  222. IFX_int32_t count;
  223. - IFX_uint32_t flags;
  224. + IFXOS_INTSTAT flags;
  225. IFXOS_LOCKINT (flags);
  226. IFXOS_BlockFree (pFW_img_data);
  227. @@ -1117,7 +1146,7 @@
  228. /* Initialize MPS main structure */
  229. memset ((IFX_void_t *) pDev, 0, sizeof (mps_comm_dev));
  230. - pDev->base_global = (mps_mbx_reg *) IFX_MPS_SRAM;
  231. + pDev->base_global = (mps_mbx_reg *) IFXMIPS_MPS_SRAM;
  232. pDev->flags = 0x00000000;
  233. MBX_Memory = pDev->base_global;
  234. @@ -1125,9 +1154,11 @@
  235. for MBX communication. These are: mailbox base address, mailbox size, *
  236. mailbox read index and mailbox write index. for command and voice
  237. mailbox, * upstream and downstream direction. */
  238. - memset ((IFX_void_t *) MBX_Memory, /* avoid to overwrite CPU boot
  239. - registers */
  240. - 0, sizeof (mps_mbx_reg) - 2 * sizeof (mps_boot_cfg_reg));
  241. + memset (
  242. + /* avoid to overwrite CPU boot registers */
  243. + (IFX_void_t *) MBX_Memory,
  244. + 0,
  245. + sizeof (mps_mbx_reg) - 2 * sizeof (mps_boot_cfg_reg));
  246. MBX_Memory->MBX_UPSTR_CMD_BASE =
  247. (IFX_uint32_t *) CPHYSADDR ((IFX_uint32_t) MBX_UPSTRM_CMD_FIFO_BASE);
  248. MBX_Memory->MBX_UPSTR_CMD_SIZE = MBX_CMD_FIFO_SIZE;
  249. @@ -1564,7 +1595,7 @@
  250. IFX_uint32_t * bytes)
  251. {
  252. IFX_int32_t i, ret;
  253. - IFX_uint32_t flags;
  254. + IFXOS_INTSTAT flags;
  255. IFXOS_LOCKINT (flags);
  256. @@ -1774,7 +1805,7 @@
  257. {
  258. mps_fifo *mbx;
  259. IFX_uint32_t i;
  260. - IFX_uint32_t flags;
  261. + IFXOS_INTSTAT flags;
  262. IFX_int32_t retval = -EAGAIN;
  263. IFX_int32_t retries = 0;
  264. IFX_uint32_t word = 0;
  265. @@ -2169,6 +2200,7 @@
  266. TRACE (MPS, DBG_LEVEL_HIGH,
  267. ("%s(): Invalid device ID %d !\n", __FUNCTION__, pMBDev->devID));
  268. }
  269. +
  270. return retval;
  271. }
  272. @@ -2192,7 +2224,7 @@
  273. mps_mbx_dev *mbx_dev;
  274. MbxMsg_s msg;
  275. IFX_uint32_t bytes_read = 0;
  276. - IFX_uint32_t flags;
  277. + IFXOS_INTSTAT flags;
  278. IFX_int32_t ret;
  279. /* set pointer to data upstream mailbox, no matter if 0,1,2 or 3 because
  280. @@ -2283,7 +2315,7 @@
  281. {
  282. ifx_mps_bufman_dec_level (1);
  283. if ((ifx_mps_bufman_get_level () <= mps_buffer.buf_threshold) &&
  284. - (atomic_read (&pMPSDev->provide_buffer->object.count) == 0))
  285. + ((volatile unsigned int)pMPSDev->provide_buffer->object.count == 0))
  286. {
  287. IFXOS_LockRelease (pMPSDev->provide_buffer);
  288. }
  289. @@ -2326,7 +2358,7 @@
  290. #endif /* CONFIG_PROC_FS */
  291. ifx_mps_bufman_dec_level (1);
  292. if ((ifx_mps_bufman_get_level () <= mps_buffer.buf_threshold) &&
  293. - (atomic_read (&pMPSDev->provide_buffer->object.count) == 0))
  294. + ((volatile unsigned int)pMPSDev->provide_buffer->object.count == 0))
  295. {
  296. IFXOS_LockRelease (pMPSDev->provide_buffer);
  297. }
  298. @@ -2356,7 +2388,7 @@
  299. IFX_void_t ifx_mps_mbx_cmd_upstream (IFX_ulong_t dummy)
  300. {
  301. mps_fifo *mbx;
  302. - IFX_uint32_t flags;
  303. + IFXOS_INTSTAT flags;
  304. /* set pointer to upstream command mailbox */
  305. mbx = &(pMPSDev->cmd_upstrm_fifo);
  306. @@ -2404,7 +2436,7 @@
  307. mps_event_msg msg;
  308. IFX_int32_t length = 0;
  309. IFX_int32_t read_length = 0;
  310. - IFX_uint32_t flags;
  311. + IFXOS_INTSTAT flags;
  312. /* set pointer to upstream event mailbox */
  313. mbx = &(pMPSDev->event_upstrm_fifo);
  314. @@ -2619,6 +2651,7 @@
  315. #endif
  316. *IFX_MPS_AD0ENR = Ad0Reg.val;
  317. +
  318. }
  319. /**
  320. @@ -2647,7 +2680,7 @@
  321. */
  322. IFX_void_t ifx_mps_dd_mbx_int_enable (IFX_void_t)
  323. {
  324. - IFX_uint32_t flags;
  325. + IFXOS_INTSTAT flags;
  326. MPS_Ad0Reg_u Ad0Reg;
  327. IFXOS_LOCKINT (flags);
  328. @@ -2673,7 +2706,7 @@
  329. */
  330. IFX_void_t ifx_mps_dd_mbx_int_disable (IFX_void_t)
  331. {
  332. - IFX_uint32_t flags;
  333. + IFXOS_INTSTAT flags;
  334. MPS_Ad0Reg_u Ad0Reg;
  335. IFXOS_LOCKINT (flags);
  336. @@ -2738,7 +2771,6 @@
  337. #else /* */
  338. mask_and_ack_danube_irq (irq);
  339. #endif /* */
  340. -
  341. /* FW is up and ready to process commands */
  342. if (MPS_Ad0StatusReg.fld.dl_end)
  343. {
  344. @@ -2800,6 +2832,7 @@
  345. }
  346. }
  347. +
  348. if (MPS_Ad0StatusReg.fld.du_mbx)
  349. {
  350. #ifdef CONFIG_PROC_FS
  351. @@ -2944,12 +2977,12 @@
  352. IFX_MPS_CVC0SR[chan] = MPS_VCStatusReg.val;
  353. /* handle only enabled interrupts */
  354. MPS_VCStatusReg.val &= IFX_MPS_VC0ENR[chan];
  355. -
  356. #ifdef LINUX_2_6
  357. bsp_mask_and_ack_irq (irq);
  358. #else /* */
  359. mask_and_ack_danube_irq (irq);
  360. #endif /* */
  361. +
  362. pMPSDev->event.MPS_VCStatReg[chan].val = MPS_VCStatusReg.val;
  363. #ifdef PRINT_ON_ERR_INTERRUPT
  364. if (MPS_VCStatusReg.fld.rcv_ov)
  365. @@ -3093,7 +3126,8 @@
  366. */
  367. IFX_return_t ifx_mps_init_gpt ()
  368. {
  369. - IFX_uint32_t flags, timer_flags, timer, loops = 0;
  370. + unsigned long flags;
  371. + IFX_uint32_t timer_flags, timer, loops = 0;
  372. IFX_ulong_t count;
  373. #if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
  374. timer = TIMER1A;
  375. @@ -3166,6 +3200,7 @@
  376. #else /* Danube */
  377. timer = TIMER1B;
  378. #endif /* SYSTEM_AR9 || SYSTEM_VR9 */
  379. +
  380. ifx_gptu_timer_free (timer);
  381. }
  382. --- a/src/mps/drv_mps_vmmc_danube.c
  383. +++ b/src/mps/drv_mps_vmmc_danube.c
  384. @@ -16,6 +16,7 @@
  385. /* ============================= */
  386. /* Includes */
  387. /* ============================= */
  388. +#include "linux/version.h"
  389. #include "drv_config.h"
  390. #ifdef SYSTEM_DANUBE /* defined in drv_mps_vmmc_config.h */
  391. @@ -36,9 +37,22 @@
  392. #include "ifxos_select.h"
  393. #include "ifxos_interrupt.h"
  394. -#include <asm/ifx/ifx_regs.h>
  395. -#include <asm/ifx/ifx_gpio.h>
  396. -#include <asm/ifx/common_routines.h>
  397. +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
  398. +# include <lantiq.h>
  399. +# include <linux/irq.h>
  400. +# include <lantiq_timer.h>
  401. +# include <linux/dma-mapping.h>
  402. +
  403. +
  404. +#define LQ_RCU_BASE_ADDR (KSEG1 + LTQ_RCU_BASE_ADDR)
  405. +# define LQ_RCU_RST ((u32 *)(LQ_RCU_BASE_ADDR + 0x0010))
  406. +#define IFX_RCU_RST_REQ_CPU1 (1 << 3)
  407. +# define IFX_RCU_RST_REQ LQ_RCU_RST
  408. +#else
  409. +# include <asm/ifx/ifx_regs.h>
  410. +# include <asm/ifx_vpe.h>
  411. +# include <asm/ifx/ifx_gpio.h>
  412. +#endif
  413. #include "drv_mps_vmmc.h"
  414. #include "drv_mps_vmmc_dbg.h"
  415. @@ -75,6 +89,20 @@
  416. /* Local function definition */
  417. /* ============================= */
  418. +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
  419. +IFX_uint32_t ifx_get_cp1_size(IFX_void_t)
  420. +{
  421. + return 1;
  422. +}
  423. +
  424. +unsigned int *ltq_get_cp1_base(void);
  425. +
  426. +IFX_uint32_t *ifx_get_cp1_base(IFX_void_t)
  427. +{
  428. + return ltq_get_cp1_base();
  429. +}
  430. +#endif
  431. +
  432. /******************************************************************************
  433. * DANUBE Specific Routines
  434. ******************************************************************************/
  435. @@ -134,6 +162,15 @@
  436. }
  437. /* check if FW image fits in available memory space */
  438. +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
  439. + if (mem > ifx_get_cp1_size()<<20)
  440. + {
  441. + TRACE (MPS, DBG_LEVEL_HIGH,
  442. + ("[%s %s %d]: error, firmware memory exceeds reserved space (%i > %i)!\n",
  443. + __FILE__, __func__, __LINE__, mem, ifx_get_cp1_size()<<20));
  444. + return IFX_ERROR;
  445. + }
  446. +#else
  447. if (mem > ifx_get_cp1_size())
  448. {
  449. TRACE (MPS, DBG_LEVEL_HIGH,
  450. @@ -141,6 +178,7 @@
  451. __FILE__, __func__, __LINE__, mem, ifx_get_cp1_size()));
  452. return IFX_ERROR;
  453. }
  454. +#endif
  455. /* reset the driver */
  456. ifx_mps_reset ();
  457. @@ -361,7 +399,7 @@
  458. */
  459. IFX_void_t ifx_mps_wdog_expiry()
  460. {
  461. - IFX_uint32_t flags;
  462. + unsigned long flags;
  463. IFXOS_LOCKINT (flags);
  464. /* recalculate and compare the firmware checksum */
  465. --- a/src/mps/drv_mps_vmmc_device.h
  466. +++ b/src/mps/drv_mps_vmmc_device.h
  467. @@ -16,8 +16,58 @@
  468. declarations.
  469. *******************************************************************************/
  470. -#include <asm/ifx/ifx_regs.h>
  471. -#include <asm/ifx_vpe.h>
  472. +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
  473. +# include <lantiq.h>
  474. +# include <linux/irq.h>
  475. +# include <lantiq_soc.h>
  476. +# include <linux/gpio.h>
  477. +#define IFXMIPS_MPS_SRAM ((u32 *)(KSEG1 + 0x1F200000))
  478. +#define IFXMIPS_MPS_BASE_ADDR (KSEG1 + 0x1F107000)
  479. +#define IFXMIPS_MPS_CHIPID ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0344))
  480. +#define IFXMIPS_MPS_VC0ENR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0000))
  481. +#define IFXMIPS_MPS_RVC0SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0010))
  482. +#define IFXMIPS_MPS_CVC0SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0030))
  483. +#define IFXMIPS_MPS_CVC1SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0034))
  484. +#define IFXMIPS_MPS_CVC2SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0038))
  485. +#define IFXMIPS_MPS_CVC3SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x003C))
  486. +#define IFXMIPS_MPS_RAD0SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0040))
  487. +#define IFXMIPS_MPS_RAD1SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0044))
  488. +#define IFXMIPS_MPS_SAD0SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0048))
  489. +#define IFXMIPS_MPS_SAD1SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x004C))
  490. +#define IFXMIPS_MPS_CAD0SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0050))
  491. +#define IFXMIPS_MPS_CAD1SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0054))
  492. +#define IFXMIPS_MPS_AD0ENR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0058))
  493. +#define IFXMIPS_MPS_AD1ENR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x005C))
  494. +
  495. +#define IFXMIPS_MPS_CHIPID_VERSION_GET(value) (((value) >> 28) & ((1 << 4) - 1))
  496. +#define IFXMIPS_MPS_CHIPID_VERSION_SET(value) ((((1 << 4) - 1) & (value)) << 28)
  497. +#define IFXMIPS_MPS_CHIPID_PARTNUM_GET(value) (((value) >> 12) & ((1 << 16) - 1))
  498. +#define IFXMIPS_MPS_CHIPID_PARTNUM_SET(value) ((((1 << 16) - 1) & (value)) << 12)
  499. +#define IFXMIPS_MPS_CHIPID_MANID_GET(value) (((value) >> 1) & ((1 << 10) - 1))
  500. +#define IFXMIPS_MPS_CHIPID_MANID_SET(value) ((((1 << 10) - 1) & (value)) << 1)
  501. +#else
  502. +# include <asm/ifx/ifx_regs.h>
  503. +# include <asm/ifx_vpe.h>
  504. +#endif
  505. +/* MPS register */
  506. +# define IFX_MPS_AD0ENR IFXMIPS_MPS_AD0ENR
  507. +# define IFX_MPS_AD1ENR IFXMIPS_MPS_AD1ENR
  508. +# define IFX_MPS_RAD0SR IFXMIPS_MPS_RAD0SR
  509. +# define IFX_MPS_RAD1SR IFXMIPS_MPS_RAD1SR
  510. +# define IFX_MPS_VC0ENR IFXMIPS_MPS_VC0ENR
  511. +# define IFX_MPS_RVC0SR IFXMIPS_MPS_RVC0SR
  512. +# define IFX_MPS_CVC0SR IFXMIPS_MPS_CVC0SR
  513. +# define IFX_MPS_CAD0SR IFXMIPS_MPS_CAD0SR
  514. +# define IFX_MPS_CAD1SR IFXMIPS_MPS_CAD1SR
  515. +# define IFX_MPS_CVC1SR IFXMIPS_MPS_CVC1SR
  516. +# define IFX_MPS_CVC2SR IFXMIPS_MPS_CVC2SR
  517. +# define IFX_MPS_CVC3SR IFXMIPS_MPS_CVC3SR
  518. +# define IFX_MPS_SAD0SR IFXMIPS_MPS_SAD0SR
  519. +/* interrupt vectors */
  520. +# define INT_NUM_IM4_IRL14 (INT_NUM_IM4_IRL0 + 14)
  521. +# define INT_NUM_IM4_IRL18 (INT_NUM_IM4_IRL0 + 18)
  522. +# define INT_NUM_IM4_IRL19 (INT_NUM_IM4_IRL0 + 19)
  523. +# define IFX_ICU_IM4_IER IFXMIPS_ICU_IM4_IER
  524. /* ============================= */
  525. /* MPS Common defines */
  526. @@ -26,32 +76,28 @@
  527. #define MPS_BASEADDRESS 0xBF107000
  528. #define MPS_RAD0SR MPS_BASEADDRESS + 0x0004
  529. -#define MPS_RAD0SR_DU (1<<0)
  530. -#define MPS_RAD0SR_CU (1<<1)
  531. -
  532. #define MBX_BASEADDRESS 0xBF200000
  533. #define VCPU_BASEADDRESS 0xBF208000 /* 0xBF108000 */
  534. /*---------------------------------------------------------------------------*/
  535. +#if !defined(CONFIG_LANTIQ)
  536. +/* enabling interrupts is done with request_irq by the BSP
  537. + The related code should not be needed anymore */
  538. #if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
  539. /* TODO: doublecheck - IM4 or different! */
  540. #define MPS_INTERRUPTS_ENABLE(X) *((volatile IFX_uint32_t*) IFX_ICU_IM4_IER) |= X;
  541. #define MPS_INTERRUPTS_DISABLE(X) *((volatile IFX_uint32_t*) IFX_ICU_IM4_IER) &= ~X;
  542. -#define MPS_INTERRUPTS_CLEAR(X) *((volatile IFX_uint32_t*) IFX_ICU_IM4_ISR) = X;
  543. -#define MPS_INTERRUPTS_SET(X) *((volatile IFX_uint32_t*) IFX_ICU_IM4_IRSR) = X;/* |= ? */
  544. #else /* Danube */
  545. /* TODO: possibly needs to be changed to IM4 !!!!!! */
  546. #ifdef LINUX_2_6
  547. #define MPS_INTERRUPTS_ENABLE(X) *((volatile IFX_uint32_t*) IFX_ICU_IM4_IER) |= X;
  548. #define MPS_INTERRUPTS_DISABLE(X) *((volatile IFX_uint32_t*) IFX_ICU_IM4_IER) &= ~X;
  549. -#define MPS_INTERRUPTS_CLEAR(X) *((volatile IFX_uint32_t*) IFX_ICU_IM4_ISR) = X;
  550. -#define MPS_INTERRUPTS_SET(X) *((volatile IFX_uint32_t*) IFX_ICU_IM4_IRSR) = X;/* |= ? */
  551. #else /* */
  552. #define MPS_INTERRUPTS_ENABLE(X) *((volatile IFX_uint32_t*) DANUBE_ICU_IM5_IER) |= X;
  553. #define MPS_INTERRUPTS_DISABLE(X) *((volatile IFX_uint32_t*) DANUBE_ICU_IM5_IER) &= ~X;
  554. -#define MPS_INTERRUPTS_CLEAR(X) *((volatile IFX_uint32_t*) DANUBE_ICU_IM5_ISR) = X;
  555. -#define MPS_INTERRUPTS_SET(X) *((volatile IFX_uint32_t*) DANUBE_ICU_IM5_IRSR) = X;/* |= ? */
  556. #endif /* LINUX_2_6 */
  557. #endif /* SYSTEM_AR9 || SYSTEM_VR9 */
  558. +#endif /* !defined(CONFIG_LANTIQ) */
  559. +
  560. /*---------------------------------------------------------------------------*/
  561. /*---------------------------------------------------------------------------*/
  562. @@ -142,53 +188,9 @@
  563. #if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
  564. /* ***** Amazon-S specific defines ***** */
  565. #define IFX_MPS_Base AMAZON_S_MPS
  566. -
  567. -//#define IFX_MPS_CHIPID AMAZON_S_MPS_CHIPID
  568. -//#define IFX_MPS_CHIPID_VERSION_GET AMAZON_S_MPS_CHIPID_VERSION_GET
  569. -
  570. -//#define IFX_MPS_AD0ENR AMAZON_S_MPS_AD0ENR
  571. -//#define IFX_MPS_AD1ENR AMAZON_S_MPS_AD1ENR
  572. -//#define IFX_MPS_VC0ENR AMAZON_S_MPS_VC0ENR
  573. -//#define IFX_MPS_SAD0SR AMAZON_S_MPS_SAD0SR
  574. -//#define IFX_MPS_RAD0SR AMAZON_S_MPS_RAD0SR
  575. -//#define IFX_MPS_CAD0SR AMAZON_S_MPS_CAD0SR
  576. -//#define IFX_MPS_RAD1SR AMAZON_S_MPS_RAD1SR
  577. -//#define IFX_MPS_CAD1SR AMAZON_S_MPS_CAD1SR
  578. -//#define IFX_MPS_RVC0SR AMAZON_S_MPS_RVC0SR
  579. -//#define IFX_MPS_CVC0SR AMAZON_S_MPS_CVC0SR
  580. -//#define IFX_MPS_CVC1SR AMAZON_S_MPS_CVC1SR
  581. -//#define IFX_MPS_CVC2SR AMAZON_S_MPS_CVC2SR
  582. -//#define IFX_MPS_CVC3SR AMAZON_S_MPS_CVC3SR
  583. -
  584. -//#define IFX_MPS_SRAM AMAZON_S_MPS_SRAM
  585. #else /* */
  586. /* ***** DANUBE specific defines ***** */
  587. #define IFX_MPS_Base DANUBE_MPS
  588. -
  589. -//#define IFX_MPS_CHIPID DANUBE_MPS_CHIPID
  590. -//#define IFX_MPS_CHIPID_VERSION_GET DANUBE_MPS_CHIPID_VERSION_GET
  591. -//#define IFX_MPS_CHIPID_VERSION_SET DANUBE_MPS_CHIPID_VERSION_SET
  592. -//#define IFX_MPS_CHIPID_PARTNUM_GET DANUBE_MPS_CHIPID_PARTNUM_GET
  593. -//#define IFX_MPS_CHIPID_PARTNUM_SET DANUBE_MPS_CHIPID_PARTNUM_SET
  594. -//#define IFX_MPS_CHIPID_MANID_GET DANUBE_MPS_CHIPID_MANID_GET
  595. -//#define IFX_MPS_CHIPID_MANID_SET DANUBE_MPS_CHIPID_MANID_SET
  596. -//#define IFX_MPS_SUBVER DANUBE_MPS_SUBVER
  597. -
  598. -//#define IFX_MPS_AD0ENR DANUBE_MPS_AD0ENR
  599. -//#define IFX_MPS_AD1ENR DANUBE_MPS_AD1ENR
  600. -//#define IFX_MPS_VC0ENR DANUBE_MPS_VC0ENR
  601. -//#define IFX_MPS_SAD0SR DANUBE_MPS_SAD0SR
  602. -//#define IFX_MPS_RAD0SR DANUBE_MPS_RAD0SR
  603. -//#define IFX_MPS_CAD0SR DANUBE_MPS_CAD0SR
  604. -//#define IFX_MPS_RAD1SR DANUBE_MPS_RAD1SR
  605. -//#define IFX_MPS_CAD1SR DANUBE_MPS_CAD1SR
  606. -//#define IFX_MPS_RVC0SR DANUBE_MPS_RVC0SR
  607. -//#define IFX_MPS_CVC0SR DANUBE_MPS_CVC0SR
  608. -//#define IFX_MPS_CVC1SR DANUBE_MPS_CVC1SR
  609. -//#define IFX_MPS_CVC2SR DANUBE_MPS_CVC2SR
  610. -//#define IFX_MPS_CVC3SR DANUBE_MPS_CVC3SR
  611. -
  612. -//#define IFX_MPS_SRAM DANUBE_MPS_SRAM
  613. #endif /* SYSTEM_AR9 || SYSTEM_VR9 */
  614. typedef enum
  615. {
  616. --- a/src/mps/drv_mps_vmmc_linux.c
  617. +++ b/src/mps/drv_mps_vmmc_linux.c
  618. @@ -57,10 +57,11 @@
  619. #include <linux/moduleparam.h>
  620. #endif /* */
  621. -
  622. +#if !defined CONFIG_LANTIQ
  623. #include <asm/ifx/irq.h>
  624. #include <asm/ifx/ifx_regs.h>
  625. #include <asm/ifx_vpe.h>
  626. +#endif
  627. /* lib_ifxos headers */
  628. #include "ifx_types.h"
  629. @@ -959,7 +960,7 @@
  630. #endif /* MPS_FIFO_BLOCKING_WRITE */
  631. case FIO_MPS_GET_STATUS:
  632. {
  633. - IFX_uint32_t flags;
  634. + unsigned long flags;
  635. /* get the status of the channel */
  636. if (!from_kernel)
  637. @@ -993,7 +994,7 @@
  638. #if CONFIG_MPS_HISTORY_SIZE > 0
  639. case FIO_MPS_GET_CMD_HISTORY:
  640. {
  641. - IFX_uint32_t flags;
  642. + unsigned long flags;
  643. if (from_kernel)
  644. {
  645. @@ -1685,6 +1686,7 @@
  646. sprintf (buf + len, " minLv: \t %8d\n",
  647. ifx_mps_dev.voice_mb[i].upstrm_fifo->min_space);
  648. }
  649. +
  650. return len;
  651. }
  652. @@ -2291,9 +2293,11 @@
  653. return result;
  654. }
  655. +#if !defined(CONFIG_LANTIQ)
  656. + /** \todo This is handled already with request_irq, remove */
  657. /* Enable all MPS Interrupts at ICU0 */
  658. MPS_INTERRUPTS_ENABLE (0x0000FF80);
  659. -
  660. +#endif
  661. /* enable mailbox interrupts */
  662. ifx_mps_enable_mailbox_int ();
  663. /* init FW ready event */
  664. @@ -2421,9 +2425,11 @@
  665. /* disable mailbox interrupts */
  666. ifx_mps_disable_mailbox_int ();
  667. +#if !defined(CONFIG_LANTIQ)
  668. /* disable Interrupts at ICU0 */
  669. - MPS_INTERRUPTS_DISABLE (DANUBE_MPS_AD0_IR4); /* Disable DFE/AFE 0 Interrupts
  670. - */
  671. + /* Disable DFE/AFE 0 Interrupts*/
  672. + MPS_INTERRUPTS_DISABLE (DANUBE_MPS_AD0_IR4);
  673. +#endif
  674. /* disable all MPS interrupts */
  675. ifx_mps_disable_all_int ();
  676. --- a/src/drv_vmmc_ioctl.c
  677. +++ b/src/drv_vmmc_ioctl.c
  678. @@ -18,6 +18,7 @@
  679. /* Includes */
  680. /* ============================= */
  681. #include "drv_api.h"
  682. +#include "drv_vmmc_init.h"
  683. #include "drv_vmmc_api.h"
  684. #include "drv_vmmc_bbd.h"
  685. Index: drv_vmmc-1.9.0/src/mps/drv_mps_vmmc_danube.c
  686. ===================================================================
  687. --- drv_vmmc-1.9.0.orig/src/mps/drv_mps_vmmc_danube.c 2012-12-13 08:43:16.080109377 +0100
  688. +++ drv_vmmc-1.9.0/src/mps/drv_mps_vmmc_danube.c 2012-12-13 08:43:48.584110192 +0100
  689. @@ -44,7 +44,7 @@
  690. # include <linux/dma-mapping.h>
  691. -#define LQ_RCU_BASE_ADDR (KSEG1 + LTQ_RCU_BASE_ADDR)
  692. +#define LQ_RCU_BASE_ADDR (KSEG1 + 0x1F203000)
  693. # define LQ_RCU_RST ((u32 *)(LQ_RCU_BASE_ADDR + 0x0010))
  694. #define IFX_RCU_RST_REQ_CPU1 (1 << 3)
  695. # define IFX_RCU_RST_REQ LQ_RCU_RST