blob: d174a463f88a70ed8d646a0e1c36e9f833d64e68 [file] [log] [blame]
Giuseppe Pagano23442e02013-11-28 12:32:48 +01001/*
2 * Copyright 2011 Freescale Semiconductor, Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <asm/imx-common/iomux-v3.h>
8#include <asm/arch/iomux.h>
9#include <asm/io.h>
Stefano Babic52d60322013-12-19 11:04:33 +010010#include <asm/arch/clock.h>
Tim Harveyc877bca2014-05-07 22:24:47 -070011#include <asm/arch/sys_proto.h>
Giuseppe Pagano23442e02013-11-28 12:32:48 +010012
13int setup_sata(void)
14{
Fabio Estevamceb74c42014-07-09 17:59:54 -030015 struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
Tim Harveyc877bca2014-05-07 22:24:47 -070016 int ret;
17
18 if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D))
19 return 1;
Giuseppe Pagano23442e02013-11-28 12:32:48 +010020
Tim Harveyc877bca2014-05-07 22:24:47 -070021 ret = enable_sata_clock();
Giuseppe Pagano23442e02013-11-28 12:32:48 +010022 if (ret)
23 return ret;
24
25 clrsetbits_le32(&iomuxc_regs->gpr[13],
26 IOMUXC_GPR13_SATA_MASK,
27 IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB
28 |IOMUXC_GPR13_SATA_PHY_7_SATA2M
29 |IOMUXC_GPR13_SATA_SPEED_3G
30 |(3<<IOMUXC_GPR13_SATA_PHY_6_SHIFT)
31 |IOMUXC_GPR13_SATA_SATA_PHY_5_SS_DISABLED
32 |IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16
33 |IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB
34 |IOMUXC_GPR13_SATA_PHY_2_TX_1P104V
35 |IOMUXC_GPR13_SATA_PHY_1_SLOW);
36
37 return 0;
38}