jtag: meson: fix jtag pinmux settings issue [2/2]
authorYingyuan Zhu <yingyuan.zhu@amlogic.com>
Thu, 17 Jan 2019 11:02:20 +0000 (19:02 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 31 Jan 2019 03:11:31 +0000 (19:11 -0800)
PD#SWPL-4501

Problem:
Standard pinmux APIs were not used

Solution:
Setting pinmux instead of require for gpio

Verify:
tl1,g12a,g12b,axg,txl,txlx,gxl

Change-Id: I0ad88f414832686d795d252f70e81a34f6cb0f9e
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
21 files changed:
arch/arm/boot/dts/amlogic/meson8b.dtsi
arch/arm/boot/dts/amlogic/mesonaxg.dtsi
arch/arm/boot/dts/amlogic/mesong12a.dtsi
arch/arm/boot/dts/amlogic/mesong12b.dtsi
arch/arm/boot/dts/amlogic/mesongxl.dtsi
arch/arm/boot/dts/amlogic/mesongxl_sei210.dtsi
arch/arm/boot/dts/amlogic/mesongxm.dtsi
arch/arm/boot/dts/amlogic/mesontl1.dtsi
arch/arm/boot/dts/amlogic/mesontxl.dtsi
arch/arm/boot/dts/amlogic/mesontxlx.dtsi
arch/arm64/boot/dts/amlogic/mesonaxg.dtsi
arch/arm64/boot/dts/amlogic/mesong12a.dtsi
arch/arm64/boot/dts/amlogic/mesong12b.dtsi
arch/arm64/boot/dts/amlogic/mesongxl.dtsi
arch/arm64/boot/dts/amlogic/mesongxl_sei210.dtsi
arch/arm64/boot/dts/amlogic/mesongxm.dtsi
arch/arm64/boot/dts/amlogic/mesontl1.dtsi
arch/arm64/boot/dts/amlogic/mesontxl.dtsi
arch/arm64/boot/dts/amlogic/mesontxlx.dtsi
drivers/amlogic/jtag/meson_jtag.c
drivers/amlogic/jtag/meson_jtag.h

index 320c498..4c12955 100644 (file)
                        compatible = "amlogic, jtag";
                        status = "okay";
                        reg = <0xda004004 0x4>;
-                       select = "apao"; /* disable apao apee */
-                       jtagao-gpios = <&gpio_ao        GPIOAO_8        0
-                                       &gpio_ao        GPIOAO_9        0
-                                       &gpio_ao        GPIOAO_10       0
-                                       &gpio_ao        GPIOAO_11       0>;
-                       jtagee-gpios = <&gpio           CARD_0          0
-                                       &gpio           CARD_1          0
-                                       &gpio           CARD_2          0
-                                       &gpio           CARD_3          0>;
+                       select = "disable"; /* disable/apao/apee */
+                       pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+                       pinctrl-0=<&jtag_apao_pins>;
+                       pinctrl-1=<&jtag_apee_pins>;
                };
 
                securitykey {
                                        bias-pull-up;
                                };
                        };
+                       jtag_apee_pins:jtag_apee_pin {
+                               mux {
+                                       groups = "CARD_0",
+                                       "CARD_1",
+                                       "CARD_2",
+                                       "CARD_3";
+                                       function = "gpio_periphs";
+                               };
+                       };
                };
                pinctrl_aobus: pinctrl@c8100084 {
                        compatible = "amlogic,meson8b-aobus-pinctrl";
                                        function = "spdif_2";
                                };
                        };
+                       jtag_apao_pins:jtag_apao_pin {
+                               mux {
+                                       groups = "GPIOAO_8",
+                                       "GPIOAO_9",
+                                       "GPIOAO_10",
+                                       "GPIOAO_11";
+                                       function = "gpio_aobus";
+                               };
+                       };
                };
 dwc2_b {
                compatible = "amlogic,dwc2";
index 3d67b2d..eb3516b 100644 (file)
                reg-names = "PREG_STICKY_REG8";
        };
 
+       jtag {
+               compatible = "amlogic, jtag";
+               status = "okay";
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
+       };
+
        pinctrl_aobus: pinctrl@ff800014{
                compatible = "amlogic,meson-axg-aobus-pinctrl";
                #address-cells = <1>;
                };
        };
 
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "jtag_ao_tdi",
+                       "jtag_ao_tdo",
+                       "jtag_ao_clk",
+                       "jtag_ao_tms";
+                       function = "jtag_ao";
+               };
+       };
+
 }; /* end of pinctrl_aobus */
 
 &pinctrl_periphs {
                };
        };
 
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "jtag_tdo_x",
+                       "jtag_tdi_x",
+                       "jtag_clk_x",
+                       "jtag_tms_x";
+                       function = "jtag_ee";
+               };
+       };
+
 }; /* end of pinctrl_periphs */
 
index 7b7d8cf..d52d126 100644 (file)
        jtag {
                compatible = "amlogic, jtag";
                status = "okay";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio_ao    GPIOAO_6    0
-                               &gpio_ao    GPIOAO_7    0
-                               &gpio_ao    GPIOAO_8    0
-                               &gpio_ao    GPIOAO_9    0>;
-               jtagee-gpios = <&gpio       GPIOC_0     0
-                               &gpio       GPIOC_1     0
-                               &gpio       GPIOC_4     0
-                               &gpio       GPIOC_5     0>;
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
        };
 
        saradc:saradc {
                        function = "cec_ao";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "jtag_a_tdi",
+                       "jtag_a_tdo",
+                       "jtag_a_clk",
+                       "jtag_a_tms";
+                       function = "jtag_a";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        drive-strength = <3>;
                };
        };
+
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "jtag_b_tdi",
+                       "jtag_b_tdo",
+                       "jtag_b_clk",
+                       "jtag_b_tms";
+                       function = "jtag_b";
+               };
+       };
 };
 
 &pinctrl_aobus {
index 82f17ba..caffd77 100644 (file)
                clocks = <&xtal>;
        };
 
+       jtag {
+               compatible = "amlogic, jtag";
+               status = "okay";
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
+       };
+
        saradc:saradc {
                compatible = "amlogic,meson-g12a-saradc";
                status = "disabled";
                        function = "pwm_a_gpioe";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "jtag_a_tdi",
+                       "jtag_a_tdo",
+                       "jtag_a_clk",
+                       "jtag_a_tms";
+                       function = "jtag_a";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        function = "remote_out";
                };
        };
+
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "jtag_b_tdi",
+                       "jtag_b_tdo",
+                       "jtag_b_clk",
+                       "jtag_b_tms";
+                       function = "jtag_b";
+               };
+       };
 };
 
 &gpu{
index d35d3b4..a72b975 100644 (file)
        jtag {
                compatible = "amlogic, jtag";
                status = "okay";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio   GPIOH_6         0
-                               &gpio   GPIOH_7         0
-                               &gpio   GPIOH_8         0
-                               &gpio   GPIOH_9         0>;
-               jtagee-gpios = <&gpio   CARD_0          0
-                               &gpio   CARD_1          0
-                               &gpio   CARD_2          0
-                               &gpio   CARD_3          0>;
+               select = "disable"; /* disable/apao/apee */
+               /* both sets of jtags for the GXL platform */
+               /* are in the ee domain, this is named apao */
+               /* just to match the jtag driver */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_a_pins>;
+               pinctrl-1=<&jtag_b_pins>;
        };
 
        mailbox: mhu@c883c400 {
                };
        };
 
