ipq806x: refresh 4.19 patches

Reworked:

 - 0034 patchset update

Added:

 - 080 Add support for pinctrl-msm framework

Removed:

 - 0074-ipq806x-usb-Control-USB-master-reset.patch
   (we now have a dedicated driver for qcom usb)

 - 0047-mtd-nand-Create-a-BBT-flag-to-access-bad-block-marke
   (merged upstream)

 - 310-msm-adhoc-bus-support
   (it looks like it was never actually used in any dts)

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
[commit subject and description facelift, SoB fix]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
master
Christian Lamparter 2019-11-28 22:28:48 +01:00 committed by Petr Štetiar
parent 53801ae1c7
commit 63066d3006
48 changed files with 1092 additions and 12445 deletions

View File

@ -18,7 +18,7 @@ Signed-off-by: Ram Chandra Jangir <rjangi@codeaurora.org>
--- a/drivers/mtd/Kconfig --- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig
@@ -194,6 +194,13 @@ config MTD_MYLOADER_PARTS @@ -193,6 +193,13 @@ config MTD_MYLOADER_PARTS
You will still need the parsing functions to be called by the driver You will still need the parsing functions to be called by the driver
for your particular device. It won't happen automatically. for your particular device. It won't happen automatically.

View File

@ -5,15 +5,10 @@ Subject: [PATCH 32/69] phy: add qcom dwc3 phy
Signed-off-by: Andy Gross <agross@codeaurora.org> Signed-off-by: Andy Gross <agross@codeaurora.org>
--- ---
drivers/phy/Kconfig | 12 +
drivers/phy/Makefile | 1 +
drivers/phy/phy-qcom-dwc3.c | 575 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 588 insertions(+)
create mode 100644 drivers/phy/phy-qcom-dwc3.c
--- a/drivers/phy/qualcomm/Kconfig --- a/drivers/phy/qualcomm/Kconfig
+++ b/drivers/phy/qualcomm/Kconfig +++ b/drivers/phy/qualcomm/Kconfig
@@ -56,3 +56,15 @@ config PHY_QCOM_USB_HSIC @@ -65,3 +65,15 @@ config PHY_QCOM_USB_HSIC
select GENERIC_PHY select GENERIC_PHY
help help
Support for the USB HSIC ULPI compliant PHY on QCOM chipsets. Support for the USB HSIC ULPI compliant PHY on QCOM chipsets.
@ -31,14 +26,14 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ +
--- a/drivers/phy/qualcomm/Makefile --- a/drivers/phy/qualcomm/Makefile
+++ b/drivers/phy/qualcomm/Makefile +++ b/drivers/phy/qualcomm/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom- @@ -9,3 +9,4 @@ obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-
obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs-qmp-20nm.o obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs-qmp-20nm.o
obj-$(CONFIG_PHY_QCOM_USB_HS) += phy-qcom-usb-hs.o obj-$(CONFIG_PHY_QCOM_USB_HS) += phy-qcom-usb-hs.o
obj-$(CONFIG_PHY_QCOM_USB_HSIC) += phy-qcom-usb-hsic.o obj-$(CONFIG_PHY_QCOM_USB_HSIC) += phy-qcom-usb-hsic.o
+obj-$(CONFIG_PHY_QCOM_DWC3) += phy-qcom-dwc3.o +obj-$(CONFIG_PHY_QCOM_DWC3) += phy-qcom-dwc3.o
--- /dev/null --- /dev/null
+++ b/drivers/phy/qualcomm/phy-qcom-dwc3.c +++ b/drivers/phy/qualcomm/phy-qcom-dwc3.c
@@ -0,0 +1,575 @@ @@ -0,0 +1,578 @@
+/* Copyright (c) 2014-2015, Code Aurora Forum. All rights reserved. +/* Copyright (c) 2014-2015, Code Aurora Forum. All rights reserved.
+ * + *
+ * This program is free software; you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify
@ -59,6 +54,8 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+#include <linux/phy/phy.h> +#include <linux/phy/phy.h>
+#include <linux/platform_device.h> +#include <linux/platform_device.h>
+#include <linux/delay.h> +#include <linux/delay.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+ +
+/** +/**
+ * USB QSCRATCH Hardware registers + * USB QSCRATCH Hardware registers
@ -86,15 +83,15 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+/** +/**
+ * USB QSCRATCH Hardware registers + * USB QSCRATCH Hardware registers
+ */ + */
+#define SSUSB_PHY_CTRL_REG (0x00) +#define SSUSB_PHY_CTRL_REG (0x30)
+#define SSUSB_PHY_PARAM_CTRL_1 (0x04) +#define SSUSB_PHY_PARAM_CTRL_1 (0x34)
+#define SSUSB_PHY_PARAM_CTRL_2 (0x08) +#define SSUSB_PHY_PARAM_CTRL_2 (0x38)
+#define CR_PROTOCOL_DATA_IN_REG (0x0c) +#define CR_PROTOCOL_DATA_IN_REG (0x3c)
+#define CR_PROTOCOL_DATA_OUT_REG (0x10) +#define CR_PROTOCOL_DATA_OUT_REG (0x40)
+#define CR_PROTOCOL_CAP_ADDR_REG (0x14) +#define CR_PROTOCOL_CAP_ADDR_REG (0x44)
+#define CR_PROTOCOL_CAP_DATA_REG (0x18) +#define CR_PROTOCOL_CAP_DATA_REG (0x48)
+#define CR_PROTOCOL_READ_REG (0x1c) +#define CR_PROTOCOL_READ_REG (0x4c)
+#define CR_PROTOCOL_WRITE_REG (0x20) +#define CR_PROTOCOL_WRITE_REG (0x50)
+ +
+/* PHY_CTRL_REG */ +/* PHY_CTRL_REG */
+#define SSUSB_CTRL_REF_USE_PAD BIT(28) +#define SSUSB_CTRL_REF_USE_PAD BIT(28)
@ -103,7 +100,7 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+#define SSUSB_CTRL_SS_PHY_EN BIT(8) +#define SSUSB_CTRL_SS_PHY_EN BIT(8)
+#define SSUSB_CTRL_SS_PHY_RESET BIT(7) +#define SSUSB_CTRL_SS_PHY_RESET BIT(7)
+ +
+/* SSPHY control registers */ +/* SSPHY control registers - Does this need 0x30? */
+#define SSPHY_CTRL_RX_OVRD_IN_HI(lane) (0x1006 + 0x100 * lane) +#define SSPHY_CTRL_RX_OVRD_IN_HI(lane) (0x1006 + 0x100 * lane)
+#define SSPHY_CTRL_TX_OVRD_DRV_LO(lane) (0x1002 + 0x100 * lane) +#define SSPHY_CTRL_TX_OVRD_DRV_LO(lane) (0x1002 + 0x100 * lane)
+ +
@ -160,7 +157,7 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+#define SS_CR_WRITE_REG BIT(0) +#define SS_CR_WRITE_REG BIT(0)
+ +
+struct qcom_dwc3_usb_phy { +struct qcom_dwc3_usb_phy {
+ void __iomem *base; + struct regmap *base;
+ struct device *dev; + struct device *dev;
+ struct clk *xo_clk; + struct clk *xo_clk;
+ struct clk *ref_clk; + struct clk *ref_clk;
@ -186,15 +183,16 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ struct qcom_dwc3_usb_phy *phy_dwc3, u32 offset, + struct qcom_dwc3_usb_phy *phy_dwc3, u32 offset,
+ const u32 mask, u32 val) + const u32 mask, u32 val)
+{ +{
+ u32 write_val, tmp = readl(phy_dwc3->base + offset); + u32 write_val, tmp;
+ +
+ tmp = regmap_read(phy_dwc3->base, offset, &tmp);
+ tmp &= ~mask; /* retain other bits */ + tmp &= ~mask; /* retain other bits */
+ write_val = tmp | val; + write_val = tmp | val;
+ +
+ writel(write_val, phy_dwc3->base + offset); + regmap_write(phy_dwc3->base, offset, write_val);
+ +
+ /* Read back to see if val was written */ + /* Read back to see if val was written */
+ tmp = readl(phy_dwc3->base + offset); + regmap_read(phy_dwc3->base, offset, &tmp);
+ tmp &= mask; /* clear other bits */ + tmp &= mask; /* clear other bits */
+ +
+ if (tmp != val) + if (tmp != val)
@ -202,12 +200,13 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ val, offset); + val, offset);
+} +}
+ +
+static int wait_for_latch(void __iomem *addr) +static int wait_for_latch(struct regmap *base, u32 addr)
+{ +{
+ u32 retry = 10; + u32 retry = 10, data;
+ +
+ while (true) { + while (true) {
+ if (!readl(addr)) + regmap_read(base, addr, &data);
+ if (!data)
+ break; + break;
+ +
+ if (--retry == 0) + if (--retry == 0)
@ -231,23 +230,23 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+{ +{
+ int ret; + int ret;
+ +
+ writel(addr, phy_dwc3->base + CR_PROTOCOL_DATA_IN_REG); + regmap_write(phy_dwc3->base, CR_PROTOCOL_DATA_IN_REG, addr);
+ writel(SS_CR_CAP_ADDR_REG, phy_dwc3->base + CR_PROTOCOL_CAP_ADDR_REG); + regmap_write(phy_dwc3->base, CR_PROTOCOL_CAP_ADDR_REG, SS_CR_CAP_ADDR_REG);
+ +
+ ret = wait_for_latch(phy_dwc3->base + CR_PROTOCOL_CAP_ADDR_REG); + ret = wait_for_latch(phy_dwc3->base, CR_PROTOCOL_CAP_ADDR_REG);
+ if (ret) + if (ret)
+ goto err_wait; + goto err_wait;
+ +
+ writel(val, phy_dwc3->base + CR_PROTOCOL_DATA_IN_REG); + regmap_write(phy_dwc3->base, CR_PROTOCOL_DATA_IN_REG, val);
+ writel(SS_CR_CAP_DATA_REG, phy_dwc3->base + CR_PROTOCOL_CAP_DATA_REG); + regmap_write(phy_dwc3->base, CR_PROTOCOL_CAP_DATA_REG, SS_CR_CAP_DATA_REG);
+ +
+ ret = wait_for_latch(phy_dwc3->base + CR_PROTOCOL_CAP_DATA_REG); + ret = wait_for_latch(phy_dwc3->base, CR_PROTOCOL_CAP_DATA_REG);
+ if (ret) + if (ret)
+ goto err_wait; + goto err_wait;
+ +
+ writel(SS_CR_WRITE_REG, phy_dwc3->base + CR_PROTOCOL_WRITE_REG); + regmap_write(phy_dwc3->base, CR_PROTOCOL_WRITE_REG, SS_CR_WRITE_REG);
+ +
+ ret = wait_for_latch(phy_dwc3->base + CR_PROTOCOL_WRITE_REG); + ret = wait_for_latch(phy_dwc3->base, CR_PROTOCOL_WRITE_REG);
+ +
+err_wait: +err_wait:
+ if (ret) + if (ret)
@ -261,14 +260,14 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ * @base - QCOM DWC3 PHY base virtual address. + * @base - QCOM DWC3 PHY base virtual address.
+ * @addr - SSPHY address to read. + * @addr - SSPHY address to read.
+ */ + */
+static int qcom_dwc3_ss_read_phycreg(void __iomem *base, u32 addr, u32 *val) +static int qcom_dwc3_ss_read_phycreg(struct regmap *base, u32 addr, u32 *val)
+{ +{
+ int ret; + int ret;
+ +
+ writel(addr, base + CR_PROTOCOL_DATA_IN_REG); + regmap_write(base, CR_PROTOCOL_DATA_IN_REG, addr);
+ writel(SS_CR_CAP_ADDR_REG, base + CR_PROTOCOL_CAP_ADDR_REG); + regmap_write(base, CR_PROTOCOL_CAP_ADDR_REG, SS_CR_CAP_ADDR_REG);
+ +
+ ret = wait_for_latch(base + CR_PROTOCOL_CAP_ADDR_REG); + ret = wait_for_latch(base, CR_PROTOCOL_CAP_ADDR_REG);
+ if (ret) + if (ret)
+ goto err_wait; + goto err_wait;
+ +
@ -277,22 +276,22 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ * incorrect. Hence as workaround, SW should perform SSPHY register + * incorrect. Hence as workaround, SW should perform SSPHY register
+ * read twice, but use only second read and ignore first read. + * read twice, but use only second read and ignore first read.
+ */ + */
+ writel(SS_CR_READ_REG, base + CR_PROTOCOL_READ_REG); + regmap_write(base, CR_PROTOCOL_READ_REG, SS_CR_READ_REG);
+ +
+ ret = wait_for_latch(base + CR_PROTOCOL_READ_REG); + ret = wait_for_latch(base, CR_PROTOCOL_READ_REG);
+ if (ret) + if (ret)
+ goto err_wait; + goto err_wait;
+ +
+ /* throwaway read */ + /* throwaway read */
+ readl(base + CR_PROTOCOL_DATA_OUT_REG); + regmap_read(base, CR_PROTOCOL_DATA_OUT_REG, &ret);
+ +
+ writel(SS_CR_READ_REG, base + CR_PROTOCOL_READ_REG); + regmap_write(base, CR_PROTOCOL_READ_REG, SS_CR_READ_REG);
+ +
+ ret = wait_for_latch(base + CR_PROTOCOL_READ_REG); + ret = wait_for_latch(base, CR_PROTOCOL_READ_REG);
+ if (ret) + if (ret)
+ goto err_wait; + goto err_wait;
+ +
+ *val = readl(base + CR_PROTOCOL_DATA_OUT_REG); + regmap_read(base, CR_PROTOCOL_DATA_OUT_REG, val);
+ +
+err_wait: +err_wait:
+ return ret; + return ret;
@ -328,11 +327,11 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ if (!phy_dwc3->xo_clk) + if (!phy_dwc3->xo_clk)
+ val |= HSUSB_CTRL_USE_CLKCORE; + val |= HSUSB_CTRL_USE_CLKCORE;
+ +
+ writel(val, phy_dwc3->base + HSUSB_PHY_CTRL_REG); + regmap_write(phy_dwc3->base, HSUSB_PHY_CTRL_REG, val);
+ usleep_range(2000, 2200); + usleep_range(2000, 2200);
+ +
+ /* Disable (bypass) VBUS and ID filters */ + /* Disable (bypass) VBUS and ID filters */
+ writel(HSUSB_GCFG_XHCI_REV, phy_dwc3->base + QSCRATCH_GENERAL_CFG); + regmap_write(phy_dwc3->base, QSCRATCH_GENERAL_CFG, HSUSB_GCFG_XHCI_REV);
+ +
+ return 0; + return 0;
+} +}
@ -364,11 +363,11 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ } + }
+ +
+ /* reset phy */ + /* reset phy */
+ data = readl(phy_dwc3->base + SSUSB_PHY_CTRL_REG); + regmap_read(phy_dwc3->base, SSUSB_PHY_CTRL_REG, &data);
+ writel(data | SSUSB_CTRL_SS_PHY_RESET, + regmap_write(phy_dwc3->base, SSUSB_PHY_CTRL_REG,
+ phy_dwc3->base + SSUSB_PHY_CTRL_REG); + data | SSUSB_CTRL_SS_PHY_RESET);
+ usleep_range(2000, 2200); + usleep_range(2000, 2200);
+ writel(data, phy_dwc3->base + SSUSB_PHY_CTRL_REG); + regmap_write(phy_dwc3->base, SSUSB_PHY_CTRL_REG, data);
+ +
+ /* clear REF_PAD if we don't have XO clk */ + /* clear REF_PAD if we don't have XO clk */
+ if (!phy_dwc3->xo_clk) + if (!phy_dwc3->xo_clk)
@ -376,13 +375,13 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ else + else
+ data |= SSUSB_CTRL_REF_USE_PAD; + data |= SSUSB_CTRL_REF_USE_PAD;
+ +
+ writel(data, phy_dwc3->base + SSUSB_PHY_CTRL_REG); + regmap_write(phy_dwc3->base, SSUSB_PHY_CTRL_REG, data);
+ +
+ /* wait for ref clk to become stable, this can take up to 30ms */ + /* wait for ref clk to become stable, this can take up to 30ms */
+ msleep(30); + msleep(30);
+ +
+ data |= SSUSB_CTRL_SS_PHY_EN | SSUSB_CTRL_LANE0_PWR_PRESENT; + data |= SSUSB_CTRL_SS_PHY_EN | SSUSB_CTRL_LANE0_PWR_PRESENT;
+ writel(data, phy_dwc3->base + SSUSB_PHY_CTRL_REG); + regmap_write(phy_dwc3->base, SSUSB_PHY_CTRL_REG, data);
+ +
+ /* + /*
+ * WORKAROUND: There is SSPHY suspend bug due to which USB enumerates + * WORKAROUND: There is SSPHY suspend bug due to which USB enumerates
@ -460,7 +459,7 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ * TX_DEEMPH_3_5DB [13:8] set based on SoC version + * TX_DEEMPH_3_5DB [13:8] set based on SoC version
+ * LOS_BIAS [7:3] to 9 + * LOS_BIAS [7:3] to 9
+ */ + */
+ data = readl(phy_dwc3->base + SSUSB_PHY_PARAM_CTRL_1); + regmap_read(phy_dwc3->base, SSUSB_PHY_PARAM_CTRL_1, &data);
+ +
+ data &= ~PHY_PARAM_CTRL1_MASK; + data &= ~PHY_PARAM_CTRL1_MASK;
+ +
@ -542,10 +541,9 @@ Signed-off-by: Andy Gross <agross@codeaurora.org>
+ +
+ phy_dwc3->dev = &pdev->dev; + phy_dwc3->dev = &pdev->dev;
+ +
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + phy_dwc3->base = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap");
+ phy_dwc3->base = devm_ioremap_resource(phy_dwc3->dev, res); + if (IS_ERR_OR_NULL(phy_dwc3->base))
+ if (IS_ERR(phy_dwc3->base)) + return PTR_ERR_OR_ZERO(phy_dwc3->base) ? : -EINVAL;
+ return PTR_ERR(phy_dwc3->base);
+ +
+ phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref"); + phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref");
+ if (IS_ERR(phy_dwc3->ref_clk)) { + if (IS_ERR(phy_dwc3->ref_clk)) {

View File

@ -1,21 +1,7 @@
From patchwork Fri Dec 8 09:42:19 2017 From 36d68f64c411e09788687d5919886aadeb92adca Mon Sep 17 00:00:00 2001
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,01/12] ARM: Add Krait L2 register accessor functions
From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102101
Message-Id: <1512726150-7204-2-git-send-email-sricharan@codeaurora.org>
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org, Mark Rutland <mark.rutland@arm.com>,
Russell King <linux@arm.linux.org.uk>,
Courtney Cavin <courtney.cavin@sonymobile.com>
Date: Fri, 8 Dec 2017 15:12:19 +0530
From: Stephen Boyd <sboyd@codeaurora.org> From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:20 +0530
Subject: [PATCH 01/12] ARM: Add Krait L2 register accessor functions
Krait CPUs have a handful of L2 cache controller registers that Krait CPUs have a handful of L2 cache controller registers that
live behind a cp15 based indirection register. First you program live behind a cp15 based indirection register. First you program
@ -28,14 +14,17 @@ underneath us.
Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Russell King <linux@arm.linux.org.uk> Cc: Russell King <linux@arm.linux.org.uk>
Cc: Courtney Cavin <courtney.cavin@sonymobile.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
--- ---
arch/arm/common/Kconfig | 3 ++ arch/arm/common/Kconfig | 3 ++
arch/arm/common/Makefile | 1 + arch/arm/common/Makefile | 1 +
arch/arm/common/krait-l2-accessors.c | 58 +++++++++++++++++++++++++++++++ arch/arm/common/krait-l2-accessors.c | 48 +++++++++++++++++++++++
arch/arm/include/asm/krait-l2-accessors.h | 20 +++++++++++ arch/arm/include/asm/krait-l2-accessors.h | 9 +++++
4 files changed, 82 insertions(+) 4 files changed, 61 insertions(+)
create mode 100644 arch/arm/common/krait-l2-accessors.c create mode 100644 arch/arm/common/krait-l2-accessors.c
create mode 100644 arch/arm/include/asm/krait-l2-accessors.h create mode 100644 arch/arm/include/asm/krait-l2-accessors.h
@ -63,19 +52,9 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o
--- /dev/null --- /dev/null
+++ b/arch/arm/common/krait-l2-accessors.c +++ b/arch/arm/common/krait-l2-accessors.c
@@ -0,0 +1,58 @@ @@ -0,0 +1,48 @@
+/* +// SPDX-License-Identifier: GPL-2.0
+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +// Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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 <linux/spinlock.h> +#include <linux/spinlock.h>
+#include <linux/export.h> +#include <linux/export.h>
@ -124,19 +103,8 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+EXPORT_SYMBOL(krait_get_l2_indirect_reg); +EXPORT_SYMBOL(krait_get_l2_indirect_reg);
--- /dev/null --- /dev/null
+++ b/arch/arm/include/asm/krait-l2-accessors.h +++ b/arch/arm/include/asm/krait-l2-accessors.h
@@ -0,0 +1,20 @@ @@ -0,0 +1,9 @@
+/* +/* SPDX-License-Identifier: GPL-2.0 */
+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+ +
+#ifndef __ASMARM_KRAIT_L2_ACCESSORS_H +#ifndef __ASMARM_KRAIT_L2_ACCESSORS_H
+#define __ASMARM_KRAIT_L2_ACCESSORS_H +#define __ASMARM_KRAIT_L2_ACCESSORS_H

View File

@ -1,57 +1,39 @@
From patchwork Fri Dec 8 09:42:21 2017 From b3f2f10693aadeacf83ab5be03810941a4b77612 Mon Sep 17 00:00:00 2001
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,03/12] clk: qcom: Add support for High-Frequency PLLs (HFPLLs)
From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102083
Message-Id: <1512726150-7204-4-git-send-email-sricharan@codeaurora.org>
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org
Date: Fri, 8 Dec 2017 15:12:21 +0530
From: Stephen Boyd <sboyd@codeaurora.org> From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:21 +0530
Subject: [PATCH 02/12] clk: qcom: Add support for High-Frequency PLLs (HFPLLs)
HFPLLs are the main frequency source for Krait CPU clocks. Add HFPLLs are the main frequency source for Krait CPU clocks. Add
support for changing the rate of these PLLs. support for changing the rate of these PLLs.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
--- ---
drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/clk-hfpll.c | 253 +++++++++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/clk-hfpll.c | 244 +++++++++++++++++++++++++++++++++++
drivers/clk/qcom/clk-hfpll.h | 54 +++++++++ drivers/clk/qcom/clk-hfpll.h | 44 +++++++
3 files changed, 308 insertions(+) 3 files changed, 289 insertions(+)
create mode 100644 drivers/clk/qcom/clk-hfpll.c create mode 100644 drivers/clk/qcom/clk-hfpll.c
create mode 100644 drivers/clk/qcom/clk-hfpll.h create mode 100644 drivers/clk/qcom/clk-hfpll.h
--- a/drivers/clk/qcom/Makefile --- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile
@@ -10,6 +10,7 @@ clk-qcom-y += clk-rcg2.o @@ -11,6 +11,7 @@ clk-qcom-y += clk-branch.o
clk-qcom-y += clk-branch.o
clk-qcom-y += clk-regmap-divider.o clk-qcom-y += clk-regmap-divider.o
clk-qcom-y += clk-regmap-mux.o clk-qcom-y += clk-regmap-mux.o
clk-qcom-y += clk-regmap-mux-div.o
+clk-qcom-y += clk-hfpll.o +clk-qcom-y += clk-hfpll.o
clk-qcom-y += reset.o clk-qcom-y += reset.o
clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o
--- /dev/null --- /dev/null
+++ b/drivers/clk/qcom/clk-hfpll.c +++ b/drivers/clk/qcom/clk-hfpll.c
@@ -0,0 +1,253 @@ @@ -0,0 +1,244 @@
+/* +// SPDX-License-Identifier: GPL-2.0
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +// Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * +
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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 <linux/kernel.h> +#include <linux/kernel.h>
+#include <linux/export.h> +#include <linux/export.h>
+#include <linux/regmap.h> +#include <linux/regmap.h>
@ -295,19 +277,9 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+EXPORT_SYMBOL_GPL(clk_ops_hfpll); +EXPORT_SYMBOL_GPL(clk_ops_hfpll);
--- /dev/null --- /dev/null
+++ b/drivers/clk/qcom/clk-hfpll.h +++ b/drivers/clk/qcom/clk-hfpll.h
@@ -0,0 +1,54 @@ @@ -0,0 +1,44 @@
+/* +/* SPDX-License-Identifier: GPL-2.0 */
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+#ifndef __QCOM_CLK_HFPLL_H__ +#ifndef __QCOM_CLK_HFPLL_H__
+#define __QCOM_CLK_HFPLL_H__ +#define __QCOM_CLK_HFPLL_H__
+ +

View File

@ -1,19 +1,7 @@
From patchwork Fri Dec 8 09:42:22 2017 From cb546b797a0da4dbb1a0c76a2a357921887b6189 Mon Sep 17 00:00:00 2001
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,04/12] clk: qcom: Add HFPLL driver
From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102079
Message-Id: <1512726150-7204-5-git-send-email-sricharan@codeaurora.org>
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org
Date: Fri, 8 Dec 2017 15:12:22 +0530
From: Stephen Boyd <sboyd@codeaurora.org> From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:22 +0530
Subject: [PATCH 03/12] clk: qcom: Add HFPLL driver
On some devices (MSM8974 for example), the HFPLLs are On some devices (MSM8974 for example), the HFPLLs are
instantiated within the Krait processor subsystem as separate instantiated within the Krait processor subsystem as separate
@ -22,64 +10,22 @@ provide HFPLL clocks for use by the system.
Cc: <devicetree@vger.kernel.org> Cc: <devicetree@vger.kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
--- ---
.../devicetree/bindings/clock/qcom,hfpll.txt | 40 ++++++++ drivers/clk/qcom/Kconfig | 8 ++++
drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/hfpll.c | 96 +++++++++++++++++++++++++++++++++++++++
drivers/clk/qcom/hfpll.c | 106 +++++++++++++++++++++ 3 files changed, 105 insertions(+)
4 files changed, 155 insertions(+)
create mode 100644 Documentation/devicetree/bindings/clock/qcom,hfpll.txt
create mode 100644 drivers/clk/qcom/hfpll.c create mode 100644 drivers/clk/qcom/hfpll.c
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/qcom,hfpll.txt
@@ -0,0 +1,40 @@
+High-Frequency PLL (HFPLL)
+
+PROPERTIES
+
+- compatible:
+ Usage: required
+ Value type: <string>
+ Definition: must be "qcom,hfpll"
+
+- reg:
+ Usage: required
+ Value type: <prop-encoded-array>
+ Definition: address and size of HPLL registers. An optional second
+ element specifies the address and size of the alias
+ register region.
+
+- clock-output-names:
+ Usage: required
+ Value type: <string>
+ Definition: Name of the PLL. Typically hfpllX where X is a CPU number
+ starting at 0. Otherwise hfpll_Y where Y is more specific
+ such as "l2".
+
+Example:
+
+1) An HFPLL for the L2 cache.
+
+ clock-controller@f9016000 {
+ compatible = "qcom,hfpll";
+ reg = <0xf9016000 0x30>;
+ clock-output-names = "hfpll_l2";
+ };
+
+2) An HFPLL for CPU0. This HFPLL has the alias register region.
+
+ clock-controller@f908a000 {
+ compatible = "qcom,hfpll";
+ reg = <0xf908a000 0x30>, <0xf900a000 0x30>;
+ clock-output-names = "hfpll0";
+ };
--- a/drivers/clk/qcom/Kconfig --- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig
@@ -196,3 +196,11 @@ config MSM_MMCC_8996 @@ -272,3 +272,11 @@ config SPMI_PMIC_CLKDIV
Support for the multimedia clock controller on msm8996 devices. Technologies, Inc. SPMI PMIC. It configures the frequency of
Say Y if you want to support multimedia devices such as display, clkdiv outputs of the PMIC. These clocks are typically wired
graphics, video encode/decode, camera, etc. through alternate functions on GPIO pins.
+ +
+config QCOM_HFPLL +config QCOM_HFPLL
+ tristate "High-Frequency PLL (HFPLL) Clock Controller" + tristate "High-Frequency PLL (HFPLL) Clock Controller"
@ -90,26 +36,16 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+ such as MSM8974, APQ8084, etc. + such as MSM8974, APQ8084, etc.
--- a/drivers/clk/qcom/Makefile --- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile
@@ -35,3 +35,4 @@ obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8 @@ -44,3 +44,4 @@ obj-$(CONFIG_SDM_DISPCC_845) += dispcc-s
obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o
obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o
obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
+obj-$(CONFIG_QCOM_HFPLL) += hfpll.o +obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
--- /dev/null --- /dev/null
+++ b/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c
@@ -0,0 +1,106 @@ @@ -0,0 +1,96 @@
+/* +// SPDX-License-Identifier: GPL-2.0
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +// Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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 <linux/kernel.h> +#include <linux/kernel.h>
+#include <linux/init.h> +#include <linux/init.h>

View File

@ -0,0 +1,81 @@
From 1f924faa8b1e4789ecc06ed0dd58ca3487c89012 Mon Sep 17 00:00:00 2001
From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:23 +0530
Subject: [PATCH 04/12] dt-bindings: clock: Document qcom,hfpll
Adds bindings document for qcom,hfpll instantiated within
the Krait processor subsystem as separate register region.
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
.../devicetree/bindings/clock/qcom,hfpll.txt | 60 +++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 Documentation/devicetree/bindings/clock/qcom,hfpll.txt
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/qcom,hfpll.txt
@@ -0,0 +1,60 @@
+High-Frequency PLL (HFPLL)
+
+PROPERTIES
+
+- compatible:
+ Usage: required
+ Value type: <string>:
+ shall contain only one of the following. The generic
+ compatible "qcom,hfpll" should be also included.
+
+ "qcom,hfpll-ipq8064", "qcom,hfpll"
+ "qcom,hfpll-apq8064", "qcom,hfpll"
+ "qcom,hfpll-msm8974", "qcom,hfpll"
+ "qcom,hfpll-msm8960", "qcom,hfpll"
+
+- reg:
+ Usage: required
+ Value type: <prop-encoded-array>
+ Definition: address and size of HPLL registers. An optional second
+ element specifies the address and size of the alias
+ register region.
+
+- clocks:
+ Usage: required
+ Value type: <prop-encoded-array>
+ Definition: reference to the xo clock.
+
+- clock-names:
+ Usage: required
+ Value type: <stringlist>
+ Definition: must be "xo".
+
+- clock-output-names:
+ Usage: required
+ Value type: <string>
+ Definition: Name of the PLL. Typically hfpllX where X is a CPU number
+ starting at 0. Otherwise hfpll_Y where Y is more specific
+ such as "l2".
+
+Example:
+
+1) An HFPLL for the L2 cache.
+
+ clock-controller@f9016000 {
+ compatible = "qcom,hfpll-ipq8064", "qcom,hfpll";
+ reg = <0xf9016000 0x30>;
+ clocks = <&xo_board>;
+ clock-names = "xo";
+ clock-output-names = "hfpll_l2";
+ };
+
+2) An HFPLL for CPU0. This HFPLL has the alias register region.
+
+ clock-controller@f908a000 {
+ compatible = "qcom,hfpll-ipq8064", "qcom,hfpll";
+ reg = <0xf908a000 0x30>, <0xf900a000 0x30>;
+ clocks = <&xo_board>;
+ clock-names = "xo";
+ clock-output-names = "hfpll0";
+ };

View File

@ -0,0 +1,236 @@
From 72ad7207954dd622a662ba884dc6c30a820123f2 Mon Sep 17 00:00:00 2001
From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:24 +0530
Subject: [PATCH 05/12] clk: qcom: Add MSM8960/APQ8064's HFPLLs
Describe the HFPLLs present on MSM8960 and APQ8064 devices.
Acked-by: Rob Herring <robh@kernel.org> (bindings)
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
drivers/clk/qcom/gcc-msm8960.c | 172 +++++++++++++++++++
include/dt-bindings/clock/qcom,gcc-msm8960.h | 2 +
2 files changed, 174 insertions(+)
--- a/drivers/clk/qcom/gcc-msm8960.c
+++ b/drivers/clk/qcom/gcc-msm8960.c
@@ -30,6 +30,7 @@
#include "clk-pll.h"
#include "clk-rcg.h"
#include "clk-branch.h"
+#include "clk-hfpll.h"
#include "reset.h"
static struct clk_pll pll3 = {
@@ -86,6 +87,164 @@ static struct clk_regmap pll8_vote = {
},
};
+static struct hfpll_data hfpll0_data = {
+ .mode_reg = 0x3200,
+ .l_reg = 0x3208,
+ .m_reg = 0x320c,
+ .n_reg = 0x3210,
+ .config_reg = 0x3204,
+ .status_reg = 0x321c,
+ .config_val = 0x7845c665,
+ .droop_reg = 0x3214,
+ .droop_val = 0x0108c000,
+ .min_rate = 600000000UL,
+ .max_rate = 1800000000UL,
+};
+
+static struct clk_hfpll hfpll0 = {
+ .d = &hfpll0_data,
+ .clkr.hw.init = &(struct clk_init_data){
+ .parent_names = (const char *[]){ "pxo" },
+ .num_parents = 1,
+ .name = "hfpll0",
+ .ops = &clk_ops_hfpll,
+ .flags = CLK_IGNORE_UNUSED,
+ },
+ .lock = __SPIN_LOCK_UNLOCKED(hfpll0.lock),
+};
+
+static struct hfpll_data hfpll1_8064_data = {
+ .mode_reg = 0x3240,
+ .l_reg = 0x3248,
+ .m_reg = 0x324c,
+ .n_reg = 0x3250,
+ .config_reg = 0x3244,
+ .status_reg = 0x325c,
+ .config_val = 0x7845c665,
+ .droop_reg = 0x3254,
+ .droop_val = 0x0108c000,
+ .min_rate = 600000000UL,
+ .max_rate = 1800000000UL,
+};
+
+static struct hfpll_data hfpll1_data = {
+ .mode_reg = 0x3300,
+ .l_reg = 0x3308,
+ .m_reg = 0x330c,
+ .n_reg = 0x3310,
+ .config_reg = 0x3304,
+ .status_reg = 0x331c,
+ .config_val = 0x7845c665,
+ .droop_reg = 0x3314,
+ .droop_val = 0x0108c000,
+ .min_rate = 600000000UL,
+ .max_rate = 1800000000UL,
+};
+
+static struct clk_hfpll hfpll1 = {
+ .d = &hfpll1_data,
+ .clkr.hw.init = &(struct clk_init_data){
+ .parent_names = (const char *[]){ "pxo" },
+ .num_parents = 1,
+ .name = "hfpll1",
+ .ops = &clk_ops_hfpll,
+ .flags = CLK_IGNORE_UNUSED,
+ },
+ .lock = __SPIN_LOCK_UNLOCKED(hfpll1.lock),
+};
+
+static struct hfpll_data hfpll2_data = {
+ .mode_reg = 0x3280,
+ .l_reg = 0x3288,
+ .m_reg = 0x328c,
+ .n_reg = 0x3290,
+ .config_reg = 0x3284,
+ .status_reg = 0x329c,
+ .config_val = 0x7845c665,
+ .droop_reg = 0x3294,
+ .droop_val = 0x0108c000,
+ .min_rate = 600000000UL,
+ .max_rate = 1800000000UL,
+};
+
+static struct clk_hfpll hfpll2 = {
+ .d = &hfpll2_data,
+ .clkr.hw.init = &(struct clk_init_data){
+ .parent_names = (const char *[]){ "pxo" },
+ .num_parents = 1,
+ .name = "hfpll2",
+ .ops = &clk_ops_hfpll,
+ .flags = CLK_IGNORE_UNUSED,
+ },
+ .lock = __SPIN_LOCK_UNLOCKED(hfpll2.lock),
+};
+
+static struct hfpll_data hfpll3_data = {
+ .mode_reg = 0x32c0,
+ .l_reg = 0x32c8,
+ .m_reg = 0x32cc,
+ .n_reg = 0x32d0,
+ .config_reg = 0x32c4,
+ .status_reg = 0x32dc,
+ .config_val = 0x7845c665,
+ .droop_reg = 0x32d4,
+ .droop_val = 0x0108c000,
+ .min_rate = 600000000UL,
+ .max_rate = 1800000000UL,
+};
+
+static struct clk_hfpll hfpll3 = {
+ .d = &hfpll3_data,
+ .clkr.hw.init = &(struct clk_init_data){
+ .parent_names = (const char *[]){ "pxo" },
+ .num_parents = 1,
+ .name = "hfpll3",
+ .ops = &clk_ops_hfpll,
+ .flags = CLK_IGNORE_UNUSED,
+ },
+ .lock = __SPIN_LOCK_UNLOCKED(hfpll3.lock),
+};
+
+static struct hfpll_data hfpll_l2_8064_data = {
+ .mode_reg = 0x3300,
+ .l_reg = 0x3308,
+ .m_reg = 0x330c,
+ .n_reg = 0x3310,
+ .config_reg = 0x3304,
+ .status_reg = 0x331c,
+ .config_val = 0x7845c665,
+ .droop_reg = 0x3314,
+ .droop_val = 0x0108c000,
+ .min_rate = 600000000UL,
+ .max_rate = 1800000000UL,
+};
+
+static struct hfpll_data hfpll_l2_data = {
+ .mode_reg = 0x3400,
+ .l_reg = 0x3408,
+ .m_reg = 0x340c,
+ .n_reg = 0x3410,
+ .config_reg = 0x3404,
+ .status_reg = 0x341c,
+ .config_val = 0x7845c665,
+ .droop_reg = 0x3414,
+ .droop_val = 0x0108c000,
+ .min_rate = 600000000UL,
+ .max_rate = 1800000000UL,
+};
+
+static struct clk_hfpll hfpll_l2 = {
+ .d = &hfpll_l2_data,
+ .clkr.hw.init = &(struct clk_init_data){
+ .parent_names = (const char *[]){ "pxo" },
+ .num_parents = 1,
+ .name = "hfpll_l2",
+ .ops = &clk_ops_hfpll,
+ .flags = CLK_IGNORE_UNUSED,
+ },
+ .lock = __SPIN_LOCK_UNLOCKED(hfpll_l2.lock),
+};
+
static struct clk_pll pll14 = {
.l_reg = 0x31c4,
.m_reg = 0x31c8,
@@ -3107,6 +3266,9 @@ static struct clk_regmap *gcc_msm8960_cl
[PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
[PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
[RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
+ [PLL9] = &hfpll0.clkr,
+ [PLL10] = &hfpll1.clkr,
+ [PLL12] = &hfpll_l2.clkr,
};
static const struct qcom_reset_map gcc_msm8960_resets[] = {
@@ -3318,6 +3480,11 @@ static struct clk_regmap *gcc_apq8064_cl
[PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
[PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
[RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
+ [PLL9] = &hfpll0.clkr,
+ [PLL10] = &hfpll1.clkr,
+ [PLL12] = &hfpll_l2.clkr,
+ [PLL16] = &hfpll2.clkr,
+ [PLL17] = &hfpll3.clkr,
};
static const struct qcom_reset_map gcc_apq8064_resets[] = {
@@ -3477,6 +3644,11 @@ static int gcc_msm8960_probe(struct plat
if (ret)
return ret;
+ if (match->data == &gcc_apq8064_desc) {
+ hfpll1.d = &hfpll1_8064_data;
+ hfpll_l2.d = &hfpll_l2_8064_data;
+ }
+
tsens = platform_device_register_data(&pdev->dev, "qcom-tsens", -1,
NULL, 0);
if (IS_ERR(tsens))
--- a/include/dt-bindings/clock/qcom,gcc-msm8960.h
+++ b/include/dt-bindings/clock/qcom,gcc-msm8960.h
@@ -319,5 +319,7 @@
#define CE3_SRC 303
#define CE3_CORE_CLK 304
#define CE3_H_CLK 305
+#define PLL16 306
+#define PLL17 307
#endif

View File

@ -1,25 +1,16 @@
From patchwork Fri Dec 8 09:42:24 2017 From 1f79131bfd512f322c16b58dca581ce39beafab9 Mon Sep 17 00:00:00 2001
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,06/12] clk: qcom: Add IPQ806X's HFPLLs
From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102047
Message-Id: <1512726150-7204-7-git-send-email-sricharan@codeaurora.org>
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org
Date: Fri, 8 Dec 2017 15:12:24 +0530
From: Stephen Boyd <sboyd@codeaurora.org> From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:25 +0530
Subject: [PATCH 06/12] clk: qcom: Add IPQ806X's HFPLLs
Describe the HFPLLs present on IPQ806X devices. Describe the HFPLLs present on IPQ806X devices.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
--- ---
drivers/clk/qcom/gcc-ipq806x.c | 82 ++++++++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/gcc-ipq806x.c | 82 ++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+) 1 file changed, 82 insertions(+)
--- a/drivers/clk/qcom/gcc-ipq806x.c --- a/drivers/clk/qcom/gcc-ipq806x.c
@ -117,7 +108,7 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
static struct clk_pll pll14 = { static struct clk_pll pll14 = {
.l_reg = 0x31c4, .l_reg = 0x31c4,
.m_reg = 0x31c8, .m_reg = 0x31c8,
@@ -2801,6 +2880,9 @@ static struct clk_regmap *gcc_ipq806x_cl @@ -2798,6 +2877,9 @@ static struct clk_regmap *gcc_ipq806x_cl
[UBI32_CORE2_CLK_SRC] = &ubi32_core2_src_clk.clkr, [UBI32_CORE2_CLK_SRC] = &ubi32_core2_src_clk.clkr,
[NSSTCM_CLK_SRC] = &nss_tcm_src.clkr, [NSSTCM_CLK_SRC] = &nss_tcm_src.clkr,
[NSSTCM_CLK] = &nss_tcm_clk.clkr, [NSSTCM_CLK] = &nss_tcm_clk.clkr,

View File

@ -1,19 +1,7 @@
From patchwork Fri Dec 8 09:42:25 2017 From 4d7dc77babfef1d6cb8fd825e2f17dc3384c3272 Mon Sep 17 00:00:00 2001
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,07/12] clk: qcom: Add support for Krait clocks
From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102051
Message-Id: <1512726150-7204-8-git-send-email-sricharan@codeaurora.org>
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org
Date: Fri, 8 Dec 2017 15:12:25 +0530
From: Stephen Boyd <sboyd@codeaurora.org> From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:26 +0530
Subject: [PATCH 07/12] clk: qcom: Add support for Krait clocks
The Krait clocks are made up of a series of muxes and a divider The Krait clocks are made up of a series of muxes and a divider
that choose between a fixed rate clock and dedicated HFPLLs for that choose between a fixed rate clock and dedicated HFPLLs for
@ -22,50 +10,45 @@ Krait implementation exposes the remux control via cp15
registers. Support these clocks. registers. Support these clocks.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
[sboyd@kernel.org: Move hidden config to top outside of the visible qcom
config zone so that menuconfig looks nice]
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
--- ---
drivers/clk/qcom/Kconfig | 4 ++ drivers/clk/qcom/Kconfig | 4 ++
drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/clk-krait.c | 134 +++++++++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/clk-krait.c | 124 +++++++++++++++++++++++++++++++++++
drivers/clk/qcom/clk-krait.h | 48 ++++++++++++++++ drivers/clk/qcom/clk-krait.h | 37 +++++++++++
4 files changed, 187 insertions(+) 4 files changed, 166 insertions(+)
create mode 100644 drivers/clk/qcom/clk-krait.c create mode 100644 drivers/clk/qcom/clk-krait.c
create mode 100644 drivers/clk/qcom/clk-krait.h create mode 100644 drivers/clk/qcom/clk-krait.h
--- a/drivers/clk/qcom/Kconfig --- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig
@@ -204,3 +204,7 @@ config QCOM_HFPLL @@ -1,3 +1,7 @@
Support for the high-frequency PLLs present on Qualcomm devices.
Say Y if you want to support CPU frequency scaling on devices
such as MSM8974, APQ8084, etc.
+
+config KRAIT_CLOCKS +config KRAIT_CLOCKS
+ bool + bool
+ select KRAIT_L2_ACCESSORS + select KRAIT_L2_ACCESSORS
+
config QCOM_GDSC
bool
select PM_GENERIC_DOMAINS if PM
--- a/drivers/clk/qcom/Makefile --- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile
@@ -10,6 +10,7 @@ clk-qcom-y += clk-rcg2.o @@ -11,6 +11,7 @@ clk-qcom-y += clk-branch.o
clk-qcom-y += clk-branch.o
clk-qcom-y += clk-regmap-divider.o clk-qcom-y += clk-regmap-divider.o
clk-qcom-y += clk-regmap-mux.o clk-qcom-y += clk-regmap-mux.o
clk-qcom-y += clk-regmap-mux-div.o
+clk-qcom-$(CONFIG_KRAIT_CLOCKS) += clk-krait.o +clk-qcom-$(CONFIG_KRAIT_CLOCKS) += clk-krait.o
clk-qcom-y += clk-hfpll.o clk-qcom-y += clk-hfpll.o
clk-qcom-y += reset.o clk-qcom-y += reset.o
clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o
--- /dev/null --- /dev/null
+++ b/drivers/clk/qcom/clk-krait.c +++ b/drivers/clk/qcom/clk-krait.c
@@ -0,0 +1,134 @@ @@ -0,0 +1,124 @@
+/* +// SPDX-License-Identifier: GPL-2.0
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +// Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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 <linux/kernel.h> +#include <linux/kernel.h>
+#include <linux/module.h> +#include <linux/module.h>
@ -190,19 +173,8 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+EXPORT_SYMBOL_GPL(krait_div2_clk_ops); +EXPORT_SYMBOL_GPL(krait_div2_clk_ops);
--- /dev/null --- /dev/null
+++ b/drivers/clk/qcom/clk-krait.h +++ b/drivers/clk/qcom/clk-krait.h
@@ -0,0 +1,48 @@ @@ -0,0 +1,37 @@
+/* +/* SPDX-License-Identifier: GPL-2.0 */
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+ +
+#ifndef __QCOM_CLK_KRAIT_H +#ifndef __QCOM_CLK_KRAIT_H
+#define __QCOM_CLK_KRAIT_H +#define __QCOM_CLK_KRAIT_H

