cec: cec g12a bring up
authorhongmin hua <hongmin.hua@amlogic.com>
Fri, 12 Jan 2018 07:42:38 +0000 (15:42 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 5 Mar 2018 06:11:34 +0000 (14:11 +0800)
PD#156734: cec: change interrupt/pinmux for g12a

Change-Id: I5f9f652addf81db4b792796d41f367073a8ac5b9
Signed-off-by: hongmin hua <hongmin.hua@amlogic.com>
arch/arm64/boot/dts/amlogic/g12a_pxp.dts
arch/arm64/boot/dts/amlogic/g12a_skt.dts
arch/arm64/boot/dts/amlogic/mesong12a.dtsi
drivers/amlogic/cec/hdmi_ao_cec.c
drivers/amlogic/cec/hdmi_ao_cec.h

index 7f69ea7..afc740a 100644 (file)
                         */
                };
        };
+
+       aocec: aocec {
+               compatible = "amlogic, aocec-g12a";
+               device_name = "aocec";
+               status = "okay";
+               vendor_name = "Amlogic"; /* Max Chars: 8     */
+               /* Refer to the following URL at:
+                * http://standards.ieee.org/develop/regauth/oui/oui.txt
+                */
+               vendor_id = <0x000000>;
+               product_desc = "G12A"; /* Max Chars: 16    */
+               cec_osd_string = "AML_MBOX"; /* Max Chars: 14    */
+               port_num = <1>;
+               ee_cec;
+               arc_port_mask = <0x2>;
+               interrupts = <0 203 1>;
+               interrupt-names = "hdmi_aocecb";
+               pinctrl-names = "default";
+               pinctrl-0=<&eecec_b>;
+               reg = <0x0 0xFF80023c 0x0 0x4
+                      0x0 0xFF800000 0x0 0x400>;
+       };
+
        canvas{
                compatible = "amlogic, meson, canvas";
                dev_name = "amlogic-canvas";
index 864f7de..d967372 100644 (file)
                pinctrl-0 = <&c_uart_pins>;
        };
 
+       aocec: aocec {
+               compatible = "amlogic, aocec-g12a";
+               device_name = "aocec";
+               status = "okay";
+               vendor_name = "Amlogic"; /* Max Chars: 8     */
+               /* Refer to the following URL at:
+                * http://standards.ieee.org/develop/regauth/oui/oui.txt
+                */
+               vendor_id = <0x000000>;
+               product_desc = "G12A"; /* Max Chars: 16    */
+               cec_osd_string = "AML_MBOX"; /* Max Chars: 14    */
+               port_num = <1>;
+               ee_cec;
+               arc_port_mask = <0x2>;
+               interrupts = <0 203 1>;
+               interrupt-names = "hdmi_aocecb";
+               pinctrl-names = "default";
+               pinctrl-0=<&eecec_b>;
+               reg = <0x0 0xFF80023c 0x0 0x4
+                      0x0 0xFF800000 0x0 0x400>;
+       };
+
        dwc3: dwc3@ff500000 {
                compatible = "synopsys, dwc3";
                status = "okay";
index 23a5a99..098114e 100644 (file)
                        function = "i2c_ao_slave";
                };
        };
+
+       aocec_a: ao_ceca {
+               mux {
+                       groups = "cec_ao_a";
+                       function = "cec_ao";
+               };
+       };
+
+       aocec_b: ao_cecb {
+               mux {
+                       groups = "cec_ao_b";
+                       function = "cec_ao";
+               };
+       };
 };
 
 &pinctrl_periphs {
                        function = "pwm_e";
                };
        };
