Received: by 10.223.164.221 with SMTP id h29csp2986231wrb; Mon, 30 Oct 2017 13:03:44 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QKSNZXOl9TNnim5EXujf0CTH1pE8ej60FkTvqKMRaXxJFcaMqbVgiLdtgbkQFG+2luPUpa X-Received: by 10.98.233.20 with SMTP id j20mr9926572pfh.281.1509393824454; Mon, 30 Oct 2017 13:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509393824; cv=none; d=google.com; s=arc-20160816; b=EShrWNnx9dOigN513mx5ssCQaJpd4PbH78Hhq6+uvdnPOk9vXmzfQko3j+nLxXcFPL cAQDm+DCdPOxTj+o+c83OPmMPZDmXvSTVnIQX0EWo9jTSeVFb7KFVBSPtW3G68osg/Jn ofetTldiwsCJ3/Ro39KZrpuplpX0HcZDlk89AwO4ZBxKgePiETRgilgxPTkC/xt7DyO0 0tCpwdnMXdbgfZqRAfYnPgr+i5UXomutkQGEmYt/OVLZQMtAqnJ5YoTCYKm0qOY/GYQe 83weRf6ucUZyGKCqCr9YjuLXxrGWoMnKuRYROMPVVrMWfEwxOILZS5VKzz2INLrw8hr9 pnVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :mime-version:dkim-signature:arc-authentication-results; bh=EEgGfjOyMAmeSi59VjGrh/cFTju/rlbcbqT0ZpHAshU=; b=k0EjAMeEdWDMMNQjKm6OcAOPpHQvuEtt2eKrT5ch7q0gm44rFep+wg4UItI4ZIMIXK WShJc5vsXdFj7vH8WlZ3X3Ajn/+MA0CVlDO/xr38wetBrgAwfKwFook5zhVj1GyEImrh w8pRhQRLtYc9tUz1t6vY8yasbeNStCIGIwnrjPXHMFaIiNA06LTZX/tUllxJQsIvfoY1 ZZ3qQMeMdH8xoJNoimjB6xQeyqWS9jdoBtlGGQzLiP6e+5n7Q4YdDX4wv79gSS9EzXdP XYLt8NtAHunk9cFB07OHtHQ5sYl2H4LYUaRjdblFf7BBRJ4du6AVYA4mX5CPbiCMadhR vSSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arasan-com.20150623.gappssmtp.com header.s=20150623 header.b=W+qQryIv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si10673678pgq.519.2017.10.30.13.03.31; Mon, 30 Oct 2017 13:03:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@arasan-com.20150623.gappssmtp.com header.s=20150623 header.b=W+qQryIv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752954AbdJ3TKw (ORCPT + 99 others); Mon, 30 Oct 2017 15:10:52 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:55050 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752905AbdJ3TKu (ORCPT ); Mon, 30 Oct 2017 15:10:50 -0400 Received: by mail-pf0-f193.google.com with SMTP id n89so11753130pfk.11 for ; Mon, 30 Oct 2017 12:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arasan-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:to:cc:subject:date:message-id; bh=EEgGfjOyMAmeSi59VjGrh/cFTju/rlbcbqT0ZpHAshU=; b=W+qQryIv4GrQZY32Ocy6IzOLUS6ksDRGnthuvTJYP6/2y5zT7P3MiSmCGYcrovC1mp 8rrFiN4VKn/669Lr7gqajNxy6rFel6w6rTbNAr7SUHkSRvy+YzHBYhiCGdtKdya6FFdR SWxD7st6TBh9aqNevaZjmXStfeINtIVQ19AogwczW/tz8wnzlcdQdbrPyiuXxyhERKY2 FJ7x7YS0J2J6u0/81bj0cURzAr0JKyk13A1CzqyIsLQrMbzeRctX1b9b/20mEheCQDv6 dH+7LE2NhSEvF3JzosGvsE71eKbBrxfMIIcp1RJbAD4OZj5rCR4FQAlSVQ9f0mDlOCfw eFiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id; bh=EEgGfjOyMAmeSi59VjGrh/cFTju/rlbcbqT0ZpHAshU=; b=bSlGam90Y+sUWwlhZRZFupp9841Zg3d//Sg7pTT9ZknfIsQ+/linvAfNq445zMTajg wcuf0HWscCrjYErJOsdu16IgWllg2mQfc0N8bcwbEDTMEdhYi8zUmAzyYTnh5AqTRzte 8dB2IqgiAs+2lwRp9o9O4i5u6KZuPJwf3TAjOHjUUCCEWlvRAraDlieTaBxUCI9c6QRs m72ULaWBBWh0NO02loHdy+cNSQEDOmbmIbssfqCiupnWx9C1hVRfBUI2VyKgl267sMou lMRi8r0opyxabxv+alAxuP6X9IWrXwsEvYrq3/A0Omje+Ub6s94cNgKBn4zKNhs5sSDw X66A== X-Gm-Message-State: AMCzsaWsbUgHSmISmOre091I8RoYSmwsT2DkqNEXf/zESQzmmUJ4Dj5s tunR8ImrUfvVM+BsG3YDVqik66OYsO0podAJb9iAjh+g4x1owvAnSUOuOVQmfn4v27ApmyhX2rH ixvP/E2ZF6035HpWHBw== MIME-Version: 1.0 X-Received: by 10.159.234.10 with SMTP id be10mr8290469plb.386.1509390649790; Mon, 30 Oct 2017 12:10:49 -0700 (PDT) Received: from localhost.localdomain (c-73-15-160-126.hsd1.ca.comcast.net. [73.15.160.126]) by smtp.gmail.com with ESMTPSA id f24sm31140075pfk.183.2017.10.30.12.10.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Oct 2017 12:10:49 -0700 (PDT) From: Atul Garg To: agarg@arasan.com, linux-mmc@vger.kernel.org, kishon@ti.com, rk@ti.com, nm@ti.com, nsekhar@ti.com, ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] mmc:host:sdhci-pci:V3-Addition of Arasan PCI Controller with integrated phy. Date: Mon, 30 Oct 2017 12:10:36 -0700 Message-Id: <1509390636-4644-1-git-send-email-agarg@arasan.com> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain; charset="US-ASCII" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Arasan controller is based on a FPGA platform and has integrated phy with specific registers used during initialization and management of different modes. The phy and the controller are integrated and registers are very specific to Arasan. Arasan being an IP provider, licenses these IPs to various companies for integration of IP in custom SOCs. The custom SOCs define own register map depending on how bits are tied inside the SOC for phy registers, depending on SOC memory plan and hence will require own platform drivers. If more details on phy registers are required, an interface document is hosted at https: //arasandotcom/NF/eMMC5.1 PHY Programming in Linux.pdf. Changes from V2: Removed sdhci-pci-arasan.h. Code and document mentioned above are made relevant. Applied code style suggestions from Sekhar Nori and Adrian Hunter . Signed-off-by: Atul Garg --- drivers/mmc/host/Makefile | 2 +- drivers/mmc/host/sdhci-pci-arasan.c | 369 ++++++++++++++++++++++++++++++++++++ drivers/mmc/host/sdhci-pci-core.c | 14 ++ drivers/mmc/host/sdhci-pci.h | 6 + 4 files changed, 390 insertions(+), 1 deletion(-) create mode 100644 drivers/mmc/host/sdhci-pci-arasan.c diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index ab61a3e..6781b81 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -10,7 +10,7 @@ obj-$(CONFIG_MMC_MXC) += mxcmmc.o obj-$(CONFIG_MMC_MXS) += mxs-mmc.o obj-$(CONFIG_MMC_SDHCI) += sdhci.o obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o -sdhci-pci-y += sdhci-pci-core.o sdhci-pci-o2micro.o +sdhci-pci-y += sdhci-pci-core.o sdhci-pci-o2micro.o sdhci-pci-arasan.o obj-$(subst m,y,$(CONFIG_MMC_SDHCI_PCI)) += sdhci-pci-data.o obj-$(CONFIG_MMC_SDHCI_ACPI) += sdhci-acpi.o obj-$(CONFIG_MMC_SDHCI_PXAV3) += sdhci-pxav3.o diff --git a/drivers/mmc/host/sdhci-pci-arasan.c b/drivers/mmc/host/sdhci-pci-arasan.c new file mode 100644 index 0000000..a0a4f3e --- /dev/null +++ b/drivers/mmc/host/sdhci-pci-arasan.c @@ -0,0 +1,369 @@ +/* + * Copyright (C) 2017 Arasan Chip Systems Inc., + * + * Authors: Atul Garg + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include + +#include "sdhci.h" +#include "sdhci-pci.h" + +/* Extra registers for Arasan SD Host Controller for eMMC5.1 PHY */ +#define HOST_PHY_ADDR_REG 0x300 +#define HOST_PHY_DATA_REG 0x304 + +/* eMMC5.1 PHY Specific Registers */ +#define DLL_CONTROL_STS 0x00 +#define IOPAD_CONTROL1 0x01 +#define IOPAD_CONTROL2 0x02 +#define IOPAD_STATUS 0x03 +#define IO_ODEN_CONTROL1 0x04 +#define IO_ODEN_CONTROL2 0x05 +#define IO_REN_CONTROL1 0x06 +#define IO_REN_CONTROL2 0x07 +#define IO_PU_CONTROL1 0x08 +#define IO_PU_CONTROL2 0x09 +#define IO_OD_REL_CONTROL1 0x0A +#define IO_OD_REL_CONTROL2 0x0B +#define ITAP_DELAY 0x0C +#define OTAP_DELAY 0x0D +#define STROBE_SELECT 0x0E +#define CLKBUF_SELECT 0x0F +#define MODE_CONTROL 0x11 +#define DLL_TRIM 0x12 +#define LDO_CONTROL 0x1F +#define CMD_CONTROL 0x20 +#define DATA_CONTROL 0x21 +#define STROBE_CONTROL 0x22 +#define CLK_CONTROL 0x23 +#define PHY_CONTROL 0x24 + +#define DLL_ENABLE BIT(3) +#define RTRIM_ENABLE BIT(1) +#define PDB_ENABLE BIT(1) +#define RETB_ENABLE BIT(6) +#define ODEN_CMD BIT(1) +#define ODEN_DAT 0xFF +#define REN_STRB BIT(0) +#define REN_CMD BIT(1) +#define REN_DAT 0xFF +#define PU_CMD BIT(1) +#define PU_DAT 0xFF +#define ITAP_DLY_EN BIT(0) +#define OTAP_DLY_EN BIT(0) +#define OD_REL_CMD BIT(1) +#define OD_REL_DAT 0xFF +#define DLL_TRIM_ICP 0x8 +#define PDB_CMD BIT(0) +#define PDB_DAT 0xFF +#define PDB_STRB BIT(0) +#define PDB_CLK BIT(0) +#define LDO_RDYB 0xFE +#define CALDONE_MASK 0x10 +#define DLL_RDY_MASK 0x10 +#define MAX_CLK_BUF 0x7 + +/* Mode Controls */ +#define ENHSTRB_MODE BIT(0) +#define HS400_MODE BIT(1) +#define LEGACY_MODE BIT(2) +#define DDR50_MODE BIT(3) + +#define OTAPDLY(x) ((x << 1) | OTAP_DLY_EN) +#define ITAPDLY(x) ((x << 1) | ITAP_DLY_EN) +#define FREQ_SEL(x) ((x << 5) | DLL_ENABLE) +#define IOPAD(x, y) ((x) | (y << 2)) + + +static int arasan_phy_write(struct sdhci_host *host, u8 data, u8 offset) +{ + u32 timeout; + u8 busy; + + sdhci_writew(host, data, HOST_PHY_DATA_REG); + sdhci_writew(host, ((1<<8) | offset), HOST_PHY_ADDR_REG); + timeout = 20; + do { + busy = sdhci_readw(host, HOST_PHY_ADDR_REG) & (1<<9); + if (!busy) + break; + usleep_range(1, 5); + } while (timeout--); + if (!timeout) + return -EBUSY; + return 0; +} + +static int arasan_phy_read(struct sdhci_host *host, u8 offset, u8 *data) +{ + u32 timeout; + u8 busy; + + sdhci_writew(host, 0, HOST_PHY_DATA_REG); + sdhci_writew(host, offset, HOST_PHY_ADDR_REG); + timeout = 20; + do { + busy = sdhci_readw(host, HOST_PHY_ADDR_REG) & (1<<9); + if (!busy) + break; + usleep_range(1, 5); + } while (timeout--); + if (!timeout) + return -EBUSY; + /*Masking valid data bits*/ + *data = sdhci_readw(host, HOST_PHY_DATA_REG) & 0xFF; + return 0; +} + +/* Initialize the Arasan PHY */ +static int arasan_phy_init(struct sdhci_host *host) +{ + struct sdhci_pci_slot *slot = sdhci_priv(host); + struct pci_dev *pdev = slot->chip->pdev; + u32 timeout; + u8 val, ret; + + /* Program IOPADs and wait for calibration to be done */ + if (arasan_phy_read(host, IOPAD_CONTROL1, &val) || + arasan_phy_write(host, val | RETB_ENABLE | PDB_ENABLE, + IOPAD_CONTROL1) || + arasan_phy_read(host, IOPAD_CONTROL2, &val) || + arasan_phy_write(host, val | RTRIM_ENABLE, IOPAD_CONTROL2)) + return -EBUSY; + timeout = 10; + do { + ret = arasan_phy_read(host, IOPAD_STATUS, &val); + if (val & CALDONE_MASK) + break; + usleep_range(1, 5); + } while (timeout--); + if (!timeout) { + dev_err(&pdev->dev, "Phy Calibration not done\n"); + return ret; + } + + /* Program CMD/Data lines */ + if (arasan_phy_read(host, IO_REN_CONTROL1, &val) || + arasan_phy_write(host, val | REN_CMD | REN_STRB, + IO_REN_CONTROL1) || + arasan_phy_read(host, IO_PU_CONTROL1, &val) || + arasan_phy_write(host, val | PU_CMD, IO_PU_CONTROL1) || + arasan_phy_read(host, CMD_CONTROL, &val) || + arasan_phy_write(host, val | PDB_CMD, CMD_CONTROL) || + arasan_phy_read(host, IO_REN_CONTROL2, &val) || + arasan_phy_write(host, val | REN_DAT, IO_REN_CONTROL2) || + arasan_phy_read(host, IO_PU_CONTROL2, &val) || + arasan_phy_write(host, val | PU_DAT, IO_PU_CONTROL2) || + arasan_phy_read(host, DATA_CONTROL, &val) || + arasan_phy_write(host, val | PDB_DAT, DATA_CONTROL) || + arasan_phy_read(host, STROBE_CONTROL, &val) || + arasan_phy_write(host, val | PDB_STRB, STROBE_CONTROL) || + arasan_phy_read(host, CLK_CONTROL, &val) || + arasan_phy_write(host, val | PDB_CLK, CLK_CONTROL) || + arasan_phy_read(host, CLKBUF_SELECT, &val) || + arasan_phy_write(host, val | MAX_CLK_BUF, CLKBUF_SELECT) || + arasan_phy_write(host, LEGACY_MODE, MODE_CONTROL)) + return -EBUSY; + return 0; +} + +static int arasan_set_phy(struct sdhci_host *host) +{ + u8 freq_sel; + static u32 chg_clk; + u32 timeout; + u8 val, ret; + + if (chg_clk == host->mmc->ios.clock) + return 0; + + chg_clk = host->mmc->ios.clock; + if (host->mmc->ios.clock == 200000000) + freq_sel = 0x0; + else if (host->mmc->ios.clock == 100000000) + freq_sel = 0x2; + else if (host->mmc->ios.clock == 50000000) + freq_sel = 0x1; + else + freq_sel = 0x0; + + if (host->mmc_host_ops.hs400_enhanced_strobe) { + if (arasan_phy_write(host, 0x1, MODE_CONTROL) || + arasan_phy_write(host, OTAPDLY(1), OTAP_DELAY) || + arasan_phy_write(host, 0, ITAP_DELAY) || + arasan_phy_write(host, DLL_TRIM_ICP, DLL_TRIM) || + arasan_phy_write(host, 0, DLL_CONTROL_STS) || + arasan_phy_write(host, FREQ_SEL(freq_sel), + DLL_CONTROL_STS)) + return -EBUSY; + timeout = 10; + do { + ret = arasan_phy_read(host, DLL_CONTROL_STS, &val); + if (val & DLL_RDY_MASK) + break; + } while (timeout--); + if (!timeout) { + dev_err(&pdev->dev, "DLL status not set\n"); + return -EBUSY; + } + } else { + switch (host->mmc->ios.timing) { + case MMC_TIMING_LEGACY: + if (arasan_phy_write(host, 0x4, MODE_CONTROL) || + arasan_phy_write(host, 0, ITAP_DELAY) || + arasan_phy_write(host, 0, OTAP_DELAY) || + arasan_phy_write(host, 0, DLL_CONTROL_STS)) + return -EBUSY; + break; + case MMC_TIMING_MMC_HS: + case MMC_TIMING_SD_HS: + if (arasan_phy_write(host, 0, MODE_CONTROL) || + arasan_phy_write(host, OTAPDLY(3), + OTAP_DELAY) || + arasan_phy_write(host, ITAPDLY(0x2), + ITAP_DELAY) || + arasan_phy_write(host, 0, ITAP_DELAY) || + arasan_phy_write(host, DLL_TRIM_ICP, + DLL_TRIM) || + arasan_phy_write(host, 0, DLL_CONTROL_STS) || + arasan_phy_write(host, FREQ_SEL(freq_sel), + DLL_CONTROL_STS)) + return -EBUSY; + timeout = 10; + do { + ret = arasan_phy_read(host, DLL_CONTROL_STS, + &val); + if (val & DLL_RDY_MASK) + break; + } while (timeout--); + if (!timeout) { + dev_err(&pdev->dev, "DLL status not set\n"); + return -EBUSY; + } + break; + case MMC_TIMING_MMC_HS200: + case MMC_TIMING_UHS_SDR104: + if (arasan_phy_write(host, 0, MODE_CONTROL) || + arasan_phy_read(host, IOPAD_CONTROL1, &val) || + arasan_phy_write(host, IOPAD(val, + host->mmc->ios.drv_type), + IOPAD_CONTROL1) || + arasan_phy_write(host, OTAPDLY(1), + OTAP_DELAY) || + arasan_phy_write(host, 0, ITAP_DELAY) || + arasan_phy_write(host, DLL_TRIM_ICP, + DLL_TRIM) || + arasan_phy_write(host, 0, DLL_CONTROL_STS) || + arasan_phy_write(host, FREQ_SEL(freq_sel), + DLL_CONTROL_STS)) + return -EBUSY; + timeout = 10; + do { + ret = arasan_phy_read(host, DLL_CONTROL_STS, + &val); + if (val & DLL_RDY_MASK) + break; + } while (timeout--); + if (!timeout) { + dev_err(&pdev->dev, "DLL status not set\n"); + return -EBUSY; + } + break; + case MMC_TIMING_MMC_DDR52: + case MMC_TIMING_UHS_DDR50: + if (arasan_phy_write(host, 0x8, MODE_CONTROL) || + arasan_phy_write(host, OTAPDLY(3), + OTAP_DELAY) || + arasan_phy_write(host, ITAPDLY(0x2), + ITAP_DELAY) || + arasan_phy_write(host, DLL_TRIM_ICP, + DLL_TRIM) || + arasan_phy_write(host, 0, DLL_CONTROL_STS) || + arasan_phy_write(host, FREQ_SEL(freq_sel), + DLL_CONTROL_STS)) + return -EBUSY; + timeout = 10; + do { + ret = arasan_phy_read(host, DLL_CONTROL_STS, + &val); + if (val & DLL_RDY_MASK) + break; + } while (timeout--); + if (!timeout) { + dev_err(&pdev->dev, "DLL status not set\n"); + return -EBUSY; + } + break; + case MMC_TIMING_MMC_HS400: + if (arasan_phy_write(host, 0x2, MODE_CONTROL) || + arasan_phy_read(host, IOPAD_CONTROL1, &val) || + arasan_phy_write(host, IOPAD(val, + host->mmc->ios.drv_type), + IOPAD_CONTROL1) || + arasan_phy_write(host, OTAPDLY(1), + OTAP_DELAY) || + arasan_phy_write(host, ITAPDLY(0xa), + ITAP_DELAY) || + arasan_phy_write(host, DLL_TRIM_ICP, + DLL_TRIM) || + arasan_phy_write(host, 0, DLL_CONTROL_STS) || + arasan_phy_write(host, FREQ_SEL(freq_sel), + DLL_CONTROL_STS)) + return -EBUSY; + timeout = 10; + do { + ret = arasan_phy_read(host, DLL_CONTROL_STS, + &val); + if (val & DLL_RDY_MASK) + break; + } while (timeout--); + if (!timeout) { + dev_err(&pdev->dev, "DLL status not set\n"); + return -EBUSY; + } + break; + default: + break; + } + } + return 0; +} + +int arasan_pci_probe_slot(struct sdhci_pci_slot *slot) +{ + int err; + + slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE | + MMC_CAP_8_BIT_DATA; + err = arasan_phy_init(slot->host); + if (err) + return -ENODEV; + return 0; +} + +void arasan_sdhci_set_clock(struct sdhci_host *host, unsigned int clock) +{ + u16 clk; + + host->mmc->actual_clock = 0; + sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); + if (clock == 0) + return; + clk = sdhci_calc_clk(host, clock, &host->mmc->actual_clock); + sdhci_enable_clk(host, clk); + + /*Change phy settings for the new clock */ + arasan_set_phy(host); +} diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index 3e4f04f..cb89161 100644 --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -1104,6 +1104,19 @@ static const struct sdhci_pci_fixes sdhci_rtsx = { .probe_slot = rtsx_probe_slot, }; +static const struct sdhci_ops arasan_sdhci_pci_ops = { + .set_clock = arasan_sdhci_set_clock, + .enable_dma = sdhci_pci_enable_dma, + .set_bus_width = sdhci_set_bus_width, + .reset = sdhci_reset, + .set_uhs_signaling = sdhci_set_uhs_signaling, +}; + +static const struct sdhci_pci_fixes sdhci_arasan = { + .probe_slot = arasan_pci_probe_slot, + .ops = &arasan_sdhci_pci_ops, +}; + /*AMD chipset generation*/ enum amd_chipset_gen { AMD_CHIPSET_BEFORE_ML, @@ -1306,6 +1319,7 @@ static const struct pci_device_id pci_ids[] = { SDHCI_PCI_DEVICE(O2, SDS1, o2), SDHCI_PCI_DEVICE(O2, SEABIRD0, o2), SDHCI_PCI_DEVICE(O2, SEABIRD1, o2), + SDHCI_PCI_DEVICE(ARASAN, PHY_EMMC, arasan), SDHCI_PCI_DEVICE_CLASS(AMD, SYSTEM_SDHCI, PCI_CLASS_MASK, amd), /* Generic SD host controller */ {PCI_DEVICE_CLASS(SYSTEM_SDHCI, PCI_CLASS_MASK)}, diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h index 063506c..63cdab5 100644 --- a/drivers/mmc/host/sdhci-pci.h +++ b/drivers/mmc/host/sdhci-pci.h @@ -54,6 +54,9 @@ #define PCI_SUBDEVICE_ID_NI_7884 0x7884 +#define PCI_VENDOR_ID_ARASAN 0x16e6 +#define PCI_DEVICE_ID_ARASAN_PHY_EMMC 0x0670 + /* * PCI device class and mask */ @@ -176,4 +179,7 @@ int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip); int sdhci_pci_o2_resume(struct sdhci_pci_chip *chip); #endif +int arasan_pci_probe_slot(struct sdhci_pci_slot *slot); +void arasan_sdhci_set_clock(struct sdhci_host *host, unsigned int clock); + #endif /* __SDHCI_PCI_H */ -- 2.7.4 -- ATTENTION: The information contained in this message may be legally privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited by law. If you have received this message in error, please immediately notify the sender and/or Arasan Chip Systems, Inc. by telephone at (408) 282-1600 and delete or destroy any copy of this message. From 1584762044119148757@xxx Wed Nov 22 10:34:19 +0000 2017 X-GM-THRID: 1584760734494944165 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread