18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Broadcom specific AMBA
38c2ecf20Sopenharmony_ci * PCI Core
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2005, 2011, Broadcom Corporation
68c2ecf20Sopenharmony_ci * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
78c2ecf20Sopenharmony_ci * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de>
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Licensed under the GNU/GPL. See COPYING for details.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "bcma_private.h"
138c2ecf20Sopenharmony_ci#include <linux/export.h>
148c2ecf20Sopenharmony_ci#include <linux/bcma/bcma.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/**************************************************
178c2ecf20Sopenharmony_ci * R/W ops.
188c2ecf20Sopenharmony_ci **************************************************/
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciu32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_ADDR, address);
238c2ecf20Sopenharmony_ci	pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_ADDR);
248c2ecf20Sopenharmony_ci	return pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_DATA);
258c2ecf20Sopenharmony_ci}
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistatic void bcma_pcie_write(struct bcma_drv_pci *pc, u32 address, u32 data)
288c2ecf20Sopenharmony_ci{
298c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_ADDR, address);
308c2ecf20Sopenharmony_ci	pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_ADDR);
318c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_DATA, data);
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u16 phy)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	u32 v;
378c2ecf20Sopenharmony_ci	int i;
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	v = BCMA_CORE_PCI_MDIODATA_START;
408c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIODATA_WRITE;
418c2ecf20Sopenharmony_ci	v |= (BCMA_CORE_PCI_MDIODATA_DEV_ADDR <<
428c2ecf20Sopenharmony_ci	      BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF);
438c2ecf20Sopenharmony_ci	v |= (BCMA_CORE_PCI_MDIODATA_BLK_ADDR <<
448c2ecf20Sopenharmony_ci	      BCMA_CORE_PCI_MDIODATA_REGADDR_SHF);
458c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIODATA_TA;
468c2ecf20Sopenharmony_ci	v |= (phy << 4);
478c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	udelay(10);
508c2ecf20Sopenharmony_ci	for (i = 0; i < 200; i++) {
518c2ecf20Sopenharmony_ci		v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
528c2ecf20Sopenharmony_ci		if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE)
538c2ecf20Sopenharmony_ci			break;
548c2ecf20Sopenharmony_ci		usleep_range(1000, 2000);
558c2ecf20Sopenharmony_ci	}
568c2ecf20Sopenharmony_ci}
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistatic u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u16 device, u8 address)
598c2ecf20Sopenharmony_ci{
608c2ecf20Sopenharmony_ci	int max_retries = 10;
618c2ecf20Sopenharmony_ci	u16 ret = 0;
628c2ecf20Sopenharmony_ci	u32 v;
638c2ecf20Sopenharmony_ci	int i;
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	/* enable mdio access to SERDES */
668c2ecf20Sopenharmony_ci	v = BCMA_CORE_PCI_MDIOCTL_PREAM_EN;
678c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL;
688c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, v);
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	if (pc->core->id.rev >= 10) {
718c2ecf20Sopenharmony_ci		max_retries = 200;
728c2ecf20Sopenharmony_ci		bcma_pcie_mdio_set_phy(pc, device);
738c2ecf20Sopenharmony_ci		v = (BCMA_CORE_PCI_MDIODATA_DEV_ADDR <<
748c2ecf20Sopenharmony_ci		     BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF);
758c2ecf20Sopenharmony_ci		v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF);
768c2ecf20Sopenharmony_ci	} else {
778c2ecf20Sopenharmony_ci		v = (device << BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD);
788c2ecf20Sopenharmony_ci		v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD);
798c2ecf20Sopenharmony_ci	}
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIODATA_START;
828c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIODATA_READ;
838c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIODATA_TA;
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v);
868c2ecf20Sopenharmony_ci	/* Wait for the device to complete the transaction */
878c2ecf20Sopenharmony_ci	udelay(10);
888c2ecf20Sopenharmony_ci	for (i = 0; i < max_retries; i++) {
898c2ecf20Sopenharmony_ci		v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
908c2ecf20Sopenharmony_ci		if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE) {
918c2ecf20Sopenharmony_ci			udelay(10);
928c2ecf20Sopenharmony_ci			ret = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_DATA);
938c2ecf20Sopenharmony_ci			break;
948c2ecf20Sopenharmony_ci		}
958c2ecf20Sopenharmony_ci		usleep_range(1000, 2000);
968c2ecf20Sopenharmony_ci	}
978c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);
988c2ecf20Sopenharmony_ci	return ret;
998c2ecf20Sopenharmony_ci}
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_cistatic void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u16 device,
1028c2ecf20Sopenharmony_ci				u8 address, u16 data)
1038c2ecf20Sopenharmony_ci{
1048c2ecf20Sopenharmony_ci	int max_retries = 10;
1058c2ecf20Sopenharmony_ci	u32 v;
1068c2ecf20Sopenharmony_ci	int i;
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	/* enable mdio access to SERDES */
1098c2ecf20Sopenharmony_ci	v = BCMA_CORE_PCI_MDIOCTL_PREAM_EN;
1108c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL;
1118c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, v);
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	if (pc->core->id.rev >= 10) {
1148c2ecf20Sopenharmony_ci		max_retries = 200;
1158c2ecf20Sopenharmony_ci		bcma_pcie_mdio_set_phy(pc, device);
1168c2ecf20Sopenharmony_ci		v = (BCMA_CORE_PCI_MDIODATA_DEV_ADDR <<
1178c2ecf20Sopenharmony_ci		     BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF);
1188c2ecf20Sopenharmony_ci		v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF);
1198c2ecf20Sopenharmony_ci	} else {
1208c2ecf20Sopenharmony_ci		v = (device << BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD);
1218c2ecf20Sopenharmony_ci		v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD);
1228c2ecf20Sopenharmony_ci	}
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIODATA_START;
1258c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIODATA_WRITE;
1268c2ecf20Sopenharmony_ci	v |= BCMA_CORE_PCI_MDIODATA_TA;
1278c2ecf20Sopenharmony_ci	v |= data;
1288c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v);
1298c2ecf20Sopenharmony_ci	/* Wait for the device to complete the transaction */
1308c2ecf20Sopenharmony_ci	udelay(10);
1318c2ecf20Sopenharmony_ci	for (i = 0; i < max_retries; i++) {
1328c2ecf20Sopenharmony_ci		v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
1338c2ecf20Sopenharmony_ci		if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE)
1348c2ecf20Sopenharmony_ci			break;
1358c2ecf20Sopenharmony_ci		usleep_range(1000, 2000);
1368c2ecf20Sopenharmony_ci	}
1378c2ecf20Sopenharmony_ci	pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);
1388c2ecf20Sopenharmony_ci}
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_cistatic u16 bcma_pcie_mdio_writeread(struct bcma_drv_pci *pc, u16 device,
1418c2ecf20Sopenharmony_ci				    u8 address, u16 data)
1428c2ecf20Sopenharmony_ci{
1438c2ecf20Sopenharmony_ci	bcma_pcie_mdio_write(pc, device, address, data);
1448c2ecf20Sopenharmony_ci	return bcma_pcie_mdio_read(pc, device, address);
1458c2ecf20Sopenharmony_ci}
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/**************************************************
1488c2ecf20Sopenharmony_ci * Early init.
1498c2ecf20Sopenharmony_ci **************************************************/
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_cistatic void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc)
1528c2ecf20Sopenharmony_ci{
1538c2ecf20Sopenharmony_ci	struct bcma_device *core = pc->core;
1548c2ecf20Sopenharmony_ci	u16 val16, core_index;
1558c2ecf20Sopenharmony_ci	uint regoff;
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci	regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET);
1588c2ecf20Sopenharmony_ci	core_index = (u16)core->core_index;
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci	val16 = pcicore_read16(pc, regoff);
1618c2ecf20Sopenharmony_ci	if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT)
1628c2ecf20Sopenharmony_ci	     != core_index) {
1638c2ecf20Sopenharmony_ci		val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) |
1648c2ecf20Sopenharmony_ci			(val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK);
1658c2ecf20Sopenharmony_ci		pcicore_write16(pc, regoff, val16);
1668c2ecf20Sopenharmony_ci	}
1678c2ecf20Sopenharmony_ci}
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci/*
1708c2ecf20Sopenharmony_ci * Apply some early fixes required before accessing SPROM.
1718c2ecf20Sopenharmony_ci * See also si_pci_fixcfg.
1728c2ecf20Sopenharmony_ci */
1738c2ecf20Sopenharmony_civoid bcma_core_pci_early_init(struct bcma_drv_pci *pc)
1748c2ecf20Sopenharmony_ci{
1758c2ecf20Sopenharmony_ci	if (pc->early_setup_done)
1768c2ecf20Sopenharmony_ci		return;
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	pc->hostmode = bcma_core_pci_is_in_hostmode(pc);
1798c2ecf20Sopenharmony_ci	if (pc->hostmode)
1808c2ecf20Sopenharmony_ci		goto out;
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	bcma_core_pci_fixcfg(pc);
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ciout:
1858c2ecf20Sopenharmony_ci	pc->early_setup_done = true;
1868c2ecf20Sopenharmony_ci}
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci/**************************************************
1898c2ecf20Sopenharmony_ci * Workarounds.
1908c2ecf20Sopenharmony_ci **************************************************/
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_cistatic u8 bcma_pcicore_polarity_workaround(struct bcma_drv_pci *pc)
1938c2ecf20Sopenharmony_ci{
1948c2ecf20Sopenharmony_ci	u32 tmp;
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci	tmp = bcma_pcie_read(pc, BCMA_CORE_PCI_PLP_STATUSREG);
1978c2ecf20Sopenharmony_ci	if (tmp & BCMA_CORE_PCI_PLP_POLARITYINV_STAT)
1988c2ecf20Sopenharmony_ci		return BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE |
1998c2ecf20Sopenharmony_ci		       BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY;
2008c2ecf20Sopenharmony_ci	else
2018c2ecf20Sopenharmony_ci		return BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE;
2028c2ecf20Sopenharmony_ci}
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_cistatic void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc)
2058c2ecf20Sopenharmony_ci{
2068c2ecf20Sopenharmony_ci	u16 tmp;
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci	bcma_pcie_mdio_write(pc, BCMA_CORE_PCI_MDIODATA_DEV_RX,
2098c2ecf20Sopenharmony_ci	                     BCMA_CORE_PCI_SERDES_RX_CTRL,
2108c2ecf20Sopenharmony_ci			     bcma_pcicore_polarity_workaround(pc));
2118c2ecf20Sopenharmony_ci	tmp = bcma_pcie_mdio_read(pc, BCMA_CORE_PCI_MDIODATA_DEV_PLL,
2128c2ecf20Sopenharmony_ci	                          BCMA_CORE_PCI_SERDES_PLL_CTRL);
2138c2ecf20Sopenharmony_ci	if (tmp & BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN)
2148c2ecf20Sopenharmony_ci		bcma_pcie_mdio_write(pc, BCMA_CORE_PCI_MDIODATA_DEV_PLL,
2158c2ecf20Sopenharmony_ci		                     BCMA_CORE_PCI_SERDES_PLL_CTRL,
2168c2ecf20Sopenharmony_ci		                     tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN);
2178c2ecf20Sopenharmony_ci}
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci/* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */
2208c2ecf20Sopenharmony_ci/* Needs to happen when coming out of 'standby'/'hibernate' */
2218c2ecf20Sopenharmony_cistatic void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc)
2228c2ecf20Sopenharmony_ci{
2238c2ecf20Sopenharmony_ci	u16 val16;
2248c2ecf20Sopenharmony_ci	uint regoff;
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci	regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_MISC_CONFIG);
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	val16 = pcicore_read16(pc, regoff);
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci	if (!(val16 & BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST)) {
2318c2ecf20Sopenharmony_ci		val16 |= BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST;
2328c2ecf20Sopenharmony_ci		pcicore_write16(pc, regoff, val16);
2338c2ecf20Sopenharmony_ci	}
2348c2ecf20Sopenharmony_ci}
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci/**************************************************
2378c2ecf20Sopenharmony_ci * Init.
2388c2ecf20Sopenharmony_ci **************************************************/
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_cistatic void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc)
2418c2ecf20Sopenharmony_ci{
2428c2ecf20Sopenharmony_ci	bcma_pcicore_serdes_workaround(pc);
2438c2ecf20Sopenharmony_ci	bcma_core_pci_config_fixup(pc);
2448c2ecf20Sopenharmony_ci}
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_civoid bcma_core_pci_init(struct bcma_drv_pci *pc)
2478c2ecf20Sopenharmony_ci{
2488c2ecf20Sopenharmony_ci	if (pc->setup_done)
2498c2ecf20Sopenharmony_ci		return;
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci	bcma_core_pci_early_init(pc);
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci	if (pc->hostmode)
2548c2ecf20Sopenharmony_ci		bcma_core_pci_hostmode_init(pc);
2558c2ecf20Sopenharmony_ci	else
2568c2ecf20Sopenharmony_ci		bcma_core_pci_clientmode_init(pc);
2578c2ecf20Sopenharmony_ci}
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_civoid bcma_core_pci_power_save(struct bcma_bus *bus, bool up)
2608c2ecf20Sopenharmony_ci{
2618c2ecf20Sopenharmony_ci	struct bcma_drv_pci *pc;
2628c2ecf20Sopenharmony_ci	u16 data;
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci	if (bus->hosttype != BCMA_HOSTTYPE_PCI)
2658c2ecf20Sopenharmony_ci		return;
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci	pc = &bus->drv_pci[0];
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	if (pc->core->id.rev >= 15 && pc->core->id.rev <= 20) {
2708c2ecf20Sopenharmony_ci		data = up ? 0x74 : 0x7C;
2718c2ecf20Sopenharmony_ci		bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1,
2728c2ecf20Sopenharmony_ci					 BCMA_CORE_PCI_MDIO_BLK1_MGMT1, 0x7F64);
2738c2ecf20Sopenharmony_ci		bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1,
2748c2ecf20Sopenharmony_ci					 BCMA_CORE_PCI_MDIO_BLK1_MGMT3, data);
2758c2ecf20Sopenharmony_ci	} else if (pc->core->id.rev >= 21 && pc->core->id.rev <= 22) {
2768c2ecf20Sopenharmony_ci		data = up ? 0x75 : 0x7D;
2778c2ecf20Sopenharmony_ci		bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1,
2788c2ecf20Sopenharmony_ci					 BCMA_CORE_PCI_MDIO_BLK1_MGMT1, 0x7E65);
2798c2ecf20Sopenharmony_ci		bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1,
2808c2ecf20Sopenharmony_ci					 BCMA_CORE_PCI_MDIO_BLK1_MGMT3, data);
2818c2ecf20Sopenharmony_ci	}
2828c2ecf20Sopenharmony_ci}
2838c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_cistatic void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
2868c2ecf20Sopenharmony_ci{
2878c2ecf20Sopenharmony_ci	u32 w;
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci	w = bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
2908c2ecf20Sopenharmony_ci	if (extend)
2918c2ecf20Sopenharmony_ci		w |= BCMA_CORE_PCI_ASPMTIMER_EXTEND;
2928c2ecf20Sopenharmony_ci	else
2938c2ecf20Sopenharmony_ci		w &= ~BCMA_CORE_PCI_ASPMTIMER_EXTEND;
2948c2ecf20Sopenharmony_ci	bcma_pcie_write(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG, w);
2958c2ecf20Sopenharmony_ci	bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
2968c2ecf20Sopenharmony_ci}
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_civoid bcma_core_pci_up(struct bcma_drv_pci *pc)
2998c2ecf20Sopenharmony_ci{
3008c2ecf20Sopenharmony_ci	bcma_core_pci_extend_L1timer(pc, true);
3018c2ecf20Sopenharmony_ci}
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_civoid bcma_core_pci_down(struct bcma_drv_pci *pc)
3048c2ecf20Sopenharmony_ci{
3058c2ecf20Sopenharmony_ci	bcma_core_pci_extend_L1timer(pc, false);
3068c2ecf20Sopenharmony_ci}
307