of_state_fixup / different path in barebox and kernel
Dear List,
I have a custom board with an AM335x on it. We used to have an I2C EEPROM for keeping the boot state, but moved that to SPI in a subsequent version.
The SPI EEPROM uses gpio-based chip select, which is supported by linux kernel spi-omap2-mcspi.c. However, it is not supported by barebox.
My "solution" was to simply use the gpio-bitbang in barebox, which also works fine for those few bytes that need to be read, performance doesn't matter.
Now however I can no longer boot any kernel image, as of_state_fixup fails in
backend_node = of_find_node_by_path_from(root, state->backend->of_path);
due to the fact that the of-path of the EEPROM is different in the barebox device tree (/spi_gpio/m95m02@0) than in the kernel device tree (/ocp/spi@481a0000/m95m02@0)
Is there any designated solution for this situation?
Thanks in advance,
Harald
Signature · 9 lines
- Harald Welte <[email protected]> http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Harald,
Quoted 9 lines · Harald Welte
Dear List,
I have a custom board with an AM335x on it. We used to have an I2C EEPROM for keeping the boot state, but moved that to SPI in a subsequent version.
The SPI EEPROM uses gpio-based chip select, which is supported by linux kernel
spi-omap2-mcspi.c. However, it is not supported by barebox.
Quoted 8 lines
My "solution" was to simply use the gpio-bitbang in barebox, which also works fine for those few bytes that need to be read, performance doesn't matter.
Now however I can no longer boot any kernel image, as
of_state_fixupfails inbackend_node = of_find_node_by_path_from(root, state->backend->of_path);
In newer versions we have:
commit b62aea561142c6974b593301fbec9ed18381cf8d
Author: Sascha Hauer <[email protected]> Date: Thu Sep 10 15:11:28 2015 +0200
of_fix_tree: do not fail when fixup fails
So at least a failed of_fixup should no longer prevent you from booting.
Quoted 6 lines
due to the fact that the of-path of the EEPROM is different in the barebox device tree (/spi_gpio/m95m02@0) than in the kernel device tree (/ocp/spi@481a0000/m95m02@0)
Is there any designated solution for this situation?
We could introduce a state.of_backend_path variable which holds the path, something like attached. You would then have to change the variable to the correct path somewhere.
Another way I could think of would be to add a possibility to blacklist of_fixups. That would do it aswell since you could provide a correct device tree for the kernel, right?
Sascha
-----------------------------8<-------------------------------
common/state.c +9 -1
@@ -56,7 +56,7 @@ struct state {struct state_backend {int (*save)(struct state_backend *backend,struct state *state);const char *name; -const char *of_path; +char *of_path;const char *path;struct digest *digest; };
@@ -1642,6 +1642,7 @@ int state_backend_raw_file(struct state *state, const char *of_path,struct state_backend *backend;struct state_variable *sv;struct mtd_info_user meminfo; +struct param_d *p;size_t path_size =0 ;int ret;
@@ -1680,6 +1681,13 @@ int state_backend_raw_file(struct state *state, const char *of_path, state->backend = backend; + p =dev_add_param_string (&state->dev,"of_backend_path" ,NULL ,NULL , + &state->backend->of_path,NULL ); +if (IS_ERR (p)) { + ret =PTR_ERR (p); + goto err; + } + ret =mtd_get_meminfo (backend->path, &meminfo);if (!ret && !(meminfo.flags &MTD_NO_ERASE )) { backend_raw->need_erase = true;
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox