Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (c) 2019 BayLibre SAS.
0004  * Author: Jerome Brunet <jbrunet@baylibre.com>
0005  */
0006 
0007 /* Libretech Amlogic GX PC form factor - AKA: Tartiflette */
0008 
0009 #include <dt-bindings/input/input.h>
0010 #include <dt-bindings/leds/common.h>
0011 #include <dt-bindings/sound/meson-aiu.h>
0012 
0013 / {
0014         adc-keys {
0015                 compatible = "adc-keys";
0016                 io-channels = <&saradc 0>;
0017                 io-channel-names = "buttons";
0018                 keyup-threshold-microvolt = <1800000>;
0019 
0020                 update-button {
0021                         label = "update";
0022                         linux,code = <KEY_VENDOR>;
0023                         press-threshold-microvolt = <1300000>;
0024                 };
0025         };
0026 
0027         aliases {
0028                 serial0 = &uart_AO;
0029                 ethernet0 = &ethmac;
0030                 spi0 = &spifc;
0031         };
0032 
0033         dio2133: analog-amplifier {
0034                 compatible = "simple-audio-amplifier";
0035                 sound-name-prefix = "AU2";
0036                 VCC-supply = <&vcc5v>;
0037                 enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
0038         };
0039 
0040         chosen {
0041                 stdout-path = "serial0:115200n8";
0042         };
0043 
0044         cvbs-connector {
0045                 compatible = "composite-video-connector";
0046                 status = "disabled";
0047 
0048                 port {
0049                         cvbs_connector_in: endpoint {
0050                                 remote-endpoint = <&cvbs_vdac_out>;
0051                         };
0052                 };
0053         };
0054 
0055         emmc_pwrseq: emmc-pwrseq {
0056                 compatible = "mmc-pwrseq-emmc";
0057                 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
0058         };
0059 
0060         hdmi-connector {
0061                 compatible = "hdmi-connector";
0062                 type = "a";
0063 
0064                 port {
0065                         hdmi_connector_in: endpoint {
0066                                 remote-endpoint = <&hdmi_tx_tmds_out>;
0067                         };
0068                 };
0069         };
0070 
0071         gpio-keys-polled {
0072                 compatible = "gpio-keys-polled";
0073                 poll-interval = <100>;
0074 
0075                 power-button {
0076                         label = "power";
0077                         linux,code = <KEY_POWER>;
0078                         gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
0079                 };
0080         };
0081 
0082         memory@0 {
0083                 device_type = "memory";
0084                 reg = <0x0 0x0 0x0 0x80000000>;
0085         };
0086 
0087         ao_5v: regulator-ao_5v {
0088                 compatible = "regulator-fixed";
0089                 regulator-name = "AO_5V";
0090                 regulator-min-microvolt = <5000000>;
0091                 regulator-max-microvolt = <5000000>;
0092                 vin-supply = <&dc_in>;
0093                 regulator-always-on;
0094         };
0095 
0096         dc_in: regulator-dc_in {
0097                 compatible = "regulator-fixed";
0098                 regulator-name = "DC_IN";
0099                 regulator-min-microvolt = <5000000>;
0100                 regulator-max-microvolt = <5000000>;
0101                 regulator-always-on;
0102         };
0103 
0104         leds {
0105                 compatible = "gpio-leds";
0106 
0107                 led-green {
0108                         color = <LED_COLOR_ID_GREEN>;
0109                         function = LED_FUNCTION_DISK_ACTIVITY;
0110                         gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
0111                         linux,default-trigger = "disk-activity";
0112                 };
0113 
0114                 led-blue {
0115                         color = <LED_COLOR_ID_BLUE>;
0116                         function = LED_FUNCTION_STATUS;
0117                         gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
0118                         linux,default-trigger = "heartbeat";
0119                         panic-indicator;
0120                 };
0121         };
0122 
0123         vcc_card: regulator-vcc_card {
0124                 compatible = "regulator-fixed";
0125                 regulator-name = "VCC_CARD";
0126                 regulator-min-microvolt = <3300000>;
0127                 regulator-max-microvolt = <3300000>;
0128                 vin-supply = <&vddio_ao3v3>;
0129 
0130                 gpio = <&gpio GPIODV_4 GPIO_ACTIVE_HIGH>;
0131                 enable-active-high;
0132         };
0133 
0134         vcc5v: regulator-vcc5v {
0135                 compatible = "regulator-fixed";
0136                 regulator-name = "VCC5V";
0137                 regulator-min-microvolt = <5000000>;
0138                 regulator-max-microvolt = <5000000>;
0139                 vin-supply = <&ao_5v>;
0140 
0141                 gpio = <&gpio GPIOH_3 GPIO_OPEN_DRAIN>;
0142         };
0143 
0144         vddio_ao18: regulator-vddio_ao18 {
0145                 compatible = "regulator-fixed";
0146                 regulator-name = "VDDIO_AO18";
0147                 regulator-min-microvolt = <1800000>;
0148                 regulator-max-microvolt = <1800000>;
0149                 vin-supply = <&ao_5v>;
0150                 regulator-always-on;
0151         };
0152 
0153         vddio_ao3v3: regulator-vddio_ao3v3 {
0154                 compatible = "regulator-fixed";
0155                 regulator-name = "VDDIO_AO3V3";
0156                 regulator-min-microvolt = <3300000>;
0157                 regulator-max-microvolt = <3300000>;
0158                 vin-supply = <&ao_5v>;
0159                 regulator-always-on;
0160         };
0161 
0162         vddio_boot: regulator-vddio_boot {
0163                 compatible = "regulator-fixed";
0164                 regulator-name = "VDDIO_BOOT";
0165                 regulator-min-microvolt = <1800000>;
0166                 regulator-max-microvolt = <1800000>;
0167                 vin-supply = <&vddio_ao3v3>;
0168                 regulator-always-on;
0169         };
0170 
0171         vddio_card: regulator-vddio-card {
0172                 compatible = "regulator-gpio";
0173                 regulator-name = "VDDIO_CARD";
0174                 regulator-min-microvolt = <1800000>;
0175                 regulator-max-microvolt = <3300000>;
0176 
0177                 gpios = <&gpio GPIODV_5 GPIO_ACTIVE_HIGH>;
0178                 gpios-states = <0>;
0179 
0180                 states = <3300000 0>,
0181                          <1800000 1>;
0182 
0183                 regulator-settling-time-up-us = <200>;
0184                 regulator-settling-time-down-us = <50000>;
0185         };
0186 
0187         sound {
0188                 compatible = "amlogic,gx-sound-card";
0189                 model = "LIBRETECH-PC";
0190                 audio-aux-devs = <&dio2133>;
0191                 audio-widgets = "Speaker", "7J4-14 LEFT",
0192                                 "Speaker", "7J4-11 RIGHT";
0193                 audio-routing = "AU2 INL", "ACODEC LOLN",
0194                                 "AU2 INR", "ACODEC LORN",
0195                                 "7J4-14 LEFT", "AU2 OUTL",
0196                                 "7J4-11 RIGHT", "AU2 OUTR";
0197                 assigned-clocks = <&clkc CLKID_MPLL0>,
0198                                   <&clkc CLKID_MPLL1>,
0199                                   <&clkc CLKID_MPLL2>;
0200                 assigned-clock-parents = <0>, <0>, <0>;
0201                 assigned-clock-rates = <294912000>,
0202                                        <270950400>,
0203                                        <393216000>;
0204                 status = "okay";
0205 
0206                 dai-link-0 {
0207                         sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
0208                 };
0209 
0210                 dai-link-1 {
0211                         sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
0212                         dai-format = "i2s";
0213                         mclk-fs = <256>;
0214 
0215                         codec-0 {
0216                                 sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
0217                         };
0218 
0219                         codec-1 {
0220                                 sound-dai = <&aiu AIU_ACODEC CTRL_I2S>;
0221                         };
0222                 };
0223 
0224                 dai-link-2 {
0225                         sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
0226 
0227                         codec-0 {
0228                                 sound-dai = <&hdmi_tx>;
0229                         };
0230                 };
0231 
0232                 dai-link-3 {
0233                         sound-dai = <&aiu AIU_ACODEC CTRL_OUT>;
0234 
0235                         codec-0 {
0236                                 sound-dai = <&acodec>;
0237                         };
0238                 };
0239         };
0240 };
0241 
0242 &acodec {
0243         AVDD-supply = <&vddio_ao18>;
0244         status = "okay";
0245 };
0246 
0247 &aiu {
0248         status = "okay";
0249 };
0250 
0251 &cec_AO {
0252         pinctrl-0 = <&ao_cec_pins>;
0253         pinctrl-names = "default";
0254         hdmi-phandle = <&hdmi_tx>;
0255         status = "okay";
0256 };
0257 
0258 &cvbs_vdac_port {
0259         cvbs_vdac_out: endpoint {
0260                 remote-endpoint = <&cvbs_connector_in>;
0261         };
0262 };
0263 
0264 &ethmac {
0265         pinctrl-0 = <&eth_pins>, <&eth_phy_irq_pins>;
0266         pinctrl-names = "default";
0267         phy-handle = <&external_phy>;
0268         amlogic,tx-delay-ns = <2>;
0269         phy-mode = "rgmii";
0270         status = "okay";
0271 };
0272 
0273 &external_mdio {
0274         external_phy: ethernet-phy@0 {
0275                 reg = <0>;
0276                 max-speed = <1000>;
0277                 reset-assert-us = <10000>;
0278                 reset-deassert-us = <30000>;
0279                 reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
0280                 interrupt-parent = <&gpio_intc>;
0281                 interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
0282         };
0283 };
0284 
0285 &pinctrl_periphs {
0286         /*
0287          * Make sure the reset pin of the usb HUB is driven high to take
0288          * it out of reset.
0289          */
0290         usb1_rst_pins: usb1_rst_irq {
0291                 mux {
0292                         groups = "GPIODV_3";
0293                         function = "gpio_periphs";
0294                         bias-disable;
0295                         output-high;
0296                 };
0297         };
0298 
0299         /* Make sure the phy irq pin is properly configured as input */
0300         eth_phy_irq_pins: eth_phy_irq {
0301                 mux {
0302                         groups = "GPIOZ_15";
0303                         function = "gpio_periphs";
0304                         bias-disable;
0305                         output-disable;
0306                 };
0307         };
0308 };
0309 
0310 &hdmi_tx {
0311         pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
0312         pinctrl-names = "default";
0313         hdmi-supply = <&vcc5v>;
0314         status = "okay";
0315 };
0316 
0317 &hdmi_tx_tmds_port {
0318         hdmi_tx_tmds_out: endpoint {
0319                 remote-endpoint = <&hdmi_connector_in>;
0320         };
0321 };
0322 
0323 &ir {
0324         pinctrl-0 = <&remote_input_ao_pins>;
0325         pinctrl-names = "default";
0326         status = "okay";
0327 };
0328 
0329 &i2c_C {
0330         pinctrl-0 = <&i2c_c_dv18_pins>;
0331         pinctrl-names = "default";
0332         status = "okay";
0333 
0334         rtc: rtc@51 {
0335                 reg = <0x51>;
0336                 compatible = "nxp,pcf8563";
0337                 #clock-cells = <0>;
0338                 clock-output-names = "rtc_clkout";
0339         };
0340 };
0341 
0342 &pwm_AO_ab {
0343         pinctrl-0 = <&pwm_ao_a_3_pins>;
0344         pinctrl-names = "default";
0345         clocks = <&clkc CLKID_FCLK_DIV4>;
0346         clock-names = "clkin0";
0347         status = "okay";
0348 };
0349 
0350 &pwm_ab {
0351         pinctrl-0 = <&pwm_b_pins>;
0352         pinctrl-names = "default";
0353         clocks = <&clkc CLKID_FCLK_DIV4>;
0354         clock-names = "clkin0";
0355         status = "okay";
0356 };
0357 
0358 &pwm_ef {
0359         pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
0360         pinctrl-names = "default";
0361         clocks = <&clkc CLKID_FCLK_DIV4>;
0362         clock-names = "clkin0";
0363         status = "okay";
0364 };
0365 
0366 &saradc {
0367         vref-supply = <&vddio_ao18>;
0368         status = "okay";
0369 };
0370 
0371 /* SD card */
0372 &sd_emmc_b {
0373         pinctrl-0 = <&sdcard_pins>;
0374         pinctrl-1 = <&sdcard_clk_gate_pins>;
0375         pinctrl-names = "default", "clk-gate";
0376 
0377         bus-width = <4>;
0378         cap-sd-highspeed;
0379         sd-uhs-sdr12;
0380         sd-uhs-sdr25;
0381         sd-uhs-sdr50;
0382         sd-uhs-ddr50;
0383         max-frequency = <200000000>;
0384         disable-wp;
0385 
0386         cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
0387 
0388         vmmc-supply = <&vcc_card>;
0389         vqmmc-supply = <&vddio_card>;
0390 
0391         status = "okay";
0392 };
0393 
0394 /* eMMC */
0395 &sd_emmc_c {
0396         pinctrl-0 = <&emmc_pins>;
0397         pinctrl-1 = <&emmc_clk_gate_pins>;
0398         pinctrl-names = "default", "clk-gate";
0399 
0400         bus-width = <8>;
0401         cap-mmc-highspeed;
0402         mmc-ddr-1_8v;
0403         mmc-hs200-1_8v;
0404         max-frequency = <200000000>;
0405         disable-wp;
0406 
0407         mmc-pwrseq = <&emmc_pwrseq>;
0408         vmmc-supply = <&vddio_ao3v3>;
0409         vqmmc-supply = <&vddio_boot>;
0410 
0411         status = "okay";
0412 };
0413 
0414 &spifc {
0415         pinctrl-0 = <&nor_pins>;
0416         pinctrl-names = "default";
0417         status = "okay";
0418 
0419         gd25lq128: flash@0 {
0420                 compatible = "jedec,spi-nor";
0421                 #address-cells = <1>;
0422                 #size-cells = <1>;
0423                 reg = <0>;
0424                 spi-max-frequency = <12000000>;
0425         };
0426 };
0427 
0428 &uart_AO {
0429         pinctrl-0 = <&uart_ao_a_pins>;
0430         pinctrl-names = "default";
0431         status = "okay";
0432 };
0433 
0434 &usb {
0435         status = "okay";
0436         dr_mode = "host";
0437 };
0438 
0439 &usb2_phy0 {
0440         pinctrl-0 = <&usb1_rst_pins>;
0441         pinctrl-names = "default";
0442         phy-supply = <&vcc5v>;
0443 };
0444 
0445 &usb2_phy1 {
0446         phy-supply = <&vcc5v>;
0447 };