Merge tag 'trace-seq-buf-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/roste...
[cascardo/linux.git] / drivers / mfd / rtsx_gops.c
1 /* Driver for Realtek PCI-Express card reader
2  *
3  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2, or (at your option) any
8  * later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, see <http://www.gnu.org/licenses/>.
17  *
18  * Author:
19  *   Micky Ching <micky_ching@realsil.com.cn>
20  */
21
22 #include <linux/mfd/rtsx_pci.h>
23 #include "rtsx_pcr.h"
24
25 int rtsx_gops_pm_reset(struct rtsx_pcr *pcr)
26 {
27         int err;
28
29         /* init aspm */
30         rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00);
31         err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00);
32         if (err < 0)
33                 return err;
34
35         /* reset PM_CTRL3 before send buffer cmd */
36         return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
37 }