From d5878eedc3452c47a93d4337fada8940dc1809a5 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 23 Oct 2020 22:05:05 +0100 Subject: [PATCH 01/56] dt-bindings: vendor-prefixes: Add abt vendor prefix Add prefix for ShenZhen Asia Better Technology Ltd. Signed-off-by: Paul Cercueil --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 2735be1a847095..25444fd85883f6 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -29,6 +29,8 @@ patternProperties: description: Abilis Systems "^abracon,.*": description: Abracon Corporation + "^abt,.*": + description: ShenZhen Asia Better Technology Ltd. "^acer,.*": description: Acer Inc. "^acme,.*": From 81f12487b2740478f05fc65fecab933911c7044b Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 10 Oct 2020 21:13:31 +0200 Subject: [PATCH 02/56] pinctrl: ingenic: Fix invalid SSI pins The values for the SSI pins on GPIO chips D and E were off by 0x20. Fixes: d3ef8c6b2286 ("pinctrl: Ingenic: Add SSI pins support for JZ4770 and JZ4780.") Signed-off-by: Paul Cercueil Reported-by: Artur Rojek --- drivers/pinctrl/pinctrl-ingenic.c | 72 +++++++++++++++---------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c index c8e50a58a5e53d..621909b01debd7 100644 --- a/drivers/pinctrl/pinctrl-ingenic.c +++ b/drivers/pinctrl/pinctrl-ingenic.c @@ -635,44 +635,44 @@ static int jz4770_uart3_data_pins[] = { 0x6c, 0x85, }; static int jz4770_uart3_hwflow_pins[] = { 0x88, 0x89, }; static int jz4770_ssi0_dt_a_pins[] = { 0x15, }; static int jz4770_ssi0_dt_b_pins[] = { 0x35, }; -static int jz4770_ssi0_dt_d_pins[] = { 0x55, }; -static int jz4770_ssi0_dt_e_pins[] = { 0x71, }; +static int jz4770_ssi0_dt_d_pins[] = { 0x75, }; +static int jz4770_ssi0_dt_e_pins[] = { 0x91, }; static int jz4770_ssi0_dr_a_pins[] = { 0x14, }; static int jz4770_ssi0_dr_b_pins[] = { 0x34, }; -static int jz4770_ssi0_dr_d_pins[] = { 0x54, }; -static int jz4770_ssi0_dr_e_pins[] = { 0x6e, }; +static int jz4770_ssi0_dr_d_pins[] = { 0x74, }; +static int jz4770_ssi0_dr_e_pins[] = { 0x8e, }; static int jz4770_ssi0_clk_a_pins[] = { 0x12, }; static int jz4770_ssi0_clk_b_pins[] = { 0x3c, }; -static int jz4770_ssi0_clk_d_pins[] = { 0x58, }; -static int jz4770_ssi0_clk_e_pins[] = { 0x6f, }; +static int jz4770_ssi0_clk_d_pins[] = { 0x78, }; +static int jz4770_ssi0_clk_e_pins[] = { 0x8f, }; static int jz4770_ssi0_gpc_b_pins[] = { 0x3e, }; -static int jz4770_ssi0_gpc_d_pins[] = { 0x56, }; -static int jz4770_ssi0_gpc_e_pins[] = { 0x73, }; +static int jz4770_ssi0_gpc_d_pins[] = { 0x76, }; +static int jz4770_ssi0_gpc_e_pins[] = { 0x93, }; static int jz4770_ssi0_ce0_a_pins[] = { 0x13, }; static int jz4770_ssi0_ce0_b_pins[] = { 0x3d, }; -static int jz4770_ssi0_ce0_d_pins[] = { 0x59, }; -static int jz4770_ssi0_ce0_e_pins[] = { 0x70, }; +static int jz4770_ssi0_ce0_d_pins[] = { 0x79, }; +static int jz4770_ssi0_ce0_e_pins[] = { 0x90, }; static int jz4770_ssi0_ce1_b_pins[] = { 0x3f, }; -static int jz4770_ssi0_ce1_d_pins[] = { 0x57, }; -static int jz4770_ssi0_ce1_e_pins[] = { 0x72, }; +static int jz4770_ssi0_ce1_d_pins[] = { 0x77, }; +static int jz4770_ssi0_ce1_e_pins[] = { 0x92, }; static int jz4770_ssi1_dt_b_pins[] = { 0x35, }; -static int jz4770_ssi1_dt_d_pins[] = { 0x55, }; -static int jz4770_ssi1_dt_e_pins[] = { 0x71, }; +static int jz4770_ssi1_dt_d_pins[] = { 0x75, }; +static int jz4770_ssi1_dt_e_pins[] = { 0x91, }; static int jz4770_ssi1_dr_b_pins[] = { 0x34, }; -static int jz4770_ssi1_dr_d_pins[] = { 0x54, }; -static int jz4770_ssi1_dr_e_pins[] = { 0x6e, }; +static int jz4770_ssi1_dr_d_pins[] = { 0x74, }; +static int jz4770_ssi1_dr_e_pins[] = { 0x8e, }; static int jz4770_ssi1_clk_b_pins[] = { 0x3c, }; -static int jz4770_ssi1_clk_d_pins[] = { 0x58, }; -static int jz4770_ssi1_clk_e_pins[] = { 0x6f, }; +static int jz4770_ssi1_clk_d_pins[] = { 0x78, }; +static int jz4770_ssi1_clk_e_pins[] = { 0x8f, }; static int jz4770_ssi1_gpc_b_pins[] = { 0x3e, }; -static int jz4770_ssi1_gpc_d_pins[] = { 0x56, }; -static int jz4770_ssi1_gpc_e_pins[] = { 0x73, }; +static int jz4770_ssi1_gpc_d_pins[] = { 0x76, }; +static int jz4770_ssi1_gpc_e_pins[] = { 0x93, }; static int jz4770_ssi1_ce0_b_pins[] = { 0x3d, }; -static int jz4770_ssi1_ce0_d_pins[] = { 0x59, }; -static int jz4770_ssi1_ce0_e_pins[] = { 0x70, }; +static int jz4770_ssi1_ce0_d_pins[] = { 0x79, }; +static int jz4770_ssi1_ce0_e_pins[] = { 0x90, }; static int jz4770_ssi1_ce1_b_pins[] = { 0x3f, }; -static int jz4770_ssi1_ce1_d_pins[] = { 0x57, }; -static int jz4770_ssi1_ce1_e_pins[] = { 0x72, }; +static int jz4770_ssi1_ce1_d_pins[] = { 0x77, }; +static int jz4770_ssi1_ce1_e_pins[] = { 0x92, }; static int jz4770_mmc0_1bit_a_pins[] = { 0x12, 0x13, 0x14, }; static int jz4770_mmc0_4bit_a_pins[] = { 0x15, 0x16, 0x17, }; static int jz4770_mmc0_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, }; @@ -1050,35 +1050,35 @@ static int jz4780_ssi0_dt_a_19_pins[] = { 0x13, }; static int jz4780_ssi0_dt_a_21_pins[] = { 0x15, }; static int jz4780_ssi0_dt_a_28_pins[] = { 0x1c, }; static int jz4780_ssi0_dt_b_pins[] = { 0x3d, }; -static int jz4780_ssi0_dt_d_pins[] = { 0x59, }; +static int jz4780_ssi0_dt_d_pins[] = { 0x79, }; static int jz4780_ssi0_dr_a_20_pins[] = { 0x14, }; static int jz4780_ssi0_dr_a_27_pins[] = { 0x1b, }; static int jz4780_ssi0_dr_b_pins[] = { 0x34, }; -static int jz4780_ssi0_dr_d_pins[] = { 0x54, }; +static int jz4780_ssi0_dr_d_pins[] = { 0x74, }; static int jz4780_ssi0_clk_a_pins[] = { 0x12, }; static int jz4780_ssi0_clk_b_5_pins[] = { 0x25, }; static int jz4780_ssi0_clk_b_28_pins[] = { 0x3c, }; -static int jz4780_ssi0_clk_d_pins[] = { 0x58, }; +static int jz4780_ssi0_clk_d_pins[] = { 0x78, }; static int jz4780_ssi0_gpc_b_pins[] = { 0x3e, }; -static int jz4780_ssi0_gpc_d_pins[] = { 0x56, }; +static int jz4780_ssi0_gpc_d_pins[] = { 0x76, }; static int jz4780_ssi0_ce0_a_23_pins[] = { 0x17, }; static int jz4780_ssi0_ce0_a_25_pins[] = { 0x19, }; static int jz4780_ssi0_ce0_b_pins[] = { 0x3f, }; -static int jz4780_ssi0_ce0_d_pins[] = { 0x57, }; +static int jz4780_ssi0_ce0_d_pins[] = { 0x77, }; static int jz4780_ssi0_ce1_b_pins[] = { 0x35, }; -static int jz4780_ssi0_ce1_d_pins[] = { 0x55, }; +static int jz4780_ssi0_ce1_d_pins[] = { 0x75, }; static int jz4780_ssi1_dt_b_pins[] = { 0x3d, }; -static int jz4780_ssi1_dt_d_pins[] = { 0x59, }; +static int jz4780_ssi1_dt_d_pins[] = { 0x79, }; static int jz4780_ssi1_dr_b_pins[] = { 0x34, }; -static int jz4780_ssi1_dr_d_pins[] = { 0x54, }; +static int jz4780_ssi1_dr_d_pins[] = { 0x74, }; static int jz4780_ssi1_clk_b_pins[] = { 0x3c, }; -static int jz4780_ssi1_clk_d_pins[] = { 0x58, }; +static int jz4780_ssi1_clk_d_pins[] = { 0x78, }; static int jz4780_ssi1_gpc_b_pins[] = { 0x3e, }; -static int jz4780_ssi1_gpc_d_pins[] = { 0x56, }; +static int jz4780_ssi1_gpc_d_pins[] = { 0x76, }; static int jz4780_ssi1_ce0_b_pins[] = { 0x3f, }; -static int jz4780_ssi1_ce0_d_pins[] = { 0x57, }; +static int jz4780_ssi1_ce0_d_pins[] = { 0x77, }; static int jz4780_ssi1_ce1_b_pins[] = { 0x35, }; -static int jz4780_ssi1_ce1_d_pins[] = { 0x55, }; +static int jz4780_ssi1_ce1_d_pins[] = { 0x75, }; static int jz4780_mmc0_8bit_a_pins[] = { 0x04, 0x05, 0x06, 0x07, 0x18, }; static int jz4780_i2c3_pins[] = { 0x6a, 0x6b, }; static int jz4780_i2c4_e_pins[] = { 0x8c, 0x8d, }; From 9405cdc366fb7d256543d51734b54b6ce29197b4 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 1 Oct 2020 02:02:04 +0200 Subject: [PATCH 03/56] pinctrl: ingenic: Get rid of repetitive data Abuse the pin function pointer to store the pin function value directly, when all the pins of a group have the same function value. Now when the pointer value is <= 3 (unsigned), the pointer value is used as the pin function; otherwise it is used as a regular pointer. This drastically reduces the number of pin function tables needed, and drops .data usage by about 2 KiB. Additionally, the few pin function tables that are still around now contain u8 instead of int, since the largest number that will be stored is 3. Signed-off-by: Paul Cercueil --- drivers/pinctrl/pinctrl-ingenic.c | 1258 ++++++++++------------------- 1 file changed, 447 insertions(+), 811 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c index 621909b01debd7..ed63dfb682415e 100644 --- a/drivers/pinctrl/pinctrl-ingenic.c +++ b/drivers/pinctrl/pinctrl-ingenic.c @@ -134,61 +134,42 @@ static int jz4740_pwm_pwm5_pins[] = { 0x7c, }; static int jz4740_pwm_pwm6_pins[] = { 0x7e, }; static int jz4740_pwm_pwm7_pins[] = { 0x7f, }; -static int jz4740_mmc_1bit_funcs[] = { 0, 0, 0, }; -static int jz4740_mmc_4bit_funcs[] = { 0, 0, 0, }; -static int jz4740_uart0_data_funcs[] = { 1, 1, }; -static int jz4740_uart0_hwflow_funcs[] = { 1, 1, }; -static int jz4740_uart1_data_funcs[] = { 2, 2, }; -static int jz4740_lcd_8bit_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4740_lcd_16bit_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4740_lcd_18bit_funcs[] = { 0, 0, }; -static int jz4740_lcd_18bit_tft_funcs[] = { 0, 0, 0, 0, }; -static int jz4740_nand_cs1_funcs[] = { 0, }; -static int jz4740_nand_cs2_funcs[] = { 0, }; -static int jz4740_nand_cs3_funcs[] = { 0, }; -static int jz4740_nand_cs4_funcs[] = { 0, }; -static int jz4740_nand_fre_fwe_funcs[] = { 0, 0, }; -static int jz4740_pwm_pwm0_funcs[] = { 0, }; -static int jz4740_pwm_pwm1_funcs[] = { 0, }; -static int jz4740_pwm_pwm2_funcs[] = { 0, }; -static int jz4740_pwm_pwm3_funcs[] = { 0, }; -static int jz4740_pwm_pwm4_funcs[] = { 0, }; -static int jz4740_pwm_pwm5_funcs[] = { 0, }; -static int jz4740_pwm_pwm6_funcs[] = { 0, }; -static int jz4740_pwm_pwm7_funcs[] = { 0, }; - -#define INGENIC_PIN_GROUP(name, id) \ + +#define INGENIC_PIN_GROUP_FUNCS(name, id, funcs) \ { \ name, \ id##_pins, \ ARRAY_SIZE(id##_pins), \ - id##_funcs, \ + funcs, \ } +#define INGENIC_PIN_GROUP(name, id, func) \ + INGENIC_PIN_GROUP_FUNCS(name, id, (void *)(func)) + static const struct group_desc jz4740_groups[] = { - INGENIC_PIN_GROUP("mmc-1bit", jz4740_mmc_1bit), - INGENIC_PIN_GROUP("mmc-4bit", jz4740_mmc_4bit), - INGENIC_PIN_GROUP("uart0-data", jz4740_uart0_data), - INGENIC_PIN_GROUP("uart0-hwflow", jz4740_uart0_hwflow), - INGENIC_PIN_GROUP("uart1-data", jz4740_uart1_data), - INGENIC_PIN_GROUP("lcd-8bit", jz4740_lcd_8bit), - INGENIC_PIN_GROUP("lcd-16bit", jz4740_lcd_16bit), - INGENIC_PIN_GROUP("lcd-18bit", jz4740_lcd_18bit), - INGENIC_PIN_GROUP("lcd-18bit-tft", jz4740_lcd_18bit_tft), + INGENIC_PIN_GROUP("mmc-1bit", jz4740_mmc_1bit, 0), + INGENIC_PIN_GROUP("mmc-4bit", jz4740_mmc_4bit, 0), + INGENIC_PIN_GROUP("uart0-data", jz4740_uart0_data, 1), + INGENIC_PIN_GROUP("uart0-hwflow", jz4740_uart0_hwflow, 1), + INGENIC_PIN_GROUP("uart1-data", jz4740_uart1_data, 2), + INGENIC_PIN_GROUP("lcd-8bit", jz4740_lcd_8bit, 0), + INGENIC_PIN_GROUP("lcd-16bit", jz4740_lcd_16bit, 0), + INGENIC_PIN_GROUP("lcd-18bit", jz4740_lcd_18bit, 0), + INGENIC_PIN_GROUP("lcd-18bit-tft", jz4740_lcd_18bit_tft, 0), { "lcd-no-pins", }, - INGENIC_PIN_GROUP("nand-cs1", jz4740_nand_cs1), - INGENIC_PIN_GROUP("nand-cs2", jz4740_nand_cs2), - INGENIC_PIN_GROUP("nand-cs3", jz4740_nand_cs3), - INGENIC_PIN_GROUP("nand-cs4", jz4740_nand_cs4), - INGENIC_PIN_GROUP("nand-fre-fwe", jz4740_nand_fre_fwe), - INGENIC_PIN_GROUP("pwm0", jz4740_pwm_pwm0), - INGENIC_PIN_GROUP("pwm1", jz4740_pwm_pwm1), - INGENIC_PIN_GROUP("pwm2", jz4740_pwm_pwm2), - INGENIC_PIN_GROUP("pwm3", jz4740_pwm_pwm3), - INGENIC_PIN_GROUP("pwm4", jz4740_pwm_pwm4), - INGENIC_PIN_GROUP("pwm5", jz4740_pwm_pwm5), - INGENIC_PIN_GROUP("pwm6", jz4740_pwm_pwm6), - INGENIC_PIN_GROUP("pwm7", jz4740_pwm_pwm7), + INGENIC_PIN_GROUP("nand-cs1", jz4740_nand_cs1, 0), + INGENIC_PIN_GROUP("nand-cs2", jz4740_nand_cs2, 0), + INGENIC_PIN_GROUP("nand-cs3", jz4740_nand_cs3, 0), + INGENIC_PIN_GROUP("nand-cs4", jz4740_nand_cs4, 0), + INGENIC_PIN_GROUP("nand-fre-fwe", jz4740_nand_fre_fwe, 0), + INGENIC_PIN_GROUP("pwm0", jz4740_pwm_pwm0, 0), + INGENIC_PIN_GROUP("pwm1", jz4740_pwm_pwm1, 0), + INGENIC_PIN_GROUP("pwm2", jz4740_pwm_pwm2, 0), + INGENIC_PIN_GROUP("pwm3", jz4740_pwm_pwm3, 0), + INGENIC_PIN_GROUP("pwm4", jz4740_pwm_pwm4, 0), + INGENIC_PIN_GROUP("pwm5", jz4740_pwm_pwm5, 0), + INGENIC_PIN_GROUP("pwm6", jz4740_pwm_pwm6, 0), + INGENIC_PIN_GROUP("pwm7", jz4740_pwm_pwm7, 0), }; static const char *jz4740_mmc_groups[] = { "mmc-1bit", "mmc-4bit", }; @@ -268,54 +249,33 @@ static int jz4725b_lcd_24bit_pins[] = { 0x76, 0x77, 0x78, 0x79, }; static int jz4725b_lcd_special_pins[] = { 0x76, 0x77, 0x78, 0x79, }; static int jz4725b_lcd_generic_pins[] = { 0x75, }; -static int jz4725b_mmc0_1bit_funcs[] = { 1, 1, 1, }; -static int jz4725b_mmc0_4bit_funcs[] = { 1, 0, 1, }; -static int jz4725b_mmc1_1bit_funcs[] = { 0, 0, 0, }; -static int jz4725b_mmc1_4bit_funcs[] = { 0, 0, 0, }; -static int jz4725b_uart_data_funcs[] = { 1, 1, }; -static int jz4725b_nand_cs1_funcs[] = { 0, }; -static int jz4725b_nand_cs2_funcs[] = { 0, }; -static int jz4725b_nand_cs3_funcs[] = { 0, }; -static int jz4725b_nand_cs4_funcs[] = { 0, }; -static int jz4725b_nand_cle_ale_funcs[] = { 0, 0, }; -static int jz4725b_nand_fre_fwe_funcs[] = { 0, 0, }; -static int jz4725b_pwm_pwm0_funcs[] = { 0, }; -static int jz4725b_pwm_pwm1_funcs[] = { 0, }; -static int jz4725b_pwm_pwm2_funcs[] = { 0, }; -static int jz4725b_pwm_pwm3_funcs[] = { 0, }; -static int jz4725b_pwm_pwm4_funcs[] = { 0, }; -static int jz4725b_pwm_pwm5_funcs[] = { 0, }; -static int jz4725b_lcd_8bit_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4725b_lcd_16bit_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4725b_lcd_18bit_funcs[] = { 0, 0, }; -static int jz4725b_lcd_24bit_funcs[] = { 1, 1, 1, 1, }; -static int jz4725b_lcd_special_funcs[] = { 0, 0, 0, 0, }; -static int jz4725b_lcd_generic_funcs[] = { 0, }; +static u8 jz4725b_mmc0_4bit_funcs[] = { 1, 0, 1, }; static const struct group_desc jz4725b_groups[] = { - INGENIC_PIN_GROUP("mmc0-1bit", jz4725b_mmc0_1bit), - INGENIC_PIN_GROUP("mmc0-4bit", jz4725b_mmc0_4bit), - INGENIC_PIN_GROUP("mmc1-1bit", jz4725b_mmc1_1bit), - INGENIC_PIN_GROUP("mmc1-4bit", jz4725b_mmc1_4bit), - INGENIC_PIN_GROUP("uart-data", jz4725b_uart_data), - INGENIC_PIN_GROUP("nand-cs1", jz4725b_nand_cs1), - INGENIC_PIN_GROUP("nand-cs2", jz4725b_nand_cs2), - INGENIC_PIN_GROUP("nand-cs3", jz4725b_nand_cs3), - INGENIC_PIN_GROUP("nand-cs4", jz4725b_nand_cs4), - INGENIC_PIN_GROUP("nand-cle-ale", jz4725b_nand_cle_ale), - INGENIC_PIN_GROUP("nand-fre-fwe", jz4725b_nand_fre_fwe), - INGENIC_PIN_GROUP("pwm0", jz4725b_pwm_pwm0), - INGENIC_PIN_GROUP("pwm1", jz4725b_pwm_pwm1), - INGENIC_PIN_GROUP("pwm2", jz4725b_pwm_pwm2), - INGENIC_PIN_GROUP("pwm3", jz4725b_pwm_pwm3), - INGENIC_PIN_GROUP("pwm4", jz4725b_pwm_pwm4), - INGENIC_PIN_GROUP("pwm5", jz4725b_pwm_pwm5), - INGENIC_PIN_GROUP("lcd-8bit", jz4725b_lcd_8bit), - INGENIC_PIN_GROUP("lcd-16bit", jz4725b_lcd_16bit), - INGENIC_PIN_GROUP("lcd-18bit", jz4725b_lcd_18bit), - INGENIC_PIN_GROUP("lcd-24bit", jz4725b_lcd_24bit), - INGENIC_PIN_GROUP("lcd-special", jz4725b_lcd_special), - INGENIC_PIN_GROUP("lcd-generic", jz4725b_lcd_generic), + INGENIC_PIN_GROUP("mmc0-1bit", jz4725b_mmc0_1bit, 1), + INGENIC_PIN_GROUP_FUNCS("mmc0-4bit", jz4725b_mmc0_4bit, + jz4725b_mmc0_4bit_funcs), + INGENIC_PIN_GROUP("mmc1-1bit", jz4725b_mmc1_1bit, 0), + INGENIC_PIN_GROUP("mmc1-4bit", jz4725b_mmc1_4bit, 0), + INGENIC_PIN_GROUP("uart-data", jz4725b_uart_data, 1), + INGENIC_PIN_GROUP("nand-cs1", jz4725b_nand_cs1, 0), + INGENIC_PIN_GROUP("nand-cs2", jz4725b_nand_cs2, 0), + INGENIC_PIN_GROUP("nand-cs3", jz4725b_nand_cs3, 0), + INGENIC_PIN_GROUP("nand-cs4", jz4725b_nand_cs4, 0), + INGENIC_PIN_GROUP("nand-cle-ale", jz4725b_nand_cle_ale, 0), + INGENIC_PIN_GROUP("nand-fre-fwe", jz4725b_nand_fre_fwe, 0), + INGENIC_PIN_GROUP("pwm0", jz4725b_pwm_pwm0, 0), + INGENIC_PIN_GROUP("pwm1", jz4725b_pwm_pwm1, 0), + INGENIC_PIN_GROUP("pwm2", jz4725b_pwm_pwm2, 0), + INGENIC_PIN_GROUP("pwm3", jz4725b_pwm_pwm3, 0), + INGENIC_PIN_GROUP("pwm4", jz4725b_pwm_pwm4, 0), + INGENIC_PIN_GROUP("pwm5", jz4725b_pwm_pwm5, 0), + INGENIC_PIN_GROUP("lcd-8bit", jz4725b_lcd_8bit, 0), + INGENIC_PIN_GROUP("lcd-16bit", jz4725b_lcd_16bit, 0), + INGENIC_PIN_GROUP("lcd-18bit", jz4725b_lcd_18bit, 0), + INGENIC_PIN_GROUP("lcd-24bit", jz4725b_lcd_24bit, 1), + INGENIC_PIN_GROUP("lcd-special", jz4725b_lcd_special, 0), + INGENIC_PIN_GROUP("lcd-generic", jz4725b_lcd_generic, 0), }; static const char *jz4725b_mmc0_groups[] = { "mmc0-1bit", "mmc0-4bit", }; @@ -431,110 +391,61 @@ static int jz4760_pwm_pwm5_pins[] = { 0x85, }; static int jz4760_pwm_pwm6_pins[] = { 0x6a, }; static int jz4760_pwm_pwm7_pins[] = { 0x6b, }; -static int jz4760_uart0_data_funcs[] = { 0, 0, }; -static int jz4760_uart0_hwflow_funcs[] = { 0, 0, }; -static int jz4760_uart1_data_funcs[] = { 0, 0, }; -static int jz4760_uart1_hwflow_funcs[] = { 0, 0, }; -static int jz4760_uart2_data_funcs[] = { 0, 0, }; -static int jz4760_uart2_hwflow_funcs[] = { 0, 0, }; -static int jz4760_uart3_data_funcs[] = { 0, 1, }; -static int jz4760_uart3_hwflow_funcs[] = { 0, 0, }; -static int jz4760_mmc0_1bit_a_funcs[] = { 1, 1, 0, }; -static int jz4760_mmc0_4bit_a_funcs[] = { 1, 1, 1, }; -static int jz4760_mmc0_1bit_e_funcs[] = { 0, 0, 0, }; -static int jz4760_mmc0_4bit_e_funcs[] = { 0, 0, 0, }; -static int jz4760_mmc0_8bit_e_funcs[] = { 0, 0, 0, 0, }; -static int jz4760_mmc1_1bit_d_funcs[] = { 0, 0, 0, }; -static int jz4760_mmc1_4bit_d_funcs[] = { 0, 0, 0, }; -static int jz4760_mmc1_1bit_e_funcs[] = { 1, 1, 1, }; -static int jz4760_mmc1_4bit_e_funcs[] = { 1, 1, 1, }; -static int jz4760_mmc1_8bit_e_funcs[] = { 1, 1, 1, 1, }; -static int jz4760_mmc2_1bit_b_funcs[] = { 0, 0, 0, }; -static int jz4760_mmc2_4bit_b_funcs[] = { 0, 0, 0, }; -static int jz4760_mmc2_1bit_e_funcs[] = { 2, 2, 2, }; -static int jz4760_mmc2_4bit_e_funcs[] = { 2, 2, 2, }; -static int jz4760_mmc2_8bit_e_funcs[] = { 2, 2, 2, 2, }; -static int jz4760_nemc_8bit_data_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4760_nemc_16bit_data_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4760_nemc_cle_ale_funcs[] = { 0, 0, }; -static int jz4760_nemc_addr_funcs[] = { 0, 0, 0, 0, }; -static int jz4760_nemc_rd_we_funcs[] = { 0, 0, }; -static int jz4760_nemc_frd_fwe_funcs[] = { 0, 0, }; -static int jz4760_nemc_wait_funcs[] = { 0, }; -static int jz4760_nemc_cs1_funcs[] = { 0, }; -static int jz4760_nemc_cs2_funcs[] = { 0, }; -static int jz4760_nemc_cs3_funcs[] = { 0, }; -static int jz4760_nemc_cs4_funcs[] = { 0, }; -static int jz4760_nemc_cs5_funcs[] = { 0, }; -static int jz4760_nemc_cs6_funcs[] = { 0, }; -static int jz4760_i2c0_funcs[] = { 0, 0, }; -static int jz4760_i2c1_funcs[] = { 0, 0, }; -static int jz4760_cim_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4760_lcd_24bit_funcs[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -}; -static int jz4760_pwm_pwm0_funcs[] = { 0, }; -static int jz4760_pwm_pwm1_funcs[] = { 0, }; -static int jz4760_pwm_pwm2_funcs[] = { 0, }; -static int jz4760_pwm_pwm3_funcs[] = { 0, }; -static int jz4760_pwm_pwm4_funcs[] = { 0, }; -static int jz4760_pwm_pwm5_funcs[] = { 0, }; -static int jz4760_pwm_pwm6_funcs[] = { 0, }; -static int jz4760_pwm_pwm7_funcs[] = { 0, }; +static u8 jz4760_uart3_data_funcs[] = { 0, 1, }; +static u8 jz4760_mmc0_1bit_a_funcs[] = { 1, 1, 0, }; static const struct group_desc jz4760_groups[] = { - INGENIC_PIN_GROUP("uart0-data", jz4760_uart0_data), - INGENIC_PIN_GROUP("uart0-hwflow", jz4760_uart0_hwflow), - INGENIC_PIN_GROUP("uart1-data", jz4760_uart1_data), - INGENIC_PIN_GROUP("uart1-hwflow", jz4760_uart1_hwflow), - INGENIC_PIN_GROUP("uart2-data", jz4760_uart2_data), - INGENIC_PIN_GROUP("uart2-hwflow", jz4760_uart2_hwflow), - INGENIC_PIN_GROUP("uart3-data", jz4760_uart3_data), - INGENIC_PIN_GROUP("uart3-hwflow", jz4760_uart3_hwflow), - INGENIC_PIN_GROUP("mmc0-1bit-a", jz4760_mmc0_1bit_a), - INGENIC_PIN_GROUP("mmc0-4bit-a", jz4760_mmc0_4bit_a), - INGENIC_PIN_GROUP("mmc0-1bit-e", jz4760_mmc0_1bit_e), - INGENIC_PIN_GROUP("mmc0-4bit-e", jz4760_mmc0_4bit_e), - INGENIC_PIN_GROUP("mmc0-8bit-e", jz4760_mmc0_8bit_e), - INGENIC_PIN_GROUP("mmc1-1bit-d", jz4760_mmc1_1bit_d), - INGENIC_PIN_GROUP("mmc1-4bit-d", jz4760_mmc1_4bit_d), - INGENIC_PIN_GROUP("mmc1-1bit-e", jz4760_mmc1_1bit_e), - INGENIC_PIN_GROUP("mmc1-4bit-e", jz4760_mmc1_4bit_e), - INGENIC_PIN_GROUP("mmc1-8bit-e", jz4760_mmc1_8bit_e), - INGENIC_PIN_GROUP("mmc2-1bit-b", jz4760_mmc2_1bit_b), - INGENIC_PIN_GROUP("mmc2-4bit-b", jz4760_mmc2_4bit_b), - INGENIC_PIN_GROUP("mmc2-1bit-e", jz4760_mmc2_1bit_e), - INGENIC_PIN_GROUP("mmc2-4bit-e", jz4760_mmc2_4bit_e), - INGENIC_PIN_GROUP("mmc2-8bit-e", jz4760_mmc2_8bit_e), - INGENIC_PIN_GROUP("nemc-8bit-data", jz4760_nemc_8bit_data), - INGENIC_PIN_GROUP("nemc-16bit-data", jz4760_nemc_16bit_data), - INGENIC_PIN_GROUP("nemc-cle-ale", jz4760_nemc_cle_ale), - INGENIC_PIN_GROUP("nemc-addr", jz4760_nemc_addr), - INGENIC_PIN_GROUP("nemc-rd-we", jz4760_nemc_rd_we), - INGENIC_PIN_GROUP("nemc-frd-fwe", jz4760_nemc_frd_fwe), - INGENIC_PIN_GROUP("nemc-wait", jz4760_nemc_wait), - INGENIC_PIN_GROUP("nemc-cs1", jz4760_nemc_cs1), - INGENIC_PIN_GROUP("nemc-cs2", jz4760_nemc_cs2), - INGENIC_PIN_GROUP("nemc-cs3", jz4760_nemc_cs3), - INGENIC_PIN_GROUP("nemc-cs4", jz4760_nemc_cs4), - INGENIC_PIN_GROUP("nemc-cs5", jz4760_nemc_cs5), - INGENIC_PIN_GROUP("nemc-cs6", jz4760_nemc_cs6), - INGENIC_PIN_GROUP("i2c0-data", jz4760_i2c0), - INGENIC_PIN_GROUP("i2c1-data", jz4760_i2c1), - INGENIC_PIN_GROUP("cim-data", jz4760_cim), - INGENIC_PIN_GROUP("lcd-24bit", jz4760_lcd_24bit), + INGENIC_PIN_GROUP("uart0-data", jz4760_uart0_data, 0), + INGENIC_PIN_GROUP("uart0-hwflow", jz4760_uart0_hwflow, 0), + INGENIC_PIN_GROUP("uart1-data", jz4760_uart1_data, 0), + INGENIC_PIN_GROUP("uart1-hwflow", jz4760_uart1_hwflow, 0), + INGENIC_PIN_GROUP("uart2-data", jz4760_uart2_data, 0), + INGENIC_PIN_GROUP("uart2-hwflow", jz4760_uart2_hwflow, 0), + INGENIC_PIN_GROUP_FUNCS("uart3-data", jz4760_uart3_data, + jz4760_uart3_data_funcs), + INGENIC_PIN_GROUP("uart3-hwflow", jz4760_uart3_hwflow, 0), + INGENIC_PIN_GROUP_FUNCS("mmc0-1bit-a", jz4760_mmc0_1bit_a, + jz4760_mmc0_1bit_a_funcs), + INGENIC_PIN_GROUP("mmc0-4bit-a", jz4760_mmc0_4bit_a, 1), + INGENIC_PIN_GROUP("mmc0-1bit-e", jz4760_mmc0_1bit_e, 0), + INGENIC_PIN_GROUP("mmc0-4bit-e", jz4760_mmc0_4bit_e, 0), + INGENIC_PIN_GROUP("mmc0-8bit-e", jz4760_mmc0_8bit_e, 0), + INGENIC_PIN_GROUP("mmc1-1bit-d", jz4760_mmc1_1bit_d, 0), + INGENIC_PIN_GROUP("mmc1-4bit-d", jz4760_mmc1_4bit_d, 0), + INGENIC_PIN_GROUP("mmc1-1bit-e", jz4760_mmc1_1bit_e, 1), + INGENIC_PIN_GROUP("mmc1-4bit-e", jz4760_mmc1_4bit_e, 1), + INGENIC_PIN_GROUP("mmc1-8bit-e", jz4760_mmc1_8bit_e, 1), + INGENIC_PIN_GROUP("mmc2-1bit-b", jz4760_mmc2_1bit_b, 0), + INGENIC_PIN_GROUP("mmc2-4bit-b", jz4760_mmc2_4bit_b, 0), + INGENIC_PIN_GROUP("mmc2-1bit-e", jz4760_mmc2_1bit_e, 2), + INGENIC_PIN_GROUP("mmc2-4bit-e", jz4760_mmc2_4bit_e, 2), + INGENIC_PIN_GROUP("mmc2-8bit-e", jz4760_mmc2_8bit_e, 2), + INGENIC_PIN_GROUP("nemc-8bit-data", jz4760_nemc_8bit_data, 0), + INGENIC_PIN_GROUP("nemc-16bit-data", jz4760_nemc_16bit_data, 0), + INGENIC_PIN_GROUP("nemc-cle-ale", jz4760_nemc_cle_ale, 0), + INGENIC_PIN_GROUP("nemc-addr", jz4760_nemc_addr, 0), + INGENIC_PIN_GROUP("nemc-rd-we", jz4760_nemc_rd_we, 0), + INGENIC_PIN_GROUP("nemc-frd-fwe", jz4760_nemc_frd_fwe, 0), + INGENIC_PIN_GROUP("nemc-wait", jz4760_nemc_wait, 0), + INGENIC_PIN_GROUP("nemc-cs1", jz4760_nemc_cs1, 0), + INGENIC_PIN_GROUP("nemc-cs2", jz4760_nemc_cs2, 0), + INGENIC_PIN_GROUP("nemc-cs3", jz4760_nemc_cs3, 0), + INGENIC_PIN_GROUP("nemc-cs4", jz4760_nemc_cs4, 0), + INGENIC_PIN_GROUP("nemc-cs5", jz4760_nemc_cs5, 0), + INGENIC_PIN_GROUP("nemc-cs6", jz4760_nemc_cs6, 0), + INGENIC_PIN_GROUP("i2c0-data", jz4760_i2c0, 0), + INGENIC_PIN_GROUP("i2c1-data", jz4760_i2c1, 0), + INGENIC_PIN_GROUP("cim-data", jz4760_cim, 0), + INGENIC_PIN_GROUP("lcd-24bit", jz4760_lcd_24bit, 0), { "lcd-no-pins", }, - INGENIC_PIN_GROUP("pwm0", jz4760_pwm_pwm0), - INGENIC_PIN_GROUP("pwm1", jz4760_pwm_pwm1), - INGENIC_PIN_GROUP("pwm2", jz4760_pwm_pwm2), - INGENIC_PIN_GROUP("pwm3", jz4760_pwm_pwm3), - INGENIC_PIN_GROUP("pwm4", jz4760_pwm_pwm4), - INGENIC_PIN_GROUP("pwm5", jz4760_pwm_pwm5), - INGENIC_PIN_GROUP("pwm6", jz4760_pwm_pwm6), - INGENIC_PIN_GROUP("pwm7", jz4760_pwm_pwm7), + INGENIC_PIN_GROUP("pwm0", jz4760_pwm_pwm0, 0), + INGENIC_PIN_GROUP("pwm1", jz4760_pwm_pwm1, 0), + INGENIC_PIN_GROUP("pwm2", jz4760_pwm_pwm2, 0), + INGENIC_PIN_GROUP("pwm3", jz4760_pwm_pwm3, 0), + INGENIC_PIN_GROUP("pwm4", jz4760_pwm_pwm4, 0), + INGENIC_PIN_GROUP("pwm5", jz4760_pwm_pwm5, 0), + INGENIC_PIN_GROUP("pwm6", jz4760_pwm_pwm6, 0), + INGENIC_PIN_GROUP("pwm7", jz4760_pwm_pwm7, 0), }; static const char *jz4760_uart0_groups[] = { "uart0-data", "uart0-hwflow", }; @@ -735,200 +646,103 @@ static int jz4770_mac_rmii_pins[] = { static int jz4770_mac_mii_pins[] = { 0xa7, 0xaf, }; static int jz4770_otg_pins[] = { 0x8a, }; -static int jz4770_uart0_data_funcs[] = { 0, 0, }; -static int jz4770_uart0_hwflow_funcs[] = { 0, 0, }; -static int jz4770_uart1_data_funcs[] = { 0, 0, }; -static int jz4770_uart1_hwflow_funcs[] = { 0, 0, }; -static int jz4770_uart2_data_funcs[] = { 0, 0, }; -static int jz4770_uart2_hwflow_funcs[] = { 0, 0, }; -static int jz4770_uart3_data_funcs[] = { 0, 1, }; -static int jz4770_uart3_hwflow_funcs[] = { 0, 0, }; -static int jz4770_ssi0_dt_a_funcs[] = { 2, }; -static int jz4770_ssi0_dt_b_funcs[] = { 1, }; -static int jz4770_ssi0_dt_d_funcs[] = { 1, }; -static int jz4770_ssi0_dt_e_funcs[] = { 0, }; -static int jz4770_ssi0_dr_a_funcs[] = { 1, }; -static int jz4770_ssi0_dr_b_funcs[] = { 1, }; -static int jz4770_ssi0_dr_d_funcs[] = { 1, }; -static int jz4770_ssi0_dr_e_funcs[] = { 0, }; -static int jz4770_ssi0_clk_a_funcs[] = { 2, }; -static int jz4770_ssi0_clk_b_funcs[] = { 1, }; -static int jz4770_ssi0_clk_d_funcs[] = { 1, }; -static int jz4770_ssi0_clk_e_funcs[] = { 0, }; -static int jz4770_ssi0_gpc_b_funcs[] = { 1, }; -static int jz4770_ssi0_gpc_d_funcs[] = { 1, }; -static int jz4770_ssi0_gpc_e_funcs[] = { 0, }; -static int jz4770_ssi0_ce0_a_funcs[] = { 2, }; -static int jz4770_ssi0_ce0_b_funcs[] = { 1, }; -static int jz4770_ssi0_ce0_d_funcs[] = { 1, }; -static int jz4770_ssi0_ce0_e_funcs[] = { 0, }; -static int jz4770_ssi0_ce1_b_funcs[] = { 1, }; -static int jz4770_ssi0_ce1_d_funcs[] = { 1, }; -static int jz4770_ssi0_ce1_e_funcs[] = { 0, }; -static int jz4770_ssi1_dt_b_funcs[] = { 2, }; -static int jz4770_ssi1_dt_d_funcs[] = { 2, }; -static int jz4770_ssi1_dt_e_funcs[] = { 1, }; -static int jz4770_ssi1_dr_b_funcs[] = { 2, }; -static int jz4770_ssi1_dr_d_funcs[] = { 2, }; -static int jz4770_ssi1_dr_e_funcs[] = { 1, }; -static int jz4770_ssi1_clk_b_funcs[] = { 2, }; -static int jz4770_ssi1_clk_d_funcs[] = { 2, }; -static int jz4770_ssi1_clk_e_funcs[] = { 1, }; -static int jz4770_ssi1_gpc_b_funcs[] = { 2, }; -static int jz4770_ssi1_gpc_d_funcs[] = { 2, }; -static int jz4770_ssi1_gpc_e_funcs[] = { 1, }; -static int jz4770_ssi1_ce0_b_funcs[] = { 2, }; -static int jz4770_ssi1_ce0_d_funcs[] = { 2, }; -static int jz4770_ssi1_ce0_e_funcs[] = { 1, }; -static int jz4770_ssi1_ce1_b_funcs[] = { 2, }; -static int jz4770_ssi1_ce1_d_funcs[] = { 2, }; -static int jz4770_ssi1_ce1_e_funcs[] = { 1, }; -static int jz4770_mmc0_1bit_a_funcs[] = { 1, 1, 0, }; -static int jz4770_mmc0_4bit_a_funcs[] = { 1, 1, 1, }; -static int jz4770_mmc0_1bit_e_funcs[] = { 0, 0, 0, }; -static int jz4770_mmc0_4bit_e_funcs[] = { 0, 0, 0, }; -static int jz4770_mmc0_8bit_e_funcs[] = { 0, 0, 0, 0, }; -static int jz4770_mmc1_1bit_d_funcs[] = { 0, 0, 0, }; -static int jz4770_mmc1_4bit_d_funcs[] = { 0, 0, 0, }; -static int jz4770_mmc1_1bit_e_funcs[] = { 1, 1, 1, }; -static int jz4770_mmc1_4bit_e_funcs[] = { 1, 1, 1, }; -static int jz4770_mmc1_8bit_e_funcs[] = { 1, 1, 1, 1, }; -static int jz4770_mmc2_1bit_b_funcs[] = { 0, 0, 0, }; -static int jz4770_mmc2_4bit_b_funcs[] = { 0, 0, 0, }; -static int jz4770_mmc2_1bit_e_funcs[] = { 2, 2, 2, }; -static int jz4770_mmc2_4bit_e_funcs[] = { 2, 2, 2, }; -static int jz4770_mmc2_8bit_e_funcs[] = { 2, 2, 2, 2, }; -static int jz4770_nemc_8bit_data_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4770_nemc_16bit_data_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4770_nemc_cle_ale_funcs[] = { 0, 0, }; -static int jz4770_nemc_addr_funcs[] = { 0, 0, 0, 0, }; -static int jz4770_nemc_rd_we_funcs[] = { 0, 0, }; -static int jz4770_nemc_frd_fwe_funcs[] = { 0, 0, }; -static int jz4770_nemc_wait_funcs[] = { 0, }; -static int jz4770_nemc_cs1_funcs[] = { 0, }; -static int jz4770_nemc_cs2_funcs[] = { 0, }; -static int jz4770_nemc_cs3_funcs[] = { 0, }; -static int jz4770_nemc_cs4_funcs[] = { 0, }; -static int jz4770_nemc_cs5_funcs[] = { 0, }; -static int jz4770_nemc_cs6_funcs[] = { 0, }; -static int jz4770_i2c0_funcs[] = { 0, 0, }; -static int jz4770_i2c1_funcs[] = { 0, 0, }; -static int jz4770_i2c2_funcs[] = { 2, 2, }; -static int jz4770_cim_8bit_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4770_cim_12bit_funcs[] = { 0, 0, 0, 0, }; -static int jz4770_lcd_24bit_funcs[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -}; -static int jz4770_pwm_pwm0_funcs[] = { 0, }; -static int jz4770_pwm_pwm1_funcs[] = { 0, }; -static int jz4770_pwm_pwm2_funcs[] = { 0, }; -static int jz4770_pwm_pwm3_funcs[] = { 0, }; -static int jz4770_pwm_pwm4_funcs[] = { 0, }; -static int jz4770_pwm_pwm5_funcs[] = { 0, }; -static int jz4770_pwm_pwm6_funcs[] = { 0, }; -static int jz4770_pwm_pwm7_funcs[] = { 0, }; -static int jz4770_mac_rmii_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static int jz4770_mac_mii_funcs[] = { 0, 0, }; -static int jz4770_otg_funcs[] = { 0, }; - static const struct group_desc jz4770_groups[] = { - INGENIC_PIN_GROUP("uart0-data", jz4770_uart0_data), - INGENIC_PIN_GROUP("uart0-hwflow", jz4770_uart0_hwflow), - INGENIC_PIN_GROUP("uart1-data", jz4770_uart1_data), - INGENIC_PIN_GROUP("uart1-hwflow", jz4770_uart1_hwflow), - INGENIC_PIN_GROUP("uart2-data", jz4770_uart2_data), - INGENIC_PIN_GROUP("uart2-hwflow", jz4770_uart2_hwflow), - INGENIC_PIN_GROUP("uart3-data", jz4770_uart3_data), - INGENIC_PIN_GROUP("uart3-hwflow", jz4770_uart3_hwflow), - INGENIC_PIN_GROUP("ssi0-dt-a", jz4770_ssi0_dt_a), - INGENIC_PIN_GROUP("ssi0-dt-b", jz4770_ssi0_dt_b), - INGENIC_PIN_GROUP("ssi0-dt-d", jz4770_ssi0_dt_d), - INGENIC_PIN_GROUP("ssi0-dt-e", jz4770_ssi0_dt_e), - INGENIC_PIN_GROUP("ssi0-dr-a", jz4770_ssi0_dr_a), - INGENIC_PIN_GROUP("ssi0-dr-b", jz4770_ssi0_dr_b), - INGENIC_PIN_GROUP("ssi0-dr-d", jz4770_ssi0_dr_d), - INGENIC_PIN_GROUP("ssi0-dr-e", jz4770_ssi0_dr_e), - INGENIC_PIN_GROUP("ssi0-clk-a", jz4770_ssi0_clk_a), - INGENIC_PIN_GROUP("ssi0-clk-b", jz4770_ssi0_clk_b), - INGENIC_PIN_GROUP("ssi0-clk-d", jz4770_ssi0_clk_d), - INGENIC_PIN_GROUP("ssi0-clk-e", jz4770_ssi0_clk_e), - INGENIC_PIN_GROUP("ssi0-gpc-b", jz4770_ssi0_gpc_b), - INGENIC_PIN_GROUP("ssi0-gpc-d", jz4770_ssi0_gpc_d), - INGENIC_PIN_GROUP("ssi0-gpc-e", jz4770_ssi0_gpc_e), - INGENIC_PIN_GROUP("ssi0-ce0-a", jz4770_ssi0_ce0_a), - INGENIC_PIN_GROUP("ssi0-ce0-b", jz4770_ssi0_ce0_b), - INGENIC_PIN_GROUP("ssi0-ce0-d", jz4770_ssi0_ce0_d), - INGENIC_PIN_GROUP("ssi0-ce0-e", jz4770_ssi0_ce0_e), - INGENIC_PIN_GROUP("ssi0-ce1-b", jz4770_ssi0_ce1_b), - INGENIC_PIN_GROUP("ssi0-ce1-d", jz4770_ssi0_ce1_d), - INGENIC_PIN_GROUP("ssi0-ce1-e", jz4770_ssi0_ce1_e), - INGENIC_PIN_GROUP("ssi1-dt-b", jz4770_ssi1_dt_b), - INGENIC_PIN_GROUP("ssi1-dt-d", jz4770_ssi1_dt_d), - INGENIC_PIN_GROUP("ssi1-dt-e", jz4770_ssi1_dt_e), - INGENIC_PIN_GROUP("ssi1-dr-b", jz4770_ssi1_dr_b), - INGENIC_PIN_GROUP("ssi1-dr-d", jz4770_ssi1_dr_d), - INGENIC_PIN_GROUP("ssi1-dr-e", jz4770_ssi1_dr_e), - INGENIC_PIN_GROUP("ssi1-clk-b", jz4770_ssi1_clk_b), - INGENIC_PIN_GROUP("ssi1-clk-d", jz4770_ssi1_clk_d), - INGENIC_PIN_GROUP("ssi1-clk-e", jz4770_ssi1_clk_e), - INGENIC_PIN_GROUP("ssi1-gpc-b", jz4770_ssi1_gpc_b), - INGENIC_PIN_GROUP("ssi1-gpc-d", jz4770_ssi1_gpc_d), - INGENIC_PIN_GROUP("ssi1-gpc-e", jz4770_ssi1_gpc_e), - INGENIC_PIN_GROUP("ssi1-ce0-b", jz4770_ssi1_ce0_b), - INGENIC_PIN_GROUP("ssi1-ce0-d", jz4770_ssi1_ce0_d), - INGENIC_PIN_GROUP("ssi1-ce0-e", jz4770_ssi1_ce0_e), - INGENIC_PIN_GROUP("ssi1-ce1-b", jz4770_ssi1_ce1_b), - INGENIC_PIN_GROUP("ssi1-ce1-d", jz4770_ssi1_ce1_d), - INGENIC_PIN_GROUP("ssi1-ce1-e", jz4770_ssi1_ce1_e), - INGENIC_PIN_GROUP("mmc0-1bit-a", jz4770_mmc0_1bit_a), - INGENIC_PIN_GROUP("mmc0-4bit-a", jz4770_mmc0_4bit_a), - INGENIC_PIN_GROUP("mmc0-1bit-e", jz4770_mmc0_1bit_e), - INGENIC_PIN_GROUP("mmc0-4bit-e", jz4770_mmc0_4bit_e), - INGENIC_PIN_GROUP("mmc0-8bit-e", jz4770_mmc0_8bit_e), - INGENIC_PIN_GROUP("mmc1-1bit-d", jz4770_mmc1_1bit_d), - INGENIC_PIN_GROUP("mmc1-4bit-d", jz4770_mmc1_4bit_d), - INGENIC_PIN_GROUP("mmc1-1bit-e", jz4770_mmc1_1bit_e), - INGENIC_PIN_GROUP("mmc1-4bit-e", jz4770_mmc1_4bit_e), - INGENIC_PIN_GROUP("mmc1-8bit-e", jz4770_mmc1_8bit_e), - INGENIC_PIN_GROUP("mmc2-1bit-b", jz4770_mmc2_1bit_b), - INGENIC_PIN_GROUP("mmc2-4bit-b", jz4770_mmc2_4bit_b), - INGENIC_PIN_GROUP("mmc2-1bit-e", jz4770_mmc2_1bit_e), - INGENIC_PIN_GROUP("mmc2-4bit-e", jz4770_mmc2_4bit_e), - INGENIC_PIN_GROUP("mmc2-8bit-e", jz4770_mmc2_8bit_e), - INGENIC_PIN_GROUP("nemc-8bit-data", jz4770_nemc_8bit_data), - INGENIC_PIN_GROUP("nemc-16bit-data", jz4770_nemc_16bit_data), - INGENIC_PIN_GROUP("nemc-cle-ale", jz4770_nemc_cle_ale), - INGENIC_PIN_GROUP("nemc-addr", jz4770_nemc_addr), - INGENIC_PIN_GROUP("nemc-rd-we", jz4770_nemc_rd_we), - INGENIC_PIN_GROUP("nemc-frd-fwe", jz4770_nemc_frd_fwe), - INGENIC_PIN_GROUP("nemc-wait", jz4770_nemc_wait), - INGENIC_PIN_GROUP("nemc-cs1", jz4770_nemc_cs1), - INGENIC_PIN_GROUP("nemc-cs2", jz4770_nemc_cs2), - INGENIC_PIN_GROUP("nemc-cs3", jz4770_nemc_cs3), - INGENIC_PIN_GROUP("nemc-cs4", jz4770_nemc_cs4), - INGENIC_PIN_GROUP("nemc-cs5", jz4770_nemc_cs5), - INGENIC_PIN_GROUP("nemc-cs6", jz4770_nemc_cs6), - INGENIC_PIN_GROUP("i2c0-data", jz4770_i2c0), - INGENIC_PIN_GROUP("i2c1-data", jz4770_i2c1), - INGENIC_PIN_GROUP("i2c2-data", jz4770_i2c2), - INGENIC_PIN_GROUP("cim-data-8bit", jz4770_cim_8bit), - INGENIC_PIN_GROUP("cim-data-12bit", jz4770_cim_12bit), - INGENIC_PIN_GROUP("lcd-24bit", jz4770_lcd_24bit), + INGENIC_PIN_GROUP("uart0-data", jz4770_uart0_data, 0), + INGENIC_PIN_GROUP("uart0-hwflow", jz4770_uart0_hwflow, 0), + INGENIC_PIN_GROUP("uart1-data", jz4770_uart1_data, 0), + INGENIC_PIN_GROUP("uart1-hwflow", jz4770_uart1_hwflow, 0), + INGENIC_PIN_GROUP("uart2-data", jz4770_uart2_data, 0), + INGENIC_PIN_GROUP("uart2-hwflow", jz4770_uart2_hwflow, 0), + INGENIC_PIN_GROUP_FUNCS("uart3-data", jz4770_uart3_data, + jz4760_uart3_data_funcs), + INGENIC_PIN_GROUP("uart3-hwflow", jz4770_uart3_hwflow, 0), + INGENIC_PIN_GROUP("ssi0-dt-a", jz4770_ssi0_dt_a, 2), + INGENIC_PIN_GROUP("ssi0-dt-b", jz4770_ssi0_dt_b, 1), + INGENIC_PIN_GROUP("ssi0-dt-d", jz4770_ssi0_dt_d, 1), + INGENIC_PIN_GROUP("ssi0-dt-e", jz4770_ssi0_dt_e, 0), + INGENIC_PIN_GROUP("ssi0-dr-a", jz4770_ssi0_dr_a, 1), + INGENIC_PIN_GROUP("ssi0-dr-b", jz4770_ssi0_dr_b, 1), + INGENIC_PIN_GROUP("ssi0-dr-d", jz4770_ssi0_dr_d, 1), + INGENIC_PIN_GROUP("ssi0-dr-e", jz4770_ssi0_dr_e, 0), + INGENIC_PIN_GROUP("ssi0-clk-a", jz4770_ssi0_clk_a, 2), + INGENIC_PIN_GROUP("ssi0-clk-b", jz4770_ssi0_clk_b, 1), + INGENIC_PIN_GROUP("ssi0-clk-d", jz4770_ssi0_clk_d, 1), + INGENIC_PIN_GROUP("ssi0-clk-e", jz4770_ssi0_clk_e, 0), + INGENIC_PIN_GROUP("ssi0-gpc-b", jz4770_ssi0_gpc_b, 1), + INGENIC_PIN_GROUP("ssi0-gpc-d", jz4770_ssi0_gpc_d, 1), + INGENIC_PIN_GROUP("ssi0-gpc-e", jz4770_ssi0_gpc_e, 0), + INGENIC_PIN_GROUP("ssi0-ce0-a", jz4770_ssi0_ce0_a, 2), + INGENIC_PIN_GROUP("ssi0-ce0-b", jz4770_ssi0_ce0_b, 1), + INGENIC_PIN_GROUP("ssi0-ce0-d", jz4770_ssi0_ce0_d, 1), + INGENIC_PIN_GROUP("ssi0-ce0-e", jz4770_ssi0_ce0_e, 0), + INGENIC_PIN_GROUP("ssi0-ce1-b", jz4770_ssi0_ce1_b, 1), + INGENIC_PIN_GROUP("ssi0-ce1-d", jz4770_ssi0_ce1_d, 1), + INGENIC_PIN_GROUP("ssi0-ce1-e", jz4770_ssi0_ce1_e, 0), + INGENIC_PIN_GROUP("ssi1-dt-b", jz4770_ssi1_dt_b, 2), + INGENIC_PIN_GROUP("ssi1-dt-d", jz4770_ssi1_dt_d, 2), + INGENIC_PIN_GROUP("ssi1-dt-e", jz4770_ssi1_dt_e, 1), + INGENIC_PIN_GROUP("ssi1-dr-b", jz4770_ssi1_dr_b, 2), + INGENIC_PIN_GROUP("ssi1-dr-d", jz4770_ssi1_dr_d, 2), + INGENIC_PIN_GROUP("ssi1-dr-e", jz4770_ssi1_dr_e, 1), + INGENIC_PIN_GROUP("ssi1-clk-b", jz4770_ssi1_clk_b, 2), + INGENIC_PIN_GROUP("ssi1-clk-d", jz4770_ssi1_clk_d, 2), + INGENIC_PIN_GROUP("ssi1-clk-e", jz4770_ssi1_clk_e, 1), + INGENIC_PIN_GROUP("ssi1-gpc-b", jz4770_ssi1_gpc_b, 2), + INGENIC_PIN_GROUP("ssi1-gpc-d", jz4770_ssi1_gpc_d, 2), + INGENIC_PIN_GROUP("ssi1-gpc-e", jz4770_ssi1_gpc_e, 1), + INGENIC_PIN_GROUP("ssi1-ce0-b", jz4770_ssi1_ce0_b, 2), + INGENIC_PIN_GROUP("ssi1-ce0-d", jz4770_ssi1_ce0_d, 2), + INGENIC_PIN_GROUP("ssi1-ce0-e", jz4770_ssi1_ce0_e, 1), + INGENIC_PIN_GROUP("ssi1-ce1-b", jz4770_ssi1_ce1_b, 2), + INGENIC_PIN_GROUP("ssi1-ce1-d", jz4770_ssi1_ce1_d, 2), + INGENIC_PIN_GROUP("ssi1-ce1-e", jz4770_ssi1_ce1_e, 1), + INGENIC_PIN_GROUP_FUNCS("mmc0-1bit-a", jz4770_mmc0_1bit_a, + jz4760_mmc0_1bit_a_funcs), + INGENIC_PIN_GROUP("mmc0-4bit-a", jz4770_mmc0_4bit_a, 1), + INGENIC_PIN_GROUP("mmc0-1bit-e", jz4770_mmc0_1bit_e, 0), + INGENIC_PIN_GROUP("mmc0-4bit-e", jz4770_mmc0_4bit_e, 0), + INGENIC_PIN_GROUP("mmc0-8bit-e", jz4770_mmc0_8bit_e, 0), + INGENIC_PIN_GROUP("mmc1-1bit-d", jz4770_mmc1_1bit_d, 0), + INGENIC_PIN_GROUP("mmc1-4bit-d", jz4770_mmc1_4bit_d, 0), + INGENIC_PIN_GROUP("mmc1-1bit-e", jz4770_mmc1_1bit_e, 1), + INGENIC_PIN_GROUP("mmc1-4bit-e", jz4770_mmc1_4bit_e, 1), + INGENIC_PIN_GROUP("mmc1-8bit-e", jz4770_mmc1_8bit_e, 1), + INGENIC_PIN_GROUP("mmc2-1bit-b", jz4770_mmc2_1bit_b, 0), + INGENIC_PIN_GROUP("mmc2-4bit-b", jz4770_mmc2_4bit_b, 0), + INGENIC_PIN_GROUP("mmc2-1bit-e", jz4770_mmc2_1bit_e, 2), + INGENIC_PIN_GROUP("mmc2-4bit-e", jz4770_mmc2_4bit_e, 2), + INGENIC_PIN_GROUP("mmc2-8bit-e", jz4770_mmc2_8bit_e, 2), + INGENIC_PIN_GROUP("nemc-8bit-data", jz4770_nemc_8bit_data, 0), + INGENIC_PIN_GROUP("nemc-16bit-data", jz4770_nemc_16bit_data, 0), + INGENIC_PIN_GROUP("nemc-cle-ale", jz4770_nemc_cle_ale, 0), + INGENIC_PIN_GROUP("nemc-addr", jz4770_nemc_addr, 0), + INGENIC_PIN_GROUP("nemc-rd-we", jz4770_nemc_rd_we, 0), + INGENIC_PIN_GROUP("nemc-frd-fwe", jz4770_nemc_frd_fwe, 0), + INGENIC_PIN_GROUP("nemc-wait", jz4770_nemc_wait, 0), + INGENIC_PIN_GROUP("nemc-cs1", jz4770_nemc_cs1, 0), + INGENIC_PIN_GROUP("nemc-cs2", jz4770_nemc_cs2, 0), + INGENIC_PIN_GROUP("nemc-cs3", jz4770_nemc_cs3, 0), + INGENIC_PIN_GROUP("nemc-cs4", jz4770_nemc_cs4, 0), + INGENIC_PIN_GROUP("nemc-cs5", jz4770_nemc_cs5, 0), + INGENIC_PIN_GROUP("nemc-cs6", jz4770_nemc_cs6, 0), + INGENIC_PIN_GROUP("i2c0-data", jz4770_i2c0, 0), + INGENIC_PIN_GROUP("i2c1-data", jz4770_i2c1, 0), + INGENIC_PIN_GROUP("i2c2-data", jz4770_i2c2, 2), + INGENIC_PIN_GROUP("cim-data-8bit", jz4770_cim_8bit, 0), + INGENIC_PIN_GROUP("cim-data-12bit", jz4770_cim_12bit, 0), + INGENIC_PIN_GROUP("lcd-24bit", jz4770_lcd_24bit, 0), { "lcd-no-pins", }, - INGENIC_PIN_GROUP("pwm0", jz4770_pwm_pwm0), - INGENIC_PIN_GROUP("pwm1", jz4770_pwm_pwm1), - INGENIC_PIN_GROUP("pwm2", jz4770_pwm_pwm2), - INGENIC_PIN_GROUP("pwm3", jz4770_pwm_pwm3), - INGENIC_PIN_GROUP("pwm4", jz4770_pwm_pwm4), - INGENIC_PIN_GROUP("pwm5", jz4770_pwm_pwm5), - INGENIC_PIN_GROUP("pwm6", jz4770_pwm_pwm6), - INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7), - INGENIC_PIN_GROUP("mac-rmii", jz4770_mac_rmii), - INGENIC_PIN_GROUP("mac-mii", jz4770_mac_mii), - INGENIC_PIN_GROUP("otg-vbus", jz4770_otg), + INGENIC_PIN_GROUP("pwm0", jz4770_pwm_pwm0, 0), + INGENIC_PIN_GROUP("pwm1", jz4770_pwm_pwm1, 0), + INGENIC_PIN_GROUP("pwm2", jz4770_pwm_pwm2, 0), + INGENIC_PIN_GROUP("pwm3", jz4770_pwm_pwm3, 0), + INGENIC_PIN_GROUP("pwm4", jz4770_pwm_pwm4, 0), + INGENIC_PIN_GROUP("pwm5", jz4770_pwm_pwm5, 0), + INGENIC_PIN_GROUP("pwm6", jz4770_pwm_pwm6, 0), + INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7, 0), + INGENIC_PIN_GROUP("mac-rmii", jz4770_mac_rmii, 0), + INGENIC_PIN_GROUP("mac-mii", jz4770_mac_mii, 0), + INGENIC_PIN_GROUP("otg-vbus", jz4770_otg, 0), }; static const char *jz4770_uart0_groups[] = { "uart0-data", "uart0-hwflow", }; @@ -1090,156 +904,115 @@ static int jz4780_i2s_clk_rx_pins[] = { 0x88, 0x89, }; static int jz4780_i2s_sysclk_pins[] = { 0x85, }; static int jz4780_hdmi_ddc_pins[] = { 0xb9, 0xb8, }; -static int jz4780_uart2_data_funcs[] = { 1, 1, }; -static int jz4780_uart2_hwflow_funcs[] = { 1, 1, }; -static int jz4780_uart4_data_funcs[] = { 2, 2, }; -static int jz4780_ssi0_dt_a_19_funcs[] = { 2, }; -static int jz4780_ssi0_dt_a_21_funcs[] = { 2, }; -static int jz4780_ssi0_dt_a_28_funcs[] = { 2, }; -static int jz4780_ssi0_dt_b_funcs[] = { 1, }; -static int jz4780_ssi0_dt_d_funcs[] = { 1, }; -static int jz4780_ssi0_dr_a_20_funcs[] = { 2, }; -static int jz4780_ssi0_dr_a_27_funcs[] = { 2, }; -static int jz4780_ssi0_dr_b_funcs[] = { 1, }; -static int jz4780_ssi0_dr_d_funcs[] = { 1, }; -static int jz4780_ssi0_clk_a_funcs[] = { 2, }; -static int jz4780_ssi0_clk_b_5_funcs[] = { 1, }; -static int jz4780_ssi0_clk_b_28_funcs[] = { 1, }; -static int jz4780_ssi0_clk_d_funcs[] = { 1, }; -static int jz4780_ssi0_gpc_b_funcs[] = { 1, }; -static int jz4780_ssi0_gpc_d_funcs[] = { 1, }; -static int jz4780_ssi0_ce0_a_23_funcs[] = { 2, }; -static int jz4780_ssi0_ce0_a_25_funcs[] = { 2, }; -static int jz4780_ssi0_ce0_b_funcs[] = { 1, }; -static int jz4780_ssi0_ce0_d_funcs[] = { 1, }; -static int jz4780_ssi0_ce1_b_funcs[] = { 1, }; -static int jz4780_ssi0_ce1_d_funcs[] = { 1, }; -static int jz4780_ssi1_dt_b_funcs[] = { 2, }; -static int jz4780_ssi1_dt_d_funcs[] = { 2, }; -static int jz4780_ssi1_dr_b_funcs[] = { 2, }; -static int jz4780_ssi1_dr_d_funcs[] = { 2, }; -static int jz4780_ssi1_clk_b_funcs[] = { 2, }; -static int jz4780_ssi1_clk_d_funcs[] = { 2, }; -static int jz4780_ssi1_gpc_b_funcs[] = { 2, }; -static int jz4780_ssi1_gpc_d_funcs[] = { 2, }; -static int jz4780_ssi1_ce0_b_funcs[] = { 2, }; -static int jz4780_ssi1_ce0_d_funcs[] = { 2, }; -static int jz4780_ssi1_ce1_b_funcs[] = { 2, }; -static int jz4780_ssi1_ce1_d_funcs[] = { 2, }; -static int jz4780_mmc0_8bit_a_funcs[] = { 1, 1, 1, 1, 1, }; -static int jz4780_i2c3_funcs[] = { 1, 1, }; -static int jz4780_i2c4_e_funcs[] = { 1, 1, }; -static int jz4780_i2c4_f_funcs[] = { 1, 1, }; -static int jz4780_i2s_data_tx_funcs[] = { 0, }; -static int jz4780_i2s_data_rx_funcs[] = { 0, }; -static int jz4780_i2s_clk_txrx_funcs[] = { 1, 0, }; -static int jz4780_i2s_clk_rx_funcs[] = { 1, 1, }; -static int jz4780_i2s_sysclk_funcs[] = { 2, }; -static int jz4780_hdmi_ddc_funcs[] = { 0, 0, }; +static u8 jz4780_i2s_clk_txrx_funcs[] = { 1, 0, }; static const struct group_desc jz4780_groups[] = { - INGENIC_PIN_GROUP("uart0-data", jz4770_uart0_data), - INGENIC_PIN_GROUP("uart0-hwflow", jz4770_uart0_hwflow), - INGENIC_PIN_GROUP("uart1-data", jz4770_uart1_data), - INGENIC_PIN_GROUP("uart1-hwflow", jz4770_uart1_hwflow), - INGENIC_PIN_GROUP("uart2-data", jz4780_uart2_data), - INGENIC_PIN_GROUP("uart2-hwflow", jz4780_uart2_hwflow), - INGENIC_PIN_GROUP("uart3-data", jz4770_uart3_data), - INGENIC_PIN_GROUP("uart3-hwflow", jz4770_uart3_hwflow), - INGENIC_PIN_GROUP("uart4-data", jz4780_uart4_data), - INGENIC_PIN_GROUP("ssi0-dt-a-19", jz4780_ssi0_dt_a_19), - INGENIC_PIN_GROUP("ssi0-dt-a-21", jz4780_ssi0_dt_a_21), - INGENIC_PIN_GROUP("ssi0-dt-a-28", jz4780_ssi0_dt_a_28), - INGENIC_PIN_GROUP("ssi0-dt-b", jz4780_ssi0_dt_b), - INGENIC_PIN_GROUP("ssi0-dt-d", jz4780_ssi0_dt_d), - INGENIC_PIN_GROUP("ssi0-dt-e", jz4770_ssi0_dt_e), - INGENIC_PIN_GROUP("ssi0-dr-a-20", jz4780_ssi0_dr_a_20), - INGENIC_PIN_GROUP("ssi0-dr-a-27", jz4780_ssi0_dr_a_27), - INGENIC_PIN_GROUP("ssi0-dr-b", jz4780_ssi0_dr_b), - INGENIC_PIN_GROUP("ssi0-dr-d", jz4780_ssi0_dr_d), - INGENIC_PIN_GROUP("ssi0-dr-e", jz4770_ssi0_dr_e), - INGENIC_PIN_GROUP("ssi0-clk-a", jz4780_ssi0_clk_a), - INGENIC_PIN_GROUP("ssi0-clk-b-5", jz4780_ssi0_clk_b_5), - INGENIC_PIN_GROUP("ssi0-clk-b-28", jz4780_ssi0_clk_b_28), - INGENIC_PIN_GROUP("ssi0-clk-d", jz4780_ssi0_clk_d), - INGENIC_PIN_GROUP("ssi0-clk-e", jz4770_ssi0_clk_e), - INGENIC_PIN_GROUP("ssi0-gpc-b", jz4780_ssi0_gpc_b), - INGENIC_PIN_GROUP("ssi0-gpc-d", jz4780_ssi0_gpc_d), - INGENIC_PIN_GROUP("ssi0-gpc-e", jz4770_ssi0_gpc_e), - INGENIC_PIN_GROUP("ssi0-ce0-a-23", jz4780_ssi0_ce0_a_23), - INGENIC_PIN_GROUP("ssi0-ce0-a-25", jz4780_ssi0_ce0_a_25), - INGENIC_PIN_GROUP("ssi0-ce0-b", jz4780_ssi0_ce0_b), - INGENIC_PIN_GROUP("ssi0-ce0-d", jz4780_ssi0_ce0_d), - INGENIC_PIN_GROUP("ssi0-ce0-e", jz4770_ssi0_ce0_e), - INGENIC_PIN_GROUP("ssi0-ce1-b", jz4780_ssi0_ce1_b), - INGENIC_PIN_GROUP("ssi0-ce1-d", jz4780_ssi0_ce1_d), - INGENIC_PIN_GROUP("ssi0-ce1-e", jz4770_ssi0_ce1_e), - INGENIC_PIN_GROUP("ssi1-dt-b", jz4780_ssi1_dt_b), - INGENIC_PIN_GROUP("ssi1-dt-d", jz4780_ssi1_dt_d), - INGENIC_PIN_GROUP("ssi1-dt-e", jz4770_ssi1_dt_e), - INGENIC_PIN_GROUP("ssi1-dr-b", jz4780_ssi1_dr_b), - INGENIC_PIN_GROUP("ssi1-dr-d", jz4780_ssi1_dr_d), - INGENIC_PIN_GROUP("ssi1-dr-e", jz4770_ssi1_dr_e), - INGENIC_PIN_GROUP("ssi1-clk-b", jz4780_ssi1_clk_b), - INGENIC_PIN_GROUP("ssi1-clk-d", jz4780_ssi1_clk_d), - INGENIC_PIN_GROUP("ssi1-clk-e", jz4770_ssi1_clk_e), - INGENIC_PIN_GROUP("ssi1-gpc-b", jz4780_ssi1_gpc_b), - INGENIC_PIN_GROUP("ssi1-gpc-d", jz4780_ssi1_gpc_d), - INGENIC_PIN_GROUP("ssi1-gpc-e", jz4770_ssi1_gpc_e), - INGENIC_PIN_GROUP("ssi1-ce0-b", jz4780_ssi1_ce0_b), - INGENIC_PIN_GROUP("ssi1-ce0-d", jz4780_ssi1_ce0_d), - INGENIC_PIN_GROUP("ssi1-ce0-e", jz4770_ssi1_ce0_e), - INGENIC_PIN_GROUP("ssi1-ce1-b", jz4780_ssi1_ce1_b), - INGENIC_PIN_GROUP("ssi1-ce1-d", jz4780_ssi1_ce1_d), - INGENIC_PIN_GROUP("ssi1-ce1-e", jz4770_ssi1_ce1_e), - INGENIC_PIN_GROUP("mmc0-1bit-a", jz4770_mmc0_1bit_a), - INGENIC_PIN_GROUP("mmc0-4bit-a", jz4770_mmc0_4bit_a), - INGENIC_PIN_GROUP("mmc0-8bit-a", jz4780_mmc0_8bit_a), - INGENIC_PIN_GROUP("mmc0-1bit-e", jz4770_mmc0_1bit_e), - INGENIC_PIN_GROUP("mmc0-4bit-e", jz4770_mmc0_4bit_e), - INGENIC_PIN_GROUP("mmc1-1bit-d", jz4770_mmc1_1bit_d), - INGENIC_PIN_GROUP("mmc1-4bit-d", jz4770_mmc1_4bit_d), - INGENIC_PIN_GROUP("mmc1-1bit-e", jz4770_mmc1_1bit_e), - INGENIC_PIN_GROUP("mmc1-4bit-e", jz4770_mmc1_4bit_e), - INGENIC_PIN_GROUP("mmc2-1bit-b", jz4770_mmc2_1bit_b), - INGENIC_PIN_GROUP("mmc2-4bit-b", jz4770_mmc2_4bit_b), - INGENIC_PIN_GROUP("mmc2-1bit-e", jz4770_mmc2_1bit_e), - INGENIC_PIN_GROUP("mmc2-4bit-e", jz4770_mmc2_4bit_e), - INGENIC_PIN_GROUP("nemc-data", jz4770_nemc_8bit_data), - INGENIC_PIN_GROUP("nemc-cle-ale", jz4770_nemc_cle_ale), - INGENIC_PIN_GROUP("nemc-addr", jz4770_nemc_addr), - INGENIC_PIN_GROUP("nemc-rd-we", jz4770_nemc_rd_we), - INGENIC_PIN_GROUP("nemc-frd-fwe", jz4770_nemc_frd_fwe), - INGENIC_PIN_GROUP("nemc-wait", jz4770_nemc_wait), - INGENIC_PIN_GROUP("nemc-cs1", jz4770_nemc_cs1), - INGENIC_PIN_GROUP("nemc-cs2", jz4770_nemc_cs2), - INGENIC_PIN_GROUP("nemc-cs3", jz4770_nemc_cs3), - INGENIC_PIN_GROUP("nemc-cs4", jz4770_nemc_cs4), - INGENIC_PIN_GROUP("nemc-cs5", jz4770_nemc_cs5), - INGENIC_PIN_GROUP("nemc-cs6", jz4770_nemc_cs6), - INGENIC_PIN_GROUP("i2c0-data", jz4770_i2c0), - INGENIC_PIN_GROUP("i2c1-data", jz4770_i2c1), - INGENIC_PIN_GROUP("i2c2-data", jz4770_i2c2), - INGENIC_PIN_GROUP("i2c3-data", jz4780_i2c3), - INGENIC_PIN_GROUP("i2c4-data-e", jz4780_i2c4_e), - INGENIC_PIN_GROUP("i2c4-data-f", jz4780_i2c4_f), - INGENIC_PIN_GROUP("i2s-data-tx", jz4780_i2s_data_tx), - INGENIC_PIN_GROUP("i2s-data-rx", jz4780_i2s_data_rx), - INGENIC_PIN_GROUP("i2s-clk-txrx", jz4780_i2s_clk_txrx), - INGENIC_PIN_GROUP("i2s-clk-rx", jz4780_i2s_clk_rx), - INGENIC_PIN_GROUP("i2s-sysclk", jz4780_i2s_sysclk), - INGENIC_PIN_GROUP("hdmi-ddc", jz4780_hdmi_ddc), - INGENIC_PIN_GROUP("cim-data", jz4770_cim_8bit), - INGENIC_PIN_GROUP("lcd-24bit", jz4770_lcd_24bit), + INGENIC_PIN_GROUP("uart0-data", jz4770_uart0_data, 0), + INGENIC_PIN_GROUP("uart0-hwflow", jz4770_uart0_hwflow, 0), + INGENIC_PIN_GROUP("uart1-data", jz4770_uart1_data, 0), + INGENIC_PIN_GROUP("uart1-hwflow", jz4770_uart1_hwflow, 0), + INGENIC_PIN_GROUP("uart2-data", jz4780_uart2_data, 1), + INGENIC_PIN_GROUP("uart2-hwflow", jz4780_uart2_hwflow, 1), + INGENIC_PIN_GROUP_FUNCS("uart3-data", jz4770_uart3_data, + jz4760_uart3_data_funcs), + INGENIC_PIN_GROUP("uart3-hwflow", jz4770_uart3_hwflow, 0), + INGENIC_PIN_GROUP("uart4-data", jz4780_uart4_data, 2), + INGENIC_PIN_GROUP("ssi0-dt-a-19", jz4780_ssi0_dt_a_19, 2), + INGENIC_PIN_GROUP("ssi0-dt-a-21", jz4780_ssi0_dt_a_21, 2), + INGENIC_PIN_GROUP("ssi0-dt-a-28", jz4780_ssi0_dt_a_28, 2), + INGENIC_PIN_GROUP("ssi0-dt-b", jz4780_ssi0_dt_b, 1), + INGENIC_PIN_GROUP("ssi0-dt-d", jz4780_ssi0_dt_d, 1), + INGENIC_PIN_GROUP("ssi0-dt-e", jz4770_ssi0_dt_e, 0), + INGENIC_PIN_GROUP("ssi0-dr-a-20", jz4780_ssi0_dr_a_20, 2), + INGENIC_PIN_GROUP("ssi0-dr-a-27", jz4780_ssi0_dr_a_27, 2), + INGENIC_PIN_GROUP("ssi0-dr-b", jz4780_ssi0_dr_b, 1), + INGENIC_PIN_GROUP("ssi0-dr-d", jz4780_ssi0_dr_d, 1), + INGENIC_PIN_GROUP("ssi0-dr-e", jz4770_ssi0_dr_e, 0), + INGENIC_PIN_GROUP("ssi0-clk-a", jz4780_ssi0_clk_a, 2), + INGENIC_PIN_GROUP("ssi0-clk-b-5", jz4780_ssi0_clk_b_5, 1), + INGENIC_PIN_GROUP("ssi0-clk-b-28", jz4780_ssi0_clk_b_28, 1), + INGENIC_PIN_GROUP("ssi0-clk-d", jz4780_ssi0_clk_d, 1), + INGENIC_PIN_GROUP("ssi0-clk-e", jz4770_ssi0_clk_e, 0), + INGENIC_PIN_GROUP("ssi0-gpc-b", jz4780_ssi0_gpc_b, 1), + INGENIC_PIN_GROUP("ssi0-gpc-d", jz4780_ssi0_gpc_d, 1), + INGENIC_PIN_GROUP("ssi0-gpc-e", jz4770_ssi0_gpc_e, 0), + INGENIC_PIN_GROUP("ssi0-ce0-a-23", jz4780_ssi0_ce0_a_23, 2), + INGENIC_PIN_GROUP("ssi0-ce0-a-25", jz4780_ssi0_ce0_a_25, 2), + INGENIC_PIN_GROUP("ssi0-ce0-b", jz4780_ssi0_ce0_b, 1), + INGENIC_PIN_GROUP("ssi0-ce0-d", jz4780_ssi0_ce0_d, 1), + INGENIC_PIN_GROUP("ssi0-ce0-e", jz4770_ssi0_ce0_e, 0), + INGENIC_PIN_GROUP("ssi0-ce1-b", jz4780_ssi0_ce1_b, 1), + INGENIC_PIN_GROUP("ssi0-ce1-d", jz4780_ssi0_ce1_d, 1), + INGENIC_PIN_GROUP("ssi0-ce1-e", jz4770_ssi0_ce1_e, 0), + INGENIC_PIN_GROUP("ssi1-dt-b", jz4780_ssi1_dt_b, 2), + INGENIC_PIN_GROUP("ssi1-dt-d", jz4780_ssi1_dt_d, 2), + INGENIC_PIN_GROUP("ssi1-dt-e", jz4770_ssi1_dt_e, 1), + INGENIC_PIN_GROUP("ssi1-dr-b", jz4780_ssi1_dr_b, 2), + INGENIC_PIN_GROUP("ssi1-dr-d", jz4780_ssi1_dr_d, 2), + INGENIC_PIN_GROUP("ssi1-dr-e", jz4770_ssi1_dr_e, 1), + INGENIC_PIN_GROUP("ssi1-clk-b", jz4780_ssi1_clk_b, 2), + INGENIC_PIN_GROUP("ssi1-clk-d", jz4780_ssi1_clk_d, 2), + INGENIC_PIN_GROUP("ssi1-clk-e", jz4770_ssi1_clk_e, 1), + INGENIC_PIN_GROUP("ssi1-gpc-b", jz4780_ssi1_gpc_b, 2), + INGENIC_PIN_GROUP("ssi1-gpc-d", jz4780_ssi1_gpc_d, 2), + INGENIC_PIN_GROUP("ssi1-gpc-e", jz4770_ssi1_gpc_e, 1), + INGENIC_PIN_GROUP("ssi1-ce0-b", jz4780_ssi1_ce0_b, 2), + INGENIC_PIN_GROUP("ssi1-ce0-d", jz4780_ssi1_ce0_d, 2), + INGENIC_PIN_GROUP("ssi1-ce0-e", jz4770_ssi1_ce0_e, 1), + INGENIC_PIN_GROUP("ssi1-ce1-b", jz4780_ssi1_ce1_b, 2), + INGENIC_PIN_GROUP("ssi1-ce1-d", jz4780_ssi1_ce1_d, 2), + INGENIC_PIN_GROUP("ssi1-ce1-e", jz4770_ssi1_ce1_e, 1), + INGENIC_PIN_GROUP_FUNCS("mmc0-1bit-a", jz4770_mmc0_1bit_a, + jz4760_mmc0_1bit_a_funcs), + INGENIC_PIN_GROUP("mmc0-4bit-a", jz4770_mmc0_4bit_a, 1), + INGENIC_PIN_GROUP("mmc0-8bit-a", jz4780_mmc0_8bit_a, 1), + INGENIC_PIN_GROUP("mmc0-1bit-e", jz4770_mmc0_1bit_e, 0), + INGENIC_PIN_GROUP("mmc0-4bit-e", jz4770_mmc0_4bit_e, 0), + INGENIC_PIN_GROUP("mmc1-1bit-d", jz4770_mmc1_1bit_d, 0), + INGENIC_PIN_GROUP("mmc1-4bit-d", jz4770_mmc1_4bit_d, 0), + INGENIC_PIN_GROUP("mmc1-1bit-e", jz4770_mmc1_1bit_e, 1), + INGENIC_PIN_GROUP("mmc1-4bit-e", jz4770_mmc1_4bit_e, 1), + INGENIC_PIN_GROUP("mmc2-1bit-b", jz4770_mmc2_1bit_b, 0), + INGENIC_PIN_GROUP("mmc2-4bit-b", jz4770_mmc2_4bit_b, 0), + INGENIC_PIN_GROUP("mmc2-1bit-e", jz4770_mmc2_1bit_e, 2), + INGENIC_PIN_GROUP("mmc2-4bit-e", jz4770_mmc2_4bit_e, 2), + INGENIC_PIN_GROUP("nemc-data", jz4770_nemc_8bit_data, 0), + INGENIC_PIN_GROUP("nemc-cle-ale", jz4770_nemc_cle_ale, 0), + INGENIC_PIN_GROUP("nemc-addr", jz4770_nemc_addr, 0), + INGENIC_PIN_GROUP("nemc-rd-we", jz4770_nemc_rd_we, 0), + INGENIC_PIN_GROUP("nemc-frd-fwe", jz4770_nemc_frd_fwe, 0), + INGENIC_PIN_GROUP("nemc-wait", jz4770_nemc_wait, 0), + INGENIC_PIN_GROUP("nemc-cs1", jz4770_nemc_cs1, 0), + INGENIC_PIN_GROUP("nemc-cs2", jz4770_nemc_cs2, 0), + INGENIC_PIN_GROUP("nemc-cs3", jz4770_nemc_cs3, 0), + INGENIC_PIN_GROUP("nemc-cs4", jz4770_nemc_cs4, 0), + INGENIC_PIN_GROUP("nemc-cs5", jz4770_nemc_cs5, 0), + INGENIC_PIN_GROUP("nemc-cs6", jz4770_nemc_cs6, 0), + INGENIC_PIN_GROUP("i2c0-data", jz4770_i2c0, 0), + INGENIC_PIN_GROUP("i2c1-data", jz4770_i2c1, 0), + INGENIC_PIN_GROUP("i2c2-data", jz4770_i2c2, 2), + INGENIC_PIN_GROUP("i2c3-data", jz4780_i2c3, 1), + INGENIC_PIN_GROUP("i2c4-data-e", jz4780_i2c4_e, 1), + INGENIC_PIN_GROUP("i2c4-data-f", jz4780_i2c4_f, 1), + INGENIC_PIN_GROUP("i2s-data-tx", jz4780_i2s_data_tx, 0), + INGENIC_PIN_GROUP("i2s-data-rx", jz4780_i2s_data_rx, 0), + INGENIC_PIN_GROUP_FUNCS("i2s-clk-txrx", jz4780_i2s_clk_txrx, + jz4780_i2s_clk_txrx_funcs), + INGENIC_PIN_GROUP("i2s-clk-rx", jz4780_i2s_clk_rx, 1), + INGENIC_PIN_GROUP("i2s-sysclk", jz4780_i2s_sysclk, 2), + INGENIC_PIN_GROUP("hdmi-ddc", jz4780_hdmi_ddc, 0), + INGENIC_PIN_GROUP("cim-data", jz4770_cim_8bit, 0), + INGENIC_PIN_GROUP("cim-data-12bit", jz4770_cim_12bit, 0), + INGENIC_PIN_GROUP("lcd-24bit", jz4770_lcd_24bit, 0), { "lcd-no-pins", }, - INGENIC_PIN_GROUP("pwm0", jz4770_pwm_pwm0), - INGENIC_PIN_GROUP("pwm1", jz4770_pwm_pwm1), - INGENIC_PIN_GROUP("pwm2", jz4770_pwm_pwm2), - INGENIC_PIN_GROUP("pwm3", jz4770_pwm_pwm3), - INGENIC_PIN_GROUP("pwm4", jz4770_pwm_pwm4), - INGENIC_PIN_GROUP("pwm5", jz4770_pwm_pwm5), - INGENIC_PIN_GROUP("pwm6", jz4770_pwm_pwm6), - INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7), + INGENIC_PIN_GROUP("pwm0", jz4770_pwm_pwm0, 0), + INGENIC_PIN_GROUP("pwm1", jz4770_pwm_pwm1, 0), + INGENIC_PIN_GROUP("pwm2", jz4770_pwm_pwm2, 0), + INGENIC_PIN_GROUP("pwm3", jz4770_pwm_pwm3, 0), + INGENIC_PIN_GROUP("pwm4", jz4770_pwm_pwm4, 0), + INGENIC_PIN_GROUP("pwm5", jz4770_pwm_pwm5, 0), + INGENIC_PIN_GROUP("pwm6", jz4770_pwm_pwm6, 0), + INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7, 0), }; static const char *jz4780_uart2_groups[] = { "uart2-data", "uart2-hwflow", }; @@ -1411,119 +1184,61 @@ static int x1000_mac_pins[] = { 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x26, }; -static int x1000_uart0_data_funcs[] = { 0, 0, }; -static int x1000_uart0_hwflow_funcs[] = { 0, 0, }; -static int x1000_uart1_data_a_funcs[] = { 2, 2, }; -static int x1000_uart1_data_d_funcs[] = { 1, 1, }; -static int x1000_uart1_hwflow_funcs[] = { 1, 1, }; -static int x1000_uart2_data_a_funcs[] = { 2, 2, }; -static int x1000_uart2_data_d_funcs[] = { 0, 0, }; -static int x1000_sfc_funcs[] = { 1, 1, 1, 1, 1, 1, }; -static int x1000_ssi_dt_a_22_funcs[] = { 2, }; -static int x1000_ssi_dt_a_29_funcs[] = { 2, }; -static int x1000_ssi_dt_d_funcs[] = { 0, }; -static int x1000_ssi_dr_a_23_funcs[] = { 2, }; -static int x1000_ssi_dr_a_28_funcs[] = { 2, }; -static int x1000_ssi_dr_d_funcs[] = { 0, }; -static int x1000_ssi_clk_a_24_funcs[] = { 2, }; -static int x1000_ssi_clk_a_26_funcs[] = { 2, }; -static int x1000_ssi_clk_d_funcs[] = { 0, }; -static int x1000_ssi_gpc_a_20_funcs[] = { 2, }; -static int x1000_ssi_gpc_a_31_funcs[] = { 2, }; -static int x1000_ssi_ce0_a_25_funcs[] = { 2, }; -static int x1000_ssi_ce0_a_27_funcs[] = { 2, }; -static int x1000_ssi_ce0_d_funcs[] = { 0, }; -static int x1000_ssi_ce1_a_21_funcs[] = { 2, }; -static int x1000_ssi_ce1_a_30_funcs[] = { 2, }; -static int x1000_mmc0_1bit_funcs[] = { 1, 1, 1, }; -static int x1000_mmc0_4bit_funcs[] = { 1, 1, 1, }; -static int x1000_mmc0_8bit_funcs[] = { 1, 1, 1, 1, 1, }; -static int x1000_mmc1_1bit_funcs[] = { 0, 0, 0, }; -static int x1000_mmc1_4bit_funcs[] = { 0, 0, 0, }; -static int x1000_emc_8bit_data_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -static int x1000_emc_16bit_data_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -static int x1000_emc_addr_funcs[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -}; -static int x1000_emc_rd_we_funcs[] = { 0, 0, }; -static int x1000_emc_wait_funcs[] = { 0, }; -static int x1000_emc_cs1_funcs[] = { 0, }; -static int x1000_emc_cs2_funcs[] = { 0, }; -static int x1000_i2c0_funcs[] = { 0, 0, }; -static int x1000_i2c1_a_funcs[] = { 2, 2, }; -static int x1000_i2c1_c_funcs[] = { 0, 0, }; -static int x1000_i2c2_funcs[] = { 1, 1, }; -static int x1000_i2s_data_tx_funcs[] = { 1, }; -static int x1000_i2s_data_rx_funcs[] = { 1, }; -static int x1000_i2s_clk_txrx_funcs[] = { 1, 1, }; -static int x1000_i2s_sysclk_funcs[] = { 1, }; -static int x1000_cim_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; -static int x1000_lcd_8bit_funcs[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -}; -static int x1000_lcd_16bit_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, }; -static int x1000_pwm_pwm0_funcs[] = { 0, }; -static int x1000_pwm_pwm1_funcs[] = { 1, }; -static int x1000_pwm_pwm2_funcs[] = { 1, }; -static int x1000_pwm_pwm3_funcs[] = { 2, }; -static int x1000_pwm_pwm4_funcs[] = { 0, }; -static int x1000_mac_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; - static const struct group_desc x1000_groups[] = { - INGENIC_PIN_GROUP("uart0-data", x1000_uart0_data), - INGENIC_PIN_GROUP("uart0-hwflow", x1000_uart0_hwflow), - INGENIC_PIN_GROUP("uart1-data-a", x1000_uart1_data_a), - INGENIC_PIN_GROUP("uart1-data-d", x1000_uart1_data_d), - INGENIC_PIN_GROUP("uart1-hwflow", x1000_uart1_hwflow), - INGENIC_PIN_GROUP("uart2-data-a", x1000_uart2_data_a), - INGENIC_PIN_GROUP("uart2-data-d", x1000_uart2_data_d), - INGENIC_PIN_GROUP("sfc", x1000_sfc), - INGENIC_PIN_GROUP("ssi-dt-a-22", x1000_ssi_dt_a_22), - INGENIC_PIN_GROUP("ssi-dt-a-29", x1000_ssi_dt_a_29), - INGENIC_PIN_GROUP("ssi-dt-d", x1000_ssi_dt_d), - INGENIC_PIN_GROUP("ssi-dr-a-23", x1000_ssi_dr_a_23), - INGENIC_PIN_GROUP("ssi-dr-a-28", x1000_ssi_dr_a_28), - INGENIC_PIN_GROUP("ssi-dr-d", x1000_ssi_dr_d), - INGENIC_PIN_GROUP("ssi-clk-a-24", x1000_ssi_clk_a_24), - INGENIC_PIN_GROUP("ssi-clk-a-26", x1000_ssi_clk_a_26), - INGENIC_PIN_GROUP("ssi-clk-d", x1000_ssi_clk_d), - INGENIC_PIN_GROUP("ssi-gpc-a-20", x1000_ssi_gpc_a_20), - INGENIC_PIN_GROUP("ssi-gpc-a-31", x1000_ssi_gpc_a_31), - INGENIC_PIN_GROUP("ssi-ce0-a-25", x1000_ssi_ce0_a_25), - INGENIC_PIN_GROUP("ssi-ce0-a-27", x1000_ssi_ce0_a_27), - INGENIC_PIN_GROUP("ssi-ce0-d", x1000_ssi_ce0_d), - INGENIC_PIN_GROUP("ssi-ce1-a-21", x1000_ssi_ce1_a_21), - INGENIC_PIN_GROUP("ssi-ce1-a-30", x1000_ssi_ce1_a_30), - INGENIC_PIN_GROUP("mmc0-1bit", x1000_mmc0_1bit), - INGENIC_PIN_GROUP("mmc0-4bit", x1000_mmc0_4bit), - INGENIC_PIN_GROUP("mmc0-8bit", x1000_mmc0_8bit), - INGENIC_PIN_GROUP("mmc1-1bit", x1000_mmc1_1bit), - INGENIC_PIN_GROUP("mmc1-4bit", x1000_mmc1_4bit), - INGENIC_PIN_GROUP("emc-8bit-data", x1000_emc_8bit_data), - INGENIC_PIN_GROUP("emc-16bit-data", x1000_emc_16bit_data), - INGENIC_PIN_GROUP("emc-addr", x1000_emc_addr), - INGENIC_PIN_GROUP("emc-rd-we", x1000_emc_rd_we), - INGENIC_PIN_GROUP("emc-wait", x1000_emc_wait), - INGENIC_PIN_GROUP("emc-cs1", x1000_emc_cs1), - INGENIC_PIN_GROUP("emc-cs2", x1000_emc_cs2), - INGENIC_PIN_GROUP("i2c0-data", x1000_i2c0), - INGENIC_PIN_GROUP("i2c1-data-a", x1000_i2c1_a), - INGENIC_PIN_GROUP("i2c1-data-c", x1000_i2c1_c), - INGENIC_PIN_GROUP("i2c2-data", x1000_i2c2), - INGENIC_PIN_GROUP("i2s-data-tx", x1000_i2s_data_tx), - INGENIC_PIN_GROUP("i2s-data-rx", x1000_i2s_data_rx), - INGENIC_PIN_GROUP("i2s-clk-txrx", x1000_i2s_clk_txrx), - INGENIC_PIN_GROUP("i2s-sysclk", x1000_i2s_sysclk), - INGENIC_PIN_GROUP("cim-data", x1000_cim), - INGENIC_PIN_GROUP("lcd-8bit", x1000_lcd_8bit), - INGENIC_PIN_GROUP("lcd-16bit", x1000_lcd_16bit), + INGENIC_PIN_GROUP("uart0-data", x1000_uart0_data, 0), + INGENIC_PIN_GROUP("uart0-hwflow", x1000_uart0_hwflow, 0), + INGENIC_PIN_GROUP("uart1-data-a", x1000_uart1_data_a, 2), + INGENIC_PIN_GROUP("uart1-data-d", x1000_uart1_data_d, 1), + INGENIC_PIN_GROUP("uart1-hwflow", x1000_uart1_hwflow, 1), + INGENIC_PIN_GROUP("uart2-data-a", x1000_uart2_data_a, 2), + INGENIC_PIN_GROUP("uart2-data-d", x1000_uart2_data_d, 0), + INGENIC_PIN_GROUP("sfc", x1000_sfc, 1), + INGENIC_PIN_GROUP("ssi-dt-a-22", x1000_ssi_dt_a_22, 2), + INGENIC_PIN_GROUP("ssi-dt-a-29", x1000_ssi_dt_a_29, 2), + INGENIC_PIN_GROUP("ssi-dt-d", x1000_ssi_dt_d, 0), + INGENIC_PIN_GROUP("ssi-dr-a-23", x1000_ssi_dr_a_23, 2), + INGENIC_PIN_GROUP("ssi-dr-a-28", x1000_ssi_dr_a_28, 2), + INGENIC_PIN_GROUP("ssi-dr-d", x1000_ssi_dr_d, 0), + INGENIC_PIN_GROUP("ssi-clk-a-24", x1000_ssi_clk_a_24, 2), + INGENIC_PIN_GROUP("ssi-clk-a-26", x1000_ssi_clk_a_26, 2), + INGENIC_PIN_GROUP("ssi-clk-d", x1000_ssi_clk_d, 0), + INGENIC_PIN_GROUP("ssi-gpc-a-20", x1000_ssi_gpc_a_20, 2), + INGENIC_PIN_GROUP("ssi-gpc-a-31", x1000_ssi_gpc_a_31, 2), + INGENIC_PIN_GROUP("ssi-ce0-a-25", x1000_ssi_ce0_a_25, 2), + INGENIC_PIN_GROUP("ssi-ce0-a-27", x1000_ssi_ce0_a_27, 2), + INGENIC_PIN_GROUP("ssi-ce0-d", x1000_ssi_ce0_d, 0), + INGENIC_PIN_GROUP("ssi-ce1-a-21", x1000_ssi_ce1_a_21, 2), + INGENIC_PIN_GROUP("ssi-ce1-a-30", x1000_ssi_ce1_a_30, 2), + INGENIC_PIN_GROUP("mmc0-1bit", x1000_mmc0_1bit, 1), + INGENIC_PIN_GROUP("mmc0-4bit", x1000_mmc0_4bit, 1), + INGENIC_PIN_GROUP("mmc0-8bit", x1000_mmc0_8bit, 1), + INGENIC_PIN_GROUP("mmc1-1bit", x1000_mmc1_1bit, 0), + INGENIC_PIN_GROUP("mmc1-4bit", x1000_mmc1_4bit, 0), + INGENIC_PIN_GROUP("emc-8bit-data", x1000_emc_8bit_data, 0), + INGENIC_PIN_GROUP("emc-16bit-data", x1000_emc_16bit_data, 0), + INGENIC_PIN_GROUP("emc-addr", x1000_emc_addr, 0), + INGENIC_PIN_GROUP("emc-rd-we", x1000_emc_rd_we, 0), + INGENIC_PIN_GROUP("emc-wait", x1000_emc_wait, 0), + INGENIC_PIN_GROUP("emc-cs1", x1000_emc_cs1, 0), + INGENIC_PIN_GROUP("emc-cs2", x1000_emc_cs2, 0), + INGENIC_PIN_GROUP("i2c0-data", x1000_i2c0, 0), + INGENIC_PIN_GROUP("i2c1-data-a", x1000_i2c1_a, 2), + INGENIC_PIN_GROUP("i2c1-data-c", x1000_i2c1_c, 0), + INGENIC_PIN_GROUP("i2c2-data", x1000_i2c2, 1), + INGENIC_PIN_GROUP("i2s-data-tx", x1000_i2s_data_tx, 1), + INGENIC_PIN_GROUP("i2s-data-rx", x1000_i2s_data_rx, 1), + INGENIC_PIN_GROUP("i2s-clk-txrx", x1000_i2s_clk_txrx, 1), + INGENIC_PIN_GROUP("i2s-sysclk", x1000_i2s_sysclk, 1), + INGENIC_PIN_GROUP("cim-data", x1000_cim, 2), + INGENIC_PIN_GROUP("lcd-8bit", x1000_lcd_8bit, 1), + INGENIC_PIN_GROUP("lcd-16bit", x1000_lcd_16bit, 1), { "lcd-no-pins", }, - INGENIC_PIN_GROUP("pwm0", x1000_pwm_pwm0), - INGENIC_PIN_GROUP("pwm1", x1000_pwm_pwm1), - INGENIC_PIN_GROUP("pwm2", x1000_pwm_pwm2), - INGENIC_PIN_GROUP("pwm3", x1000_pwm_pwm3), - INGENIC_PIN_GROUP("pwm4", x1000_pwm_pwm4), - INGENIC_PIN_GROUP("mac", x1000_mac), + INGENIC_PIN_GROUP("pwm0", x1000_pwm_pwm0, 0), + INGENIC_PIN_GROUP("pwm1", x1000_pwm_pwm1, 1), + INGENIC_PIN_GROUP("pwm2", x1000_pwm_pwm2, 1), + INGENIC_PIN_GROUP("pwm3", x1000_pwm_pwm3, 2), + INGENIC_PIN_GROUP("pwm4", x1000_pwm_pwm4, 0), + INGENIC_PIN_GROUP("mac", x1000_mac, 1), }; static const char *x1000_uart0_groups[] = { "uart0-data", "uart0-hwflow", }; @@ -1633,56 +1348,32 @@ static int x1500_pwm_pwm2_pins[] = { 0x5b, }; static int x1500_pwm_pwm3_pins[] = { 0x26, }; static int x1500_pwm_pwm4_pins[] = { 0x58, }; -static int x1500_uart0_data_funcs[] = { 0, 0, }; -static int x1500_uart0_hwflow_funcs[] = { 0, 0, }; -static int x1500_uart1_data_a_funcs[] = { 2, 2, }; -static int x1500_uart1_data_d_funcs[] = { 1, 1, }; -static int x1500_uart1_hwflow_funcs[] = { 1, 1, }; -static int x1500_uart2_data_a_funcs[] = { 2, 2, }; -static int x1500_uart2_data_d_funcs[] = { 0, 0, }; -static int x1500_mmc_1bit_funcs[] = { 1, 1, 1, }; -static int x1500_mmc_4bit_funcs[] = { 1, 1, 1, }; -static int x1500_i2c0_funcs[] = { 0, 0, }; -static int x1500_i2c1_a_funcs[] = { 2, 2, }; -static int x1500_i2c1_c_funcs[] = { 0, 0, }; -static int x1500_i2c2_funcs[] = { 1, 1, }; -static int x1500_i2s_data_tx_funcs[] = { 1, }; -static int x1500_i2s_data_rx_funcs[] = { 1, }; -static int x1500_i2s_clk_txrx_funcs[] = { 1, 1, }; -static int x1500_i2s_sysclk_funcs[] = { 1, }; -static int x1500_cim_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; -static int x1500_pwm_pwm0_funcs[] = { 0, }; -static int x1500_pwm_pwm1_funcs[] = { 1, }; -static int x1500_pwm_pwm2_funcs[] = { 1, }; -static int x1500_pwm_pwm3_funcs[] = { 2, }; -static int x1500_pwm_pwm4_funcs[] = { 0, }; - static const struct group_desc x1500_groups[] = { - INGENIC_PIN_GROUP("uart0-data", x1500_uart0_data), - INGENIC_PIN_GROUP("uart0-hwflow", x1500_uart0_hwflow), - INGENIC_PIN_GROUP("uart1-data-a", x1500_uart1_data_a), - INGENIC_PIN_GROUP("uart1-data-d", x1500_uart1_data_d), - INGENIC_PIN_GROUP("uart1-hwflow", x1500_uart1_hwflow), - INGENIC_PIN_GROUP("uart2-data-a", x1500_uart2_data_a), - INGENIC_PIN_GROUP("uart2-data-d", x1500_uart2_data_d), - INGENIC_PIN_GROUP("sfc", x1000_sfc), - INGENIC_PIN_GROUP("mmc-1bit", x1500_mmc_1bit), - INGENIC_PIN_GROUP("mmc-4bit", x1500_mmc_4bit), - INGENIC_PIN_GROUP("i2c0-data", x1500_i2c0), - INGENIC_PIN_GROUP("i2c1-data-a", x1500_i2c1_a), - INGENIC_PIN_GROUP("i2c1-data-c", x1500_i2c1_c), - INGENIC_PIN_GROUP("i2c2-data", x1500_i2c2), - INGENIC_PIN_GROUP("i2s-data-tx", x1500_i2s_data_tx), - INGENIC_PIN_GROUP("i2s-data-rx", x1500_i2s_data_rx), - INGENIC_PIN_GROUP("i2s-clk-txrx", x1500_i2s_clk_txrx), - INGENIC_PIN_GROUP("i2s-sysclk", x1500_i2s_sysclk), - INGENIC_PIN_GROUP("cim-data", x1500_cim), + INGENIC_PIN_GROUP("uart0-data", x1500_uart0_data, 0), + INGENIC_PIN_GROUP("uart0-hwflow", x1500_uart0_hwflow, 0), + INGENIC_PIN_GROUP("uart1-data-a", x1500_uart1_data_a, 2), + INGENIC_PIN_GROUP("uart1-data-d", x1500_uart1_data_d, 1), + INGENIC_PIN_GROUP("uart1-hwflow", x1500_uart1_hwflow, 1), + INGENIC_PIN_GROUP("uart2-data-a", x1500_uart2_data_a, 2), + INGENIC_PIN_GROUP("uart2-data-d", x1500_uart2_data_d, 0), + INGENIC_PIN_GROUP("sfc", x1000_sfc, 1), + INGENIC_PIN_GROUP("mmc-1bit", x1500_mmc_1bit, 1), + INGENIC_PIN_GROUP("mmc-4bit", x1500_mmc_4bit, 1), + INGENIC_PIN_GROUP("i2c0-data", x1500_i2c0, 0), + INGENIC_PIN_GROUP("i2c1-data-a", x1500_i2c1_a, 2), + INGENIC_PIN_GROUP("i2c1-data-c", x1500_i2c1_c, 0), + INGENIC_PIN_GROUP("i2c2-data", x1500_i2c2, 1), + INGENIC_PIN_GROUP("i2s-data-tx", x1500_i2s_data_tx, 1), + INGENIC_PIN_GROUP("i2s-data-rx", x1500_i2s_data_rx, 1), + INGENIC_PIN_GROUP("i2s-clk-txrx", x1500_i2s_clk_txrx, 1), + INGENIC_PIN_GROUP("i2s-sysclk", x1500_i2s_sysclk, 1), + INGENIC_PIN_GROUP("cim-data", x1500_cim, 2), { "lcd-no-pins", }, - INGENIC_PIN_GROUP("pwm0", x1500_pwm_pwm0), - INGENIC_PIN_GROUP("pwm1", x1500_pwm_pwm1), - INGENIC_PIN_GROUP("pwm2", x1500_pwm_pwm2), - INGENIC_PIN_GROUP("pwm3", x1500_pwm_pwm3), - INGENIC_PIN_GROUP("pwm4", x1500_pwm_pwm4), + INGENIC_PIN_GROUP("pwm0", x1500_pwm_pwm0, 0), + INGENIC_PIN_GROUP("pwm1", x1500_pwm_pwm1, 1), + INGENIC_PIN_GROUP("pwm2", x1500_pwm_pwm2, 1), + INGENIC_PIN_GROUP("pwm3", x1500_pwm_pwm3, 2), + INGENIC_PIN_GROUP("pwm4", x1500_pwm_pwm4, 0), }; static const char *x1500_uart0_groups[] = { "uart0-data", "uart0-hwflow", }; @@ -1811,124 +1502,62 @@ static int x1830_mac_pins[] = { 0x29, 0x30, 0x2f, 0x28, 0x2e, 0x2d, 0x2a, 0x2b, 0x26, 0x27, }; -static int x1830_uart0_data_funcs[] = { 0, 0, }; -static int x1830_uart0_hwflow_funcs[] = { 0, 0, }; -static int x1830_uart1_data_funcs[] = { 0, 0, }; -static int x1830_sfc_funcs[] = { 1, 1, 1, 1, 1, 1, }; -static int x1830_ssi0_dt_funcs[] = { 0, }; -static int x1830_ssi0_dr_funcs[] = { 0, }; -static int x1830_ssi0_clk_funcs[] = { 0, }; -static int x1830_ssi0_gpc_funcs[] = { 0, }; -static int x1830_ssi0_ce0_funcs[] = { 0, }; -static int x1830_ssi0_ce1_funcs[] = { 0, }; -static int x1830_ssi1_dt_c_funcs[] = { 1, }; -static int x1830_ssi1_dr_c_funcs[] = { 1, }; -static int x1830_ssi1_clk_c_funcs[] = { 1, }; -static int x1830_ssi1_gpc_c_funcs[] = { 1, }; -static int x1830_ssi1_ce0_c_funcs[] = { 1, }; -static int x1830_ssi1_ce1_c_funcs[] = { 1, }; -static int x1830_ssi1_dt_d_funcs[] = { 2, }; -static int x1830_ssi1_dr_d_funcs[] = { 2, }; -static int x1830_ssi1_clk_d_funcs[] = { 2, }; -static int x1830_ssi1_gpc_d_funcs[] = { 2, }; -static int x1830_ssi1_ce0_d_funcs[] = { 2, }; -static int x1830_ssi1_ce1_d_funcs[] = { 2, }; -static int x1830_mmc0_1bit_funcs[] = { 0, 0, 0, }; -static int x1830_mmc0_4bit_funcs[] = { 0, 0, 0, }; -static int x1830_mmc1_1bit_funcs[] = { 0, 0, 0, }; -static int x1830_mmc1_4bit_funcs[] = { 0, 0, 0, }; -static int x1830_i2c0_funcs[] = { 1, 1, }; -static int x1830_i2c1_funcs[] = { 0, 0, }; -static int x1830_i2c2_funcs[] = { 1, 1, }; -static int x1830_i2s_data_tx_funcs[] = { 0, }; -static int x1830_i2s_data_rx_funcs[] = { 0, }; -static int x1830_i2s_clk_txrx_funcs[] = { 0, 0, }; -static int x1830_i2s_clk_rx_funcs[] = { 0, 0, }; -static int x1830_i2s_sysclk_funcs[] = { 0, }; -static int x1830_lcd_rgb_18bit_funcs[] = { - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -}; -static int x1830_lcd_slcd_8bit_funcs[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -}; -static int x1830_lcd_slcd_16bit_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, }; -static int x1830_pwm_pwm0_b_funcs[] = { 0, }; -static int x1830_pwm_pwm0_c_funcs[] = { 1, }; -static int x1830_pwm_pwm1_b_funcs[] = { 0, }; -static int x1830_pwm_pwm1_c_funcs[] = { 1, }; -static int x1830_pwm_pwm2_c_8_funcs[] = { 0, }; -static int x1830_pwm_pwm2_c_13_funcs[] = { 1, }; -static int x1830_pwm_pwm3_c_9_funcs[] = { 0, }; -static int x1830_pwm_pwm3_c_14_funcs[] = { 1, }; -static int x1830_pwm_pwm4_c_15_funcs[] = { 1, }; -static int x1830_pwm_pwm4_c_25_funcs[] = { 0, }; -static int x1830_pwm_pwm5_c_16_funcs[] = { 1, }; -static int x1830_pwm_pwm5_c_26_funcs[] = { 0, }; -static int x1830_pwm_pwm6_c_17_funcs[] = { 1, }; -static int x1830_pwm_pwm6_c_27_funcs[] = { 0, }; -static int x1830_pwm_pwm7_c_18_funcs[] = { 1, }; -static int x1830_pwm_pwm7_c_28_funcs[] = { 0, }; -static int x1830_mac_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - static const struct group_desc x1830_groups[] = { - INGENIC_PIN_GROUP("uart0-data", x1830_uart0_data), - INGENIC_PIN_GROUP("uart0-hwflow", x1830_uart0_hwflow), - INGENIC_PIN_GROUP("uart1-data", x1830_uart1_data), - INGENIC_PIN_GROUP("sfc", x1830_sfc), - INGENIC_PIN_GROUP("ssi0-dt", x1830_ssi0_dt), - INGENIC_PIN_GROUP("ssi0-dr", x1830_ssi0_dr), - INGENIC_PIN_GROUP("ssi0-clk", x1830_ssi0_clk), - INGENIC_PIN_GROUP("ssi0-gpc", x1830_ssi0_gpc), - INGENIC_PIN_GROUP("ssi0-ce0", x1830_ssi0_ce0), - INGENIC_PIN_GROUP("ssi0-ce1", x1830_ssi0_ce1), - INGENIC_PIN_GROUP("ssi1-dt-c", x1830_ssi1_dt_c), - INGENIC_PIN_GROUP("ssi1-dr-c", x1830_ssi1_dr_c), - INGENIC_PIN_GROUP("ssi1-clk-c", x1830_ssi1_clk_c), - INGENIC_PIN_GROUP("ssi1-gpc-c", x1830_ssi1_gpc_c), - INGENIC_PIN_GROUP("ssi1-ce0-c", x1830_ssi1_ce0_c), - INGENIC_PIN_GROUP("ssi1-ce1-c", x1830_ssi1_ce1_c), - INGENIC_PIN_GROUP("ssi1-dt-d", x1830_ssi1_dt_d), - INGENIC_PIN_GROUP("ssi1-dr-d", x1830_ssi1_dr_d), - INGENIC_PIN_GROUP("ssi1-clk-d", x1830_ssi1_clk_d), - INGENIC_PIN_GROUP("ssi1-gpc-d", x1830_ssi1_gpc_d), - INGENIC_PIN_GROUP("ssi1-ce0-d", x1830_ssi1_ce0_d), - INGENIC_PIN_GROUP("ssi1-ce1-d", x1830_ssi1_ce1_d), - INGENIC_PIN_GROUP("mmc0-1bit", x1830_mmc0_1bit), - INGENIC_PIN_GROUP("mmc0-4bit", x1830_mmc0_4bit), - INGENIC_PIN_GROUP("mmc1-1bit", x1830_mmc1_1bit), - INGENIC_PIN_GROUP("mmc1-4bit", x1830_mmc1_4bit), - INGENIC_PIN_GROUP("i2c0-data", x1830_i2c0), - INGENIC_PIN_GROUP("i2c1-data", x1830_i2c1), - INGENIC_PIN_GROUP("i2c2-data", x1830_i2c2), - INGENIC_PIN_GROUP("i2s-data-tx", x1830_i2s_data_tx), - INGENIC_PIN_GROUP("i2s-data-rx", x1830_i2s_data_rx), - INGENIC_PIN_GROUP("i2s-clk-txrx", x1830_i2s_clk_txrx), - INGENIC_PIN_GROUP("i2s-clk-rx", x1830_i2s_clk_rx), - INGENIC_PIN_GROUP("i2s-sysclk", x1830_i2s_sysclk), - INGENIC_PIN_GROUP("lcd-rgb-18bit", x1830_lcd_rgb_18bit), - INGENIC_PIN_GROUP("lcd-slcd-8bit", x1830_lcd_slcd_8bit), - INGENIC_PIN_GROUP("lcd-slcd-16bit", x1830_lcd_slcd_16bit), + INGENIC_PIN_GROUP("uart0-data", x1830_uart0_data, 0), + INGENIC_PIN_GROUP("uart0-hwflow", x1830_uart0_hwflow, 0), + INGENIC_PIN_GROUP("uart1-data", x1830_uart1_data, 0), + INGENIC_PIN_GROUP("sfc", x1830_sfc, 1), + INGENIC_PIN_GROUP("ssi0-dt", x1830_ssi0_dt, 0), + INGENIC_PIN_GROUP("ssi0-dr", x1830_ssi0_dr, 0), + INGENIC_PIN_GROUP("ssi0-clk", x1830_ssi0_clk, 0), + INGENIC_PIN_GROUP("ssi0-gpc", x1830_ssi0_gpc, 0), + INGENIC_PIN_GROUP("ssi0-ce0", x1830_ssi0_ce0, 0), + INGENIC_PIN_GROUP("ssi0-ce1", x1830_ssi0_ce1, 0), + INGENIC_PIN_GROUP("ssi1-dt-c", x1830_ssi1_dt_c, 1), + INGENIC_PIN_GROUP("ssi1-dr-c", x1830_ssi1_dr_c, 1), + INGENIC_PIN_GROUP("ssi1-clk-c", x1830_ssi1_clk_c, 1), + INGENIC_PIN_GROUP("ssi1-gpc-c", x1830_ssi1_gpc_c, 1), + INGENIC_PIN_GROUP("ssi1-ce0-c", x1830_ssi1_ce0_c, 1), + INGENIC_PIN_GROUP("ssi1-ce1-c", x1830_ssi1_ce1_c, 1), + INGENIC_PIN_GROUP("ssi1-dt-d", x1830_ssi1_dt_d, 2), + INGENIC_PIN_GROUP("ssi1-dr-d", x1830_ssi1_dr_d, 2), + INGENIC_PIN_GROUP("ssi1-clk-d", x1830_ssi1_clk_d, 2), + INGENIC_PIN_GROUP("ssi1-gpc-d", x1830_ssi1_gpc_d, 2), + INGENIC_PIN_GROUP("ssi1-ce0-d", x1830_ssi1_ce0_d, 2), + INGENIC_PIN_GROUP("ssi1-ce1-d", x1830_ssi1_ce1_d, 2), + INGENIC_PIN_GROUP("mmc0-1bit", x1830_mmc0_1bit, 0), + INGENIC_PIN_GROUP("mmc0-4bit", x1830_mmc0_4bit, 0), + INGENIC_PIN_GROUP("mmc1-1bit", x1830_mmc1_1bit, 0), + INGENIC_PIN_GROUP("mmc1-4bit", x1830_mmc1_4bit, 0), + INGENIC_PIN_GROUP("i2c0-data", x1830_i2c0, 1), + INGENIC_PIN_GROUP("i2c1-data", x1830_i2c1, 0), + INGENIC_PIN_GROUP("i2c2-data", x1830_i2c2, 1), + INGENIC_PIN_GROUP("i2s-data-tx", x1830_i2s_data_tx, 0), + INGENIC_PIN_GROUP("i2s-data-rx", x1830_i2s_data_rx, 0), + INGENIC_PIN_GROUP("i2s-clk-txrx", x1830_i2s_clk_txrx, 0), + INGENIC_PIN_GROUP("i2s-clk-rx", x1830_i2s_clk_rx, 0), + INGENIC_PIN_GROUP("i2s-sysclk", x1830_i2s_sysclk, 0), + INGENIC_PIN_GROUP("lcd-rgb-18bit", x1830_lcd_rgb_18bit, 0), + INGENIC_PIN_GROUP("lcd-slcd-8bit", x1830_lcd_slcd_8bit, 1), + INGENIC_PIN_GROUP("lcd-slcd-16bit", x1830_lcd_slcd_16bit, 1), { "lcd-no-pins", }, - INGENIC_PIN_GROUP("pwm0-b", x1830_pwm_pwm0_b), - INGENIC_PIN_GROUP("pwm0-c", x1830_pwm_pwm0_c), - INGENIC_PIN_GROUP("pwm1-b", x1830_pwm_pwm1_b), - INGENIC_PIN_GROUP("pwm1-c", x1830_pwm_pwm1_c), - INGENIC_PIN_GROUP("pwm2-c-8", x1830_pwm_pwm2_c_8), - INGENIC_PIN_GROUP("pwm2-c-13", x1830_pwm_pwm2_c_13), - INGENIC_PIN_GROUP("pwm3-c-9", x1830_pwm_pwm3_c_9), - INGENIC_PIN_GROUP("pwm3-c-14", x1830_pwm_pwm3_c_14), - INGENIC_PIN_GROUP("pwm4-c-15", x1830_pwm_pwm4_c_15), - INGENIC_PIN_GROUP("pwm4-c-25", x1830_pwm_pwm4_c_25), - INGENIC_PIN_GROUP("pwm5-c-16", x1830_pwm_pwm5_c_16), - INGENIC_PIN_GROUP("pwm5-c-26", x1830_pwm_pwm5_c_26), - INGENIC_PIN_GROUP("pwm6-c-17", x1830_pwm_pwm6_c_17), - INGENIC_PIN_GROUP("pwm6-c-27", x1830_pwm_pwm6_c_27), - INGENIC_PIN_GROUP("pwm7-c-18", x1830_pwm_pwm7_c_18), - INGENIC_PIN_GROUP("pwm7-c-28", x1830_pwm_pwm7_c_28), - INGENIC_PIN_GROUP("mac", x1830_mac), + INGENIC_PIN_GROUP("pwm0-b", x1830_pwm_pwm0_b, 0), + INGENIC_PIN_GROUP("pwm0-c", x1830_pwm_pwm0_c, 1), + INGENIC_PIN_GROUP("pwm1-b", x1830_pwm_pwm1_b, 0), + INGENIC_PIN_GROUP("pwm1-c", x1830_pwm_pwm1_c, 1), + INGENIC_PIN_GROUP("pwm2-c-8", x1830_pwm_pwm2_c_8, 0), + INGENIC_PIN_GROUP("pwm2-c-13", x1830_pwm_pwm2_c_13, 1), + INGENIC_PIN_GROUP("pwm3-c-9", x1830_pwm_pwm3_c_9, 0), + INGENIC_PIN_GROUP("pwm3-c-14", x1830_pwm_pwm3_c_14, 1), + INGENIC_PIN_GROUP("pwm4-c-15", x1830_pwm_pwm4_c_15, 1), + INGENIC_PIN_GROUP("pwm4-c-25", x1830_pwm_pwm4_c_25, 0), + INGENIC_PIN_GROUP("pwm5-c-16", x1830_pwm_pwm5_c_16, 1), + INGENIC_PIN_GROUP("pwm5-c-26", x1830_pwm_pwm5_c_26, 0), + INGENIC_PIN_GROUP("pwm6-c-17", x1830_pwm_pwm6_c_17, 1), + INGENIC_PIN_GROUP("pwm6-c-27", x1830_pwm_pwm6_c_27, 0), + INGENIC_PIN_GROUP("pwm7-c-18", x1830_pwm_pwm7_c_18, 1), + INGENIC_PIN_GROUP("pwm7-c-28", x1830_pwm_pwm7_c_28, 0), + INGENIC_PIN_GROUP("mac", x1830_mac, 0), }; static const char *x1830_uart0_groups[] = { "uart0-data", "uart0-hwflow", }; @@ -2381,6 +2010,8 @@ static int ingenic_pinmux_set_mux(struct pinctrl_dev *pctldev, struct function_desc *func; struct group_desc *grp; unsigned int i; + uintptr_t mode; + u8 *pin_modes; func = pinmux_generic_get_function(pctldev, selector); if (!func) @@ -2393,10 +2024,15 @@ static int ingenic_pinmux_set_mux(struct pinctrl_dev *pctldev, dev_dbg(pctldev->dev, "enable function %s group %s\n", func->name, grp->name); - for (i = 0; i < grp->num_pins; i++) { - int *pin_modes = grp->data; + mode = (uintptr_t)grp->data; + if (mode <= 3) { + for (i = 0; i < grp->num_pins; i++) + ingenic_pinmux_set_pin_fn(jzpc, grp->pins[i], mode); + } else { + pin_modes = grp->data; - ingenic_pinmux_set_pin_fn(jzpc, grp->pins[i], pin_modes[i]); + for (i = 0; i < grp->num_pins; i++) + ingenic_pinmux_set_pin_fn(jzpc, grp->pins[i], pin_modes[i]); } return 0; From 0b9eb84e134b033bd319ac50a45d83dc1e81a961 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 9 Oct 2020 14:52:07 +0200 Subject: [PATCH 04/56] drm/ingenic: Compute timings according to adjusted_mode->crtc_* The adjusted_mode->crtc_* fields contain the values adjusted for the hardware, and are the ones that should be written to the registers. Signed-off-by: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index a3d1617d7c67e0..a551fabe50be57 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -146,15 +146,15 @@ static void ingenic_drm_crtc_update_timings(struct ingenic_drm *priv, { unsigned int vpe, vds, vde, vt, hpe, hds, hde, ht; - vpe = mode->vsync_end - mode->vsync_start; - vds = mode->vtotal - mode->vsync_start; - vde = vds + mode->vdisplay; - vt = vde + mode->vsync_start - mode->vdisplay; + vpe = mode->crtc_vsync_end - mode->crtc_vsync_start; + vds = mode->crtc_vtotal - mode->crtc_vsync_start; + vde = vds + mode->crtc_vdisplay; + vt = vde + mode->crtc_vsync_start - mode->crtc_vdisplay; - hpe = mode->hsync_end - mode->hsync_start; - hds = mode->htotal - mode->hsync_start; - hde = hds + mode->hdisplay; - ht = hde + mode->hsync_start - mode->hdisplay; + hpe = mode->crtc_hsync_end - mode->crtc_hsync_start; + hds = mode->crtc_htotal - mode->crtc_hsync_start; + hde = hds + mode->crtc_hdisplay; + ht = hde + mode->crtc_hsync_start - mode->crtc_hdisplay; regmap_write(priv->map, JZ_REG_LCD_VSYNC, 0 << JZ_LCD_VSYNC_VPS_OFFSET | @@ -275,9 +275,9 @@ static void ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_pending_vblank_event *event = state->event; if (drm_atomic_crtc_needs_modeset(state)) { - ingenic_drm_crtc_update_timings(priv, &state->mode); + ingenic_drm_crtc_update_timings(priv, &state->adjusted_mode); - clk_set_rate(priv->pix_clk, state->adjusted_mode.clock * 1000); + clk_set_rate(priv->pix_clk, state->adjusted_mode.crtc_clock * 1000); } if (event) { From 7174c04c9bd69e82117c91be6758433d626e94ce Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 9 Oct 2020 14:52:59 +0200 Subject: [PATCH 05/56] drm/ingenic: Properly compute timings when using a 3x8-bit panel The LCD controller expects timing values in dot-clock ticks, which is 3x the timing values in pixels when using a 3x8-bit display; but it will count the display area size in pixels either way. Go figure. Signed-off-by: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index a551fabe50be57..362271ae40f9bb 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -531,6 +531,7 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder, struct drm_connector_state *conn_state) { struct drm_display_info *info = &conn_state->connector->display_info; + struct drm_display_mode *mode = &crtc_state->adjusted_mode; if (info->num_bus_formats != 1) return -EINVAL; @@ -539,10 +540,22 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder, return 0; switch (*info->bus_formats) { + case MEDIA_BUS_FMT_RGB888_3X8: + /* + * The LCD controller expects timing values in dot-clock ticks, + * which is 3x the timing values in pixels when using a 3x8-bit + * display; but it will count the display area size in pixels + * either way. Go figure. + */ + mode->crtc_clock = mode->clock * 3; + mode->crtc_hsync_start = mode->hsync_start * 3 - mode->hdisplay * 2; + mode->crtc_hsync_end = mode->hsync_end * 3 - mode->hdisplay * 2; + mode->crtc_hdisplay = mode->hdisplay; + mode->crtc_htotal = mode->htotal * 3 - mode->hdisplay * 2; + return 0; case MEDIA_BUS_FMT_RGB565_1X16: case MEDIA_BUS_FMT_RGB666_1X18: case MEDIA_BUS_FMT_RGB888_1X24: - case MEDIA_BUS_FMT_RGB888_3X8: return 0; default: return -EINVAL; From b7f42201eda3ce142ca694a1bb8f3431cb5b9184 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 26 Sep 2020 19:04:55 +0200 Subject: [PATCH 06/56] drm/ingenic: Reset pixclock rate when parent clock rate changes Old Ingenic SoCs can overclock very well, up to +50% of their nominal clock rate, whithout requiring overvolting or anything like that, just by changing the rate of the main PLL. Unfortunately, all clocks on the system are derived from that PLL, and when the PLL rate is updated, so is our pixel clock. To counter that issue, we make sure that the panel is in VBLANK before the rate change happens, and we will then re-set the pixel clock rate afterwards, once the PLL has been changed, to be as close as possible to the pixel rate requested by the encoder. v2: Add comment about mutex usage Signed-off-by: Paul Cercueil Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-2-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 61 ++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index a3d1617d7c67e0..819744d7d58979 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -68,6 +69,21 @@ struct ingenic_drm { bool panel_is_sharp; bool no_vblank; + + /* + * clk_mutex is used to synchronize the pixel clock rate update with + * the VBLANK. When the pixel clock's parent clock needs to be updated, + * clock_nb's notifier function will lock the mutex, then wait until the + * next VBLANK. At that point, the parent clock's rate can be updated, + * and the mutex is then unlocked. If an atomic commit happens in the + * meantime, it will lock on the mutex, effectively waiting until the + * clock update process finishes. Finally, the pixel clock's rate will + * be recomputed when the mutex has been released, in the pending atomic + * commit, or a future one. + */ + struct mutex clk_mutex; + bool update_clk_rate; + struct notifier_block clock_nb; }; static const u32 ingenic_drm_primary_formats[] = { @@ -111,6 +127,29 @@ static inline struct ingenic_drm *drm_crtc_get_priv(struct drm_crtc *crtc) return container_of(crtc, struct ingenic_drm, crtc); } +static inline struct ingenic_drm *drm_nb_get_priv(struct notifier_block *nb) +{ + return container_of(nb, struct ingenic_drm, clock_nb); +} + +static int ingenic_drm_update_pixclk(struct notifier_block *nb, + unsigned long action, + void *data) +{ + struct ingenic_drm *priv = drm_nb_get_priv(nb); + + switch (action) { + case PRE_RATE_CHANGE: + mutex_lock(&priv->clk_mutex); + priv->update_clk_rate = true; + drm_crtc_wait_one_vblank(&priv->crtc); + return NOTIFY_OK; + default: + mutex_unlock(&priv->clk_mutex); + return NOTIFY_OK; + } +} + static void ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *state) { @@ -276,8 +315,14 @@ static void ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc, if (drm_atomic_crtc_needs_modeset(state)) { ingenic_drm_crtc_update_timings(priv, &state->mode); + priv->update_clk_rate = true; + } + if (priv->update_clk_rate) { + mutex_lock(&priv->clk_mutex); clk_set_rate(priv->pix_clk, state->adjusted_mode.clock * 1000); + priv->update_clk_rate = false; + mutex_unlock(&priv->clk_mutex); } if (event) { @@ -934,16 +979,28 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) if (soc_info->has_osd) regmap_write(priv->map, JZ_REG_LCD_OSDC, JZ_LCD_OSDC_OSDEN); + mutex_init(&priv->clk_mutex); + priv->clock_nb.notifier_call = ingenic_drm_update_pixclk; + + parent_clk = clk_get_parent(priv->pix_clk); + ret = clk_notifier_register(parent_clk, &priv->clock_nb); + if (ret) { + dev_err(dev, "Unable to register clock notifier\n"); + goto err_devclk_disable; + } + ret = drm_dev_register(drm, 0); if (ret) { dev_err(dev, "Failed to register DRM driver\n"); - goto err_devclk_disable; + goto err_clk_notifier_unregister; } drm_fbdev_generic_setup(drm, 32); return 0; +err_clk_notifier_unregister: + clk_notifier_unregister(parent_clk, &priv->clock_nb); err_devclk_disable: if (priv->lcd_clk) clk_disable_unprepare(priv->lcd_clk); @@ -965,7 +1022,9 @@ static int compare_of(struct device *dev, void *data) static void ingenic_drm_unbind(struct device *dev) { struct ingenic_drm *priv = dev_get_drvdata(dev); + struct clk *parent_clk = clk_get_parent(priv->pix_clk); + clk_notifier_unregister(parent_clk, &priv->clock_nb); if (priv->lcd_clk) clk_disable_unprepare(priv->lcd_clk); clk_disable_unprepare(priv->pix_clk); From ecbcd371c105772f0b7cfa2f0216840999b20731 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 26 Sep 2020 19:04:56 +0200 Subject: [PATCH 07/56] drm/ingenic: Add support for reserved memory Add support for static memory reserved from Device Tree. Since we're using GEM buffers backed by CMA, it is interesting to have an option to specify the CMA area where the GEM buffers will be allocated. v2: Don't abort probe if reserved memory cannot be obtained. The driver will still work fine provided the kernel configuration is sane. Signed-off-by: Paul Cercueil Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-3-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 819744d7d58979..9358a5f70f7114 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -731,6 +732,11 @@ static void ingenic_drm_unbind_all(void *d) component_unbind_all(priv->dev, &priv->drm); } +static void __maybe_unused ingenic_drm_release_rmem(void *d) +{ + of_reserved_mem_device_release(d); +} + static int ingenic_drm_bind(struct device *dev, bool has_components) { struct platform_device *pdev = to_platform_device(dev); @@ -752,6 +758,19 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return -EINVAL; } + if (IS_ENABLED(CONFIG_OF_RESERVED_MEM)) { + ret = of_reserved_mem_device_init(dev); + + if (ret && ret != -ENODEV) + dev_warn(dev, "Failed to get reserved memory: %d\n", ret); + + if (!ret) { + ret = devm_add_action_or_reset(dev, ingenic_drm_release_rmem, dev); + if (ret) + return ret; + } + } + priv = devm_drm_dev_alloc(dev, &ingenic_drm_driver_data, struct ingenic_drm, drm); if (IS_ERR(priv)) From b641af31f7b9a43590a97b011f1d10e61a72f174 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 26 Sep 2020 19:04:57 +0200 Subject: [PATCH 08/56] drm/ingenic: Alloc F0 and F1 DMA descriptors at once Instead of calling dmam_alloc_coherent() once for each 4-bit DMA hardware descriptor, we can have them both in a physical memory page, as long as they are aligned to 16 bytes. This reduces memory consumption, and will make it easier to add more DMA descriptors in the future. Note that the old code would not create the F0 descriptor on SoCs that don't support multiple planes. We don't care, because: - we don't use more memory by allocating two descriptors instead of a single one; - the only SoC that does not support multiple planes (JZ4740) still has two independent DMA channels, for an unknown reason. Signed-off-by: Paul Cercueil Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-4-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 51 +++++++++++++---------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 9358a5f70f7114..49a9c06c225d29 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -42,7 +42,12 @@ struct ingenic_dma_hwdesc { u32 addr; u32 id; u32 cmd; -} __packed; +} __aligned(16); + +struct ingenic_dma_hwdescs { + struct ingenic_dma_hwdesc hwdesc_f0; + struct ingenic_dma_hwdesc hwdesc_f1; +}; struct jz_soc_info { bool needs_dev_clk; @@ -65,8 +70,8 @@ struct ingenic_drm { struct clk *lcd_clk, *pix_clk; const struct jz_soc_info *soc_info; - struct ingenic_dma_hwdesc *dma_hwdesc_f0, *dma_hwdesc_f1; - dma_addr_t dma_hwdesc_phys_f0, dma_hwdesc_phys_f1; + struct ingenic_dma_hwdescs *dma_hwdescs; + dma_addr_t dma_hwdescs_phys; bool panel_is_sharp; bool no_vblank; @@ -502,9 +507,9 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane, cpp = state->fb->format->cpp[0]; if (priv->soc_info->has_osd && plane->type == DRM_PLANE_TYPE_OVERLAY) - hwdesc = priv->dma_hwdesc_f0; + hwdesc = &priv->dma_hwdescs->hwdesc_f0; else - hwdesc = priv->dma_hwdesc_f1; + hwdesc = &priv->dma_hwdescs->hwdesc_f1; hwdesc->addr = addr; hwdesc->cmd = JZ_LCD_CMD_EOF_IRQ | (width * height * cpp / 4); @@ -750,6 +755,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) void __iomem *base; long parent_rate; unsigned int i, clone_mask = 0; + dma_addr_t dma_hwdesc_phys_f0, dma_hwdesc_phys_f1; int ret, irq; soc_info = of_device_get_match_data(dev); @@ -824,26 +830,25 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return PTR_ERR(priv->pix_clk); } - priv->dma_hwdesc_f1 = dmam_alloc_coherent(dev, sizeof(*priv->dma_hwdesc_f1), - &priv->dma_hwdesc_phys_f1, - GFP_KERNEL); - if (!priv->dma_hwdesc_f1) + priv->dma_hwdescs = dmam_alloc_coherent(dev, + sizeof(*priv->dma_hwdescs), + &priv->dma_hwdescs_phys, + GFP_KERNEL); + if (!priv->dma_hwdescs) return -ENOMEM; - priv->dma_hwdesc_f1->next = priv->dma_hwdesc_phys_f1; - priv->dma_hwdesc_f1->id = 0xf1; - if (priv->soc_info->has_osd) { - priv->dma_hwdesc_f0 = dmam_alloc_coherent(dev, - sizeof(*priv->dma_hwdesc_f0), - &priv->dma_hwdesc_phys_f0, - GFP_KERNEL); - if (!priv->dma_hwdesc_f0) - return -ENOMEM; + /* Configure DMA hwdesc for foreground0 plane */ + dma_hwdesc_phys_f0 = priv->dma_hwdescs_phys + + offsetof(struct ingenic_dma_hwdescs, hwdesc_f0); + priv->dma_hwdescs->hwdesc_f0.next = dma_hwdesc_phys_f0; + priv->dma_hwdescs->hwdesc_f0.id = 0xf0; - priv->dma_hwdesc_f0->next = priv->dma_hwdesc_phys_f0; - priv->dma_hwdesc_f0->id = 0xf0; - } + /* Configure DMA hwdesc for foreground1 plane */ + dma_hwdesc_phys_f1 = priv->dma_hwdescs_phys + + offsetof(struct ingenic_dma_hwdescs, hwdesc_f1); + priv->dma_hwdescs->hwdesc_f1.next = dma_hwdesc_phys_f1; + priv->dma_hwdescs->hwdesc_f1.id = 0xf1; if (soc_info->has_osd) priv->ipu_plane = drm_plane_from_index(drm, 0); @@ -991,8 +996,8 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) } /* Set address of our DMA descriptor chain */ - regmap_write(priv->map, JZ_REG_LCD_DA0, priv->dma_hwdesc_phys_f0); - regmap_write(priv->map, JZ_REG_LCD_DA1, priv->dma_hwdesc_phys_f1); + regmap_write(priv->map, JZ_REG_LCD_DA0, dma_hwdesc_phys_f0); + regmap_write(priv->map, JZ_REG_LCD_DA1, dma_hwdesc_phys_f1); /* Enable OSD if available */ if (soc_info->has_osd) From d969697ea662f3ddcf453e6948da7aecada9d827 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 26 Sep 2020 19:04:58 +0200 Subject: [PATCH 09/56] drm/ingenic: Support handling different pixel formats in F0/F1 planes Until now the ingenic-drm driver supported the same pixel formats on the F0 and F1 planes, and across all SoCs. However, the F0 plane does support paletted 8bpp, while the F1 plane doesn't. Furthermore, the three SoCs currently supported all have different pixel formats available; 24bpp was added in JZ4725B, 30bpp was added in JZ4770. Prepare the inclusion of paletted 8bpp, 24bpp and 30bpp support by having separate pixel format lists for F0 and F1 planes. Signed-off-by: Paul Cercueil Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-5-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 57 +++++++++++++++++++---- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 49a9c06c225d29..be97bf57ae0dab 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -53,6 +53,8 @@ struct jz_soc_info { bool needs_dev_clk; bool has_osd; unsigned int max_width, max_height; + const u32 *formats_f0, *formats_f1; + unsigned int num_formats_f0, num_formats_f1; }; struct ingenic_drm { @@ -92,12 +94,6 @@ struct ingenic_drm { struct notifier_block clock_nb; }; -static const u32 ingenic_drm_primary_formats[] = { - DRM_FORMAT_XRGB1555, - DRM_FORMAT_RGB565, - DRM_FORMAT_XRGB8888, -}; - static bool ingenic_drm_writeable_reg(struct device *dev, unsigned int reg) { switch (reg) { @@ -857,8 +853,8 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) ret = drm_universal_plane_init(drm, &priv->f1, 1, &ingenic_drm_primary_plane_funcs, - ingenic_drm_primary_formats, - ARRAY_SIZE(ingenic_drm_primary_formats), + priv->soc_info->formats_f1, + priv->soc_info->num_formats_f1, NULL, DRM_PLANE_TYPE_PRIMARY, NULL); if (ret) { dev_err(dev, "Failed to register plane: %i\n", ret); @@ -880,8 +876,8 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) ret = drm_universal_plane_init(drm, &priv->f0, 1, &ingenic_drm_primary_plane_funcs, - ingenic_drm_primary_formats, - ARRAY_SIZE(ingenic_drm_primary_formats), + priv->soc_info->formats_f0, + priv->soc_info->num_formats_f0, NULL, DRM_PLANE_TYPE_OVERLAY, NULL); if (ret) { @@ -1094,11 +1090,44 @@ static int ingenic_drm_remove(struct platform_device *pdev) return 0; } +static const u32 jz4740_formats[] = { + DRM_FORMAT_XRGB1555, + DRM_FORMAT_RGB565, + DRM_FORMAT_XRGB8888, +}; + +static const u32 jz4725b_formats_f1[] = { + DRM_FORMAT_XRGB1555, + DRM_FORMAT_RGB565, + DRM_FORMAT_XRGB8888, +}; + +static const u32 jz4725b_formats_f0[] = { + DRM_FORMAT_XRGB1555, + DRM_FORMAT_RGB565, + DRM_FORMAT_XRGB8888, +}; + +static const u32 jz4770_formats_f1[] = { + DRM_FORMAT_XRGB1555, + DRM_FORMAT_RGB565, + DRM_FORMAT_XRGB8888, +}; + +static const u32 jz4770_formats_f0[] = { + DRM_FORMAT_XRGB1555, + DRM_FORMAT_RGB565, + DRM_FORMAT_XRGB8888, +}; + static const struct jz_soc_info jz4740_soc_info = { .needs_dev_clk = true, .has_osd = false, .max_width = 800, .max_height = 600, + .formats_f1 = jz4740_formats, + .num_formats_f1 = ARRAY_SIZE(jz4740_formats), + /* JZ4740 has only one plane */ }; static const struct jz_soc_info jz4725b_soc_info = { @@ -1106,6 +1135,10 @@ static const struct jz_soc_info jz4725b_soc_info = { .has_osd = true, .max_width = 800, .max_height = 600, + .formats_f1 = jz4725b_formats_f1, + .num_formats_f1 = ARRAY_SIZE(jz4725b_formats_f1), + .formats_f0 = jz4725b_formats_f0, + .num_formats_f0 = ARRAY_SIZE(jz4725b_formats_f0), }; static const struct jz_soc_info jz4770_soc_info = { @@ -1113,6 +1146,10 @@ static const struct jz_soc_info jz4770_soc_info = { .has_osd = true, .max_width = 1280, .max_height = 720, + .formats_f1 = jz4770_formats_f1, + .num_formats_f1 = ARRAY_SIZE(jz4770_formats_f1), + .formats_f0 = jz4770_formats_f0, + .num_formats_f0 = ARRAY_SIZE(jz4770_formats_f0), }; static const struct of_device_id ingenic_drm_of_match[] = { From 6a88d771d6408b8c5faa2ab4da25cc2230ac05fd Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 26 Sep 2020 19:05:00 +0200 Subject: [PATCH 10/56] drm/ingenic: Add support for 30-bit modes Starting from the JZ4760 SoC, the primary and overlay planes support 30-bit pixel modes (10 bits per color component). Add support for these in the ingenic-drm driver. Signed-off-by: Paul Cercueil Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-7-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 8 ++++++++ drivers/gpu/drm/ingenic/ingenic-drm.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index be97bf57ae0dab..55ee199c20f763 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -448,6 +448,9 @@ void ingenic_drm_plane_config(struct device *dev, case DRM_FORMAT_XRGB8888: ctrl |= JZ_LCD_OSDCTRL_BPP_18_24; break; + case DRM_FORMAT_XRGB2101010: + ctrl |= JZ_LCD_OSDCTRL_BPP_30; + break; } regmap_update_bits(priv->map, JZ_REG_LCD_OSDCTRL, @@ -463,6 +466,9 @@ void ingenic_drm_plane_config(struct device *dev, case DRM_FORMAT_XRGB8888: ctrl |= JZ_LCD_CTRL_BPP_18_24; break; + case DRM_FORMAT_XRGB2101010: + ctrl |= JZ_LCD_CTRL_BPP_30; + break; } regmap_update_bits(priv->map, JZ_REG_LCD_CTRL, @@ -1112,12 +1118,14 @@ static const u32 jz4770_formats_f1[] = { DRM_FORMAT_XRGB1555, DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888, + DRM_FORMAT_XRGB2101010, }; static const u32 jz4770_formats_f0[] = { DRM_FORMAT_XRGB1555, DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888, + DRM_FORMAT_XRGB2101010, }; static const struct jz_soc_info jz4740_soc_info = { diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.h b/drivers/gpu/drm/ingenic/ingenic-drm.h index 43f7d959cff7e7..7f15d2f0b87eee 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.h +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h @@ -124,6 +124,7 @@ #define JZ_LCD_CTRL_BPP_8 0x3 #define JZ_LCD_CTRL_BPP_15_16 0x4 #define JZ_LCD_CTRL_BPP_18_24 0x5 +#define JZ_LCD_CTRL_BPP_30 0x7 #define JZ_LCD_CTRL_BPP_MASK (JZ_LCD_CTRL_RGB555 | 0x7) #define JZ_LCD_CMD_SOF_IRQ BIT(31) From ec11b79c78ef08e9dc48853dd2cb11a149f40334 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 26 Sep 2020 19:05:01 +0200 Subject: [PATCH 11/56] drm/ingenic: Add support for 24-bit modes Starting from the JZ4725B SoC, the primary and overlay planes support 24-bit pixel modes (8 bits per color component, without dummy byte). Add support for these in the ingenic-drm driver. Signed-off-by: Paul Cercueil Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-8-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 8 ++++++++ drivers/gpu/drm/ingenic/ingenic-drm.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 55ee199c20f763..4c1c1d0e62948b 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -445,6 +445,9 @@ void ingenic_drm_plane_config(struct device *dev, case DRM_FORMAT_RGB565: ctrl |= JZ_LCD_OSDCTRL_BPP_15_16; break; + case DRM_FORMAT_RGB888: + ctrl |= JZ_LCD_OSDCTRL_BPP_24_COMP; + break; case DRM_FORMAT_XRGB8888: ctrl |= JZ_LCD_OSDCTRL_BPP_18_24; break; @@ -463,6 +466,9 @@ void ingenic_drm_plane_config(struct device *dev, case DRM_FORMAT_RGB565: ctrl |= JZ_LCD_CTRL_BPP_15_16; break; + case DRM_FORMAT_RGB888: + ctrl |= JZ_LCD_CTRL_BPP_24_COMP; + break; case DRM_FORMAT_XRGB8888: ctrl |= JZ_LCD_CTRL_BPP_18_24; break; @@ -1117,6 +1123,7 @@ static const u32 jz4725b_formats_f0[] = { static const u32 jz4770_formats_f1[] = { DRM_FORMAT_XRGB1555, DRM_FORMAT_RGB565, + DRM_FORMAT_RGB888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB2101010, }; @@ -1124,6 +1131,7 @@ static const u32 jz4770_formats_f1[] = { static const u32 jz4770_formats_f0[] = { DRM_FORMAT_XRGB1555, DRM_FORMAT_RGB565, + DRM_FORMAT_RGB888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB2101010, }; diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.h b/drivers/gpu/drm/ingenic/ingenic-drm.h index 7f15d2f0b87eee..9b48ce02803dd7 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.h +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h @@ -124,6 +124,7 @@ #define JZ_LCD_CTRL_BPP_8 0x3 #define JZ_LCD_CTRL_BPP_15_16 0x4 #define JZ_LCD_CTRL_BPP_18_24 0x5 +#define JZ_LCD_CTRL_BPP_24_COMP 0x6 #define JZ_LCD_CTRL_BPP_30 0x7 #define JZ_LCD_CTRL_BPP_MASK (JZ_LCD_CTRL_RGB555 | 0x7) @@ -146,6 +147,7 @@ #define JZ_LCD_OSDCTRL_CHANGE BIT(3) #define JZ_LCD_OSDCTRL_BPP_15_16 0x4 #define JZ_LCD_OSDCTRL_BPP_18_24 0x5 +#define JZ_LCD_OSDCTRL_BPP_24_COMP 0x6 #define JZ_LCD_OSDCTRL_BPP_30 0x7 #define JZ_LCD_OSDCTRL_BPP_MASK (JZ_LCD_OSDCTRL_RGB555 | 0x7) From 8efbdab8619e546df62e2ae0873148e7afa18026 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sun, 27 Sep 2020 21:36:45 +0200 Subject: [PATCH 12/56] drm/ingenic: Add support for paletted 8bpp On JZ4725B and newer, the F0 plane supports paletted 8bpp with a 256-entry palette. Add support for it. v3: Only accept a full 256-entry palette. Signed-off-by: Paul Cercueil Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200927193645.262612-2-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 66 +++++++++++++++++++++-- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 4c1c1d0e62948b..7d8b0ad52979a8 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,8 @@ struct ingenic_dma_hwdesc { struct ingenic_dma_hwdescs { struct ingenic_dma_hwdesc hwdesc_f0; struct ingenic_dma_hwdesc hwdesc_f1; + struct ingenic_dma_hwdesc hwdesc_pal; + u16 palette[256] __aligned(16); }; struct jz_soc_info { @@ -241,6 +244,12 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc, struct ingenic_drm *priv = drm_crtc_get_priv(crtc); struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL; + if (state->gamma_lut && + drm_color_lut_size(state->gamma_lut) != ARRAY_SIZE(priv->dma_hwdescs->palette)) { + dev_dbg(priv->dev, "Invalid palette size\n"); + return -EINVAL; + } + if (drm_atomic_crtc_needs_modeset(state) && priv->soc_info->has_osd) { f1_state = drm_atomic_get_plane_state(state->state, &priv->f1); if (IS_ERR(f1_state)) @@ -460,6 +469,9 @@ void ingenic_drm_plane_config(struct device *dev, JZ_LCD_OSDCTRL_BPP_MASK, ctrl); } else { switch (fourcc) { + case DRM_FORMAT_C8: + ctrl |= JZ_LCD_CTRL_BPP_8; + break; case DRM_FORMAT_XRGB1555: ctrl |= JZ_LCD_CTRL_RGB555; fallthrough; @@ -499,16 +511,34 @@ void ingenic_drm_plane_config(struct device *dev, } } +static void ingenic_drm_update_palette(struct ingenic_drm *priv, + const struct drm_color_lut *lut) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); i++) { + u16 color = drm_color_lut_extract(lut[i].red, 5) << 11 + | drm_color_lut_extract(lut[i].green, 6) << 5 + | drm_color_lut_extract(lut[i].blue, 5); + + priv->dma_hwdescs->palette[i] = color; + } +} + static void ingenic_drm_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *oldstate) { struct ingenic_drm *priv = drm_device_get_priv(plane->dev); struct drm_plane_state *state = plane->state; + struct drm_crtc_state *crtc_state; struct ingenic_dma_hwdesc *hwdesc; - unsigned int width, height, cpp; + unsigned int width, height, cpp, offset; dma_addr_t addr; + u32 fourcc; if (state && state->fb) { + crtc_state = state->crtc->state; + addr = drm_fb_cma_get_gem_addr(state->fb, state, 0); width = state->src_w >> 16; height = state->src_h >> 16; @@ -522,9 +552,23 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane, hwdesc->addr = addr; hwdesc->cmd = JZ_LCD_CMD_EOF_IRQ | (width * height * cpp / 4); - if (drm_atomic_crtc_needs_modeset(state->crtc->state)) - ingenic_drm_plane_config(priv->dev, plane, - state->fb->format->format); + if (drm_atomic_crtc_needs_modeset(crtc_state)) { + fourcc = state->fb->format->format; + + ingenic_drm_plane_config(priv->dev, plane, fourcc); + + if (fourcc == DRM_FORMAT_C8) + offset = offsetof(struct ingenic_dma_hwdescs, hwdesc_pal); + else + offset = offsetof(struct ingenic_dma_hwdescs, hwdesc_f0); + + priv->dma_hwdescs->hwdesc_f0.next = priv->dma_hwdescs_phys + offset; + + crtc_state->color_mgmt_changed = fourcc == DRM_FORMAT_C8; + } + + if (crtc_state->color_mgmt_changed) + ingenic_drm_update_palette(priv, crtc_state->gamma_lut->data); } } @@ -858,6 +902,15 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) priv->dma_hwdescs->hwdesc_f1.next = dma_hwdesc_phys_f1; priv->dma_hwdescs->hwdesc_f1.id = 0xf1; + /* Configure DMA hwdesc for palette */ + priv->dma_hwdescs->hwdesc_pal.next = priv->dma_hwdescs_phys + + offsetof(struct ingenic_dma_hwdescs, hwdesc_f0); + priv->dma_hwdescs->hwdesc_pal.id = 0xc0; + priv->dma_hwdescs->hwdesc_pal.addr = priv->dma_hwdescs_phys + + offsetof(struct ingenic_dma_hwdescs, palette); + priv->dma_hwdescs->hwdesc_pal.cmd = JZ_LCD_CMD_ENABLE_PAL + | (sizeof(priv->dma_hwdescs->palette) / 4); + if (soc_info->has_osd) priv->ipu_plane = drm_plane_from_index(drm, 0); @@ -882,6 +935,9 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return ret; } + drm_crtc_enable_color_mgmt(&priv->crtc, 0, false, + ARRAY_SIZE(priv->dma_hwdescs->palette)); + if (soc_info->has_osd) { drm_plane_helper_add(&priv->f0, &ingenic_drm_plane_helper_funcs); @@ -1115,6 +1171,7 @@ static const u32 jz4725b_formats_f1[] = { }; static const u32 jz4725b_formats_f0[] = { + DRM_FORMAT_C8, DRM_FORMAT_XRGB1555, DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888, @@ -1129,6 +1186,7 @@ static const u32 jz4770_formats_f1[] = { }; static const u32 jz4770_formats_f0[] = { + DRM_FORMAT_C8, DRM_FORMAT_XRGB1555, DRM_FORMAT_RGB565, DRM_FORMAT_RGB888, From 12c136e65e048dcf29719e602f11407c9ac2071a Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 27 Jul 2020 18:13:39 +0200 Subject: [PATCH 13/56] dt-bindings: display: Document NewVision NV3052C DT node Add documentation for the Device Tree node for LCD panels based on the NewVision NV3052C controller. v2: - Support backlight property - Add *-supply properties for the 5 different power supplies. Either they must all be present, or 'power-supply' must be present. - Reword description to avoid confusion about 'driver' - Use 4-space indent in example Signed-off-by: Paul Cercueil --- .../display/panel/newvision,nv3052c.yaml | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/newvision,nv3052c.yaml diff --git a/Documentation/devicetree/bindings/display/panel/newvision,nv3052c.yaml b/Documentation/devicetree/bindings/display/panel/newvision,nv3052c.yaml new file mode 100644 index 00000000000000..0468ddeaff2df3 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/newvision,nv3052c.yaml @@ -0,0 +1,100 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/newvision,nv3052c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NewVision NV3052C TFT LCD panel driver with SPI control bus + +maintainers: + - Paul Cercueil + +description: | + This is a IC driver for TFT panels, accepting a variety of input + streams that get adapted and scaled to the panel. + + The panel must obey the rules for a SPI slave device as specified in + spi/spi-controller.yaml + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + items: + - enum: + - leadtek,ltk035c5444t-spi + + - const: newvision,nv3052c + + reg: + maxItems: 1 + + reset-gpios: true + power-supply: true + backlight: true + port: true + + vci-supply: + description: + Power supply for analog circuits (VCI=2.5V to 6V) + + vddam-supply: + description: + Power Supply for MIPI regulator circuits (VDDAM=1.75V to 6V) + + iovcc-supply: + description: | + External Power Supply for IO pads and other logic circuits + (IOVCC=1.65 to 3.6V) + + pprech-supply: + description: + Pre-charge power for source (can be connected to IOVCC or VCI) + + vpp-supply: + description: + Input power for NV memory programming (8.0V ~ 8.5V, typical=8.25V) + +required: + - compatible + - reg + +oneOf: + - required: + - power-supply + - required: + - vci-supply + - vddam-supply + - iovcc-supply + - pprech-supply + - vpp-supply + +unevaluatedProperties: false + +examples: + - | + #include + spi { + #address-cells = <1>; + #size-cells = <0>; + + display@0 { + compatible = "leadtek,ltk035c5444t-spi", "newvision,nv3052c"; + reg = <0>; + + spi-max-frequency = <15000000>; + spi-3wire; + reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>; + backlight = <&backlight>; + power-supply = <&vcc>; + + port { + panel_input: endpoint { + remote-endpoint = <&panel_output>; + }; + }; + }; + }; + +... From c39a35e661fc4a9e2b0c886466ecc212335d953a Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 30 May 2020 14:37:32 +0200 Subject: [PATCH 14/56] drm: dsi: Let host and device specify supported bus The current MIPI DSI framework can very well be used to support MIPI DBI panels. In order to add support for the various bus types supported by DBI, the DRM panel drivers should specify the bus type they will use, and the DSI host drivers should specify the bus types they are compatible with. The DSI host driver can then use the information provided by the DBI/DSI device driver, such as the bus type and the number of lanes, to configure its hardware properly. v2: - Remove the WARN_ON_ONCE() if (dbi->bus_types == 0), because it will trigger for every panel out there. Just default to MIPI_DCS_BUS_TYPE_DSI if the bitmask is not populated. - Create a 'enum mipi_dcs_bus_type' instead of macros - Rename values to avoid confusion about SPI modes Signed-off-by: Paul Cercueil --- drivers/gpu/drm/drm_mipi_dsi.c | 9 +++++++++ include/drm/drm_mipi_dsi.h | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 5dd475e8299501..a3cbea8019ccc2 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -281,6 +281,9 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host) { struct device_node *node; + if (!host->bus_types) + host->bus_types = MIPI_DCS_BUS_TYPE_DSI; + for_each_available_child_of_node(host->dev->of_node, node) { /* skip nodes without reg property */ if (!of_find_property(node, "reg", NULL)) @@ -323,6 +326,12 @@ int mipi_dsi_attach(struct mipi_dsi_device *dsi) { const struct mipi_dsi_host_ops *ops = dsi->host->ops; + if (!dsi->bus_type) + dsi->bus_type = MIPI_DCS_BUS_TYPE_DSI; + + if (!(dsi->bus_type & dsi->host->bus_types)) + return -EINVAL; + if (!ops || !ops->attach) return -ENOSYS; diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 360e6377e84ba8..802644c4c0c434 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -63,6 +63,27 @@ struct mipi_dsi_packet { int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, const struct mipi_dsi_msg *msg); +/** + * enum mipi_dcs_bus_type - MIPI DCS bus types + * @MIPI_DCS_BUS_TYPE_DSI: MIPI DSI + * @MIPI_DCS_BUS_TYPE_DBI_SPI_C1: DBI with SPI carrier, 9 bits per word, with + * the data/command information in the 9th (MSB) bit + * @MIPI_DCS_BUS_TYPE_DBI_SPI_C2: DBI with SPI carrier, 16 bits per word, with + * the data/command information in the 9th bit, and 7 MSB bits of padding + * @MIPI_DCS_BUS_TYPE_DBI_SPI_C3: DBI with SPI carrier, 8 bits per word, with + * the data/command information carried by a separate GPIO + * @MIPI_DCS_BUS_TYPE_DBI_M6800: Motorola 6800 type parallel bus + * @MIPI_DCS_BUS_TYPE_DBI_I8080: Intel 8080 type parallel bus + */ +enum mipi_dcs_bus_type { + MIPI_DCS_BUS_TYPE_DSI = BIT(0), + MIPI_DCS_BUS_TYPE_DBI_SPI_C1 = BIT(1), + MIPI_DCS_BUS_TYPE_DBI_SPI_C2 = BIT(2), + MIPI_DCS_BUS_TYPE_DBI_SPI_C3 = BIT(3), + MIPI_DCS_BUS_TYPE_DBI_M6800 = BIT(4), + MIPI_DCS_BUS_TYPE_DBI_I8080 = BIT(5), +}; + /** * struct mipi_dsi_host_ops - DSI bus operations * @attach: attach DSI device to DSI host @@ -94,11 +115,13 @@ struct mipi_dsi_host_ops { * struct mipi_dsi_host - DSI host device * @dev: driver model device node for this DSI host * @ops: DSI host operations + * @bus_types: Bitmask of supported MIPI bus types (enum mipi_dcs_bus_type) * @list: list management */ struct mipi_dsi_host { struct device *dev; const struct mipi_dsi_host_ops *ops; + unsigned int bus_types; struct list_head list; }; @@ -162,6 +185,7 @@ struct mipi_dsi_device_info { * @host: DSI host for this peripheral * @dev: driver model device node for this peripheral * @name: DSI peripheral chip type + * @bus_type: MIPI bus type * @channel: virtual channel assigned to the peripheral * @format: pixel format for video mode * @lanes: number of active data lanes @@ -178,6 +202,7 @@ struct mipi_dsi_device { struct device dev; char name[DSI_DEV_NAME_SIZE]; + enum mipi_dcs_bus_type bus_type; unsigned int channel; unsigned int lanes; enum mipi_dsi_pixel_format format; From 6690bbb8de1ce0311267f3abe69fff954bd63670 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sun, 7 Jun 2020 14:55:17 +0200 Subject: [PATCH 15/56] drm: Add SPI DBI host driver This driver will register a DBI host driver for panels connected over SPI. DBI types c1 and c3 are supported. C1 is a SPI protocol with 9 bits per word, with the data/command information in the 9th (MSB) bit. C3 is a SPI protocol with 8 bits per word, with the data/command information carried by a separate GPIO. v2: - Move ouside of drivers/gpu/drm/bridge/ - The client drivers should now use module_mipi_dbi_spi_driver(). This ensures that the panel drivers can probe from the DSI/DBI bus, as well as from the SPI bus, using a shared OF match table. v3: 9th bit is BIT(8), not BIT(9)... Signed-off-by: Paul Cercueil --- drivers/gpu/drm/Kconfig | 8 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_mipi_dbi_spi.c | 247 +++++++++++++++++++++++++++++ include/drm/drm_mipi_dbi_spi.h | 42 +++++ 4 files changed, 298 insertions(+) create mode 100644 drivers/gpu/drm/drm_mipi_dbi_spi.c create mode 100644 include/drm/drm_mipi_dbi_spi.h diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 147d61b9674ea1..932c7bcaeff0b9 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -32,6 +32,14 @@ config DRM_MIPI_DSI bool depends on DRM +config DRM_MIPI_DBI_SPI + tristate "SPI host support for MIPI DBI" + depends on DRM && OF && SPI + select DRM_MIPI_DSI + select DRM_MIPI_DBI + help + Enable this option to support DBI panels connected over SPI. + config DRM_DP_AUX_CHARDEV bool "DRM DP AUX Interface" depends on DRM diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 81569009f88481..b93ef1bdb82ebd 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -60,6 +60,7 @@ obj-$(CONFIG_DRM_DEBUG_SELFTEST) += selftests/ obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o +obj-$(CONFIG_DRM_MIPI_DBI_SPI) += drm_mipi_dbi_spi.o obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o obj-y += arm/ obj-$(CONFIG_DRM_TTM) += ttm/ diff --git a/drivers/gpu/drm/drm_mipi_dbi_spi.c b/drivers/gpu/drm/drm_mipi_dbi_spi.c new file mode 100644 index 00000000000000..82d566fe668500 --- /dev/null +++ b/drivers/gpu/drm/drm_mipi_dbi_spi.c @@ -0,0 +1,247 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * MIPI Display Bus Interface (DBI) SPI support + * + * Copyright 2016 Noralf Trønnes + * Copyright 2020 Paul Cercueil + */ + +#include +#include +#include + +#include +#include + +#include