add PCIe, its PHY and AHCI support for mt7623
Subsystems (7)
v3 cover add PCIe, its PHY and AHCI support for mt7623
This series adds PCIe/PHY drivers which were adapted from Linux version. The related drivers were tested on bpi-r2.
To get AHCI (SATA) working on R2 (ASM1061 PCIe2SATA-Controller) 2 addional changes are needed (see Parts 5+6 from Oleksandr Rybalko)
changes since v2:
- rename pcie-driver to "MediaTek PCIe Gen2 controller"
- replaced readl/writel with (clr/set)bits_le32
- add dt-binding documents for pcie and phy
changes since v1:
- replaced mt2701 PCIe driver with version (PHY+PCIe) from Ryder
Oleksandr Rybalko (2):
ahci-pci: ASM1061 report wrong class, but support AHCI.
ata: ahci: Don't forget to clear upper address regs.
Ryder Lee (6):
pci: mediatek: add PCIe controller support for MT7623
phy: mediatek: add MediaTek T-PHY support for PCIe
arm: dts: add PCIe controller for MT7623 SoC
arm: dts: split mtk-reset.h into per-chip header
dt-bindings: pcie: add a document for MT7623 PCIe controller
dt-bindings: phy: add a document for MediaTek tphy
arch/arm/dts/mt7623.dtsi | 130 ++++++-
arch/arm/dts/mt7623n-bananapi-bpi-r2.dts | 29 ++
arch/arm/dts/mt7629.dtsi | 2 +-
.../pci/mediatek-pcie.txt | 122 ++++++
doc/device-tree-bindings/phy/phy-mtk-tphy.txt | 86 +++++
drivers/ata/ahci-pci.c | 1 +
drivers/ata/ahci.c | 9 +-
drivers/pci/Kconfig | 8 +
drivers/pci/Makefile | 1 +
drivers/pci/pcie_mediatek.c | 279 ++++++++++++++
drivers/phy/Kconfig | 11 +
drivers/phy/Makefile | 1 +
drivers/phy/phy-mtk-tphy.c | 362 ++++++++++++++++++
.../reset/{mtk-reset.h => mt7623-reset.h} | 4 +-
include/dt-bindings/reset/mt7629-reset.h | 36 ++
15 files changed, 1074 insertions(+), 7 deletions(-)
create mode 100644 doc/device-tree-bindings/pci/mediatek-pcie.txt
create mode 100644 doc/device-tree-bindings/phy/phy-mtk-tphy.txt
create mode 100644 drivers/pci/pcie_mediatek.c
create mode 100644 drivers/phy/phy-mtk-tphy.c
rename include/dt-bindings/reset/{mtk-reset.h => mt7623-reset.h} (88%)
create mode 100644 include/dt-bindings/reset/mt7629-reset.h--
2.17.1
PATCH v3 1/8 pci: mediatek: add PCIe controller support for MT7623
From: Ryder Lee <[email protected]>
This adds PCIe controller support for MT7623.
This is adapted from the Linux version.
changes since v2:
- rename driver to "MediaTek PCIe Gen2 controller"
- use clrsetbits_le32 instead of readl/writel
--- drivers/pci/Kconfig | 8 ++ drivers/pci/Makefile | 1 + drivers/pci/pcie_mediatek.c | 279 ++++++++++++++++++++++++++++++++++++ 3 files changed, 288 insertions(+) create mode 100644 drivers/pci/pcie_mediatek.c
drivers/pci/Kconfig +8 -0
@@ -145,4 +145,12 @@ config PCI_MVEBU Say Y here if you want to enable PCIe controller support on Armada XP/38x SoCs. +config PCIE_MEDIATEK + bool "MediaTek PCIe Gen2 controller" + depends on DM_PCI + depends on ARCH_MEDIATEK + help + Say Y here if you want to enable Gen2 PCIe controller, + which could be found on MT7623 SoC family. + endif
drivers/pci/Makefile +1 -0
@@ -38,3 +38,4 @@ obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie_layerscape_gen4.o \ pcie_layerscape_gen4_fixup.o obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o +obj-$(CONFIG_PCIE_MEDIATEK) += pcie_mediatek.o
drivers/pci/pcie_mediatek.c new file +279 -0
279 lines not on this page · raw message
--
2.17.1
PATCH v3 2/8 phy: mediatek: add MediaTek T-PHY support for PCIe
In reply to Frank WunderlichFrom: Ryder Lee <[email protected]>
The driver provides PHY for USB2, USB3.0, PCIe and SATA, and now we just enable PCIe. As for the other functionalities will be added gradually in upcoming days.
This is adapted from the Linux version.
changes since v2:
- use clrsetbits_le32 instead of readl/writel
- change SSC-delta
--- drivers/phy/Kconfig | 11 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-mtk-tphy.c | 362 +++++++++++++++++++++++++++++++++++++ 3 files changed, 374 insertions(+) create mode 100644 drivers/phy/phy-mtk-tphy.c
drivers/phy/Kconfig +11 -0
@@ -190,4 +190,15 @@ config MT76X8_USB_PHY This PHY is found on MT76x8 devices supporting USB. +config PHY_MTK_TPHY + bool "MediaTek T-PHY Driver" + depends on PHY + depends on ARCH_MEDIATEK + help + MediaTek T-PHY driver supports usb2.0, usb3.0 ports, PCIe and + SATA, and meanwhile supports two version T-PHY which have + different banks layout, the T-PHY with shared banks between + multi-ports is first version, otherwise is second veriosn, + so you can easily distinguish them by banks layout. + endmenu
drivers/phy/Makefile +1 -0
@@ -21,3 +21,4 @@ obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o obj-$(CONFIG_OMAP_USB2_PHY) += omap-usb2-phy.o obj-$(CONFIG_KEYSTONE_USB_PHY) += keystone-usb-phy.o obj-$(CONFIG_MT76X8_USB_PHY) += mt76x8-usb-phy.o +obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o
drivers/phy/phy-mtk-tphy.c new file +362 -0
362 lines not on this page · raw message
--
2.17.1
PATCH v3 3/8 arm: dts: add PCIe controller for MT7623 SoC
In reply to Frank WunderlichFrom: Ryder Lee <[email protected]>
This adds PCIe and its PHY nodes for MT7623.
changes since v2: none
--- arch/arm/dts/mt7623.dtsi | 128 +++++++++++++++++++++++ arch/arm/dts/mt7623n-bananapi-bpi-r2.dts | 29 +++++ 2 files changed, 157 insertions(+)
arch/arm/dts/mt7623.dtsi +128 -0
@@ -9,6 +9,7 @@ #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/phy/phy.h> #include <dt-bindings/power/mt7623-power.h> #include <dt-bindings/reset/mtk-reset.h> #include "skeleton.dtsi"
@@ -255,6 +256,133 @@ #reset-cells = <1>; }; + pcie: pcie at 1a140000 { + compatible = "mediatek,mt7623-pcie"; + device_type = "pci"; + reg = <0x1a140000 0x1000>, /* PCIe shared registers */ + <0x1a142000 0x1000>, /* Port0 registers */ + <0x1a143000 0x1000>, /* Port1 registers */ + <0x1a144000 0x1000>; /* Port2 registers */ + reg-names = "subsys", "port0", "port1", "port2"; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-map-mask = <0xf800 0 0 0>; + interrupt-map = <0x0000 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>, + <0x0800 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>, + <0x1000 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>; + clocks = <&topckgen CLK_TOP_ETHIF_SEL>, + <&hifsys CLK_HIFSYS_PCIE0>, + <&hifsys CLK_HIFSYS_PCIE1>, + <&hifsys CLK_HIFSYS_PCIE2>; + clock-names = "free_ck", "sys_ck0", "sys_ck1", "sys_ck2"; + resets = <&hifsys HIFSYS_PCIE0_RST>, + <&hifsys HIFSYS_PCIE1_RST>, + <&hifsys HIFSYS_PCIE2_RST>; + reset-names = "pcie-rst0", "pcie-rst1", "pcie-rst2"; + phys = <&pcie0_port PHY_TYPE_PCIE>, + <&pcie1_port PHY_TYPE_PCIE>, + <&u3port1 PHY_TYPE_PCIE>; + phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2"; + power-domains = <&scpsys MT7623_POWER_DOMAIN_HIF>; + bus-range = <0x00 0xff>; + status = "disabled"; + ranges = <0x81000000 0 0x1a160000 0x1a160000 0 0x00010000 + 0x83000000 0 0x60000000 0x60000000 0 0x10000000>; + + pcie at 0,0 { + reg = <0x0000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>; + ranges; + status = "disabled"; + }; + + pcie at 1,0 { + reg = <0x0800 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>; + ranges; + status = "disabled"; + }; + + pcie at 2,0 { + reg = <0x1000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>; + ranges; + status = "disabled"; + }; + }; + + pcie0_phy: pcie-phy at 1a149000 { + compatible = "mediatek,generic-tphy-v1"; + reg = <0x1a149000 0x0700>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + pcie0_port: pcie-phy at 1a149900 { + reg = <0x1a149900 0x0700>; + clocks = <&clk26m>; + clock-names = "ref"; + #phy-cells = <1>; + status = "okay"; + }; + }; + + pcie1_phy: pcie-phy at 1a14a000 { + compatible = "mediatek,generic-tphy-v1"; + reg = <0x1a14a000 0x0700>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + pcie1_port: pcie-phy at 1a14a900 { + reg = <0x1a14a900 0x0700>; + clocks = <&clk26m>; + clock-names = "ref"; + #phy-cells = <1>; + status = "okay"; + }; + }; + + u3phy2: usb-phy at 1a244000 { + compatible = "mediatek,generic-tphy-v1"; + reg = <0x1a244000 0x0700>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + u2port1: usb-phy at 1a244800 { + reg = <0x1a244800 0x0100>; + clocks = <&topckgen CLK_TOP_USB_PHY48M>; + clock-names = "ref"; + #phy-cells = <1>; + status = "okay"; + }; + + u3port1: usb-phy at 1a244900 { + reg = <0x1a244900 0x0700>; + clocks = <&clk26m>; + clock-names = "ref"; + #phy-cells = <1>; + status = "okay"; + }; + }; + ethsys: syscon at 1b000000 { compatible = "mediatek,mt7623-ethsys", "syscon"; reg = <0x1b000000 0x1000>;
arch/arm/dts/mt7623n-bananapi-bpi-r2.dts +29 -0
@@ -172,6 +172,13 @@ }; }; + pcie_default: pcie-default { + mux { + function = "pcie"; + groups = "pcie0_0_perst", "pcie1_0_perst"; + }; + }; + uart0_pins_a: uart0-default { mux { function = "uart";
@@ -201,6 +208,28 @@ }; }; +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_default>; + status = "okay"; + + pcie at 0,0 { + status = "okay"; + }; + + pcie at 1,0 { + status = "okay"; + }; +}; + +&pcie0_phy { + status = "okay"; +}; + +&pcie1_phy { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>;
--
2.17.1
PATCH v3 4/8 arm: dts: split mtk-reset.h into per-chip header
In reply to Frank WunderlichFrom: Ryder Lee <[email protected]>
This follows the linux header rules to avoid conflict bitfields.
changes since v2: none
---
arch/arm/dts/mt7623.dtsi | 2 +-
arch/arm/dts/mt7629.dtsi | 2 +-
.../reset/{mtk-reset.h => mt7623-reset.h} | 4 +--
include/dt-bindings/reset/mt7629-reset.h | 36 +++++++++++++++++++
4 files changed, 39 insertions(+), 5 deletions(-)
rename include/dt-bindings/reset/{mtk-reset.h => mt7623-reset.h} (88%)
create mode 100644 include/dt-bindings/reset/mt7629-reset.harch/arm/dts/mt7623.dtsi +1 -1
@@ -11,7 +11,7 @@ #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/phy/phy.h> #include <dt-bindings/power/mt7623-power.h> -#include <dt-bindings/reset/mtk-reset.h> +#include <dt-bindings/reset/mt7623-reset.h> #include "skeleton.dtsi" / {
arch/arm/dts/mt7629.dtsi +1 -1
@@ -10,7 +10,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/power/mt7629-power.h> -#include <dt-bindings/reset/mtk-reset.h> +#include <dt-bindings/reset/mt7629-reset.h> #include "skeleton.dtsi" / {
include/dt-bindings/reset/mt7623-reset.h renamed from include/dt-bindings/reset/mtk-reset.h +1 -3
@@ -6,11 +6,9 @@#ifndef _DT_BINDINGS_MTK_RESET_H_#define _DT_BINDINGS_MTK_RESET_H_ -/* ETHSYS */ +/* ETHSYS resets */ #define ETHSYS_PPE_RST 31 -#define ETHSYS_EPHY_RST 24#define ETHSYS_GMAC_RST 23 -#define ETHSYS_ESW_RST 16#define ETHSYS_FE_RST 6#define ETHSYS_MCM_RST 2#define ETHSYS_SYS_RST 0
include/dt-bindings/reset/mt7629-reset.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2019 MediaTek Inc. +*/ + +#ifndef _DT_BINDINGS_MTK_RESET_H_ +#define _DT_BINDINGS_MTK_RESET_H_ + +/* PCIe Subsystem resets */ +#define PCIE1_CORE_RST 19 +#define PCIE1_MMIO_RST 20 +#define PCIE1_HRST 21 +#define PCIE1_USER_RST 22 +#define PCIE1_PIPE_RST 23 +#define PCIE0_CORE_RST 27 +#define PCIE0_MMIO_RST 28 +#define PCIE0_HRST 29 +#define PCIE0_USER_RST 30 +#define PCIE0_PIPE_RST 31 + +/* SSUSB Subsystem resets */ +#define SSUSB_PHY_PWR_RST 3 +#define SSUSB_MAC_PWR_RST 4 + +/* ETH Subsystem resets */ +#define ETHSYS_SYS_RST 0 +#define ETHSYS_MCM_RST 2 +#define ETHSYS_HSDMA_RST 5 +#define ETHSYS_FE_RST 6 +#define ETHSYS_ESW_RST 16 +#define ETHSYS_GMAC_RST 23 +#define ETHSYS_EPHY_RST 24 +#define ETHSYS_CRYPTO_RST 29 +#define ETHSYS_PPE_RST 31 + +#endif /* _DT_BINDINGS_MTK_RESET_H_ */
--
2.17.1
PATCH v3 5/8 dt-bindings: pcie: add a document for MT7623 PCIe controller
In reply to Frank WunderlichFrom: Ryder Lee <[email protected]>
This adds a document for MT7623 PCIe controller.
changes since v2: dt-bindings added with v3
--- .../pci/mediatek-pcie.txt | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 doc/device-tree-bindings/pci/mediatek-pcie.txt
doc/device-tree-bindings/pci/mediatek-pcie.txt new file +122 -0
@@ -0,0 +1,122 @@ +MediaTek Gen2 PCIe controller + +Required properties: +- compatible: Should contain one of the following strings: + "mediatek,mt7623-pcie" +- device_type: Must be "pci" +- reg: Base addresses and lengths of the PCIe subsys and root ports. +- reg-names: Names of the above areas to use during resource lookup. +- #address-cells: Address representation for root ports (must be 3) +- #size-cells: Size representation for root ports (must be 2) +- clocks: Must contain an entry for each entry in clock-names. +- clock-names: + Mandatory entries: + - sys_ckN :transaction layer and data link layer clock + Required entries for MT7623: + - free_ck :for reference clock of PCIe subsys + where N starting from 0 to one less than the number of root ports. +- phys: List of PHY specifiers (used by generic PHY framework). +- phy-names : Must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the + number of PHYs as specified in *phys* property. +- power-domains: A phandle and power domain specifier pair to the power domain + which is responsible for collapsing and restoring power to the peripheral. +- bus-range: Range of bus numbers associated with this controller. +- ranges: Ranges for the PCI memory and I/O regions. + +Required properties for MT7623: +- #interrupt-cells: Size representation for interrupts (must be 1) +- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties + Please refer to the standard PCI bus binding document for a more detailed + explanation. +- resets: Must contain an entry for each entry in reset-names. +- reset-names: Must be "pcie-rst0", "pcie-rst1", "pcie-rstN".. based on the + number of root ports. + +In addition, the device tree node must have sub-nodes describing each +PCIe port interface, having the following mandatory properties: + +Required properties: +- device_type: Must be "pci" +- reg: Only the first four bytes are used to refer to the correct bus number + and device number. +- #address-cells: Must be 3 +- #size-cells: Must be 2 +- #interrupt-cells: Must be 1 +- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties + Please refer to the standard PCI bus binding document for a more detailed + explanation. +- ranges: Sub-ranges distributed from the PCIe controller node. An empty + property is sufficient. + +Examples for MT7623: + + hifsys: syscon at 1a000000 { + compatible = "mediatek,mt7623-hifsys", + "syscon"; + reg = <0x1a000000 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + pcie: pcie at 1a140000 { + compatible = "mediatek,mt7623-pcie"; + device_type = "pci"; + reg = <0x1a140000 0x1000>, /* PCIe shared registers */ + <0x1a142000 0x1000>, /* Port0 registers */ + <0x1a143000 0x1000>, /* Port1 registers */ + <0x1a144000 0x1000>; /* Port2 registers */ + reg-names = "subsys", "port0", "port1", "port2"; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-map-mask = <0xf800 0 0 0>; + interrupt-map = <0x0000 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>, + <0x0800 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>, + <0x1000 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>; + clocks = <&topckgen CLK_TOP_ETHIF_SEL>, + <&hifsys CLK_HIFSYS_PCIE0>, + <&hifsys CLK_HIFSYS_PCIE1>, + <&hifsys CLK_HIFSYS_PCIE2>; + clock-names = "free_ck", "sys_ck0", "sys_ck1", "sys_ck2"; + resets = <&hifsys HIFSYS_PCIE0_RST>, + <&hifsys HIFSYS_PCIE1_RST>, + <&hifsys HIFSYS_PCIE2_RST>; + reset-names = "pcie-rst0", "pcie-rst1", "pcie-rst2"; + phys = <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE>, + <&pcie2_phy PHY_TYPE_PCIE>; + phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2"; + power-domains = <&scpsys MT7623_POWER_DOMAIN_HIF>; + bus-range = <0x00 0xff>; + ranges = <0x81000000 0 0x1a160000 0x1a160000 0 0x00010000 /* I/O space */ + 0x83000000 0 0x60000000 0x60000000 0 0x10000000>; /* memory space */ + + pcie at 0,0 { + reg = <0x0000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>; + ranges; + }; + + pcie at 1,0 { + reg = <0x0800 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>; + ranges; + }; + + pcie at 2,0 { + reg = <0x1000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>; + ranges; + }; + };
--
2.17.1
PATCH v3 6/8 dt-bindings: phy: add a document for MediaTek tphy
In reply to Frank WunderlichFrom: Ryder Lee <[email protected]>
This adds a document for tphy which supports physical layer functionality for a number of controllers on MediaTek SoCs, such as, USB2.0, USB3.0, PCIe, and SATA.
changes since v2: dt-bindings added with v3
--- doc/device-tree-bindings/phy/phy-mtk-tphy.txt | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 doc/device-tree-bindings/phy/phy-mtk-tphy.txt
doc/device-tree-bindings/phy/phy-mtk-tphy.txt new file +86 -0
@@ -0,0 +1,86 @@ +MediaTek T-PHY binding +-------------------------- + +T-phy controller supports physical layer functionality for a number of +controllers on MediaTek SoCs, such as, USB2.0, USB3.0, PCIe, and SATA. + +Required properties (controller (parent) node): + - compatible : should be one of + "mediatek,generic-tphy-v1" + - clocks : (deprecated, use port's clocks instead) a list of phandle + + clock-specifier pairs, one for each entry in clock-names + - clock-names : (deprecated, use port's one instead) must contain + "u3phya_ref": for reference clock of usb3.0 analog phy. + +Required nodes : a sub-node is required for each port the controller + provides. Address range information including the usual + 'reg' property is used inside these nodes to describe + the controller's topology. + +Optional properties (controller (parent) node): + - reg : offset and length of register shared by multiple ports, + exclude port's private register. + - mediatek,src-ref-clk-mhz : frequency of reference clock for slew rate + calibrate + - mediatek,src-coef : coefficient for slew rate calibrate, depends on + SoC process + +Required properties (port (child) node): +- reg : address and length of the register set for the port. +- clocks : a list of phandle + clock-specifier pairs, one for each + entry in clock-names +- clock-names : must contain + "ref": 48M reference clock for HighSpeed analog phy; and 26M + reference clock for SuperSpeed analog phy, sometimes is + 24M, 25M or 27M, depended on platform. +- #phy-cells : should be 1 (See second example) + cell after port phandle is phy type from: + - PHY_TYPE_USB2 + - PHY_TYPE_USB3 + - PHY_TYPE_PCIE + - PHY_TYPE_SATA + +Example: + + u3phy2: usb-phy at 1a244000 { + compatible = "mediatek,generic-tphy-v1"; + reg = <0x1a244000 0x0700>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + u2port1: usb-phy at 1a244800 { + reg = <0x1a244800 0x0100>; + clocks = <&topckgen CLK_TOP_USB_PHY48M>; + clock-names = "ref"; + #phy-cells = <1>; + status = "okay"; + }; + + u3port1: usb-phy at 1a244900 { + reg = <0x1a244900 0x0700>; + clocks = <&clk26m>; + clock-names = "ref"; + #phy-cells = <1>; + status = "okay"; + }; + }; + +Specifying phy control of devices +--------------------------------- + +Device nodes should specify the configuration required in their "phys" +property, containing a phandle to the phy port node and a device type; +phy-names for each port are optional. + +Example: + +#include <dt-bindings/phy/phy.h> + +usb30: usb at 11270000 { + ... + phys = <&u2port0 PHY_TYPE_USB2>, <&u3port0 PHY_TYPE_USB3>; + phy-names = "usb2-0", "usb3-0"; + ... +};
--
2.17.1
PATCH v3 7/8 ahci-pci: ASM1061 report wrong class, but support AHCI.
In reply to Frank WunderlichFrom: Oleksandr Rybalko <[email protected]>
changes since v2: none
--- drivers/ata/ahci-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/ahci-pci.c +1 -0
@@ -35,6 +35,7 @@ U_BOOT_DRIVER(ahci_pci) = {static struct pci_device_id ahci_pci_supported[] = { {PCI_DEVICE_CLASS (PCI_CLASS_STORAGE_SATA_AHCI , ~0 ) }, + {PCI_DEVICE (0x1b21 ,0x0611 ) }, {}, };
--
2.17.1
PATCH v3 8/8 ata: ahci: Don't forget to clear upper address regs.
In reply to Frank WunderlichFrom: Oleksandr Rybalko <[email protected]>
In 32bits mode upper bits need to be set to 0, otherwise controller will try to DMA into not existing memory and stops with error.
changes since v2: none
--- drivers/ata/ahci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/ata/ahci.c +7 -2
@@ -593,10 +593,15 @@ static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port) pp->cmd_tbl_sg = (struct ahci_sg *)(uintptr_t )virt_to_phys ((void *)mem); -writel_with_flush ((unsigned long )pp->cmd_slot, - port_mmio +PORT_LST_ADDR ); +writel_with_flush ((u32 )pp->cmd_slot, port_mmio +PORT_LST_ADDR ); +#ifndef CONFIG_PHYS_64BIT +writel_with_flush (0 , port_mmio +PORT_LST_ADDR_HI ); +#endif writel_with_flush (pp->rx_fis, port_mmio +PORT_FIS_ADDR ); +#ifndef CONFIG_PHYS_64BIT +writel_with_flush (0 , port_mmio +PORT_FIS_ADDR_HI ); +#endif #ifdef CONFIG_SUNXI_AHCI sunxi_dma_init (port_mmio);
--
2.17.1
PATCH v3 8/8 ata: ahci: Don't forget to clear upper address regs.
Quoted 10 lines · Frank Wunderlich
From: Oleksandr Rybalko <[email protected]>
In 32bits mode upper bits need to be set to 0, otherwise controller will try to DMA into not existing memory and stops with error.
changes since v2: none
Tested-by Frank Wunderlich <[email protected]>Signed-off-by Frank Wunderlich <[email protected]>Signed-off-by Oleksandr Rybalko <[email protected]>
This introduces a warning:
x86: w+ qemu-x86_64
+(qemu-x86_64) writel_with_flush((u32)pp->cmd_slot, port_mmio + PORT_LST_ADDR);
+(qemu-x86_64) ^
+(qemu-x86_64) arch/x86/include/asm/io.h:71:53: note: in definition of macro 'writel'
+(qemu-x86_64) #define writel(b, addr) (*(volatile u32 *)(addr) = (b))
+(qemu-x86_64) ^
+(qemu-x86_64) drivers/ata/ahci.c:596:2: note: in expansion of macro 'writel_with_flush'
+(qemu-x86_64) ^~~~~~~~~~~~~~~~~
w+(qemu-x86_64) drivers/ata/ahci.c: In function 'ahci_port_start':
w+(qemu-x86_64) drivers/ata/ahci.c:596:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190820/1a22b641/attachment.sig>
v3 cover add PCIe, its PHY and AHCI support for mt7623
In reply to Frank WunderlichAny comments on this series? can it be merged as it is?