-static int flexcan_enabled(void *blob)
-{
- const char *status;
- int off = fdt_path_offset(blob, "can0");
-
- if (off < 0) {
- printf("node 'can0' not found\n");
- } else {
- status = fdt_getprop(blob, off, "status", NULL);
- if (status && strcmp(status, "okay") == 0) {
- printf("can0 is enabled\n");
- return 1;
- }
- }
- off = fdt_path_offset(blob, "can1");
- if (off < 0) {
- printf("node 'can1' not found\n");
- return 0;
- }
- status = fdt_getprop(blob, off, "status", NULL);
- if (status && strcmp(status, "okay") == 0) {
- printf("can1 is enabled\n");
- return 1;
- }
- printf("can driver disabled\n");
- return 0;
-}
-
-static void tx28_set_lcd_pins(void *blob, const char *name)
-{
- int off = fdt_path_offset(blob, name);
- u32 ph;
- const struct fdt_property *pc;
- int len;
-
- if (off < 0)
- return;
-
- ph = fdt32_to_cpu(fdt_create_phandle(blob, off));
- if (!ph)
- return;
-
- off = fdt_path_offset(blob, "lcdif");
- if (off < 0)
- return;
-
- pc = fdt_get_property(blob, off, "pinctrl-0", &len);
- if (!pc || len < sizeof(ph))
- return;
-
- memcpy((void *)pc->data, &ph, sizeof(ph));
- fdt_setprop(blob, off, "pinctrl-0", pc->data, len);
-}
-
-static void tx28_fixup_flexcan(void *blob, int stk5_v5)
-{
- const char *can_xcvr = "disabled";
-
- if (stk5_v5) {
- if (flexcan_enabled(blob)) {
- tx28_set_lcd_pins(blob, "lcdif_23bit_pins_a");
- can_xcvr = "okay";
- } else {
- tx28_set_lcd_pins(blob, "lcdif_24bit_pins_a");
- }
- } else {
- const char *otg_mode = getenv("otg_mode");
-
- if (otg_mode && (strcmp(otg_mode, "host") == 0))
- karo_fdt_enable_node(blob, "can1", 0);
- }
- fdt_find_and_setprop(blob, "/regulators/can-xcvr", "status",
- can_xcvr, strlen(can_xcvr) + 1, 1);
-}
-
-static void tx28_fixup_fec(void *blob)
-{
- karo_fdt_enable_node(blob, "ethernet1", 0);
-}