From patchwork Wed Oct 30 13:53:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 11219597 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04134112B for ; Wed, 30 Oct 2019 14:00:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5FFA208C0 for ; Wed, 30 Oct 2019 14:00:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="wJKmPGOa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbfJ3OAu (ORCPT ); Wed, 30 Oct 2019 10:00:50 -0400 Received: from forward104o.mail.yandex.net ([37.140.190.179]:44833 "EHLO forward104o.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726322AbfJ3OAt (ORCPT ); Wed, 30 Oct 2019 10:00:49 -0400 Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 610D59411F7; Wed, 30 Oct 2019 16:54:14 +0300 (MSK) Received: from iva8-e1a842234f87.qloud-c.yandex.net (iva8-e1a842234f87.qloud-c.yandex.net [2a02:6b8:c0c:77a0:0:640:e1a8:4223]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id bs174B8v8y-sDv0nwPT; Wed, 30 Oct 2019 16:54:14 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; s=mail; t=1572443654; bh=LZfCzRmnU5GvSwNDTZRMxa1XSUXSuYUhaw6ApIP4riQ=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=wJKmPGOanSsEV3K2e5hMdIEowzXiw1PWxSyTsNtDsr4nD8frEBBMnSq10gVgRZ6gy b7rxmrO+px7aZFw0iuONaHAvy/SJJviVqjFrlPz5gGnBQotilCPv/kVng8S4LpbZZR za2bNj+TMDDRlyYOYtr6GAqcjI0t6rlebs+abm+Y= Authentication-Results: mxback17j.mail.yandex.net; dkim=pass header.i=@flygoat.com Received: by iva8-e1a842234f87.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id iQ85YfuBaZ-s6UuMBEg; Wed, 30 Oct 2019 16:54:12 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: davem@davemloft.net, robh+dt@kernel.org, mark.rutland@arm.com, axboe@kernel.dk, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, bhelgaas@google.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-ide@vger.kernel.org, linux-pci@vger.kernel.org, Jiaxun Yang Subject: [PATCH 1/5] PCI: pci_ids: Add Loongson IDs Date: Wed, 30 Oct 2019 21:53:43 +0800 Message-Id: <20191030135347.3636-2-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030135347.3636-1-jiaxun.yang@flygoat.com> References: <20191030135347.3636-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add Loongson device IDs that will be used by drivers later. Signed-off-by: Jiaxun Yang Acked-by: Bjorn Helgaas --- include/linux/pci_ids.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 21a572469a4e..75f3336116eb 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -148,6 +148,10 @@ /* Vendors and devices. Sort key: vendor first, device next. */ +#define PCI_VENDOR_ID_LOONGSON 0x0014 +#define PCI_DEVICE_ID_LOONGSON_GMAC 0x7a03 +#define PCI_DEVICE_ID_LOONGSON_AHCI 0x7a08 + #define PCI_VENDOR_ID_TTTECH 0x0357 #define PCI_DEVICE_ID_TTTECH_MC322 0x000a From patchwork Wed Oct 30 13:53:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 11219595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1B1E139A for ; Wed, 30 Oct 2019 13:59:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5EDB2087E for ; Wed, 30 Oct 2019 13:59:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="AiTD+CrQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726297AbfJ3N7x (ORCPT ); Wed, 30 Oct 2019 09:59:53 -0400 Received: from forward101p.mail.yandex.net ([77.88.28.101]:54553 "EHLO forward101p.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbfJ3N7x (ORCPT ); Wed, 30 Oct 2019 09:59:53 -0400 X-Greylist: delayed 326 seconds by postgrey-1.27 at vger.kernel.org; Wed, 30 Oct 2019 09:59:51 EDT Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 0EE433281C63; Wed, 30 Oct 2019 16:54:24 +0300 (MSK) Received: from iva8-e1a842234f87.qloud-c.yandex.net (iva8-e1a842234f87.qloud-c.yandex.net [2a02:6b8:c0c:77a0:0:640:e1a8:4223]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id XdRHidBpFf-sMPCvR3M; Wed, 30 Oct 2019 16:54:24 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; s=mail; t=1572443664; bh=03l/30FMS82CFhGnplZOj90sCc7C0ySutIdyr15O1OE=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=AiTD+CrQA0BlduaOCrVqhA51GYC7+pFYVZNzPahTffxwT2yp/f1jxAO0OsCptER57 i0XDdjHGO1m1UGOdrOA+aT5TQCDzCznmBa7/A6QHJRBGOhWDUPcxMmmJQzfFxdHnO5 4jkYAfD/nmUhDNB+8SN5oESPThou7KTsLtjFoSVs= Authentication-Results: mxback13g.mail.yandex.net; dkim=pass header.i=@flygoat.com Received: by iva8-e1a842234f87.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id iQ85YfuBaZ-sEUurF50; Wed, 30 Oct 2019 16:54:20 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: davem@davemloft.net, robh+dt@kernel.org, mark.rutland@arm.com, axboe@kernel.dk, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, bhelgaas@google.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-ide@vger.kernel.org, linux-pci@vger.kernel.org, Jiaxun Yang Subject: [PATCH 2/5] net: stmmac: Split devicetree parse Date: Wed, 30 Oct 2019 21:53:44 +0800 Message-Id: <20191030135347.3636-3-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030135347.3636-1-jiaxun.yang@flygoat.com> References: <20191030135347.3636-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org PCI based devices can share devicetree info parse with platform device based devices after split dt parse frpm dt probe. Signed-off-by: Jiaxun Yang --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 63 ++++++++++++++----- .../ethernet/stmicro/stmmac/stmmac_platform.h | 3 + 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 170c3a052b14..7e29bc76b7c3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -385,25 +385,19 @@ static int stmmac_of_get_mac_mode(struct device_node *np) } /** - * stmmac_probe_config_dt - parse device-tree driver parameters - * @pdev: platform_device structure - * @mac: MAC address to use + * stmmac_parse_config_dt - parse device-tree driver parameters + * @np: device_mode structure + * @plat: plat_stmmacenet_data structure * Description: * this function is to read the driver parameters from device-tree and * set some private fields that will be used by the main at runtime. */ -struct plat_stmmacenet_data * -stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) +int stmmac_parse_config_dt(struct device_node *np, + struct plat_stmmacenet_data *plat) { - struct device_node *np = pdev->dev.of_node; - struct plat_stmmacenet_data *plat; struct stmmac_dma_cfg *dma_cfg; int rc; - plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); - if (!plat) - return ERR_PTR(-ENOMEM); - *mac = of_get_mac_address(np); if (IS_ERR(*mac)) { if (PTR_ERR(*mac) == -EPROBE_DEFER) @@ -414,7 +408,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->phy_interface = of_get_phy_mode(np); if (plat->phy_interface < 0) - return ERR_PTR(plat->phy_interface); + return plat->phy_interface; plat->interface = stmmac_of_get_mac_mode(np); if (plat->interface < 0) @@ -453,7 +447,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* To Configure PHY by using all device-tree supported properties */ rc = stmmac_dt_phy(plat, np, &pdev->dev); if (rc) - return ERR_PTR(rc); + return rc; of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); @@ -531,7 +525,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) GFP_KERNEL); if (!dma_cfg) { stmmac_remove_config_dt(pdev, plat); - return ERR_PTR(-ENOMEM); + return -ENOMEM; } plat->dma_cfg = dma_cfg; @@ -560,7 +554,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) rc = stmmac_mtl_setup(pdev, plat); if (rc) { stmmac_remove_config_dt(pdev, plat); - return ERR_PTR(rc); + return rc; } /* clock setup */ @@ -604,14 +598,43 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->stmmac_rst = NULL; } - return plat; + return 0; error_hw_init: clk_disable_unprepare(plat->pclk); error_pclk_get: clk_disable_unprepare(plat->stmmac_clk); - return ERR_PTR(-EPROBE_DEFER); + return -EPROBE_DEFER; +} + +/** + * stmmac_probe_config_dt - probe and setup stmmac platform data by devicetree + * @pdev: platform_device structure + * @mac: MAC address to use + * Description: + * this function is to set up plat_stmmacenet_data private structure + * for platform drivers. + */ +struct plat_stmmacenet_data * +stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) +{ + struct device_node *np = pdev->dev.of_node; + struct plat_stmmacenet_data *plat; + int rc; + + plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); + if (!plat) + return ERR_PTR(-ENOMEM); + + rc = stmmac_parse_config_dt(np, plat); + + if (rc) { + free(plat); + return ERR_PTR(rc); + } + + return plat; } /** @@ -628,6 +651,11 @@ void stmmac_remove_config_dt(struct platform_device *pdev, of_node_put(plat->mdio_node); } #else +int stmmac_parse_config_dt(struct device_node *np, + struct plat_stmmacenet_data *plat) +{ + return -EINVAL; +} struct plat_stmmacenet_data * stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) { @@ -639,6 +667,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev, { } #endif /* CONFIG_OF */ +EXPORT_SYMBOL_GPL(stmmac_parse_config_dt); EXPORT_SYMBOL_GPL(stmmac_probe_config_dt); EXPORT_SYMBOL_GPL(stmmac_remove_config_dt); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index 3a4663b7b460..0e4aec1f502a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -11,6 +11,9 @@ #include "stmmac.h" +int stmmac_parse_config_dt(struct device_node *np, + struct plat_stmmacenet_data *plat); + struct plat_stmmacenet_data * stmmac_probe_config_dt(struct platform_device *pdev, const char **mac); void stmmac_remove_config_dt(struct platform_device *pdev, From patchwork Wed Oct 30 13:53:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 11219601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 11248112B for ; Wed, 30 Oct 2019 14:01:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E21BC2190F for ; Wed, 30 Oct 2019 14:01:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="dYPNLQ+J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726656AbfJ3OBp (ORCPT ); Wed, 30 Oct 2019 10:01:45 -0400 Received: from forward103j.mail.yandex.net ([5.45.198.246]:54056 "EHLO forward103j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726607AbfJ3OBp (ORCPT ); Wed, 30 Oct 2019 10:01:45 -0400 Received: from mxback7o.mail.yandex.net (mxback7o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::21]) by forward103j.mail.yandex.net (Yandex) with ESMTP id E32C96741E8E; Wed, 30 Oct 2019 16:54:36 +0300 (MSK) Received: from iva8-e1a842234f87.qloud-c.yandex.net (iva8-e1a842234f87.qloud-c.yandex.net [2a02:6b8:c0c:77a0:0:640:e1a8:4223]) by mxback7o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 48FFXf50Ah-sZN0FjPD; Wed, 30 Oct 2019 16:54:36 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; s=mail; t=1572443676; bh=j0qExup+mjN9/866l9U9/4+EErx2RZW+CoBkOGAlloM=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=dYPNLQ+JtpRNu+87bHmlt3SOg/VR93n/nw51idJw3BG9Xny4NRxHUQEHSIIYPtddE FwGOs9eALbIioCxlSgTBSVFvrOY1zCk6WQvy5alkktNQvqBrWamjW2FoY4uQ4AaGh3 PeGd6tCV1HUjQNF/otycaUVpZoVvQtbThU0ORzb8= Authentication-Results: mxback7o.mail.yandex.net; dkim=pass header.i=@flygoat.com Received: by iva8-e1a842234f87.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id iQ85YfuBaZ-sOUuwUUB; Wed, 30 Oct 2019 16:54:34 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: davem@davemloft.net, robh+dt@kernel.org, mark.rutland@arm.com, axboe@kernel.dk, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, bhelgaas@google.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-ide@vger.kernel.org, linux-pci@vger.kernel.org, Jiaxun Yang Subject: [PATCH 3/5] net: stmmac: pci: Add Loongson GMAC Date: Wed, 30 Oct 2019 21:53:45 +0800 Message-Id: <20191030135347.3636-4-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030135347.3636-1-jiaxun.yang@flygoat.com> References: <20191030135347.3636-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This device will be setup by parsing DeviceTree node of pci device. Signed-off-by: Jiaxun Yang --- .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 52 ++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 292045f4581f..640a2a5b8d41 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -12,8 +12,11 @@ #include #include #include +#include +#include #include "stmmac.h" +#include "stmmac_platform.h" /* * This struct is used to associate PCI Function of MAC controller on a board, @@ -33,6 +36,7 @@ struct stmmac_pci_dmi_data { struct stmmac_pci_info { int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat); + bool of_irq; }; static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, @@ -444,6 +448,30 @@ static const struct stmmac_pci_info snps_gmac5_pci_info = { .setup = snps_gmac5_default_data, }; +static int loongson_pci_of_setup(struct pci_dev *pdev, + struct plat_stmmacenet_data *plat) +{ + struct device_node *np; + np = pci_device_to_OF_node(pdev); + + if(!np) { + dev_err(&pdev->dev, "Unable to get OF node\n"); + return -ENODEV; + } + + if(!of_device_is_compatible(np, "loongson,pci-gmac")) { + dev_err(&pdev->dev, "Device compatible mismatch\n"); + return -ENODEV; + } + + return stmmac_parse_config_dt(np, plat); +} + +static const struct stmmac_pci_info loongson_of_pci_info = { + .setup = loongson_pci_of_setup, + .of_irq = true, +}; + /** * stmmac_pci_probe * @@ -508,8 +536,27 @@ static int stmmac_pci_probe(struct pci_dev *pdev, memset(&res, 0, sizeof(res)); res.addr = pcim_iomap_table(pdev)[i]; - res.wol_irq = pdev->irq; - res.irq = pdev->irq; + + if(info->of_irq) { + struct device_node *np; + np = pci_device_to_OF_node(pdev); + + res.irq = of_irq_get_byname(np, "macirq"); + if (res.irq < 0) + return res.irq; + res.wol_irq = of_irq_get_byname(np, "eth_wake_irq"); + if (res.wol_irq < 0) { + if (res.wol_irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + res.wol_irq = res.irq; + } + res.lpi_irq = of_irq_get_byname(np, "eth_lpi"); + if (res.lpi_irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + } else { + res.wol_irq = pdev->irq; + res.irq = pdev->irq; + } return stmmac_dvr_probe(&pdev->dev, plat, &res); } @@ -602,6 +649,7 @@ static const struct pci_device_id stmmac_id_table[] = { STMMAC_DEVICE(INTEL, STMMAC_EHL_SGMII1G_ID, ehl_sgmii1g_pci_info), STMMAC_DEVICE(INTEL, STMMAC_TGL_SGMII1G_ID, tgl_sgmii1g_pci_info), STMMAC_DEVICE(SYNOPSYS, STMMAC_GMAC5_ID, snps_gmac5_pci_info), + STMMAC_DEVICE(LOONGSON, PCI_DEVICE_ID_LOONGSON_GMAC, loongson_of_pci_info), {} }; From patchwork Wed Oct 30 13:53:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 11219599 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0A5D112B for ; Wed, 30 Oct 2019 14:01:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9CB821835 for ; Wed, 30 Oct 2019 14:01:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="IOw2lJSL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbfJ3OBd (ORCPT ); Wed, 30 Oct 2019 10:01:33 -0400 Received: from forward106j.mail.yandex.net ([5.45.198.249]:33401 "EHLO forward106j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbfJ3OBc (ORCPT ); Wed, 30 Oct 2019 10:01:32 -0400 X-Greylist: delayed 411 seconds by postgrey-1.27 at vger.kernel.org; Wed, 30 Oct 2019 10:01:29 EDT Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 3135A11A1F94; Wed, 30 Oct 2019 16:54:46 +0300 (MSK) Received: from iva8-e1a842234f87.qloud-c.yandex.net (iva8-e1a842234f87.qloud-c.yandex.net [2a02:6b8:c0c:77a0:0:640:e1a8:4223]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id V5E8gqFvMo-sjkCoBaY; Wed, 30 Oct 2019 16:54:46 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; s=mail; t=1572443686; bh=gWEa5FRcTgUF0nhJEpPZLRQAybGIQLvAfMzmy9iALuU=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=IOw2lJSLcgJgAiZbMTlg7+x1VaooTXAwE6jj0gMZGk7J5MyHLNqfW94LJLIM1z+/z mIzcq7YoUGpgeAZI3GH1NjqAojg2Pwszjmy9Gm1Xx1whBV/VImBVTSbc9iuYA6Aziy zCietABTtDDeDm9ZHK0BvlcREke9RmEz6WyJUc7I= Authentication-Results: mxback10j.mail.yandex.net; dkim=pass header.i=@flygoat.com Received: by iva8-e1a842234f87.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id iQ85YfuBaZ-sbUu9RH8; Wed, 30 Oct 2019 16:54:43 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: davem@davemloft.net, robh+dt@kernel.org, mark.rutland@arm.com, axboe@kernel.dk, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, bhelgaas@google.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-ide@vger.kernel.org, linux-pci@vger.kernel.org, Jiaxun Yang Subject: [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac Date: Wed, 30 Oct 2019 21:53:46 +0800 Message-Id: <20191030135347.3636-5-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030135347.3636-1-jiaxun.yang@flygoat.com> References: <20191030135347.3636-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This binding will provide extra information for PCI enabled device. Signed-off-by: Jiaxun Yang --- .../net/wireless/loongson,pci-gmac.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml new file mode 100644 index 000000000000..5f764bd46735 --- /dev/null +++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Loongson PCI GMAC Device Tree Bindings + +allOf: + - $ref: "snps,dwmac.yaml#" + +maintainers: + - Jiaxun Yang + +properties: + compatible: + const: loongson,pci-gmac + + reg: + maxItems: 1 + + interrupts: + minItems: 1 + maxItems: 3 + items: + - description: Combined signal for various interrupt events + - description: The interrupt to manage the remote wake-up packet detection + - description: The interrupt that occurs when Rx exits the LPI state + + interrupt-names: + minItems: 1 + maxItems: 3 + items: + - const: macirq + - const: eth_wake_irq + - const: eth_lpi + + clocks: + items: + - description: GMAC main clock + + clock-names: + items: + - const: stmmaceth + +required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + - clock-names + - phy-mode + +examples: + - | + gmac: ethernet@ { + compatible = "loongson,pci-irq"; + reg = <0x00001800 0 0 0 0>; + interrupts = <12>, <13>; + interrupt-names = "macirq", "eth_lpi"; + clocks = <&clk_pch_gmac>; + clock-names = "stmmaceth"; + phy-mode = "rgmii"; + }; + +# FIXME: We should set it, but it would report all the generic +# properties as additional properties. +# additionalProperties: false + +... From patchwork Wed Oct 30 13:53:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 11219603 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45C7C13BD for ; Wed, 30 Oct 2019 14:01:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 197E921835 for ; Wed, 30 Oct 2019 14:01:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="TK4EPcMd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726664AbfJ3OBo (ORCPT ); Wed, 30 Oct 2019 10:01:44 -0400 Received: from forward105o.mail.yandex.net ([37.140.190.183]:57827 "EHLO forward105o.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726656AbfJ3OBo (ORCPT ); Wed, 30 Oct 2019 10:01:44 -0400 Received: from mxback27g.mail.yandex.net (mxback27g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:327]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 502484200ED8; Wed, 30 Oct 2019 16:54:56 +0300 (MSK) Received: from iva8-e1a842234f87.qloud-c.yandex.net (iva8-e1a842234f87.qloud-c.yandex.net [2a02:6b8:c0c:77a0:0:640:e1a8:4223]) by mxback27g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 7uGwIg3QMS-st8S4JGH; Wed, 30 Oct 2019 16:54:56 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; s=mail; t=1572443696; bh=ARWVQLt1dWTnBId169FvLsAgeDt/XuDlOiFp1rFzjZQ=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=TK4EPcMd+uMyrwR/jJaCbKycYOzuQEY0ykw2BJkgg9+t2DcnYJ8TNZNbyIaRHnNIk Rl3SPtnHGHxpUON23jol9EUi4qs0tLyY89XDe3HTbuiyJW8Zc0MA2vSEBG/8WVf3Mh zm2t8a7h51ZVfX5351ynrY5gYQa+LZ1qJQy5G8r8= Authentication-Results: mxback27g.mail.yandex.net; dkim=pass header.i=@flygoat.com Received: by iva8-e1a842234f87.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id iQ85YfuBaZ-skUufJNa; Wed, 30 Oct 2019 16:54:54 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: davem@davemloft.net, robh+dt@kernel.org, mark.rutland@arm.com, axboe@kernel.dk, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, bhelgaas@google.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-ide@vger.kernel.org, linux-pci@vger.kernel.org, Jiaxun Yang Subject: [PATCH 5/5] libata/ahci: Apply non-standard BAR fix for Loongson Date: Wed, 30 Oct 2019 21:53:47 +0800 Message-Id: <20191030135347.3636-6-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030135347.3636-1-jiaxun.yang@flygoat.com> References: <20191030135347.3636-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Loongson is using BAR0 as AHCI registers BAR. Signed-off-by: Jiaxun Yang --- drivers/ata/ahci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index dd92faf197d5..db3d7b94ad53 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -42,6 +42,7 @@ enum { AHCI_PCI_BAR_CAVIUM = 0, AHCI_PCI_BAR_ENMOTUS = 2, AHCI_PCI_BAR_CAVIUM_GEN5 = 4, + AHCI_PCI_BAR_LOONGSON = 0, AHCI_PCI_BAR_STANDARD = 5, }; @@ -575,6 +576,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { /* Enmotus */ { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, + /* Loongson */ + { PCI_VDEVICE(LOONGSON, 0x7a08), board_ahci }, + /* Generic, PCI class code for AHCI */ { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, @@ -1663,6 +1667,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ahci_pci_bar = AHCI_PCI_BAR_CAVIUM; if (pdev->device == 0xa084) ahci_pci_bar = AHCI_PCI_BAR_CAVIUM_GEN5; + } else if (pdev->vendor == PCI_VENDOR_ID_LOONGSON) { + if (pdev->device == PCI_DEVICE_ID_LOONGSON_AHCI) + ahci_pci_bar = AHCI_PCI_BAR_LOONGSON; } /* acquire resources */