0010-mraa-for-iot2050.patch 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036
  1. diff --git a/package/mraa/0001-gpio-Fix-JS-binding-regarding-interrupt-injections.patch b/package/mraa/0001-gpio-Fix-JS-binding-regarding-interrupt-injections.patch
  2. new file mode 100644
  3. index 0000000000..d8dc029b62
  4. --- /dev/null
  5. +++ b/package/mraa/0001-gpio-Fix-JS-binding-regarding-interrupt-injections.patch
  6. @@ -0,0 +1,135 @@
  7. +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  8. +From: Jan Kiszka <jan.kiszka@siemens.com>
  9. +Date: Mon, 5 Dec 2022 11:45:15 +0100
  10. +Subject: [PATCH] gpio: Fix JS binding regarding interrupt injections
  11. +
  12. +According to [1] and based on stress tests, it is not correct to call
  13. +uv_queue_work outside of the loop thread. We rather need to use the
  14. +async API of libuv. That even simplifies things.
  15. +
  16. +Resolves "uv__queue_done: Assertion `uv__has_active_reqs(req->loop)' failed"
  17. +errors that were easy to trigger by multiple DIs being used in parallel.
  18. +See also [2].
  19. +
  20. +[1] https://github.com/libuv/libuv/discussions/3847
  21. +[2] https://github.com/siemens/meta-iot2050/issues/386
  22. +
  23. +Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  24. +---
  25. + api/mraa/gpio.hpp | 37 +++++++++++++++++++++----------------
  26. + 1 file changed, 21 insertions(+), 16 deletions(-)
  27. +
  28. +diff --git a/api/mraa/gpio.hpp b/api/mraa/gpio.hpp
  29. +index 8fc0881..c41d527 100644
  30. +--- a/api/mraa/gpio.hpp
  31. ++++ b/api/mraa/gpio.hpp
  32. +@@ -31,10 +31,10 @@
  33. + #include <stdexcept>
  34. +
  35. + #if defined(SWIGJAVASCRIPT)
  36. +-#if NODE_MODULE_VERSION >= 0x000D
  37. + #include <uv.h>
  38. + #endif
  39. +-#endif
  40. ++
  41. ++#define container_of(ptr, type, member) ((type*) ((char*) (ptr) - offsetof(type, member)))
  42. +
  43. + namespace mraa
  44. + {
  45. +@@ -124,6 +124,10 @@ class Gpio
  46. + if (!owner) {
  47. + mraa_gpio_owner(m_gpio, 0);
  48. + }
  49. ++
  50. ++#if defined(SWIGJAVASCRIPT)
  51. ++ uv_async_init(uv_default_loop(), &m_async, v8isr);
  52. ++#endif
  53. + }
  54. + /**
  55. + * Gpio Constructor, takes a pointer to the GPIO context and initialises
  56. +@@ -137,6 +141,9 @@ class Gpio
  57. + if (m_gpio == NULL) {
  58. + throw std::invalid_argument("Invalid GPIO context");
  59. + }
  60. ++#if defined(SWIGJAVASCRIPT)
  61. ++ uv_async_init(uv_default_loop(), &m_async, v8isr);
  62. ++#endif
  63. + }
  64. + /**
  65. + * Gpio object destructor, this will only unexport the gpio if we where
  66. +@@ -146,6 +153,9 @@ class Gpio
  67. + {
  68. + if (m_gpio != NULL) {
  69. + mraa_gpio_close(m_gpio);
  70. ++#if defined(SWIGJAVASCRIPT)
  71. ++ uv_close((uv_handle_t*) &m_async, NULL);
  72. ++#endif
  73. + }
  74. + }
  75. + /**
  76. +@@ -156,6 +166,9 @@ class Gpio
  77. + {
  78. + mraa_gpio_close(m_gpio);
  79. + m_gpio = NULL;
  80. ++#if defined(SWIGJAVASCRIPT)
  81. ++ uv_close((uv_handle_t*) &m_async, NULL);
  82. ++#endif
  83. + }
  84. + /**
  85. + * Set the edge mode for ISR
  86. +@@ -176,12 +189,12 @@ class Gpio
  87. + }
  88. + #elif defined(SWIGJAVASCRIPT)
  89. + static void
  90. +- v8isr(uv_work_t* req, int status)
  91. ++ v8isr(uv_async_t* async)
  92. + {
  93. + #if NODE_MODULE_VERSION >= 0x000D
  94. + v8::HandleScope scope(v8::Isolate::GetCurrent());
  95. + #endif
  96. +- mraa::Gpio* This = (mraa::Gpio*) req->data;
  97. ++ mraa::Gpio* This = container_of(async, mraa::Gpio, m_async);
  98. + int argc = 1;
  99. + v8::Local<v8::Value> argv[] = { SWIGV8_INTEGER_NEW(-1) };
  100. + #if NODE_MODULE_VERSION >= 0x000D
  101. +@@ -194,21 +207,12 @@ class Gpio
  102. + #else
  103. + This->m_v8isr->Call(SWIGV8_CURRENT_CONTEXT()->Global(), argc, argv);
  104. + #endif
  105. +- delete req;
  106. +- }
  107. +-
  108. +- static void
  109. +- nop(uv_work_t* req)
  110. +- {
  111. +- // Do nothing.
  112. + }
  113. +
  114. + static void
  115. +- uvwork(void* ctx)
  116. ++ trigger_async(void* async)
  117. + {
  118. +- uv_work_t* req = new uv_work_t;
  119. +- req->data = ctx;
  120. +- uv_queue_work(uv_default_loop(), req, nop, v8isr);
  121. ++ uv_async_send((uv_async_t*) async);
  122. + }
  123. +
  124. + Result
  125. +@@ -219,7 +223,7 @@ class Gpio
  126. + #else
  127. + m_v8isr = v8::Persistent<v8::Function>::New(func);
  128. + #endif
  129. +- return (Result) mraa_gpio_isr(m_gpio, (mraa_gpio_edge_t) mode, &uvwork, this);
  130. ++ return (Result) mraa_gpio_isr(m_gpio, (mraa_gpio_edge_t) mode, trigger_async, &m_async);
  131. + }
  132. + #elif defined(SWIGJAVA) || defined(JAVACALLBACK)
  133. + Result
  134. +@@ -376,6 +380,7 @@ class Gpio
  135. + private:
  136. + mraa_gpio_context m_gpio;
  137. + #if defined(SWIGJAVASCRIPT)
  138. ++ uv_async_t m_async;
  139. + v8::Persistent<v8::Function> m_v8isr;
  140. + #endif
  141. + };
  142. diff --git a/package/mraa/0001-include-Declare-gVERSION-global-as-extern.patch b/package/mraa/0001-include-Declare-gVERSION-global-as-extern.patch
  143. deleted file mode 100644
  144. index 110c020a62..0000000000
  145. --- a/package/mraa/0001-include-Declare-gVERSION-global-as-extern.patch
  146. +++ /dev/null
  147. @@ -1,30 +0,0 @@
  148. -From aaa0a5cd4e401bde4fb3691dd4e6c70a5c61e031 Mon Sep 17 00:00:00 2001
  149. -From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
  150. -Date: Mon, 13 Apr 2020 20:12:11 +0200
  151. -Subject: [PATCH] include: Declare gVERSION global as 'extern'.
  152. -
  153. -Fixes build with '-fno-common'.
  154. -
  155. -Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
  156. -[Retrieved from:
  157. -https://github.com/eclipse/mraa/commit/aaa0a5cd4e401bde4fb3691dd4e6c70a5c61e031]
  158. -Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  159. ----
  160. - include/version.h | 4 ++--
  161. - 1 file changed, 2 insertions(+), 2 deletions(-)
  162. -
  163. -diff --git a/include/version.h b/include/version.h
  164. -index 47366ef6f..3a567a1d5 100644
  165. ---- a/include/version.h
  166. -+++ b/include/version.h
  167. -@@ -11,8 +11,8 @@
  168. - extern "C" {
  169. - #endif
  170. -
  171. --const char* gVERSION;
  172. --const char* gVERSION_SHORT;
  173. -+extern const char* gVERSION;
  174. -+extern const char* gVERSION_SHORT;
  175. -
  176. - #ifdef __cplusplus
  177. - }
  178. diff --git a/package/mraa/0002-common-increase-pin-name-size.patch b/package/mraa/0002-common-increase-pin-name-size.patch
  179. new file mode 100644
  180. index 0000000000..c2aaa57e79
  181. --- /dev/null
  182. +++ b/package/mraa/0002-common-increase-pin-name-size.patch
  183. @@ -0,0 +1,27 @@
  184. +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  185. +From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
  186. +Date: Mon, 27 Feb 2023 16:31:13 +0100
  187. +Subject: [PATCH] common: increase pin name size
  188. +
  189. +Some pin names are longer than 12 characters.
  190. +32 characters should be enough while consuming not too
  191. +much space.
  192. +
  193. +Signed-off-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
  194. +---
  195. + api/mraa/common.h | 2 +-
  196. + 1 file changed, 1 insertion(+), 1 deletion(-)
  197. +
  198. +diff --git a/api/mraa/common.h b/api/mraa/common.h
  199. +index 6675f2d15771..13df2f1681fe 100644
  200. +--- a/api/mraa/common.h
  201. ++++ b/api/mraa/common.h
  202. +@@ -32,7 +32,7 @@
  203. + /** Max size off Mraa Platform name */
  204. + #define MRAA_PLATFORM_NAME_MAX_SIZE 64
  205. + /** Size off Mraa pin name */
  206. +-#define MRAA_PIN_NAME_SIZE 12
  207. ++#define MRAA_PIN_NAME_SIZE 32
  208. +
  209. + /** Bit Shift for Mraa sub platform */
  210. + #define MRAA_SUB_PLATFORM_BIT_SHIFT 9
  211. diff --git a/package/mraa/0003-iot2050-add-debugfs-pinmux-support.patch b/package/mraa/0003-iot2050-add-debugfs-pinmux-support.patch
  212. new file mode 100644
  213. index 0000000000..b363fe1bfe
  214. --- /dev/null
  215. +++ b/package/mraa/0003-iot2050-add-debugfs-pinmux-support.patch
  216. @@ -0,0 +1,796 @@
  217. +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  218. +From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
  219. +Date: Thu, 23 Mar 2023 10:21:58 +0100
  220. +Subject: [PATCH] iot2050: add debugfs pinmux support
  221. +
  222. +This patch adds support for multiplexing pins via debugfs rather
  223. +than access memory mapped pad-configuration registers.
  224. +The debugfs pinmux offers the possbility to run mraa on iot2050
  225. +platforms as regular user instead of root by adjusting privileges
  226. +on debugfs files.
  227. +
  228. +Bias settings are currently also configured by accessing pinmux.
  229. +Unfortunatelly a proper upstream-like pinconf usage is currently
  230. +not possible.
  231. +
  232. +Note: In case debugfs mux fails MRAA falls back to mmap mux.
  233. +
  234. +Signed-off-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
  235. +---
  236. + src/arm/siemens/iot2050.c | 547 ++++++++++++++++++++++++++++++++++++-
  237. + src/arm/siemens/platform.c | 4 +-
  238. + 2 files changed, 540 insertions(+), 11 deletions(-)
  239. +
  240. +diff --git a/src/arm/siemens/iot2050.c b/src/arm/siemens/iot2050.c
  241. +index cec25faf0547..c63400d6b692 100644
  242. +--- a/src/arm/siemens/iot2050.c
  243. ++++ b/src/arm/siemens/iot2050.c
  244. +@@ -24,6 +24,7 @@
  245. + #include <stdlib.h>
  246. + #include <string.h>
  247. + #include <sys/mman.h>
  248. ++#include <limits.h>
  249. + #include <mraa/types.h>
  250. +
  251. + #include "common.h"
  252. +@@ -39,6 +40,9 @@ typedef struct {
  253. + uint16_t index;
  254. + uint16_t pinmap;
  255. + int8_t mode[MAX_MUX_REGISTER_MODE];
  256. ++ const char *debugfs_path[MAX_MUX_REGISTER_MODE];
  257. ++ const char *pmx_function[MAX_MUX_REGISTER_MODE];
  258. ++ const char *pmx_group[MAX_MUX_REGISTER_MODE];
  259. + }regmux_info_t;
  260. +
  261. + static void *pinmux_instance = NULL;
  262. +@@ -75,30 +79,126 @@ iot2050_get_regmux_by_pinmap(int pinmap)
  263. + return NULL;
  264. + }
  265. +
  266. ++static mraa_result_t
  267. ++iot2050_mux_debugfs(const char *base_dir, const char *group, const char *function, mraa_gpio_mode_t gpio_mode)
  268. ++{
  269. ++ FILE *fd = NULL;
  270. ++ char p_pinmux[PATH_MAX];
  271. ++ char mux[MRAA_PIN_NAME_SIZE];
  272. ++ int ret;
  273. ++
  274. ++ syslog(LOG_DEBUG, "iot2050: debugfs: enter\n");
  275. ++
  276. ++ if (!base_dir || !group || !function) {
  277. ++ syslog(LOG_ERR, "iot2050: debugfs: Invalid parameter base_dir=%s, group=%s, function=%s!\n", base_dir, group, function);
  278. ++ return MRAA_ERROR_INVALID_PARAMETER;
  279. ++ }
  280. ++
  281. ++ ret = snprintf(p_pinmux, PATH_MAX, "/sys/kernel/debug/pinctrl/%s/pinmux-select", base_dir);
  282. ++ if (ret < 0) {
  283. ++ ret = MRAA_ERROR_UNSPECIFIED;
  284. ++ goto err;
  285. ++ }
  286. ++
  287. ++ fd = fopen(p_pinmux, "w");
  288. ++ if (!fd) {
  289. ++ ret = MRAA_ERROR_INVALID_RESOURCE;
  290. ++ goto err;
  291. ++ }
  292. ++
  293. ++ switch (gpio_mode) {
  294. ++ case MRAA_GPIO_PULLUP:
  295. ++ snprintf(mux, MRAA_PIN_NAME_SIZE, "%s-%s", group, "pullup");
  296. ++ break;
  297. ++ case MRAA_GPIO_PULLDOWN:
  298. ++ snprintf(mux, MRAA_PIN_NAME_SIZE, "%s-%s", group, "pulldown");
  299. ++ break;
  300. ++ default:
  301. ++ strncpy(mux, group, MRAA_PIN_NAME_SIZE);
  302. ++ }
  303. ++
  304. ++ syslog(LOG_DEBUG, "iot2050: debugfs: group: %s, function: %s\n", mux, mux);
  305. ++
  306. ++ ret = fprintf(fd, "%s %s\n", mux, mux);
  307. ++ if (ret < 0) {
  308. ++ ret = MRAA_ERROR_UNSPECIFIED;
  309. ++ goto err_close;
  310. ++ }
  311. ++
  312. ++ fclose(fd);
  313. ++ return MRAA_SUCCESS;
  314. ++
  315. ++err_close:
  316. ++ fclose(fd);
  317. ++err:
  318. ++ syslog(LOG_ERR, "iot2050: debugfs: Pinmux failed(%d)! group: %s, function: %s", ret, group, function);
  319. ++ return ret;
  320. ++}
  321. ++
  322. ++static mraa_result_t
  323. ++iot2050_mux_mmap(int phy_pin, int mode, mraa_gpio_mode_t gpio_mode)
  324. ++{
  325. ++ int8_t mux_mode;
  326. ++ regmux_info_t *info = &pinmux_info[phy_pin];
  327. ++
  328. ++ syslog(LOG_ERR, "iot2050: mmap: Debugfs pinmux failed! Falling back to mmap!");
  329. ++
  330. ++ pinmux_instance = platfrom_pinmux_get_instance("iot2050");
  331. ++ if (!pinmux_instance) {
  332. ++ syslog(LOG_ERR, "iot2050: mmap: Pinmux failed! Can't get pinmux instance!");
  333. ++ return MRAA_ERROR_INVALID_RESOURCE;
  334. ++ }
  335. ++
  336. ++ mux_mode = info->mode[mode];
  337. ++ if (mux_mode < 0) {
  338. ++ return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
  339. ++ }
  340. ++
  341. ++ syslog(LOG_DEBUG, "REGMUX[phy_pin %d] group %d index %d mode %d\n", phy_pin, info->group, info->index, mux_mode);
  342. ++
  343. ++ platform_pinmux_select_func(pinmux_instance, info->group, info->index, mux_mode);
  344. ++ /* Configure as input and output for default */
  345. ++ platform_pinmux_select_inout(pinmux_instance, info->group, info->index);
  346. ++
  347. ++ switch (gpio_mode) {
  348. ++ case MRAA_GPIO_PULLUP:
  349. ++ platform_pinmux_select_pull_up(pinmux_instance, info->group, info->index);
  350. ++ break;
  351. ++ case MRAA_GPIO_PULLDOWN:
  352. ++ platform_pinmux_select_pull_down(pinmux_instance, info->group, info->index);
  353. ++ break;
  354. ++ default:
  355. ++ break;
  356. ++ }
  357. ++ return MRAA_SUCCESS;
  358. ++}
  359. ++
  360. ++
  361. + static mraa_result_t
  362. + iot2050_mux_init_reg(int phy_pin, int mode)
  363. + {
  364. + regmux_info_t *info = &pinmux_info[phy_pin];
  365. + int8_t mux_mode;
  366. ++ mraa_result_t ret;
  367. +
  368. + if((phy_pin < 0) || (phy_pin > MRAA_IOT2050_PINCOUNT))
  369. + return MRAA_SUCCESS;
  370. + if((mode < 0) || (mode >= MAX_MUX_REGISTER_MODE)) {
  371. + return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
  372. + }
  373. +- if(mode == MUX_REGISTER_MODE_AIO) {
  374. ++ /* Dedicated SoC pins that have been statically defined in DTB */
  375. ++ if(mode == MUX_REGISTER_MODE_AIO || mode == MUX_REGISTER_MODE_I2C) {
  376. + return MRAA_SUCCESS;
  377. + }
  378. + mux_mode = info->mode[mode];
  379. + if(mux_mode < 0) {
  380. + return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
  381. + }
  382. +- syslog(LOG_DEBUG, "REGMUX[phy_pin %d] group %d index %d mode %d\n", phy_pin, info->group, info->index, mux_mode);
  383. +
  384. +- platform_pinmux_select_func(pinmux_instance, info->group, info->index, mux_mode);
  385. +- /* Configure as input and output for default */
  386. +- platform_pinmux_select_inout(pinmux_instance, info->group, info->index);
  387. +- return MRAA_SUCCESS;
  388. ++ ret = iot2050_mux_debugfs(info->debugfs_path[mode], info->pmx_group[mode], info->pmx_function[mode], 0);
  389. ++ if (ret != MRAA_SUCCESS)
  390. ++ return iot2050_mux_mmap(phy_pin, mode, 0);
  391. ++ return ret;
  392. + }
  393. +
  394. + static mraa_result_t
  395. +@@ -172,7 +272,10 @@ iot2050_gpio_mode_replace(mraa_gpio_context dev, mraa_gpio_mode_t mode)
  396. + goto failed;
  397. + }
  398. + if(info) {
  399. +- platform_pinmux_select_pull_up(pinmux_instance, info->group, info->index);
  400. ++ ret = iot2050_mux_debugfs(info->debugfs_path[0], info->pmx_group[0], info->pmx_function[0], mode);
  401. ++ if (ret != MRAA_SUCCESS)
  402. ++ ret = iot2050_mux_mmap(dev->phy_pin, 0, mode);
  403. ++
  404. + }
  405. + break;
  406. + case MRAA_GPIO_PULLDOWN:
  407. +@@ -181,7 +284,9 @@ iot2050_gpio_mode_replace(mraa_gpio_context dev, mraa_gpio_mode_t mode)
  408. + goto failed;
  409. + }
  410. + if(info) {
  411. +- platform_pinmux_select_pull_down(pinmux_instance, info->group, info->index);
  412. ++ ret = iot2050_mux_debugfs(info->debugfs_path[0], info->pmx_group[0], info->pmx_function[0], mode);
  413. ++ if (ret != MRAA_SUCCESS)
  414. ++ ret = iot2050_mux_mmap(dev->phy_pin, 0, mode);
  415. + }
  416. + break;
  417. + case MRAA_GPIO_HIZ:
  418. +@@ -191,7 +296,9 @@ iot2050_gpio_mode_replace(mraa_gpio_context dev, mraa_gpio_mode_t mode)
  419. + goto failed;
  420. + }
  421. + if(info) {
  422. +- platform_pinmux_select_pull_disable(pinmux_instance, info->group, info->index);
  423. ++ ret = iot2050_mux_debugfs(info->debugfs_path[0], info->pmx_group[0], info->pmx_function[0], mode);
  424. ++ if (ret != MRAA_SUCCESS)
  425. ++ ret = iot2050_mux_mmap(dev->phy_pin, 0, mode);
  426. + }
  427. + break;
  428. + case MRAA_GPIOD_ACTIVE_LOW:
  429. +@@ -455,7 +562,7 @@ mraa_siemens_iot2050()
  430. + free(b->adv_func);
  431. + goto error;
  432. + }
  433. +- pinmux_instance = platfrom_pinmux_get_instance("iot2050");
  434. ++
  435. + /* IO */
  436. + iot2050_setup_pins(b, pin_index, "IO0",
  437. + (mraa_pincapabilities_t) {
  438. +@@ -477,6 +584,27 @@ mraa_siemens_iot2050()
  439. + -1, /*I2C*/
  440. + -1, /*SPI*/
  441. + -1 /*PWM*/
  442. ++ },
  443. ++ {
  444. ++ "4301c000.pinctrl-pinctrl-single",
  445. ++ "4301c000.pinctrl-pinctrl-single",
  446. ++ NULL,
  447. ++ NULL,
  448. ++ NULL
  449. ++ },
  450. ++ {
  451. ++ "d0-gpio",
  452. ++ "d0-uart0-rxd",
  453. ++ NULL,
  454. ++ NULL,
  455. ++ NULL
  456. ++ },
  457. ++ {
  458. ++ "d0-gpio",
  459. ++ "d0-uart0-rxd",
  460. ++ NULL,
  461. ++ NULL,
  462. ++ NULL
  463. + }
  464. + });
  465. +
  466. +@@ -510,6 +638,27 @@ mraa_siemens_iot2050()
  467. + -1, /*I2C*/
  468. + -1, /*SPI*/
  469. + -1 /*PWM*/
  470. ++ },
  471. ++ {
  472. ++ "4301c000.pinctrl-pinctrl-single",
  473. ++ "4301c000.pinctrl-pinctrl-single",
  474. ++ NULL,
  475. ++ NULL,
  476. ++ NULL
  477. ++ },
  478. ++ {
  479. ++ "d1-gpio",
  480. ++ "d1-uart0-txd",
  481. ++ NULL,
  482. ++ NULL,
  483. ++ NULL
  484. ++ },
  485. ++ {
  486. ++ "d1-gpio",
  487. ++ "d1-uart0-txd",
  488. ++ NULL,
  489. ++ NULL,
  490. ++ NULL
  491. + }
  492. + });
  493. + iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 30, d4201_gpio_base+1, d4202_gpio_base+1, NULL, 0);
  494. +@@ -542,6 +691,27 @@ mraa_siemens_iot2050()
  495. + -1, /*I2C*/
  496. + -1, /*SPI*/
  497. + -1 /*PWM*/
  498. ++ },
  499. ++ {
  500. ++ "4301c000.pinctrl-pinctrl-single",
  501. ++ "4301c000.pinctrl-pinctrl-single",
  502. ++ NULL,
  503. ++ NULL,
  504. ++ NULL
  505. ++ },
  506. ++ {
  507. ++ "d2-gpio",
  508. ++ "d2-uart0-ctsn",
  509. ++ NULL,
  510. ++ NULL,
  511. ++ NULL
  512. ++ },
  513. ++ {
  514. ++ "d2-gpio",
  515. ++ "d2-uart0-ctsn",
  516. ++ NULL,
  517. ++ NULL,
  518. ++ NULL
  519. + }
  520. + });
  521. + iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 31, d4201_gpio_base+2, d4202_gpio_base+2, NULL, 0);
  522. +@@ -574,6 +744,27 @@ mraa_siemens_iot2050()
  523. + -1, /*I2C*/
  524. + -1, /*SPI*/
  525. + -1 /*PWM*/
  526. ++ },
  527. ++ {
  528. ++ "4301c000.pinctrl-pinctrl-single",
  529. ++ "4301c000.pinctrl-pinctrl-single",
  530. ++ NULL,
  531. ++ NULL,
  532. ++ NULL
  533. ++ },
  534. ++ {
  535. ++ "d3-gpio",
  536. ++ "d3-uart0-rtsn",
  537. ++ NULL,
  538. ++ NULL,
  539. ++ NULL
  540. ++ },
  541. ++ {
  542. ++ "d3-gpio",
  543. ++ "d3-uart0-rtsn",
  544. ++ NULL,
  545. ++ NULL,
  546. ++ NULL
  547. + }
  548. + });
  549. + iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 33, d4201_gpio_base+3, d4202_gpio_base+3, NULL, 0);
  550. +@@ -606,6 +797,27 @@ mraa_siemens_iot2050()
  551. + -1, /*I2C*/
  552. + -1, /*SPI*/
  553. + 5 /*PWM*/
  554. ++ },
  555. ++ {
  556. ++ "11c000.pinctrl-pinctrl-single",
  557. ++ NULL,
  558. ++ NULL,
  559. ++ NULL,
  560. ++ "11c000.pinctrl-pinctrl-single"
  561. ++ },
  562. ++ {
  563. ++ "d4-gpio",
  564. ++ NULL,
  565. ++ NULL,
  566. ++ NULL,
  567. ++ "d4-ehrpwm0-a"
  568. ++ },
  569. ++ {
  570. ++ "d4-gpio",
  571. ++ NULL,
  572. ++ NULL,
  573. ++ NULL,
  574. ++ "d4-ehrpwm0-a"
  575. + }
  576. + });
  577. + iot2050_pin_add_gpio(b, pin_index, main_gpio0_chip, 33, d4201_gpio_base+4, d4202_gpio_base+4, NULL, 0);
  578. +@@ -638,6 +850,27 @@ mraa_siemens_iot2050()
  579. + -1, /*I2C*/
  580. + -1, /*SPI*/
  581. + 5 /*PWM*/
  582. ++ },
  583. ++ {
  584. ++ "11c000.pinctrl-pinctrl-single",
  585. ++ NULL,
  586. ++ NULL,
  587. ++ NULL,
  588. ++ "11c000.pinctrl-pinctrl-single"
  589. ++ },
  590. ++ {
  591. ++ "d5-gpio",
  592. ++ NULL,
  593. ++ NULL,
  594. ++ NULL,
  595. ++ "d5-ehrpwm1-a"
  596. ++ },
  597. ++ {
  598. ++ "d5-gpio",
  599. ++ NULL,
  600. ++ NULL,
  601. ++ NULL,
  602. ++ "d5-ehrpwm1-a"
  603. + }
  604. + });
  605. + iot2050_pin_add_gpio(b, pin_index, main_gpio0_chip, 35, d4201_gpio_base+5, d4202_gpio_base+5, NULL, 0);
  606. +@@ -670,6 +903,27 @@ mraa_siemens_iot2050()
  607. + -1, /*I2C*/
  608. + -1, /*SPI*/
  609. + 5 /*PWM*/
  610. ++ },
  611. ++ {
  612. ++ "11c000.pinctrl-pinctrl-single",
  613. ++ NULL,
  614. ++ NULL,
  615. ++ NULL,
  616. ++ "11c000.pinctrl-pinctrl-single"
  617. ++ },
  618. ++ {
  619. ++ "d6-gpio",
  620. ++ NULL,
  621. ++ NULL,
  622. ++ NULL,
  623. ++ "d6-ehrpwm2-a"
  624. ++ },
  625. ++ {
  626. ++ "d6-gpio",
  627. ++ NULL,
  628. ++ NULL,
  629. ++ NULL,
  630. ++ "d6-ehrpwm2-a"
  631. + }
  632. + });
  633. + iot2050_pin_add_gpio(b, pin_index, main_gpio0_chip, 38, d4201_gpio_base+6, d4202_gpio_base+6, NULL, 0);
  634. +@@ -702,6 +956,27 @@ mraa_siemens_iot2050()
  635. + -1, /*I2C*/
  636. + -1, /*SPI*/
  637. + 5 /*PWM*/
  638. ++ },
  639. ++ {
  640. ++ "11c000.pinctrl-pinctrl-single",
  641. ++ NULL,
  642. ++ NULL,
  643. ++ NULL,
  644. ++ "11c000.pinctrl-pinctrl-single"
  645. ++ },
  646. ++ {
  647. ++ "d7-gpio",
  648. ++ NULL,
  649. ++ NULL,
  650. ++ NULL,
  651. ++ "d7-ehrpwm3-a"
  652. ++ },
  653. ++ {
  654. ++ "d7-gpio",
  655. ++ NULL,
  656. ++ NULL,
  657. ++ NULL,
  658. ++ "d7-ehrpwm3-a"
  659. + }
  660. + });
  661. + iot2050_pin_add_gpio(b, pin_index, main_gpio0_chip, 43, d4201_gpio_base+7, d4202_gpio_base+7, NULL, 0);
  662. +@@ -734,6 +1009,27 @@ mraa_siemens_iot2050()
  663. + -1, /*I2C*/
  664. + -1, /*SPI*/
  665. + 5 /*PWM*/
  666. ++ },
  667. ++ {
  668. ++ "11c000.pinctrl-pinctrl-single",
  669. ++ NULL,
  670. ++ NULL,
  671. ++ NULL,
  672. ++ "11c000.pinctrl-pinctrl-single"
  673. ++ },
  674. ++ {
  675. ++ "d8-gpio",
  676. ++ NULL,
  677. ++ NULL,
  678. ++ NULL,
  679. ++ "d8-ehrpwm4-a"
  680. ++ },
  681. ++ {
  682. ++ "d8-gpio",
  683. ++ NULL,
  684. ++ NULL,
  685. ++ NULL,
  686. ++ "d8-ehrpwm4-a"
  687. + }
  688. + });
  689. + iot2050_pin_add_gpio(b, pin_index, main_gpio0_chip, 48, d4201_gpio_base+8, d4202_gpio_base+8, NULL, 0);
  690. +@@ -766,6 +1062,27 @@ mraa_siemens_iot2050()
  691. + -1, /*I2C*/
  692. + -1, /*SPI*/
  693. + 5 /*PWM*/
  694. ++ },
  695. ++ {
  696. ++ "11c000.pinctrl-pinctrl-single",
  697. ++ NULL,
  698. ++ NULL,
  699. ++ NULL,
  700. ++ "11c000.pinctrl-pinctrl-single"
  701. ++ },
  702. ++ {
  703. ++ "d9-gpio",
  704. ++ NULL,
  705. ++ NULL,
  706. ++ NULL,
  707. ++ "d9-ehrpwm5-a"
  708. ++ },
  709. ++ {
  710. ++ "d9-gpio",
  711. ++ NULL,
  712. ++ NULL,
  713. ++ NULL,
  714. ++ "d9-ehrpwm5-a"
  715. + }
  716. + });
  717. + iot2050_pin_add_gpio(b, pin_index, main_gpio0_chip, 51, d4201_gpio_base+9, d4202_gpio_base+9, NULL, 0);
  718. +@@ -798,6 +1115,27 @@ mraa_siemens_iot2050()
  719. + -1, /*I2C*/
  720. + 0, /*SPI*/
  721. + -1 /*PWM*/
  722. ++ },
  723. ++ {
  724. ++ "4301c000.pinctrl-pinctrl-single",
  725. ++ NULL,
  726. ++ NULL,
  727. ++ "4301c000.pinctrl-pinctrl-single",
  728. ++ NULL
  729. ++ },
  730. ++ {
  731. ++ "d10-gpio",
  732. ++ NULL,
  733. ++ NULL,
  734. ++ "d10-spi0-cs0",
  735. ++ NULL
  736. ++ },
  737. ++ {
  738. ++ "d10-gpio",
  739. ++ NULL,
  740. ++ NULL,
  741. ++ "d10-spi0-cs0",
  742. ++ NULL
  743. + }
  744. + });
  745. + iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 51, d4201_gpio_base+10, d4202_gpio_base+10, NULL, 0);
  746. +@@ -830,6 +1168,27 @@ mraa_siemens_iot2050()
  747. + -1, /*I2C*/
  748. + 0, /*SPI*/
  749. + -1 /*PWM*/
  750. ++ },
  751. ++ {
  752. ++ "4301c000.pinctrl-pinctrl-single",
  753. ++ NULL,
  754. ++ NULL,
  755. ++ "4301c000.pinctrl-pinctrl-single",
  756. ++ NULL
  757. ++ },
  758. ++ {
  759. ++ "d11-gpio",
  760. ++ NULL,
  761. ++ NULL,
  762. ++ "d11-spi0-d0",
  763. ++ NULL
  764. ++ },
  765. ++ {
  766. ++ "d11-gpio",
  767. ++ NULL,
  768. ++ NULL,
  769. ++ "d11-spi0-d0",
  770. ++ NULL
  771. + }
  772. + });
  773. + iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 49, d4201_gpio_base+11, d4202_gpio_base+11, NULL, 0);
  774. +@@ -862,6 +1221,27 @@ mraa_siemens_iot2050()
  775. + -1, /*I2C*/
  776. + 0, /*SPI*/
  777. + -1 /*PWM*/
  778. ++ },
  779. ++ {
  780. ++ "4301c000.pinctrl-pinctrl-single",
  781. ++ NULL,
  782. ++ NULL,
  783. ++ "4301c000.pinctrl-pinctrl-single",
  784. ++ NULL
  785. ++ },
  786. ++ {
  787. ++ "d12-gpio",
  788. ++ NULL,
  789. ++ NULL,
  790. ++ "d12-spi0-d1",
  791. ++ NULL
  792. ++ },
  793. ++ {
  794. ++ "d12-gpio",
  795. ++ NULL,
  796. ++ NULL,
  797. ++ "d12-spi0-d1",
  798. ++ NULL
  799. + }
  800. + });
  801. + iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 50, d4201_gpio_base+12, d4202_gpio_base+12, NULL, 0);
  802. +@@ -894,6 +1274,27 @@ mraa_siemens_iot2050()
  803. + -1, /*I2C*/
  804. + 0, /*SPI*/
  805. + -1 /*PWM*/
  806. ++ },
  807. ++ {
  808. ++ "4301c000.pinctrl-pinctrl-single",
  809. ++ NULL,
  810. ++ NULL,
  811. ++ "4301c000.pinctrl-pinctrl-single",
  812. ++ NULL
  813. ++ },
  814. ++ {
  815. ++ "d13-gpio",
  816. ++ NULL,
  817. ++ NULL,
  818. ++ "d13-spi0-clk",
  819. ++ NULL
  820. ++ },
  821. ++ {
  822. ++ "d13-gpio",
  823. ++ NULL,
  824. ++ NULL,
  825. ++ "d13-spi0-clk",
  826. ++ NULL
  827. + }
  828. + });
  829. + iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 48, d4201_gpio_base+13, d4202_gpio_base+13, NULL, 0);
  830. +@@ -926,6 +1327,27 @@ mraa_siemens_iot2050()
  831. + -1, /*I2C*/
  832. + -1, /*SPI*/
  833. + -1 /*PWM*/
  834. ++ },
  835. ++ {
  836. ++ "4301c000.pinctrl-pinctrl-single",
  837. ++ NULL,
  838. ++ NULL,
  839. ++ NULL,
  840. ++ NULL
  841. ++ },
  842. ++ {
  843. ++ "a0-gpio",
  844. ++ NULL,
  845. ++ NULL,
  846. ++ NULL,
  847. ++ NULL
  848. ++ },
  849. ++ {
  850. ++ "a0-gpio",
  851. ++ NULL,
  852. ++ NULL,
  853. ++ NULL,
  854. ++ NULL
  855. + }
  856. + });
  857. + mux_info[0].pin = d4200_gpio_base+8;
  858. +@@ -971,6 +1393,27 @@ mraa_siemens_iot2050()
  859. + -1, /*I2C*/
  860. + -1, /*SPI*/
  861. + -1 /*PWM*/
  862. ++ },
  863. ++ {
  864. ++ "4301c000.pinctrl-pinctrl-single",
  865. ++ NULL,
  866. ++ NULL,
  867. ++ NULL,
  868. ++ NULL
  869. ++ },
  870. ++ {
  871. ++ "a1-gpio",
  872. ++ NULL,
  873. ++ NULL,
  874. ++ NULL,
  875. ++ NULL
  876. ++ },
  877. ++ {
  878. ++ "a1-gpio",
  879. ++ NULL,
  880. ++ NULL,
  881. ++ NULL,
  882. ++ NULL
  883. + }
  884. + });
  885. + mux_info[0].pin = d4200_gpio_base+9;
  886. +@@ -1016,6 +1459,27 @@ mraa_siemens_iot2050()
  887. + -1, /*I2C*/
  888. + -1, /*SPI*/
  889. + -1 /*PWM*/
  890. ++ },
  891. ++ {
  892. ++ "4301c000.pinctrl-pinctrl-single",
  893. ++ NULL,
  894. ++ NULL,
  895. ++ NULL,
  896. ++ NULL
  897. ++ },
  898. ++ {
  899. ++ "a2-gpio",
  900. ++ NULL,
  901. ++ NULL,
  902. ++ NULL,
  903. ++ NULL
  904. ++ },
  905. ++ {
  906. ++ "a2-gpio",
  907. ++ NULL,
  908. ++ NULL,
  909. ++ NULL,
  910. ++ NULL
  911. + }
  912. + });
  913. + mux_info[0].pin = d4200_gpio_base+10;
  914. +@@ -1061,6 +1525,27 @@ mraa_siemens_iot2050()
  915. + -1, /*I2C*/
  916. + -1, /*SPI*/
  917. + -1 /*PWM*/
  918. ++ },
  919. ++ {
  920. ++ "4301c000.pinctrl-pinctrl-single",
  921. ++ NULL,
  922. ++ NULL,
  923. ++ NULL,
  924. ++ NULL
  925. ++ },
  926. ++ {
  927. ++ "a3-gpio",
  928. ++ NULL,
  929. ++ NULL,
  930. ++ NULL,
  931. ++ NULL
  932. ++ },
  933. ++ {
  934. ++ "a3-gpio",
  935. ++ NULL,
  936. ++ NULL,
  937. ++ NULL,
  938. ++ NULL
  939. + }
  940. + });
  941. + mux_info[0].pin = d4200_gpio_base+11;
  942. +@@ -1106,6 +1591,27 @@ mraa_siemens_iot2050()
  943. + 0, /*I2C*/
  944. + -1, /*SPI*/
  945. + -1 /*PWM*/
  946. ++ },
  947. ++ {
  948. ++ "4301c000.pinctrl-pinctrl-single",
  949. ++ NULL,
  950. ++ NULL,
  951. ++ NULL,
  952. ++ NULL
  953. ++ },
  954. ++ {
  955. ++ "a4-gpio",
  956. ++ NULL,
  957. ++ NULL,
  958. ++ NULL,
  959. ++ NULL
  960. ++ },
  961. ++ {
  962. ++ "a4-gpio",
  963. ++ NULL,
  964. ++ NULL,
  965. ++ NULL,
  966. ++ NULL
  967. + }
  968. + });
  969. + mux_info[0].pin = d4200_gpio_base+12;
  970. +@@ -1169,6 +1675,27 @@ mraa_siemens_iot2050()
  971. + 0, /*I2C*/
  972. + -1, /*SPI*/
  973. + -1 /*PWM*/
  974. ++ },
  975. ++ {
  976. ++ "4301c000.pinctrl-pinctrl-single",
  977. ++ NULL,
  978. ++ NULL,
  979. ++ NULL,
  980. ++ NULL
  981. ++ },
  982. ++ {
  983. ++ "a5-gpio",
  984. ++ NULL,
  985. ++ NULL,
  986. ++ NULL,
  987. ++ NULL
  988. ++ },
  989. ++ {
  990. ++ "a5-gpio",
  991. ++ NULL,
  992. ++ NULL,
  993. ++ NULL,
  994. ++ NULL
  995. + }
  996. + });
  997. + mux_info[0].pin = d4200_gpio_base+13;
  998. +diff --git a/src/arm/siemens/platform.c b/src/arm/siemens/platform.c
  999. +index faa808a4c6d0..fb87a7f2c47a 100644
  1000. +--- a/src/arm/siemens/platform.c
  1001. ++++ b/src/arm/siemens/platform.c
  1002. +@@ -35,7 +35,9 @@ platfrom_pinmux_get_instance(char *platform)
  1003. + if((instance) && (instance->initialized == false) && (instance->ops.init)) {
  1004. + return instance->ops.init()?instance:NULL;
  1005. + }
  1006. +- else {
  1007. ++ else if((instance) && (instance->initialized == true)) {
  1008. ++ return instance;
  1009. ++ } else {
  1010. + return NULL;
  1011. + }
  1012. + }
  1013. diff --git a/package/mraa/mraa.hash b/package/mraa/mraa.hash
  1014. deleted file mode 100644
  1015. index 321b6409ed..0000000000
  1016. --- a/package/mraa/mraa.hash
  1017. +++ /dev/null
  1018. @@ -1,3 +0,0 @@
  1019. -# Locally calculated
  1020. -sha256 076669bee8423ffef3065735b293a329020be86630fea457174dbfcc67a0554a mraa-2.2.0.tar.gz
  1021. -sha256 fac52622ed3badd86b34857b21777ab90296d6ccbc2ac0fd457c09fdeefa9ef1 COPYING
  1022. diff --git a/package/mraa/mraa.mk b/package/mraa/mraa.mk
  1023. index 47178a423b..78db12120a 100644
  1024. --- a/package/mraa/mraa.mk
  1025. +++ b/package/mraa/mraa.mk
  1026. @@ -4,8 +4,8 @@
  1027. #
  1028. ################################################################################
  1029. -MRAA_VERSION = 2.2.0
  1030. -MRAA_SITE = $(call github,eclipse,mraa,v$(MRAA_VERSION))
  1031. +MRAA_VERSION = 8b1c54934e80edc2d36abac9d9c96fe1e01cb669
  1032. +MRAA_SITE = $(call github,eclipse,mraa,$(MRAA_VERSION))
  1033. MRAA_LICENSE = MIT
  1034. MRAA_LICENSE_FILES = COPYING
  1035. MRAA_INSTALL_STAGING = YES