#include <linux/ahci_platform.h>
#include <linux/kernel.h>
#include <linux/libata.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#define DRV_NAME "ahci-mtk"
#define SYS_CFG_SATA_MSK GENMASK(31, 30)
#define SYS_CFG_SATA_EN BIT(31)
struct reset_control *axi_rst;
struct reset_control *sw_rst;
struct reset_control *reg_rst;
static const struct ata_port_info ahci_port_info = {
.flags = AHCI_FLAG_COMMON,
.port_ops = &ahci_platform_ops,
static struct scsi_host_template ahci_platform_sht = {
static int mtk_ahci_platform_resets(struct ahci_host_priv *hpriv,
struct mtk_ahci_plat *plat = hpriv->plat_data;
plat->axi_rst = devm_reset_control_get_optional_exclusive(dev, "axi");
if (PTR_ERR(plat->axi_rst) == -EPROBE_DEFER)
return PTR_ERR(plat->axi_rst);
plat->sw_rst = devm_reset_control_get_optional_exclusive(dev, "sw");