+
+       c_i2c_master_pin1:c_i2c_pin1 {
+               mux {
+                       groups = "i2c3_sck_a",
+                               "i2c3_sda_a";
+                       function = "i2c3";
+               };
+       };
+
+       eecec_a: ee_ceca {
+               mux {
+                       groups = "cec_ao_a_ee";
+                       function = "cec_ao_ee";
+               };
+       };
+
+       eecec_b: ee_cecb {
+               mux {
+                       groups = "cec_ao_b_ee";
+                       function = "cec_ao_ee";
+               };
+       };
 };
 
 &pinctrl_aobus {
index aa2b4fe..f120094 100644 (file)
@@ -510,7 +510,7 @@ static void ao_cecb_init(void)
        writel(reg, cec_dev->cec_reg + AO_CECB_CLK_CNTL_REG0);
 
        reg = readl(cec_dev->cec_reg + AO_RTI_PWR_CNTL_REG0);
-       reg |=  (0x01 << 6);    /* xtal gate */
+       reg |=  (0x01 << 14);   /* xtal gate */
        writel(reg, cec_dev->cec_reg + AO_RTI_PWR_CNTL_REG0);
 
        data32  = 0;
@@ -1840,7 +1840,6 @@ static ssize_t physical_addr_store(struct class *cla,
 
        if (kstrtouint(buf, 16, &addr) != 1)
                return -EINVAL;
-
        if (addr > 0xffff || addr < 0) {
                CEC_ERR("invalid input:%s\n", buf);
                phy_addr_test = 0;
@@ -2385,6 +2384,11 @@ static const struct cec_platform_data_s cec_txlx_data = {
        .ee_to_ao = 1,
 };
 
+static const struct cec_platform_data_s cec_g12a_data = {
+       .line_bit = 7,
+       .ee_to_ao = 1,
+};
+
 static const struct of_device_id aml_cec_dt_match[] = {
        {
                .compatible = "amlogic, amlogic-aocec",
@@ -2394,6 +2398,10 @@ static const struct of_device_id aml_cec_dt_match[] = {
                .compatible = "amlogic, aocec-txlx",
                .data = &cec_txlx_data,
        },
+       {
+               .compatible = "amlogic, aocec-g12a",
+               .data = &cec_g12a_data,
+       },
 };
 #endif
 
@@ -2406,7 +2414,7 @@ static int aml_cec_probe(struct platform_device *pdev)
        struct device_node *node = pdev->dev.of_node;
        int irq_idx = 0, r;
        const char *irq_name = NULL;
-       /*struct pinctrl *p;*/
+       struct pinctrl *p;
        struct vendor_info_data *vend;
        struct resource *res;
        resource_size_t *base;
@@ -2502,6 +2510,19 @@ static int aml_cec_probe(struct platform_device *pdev)
        else
                ee_cec = 0;
        CEC_INFO("using EE cec:%d\n", ee_cec);
+       /* pinmux set */
+       if (of_get_property(node, "pinctrl-names", NULL)) {
+               r = of_property_read_string(node,
+                                           "pinctrl-names",
+                                           &cec_dev->pin_name);
+               if ((!r) && strcmp(cec_dev->pin_name, "default")) {
+                       CEC_INFO("%s pin name:%s\n", __func__,
+                        cec_dev->pin_name);
+                       p = devm_pinctrl_get_select(&pdev->dev,
+                                                   cec_dev->pin_name);
+               }
+       }
+
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (res) {
                base = ioremap(res->start, res->end - res->start);
@@ -2614,6 +2635,8 @@ static int aml_cec_probe(struct platform_device *pdev)
        cec_pre_init();
        queue_delayed_work(cec_dev->cec_thread, &cec_dev->cec_work, 0);
 
+       CEC_ERR("%s success end\n", __func__);
+
        return 0;
 tag_cec_msg_alloc_err:
                input_free_device(cec_dev->cec_info.remote_cec_dev);
index ef1182a..a9d7eb6 100644 (file)
 #define AO_DEBUG_REG1                  ((0x29 << 2))
 #define AO_DEBUG_REG2                  ((0x2a << 2))
 #define AO_DEBUG_REG3                  ((0x2b << 2))
+#define AO_CEC_STICKY_DATA0                    ((0xca << 2))
+#define AO_CEC_STICKY_DATA1                    ((0xcb << 2))
+#define AO_CEC_STICKY_DATA2                    ((0xcc << 2))
+#define AO_CEC_STICKY_DATA3                    ((0xcd << 2))
+#define AO_CEC_STICKY_DATA4                    ((0xce << 2))
+#define AO_CEC_STICKY_DATA5                    ((0xcf << 2))
+#define AO_CEC_STICKY_DATA6                    ((0xd0 << 2))
+#define AO_CEC_STICKY_DATA7                    ((0xd1 << 2))
 
 /*
  * AOCEC_B