-       jtag_apao_pins:jtag_apao_pin {
+       jtag_a_pins:jtag_a_pin {
                mux {
-                       groups = "jtag_tdi_0",
-                               "jtag_tdo_0",
-                               "jtag_clk_0",
-                               "jtag_tms_0";
-                       function = "jtag";
+                       groups = "GPIOH_6",
+                               "GPIOH_7",
+                               "GPIOH_8",
+                               "GPIOH_9";
+                       function = "gpio_periphs";
                };
        };
 
-       jtag_apee_pins:jtag_apee_pin {
+       jtag_b_pins:jtag_b_pin {
                mux {
-                       groups ="jtag_tdi_1",
-                               "jtag_tdo_1",
-                               "jtag_clk_1",
-                               "jtag_tms_1";
-                       function = "jtag";
+                       groups = "CARD_0",
+                               "CARD_1",
+                               "CARD_2",
+                               "CARD_3";
+                       function = "gpio_periphs";
                };
        };
 
index 53d7823..75c0c8a 100644 (file)
        jtag {
                compatible = "amlogic, jtag";
                status = "okay";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio   GPIOH_6         0
-                               &gpio   GPIOH_7         0
-                               &gpio   GPIOH_8         0
-                               &gpio   GPIOH_9         0>;
-               jtagee-gpios = <&gpio   CARD_0          0
-                               &gpio   CARD_1          0
-                               &gpio   CARD_2          0
-                               &gpio   CARD_3          0>;
+               select = "disable"; /* disable/apao/apee */
+               /* both sets of jtags for the GXL platform */
+               /* are in the ee domain, this is named apao */
+               /* just to match the jtag driver */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_a_pins>;
+               pinctrl-1=<&jtag_b_pins>;
        };
 
        mailbox: mhu@c883c400 {
                };
        };
 
-       jtag_apao_pins:jtag_apao_pin {
+       jtag_a_pins:jtag_a_pin {
                mux {
-                       groups = "jtag_tdi_0",
-                               "jtag_tdo_0",
-                               "jtag_clk_0",
-                               "jtag_tms_0";
-                       function = "jtag";
+                       groups = "GPIOH_6",
+                               "GPIOH_7",
+                               "GPIOH_8",
+                               "GPIOH_9";
+                       function = "gpio_periphs";
                };
        };
 
-       jtag_apee_pins:jtag_apee_pin {
+       jtag_b_pins:jtag_b_pin {
                mux {
-                       groups ="jtag_tdi_1",
-                               "jtag_tdo_1",
-                               "jtag_clk_1",
-                               "jtag_tms_1";
-                       function = "jtag";
+                       groups = "CARD_0",
+                               "CARD_1",
+                               "CARD_2",
+                               "CARD_3";
+                       function = "gpio_periphs";
                };
        };
 
index 5544ca9..b697e4b 100644 (file)
 
        jtag {
                compatible = "amlogic, jtag";
-               status = "disabled";
+               status = "okay";
+               select = "disable"; /* disable/apao/apee */
+               /* both sets of jtags for the GXM platform */
+               /* are in the ee domain, this is named apao */
+               /* just to match the jtag driver */
                pinctrl-names = "jtag_apao_pins", "jtag_apee_pins";
-               pinctrl-0 = <&jtag_apao_pins>;
-               pinctrl-1 = <&jtag_apee_pins>;
+               pinctrl-0 = <&jtag_a_pins>;
+               pinctrl-1 = <&jtag_b_pins>;
        };
 
        psci {
                };
        };
 
-       jtag_apao_pins:jtag_apao_pin {
+       jtag_a_pins:jtag_a_pin {
                mux {
-                       groups = "jtag_tdi_0",
-                               "jtag_tdo_0",
-                               "jtag_clk_0",
-                               "jtag_tms_0";
-                       function = "jtag";
+                       groups = "GPIOH_6",
+                               "GPIOH_7",
+                               "GPIOH_8",
+                               "GPIOH_9";
+                       function = "gpio_periphs";
                };
        };
 
-       jtag_apee_pins:jtag_apee_pin {
+       jtag_b_pins:jtag_b_pin {
                mux {
-                       groups ="jtag_tdi_1",
-                               "jtag_tdo_1",
-                               "jtag_clk_1",
-                               "jtag_tms_1";
-                       function = "jtag";
+                       groups = "CARD_0",
+                               "CARD_1",
+                               "CARD_2",
+                               "CARD_3";
+                       function = "gpio_periphs";
                };
        };
 
index 7a911fb..6357e1e 100644 (file)
 
        jtag {
                compatible = "amlogic, jtag";
-               status = "disabled";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio_ao    GPIOAO_6    0
-                               &gpio_ao    GPIOAO_7    0
-                               &gpio_ao    GPIOAO_8    0
-                               &gpio_ao    GPIOAO_9    0>;
-               jtagee-gpios = <&gpio       GPIOC_0     0
-                               &gpio       GPIOC_1     0
-                               &gpio       GPIOC_4     0
-                               &gpio       GPIOC_5     0>;
+               status = "okay";
+               select = "disable"; /* disable/apao */
+               pinctrl-names="jtag_apao_pins";
+               pinctrl-0=<&jtag_apao_pins>;
        };
 
        saradc:saradc {
                        function = "remote_out_ao";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "jtag_a_tdi",
+                       "jtag_a_tdo",
+                       "jtag_a_clk",
+                       "jtag_a_tms";
+                       function = "jtag_a";
+               };
+       };
 };
 
 &pinctrl_periphs {
index 4a9bc65..3379d34 100644 (file)
        jtag {
                compatible = "amlogic, jtag";
                status = "okay";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio_ao        GPIOAO_3        0
-                               &gpio_ao        GPIOAO_4        0
-                               &gpio_ao        GPIOAO_5        0
-                               &gpio_ao        GPIOAO_7        0>;
-               jtagee-gpios = <&gpio           CARD_0          0
-                               &gpio           CARD_1          0
-                               &gpio           CARD_2          0
-                               &gpio           CARD_3          0>;
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
        };
 
        meson_suspend: pm {
                     function = "ee_cec";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "GPIOAO_3",
+                       "GPIOAO_4",
+                       "GPIOAO_5",
+                       "GPIOAO_7";
+                       function = "gpio_aobus";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        function = "spi_a";
                };
        };
+
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "CARD_0",
+                       "CARD_1",
+                       "CARD_2",
+                       "CARD_3";
+                       function = "gpio_periphs";
+               };
+       };
 };
index 3521f63..6399685 100644 (file)
                reg-names = "PREG_STICKY_REG8";
        };
 
-       amlogic-jtag {
+       jtag {
                compatible = "amlogic, jtag";
                status = "okay";
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
        };
 
        vpu {
                    function = "i2c_ao";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "GPIOAO_3",
+                       "GPIOAO_4",
+                       "GPIOAO_5",
+                       "GPIOAO_7";
+                       function = "gpio_aobus";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        function = "pwm_d";
                };
        };
+
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "GPIOC_0",
+                       "GPIOC_1",
+                       "GPIOC_2",
+                       "GPIOC_3";
+                       function = "gpio_periphs";
+               };
+       };
 };
 
 &gpu{
index ee04ae3..b3cd366 100644 (file)
                reg-names = "PREG_STICKY_REG8";
        };
 
+       jtag {
+               compatible = "amlogic, jtag";
+               status = "okay";
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
+       };
+
        pinctrl_aobus: pinctrl@ff800014{
                compatible = "amlogic,meson-axg-aobus-pinctrl";
                #address-cells = <2>;
                };
        };
 
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "jtag_ao_tdi",
+                       "jtag_ao_tdo",
+                       "jtag_ao_clk",
+                       "jtag_ao_tms";
+                       function = "jtag_ao";
+               };
+       };
 }; /* end of pinctrl_aobus */
 
 &pinctrl_periphs {
                };
        };
 
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "jtag_tdo_x",
+                       "jtag_tdi_x",
+                       "jtag_clk_x",
+                       "jtag_tms_x";
+                       function = "jtag_ee";
+               };
+       };
 }; /* end of pinctrl_periphs */
 
