This commit is contained in:
coolsnowwolf 2022-10-28 11:25:48 +08:00
commit d574ac301c
42 changed files with 1959 additions and 515 deletions

View File

@ -1,2 +1,2 @@
LINUX_VERSION-6.0 = .3 LINUX_VERSION-6.0 = .5
LINUX_KERNEL_HASH-6.0.3 = b0d522241805794d8af3a67d331ba063a16496c6fb6d365d48f7ed78ee1c3dcf LINUX_KERNEL_HASH-6.0.5 = 61332ef22b53c50c10faabfb965896a7d1ad4f3381f0f89643c820f28a60418e

View File

@ -0,0 +1,32 @@
From 14aa8b2d5c2ebead01b542f62d68029023054774 Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 28 Sep 2022 13:36:58 -0600
Subject: [PATCH 1/1] mm/mglru: don't sync disk for each aging cycle
wakeup_flusher_threads() was added under the assumption that if a system
runs out of clean cold pages, it might want to write back dirty pages more
aggressively so that they can become clean and be dropped.
However, doing so can breach the rate limit a system wants to impose on
writeback, resulting in early SSD wearout.
Link: https://lkml.kernel.org/r/YzSiWq9UEER5LKup@google.com
Fixes: bd74fdaea146 ("mm: multi-gen LRU: support page table walks")
Signed-off-by: Yu Zhao <yuzhao@google.com>
Reported-by: Axel Rasmussen <axelrasmussen@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 2 --
1 file changed, 2 deletions(-)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4072,8 +4072,6 @@ static bool try_to_inc_max_seq(struct lr
if (wq_has_sleeper(&lruvec->mm_walk.wait))
wake_up_all(&lruvec->mm_walk.wait);
- wakeup_flusher_threads(WB_REASON_VMSCAN);
-
return true;
}

View File

