ShiboSoftwareDev/linux-gameboy-advance

Restores PCB assembly metadata by assigning part numbers and 3D CAD models, removing test-point bodies, and validating top-side SMT solder-paste features without altering copper or pads.

Version
1.0.17
License
unset
Stars
0

firmware/carrier.dtsi

/* F1C100S Linux Game Boy Advance carrier integration.
 * Include after suniv-f1c100s.dtsi (or the Lichee Pi Nano board DTS).
 * The LCD controller itself needs the F1C100S display-enabled BSP; see
 * display-bsp-example.dtsi. Mainline Linux does not yet expose that complete
 * display pipeline for this SoC.
 */
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	aliases {
		mmc0 = &mmc0;
		serial0 = &uart0;
		spi0 = &spi0;
		i2c0 = &i2c0;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	/* PCF8575 inputs are quasi-bidirectional and idle high. Polling avoids
	 * depending on GPIO-expander IRQ support in older F1C100S BSP kernels.
	 */
	gamepad {
		compatible = "gpio-keys-polled";
		poll-interval = <8>;
		autorepeat;

		key-up     { label = "D-pad Up";     linux,code = <KEY_UP>;     gpios = <&gamepad_gpio 0 GPIO_ACTIVE_LOW>; };
		key-down   { label = "D-pad Down";   linux,code = <KEY_DOWN>;   gpios = <&gamepad_gpio 1 GPIO_ACTIVE_LOW>; };
		key-left   { label = "D-pad Left";   linux,code = <KEY_LEFT>;   gpios = <&gamepad_gpio 2 GPIO_ACTIVE_LOW>; };
		key-right  { label = "D-pad Right";  linux,code = <KEY_RIGHT>;  gpios = <&gamepad_gpio 3 GPIO_ACTIVE_LOW>; };
		key-a      { label = "A";            linux,code = <KEY_A>;      gpios = <&gamepad_gpio 4 GPIO_ACTIVE_LOW>; };
		key-b      { label = "B";            linux,code = <KEY_B>;      gpios = <&gamepad_gpio 5 GPIO_ACTIVE_LOW>; };
		key-x      { label = "X";            linux,code = <KEY_X>;      gpios = <&gamepad_gpio 6 GPIO_ACTIVE_LOW>; };
		key-y      { label = "Y";            linux,code = <KEY_Y>;      gpios = <&gamepad_gpio 7 GPIO_ACTIVE_LOW>; };
		key-select { label = "Select";       linux,code = <KEY_SELECT>; gpios = <&gamepad_gpio 8 GPIO_ACTIVE_LOW>; };
		key-start  { label = "Start";        linux,code = <KEY_START>;  gpios = <&gamepad_gpio 9 GPIO_ACTIVE_LOW>; };
		key-l      { label = "Left trigger"; linux,code = <KEY_TL>;     gpios = <&gamepad_gpio 10 GPIO_ACTIVE_LOW>; };
		key-r      { label = "Right trigger";linux,code = <KEY_TR>;     gpios = <&gamepad_gpio 11 GPIO_ACTIVE_LOW>; };
	};
};

&pio {
	gameboy_i2c0_pins: gameboy-i2c0-pins {
		pins = "PE11", "PE12";
		function = "i2c0";
	};
};

&i2c0 {
	pinctrl-names = "default";
	pinctrl-0 = <&gameboy_i2c0_pins>;
	clock-frequency = <100000>;
	status = "okay";

	gamepad_gpio: gpio@20 {
		compatible = "nxp,pcf8575";
		reg = <0x20>;
		gpio-controller;
		#gpio-cells = <2>;
		lines-initial-states = <0>;
	};
};

&mmc0 {
	broken-cd;
	bus-width = <4>;
	disable-wp;
	status = "okay";
};

&spi0 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi0_pc_pins>;
	status = "okay";

	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "winbond,w25q128", "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <24000000>;
	};
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pe_pins>;
	status = "okay";
};

&otg_sram {
	status = "okay";
};

&usb_otg {
	/* USB-C receptacle is wired as a fixed device/sink; there is no ID pin. */
	dr_mode = "peripheral";
	status = "okay";
};

&usbphy {
	status = "okay";
};