/* * We need to determine the value of the multiplier (MPY) bits. * In order to include the 12.5 multiplier we need to first divide * the refclk rate by ten. * * __div64_32() turned out to be unreliable, sometimes returning * false results.
*/
WARN((refclk_rate % 10) != 0, "refclk must be divisible by 10");
needed = pll_output / (refclk_rate / 10);
/* * What we have now is (multiplier * 10). * * Let's determine the actual register value we need to write.
*/
switch (needed) { case 50: return 0x1; case 60: return 0x2; case 80: return 0x4; case 100: return 0x5; case 120: return 0x6; case 125: return 0x7; case 150: return 0x8; case 200: return 0x9; case 250: return 0xa; default: /* * We should have divided evenly - if not, return an invalid * value.
*/ return 0;
}
}
/* * There's an issue with the SATA controller on da850 SoCs: if we * enable Port Multiplier support, but the drive is connected directly * to the board, it can't be detected. As a workaround: if PMP is * enabled, we first call ahci_do_softreset() and pass it the result of * sata_srst_pmp(). If this call fails, we retry with pmp = 0.
*/
ret = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready); if (pmp && ret == -EBUSY) return ahci_do_softreset(link, class, 0,
deadline, ahci_check_ready);
/* * In order to correctly service the LCD controller of the da850 SoC, * we increased the PLL0 frequency to 456MHz from the default 300MHz. * * This made the SATA controller unstable and the hardreset operation * does not always succeed the first time. Before really giving up to * bring up the link, retry the reset a couple times.
*/ do {
ret = ahci_do_hardreset(link, class, deadline, &online); if (online) return ret;
} while (retry--);
return ret;
}
staticstruct ata_port_operations ahci_da850_port_ops = {
.inherits = &ahci_platform_ops,
.reset.softreset = ahci_da850_softreset, /* * No need to override .pmp_softreset - it's only used for actual * PMP-enabled ports.
*/
.reset.hardreset = ahci_da850_hardreset,
.pmp_reset.hardreset = ahci_da850_hardreset,
};
hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv);
/* * Internally ahci_platform_get_resources() calls the bulk clocks * get method or falls back to using a single clk_get_optional(). * This AHCI SATA controller uses two clocks: functional clock * with "fck" connection id and external reference clock with * "refclk" id. If we haven't got all of them re-try the clocks * getting procedure with the explicitly specified ids.
*/ if (hpriv->n_clks < 2) {
hpriv->clks = devm_kcalloc(dev, 2, sizeof(*hpriv->clks), GFP_KERNEL); if (!hpriv->clks) return -ENOMEM;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.