Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1111927yba; Tue, 2 Apr 2019 02:31:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVDxJuR8riOx8dpM27LvTN4TFIrz4StPT6lIxRnpQ06yXsOPX1BkYEpcXLACK3PR7TaeZ7 X-Received: by 2002:a63:2c3:: with SMTP id 186mr65196974pgc.161.1554197481900; Tue, 02 Apr 2019 02:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554197481; cv=none; d=google.com; s=arc-20160816; b=TsqB84ZRjn6Nlco2kqZIvwTVqYR0F4tk2ewZ0yZIjFnI8QN6wgPXvXvFgh4QdJOqd4 HTXL5DoAvdH7OE1dvph5aRw6ApwaOKaddyEBDctMeKvzOq3Czzr5EMqcG3tG8hJBQSCw hkipF+SZKrBHoc9ppWeoVhLUes7A0jSwWsayoLb3ukvbiRr57rhkTrRPfk13G1ADi0mV dK4ADjC8vei04u3aYcUx/9YL+TfMxYX686kgFQCxmk98gBcPwfaf0dDbJjPFgy+792z2 CwpUxlkzTOYOfCk7ECYt0WOTouLjfC0sISq8sLqsZZF6P0NG7i47B5M68mwPZLI7LV0l pofA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:authenticated-by; bh=5BWuV14SC4MMp75/gsPtdPiKnGS8OaLytRkjWwXFYds=; b=cVbglxUW9GUPNxaNK2BxGu3+vxPCJjuEqWv/Li7BEB8HA8vPZfMEEjTwl4iqlcDvOM /EfbC+9mjFIksBwRrdc4Lohly+1XFglbbW0/2yegJMcjv5qA1327gSS1VJNwq+tq8okd qRIFNheC9L8su0YtxMzQzOtiPMQodbBvPT0XAwVXD+6e9hSHkJBB7u2h2GjwVOZtO55G 42W3I8lZW6OOheePZ7QIO4oT7mfmZcYJd3JExMkrO2lFaBlLC7sST0+szDAq9EC/uhJu bODc37By7Wm8+KwJYP83SYI4WBqdJPjY04nLGWWp345L9ZEEEqTasUc1Y5g2Scn4Ko1E Yw+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v35si11578691plg.382.2019.04.02.02.31.06; Tue, 02 Apr 2019 02:31:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729662AbfDBI4Y (ORCPT + 99 others); Tue, 2 Apr 2019 04:56:24 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:41063 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729368AbfDBI4Y (ORCPT ); Tue, 2 Apr 2019 04:56:24 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x328uEn3032403, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x328uEn3032403 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NOT); Tue, 2 Apr 2019 16:56:14 +0800 Received: from localhost (172.22.88.128) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.408.0; Tue, 2 Apr 2019 16:56:14 +0800 From: To: , , CC: RickyWu Subject: [PATCH] misc: rtsx: Fixed rts5260 power saving parameter and sd glitch Date: Tue, 2 Apr 2019 16:56:07 +0800 Message-ID: <20190402085607.32165-1-ricky_wu@realtek.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.22.88.128] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: RickyWu this patch fixes rts5260 power saving parameter make power saving function work on L1.1, L1.2 Signed-off-by: RickyWu --- drivers/misc/cardreader/rts5260.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/misc/cardreader/rts5260.c b/drivers/misc/cardreader/rts5260.c index da22bcb62b04..b510d3f46587 100644 --- a/drivers/misc/cardreader/rts5260.c +++ b/drivers/misc/cardreader/rts5260.c @@ -195,7 +195,7 @@ static int sd_set_sample_push_timing_sd30(struct rtsx_pcr *pcr) | SD_ASYNC_FIFO_NOT_RST, SD_30_MODE | SD_ASYNC_FIFO_NOT_RST); rtsx_pci_write_register(pcr, CLK_CTL, CLK_LOW_FREQ, CLK_LOW_FREQ); rtsx_pci_write_register(pcr, CARD_CLK_SOURCE, 0xFF, - CRC_VAR_CLK0 | SD30_FIX_CLK | SAMPLE_VAR_CLK1); + CRC_VAR_CLK0 | SD30_FIX_CLK | SAMPLE_VAR_CLK1); rtsx_pci_write_register(pcr, CLK_CTL, CLK_LOW_FREQ, 0); return 0; @@ -238,8 +238,8 @@ static int rts5260_card_power_on(struct rtsx_pcr *pcr, int card) /* Reset SD_CFG3 register */ rtsx_pci_write_register(pcr, SD_CFG3, SD30_CLK_END_EN, 0); rtsx_pci_write_register(pcr, REG_SD_STOP_SDCLK_CFG, - SD30_CLK_STOP_CFG_EN | SD30_CLK_STOP_CFG1 | - SD30_CLK_STOP_CFG0, 0); + SD30_CLK_STOP_CFG_EN | SD30_CLK_STOP_CFG1 | + SD30_CLK_STOP_CFG0, 0); rtsx_pci_write_register(pcr, REG_PRE_RW_MODE, EN_INFINITE_MODE, 0); @@ -315,12 +315,12 @@ static void rts5260_init_ocp(struct rtsx_pcr *pcr) rtsx_pci_write_register(pcr, RTS5260_DVCC_CTRL, - RTS5260_DVCC_OCP_THD_MASK, - option->sd_800mA_ocp_thd); + RTS5260_DVCC_OCP_THD_MASK, + option->sd_800mA_ocp_thd); rtsx_pci_write_register(pcr, RTS5260_DV331812_CFG, - RTS5260_DV331812_OCP_THD_MASK, - RTS5260_DV331812_OCP_THD_270); + RTS5260_DV331812_OCP_THD_MASK, + RTS5260_DV331812_OCP_THD_270); mask = SD_OCP_GLITCH_MASK; val = pcr->hw_param.ocp_glitch; @@ -451,6 +451,7 @@ static void rts5260_pwr_saving_setting(struct rtsx_pcr *pcr) lss_l1_2 = rtsx_check_dev_flag(pcr, ASPM_L1_2_EN) | rtsx_check_dev_flag(pcr, PM_L1_2_EN); + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0); if (lss_l1_2) { pcr_dbg(pcr, "Set parameters for L1.2."); rtsx_pci_write_register(pcr, PWR_GLOBAL_CTRL, @@ -573,10 +574,10 @@ static int rts5260_extra_init_hw(struct rtsx_pcr *pcr) * to drive low, and we forcibly request clock. */ if (option->force_clkreq_0) - rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, + rtsx_pci_write_register(pcr, PETXCFG, FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW); else - rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, + rtsx_pci_write_register(pcr, PETXCFG, FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH); return 0; @@ -704,7 +705,7 @@ void rts5260_init_params(struct rtsx_pcr *pcr) option->ocp_en = 1; if (option->ocp_en) hw_param->interrupt_en |= SD_OC_INT_EN; - hw_param->ocp_glitch = SDVIO_OCP_GLITCH_800U | SDVIO_OCP_GLITCH_800U; + hw_param->ocp_glitch = SD_OCP_GLITCH_100U | SDVIO_OCP_GLITCH_800U; option->sd_400mA_ocp_thd = RTS5260_DVCC_OCP_THD_550; option->sd_800mA_ocp_thd = RTS5260_DVCC_OCP_THD_970; } -- 2.17.1