View File

@ -0,0 +1,134 @@
From 3ddc3564d3c9f097986bd4ccbe34152413811335 Mon Sep 17 00:00:00 2001
From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:27 +0530
Subject: [PATCH 08/12] clk: qcom: Add KPSS ACC/GCC driver
The ACC and GCC regions present in KPSSv1 contain registers to
control clocks and power to each Krait CPU and L2. For CPUfreq
purposes probe these devices and expose a mux clock that chooses
between PXO and PLL8.
Cc: <devicetree@vger.kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
drivers/clk/qcom/Kconfig | 8 ++++
drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/kpss-xcc.c | 87 +++++++++++++++++++++++++++++++++++++
3 files changed, 96 insertions(+)
create mode 100644 drivers/clk/qcom/kpss-xcc.c
--- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig
@@ -284,3 +284,11 @@ config QCOM_HFPLL
Support for the high-frequency PLLs present on Qualcomm devices.
Say Y if you want to support CPU frequency scaling on devices
such as MSM8974, APQ8084, etc.
+
+config KPSS_XCC
+ tristate "KPSS Clock Controller"
+ depends on COMMON_CLK_QCOM
+ help
+ Support for the Krait ACC and GCC clock controllers. Say Y
+ if you want to support CPU frequency scaling on devices such
+ as MSM8960, APQ8064, etc.
--- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile
@@ -45,4 +45,5 @@ obj-$(CONFIG_SDM_DISPCC_845) += dispcc-s
obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o
obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o
obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
+obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
--- /dev/null
+++ b/drivers/clk/qcom/kpss-xcc.c
@@ -0,0 +1,87 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018, The Linux Foundation. All rights reserved.
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+
+static const char *aux_parents[] = {
+ "pll8_vote",
+ "pxo",
+};
+
+static unsigned int aux_parent_map[] = {
+ 3,
+ 0,
+};
+
+static const struct of_device_id kpss_xcc_match_table[] = {
+ { .compatible = "qcom,kpss-acc-v1", .data = (void *)1UL },
+ { .compatible = "qcom,kpss-gcc" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, kpss_xcc_match_table);
+
+static int kpss_xcc_driver_probe(struct platform_device *pdev)
+{
+ const struct of_device_id *id;
+ struct clk *clk;
+ struct resource *res;
+ void __iomem *base;
+ const char *name;
+
+ id = of_match_device(kpss_xcc_match_table, &pdev->dev);
+ if (!id)
+ return -ENODEV;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
+
+ if (id->data) {
+ if (of_property_read_string_index(pdev->dev.of_node,
+ "clock-output-names",
+ 0, &name))
+ return -ENODEV;
+ base += 0x14;
+ } else {
+ name = "acpu_l2_aux";
+ base += 0x28;
+ }
+
+ clk = clk_register_mux_table(&pdev->dev, name, aux_parents,
+ ARRAY_SIZE(aux_parents), 0, base, 0, 0x3,
+ 0, aux_parent_map, NULL);
+
+ platform_set_drvdata(pdev, clk);
+
+ return PTR_ERR_OR_ZERO(clk);
+}
+
+static int kpss_xcc_driver_remove(struct platform_device *pdev)
+{
+ clk_unregister_mux(platform_get_drvdata(pdev));
+ return 0;
+}
+
+static struct platform_driver kpss_xcc_driver = {
+ .probe = kpss_xcc_driver_probe,
+ .remove = kpss_xcc_driver_remove,
+ .driver = {
+ .name = "kpss-xcc",
+ .of_match_table = kpss_xcc_match_table,
+ },
+};
+module_platform_driver(kpss_xcc_driver);
+
+MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:kpss-xcc");

View File

@ -0,0 +1,99 @@
From 40e5ddf4f84869815129551f4a8cfc2c223ebeae Mon Sep 17 00:00:00 2001
From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:28 +0530
Subject: [PATCH 09/12] dt-bindings: arm: Document qcom,kpss-gcc
The ACC and GCC regions present in KPSSv1 contain registers to
control clocks and power to each Krait CPU and L2. Documenting
the bindings here.
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
.../bindings/arm/msm/qcom,kpss-acc.txt | 19 ++++++++
.../bindings/arm/msm/qcom,kpss-gcc.txt | 44 +++++++++++++++++++
2 files changed, 63 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt
--- a/Documentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt
+++ b/Documentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt
@@ -21,10 +21,29 @@ PROPERTIES
the register region. An optional second element specifies
the base address and size of the alias register region.
+- clocks:
+ Usage: required
+ Value type: <prop-encoded-array>
+ Definition: reference to the pll parents.
+
+- clock-names:
+ Usage: required
+ Value type: <stringlist>
+ Definition: must be "pll8_vote", "pxo".
+
+- clock-output-names:
+ Usage: optional
+ Value type: <string>
+ Definition: Name of the output clock. Typically acpuX_aux where X is a
+ CPU number starting at 0.
+
Example:
clock-controller@2088000 {
compatible = "qcom,kpss-acc-v2";
reg = <0x02088000 0x1000>,
<0x02008000 0x1000>;
+ clocks = <&gcc PLL8_VOTE>, <&gcc PXO_SRC>;
+ clock-names = "pll8_vote", "pxo";
+ clock-output-names = "acpu0_aux";
};
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt
@@ -0,0 +1,44 @@
+Krait Processor Sub-system (KPSS) Global Clock Controller (GCC)
+
+PROPERTIES
+
+- compatible:
+ Usage: required
+ Value type: <string>
+ Definition: should be one of the following. The generic compatible
+ "qcom,kpss-gcc" should also be included.
+ "qcom,kpss-gcc-ipq8064", "qcom,kpss-gcc"
+ "qcom,kpss-gcc-apq8064", "qcom,kpss-gcc"
+ "qcom,kpss-gcc-msm8974", "qcom,kpss-gcc"
+ "qcom,kpss-gcc-msm8960", "qcom,kpss-gcc"
+
+- reg:
+ Usage: required
+ Value type: <prop-encoded-array>
+ Definition: base address and size of the register region
+
+- clocks:
+ Usage: required
+ Value type: <prop-encoded-array>
+ Definition: reference to the pll parents.
+
+- clock-names:
+ Usage: required
+ Value type: <stringlist>
+ Definition: must be "pll8_vote", "pxo".
+
+- clock-output-names:
+ Usage: required
+ Value type: <string>
+ Definition: Name of the output clock. Typically acpu_l2_aux indicating
+ an L2 cache auxiliary clock.
+
+Example:
+
+ l2cc: clock-controller@2011000 {
+ compatible = "qcom,kpss-gcc-ipq8064", "qcom,kpss-gcc";
+ reg = <0x2011000 0x1000>;
+ clocks = <&gcc PLL8_VOTE>, <&gcc PXO_SRC>;
+ clock-names = "pll8_vote", "pxo";
+ clock-output-names = "acpu_l2_aux";
+ };

View File

@ -1,19 +1,7 @@
From patchwork Fri Dec 8 09:42:27 2017 From bb5c4a85051e5e0be39c775b6df85521f2ae807d Mon Sep 17 00:00:00 2001
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,09/12] clk: qcom: Add Krait clock controller driver
From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102061
Message-Id: <1512726150-7204-10-git-send-email-sricharan@codeaurora.org>
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org
Date: Fri, 8 Dec 2017 15:12:27 +0530
From: Stephen Boyd <sboyd@codeaurora.org> From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:29 +0530
Subject: [PATCH 10/12] clk: qcom: Add Krait clock controller driver
The Krait CPU clocks are made up of a primary mux and secondary The Krait CPU clocks are made up of a primary mux and secondary
mux for each CPU and the L2, controlled via cp15 accessors. For mux for each CPU and the L2, controlled via cp15 accessors. For
@ -23,46 +11,24 @@ source.
Cc: <devicetree@vger.kernel.org> Cc: <devicetree@vger.kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
--- ---
.../devicetree/bindings/clock/qcom,krait-cc.txt | 22 ++ drivers/clk/qcom/Kconfig | 8 +
drivers/clk/qcom/Kconfig | 8 + drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clk-krait.c | 4 +-
drivers/clk/qcom/krait-cc.c | 350 +++++++++++++++++++++ drivers/clk/qcom/krait-cc.c | 341 +++++++++++++++++++++++++++++++++++
4 files changed, 381 insertions(+) 4 files changed, 352 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/clock/qcom,krait-cc.txt
create mode 100644 drivers/clk/qcom/krait-cc.c create mode 100644 drivers/clk/qcom/krait-cc.c
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/qcom,krait-cc.txt
@@ -0,0 +1,22 @@
+Krait Clock Controller
+
+PROPERTIES
+
+- compatible:
+ Usage: required
+ Value type: <string>
+ Definition: must be one of:
+ "qcom,krait-cc-v1"
+ "qcom,krait-cc-v2"
+
+- #clock-cells:
+ Usage: required
+ Value type: <u32>
+ Definition: must be 1
+
+Example:
+
+ kraitcc: clock-controller {
+ compatible = "qcom,krait-cc-v1";
+ #clock-cells = <1>;
+ };
--- a/drivers/clk/qcom/Kconfig --- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig
@@ -213,6 +213,14 @@ config KPSS_XCC @@ -292,3 +292,11 @@ config KPSS_XCC
Support for the Krait ACC and GCC clock controllers. Say Y
if you want to support CPU frequency scaling on devices such if you want to support CPU frequency scaling on devices such
as MSM8960, APQ8064, etc. as MSM8960, APQ8064, etc.
+
+config KRAITCC +config KRAITCC
+ tristate "Krait Clock Controller" + tristate "Krait Clock Controller"
+ depends on COMMON_CLK_QCOM && ARM + depends on COMMON_CLK_QCOM && ARM
@ -70,31 +36,38 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+ help + help
+ Support for the Krait CPU clocks on Qualcomm devices. + Support for the Krait CPU clocks on Qualcomm devices.
+ Say Y if you want to support CPU frequency scaling. + Say Y if you want to support CPU frequency scaling.
+
config KRAIT_CLOCKS
bool
select KRAIT_L2_ACCESSORS
--- a/drivers/clk/qcom/Makefile --- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile
@@ -38,3 +38,4 @@ obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o @@ -47,3 +47,4 @@ obj-$(CONFIG_SDM_VIDEOCC_845) += videocc
obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
obj-$(CONFIG_QCOM_HFPLL) += hfpll.o obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
+obj-$(CONFIG_KRAITCC) += krait-cc.o +obj-$(CONFIG_KRAITCC) += krait-cc.o
--- a/drivers/clk/qcom/clk-krait.c
+++ b/drivers/clk/qcom/clk-krait.c
@@ -44,7 +44,7 @@ static int krait_mux_set_parent(struct c
struct krait_mux_clk *mux = to_krait_mux_clk(hw);
u32 sel;
- sel = clk_mux_reindex(index, mux->parent_map, 0);
+ sel = clk_mux_index_to_val(mux->parent_map, 0, index);
mux->en_mask = sel;
/* Don't touch mux if CPU is off as it won't work */
if (__clk_is_enabled(hw->clk))
@@ -63,7 +63,7 @@ static u8 krait_mux_get_parent(struct cl
sel &= mux->mask;
mux->en_mask = sel;
- return clk_mux_get_parent(hw, sel, mux->parent_map, 0);
+ return clk_mux_val_to_index(hw, mux->parent_map, 0, sel);
}
const struct clk_ops krait_mux_clk_ops = {
--- /dev/null --- /dev/null
+++ b/drivers/clk/qcom/krait-cc.c +++ b/drivers/clk/qcom/krait-cc.c
@@ -0,0 +1,350 @@ @@ -0,0 +1,341 @@
+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. +// SPDX-License-Identifier: GPL-2.0
+ * +// Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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 <linux/kernel.h> +#include <linux/kernel.h>
+#include <linux/init.h> +#include <linux/init.h>

View File

@ -0,0 +1,55 @@
From bf4503ccf321811192cb07f9711556237c3cf668 Mon Sep 17 00:00:00 2001
From: Stephen Boyd <sboyd@codeaurora.org>
Date: Tue, 14 Aug 2018 17:42:30 +0530
Subject: [PATCH 11/12] dt-bindings: clock: Document qcom,krait-cc
The Krait clock controller controls the krait CPU and the L2 clocks
consisting a primary mux and secondary mux. Add document for that.
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
.../bindings/clock/qcom,krait-cc.txt | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 Documentation/devicetree/bindings/clock/qcom,krait-cc.txt
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/qcom,krait-cc.txt
@@ -0,0 +1,34 @@
+Krait Clock Controller
+
+PROPERTIES
+
+- compatible:
+ Usage: required
+ Value type: <string>
+ Definition: must be one of:
+ "qcom,krait-cc-v1"
+ "qcom,krait-cc-v2"
+
+- #clock-cells:
+ Usage: required
+ Value type: <u32>
+ Definition: must be 1
+
+- clocks:
+ Usage: required
+ Value type: <prop-encoded-array>
+ Definition: reference to the clock parents of hfpll, secondary muxes.
+
+- clock-names:
+ Usage: required
+ Value type: <stringlist>
+ Definition: must be "hfpll0", "hfpll1", "acpu0_aux", "acpu1_aux", "qsb".
+
+Example:
+
+ kraitcc: clock-controller {
+ compatible = "qcom,krait-cc-v1";
+ clocks = <&hfpll0>, <&hfpll1>, <&acpu0_aux>, <&acpu1_aux>, <qsb>;
+ clock-names = "hfpll0", "hfpll1", "acpu0_aux", "acpu1_aux", "qsb";
+ #clock-cells = <1>;
+ };

View File

@ -1,17 +1,7 @@
From patchwork Fri Dec 8 09:42:28 2017 From 77612720a2362230af726baa4149c40ec7a7fb05 Mon Sep 17 00:00:00 2001
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,10/12] clk: qcom: Add safe switch hook for krait mux clocks
From: Sricharan R <sricharan@codeaurora.org> From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102057 Date: Tue, 14 Aug 2018 17:42:31 +0530
Message-Id: <1512726150-7204-11-git-send-email-sricharan@codeaurora.org> Subject: [PATCH 12/12] clk: qcom: Add safe switch hook for krait mux clocks
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org
Date: Fri, 8 Dec 2017 15:12:28 +0530
When the Hfplls are reprogrammed during the rate change, When the Hfplls are reprogrammed during the rate change,
the primary muxes which are sourced from the same hfpll the primary muxes which are sourced from the same hfpll
@ -22,15 +12,17 @@ switching to the safe parent in the PRE_RATE_CHANGE notifier
and back to the original parent in the POST_RATE_CHANGE notifier. and back to the original parent in the POST_RATE_CHANGE notifier.
Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Tested-by: Craig Tatlor <ctatlor97@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
--- ---
drivers/clk/qcom/clk-krait.c | 2 ++ drivers/clk/qcom/clk-krait.c | 2 ++
drivers/clk/qcom/clk-krait.h | 3 +++ drivers/clk/qcom/clk-krait.h | 3 ++
drivers/clk/qcom/krait-cc.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/krait-cc.c | 56 ++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+) 3 files changed, 61 insertions(+)
--- a/drivers/clk/qcom/clk-krait.c --- a/drivers/clk/qcom/clk-krait.c
+++ b/drivers/clk/qcom/clk-krait.c +++ b/drivers/clk/qcom/clk-krait.c
@@ -60,6 +60,8 @@ static int krait_mux_set_parent(struct c @@ -50,6 +50,8 @@ static int krait_mux_set_parent(struct c
if (__clk_is_enabled(hw->clk)) if (__clk_is_enabled(hw->clk))
__krait_mux_set_sel(mux, sel); __krait_mux_set_sel(mux, sel);
@ -41,7 +33,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
--- a/drivers/clk/qcom/clk-krait.h --- a/drivers/clk/qcom/clk-krait.h
+++ b/drivers/clk/qcom/clk-krait.h +++ b/drivers/clk/qcom/clk-krait.h
@@ -23,6 +23,9 @@ struct krait_mux_clk { @@ -12,6 +12,9 @@ struct krait_mux_clk {
u32 shift; u32 shift;
u32 en_mask; u32 en_mask;
bool lpl; bool lpl;
@ -53,7 +45,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
struct notifier_block clk_nb; struct notifier_block clk_nb;
--- a/drivers/clk/qcom/krait-cc.c --- a/drivers/clk/qcom/krait-cc.c
+++ b/drivers/clk/qcom/krait-cc.c +++ b/drivers/clk/qcom/krait-cc.c
@@ -35,6 +35,49 @@ static unsigned int pri_mux_map[] = { @@ -26,6 +26,49 @@ static unsigned int pri_mux_map[] = {
0, 0,
}; };
@ -103,7 +95,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
static int static int
krait_add_div(struct device *dev, int id, const char *s, unsigned int offset) krait_add_div(struct device *dev, int id, const char *s, unsigned int offset)
{ {
@@ -79,6 +122,7 @@ static int @@ -70,6 +113,7 @@ static int
krait_add_sec_mux(struct device *dev, int id, const char *s, krait_add_sec_mux(struct device *dev, int id, const char *s,
unsigned int offset, bool unique_aux) unsigned int offset, bool unique_aux)
{ {
@ -111,7 +103,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
struct krait_mux_clk *mux; struct krait_mux_clk *mux;
static const char *sec_mux_list[] = { static const char *sec_mux_list[] = {
"acpu_aux", "acpu_aux",
@@ -102,6 +146,7 @@ krait_add_sec_mux(struct device *dev, in @@ -93,6 +137,7 @@ krait_add_sec_mux(struct device *dev, in
mux->shift = 2; mux->shift = 2;
mux->parent_map = sec_mux_map; mux->parent_map = sec_mux_map;
mux->hw.init = &init; mux->hw.init = &init;
@ -119,7 +111,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
init.name = kasprintf(GFP_KERNEL, "krait%s_sec_mux", s); init.name = kasprintf(GFP_KERNEL, "krait%s_sec_mux", s);
if (!init.name) if (!init.name)
@@ -117,6 +162,11 @@ krait_add_sec_mux(struct device *dev, in @@ -108,6 +153,11 @@ krait_add_sec_mux(struct device *dev, in
clk = devm_clk_register(dev, &mux->hw); clk = devm_clk_register(dev, &mux->hw);
@ -131,7 +123,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
if (unique_aux) if (unique_aux)
kfree(sec_mux_list[0]); kfree(sec_mux_list[0]);
err_aux: err_aux:
@@ -128,6 +178,7 @@ static struct clk * @@ -119,6 +169,7 @@ static struct clk *
krait_add_pri_mux(struct device *dev, int id, const char *s, krait_add_pri_mux(struct device *dev, int id, const char *s,
unsigned int offset) unsigned int offset)
{ {
@ -139,7 +131,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
struct krait_mux_clk *mux; struct krait_mux_clk *mux;
const char *p_names[3]; const char *p_names[3];
struct clk_init_data init = { struct clk_init_data init = {
@@ -148,6 +199,7 @@ krait_add_pri_mux(struct device *dev, in @@ -139,6 +190,7 @@ krait_add_pri_mux(struct device *dev, in
mux->lpl = id >= 0; mux->lpl = id >= 0;
mux->parent_map = pri_mux_map; mux->parent_map = pri_mux_map;
mux->hw.init = &init; mux->hw.init = &init;
@ -147,7 +139,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
init.name = kasprintf(GFP_KERNEL, "krait%s_pri_mux", s); init.name = kasprintf(GFP_KERNEL, "krait%s_pri_mux", s);
if (!init.name) if (!init.name)
@@ -173,6 +225,10 @@ krait_add_pri_mux(struct device *dev, in @@ -164,6 +216,10 @@ krait_add_pri_mux(struct device *dev, in
clk = devm_clk_register(dev, &mux->hw); clk = devm_clk_register(dev, &mux->hw);

View File

@ -1,195 +0,0 @@
From patchwork Fri Dec 8 09:42:20 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,02/12] clk: mux: Split out register accessors for reuse
From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102103
Message-Id: <1512726150-7204-3-git-send-email-sricharan@codeaurora.org>
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org
Date: Fri, 8 Dec 2017 15:12:20 +0530
From: Stephen Boyd <sboyd@codeaurora.org>
We want to reuse the logic in clk-mux.c for other clock drivers
that don't use readl as register accessors. Fortunately, there
really isn't much to the mux code besides the table indirection
and quirk flags if you assume any bit shifting and masking has
been done already. Pull that logic out into reusable functions
that operate on an optional table and some flags so that other
drivers can use the same logic.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
drivers/clk/clk-mux.c | 75 +++++++++++++++++++++++++++-----------------
include/linux/clk-provider.h | 9 ++++--
2 files changed, 54 insertions(+), 30 deletions(-)
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -26,35 +26,24 @@
* parent - parent is adjustable through clk_set_parent
*/
-static u8 clk_mux_get_parent(struct clk_hw *hw)
+unsigned int clk_mux_get_parent(struct clk_hw *hw, unsigned int val,
+ unsigned int *table, unsigned long flags)
{
- struct clk_mux *mux = to_clk_mux(hw);
int num_parents = clk_hw_get_num_parents(hw);
- u32 val;
-
- /*
- * FIXME need a mux-specific flag to determine if val is bitwise or numeric
- * e.g. sys_clkin_ck's clksel field is 3 bits wide, but ranges from 0x1
- * to 0x7 (index starts at one)
- * OTOH, pmd_trace_clk_mux_ck uses a separate bit for each clock, so
- * val = 0x4 really means "bit 2, index starts at bit 0"
- */
- val = clk_readl(mux->reg) >> mux->shift;
- val &= mux->mask;
- if (mux->table) {
+ if (table) {
int i;
for (i = 0; i < num_parents; i++)
- if (mux->table[i] == val)
+ if (table[i] == val)
return i;
return -EINVAL;
}
- if (val && (mux->flags & CLK_MUX_INDEX_BIT))
+ if (val && (flags & CLK_MUX_INDEX_BIT))
val = ffs(val) - 1;
- if (val && (mux->flags & CLK_MUX_INDEX_ONE))
+ if (val && (flags & CLK_MUX_INDEX_ONE))
val--;
if (val >= num_parents)
@@ -62,23 +51,53 @@ static u8 clk_mux_get_parent(struct clk_
return val;
}
+EXPORT_SYMBOL_GPL(clk_mux_get_parent);
-static int clk_mux_set_parent(struct clk_hw *hw, u8 index)
+static u8 _clk_mux_get_parent(struct clk_hw *hw)
{
struct clk_mux *mux = to_clk_mux(hw);
u32 val;
- unsigned long flags = 0;
- if (mux->table) {
- index = mux->table[index];
+ /*
+ * FIXME need a mux-specific flag to determine if val is bitwise or
+ * numeric e.g. sys_clkin_ck's clksel field is 3 bits wide,
+ * but ranges from 0x1 to 0x7 (index starts at one)
+ * OTOH, pmd_trace_clk_mux_ck uses a separate bit for each clock, so
+ * val = 0x4 really means "bit 2, index starts at bit 0"
+ */
+ val = clk_readl(mux->reg) >> mux->shift;
+ val &= mux->mask;
+
+ return clk_mux_get_parent(hw, val, mux->table, mux->flags);
+}
+
+unsigned int clk_mux_reindex(u8 index, unsigned int *table,
+ unsigned long flags)
+{
+ unsigned int val = index;
+
+ if (table) {
+ val = table[val];
} else {
- if (mux->flags & CLK_MUX_INDEX_BIT)
- index = 1 << index;
+ if (flags & CLK_MUX_INDEX_BIT)
+ val = 1 << index;
- if (mux->flags & CLK_MUX_INDEX_ONE)
- index++;
+ if (flags & CLK_MUX_INDEX_ONE)
+ val++;
}
+ return val;
+}
+EXPORT_SYMBOL_GPL(clk_mux_reindex);
+
+static int clk_mux_set_parent(struct clk_hw *hw, u8 index)
+{
+ struct clk_mux *mux = to_clk_mux(hw);
+ u32 val;
+ unsigned long flags = 0;
+
+ index = clk_mux_reindex(index, mux->table, mux->flags);
+
if (mux->lock)
spin_lock_irqsave(mux->lock, flags);
else
@@ -110,14 +129,14 @@ static int clk_mux_determine_rate(struct
}
const struct clk_ops clk_mux_ops = {
- .get_parent = clk_mux_get_parent,
+ .get_parent = _clk_mux_get_parent,
.set_parent = clk_mux_set_parent,
.determine_rate = clk_mux_determine_rate,
};
EXPORT_SYMBOL_GPL(clk_mux_ops);
const struct clk_ops clk_mux_ro_ops = {
- .get_parent = clk_mux_get_parent,
+ .get_parent = _clk_mux_get_parent,
};
EXPORT_SYMBOL_GPL(clk_mux_ro_ops);
@@ -125,7 +144,7 @@ struct clk_hw *clk_hw_register_mux_table
const char * const *parent_names, u8 num_parents,
unsigned long flags,
void __iomem *reg, u8 shift, u32 mask,
- u8 clk_mux_flags, u32 *table, spinlock_t *lock)
+ u8 clk_mux_flags, unsigned int *table, spinlock_t *lock)
{
struct clk_mux *mux;
struct clk_hw *hw;
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -468,7 +468,7 @@ void clk_hw_unregister_divider(struct cl
struct clk_mux {
struct clk_hw hw;
void __iomem *reg;
- u32 *table;
+ unsigned int *table;
u32 mask;
u8 shift;
u8 flags;
@@ -486,6 +486,11 @@ struct clk_mux {
extern const struct clk_ops clk_mux_ops;
extern const struct clk_ops clk_mux_ro_ops;
+unsigned int clk_mux_get_parent(struct clk_hw *hw, unsigned int val,
+ unsigned int *table, unsigned long flags);
+unsigned int clk_mux_reindex(u8 index, unsigned int *table,
+ unsigned long flags);
+
struct clk *clk_register_mux(struct device *dev, const char *name,
const char * const *parent_names, u8 num_parents,
unsigned long flags,
@@ -506,7 +511,7 @@ struct clk_hw *clk_hw_register_mux_table
const char * const *parent_names, u8 num_parents,
unsigned long flags,
void __iomem *reg, u8 shift, u32 mask,
- u8 clk_mux_flags, u32 *table, spinlock_t *lock);
+ u8 clk_mux_flags, unsigned int *table, spinlock_t *lock);
void clk_unregister_mux(struct clk *clk);
void clk_hw_unregister_mux(struct clk_hw *hw);

View File

@ -1,209 +0,0 @@
From patchwork Fri Dec 8 09:42:26 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v4,08/12] clk: qcom: Add KPSS ACC/GCC driver
From: Sricharan R <sricharan@codeaurora.org>
X-Patchwork-Id: 10102023
Message-Id: <1512726150-7204-9-git-send-email-sricharan@codeaurora.org>
To: mturquette@baylibre.com, sboyd@codeaurora.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
Cc: sricharan@codeaurora.org
Date: Fri, 8 Dec 2017 15:12:26 +0530
From: Stephen Boyd <sboyd@codeaurora.org>
The ACC and GCC regions present in KPSSv1 contain registers to
control clocks and power to each Krait CPU and L2. For CPUfreq
purposes probe these devices and expose a mux clock that chooses
between PXO and PLL8.
Cc: <devicetree@vger.kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
.../devicetree/bindings/arm/msm/qcom,kpss-acc.txt | 7 ++
.../devicetree/bindings/arm/msm/qcom,kpss-gcc.txt | 28 +++++++
drivers/clk/qcom/Kconfig | 8 ++
drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/kpss-xcc.c | 96 ++++++++++++++++++++++
5 files changed, 140 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt
create mode 100644 drivers/clk/qcom/kpss-xcc.c
--- a/Documentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt
+++ b/Documentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt
@@ -21,10 +21,17 @@ PROPERTIES
the register region. An optional second element specifies
the base address and size of the alias register region.
+- clock-output-names:
+ Usage: optional
+ Value type: <string>
+ Definition: Name of the output clock. Typically acpuX_aux where X is a
+ CPU number starting at 0.
+
Example:
clock-controller@2088000 {
compatible = "qcom,kpss-acc-v2";
reg = <0x02088000 0x1000>,
<0x02008000 0x1000>;
+ clock-output-names = "acpu0_aux";
};
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt
@@ -0,0 +1,28 @@
+Krait Processor Sub-system (KPSS) Global Clock Controller (GCC)
+
+PROPERTIES
+
+- compatible:
+ Usage: required
+ Value type: <string>
+ Definition: should be one of:
+ "qcom,kpss-gcc"
+
+- reg:
+ Usage: required
+ Value type: <prop-encoded-array>
+ Definition: base address and size of the register region
+
+- clock-output-names:
+ Usage: required
+ Value type: <string>
+ Definition: Name of the output clock. Typically acpu_l2_aux indicating
+ an L2 cache auxiliary clock.
+
+Example:
+
+ l2cc: clock-controller@2011000 {
+ compatible = "qcom,kpss-gcc";
+ reg = <0x2011000 0x1000>;
+ clock-output-names = "acpu_l2_aux";
+ };
--- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig
@@ -205,6 +205,14 @@ config QCOM_HFPLL
Say Y if you want to support CPU frequency scaling on devices
such as MSM8974, APQ8084, etc.
+config KPSS_XCC
+ tristate "KPSS Clock Controller"
+ depends on COMMON_CLK_QCOM
+ help
+ Support for the Krait ACC and GCC clock controllers. Say Y
+ if you want to support CPU frequency scaling on devices such
+ as MSM8960, APQ8064, etc.
+
config KRAIT_CLOCKS
bool
select KRAIT_L2_ACCESSORS
--- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile
@@ -36,4 +36,5 @@ obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8
obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o
obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o
obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o
+obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
--- /dev/null
+++ b/drivers/clk/qcom/kpss-xcc.c
@@ -0,0 +1,96 @@
+/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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 <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+
+static const char *aux_parents[] = {
+ "pll8_vote",
+ "pxo",
+};
+
+static unsigned int aux_parent_map[] = {
+ 3,
+ 0,
+};
+
+static const struct of_device_id kpss_xcc_match_table[] = {
+ { .compatible = "qcom,kpss-acc-v1", .data = (void *)1UL },
+ { .compatible = "qcom,kpss-gcc" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, kpss_xcc_match_table);
+
+static int kpss_xcc_driver_probe(struct platform_device *pdev)
+{
+ const struct of_device_id *id;
+ struct clk *clk;
+ struct resource *res;
+ void __iomem *base;
+ const char *name;
+
+ id = of_match_device(kpss_xcc_match_table, &pdev->dev);
+ if (!id)
+ return -ENODEV;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
+
+ if (id->data) {
+ if (of_property_read_string_index(pdev->dev.of_node,
+ "clock-output-names",
+ 0, &name))
+ return -ENODEV;
+ base += 0x14;
+ } else {
+ name = "acpu_l2_aux";
+ base += 0x28;
+ }
+
+ clk = clk_register_mux_table(&pdev->dev, name, aux_parents,
+ ARRAY_SIZE(aux_parents), 0, base, 0, 0x3,
+ 0, aux_parent_map, NULL);
+
+ platform_set_drvdata(pdev, clk);
+
+ return PTR_ERR_OR_ZERO(clk);
+}
+
+static int kpss_xcc_driver_remove(struct platform_device *pdev)
+{
+ clk_unregister_mux(platform_get_drvdata(pdev));
+ return 0;
+}
+
+static struct platform_driver kpss_xcc_driver = {
+ .probe = kpss_xcc_driver_probe,
+ .remove = kpss_xcc_driver_remove,
+ .driver = {
+ .name = "kpss-xcc",
+ .of_match_table = kpss_xcc_match_table,
+ },
+};
+module_platform_driver(kpss_xcc_driver);
+
+MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:kpss-xcc");

View File

@ -72,9 +72,9 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+ }; + };
--- a/drivers/cpufreq/Kconfig.arm --- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm
@@ -100,6 +100,15 @@ config ARM_OMAP2PLUS_CPUFREQ @@ -121,6 +121,15 @@ config ARM_QCOM_CPUFREQ_KRYO
depends on ARCH_OMAP2PLUS
default ARCH_OMAP2PLUS If in doubt, say N.
+config ARM_QCOM_CPUFREQ +config ARM_QCOM_CPUFREQ
+ tristate "Qualcomm based" + tristate "Qualcomm based"
@ -90,14 +90,14 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
help help
--- a/drivers/cpufreq/Makefile --- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_ARM_MEDIATEK_CPUFREQ) += me @@ -64,6 +64,7 @@ obj-$(CONFIG_MACH_MVEBU_V7) += mvebu-cp
obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ) += omap-cpufreq.o obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ) += omap-cpufreq.o
obj-$(CONFIG_ARM_PXA2xx_CPUFREQ) += pxa2xx-cpufreq.o obj-$(CONFIG_ARM_PXA2xx_CPUFREQ) += pxa2xx-cpufreq.o
obj-$(CONFIG_PXA3xx) += pxa3xx-cpufreq.o obj-$(CONFIG_PXA3xx) += pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_QCOM_CPUFREQ) += qcom-cpufreq.o +obj-$(CONFIG_ARM_QCOM_CPUFREQ) += qcom-cpufreq.o
obj-$(CONFIG_ARM_S3C24XX_CPUFREQ) += s3c24xx-cpufreq.o obj-$(CONFIG_ARM_QCOM_CPUFREQ_KRYO) += qcom-cpufreq-kryo.o
obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o
obj-$(CONFIG_ARM_S3C2410_CPUFREQ) += s3c2410-cpufreq.o obj-$(CONFIG_ARM_S3C2410_CPUFREQ) += s3c2410-cpufreq.o
obj-$(CONFIG_ARM_S3C2412_CPUFREQ) += s3c2412-cpufreq.o
--- /dev/null --- /dev/null
+++ b/drivers/cpufreq/qcom-cpufreq.c +++ b/drivers/cpufreq/qcom-cpufreq.c
@@ -0,0 +1,204 @@ @@ -0,0 +1,204 @@

View File

@ -28,7 +28,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
--- a/drivers/cpufreq/cpufreq-dt.c --- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c
@@ -231,7 +231,10 @@ static int cpufreq_init(struct cpufreq_p @@ -239,7 +239,10 @@ static int cpufreq_init(struct cpufreq_p
} }
if (fallback) { if (fallback) {
@ -40,9 +40,9 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
/* /*
* OPP tables are initialized only for policy->cpu, do it for * OPP tables are initialized only for policy->cpu, do it for
@@ -376,6 +379,8 @@ static int dt_cpufreq_probe(struct platf @@ -359,6 +362,8 @@ static int dt_cpufreq_probe(struct platf
if (data && data->have_governor_per_policy) dt_cpufreq_driver.suspend = data->suspend;
dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY; }
+ dt_cpufreq_driver.driver_data = data; + dt_cpufreq_driver.driver_data = data;
+ +
@ -51,8 +51,8 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
dev_err(&pdev->dev, "failed register driver: %d\n", ret); dev_err(&pdev->dev, "failed register driver: %d\n", ret);
--- a/drivers/cpufreq/cpufreq-dt.h --- a/drivers/cpufreq/cpufreq-dt.h
+++ b/drivers/cpufreq/cpufreq-dt.h +++ b/drivers/cpufreq/cpufreq-dt.h
@@ -13,6 +13,12 @@ @@ -15,6 +15,12 @@
#include <linux/types.h> struct cpufreq_policy;
struct cpufreq_dt_platform_data { struct cpufreq_dt_platform_data {
+ /* + /*
@ -62,5 +62,5 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
+ */ + */
+ bool independent_clocks; + bool independent_clocks;
bool have_governor_per_policy; bool have_governor_per_policy;
};
int (*suspend)(struct cpufreq_policy *policy);

View File

@ -1,72 +0,0 @@
From c7c6a0f50f9ac3620c611ce06ba1f9fafea0444e Mon Sep 17 00:00:00 2001
From: Archit Taneja <architt@codeaurora.org>
Date: Mon, 3 Aug 2015 10:38:14 +0530
Subject: [PATCH 47/69] mtd: nand: Create a BBT flag to access bad block
markers in raw mode
Some controllers can access the factory bad block marker from OOB only
when they read it in raw mode. When ECC is enabled, these controllers
discard reading/writing bad block markers, preventing access to them
altogether.
The bbt driver assumes MTD_OPS_PLACE_OOB when scanning for bad blocks.
This results in the nand driver's ecc->read_oob() op to be called, which
works with ECC enabled.
Create a new BBT option flag that tells nand_bbt to force the mode to
MTD_OPS_RAW. This would result in the correct op being called for the
underlying nand controller driver.
Reviewed-by: Andy Gross <agross@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
drivers/mtd/nand/nand_base.c | 6 +++++-
drivers/mtd/nand/nand_bbt.c | 6 +++++-
include/linux/mtd/bbm.h | 6 ++++++
3 files changed, 16 insertions(+), 2 deletions(-)
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -481,7 +481,11 @@ static int nand_default_block_markbad(st
} else {
ops.len = ops.ooblen = 1;
}
- ops.mode = MTD_OPS_PLACE_OOB;
+
+ if (unlikely(chip->bbt_options & NAND_BBT_ACCESS_BBM_RAW))
+ ops.mode = MTD_OPS_RAW;
+ else
+ ops.mode = MTD_OPS_PLACE_OOB;
/* Write to first/last page(s) if necessary */
if (chip->bbt_options & NAND_BBT_SCANLASTPAGE)
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -420,7 +420,11 @@ static int scan_block_fast(struct mtd_in
ops.oobbuf = buf;
ops.ooboffs = 0;
ops.datbuf = NULL;
- ops.mode = MTD_OPS_PLACE_OOB;
+
+ if (unlikely(bd->options & NAND_BBT_ACCESS_BBM_RAW))
+ ops.mode = MTD_OPS_RAW;
+ else
+ ops.mode = MTD_OPS_PLACE_OOB;
for (j = 0; j < numpages; j++) {
/*
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -116,6 +116,12 @@ struct nand_bbt_descr {
#define NAND_BBT_NO_OOB_BBM 0x00080000
/*
+ * Force MTD_OPS_RAW mode when trying to access bad block markes from OOB. To
+ * be used by controllers which can access BBM only when ECC is disabled, i.e,
+ * when in RAW access mode
+ */
+#define NAND_BBT_ACCESS_BBM_RAW 0x00100000
+/*
* Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr
* was allocated dynamicaly and must be freed in nand_release(). Has no meaning
* in nand_chip.bbt_options.

View File

@ -8,9 +8,9 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
drivers/base/power/opp/core.c | 3 ++- drivers/base/power/opp/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/base/power/opp/core.c --- a/drivers/opp/core.c
+++ b/drivers/base/power/opp/core.c +++ b/drivers/opp/core.c
@@ -1280,11 +1280,13 @@ struct opp_table *dev_pm_opp_set_regulat @@ -1317,11 +1317,13 @@ struct opp_table *dev_pm_opp_set_regulat
if (!opp_table) if (!opp_table)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
@ -22,5 +22,5 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
} }
+#endif +#endif
/* Already have regulators set */ /* Another CPU that shares the OPP table has set the regulators ? */
if (opp_table->regulators) { if (opp_table->regulators)

View File

@ -21,13 +21,13 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
--- ---
drivers/base/power/opp/core.c | 77 +++++++++++++++++++++++++++++++++++++++++++ drivers/opp/core.c | 77 +++++++++++++++++++++++++++++++++++++++++++
include/linux/pm_opp.h | 11 +++++++ include/linux/pm_opp.h | 11 +++++++
2 files changed, 88 insertions(+) 2 files changed, 88 insertions(+)
--- a/drivers/base/power/opp/core.c --- a/drivers/opp/core.c
+++ b/drivers/base/power/opp/core.c +++ b/drivers/opp/core.c
@@ -1608,6 +1608,83 @@ put_table: @@ -1625,6 +1625,83 @@ put_table:
} }
/** /**

View File

@ -6,13 +6,13 @@ Subject: [PATCH 51/69] PM / OPP: Add a helper to get an opp regulator for
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
--- ---
drivers/base/power/opp/core.c | 21 +++++++++++++++++++++ drivers/opp/core.c | 21 +++++++++++++++++++++
include/linux/pm_opp.h | 1 + include/linux/pm_opp.h | 1 +
2 files changed, 22 insertions(+) 2 files changed, 22 insertions(+)
--- a/drivers/base/power/opp/core.c --- a/drivers/opp/core.c
+++ b/drivers/base/power/opp/core.c +++ b/drivers/opp/core.c
@@ -126,6 +126,27 @@ unsigned long dev_pm_opp_get_freq(struct @@ -125,6 +125,27 @@ unsigned long dev_pm_opp_get_freq(struct
} }
EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq); EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);

View File

@ -12,12 +12,12 @@ Fix this by updating the voltage tolerance values too.
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
--- ---
drivers/base/power/opp/core.c | 5 +++++ drivers/opp/core.c | 5 +++++
1 file changed, 5 insertions(+) 1 file changed, 5 insertions(+)
--- a/drivers/base/power/opp/core.c --- a/drivers/opp/core.c
+++ b/drivers/base/power/opp/core.c +++ b/drivers/opp/core.c
@@ -1652,6 +1652,7 @@ int dev_pm_opp_adjust_voltage(struct dev @@ -1669,6 +1669,7 @@ int dev_pm_opp_adjust_voltage(struct dev
struct opp_table *opp_table; struct opp_table *opp_table;
struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV); struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
int r = 0; int r = 0;
@ -25,7 +25,7 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
/* keep the node allocated */ /* keep the node allocated */
new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL); new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL);
@@ -1688,6 +1689,10 @@ int dev_pm_opp_adjust_voltage(struct dev @@ -1705,6 +1706,10 @@ int dev_pm_opp_adjust_voltage(struct dev
/* plug in new node */ /* plug in new node */
new_opp->supplies[0].u_volt = u_volt; new_opp->supplies[0].u_volt = u_volt;

View File

@ -35,26 +35,23 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
bool have_static_opps; bool have_static_opps;
}; };
@@ -44,9 +47,16 @@ static struct freq_attr *cpufreq_dt_attr @@ -47,12 +50,15 @@ static int set_target(struct cpufreq_pol
static int set_target(struct cpufreq_policy *policy, unsigned int index) unsigned long freq = policy->freq_table[index].frequency;
{ int ret;
struct private_data *priv = policy->driver_data;
+ int ret;
+ unsigned long target_freq = policy->freq_table[index].frequency * 1000;
+
+ mutex_lock(&priv->lock); + mutex_lock(&priv->lock);
+ ret = dev_pm_opp_set_rate(priv->cpu_dev, target_freq); ret = dev_pm_opp_set_rate(priv->cpu_dev, freq * 1000);
+ if (!ret)
+ priv->opp_freq = target_freq; if (!ret) {
+ priv->opp_freq = freq * 1000;
arch_set_freq_scale(policy->related_cpus, freq,
policy->cpuinfo.max_freq);
}
+ mutex_unlock(&priv->lock); + mutex_unlock(&priv->lock);
- return dev_pm_opp_set_rate(priv->cpu_dev, return ret;
- policy->freq_table[index].frequency * 1000);
+ return ret;
} }
@@ -95,6 +101,39 @@ node_put:
/*
@@ -87,6 +97,39 @@ node_put:
return name; return name;
} }
@ -94,7 +91,7 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
static int resources_available(void) static int resources_available(void)
{ {
struct device *cpu_dev; struct device *cpu_dev;
@@ -153,6 +196,7 @@ static int cpufreq_init(struct cpufreq_p @@ -161,6 +200,7 @@ static int cpufreq_init(struct cpufreq_p
bool fallback = false; bool fallback = false;
const char *name; const char *name;
int ret; int ret;
@ -102,7 +99,7 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
cpu_dev = get_cpu_device(policy->cpu); cpu_dev = get_cpu_device(policy->cpu);
if (!cpu_dev) { if (!cpu_dev) {
@@ -246,10 +290,13 @@ static int cpufreq_init(struct cpufreq_p @@ -254,10 +294,13 @@ static int cpufreq_init(struct cpufreq_p
__func__, ret); __func__, ret);
} }
@ -117,7 +114,7 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
} }
priv->cpu_dev = cpu_dev; priv->cpu_dev = cpu_dev;
@@ -285,6 +332,8 @@ static int cpufreq_init(struct cpufreq_p @@ -287,6 +330,8 @@ static int cpufreq_init(struct cpufreq_p
out_free_cpufreq_table: out_free_cpufreq_table:
dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);

View File

@ -11,23 +11,23 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
--- a/drivers/cpufreq/cpufreq-dt.c --- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c
@@ -49,11 +49,41 @@ static int set_target(struct cpufreq_pol @@ -49,11 +49,39 @@ static int set_target(struct cpufreq_pol
struct private_data *priv = policy->driver_data; struct private_data *priv = policy->driver_data;
unsigned long freq = policy->freq_table[index].frequency;
int ret; int ret;
unsigned long target_freq = policy->freq_table[index].frequency * 1000;
+ struct clk *l2_clk = policy->l2_clk; + struct clk *l2_clk = policy->l2_clk;
+ unsigned int l2_freq; + unsigned int l2_freq;
+ unsigned long new_l2_freq = 0; + unsigned long new_l2_freq = 0;
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
ret = dev_pm_opp_set_rate(priv->cpu_dev, target_freq); ret = dev_pm_opp_set_rate(priv->cpu_dev, freq * 1000);
- if (!ret)
+ if (!ret) {
+ if (!ret) {
+ if (!IS_ERR(l2_clk) && policy->l2_rate[0] && policy->l2_rate[1] && + if (!IS_ERR(l2_clk) && policy->l2_rate[0] && policy->l2_rate[1] &&
+ policy->l2_rate[2]) { + policy->l2_rate[2]) {
+ static unsigned long krait_l2[CONFIG_NR_CPUS] = { }; + static unsigned long krait_l2[CONFIG_NR_CPUS] = { };
+ int cpu, ret = 0; + int cpu, ret = 0;
+ unsigned long target_freq = freq * 1000;
+ +
+ if (target_freq >= policy->l2_rate[2]) + if (target_freq >= policy->l2_rate[2])
+ new_l2_freq = policy->l2_rate[2]; + new_l2_freq = policy->l2_rate[2];
@ -48,13 +48,10 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
+ } + }
+ } + }
+ +
priv->opp_freq = target_freq; priv->opp_freq = freq * 1000;
+ } arch_set_freq_scale(policy->related_cpus, freq,
+ policy->cpuinfo.max_freq);
mutex_unlock(&priv->lock); @@ -201,6 +229,8 @@ static int cpufreq_init(struct cpufreq_p
return ret;
@@ -197,6 +227,8 @@ static int cpufreq_init(struct cpufreq_p
const char *name; const char *name;
int ret; int ret;
struct srcu_notifier_head *opp_srcu_head; struct srcu_notifier_head *opp_srcu_head;
@ -63,7 +60,7 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
cpu_dev = get_cpu_device(policy->cpu); cpu_dev = get_cpu_device(policy->cpu);
if (!cpu_dev) { if (!cpu_dev) {
@@ -305,6 +337,13 @@ static int cpufreq_init(struct cpufreq_p @@ -310,6 +340,13 @@ static int cpufreq_init(struct cpufreq_p
policy->suspend_freq = dev_pm_opp_get_suspend_opp_freq(cpu_dev) / 1000; policy->suspend_freq = dev_pm_opp_get_suspend_opp_freq(cpu_dev) / 1000;
@ -74,9 +71,9 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
+ if (l2_np) + if (l2_np)
+ of_property_read_u32_array(l2_np, "qcom,l2-rates", policy->l2_rate, 3); + of_property_read_u32_array(l2_np, "qcom,l2-rates", policy->l2_rate, 3);
+ +
ret = cpufreq_table_validate_and_show(policy, freq_table); /* Support turbo/boost mode */
if (ret) { if (policy_has_boost_freq(policy)) {
dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__, /* This gets disabled by core on driver unregister */
--- a/include/linux/cpufreq.h --- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h
@@ -73,6 +73,8 @@ struct cpufreq_policy { @@ -73,6 +73,8 @@ struct cpufreq_policy {

View File

@ -10,7 +10,7 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
--- a/drivers/cpufreq/cpufreq-dt.c --- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c
@@ -144,8 +144,10 @@ static int opp_notifier(struct notifier_ @@ -146,8 +146,10 @@ static int opp_notifier(struct notifier_
ret = PTR_ERR(cpu_reg); ret = PTR_ERR(cpu_reg);
goto out; goto out;
} }

View File

@ -33,7 +33,7 @@ Signed-off-by: Mathieu Olivari <mathieu@codeaurora.org>
--- a/arch/arm/Kconfig --- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig +++ b/arch/arm/Kconfig
@@ -341,7 +341,7 @@ config ARCH_MULTIPLATFORM @@ -331,7 +331,7 @@ config ARCH_MULTIPLATFORM
depends on MMU depends on MMU
select ARM_HAS_SG_CHAIN select ARM_HAS_SG_CHAIN
select ARM_PATCH_PHYS_VIRT select ARM_PATCH_PHYS_VIRT

View File

@ -24,30 +24,13 @@ following fucntionalities:
Change-Id: I8bc7204fd627d10875ab13fc1de8cb6c2ed7a918 Change-Id: I8bc7204fd627d10875ab13fc1de8cb6c2ed7a918
Signed-off-by: Rajith Cherian <rajith@codeaurora.org> Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
--- ---
.../devicetree/bindings/thermal/qcom-tsens.txt | 1 +
drivers/thermal/qcom/Makefile | 3 +-
drivers/thermal/qcom/tsens-ipq8064.c | 551 +++++++++++++++++++++
drivers/thermal/qcom/tsens.c | 3 +
drivers/thermal/qcom/tsens.h | 2 +-
5 files changed, 558 insertions(+), 2 deletions(-)
create mode 100644 drivers/thermal/qcom/tsens-ipq8064.c
--- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
@@ -5,6 +5,7 @@ Required properties:
- "qcom,msm8916-tsens" : For 8916 Family of SoCs
- "qcom,msm8974-tsens" : For 8974 Family of SoCs
- "qcom,msm8996-tsens" : For 8996 Family of SoCs
+ - "qcom,ipq8064-tsens" : For IPQ8064
- reg: Address range of the thermal registers
- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
--- a/drivers/thermal/qcom/Makefile --- a/drivers/thermal/qcom/Makefile
+++ b/drivers/thermal/qcom/Makefile +++ b/drivers/thermal/qcom/Makefile
@@ -1,2 +1,3 @@ @@ -1,2 +1,3 @@
obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o
-qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o -qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-v2.o
+qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o \ +qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-v2.o \
+ tsens-ipq8064.o + tsens-ipq8064.o
--- /dev/null --- /dev/null
+++ b/drivers/thermal/qcom/tsens-ipq8064.c +++ b/drivers/thermal/qcom/tsens-ipq8064.c
@ -605,23 +588,27 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
+}; +};
--- a/drivers/thermal/qcom/tsens.c --- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c
@@ -72,6 +72,9 @@ static const struct of_device_id tsens_t @@ -75,8 +75,11 @@ static const struct of_device_id tsens_t
}, { }, {
.compatible = "qcom,msm8996-tsens", .compatible = "qcom,tsens-v2",
.data = &data_8996, .data = &data_tsens_v2,
+ }, { + }, {
+ .compatible = "qcom,ipq8064-tsens", + .compatible = "qcom,ipq8064-tsens",
+ .data = &data_ipq8064, + .data = &data_ipq8064,
}, },
{} - {}
+ {}
}; };
MODULE_DEVICE_TABLE(of, tsens_table);
--- a/drivers/thermal/qcom/tsens.h --- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h
@@ -89,6 +89,6 @@ void compute_intercept_slope(struct tsen @@ -89,7 +89,7 @@ int init_common(struct tsens_device *);
int init_common(struct tsens_device *);
int get_temp_common(struct tsens_device *, int, int *); int get_temp_common(struct tsens_device *, int, int *);
-extern const struct tsens_data data_8916, data_8974, data_8960, data_8996; /* TSENS v1 targets */
+extern const struct tsens_data data_8916, data_8974, data_8960, data_8996, data_ipq8064; -extern const struct tsens_data data_8916, data_8974, data_8960;
+extern const struct tsens_data data_8916, data_8974, data_8960, data_ipq8064;
/* TSENS v2 targets */
extern const struct tsens_data data_8996, data_tsens_v2;
#endif /* __QCOM_TSENS_H__ */

View File

@ -21,27 +21,9 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
include/linux/thermal.h | 14 +++++ include/linux/thermal.h | 14 +++++
6 files changed, 162 insertions(+), 17 deletions(-) 6 files changed, 162 insertions(+), 17 deletions(-)
--- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
@@ -12,11 +12,15 @@ Required properties:
- Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to specify
nvmem cells
+Optional properties:
+- interrupts: Interrupt which gets triggered when threshold is hit
+
Example:
tsens: thermal-sensor@900000 {
compatible = "qcom,msm8916-tsens";
reg = <0x4a8000 0x2000>;
nvmem-cells = <&tsens_caldata>, <&tsens_calsel>;
nvmem-cell-names = "caldata", "calsel";
+ interrupts = <0 178 0>;
#thermal-sensor-cells = <1>;
};
--- a/drivers/thermal/of-thermal.c --- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c
@@ -95,7 +95,7 @@ static int of_thermal_get_temp(struct th @@ -77,7 +77,7 @@ static int of_thermal_get_temp(struct th
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
@ -50,7 +32,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EINVAL; return -EINVAL;
return data->ops->get_temp(data->sensor_data, temp); return data->ops->get_temp(data->sensor_data, temp);
@@ -106,7 +106,8 @@ static int of_thermal_set_trips(struct t @@ -88,7 +88,8 @@ static int of_thermal_set_trips(struct t
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
@ -60,7 +42,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EINVAL; return -EINVAL;
return data->ops->set_trips(data->sensor_data, low, high); return data->ops->set_trips(data->sensor_data, low, high);
@@ -192,6 +193,9 @@ static int of_thermal_set_emul_temp(stru @@ -174,6 +175,9 @@ static int of_thermal_set_emul_temp(stru
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
@ -70,7 +52,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return data->ops->set_emul_temp(data->sensor_data, temp); return data->ops->set_emul_temp(data->sensor_data, temp);
} }
@@ -200,7 +204,7 @@ static int of_thermal_get_trend(struct t @@ -182,7 +186,7 @@ static int of_thermal_get_trend(struct t
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
@ -79,7 +61,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EINVAL; return -EINVAL;
return data->ops->get_trend(data->sensor_data, trip, trend); return data->ops->get_trend(data->sensor_data, trip, trend);
@@ -289,7 +293,9 @@ static int of_thermal_set_mode(struct th @@ -271,7 +275,9 @@ static int of_thermal_set_mode(struct th
mutex_unlock(&tz->lock); mutex_unlock(&tz->lock);
data->mode = mode; data->mode = mode;
@ -90,7 +72,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return 0; return 0;
} }
@@ -299,7 +305,8 @@ static int of_thermal_get_trip_type(stru @@ -281,7 +287,8 @@ static int of_thermal_get_trip_type(stru
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
@ -100,7 +82,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM; return -EDOM;
*type = data->trips[trip].type; *type = data->trips[trip].type;
@@ -307,12 +314,39 @@ static int of_thermal_get_trip_type(stru @@ -289,12 +296,39 @@ static int of_thermal_get_trip_type(stru
return 0; return 0;
} }
@ -141,7 +123,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM; return -EDOM;
*temp = data->trips[trip].temperature; *temp = data->trips[trip].temperature;
@@ -325,7 +359,8 @@ static int of_thermal_set_trip_temp(stru @@ -307,7 +341,8 @@ static int of_thermal_set_trip_temp(stru
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
@ -151,7 +133,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM; return -EDOM;
if (data->ops->set_trip_temp) { if (data->ops->set_trip_temp) {
@@ -347,7 +382,8 @@ static int of_thermal_get_trip_hyst(stru @@ -329,7 +364,8 @@ static int of_thermal_get_trip_hyst(stru
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
@ -161,7 +143,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM; return -EDOM;
*hyst = data->trips[trip].hysteresis; *hyst = data->trips[trip].hysteresis;
@@ -360,7 +396,8 @@ static int of_thermal_set_trip_hyst(stru @@ -342,7 +378,8 @@ static int of_thermal_set_trip_hyst(stru
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
@ -171,7 +153,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
return -EDOM; return -EDOM;
/* thermal framework should take care of data->mask & (1 << trip) */ /* thermal framework should take care of data->mask & (1 << trip) */
@@ -435,6 +472,9 @@ thermal_zone_of_add_sensor(struct device @@ -417,6 +454,9 @@ thermal_zone_of_add_sensor(struct device
if (ops->set_emul_temp) if (ops->set_emul_temp)
tzd->ops->set_emul_temp = of_thermal_set_emul_temp; tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
@ -181,7 +163,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
mutex_unlock(&tzd->lock); mutex_unlock(&tzd->lock);
return tzd; return tzd;
@@ -729,7 +769,10 @@ static const char * const trip_types[] = @@ -711,7 +751,10 @@ static const char * const trip_types[] =
[THERMAL_TRIP_ACTIVE] = "active", [THERMAL_TRIP_ACTIVE] = "active",
[THERMAL_TRIP_PASSIVE] = "passive", [THERMAL_TRIP_PASSIVE] = "passive",
[THERMAL_TRIP_HOT] = "hot", [THERMAL_TRIP_HOT] = "hot",
@ -261,7 +243,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume); static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume);
static const struct of_device_id tsens_table[] = { static const struct of_device_id tsens_table[] = {
@@ -83,6 +109,8 @@ MODULE_DEVICE_TABLE(of, tsens_table); @@ -86,6 +112,8 @@ MODULE_DEVICE_TABLE(of, tsens_table);
static const struct thermal_zone_of_device_ops tsens_of_ops = { static const struct thermal_zone_of_device_ops tsens_of_ops = {
.get_temp = tsens_get_temp, .get_temp = tsens_get_temp,
.get_trend = tsens_get_trend, .get_trend = tsens_get_trend,
@ -270,18 +252,18 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
}; };
static int tsens_register(struct tsens_device *tmdev) static int tsens_register(struct tsens_device *tmdev)
@@ -131,7 +159,7 @@ static int tsens_probe(struct platform_d @@ -134,7 +162,7 @@ static int tsens_probe(struct platform_d
if (id) if (id)
data = id->data; data = id->data;
else else
- data = &data_8960; - data = &data_8960;
+ return -EINVAL; + return -EINVAL;
if (data->num_sensors <= 0) { num_sensors = data->num_sensors;
dev_err(dev, "invalid number of sensors\n");
@@ -146,6 +174,9 @@ static int tsens_probe(struct platform_d @@ -155,6 +183,9 @@ static int tsens_probe(struct platform_d
tmdev->dev = dev; tmdev->dev = dev;
tmdev->num_sensors = data->num_sensors; tmdev->num_sensors = num_sensors;
tmdev->ops = data->ops; tmdev->ops = data->ops;
+ +
+ tmdev->tsens_irq = platform_get_irq(pdev, 0); + tmdev->tsens_irq = platform_get_irq(pdev, 0);
@ -324,15 +306,14 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
}; };
/** /**
@@ -76,11 +85,13 @@ struct tsens_context { @@ -76,10 +85,12 @@ struct tsens_context {
struct tsens_device { struct tsens_device {
struct device *dev; struct device *dev;
u32 num_sensors; u32 num_sensors;
+ u32 tsens_irq; + u32 tsens_irq;
struct regmap *map; struct regmap *map;
struct regmap_field *status_field; u32 tm_offset;
struct tsens_context ctx; struct tsens_context ctx;
bool trdy;
const struct tsens_ops *ops; const struct tsens_ops *ops;
+ struct work_struct tsens_work; + struct work_struct tsens_work;
struct tsens_sensor sensor[0]; struct tsens_sensor sensor[0];
@ -340,7 +321,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
--- a/drivers/thermal/thermal_sysfs.c --- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c
@@ -115,12 +115,48 @@ trip_point_type_show(struct device *dev, @@ -113,12 +113,48 @@ trip_point_type_show(struct device *dev,
return sprintf(buf, "passive\n"); return sprintf(buf, "passive\n");
case THERMAL_TRIP_ACTIVE: case THERMAL_TRIP_ACTIVE:
return sprintf(buf, "active\n"); return sprintf(buf, "active\n");
@ -389,7 +370,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
trip_point_temp_store(struct device *dev, struct device_attribute *attr, trip_point_temp_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
@@ -562,6 +598,12 @@ static int create_trip_attrs(struct ther @@ -559,6 +595,12 @@ static int create_trip_attrs(struct ther
tz->trip_type_attrs[indx].attr.show = trip_point_type_show; tz->trip_type_attrs[indx].attr.show = trip_point_type_show;
attrs[indx] = &tz->trip_type_attrs[indx].attr.attr; attrs[indx] = &tz->trip_type_attrs[indx].attr.attr;
@ -404,7 +385,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
"trip_point_%d_temp", indx); "trip_point_%d_temp", indx);
--- a/include/linux/thermal.h --- a/include/linux/thermal.h
+++ b/include/linux/thermal.h +++ b/include/linux/thermal.h
@@ -78,11 +78,19 @@ enum thermal_device_mode { @@ -63,11 +63,19 @@ enum thermal_device_mode {
THERMAL_DEVICE_ENABLED, THERMAL_DEVICE_ENABLED,
}; };
@ -424,7 +405,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
}; };
enum thermal_trend { enum thermal_trend {
@@ -120,6 +128,8 @@ struct thermal_zone_device_ops { @@ -105,6 +113,8 @@ struct thermal_zone_device_ops {
enum thermal_trip_type *); enum thermal_trip_type *);
int (*get_trip_temp) (struct thermal_zone_device *, int, int *); int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
int (*set_trip_temp) (struct thermal_zone_device *, int, int); int (*set_trip_temp) (struct thermal_zone_device *, int, int);
@ -433,7 +414,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
int (*set_trip_hyst) (struct thermal_zone_device *, int, int); int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
int (*get_crit_temp) (struct thermal_zone_device *, int *); int (*get_crit_temp) (struct thermal_zone_device *, int *);
@@ -363,6 +373,8 @@ struct thermal_genl_event { @@ -349,6 +359,8 @@ struct thermal_genl_event {
* temperature. * temperature.
* @set_trip_temp: a pointer to a function that sets the trip temperature on * @set_trip_temp: a pointer to a function that sets the trip temperature on
* hardware. * hardware.
@ -442,7 +423,7 @@ Signed-off-by: Rajith Cherian <rajith@codeaurora.org>
*/ */
struct thermal_zone_of_device_ops { struct thermal_zone_of_device_ops {
int (*get_temp)(void *, int *); int (*get_temp)(void *, int *);
@@ -370,6 +382,8 @@ struct thermal_zone_of_device_ops { @@ -356,6 +368,8 @@ struct thermal_zone_of_device_ops {
int (*set_trips)(void *, int, int); int (*set_trips)(void *, int, int);
int (*set_emul_temp)(void *, int); int (*set_emul_temp)(void *, int);
int (*set_trip_temp)(void *, int, int); int (*set_trip_temp)(void *, int, int);

View File

@ -12,19 +12,32 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt
+++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt
@@ -13,6 +13,7 @@ Required properties : @@ -16,6 +16,7 @@ Required properties :
"qcom,rpmcc-msm8916", "qcom,rpmcc"
"qcom,rpmcc-msm8974", "qcom,rpmcc" "qcom,rpmcc-msm8974", "qcom,rpmcc"
"qcom,rpmcc-apq8064", "qcom,rpmcc" "qcom,rpmcc-apq8064", "qcom,rpmcc"
"qcom,rpmcc-msm8996", "qcom,rpmcc"
+ "qcom,rpmcc-ipq806x", "qcom,rpmcc" + "qcom,rpmcc-ipq806x", "qcom,rpmcc"
- #clock-cells : shall contain 1 - #clock-cells : shall contain 1
--- a/include/dt-bindings/clock/qcom,rpmcc.h
+++ b/include/dt-bindings/clock/qcom,rpmcc.h
@@ -45,6 +45,10 @@
#define RPM_XO_A0 27
#define RPM_XO_A1 28
#define RPM_XO_A2 29
+#define RPM_NSS_FABRIC_0_CLK 30
+#define RPM_NSS_FABRIC_0_A_CLK 31
+#define RPM_NSS_FABRIC_1_CLK 32
+#define RPM_NSS_FABRIC_1_A_CLK 33
/* SMD RPM clocks */
#define RPM_SMD_XO_CLK_SRC 0
--- a/drivers/clk/qcom/clk-rpm.c --- a/drivers/clk/qcom/clk-rpm.c
+++ b/drivers/clk/qcom/clk-rpm.c +++ b/drivers/clk/qcom/clk-rpm.c
@@ -359,6 +359,16 @@ DEFINE_CLK_RPM(apq8064, sfab_clk, sfab_a @@ -520,6 +520,16 @@ DEFINE_CLK_RPM_XO_BUFFER(apq8064, xo_a0_
DEFINE_CLK_RPM(apq8064, sfpb_clk, sfpb_a_clk, QCOM_RPM_SFPB_CLK); DEFINE_CLK_RPM_XO_BUFFER(apq8064, xo_a1_clk, xo_a1_a_clk, 24);
DEFINE_CLK_RPM(apq8064, qdss_clk, qdss_a_clk, QCOM_RPM_QDSS_CLK); DEFINE_CLK_RPM_XO_BUFFER(apq8064, xo_a2_clk, xo_a2_a_clk, 28);
+/* ipq806x */ +/* ipq806x */
+DEFINE_CLK_RPM(ipq806x, afab_clk, afab_a_clk, QCOM_RPM_APPS_FABRIC_CLK); +DEFINE_CLK_RPM(ipq806x, afab_clk, afab_a_clk, QCOM_RPM_APPS_FABRIC_CLK);
@ -39,8 +52,8 @@ Signed-off-by: John Crispin <john@phrozen.org>
static struct clk_rpm *apq8064_clks[] = { static struct clk_rpm *apq8064_clks[] = {
[RPM_APPS_FABRIC_CLK] = &apq8064_afab_clk, [RPM_APPS_FABRIC_CLK] = &apq8064_afab_clk,
[RPM_APPS_FABRIC_A_CLK] = &apq8064_afab_a_clk, [RPM_APPS_FABRIC_A_CLK] = &apq8064_afab_a_clk,
@@ -380,13 +390,38 @@ static struct clk_rpm *apq8064_clks[] = @@ -546,15 +556,40 @@ static struct clk_rpm *apq8064_clks[] =
[RPM_QDSS_A_CLK] = &apq8064_qdss_a_clk, [RPM_XO_A2] = &apq8064_xo_a2_clk,
}; };
+static struct clk_rpm *ipq806x_clks[] = { +static struct clk_rpm *ipq806x_clks[] = {
@ -73,21 +86,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
+}; +};
+ +
static const struct of_device_id rpm_clk_match_table[] = { static const struct of_device_id rpm_clk_match_table[] = {
{ .compatible = "qcom,rpmcc-msm8660", .data = &rpm_clk_msm8660 },
{ .compatible = "qcom,rpmcc-apq8060", .data = &rpm_clk_msm8660 },
{ .compatible = "qcom,rpmcc-apq8064", .data = &rpm_clk_apq8064 }, { .compatible = "qcom,rpmcc-apq8064", .data = &rpm_clk_apq8064 },
+ { .compatible = "qcom,rpmcc-ipq806x", .data = &rpm_clk_ipq806x }, + { .compatible = "qcom,rpmcc-ipq806x", .data = &rpm_clk_ipq806x },
{ } { }
}; };
MODULE_DEVICE_TABLE(of, rpm_clk_match_table); MODULE_DEVICE_TABLE(of, rpm_clk_match_table);
--- a/include/dt-bindings/clock/qcom,rpmcc.h
+++ b/include/dt-bindings/clock/qcom,rpmcc.h
@@ -37,6 +37,10 @@
#define RPM_SYS_FABRIC_A_CLK 19
#define RPM_SFPB_CLK 20
#define RPM_SFPB_A_CLK 21
+#define RPM_NSS_FABRIC_0_CLK 22
+#define RPM_NSS_FABRIC_0_A_CLK 23
+#define RPM_NSS_FABRIC_1_CLK 24
+#define RPM_NSS_FABRIC_1_A_CLK 25
/* SMD RPM clocks */
#define RPM_SMD_XO_CLK_SRC 0

View File

@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/arch/arm/Makefile --- a/arch/arm/Makefile
+++ b/arch/arm/Makefile +++ b/arch/arm/Makefile
@@ -67,7 +67,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-i @@ -64,7 +64,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-i
# macro, but instead defines a whole series of macros which makes # macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible. # testing for a specific architecture or later rather impossible.
arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m

View File

@ -22,7 +22,7 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
--- a/arch/arm/Kconfig --- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig +++ b/arch/arm/Kconfig
@@ -1939,6 +1939,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN @@ -1925,6 +1925,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN
The command-line arguments provided by the boot loader will be The command-line arguments provided by the boot loader will be
appended to the the device tree bootargs property. appended to the the device tree bootargs property.
@ -157,9 +157,9 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
} }
--- a/init/main.c --- a/init/main.c
+++ b/init/main.c +++ b/init/main.c
@@ -95,6 +95,10 @@ @@ -102,6 +102,10 @@
#include <asm/sections.h> #define CREATE_TRACE_POINTS
#include <asm/cacheflush.h> #include <trace/events/initcall.h>
+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE) +#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
+#include <linux/of.h> +#include <linux/of.h>
@ -168,10 +168,10 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
static int kernel_init(void *); static int kernel_init(void *);
extern void init_IRQ(void); extern void init_IRQ(void);
@@ -574,6 +578,18 @@ asmlinkage __visible void __init start_k @@ -594,6 +598,18 @@ asmlinkage __visible void __init start_k
page_alloc_init();
pr_notice("Kernel command line: %s\n", boot_command_line); pr_notice("Kernel command line: %s\n", boot_command_line);
/* parameters may set static keys */
jump_label_init();
+ +
+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE) +#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
+ //Show bootloader's original command line for reference + //Show bootloader's original command line for reference
@ -184,6 +184,6 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
+ } + }
+#endif +#endif
+ +
/* parameters may set static keys */
jump_label_init();
parse_early_param(); parse_early_param();
after_dashes = parse_args("Booting kernel",
static_command_line, __start___param,

View File

@ -10,9 +10,9 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/arch/arm/boot/dts/Makefile --- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile
@@ -699,6 +699,18 @@ dtb-$(CONFIG_ARCH_QCOM) += \ @@ -791,6 +791,18 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-apq8084-mtp.dtb \ qcom-ipq4019-ap.dk07.1-c1.dtb \
qcom-ipq4019-ap.dk01.1-c1.dtb \ qcom-ipq4019-ap.dk07.1-c2.dtb \
qcom-ipq8064-ap148.dtb \ qcom-ipq8064-ap148.dtb \
+ qcom-ipq8064-c2600.dtb \ + qcom-ipq8064-c2600.dtb \
+ qcom-ipq8064-d7800.dtb \ + qcom-ipq8064-d7800.dtb \
@ -28,4 +28,4 @@ Signed-off-by: John Crispin <john@phrozen.org>
+ qcom-ipq8065-r7800.dtb \ + qcom-ipq8065-r7800.dtb \
qcom-msm8660-surf.dtb \ qcom-msm8660-surf.dtb \
qcom-msm8960-cdp.dtb \ qcom-msm8960-cdp.dtb \
qcom-msm8974-lge-nexus5-hammerhead.dtb \ qcom-msm8974-fairphone-fp2.dtb \

View File

@ -6,12 +6,10 @@ Subject: PCI: qcom: Fixed IPQ806x specific clocks
Change-Id: I488e1bc707d6a22b37a338f41935e3922009ba5e Change-Id: I488e1bc707d6a22b37a338f41935e3922009ba5e
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org> Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
--- ---
drivers/pci/host/pcie-qcom.c | 38 +++++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)
--- a/drivers/pci/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -91,6 +91,8 @@ struct qcom_pcie_resources_2_1_0 { @@ -85,6 +85,8 @@ struct qcom_pcie_resources_2_1_0 {
struct clk *iface_clk; struct clk *iface_clk;
struct clk *core_clk; struct clk *core_clk;
struct clk *phy_clk; struct clk *phy_clk;
@ -20,7 +18,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
struct reset_control *pci_reset; struct reset_control *pci_reset;
struct reset_control *axi_reset; struct reset_control *axi_reset;
struct reset_control *ahb_reset; struct reset_control *ahb_reset;
@@ -249,6 +251,14 @@ static int qcom_pcie_get_resources_2_1_0 @@ -235,6 +237,14 @@ static int qcom_pcie_get_resources_2_1_0
if (IS_ERR(res->phy_clk)) if (IS_ERR(res->phy_clk))
return PTR_ERR(res->phy_clk); return PTR_ERR(res->phy_clk);
@ -35,16 +33,16 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
res->pci_reset = devm_reset_control_get_exclusive(dev, "pci"); res->pci_reset = devm_reset_control_get_exclusive(dev, "pci");
if (IS_ERR(res->pci_reset)) if (IS_ERR(res->pci_reset))
return PTR_ERR(res->pci_reset); return PTR_ERR(res->pci_reset);
@@ -281,6 +291,8 @@ static void qcom_pcie_deinit_2_1_0(struc @@ -267,6 +277,8 @@ static void qcom_pcie_deinit_2_1_0(struc
clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->iface_clk);
clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->core_clk);
clk_disable_unprepare(res->phy_clk); clk_disable_unprepare(res->phy_clk);
+ clk_disable_unprepare(res->aux_clk); + clk_disable_unprepare(res->aux_clk);
+ clk_disable_unprepare(res->ref_clk); + clk_disable_unprepare(res->ref_clk);
regulator_disable(res->vdda); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
regulator_disable(res->vdda_phy); }
regulator_disable(res->vdda_refclk);
@@ -324,16 +336,28 @@ static int qcom_pcie_init_2_1_0(struct q @@ -296,16 +308,28 @@ static int qcom_pcie_init_2_1_0(struct q
goto err_assert_ahb; goto err_assert_ahb;
} }
@ -76,7 +74,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
} }
ret = reset_control_deassert(res->ahb_reset); ret = reset_control_deassert(res->ahb_reset);
@@ -389,10 +413,14 @@ static int qcom_pcie_init_2_1_0(struct q @@ -361,10 +385,14 @@ static int qcom_pcie_init_2_1_0(struct q
return 0; return 0;
err_deassert_ahb: err_deassert_ahb:
@ -92,4 +90,4 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
+err_clk_core: +err_clk_core:
clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->iface_clk);
err_assert_ahb: err_assert_ahb:
regulator_disable(res->vdda_phy); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);

View File

@ -6,20 +6,18 @@ Subject: PCI: qcom: Fixed IPQ806x PCIE reset changes
Change-Id: Ia6590e960b9754b1e8b7a51f318788cd63e9e321 Change-Id: Ia6590e960b9754b1e8b7a51f318788cd63e9e321
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org> Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
--- ---
drivers/pci/host/pcie-qcom.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
--- a/drivers/pci/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -98,6 +98,7 @@ struct qcom_pcie_resources_2_1_0 { @@ -92,6 +92,7 @@ struct qcom_pcie_resources_2_1_0 {
struct reset_control *ahb_reset; struct reset_control *ahb_reset;
struct reset_control *por_reset; struct reset_control *por_reset;
struct reset_control *phy_reset; struct reset_control *phy_reset;
+ struct reset_control *ext_reset; + struct reset_control *ext_reset;
struct regulator *vdda; struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY];
struct regulator *vdda_phy; };
struct regulator *vdda_refclk;
@@ -275,6 +276,10 @@ static int qcom_pcie_get_resources_2_1_0 @@ -261,6 +262,10 @@ static int qcom_pcie_get_resources_2_1_0
if (IS_ERR(res->por_reset)) if (IS_ERR(res->por_reset))
return PTR_ERR(res->por_reset); return PTR_ERR(res->por_reset);
@ -30,7 +28,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
res->phy_reset = devm_reset_control_get_exclusive(dev, "phy"); res->phy_reset = devm_reset_control_get_exclusive(dev, "phy");
return PTR_ERR_OR_ZERO(res->phy_reset); return PTR_ERR_OR_ZERO(res->phy_reset);
} }
@@ -288,6 +293,7 @@ static void qcom_pcie_deinit_2_1_0(struc @@ -274,6 +279,7 @@ static void qcom_pcie_deinit_2_1_0(struc
reset_control_assert(res->ahb_reset); reset_control_assert(res->ahb_reset);
reset_control_assert(res->por_reset); reset_control_assert(res->por_reset);
reset_control_assert(res->pci_reset); reset_control_assert(res->pci_reset);
@ -38,7 +36,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->iface_clk);
clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->core_clk);
clk_disable_unprepare(res->phy_clk); clk_disable_unprepare(res->phy_clk);
@@ -306,6 +312,12 @@ static int qcom_pcie_init_2_1_0(struct q @@ -290,15 +296,21 @@ static int qcom_pcie_init_2_1_0(struct q
u32 val; u32 val;
int ret; int ret;
@ -48,38 +46,17 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
+ return ret; + return ret;
+ } + }
+ +
ret = regulator_enable(res->vdda); ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies);
if (ret) { if (ret < 0) {
dev_err(dev, "cannot enable vdda regulator\n"); dev_err(dev, "cannot enable regulators\n");
@@ -324,16 +336,16 @@ static int qcom_pcie_init_2_1_0(struct q return ret;
goto err_vdda_phy;
} }
- ret = reset_control_assert(res->ahb_reset); - ret = reset_control_assert(res->ahb_reset);
+ ret = reset_control_deassert(res->ext_reset); + ret = reset_control_deassert(res->ext_reset);
if (ret) { if (ret) {
- dev_err(dev, "cannot assert ahb reset\n"); - dev_err(dev, "cannot assert ahb reset\n");
- goto err_assert_ahb;
+ dev_err(dev, "cannot assert ext reset\n"); + dev_err(dev, "cannot assert ext reset\n");
+ goto err_reset_ext; goto err_assert_ahb;
} }
ret = clk_prepare_enable(res->iface_clk);
if (ret) {
dev_err(dev, "cannot prepare/enable iface clock\n");
- goto err_assert_ahb;
+ goto err_iface;
}
ret = clk_prepare_enable(res->core_clk);
@@ -422,7 +434,9 @@ err_clk_phy:
clk_disable_unprepare(res->core_clk);
err_clk_core:
clk_disable_unprepare(res->iface_clk);
-err_assert_ahb:
+err_iface:
+ reset_control_assert(res->ext_reset);
+err_reset_ext:
regulator_disable(res->vdda_phy);
err_vdda_phy:
regulator_disable(res->vdda_refclk);

View File

@ -6,12 +6,10 @@ Subject: PCI: qcom: Fixed IPQ806x PCIE init changes
Change-Id: Ic319b1aec27a47809284759f8fcb6a8815b7cf7e Change-Id: Ic319b1aec27a47809284759f8fcb6a8815b7cf7e
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org> Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
--- ---
drivers/pci/host/pcie-qcom.c | 62 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 53 insertions(+), 9 deletions(-)
--- a/drivers/pci/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -52,7 +52,13 @@ @@ -45,7 +45,13 @@
#define PCIE_CAP_CPL_TIMEOUT_DISABLE 0x10 #define PCIE_CAP_CPL_TIMEOUT_DISABLE 0x10
#define PCIE20_PARF_PHY_CTRL 0x40 #define PCIE20_PARF_PHY_CTRL 0x40
@ -25,7 +23,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
#define PCIE20_PARF_DBI_BASE_ADDR 0x168 #define PCIE20_PARF_DBI_BASE_ADDR 0x168
#define PCIE20_PARF_SLV_ADDR_SPACE_SIZE 0x16C #define PCIE20_PARF_SLV_ADDR_SPACE_SIZE 0x16C
#define PCIE20_PARF_MHI_CLOCK_RESET_CTRL 0x174 #define PCIE20_PARF_MHI_CLOCK_RESET_CTRL 0x174
@@ -83,6 +89,18 @@ @@ -76,6 +82,18 @@
#define DBI_RO_WR_EN 1 #define DBI_RO_WR_EN 1
#define PERST_DELAY_US 1000 #define PERST_DELAY_US 1000
@ -44,15 +42,15 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
#define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358 #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358
#define SLV_ADDR_SPACE_SZ 0x10000000 #define SLV_ADDR_SPACE_SZ 0x10000000
@@ -102,6 +120,7 @@ struct qcom_pcie_resources_2_1_0 { @@ -94,6 +112,7 @@ struct qcom_pcie_resources_2_1_0 {
struct regulator *vdda; struct reset_control *phy_reset;
struct regulator *vdda_phy; struct reset_control *ext_reset;
struct regulator *vdda_refclk; struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY];
+ uint8_t phy_tx0_term_offset; + uint8_t phy_tx0_term_offset;
}; };
struct qcom_pcie_resources_1_0_0 { struct qcom_pcie_resources_1_0_0 {
@@ -179,6 +198,16 @@ struct qcom_pcie { @@ -173,6 +192,16 @@ struct qcom_pcie {
#define to_qcom_pcie(x) dev_get_drvdata((x)->dev) #define to_qcom_pcie(x) dev_get_drvdata((x)->dev)
@ -69,7 +67,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
static void qcom_ep_reset_assert(struct qcom_pcie *pcie) static void qcom_ep_reset_assert(struct qcom_pcie *pcie)
{ {
gpiod_set_value_cansleep(pcie->reset, 1); gpiod_set_value_cansleep(pcie->reset, 1);
@@ -280,6 +309,10 @@ static int qcom_pcie_get_resources_2_1_0 @@ -266,6 +295,10 @@ static int qcom_pcie_get_resources_2_1_0
if (IS_ERR(res->ext_reset)) if (IS_ERR(res->ext_reset))
return PTR_ERR(res->ext_reset); return PTR_ERR(res->ext_reset);
@ -80,7 +78,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
res->phy_reset = devm_reset_control_get_exclusive(dev, "phy"); res->phy_reset = devm_reset_control_get_exclusive(dev, "phy");
return PTR_ERR_OR_ZERO(res->phy_reset); return PTR_ERR_OR_ZERO(res->phy_reset);
} }
@@ -309,7 +342,6 @@ static int qcom_pcie_init_2_1_0(struct q @@ -293,7 +326,6 @@ static int qcom_pcie_init_2_1_0(struct q
struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
struct dw_pcie *pci = pcie->pci; struct dw_pcie *pci = pcie->pci;
struct device *dev = pci->dev; struct device *dev = pci->dev;
@ -88,7 +86,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
int ret; int ret;
ret = reset_control_assert(res->ahb_reset); ret = reset_control_assert(res->ahb_reset);
@@ -378,15 +410,26 @@ static int qcom_pcie_init_2_1_0(struct q @@ -350,15 +382,26 @@ static int qcom_pcie_init_2_1_0(struct q
goto err_deassert_ahb; goto err_deassert_ahb;
} }

View File

@ -8,12 +8,10 @@ Resolved PCIE EP detection errors caused due to missing iATU programming.
Change-Id: Ie95c0f8cb940abc0192a8a3c4e825ddba54b72fe Change-Id: Ie95c0f8cb940abc0192a8a3c4e825ddba54b72fe
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org> Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
--- ---
drivers/pci/host/pcie-qcom.c | 77 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
--- a/drivers/pci/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -83,6 +83,30 @@ @@ -76,6 +76,30 @@
#define PCIE20_CAP_LINK_1 (PCIE20_CAP + 0x14) #define PCIE20_CAP_LINK_1 (PCIE20_CAP + 0x14)
#define PCIE_CAP_LINK1_VAL 0x2FD7F #define PCIE_CAP_LINK1_VAL 0x2FD7F
@ -44,7 +42,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
#define PCIE20_PARF_Q2A_FLUSH 0x1AC #define PCIE20_PARF_Q2A_FLUSH 0x1AC
#define PCIE20_MISC_CONTROL_1_REG 0x8BC #define PCIE20_MISC_CONTROL_1_REG 0x8BC
@@ -251,6 +275,57 @@ static void qcom_pcie_2_1_0_ltssm_enable @@ -240,6 +264,57 @@ static void qcom_pcie_2_1_0_ltssm_enable
writel(val, pcie->elbi + PCIE20_ELBI_SYS_CTRL); writel(val, pcie->elbi + PCIE20_ELBI_SYS_CTRL);
} }
@ -102,7 +100,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie)
{ {
struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
@@ -465,6 +540,9 @@ static int qcom_pcie_init_2_1_0(struct q @@ -437,6 +512,9 @@ static int qcom_pcie_init_2_1_0(struct q
writel(CFG_BRIDGE_SB_INIT, writel(CFG_BRIDGE_SB_INIT,
pci->dbi_base + PCIE20_AXI_MSTR_RESP_COMP_CTRL1); pci->dbi_base + PCIE20_AXI_MSTR_RESP_COMP_CTRL1);

View File

@ -6,29 +6,27 @@ Subject: PCI: qcom: Force GEN1 support
Change-Id: Ica54ddb737d7b851469deab1745f54bf431bd3f0 Change-Id: Ica54ddb737d7b851469deab1745f54bf431bd3f0
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org> Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
--- ---
drivers/pci/host/pcie-qcom.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- a/drivers/pci/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -129,6 +129,8 @@ @@ -122,6 +122,8 @@
#define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358 #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358
#define SLV_ADDR_SPACE_SZ 0x10000000 #define SLV_ADDR_SPACE_SZ 0x10000000
+#define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xA0 +#define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xA0
+ +
#define QCOM_PCIE_2_1_0_MAX_SUPPLY 3
struct qcom_pcie_resources_2_1_0 { struct qcom_pcie_resources_2_1_0 {
struct clk *iface_clk; struct clk *iface_clk;
struct clk *core_clk; @@ -212,6 +214,7 @@ struct qcom_pcie {
@@ -218,6 +220,7 @@ struct qcom_pcie {
struct phy *phy; struct phy *phy;
struct gpio_desc *reset; struct gpio_desc *reset;
struct qcom_pcie_ops *ops; const struct qcom_pcie_ops *ops;
+ uint32_t force_gen1; + uint32_t force_gen1;
}; };
#define to_qcom_pcie(x) dev_get_drvdata((x)->dev) #define to_qcom_pcie(x) dev_get_drvdata((x)->dev)
@@ -532,6 +535,11 @@ static int qcom_pcie_init_2_1_0(struct q @@ -504,6 +507,11 @@ static int qcom_pcie_init_2_1_0(struct q
/* wait for clock acquisition */ /* wait for clock acquisition */
usleep_range(1000, 1500); usleep_range(1000, 1500);
@ -40,7 +38,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
/* Set the Max TLP size to 2K, instead of using default of 4K */ /* Set the Max TLP size to 2K, instead of using default of 4K */
@@ -1382,6 +1390,8 @@ static int qcom_pcie_probe(struct platfo @@ -1369,6 +1377,8 @@ static int qcom_pcie_probe(struct platfo
struct dw_pcie *pci; struct dw_pcie *pci;
struct qcom_pcie *pcie; struct qcom_pcie *pcie;
int ret; int ret;
@ -49,7 +47,7 @@ Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
if (!pcie) if (!pcie)
@@ -1403,6 +1413,9 @@ static int qcom_pcie_probe(struct platfo @@ -1391,6 +1401,9 @@ static int qcom_pcie_probe(struct platfo
if (IS_ERR(pcie->reset)) if (IS_ERR(pcie->reset))
return PTR_ERR(pcie->reset); return PTR_ERR(pcie->reset);

View File

@ -14,9 +14,9 @@ Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
(limited to 'drivers/pci/host/pcie-qcom.c') (limited to 'drivers/pci/host/pcie-qcom.c')
--- a/drivers/pci/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -131,6 +131,14 @@ @@ -124,6 +124,14 @@
#define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xA0 #define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xA0
@ -28,10 +28,10 @@ Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
+#define PCIE20_MPS_MASK __mask(7, 5) +#define PCIE20_MPS_MASK __mask(7, 5)
+#define PCIE20_MPS(x) __set(x, 7, 5) +#define PCIE20_MPS(x) __set(x, 7, 5)
+ +
#define QCOM_PCIE_2_1_0_MAX_SUPPLY 3
struct qcom_pcie_resources_2_1_0 { struct qcom_pcie_resources_2_1_0 {
struct clk *iface_clk; struct clk *iface_clk;
struct clk *core_clk; @@ -1453,6 +1461,35 @@ static int qcom_pcie_probe(struct platfo
@@ -1472,6 +1480,35 @@ static int qcom_pcie_probe(struct platfo
return 0; return 0;
} }

View File

@ -36,9 +36,9 @@ Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
drivers/pci/host/pcie-qcom.c | 16 +++++++--------- drivers/pci/host/pcie-qcom.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-) 1 file changed, 7 insertions(+), 9 deletions(-)
--- a/drivers/pci/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -407,6 +407,7 @@ static void qcom_pcie_deinit_2_1_0(struc @@ -393,6 +393,7 @@ static void qcom_pcie_deinit_2_1_0(struc
{ {
struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
@ -46,15 +46,15 @@ Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
reset_control_assert(res->pci_reset); reset_control_assert(res->pci_reset);
reset_control_assert(res->axi_reset); reset_control_assert(res->axi_reset);
reset_control_assert(res->ahb_reset); reset_control_assert(res->ahb_reset);
@@ -415,7 +416,6 @@ static void qcom_pcie_deinit_2_1_0(struc @@ -401,7 +402,6 @@ static void qcom_pcie_deinit_2_1_0(struc
reset_control_assert(res->ext_reset); reset_control_assert(res->ext_reset);
clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->iface_clk);
clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->core_clk);
- clk_disable_unprepare(res->phy_clk); - clk_disable_unprepare(res->phy_clk);
clk_disable_unprepare(res->aux_clk); clk_disable_unprepare(res->aux_clk);
clk_disable_unprepare(res->ref_clk); clk_disable_unprepare(res->ref_clk);
regulator_disable(res->vdda); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
@@ -472,12 +472,6 @@ static int qcom_pcie_init_2_1_0(struct q @@ -444,12 +444,6 @@ static int qcom_pcie_init_2_1_0(struct q
goto err_clk_core; goto err_clk_core;
} }
@ -67,7 +67,7 @@ Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
ret = clk_prepare_enable(res->aux_clk); ret = clk_prepare_enable(res->aux_clk);
if (ret) { if (ret) {
dev_err(dev, "cannot prepare/enable aux clock\n"); dev_err(dev, "cannot prepare/enable aux clock\n");
@@ -541,6 +535,12 @@ static int qcom_pcie_init_2_1_0(struct q @@ -513,6 +507,12 @@ static int qcom_pcie_init_2_1_0(struct q
return ret; return ret;
} }
@ -80,7 +80,7 @@ Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
/* wait for clock acquisition */ /* wait for clock acquisition */
usleep_range(1000, 1500); usleep_range(1000, 1500);
if (pcie->force_gen1) { if (pcie->force_gen1) {
@@ -566,8 +566,6 @@ err_deassert_ahb: @@ -538,8 +538,6 @@ err_deassert_ahb:
err_clk_ref: err_clk_ref:
clk_disable_unprepare(res->aux_clk); clk_disable_unprepare(res->aux_clk);
err_clk_aux: err_clk_aux:

View File

@ -12,9 +12,9 @@ Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
drivers/pci/host/pcie-qcom.c | 2 +- drivers/pci/host/pcie-qcom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/pci/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -408,7 +408,7 @@ static void qcom_pcie_deinit_2_1_0(struc @@ -394,7 +394,7 @@ static void qcom_pcie_deinit_2_1_0(struc
struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
clk_disable_unprepare(res->phy_clk); clk_disable_unprepare(res->phy_clk);

View File

@ -1,7 +1,7 @@
--- a/drivers/firmware/qcom_scm.c --- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c
@@ -422,6 +422,9 @@ static const struct of_device_id qcom_sc @@ -606,6 +606,9 @@ static const struct of_device_id qcom_sc
{ .compatible = "qcom,scm-msm8996", { .compatible = "qcom,scm-ipq4019",
.data = NULL, /* no clocks */ .data = NULL, /* no clocks */
}, },
+ { .compatible = "qcom,scm-ipq806x", + { .compatible = "qcom,scm-ipq806x",

View File

@ -11,95 +11,7 @@ to application processor. Also the scm call interface is changed.
Change-Id: Ib6c06829d04bc8c20483c36e63da92e26cdef9ce Change-Id: Ib6c06829d04bc8c20483c36e63da92e26cdef9ce
Signed-off-by: Ajay Kishore <akisho@codeaurora.org> Signed-off-by: Ajay Kishore <akisho@codeaurora.org>
--- ---
drivers/firmware/qcom_scm-32.c | 17 +++++++++++++++++
drivers/firmware/qcom_scm-64.c | 9 +++++++++
drivers/firmware/qcom_scm.c | 13 +++++++++++++
drivers/firmware/qcom_scm.h | 8 ++++++++
drivers/pinctrl/qcom/pinctrl-msm.c | 34 ++++++++++++++++++++++++++++------
include/linux/qcom_scm.h | 3 ++-
6 files changed, 77 insertions(+), 7 deletions(-)
--- a/drivers/firmware/qcom_scm-32.c
+++ b/drivers/firmware/qcom_scm-32.c
@@ -561,6 +561,24 @@ int __qcom_scm_pas_mss_reset(struct devi
return ret ? : le32_to_cpu(out);
}
+int __qcom_scm_pinmux_read(u32 svc_id, u32 cmd_id, u32 arg1)
+{
+ s32 ret;
+
+ ret = qcom_scm_call_atomic1(svc_id, cmd_id, arg1);
+
+ return ret;
+}
+
+int __qcom_scm_pinmux_write(u32 svc_id, u32 cmd_id, u32 arg1, u32 arg2)
+{
+ s32 ret;
+
+ ret = qcom_scm_call_atomic2(svc_id, cmd_id, arg1, arg2);
+
+ return ret;
+}
+
int __qcom_scm_set_remote_state(struct device *dev, u32 state, u32 id)
{
struct {
--- a/drivers/firmware/qcom_scm-64.c
+++ b/drivers/firmware/qcom_scm-64.c
@@ -366,6 +366,16 @@ int __qcom_scm_pas_mss_reset(struct devi
return ret ? : res.a1;
}
+int __qcom_scm_pinmux_read(u32 svc_id, u32 cmd_id, u32 arg1)
+{
+ return -ENOTSUPP;
+}
+
+int __qcom_scm_pinmux_write(u32 svc_id, u32 cmd_id, u32 arg1, u32 arg2)
+{
+ return -ENOTSUPP;
+}
+
int __qcom_scm_set_remote_state(struct device *dev, u32 state, u32 id)
{
struct qcom_scm_desc desc = {0};
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
@@ -470,3 +470,16 @@ static int __init qcom_scm_init(void)
return platform_driver_register(&qcom_scm_driver);
}
subsys_initcall(qcom_scm_init);
+
+int qcom_scm_pinmux_read(u32 arg1)
+{
+ return __qcom_scm_pinmux_read(SCM_SVC_IO_ACCESS, SCM_IO_READ, arg1);
+}
+EXPORT_SYMBOL(qcom_scm_pinmux_read);
+
+int qcom_scm_pinmux_write(u32 arg1, u32 arg2)
+{
+ return __qcom_scm_pinmux_write(SCM_SVC_IO_ACCESS, SCM_IO_WRITE,
+ arg1, arg2);
+}
+EXPORT_SYMBOL(qcom_scm_pinmux_write);
--- a/drivers/firmware/qcom_scm.h
+++ b/drivers/firmware/qcom_scm.h
@@ -58,6 +58,13 @@ extern int __qcom_scm_pas_auth_and_rese
extern int __qcom_scm_pas_shutdown(struct device *dev, u32 peripheral);
extern int __qcom_scm_pas_mss_reset(struct device *dev, bool reset);
+#define SCM_IO_READ 1
+#define SCM_IO_WRITE 2
+#define SCM_SVC_IO_ACCESS 0x5
+
+s32 __qcom_scm_pinmux_read(u32 svc_id, u32 cmd_id, u32 arg1);
+s32 __qcom_scm_pinmux_write(u32 svc_id, u32 cmd_id, u32 arg1, u32 arg2);
+
/* common error codes */
#define QCOM_SCM_V2_EBUSY -12
#define QCOM_SCM_ENOMEM -5
--- a/drivers/pinctrl/qcom/pinctrl-msm.c --- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -30,7 +30,8 @@ @@ -30,7 +30,8 @@
@ -112,7 +24,7 @@ Signed-off-by: Ajay Kishore <akisho@codeaurora.org>
#include "../core.h" #include "../core.h"
#include "../pinconf.h" #include "../pinconf.h"
#include "pinctrl-msm.h" #include "pinctrl-msm.h"
@@ -646,6 +647,9 @@ static void msm_gpio_irq_ack(struct irq_ @@ -628,6 +629,9 @@ static void msm_gpio_irq_mask(struct irq
const struct msm_pingroup *g; const struct msm_pingroup *g;
unsigned long flags; unsigned long flags;
u32 val; u32 val;
@ -122,7 +34,7 @@ Signed-off-by: Ajay Kishore <akisho@codeaurora.org>
g = &pctrl->soc->groups[d->hwirq]; g = &pctrl->soc->groups[d->hwirq];
@@ -684,11 +688,30 @@ static int msm_gpio_irq_set_type(struct @@ -732,11 +736,30 @@ static int msm_gpio_irq_set_type(struct
else else
clear_bit(d->hwirq, pctrl->dual_edge_irqs); clear_bit(d->hwirq, pctrl->dual_edge_irqs);
@ -142,14 +54,14 @@ Signed-off-by: Ajay Kishore <akisho@codeaurora.org>
+ const __be32 *reg = of_get_property(pctrl->dev->of_node, "reg", NULL); + const __be32 *reg = of_get_property(pctrl->dev->of_node, "reg", NULL);
+ if (reg) { + if (reg) {
+ u32 addr = be32_to_cpup(reg) + g->intr_target_reg; + u32 addr = be32_to_cpup(reg) + g->intr_target_reg;
+ val = qcom_scm_pinmux_read(addr); + qcom_scm_io_readl(addr, &val);
+ __iormb(); + __iormb();
+ +
+ val &= ~(7 << g->intr_target_bit); + val &= ~(7 << g->intr_target_bit);
+ val |= g->intr_target_kpss_val << g->intr_target_bit; + val |= g->intr_target_kpss_val << g->intr_target_bit;
+ +
+ __iowmb(); + __iowmb();
+ ret = qcom_scm_pinmux_write(addr, val); + ret = qcom_scm_io_writel(addr, val);
+ if (ret) + if (ret)
+ pr_err("\n Routing interrupts to Apps proc failed"); + pr_err("\n Routing interrupts to Apps proc failed");
+ } + }
@ -157,27 +69,3 @@ Signed-off-by: Ajay Kishore <akisho@codeaurora.org>
/* Update configuration for gpio. /* Update configuration for gpio.
* RAW_STATUS_EN is left on for all gpio irqs. Due to the * RAW_STATUS_EN is left on for all gpio irqs. Due to the
@@ -975,4 +998,3 @@ int msm_pinctrl_remove(struct platform_d
return 0;
}
EXPORT_SYMBOL(msm_pinctrl_remove);
-
--- a/include/linux/qcom_scm.h
+++ b/include/linux/qcom_scm.h
@@ -43,6 +43,8 @@ extern int qcom_scm_set_remote_state(u32
extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);
extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size);
extern int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare);
+extern s32 qcom_scm_pinmux_read(u32 arg1);
+extern s32 qcom_scm_pinmux_write(u32 arg1, u32 arg2);
#else
static inline
int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
@@ -73,5 +75,7 @@ qcom_scm_set_remote_state(u32 state,u32
static inline int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) { return -ENODEV; }
static inline int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size) { return -ENODEV; }
static inline int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) { return -ENODEV; }
+extern s32 qcom_scm_pinmux_read(u32 arg1) { return -ENODEV; }
+extern s32 qcom_scm_pinmux_write(u32 arg1, u32 arg2) { return -ENODEV; }
#endif
#endif

View File

@ -1,71 +0,0 @@
From a86bda9f8a7965f0cedd347a9c04800eb9f41ea3 Mon Sep 17 00:00:00 2001
From: Vasudevan Murugesan <vmuruges@codeaurora.org>
Date: Tue, 21 Jul 2015 10:22:38 +0530
Subject: ipq806x: usb: Control USB master reset
During removal of the glue layer(dwc3-of-simple),
USB master reset is set to active and during insertion
it is de-activated.
Change-Id: I537dc810f6cb2a46664ee674840145066432b957
Signed-off-by: Vasudevan Murugesan <vmuruges@codeaurora.org>
(cherry picked from commit 4611e13580a216812f85f0801b95442d02eeb836)
---
drivers/usb/dwc3/dwc3-of-simple.c | 22 ++++++++++++++++++++++
1 file changed, 12 insertions(+)
(limited to 'drivers/usb/dwc3/dwc3-of-simple.c')
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -25,6 +25,7 @@
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
+#include <linux/reset.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
@@ -33,6 +34,8 @@ struct dwc3_of_simple {
struct device *dev;
struct clk **clks;
int num_clocks;
+ struct reset_control *mstr_rst_30_0;
+ struct reset_control *mstr_rst_30_1;
};
static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count)
@@ -102,6 +105,20 @@ static int dwc3_of_simple_probe(struct p
if (ret)
return ret;
+ simple->mstr_rst_30_0 = devm_reset_control_get(dev, "usb30_0_mstr_rst");
+
+ if (!IS_ERR(simple->mstr_rst_30_0))
+ reset_control_deassert(simple->mstr_rst_30_0);
+ else
+ dev_dbg(simple->dev, "cannot get handle for USB PHY 0 master reset control\n");
+
+ simple->mstr_rst_30_1 = devm_reset_control_get(dev, "usb30_1_mstr_rst");
+
+ if (!IS_ERR(simple->mstr_rst_30_1))
+ reset_control_deassert(simple->mstr_rst_30_1);
+ else
+ dev_dbg(simple->dev, "cannot get handle for USB PHY 1 master reset control\n");
+
ret = of_platform_populate(np, NULL, NULL, dev);
if (ret) {
for (i = 0; i < simple->num_clocks; i++) {
@@ -130,6 +147,12 @@ static int dwc3_of_simple_remove(struct
clk_put(simple->clks[i]);
}
+ if (!IS_ERR(simple->mstr_rst_30_0))
+ reset_control_assert(simple->mstr_rst_30_0);
+
+ if (!IS_ERR(simple->mstr_rst_30_1))
+ reset_control_assert(simple->mstr_rst_30_1);
+
of_platform_depopulate(dev);
pm_runtime_disable(dev);

View File

@ -0,0 +1,70 @@
From patchwork Mon May 21 20:57:38 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v5,3/4] ARM: dts: qcom: add gpio-ranges property
X-Patchwork-Submitter: Christian Lamparter <chunkeey@gmail.com>
X-Patchwork-Id: 917856
Message-Id: <0ae3376606a89bcdf3fe753a5c967f7103699e09.1526935804.git.chunkeey@gmail.com>
To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
Stephen Boyd <sboyd@kernel.org>, David Brown <david.brown@linaro.org>,
Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,
Andy Gross <andy.gross@linaro.org>,
Sven Eckelmann <sven.eckelmann@openmesh.com>
Date: Mon, 21 May 2018 22:57:38 +0200
From: Christian Lamparter <chunkeey@gmail.com>
List-Id: <linux-gpio.vger.kernel.org>
This patch adds the gpio-ranges property to almost all of
the Qualcomm ARM platforms that utilize the pinctrl-msm
framework.
The gpio-ranges property is part of the gpiolib subsystem.
As a result, the binding text is available in section
"2.1 gpio- and pin-controller interaction" of
Documentation/devicetree/bindings/gpio/gpio.txt
For more information please see the patch titled:
"pinctrl: msm: fix gpio-hog related boot issues" from
this series.
Reported-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Tested-by: Sven Eckelmann <sven.eckelmann@openmesh.com> [ipq4019]
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
To help with git bisect, the DT update patch has been intentionally
placed after the "pinctrl: msm: fix gpio-hog related boot issues".
Otherwise - if the order was reveresed - and bisect decides to split
between these two patches, the gpiochip_add_pin_ranges() function
will be executed twice with the same parameters for the same pinctrl.
---
arch/arm/boot/dts/qcom-apq8064.dtsi | 1 +
arch/arm/boot/dts/qcom-apq8084.dtsi | 1 +
arch/arm/boot/dts/qcom-ipq4019.dtsi | 1 +
arch/arm/boot/dts/qcom-ipq8064.dtsi | 1 +
arch/arm/boot/dts/qcom-mdm9615.dtsi | 1 +
arch/arm/boot/dts/qcom-msm8660.dtsi | 1 +
arch/arm/boot/dts/qcom-msm8960.dtsi | 1 +
arch/arm/boot/dts/qcom-msm8974.dtsi | 1 +
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 3 ++-
arch/arm64/boot/dts/qcom/msm8916.dtsi | 1 +
arch/arm64/boot/dts/qcom/msm8992.dtsi | 1 +
arch/arm64/boot/dts/qcom/msm8994.dtsi | 1 +
arch/arm64/boot/dts/qcom/msm8996.dtsi | 1 +
13 files changed, 14 insertions(+), 1 deletion(-)
--- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
@@ -653,6 +653,7 @@
reg = <0x800000 0x4000>;
gpio-controller;
+ gpio-ranges = <&qcom_pinmux 0 0 69>;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;

View File

@ -1,22 +0,0 @@
Subject: mtd: spi-nor: add mx25l25635f with SECT_4K
This patch fixes an issue with the creation of the
ubi volume on the AVM FRITZ!Box 4040. The mx25l25635f
and mx25l25635e support SECT_4K which will set the
erase size to 4K. This is used by ubi to calculate
VID header offsets. Without this, uboot and linux
disagrees about the layout and refuse to attach
the ubi volume created by the other.
---
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1031,7 +1031,7 @@ static const struct flash_info spi_nor_i
{ "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) },
{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
- { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+ { "mx25l25635f", INFO(0xc22019, 0, 64 * 1024, 512, SECT_4K) },
{ "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) },
{ "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
{ "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },

View File

@ -2,14 +2,17 @@ From: Christian Lamparter <chunkeey@googlemail.com>
Subject: SoC: add qualcomm syscon Subject: SoC: add qualcomm syscon
--- a/drivers/soc/qcom/Makefile --- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_QCOM_SMEM_STATE) += smem_st @@ -18,6 +18,7 @@ obj-$(CONFIG_QCOM_SMEM_STATE) += smem_st
obj-$(CONFIG_QCOM_SMP2P) += smp2p.o obj-$(CONFIG_QCOM_SMP2P) += smp2p.o
obj-$(CONFIG_QCOM_SMSM) += smsm.o obj-$(CONFIG_QCOM_SMSM) += smsm.o
obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o
+obj-$(CONFIG_QCOM_TCSR) += qcom_tcsr.o +obj-$(CONFIG_QCOM_TCSR) += qcom_tcsr.o
obj-$(CONFIG_QCOM_APR) += apr.o
obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o
obj-$(CONFIG_QCOM_SDM845_LLCC) += llcc-sdm845.o
--- a/drivers/soc/qcom/Kconfig --- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig
@@ -78,6 +78,13 @@ config QCOM_SMSM @@ -146,6 +146,13 @@ config QCOM_SMSM
Say yes here to support the Qualcomm Shared Memory State Machine. Say yes here to support the Qualcomm Shared Memory State Machine.
The state machine is represented by bits in shared memory. The state machine is represented by bits in shared memory.
@ -25,7 +28,7 @@ Subject: SoC: add qualcomm syscon
depends on ARCH_QCOM depends on ARCH_QCOM
--- /dev/null --- /dev/null
+++ b/drivers/soc/qcom/qcom_tcsr.c +++ b/drivers/soc/qcom/qcom_tcsr.c
@@ -0,0 +1,98 @@ @@ -0,0 +1,64 @@
+/* +/*
+ * Copyright (c) 2014, The Linux foundation. All rights reserved. + * Copyright (c) 2014, The Linux foundation. All rights reserved.
+ * + *
@ -48,14 +51,6 @@ Subject: SoC: add qualcomm syscon
+#include <linux/platform_device.h> +#include <linux/platform_device.h>
+ +
+#define TCSR_USB_PORT_SEL 0xb0 +#define TCSR_USB_PORT_SEL 0xb0
+#define TCSR_USB_HSPHY_CONFIG 0xC
+
+#define TCSR_ESS_INTERFACE_SEL_OFFSET 0x0
+#define TCSR_ESS_INTERFACE_SEL_MASK 0xf
+
+#define TCSR_WIFI0_GLB_CFG_OFFSET 0x0
+#define TCSR_WIFI1_GLB_CFG_OFFSET 0x4
+#define TCSR_PNOC_SNOC_MEMTYPE_M0_M2 0x4
+ +
+static int tcsr_probe(struct platform_device *pdev) +static int tcsr_probe(struct platform_device *pdev)
+{ +{
@ -74,32 +69,6 @@ Subject: SoC: add qualcomm syscon
+ writel(val, base + TCSR_USB_PORT_SEL); + writel(val, base + TCSR_USB_PORT_SEL);
+ } + }
+ +
+ if (!of_property_read_u32(node, "qcom,usb-hsphy-mode-select", &val)) {
+ dev_info(&pdev->dev, "setting usb hs phy mode select = %x\n", val);
+ writel(val, base + TCSR_USB_HSPHY_CONFIG);
+ }
+
+ if (!of_property_read_u32(node, "qcom,ess-interface-select", &val)) {
+ u32 tmp = 0;
+ dev_info(&pdev->dev, "setting ess interface select = %x\n", val);
+ tmp = readl(base + TCSR_ESS_INTERFACE_SEL_OFFSET);
+ tmp = tmp & (~TCSR_ESS_INTERFACE_SEL_MASK);
+ tmp = tmp | (val&TCSR_ESS_INTERFACE_SEL_MASK);
+ writel(tmp, base + TCSR_ESS_INTERFACE_SEL_OFFSET);
+ }
+
+ if (!of_property_read_u32(node, "qcom,wifi_glb_cfg", &val)) {
+ dev_info(&pdev->dev, "setting wifi_glb_cfg = %x\n", val);
+ writel(val, base + TCSR_WIFI0_GLB_CFG_OFFSET);
+ writel(val, base + TCSR_WIFI1_GLB_CFG_OFFSET);
+ }
+
+ if (!of_property_read_u32(node, "qcom,wifi_noc_memtype_m0_m2", &val)) {
+ dev_info(&pdev->dev,
+ "setting wifi_noc_memtype_m0_m2 = %x\n", val);
+ writel(val, base + TCSR_PNOC_SNOC_MEMTYPE_M0_M2);
+ }
+
+ return 0; + return 0;
+} +}
+ +
@ -126,7 +95,7 @@ Subject: SoC: add qualcomm syscon
+MODULE_LICENSE("GPL v2"); +MODULE_LICENSE("GPL v2");
--- /dev/null --- /dev/null
+++ b/include/dt-bindings/soc/qcom,tcsr.h +++ b/include/dt-bindings/soc/qcom,tcsr.h
@@ -0,0 +1,48 @@ @@ -0,0 +1,23 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * + *
+ * This program is free software; you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify
@ -145,31 +114,6 @@ Subject: SoC: add qualcomm syscon
+#define TCSR_USB_SELECT_USB3_P1 0x2 +#define TCSR_USB_SELECT_USB3_P1 0x2
+#define TCSR_USB_SELECT_USB3_DUAL 0x3 +#define TCSR_USB_SELECT_USB3_DUAL 0x3
+ +
+/* IPQ40xx HS PHY Mode Select */
+#define TCSR_USB_HSPHY_HOST_MODE 0x00E700E7
+#define TCSR_USB_HSPHY_DEVICE_MODE 0x00C700E7
+
+/* IPQ40xx ess interface mode select */
+#define TCSR_ESS_PSGMII 0
+#define TCSR_ESS_PSGMII_RGMII5 1
+#define TCSR_ESS_PSGMII_RMII0 2
+#define TCSR_ESS_PSGMII_RMII1 4
+#define TCSR_ESS_PSGMII_RMII0_RMII1 6
+#define TCSR_ESS_PSGMII_RGMII4 9
+
+/*
+ * IPQ40xx WiFi Global Config
+ * Bit 30:AXID_EN
+ * Enable AXI master bus Axid translating to confirm all txn submitted by order
+ * Bit 24: Use locally generated socslv_wxi_bvalid
+ * 1: use locally generate socslv_wxi_bvalid for performance.
+ * 0: use SNOC socslv_wxi_bvalid.
+ */
+#define TCSR_WIFI_GLB_CFG 0x41000000
+
+/* IPQ40xx MEM_TYPE_SEL_M0_M2 Select Bit 26:24 - 2 NORMAL */
+#define TCSR_WIFI_NOC_MEMTYPE_M0_M2 0x02222222
+
+/* TCSR A/B REG */ +/* TCSR A/B REG */
+#define IPQ806X_TCSR_REG_A_ADM_CRCI_MUX_SEL 0 +#define IPQ806X_TCSR_REG_A_ADM_CRCI_MUX_SEL 0
+#define IPQ806X_TCSR_REG_B_ADM_CRCI_MUX_SEL 1 +#define IPQ806X_TCSR_REG_B_ADM_CRCI_MUX_SEL 1