| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#include <console/console.h> |
| 6 |
#include <device/device.h> |
| 7 |
#include <device/pci.h> |
| 8 |
#include <device/pciexp.h> |
| 9 |
#include <device/pci_ops.h> |
| 10 |
#include <device/pci_ids.h> |
| 11 |
#include "gl9763e.h" |
| 12 |
|
| 13 |
static void gl9763e_init(struct device *dev) |
| 14 |
{ |
| 15 |
uint32_t ver, value; |
| 16 |
int aer; |
| 17 |
|
| 18 |
printk(BIOS_INFO, "GL9763E: init\n"); |
| 19 |
pci_dev_init(dev); |
| 20 |
|
| 21 |
|
| 22 |
pci_update_config32(dev, VHS, ~VHS_REV_MASK, VHS_REV_W); |
| 23 |
|
| 24 |
pci_or_config32(dev, SCR, SCR_AXI_REQ); |
| 25 |
|
| 26 |
pci_and_config32(dev, CFG_REG_2, ~CFG_REG_2_L0S); |
| 27 |
|
| 28 |
if (CONFIG(DRIVERS_GENESYSLOGIC_GL9763E_L1_MAX)) |
| 29 |
|
| 30 |
pci_or_config32(dev, CFG_REG_2, CFG_REG_2_L1DLY_MAX); |
| 31 |
|
| 32 |
|
| 33 |
pci_update_config32(dev, PLL_CTL_2, ~PLL_CTL_2_MAX_SSC_MASK, MAX_SSC_30000PPM); |
| 34 |
|
| 35 |
pci_or_config32(dev, PLL_CTL, PLL_CTL_SSC); |
| 36 |
|
| 37 |
ver = pci_read_config32(dev, HW_VER_2); |
| 38 |
if ((ver & HW_VER_MASK) == REVISION_03) { |
| 39 |
|
| 40 |
pci_update_config32(dev, SD_CLKRX_DLY, ~CLK_SRC_MASK, AFTER_OUTPUT_BUFF); |
| 41 |
} |
| 42 |
|
| 43 |
pci_update_config32(dev, SD_CLKRX_DLY, ~HS400_RX_DELAY_MASK, HS400_RX_DELAY); |
| 44 |
|
| 45 |
pci_and_config32(dev, EMMC_CTL, ~SLOW_MODE); |
| 46 |
|
| 47 |
aer = pciexp_find_extended_cap(dev, PCI_EXT_CAP_ID_ERR, 0); |
| 48 |
if (aer) { |
| 49 |
value = pci_read_config32(dev, aer + PCI_ERR_COR_MASK); |
| 50 |
value |= PCI_ERR_COR_REP_TIMER; |
| 51 |
pci_write_config32(dev, aer + PCI_ERR_COR_MASK, value); |
| 52 |
} |
| 53 |
|
| 54 |
pci_update_config32(dev, VHS, ~VHS_REV_MASK, VHS_REV_R); |
| 55 |
} |
| 56 |
|
| 57 |
static struct device_operations gl9763e_ops = { |
| 58 |
.read_resources = pci_dev_read_resources, |
| 59 |
.set_resources = pci_dev_set_resources, |
| 60 |
.enable_resources = pci_dev_enable_resources, |
| 61 |
.ops_pci = &pci_dev_ops_pci, |
| 62 |
.init = gl9763e_init, |
| 63 |
}; |
| 64 |
|
| 65 |
static const unsigned short pci_device_ids[] = { |
| 66 |
PCI_DID_GLI_9763E, |
| 67 |
0 |
| 68 |
}; |
| 69 |
|
| 70 |
static const struct pci_driver genesyslogic_gl9763e __pci_driver = { |
| 71 |
.ops = &gl9763e_ops, |
| 72 |
.vendor = PCI_VID_GLI, |
| 73 |
.devices = pci_device_ids, |
| 74 |
}; |
| 75 |
|
| 76 |
struct chip_operations drivers_generic_genesyslogic_ops = { |
| 77 |
.name = "Genesys Logic GL9763E", |
| 78 |
}; |