Changes in 4.9.137 bcache: fix miss key refill->end in writeback hwmon: (pmbus) Fix page count auto-detection. jffs2: free jffs2_sb_info through jffs2_kill_sb() pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges ipmi: Fix timer race with module unload parisc: Fix address in HPMC IVA parisc: Fix map_pages() to not overwrite existing pte entries ALSA: hda - Add quirk for ASUS G751 laptop ALSA: hda - Fix headphone pin config for ASUS G751 ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905) ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided x86/speculation: Support Enhanced IBRS on future CPUs bpf: do not blindly change rlimit in reuseport net selftest Revert "perf tools: Fix PMU term format max value calculation" xfrm: policy: use hlist rcu variants on insert sparc: Fix single-pcr perf event counter management. sparc64: Make proc_id signed. sched/fair: Fix the min_vruntime update logic in dequeue_entity() perf cpu_map: Align cpu map synthesized events properly. x86/fpu: Remove second definition of fpu in __fpu__restore_sig() net: qla3xxx: Remove overflowing shift statement selftests: ftrace: Add synthetic event syntax testcase i2c: rcar: cleanup DMA for all kinds of failure locking/lockdep: Fix debug_locks off performance problem ataflop: fix error handling during setup swim: fix cleanup on setup error tun: Consistently configure generic netdev params via rtnetlink s390/sthyi: Fix machine name validity indication hwmon: (pwm-fan) Set fan speed to 0 on suspend perf tools: Free temporary 'sys' string in read_event_files() perf tools: Cleanup trace-event-info 'tdata' leak perf strbuf: Match va_{add,copy} with va_end mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01 iwlwifi: pcie: avoid empty free RB queue x86/olpc: Indicate that legacy PC XO-1 platform should not register RTC cpufreq: dt: Try freeing static OPPs only if we have added them Bluetooth: btbcm: Add entry for BCM4335C0 UART bluetooth x86: boot: Fix EFI stub alignment pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux brcmfmac: fix for proper support of 160MHz bandwidth kprobes: Return error if we fail to reuse kprobe instead of BUG_ON() ACPI / LPSS: Add alternative ACPI HIDs for Cherry Trail DMA controllers pinctrl: qcom: spmi-mpp: Fix drive strength setting pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant ixgbevf: VF2VF TCP RSS ath10k: schedule hardware restart if WMI command times out cgroup, netclassid: add a preemption point to write_classid scsi: esp_scsi: Track residual for PIO transfers scsi: megaraid_sas: fix a missing-check bug RDMA/core: Do not expose unsupported counters IB/ipoib: Clear IPCB before icmp_send tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated VMCI: Resource wildcard match fixed usb: gadget: udc: atmel: handle at91sam9rl PMC ext4: fix argument checking in EXT4_IOC_MOVE_EXT MD: fix invalid stored role for a disk PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice coresight: etb10: Fix handling of perf mode crypto: caam - fix implicit casts in endianness helpers usb: chipidea: Prevent unbalanced IRQ disable driver/dma/ioat: Call del_timer_sync() without holding prep_lock uio: ensure class is registered before devices scsi: lpfc: Correct soft lockup when running mds diagnostics signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init dmaengine: dma-jz4780: Return error if not probed from DT ALSA: hda: Check the non-cached stream buffers more explicitly ARM: dts: exynos: Remove "cooling-{min|max}-level" for CPU nodes arm: dts: exynos: Add missing cooling device properties for CPUs ARM: dts: exynos: Convert exynos5250.dtsi to opp-v2 bindings ARM: dts: exynos: Mark 1 GHz CPU OPP as suspend OPP on Exynos5250 xen-swiotlb: use actually allocated size on check physical continuous tpm: Restore functionality to xen vtpm driver. xen/blkfront: avoid NULL blkfront_info dereference on device removal xen: fix race in xen_qlock_wait() xen: make xen_qlock_wait() nestable libertas: don't set URB_ZERO_PACKET on IN USB transfer usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten iwlwifi: mvm: check return value of rs_rate_from_ucode_rate() net/ipv4: defensive cipso option parsing libnvdimm: Hold reference on parent while scheduling async init ASoC: intel: skylake: Add missing break in skl_tplg_get_token() jbd2: fix use after free in jbd2_log_do_checkpoint() gfs2_meta: ->mount() can get NULL dev_name ext4: initialize retries variable in ext4_da_write_inline_data_begin() ext4: propagate error from dquot_initialize() in EXT4_IOC_FSSETXATTR HID: hiddev: fix potential Spectre v1 EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting EDAC, skx_edac: Fix logical channel intermediate decoding PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk signal/GenWQE: Fix sending of SIGKILL crypto: lrw - Fix out-of bounds access on counter overflow crypto: tcrypt - fix ghash-generic speed test ima: fix showing large 'violations' or 'runtime_measurements_count' hugetlbfs: dirty pages as they are added to pagecache kbuild: fix kernel/bounds.c 'W=1' warning iio: ad5064: Fix regulator handling iio: adc: imx25-gcq: Fix leak of device_node in mx25_gcq_setup_cfgs() iio: adc: at91: fix acking DRDY irq on simple conversions iio: adc: at91: fix wrong channel number in triggered buffer mode w1: omap-hdq: fix missing bus unregister at removal smb3: allow stats which track session and share reconnects to be reset smb3: do not attempt cifs operation in smb3 query info error path smb3: on kerberos mount if server doesn't specify auth type use krb5 printk: Fix panic caused by passing log_buf_len to command line genirq: Fix race on spurious interrupt detection NFSv4.1: Fix the r/wsize checking nfsd: Fix an Oops in free_session() lockd: fix access beyond unterminated strings in prints dm ioctl: harden copy_params()'s copy_from_user() from malicious users powerpc/msi: Fix compile error on mpc83xx MIPS: OCTEON: fix out of bounds array access on CN68XX TC: Set DMA masks for devices media: v4l2-tpg: fix kernel oops when enabling HFLIP and OSD kgdboc: Passing ekgdboc to command line causes panic xen: fix xen_qlock_wait() media: em28xx: use a default format if TRY_FMT fails media: tvp5150: avoid going past array on v4l2_querymenu() media: em28xx: fix input name for Terratec AV 350 media: em28xx: make v4l2-compliance happier by starting sequence on zero arm64: lse: remove -fcall-used-x0 flag rpmsg: smd: fix memory leak on channel create Cramfs: fix abad comparison when wrap-arounds occur arm64: dts: stratix10: Correct System Manager register size soc/tegra: pmc: Fix child-node lookup btrfs: Handle owner mismatch gracefully when walking up tree btrfs: locking: Add extra check in btrfs_init_new_buffer() to avoid deadlock btrfs: fix error handling in free_log_tree btrfs: iterate all devices during trim, instead of fs_devices::alloc_list btrfs: don't attempt to trim devices that don't support it btrfs: wait on caching when putting the bg cache btrfs: reset max_extent_size on clear in a bitmap btrfs: make sure we create all new block groups Btrfs: fix wrong dentries after fsync of file that got its parent replaced btrfs: qgroup: Dirty all qgroups before rescan Btrfs: fix null pointer dereference on compressed write path error btrfs: set max_extent_size properly MD: fix invalid stored role for a disk - try2 Linux 4.9.137 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
395 lines
10 KiB
C
395 lines
10 KiB
C
/*
|
|
* Copyright (C) 2013 BayHub Technology Ltd.
|
|
*
|
|
* Authors: Peter Guo <peter.guo@bayhubtech.com>
|
|
* Adam Lee <adam.lee@canonical.com>
|
|
*
|
|
* This software is licensed under the terms of the GNU General Public
|
|
* License version 2, as published by the Free Software Foundation, and
|
|
* may be copied, distributed, and modified under those terms.
|
|
*
|
|
* 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.
|
|
*
|
|
*/
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include "sdhci.h"
|
|
#include "sdhci-pci.h"
|
|
#include "sdhci-pci-o2micro.h"
|
|
|
|
static void o2_pci_set_baseclk(struct sdhci_pci_chip *chip, u32 value)
|
|
{
|
|
u32 scratch_32;
|
|
pci_read_config_dword(chip->pdev,
|
|
O2_SD_PLL_SETTING, &scratch_32);
|
|
|
|
scratch_32 &= 0x0000FFFF;
|
|
scratch_32 |= value;
|
|
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_PLL_SETTING, scratch_32);
|
|
}
|
|
|
|
static void o2_pci_led_enable(struct sdhci_pci_chip *chip)
|
|
{
|
|
int ret;
|
|
u32 scratch_32;
|
|
|
|
/* Set led of SD host function enable */
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_FUNC_REG0, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
|
|
scratch_32 &= ~O2_SD_FREG0_LEDOFF;
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_FUNC_REG0, scratch_32);
|
|
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_TEST_REG, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
|
|
scratch_32 |= O2_SD_LED_ENABLE;
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_TEST_REG, scratch_32);
|
|
|
|
}
|
|
|
|
static void sdhci_pci_o2_fujin2_pci_init(struct sdhci_pci_chip *chip)
|
|
{
|
|
u32 scratch_32;
|
|
int ret;
|
|
/* Improve write performance for SD3.0 */
|
|
ret = pci_read_config_dword(chip->pdev, O2_SD_DEV_CTRL, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~((1 << 12) | (1 << 13) | (1 << 14));
|
|
pci_write_config_dword(chip->pdev, O2_SD_DEV_CTRL, scratch_32);
|
|
|
|
/* Enable Link abnormal reset generating Reset */
|
|
ret = pci_read_config_dword(chip->pdev, O2_SD_MISC_REG5, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~((1 << 19) | (1 << 11));
|
|
scratch_32 |= (1 << 10);
|
|
pci_write_config_dword(chip->pdev, O2_SD_MISC_REG5, scratch_32);
|
|
|
|
/* set card power over current protection */
|
|
ret = pci_read_config_dword(chip->pdev, O2_SD_TEST_REG, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 |= (1 << 4);
|
|
pci_write_config_dword(chip->pdev, O2_SD_TEST_REG, scratch_32);
|
|
|
|
/* adjust the output delay for SD mode */
|
|
pci_write_config_dword(chip->pdev, O2_SD_DELAY_CTRL, 0x00002492);
|
|
|
|
/* Set the output voltage setting of Aux 1.2v LDO */
|
|
ret = pci_read_config_dword(chip->pdev, O2_SD_LD0_CTRL, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~(3 << 12);
|
|
pci_write_config_dword(chip->pdev, O2_SD_LD0_CTRL, scratch_32);
|
|
|
|
/* Set Max power supply capability of SD host */
|
|
ret = pci_read_config_dword(chip->pdev, O2_SD_CAP_REG0, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~(0x01FE);
|
|
scratch_32 |= 0x00CC;
|
|
pci_write_config_dword(chip->pdev, O2_SD_CAP_REG0, scratch_32);
|
|
/* Set DLL Tuning Window */
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_TUNING_CTRL, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~(0x000000FF);
|
|
scratch_32 |= 0x00000066;
|
|
pci_write_config_dword(chip->pdev, O2_SD_TUNING_CTRL, scratch_32);
|
|
|
|
/* Set UHS2 T_EIDLE */
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_UHS2_L1_CTRL, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~(0x000000FC);
|
|
scratch_32 |= 0x00000084;
|
|
pci_write_config_dword(chip->pdev, O2_SD_UHS2_L1_CTRL, scratch_32);
|
|
|
|
/* Set UHS2 Termination */
|
|
ret = pci_read_config_dword(chip->pdev, O2_SD_FUNC_REG3, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~((1 << 21) | (1 << 30));
|
|
|
|
pci_write_config_dword(chip->pdev, O2_SD_FUNC_REG3, scratch_32);
|
|
|
|
/* Set L1 Entrance Timer */
|
|
ret = pci_read_config_dword(chip->pdev, O2_SD_CAPS, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~(0xf0000000);
|
|
scratch_32 |= 0x30000000;
|
|
pci_write_config_dword(chip->pdev, O2_SD_CAPS, scratch_32);
|
|
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_MISC_CTRL4, &scratch_32);
|
|
if (ret)
|
|
return;
|
|
scratch_32 &= ~(0x000f0000);
|
|
scratch_32 |= 0x00080000;
|
|
pci_write_config_dword(chip->pdev, O2_SD_MISC_CTRL4, scratch_32);
|
|
}
|
|
|
|
int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot)
|
|
{
|
|
struct sdhci_pci_chip *chip;
|
|
struct sdhci_host *host;
|
|
u32 reg;
|
|
|
|
chip = slot->chip;
|
|
host = slot->host;
|
|
switch (chip->pdev->device) {
|
|
case PCI_DEVICE_ID_O2_SDS0:
|
|
case PCI_DEVICE_ID_O2_SEABIRD0:
|
|
case PCI_DEVICE_ID_O2_SEABIRD1:
|
|
case PCI_DEVICE_ID_O2_SDS1:
|
|
case PCI_DEVICE_ID_O2_FUJIN2:
|
|
reg = sdhci_readl(host, O2_SD_VENDOR_SETTING);
|
|
if (reg & 0x1)
|
|
host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
|
|
|
|
if (chip->pdev->device != PCI_DEVICE_ID_O2_FUJIN2)
|
|
break;
|
|
/* set dll watch dog timer */
|
|
reg = sdhci_readl(host, O2_SD_VENDOR_SETTING2);
|
|
reg |= (1 << 12);
|
|
sdhci_writel(host, reg, O2_SD_VENDOR_SETTING2);
|
|
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
|
|
{
|
|
int ret;
|
|
u8 scratch;
|
|
u32 scratch_32;
|
|
|
|
switch (chip->pdev->device) {
|
|
case PCI_DEVICE_ID_O2_8220:
|
|
case PCI_DEVICE_ID_O2_8221:
|
|
case PCI_DEVICE_ID_O2_8320:
|
|
case PCI_DEVICE_ID_O2_8321:
|
|
/* This extra setup is required due to broken ADMA. */
|
|
ret = pci_read_config_byte(chip->pdev,
|
|
O2_SD_LOCK_WP, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
scratch &= 0x7f;
|
|
pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
|
|
|
|
/* Set Multi 3 to VCC3V# */
|
|
pci_write_config_byte(chip->pdev, O2_SD_MULTI_VCC3V, 0x08);
|
|
|
|
/* Disable CLK_REQ# support after media DET */
|
|
ret = pci_read_config_byte(chip->pdev,
|
|
O2_SD_CLKREQ, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
scratch |= 0x20;
|
|
pci_write_config_byte(chip->pdev, O2_SD_CLKREQ, scratch);
|
|
|
|
/* Choose capabilities, enable SDMA. We have to write 0x01
|
|
* to the capabilities register first to unlock it.
|
|
*/
|
|
ret = pci_read_config_byte(chip->pdev, O2_SD_CAPS, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
scratch |= 0x01;
|
|
pci_write_config_byte(chip->pdev, O2_SD_CAPS, scratch);
|
|
pci_write_config_byte(chip->pdev, O2_SD_CAPS, 0x73);
|
|
|
|
/* Disable ADMA1/2 */
|
|
pci_write_config_byte(chip->pdev, O2_SD_ADMA1, 0x39);
|
|
pci_write_config_byte(chip->pdev, O2_SD_ADMA2, 0x08);
|
|
|
|
/* Disable the infinite transfer mode */
|
|
ret = pci_read_config_byte(chip->pdev,
|
|
O2_SD_INF_MOD, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
scratch |= 0x08;
|
|
pci_write_config_byte(chip->pdev, O2_SD_INF_MOD, scratch);
|
|
|
|
/* Lock WP */
|
|
ret = pci_read_config_byte(chip->pdev,
|
|
O2_SD_LOCK_WP, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
scratch |= 0x80;
|
|
pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
|
|
break;
|
|
case PCI_DEVICE_ID_O2_SDS0:
|
|
case PCI_DEVICE_ID_O2_SDS1:
|
|
case PCI_DEVICE_ID_O2_FUJIN2:
|
|
/* UnLock WP */
|
|
ret = pci_read_config_byte(chip->pdev,
|
|
O2_SD_LOCK_WP, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
|
|
scratch &= 0x7f;
|
|
pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
|
|
|
|
/* DevId=8520 subId= 0x11 or 0x12 Type Chip support */
|
|
if (chip->pdev->device == PCI_DEVICE_ID_O2_FUJIN2) {
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_FUNC_REG0,
|
|
&scratch_32);
|
|
scratch_32 = ((scratch_32 & 0xFF000000) >> 24);
|
|
|
|
/* Check Whether subId is 0x11 or 0x12 */
|
|
if ((scratch_32 == 0x11) || (scratch_32 == 0x12)) {
|
|
scratch_32 = 0x2c280000;
|
|
|
|
/* Set Base Clock to 208MZ */
|
|
o2_pci_set_baseclk(chip, scratch_32);
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_FUNC_REG4,
|
|
&scratch_32);
|
|
|
|
/* Enable Base Clk setting change */
|
|
scratch_32 |= O2_SD_FREG4_ENABLE_CLK_SET;
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_FUNC_REG4,
|
|
scratch_32);
|
|
|
|
/* Set Tuning Window to 4 */
|
|
pci_write_config_byte(chip->pdev,
|
|
O2_SD_TUNING_CTRL, 0x44);
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
/* Enable 8520 led function */
|
|
o2_pci_led_enable(chip);
|
|
|
|
/* Set timeout CLK */
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_CLK_SETTING, &scratch_32);
|
|
if (ret)
|
|
return ret;
|
|
|
|
scratch_32 &= ~(0xFF00);
|
|
scratch_32 |= 0x07E0C800;
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_CLK_SETTING, scratch_32);
|
|
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_CLKREQ, &scratch_32);
|
|
if (ret)
|
|
return ret;
|
|
scratch_32 |= 0x3;
|
|
pci_write_config_dword(chip->pdev, O2_SD_CLKREQ, scratch_32);
|
|
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_PLL_SETTING, &scratch_32);
|
|
if (ret)
|
|
return ret;
|
|
|
|
scratch_32 &= ~(0x1F3F070E);
|
|
scratch_32 |= 0x18270106;
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_PLL_SETTING, scratch_32);
|
|
|
|
/* Disable UHS1 funciton */
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_CAP_REG2, &scratch_32);
|
|
if (ret)
|
|
return ret;
|
|
scratch_32 &= ~(0xE0);
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_CAP_REG2, scratch_32);
|
|
|
|
if (chip->pdev->device == PCI_DEVICE_ID_O2_FUJIN2)
|
|
sdhci_pci_o2_fujin2_pci_init(chip);
|
|
|
|
/* Lock WP */
|
|
ret = pci_read_config_byte(chip->pdev,
|
|
O2_SD_LOCK_WP, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
scratch |= 0x80;
|
|
pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
|
|
break;
|
|
case PCI_DEVICE_ID_O2_SEABIRD0:
|
|
if (chip->pdev->revision == 0x01)
|
|
chip->quirks |= SDHCI_QUIRK_DELAY_AFTER_POWER;
|
|
/* fall through */
|
|
case PCI_DEVICE_ID_O2_SEABIRD1:
|
|
/* UnLock WP */
|
|
ret = pci_read_config_byte(chip->pdev,
|
|
O2_SD_LOCK_WP, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
|
|
scratch &= 0x7f;
|
|
pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
|
|
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_PLL_SETTING, &scratch_32);
|
|
|
|
if ((scratch_32 & 0xff000000) == 0x01000000) {
|
|
scratch_32 &= 0x0000FFFF;
|
|
scratch_32 |= 0x1F340000;
|
|
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_PLL_SETTING, scratch_32);
|
|
} else {
|
|
scratch_32 &= 0x0000FFFF;
|
|
scratch_32 |= 0x2c280000;
|
|
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_PLL_SETTING, scratch_32);
|
|
|
|
ret = pci_read_config_dword(chip->pdev,
|
|
O2_SD_FUNC_REG4,
|
|
&scratch_32);
|
|
scratch_32 |= (1 << 22);
|
|
pci_write_config_dword(chip->pdev,
|
|
O2_SD_FUNC_REG4, scratch_32);
|
|
}
|
|
|
|
/* Set Tuning Windows to 5 */
|
|
pci_write_config_byte(chip->pdev,
|
|
O2_SD_TUNING_CTRL, 0x55);
|
|
/* Lock WP */
|
|
ret = pci_read_config_byte(chip->pdev,
|
|
O2_SD_LOCK_WP, &scratch);
|
|
if (ret)
|
|
return ret;
|
|
scratch |= 0x80;
|
|
pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int sdhci_pci_o2_resume(struct sdhci_pci_chip *chip)
|
|
{
|
|
sdhci_pci_o2_probe(chip);
|
|
return 0;
|
|
}
|