Skip to content

Commit

Permalink
[top_earlgrey,pinmux] Enable pull-down for TAP strap 0 at reset
Browse files Browse the repository at this point in the history
TAP strap 0 is sampled after reset (and only once for life cycle states
that are not TEST_UNLOCKED* or RMA).  To ensure it gets sampled as 0
unless driven to 1 from an external source (and specifically that it
gets sampled as 0 when left floating / not connected), this enables the
pull-down of the pad at reset.

Signed-off-by: Andreas Kurth <[email protected]>
  • Loading branch information
andreaskurth committed Sep 23, 2024
1 parent ae8ac57 commit 78ad89d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
4 changes: 3 additions & 1 deletion hw/ip/pinmux/data/pinmux.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@
Muxed pad attributes.
This register has WARL behavior since not each pad type may support
all attributes.
The muxed pad that is used for TAP strap 0 has a different reset value, with `pull_en` set to 1.
''',
count: "NMioPads",
compact: "false",
Expand Down Expand Up @@ -509,7 +510,8 @@
// read back the same value that was written to them.
// further, they have hardware side effects since they drive the
// pad attributes, and hence no random data should be written to them.
tags: ["excl:CsrAllTests:CsrExclWrite"]
// Additionally, their reset value is defined by the RTL implementation and may not equal `resval` for all instances (#24621).
tags: ["excl:CsrAllTests:CsrExclAll"]
}
},

Expand Down
4 changes: 3 additions & 1 deletion hw/ip/pinmux/data/pinmux.hjson.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@
Muxed pad attributes.
This register has WARL behavior since not each pad type may support
all attributes.
The muxed pad that is used for TAP strap 0 has a different reset value, with `pull_en` set to 1.
''',
count: "NMioPads",
compact: "false",
Expand Down Expand Up @@ -626,7 +627,8 @@
// read back the same value that was written to them.
// further, they have hardware side effects since they drive the
// pad attributes, and hence no random data should be written to them.
tags: ["excl:CsrAllTests:CsrExclWrite"]
// Additionally, their reset value is defined by the RTL implementation and may not equal `resval` for all instances (#24621).
tags: ["excl:CsrAllTests:CsrExclAll"]
}
},

Expand Down
1 change: 1 addition & 0 deletions hw/ip/pinmux/doc/registers.md
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ Register write enable for MIO PAD attributes.
Muxed pad attributes.
This register has WARL behavior since not each pad type may support
all attributes.
The muxed pad that is used for TAP strap 0 has a different reset value, with `pull_en` set to 1.
- Reset default: `0x0`
- Reset mask: `0xf300ff`

Expand Down
3 changes: 3 additions & 0 deletions hw/ip/pinmux/lint/pinmux.waiver
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ waive -rules CLOCK_USE -location {pinmux.sv} -regexp {'(dio_wkup_mux\[12\]|dio_w

waive -rules CLOCK_MUX -location {pinmux.sv} -regexp {Clock 'dio_in_i\[12\]' reaches a multiplexer here, used as a clock 'clk_i'} \
-comment "This mux is required to filter designated scan clock inputs (e.g. 'DioSpiDeviceSck' at index 12) from wakeup detector inputs"

waive -rules RESET_ONLY -location {pinmux.sv} -regexp {'mio_pad_attr_q\[0\]' is asynchronously reset but has no other assignments in this block} \
-comment "This error can safely be ignored: The signal is obviously driven further down in the very same block, changing the TargetCfg.tap_strap0_idx value to a non-zero value (which it actually is in the Earlgrey top level) makes the error go away."
12 changes: 11 additions & 1 deletion hw/ip/pinmux/rtl/pinmux.sv
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,17 @@ module pinmux
always_ff @(posedge clk_i or negedge rst_ni) begin : p_regs
if (!rst_ni) begin
dio_pad_attr_q <= '0;
mio_pad_attr_q <= '0;
for (int kk = 0; kk < NMioPads; kk++) begin
if (kk == TargetCfg.tap_strap0_idx) begin
// TAP strap 0 is sampled after reset (and only once for life cycle states that are not
// TEST_UNLOCKED* or RMA). To ensure it gets sampled as 0 unless driven to 1 from an
// external source (and specifically that it gets sampled as 0 when left floating / not
// connected), this enables the pull-down of the pad at reset.
mio_pad_attr_q[kk] <= '{pull_en: 1'b1, default: '0};
end else begin
mio_pad_attr_q[kk] <= '0;
end
end
end else begin
// dedicated pads
for (int kk = 0; kk < NDioPads; kk++) begin
Expand Down
4 changes: 3 additions & 1 deletion hw/top_earlgrey/ip/pinmux/data/autogen/pinmux.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@
Muxed pad attributes.
This register has WARL behavior since not each pad type may support
all attributes.
The muxed pad that is used for TAP strap 0 has a different reset value, with `pull_en` set to 1.
''',
count: "NMioPads",
compact: "false",
Expand Down Expand Up @@ -622,7 +623,8 @@
// read back the same value that was written to them.
// further, they have hardware side effects since they drive the
// pad attributes, and hence no random data should be written to them.
tags: ["excl:CsrAllTests:CsrExclWrite"]
// Additionally, their reset value is defined by the RTL implementation and may not equal `resval` for all instances (#24621).
tags: ["excl:CsrAllTests:CsrExclAll"]
}
},

Expand Down

0 comments on commit 78ad89d

Please sign in to comment.