index f008939..bd5274f 100644 (file)
        jtag {
                compatible = "amlogic, jtag";
                status = "okay";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio_ao    GPIOAO_6    0
-                               &gpio_ao    GPIOAO_7    0
-                               &gpio_ao    GPIOAO_8    0
-                               &gpio_ao    GPIOAO_9    0>;
-               jtagee-gpios = <&gpio       GPIOC_0     0
-                               &gpio       GPIOC_1     0
-                               &gpio       GPIOC_4     0
-                               &gpio       GPIOC_5     0>;
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
        };
 
        saradc:saradc {
                        function = "cec_ao";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "jtag_a_tdi",
+                       "jtag_a_tdo",
+                       "jtag_a_clk",
+                       "jtag_a_tms";
+                       function = "jtag_a";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        drive-strength = <3>;
                };
        };
+
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "jtag_b_tdi",
+                       "jtag_b_tdo",
+                       "jtag_b_clk",
+                       "jtag_b_tms";
+                       function = "jtag_b";
+               };
+       };
 };
 
 &pinctrl_aobus {
index e9a1d3a..d49f280 100644 (file)
                clocks = <&xtal>;
        };
 
+       jtag {
+               compatible = "amlogic, jtag";
+               status = "okay";
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
+       };
+
        saradc:saradc {
                compatible = "amlogic,meson-g12a-saradc";
                status = "disabled";
                        function = "pwm_a_gpioe";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "jtag_a_tdi",
+                       "jtag_a_tdo",
+                       "jtag_a_clk",
+                       "jtag_a_tms";
+                       function = "jtag_a";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        function = "remote_out";
                };
        };
+
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "jtag_b_tdi",
+                       "jtag_b_tdo",
+                       "jtag_b_clk",
+                       "jtag_b_tms";
+                       function = "jtag_b";
+               };
+       };
 };
 
 &gpu{
index 244efa2..fb528f9 100644 (file)
        jtag {
                compatible = "amlogic, jtag";
                status = "okay";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio   GPIOH_6         0
-                               &gpio   GPIOH_7         0
-                               &gpio   GPIOH_8         0
-                               &gpio   GPIOH_9         0>;
-               jtagee-gpios = <&gpio   CARD_0          0
-                               &gpio   CARD_1          0
-                               &gpio   CARD_2          0
-                               &gpio   CARD_3          0>;
+               select = "disable"; /* disable/apao/apee */
+               /* both sets of jtags for the GXL platform */
+               /* are in the ee domain, this is named apao */
+               /* just to match the jtag driver */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_a_pins>;
+               pinctrl-1=<&jtag_b_pins>;
        };
 
        mailbox: mhu@c883c400 {
                        function = "ee_cec";
                };
        };
+
 }; /* end of pinctrl_aobus*/
 
 &pinctrl_periphs {
                };
        };
 
