-
Notifications
You must be signed in to change notification settings - Fork 0
TS-7100 updates #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| AUTOMAKE_OPTIONS = foreign | ||
| SUBDIRS = src | ||
| SUBDIRS = src scripts |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| bin_SCRIPTS = splash-convert |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
| #include <stdint.h> | ||
| #include <endian.h> | ||
| #include <string.h> | ||
| #include <errno.h> | ||
|
|
||
| int get_model(void) | ||
| { | ||
|
|
@@ -29,3 +31,25 @@ int get_model(void) | |
|
|
||
| return ret; | ||
| } | ||
|
|
||
| int chosen_read_u32(const char *name, uint32_t *value) | ||
| { | ||
| char path[256]; | ||
| FILE *fp; | ||
| uint32_t be_val; | ||
| size_t n; | ||
|
|
||
| snprintf(path, sizeof(path), "/sys/firmware/devicetree/base/chosen/%s", name); | ||
|
|
||
| fp = fopen(path, "rb"); | ||
| if (!fp) | ||
| return errno; | ||
| n = fread(&be_val, 1, sizeof(be_val), fp); | ||
| fclose(fp); | ||
|
|
||
| if (n != sizeof(be_val)) | ||
| return EIO; | ||
|
Comment on lines
+50
to
+51
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something to keep in mind in the future, when returning an error code we probably want to follow along with how |
||
|
|
||
| *value = be32toh(be_val); | ||
| return 0; | ||
| } | ||
|
Comment on lines
+35
to
+55
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This all uses 4 space indenting, should be tabs |
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,6 @@ | |||||||||
| #include <stdlib.h> | ||||||||||
| #include <string.h> | ||||||||||
| #include <unistd.h> | ||||||||||
| #include "eval_cmdline.h" | ||||||||||
| #include "fpga.h" | ||||||||||
| #include "helpers.h" | ||||||||||
|
|
||||||||||
|
|
@@ -24,17 +23,36 @@ int model = 0; | |||||||||
|
|
||||||||||
| void do_info(void) | ||||||||||
| { | ||||||||||
| fpga_init(0x50004000); | ||||||||||
| eval_cmd_init(); | ||||||||||
| int ret; | ||||||||||
|
|
||||||||||
| fpga_init(0x50004000); | ||||||||||
| printf("MODEL=%X\n", model); | ||||||||||
|
|
||||||||||
| if(model == 0x7100) { | ||||||||||
| printf("FPGA_REV=0x%X\n", fpeek32(0x0) >> 16); | ||||||||||
| printf("CPU_OPTS=0x%X\n", eval_cmd("cpu_opts")); | ||||||||||
| printf("IO_OPTS=0x%X\n", eval_cmd("io_opts")); | ||||||||||
| printf("IO_MODEL=0x%X\n", eval_cmd("io_model")); | ||||||||||
| } else if(model == 0x7250) { | ||||||||||
| if (model == 0x7100) { | ||||||||||
| uint32_t cpu_options, io_options, io_model; | ||||||||||
|
|
||||||||||
| ret = chosen_read_u32("cpu-options", &cpu_options); | ||||||||||
| if (ret) { | ||||||||||
| fprintf(stderr, "cpu-options missing from device-tree chosen.\n" | ||||||||||
| "This may be an outdated u-boot\n"); | ||||||||||
|
Comment on lines
+36
to
+37
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| return; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| ret = chosen_read_u32("io-options", &io_options); | ||||||||||
| if (ret) { | ||||||||||
| return; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| ret = chosen_read_u32("io-model", &io_model); | ||||||||||
| if (ret) { | ||||||||||
| return; | ||||||||||
| } | ||||||||||
|
Comment on lines
+35
to
+49
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rest of codebase looks like it does not add braces for single line following an if, suggest these change to for consistency. EDIT: This would only apply to lines 41-49 above, I accidentally highlighted too far back. |
||||||||||
|
|
||||||||||
| printf("FPGA_REV=%d\n", fpeek32(0x0)); | ||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want to understand why this line changed from |
||||||||||
| printf("CPU_OPTS=0x%X\n", cpu_options); | ||||||||||
| printf("IO_OPTS=0x%X\n", io_options); | ||||||||||
| printf("IO_MODEL=0x%X\n", io_model); | ||||||||||
| } else if (model == 0x7250) { | ||||||||||
| uint32_t fpga_rev = fpeek32(0x0); | ||||||||||
| uint32_t fpga_hash = fpeek32(0x4); | ||||||||||
| uint32_t opts = fpeek32(0x8); | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, if we just return
-1here,errnowould get passed just the same.