From: Emmanuel Gil Peyrot <hidden> Date: 2021-05-19 09:51:04
The OTP is a read-only memory area which contains various keys and
signatures used to decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
This series has only been tested on the Wii U so far, using the
downstream 4.19 branch from linux-wiiu[1], but it should also work on
the Wii on mainline.
[1] https://gitlab.com/linux-wiiu/linux-wiiu
Changes since v1:
- Fixed the commit messages so they can be accepted by other email
servers, sorry about that.
Emmanuel Gil Peyrot (4):
nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP
dt-bindings: nintendo-otp: Document the Wii and Wii U OTP support
powerpc: wii.dts: Expose the OTP on this platform
powerpc: wii_defconfig: Enable OTP by default
.../bindings/nvmem/nintendo-otp.txt | 14 +++
arch/powerpc/boot/dts/wii.dts | 5 +
arch/powerpc/configs/wii_defconfig | 1 +
drivers/nvmem/Kconfig | 11 ++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/nintendo-otp.c | 115 ++++++++++++++++++
6 files changed, 148 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.txt
create mode 100644 drivers/nvmem/nintendo-otp.c
--
2.31.1
From: Emmanuel Gil Peyrot <hidden> Date: 2021-05-19 09:51:06
This OTP is read-only and contains various keys used by the console to
decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
drivers/nvmem/Kconfig | 11 ++++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/nintendo-otp.c | 115 +++++++++++++++++++++++++++++++++++
3 files changed, 128 insertions(+)
create mode 100644 drivers/nvmem/nintendo-otp.c
From: Emmanuel Gil Peyrot <hidden> Date: 2021-05-19 09:51:10
This can be used by the newly-added nintendo-otp nvmem module.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/boot/dts/wii.dts | 5 +++++
1 file changed, 5 insertions(+)
From: Emmanuel Gil Peyrot <hidden> Date: 2021-05-19 09:51:17
Both of these consoles use the exact same two registers, even at the
same address, but the Wii U has eight banks of 128 bytes memory while
the Wii only has one, hence the two compatible strings.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
.../devicetree/bindings/nvmem/nintendo-otp.txt | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.txt
@@ -0,0 +1,14 @@+Nintendo Wii and Wii U OTP++Required Properties:+- compatible: depending on the console this should be one of:+ - "nintendo,hollywood-otp" for the Wii+ - "nintendo,latte-otp" for the Wii U+- reg: base address and size of the OTP registers+++Example:+ otp@d8001ec {+ compatible = "nintendo,latte-otp";+ reg = <0x0d8001ec 0x8>;+ };
From: Emmanuel Gil Peyrot <hidden> Date: 2021-05-19 09:51:20
This selects the nintendo-otp module when building for this platform, if
CONFIG_NVMEM is also selected.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/configs/wii_defconfig | 1 +
1 file changed, 1 insertion(+)
From: Rob Herring <robh@kernel.org> Date: 2021-05-21 01:37:26
On Wed, May 19, 2021 at 11:50:42AM +0200, Emmanuel Gil Peyrot wrote:
Both of these consoles use the exact same two registers, even at the
same address, but the Wii U has eight banks of 128 bytes memory while
the Wii only has one, hence the two compatible strings.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
.../devicetree/bindings/nvmem/nintendo-otp.txt | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.txt
@@ -0,0 +1,14 @@+Nintendo Wii and Wii U OTP++Required Properties:+- compatible: depending on the console this should be one of:+ - "nintendo,hollywood-otp" for the Wii+ - "nintendo,latte-otp" for the Wii U+- reg: base address and size of the OTP registers+++Example:+ otp@d8001ec {+ compatible = "nintendo,latte-otp";+ reg = <0x0d8001ec 0x8>;+ };
From: Jonathan Neuschäfer <hidden> Date: 2021-06-26 21:27:40
Hello and sorry for the delay,
On Wed, May 19, 2021 at 11:50:42AM +0200, Emmanuel Gil Peyrot wrote:
Both of these consoles use the exact same two registers, even at the
same address, but the Wii U has eight banks of 128 bytes memory while
the Wii only has one, hence the two compatible strings.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
A link to the (third-party) documentation for the OTP device would be nice.
Best regards,
Jonathan Neuschäfer
@@ -0,0 +1,14 @@+Nintendo Wii and Wii U OTP++Required Properties:+- compatible: depending on the console this should be one of:+ - "nintendo,hollywood-otp" for the Wii+ - "nintendo,latte-otp" for the Wii U+- reg: base address and size of the OTP registers+++Example:+ otp@d8001ec {+ compatible = "nintendo,latte-otp";+ reg = <0x0d8001ec 0x8>;+ };
From: Jonathan Neuschäfer <hidden> Date: 2021-06-26 23:24:22
Hi,
On Wed, May 19, 2021 at 11:50:41AM +0200, Emmanuel Gil Peyrot wrote:
This OTP is read-only and contains various keys used by the console to
decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
A link to the (third-party) documentation would be nice, either in the
commit message or in the code itself.
(https://wiiubrew.org/wiki/Hardware/OTP i guess)
[...]
+static int nintendo_otp_reg_read(void *context,
+ unsigned int reg, void *_val, size_t bytes)
+{
+ struct nintendo_otp_priv *priv = context;
+ u32 *val = _val;
+ int words = bytes >> 2;
+ u32 bank, addr;
+
+ while (words--) {
+ bank = (reg << 1) & ~0xff;
This is a bit non-obvious, IMHO. As far as I understand it, the expanded
formula is:
bank = (reg / 128) << 8;
I.e. first divide by bank size, then shift the parameter into the right
place.
+ addr = (reg >> 2) & 0x1f;
Here, I think it's about the word size (4 bytes); I think / 4 would be
clearer.
I *think* (but haven't checked) that gcc should generate efficent shifts
for the divisions above, so using the division operator shouldn't be
problem.
From: Jonathan Neuschäfer <hidden> Date: 2021-06-26 23:34:08
On Wed, May 19, 2021 at 11:50:43AM +0200, Emmanuel Gil Peyrot wrote:
quoted hunk
This can be used by the newly-added nintendo-otp nvmem module.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/boot/dts/wii.dts | 5 +++++
1 file changed, 5 insertions(+)
The OTP registers overlap with the previous node, control@d800100.
Not sure what's the best way to structure the devicetree in this case,
maybe something roughly like the following (untested, unverified):
control@d800100 {
compatible = "nintendo,hollywood-control", "simple-mfd";
reg = <0x0d800100 0x300>;
ranges;
otp@d8001ec {
compatible = "nintendo,hollywood-otp";
reg = <0x0d8001ec 0x8>;
};
};
Thanks,
Jonathan Neuschäfer
From: Emmanuel Gil Peyrot <hidden> Date: 2021-07-01 20:05:15
On Sat, Jun 26, 2021 at 11:34:01PM +0000, Jonathan Neuschäfer wrote:
On Wed, May 19, 2021 at 11:50:43AM +0200, Emmanuel Gil Peyrot wrote:
quoted
This can be used by the newly-added nintendo-otp nvmem module.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/boot/dts/wii.dts | 5 +++++
1 file changed, 5 insertions(+)
The OTP registers overlap with the previous node, control@d800100.
Not sure what's the best way to structure the devicetree in this case,
maybe something roughly like the following (untested, unverified):
[snip]
I couldn’t get this to work, but additionally it looks like it should
start 0x100 earlier and contain pic1@d800030 and gpio@d8000c0, given
https://wiibrew.org/wiki/Hardware/Hollywood_Registers
Would it make sense, for the time being, to reduce the size of this
control@d800100 device to the single register currently being used by
arch/powerpc/platforms/embedded6xx/wii.c (0xd800194, used to reboot the
system) and leave the refactor of restart + OTP + PIC + GPIO for a
future series?
Thanks,
--
Emmanuel Gil Peyrot
From: Emmanuel Gil Peyrot <hidden> Date: 2021-07-01 22:57:54
The OTP is a read-only memory area which contains various keys and
signatures used to decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
This series has been tested on both the Wii U (using my downstream
master-wiiu branch[1]), as well as on the Wii on mainline.
[1] https://gitlab.com/linkmauve/linux-wiiu/-/commits/master-wiiu
Changes since v1:
- Fixed the commit messages so they can be accepted by other email
servers, sorry about that.
Changes since v2:
- Switched the dt binding documentation to YAML.
- Used more obvious register arithmetic, and tested that gcc (at -O1 and
above) outputs the exact same rlwinm instructions for them.
- Use more #defines to make the code easier to read.
- Include some links to the reversed documentation.
- Avoid overlapping dt regions by changing the existing control@d800100
node to end before the OTP registers, with some bigger dt refactoring
left for a future series.
Emmanuel Gil Peyrot (5):
nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP
dt-bindings: nintendo-otp: Document the Wii and Wii U OTP support
powerpc: wii.dts: Reduce the size of the control area
powerpc: wii.dts: Expose the OTP on this platform
powerpc: wii_defconfig: Enable OTP by default
.../bindings/nvmem/nintendo-otp.yaml | 44 +++++++
arch/powerpc/boot/dts/wii.dts | 13 +-
arch/powerpc/configs/wii_defconfig | 1 +
drivers/nvmem/Kconfig | 11 ++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/nintendo-otp.c | 124 ++++++++++++++++++
6 files changed, 194 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml
create mode 100644 drivers/nvmem/nintendo-otp.c
--
2.32.0
From: Emmanuel Gil Peyrot <hidden> Date: 2021-07-01 22:57:57
This OTP is read-only and contains various keys used by the console to
decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
This driver was written based on reversed documentation, see:
https://wiiubrew.org/wiki/Hardware/OTP
Signed-off-by: Emmanuel Gil Peyrot <redacted>
Tested-by: Jonathan Neuschäfer <redacted> # on Wii
Tested-by: Emmanuel Gil Peyrot <redacted> # on Wii U
---
drivers/nvmem/Kconfig | 11 ++++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/nintendo-otp.c | 124 +++++++++++++++++++++++++++++++++++
3 files changed, 137 insertions(+)
create mode 100644 drivers/nvmem/nintendo-otp.c
From: Emmanuel Gil Peyrot <hidden> Date: 2021-07-01 22:57:59
Both of these consoles use the exact same two registers, even at the
same address, but the Wii U has eight banks of 128 bytes memory while
the Wii only has one, hence the two compatible strings.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
.../bindings/nvmem/nintendo-otp.yaml | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml
@@ -0,0 +1,44 @@+# SPDX-License-Identifier: GPL-2.0+%YAML1.2+---+$id:http://devicetree.org/schemas/nvmem/nintendo-otp.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Nintendo Wii and WiiU OTP Device Tree Bindings++description:|+This binding represents the OTP memory as found on a Nintendo Wii or WiiU,+which contains common and per-console keys, signatures and related data+required to access peripherals.++See https://wiiubrew.org/wiki/Hardware/OTP++maintainers:+-Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>++allOf:+-$ref:"nvmem.yaml#"++properties:+compatible:+enum:+-nintendo,hollywood-otp+-nintendo,latte-otp++reg:+maxItems:1++required:+-compatible+-reg++unevaluatedProperties:false++examples:+-|+otp@d8001ec {+compatible = "nintendo,latte-otp";+reg = <0x0d8001ec 0x8>;+};++...
From: Emmanuel Gil Peyrot <hidden> Date: 2021-07-01 22:58:01
This is wrong, but needed in order to avoid overlapping ranges with the
OTP area added in the next commit. A refactor of this part of the
device tree is needed: according to Wiibrew[1], this area starts at
0x0d800000 and spans 0x400 bytes (that is, 0x100 32-bit registers),
encompassing PIC and GPIO registers, amongst the ones already exposed in
this device tree, which should become children of the control@d800000
node.
[1] https://wiibrew.org/wiki/Hardware/Hollywood_Registers
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/boot/dts/wii.dts | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
From: Emmanuel Gil Peyrot <hidden> Date: 2021-07-01 22:58:03
This can be used by the newly-added nintendo-otp nvmem module.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/boot/dts/wii.dts | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
From: Emmanuel Gil Peyrot <hidden> Date: 2021-07-01 22:58:05
This selects the nintendo-otp module when building for this platform.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/configs/wii_defconfig | 1 +
1 file changed, 1 insertion(+)
The OTP registers overlap with the previous node, control@d800100.
Not sure what's the best way to structure the devicetree in this case,
maybe something roughly like the following (untested, unverified):
[snip]
I couldn’t get this to work, but additionally it looks like it should
start 0x100 earlier and contain pic1@d800030 and gpio@d8000c0, given
https://wiibrew.org/wiki/Hardware/Hollywood_Registers
Would it make sense, for the time being, to reduce the size of this
control@d800100 device to the single register currently being used by
arch/powerpc/platforms/embedded6xx/wii.c (0xd800194, used to reboot the
system) and leave the refactor of restart + OTP + PIC + GPIO for a
future series?
The OTP registers overlap with the previous node, control@d800100.
Not sure what's the best way to structure the devicetree in this case,
maybe something roughly like the following (untested, unverified):
[snip]
I couldn’t get this to work, but additionally it looks like it should
start 0x100 earlier and contain pic1@d800030 and gpio@d8000c0, given
https://wiibrew.org/wiki/Hardware/Hollywood_Registers
Would it make sense, for the time being, to reduce the size of this
control@d800100 device to the single register currently being used by
arch/powerpc/platforms/embedded6xx/wii.c (0xd800194, used to reboot the
system) and leave the refactor of restart + OTP + PIC + GPIO for a
future series?
Makes sense to me!
There is no benefit to pretending there is a "control" bus (there is no
such thing), it only gets in the way.
Segher
From: Rob Herring <robh@kernel.org> Date: 2021-07-14 22:51:40
On Fri, Jul 02, 2021 at 12:57:40AM +0200, Emmanuel Gil Peyrot wrote:
quoted hunk
Both of these consoles use the exact same two registers, even at the
same address, but the Wii U has eight banks of 128 bytes memory while
the Wii only has one, hence the two compatible strings.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
.../bindings/nvmem/nintendo-otp.yaml | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml
From: Emmanuel Gil Peyrot <hidden> Date: 2021-08-01 07:38:33
This OTP is read-only and contains various keys used by the console to
decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
This driver was written based on reversed documentation, see:
https://wiiubrew.org/wiki/Hardware/OTP
Signed-off-by: Emmanuel Gil Peyrot <redacted>
Tested-by: Jonathan Neuschäfer <redacted> # on Wii
Tested-by: Emmanuel Gil Peyrot <redacted> # on Wii U
---
drivers/nvmem/Kconfig | 11 ++++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/nintendo-otp.c | 124 +++++++++++++++++++++++++++++++++++
3 files changed, 137 insertions(+)
create mode 100644 drivers/nvmem/nintendo-otp.c
From: Emmanuel Gil Peyrot <hidden> Date: 2021-08-01 07:38:42
The OTP is a read-only memory area which contains various keys and
signatures used to decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
This series has been tested on both the Wii U (using my downstream
master-wiiu branch[1]), as well as on the Wii on mainline.
[1] https://gitlab.com/linkmauve/linux-wiiu/-/commits/master-wiiu
Changes since v1:
- Fixed the commit messages so they can be accepted by other email
servers, sorry about that.
Changes since v2:
- Switched the dt binding documentation to YAML.
- Used more obvious register arithmetic, and tested that gcc (at -O1 and
above) outputs the exact same rlwinm instructions for them.
- Use more #defines to make the code easier to read.
- Include some links to the reversed documentation.
- Avoid overlapping dt regions by changing the existing control@d800100
node to end before the OTP registers, with some bigger dt refactoring
left for a future series.
Changes since v3:
- Relicense the dt-binding documentation under GPLv2-only or
BSD-2-clauses.
Emmanuel Gil Peyrot (5):
nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP
dt-bindings: nintendo-otp: Document the Wii and Wii U OTP support
powerpc: wii.dts: Reduce the size of the control area
powerpc: wii.dts: Expose the OTP on this platform
powerpc: wii_defconfig: Enable OTP by default
.../bindings/nvmem/nintendo-otp.yaml | 44 +++++++
arch/powerpc/boot/dts/wii.dts | 13 +-
arch/powerpc/configs/wii_defconfig | 1 +
drivers/nvmem/Kconfig | 11 ++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/nintendo-otp.c | 124 ++++++++++++++++++
6 files changed, 194 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml
create mode 100644 drivers/nvmem/nintendo-otp.c
--
2.32.0
From: Emmanuel Gil Peyrot <hidden> Date: 2021-08-01 07:38:42
This is wrong, but needed in order to avoid overlapping ranges with the
OTP area added in the next commit. A refactor of this part of the
device tree is needed: according to Wiibrew[1], this area starts at
0x0d800000 and spans 0x400 bytes (that is, 0x100 32-bit registers),
encompassing PIC and GPIO registers, amongst the ones already exposed in
this device tree, which should become children of the control@d800000
node.
[1] https://wiibrew.org/wiki/Hardware/Hollywood_Registers
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/boot/dts/wii.dts | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
From: Emmanuel Gil Peyrot <hidden> Date: 2021-08-01 07:38:58
This can be used by the newly-added nintendo-otp nvmem module.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/boot/dts/wii.dts | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
From: Emmanuel Gil Peyrot <hidden> Date: 2021-08-01 07:38:58
Both of these consoles use the exact same two registers, even at the
same address, but the Wii U has eight banks of 128 bytes memory while
the Wii only has one, hence the two compatible strings.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
.../bindings/nvmem/nintendo-otp.yaml | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml
@@ -0,0 +1,44 @@+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause+%YAML1.2+---+$id:http://devicetree.org/schemas/nvmem/nintendo-otp.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Nintendo Wii and WiiU OTP Device Tree Bindings++description:|+This binding represents the OTP memory as found on a Nintendo Wii or WiiU,+which contains common and per-console keys, signatures and related data+required to access peripherals.++See https://wiiubrew.org/wiki/Hardware/OTP++maintainers:+-Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>++allOf:+-$ref:"nvmem.yaml#"++properties:+compatible:+enum:+-nintendo,hollywood-otp+-nintendo,latte-otp++reg:+maxItems:1++required:+-compatible+-reg++unevaluatedProperties:false++examples:+-|+otp@d8001ec {+compatible = "nintendo,latte-otp";+reg = <0x0d8001ec 0x8>;+};++...
From: Emmanuel Gil Peyrot <hidden> Date: 2021-08-01 07:38:58
This selects the nintendo-otp module when building for this platform.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
arch/powerpc/configs/wii_defconfig | 1 +
1 file changed, 1 insertion(+)
From: Rob Herring <robh@kernel.org> Date: 2021-08-06 21:07:31
On Sun, 01 Aug 2021 09:38:19 +0200, Emmanuel Gil Peyrot wrote:
Both of these consoles use the exact same two registers, even at the
same address, but the Wii U has eight banks of 128 bytes memory while
the Wii only has one, hence the two compatible strings.
Signed-off-by: Emmanuel Gil Peyrot <redacted>
---
.../bindings/nvmem/nintendo-otp.yaml | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml
The OTP is a read-only memory area which contains various keys and
signatures used to decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
This series has been tested on both the Wii U (using my downstream
master-wiiu branch[1]), as well as on the Wii on mainline.
[1] https://gitlab.com/linkmauve/linux-wiiu/-/commits/master-wiiu
Changes since v1:
- Fixed the commit messages so they can be accepted by other email
servers, sorry about that.
Changes since v2:
- Switched the dt binding documentation to YAML.
- Used more obvious register arithmetic, and tested that gcc (at -O1 and
above) outputs the exact same rlwinm instructions for them.
- Use more #defines to make the code easier to read.
- Include some links to the reversed documentation.
- Avoid overlapping dt regions by changing the existing control@d800100
node to end before the OTP registers, with some bigger dt refactoring
left for a future series.
Changes since v3:
- Relicense the dt-binding documentation under GPLv2-only or
BSD-2-clauses.
Emmanuel Gil Peyrot (5):
nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP
dt-bindings: nintendo-otp: Document the Wii and Wii U OTP support
Applied 1/5 and 2/5 to nvmem next,
rest of the patches should go via powerpc dts tree.
thanks,
--srini
powerpc: wii.dts: Reduce the size of the control area
powerpc: wii.dts: Expose the OTP on this platform
powerpc: wii_defconfig: Enable OTP by default
.../bindings/nvmem/nintendo-otp.yaml | 44 +++++++
arch/powerpc/boot/dts/wii.dts | 13 +-
arch/powerpc/configs/wii_defconfig | 1 +
drivers/nvmem/Kconfig | 11 ++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/nintendo-otp.c | 124 ++++++++++++++++++
6 files changed, 194 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml
create mode 100644 drivers/nvmem/nintendo-otp.c
From: Michael Ellerman <hidden> Date: 2021-08-18 13:52:12
On Sun, 1 Aug 2021 09:38:17 +0200, Emmanuel Gil Peyrot wrote:
The OTP is a read-only memory area which contains various keys and
signatures used to decrypt, encrypt or verify various pieces of storage.
Its size depends on the console, it is 128 bytes on the Wii and
1024 bytes on the Wii U (split into eight 128 bytes banks).
It can be used directly by writing into one register and reading from
the other one, without any additional synchronisation.
[...]