1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-20 15:48:26 +02:00
openwrt/target/linux/lantiq/patches-5.10/0051-MIPS-lantiq-improve-USB-initialization.patch
Mathias Kresin 0806f8fc80 lantiq: add Linux 5.10 support as testing kernel
Following changes are made to the Lantiq kernel patches:

  0001-MIPS-lantiq-add-pcie-driver.patch
    The pci header isn't included by the of_pci header any longer

  0024-MIPS-lantiq-revert-DSA-switch-driver-PMU-clock-chang.patch
    Due to the merge of grx390 and ar10 clocks, extend support to grx390

  0025-NET-MIPS-lantiq-adds-xrx200-legacy.patch
    The do_carrier arguments was dropped from phy_link_change. The
    phylib has always sets the third parameter to true so the flag is
    always changed anyway.

    of_get_phy_mode() returns an error, or 0 on success, and pass a
    pointer, of type phy_interface_t, where the phy mode should be
    stored now. So far an error wasn't considered. Print at least an
    error message if something unexpected happens.

    The stuck queue is now passed to xrx200_tx_timeout (the timeout
    handler) but not used so far.

  0028-NET-lantiq-various-etop-fixes.patch
    ioremap has provided non-cached semantics by default since the Linux
    2.6 days and was removed with kernel version 5.6.

    of_get_phy_mode() returns an error, or 0 on success, and pass a
    pointer, of type phy_interface_t, where the phy mode should be
    stored now. So far an error wasn't considered. Print at least an
    error message if something unexpected happens.

  0042-arch-mips-increase-io_space_limit.patch
    Move IO space extension to laniq specific file

Signed-off-by: Mathias Kresin <dev@kresin.me>
2021-04-12 23:23:09 +02:00

50 lines
1.6 KiB
Diff

From 14909c4e4e836925668e74fc6e0e85ba0283cbf9 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Fri, 6 Jan 2017 17:40:12 +0100
Subject: [PATCH 2/2] MIPS: lantiq: improve USB initialization
This adds code to initialize the USB controller and PHY also on Danube,
Amazon SE and AR10. This code is based on the Vendor driver from
different UGW versions and compared to the hardware documentation.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
arch/mips/lantiq/xway/sysctrl.c | 20 +++++++
2 files changed, 110 insertions(+), 30 deletions(-)
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -248,6 +248,25 @@ static void pmu_disable(struct clk *clk)
pr_warn("deactivating PMU module failed!");
}
+static void usb_set_clock(void)
+{
+ unsigned int val = ltq_cgu_r32(ifccr);
+
+ if (of_machine_is_compatible("lantiq,ar10") ||
+ of_machine_is_compatible("lantiq,grx390")) {
+ val &= ~0x03; /* XTAL divided by 3 */
+ } else if (of_machine_is_compatible("lantiq,ar9") ||
+ of_machine_is_compatible("lantiq,vr9")) {
+ /* TODO: this depends on the XTAL frequency */
+ val |= 0x03; /* XTAL divided by 3 */
+ } else if (of_machine_is_compatible("lantiq,ase")) {
+ val |= 0x20; /* from XTAL */
+ } else if (of_machine_is_compatible("lantiq,danube")) {
+ val |= 0x30; /* 12 MHz, generated from 36 MHz */
+ }
+ ltq_cgu_w32(val, ifccr);
+}
+
/* the pci enable helper */
static int pci_enable(struct clk *clk)
{
@@ -571,4 +590,5 @@ void __init ltq_soc_init(void)
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
}
+ usb_set_clock();
}