@ -0,0 +1,997 @@
From a77725a9a3c5924e2fd4cd5b3557dd92a8e46f87 Mon Sep 17 00:00:00 2001
From: Rob Herring <robh@kernel.org>
Date: Mon, 25 Oct 2021 11:05:45 -0500
Subject: [PATCH 1/1] scripts/dtc: Update to upstream version
v1.6.1-19-g0a3a9d3449c8
This adds the following commits from upstream:
0a3a9d3449c8 checks: Add an interrupt-map check
8fd24744e361 checks: Ensure '#interrupt-cells' only exists in interrupt providers
d8d1a9a77863 checks: Drop interrupt provider '#address-cells' check
52a16fd72824 checks: Make interrupt_provider check dependent on interrupts_extended_is_cell
37fd700685da treesource: Maintain phandle label/path on output
e33ce1d6a8c7 flattree: Use '\n', not ';' to separate asm pseudo-ops
d24cc189dca6 asm: Use assembler macros instead of cpp macros
ff3a30c115ad asm: Use .asciz and .ascii instead of .string
5eb5927d81ee fdtdump: fix -Werror=int-to-pointer-cast
0869f8269161 libfdt: Add ALIGNMENT error string
69595a167f06 checks: Fix bus-range check
72d09e2682a4 Makefile: add -Wsign-compare to warning options
b587787ef388 checks: Fix signedness comparisons warnings
69bed6c2418f dtc: Wrap phandle validity check
910221185560 fdtget: Fix signedness comparisons warnings
d966f08fcd21 tests: Fix signedness comparisons warnings
ecfb438c07fa dtc: Fix signedness comparisons warnings: pointer diff
5bec74a6d135 dtc: Fix signedness comparisons warnings: reservednum
24e7f511fd4a fdtdump: Fix signedness comparisons warnings
b6910bec1161 Bump version to v1.6.1
21d61d18f968 Fix CID 1461557
4c2ef8f4d14c checks: Introduce is_multiple_of()
e59ca36fb70e Make handling of cpp line information more tolerant
0c3fd9b6aceb checks: Drop interrupt_cells_is_cell check
6b3081abc4ac checks: Add check_is_cell() for all phandle+arg properties
2dffc192a77f yamltree: Remove marker ordering dependency
61e513439e40 pylibfdt: Rework "avoid unused variable warning" lines
c8bddd106095 tests: add a positive gpio test case
ad4abfadb687 checks: replace strstr and strrchr with strends
09c6a6e88718 dtc.h: add strends for suffix matching
9bb9b8d0b4a0 checks: tigthen up nr-gpios prop exception
b07b62ee3342 libfdt: Add FDT alignment check to fdt_check_header()
a2def5479950 libfdt: Check that the root-node name is empty
4ca61f84dc21 libfdt: Check that there is only one root node
34d708249a91 dtc: Remove -O dtbo support
8e7ff260f755 libfdt: Fix a possible "unchecked return value" warning
88875268c05c checks: Warn on node-name and property name being the same
9d2279e7e6ee checks: Change node-name check to match devicetree spec
f527c867a8c6 util: limit gnu_printf format attribute to gcc >= 4.4.0
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Tested-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
scripts/dtc/checks.c | 222 ++++++++++++++++++++++--------
scripts/dtc/dtc-lexer.l | 2 +-
scripts/dtc/dtc.c | 6 +-
scripts/dtc/dtc.h | 40 +++++-
scripts/dtc/flattree.c | 11 +-
scripts/dtc/libfdt/fdt.c | 4 +
scripts/dtc/libfdt/fdt_rw.c | 18 ++-
scripts/dtc/libfdt/fdt_strerror.c | 1 +
scripts/dtc/libfdt/libfdt.h | 7 +
scripts/dtc/livetree.c | 6 +-
scripts/dtc/treesource.c | 48 +++----
scripts/dtc/util.h | 6 +-
scripts/dtc/version_gen.h | 2 +-
scripts/dtc/yamltree.c | 16 ++-
14 files changed, 275 insertions(+), 114 deletions(-)
--- a/scripts/dtc/checks.c
+++ b/scripts/dtc/checks.c
@@ -143,6 +143,14 @@ static void check_nodes_props(struct che
check_nodes_props(c, dti, child);
}
+static bool is_multiple_of(int multiple, int divisor)
+{
+ if (divisor == 0)
+ return multiple == 0;
+ else
+ return (multiple % divisor) == 0;
+}
+
static bool run_check(struct check *c, struct dt_info *dti)
{
struct node *dt = dti->dt;
@@ -297,19 +305,20 @@ ERROR(duplicate_property_names, check_du
#define LOWERCASE "abcdefghijklmnopqrstuvwxyz"
#define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define DIGITS "0123456789"
-#define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
+#define NODECHARS LOWERCASE UPPERCASE DIGITS ",._+-@"
+#define PROPCHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
#define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-"
static void check_node_name_chars(struct check *c, struct dt_info *dti,
struct node *node)
{
- int n = strspn(node->name, c->data);
+ size_t n = strspn(node->name, c->data);
if (n < strlen(node->name))
FAIL(c, dti, node, "Bad character '%c' in node name",
node->name[n]);
}
-ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@");
+ERROR(node_name_chars, check_node_name_chars, NODECHARS);
static void check_node_name_chars_strict(struct check *c, struct dt_info *dti,
struct node *node)
@@ -330,6 +339,20 @@ static void check_node_name_format(struc
}
ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars);
+static void check_node_name_vs_property_name(struct check *c,
+ struct dt_info *dti,
+ struct node *node)
+{
+ if (!node->parent)
+ return;
+
+ if (get_property(node->parent, node->name)) {
+ FAIL(c, dti, node, "node name and property name conflict");
+ }
+}
+WARNING(node_name_vs_property_name, check_node_name_vs_property_name,
+ NULL, &node_name_chars);
+
static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti,
struct node *node)
{
@@ -363,14 +386,14 @@ static void check_property_name_chars(st
struct property *prop;
for_each_property(node, prop) {
- int n = strspn(prop->name, c->data);
+ size_t n = strspn(prop->name, c->data);
if (n < strlen(prop->name))
FAIL_PROP(c, dti, node, prop, "Bad character '%c' in property name",
prop->name[n]);
}
}
-ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS);
+ERROR(property_name_chars, check_property_name_chars, PROPCHARS);
static void check_property_name_chars_strict(struct check *c,
struct dt_info *dti,
@@ -380,7 +403,7 @@ static void check_property_name_chars_st
for_each_property(node, prop) {
const char *name = prop->name;
- int n = strspn(name, c->data);
+ size_t n = strspn(name, c->data);
if (n == strlen(prop->name))
continue;
@@ -497,7 +520,7 @@ static cell_t check_phandle_prop(struct
phandle = propval_cell(prop);
- if ((phandle == 0) || (phandle == -1)) {
+ if (!phandle_is_valid(phandle)) {
FAIL_PROP(c, dti, node, prop, "bad value (0x%x) in %s property",
phandle, prop->name);
return 0;
@@ -556,7 +579,7 @@ static void check_name_properties(struct
if (!prop)
return; /* No name property, that's fine */
- if ((prop->val.len != node->basenamelen+1)
+ if ((prop->val.len != node->basenamelen + 1U)
|| (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) {
FAIL(c, dti, node, "\"name\" property is incorrect (\"%s\" instead"
" of base node name)", prop->val.val);
@@ -657,7 +680,6 @@ ERROR(omit_unused_nodes, fixup_omit_unus
*/
WARNING_IF_NOT_CELL(address_cells_is_cell, "#address-cells");
WARNING_IF_NOT_CELL(size_cells_is_cell, "#size-cells");
-WARNING_IF_NOT_CELL(interrupt_cells_is_cell, "#interrupt-cells");
WARNING_IF_NOT_STRING(device_type_is_string, "device_type");
WARNING_IF_NOT_STRING(model_is_string, "model");
@@ -672,8 +694,7 @@ static void check_names_is_string_list(s
struct property *prop;
for_each_property(node, prop) {
- const char *s = strrchr(prop->name, '-');
- if (!s || !streq(s, "-names"))
+ if (!strends(prop->name, "-names"))
continue;
c->data = prop->name;
@@ -753,7 +774,7 @@ static void check_reg_format(struct chec
size_cells = node_size_cells(node->parent);
entrylen = (addr_cells + size_cells) * sizeof(cell_t);
- if (!entrylen || (prop->val.len % entrylen) != 0)
+ if (!is_multiple_of(prop->val.len, entrylen))
FAIL_PROP(c, dti, node, prop, "property has invalid length (%d bytes) "
"(#address-cells == %d, #size-cells == %d)",
prop->val.len, addr_cells, size_cells);
@@ -794,7 +815,7 @@ static void check_ranges_format(struct c
"#size-cells (%d) differs from %s (%d)",
ranges, c_size_cells, node->parent->fullpath,
p_size_cells);
- } else if ((prop->val.len % entrylen) != 0) {
+ } else if (!is_multiple_of(prop->val.len, entrylen)) {
FAIL_PROP(c, dti, node, prop, "\"%s\" property has invalid length (%d bytes) "
"(parent #address-cells == %d, child #address-cells == %d, "
"#size-cells == %d)", ranges, prop->val.len,
@@ -871,7 +892,7 @@ static void check_pci_device_bus_num(str
} else {
cells = (cell_t *)prop->val.val;
min_bus = fdt32_to_cpu(cells[0]);
- max_bus = fdt32_to_cpu(cells[0]);
+ max_bus = fdt32_to_cpu(cells[1]);
}
if ((bus_num < min_bus) || (bus_num > max_bus))
FAIL_PROP(c, dti, node, prop, "PCI bus number %d out of range, expected (%d - %d)",
@@ -1367,9 +1388,9 @@ static void check_property_phandle_args(
const struct provider *provider)
{
struct node *root = dti->dt;
- int cell, cellsize = 0;
+ unsigned int cell, cellsize = 0;
- if (prop->val.len % sizeof(cell_t)) {
+ if (!is_multiple_of(prop->val.len, sizeof(cell_t))) {
FAIL_PROP(c, dti, node, prop,
"property size (%d) is invalid, expected multiple of %zu",
prop->val.len, sizeof(cell_t));
@@ -1379,14 +1400,14 @@ static void check_property_phandle_args(
for (cell = 0; cell < prop->val.len / sizeof(cell_t); cell += cellsize + 1) {
struct node *provider_node;
struct property *cellprop;
- int phandle;
+ cell_t phandle;
phandle = propval_cell_n(prop, cell);
/*
* Some bindings use a cell value 0 or -1 to skip over optional
* entries when each index position has a specific definition.
*/
- if (phandle == 0 || phandle == -1) {
+ if (!phandle_is_valid(phandle)) {
/* Give up if this is an overlay with external references */
if (dti->dtsflags & DTSF_PLUGIN)
break;
@@ -1452,7 +1473,8 @@ static void check_provider_cells_propert
}
#define WARNING_PROPERTY_PHANDLE_CELLS(nm, propname, cells_name, ...) \
static struct provider nm##_provider = { (propname), (cells_name), __VA_ARGS__ }; \
- WARNING(nm##_property, check_provider_cells_property, &nm##_provider, &phandle_references);
+ WARNING_IF_NOT_CELL(nm##_is_cell, cells_name); \
+ WARNING(nm##_property, check_provider_cells_property, &nm##_provider, &nm##_is_cell, &phandle_references);
WARNING_PROPERTY_PHANDLE_CELLS(clocks, "clocks", "#clock-cells");
WARNING_PROPERTY_PHANDLE_CELLS(cooling_device, "cooling-device", "#cooling-cells");
@@ -1473,24 +1495,17 @@ WARNING_PROPERTY_PHANDLE_CELLS(thermal_s
static bool prop_is_gpio(struct property *prop)
{
- char *str;
-
/*
* *-gpios and *-gpio can appear in property names,
* so skip over any false matches (only one known ATM)
*/
- if (strstr(prop->name, "nr-gpio"))
+ if (strends(prop->name, ",nr-gpios"))
return false;
- str = strrchr(prop->name, '-');
- if (str)
- str++;
- else
- str = prop->name;
- if (!(streq(str, "gpios") || streq(str, "gpio")))
- return false;
-
- return true;
+ return strends(prop->name, "-gpios") ||
+ streq(prop->name, "gpios") ||
+ strends(prop->name, "-gpio") ||
+ streq(prop->name, "gpio");
}
static void check_gpios_property(struct check *c,
@@ -1525,13 +1540,10 @@ static void check_deprecated_gpio_proper
struct property *prop;
for_each_property(node, prop) {
- char *str;
-
if (!prop_is_gpio(prop))
continue;
- str = strstr(prop->name, "gpio");
- if (!streq(str, "gpio"))
+ if (!strends(prop->name, "gpio"))
continue;
FAIL_PROP(c, dti, node, prop,
@@ -1561,21 +1573,106 @@ static void check_interrupt_provider(str
struct node *node)
{
struct property *prop;
+ bool irq_provider = node_is_interrupt_provider(node);
- if (!node_is_interrupt_provider(node))
+ prop = get_property(node, "#interrupt-cells");
+ if (irq_provider && !prop) {
+ FAIL(c, dti, node,
+ "Missing '#interrupt-cells' in interrupt provider");
return;
+ }
- prop = get_property(node, "#interrupt-cells");
- if (!prop)
+ if (!irq_provider && prop) {
FAIL(c, dti, node,
- "Missing #interrupt-cells in interrupt provider");
+ "'#interrupt-cells' found, but node is not an interrupt provider");
+ return;
+ }
+}
+WARNING(interrupt_provider, check_interrupt_provider, NULL, &interrupts_extended_is_cell);
- prop = get_property(node, "#address-cells");
- if (!prop)
+static void check_interrupt_map(struct check *c,
+ struct dt_info *dti,
+ struct node *node)
+{
+ struct node *root = dti->dt;
+ struct property *prop, *irq_map_prop;
+ size_t cellsize, cell, map_cells;
+
+ irq_map_prop = get_property(node, "interrupt-map");
+ if (!irq_map_prop)
+ return;
+
+ if (node->addr_cells < 0) {
FAIL(c, dti, node,
- "Missing #address-cells in interrupt provider");
+ "Missing '#address-cells' in interrupt-map provider");
+ return;
+ }
+ cellsize = node_addr_cells(node);
+ cellsize += propval_cell(get_property(node, "#interrupt-cells"));
+
+ prop = get_property(node, "interrupt-map-mask");
+ if (prop && (prop->val.len != (cellsize * sizeof(cell_t))))
+ FAIL_PROP(c, dti, node, prop,
+ "property size (%d) is invalid, expected %zu",
+ prop->val.len, cellsize * sizeof(cell_t));
+
+ if (!is_multiple_of(irq_map_prop->val.len, sizeof(cell_t))) {
+ FAIL_PROP(c, dti, node, irq_map_prop,
+ "property size (%d) is invalid, expected multiple of %zu",
+ irq_map_prop->val.len, sizeof(cell_t));
+ return;
+ }
+
+ map_cells = irq_map_prop->val.len / sizeof(cell_t);
+ for (cell = 0; cell < map_cells; ) {
+ struct node *provider_node;
+ struct property *cellprop;
+ int phandle;
+ size_t parent_cellsize;
+
+ if ((cell + cellsize) >= map_cells) {
+ FAIL_PROP(c, dti, node, irq_map_prop,
+ "property size (%d) too small, expected > %zu",
+ irq_map_prop->val.len, (cell + cellsize) * sizeof(cell_t));
+ break;
+ }
+ cell += cellsize;
+
+ phandle = propval_cell_n(irq_map_prop, cell);
+ if (!phandle_is_valid(phandle)) {
+ /* Give up if this is an overlay with external references */
+ if (!(dti->dtsflags & DTSF_PLUGIN))
+ FAIL_PROP(c, dti, node, irq_map_prop,
+ "Cell %zu is not a phandle(%d)",
+ cell, phandle);
+ break;
+ }
+
+ provider_node = get_node_by_phandle(root, phandle);
+ if (!provider_node) {
+ FAIL_PROP(c, dti, node, irq_map_prop,
+ "Could not get phandle(%d) node for (cell %zu)",
+ phandle, cell);
+ break;
+ }
+
+ cellprop = get_property(provider_node, "#interrupt-cells");
+ if (cellprop) {
+ parent_cellsize = propval_cell(cellprop);
+ } else {
+ FAIL(c, dti, node, "Missing property '#interrupt-cells' in node %s or bad phandle (referred from interrupt-map[%zu])",
+ provider_node->fullpath, cell);
+ break;
+ }
+
+ cellprop = get_property(provider_node, "#address-cells");
+ if (cellprop)
+ parent_cellsize += propval_cell(cellprop);
+
+ cell += 1 + parent_cellsize;
+ }
}
-WARNING(interrupt_provider, check_interrupt_provider, NULL);
+WARNING(interrupt_map, check_interrupt_map, NULL, &phandle_references, &addr_size_cells, &interrupt_provider);
static void check_interrupts_property(struct check *c,
struct dt_info *dti,
@@ -1584,13 +1681,13 @@ static void check_interrupts_property(st
struct node *root = dti->dt;
struct node *irq_node = NULL, *parent = node;
struct property *irq_prop, *prop = NULL;
- int irq_cells, phandle;
+ cell_t irq_cells, phandle;
irq_prop = get_property(node, "interrupts");
if (!irq_prop)
return;
- if (irq_prop->val.len % sizeof(cell_t))
+ if (!is_multiple_of(irq_prop->val.len, sizeof(cell_t)))
FAIL_PROP(c, dti, node, irq_prop, "size (%d) is invalid, expected multiple of %zu",
irq_prop->val.len, sizeof(cell_t));
@@ -1603,7 +1700,7 @@ static void check_interrupts_property(st
prop = get_property(parent, "interrupt-parent");
if (prop) {
phandle = propval_cell(prop);
- if ((phandle == 0) || (phandle == -1)) {
+ if (!phandle_is_valid(phandle)) {
/* Give up if this is an overlay with
* external references */
if (dti->dtsflags & DTSF_PLUGIN)
@@ -1639,7 +1736,7 @@ static void check_interrupts_property(st
}
irq_cells = propval_cell(prop);
- if (irq_prop->val.len % (irq_cells * sizeof(cell_t))) {
+ if (!is_multiple_of(irq_prop->val.len, irq_cells * sizeof(cell_t))) {
FAIL_PROP(c, dti, node, prop,
"size is (%d), expected multiple of %d",
irq_prop->val.len, (int)(irq_cells * sizeof(cell_t)));
@@ -1750,7 +1847,7 @@ WARNING(graph_port, check_graph_port, NU
static struct node *get_remote_endpoint(struct check *c, struct dt_info *dti,
struct node *endpoint)
{
- int phandle;
+ cell_t phandle;
struct node *node;
struct property *prop;
@@ -1760,7 +1857,7 @@ static struct node *get_remote_endpoint(
phandle = propval_cell(prop);
/* Give up if this is an overlay with external references */
- if (phandle == 0 || phandle == -1)
+ if (!phandle_is_valid(phandle))
return NULL;
node = get_node_by_phandle(dti->dt, phandle);
@@ -1796,7 +1893,7 @@ WARNING(graph_endpoint, check_graph_endp
static struct check *check_table[] = {
&duplicate_node_names, &duplicate_property_names,
&node_name_chars, &node_name_format, &property_name_chars,
- &name_is_string, &name_properties,
+ &name_is_string, &name_properties, &node_name_vs_property_name,
&duplicate_label,
@@ -1804,7 +1901,7 @@ static struct check *check_table[] = {
&phandle_references, &path_references,
&omit_unused_nodes,
- &address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell,
+ &address_cells_is_cell, &size_cells_is_cell,
&device_type_is_string, &model_is_string, &status_is_string,
&label_is_string,
@@ -1839,26 +1936,43 @@ static struct check *check_table[] = {
&chosen_node_is_root, &chosen_node_bootargs, &chosen_node_stdout_path,
&clocks_property,
+ &clocks_is_cell,
&cooling_device_property,
+ &cooling_device_is_cell,
&dmas_property,
+ &dmas_is_cell,
&hwlocks_property,
+ &hwlocks_is_cell,
&interrupts_extended_property,
+ &interrupts_extended_is_cell,
&io_channels_property,
+ &io_channels_is_cell,
&iommus_property,
+ &iommus_is_cell,
&mboxes_property,
+ &mboxes_is_cell,
&msi_parent_property,
+ &msi_parent_is_cell,
&mux_controls_property,
+ &mux_controls_is_cell,
&phys_property,
+ &phys_is_cell,
&power_domains_property,
+ &power_domains_is_cell,
&pwms_property,
+ &pwms_is_cell,
&resets_property,
+ &resets_is_cell,
&sound_dai_property,
+ &sound_dai_is_cell,
&thermal_sensors_property,
+ &thermal_sensors_is_cell,
&deprecated_gpio_property,
&gpios_property,
&interrupts_property,
&interrupt_provider,
+ &interrupt_map,
&alias_paths,
@@ -1882,7 +1996,7 @@ static void enable_warning_error(struct
static void disable_warning_error(struct check *c, bool warn, bool error)
{
- int i;
+ unsigned int i;
/* Lowering level, also lower it for things this is the prereq
* for */
@@ -1903,7 +2017,7 @@ static void disable_warning_error(struct
void parse_checks_option(bool warn, bool error, const char *arg)
{
- int i;
+ unsigned int i;
const char *name = arg;
bool enable = true;
@@ -1930,7 +2044,7 @@ void parse_checks_option(bool warn, bool
void process_checks(bool force, struct dt_info *dti)
{
- int i;
+ unsigned int i;
int error = 0;
for (i = 0; i < ARRAY_SIZE(check_table); i++) {
--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -57,7 +57,7 @@ static void PRINTF(1, 2) lexical_error(c
push_input_file(name);
}
-<*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)? {
+<*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)* {
char *line, *fnstart, *fnend;
struct data fn;
/* skip text before line # */
--- a/scripts/dtc/dtc.c
+++ b/scripts/dtc/dtc.c
@@ -12,7 +12,7 @@
* Command line options
*/
int quiet; /* Level of quietness */
-int reservenum; /* Number of memory reservation slots */
+unsigned int reservenum;/* Number of memory reservation slots */
int minsize; /* Minimum blob size */
int padsize; /* Additional padding to blob */
int alignsize; /* Additional padding to blob accroding to the alignsize */
@@ -197,7 +197,7 @@ int main(int argc, char *argv[])
depname = optarg;
break;
case 'R':
- reservenum = strtol(optarg, NULL, 0);
+ reservenum = strtoul(optarg, NULL, 0);
break;
case 'S':
minsize = strtol(optarg, NULL, 0);
@@ -359,8 +359,6 @@ int main(int argc, char *argv[])
#endif
} else if (streq(outform, "dtb")) {
dt_to_blob(outf, dti, outversion);
- } else if (streq(outform, "dtbo")) {
- dt_to_blob(outf, dti, outversion);
} else if (streq(outform, "asm")) {
dt_to_asm(outf, dti, outversion);
} else if (streq(outform, "null")) {
--- a/scripts/dtc/dtc.h
+++ b/scripts/dtc/dtc.h
@@ -35,7 +35,7 @@
* Command line options
*/
extern int quiet; /* Level of quietness */
-extern int reservenum; /* Number of memory reservation slots */
+extern unsigned int reservenum; /* Number of memory reservation slots */
extern int minsize; /* Minimum blob size */
extern int padsize; /* Additional padding to blob */
extern int alignsize; /* Additional padding to blob accroding to the alignsize */
@@ -51,6 +51,11 @@ extern int annotate; /* annotate .dts w
typedef uint32_t cell_t;
+static inline bool phandle_is_valid(cell_t phandle)
+{
+ return phandle != 0 && phandle != ~0U;
+}
+
static inline uint16_t dtb_ld16(const void *p)
{
const uint8_t *bp = (const uint8_t *)p;
@@ -86,6 +91,16 @@ static inline uint64_t dtb_ld64(const vo
#define streq(a, b) (strcmp((a), (b)) == 0)
#define strstarts(s, prefix) (strncmp((s), (prefix), strlen(prefix)) == 0)
#define strprefixeq(a, n, b) (strlen(b) == (n) && (memcmp(a, b, n) == 0))
+static inline bool strends(const char *str, const char *suffix)
+{
+ unsigned int len, suffix_len;
+
+ len = strlen(str);
+ suffix_len = strlen(suffix);
+ if (len < suffix_len)
+ return false;
+ return streq(str + len - suffix_len, suffix);
+}
#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
@@ -101,6 +116,12 @@ enum markertype {
TYPE_UINT64,
TYPE_STRING,
};
+
+static inline bool is_type_marker(enum markertype type)
+{
+ return type >= TYPE_UINT8;
+}
+
extern const char *markername(enum markertype markertype);
struct marker {
@@ -125,7 +146,22 @@ struct data {
for_each_marker(m) \
if ((m)->type == (t))
-size_t type_marker_length(struct marker *m);
+static inline struct marker *next_type_marker(struct marker *m)
+{
+ for_each_marker(m)
+ if (is_type_marker(m->type))
+ break;
+ return m;
+}
+
+static inline size_t type_marker_length(struct marker *m)
+{
+ struct marker *next = next_type_marker(m->next);
+
+ if (next)
+ return next->offset - m->offset;
+ return 0;
+}
void data_free(struct data d);
--- a/scripts/dtc/flattree.c
+++ b/scripts/dtc/flattree.c
@@ -124,7 +124,8 @@ static void asm_emit_cell(void *e, cell_
{
FILE *f = e;
- fprintf(f, "\t.byte 0x%02x; .byte 0x%02x; .byte 0x%02x; .byte 0x%02x\n",
+ fprintf(f, "\t.byte\t0x%02x\n" "\t.byte\t0x%02x\n"
+ "\t.byte\t0x%02x\n" "\t.byte\t0x%02x\n",
(val >> 24) & 0xff, (val >> 16) & 0xff,
(val >> 8) & 0xff, val & 0xff);
}
@@ -134,9 +135,9 @@ static void asm_emit_string(void *e, con
FILE *f = e;
if (len != 0)
- fprintf(f, "\t.string\t\"%.*s\"\n", len, str);
+ fprintf(f, "\t.asciz\t\"%.*s\"\n", len, str);
else
- fprintf(f, "\t.string\t\"%s\"\n", str);
+ fprintf(f, "\t.asciz\t\"%s\"\n", str);
}
static void asm_emit_align(void *e, int a)
@@ -295,7 +296,7 @@ static struct data flatten_reserve_list(
{
struct reserve_info *re;
struct data d = empty_data;
- int j;
+ unsigned int j;
for (re = reservelist; re; re = re->next) {
d = data_append_re(d, re->address, re->size);
@@ -438,7 +439,7 @@ static void dump_stringtable_asm(FILE *f
while (p < (strbuf.val + strbuf.len)) {
len = strlen(p);
- fprintf(f, "\t.string \"%s\"\n", p);
+ fprintf(f, "\t.asciz \"%s\"\n", p);
p += len+1;
}
}
--- a/scripts/dtc/libfdt/fdt.c
+++ b/scripts/dtc/libfdt/fdt.c
@@ -90,6 +90,10 @@ int fdt_check_header(const void *fdt)
{
size_t hdrsize;
+ /* The device tree must be at an 8-byte aligned address */
+ if ((uintptr_t)fdt & 7)
+ return -FDT_ERR_ALIGNMENT;
+
if (fdt_magic(fdt) != FDT_MAGIC)
return -FDT_ERR_BADMAGIC;
if (!can_assume(LATEST)) {
--- a/scripts/dtc/libfdt/fdt_rw.c
+++ b/scripts/dtc/libfdt/fdt_rw.c
@@ -349,7 +349,10 @@ int fdt_add_subnode_namelen(void *fdt, i
return offset;
/* Try to place the new node after the parent's properties */
- fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
+ tag = fdt_next_tag(fdt, parentoffset, &nextoffset);
+ /* the fdt_subnode_offset_namelen() should ensure this never hits */
+ if (!can_assume(LIBFDT_FLAWLESS) && (tag != FDT_BEGIN_NODE))
+ return -FDT_ERR_INTERNAL;
do {
offset = nextoffset;
tag = fdt_next_tag(fdt, offset, &nextoffset);
@@ -391,7 +394,9 @@ int fdt_del_node(void *fdt, int nodeoffs
}
static void fdt_packblocks_(const char *old, char *new,
- int mem_rsv_size, int struct_size)
+ int mem_rsv_size,
+ int struct_size,
+ int strings_size)
{
int mem_rsv_off, struct_off, strings_off;
@@ -406,8 +411,7 @@ static void fdt_packblocks_(const char *
fdt_set_off_dt_struct(new, struct_off);
fdt_set_size_dt_struct(new, struct_size);
- memmove(new + strings_off, old + fdt_off_dt_strings(old),
- fdt_size_dt_strings(old));
+ memmove(new + strings_off, old + fdt_off_dt_strings(old), strings_size);
fdt_set_off_dt_strings(new, strings_off);
fdt_set_size_dt_strings(new, fdt_size_dt_strings(old));
}
@@ -467,7 +471,8 @@ int fdt_open_into(const void *fdt, void
return -FDT_ERR_NOSPACE;
}
- fdt_packblocks_(fdt, tmp, mem_rsv_size, struct_size);
+ fdt_packblocks_(fdt, tmp, mem_rsv_size, struct_size,
+ fdt_size_dt_strings(fdt));
memmove(buf, tmp, newsize);
fdt_set_magic(buf, FDT_MAGIC);
@@ -487,7 +492,8 @@ int fdt_pack(void *fdt)
mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
* sizeof(struct fdt_reserve_entry);
- fdt_packblocks_(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
+ fdt_packblocks_(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt),
+ fdt_size_dt_strings(fdt));
fdt_set_totalsize(fdt, fdt_data_size_(fdt));
return 0;
--- a/scripts/dtc/libfdt/fdt_strerror.c
+++ b/scripts/dtc/libfdt/fdt_strerror.c
@@ -39,6 +39,7 @@ static struct fdt_errtabent fdt_errtable
FDT_ERRTABENT(FDT_ERR_BADOVERLAY),
FDT_ERRTABENT(FDT_ERR_NOPHANDLES),
FDT_ERRTABENT(FDT_ERR_BADFLAGS),
+ FDT_ERRTABENT(FDT_ERR_ALIGNMENT),
};
#define FDT_ERRTABSIZE ((int)(sizeof(fdt_errtable) / sizeof(fdt_errtable[0])))
--- a/scripts/dtc/libfdt/libfdt.h
+++ b/scripts/dtc/libfdt/libfdt.h
@@ -131,6 +131,13 @@ uint32_t fdt_next_tag(const void *fdt, i
* to work even with unaligned pointers on platforms (such as ARMv5) that don't
* like unaligned loads and stores.
*/
+static inline uint16_t fdt16_ld(const fdt16_t *p)
+{
+ const uint8_t *bp = (const uint8_t *)p;
+
+ return ((uint16_t)bp[0] << 8) | bp[1];
+}
+
static inline uint32_t fdt32_ld(const fdt32_t *p)
{
const uint8_t *bp = (const uint8_t *)p;
--- a/scripts/dtc/livetree.c
+++ b/scripts/dtc/livetree.c
@@ -526,7 +526,7 @@ struct node *get_node_by_path(struct nod
p = strchr(path, '/');
for_each_child(tree, child) {
- if (p && strprefixeq(path, p - path, child->name))
+ if (p && strprefixeq(path, (size_t)(p - path), child->name))
return get_node_by_path(child, p+1);
else if (!p && streq(path, child->name))
return child;
@@ -559,7 +559,7 @@ struct node *get_node_by_phandle(struct
{
struct node *child, *node;
- if ((phandle == 0) || (phandle == -1)) {
+ if (!phandle_is_valid(phandle)) {
assert(generate_fixups);
return NULL;
}
@@ -594,7 +594,7 @@ cell_t get_node_phandle(struct node *roo
static cell_t phandle = 1; /* FIXME: ick, static local */
struct data d = empty_data;
- if ((node->phandle != 0) && (node->phandle != -1))
+ if (phandle_is_valid(node->phandle))
return node->phandle;
while (get_node_by_phandle(root, phandle))
--- a/scripts/dtc/treesource.c
+++ b/scripts/dtc/treesource.c
@@ -124,27 +124,6 @@ static void write_propval_int(FILE *f, c
}
}
-static bool has_data_type_information(struct marker *m)
-{
- return m->type >= TYPE_UINT8;
-}
-
-static struct marker *next_type_marker(struct marker *m)
-{
- while (m && !has_data_type_information(m))
- m = m->next;
- return m;
-}
-
-size_t type_marker_length(struct marker *m)
-{
- struct marker *next = next_type_marker(m->next);
-
- if (next)
- return next->offset - m->offset;
- return 0;
-}
-
static const char *delim_start[] = {
[TYPE_UINT8] = "[",
[TYPE_UINT16] = "/bits/ 16 <",
@@ -229,26 +208,39 @@ static void write_propval(FILE *f, struc
size_t chunk_len = (m->next ? m->next->offset : len) - m->offset;
size_t data_len = type_marker_length(m) ? : len - m->offset;
const char *p = &prop->val.val[m->offset];
+ struct marker *m_phandle;
- if (has_data_type_information(m)) {
+ if (is_type_marker(m->type)) {
emit_type = m->type;
fprintf(f, " %s", delim_start[emit_type]);
} else if (m->type == LABEL)
fprintf(f, " %s:", m->ref);
- else if (m->offset)
- fputc(' ', f);
- if (emit_type == TYPE_NONE) {
- assert(chunk_len == 0);
+ if (emit_type == TYPE_NONE || chunk_len == 0)
continue;
- }
switch(emit_type) {
case TYPE_UINT16:
write_propval_int(f, p, chunk_len, 2);
break;
case TYPE_UINT32:
- write_propval_int(f, p, chunk_len, 4);
+ m_phandle = prop->val.markers;
+ for_each_marker_of_type(m_phandle, REF_PHANDLE)
+ if (m->offset == m_phandle->offset)
+ break;
+
+ if (m_phandle) {
+ if (m_phandle->ref[0] == '/')
+ fprintf(f, "&{%s}", m_phandle->ref);
+ else
+ fprintf(f, "&%s", m_phandle->ref);
+ if (chunk_len > 4) {
+ fputc(' ', f);
+ write_propval_int(f, p + 4, chunk_len - 4, 4);
+ }
+ } else {
+ write_propval_int(f, p, chunk_len, 4);
+ }
break;
case TYPE_UINT64:
write_propval_int(f, p, chunk_len, 8);
--- a/scripts/dtc/util.h
+++ b/scripts/dtc/util.h
@@ -13,10 +13,10 @@
*/
#ifdef __GNUC__
-#ifdef __clang__
-#define PRINTF(i, j) __attribute__((format (printf, i, j)))
-#else
+#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#define PRINTF(i, j) __attribute__((format (gnu_printf, i, j)))
+#else
+#define PRINTF(i, j) __attribute__((format (printf, i, j)))
#endif
#define NORETURN __attribute__((noreturn))
#else
--- a/scripts/dtc/version_gen.h
+++ b/scripts/dtc/version_gen.h
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.6.0-g183df9e9"
+#define DTC_VERSION "DTC 1.6.1-g0a3a9d34"
--- a/scripts/dtc/yamltree.c
+++ b/scripts/dtc/yamltree.c
@@ -29,11 +29,12 @@ char *yaml_error_name[] = {
(emitter)->problem, __func__, __LINE__); \
})
-static void yaml_propval_int(yaml_emitter_t *emitter, struct marker *markers, char *data, unsigned int len, int width)
+static void yaml_propval_int(yaml_emitter_t *emitter, struct marker *markers,
+ char *data, unsigned int seq_offset, unsigned int len, int width)
{
yaml_event_t event;
void *tag;
- unsigned int off, start_offset = markers->offset;
+ unsigned int off;
switch(width) {
case 1: tag = "!u8"; break;
@@ -66,7 +67,7 @@ static void yaml_propval_int(yaml_emitte
m = markers;
is_phandle = false;
for_each_marker_of_type(m, REF_PHANDLE) {
- if (m->offset == (start_offset + off)) {
+ if (m->offset == (seq_offset + off)) {
is_phandle = true;
break;
}
@@ -114,6 +115,7 @@ static void yaml_propval(yaml_emitter_t
yaml_event_t event;
unsigned int len = prop->val.len;
struct marker *m = prop->val.markers;
+ struct marker *markers = prop->val.markers;
/* Emit the property name */
yaml_scalar_event_initialize(&event, NULL,
@@ -151,19 +153,19 @@ static void yaml_propval(yaml_emitter_t
switch(m->type) {
case TYPE_UINT16:
- yaml_propval_int(emitter, m, data, chunk_len, 2);
+ yaml_propval_int(emitter, markers, data, m->offset, chunk_len, 2);
break;
case TYPE_UINT32:
- yaml_propval_int(emitter, m, data, chunk_len, 4);
+ yaml_propval_int(emitter, markers, data, m->offset, chunk_len, 4);
break;
case TYPE_UINT64:
- yaml_propval_int(emitter, m, data, chunk_len, 8);
+ yaml_propval_int(emitter, markers, data, m->offset, chunk_len, 8);
break;
case TYPE_STRING:
yaml_propval_string(emitter, data, chunk_len);
break;
default:
- yaml_propval_int(emitter, m, data, chunk_len, 1);
+ yaml_propval_int(emitter, markers, data, m->offset, chunk_len, 1);
break;
}
}

View File

@ -0,0 +1,166 @@
From b5af64fceb04dc298c5e69c517b4d83893ff060b Mon Sep 17 00:00:00 2001
From: Bjorn Andersson <bjorn.andersson@linaro.org>
Date: Thu, 30 Sep 2021 11:21:10 -0700
Subject: [PATCH 1/1] soc: qcom: smem: Support reserved-memory description
Practically all modern Qualcomm platforms has a single reserved-memory
region for SMEM. So rather than having to describe SMEM in the form of a
node with a reference to a reserved-memory node, allow the SMEM device
to be instantiated directly from the reserved-memory node.
The current means of falling back to dereferencing the "memory-region"
is kept as a fallback, if it's determined that the SMEM node is a
reserved-memory node.
The "qcom,smem" compatible is added to the reserved_mem_matches list, to
allow the reserved-memory device to be probed.
In order to retain the readability of the code, the resolution of
resources is split from the actual ioremapping.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.org
---
drivers/of/platform.c | 1 +
drivers/soc/qcom/smem.c | 57 ++++++++++++++++++++++++++++-------------
2 files changed, 40 insertions(+), 18 deletions(-)
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -509,6 +509,7 @@ EXPORT_SYMBOL_GPL(of_platform_default_po
static const struct of_device_id reserved_mem_matches[] = {
{ .compatible = "qcom,rmtfs-mem" },
{ .compatible = "qcom,cmd-db" },
+ { .compatible = "qcom,smem" },
{ .compatible = "ramoops" },
{ .compatible = "nvmem-rmem" },
{}
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
#include <linux/sizes.h>
#include <linux/slab.h>
@@ -240,7 +241,7 @@ static const u8 SMEM_INFO_MAGIC[] = { 0x
* @size: size of the memory region
*/
struct smem_region {
- u32 aux_base;
+ phys_addr_t aux_base;
void __iomem *virt_base;
size_t size;
};
@@ -499,7 +500,7 @@ static void *qcom_smem_get_global(struct
for (i = 0; i < smem->num_regions; i++) {
region = &smem->regions[i];
- if (region->aux_base == aux_base || !aux_base) {
+ if ((u32)region->aux_base == aux_base || !aux_base) {
if (size != NULL)
*size = le32_to_cpu(entry->size);
return region->virt_base + le32_to_cpu(entry->offset);
@@ -664,7 +665,7 @@ phys_addr_t qcom_smem_virt_to_phys(void
if (p < region->virt_base + region->size) {
u64 offset = p - region->virt_base;
- return (phys_addr_t)region->aux_base + offset;
+ return region->aux_base + offset;
}
}
@@ -863,12 +864,12 @@ qcom_smem_enumerate_partitions(struct qc
return 0;
}
-static int qcom_smem_map_memory(struct qcom_smem *smem, struct device *dev,
- const char *name, int i)
+static int qcom_smem_resolve_mem(struct qcom_smem *smem, const char *name,
+ struct smem_region *region)
{
+ struct device *dev = smem->dev;
struct device_node *np;
struct resource r;
- resource_size_t size;
int ret;
np = of_parse_phandle(dev->of_node, name, 0);
@@ -881,13 +882,9 @@ static int qcom_smem_map_memory(struct q
of_node_put(np);
if (ret)
return ret;
- size = resource_size(&r);
- smem->regions[i].virt_base = devm_ioremap_wc(dev, r.start, size);
- if (!smem->regions[i].virt_base)
- return -ENOMEM;
- smem->regions[i].aux_base = (u32)r.start;
- smem->regions[i].size = size;
+ region->aux_base = r.start;
+ region->size = resource_size(&r);
return 0;
}
@@ -895,12 +892,14 @@ static int qcom_smem_map_memory(struct q
static int qcom_smem_probe(struct platform_device *pdev)
{
struct smem_header *header;
+ struct reserved_mem *rmem;
struct qcom_smem *smem;
size_t array_size;
int num_regions;
int hwlock_id;
u32 version;
int ret;
+ int i;
num_regions = 1;
if (of_find_property(pdev->dev.of_node, "qcom,rpm-msg-ram", NULL))
@@ -914,13 +913,35 @@ static int qcom_smem_probe(struct platfo
smem->dev = &pdev->dev;
smem->num_regions = num_regions;
- ret = qcom_smem_map_memory(smem, &pdev->dev, "memory-region", 0);
- if (ret)
- return ret;
-
- if (num_regions > 1 && (ret = qcom_smem_map_memory(smem, &pdev->dev,
- "qcom,rpm-msg-ram", 1)))
- return ret;
+ rmem = of_reserved_mem_lookup(pdev->dev.of_node);
+ if (rmem) {
+ smem->regions[0].aux_base = rmem->base;
+ smem->regions[0].size = rmem->size;
+ } else {
+ /*
+ * Fall back to the memory-region reference, if we're not a
+ * reserved-memory node.
+ */
+ ret = qcom_smem_resolve_mem(smem, "memory-region", &smem->regions[0]);
+ if (ret)
+ return ret;
+ }
+
+ if (num_regions > 1) {
+ ret = qcom_smem_resolve_mem(smem, "qcom,rpm-msg-ram", &smem->regions[1]);
+ if (ret)
+ return ret;
+ }
+
+ for (i = 0; i < num_regions; i++) {
+ smem->regions[i].virt_base = devm_ioremap_wc(&pdev->dev,
+ smem->regions[i].aux_base,
+ smem->regions[i].size);
+ if (!smem->regions[i].virt_base) {
+ dev_err(&pdev->dev, "failed to remap %pa\n", &smem->regions[i].aux_base);
+ return -ENOMEM;
+ }
+ }
header = smem->regions[0].virt_base;
if (le32_to_cpu(header->initialized) != 1 ||

View File

@ -0,0 +1,162 @@
From 626bfa03729959ea9917181fb3d8ffaa1594d02a Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Wed, 13 Oct 2021 22:40:18 -0700
Subject: [PATCH 1/1] MIPS: kernel: proc: add CPU option reporting
Many MIPS CPUs have optional CPU features which are not activated for
all CPU cores. Print the CPU options, which are implemented in the core,
in /proc/cpuinfo. This makes it possible to see which features are
supported and which are not supported. This should cover all standard
MIPS extensions. Before, it only printed information about the main MIPS
ASEs.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Changes from original patch[0]:
- Remove cpu_has_6k_cache and cpu_has_8k_cache due to commit 6ce91ba8589a
("MIPS: Remove cpu_has_6k_cache and cpu_has_8k_cache in cpu_cache_init()")
- Add new options: mac2008_only, ftlbparex, gsexcex, mmid, mm_sysad,
mm_full
- Use seq_puts instead of seq_printf as suggested by checkpatch
- Minor commit message reword
[0]: https://lore.kernel.org/linux-mips/20181223225224.23042-1-hauke@hauke-m.de/
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/kernel/proc.c | 122 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 122 insertions(+)
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -138,6 +138,128 @@ static int show_cpuinfo(struct seq_file
seq_printf(m, "micromips kernel\t: %s\n",
(read_c0_config3() & MIPS_CONF3_ISA_OE) ? "yes" : "no");
}
+
+ seq_puts(m, "Options implemented\t:");
+ if (cpu_has_tlb)
+ seq_puts(m, " tlb");
+ if (cpu_has_ftlb)
+ seq_puts(m, " ftlb");
+ if (cpu_has_tlbinv)
+ seq_puts(m, " tlbinv");
+ if (cpu_has_segments)
+ seq_puts(m, " segments");
+ if (cpu_has_rixiex)
+ seq_puts(m, " rixiex");
+ if (cpu_has_ldpte)
+ seq_puts(m, " ldpte");
+ if (cpu_has_maar)
+ seq_puts(m, " maar");
+ if (cpu_has_rw_llb)
+ seq_puts(m, " rw_llb");
+ if (cpu_has_4kex)
+ seq_puts(m, " 4kex");
+ if (cpu_has_3k_cache)
+ seq_puts(m, " 3k_cache");
+ if (cpu_has_4k_cache)
+ seq_puts(m, " 4k_cache");
+ if (cpu_has_tx39_cache)
+ seq_puts(m, " tx39_cache");
+ if (cpu_has_octeon_cache)
+ seq_puts(m, " octeon_cache");
+ if (cpu_has_fpu)
+ seq_puts(m, " fpu");
+ if (cpu_has_32fpr)
+ seq_puts(m, " 32fpr");
+ if (cpu_has_cache_cdex_p)
+ seq_puts(m, " cache_cdex_p");
+ if (cpu_has_cache_cdex_s)
+ seq_puts(m, " cache_cdex_s");
+ if (cpu_has_prefetch)
+ seq_puts(m, " prefetch");
+ if (cpu_has_mcheck)
+ seq_puts(m, " mcheck");
+ if (cpu_has_ejtag)
+ seq_puts(m, " ejtag");
+ if (cpu_has_llsc)
+ seq_puts(m, " llsc");
+ if (cpu_has_guestctl0ext)
+ seq_puts(m, " guestctl0ext");
+ if (cpu_has_guestctl1)
+ seq_puts(m, " guestctl1");
+ if (cpu_has_guestctl2)
+ seq_puts(m, " guestctl2");
+ if (cpu_has_guestid)
+ seq_puts(m, " guestid");
+ if (cpu_has_drg)
+ seq_puts(m, " drg");
+ if (cpu_has_rixi)
+ seq_puts(m, " rixi");
+ if (cpu_has_lpa)
+ seq_puts(m, " lpa");
+ if (cpu_has_mvh)
+ seq_puts(m, " mvh");
+ if (cpu_has_vtag_icache)
+ seq_puts(m, " vtag_icache");
+ if (cpu_has_dc_aliases)
+ seq_puts(m, " dc_aliases");
+ if (cpu_has_ic_fills_f_dc)
+ seq_puts(m, " ic_fills_f_dc");
+ if (cpu_has_pindexed_dcache)
+ seq_puts(m, " pindexed_dcache");
+ if (cpu_has_userlocal)
+ seq_puts(m, " userlocal");
+ if (cpu_has_nofpuex)
+ seq_puts(m, " nofpuex");
+ if (cpu_has_vint)
+ seq_puts(m, " vint");
+ if (cpu_has_veic)
+ seq_puts(m, " veic");
+ if (cpu_has_inclusive_pcaches)
+ seq_puts(m, " inclusive_pcaches");
+ if (cpu_has_perf_cntr_intr_bit)
+ seq_puts(m, " perf_cntr_intr_bit");
+ if (cpu_has_ufr)
+ seq_puts(m, " ufr");
+ if (cpu_has_fre)
+ seq_puts(m, " fre");
+ if (cpu_has_cdmm)
+ seq_puts(m, " cdmm");
+ if (cpu_has_small_pages)
+ seq_puts(m, " small_pages");
+ if (cpu_has_nan_legacy)
+ seq_puts(m, " nan_legacy");
+ if (cpu_has_nan_2008)
+ seq_puts(m, " nan_2008");
+ if (cpu_has_ebase_wg)
+ seq_puts(m, " ebase_wg");
+ if (cpu_has_badinstr)
+ seq_puts(m, " badinstr");
+ if (cpu_has_badinstrp)
+ seq_puts(m, " badinstrp");
+ if (cpu_has_contextconfig)
+ seq_puts(m, " contextconfig");
+ if (cpu_has_perf)
+ seq_puts(m, " perf");
+ if (cpu_has_mac2008_only)
+ seq_puts(m, " mac2008_only");
+ if (cpu_has_ftlbparex)
+ seq_puts(m, " ftlbparex");
+ if (cpu_has_gsexcex)
+ seq_puts(m, " gsexcex");
+ if (cpu_has_shared_ftlb_ram)
+ seq_puts(m, " shared_ftlb_ram");
+ if (cpu_has_shared_ftlb_entries)
+ seq_puts(m, " shared_ftlb_entries");
+ if (cpu_has_mipsmt_pertccounters)
+ seq_puts(m, " mipsmt_pertccounters");
+ if (cpu_has_mmid)
+ seq_puts(m, " mmid");
+ if (cpu_has_mm_sysad)
+ seq_puts(m, " mm_sysad");
+ if (cpu_has_mm_full)
+ seq_puts(m, " mm_full");
+ seq_puts(m, "\n");
+
seq_printf(m, "shadow register sets\t: %d\n",
cpu_data[n].srsets);
seq_printf(m, "kscratch registers\t: %d\n",

View File

@ -0,0 +1,62 @@
From 1cab5bd69eb1f995ced2d7576cb15f8a8941fd85 Mon Sep 17 00:00:00 2001
From: Tiezhu Yang <yangtiezhu@loongson.cn>
Date: Thu, 25 Nov 2021 19:39:32 +0800
Subject: [PATCH 1/1] MIPS: Fix using smp_processor_id() in preemptible in
show_cpuinfo()
There exists the following issue under DEBUG_PREEMPT:
BUG: using smp_processor_id() in preemptible [00000000] code: systemd/1
caller is show_cpuinfo+0x460/0xea0
...
Call Trace:
[<ffffffff8020f0dc>] show_stack+0x94/0x128
[<ffffffff80e6cab4>] dump_stack_lvl+0x94/0xd8
[<ffffffff80e74c5c>] check_preemption_disabled+0x104/0x110
[<ffffffff802209c8>] show_cpuinfo+0x460/0xea0
[<ffffffff80539d54>] seq_read_iter+0xfc/0x4f8
[<ffffffff804fcc10>] new_sync_read+0x110/0x1b8
[<ffffffff804ff57c>] vfs_read+0x1b4/0x1d0
[<ffffffff804ffb18>] ksys_read+0xd0/0x110
[<ffffffff8021c090>] syscall_common+0x34/0x58
We can see the following call trace:
show_cpuinfo()
cpu_has_fpu
current_cpu_data
smp_processor_id()
$ addr2line -f -e vmlinux 0xffffffff802209c8
show_cpuinfo
arch/mips/kernel/proc.c:188
$ head -188 arch/mips/kernel/proc.c | tail -1
if (cpu_has_fpu)
arch/mips/include/asm/cpu-features.h
# define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU)
arch/mips/include/asm/cpu-info.h
#define current_cpu_data cpu_data[smp_processor_id()]
Based on the above analysis, fix the issue by using raw_cpu_has_fpu
which calls raw_smp_processor_id() in show_cpuinfo().
Fixes: 626bfa037299 ("MIPS: kernel: proc: add CPU option reporting")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/kernel/proc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -166,7 +166,7 @@ static int show_cpuinfo(struct seq_file
seq_puts(m, " tx39_cache");
if (cpu_has_octeon_cache)
seq_puts(m, " octeon_cache");
- if (cpu_has_fpu)
+ if (raw_cpu_has_fpu)
seq_puts(m, " fpu");
if (cpu_has_32fpr)
seq_puts(m, " 32fpr");

View File

@ -1,7 +1,7 @@
From a07e31adf2753cad2fd9790db5bfc047c81e8152 Mon Sep 17 00:00:00 2001 From f4c5c7f9d2e5ab005d57826b740b694b042a737c Mon Sep 17 00:00:00 2001
From: Felix Matouschek <felix@matouschek.org> From: Felix Matouschek <felix@matouschek.org>
Date: Fri, 2 Jul 2021 20:31:23 +0200 Date: Mon, 18 Apr 2022 15:28:03 +0200
Subject: [PATCH] mtd: spinand: Add support for XTX XT26G0xA Subject: [PATCH 1/1] mtd: spinand: Add support for XTX XT26G0xA
Add support for XTX Technology XT26G01AXXXXX, XTX26G02AXXXXX and Add support for XTX Technology XT26G01AXXXXX, XTX26G02AXXXXX and
XTX26G04AXXXXX SPI NAND. XTX26G04AXXXXX SPI NAND.
@ -11,17 +11,18 @@ These are 3V, 1G/2G/4Gbit serial SLC NAND flash devices with on-die ECC
Tested on Teltonika RUTX10 flashed with OpenWrt. Tested on Teltonika RUTX10 flashed with OpenWrt.
Datasheets available at Links:
http://www.xtxtech.com/download/?AId=225 - http://www.xtxtech.com/download/?AId=225
https://datasheet.lcsc.com/szlcsc/2005251034_XTX-XT26G01AWSEGA_C558841.pdf - https://datasheet.lcsc.com/szlcsc/2005251034_XTX-XT26G01AWSEGA_C558841.pdf
Signed-off-by: Felix Matouschek <felix@matouschek.org> Signed-off-by: Felix Matouschek <felix@matouschek.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220418132803.664103-1-felix@matouschek.org
--- ---
drivers/mtd/nand/spi/Makefile | 2 +- drivers/mtd/nand/spi/Makefile | 2 +-
drivers/mtd/nand/spi/core.c | 1 + drivers/mtd/nand/spi/core.c | 1 +
drivers/mtd/nand/spi/xtx.c | 122 ++++++++++++++++++++++++++++++++++ drivers/mtd/nand/spi/xtx.c | 129 ++++++++++++++++++++++++++++++++++
include/linux/mtd/spinand.h | 1 + include/linux/mtd/spinand.h | 1 +
4 files changed, 125 insertions(+), 1 deletion(-) 4 files changed, 132 insertions(+), 1 deletion(-)
create mode 100644 drivers/mtd/nand/spi/xtx.c create mode 100644 drivers/mtd/nand/spi/xtx.c
--- a/drivers/mtd/nand/spi/Makefile --- a/drivers/mtd/nand/spi/Makefile
@ -43,7 +44,7 @@ Signed-off-by: Felix Matouschek <felix@matouschek.org>
static int spinand_manufacturer_match(struct spinand_device *spinand, static int spinand_manufacturer_match(struct spinand_device *spinand,
--- /dev/null --- /dev/null
+++ b/drivers/mtd/nand/spi/xtx.c +++ b/drivers/mtd/nand/spi/xtx.c
@@ -0,0 +1,122 @@ @@ -0,0 +1,129 @@
+// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0
+/* +/*
+ * Author: + * Author:
@ -109,18 +110,25 @@ Signed-off-by: Felix Matouschek <felix@matouschek.org>
+static int xt26g0xa_ecc_get_status(struct spinand_device *spinand, +static int xt26g0xa_ecc_get_status(struct spinand_device *spinand,
+ u8 status) + u8 status)
+{ +{
+ switch (status & XT26G0XA_STATUS_ECC_MASK) { + status = status & XT26G0XA_STATUS_ECC_MASK;
+
+ switch (status) {
+ case XT26G0XA_STATUS_ECC_NO_DETECTED: + case XT26G0XA_STATUS_ECC_NO_DETECTED:
+ return 0; + return 0;
+ case XT26G0XA_STATUS_ECC_8_CORRECTED: + case XT26G0XA_STATUS_ECC_8_CORRECTED:
+ return 8; + return 8;
+ case XT26G0XA_STATUS_ECC_UNCOR_ERROR: + case XT26G0XA_STATUS_ECC_UNCOR_ERROR:
+ return -EBADMSG; + return -EBADMSG;
+ default: /* (1 << 2) through (7 << 2) are 1-7 corrected errors */ + default:
+ return (status & XT26G0XA_STATUS_ECC_MASK) >> 2; + break;
+ } + }
+ +
+ return -EINVAL; + /* At this point values greater than (2 << 4) are invalid */
+ if (status > XT26G0XA_STATUS_ECC_UNCOR_ERROR)
+ return -EINVAL;
+
+ /* (1 << 2) through (7 << 2) are 1-7 corrected errors */
+ return status >> 2;
+} +}
+ +
+static const struct spinand_info xtx_spinand_table[] = { +static const struct spinand_info xtx_spinand_table[] = {

View File

@ -1,8 +1,8 @@
From a719f7ba7fcba05d85801c6f0267f389a21627c1 Mon Sep 17 00:00:00 2001 From 4bf18d5a2dd02db8c5b16a2cfae513510506df5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org> From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Fri, 24 Sep 2021 13:03:02 +0200 Date: Thu, 3 Feb 2022 22:44:40 +0100
Subject: [PATCH] phy: marvell: phy-mvebu-a3700-comphy: Remove port from driver Subject: [PATCH 1/2] phy: marvell: phy-mvebu-a3700-comphy: Remove port from
configuration driver configuration
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
@ -25,6 +25,8 @@ driver code which parses it. This also simplifies the driver.
Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220203214444.1508-2-kabel@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
--- ---
drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 62 +++++++++----------- drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 62 +++++++++-----------
1 file changed, 29 insertions(+), 33 deletions(-) 1 file changed, 29 insertions(+), 33 deletions(-)

View File

@ -1,7 +1,7 @@
From 9d276da259cce20b2ed7a868b6e6a6a205f7bb04 Mon Sep 17 00:00:00 2001 From 934337080c6c59b75db76b180b509f218640ad48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org> From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Thu, 23 Sep 2021 19:20:13 +0200 Date: Thu, 3 Feb 2022 22:44:41 +0100
Subject: [PATCH] phy: marvell: phy-mvebu-a3700-comphy: Add native kernel Subject: [PATCH 2/2] phy: marvell: phy-mvebu-a3700-comphy: Add native kernel
implementation implementation
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
@ -46,16 +46,19 @@ original code not conforming to kernel standards. Also PCIe mode poweroff
support was added here, and PHY reset support. These changes are also going support was added here, and PHY reset support. These changes are also going
to be sent to ARM Trusted Firmware. to be sent to ARM Trusted Firmware.
Signed-off-by: Pali Rohár <pali@kernel.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
[ Pali did the porting from ATF. [ Pali did the porting from ATF.
I (Marek) then fixed some register names, some various other things, I (Marek) then fixed some register names, some various other things,
added some comments and refactored the code to kernel standards. Also added some comments and refactored the code to kernel standards. Also
fixed PHY poweroff and added PHY reset. ] fixed PHY poweroff and added PHY reset. ]
Signed-off-by: Pali Rohár <pali@kernel.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20220203214444.1508-3-kabel@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
--- ---
drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 1351 ++++++++++++++++-- drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 1332 ++++++++++++++++--
1 file changed, 1234 insertions(+), 117 deletions(-) 1 file changed, 1215 insertions(+), 117 deletions(-)
--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c --- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
@ -78,7 +81,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h> #include <linux/iopoll.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
@@ -18,103 +22,1147 @@ @@ -18,103 +22,1118 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
@ -480,23 +483,23 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
- struct arm_smccc_res res; - struct arm_smccc_res res;
- s32 ret; - s32 ret;
+ u32 val; + u32 val;
+
- arm_smccc_smc(function, lane, mode, 0, 0, 0, 0, 0, &res);
- ret = res.a0;
+ val = readl(addr); + val = readl(addr);
+ val = (val & ~mask) | (data & mask); + val = (val & ~mask) | (data & mask);
+ writel(val, addr); + writel(val, addr);
+} +}
- arm_smccc_smc(function, lane, mode, 0, 0, 0, 0, 0, &res);
- ret = res.a0;
+static inline void comphy_reg_set16(void __iomem *addr, u16 data, u16 mask)
+{
+ u16 val;
- switch (ret) { - switch (ret) {
- case SMCCC_RET_SUCCESS: - case SMCCC_RET_SUCCESS:
- return 0; - return 0;
- case SMCCC_RET_NOT_SUPPORTED: - case SMCCC_RET_NOT_SUPPORTED:
- return -EOPNOTSUPP; - return -EOPNOTSUPP;
+static inline void comphy_reg_set16(void __iomem *addr, u16 data, u16 mask)
+{
+ u16 val;
+
+ val = readw(addr); + val = readw(addr);
+ val = (val & ~mask) | (data & mask); + val = (val & ~mask) | (data & mask);
+ writew(val, addr); + writew(val, addr);
@ -708,12 +711,10 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ ret = comphy_lane_reg_poll(lane, COMPHY_DIG_LOOPBACK_EN, + ret = comphy_lane_reg_poll(lane, COMPHY_DIG_LOOPBACK_EN,
+ PLL_READY_TX_BIT, COMPHY_PLL_SLEEP, + PLL_READY_TX_BIT, COMPHY_PLL_SLEEP,
+ COMPHY_PLL_TIMEOUT); + COMPHY_PLL_TIMEOUT);
+ if (ret) { + if (ret)
+ dev_err(lane->dev, "Failed to lock SATA PLL\n"); + dev_err(lane->dev, "Failed to lock SATA PLL\n");
+ return ret;
+ }
+ +
+ return 0; + return ret;
+} +}
+ +
+static void comphy_gbe_phy_init(struct mvebu_a3700_comphy_lane *lane, +static void comphy_gbe_phy_init(struct mvebu_a3700_comphy_lane *lane,
@ -827,7 +828,8 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ mask = REF_FREF_SEL_MASK; + mask = REF_FREF_SEL_MASK;
+ comphy_lane_reg_set(lane, COMPHY_POWER_PLL_CTRL, data, mask); + comphy_lane_reg_set(lane, COMPHY_POWER_PLL_CTRL, data, mask);
+ +
+ /* 10. Program COMPHY register PHY_GEN_MAX[1:0] + /*
+ * 10. Program COMPHY register PHY_GEN_MAX[1:0]
+ * This step is mentioned in the flow received from verification team. + * This step is mentioned in the flow received from verification team.
+ * However the PHY_GEN_MAX value is only meaningful for other interfaces + * However the PHY_GEN_MAX value is only meaningful for other interfaces
+ * (not SERDES). For instance, it selects SATA speed 1.5/3/6 Gbps or + * (not SERDES). For instance, it selects SATA speed 1.5/3/6 Gbps or
@ -846,9 +848,8 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ * 12. As long as DFE function needs to be enabled in any mode, + * 12. As long as DFE function needs to be enabled in any mode,
+ * COMPHY register DFE_UPDATE_EN[5:0] shall be programmed to 0x3F + * COMPHY register DFE_UPDATE_EN[5:0] shall be programmed to 0x3F
+ * for real chip during COMPHY power on. + * for real chip during COMPHY power on.
+ * The step 14 exists (and empty) in the original initialization flow + * The value of the DFE_UPDATE_EN already is 0x3F, because it is the
+ * obtained from the verification team. According to the functional + * default value after reset of the PHY.
+ * specification DFE_UPDATE_EN already has the default value 0x3F
+ */ + */
+ +
+ /* + /*
@ -867,19 +868,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ lane->submode != PHY_INTERFACE_MODE_2500BASEX); + lane->submode != PHY_INTERFACE_MODE_2500BASEX);
+ +
+ /* + /*
+ * 14. [Simulation Only] should not be used for real chip. + * 14. Check the PHY Polarity invert bit
+ * By pass power up calibration by programming EXT_FORCE_CAL_DONE
+ * (R02h[9]) to 1 to shorten COMPHY simulation time.
+ */
+
+ /*
+ * 15. [Simulation Only: should not be used for real chip]
+ * Program COMPHY register FAST_DFE_TIMER_EN=1 to shorten RX training
+ * simulation time.
+ */
+
+ /*
+ * 16. Check the PHY Polarity invert bit
+ */ + */
+ data = 0x0; + data = 0x0;
+ if (lane->invert_tx) + if (lane->invert_tx)
@ -890,7 +879,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ comphy_lane_reg_set(lane, COMPHY_SYNC_PATTERN, data, mask); + comphy_lane_reg_set(lane, COMPHY_SYNC_PATTERN, data, mask);
+ +
+ /* + /*
+ * 17. Set PHY input ports PIN_PU_PLL, PIN_PU_TX and PIN_PU_RX to 1 to + * 15. Set PHY input ports PIN_PU_PLL, PIN_PU_TX and PIN_PU_RX to 1 to
+ * start PHY power up sequence. All the PHY register programming should + * start PHY power up sequence. All the PHY register programming should
+ * be done before PIN_PU_PLL=1. There should be no register programming + * be done before PIN_PU_PLL=1. There should be no register programming
+ * for normal PHY operation from this point. + * for normal PHY operation from this point.
@ -900,7 +889,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, data, mask); + comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, data, mask);
+ +
+ /* + /*
+ * 18. Wait for PHY power up sequence to finish by checking output ports + * 16. Wait for PHY power up sequence to finish by checking output ports
+ * PIN_PLL_READY_TX=1 and PIN_PLL_READY_RX=1. + * PIN_PLL_READY_TX=1 and PIN_PLL_READY_RX=1.
+ */ + */
+ ret = comphy_periph_reg_poll(lane, COMPHY_PHY_STAT1, + ret = comphy_periph_reg_poll(lane, COMPHY_PHY_STAT1,
@ -914,12 +903,12 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ } + }
+ +
+ /* + /*
+ * 19. Set COMPHY input port PIN_TX_IDLE=0 + * 17. Set COMPHY input port PIN_TX_IDLE=0
+ */ + */
+ comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, 0x0, PIN_TX_IDLE_BIT); + comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, 0x0, PIN_TX_IDLE_BIT);
+ +
+ /* + /*
+ * 20. After valid data appear on PIN_RXDATA bus, set PIN_RX_INIT=1. To + * 18. After valid data appear on PIN_RXDATA bus, set PIN_RX_INIT=1. To
+ * start RX initialization. PIN_RX_INIT_DONE will be cleared to 0 by the + * start RX initialization. PIN_RX_INIT_DONE will be cleared to 0 by the
+ * PHY After RX initialization is done, PIN_RX_INIT_DONE will be set to + * PHY After RX initialization is done, PIN_RX_INIT_DONE will be set to
+ * 1 by COMPHY Set PIN_RX_INIT=0 after PIN_RX_INIT_DONE= 1. Please + * 1 by COMPHY Set PIN_RX_INIT=0 after PIN_RX_INIT_DONE= 1. Please
@ -941,13 +930,11 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ ret = comphy_periph_reg_poll(lane, COMPHY_PHY_STAT1, + ret = comphy_periph_reg_poll(lane, COMPHY_PHY_STAT1,
+ PHY_RX_INIT_DONE_BIT, + PHY_RX_INIT_DONE_BIT,
+ COMPHY_PLL_SLEEP, COMPHY_PLL_TIMEOUT); + COMPHY_PLL_SLEEP, COMPHY_PLL_TIMEOUT);
+ if (ret) { + if (ret)
+ dev_err(lane->dev, "Failed to init RX of SERDES PHY %d\n", + dev_err(lane->dev, "Failed to init RX of SERDES PHY %d\n",
+ lane->id); + lane->id);
+ return ret;
+ }
+ +
+ return 0; + return ret;
} }
-static int mvebu_a3700_comphy_get_fw_mode(int lane, -static int mvebu_a3700_comphy_get_fw_mode(int lane,
@ -1107,12 +1094,10 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ +
+ ret = comphy_lane_reg_poll(lane, COMPHY_PIPE_LANE_STAT1, TXDCLK_PCLK_EN, + ret = comphy_lane_reg_poll(lane, COMPHY_PIPE_LANE_STAT1, TXDCLK_PCLK_EN,
+ COMPHY_PLL_SLEEP, COMPHY_PLL_TIMEOUT); + COMPHY_PLL_SLEEP, COMPHY_PLL_TIMEOUT);
+ if (ret) { + if (ret)
+ dev_err(lane->dev, "Failed to lock USB3 PLL\n"); + dev_err(lane->dev, "Failed to lock USB3 PLL\n");
+ return ret;
+ }
+ +
+ return 0; + return ret;
+} +}
+ +
+static int +static int
@ -1197,21 +1182,10 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
+ +
+ ret = comphy_lane_reg_poll(lane, COMPHY_PIPE_LANE_STAT1, TXDCLK_PCLK_EN, + ret = comphy_lane_reg_poll(lane, COMPHY_PIPE_LANE_STAT1, TXDCLK_PCLK_EN,
+ COMPHY_PLL_SLEEP, COMPHY_PLL_TIMEOUT); + COMPHY_PLL_SLEEP, COMPHY_PLL_TIMEOUT);
+ if (ret) { + if (ret)
+ dev_err(lane->dev, "Failed to lock PCIE PLL\n"); + dev_err(lane->dev, "Failed to lock PCIE PLL\n");
+ return ret;
+ }
+ +
+ return 0; + return ret;
+}
+
+static void
+mvebu_a3700_comphy_usb3_power_off(struct mvebu_a3700_comphy_lane *lane)
+{
+ /*
+ * Currently the USB3 MAC sets the USB3 PHY to low state, so we do not
+ * need to power off USB3 PHY again.
+ */
+} +}
+ +
+static void +static void
@ -1285,7 +1259,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
enum phy_mode mode, enum phy_mode mode,
int submode) int submode)
{ {
@@ -122,7 +1170,7 @@ static int mvebu_a3700_comphy_get_fw_mod @@ -122,7 +1141,7 @@ static int mvebu_a3700_comphy_get_fw_mod
/* Unused PHY mux value is 0x0 */ /* Unused PHY mux value is 0x0 */
if (mode == PHY_MODE_INVALID) if (mode == PHY_MODE_INVALID)
@ -1294,7 +1268,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (mvebu_a3700_comphy_modes[i].lane == lane && if (mvebu_a3700_comphy_modes[i].lane == lane &&
@@ -132,27 +1180,30 @@ static int mvebu_a3700_comphy_get_fw_mod @@ -132,27 +1151,30 @@ static int mvebu_a3700_comphy_get_fw_mod
} }
if (i == n) if (i == n)
@ -1310,10 +1284,10 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
{ {
struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy);
- int fw_mode; - int fw_mode;
-
- if (submode == PHY_INTERFACE_MODE_1000BASEX) - if (submode == PHY_INTERFACE_MODE_1000BASEX)
- submode = PHY_INTERFACE_MODE_SGMII; - submode = PHY_INTERFACE_MODE_SGMII;
-
- fw_mode = mvebu_a3700_comphy_get_fw_mode(lane->id, mode, - fw_mode = mvebu_a3700_comphy_get_fw_mode(lane->id, mode,
- submode); - submode);
- if (fw_mode < 0) { - if (fw_mode < 0) {
@ -1335,7 +1309,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
/* Just remember the mode, ->power_on() will do the real setup */ /* Just remember the mode, ->power_on() will do the real setup */
lane->mode = mode; lane->mode = mode;
lane->submode = submode; lane->submode = submode;
@@ -163,76 +1214,68 @@ static int mvebu_a3700_comphy_set_mode(s @@ -163,76 +1185,77 @@ static int mvebu_a3700_comphy_set_mode(s
static int mvebu_a3700_comphy_power_on(struct phy *phy) static int mvebu_a3700_comphy_power_on(struct phy *phy)
{ {
struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy);
@ -1423,21 +1397,30 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
- return mvebu_a3700_comphy_smc(COMPHY_SIP_POWER_OFF, lane->id, 0); - return mvebu_a3700_comphy_smc(COMPHY_SIP_POWER_OFF, lane->id, 0);
+ switch (lane->mode) { + switch (lane->mode) {
+ case PHY_MODE_USB_HOST_SS: + case PHY_MODE_USB_HOST_SS:
+ mvebu_a3700_comphy_usb3_power_off(lane); + /*
+ return 0; + * The USB3 MAC sets the USB3 PHY to low state, so we do not
+ * need to power off USB3 PHY again.
+ */
+ break;
+
+ case PHY_MODE_SATA: + case PHY_MODE_SATA:
+ mvebu_a3700_comphy_sata_power_off(lane); + mvebu_a3700_comphy_sata_power_off(lane);
+ return 0; + break;
+
+ case PHY_MODE_ETHERNET: + case PHY_MODE_ETHERNET:
+ mvebu_a3700_comphy_ethernet_power_off(lane); + mvebu_a3700_comphy_ethernet_power_off(lane);
+ return 0; + break;
+
+ case PHY_MODE_PCIE: + case PHY_MODE_PCIE:
+ mvebu_a3700_comphy_pcie_power_off(lane); + mvebu_a3700_comphy_pcie_power_off(lane);
+ return 0; + break;
+
+ default: + default:
+ dev_err(lane->dev, "invalid COMPHY mode\n"); + dev_err(lane->dev, "invalid COMPHY mode\n");
+ return -EINVAL; + return -EINVAL;
+ } + }
+
+ return 0;
} }
static const struct phy_ops mvebu_a3700_comphy_ops = { static const struct phy_ops mvebu_a3700_comphy_ops = {
@ -1447,7 +1430,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
.set_mode = mvebu_a3700_comphy_set_mode, .set_mode = mvebu_a3700_comphy_set_mode,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
@@ -256,13 +1299,75 @@ static struct phy *mvebu_a3700_comphy_xl @@ -256,13 +1279,75 @@ static struct phy *mvebu_a3700_comphy_xl
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
@ -1523,7 +1506,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
for_each_available_child_of_node(pdev->dev.of_node, child) { for_each_available_child_of_node(pdev->dev.of_node, child) {
struct mvebu_a3700_comphy_lane *lane; struct mvebu_a3700_comphy_lane *lane;
@@ -277,7 +1382,7 @@ static int mvebu_a3700_comphy_probe(stru @@ -277,7 +1362,7 @@ static int mvebu_a3700_comphy_probe(stru
continue; continue;
} }
@ -1532,7 +1515,7 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
dev_err(&pdev->dev, "invalid 'reg' property\n"); dev_err(&pdev->dev, "invalid 'reg' property\n");
continue; continue;
} }
@@ -295,11 +1400,21 @@ static int mvebu_a3700_comphy_probe(stru @@ -295,15 +1380,26 @@ static int mvebu_a3700_comphy_probe(stru
return PTR_ERR(phy); return PTR_ERR(phy);
} }
@ -1554,7 +1537,12 @@ Signed-off-by: Marek Behún <kabel@kernel.org>
} }
provider = devm_of_phy_provider_register(&pdev->dev, provider = devm_of_phy_provider_register(&pdev->dev,
@@ -323,5 +1438,7 @@ static struct platform_driver mvebu_a370 mvebu_a3700_comphy_xlate);
+
return PTR_ERR_OR_ZERO(provider);
}
@@ -323,5 +1419,7 @@ static struct platform_driver mvebu_a370
module_platform_driver(mvebu_a3700_comphy_driver); module_platform_driver(mvebu_a3700_comphy_driver);
MODULE_AUTHOR("Miquèl Raynal <miquel.raynal@bootlin.com>"); MODULE_AUTHOR("Miquèl Raynal <miquel.raynal@bootlin.com>");

View File

@ -1,8 +1,8 @@
From 66c51c39fd4bf05e99debf0e71de5704231c57dc Mon Sep 17 00:00:00 2001 From 73a78b6130d9e13daca22b86ad52f063b9403e03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org> From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Thu, 23 Sep 2021 19:26:26 +0200 Date: Wed, 8 Dec 2021 03:40:35 +0100
Subject: [PATCH] arm64: dts: marvell: armada-37xx: Add xtal clock to comphy Subject: [PATCH 1/1] arm64: dts: marvell: armada-37xx: Add xtal clock to
node comphy node
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
@ -14,6 +14,7 @@ xtal rate (which, as far as we know, is used by all the existing boards).
Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
--- ---
arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 2 ++ arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 2 ++
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)

View File

@ -1,8 +1,8 @@
From 750bb44dbbe9dfb4ba3e1f8a746b831b39ba3cd9 Mon Sep 17 00:00:00 2001 From ee995101fde67f85a3cd4c74f4f92fc4592e726b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org> From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Thu, 23 Sep 2021 19:35:57 +0200 Date: Thu, 3 Feb 2022 22:44:42 +0100
Subject: [PATCH] Revert "ata: ahci: mvebu: Make SATA PHY optional for Armada Subject: [PATCH 1/3] Revert "ata: ahci: mvebu: Make SATA PHY optional for
3720" Armada 3720"
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
@ -20,6 +20,9 @@ remove this flag completely.
Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Link: https://lore.kernel.org/r/20220203214444.1508-4-kabel@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
--- ---
drivers/ata/ahci.h | 2 -- drivers/ata/ahci.h | 2 --
drivers/ata/ahci_mvebu.c | 2 +- drivers/ata/ahci_mvebu.c | 2 +-

View File

@ -1,8 +1,8 @@
From 9f0dfb279b1dd505d5e10b10e4a78a62030978d8 Mon Sep 17 00:00:00 2001 From 8e10548f7f4814e530857d2049d6af6bc78add53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org> From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Thu, 23 Sep 2021 19:40:06 +0200 Date: Thu, 3 Feb 2022 22:44:43 +0100
Subject: [PATCH] Revert "usb: host: xhci: mvebu: make USB 3.0 PHY optional for Subject: [PATCH 2/3] Revert "usb: host: xhci: mvebu: make USB 3.0 PHY optional
Armada 3720" for Armada 3720"
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
@ -22,6 +22,9 @@ remove this callback completely.
Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20220203214444.1508-5-kabel@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
--- ---
drivers/usb/host/xhci-mvebu.c | 42 ----------------------------------- drivers/usb/host/xhci-mvebu.c | 42 -----------------------------------
drivers/usb/host/xhci-mvebu.h | 6 ----- drivers/usb/host/xhci-mvebu.h | 6 -----

View File

@ -1,8 +1,8 @@
From 9a352062b7e3857742389dff6f64393481dc755e Mon Sep 17 00:00:00 2001 From 9a4556dad7bd0a6b8339cb72e169f5c76f2af6f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org> From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Thu, 23 Sep 2021 19:37:05 +0200 Date: Thu, 3 Feb 2022 22:44:44 +0100
Subject: [PATCH] Revert "PCI: aardvark: Fix initialization with old Marvell's Subject: [PATCH 3/3] Revert "PCI: aardvark: Fix initialization with old
Arm Trusted Firmware" Marvell's Arm Trusted Firmware"
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
@ -17,13 +17,16 @@ So remove dead code which handles -EOPNOTSUPP return value.
Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Link: https://lore.kernel.org/r/20220203214444.1508-6-kabel@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
--- ---
drivers/pci/controller/pci-aardvark.c | 4 +--- drivers/pci/controller/pci-aardvark.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-) 1 file changed, 1 insertion(+), 3 deletions(-)
--- a/drivers/pci/controller/pci-aardvark.c --- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c
@@ -1647,9 +1647,7 @@ static int advk_pcie_enable_phy(struct a @@ -1642,9 +1642,7 @@ static int advk_pcie_enable_phy(struct a
} }
ret = phy_power_on(pcie->phy); ret = phy_power_on(pcie->phy);

View File

@ -0,0 +1,194 @@
From 0a6fc70d76bddf98278af2ac000379c82aec8f11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Mon, 29 Aug 2022 10:30:46 +0200
Subject: [PATCH] phy: marvell: phy-mvebu-a3700-comphy: Remove broken reset
support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reset support for SATA PHY is somehow broken and after calling it, kernel
is not able to detect and initialize SATA disk Samsung SSD 850 EMT0 [1].
Reset support was introduced in commit 934337080c6c ("phy: marvell:
phy-mvebu-a3700-comphy: Add native kernel implementation") as part of
complete rewrite of this driver. v1 patch series of that commit [2] did
not contain reset support and was tested that is working fine with
Ethernet, SATA and USB PHYs without issues too.
So for now remove broken reset support and change implementation of
power_off callback to power off all functions on specified lane (and not
only selected function) because during startup kernel does not know which
function was selected and configured by bootloader. Same logic was used
also in v1 patch series of that commit.
This change fixes issues with initialization of SATA disk Samsung SSD 850
and disk is working again, like before mentioned commit.
Once problem with PHY reset callback is solved its functionality could be
re-introduced. But for now it is unknown why it does not work.
[1] - https://lore.kernel.org/r/20220531124159.3e4lgn2v462irbtz@shindev/
[2] - https://lore.kernel.org/r/20211028184242.22105-1-kabel@kernel.org/
Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes: 934337080c6c ("phy: marvell: phy-mvebu-a3700-comphy: Add native kernel implementation")
Cc: stable@vger.kernel.org # v5.18+
Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20220829083046.15082-1-pali@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 87 ++++----------------
1 file changed, 17 insertions(+), 70 deletions(-)
--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
@@ -274,7 +274,6 @@ struct mvebu_a3700_comphy_lane {
int submode;
bool invert_tx;
bool invert_rx;
- bool needs_reset;
};
struct gbe_phy_init_data_fix {
@@ -1097,40 +1096,12 @@ mvebu_a3700_comphy_pcie_power_off(struct
0x0, PU_PLL_BIT | PU_RX_BIT | PU_TX_BIT);
}
-static int mvebu_a3700_comphy_reset(struct phy *phy)
+static void mvebu_a3700_comphy_usb3_power_off(struct mvebu_a3700_comphy_lane *lane)
{
- struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy);
- u16 mask, data;
-
- dev_dbg(lane->dev, "resetting lane %d\n", lane->id);
-
- /* COMPHY reset for internal logic */
- comphy_lane_reg_set(lane, COMPHY_SFT_RESET,
- SFT_RST_NO_REG, SFT_RST_NO_REG);
-
- /* COMPHY register reset (cleared automatically) */
- comphy_lane_reg_set(lane, COMPHY_SFT_RESET, SFT_RST, SFT_RST);
-
- /* PIPE soft and register reset */
- data = PIPE_SOFT_RESET | PIPE_REG_RESET;
- mask = data;
- comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, data, mask);
-
- /* Release PIPE register reset */
- comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL,
- 0x0, PIPE_REG_RESET);
-
- /* Reset SB configuration register (only for lanes 0 and 1) */
- if (lane->id == 0 || lane->id == 1) {
- u32 mask, data;
-
- data = PIN_RESET_CORE_BIT | PIN_RESET_COMPHY_BIT |
- PIN_PU_PLL_BIT | PIN_PU_RX_BIT | PIN_PU_TX_BIT;
- mask = data | PIN_PU_IVREF_BIT | PIN_TX_IDLE_BIT;
- comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, data, mask);
- }
-
- return 0;
+ /*
+ * The USB3 MAC sets the USB3 PHY to low state, so we do not
+ * need to power off USB3 PHY again.
+ */
}
static bool mvebu_a3700_comphy_check_mode(int lane,
@@ -1171,10 +1142,6 @@ static int mvebu_a3700_comphy_set_mode(s
(lane->mode != mode || lane->submode != submode))
return -EBUSY;
- /* If changing mode, ensure reset is called */
- if (lane->mode != PHY_MODE_INVALID && lane->mode != mode)
- lane->needs_reset = true;
-
/* Just remember the mode, ->power_on() will do the real setup */
lane->mode = mode;
lane->submode = submode;
@@ -1185,7 +1152,6 @@ static int mvebu_a3700_comphy_set_mode(s
static int mvebu_a3700_comphy_power_on(struct phy *phy)
{
struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy);
- int ret;
if (!mvebu_a3700_comphy_check_mode(lane->id, lane->mode,
lane->submode)) {
@@ -1193,14 +1159,6 @@ static int mvebu_a3700_comphy_power_on(s
return -EINVAL;
}
- if (lane->needs_reset) {
- ret = mvebu_a3700_comphy_reset(phy);
- if (ret)
- return ret;
-
- lane->needs_reset = false;
- }
-
switch (lane->mode) {
case PHY_MODE_USB_HOST_SS:
dev_dbg(lane->dev, "set lane %d to USB3 host mode\n", lane->id);
@@ -1224,38 +1182,28 @@ static int mvebu_a3700_comphy_power_off(
{
struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy);
- switch (lane->mode) {
- case PHY_MODE_USB_HOST_SS:
- /*
- * The USB3 MAC sets the USB3 PHY to low state, so we do not
- * need to power off USB3 PHY again.
- */
- break;
-
- case PHY_MODE_SATA:
- mvebu_a3700_comphy_sata_power_off(lane);
- break;
-
- case PHY_MODE_ETHERNET:
+ switch (lane->id) {
+ case 0:
+ mvebu_a3700_comphy_usb3_power_off(lane);
mvebu_a3700_comphy_ethernet_power_off(lane);
- break;
-
- case PHY_MODE_PCIE:
+ return 0;
+ case 1:
mvebu_a3700_comphy_pcie_power_off(lane);
- break;
-
+ mvebu_a3700_comphy_ethernet_power_off(lane);
+ return 0;
+ case 2:
+ mvebu_a3700_comphy_usb3_power_off(lane);
+ mvebu_a3700_comphy_sata_power_off(lane);
+ return 0;
default:
dev_err(lane->dev, "invalid COMPHY mode\n");
return -EINVAL;
}
-
- return 0;
}
static const struct phy_ops mvebu_a3700_comphy_ops = {
.power_on = mvebu_a3700_comphy_power_on,
.power_off = mvebu_a3700_comphy_power_off,
- .reset = mvebu_a3700_comphy_reset,
.set_mode = mvebu_a3700_comphy_set_mode,
.owner = THIS_MODULE,
};
@@ -1393,8 +1341,7 @@ static int mvebu_a3700_comphy_probe(stru
* To avoid relying on the bootloader/firmware configuration,
* power off all comphys.
*/
- mvebu_a3700_comphy_reset(phy);
- lane->needs_reset = false;
+ mvebu_a3700_comphy_power_off(phy);
}
provider = devm_of_phy_provider_register(&pdev->dev,

View File

@ -0,0 +1,32 @@
From 26bccc9671ba5e01f7153addbe94e7dc3f677375 Mon Sep 17 00:00:00 2001
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date: Mon, 3 Jan 2022 03:03:16 +0000
Subject: [PATCH 13/14] mtd: parsers: qcom: Don't print error message on
-EPROBE_DEFER
Its possible for the main smem driver to not be loaded by the time we come
along to parse the smem partition description but, this is a perfectly
normal thing.
No need to print out an error message in this case.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220103030316.58301-3-bryan.odonoghue@linaro.org
---
drivers/mtd/parsers/qcomsmempart.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/mtd/parsers/qcomsmempart.c
+++ b/drivers/mtd/parsers/qcomsmempart.c
@@ -75,7 +75,8 @@ static int parse_qcomsmem_part(struct mt
pr_debug("Parsing partition table info from SMEM\n");
ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len);
if (IS_ERR(ptable)) {
- pr_err("Error reading partition table header\n");
+ if (PTR_ERR(ptable) != -EPROBE_DEFER)
+ pr_err("Error reading partition table header\n");
return PTR_ERR(ptable);
}

View File

@ -1,37 +1,25 @@
From 8e18c5fef75debfae3531fbd6901f3bf317d91ed Mon Sep 17 00:00:00 2001 From e19de30d20809af3221ef8a2648b8a8a52e02d90 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org> From: Daniel Golle <daniel@makrotopia.org>
Date: Fri, 9 Sep 2022 04:28:43 +0100 Date: Wed, 21 Sep 2022 01:23:14 +0100
Subject: [PATCH] net: dsa: mt7530: add support for in-band link status Subject: [PATCH 1/1] net: dsa: mt7530: add support for in-band link status
To: linux-mediatek@lists.infradead.org,
netdev@vger.kernel.org
Cc: Russell King <linux@armlinux.org.uk>,
Sean Wang <sean.wang@mediatek.com>,
Landen Chao <Landen.Chao@mediatek.com>,
DENG Qingfang <dqfext@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
David S. Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Philipp Zabel <p.zabel@pengutronix.de>
Read link status from SGMII PCS for in-band managed 2500Base-X and Read link status from SGMII PCS for in-band managed 2500Base-X and
1000Base-X connection on a MAC port of the MT7531. This is needed to 1000Base-X connection on a MAC port of the MT7531. This is needed to
get the SFP cage working which is connected to SGMII interface of get the SFP cage working which is connected to SGMII interface of
port 5 of the MT7531 switch IC on the Bananapi BPi-R3 board. port 5 of the MT7531 switch IC on the Bananapi BPi-R3 board.
While at it also handle an_complete for both the autoneg and the
non-autoneg codepath.
Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
--- ---
drivers/net/dsa/mt7530.c | 48 +++++++++++++++++++++++++++++----------- drivers/net/dsa/mt7530.c | 50 +++++++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 13 deletions(-) drivers/net/dsa/mt7530.h | 1 +
2 files changed, 38 insertions(+), 13 deletions(-)
--- a/drivers/net/dsa/mt7530.c --- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c
@@ -2703,9 +2703,6 @@ mt7531_mac_config(struct dsa_switch *ds, @@ -2699,9 +2699,6 @@ mt7531_mac_config(struct dsa_switch *ds,
case PHY_INTERFACE_MODE_NA: case PHY_INTERFACE_MODE_NA:
case PHY_INTERFACE_MODE_1000BASEX: case PHY_INTERFACE_MODE_1000BASEX:
case PHY_INTERFACE_MODE_2500BASEX: case PHY_INTERFACE_MODE_2500BASEX:
@ -41,7 +29,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
return mt7531_sgmii_setup_mode_force(priv, port, interface); return mt7531_sgmii_setup_mode_force(priv, port, interface);
default: default:
return -EINVAL; return -EINVAL;
@@ -2781,13 +2778,6 @@ unsupported: @@ -2777,13 +2774,6 @@ unsupported:
return; return;
} }
@ -55,7 +43,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port));
mcr_new = mcr_cur; mcr_new = mcr_cur;
mcr_new &= ~PMCR_LINK_SETTINGS_MASK; mcr_new &= ~PMCR_LINK_SETTINGS_MASK;
@@ -2924,6 +2914,9 @@ static void mt753x_phylink_get_caps(stru @@ -2920,6 +2910,9 @@ static void mt753x_phylink_get_caps(stru
config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
MAC_10 | MAC_100 | MAC_1000FD; MAC_10 | MAC_100 | MAC_1000FD;
@ -65,7 +53,15 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/* This driver does not make use of the speed, duplex, pause or the /* This driver does not make use of the speed, duplex, pause or the
* advertisement in its mac_config, so it is safe to mark this driver * advertisement in its mac_config, so it is safe to mark this driver
* as non-legacy. * as non-legacy.
@@ -3019,16 +3012,43 @@ mt7531_sgmii_pcs_get_state_an(struct mt7 @@ -2985,6 +2978,7 @@ mt7531_sgmii_pcs_get_state_an(struct mt7
status = mt7530_read(priv, MT7531_PCS_CONTROL_1(port));
state->link = !!(status & MT7531_SGMII_LINK_STATUS);
+ state->an_complete = !!(status & MT7531_SGMII_AN_COMPLETE);
if (state->interface == PHY_INTERFACE_MODE_SGMII &&
(status & MT7531_SGMII_AN_ENABLE)) {
val = mt7530_read(priv, MT7531_PCS_SPEED_ABILITY(port));
@@ -3015,16 +3009,44 @@ mt7531_sgmii_pcs_get_state_an(struct mt7
return 0; return 0;
} }
@ -80,13 +76,15 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+ if (!state->link) + if (!state->link)
+ return; + return;
+ +
+ state->an_complete = state->link;
+
+ if (state->interface == PHY_INTERFACE_MODE_2500BASEX) + if (state->interface == PHY_INTERFACE_MODE_2500BASEX)
+ state->speed = SPEED_2500; + state->speed = SPEED_2500;
+ else + else
+ state->speed = SPEED_1000; + state->speed = SPEED_1000;
+ +
+ state->duplex = DUPLEX_FULL; + state->duplex = DUPLEX_FULL;
+ state->pause = 0; + state->pause = MLO_PAUSE_NONE;
+} +}
+ +
static void mt7531_pcs_get_state(struct phylink_pcs *pcs, static void mt7531_pcs_get_state(struct phylink_pcs *pcs,
@ -94,7 +92,6 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
{ {
struct mt7530_priv *priv = pcs_to_mt753x_pcs(pcs)->priv; struct mt7530_priv *priv = pcs_to_mt753x_pcs(pcs)->priv;
int port = pcs_to_mt753x_pcs(pcs)->port; int port = pcs_to_mt753x_pcs(pcs)->port;
+ unsigned int val;
- if (state->interface == PHY_INTERFACE_MODE_SGMII) - if (state->interface == PHY_INTERFACE_MODE_SGMII)
+ if (state->interface == PHY_INTERFACE_MODE_SGMII) { + if (state->interface == PHY_INTERFACE_MODE_SGMII) {
@ -112,7 +109,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
} }
static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int mode, static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
@@ -3069,6 +3089,8 @@ mt753x_setup(struct dsa_switch *ds) @@ -3065,6 +3087,8 @@ mt753x_setup(struct dsa_switch *ds)
priv->pcs[i].pcs.ops = priv->info->pcs_ops; priv->pcs[i].pcs.ops = priv->info->pcs_ops;
priv->pcs[i].priv = priv; priv->pcs[i].priv = priv;
priv->pcs[i].port = i; priv->pcs[i].port = i;
@ -121,3 +118,13 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
} }
ret = priv->info->sw_setup(ds); ret = priv->info->sw_setup(ds);
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -373,6 +373,7 @@ enum mt7530_vlan_port_acc_frm {
#define MT7531_SGMII_LINK_STATUS BIT(18)
#define MT7531_SGMII_AN_ENABLE BIT(12)
#define MT7531_SGMII_AN_RESTART BIT(9)
+#define MT7531_SGMII_AN_COMPLETE BIT(21)
/* Register for SGMII PCS_SPPED_ABILITY */
#define MT7531_PCS_SPEED_ABILITY(p) MT7531_SGMII_REG(p, 0x08)

View File

@ -0,0 +1,98 @@
From 8475c4b70b040f9d8cbc308100f2c4d865f810b3 Mon Sep 17 00:00:00 2001
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Date: Tue, 13 Sep 2022 20:06:27 +0100
Subject: [PATCH 1/1] net: sfp: re-implement soft state polling setup
Re-implement the decision making for soft state polling. Instead of
generating the soft state mask in sfp_soft_start_poll() by looking at
which GPIOs are available, record their availability in
sfp_sm_mod_probe() in sfp->state_hw_mask.
This will then allow us to clear bits in sfp->state_hw_mask in module
specific quirks when the hardware signals should not be used, thereby
allowing us to switch to using the software state polling.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/phy/sfp.c | 38 ++++++++++++++++++++++++++------------
1 file changed, 26 insertions(+), 12 deletions(-)
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -234,6 +234,7 @@ struct sfp {
bool need_poll;
struct mutex st_mutex; /* Protects state */
+ unsigned int state_hw_mask;
unsigned int state_soft_mask;
unsigned int state;
struct delayed_work poll;
@@ -499,17 +500,18 @@ static void sfp_soft_set_state(struct sf
static void sfp_soft_start_poll(struct sfp *sfp)
{
const struct sfp_eeprom_id *id = &sfp->id;
+ unsigned int mask = 0;
sfp->state_soft_mask = 0;
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_DISABLE &&
- !sfp->gpio[GPIO_TX_DISABLE])
- sfp->state_soft_mask |= SFP_F_TX_DISABLE;
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_FAULT &&
- !sfp->gpio[GPIO_TX_FAULT])
- sfp->state_soft_mask |= SFP_F_TX_FAULT;
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_RX_LOS &&
- !sfp->gpio[GPIO_LOS])
- sfp->state_soft_mask |= SFP_F_LOS;
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_DISABLE)
+ mask |= SFP_F_TX_DISABLE;
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_FAULT)
+ mask |= SFP_F_TX_FAULT;
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_RX_LOS)
+ mask |= SFP_F_LOS;
+
+ // Poll the soft state for hardware pins we want to ignore
+ sfp->state_soft_mask = ~sfp->state_hw_mask & mask;
if (sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT) &&
!sfp->need_poll)
@@ -523,10 +525,11 @@ static void sfp_soft_stop_poll(struct sf
static unsigned int sfp_get_state(struct sfp *sfp)
{
- unsigned int state = sfp->get_state(sfp);
+ unsigned int soft = sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT);
+ unsigned int state;
- if (state & SFP_F_PRESENT &&
- sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT))
+ state = sfp->get_state(sfp) & sfp->state_hw_mask;
+ if (state & SFP_F_PRESENT && soft)
state |= sfp_soft_get_state(sfp);
return state;
@@ -1940,6 +1943,15 @@ static int sfp_sm_mod_probe(struct sfp *
if (ret < 0)
return ret;
+ /* Initialise state bits to use from hardware */
+ sfp->state_hw_mask = SFP_F_PRESENT;
+ if (sfp->gpio[GPIO_TX_DISABLE])
+ sfp->state_hw_mask |= SFP_F_TX_DISABLE;
+ if (sfp->gpio[GPIO_TX_FAULT])
+ sfp->state_hw_mask |= SFP_F_TX_FAULT;
+ if (sfp->gpio[GPIO_LOS])
+ sfp->state_hw_mask |= SFP_F_LOS;
+
if (!memcmp(id.base.vendor_name, "ALCATELLUCENT ", 16) &&
!memcmp(id.base.vendor_pn, "3FE46541AA ", 16))
sfp->module_t_start_up = T_START_UP_BAD_GPON;
@@ -2565,6 +2577,8 @@ static int sfp_probe(struct platform_dev
return PTR_ERR(sfp->gpio[i]);
}
+ sfp->state_hw_mask = SFP_F_PRESENT;
+
sfp->get_state = sfp_gpio_get_state;
sfp->set_state = sfp_gpio_set_state;

View File

@ -1,13 +1,14 @@
From a4648a1957cd79bc389538aa0472db39a56e3df6 Mon Sep 17 00:00:00 2001 From 23571c7b96437483d28a990c906cc81f5f66374e Mon Sep 17 00:00:00 2001
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Date: Fri, 26 Aug 2022 08:43:30 +0100 Date: Tue, 13 Sep 2022 20:06:32 +0100
Subject: [PATCH 1/6] net: sfp: move quirk handling into sfp.c Subject: [PATCH 1/1] net: sfp: move quirk handling into sfp.c
We need to handle more quirks than just those which affect the link We need to handle more quirks than just those which affect the link
modes of the module. Move the quirk lookup into sfp.c, and pass the modes of the module. Move the quirk lookup into sfp.c, and pass the
quirk to sfp-bus.c quirk to sfp-bus.c
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--- ---
drivers/net/phy/sfp-bus.c | 98 ++------------------------------------- drivers/net/phy/sfp-bus.c | 98 ++-------------------------------------
drivers/net/phy/sfp.c | 94 ++++++++++++++++++++++++++++++++++++- drivers/net/phy/sfp.c | 94 ++++++++++++++++++++++++++++++++++++-
@ -141,7 +142,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
ret = ops->module_insert(bus->upstream, id); ret = ops->module_insert(bus->upstream, id);
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -252,6 +252,8 @@ struct sfp { @@ -253,6 +253,8 @@ struct sfp {
unsigned int module_t_start_up; unsigned int module_t_start_up;
bool tx_fault_ignore; bool tx_fault_ignore;
@ -150,7 +151,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
#if IS_ENABLED(CONFIG_HWMON) #if IS_ENABLED(CONFIG_HWMON)
struct sfp_diag diag; struct sfp_diag diag;
struct delayed_work hwmon_probe; struct delayed_work hwmon_probe;
@@ -308,6 +310,93 @@ static const struct of_device_id sfp_of_ @@ -309,6 +311,93 @@ static const struct of_device_id sfp_of_
}; };
MODULE_DEVICE_TABLE(of, sfp_of_match); MODULE_DEVICE_TABLE(of, sfp_of_match);
@ -244,7 +245,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
static unsigned long poll_jiffies; static unsigned long poll_jiffies;
static unsigned int sfp_gpio_get_state(struct sfp *sfp) static unsigned int sfp_gpio_get_state(struct sfp *sfp)
@@ -1952,6 +2041,8 @@ static int sfp_sm_mod_probe(struct sfp * @@ -1964,6 +2053,8 @@ static int sfp_sm_mod_probe(struct sfp *
else else
sfp->tx_fault_ignore = false; sfp->tx_fault_ignore = false;
@ -253,7 +254,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
return 0; return 0;
} }
@@ -2063,7 +2154,8 @@ static void sfp_sm_module(struct sfp *sf @@ -2075,7 +2166,8 @@ static void sfp_sm_module(struct sfp *sf
break; break;
/* Report the module insertion to the upstream device */ /* Report the module insertion to the upstream device */

View File

@ -1,12 +1,13 @@
From 21fdd8281de3022aee35dd5bfccc892bd46529a3 Mon Sep 17 00:00:00 2001 From 275416754e9a262c97a1ad6f806a4bc6e0464aa2 Mon Sep 17 00:00:00 2001
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Date: Fri, 26 Aug 2022 08:43:35 +0100 Date: Tue, 13 Sep 2022 20:06:37 +0100
Subject: [PATCH 2/6] net: sfp: move Alcatel Lucent 3FE46541AA fixup Subject: [PATCH 1/1] net: sfp: move Alcatel Lucent 3FE46541AA fixup
Add a new fixup mechanism to the SFP quirks, and use it for this Add a new fixup mechanism to the SFP quirks, and use it for this
module. module.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--- ---
drivers/net/phy/sfp.c | 14 +++++++++----- drivers/net/phy/sfp.c | 14 +++++++++-----
drivers/net/phy/sfp.h | 1 + drivers/net/phy/sfp.h | 1 +
@ -14,7 +15,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -310,6 +310,11 @@ static const struct of_device_id sfp_of_ @@ -311,6 +311,11 @@ static const struct of_device_id sfp_of_
}; };
MODULE_DEVICE_TABLE(of, sfp_of_match); MODULE_DEVICE_TABLE(of, sfp_of_match);
@ -26,7 +27,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id, static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
unsigned long *modes) unsigned long *modes)
{ {
@@ -340,6 +345,7 @@ static const struct sfp_quirk sfp_quirks @@ -341,6 +346,7 @@ static const struct sfp_quirk sfp_quirks
.vendor = "ALCATELLUCENT", .vendor = "ALCATELLUCENT",
.part = "3FE46541AA", .part = "3FE46541AA",
.modes = sfp_quirk_2500basex, .modes = sfp_quirk_2500basex,
@ -34,9 +35,9 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
}, { }, {
// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd // Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
// NRZ in their EEPROM // NRZ in their EEPROM
@@ -2029,11 +2035,7 @@ static int sfp_sm_mod_probe(struct sfp * @@ -2041,11 +2047,7 @@ static int sfp_sm_mod_probe(struct sfp *
if (ret < 0) if (sfp->gpio[GPIO_LOS])
return ret; sfp->state_hw_mask |= SFP_F_LOS;
- if (!memcmp(id.base.vendor_name, "ALCATELLUCENT ", 16) && - if (!memcmp(id.base.vendor_name, "ALCATELLUCENT ", 16) &&
- !memcmp(id.base.vendor_pn, "3FE46541AA ", 16)) - !memcmp(id.base.vendor_pn, "3FE46541AA ", 16))
@ -47,7 +48,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
if (!memcmp(id.base.vendor_name, "HUAWEI ", 16) && if (!memcmp(id.base.vendor_name, "HUAWEI ", 16) &&
!memcmp(id.base.vendor_pn, "MA5671A ", 16)) !memcmp(id.base.vendor_pn, "MA5671A ", 16))
@@ -2042,6 +2044,8 @@ static int sfp_sm_mod_probe(struct sfp * @@ -2054,6 +2056,8 @@ static int sfp_sm_mod_probe(struct sfp *
sfp->tx_fault_ignore = false; sfp->tx_fault_ignore = false;
sfp->quirk = sfp_lookup_quirk(&id); sfp->quirk = sfp_lookup_quirk(&id);

View File

@ -1,18 +1,19 @@
From 4c9d8c654827ef42da702c5b6c3392e8ac0bc60a Mon Sep 17 00:00:00 2001 From 5029be761161374a3624aa7b4670174c35449bf5 Mon Sep 17 00:00:00 2001
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Date: Fri, 26 Aug 2022 08:43:40 +0100 Date: Tue, 13 Sep 2022 20:06:42 +0100
Subject: [PATCH 3/6] net: sfp: move Huawei MA5671A fixup Subject: [PATCH 1/1] net: sfp: move Huawei MA5671A fixup
Move this module over to the new fixup mechanism. Move this module over to the new fixup mechanism.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--- ---
drivers/net/phy/sfp.c | 12 +++++++----- drivers/net/phy/sfp.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-) 1 file changed, 7 insertions(+), 5 deletions(-)
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -315,6 +315,11 @@ static void sfp_fixup_long_startup(struc @@ -316,6 +316,11 @@ static void sfp_fixup_long_startup(struc
sfp->module_t_start_up = T_START_UP_BAD_GPON; sfp->module_t_start_up = T_START_UP_BAD_GPON;
} }
@ -24,7 +25,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id, static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
unsigned long *modes) unsigned long *modes)
{ {
@@ -352,6 +357,7 @@ static const struct sfp_quirk sfp_quirks @@ -353,6 +358,7 @@ static const struct sfp_quirk sfp_quirks
.vendor = "HUAWEI", .vendor = "HUAWEI",
.part = "MA5671A", .part = "MA5671A",
.modes = sfp_quirk_2500basex, .modes = sfp_quirk_2500basex,
@ -32,7 +33,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
}, { }, {
// Lantech 8330-262D-E can operate at 2500base-X, but // Lantech 8330-262D-E can operate at 2500base-X, but
// incorrectly report 2500MBd NRZ in their EEPROM // incorrectly report 2500MBd NRZ in their EEPROM
@@ -2037,11 +2043,7 @@ static int sfp_sm_mod_probe(struct sfp * @@ -2049,11 +2055,7 @@ static int sfp_sm_mod_probe(struct sfp *
sfp->module_t_start_up = T_START_UP; sfp->module_t_start_up = T_START_UP;

View File

@ -1,18 +1,19 @@
From 43ac680124bc57951a6d0356b41498c2324388bf Mon Sep 17 00:00:00 2001 From 73472c830eae5fce2107f7f086f1e6827d215caf Mon Sep 17 00:00:00 2001
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Date: Fri, 26 Aug 2022 08:43:45 +0100 Date: Tue, 13 Sep 2022 20:06:48 +0100
Subject: [PATCH 4/6] net: sfp: add support for HALNy GPON SFP Subject: [PATCH 1/1] net: sfp: add support for HALNy GPON SFP
Add a quirk for the HALNy HL-GSFP module, which appears to have an Add a quirk for the HALNy HL-GSFP module, which appears to have an
inverted RX_LOS signal, and possibly uses TX_FAULT as an inverted inverted RX_LOS signal, and maybe uses TX_FAULT as a serial port
host-link status signal. As we can't be certain about the modules transmit pin. Rather than use these hardware signals, switch to
use of TX_FAULT, we ignore it. using software polling for these status signals.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--- ---
drivers/net/phy/sfp-bus.c | 2 +- drivers/net/phy/sfp-bus.c | 2 +-
drivers/net/phy/sfp.c | 29 ++++++++++++++++++++++++++--- drivers/net/phy/sfp.c | 21 ++++++++++++++++++---
2 files changed, 27 insertions(+), 4 deletions(-) 2 files changed, 19 insertions(+), 4 deletions(-)
--- a/drivers/net/phy/sfp-bus.c --- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c
@ -27,31 +28,23 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
linkmode_or(support, support, modes); linkmode_or(support, support, modes);
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -320,6 +320,23 @@ static void sfp_fixup_ignore_tx_fault(st @@ -321,6 +321,15 @@ static void sfp_fixup_ignore_tx_fault(st
sfp->tx_fault_ignore = true; sfp->tx_fault_ignore = true;
} }
+static void sfp_fixup_inverted_los(struct sfp *sfp)
+{
+ const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
+ const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
+
+ sfp->id.ext.options &= ~los_normal;
+ sfp->id.ext.options |= los_inverted;
+}
+
+static void sfp_fixup_halny_gsfp(struct sfp *sfp) +static void sfp_fixup_halny_gsfp(struct sfp *sfp)
+{ +{
+ /* LOS is inverted */ + /* Ignore the TX_FAULT and LOS signals on this module.
+ sfp_fixup_inverted_los(sfp); + * these are possibly used for other purposes on this
+ /* TX fault might be inverted, but we don't know for certain. */ + * module, e.g. a serial port.
+ sfp_fixup_ignore_tx_fault(sfp); + */
+ sfp->state_hw_mask &= ~(SFP_F_TX_FAULT | SFP_F_LOS);
+} +}
+ +
static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id, static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
unsigned long *modes) unsigned long *modes)
{ {
@@ -352,6 +369,10 @@ static const struct sfp_quirk sfp_quirks @@ -353,6 +362,10 @@ static const struct sfp_quirk sfp_quirks
.modes = sfp_quirk_2500basex, .modes = sfp_quirk_2500basex,
.fixup = sfp_fixup_long_startup, .fixup = sfp_fixup_long_startup,
}, { }, {
@ -62,7 +55,7 @@ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd // Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
// NRZ in their EEPROM // NRZ in their EEPROM
.vendor = "HUAWEI", .vendor = "HUAWEI",
@@ -368,16 +389,18 @@ static const struct sfp_quirk sfp_quirks @@ -369,16 +382,18 @@ static const struct sfp_quirk sfp_quirks
.vendor = "UBNT", .vendor = "UBNT",
.part = "UF-INSTANT", .part = "UF-INSTANT",
.modes = sfp_quirk_ubnt_uf_instant, .modes = sfp_quirk_ubnt_uf_instant,

View File

@ -1,23 +1,8 @@
From 8743af8a77dd909970462ca578358128cce5d027 Mon Sep 17 00:00:00 2001 From c9da02bfb1112461e048d3b736afb1873f6f4ccf Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org> From: Daniel Golle <daniel@makrotopia.org>
Date: Tue, 27 Sep 2022 15:39:39 +0100 Date: Tue, 27 Sep 2022 16:30:02 +0100
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix mask of Subject: [PATCH 1/1] net: ethernet: mtk_eth_soc: fix mask of
RX_DMA_GET_SPORT{,_V2} RX_DMA_GET_SPORT{,_V2}
To: linux-mediatek@lists.infradead.org,
netdev@vger.kernel.org,
Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Sujuan Chen <sujuan.chen@mediatek.com>,
Bo Jiao <Bo.Jiao@mediatek.com>,
Felix Fietkau <nbd@nbd.name>,
John Crispin <john@phrozen.org>,
Sean Wang <sean.wang@mediatek.com>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
David S. Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Chen Minqiang <ptpt52@gmail.com>
The bitmasks applied in RX_DMA_GET_SPORT and RX_DMA_GET_SPORT_V2 macros The bitmasks applied in RX_DMA_GET_SPORT and RX_DMA_GET_SPORT_V2 macros
were swapped. Fix that. were swapped. Fix that.
@ -26,6 +11,8 @@ Reported-by: Chen Minqiang <ptpt52@gmail.com>
Fixes: 160d3a9b192985 ("net: ethernet: mtk_eth_soc: introduce MTK_NETSYS_V2 support") Fixes: 160d3a9b192985 ("net: ethernet: mtk_eth_soc: introduce MTK_NETSYS_V2 support")
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://lore.kernel.org/r/YzMW+mg9UsaCdKRQ@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--- ---
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++-- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)

View File

@ -1,24 +1,8 @@
From cd8e1f340c3e571b78952d4ca2c128d183a47cc2 Mon Sep 17 00:00:00 2001 From ae3ed15da5889263de372ff9df2e83e16acca4cb Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org> From: Daniel Golle <daniel@makrotopia.org>
Date: Wed, 28 Sep 2022 02:17:02 +0100 Date: Fri, 30 Sep 2022 01:56:53 +0100
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix state in Subject: [PATCH 1/1] net: ethernet: mtk_eth_soc: fix state in
__mtk_foe_entry_clear __mtk_foe_entry_clear
To: linux-mediatek@lists.infradead.org,
netdev@vger.kernel.org,
Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Sujuan Chen <sujuan.chen@mediatek.com>,
Bo Jiao <Bo.Jiao@mediatek.com>,
Felix Fietkau <nbd@nbd.name>,
John Crispin <john@phrozen.org>,
Sean Wang <sean.wang@mediatek.com>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
David S. Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Chen Minqiang <ptpt52@gmail.com>,
Thomas Hühn <thomas.huehn@hs-nordhausen.de>
Setting ib1 state to MTK_FOE_STATE_UNBIND in __mtk_foe_entry_clear Setting ib1 state to MTK_FOE_STATE_UNBIND in __mtk_foe_entry_clear
routine as done by commit 0e80707d94e4c8 ("net: ethernet: mtk_eth_soc: routine as done by commit 0e80707d94e4c8 ("net: ethernet: mtk_eth_soc:
@ -32,8 +16,10 @@ Tested on MT7622 (Linksys E8450) and MT7986 (BananaPi BPI-R3).
Suggested-by: Felix Fietkau <nbd@nbd.name> Suggested-by: Felix Fietkau <nbd@nbd.name>
Fixes: 0e80707d94e4c8 ("net: ethernet: mtk_eth_soc: fix typo in __mtk_foe_entry_clear") Fixes: 0e80707d94e4c8 ("net: ethernet: mtk_eth_soc: fix typo in __mtk_foe_entry_clear")
Fixes: 33fc42de33278 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries") Fixes: 33fc42de33278b ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://lore.kernel.org/r/YzY+1Yg0FBXcnrtc@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--- ---
drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +- drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -1,7 +1,7 @@
From 078c6a1cbd4cd7496048786beec2e312577bebbf Mon Sep 17 00:00:00 2001 From 078c6a1cbd4cd7496048786beec2e312577bebbf Mon Sep 17 00:00:00 2001
From: Pawel Dembicki <paweldembicki@gmail.com> From: Pawel Dembicki <paweldembicki@gmail.com>
Date: Tue, 11 Jan 2022 23:11:32 +0100 Date: Tue, 11 Jan 2022 23:11:32 +0100
Subject: [PATCH] net: qmi_wwan: add ZTE MF286D modem 19d2:1485 Subject: [PATCH 1/1] net: qmi_wwan: add ZTE MF286D modem 19d2:1485
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit

View File

@ -1,13 +1,7 @@
From ced9d535126a81a85b022cff1e2fd8e0da46c7ae Mon Sep 17 00:00:00 2001 From be55622ce673f9692cc15d26d77a050cda42a3d3 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org> From: Daniel Golle <daniel@makrotopia.org>
Date: Fri, 9 Sep 2022 18:25:21 +0100 Date: Fri, 9 Sep 2022 21:00:30 +0100
Subject: [PATCH] Bluetooth: btusb: Add a new VID/PID 0e8d/0608 for MT7921 Subject: [PATCH 1/1] Bluetooth: btusb: Add a new VID/PID 0e8d/0608 for MT7921
To: linux-mediatek@lists.infradead.org,
linux-bluetooth@vger.kernel.org
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
Johan Hedberg <johan.hedberg@gmail.com>,
Marcel Holtmann <marcel@holtmann.org>
Add a new PID/VID 0e8d/0608 for MT7921K chip found on AMD RZ608 module. Add a new PID/VID 0e8d/0608 for MT7921K chip found on AMD RZ608 module.
@ -53,6 +47,7 @@ E: Ad=8a(I) Atr=03(Int.) MxPS= 64 Ivl=125us
E: Ad=0a(O) Atr=03(Int.) MxPS= 64 Ivl=125us E: Ad=0a(O) Atr=03(Int.) MxPS= 64 Ivl=125us
Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
--- ---
drivers/bluetooth/btusb.c | 3 +++ drivers/bluetooth/btusb.c | 3 +++
1 file changed, 3 insertions(+) 1 file changed, 3 insertions(+)

View File

@ -26,7 +26,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -369,6 +369,11 @@ static const struct sfp_quirk sfp_quirks @@ -373,6 +373,11 @@ static const struct sfp_quirk sfp_quirks
.modes = sfp_quirk_2500basex, .modes = sfp_quirk_2500basex,
.fixup = sfp_fixup_ignore_tx_fault, .fixup = sfp_fixup_ignore_tx_fault,
}, { }, {
@ -38,7 +38,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
// Lantech 8330-262D-E can operate at 2500base-X, but // Lantech 8330-262D-E can operate at 2500base-X, but
// incorrectly report 2500MBd NRZ in their EEPROM // incorrectly report 2500MBd NRZ in their EEPROM
.vendor = "Lantech", .vendor = "Lantech",
@@ -2303,7 +2308,8 @@ static void sfp_sm_main(struct sfp *sfp, @@ -2306,7 +2311,8 @@ static void sfp_sm_main(struct sfp *sfp,
* or t_start_up, so assume there is a fault. * or t_start_up, so assume there is a fault.
*/ */
sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT, sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
@ -48,7 +48,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
init_done: init_done:
sfp->sm_phy_retries = R_PHY_RETRY; sfp->sm_phy_retries = R_PHY_RETRY;
@@ -2526,10 +2532,12 @@ static void sfp_check_state(struct sfp * @@ -2529,10 +2535,12 @@ static void sfp_check_state(struct sfp *
mutex_lock(&sfp->st_mutex); mutex_lock(&sfp->st_mutex);
state = sfp_get_state(sfp); state = sfp_get_state(sfp);
changed = state ^ sfp->state; changed = state ^ sfp->state;

View File

@ -1,28 +0,0 @@
From d8d1a9a77863a8c7031ae82a1d461aa78eb72a7b Mon Sep 17 00:00:00 2001
From: Rob Herring <robh@kernel.org>
Date: Mon, 11 Oct 2021 14:12:43 -0500
Subject: [PATCH] checks: Drop interrupt provider '#address-cells' check
'#address-cells' is only needed when parsing 'interrupt-map' properties, so
remove it from the common interrupt-provider test.
Cc: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Rob Herring <robh@kernel.org>
Message-Id: <20211011191245.1009682-3-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
--- a/scripts/dtc/checks.c
+++ b/scripts/dtc/checks.c
@@ -1569,11 +1569,6 @@ static void check_interrupt_provider(str
if (!prop)
FAIL(c, dti, node,
"Missing #interrupt-cells in interrupt provider");
-
- prop = get_property(node, "#address-cells");
- if (!prop)
- FAIL(c, dti, node,
- "Missing #address-cells in interrupt provider");
}
WARNING(interrupt_provider, check_interrupt_provider, NULL);

View File

@ -1,136 +0,0 @@
From 87ec87c2ad615c1a177cd08ef5fa29fc739f6e50 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 23 Dec 2018 18:06:53 +0100
Subject: [PATCH] MIPS: Add CPU option reporting to /proc/cpuinfo
Many MIPS CPUs have optional CPU features which are not activates for
all CPU cores. Print the CPU options which are implemented in the core
in /proc/cpuinfo. This makes it possible to see what features are
supported and which are not supported. This should cover all standard
MIPS extensions, before it only printed information about the main MIPS
ASEs.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
arch/mips/kernel/proc.c | 116 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 116 insertions(+)
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -138,6 +138,116 @@ static int show_cpuinfo(struct seq_file
seq_printf(m, "micromips kernel\t: %s\n",
(read_c0_config3() & MIPS_CONF3_ISA_OE) ? "yes" : "no");
}
+
+ seq_printf(m, "Options implemented\t:");
+ if (cpu_has_tlb)
+ seq_printf(m, "%s", " tlb");
+ if (cpu_has_ftlb)
+ seq_printf(m, "%s", " ftlb");
+ if (cpu_has_tlbinv)
+ seq_printf(m, "%s", " tlbinv");
+ if (cpu_has_segments)
+ seq_printf(m, "%s", " segments");
+ if (cpu_has_rixiex)
+ seq_printf(m, "%s", " rixiex");
+ if (cpu_has_ldpte)
+ seq_printf(m, "%s", " ldpte");
+ if (cpu_has_maar)
+ seq_printf(m, "%s", " maar");
+ if (cpu_has_rw_llb)
+ seq_printf(m, "%s", " rw_llb");
+ if (cpu_has_4kex)
+ seq_printf(m, "%s", " 4kex");
+ if (cpu_has_3k_cache)
+ seq_printf(m, "%s", " 3k_cache");
+ if (cpu_has_4k_cache)
+ seq_printf(m, "%s", " 4k_cache");
+ if (cpu_has_tx39_cache)
+ seq_printf(m, "%s", " tx39_cache");
+ if (cpu_has_octeon_cache)
+ seq_printf(m, "%s", " octeon_cache");
+ if (cpu_has_fpu)
+ seq_printf(m, "%s", " fpu");
+ if (cpu_has_32fpr)
+ seq_printf(m, "%s", " 32fpr");
+ if (cpu_has_cache_cdex_p)
+ seq_printf(m, "%s", " cache_cdex_p");
+ if (cpu_has_cache_cdex_s)
+ seq_printf(m, "%s", " cache_cdex_s");
+ if (cpu_has_prefetch)
+ seq_printf(m, "%s", " prefetch");
+ if (cpu_has_mcheck)
+ seq_printf(m, "%s", " mcheck");
+ if (cpu_has_ejtag)
+ seq_printf(m, "%s", " ejtag");
+ if (cpu_has_llsc)
+ seq_printf(m, "%s", " llsc");
+ if (cpu_has_guestctl0ext)
+ seq_printf(m, "%s", " guestctl0ext");
+ if (cpu_has_guestctl1)
+ seq_printf(m, "%s", " guestctl1");
+ if (cpu_has_guestctl2)
+ seq_printf(m, "%s", " guestctl2");
+ if (cpu_has_guestid)
+ seq_printf(m, "%s", " guestid");
+ if (cpu_has_drg)
+ seq_printf(m, "%s", " drg");
+ if (cpu_has_rixi)
+ seq_printf(m, "%s", " rixi");
+ if (cpu_has_lpa)
+ seq_printf(m, "%s", " lpa");
+ if (cpu_has_mvh)
+ seq_printf(m, "%s", " mvh");
+ if (cpu_has_vtag_icache)
+ seq_printf(m, "%s", " vtag_icache");
+ if (cpu_has_dc_aliases)
+ seq_printf(m, "%s", " dc_aliases");
+ if (cpu_has_ic_fills_f_dc)
+ seq_printf(m, "%s", " ic_fills_f_dc");
+ if (cpu_has_pindexed_dcache)
+ seq_printf(m, "%s", " pindexed_dcache");
+ if (cpu_has_userlocal)
+ seq_printf(m, "%s", " userlocal");
+ if (cpu_has_nofpuex)
+ seq_printf(m, "%s", " nofpuex");
+ if (cpu_has_vint)
+ seq_printf(m, "%s", " vint");
+ if (cpu_has_veic)
+ seq_printf(m, "%s", " veic");
+ if (cpu_has_inclusive_pcaches)
+ seq_printf(m, "%s", " inclusive_pcaches");
+ if (cpu_has_perf_cntr_intr_bit)
+ seq_printf(m, "%s", " perf_cntr_intr_bit");
+ if (cpu_has_ufr)
+ seq_printf(m, "%s", " ufr");
+ if (cpu_has_fre)
+ seq_printf(m, "%s", " fre");
+ if (cpu_has_cdmm)
+ seq_printf(m, "%s", " cdmm");
+ if (cpu_has_small_pages)
+ seq_printf(m, "%s", " small_pages");
+ if (cpu_has_nan_legacy)
+ seq_printf(m, "%s", " nan_legacy");
+ if (cpu_has_nan_2008)
+ seq_printf(m, "%s", " nan_2008");
+ if (cpu_has_ebase_wg)
+ seq_printf(m, "%s", " ebase_wg");
+ if (cpu_has_badinstr)
+ seq_printf(m, "%s", " badinstr");
+ if (cpu_has_badinstrp)
+ seq_printf(m, "%s", " badinstrp");
+ if (cpu_has_contextconfig)
+ seq_printf(m, "%s", " contextconfig");
+ if (cpu_has_perf)
+ seq_printf(m, "%s", " perf");
+ if (cpu_has_shared_ftlb_ram)
+ seq_printf(m, "%s", " shared_ftlb_ram");
+ if (cpu_has_shared_ftlb_entries)
+ seq_printf(m, "%s", " shared_ftlb_entries");
+ if (cpu_has_mipsmt_pertccounters)
+ seq_printf(m, "%s", " mipsmt_pertccounters");
+ seq_printf(m, "\n");
+
seq_printf(m, "shadow register sets\t: %d\n",
cpu_data[n].srsets);
seq_printf(m, "kscratch registers\t: %d\n",

View File

@ -1,79 +0,0 @@
From 9a84d699ddde0d4e272aa919ad8fd50271a3f932 Mon Sep 17 00:00:00 2001
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Date: Fri, 26 Aug 2022 08:48:20 +0100
Subject: [PATCH 5/6] net: sfp: redo soft state polling
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/sfp.c | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -234,6 +234,7 @@ struct sfp {
bool need_poll;
struct mutex st_mutex; /* Protects state */
+ unsigned int state_ignore_hw_mask;
unsigned int state_soft_mask;
unsigned int state;
struct delayed_work poll;
@@ -623,17 +624,18 @@ static void sfp_soft_set_state(struct sf
static void sfp_soft_start_poll(struct sfp *sfp)
{
const struct sfp_eeprom_id *id = &sfp->id;
+ unsigned int mask = 0;
sfp->state_soft_mask = 0;
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_DISABLE &&
- !sfp->gpio[GPIO_TX_DISABLE])
- sfp->state_soft_mask |= SFP_F_TX_DISABLE;
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_FAULT &&
- !sfp->gpio[GPIO_TX_FAULT])
- sfp->state_soft_mask |= SFP_F_TX_FAULT;
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_RX_LOS &&
- !sfp->gpio[GPIO_LOS])
- sfp->state_soft_mask |= SFP_F_LOS;
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_DISABLE)
+ mask |= SFP_F_TX_DISABLE;
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_FAULT)
+ mask |= SFP_F_TX_FAULT;
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_RX_LOS)
+ mask |= SFP_F_LOS;
+
+ // Poll the soft state for hardware pins we want to ignore
+ sfp->state_soft_mask = sfp->state_ignore_hw_mask & mask;
if (sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT) &&
!sfp->need_poll)
@@ -647,10 +649,12 @@ static void sfp_soft_stop_poll(struct sf
static unsigned int sfp_get_state(struct sfp *sfp)
{
+ unsigned int soft = sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT);
unsigned int state = sfp->get_state(sfp);
- if (state & SFP_F_PRESENT &&
- sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT))
+ state &= ~sfp->state_ignore_hw_mask;
+
+ if (state & SFP_F_PRESENT && soft)
state |= sfp_soft_get_state(sfp);
return state;
@@ -2064,6 +2068,15 @@ static int sfp_sm_mod_probe(struct sfp *
if (ret < 0)
return ret;
+ /* Initialise state bits to ignore from hardware */
+ sfp->state_ignore_hw_mask = 0;
+ if (!sfp->gpio[GPIO_TX_DISABLE])
+ sfp->state_ignore_hw_mask |= SFP_F_TX_DISABLE;
+ if (!sfp->gpio[GPIO_TX_FAULT])
+ sfp->state_ignore_hw_mask |= SFP_F_TX_FAULT;
+ if (!sfp->gpio[GPIO_LOS])
+ sfp->state_ignore_hw_mask |= SFP_F_LOS;
+
sfp->module_t_start_up = T_START_UP;
sfp->tx_fault_ignore = false;

View File

@ -1,35 +0,0 @@
From 32a59a1c5dc8f6fa755bab9a5f9751fdb66bb234 Mon Sep 17 00:00:00 2001
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Date: Fri, 26 Aug 2022 08:48:25 +0100
Subject: [PATCH 6/6] net: sfp: change HALNy to ignore hardware pins
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/sfp.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -321,21 +321,9 @@ static void sfp_fixup_ignore_tx_fault(st
sfp->tx_fault_ignore = true;
}
-static void sfp_fixup_inverted_los(struct sfp *sfp)
-{
- const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
- const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
-
- sfp->id.ext.options &= ~los_normal;
- sfp->id.ext.options |= los_inverted;
-}
-
static void sfp_fixup_halny_gsfp(struct sfp *sfp)
{
- /* LOS is inverted */
- sfp_fixup_inverted_los(sfp);
- /* TX fault might be inverted, but we don't know for certain. */
- sfp_fixup_ignore_tx_fault(sfp);
+ sfp->state_ignore_hw_mask |= SFP_F_TX_FAULT | SFP_F_LOS;
}
static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,