2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2013-11-11 14:56:41 +00:00
|
|
|
/*
|
|
|
|
* TI SATA platform driver
|
|
|
|
*
|
|
|
|
* (C) Copyright 2013
|
|
|
|
* Texas Instruments, <www.ti.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <ahci.h>
|
|
|
|
#include <scsi.h>
|
|
|
|
#include <asm/arch/clock.h>
|
|
|
|
#include <asm/arch/sata.h>
|
2014-02-03 12:59:02 +00:00
|
|
|
#include <sata.h>
|
2013-11-11 14:56:41 +00:00
|
|
|
#include <asm/io.h>
|
2022-05-12 21:22:26 +00:00
|
|
|
#include <asm/omap_common.h>
|
2013-11-11 14:56:41 +00:00
|
|
|
#include "pipe3-phy.h"
|
|
|
|
|
|
|
|
static struct pipe3_dpll_map dpll_map_sata[] = {
|
|
|
|
{12000000, {1000, 7, 4, 6, 0} }, /* 12 MHz */
|
|
|
|
{16800000, {714, 7, 4, 6, 0} }, /* 16.8 MHz */
|
|
|
|
{19200000, {625, 7, 4, 6, 0} }, /* 19.2 MHz */
|
|
|
|
{20000000, {600, 7, 4, 6, 0} }, /* 20 MHz */
|
|
|
|
{26000000, {461, 7, 4, 6, 0} }, /* 26 MHz */
|
|
|
|
{38400000, {312, 7, 4, 6, 0} }, /* 38.4 MHz */
|
|
|
|
{ }, /* Terminator */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct omap_pipe3 sata_phy = {
|
|
|
|
.pll_ctrl_base = (void __iomem *)TI_SATA_PLLCTRL_BASE,
|
|
|
|
/* .power_reg is updated at runtime */
|
|
|
|
.dpll_map = dpll_map_sata,
|
|
|
|
};
|
|
|
|
|
2014-02-03 12:59:02 +00:00
|
|
|
int init_sata(int dev)
|
2013-11-11 14:56:41 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
u32 val;
|
|
|
|
|
|
|
|
sata_phy.power_reg = (void __iomem *)(*ctrl)->control_phy_power_sata;
|
|
|
|
|
|
|
|
/* Power up the PHY */
|
|
|
|
phy_pipe3_power_on(&sata_phy);
|
|
|
|
|
|
|
|
/* Enable SATA module, No Idle, No Standby */
|
|
|
|
val = TI_SATA_IDLE_NO | TI_SATA_STANDBY_NO;
|
|
|
|
writel(val, TI_SATA_WRAPPER_BASE + TI_SATA_SYSCONFIG);
|
|
|
|
|
2015-04-17 14:19:01 +00:00
|
|
|
ret = ahci_init((void __iomem *)DWC_AHSATA_BASE);
|
2013-11-11 14:56:41 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2014-09-23 15:07:02 +00:00
|
|
|
|
2014-11-21 10:47:23 +00:00
|
|
|
int reset_sata(int dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-23 15:07:02 +00:00
|
|
|
/* On OMAP platforms SATA provides the SCSI subsystem */
|
|
|
|
void scsi_init(void)
|
|
|
|
{
|
|
|
|
init_sata(0);
|
2014-09-23 15:07:03 +00:00
|
|
|
scsi_scan(1);
|
2014-09-23 15:07:02 +00:00
|
|
|
}
|
2014-12-15 14:02:57 +00:00
|
|
|
|
2017-06-15 03:28:40 +00:00
|
|
|
int scsi_bus_reset(struct udevice *dev)
|
2014-12-15 14:02:57 +00:00
|
|
|
{
|
2015-04-17 14:19:01 +00:00
|
|
|
ahci_reset((void __iomem *)DWC_AHSATA_BASE);
|
|
|
|
ahci_init((void __iomem *)DWC_AHSATA_BASE);
|
2017-06-15 03:28:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2014-12-15 14:02:57 +00:00
|
|
|
}
|