Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /dts-v1/;
0003 
0004 #include "jz4770.dtsi"
0005 #include <dt-bindings/clock/ingenic,tcu.h>
0006 
0007 #include <dt-bindings/gpio/gpio.h>
0008 #include <dt-bindings/iio/adc/ingenic,adc.h>
0009 #include <dt-bindings/input/input.h>
0010 
0011 / {
0012         compatible = "gcw,zero", "ingenic,jz4770";
0013         model = "GCW Zero";
0014 
0015         aliases {
0016                 serial0 = &uart0;
0017                 serial1 = &uart1;
0018                 serial2 = &uart2;
0019                 serial3 = &uart3;
0020         };
0021 
0022         memory: memory {
0023                 device_type = "memory";
0024                 reg = <0x0 0x10000000>,
0025                       <0x30000000 0x10000000>;
0026         };
0027 
0028         chosen {
0029                 stdout-path = "serial2:57600n8";
0030         };
0031 
0032         vcc: regulator@0 {
0033                 compatible = "regulator-fixed";
0034                 regulator-name = "vcc";
0035 
0036                 regulator-min-microvolt = <3300000>;
0037                 regulator-max-microvolt = <3300000>;
0038                 regulator-always-on;
0039         };
0040 
0041         mmc1_power: regulator@1 {
0042                 compatible = "regulator-fixed";
0043                 regulator-name = "mmc1_vcc";
0044                 gpio = <&gpe 9 0>;
0045 
0046                 regulator-min-microvolt = <3300000>;
0047                 regulator-max-microvolt = <3300000>;
0048                 vin-supply = <&vcc>;
0049         };
0050 
0051         headphones_amp: analog-amplifier@0 {
0052                 compatible = "simple-audio-amplifier";
0053                 enable-gpios = <&gpf 3 GPIO_ACTIVE_LOW>;
0054                 enable-delay-ms = <50>;
0055 
0056                 VCC-supply = <&ldo5>;
0057                 sound-name-prefix = "Headphones Amp";
0058         };
0059 
0060         speaker_amp: analog-amplifier@1 {
0061                 compatible = "simple-audio-amplifier";
0062                 enable-gpios = <&gpf 20 GPIO_ACTIVE_HIGH>;
0063 
0064                 VCC-supply = <&ldo5>;
0065                 sound-name-prefix = "Speaker Amp";
0066         };
0067 
0068         sound {
0069                 compatible = "simple-audio-card";
0070 
0071                 simple-audio-card,name = "gcw0-audio";
0072                 simple-audio-card,format = "i2s";
0073 
0074                 simple-audio-card,widgets =
0075                         "Speaker", "Speaker",
0076                         "Headphone", "Headphones",
0077                         "Microphone", "Built-in Mic";
0078                 simple-audio-card,routing =
0079                         "Headphones Amp INL", "LHPOUT",
0080                         "Headphones Amp INR", "RHPOUT",
0081                         "Headphones", "Headphones Amp OUTL",
0082                         "Headphones", "Headphones Amp OUTR",
0083                         "Speaker Amp INL", "LOUT",
0084                         "Speaker Amp INR", "ROUT",
0085                         "Speaker", "Speaker Amp OUTL",
0086                         "Speaker", "Speaker Amp OUTR",
0087                         "LLINEIN", "Cap-less",
0088                         "RLINEIN", "Cap-less",
0089                         "Built-in Mic", "MICBIAS",
0090                         "MIC1P", "Built-in Mic",
0091                         "MIC1N", "Built-in Mic";
0092                 simple-audio-card,pin-switches = "Speaker", "Headphones";
0093 
0094                 simple-audio-card,hp-det-gpio = <&gpf 21 GPIO_ACTIVE_LOW>;
0095                 simple-audio-card,aux-devs = <&speaker_amp>, <&headphones_amp>;
0096 
0097                 simple-audio-card,bitclock-master = <&dai_codec>;
0098                 simple-audio-card,frame-master = <&dai_codec>;
0099 
0100                 dai_cpu: simple-audio-card,cpu {
0101                         sound-dai = <&aic>;
0102                 };
0103 
0104                 dai_codec: simple-audio-card,codec {
0105                         sound-dai = <&codec>;
0106                 };
0107         };
0108 
0109         rumble {
0110                 compatible = "pwm-vibrator";
0111                 pwms = <&pwm 4 2000000 0>;
0112                 pwm-names = "enable";
0113 
0114                 pinctrl-names = "default";
0115                 pinctrl-0 = <&pins_pwm4>;
0116         };
0117 
0118         backlight: backlight {
0119                 compatible = "pwm-backlight";
0120                 pwms = <&pwm 1 40000 0>;
0121                 power-supply = <&vcc>;
0122 
0123                 brightness-levels = <0 16 32 48 64 80 96 112 128
0124                                      144 160 176 192 208 224 240 255>;
0125                 default-brightness-level = <12>;
0126 
0127                 pinctrl-names = "default";
0128                 pinctrl-0 = <&pins_pwm1>;
0129         };
0130 
0131         gpio-keys {
0132                 compatible = "gpio-keys";
0133                 autorepeat;
0134 
0135                 button-0 {
0136                         label = "D-pad up";
0137                         linux,code = <KEY_UP>;
0138                         linux,can-disable;
0139                         gpios = <&gpe 21 GPIO_ACTIVE_LOW>;
0140                 };
0141 
0142                 button-1 {
0143                         label = "D-pad down";
0144                         linux,code = <KEY_DOWN>;
0145                         linux,can-disable;
0146                         gpios = <&gpe 25 GPIO_ACTIVE_LOW>;
0147                 };
0148 
0149                 button-2 {
0150                         label = "D-pad left";
0151                         linux,code = <KEY_LEFT>;
0152                         linux,can-disable;
0153                         gpios = <&gpe 23 GPIO_ACTIVE_LOW>;
0154                 };
0155 
0156                 button-3 {
0157                         label = "D-pad right";
0158                         linux,code = <KEY_RIGHT>;
0159                         linux,can-disable;
0160                         gpios = <&gpe 24 GPIO_ACTIVE_LOW>;
0161                 };
0162 
0163                 button-4 {
0164                         label = "Button A";
0165                         linux,code = <KEY_LEFTCTRL>;
0166                         linux,can-disable;
0167                         gpios = <&gpe 29 GPIO_ACTIVE_LOW>;
0168                 };
0169 
0170                 button-5 {
0171                         label = "Button B";
0172                         linux,code = <KEY_LEFTALT>;
0173                         linux,can-disable;
0174                         gpios = <&gpe 20 GPIO_ACTIVE_LOW>;
0175                 };
0176 
0177                 button-6 {
0178                         label = "Button Y";
0179                         linux,code = <KEY_SPACE>;
0180                         linux,can-disable;
0181                         gpios = <&gpe 27 GPIO_ACTIVE_LOW>;
0182                 };
0183 
0184                 button-7 {
0185                         label = "Button X";
0186                         linux,code = <KEY_LEFTSHIFT>;
0187                         linux,can-disable;
0188                         gpios = <&gpe 28 GPIO_ACTIVE_LOW>;
0189                 };
0190 
0191                 button-8 {
0192                         label = "Left shoulder button";
0193                         linux,code = <KEY_TAB>;
0194                         linux,can-disable;
0195                         gpios = <&gpb 20 GPIO_ACTIVE_LOW>;
0196                 };
0197 
0198                 button-9 {
0199                         label = "Right shoulder button";
0200                         linux,code = <KEY_BACKSPACE>;
0201                         linux,can-disable;
0202                         gpios = <&gpe 26 GPIO_ACTIVE_LOW>;
0203                 };
0204 
0205                 button-10 {
0206                         label = "Start button";
0207                         linux,code = <KEY_ENTER>;
0208                         linux,can-disable;
0209                         gpios = <&gpb 21 GPIO_ACTIVE_LOW>;
0210                 };
0211 
0212                 button-11 {
0213                         label = "Select button";
0214                         linux,code = <KEY_ESC>;
0215                         linux,can-disable;
0216                         /*
0217                          * This is the only button that is active high,
0218                          * since it doubles as BOOT_SEL1.
0219                          */
0220                         gpios = <&gpd 18 GPIO_ACTIVE_HIGH>;
0221                 };
0222 
0223                 button-12 {
0224                         label = "Power slider";
0225                         linux,code = <KEY_POWER>;
0226                         linux,can-disable;
0227                         gpios = <&gpa 30 GPIO_ACTIVE_LOW>;
0228                         wakeup-source;
0229                 };
0230 
0231                 button-13 {
0232                         label = "Power hold";
0233                         linux,code = <KEY_PAUSE>;
0234                         linux,can-disable;
0235                         gpios = <&gpf 11 GPIO_ACTIVE_LOW>;
0236                 };
0237         };
0238 
0239         i2c3: i2c-controller@3 {
0240                 compatible = "i2c-gpio";
0241                 #address-cells = <1>;
0242                 #size-cells = <0>;
0243 
0244                 sda-gpios = <&gpd 5 GPIO_ACTIVE_HIGH>;
0245                 scl-gpios = <&gpd 4 GPIO_ACTIVE_HIGH>;
0246                 i2c-gpio,delay-us = <2>; /* 250 kHz */
0247 
0248                 act8600: pmic@5a {
0249                         compatible = "active-semi,act8600";
0250                         reg = <0x5a>;
0251 
0252                         regulators {
0253                                 /* USB OTG */
0254                                 otg_vbus: SUDCDC_REG4 {
0255                                         /*
0256                                          * 5.3V instead of 5.0V to compensate
0257                                          * for the voltage drop of a diode
0258                                          * between the regulator and the
0259                                          * connector.
0260                                          */
0261                                         regulator-min-microvolt = <5300000>;
0262                                         regulator-max-microvolt = <5300000>;
0263                                         inl-supply = <&vcc>;
0264                                 };
0265 
0266                                 /*
0267                                  * When this is off, there is no sound, but also
0268                                  * no USB networking.
0269                                  */
0270                                 ldo5: LDO5 {
0271                                         regulator-min-microvolt = <2500000>;
0272                                         regulator-max-microvolt = <2500000>;
0273                                         inl-supply = <&vcc>;
0274                                 };
0275 
0276                                 /* LCD panel and FM radio */
0277                                 ldo6: LDO6 {
0278                                         regulator-min-microvolt = <3300000>;
0279                                         regulator-max-microvolt = <3300000>;
0280                                         inl-supply = <&vcc>;
0281                                 };
0282 
0283                                 /* ??? */
0284                                 LDO7 {
0285                                         regulator-min-microvolt = <3300000>;
0286                                         regulator-max-microvolt = <3300000>;
0287                                         /*regulator-always-on;*/
0288                                         inl-supply = <&vcc>;
0289                                 };
0290 
0291                                 /*
0292                                  * The colors on the LCD are wrong when this is
0293                                  * off. Which is strange, since the LCD panel
0294                                  * data sheet only mentions a 3.3V input.
0295                                  */
0296                                 LDO8 {
0297                                         regulator-min-microvolt = <1800000>;
0298                                         regulator-max-microvolt = <1800000>;
0299                                         regulator-always-on;
0300                                         inl-supply = <&vcc>;
0301                                 };
0302 
0303                                 /* RTC fixed 3.3V */
0304                                 LDO_REG9 {
0305                                         regulator-min-microvolt = <3300000>;
0306                                         regulator-max-microvolt = <3300000>;
0307                                         regulator-always-on;
0308                                         inl-supply = <&vcc>;
0309                                 };
0310 
0311                                 /* Unused fixed 1.2V */
0312                                 LDO_REG10 {
0313                                         inl-supply = <&vcc>;
0314                                 };
0315                         };
0316                 };
0317         };
0318 
0319         leds {
0320                 compatible = "gpio-leds";
0321 
0322                 led {
0323                         gpios = <&gpb 30 GPIO_ACTIVE_LOW>;
0324                         default-state = "on";
0325                 };
0326         };
0327 
0328         spi {
0329                 compatible = "spi-gpio";
0330                 #address-cells = <1>;
0331                 #size-cells = <0>;
0332 
0333                 sck-gpios = <&gpe 15 GPIO_ACTIVE_HIGH>;
0334                 mosi-gpios = <&gpe 17 GPIO_ACTIVE_HIGH>;
0335                 cs-gpios = <&gpe 16 GPIO_ACTIVE_HIGH>;
0336                 num-chipselects = <1>;
0337 
0338                 nt39016@0 {
0339                         compatible = "kingdisplay,kd035g6-54nt";
0340                         reg = <0>;
0341 
0342                         spi-max-frequency = <3125000>;
0343                         spi-3wire;
0344 
0345                         reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>;
0346 
0347                         backlight = <&backlight>;
0348                         power-supply = <&ldo6>;
0349 
0350                         port {
0351                                 panel_input: endpoint {
0352                                         remote-endpoint = <&panel_output>;
0353                                 };
0354                         };
0355                 };
0356         };
0357 
0358         connector {
0359                 compatible = "gpio-usb-b-connector", "usb-b-connector";
0360                 label = "mini-USB";
0361                 type = "mini";
0362 
0363                 /*
0364                  * USB OTG is not yet working reliably, the ID detection
0365                  * mechanism tends to fry easily for unknown reasons.
0366                  * Until this is fixed, disable OTG by not providing the
0367                  * ID GPIO to the driver.
0368                  */
0369                 //id-gpios = <&gpf 18 GPIO_ACTIVE_LOW>;
0370 
0371                 vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>;
0372                 vbus-supply = <&otg_vbus>;
0373 
0374                 pinctrl-names = "default";
0375                 pinctrl-0 = <&pins_otg>;
0376 
0377                 port {
0378                         usb_ep: endpoint {
0379                                 remote-endpoint = <&usb_otg_ep>;
0380                         };
0381                 };
0382         };
0383 };
0384 
0385 &ext {
0386         clock-frequency = <12000000>;
0387 };
0388 
0389 &pinctrl {
0390         pins_lcd: lcd {
0391                 function = "lcd";
0392                 groups = "lcd-24bit";
0393         };
0394 
0395         pins_uart2: uart2 {
0396                 function = "uart2";
0397                 groups = "uart2-data";
0398         };
0399 
0400         pins_mmc0: mmc0 {
0401                 function = "mmc0";
0402                 groups = "mmc0-1bit-a", "mmc0-4bit-a";
0403         };
0404 
0405         pins_mmc1: mmc1 {
0406                 function = "mmc1";
0407                 groups = "mmc1-1bit-d", "mmc1-4bit-d";
0408         };
0409 
0410         pins_otg: otg {
0411                 otg-vbus-pin {
0412                         function = "otg";
0413                         groups = "otg-vbus";
0414                 };
0415 
0416                 vbus-pin {
0417                         pins = "PB5";
0418                         bias-disable;
0419                 };
0420         };
0421 
0422         pins_pwm1: pwm1 {
0423                 function = "pwm1";
0424                 groups = "pwm1";
0425         };
0426 
0427         pins_pwm4: pwm4 {
0428                 function = "pwm4";
0429                 groups = "pwm4";
0430         };
0431 };
0432 
0433 &uart2 {
0434         pinctrl-names = "default";
0435         pinctrl-0 = <&pins_uart2>;
0436 
0437         status = "okay";
0438 };
0439 
0440 &cgu {
0441         /*
0442          * Put high-speed peripherals under PLL1, such that we can change the
0443          * PLL0 frequency on demand without having to suspend peripherals.
0444          * We use a rate of 432 MHz, which is the least common multiple of
0445          * 27 MHz (required by TV encoder) and 48 MHz (required by USB host).
0446          * Put the GPU under PLL0 since we want a higher frequency.
0447          * Use the 32 kHz oscillator as the parent of the RTC for a higher
0448          * precision.
0449          */
0450         assigned-clocks =
0451                 <&cgu JZ4770_CLK_PLL1>,
0452                 <&cgu JZ4770_CLK_GPU>,
0453                 <&cgu JZ4770_CLK_RTC>,
0454                 <&cgu JZ4770_CLK_UHC>,
0455                 <&cgu JZ4770_CLK_LPCLK_MUX>,
0456                 <&cgu JZ4770_CLK_MMC0_MUX>,
0457                 <&cgu JZ4770_CLK_MMC1_MUX>;
0458         assigned-clock-parents =
0459                 <0>,
0460                 <&cgu JZ4770_CLK_PLL0>,
0461                 <&cgu JZ4770_CLK_OSC32K>,
0462                 <&cgu JZ4770_CLK_PLL1>,
0463                 <&cgu JZ4770_CLK_PLL1>,
0464                 <&cgu JZ4770_CLK_PLL1>,
0465                 <&cgu JZ4770_CLK_PLL1>;
0466         assigned-clock-rates =
0467                 <432000000>,
0468                 <600000000>;
0469 };
0470 
0471 &uhc {
0472         /* The WiFi module is connected to the UHC. */
0473         status = "okay";
0474 };
0475 
0476 &tcu {
0477         /*
0478          * 750 kHz for the system timer and clocksource, 12 MHz for the OST,
0479          * and use RTC as the parent for the watchdog clock
0480          */
0481         assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER2>,
0482                           <&tcu TCU_CLK_OST>, <&tcu TCU_CLK_WDT>;
0483         assigned-clock-parents = <0>, <0>, <0>, <&cgu JZ4770_CLK_RTC>;
0484         assigned-clock-rates = <750000>, <750000>, <12000000>;
0485 
0486         /* PWM1 is in use, so use channel #2 for the clocksource */
0487         ingenic,pwm-channels-mask = <0xfa>;
0488 };
0489 
0490 &usb_otg {
0491         port {
0492                 usb_otg_ep: endpoint {
0493                         remote-endpoint = <&usb_ep>;
0494                 };
0495         };
0496 };
0497 
0498 &otg_phy {
0499         vcc-supply = <&ldo5>;
0500 };
0501 
0502 &rtc {
0503         clocks = <&cgu JZ4770_CLK_RTC>;
0504         clock-names = "rtc";
0505 
0506         system-power-controller;
0507 };
0508 
0509 &mmc0 {
0510         status = "okay";
0511 
0512         bus-width = <4>;
0513         max-frequency = <48000000>;
0514         vmmc-supply = <&vcc>;
0515         non-removable;
0516 
0517         pinctrl-names = "default";
0518         pinctrl-0 = <&pins_mmc0>;
0519 };
0520 
0521 &mmc1 {
0522         status = "okay";
0523 
0524         bus-width = <4>;
0525         max-frequency = <48000000>;
0526         cd-gpios = <&gpb 2 GPIO_ACTIVE_LOW>;
0527         vmmc-supply = <&mmc1_power>;
0528 
0529         pinctrl-names = "default";
0530         pinctrl-0 = <&pins_mmc1>;
0531 };
0532 
0533 &lcd {
0534         pinctrl-names = "default";
0535         pinctrl-0 = <&pins_lcd>;
0536 
0537         port {
0538                 panel_output: endpoint {
0539                         remote-endpoint = <&panel_input>;
0540                 };
0541         };
0542 };