-       jtag_apao_pins:jtag_apao_pin {
+       jtag_a_pins:jtag_a_pin {
                mux {
-                       groups = "jtag_tdi_0",
-                               "jtag_tdo_0",
-                               "jtag_clk_0",
-                               "jtag_tms_0";
-                       function = "jtag";
+                       groups = "GPIOH_6",
+                               "GPIOH_7",
+                               "GPIOH_8",
+                               "GPIOH_9";
+                       function = "gpio_periphs";
                };
        };
 
-       jtag_apee_pins:jtag_apee_pin {
+       jtag_b_pins:jtag_b_pin {
                mux {
-                       groups ="jtag_tdi_1",
-                               "jtag_tdo_1",
-                               "jtag_clk_1",
-                               "jtag_tms_1";
-                       function = "jtag";
+                       groups = "CARD_0",
+                               "CARD_1",
+                               "CARD_2",
+                               "CARD_3";
+                       function = "gpio_periphs";
                };
        };
 
index ef80ea7..101970a 100644 (file)
        jtag {
                compatible = "amlogic, jtag";
                status = "okay";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio   GPIOH_6         0
-                               &gpio   GPIOH_7         0
-                               &gpio   GPIOH_8         0
-                               &gpio   GPIOH_9         0>;
-               jtagee-gpios = <&gpio   CARD_0          0
-                               &gpio   CARD_1          0
-                               &gpio   CARD_2          0
-                               &gpio   CARD_3          0>;
+               select = "disable"; /* disable/apao/apee */
+               /* both sets of jtags for the GXL platform */
+               /* are in the ee domain, this is named apao */
+               /* just to match the jtag driver */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_a_pins>;
+               pinctrl-1=<&jtag_b_pins>;
        };
 
        mailbox: mhu@c883c400 {
                };
        };
 
-       jtag_apao_pins:jtag_apao_pin {
+       jtag_a_pins:jtag_a_pin {
                mux {
-                       groups = "jtag_tdi_0",
-                               "jtag_tdo_0",
-                               "jtag_clk_0",
-                               "jtag_tms_0";
-                       function = "jtag";
+                       groups = "GPIOH_6",
+                               "GPIOH_7",
+                               "GPIOH_8",
+                               "GPIOH_9";
+                       function = "gpio_periphs";
                };
        };
 
-       jtag_apee_pins:jtag_apee_pin {
+       jtag_b_pins:jtag_b_pin {
                mux {
-                       groups ="jtag_tdi_1",
-                               "jtag_tdo_1",
-                               "jtag_clk_1",
-                               "jtag_tms_1";
-                       function = "jtag";
+                       groups = "CARD_0",
+                               "CARD_1",
+                               "CARD_2",
+                               "CARD_3";
+                       function = "gpio_periphs";
                };
        };
 
index 3c66f01..bcf71c3 100644 (file)
 
        jtag {
                compatible = "amlogic, jtag";
-               status = "disabled";
+               status = "okay";
+               select = "disable"; /* disable/apao/apee */
+               /* both sets of jtags for the GXM platform */
+               /* are in the ee domain, this is named apao */
+               /* just to match the jtag driver */
                pinctrl-names = "jtag_apao_pins", "jtag_apee_pins";
-               pinctrl-0 = <&jtag_apao_pins>;
-               pinctrl-1 = <&jtag_apee_pins>;
+               pinctrl-0 = <&jtag_a_pins>;
+               pinctrl-1 = <&jtag_b_pins>;
        };
 
        psci {
                };
        };
 
-       jtag_apao_pins:jtag_apao_pin {
+       jtag_a_pins:jtag_a_pin {
                mux {
-                       groups = "jtag_tdi_0",
-                               "jtag_tdo_0",
-                               "jtag_clk_0",
-                               "jtag_tms_0";
-                       function = "jtag";
+                       groups = "GPIOH_6",
+                               "GPIOH_7",
+                               "GPIOH_8",
+                               "GPIOH_9";
+                       function = "gpio_periphs";
                };
        };
 
-       jtag_apee_pins:jtag_apee_pin {
+       jtag_b_pins:jtag_b_pin {
                mux {
-                       groups ="jtag_tdi_1",
-                               "jtag_tdo_1",
-                               "jtag_clk_1",
-                               "jtag_tms_1";
-                       function = "jtag";
+                       groups = "CARD_0",
+                               "CARD_1",
+                               "CARD_2",
+                               "CARD_3";
+                       function = "gpio_periphs";
                };
        };
 
index b9bc8f9..207ee3d 100644 (file)
 
        jtag {
                compatible = "amlogic, jtag";
-               status = "disabled";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio_ao    GPIOAO_6    0
-                               &gpio_ao    GPIOAO_7    0
-                               &gpio_ao    GPIOAO_8    0
-                               &gpio_ao    GPIOAO_9    0>;
-               jtagee-gpios = <&gpio       GPIOC_0     0
-                               &gpio       GPIOC_1     0
-                               &gpio       GPIOC_4     0
-                               &gpio       GPIOC_5     0>;
+               status = "okay";
+               select = "disable"; /* disable/apao */
+               pinctrl-names="jtag_apao_pins";
+               pinctrl-0=<&jtag_apao_pins>;
        };
 
        saradc:saradc {
                        function = "remote_out_ao";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "jtag_a_tdi",
+                       "jtag_a_tdo",
+                       "jtag_a_clk",
+                       "jtag_a_tms";
+                       function = "jtag_a";
+               };
+       };
 };
 
 &pinctrl_periphs {
index 7b89d39..afcded1 100644 (file)
        jtag {
                compatible = "amlogic, jtag";
                status = "okay";
-               select = "apao"; /* disable/apao/apee */
-               jtagao-gpios = <&gpio_ao        GPIOAO_3        0
-                               &gpio_ao        GPIOAO_4        0
-                               &gpio_ao        GPIOAO_5        0
-                               &gpio_ao        GPIOAO_7        0>;
-               jtagee-gpios = <&gpio           CARD_0          0
-                               &gpio           CARD_1          0
-                               &gpio           CARD_2          0
-                               &gpio           CARD_3          0>;
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
        };
 
        meson_suspend: pm {
                     function = "ee_cec";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "GPIOAO_3",
+                       "GPIOAO_4",
+                       "GPIOAO_5",
+                       "GPIOAO_7";
+                       function = "gpio_aobus";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        function = "spi_a";
                };
        };
+
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "CARD_0",
+                       "CARD_1",
+                       "CARD_2",
+                       "CARD_3";
+                       function = "gpio_periphs";
+               };
+       };
 };
index bd7a87d..d22214f 100644 (file)
                reg-names = "PREG_STICKY_REG8";
        };
 
-       amlogic-jtag {
+       jtag {
                compatible = "amlogic, jtag";
                status = "okay";
+               select = "disable"; /* disable/apao/apee */
+               pinctrl-names="jtag_apao_pins", "jtag_apee_pins";
+               pinctrl-0=<&jtag_apao_pins>;
+               pinctrl-1=<&jtag_apee_pins>;
        };
 
        vpu {
                    function = "i2c_ao";
                };
        };
+
+       jtag_apao_pins:jtag_apao_pin {
+               mux {
+                       groups = "GPIOAO_3",
+                       "GPIOAO_4",
+                       "GPIOAO_5",
+                       "GPIOAO_7";
+                       function = "gpio_aobus";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        function = "pwm_d";
                };
        };
+
+       jtag_apee_pins:jtag_apee_pin {
+               mux {
+                       groups = "GPIOC_0",
+                       "GPIOC_1",
+                       "GPIOC_2",
+                       "GPIOC_3";
+                       function = "gpio_periphs";
+               };
+       };
 };
 
 &gpu{
index ddca757..e3890ac 100644 (file)
@@ -101,6 +101,23 @@ static inline char *select_to_name(int select)
        }
 
 }
