diff --git a/recipes-extra/barebox-state/barebox-state.bb b/recipes-extra/barebox-state/barebox-state.bb index d4ce730..11567f5 100644 --- a/recipes-extra/barebox-state/barebox-state.bb +++ b/recipes-extra/barebox-state/barebox-state.bb @@ -1,9 +1,14 @@ DESCRIPTION = "barebox state tool (dt)" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=9ac2e7cff1ddaf48b6eab6028f23ef88" -PR = "r0" +PR = "r2" -SRC_URI = "git://git.pengutronix.de/git/tools/dt-utils.git" +SRC_URI = "\ + git://git.pengutronix.de/git/tools/dt-utils.git\ + file://0001-barebox-state-fix-typo.patch\ + file://0002-barebox-state-add-support-for-uint8-variables.patch\ + file://0003-hardcode-sysmobts-values.patch\ +" PACKAGES =+ "libdt-utils barebox-fdtdump" diff --git a/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0001-barebox-state-fix-typo.patch b/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0001-barebox-state-fix-typo.patch new file mode 100644 index 0000000..0aa1a6e --- /dev/null +++ b/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0001-barebox-state-fix-typo.patch @@ -0,0 +1,26 @@ +From bd5d86df489c7620b02537fd2a3fd2725125056f Mon Sep 17 00:00:00 2001 +From: Jan Luebbe +Date: Sat, 30 May 2015 19:44:54 +0200 +Subject: [PATCH 1/3] barebox-state: fix typo + +Signed-off-by: Jan Luebbe +--- + src/barebox-state.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/barebox-state.c b/src/barebox-state.c +index 61ea160..57305c4 100644 +--- a/src/barebox-state.c ++++ b/src/barebox-state.c +@@ -1698,7 +1698,7 @@ static struct state *state_get(const char *name) + + state = state_new_from_node(node->name, node); + if (IS_ERR(state)) { +- fprintf(stderr, "unable to initlialize state: %s\n", ++ fprintf(stderr, "unable to initialize state: %s\n", + strerror(PTR_ERR(state))); + return ERR_CAST(state); + } +-- +2.1.4 + diff --git a/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0002-barebox-state-add-support-for-uint8-variables.patch b/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0002-barebox-state-add-support-for-uint8-variables.patch new file mode 100644 index 0000000..2518895 --- /dev/null +++ b/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0002-barebox-state-add-support-for-uint8-variables.patch @@ -0,0 +1,73 @@ +From cada2ed0b4ca0d467621fa90de304421e17b4869 Mon Sep 17 00:00:00 2001 +From: Jan Luebbe +Date: Sat, 30 May 2015 19:52:55 +0200 +Subject: [PATCH 2/3] barebox-state: add support for uint8 variables + +Signed-off-by: Jan Luebbe +--- + src/barebox-state.c | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/src/barebox-state.c b/src/barebox-state.c +index 57305c4..f56275f 100644 +--- a/src/barebox-state.c ++++ b/src/barebox-state.c +@@ -81,6 +81,7 @@ struct state_backend { + enum state_variable_type { + STATE_TYPE_INVALID = 0, + STATE_TYPE_ENUM, ++ STATE_TYPE_U8, + STATE_TYPE_U32, + STATE_TYPE_MAC, + }; +@@ -185,6 +186,32 @@ static int state_uint32_import(struct state_variable *sv, + return 0; + } + ++static struct state_variable *state_uint8_create(struct state *state, ++ const char *name, struct device_node *node) ++{ ++ struct state_uint32 *su32; ++ struct param_d *param; ++ ++ su32 = xzalloc(sizeof(*su32)); ++ ++ param = dev_add_param_int(&state->dev, name, state_set_dirty, ++ NULL, &su32->value, "%u", state); ++ if (IS_ERR(param)) { ++ free(su32); ++ return ERR_CAST(param); ++ } ++ ++ su32->param = param; ++ su32->var.size = sizeof(uint8_t); ++#ifdef __LITTLE_ENDIAN ++ su32->var.raw = &su32->value; ++#else ++ su32->var.raw = &su32->value + 3; ++#endif ++ ++ return &su32->var; ++} ++ + static struct state_variable *state_uint32_create(struct state *state, + const char *name, struct device_node *node) + { +@@ -395,6 +422,14 @@ out: + + static struct variable_type types[] = { + { ++ .type = STATE_TYPE_U8, ++ .type_name = "uint8", ++ .export = state_uint32_export, ++ .import = state_uint32_import, ++ .create = state_uint8_create, ++ .set = state_uint32_set, ++ .get = state_uint32_get, ++ }, { + .type = STATE_TYPE_U32, + .type_name = "uint32", + .export = state_uint32_export, +-- +2.1.4 + diff --git a/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0003-hardcode-sysmobts-values.patch b/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0003-hardcode-sysmobts-values.patch new file mode 100644 index 0000000..946eded --- /dev/null +++ b/recipes-extra/barebox-state/barebox-state/sysmobts-v2/0003-hardcode-sysmobts-values.patch @@ -0,0 +1,41 @@ +From 4cc63588211df7bf328e55820cfe19b56ea776b6 Mon Sep 17 00:00:00 2001 +From: Jan Luebbe +Date: Sat, 30 May 2015 20:00:10 +0200 +Subject: [PATCH 3/3] hardcode sysmobts values + +Signed-off-by: Jan Luebbe +--- + src/barebox-state.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/barebox-state.c b/src/barebox-state.c +index f56275f..002ee5c 100644 +--- a/src/barebox-state.c ++++ b/src/barebox-state.c +@@ -1738,6 +1738,7 @@ static struct state *state_get(const char *name) + return ERR_CAST(state); + } + ++#if 0 + partition_node = of_parse_phandle(node, "backend", 0); + if (!partition_node) { + fprintf(stderr, "cannot find backend node in %s\n", node->full_name); +@@ -1750,9 +1751,14 @@ static struct state *state_get(const char *name) + return ERR_PTR(ret); + } + ++#endif ++ devpath = "/sys/bus/i2c/devices/1-0050/eeprom"; ++ offset = 0x25; ++ size = 0x54; ++ + of_property_read_string(node, "backend-type", &backend_type); + if (!strcmp(backend_type, "raw")) +- ret = state_backend_raw_file(state, partition_node->full_name, devpath, offset, size); ++ ret = state_backend_raw_file(state, "/i2c/eeprom@50/partition@0", devpath, offset, size); + else + fprintf(stderr, "invalid backend type: %s\n", backend_type); + +-- +2.1.4 +