All of lore.kernel.org
 help / color / mirror / Atom feed
From: miquel.raynal@bootlin.com (Miquel Raynal)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: dts: nes: add Nintendo NES Classic Edition support
Date: Fri, 9 Mar 2018 09:58:14 +0100	[thread overview]
Message-ID: <20180309095814.5ea40afe@xps13> (raw)
In-Reply-To: <20180309082656.kglipdyu3knfq4ga@flea.lan>

Hi Maxime,

On Fri, 9 Mar 2018 09:26:56 +0100, Maxime Ripard
<maxime.ripard@bootlin.com> wrote:

> Hi Miquel,
> 
> On Wed, Mar 07, 2018 at 05:43:36PM +0100, Miquel Raynal wrote:
> > The Nintendo NES Classic features an R16 already well supported in
> > mainline.
> > 
> > The console over UART0 may be wired on two ports of the R16, both
> > available on the NES Classic PCB.
> > 
> > USB host can be used after a bit of soldering to wire a 5V power supply
> > directly on the PCB, in order to free the micro-USB port from that task
> > and allow the plug of any USB device.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  arch/arm/boot/dts/Makefile                         |  1 +
> >  arch/arm/boot/dts/sun8i-a23-a33.dtsi               | 18 ++++++
> >  .../dts/sun8i-r16-nintendo-nes-classic-edition.dts | 71 ++++++++++++++++++++++
> >  3 files changed, 90 insertions(+)
> >  create mode 100644 arch/arm/boot/dts/sun8i-r16-nintendo-nes-classic-edition.dts
> > 
> > diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> > index ade7a38543dc..eed4e1222897 100644
> > --- a/arch/arm/boot/dts/Makefile
> > +++ b/arch/arm/boot/dts/Makefile
> > @@ -990,6 +990,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
> >  	sun8i-h3-orangepi-plus.dtb \
> >  	sun8i-h3-orangepi-plus2e.dtb \
> >  	sun8i-r16-bananapi-m2m.dtb \
> > +	sun8i-r16-nintendo-nes-classic-edition.dtb \
> >  	sun8i-r16-parrot.dtb \
> >  	sun8i-r40-bananapi-m2-ultra.dtb \
> >  	sun8i-v3s-licheepi-zero.dtb \
> > diff --git a/arch/arm/boot/dts/sun8i-a23-a33.dtsi b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
> > index 971f9be699a7..1ad7291581be 100644
> > --- a/arch/arm/boot/dts/sun8i-a23-a33.dtsi
> > +++ b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
> > @@ -315,6 +315,24 @@
> >  				bias-pull-up;
> >  			};
> >  
> > +			nand_pins_a: nand-base0 at 0 {
> > +				pins = "PC0", "PC1", "PC2",
> > +				       "PC5", "PC8", "PC9", "PC10",
> > +				       "PC11", "PC12", "PC13", "PC14",
> > +				       "PC15";

I will change a bit the visual organization.

> > +				function = "nand0";
> > +			};
> > +
> > +			nand_cs0_pins_a: nand-cs at 0 {
> > +				pins = "PC4";
> > +				function = "nand0";
> > +			};
> > +
> > +			nand_rb0_pins_a: nand-rb at 0 {
> > +				pins = "PC6";
> > +				function = "nand0";
> > +			};
> > +  
> 
> This should be in a separate patch.

Ok.

> 
> Also, these will generate dtc warnings.

I will remove the trailing @0.

> 
> If there is multiple muxing options, I'd suggest to have the node
> names be nand-pc-pins, and the label nand_pc_pins. If there's only
> one, you can drop the pc part.

There is only one, I will name it nand_pins: nand-pins.

For CS and RB pins, there are two of them each time, I will declare
them all:
nand_pins_cs0 PC4
nand_pins_cs1 PC3
nand_pins_rb0 PC6
nand_pins_rb1 PC7

> 
> >  			pwm0_pins: pwm0 {
> >  				pins = "PH0";
> >  				function = "pwm0";
> > diff --git a/arch/arm/boot/dts/sun8i-r16-nintendo-nes-classic-edition.dts b/arch/arm/boot/dts/sun8i-r16-nintendo-nes-classic-edition.dts
> > new file mode 100644
> > index 000000000000..63c289f1f46d
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/sun8i-r16-nintendo-nes-classic-edition.dts
> > @@ -0,0 +1,71 @@
> > +// SPDX-License-Identifier: GPL-2.0 OR X11
> > +/* Copyright (c) 2016 FUKAUMI Naoki <naobsd@gmail.com> */
> > +
> > +/dts-v1/;
> > +#include "sun8i-a33.dtsi"
> > +#include "sunxi-common-regulators.dtsi"
> > +
> > +/ {
> > +	model = "Nintendo NES Classic Edition";
> > +	compatible = "nintendo,nes-classic-edition", "allwinner,sun8i-a33";
> > +
> > +	aliases {
> > +		serial0 = &uart0;
> > +	};
> > +
> > +	chosen {
> > +		stdout-path = "serial0:115200n8";
> > +	};
> > +};
> > +
> > +&uart0 {
> > +	/*
> > +	 * UART0 is available on two ports, both accessible on the NES Classic
> > +	 * PCB. One can use the <&uart0_pins_b> handle instead.
> > +	 */  
> 
> I guess you should mention that the PF pins will also rule out the SD
> option that might be convenient.

Sure. I will add that port PB and PF can both mux UART0, but PF can
also be used for the SD card, so PB is preferred (
> 
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&uart0_pins_a>;
> > +	status = "okay";
> > +};
> > +
> > +&nfc {
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&nand_pins_a &nand_cs0_pins_a &nand_rb0_pins_a>;

I'll move this in the DTSI also.

> > +	status = "okay";
> > +
> > +	/* 2Gb Macronix MX30LF2G18AC (3V) */
> > +	nand at 0 {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		reg = <0>;
> > +		allwinner,rb = <0>;
> > +		nand-ecc-mode = "hw";
> > +		nand-ecc-strength = <16>;
> > +		nand-ecc-step-size = <1024>;
> > +	};
> > +};
> > +
> > +/*
> > + * The NES is powered by the USB port. However it is possible to solder a wire
> > + * from the internal side of the connector on VBUS pin to supply the required 5V
> > + * without the need of a cable plugged in the micro USB port. This way it is
> > + * easy to use any USB device.
> > + */
> > +&usb_otg {
> > +	dr_mode = "host";
> > +	status = "okay";
> > +};  
> 
> We want to support the default setup, and not require some hackery to
> be done. It will thus be some OTG / peripheral mode, most likely with
> an ID pin somewhere.
> 
> Since you tested on a SuperNES Classic, I think you should also create
> a new DT (possibly include it) with a compatible of its own.
> 
> That way, if we ever find some differences, it will be easy to deal
> with them.

So, what you would prefer is:
1/ Move this entire DTS but the usb_otg node into a
"sun8i-r16-nintendo-nes.dtsi"
2/ Include that DTSI from a
"sun8i-r16-nintendo-super-nes-classic-edition.dts" that would add the
usb_otg node as it is above.

Right?

Thanks,
Miqu?l

-- 
Miquel Raynal, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-03-09  8:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 16:43 [PATCH] arm: dts: nes: add Nintendo NES Classic Edition support Miquel Raynal
2018-03-09  8:26 ` Maxime Ripard
2018-03-09  8:58   ` Miquel Raynal [this message]
2018-03-09  9:10     ` Maxime Ripard
2018-03-09  9:34       ` Miquel Raynal
2018-03-09 10:09         ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180309095814.5ea40afe@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.