diff --git a/arch/arm64/boot/dts/amlogic/mesons5.dtsi b/arch/arm64/boot/dts/amlogic/mesons5.dtsi index 4c7db4df2..ad08ad1e2 100644 --- a/arch/arm64/boot/dts/amlogic/mesons5.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesons5.dtsi @@ -3354,8 +3354,8 @@ sd_iso7816_pins:sd_iso7816_pins { mux { - groups = "iso7816_clk_z", - "iso7816_data_z"; + groups = "iso7816_clk_t", + "iso7816_data_t"; function = "iso7816"; input-enable; bias-pull-down; diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201.dts index 97dee228c..6c1e98e3c 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201.dts @@ -775,7 +775,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -784,12 +784,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -806,8 +806,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_drm.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_drm.dts index 5bd563b7b..c912a8d45 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_drm.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_drm.dts @@ -773,7 +773,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -782,12 +782,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -804,8 +804,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_linux.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_linux.dts index aa077b68f..e4e81eb09 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_linux.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_linux.dts @@ -773,7 +773,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -782,12 +782,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -804,8 +804,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2.dts index a56c7284c..960415caa 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2.dts @@ -775,7 +775,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -784,12 +784,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -806,8 +806,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2_drm.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2_drm.dts index 790bb1a24..d23856bd8 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2_drm.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2_drm.dts @@ -773,7 +773,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -782,12 +782,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -804,8 +804,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2_linux.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2_linux.dts index 396775ac4..ba10d910d 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2_linux.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax201_v2_linux.dts @@ -773,7 +773,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -782,12 +782,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -804,8 +804,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax208.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax208.dts index a53c681c3..4ee2deecc 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax208.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax208.dts @@ -772,7 +772,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -781,12 +781,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -803,8 +803,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax208_v2.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax208_v2.dts index 49315c42c..f07279bb9 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax208_v2.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax208_v2.dts @@ -772,7 +772,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -781,12 +781,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -803,8 +803,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax209.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax209.dts index 9d8d6ee14..b1db00d9c 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax209.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax209.dts @@ -720,7 +720,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -729,12 +729,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -751,8 +751,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/arch/arm64/boot/dts/amlogic/s5_s928x_ax209_v2.dts b/arch/arm64/boot/dts/amlogic/s5_s928x_ax209_v2.dts index 0de27cacb..255cf541a 100644 --- a/arch/arm64/boot/dts/amlogic/s5_s928x_ax209_v2.dts +++ b/arch/arm64/boot/dts/amlogic/s5_s928x_ax209_v2.dts @@ -720,7 +720,7 @@ multi_core1 = <1>; }; - /* SMC */ + /* SMC */ smartcard { compatible = "amlogic,smartcard-sc2"; dev_name = "smartcard"; @@ -729,12 +729,12 @@ reg = <0x0 0xfe000000 0x0 0x480000>; irq_trigger_type = "GPIO_IRQ_LOW"; - reset_pin-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_HIGH>; - detect_pin-gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; - enable_5v3v_pin-gpios = <&gpio GPIOT_11 GPIO_ACTIVE_HIGH>; - enable_pin-gpios = <&gpio GPIOT_12 GPIO_ACTIVE_HIGH>; + reset_pin-gpios = <&gpio GPIOT_19 GPIO_ACTIVE_HIGH>; + detect_pin-gpios = <&gpio GPIOT_23 GPIO_ACTIVE_HIGH>; + enable_5v3v_pin-gpios = <&gpio GPIOT_22 GPIO_ACTIVE_HIGH>; + enable_pin-gpios = <&gpio GPIOT_18 GPIO_ACTIVE_HIGH>; - interrupts = <0 174 1>; + interrupts = <0 81 1>; interrupt-names = "smc0_irq"; /* *Smc clock source, if change this, @@ -751,8 +751,8 @@ pinctrl-names = "default"; pinctrl-0 = <&sd_iso7816_pins>; -// clocks = <&clkc CLKID_SC_CLK_GATE>; -// clock-names = "smartcard"; + clocks = <&clkc CLKID_SYS_CLK_SMART_CARD>; + clock-names = "smartcard"; }; dvb-extern { diff --git a/drivers/dvb/smartcard_sc2/smartcard.c b/drivers/dvb/smartcard_sc2/smartcard.c index 9aad8802b..8d9791599 100644 --- a/drivers/dvb/smartcard_sc2/smartcard.c +++ b/drivers/dvb/smartcard_sc2/smartcard.c @@ -169,6 +169,7 @@ static int cpu_type; #define REG_READ 0 #define REG_WRITE 1 +static int sys_addr_offset = 0x38000; #ifdef MEM_DEBUG static void debug_write(const char __user *buf, size_t count) @@ -499,7 +500,7 @@ static int sc2_read_smc(unsigned int reg) static void sc2_write_sys(unsigned int reg, unsigned int val) { - void *ptr = (void *)(p_smc_hw_base - 0x38000 + reg); + void *ptr = (void *)(p_smc_hw_base - sys_addr_offset + reg); if (t5w_smartcard) return; @@ -511,7 +512,7 @@ static void sc2_write_sys(unsigned int reg, unsigned int val) static int sc2_read_sys(unsigned int reg) { - void *addr = p_smc_hw_base - 0x38000 + reg; + void *addr = p_smc_hw_base - sys_addr_offset + reg; int ret = 0; if (t5w_smartcard) @@ -542,9 +543,12 @@ static int sc2_smc_addr(struct platform_device *pdev) pr_error("%s addr:0x%x\n", __func__, (unsigned int)res->start); if (res->start == 0xfe000000) { - p_smc_hw_base += 0x38000; - pr_error("sc2 smartcard\n"); cpu_type = get_cpu_type(); + if (cpu_type == MESON_CPU_MAJOR_ID_S5) + sys_addr_offset = 0x40000; + + p_smc_hw_base += sys_addr_offset; + pr_error("sc2 smartcard\n"); } else { pr_error("t5w smartcard\n"); t5w_smartcard = 1;