Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cb5d961 authored by Micky Ching's avatar Micky Ching Committed by Lee Jones
Browse files

mfd: rtsx: Fix PM suspend for 5227 & 5249



Fix rts5227&5249 failed send buffer cmd after suspend,
PM_CTRL3 should reset before send any buffer cmd after suspend.
Otherwise, buffer cmd will failed, this will lead resume fail.

Signed-off-by: default avatarMicky Ching <micky_ching@realsil.com.cn>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 130dd5b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o
obj-$(CONFIG_MFD_CROS_EC_I2C)	+= cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI)	+= cros_ec_spi.o

rtsx_pci-objs			:= rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o
rtsx_pci-objs			:= rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o
obj-$(CONFIG_MFD_RTSX_PCI)	+= rtsx_pci.o
obj-$(CONFIG_MFD_RTSX_USB)	+= rtsx_usb.o

+6 −0
Original line number Diff line number Diff line
@@ -130,6 +130,12 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)

static int rts5227_optimize_phy(struct rtsx_pcr *pcr)
{
	int err;

	err = rtsx_gops_pm_reset(pcr);
	if (err < 0)
		return err;

	/* Optimize RX sensitivity */
	return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42);
}
+4 −0
Original line number Diff line number Diff line
@@ -130,6 +130,10 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
{
	int err;

	err = rtsx_gops_pm_reset(pcr);
	if (err < 0)
		return err;

	err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV,
			PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED |
			PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN |
+37 −0
Original line number Diff line number Diff line
/* Driver for Realtek PCI-Express card reader
 *
 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, see <http://www.gnu.org/licenses/>.
 *
 * Author:
 *   Micky Ching <micky_ching@realsil.com.cn>
 */

#include <linux/mfd/rtsx_pci.h>
#include "rtsx_pcr.h"

int rtsx_gops_pm_reset(struct rtsx_pcr *pcr)
{
	int err;

	/* init aspm */
	rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00);
	err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00);
	if (err < 0)
		return err;

	/* reset PM_CTRL3 before send buffer cmd */
	return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
}
+3 −0
Original line number Diff line number Diff line
@@ -72,4 +72,7 @@ do { \
	pcr->ms_pull_ctl_disable_tbl = __device##_ms_pull_ctl_disable_tbl; \
} while (0)

/* generic operations */
int rtsx_gops_pm_reset(struct rtsx_pcr *pcr);

#endif
Loading