mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
fix
This commit is contained in:
parent
3c27c8d9a1
commit
cf93e96503
8 changed files with 0 additions and 811 deletions
|
@ -1,36 +0,0 @@
|
|||
From 89b43d59ec8c9cda588555eb1f2754dd19ef5144 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sun, 22 Jul 2018 12:07:57 +0200
|
||||
Subject: [PATCH 8/8] ARM: qcom: Add IPQ4019 SoC support
|
||||
|
||||
Add support for the Qualcomm Atheros IPQ4019 SoC.
|
||||
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
arch/arm/Makefile | 1 +
|
||||
arch/arm/mach-qcom/Kconfig | 5 +++++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
--- a/arch/arm/Makefile
|
||||
+++ b/arch/arm/Makefile
|
||||
@@ -156,6 +156,7 @@ textofs-$(CONFIG_ARCH_MSM8X60) := 0x0020
|
||||
textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
|
||||
textofs-$(CONFIG_ARCH_MESON) := 0x00208000
|
||||
textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
|
||||
+textofs-$(CONFIG_ARCH_IPQ40XX) := 0x00208000
|
||||
|
||||
# Machine directory name. This list is sorted alphanumerically
|
||||
# by CONFIG_* macro name.
|
||||
--- a/arch/arm/mach-qcom/Kconfig
|
||||
+++ b/arch/arm/mach-qcom/Kconfig
|
||||
@@ -28,4 +28,9 @@ config ARCH_MDM9615
|
||||
bool "Enable support for MDM9615"
|
||||
select CLKSRC_QCOM
|
||||
|
||||
+config ARCH_IPQ40XX
|
||||
+ bool "Enable support for IPQ40XX"
|
||||
+ select CLKSRC_QCOM
|
||||
+ select HAVE_ARM_ARCH_TIMER
|
||||
+
|
||||
endif
|
|
@ -1,123 +0,0 @@
|
|||
From 1fc7d5523e21ed140fed43c4dde011a3b6d9ba08 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Tue, 24 Jul 2018 14:47:55 +0200
|
||||
Subject: [PATCH 3/3] qcom: ipq4019: add USB devicetree nodes
|
||||
|
||||
This patch makes USB work on the Dakota EVB.
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi | 20 ++++++++
|
||||
arch/arm/boot/dts/qcom-ipq4019.dtsi | 74 +++++++++++++++++++++++++++
|
||||
2 files changed, 94 insertions(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
|
||||
+++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
|
||||
@@ -109,5 +109,25 @@
|
||||
wifi@a800000 {
|
||||
status = "ok";
|
||||
};
|
||||
+
|
||||
+ usb3_ss_phy: ssphy@9a000 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ usb3_hs_phy: hsphy@a6000 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ usb3: usb3@8af8800 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ usb2_hs_phy: hsphy@a8000 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ usb2: usb2@60f8800 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
};
|
||||
};
|
||||
--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
@@ -563,5 +563,79 @@
|
||||
"legacy";
|
||||
status = "disabled";
|
||||
};
|
||||
+
|
||||
+ usb3_ss_phy: ssphy@9a000 {
|
||||
+ compatible = "qcom,usb-ss-ipq4019-phy";
|
||||
+ #phy-cells = <0>;
|
||||
+ reg = <0x9a000 0x800>;
|
||||
+ reg-names = "phy_base";
|
||||
+ resets = <&gcc USB3_UNIPHY_PHY_ARES>;
|
||||
+ reset-names = "por_rst";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ usb3_hs_phy: hsphy@a6000 {
|
||||
+ compatible = "qcom,usb-hs-ipq4019-phy";
|
||||
+ #phy-cells = <0>;
|
||||
+ reg = <0xa6000 0x40>;
|
||||
+ reg-names = "phy_base";
|
||||
+ resets = <&gcc USB3_HSPHY_POR_ARES>, <&gcc USB3_HSPHY_S_ARES>;
|
||||
+ reset-names = "por_rst", "srif_rst";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ usb3@8af8800 {
|
||||
+ compatible = "qcom,dwc3";
|
||||
+ reg = <0x8af8800 0x100>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ clocks = <&gcc GCC_USB3_MASTER_CLK>,
|
||||
+ <&gcc GCC_USB3_SLEEP_CLK>,
|
||||
+ <&gcc GCC_USB3_MOCK_UTMI_CLK>;
|
||||
+ clock-names = "master", "sleep", "mock_utmi";
|
||||
+ ranges;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ dwc3@8a00000 {
|
||||
+ compatible = "snps,dwc3";
|
||||
+ reg = <0x8a00000 0xf8000>;
|
||||
+ interrupts = <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ phys = <&usb3_hs_phy>, <&usb3_ss_phy>;
|
||||
+ phy-names = "usb2-phy", "usb3-phy";
|
||||
+ dr_mode = "host";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ usb2_hs_phy: hsphy@a8000 {
|
||||
+ compatible = "qcom,usb-hs-ipq4019-phy";
|
||||
+ #phy-cells = <0>;
|
||||
+ reg = <0xa8000 0x40>;
|
||||
+ reg-names = "phy_base";
|
||||
+ resets = <&gcc USB2_HSPHY_POR_ARES>, <&gcc USB2_HSPHY_S_ARES>;
|
||||
+ reset-names = "por_rst", "srif_rst";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ usb2@60f8800 {
|
||||
+ compatible = "qcom,dwc3";
|
||||
+ reg = <0x60f8800 0x100>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ clocks = <&gcc GCC_USB2_MASTER_CLK>,
|
||||
+ <&gcc GCC_USB2_SLEEP_CLK>,
|
||||
+ <&gcc GCC_USB2_MOCK_UTMI_CLK>;
|
||||
+ clock-names = "master", "sleep", "mock_utmi";
|
||||
+ ranges;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ dwc3@6000000 {
|
||||
+ compatible = "snps,dwc3";
|
||||
+ reg = <0x6000000 0xf8000>;
|
||||
+ interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ phys = <&usb2_hs_phy>;
|
||||
+ phy-names = "usb2-phy";
|
||||
+ dr_mode = "host";
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
};
|
|
@ -1,115 +0,0 @@
|
|||
From f2b87dc1028b710ec8ce25808b9d21f92b376184 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@googlemail.com>
|
||||
Date: Sun, 11 Mar 2018 14:41:31 +0100
|
||||
Subject: [PATCH 2/2] clk: fix apss cpu overclocking
|
||||
|
||||
There's an interaction issue between the clk changes:"
|
||||
clk: qcom: ipq4019: Add the apss cpu pll divider clock node
|
||||
clk: qcom: ipq4019: remove fixed clocks and add pll clocks
|
||||
" and the cpufreq-dt.
|
||||
|
||||
cpufreq-dt is now spamming the kernel-log with the following:
|
||||
|
||||
[ 1099.190658] cpu cpu0: dev_pm_opp_set_rate: failed to find current OPP
|
||||
for freq 761142857 (-34)
|
||||
|
||||
This only happens on certain devices like the Compex WPJ428
|
||||
and AVM FritzBox!4040. However, other devices like the Asus
|
||||
RT-AC58U and Meraki MR33 work just fine.
|
||||
|
||||
The issue stem from the fact that all higher CPU-Clocks
|
||||
are achieved by switching the clock-parent to the P_DDRPLLAPSS
|
||||
(ddrpllapss). Which is set by Qualcomm's proprietary bootcode
|
||||
as part of the DDR calibration.
|
||||
|
||||
For example, the FB4040 uses 256 MiB Nanya NT5CC128M16IP clocked
|
||||
at round 533 MHz (ddrpllsdcc = 190285714 Hz).
|
||||
|
||||
whereas the 128 MiB Nanya NT5CC64M16GP-DI in the ASUS RT-AC58U is
|
||||
clocked at a slightly higher 537 MHz ( ddrpllsdcc = 192000000 Hz).
|
||||
|
||||
This patch attempts to fix the issue by modifying
|
||||
clk_cpu_div_round_rate(), clk_cpu_div_set_rate(), clk_cpu_div_recalc_rate()
|
||||
to use a new qcom_find_freq_close() function, which returns the closest
|
||||
matching frequency, instead of the next higher. This way, the SoC in
|
||||
the FB4040 (with its max clock speed of 710.4 MHz) will no longer
|
||||
try to overclock to 761 MHz.
|
||||
|
||||
Fixes: d83dcacea18 ("clk: qcom: ipq4019: Add the apss cpu pll divider clock node")
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
drivers/clk/qcom/gcc-ipq4019.c | 34 +++++++++++++++++++++++++++++++---
|
||||
1 file changed, 31 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/clk/qcom/gcc-ipq4019.c
|
||||
+++ b/drivers/clk/qcom/gcc-ipq4019.c
|
||||
@@ -1243,6 +1243,29 @@ static const struct clk_fepll_vco gcc_fe
|
||||
.reg = 0x2f020,
|
||||
};
|
||||
|
||||
+
|
||||
+const struct freq_tbl *qcom_find_freq_close(const struct freq_tbl *f,
|
||||
+ unsigned long rate)
|
||||
+{
|
||||
+ const struct freq_tbl *last = NULL;
|
||||
+
|
||||
+ for ( ; f->freq; f++) {
|
||||
+ if (rate == f->freq)
|
||||
+ return f;
|
||||
+
|
||||
+ if (f->freq > rate) {
|
||||
+ if (!last ||
|
||||
+ (f->freq - rate) < (rate - last->freq))
|
||||
+ return f;
|
||||
+ else
|
||||
+ return last;
|
||||
+ }
|
||||
+ last = f;
|
||||
+ }
|
||||
+
|
||||
+ return last;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Round rate function for APSS CPU PLL Clock divider.
|
||||
* It looks up the frequency table and returns the next higher frequency
|
||||
@@ -1255,7 +1278,7 @@ static long clk_cpu_div_round_rate(struc
|
||||
struct clk_hw *p_hw;
|
||||
const struct freq_tbl *f;
|
||||
|
||||
- f = qcom_find_freq(pll->freq_tbl, rate);
|
||||
+ f = qcom_find_freq_close(pll->freq_tbl, rate);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1278,7 +1301,7 @@ static int clk_cpu_div_set_rate(struct c
|
||||
u32 mask;
|
||||
int ret;
|
||||
|
||||
- f = qcom_find_freq(pll->freq_tbl, rate);
|
||||
+ f = qcom_find_freq_close(pll->freq_tbl, rate);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1305,6 +1328,7 @@ static unsigned long
|
||||
clk_cpu_div_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
+ const struct freq_tbl *f;
|
||||
struct clk_fepll *pll = to_clk_fepll(hw);
|
||||
u32 cdiv, pre_div;
|
||||
u64 rate;
|
||||
@@ -1325,7 +1349,11 @@ clk_cpu_div_recalc_rate(struct clk_hw *h
|
||||
rate = clk_fepll_vco_calc_rate(pll, parent_rate) * 2;
|
||||
do_div(rate, pre_div);
|
||||
|
||||
- return rate;
|
||||
+ f = qcom_find_freq_close(pll->freq_tbl, rate);
|
||||
+ if (!f)
|
||||
+ return rate;
|
||||
+
|
||||
+ return f->freq;
|
||||
};
|
||||
|
||||
static const struct clk_ops clk_regmap_cpu_div_ops = {
|
|
@ -1,165 +0,0 @@
|
|||
From 4267880319bc1a2270d352e0ded6d6386242a7ef Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Tue, 12 Aug 2014 20:49:27 +0200
|
||||
Subject: [PATCH 24/53] GPIO: add named gpio exports
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/gpio/gpiolib-of.c | 68 +++++++++++++++++++++++++++++++++++++++++
|
||||
drivers/gpio/gpiolib-sysfs.c | 10 +++++-
|
||||
include/asm-generic/gpio.h | 6 ++++
|
||||
include/linux/gpio/consumer.h | 8 +++++
|
||||
4 files changed, 91 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/gpio/gpiolib-of.c
|
||||
+++ b/drivers/gpio/gpiolib-of.c
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <linux/pinctrl/pinctrl.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/gpio/machine.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/platform_device.h>
|
||||
|
||||
#include "gpiolib.h"
|
||||
#include "gpiolib-of.h"
|
||||
@@ -915,3 +917,68 @@ void of_gpiochip_remove(struct gpio_chip
|
||||
{
|
||||
of_node_put(chip->of_node);
|
||||
}
|
||||
+
|
||||
+static struct of_device_id gpio_export_ids[] = {
|
||||
+ { .compatible = "gpio-export" },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+
|
||||
+static int of_gpio_export_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node;
|
||||
+ struct device_node *cnp;
|
||||
+ u32 val;
|
||||
+ int nb = 0;
|
||||
+
|
||||
+ for_each_child_of_node(np, cnp) {
|
||||
+ const char *name = NULL;
|
||||
+ int gpio;
|
||||
+ bool dmc;
|
||||
+ int max_gpio = 1;
|
||||
+ int i;
|
||||
+
|
||||
+ of_property_read_string(cnp, "gpio-export,name", &name);
|
||||
+
|
||||
+ if (!name)
|
||||
+ max_gpio = of_gpio_count(cnp);
|
||||
+
|
||||
+ for (i = 0; i < max_gpio; i++) {
|
||||
+ unsigned flags = 0;
|
||||
+ enum of_gpio_flags of_flags;
|
||||
+
|
||||
+ gpio = of_get_gpio_flags(cnp, i, &of_flags);
|
||||
+ if (!gpio_is_valid(gpio))
|
||||
+ return gpio;
|
||||
+
|
||||
+ if (of_flags == OF_GPIO_ACTIVE_LOW)
|
||||
+ flags |= GPIOF_ACTIVE_LOW;
|
||||
+
|
||||
+ if (!of_property_read_u32(cnp, "gpio-export,output", &val))
|
||||
+ flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
|
||||
+ else
|
||||
+ flags |= GPIOF_IN;
|
||||
+
|
||||
+ if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np)))
|
||||
+ continue;
|
||||
+
|
||||
+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change");
|
||||
+ gpio_export_with_name(gpio, dmc, name);
|
||||
+ nb++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ dev_info(&pdev->dev, "%d gpio(s) exported\n", nb);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver gpio_export_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "gpio-export",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = of_match_ptr(gpio_export_ids),
|
||||
+ },
|
||||
+ .probe = of_gpio_export_probe,
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(gpio_export_driver);
|
||||
--- a/drivers/gpio/gpiolib-sysfs.c
|
||||
+++ b/drivers/gpio/gpiolib-sysfs.c
|
||||
@@ -563,7 +563,7 @@ static struct class gpio_class = {
|
||||
*
|
||||
* Returns zero on success, else an error.
|
||||
*/
|
||||
-int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
|
||||
+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name)
|
||||
{
|
||||
struct gpio_chip *chip;
|
||||
struct gpio_device *gdev;
|
||||
@@ -625,6 +625,8 @@ int gpiod_export(struct gpio_desc *desc,
|
||||
offset = gpio_chip_hwgpio(desc);
|
||||
if (chip->names && chip->names[offset])
|
||||
ioname = chip->names[offset];
|
||||
+ if (name)
|
||||
+ ioname = name;
|
||||
|
||||
dev = device_create_with_groups(&gpio_class, &gdev->dev,
|
||||
MKDEV(0, 0), data, gpio_groups,
|
||||
@@ -646,6 +648,12 @@ err_unlock:
|
||||
gpiod_dbg(desc, "%s: status %d\n", __func__, status);
|
||||
return status;
|
||||
}
|
||||
+EXPORT_SYMBOL_GPL(__gpiod_export);
|
||||
+
|
||||
+int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
|
||||
+{
|
||||
+ return __gpiod_export(desc, direction_may_change, NULL);
|
||||
+}
|
||||
EXPORT_SYMBOL_GPL(gpiod_export);
|
||||
|
||||
static int match_export(struct device *dev, const void *desc)
|
||||
--- a/include/asm-generic/gpio.h
|
||||
+++ b/include/asm-generic/gpio.h
|
||||
@@ -127,6 +127,12 @@ static inline int gpio_export(unsigned g
|
||||
return gpiod_export(gpio_to_desc(gpio), direction_may_change);
|
||||
}
|
||||
|
||||
+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
|
||||
+static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name)
|
||||
+{
|
||||
+ return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name);
|
||||
+}
|
||||
+
|
||||
static inline int gpio_export_link(struct device *dev, const char *name,
|
||||
unsigned gpio)
|
||||
{
|
||||
--- a/include/linux/gpio/consumer.h
|
||||
+++ b/include/linux/gpio/consumer.h
|
||||
@@ -668,6 +668,7 @@ static inline void devm_acpi_dev_remove_
|
||||
|
||||
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
|
||||
|
||||
+int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
|
||||
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
|
||||
int gpiod_export_link(struct device *dev, const char *name,
|
||||
struct gpio_desc *desc);
|
||||
@@ -675,6 +676,13 @@ void gpiod_unexport(struct gpio_desc *de
|
||||
|
||||
#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
|
||||
|
||||
+static inline int _gpiod_export(struct gpio_desc *desc,
|
||||
+ bool direction_may_change,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ return -ENOSYS;
|
||||
+}
|
||||
+
|
||||
static inline int gpiod_export(struct gpio_desc *desc,
|
||||
bool direction_may_change)
|
||||
{
|
|
@ -1,26 +0,0 @@
|
|||
From 158acdbf0336f601971637f988b57a6a67a0869b Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Sun, 15 Dec 2019 13:10:50 +0100
|
||||
Subject: [PATCH] mtd: spi-nor: Add support for mx25r3235f
|
||||
|
||||
Add MTD support for the Macronix MX25R3235F SPI NOR chip from Macronix.
|
||||
The chip has 4MB of total capacity, divided into a total of 64 sectors,
|
||||
each 64KB sized. The chip also supports 4KB large sectors.
|
||||
Additionally, it supports dual and quad read modes.
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
drivers/mtd/spi-nor/spi-nor.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/spi-nor/spi-nor.c
|
||||
+++ b/drivers/mtd/spi-nor/spi-nor.c
|
||||
@@ -2344,6 +2344,8 @@ 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) },
|
||||
+ { "mx25r3235f", INFO(0xc22816, 0, 64 * 1024, 64,
|
||||
+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
{ "mx25u12835f", INFO(0xc22538, 0, 64 * 1024, 256,
|
||||
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
{ "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512,
|
|
@ -1,225 +0,0 @@
|
|||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -581,6 +581,13 @@ config XILINX_GMII2RGMII
|
||||
the Reduced Gigabit Media Independent Interface(RGMII) between
|
||||
Ethernet physical media devices and the Gigabit Ethernet controller.
|
||||
|
||||
+config MDIO_IPQ40XX
|
||||
+ tristate "Qualcomm Atheros ipq40xx MDIO interface"
|
||||
+ depends on HAS_IOMEM && OF
|
||||
+ ---help---
|
||||
+ This driver supports the MDIO interface found in Qualcomm
|
||||
+ Atheros ipq40xx Soc chip.
|
||||
+
|
||||
endif # PHYLIB
|
||||
|
||||
config MICREL_KS8995MA
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -51,6 +51,7 @@ obj-$(CONFIG_MDIO_CAVIUM) += mdio-cavium
|
||||
obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o
|
||||
obj-$(CONFIG_MDIO_HISI_FEMAC) += mdio-hisi-femac.o
|
||||
obj-$(CONFIG_MDIO_I2C) += mdio-i2c.o
|
||||
+obj-$(CONFIG_MDIO_IPQ40XX) += mdio-ipq40xx.o
|
||||
obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o
|
||||
obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-mscc-miim.o
|
||||
obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/phy/mdio-ipq40xx.c
|
||||
@@ -0,0 +1,196 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
|
||||
+ *
|
||||
+ * Permission to use, copy, modify, and/or distribute this software for
|
||||
+ * any purpose with or without fee is hereby granted, provided that the
|
||||
+ * above copyright notice and this permission notice appear in all copies.
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/mutex.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/of_address.h>
|
||||
+#include <linux/of_mdio.h>
|
||||
+#include <linux/phy.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#define MDIO_CTRL_0_REG 0x40
|
||||
+#define MDIO_CTRL_1_REG 0x44
|
||||
+#define MDIO_CTRL_2_REG 0x48
|
||||
+#define MDIO_CTRL_3_REG 0x4c
|
||||
+#define MDIO_CTRL_4_REG 0x50
|
||||
+#define MDIO_CTRL_4_ACCESS_BUSY BIT(16)
|
||||
+#define MDIO_CTRL_4_ACCESS_START BIT(8)
|
||||
+#define MDIO_CTRL_4_ACCESS_CODE_READ 0
|
||||
+#define MDIO_CTRL_4_ACCESS_CODE_WRITE 1
|
||||
+#define CTRL_0_REG_DEFAULT_VALUE 0x150FF
|
||||
+
|
||||
+#define IPQ40XX_MDIO_RETRY 1000
|
||||
+#define IPQ40XX_MDIO_DELAY 10
|
||||
+
|
||||
+struct ipq40xx_mdio_data {
|
||||
+ struct mii_bus *mii_bus;
|
||||
+ void __iomem *membase;
|
||||
+ struct device *dev;
|
||||
+};
|
||||
+
|
||||
+static int ipq40xx_mdio_wait_busy(struct ipq40xx_mdio_data *am)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < IPQ40XX_MDIO_RETRY; i++) {
|
||||
+ unsigned int busy;
|
||||
+
|
||||
+ busy = readl(am->membase + MDIO_CTRL_4_REG) &
|
||||
+ MDIO_CTRL_4_ACCESS_BUSY;
|
||||
+ if (!busy)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* BUSY might take to be cleard by 15~20 times of loop */
|
||||
+ udelay(IPQ40XX_MDIO_DELAY);
|
||||
+ }
|
||||
+
|
||||
+ dev_err(am->dev, "%s: MDIO operation timed out\n", am->mii_bus->name);
|
||||
+
|
||||
+ return -ETIMEDOUT;
|
||||
+}
|
||||
+
|
||||
+static int ipq40xx_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
|
||||
+{
|
||||
+ struct ipq40xx_mdio_data *am = bus->priv;
|
||||
+ int value = 0;
|
||||
+ unsigned int cmd = 0;
|
||||
+
|
||||
+ lockdep_assert_held(&bus->mdio_lock);
|
||||
+
|
||||
+ if (ipq40xx_mdio_wait_busy(am))
|
||||
+ return -ETIMEDOUT;
|
||||
+
|
||||
+ /* issue the phy address and reg */
|
||||
+ writel((mii_id << 8) | regnum, am->membase + MDIO_CTRL_1_REG);
|
||||
+
|
||||
+ cmd = MDIO_CTRL_4_ACCESS_START|MDIO_CTRL_4_ACCESS_CODE_READ;
|
||||
+
|
||||
+ /* issue read command */
|
||||
+ writel(cmd, am->membase + MDIO_CTRL_4_REG);
|
||||
+
|
||||
+ /* Wait read complete */
|
||||
+ if (ipq40xx_mdio_wait_busy(am))
|
||||
+ return -ETIMEDOUT;
|
||||
+
|
||||
+ /* Read data */
|
||||
+ value = readl(am->membase + MDIO_CTRL_3_REG);
|
||||
+
|
||||
+ return value;
|
||||
+}
|
||||
+
|
||||
+static int ipq40xx_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
|
||||
+ u16 value)
|
||||
+{
|
||||
+ struct ipq40xx_mdio_data *am = bus->priv;
|
||||
+ unsigned int cmd = 0;
|
||||
+
|
||||
+ lockdep_assert_held(&bus->mdio_lock);
|
||||
+
|
||||
+ if (ipq40xx_mdio_wait_busy(am))
|
||||
+ return -ETIMEDOUT;
|
||||
+
|
||||
+ /* issue the phy address and reg */
|
||||
+ writel((mii_id << 8) | regnum, am->membase + MDIO_CTRL_1_REG);
|
||||
+
|
||||
+ /* issue write data */
|
||||
+ writel(value, am->membase + MDIO_CTRL_2_REG);
|
||||
+
|
||||
+ cmd = MDIO_CTRL_4_ACCESS_START|MDIO_CTRL_4_ACCESS_CODE_WRITE;
|
||||
+ /* issue write command */
|
||||
+ writel(cmd, am->membase + MDIO_CTRL_4_REG);
|
||||
+
|
||||
+ /* Wait write complete */
|
||||
+ if (ipq40xx_mdio_wait_busy(am))
|
||||
+ return -ETIMEDOUT;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ipq40xx_mdio_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct ipq40xx_mdio_data *am;
|
||||
+ struct resource *res;
|
||||
+ int i;
|
||||
+
|
||||
+ am = devm_kzalloc(&pdev->dev, sizeof(*am), GFP_KERNEL);
|
||||
+ if (!am)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (!res) {
|
||||
+ dev_err(&pdev->dev, "no iomem resource found\n");
|
||||
+ return -ENXIO;
|
||||
+ }
|
||||
+
|
||||
+ am->membase = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(am->membase)) {
|
||||
+ dev_err(&pdev->dev, "unable to ioremap registers\n");
|
||||
+ return PTR_ERR(am->membase);
|
||||
+ }
|
||||
+
|
||||
+ am->mii_bus = devm_mdiobus_alloc(&pdev->dev);
|
||||
+ if (!am->mii_bus)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ writel(CTRL_0_REG_DEFAULT_VALUE, am->membase + MDIO_CTRL_0_REG);
|
||||
+
|
||||
+ am->mii_bus->name = "ipq40xx_mdio";
|
||||
+ am->mii_bus->read = ipq40xx_mdio_read;
|
||||
+ am->mii_bus->write = ipq40xx_mdio_write;
|
||||
+ am->mii_bus->priv = am;
|
||||
+ am->mii_bus->parent = &pdev->dev;
|
||||
+ snprintf(am->mii_bus->id, MII_BUS_ID_SIZE, "%s", dev_name(&pdev->dev));
|
||||
+
|
||||
+ am->dev = &pdev->dev;
|
||||
+ platform_set_drvdata(pdev, am);
|
||||
+
|
||||
+ return of_mdiobus_register(am->mii_bus, pdev->dev.of_node);
|
||||
+}
|
||||
+
|
||||
+static int ipq40xx_mdio_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct ipq40xx_mdio_data *am = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ mdiobus_unregister(am->mii_bus);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id ipq40xx_mdio_dt_ids[] = {
|
||||
+ { .compatible = "qcom,ipq4019-mdio" },
|
||||
+ { }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, ipq40xx_mdio_dt_ids);
|
||||
+
|
||||
+static struct platform_driver ipq40xx_mdio_driver = {
|
||||
+ .probe = ipq40xx_mdio_probe,
|
||||
+ .remove = ipq40xx_mdio_remove,
|
||||
+ .driver = {
|
||||
+ .name = "ipq40xx-mdio",
|
||||
+ .of_match_table = ipq40xx_mdio_dt_ids,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(ipq40xx_mdio_driver);
|
||||
+
|
||||
+#define DRV_VERSION "1.0"
|
||||
+
|
||||
+MODULE_DESCRIPTION("IPQ40XX MDIO interface driver");
|
||||
+MODULE_AUTHOR("Qualcomm Atheros");
|
||||
+MODULE_VERSION(DRV_VERSION);
|
||||
+MODULE_LICENSE("Dual BSD/GPL");
|
|
@ -1,52 +0,0 @@
|
|||
From 09ed737593f71bcca08a537a6c15264a1a6add08 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sun, 20 Nov 2016 01:10:33 +0100
|
||||
Subject: [PATCH] dts: ipq4019: add mdio node for ethernet
|
||||
|
||||
This patch adds the mdio device-tree node.
|
||||
This is where the switch is connected to, so it's needed
|
||||
for the ethernet interfaces.
|
||||
|
||||
Note: The driver isn't anywhere close to be upstream,
|
||||
so the info might change.
|
||||
---
|
||||
arch/arm/boot/dts/qcom-ipq4019.dtsi | 28 ++++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
@@ -588,6 +588,34 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ mdio: mdio@90000 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ compatible = "qcom,ipq4019-mdio";
|
||||
+ reg = <0x90000 0x64>;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ ethphy0: ethernet-phy@0 {
|
||||
+ reg = <0>;
|
||||
+ };
|
||||
+
|
||||
+ ethphy1: ethernet-phy@1 {
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+
|
||||
+ ethphy2: ethernet-phy@2 {
|
||||
+ reg = <2>;
|
||||
+ };
|
||||
+
|
||||
+ ethphy3: ethernet-phy@3 {
|
||||
+ reg = <3>;
|
||||
+ };
|
||||
+
|
||||
+ ethphy4: ethernet-phy@4 {
|
||||
+ reg = <4>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
usb3_ss_phy: ssphy@9a000 {
|
||||
compatible = "qcom,usb-ss-ipq4019-phy";
|
||||
#phy-cells = <0>;
|
|
@ -1,69 +0,0 @@
|
|||
From c611d3780fa101662a822d10acf8feb04ca97409 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Lamparter <chunkeey@gmail.com>
|
||||
Date: Sun, 20 Nov 2016 01:01:10 +0100
|
||||
Subject: [PATCH] dts: ipq4019: add ethernet ipqess node
|
||||
|
||||
This patch adds the device-tree node for the ipqess ethernet
|
||||
interfaces.
|
||||
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/qcom-ipq4019.dtsi | 60 +++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 60 insertions(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
@@ -699,6 +699,53 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ gmac: ethernet@c080000 {
|
||||
+ compatible = "qcom,ipq4019-ess-edma";
|
||||
+ reg = <0xc080000 0x8000>;
|
||||
+ interrupts = <GIC_SPI 65 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 66 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 67 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 68 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 69 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 70 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 71 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 72 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 73 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 74 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 75 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 76 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 77 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 78 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 79 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 80 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 240 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 241 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 242 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 243 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 244 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 245 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 246 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 247 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 248 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 249 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 250 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 251 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 252 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 253 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 254 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 255 IRQ_TYPE_EDGE_RISING>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ phy-mode = "internal";
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ pause;
|
||||
+ asym-pause;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
usb3_ss_phy: ssphy@9a000 {
|
||||
compatible = "qcom,usb-ss-ipq4019-phy";
|
||||
#phy-cells = <0>;
|
Loading…
Add table
Add a link
Reference in a new issue