+static inline int name_to_select(const char *s)
+{
+       int select;
+
+       if (!strncmp(s, "disable", 7))
+               select = AMLOGIC_JTAG_DISABLE;
+       else if (!strncmp(s, "apao", 4))
+               select = AMLOGIC_JTAG_APAO;
+       else if (!strncmp(s, "apee", 4))
+               select = AMLOGIC_JTAG_APEE;
+       else {
+               pr_err("unknown select: %s\n", s);
+               select = AMLOGIC_JTAG_DISABLE;
+       }
+
+       return select;
+}
 
 static void aml_jtag_option_parse(struct aml_jtag_dev *jdev, const char *s)
 {
@@ -108,15 +125,7 @@ static void aml_jtag_option_parse(struct aml_jtag_dev *jdev, const char *s)
        unsigned long value;
        int ret;
 
-       if (!strncmp(s, "disable", 7))
-               jdev->select = AMLOGIC_JTAG_DISABLE;
-       else if (!strncmp(s, "apao", 4))
-               jdev->select = AMLOGIC_JTAG_APAO;
-       else if (!strncmp(s, "apee", 4))
-               jdev->select = AMLOGIC_JTAG_APEE;
-       else
-               pr_err("unknown select: %s", s);
-
+       jdev->select = name_to_select(s);
        cluster = strchr(s, ',');
        if (cluster != NULL) {
                cluster++;
@@ -138,19 +147,10 @@ static int __init setup_jtag(char *p)
        unsigned long value;
        int ret;
 
+       if (!p)
+               return -EINVAL;
        jtag_select_setup = true;
-
-       if (!strncmp(p, "disable", 7))
-               jtag_select = AMLOGIC_JTAG_DISABLE;
-       else if (!strncmp(p, "apao", 4))
-               jtag_select = AMLOGIC_JTAG_APAO;
-       else if (!strncmp(p, "apee", 4))
-               jtag_select = AMLOGIC_JTAG_APEE;
-       else
-               jtag_select = AMLOGIC_JTAG_DISABLE;
-
-       pr_info("jtag select %s\n", select_to_name(jtag_select));
-
+       jtag_select = name_to_select(p);
        cluster = strchr(p, ',');
        if (cluster != NULL) {
                cluster++;
@@ -176,97 +176,6 @@ static int __init setup_jtag(char *p)
  */
 __setup("jtag=", setup_jtag);
 
-
-/*
- * request gpios for jtag apao.
- *
- * @return: 0 success, other failed
- *
- */
-static int aml_jtag_apao_request_gpios(struct platform_device *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
-       const unsigned int *gpios = jdev->ao_gpios;
-
-       int ngpio, i, ret;
-
-       ngpio = jdev->ao_ngpios;
-
-       for (i = 0; i < ngpio; i++) {
-               ret = devm_gpio_request(dev, gpios[i], "apao");
-               if (ret) {
-                       pr_err("can't request gpio %d", gpios[i]);
-                       return -ENOENT;
-               }
-               pr_info("request gpio %d  for apao\n", gpios[i]);
-       }
-
-       return 0;
-}
-
-static int aml_jtag_apao_free_gpios(struct platform_device *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
-       const unsigned int *gpios = jdev->ao_gpios;
-
-       int ngpio, i;
-
-       ngpio = jdev->ao_ngpios;
-
-       for (i = 0; i < ngpio; i++)
-               devm_gpio_free(dev, gpios[i]);
-
-       return 0;
-}
-
-
-/*
- * request gpios for jtag apee.
- *
- * @return: 0 success, other failed
- *
- */
-static int aml_jtag_apee_request_gpios(struct platform_device *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
-       const unsigned int *gpios = jdev->ee_gpios;
-
-       int ngpio, i, ret;
-
-       ngpio = jdev->ee_ngpios;
-
-       for (i = 0; i < ngpio; i++) {
-               ret = devm_gpio_request(dev, gpios[i], "apee");
-               if (ret) {
-                       pr_err("can't request gpio %d", gpios[i]);
-                       return -ENOENT;
-               }
-               pr_info("request gpio %d for apee\n", gpios[i]);
-       }
-
-       return 0;
-}
-
-static int aml_jtag_apee_free_gpios(struct platform_device *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
-       const unsigned int *gpios = jdev->ee_gpios;
-
-       int ngpio, i;
-
-       ngpio = jdev->ee_ngpios;
-
-       for (i = 0; i < ngpio; i++)
-               devm_gpio_free(dev, gpios[i]);
-
-       return 0;
-}
-
-
 #ifdef CONFIG_MACH_MESON8B
 
 static int aml_jtag_select_tee(struct platform_device *pdev)
@@ -274,8 +183,8 @@ static int aml_jtag_select_tee(struct platform_device *pdev)
        struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
        uint32_t select = jdev->select;
 
-       pr_info("set state %u\n", select);
        set_cpus_allowed_ptr(current, cpumask_of(0));
+       pr_info("meson8b select %s\n", select_to_name(jdev->select));
        switch (select) {
        case AMLOGIC_JTAG_DISABLE:
                meson_secure_jtag_disable();
@@ -309,7 +218,7 @@ static int aml_jtag_select_ree(struct platform_device *pdev)
                pr_err("failed to iomap regs");
                return -ENODEV;
        }
-
+       pr_info("meson8b select %s\n", select_to_name(jdev->select));
        switch (sel) {
        case AMLOGIC_JTAG_DISABLE:
                writel_relaxed(0x0, jdev->base);
@@ -353,6 +262,7 @@ static unsigned long __invoke_psci_fn_smc(unsigned long function_id,
        struct arm_smccc_res res;
 
        arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res);
+
        return res.a0;
 }
 
@@ -388,8 +298,7 @@ static int aml_jtag_select(struct platform_device *pdev)
        if (jdev->cluster != CLUSTER_DISABLE)
                select |= jdev->cluster << CLUSTER_BIT;
 
-       pr_info("set state %u\n", select);
-
+       pr_info("select %s\n", select_to_name(select));
        set_cpus_allowed_ptr(current, cpumask_of(0));
        aml_set_jtag_state(state, select);
        set_cpus_allowed_ptr(current, cpu_all_mask);
@@ -399,43 +308,64 @@ static int aml_jtag_select(struct platform_device *pdev)
 
 #endif
 
-static void aml_jtag_setup(struct aml_jtag_dev *jdev)
+static int aml_jtag_setup(struct aml_jtag_dev *jdev)
 {
-       struct platform_device *pdev = jdev->pdev;
        unsigned int old_select = jdev->old_select;
        unsigned int select = jdev->select;
+       struct pinctrl_state *s;
+       int ret;
 
        if (old_select == select)
-               return;
-
-       /* free gpios */
-       switch (old_select) {
-       case AMLOGIC_JTAG_APAO:
-               aml_jtag_apao_free_gpios(pdev);
-               break;
-       case AMLOGIC_JTAG_APEE:
-               aml_jtag_apee_free_gpios(pdev);
-               break;
-       default:
-               break;
+               return 0;
+       if (!jdev->jtag_pinctrl) {
+               jdev->jtag_pinctrl = devm_pinctrl_get(&jdev->pdev->dev);
+               if (IS_ERR_OR_NULL(jdev->jtag_pinctrl)) {
+                       dev_err(&jdev->pdev->dev, "could not get pinctrl handle\n");
+                       return -EINVAL;
+               }
        }
-
-       /* free gpios */
+       /* set pinmux */
        switch (select) {
        case AMLOGIC_JTAG_APAO:
-               aml_jtag_apao_request_gpios(pdev);
+               s = pinctrl_lookup_state(jdev->jtag_pinctrl, "jtag_apao_pins");
+               if (IS_ERR_OR_NULL(s)) {
+                       dev_err(&jdev->pdev->dev,
+                                       "could not get jtag_apao_pins state\n");
+                       return -EINVAL;
+               }
+               ret = pinctrl_select_state(jdev->jtag_pinctrl, s);
+               if (ret) {
+                       dev_err(&jdev->pdev->dev, "failed to set pinctrl\n");
+                       return -EINVAL;
+               }
                break;
        case AMLOGIC_JTAG_APEE:
-               aml_jtag_apee_request_gpios(pdev);
+               s = pinctrl_lookup_state(jdev->jtag_pinctrl, "jtag_apee_pins");
+               if (IS_ERR_OR_NULL(s)) {
+                       dev_err(&jdev->pdev->dev,
+                                       "could not get jtag_apee_pins state\n");
+                       return -EINVAL;
+               }
+               ret = pinctrl_select_state(jdev->jtag_pinctrl, s);
+               if (ret) {
+                       dev_err(&jdev->pdev->dev, "failed to set pinctrl\n");
+                       return -EINVAL;
+               }
                break;
        default:
+               if (old_select != AMLOGIC_JTAG_DISABLE) {
+                       devm_pinctrl_put(jdev->jtag_pinctrl);
+                       jdev->jtag_pinctrl = NULL;
+               }
                break;
        }
 
+       /* save to global */
+       global_select = jdev->select;
        aml_jtag_select(jdev->pdev);
-
        jdev->old_select = select;
 
+       return 0;
 }
 
 static ssize_t jtag_select_show(struct class *cls,
@@ -448,23 +378,23 @@ static ssize_t jtag_select_show(struct class *cls,
        len += sprintf(buf + len, "usage:\n");
        len += sprintf(buf + len, "    echo [apao|apee] > select\n");
        len += sprintf(buf + len, "    echo [apao|apee]{,[0|1]} > select\n");
+
        return len;
 }
 
-
 static ssize_t jtag_select_store(struct class *cls,
                         struct class_attribute *attr,
                         const char *buffer, size_t count)
 {
        struct aml_jtag_dev *jdev;
+       int ret;
 
        jdev = container_of(cls, struct aml_jtag_dev, cls);
        aml_jtag_option_parse(jdev, buffer);
 
-       /* save to global */
-       global_select = jdev->select;
-
-       aml_jtag_setup(jdev);
+       ret = aml_jtag_setup(jdev);
+       if (ret < 0)
+               return ret;
 
        return count;
 }
@@ -474,63 +404,13 @@ static struct class_attribute aml_jtag_attrs[] = {
        __ATTR_NULL,
 };
 
-
 static int aml_jtag_dt_parse(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct device_node *np = dev->of_node;
        struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
        const char *tmp;
-
-       int ao_ngpios, ee_ngpios;
-       unsigned int *ao_gpios, *ee_gpios;
-       int ret, i, gpio;
-
-
-       ao_ngpios = of_gpio_named_count(np, "jtagao-gpios");
-       if (ao_ngpios <= 0) {
-               pr_err("ao gpios not specified\n");
-               return -EINVAL;
-       }
-
-       ee_ngpios = of_gpio_named_count(np, "jtagee-gpios");
-       if (ee_ngpios <= 0) {
-               pr_err("ee gpios not specified\n");
-               return -EINVAL;
-       }
-
-       jdev->ao_ngpios = ao_ngpios;
-       jdev->ee_ngpios = ee_ngpios;
-
-       ao_gpios = devm_kzalloc(dev, sizeof(unsigned int) * ao_ngpios,
-                               GFP_KERNEL);
-       ee_gpios = devm_kzalloc(dev, sizeof(unsigned int) * ee_ngpios,
-                               GFP_KERNEL);
-       if (!ao_gpios || !ee_gpios) {
-               pr_err("failed to allocate memory for gpios\n");
-               return -ENOMEM;
-       }
-
-       for (i = 0; i < ao_ngpios; i++) {
-               gpio = of_get_named_gpio(dev->of_node, "jtagao-gpios", i);
-               if (!gpio_is_valid(gpio)) {
-                       pr_err("gpio %d is not valid", gpio);
-                       return -EINVAL;
-               }
-               ao_gpios[i] = gpio;
-       }
-
-       for (i = 0; i < ee_ngpios; i++) {
-               gpio = of_get_named_gpio(dev->of_node, "jtagee-gpios", i);
-               if (!gpio_is_valid(gpio)) {
-                       pr_err("gpio %d is not valid", gpio);
-                       return -EINVAL;
-               }
-               ee_gpios[i] = gpio;
-       }
-
-       jdev->ao_gpios = ao_gpios;
-       jdev->ee_gpios = ee_gpios;
+       int ret;
 
        /* otherwise set select with dt */
        ret = of_property_read_string(np, "select", &tmp);
@@ -538,34 +418,22 @@ static int aml_jtag_dt_parse(struct platform_device *pdev)
                pr_err("select not configured\n");
                return -EINVAL;
        }
-       pr_info("select is configured %s\n", tmp);
-
-       if (!strcmp(tmp, "disable"))
-               jdev->select = AMLOGIC_JTAG_DISABLE;
-       else if (!strcmp(tmp, "apao"))
-               jdev->select = AMLOGIC_JTAG_APAO;
-       else if (!strcmp(tmp, "apee"))
-               jdev->select = AMLOGIC_JTAG_APEE;
-       else
-               pr_err("unknown select: %s", tmp);
-
+       jdev->select = name_to_select(tmp);
        return 0;
 }
 
-
-
 static int aml_jtag_probe(struct platform_device *pdev)
 {
        struct aml_jtag_dev *jdev;
        int ret;
 
        /* kzalloc device */
-       jdev = kzalloc(sizeof(struct aml_jtag_dev), GFP_KERNEL);
+       jdev = devm_kzalloc(&pdev->dev,
+                           sizeof(struct aml_jtag_dev), GFP_KERNEL);
 
        /* set driver data */
        jdev->pdev = pdev;
        platform_set_drvdata(pdev, jdev);
-
        ret = aml_jtag_dt_parse(pdev);
        if (ret)
                return -EINVAL;
@@ -575,12 +443,8 @@ static int aml_jtag_probe(struct platform_device *pdev)
        if (jtag_select_setup) {
                jdev->select = jtag_select;
                jdev->cluster = jtag_cluster;
-               pr_info("select is replaced by boot param\n");
        }
 
-       /* save to global */
-       global_select = jdev->select;
-
        /* create class attributes */
        jdev->cls.name = AML_JTAG_NAME;
        jdev->cls.owner = THIS_MODULE;
@@ -592,26 +456,25 @@ static int aml_jtag_probe(struct platform_device *pdev)
        }
 
        /* setup jtag */
-       aml_jtag_setup(jdev);
+       ret = aml_jtag_setup(jdev);
+       if (ret < 0) {
+               class_unregister(&jdev->cls);
+               return ret;
+       }
 
-       pr_info("module probed ok\n");
        return 0;
 }
 
-
 static int __exit aml_jtag_remove(struct platform_device *pdev)
 {
        struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
 
        class_unregister(&jdev->cls);
        platform_set_drvdata(pdev, NULL);
-       kfree(jdev);
 
-       pr_info("module removed ok\n");
        return 0;
 }
 
-
 static const struct of_device_id aml_jtag_dt_match[] = {
        {
                .compatible = "amlogic, jtag",
@@ -619,7 +482,6 @@ static const struct of_device_id aml_jtag_dt_match[] = {
        {},
 };
 
-
 static struct platform_driver aml_jtag_driver = {
        .driver = {
                .name = AML_JTAG_NAME,
@@ -630,10 +492,8 @@ static struct platform_driver aml_jtag_driver = {
        .remove = __exit_p(aml_jtag_remove),
 };
 
-
 static int __init aml_jtag_init(void)
 {
-       pr_info("module init\n");
        if (platform_driver_register(&aml_jtag_driver)) {
                pr_err("failed to register driver\n");
                return -ENODEV;
@@ -651,7 +511,6 @@ fs_initcall(aml_jtag_init);
 
 static void __exit aml_jtag_exit(void)
 {
-       pr_info("module exit\n");
        platform_driver_unregister(&aml_jtag_driver);
 }
 
index 41713a6..1b9556c 100644 (file)
@@ -27,6 +27,7 @@
 
 struct aml_jtag_dev {
        struct platform_device *pdev;
+       struct pinctrl *jtag_pinctrl;
        struct class cls;
 
 #ifdef CONFIG_MACH_MESON8B