Lines Matching +full:sata +full:- +full:oob
1 /*-
207 #define AHCI_WR4(_sc, _r, _v) bus_write_4((_sc)->ctlr.r_mem, (_r), (_v))
208 #define AHCI_RD4(_sc, _r) bus_read_4((_sc)->ctlr.r_mem, (_r))
209 #define SATA_WR4(_sc, _r, _v) bus_write_4((_sc)->sata_mem, (_r), (_v))
210 #define SATA_RD4(_sc, _r) bus_read_4((_sc)->sata_mem, (_r))
251 "hvdd-supply",
252 "vddio-supply",
253 "avdd-supply",
254 "target-5v-supply",
255 "target-12v-supply",
276 {"nvidia,tegra124-ahci", (uintptr_t)&tegra124_soc},
277 {"nvidia,tegra210-ahci", (uintptr_t)&tegra210_soc},
287 for (i = 0; sc->soc->regulator_names[i] != NULL; i++) { in get_fdt_resources()
288 if (i >= nitems(sc->regulators)) { in get_fdt_resources()
289 device_printf(sc->dev, in get_fdt_resources()
293 rv = regulator_get_by_ofw_property(sc->dev, 0, in get_fdt_resources()
294 sc->soc->regulator_names[i], sc->regulators + i); in get_fdt_resources()
296 device_printf(sc->dev, in get_fdt_resources()
298 sc->soc->regulator_names[i]); in get_fdt_resources()
304 rv = hwreset_get_by_ofw_name(sc->dev, 0, "sata", &sc->hwreset_sata ); in get_fdt_resources()
306 device_printf(sc->dev, "Cannot get 'sata' reset\n"); in get_fdt_resources()
309 rv = hwreset_get_by_ofw_name(sc->dev, 0, "sata-oob", in get_fdt_resources()
310 &sc->hwreset_sata_oob); in get_fdt_resources()
312 device_printf(sc->dev, "Cannot get 'sata oob' reset\n"); in get_fdt_resources()
315 rv = hwreset_get_by_ofw_name(sc->dev, 0, "sata-cold", in get_fdt_resources()
316 &sc->hwreset_sata_cold); in get_fdt_resources()
318 device_printf(sc->dev, "Cannot get 'sata cold' reset\n"); in get_fdt_resources()
323 rv = phy_get_by_ofw_name(sc->dev, 0, "sata-0", &sc->phy); in get_fdt_resources()
325 rv = phy_get_by_ofw_idx(sc->dev, 0, 0, &sc->phy); in get_fdt_resources()
327 device_printf(sc->dev, "Cannot get 'sata' phy\n"); in get_fdt_resources()
333 rv = clk_get_by_ofw_name(sc->dev, 0, "sata", &sc->clk_sata); in get_fdt_resources()
335 device_printf(sc->dev, "Cannot get 'sata' clock\n"); in get_fdt_resources()
338 rv = clk_get_by_ofw_name(sc->dev, 0, "sata-oob", &sc->clk_sata_oob); in get_fdt_resources()
340 device_printf(sc->dev, "Cannot get 'sata oob' clock\n"); in get_fdt_resources()
344 rv = clk_get_by_ofw_name(sc->dev, 0, "cml1", &sc->clk_cml); in get_fdt_resources()
346 sc->clk_cml = NULL; in get_fdt_resources()
348 rv = clk_get_by_ofw_name(sc->dev, 0, "pll_e", &sc->clk_pll_e); in get_fdt_resources()
350 sc->clk_pll_e = NULL; in get_fdt_resources()
360 for (i = 0; i < nitems(sc->regulators); i++) { in enable_fdt_resources()
361 if (sc->regulators[i] == NULL) in enable_fdt_resources()
363 rv = regulator_enable(sc->regulators[i]); in enable_fdt_resources()
365 device_printf(sc->dev, in enable_fdt_resources()
367 sc->soc->regulator_names[i]); in enable_fdt_resources()
373 clk_stop(sc->clk_sata); in enable_fdt_resources()
374 clk_stop(sc->clk_sata_oob); in enable_fdt_resources()
377 rv = hwreset_assert(sc->hwreset_sata); in enable_fdt_resources()
379 device_printf(sc->dev, "Cannot assert 'sata' reset\n"); in enable_fdt_resources()
382 rv = hwreset_assert(sc->hwreset_sata_oob); in enable_fdt_resources()
384 device_printf(sc->dev, "Cannot assert 'sata oob' reset\n"); in enable_fdt_resources()
388 rv = hwreset_assert(sc->hwreset_sata_cold); in enable_fdt_resources()
390 device_printf(sc->dev, "Cannot assert 'sata cold' reset\n"); in enable_fdt_resources()
394 sc->clk_sata, sc->hwreset_sata); in enable_fdt_resources()
396 device_printf(sc->dev, "Cannot enable 'SAX' powergate\n"); in enable_fdt_resources()
400 rv = clk_enable(sc->clk_sata_oob); in enable_fdt_resources()
402 device_printf(sc->dev, "Cannot enable 'sata oob' clock\n"); in enable_fdt_resources()
405 if (sc->clk_cml != NULL) { in enable_fdt_resources()
406 rv = clk_enable(sc->clk_cml); in enable_fdt_resources()
408 device_printf(sc->dev, "Cannot enable 'cml' clock\n"); in enable_fdt_resources()
412 if (sc->clk_pll_e != NULL) { in enable_fdt_resources()
413 rv = clk_enable(sc->clk_pll_e); in enable_fdt_resources()
415 device_printf(sc->dev, "Cannot enable 'pll e' clock\n"); in enable_fdt_resources()
420 rv = hwreset_deassert(sc->hwreset_sata_cold); in enable_fdt_resources()
422 device_printf(sc->dev, "Cannot unreset 'sata cold' reset\n"); in enable_fdt_resources()
425 rv = hwreset_deassert(sc->hwreset_sata_oob); in enable_fdt_resources()
427 device_printf(sc->dev, "Cannot unreset 'sata oob' reset\n"); in enable_fdt_resources()
431 rv = phy_enable(sc->phy); in enable_fdt_resources()
433 device_printf(sc->dev, "Cannot enable SATA phy\n"); in enable_fdt_resources()
456 val |= calib->gen1_tx_amp << T_SATA0_CHX_PHY_CTRL1_GEN1_TX_AMP_SHIFT; in tegra124_ahci_init()
457 val |= calib->gen1_tx_peak << T_SATA0_CHX_PHY_CTRL1_GEN1_TX_PEAK_SHIFT; in tegra124_ahci_init()
465 val |= calib->gen2_tx_amp << T_SATA0_CHX_PHY_CTRL1_GEN2_TX_AMP_SHIFT; in tegra124_ahci_init()
466 val |= calib->gen2_tx_peak << T_SATA0_CHX_PHY_CTRL1_GEN2_TX_PEAK_SHIFT; in tegra124_ahci_init()
486 /* Enable SATA MMIO. */ in tegra_ahci_ctrl_init()
525 if (sc->soc->init != NULL) { in tegra_ahci_ctrl_init()
526 rv = sc->soc->init(sc); in tegra_ahci_ctrl_init()
528 device_printf(sc->dev, in tegra_ahci_ctrl_init()
560 /* SATA Second Level Clock Gating */ in tegra_ahci_ctrl_init()
574 * Indicate Sata only has the capability to enter DevSleep in tegra_ahci_ctrl_init()
577 if (sc->aux_mem != NULL) { in tegra_ahci_ctrl_init()
578 val = bus_read_4(sc->aux_mem, SATA_AUX_MISC_CNTL_1); in tegra_ahci_ctrl_init()
580 bus_write_4(sc->aux_mem, SATA_AUX_MISC_CNTL_1, val); in tegra_ahci_ctrl_init()
651 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) in tegra_ahci_probe()
654 device_set_desc(dev, "AHCI SATA controller"); in tegra_ahci_probe()
667 sc->dev = dev; in tegra_ahci_attach()
668 ctlr = &sc->ctlr; in tegra_ahci_attach()
670 sc->soc = (struct ahci_soc *)ofw_bus_search_compatible(dev, in tegra_ahci_attach()
671 compat_data)->ocd_data; in tegra_ahci_attach()
673 ctlr->r_rid = 0; in tegra_ahci_attach()
674 ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in tegra_ahci_attach()
675 &ctlr->r_rid, RF_ACTIVE); in tegra_ahci_attach()
676 if (ctlr->r_mem == NULL) in tegra_ahci_attach()
680 sc->sata_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in tegra_ahci_attach()
682 if (sc->sata_mem == NULL) { in tegra_ahci_attach()
689 sc->aux_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in tegra_ahci_attach()
694 device_printf(sc->dev, "Failed to allocate FDT resource(s)\n"); in tegra_ahci_attach()
700 device_printf(sc->dev, "Failed to enable FDT resource(s)\n"); in tegra_ahci_attach()
705 device_printf(sc->dev, "Failed to initialize controller)\n"); in tegra_ahci_attach()
710 ctlr->msi = 0; in tegra_ahci_attach()
711 ctlr->numirqs = 1; in tegra_ahci_attach()
712 ctlr->ccc = 0; in tegra_ahci_attach()
723 if (sc->sata_mem != NULL) in tegra_ahci_attach()
724 bus_release_resource(dev, SYS_RES_MEMORY, 1, sc->sata_mem); in tegra_ahci_attach()
725 if (ctlr->r_mem != NULL) in tegra_ahci_attach()
726 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, in tegra_ahci_attach()
727 ctlr->r_mem); in tegra_ahci_attach()
746 ATA_OUTL(sc->ctlr.r_mem, AHCI_GHC, in tegra_ahci_suspend()
747 ATA_INL(sc->ctlr.r_mem, AHCI_GHC) & (~AHCI_GHC_IE)); in tegra_ahci_suspend()