You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'next' into resolution
Conflicts: drivers/extcon/extcon-adc-jack.c drivers/extcon/extcon-arizona.c drivers/extcon/extcon-gpio.c include/linux/extcon.h
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
Driver for Broadcom Northstar USB 3.0 PHY
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: one of: "brcm,ns-ax-usb3-phy", "brcm,ns-bx-usb3-phy".
|
||||
- reg: register mappings for DMP (Device Management Plugin) and ChipCommon B
|
||||
MMI.
|
||||
- reg-names: "dmp" and "ccb-mii"
|
||||
|
||||
Initialization of USB 3.0 PHY depends on Northstar version. There are currently
|
||||
three known series: Ax, Bx and Cx.
|
||||
Known A0: BCM4707 rev 0
|
||||
Known B0: BCM4707 rev 4, BCM53573 rev 2
|
||||
Known B1: BCM4707 rev 6
|
||||
Known C0: BCM47094 rev 0
|
||||
|
||||
Example:
|
||||
usb3-phy {
|
||||
compatible = "brcm,ns-ax-usb3-phy";
|
||||
reg = <0x18105000 0x1000>, <0x18003000 0x1000>;
|
||||
reg-names = "dmp", "ccb-mii";
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
@@ -0,0 +1,64 @@
|
||||
ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
|
||||
|
||||
Required properties (phy (parent) node):
|
||||
- compatible : should be one of the listed compatibles:
|
||||
* "rockchip,rk3366-usb2phy"
|
||||
* "rockchip,rk3399-usb2phy"
|
||||
- reg : the address offset of grf for usb-phy configuration.
|
||||
- #clock-cells : should be 0.
|
||||
- clock-output-names : specify the 480m output clock name.
|
||||
|
||||
Optional properties:
|
||||
- clocks : phandle + phy specifier pair, for the input clock of phy.
|
||||
- clock-names : input clock name of phy, must be "phyclk".
|
||||
|
||||
Required nodes : a sub-node is required for each port the phy provides.
|
||||
The sub-node name is used to identify host or otg port,
|
||||
and shall be the following entries:
|
||||
* "otg-port" : the name of otg port.
|
||||
* "host-port" : the name of host port.
|
||||
|
||||
Required properties (port (child) node):
|
||||
- #phy-cells : must be 0. See ./phy-bindings.txt for details.
|
||||
- interrupts : specify an interrupt for each entry in interrupt-names.
|
||||
- interrupt-names : a list which shall be the following entries:
|
||||
* "otg-id" : for the otg id interrupt.
|
||||
* "otg-bvalid" : for the otg vbus interrupt.
|
||||
* "linestate" : for the host/otg linestate interrupt.
|
||||
|
||||
Optional properties:
|
||||
- phy-supply : phandle to a regulator that provides power to VBUS.
|
||||
See ./phy-bindings.txt for details.
|
||||
|
||||
Example:
|
||||
|
||||
grf: syscon@ff770000 {
|
||||
compatible = "rockchip,rk3366-grf", "syscon", "simple-mfd";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
...
|
||||
|
||||
u2phy: usb2-phy@700 {
|
||||
compatible = "rockchip,rk3366-usb2phy";
|
||||
reg = <0x700 0x2c>;
|
||||
#clock-cells = <0>;
|
||||
clock-output-names = "sclk_otgphy0_480m";
|
||||
|
||||
u2phy_otg: otg-port {
|
||||
#phy-cells = <0>;
|
||||
interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "otg-id", "otg-bvalid", "linestate";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
u2phy_host: host-port {
|
||||
#phy-cells = <0>;
|
||||
interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "linestate";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,101 @@
|
||||
* ROCKCHIP type-c PHY
|
||||
---------------------
|
||||
|
||||
Required properties:
|
||||
- compatible : must be "rockchip,rk3399-typec-phy"
|
||||
- reg: Address and length of the usb phy control register set
|
||||
- rockchip,grf : phandle to the syscon managing the "general
|
||||
register files"
|
||||
- clocks : phandle + clock specifier for the phy clocks
|
||||
- clock-names : string, clock name, must be "tcpdcore", "tcpdphy-ref";
|
||||
- assigned-clocks: main clock, should be <&cru SCLK_UPHY0_TCPDCORE> or
|
||||
<&cru SCLK_UPHY1_TCPDCORE>;
|
||||
- assigned-clock-rates : the phy core clk frequency, shall be: 50000000
|
||||
- resets : a list of phandle + reset specifier pairs
|
||||
- reset-names : string reset name, must be:
|
||||
"uphy", "uphy-pipe", "uphy-tcphy"
|
||||
- extcon : extcon specifier for the Power Delivery
|
||||
|
||||
Note, there are 2 type-c phys for RK3399, and they are almost identical, except
|
||||
these registers(description below), every register node contains 3 sections:
|
||||
offset, enable bit, write mask bit.
|
||||
- rockchip,typec-conn-dir : the register of type-c connector direction,
|
||||
for type-c phy0, it must be <0xe580 0 16>;
|
||||
for type-c phy1, it must be <0xe58c 0 16>;
|
||||
- rockchip,usb3tousb2-en : the register of type-c force usb3 to usb2 enable
|
||||
control.
|
||||
for type-c phy0, it must be <0xe580 3 19>;
|
||||
for type-c phy1, it must be <0xe58c 3 19>;
|
||||
- rockchip,external-psm : the register of type-c phy external psm clock
|
||||
selection.
|
||||
for type-c phy0, it must be <0xe588 14 30>;
|
||||
for type-c phy1, it must be <0xe594 14 30>;
|
||||
- rockchip,pipe-status : the register of type-c phy pipe status.
|
||||
for type-c phy0, it must be <0xe5c0 0 0>;
|
||||
for type-c phy1, it must be <0xe5c0 16 16>;
|
||||
|
||||
Required nodes : a sub-node is required for each port the phy provides.
|
||||
The sub-node name is used to identify dp or usb3 port,
|
||||
and shall be the following entries:
|
||||
* "dp-port" : the name of DP port.
|
||||
* "usb3-port" : the name of USB3 port.
|
||||
|
||||
Required properties (port (child) node):
|
||||
- #phy-cells : must be 0, See ./phy-bindings.txt for details.
|
||||
|
||||
Example:
|
||||
tcphy0: phy@ff7c0000 {
|
||||
compatible = "rockchip,rk3399-typec-phy";
|
||||
reg = <0x0 0xff7c0000 0x0 0x40000>;
|
||||
rockchip,grf = <&grf>;
|
||||
extcon = <&fusb0>;
|
||||
clocks = <&cru SCLK_UPHY0_TCPDCORE>,
|
||||
<&cru SCLK_UPHY0_TCPDPHY_REF>;
|
||||
clock-names = "tcpdcore", "tcpdphy-ref";
|
||||
assigned-clocks = <&cru SCLK_UPHY0_TCPDCORE>;
|
||||
assigned-clock-rates = <50000000>;
|
||||
resets = <&cru SRST_UPHY0>,
|
||||
<&cru SRST_UPHY0_PIPE_L00>,
|
||||
<&cru SRST_P_UPHY0_TCPHY>;
|
||||
reset-names = "uphy", "uphy-pipe", "uphy-tcphy";
|
||||
rockchip,typec-conn-dir = <0xe580 0 16>;
|
||||
rockchip,usb3tousb2-en = <0xe580 3 19>;
|
||||
rockchip,external-psm = <0xe588 14 30>;
|
||||
rockchip,pipe-status = <0xe5c0 0 0>;
|
||||
|
||||
tcphy0_dp: dp-port {
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
|
||||
tcphy0_usb3: usb3-port {
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
tcphy1: phy@ff800000 {
|
||||
compatible = "rockchip,rk3399-typec-phy";
|
||||
reg = <0x0 0xff800000 0x0 0x40000>;
|
||||
rockchip,grf = <&grf>;
|
||||
extcon = <&fusb1>;
|
||||
clocks = <&cru SCLK_UPHY1_TCPDCORE>,
|
||||
<&cru SCLK_UPHY1_TCPDPHY_REF>;
|
||||
clock-names = "tcpdcore", "tcpdphy-ref";
|
||||
assigned-clocks = <&cru SCLK_UPHY1_TCPDCORE>;
|
||||
assigned-clock-rates = <50000000>;
|
||||
resets = <&cru SRST_UPHY1>,
|
||||
<&cru SRST_UPHY1_PIPE_L00>,
|
||||
<&cru SRST_P_UPHY1_TCPHY>;
|
||||
reset-names = "uphy", "uphy-pipe", "uphy-tcphy";
|
||||
rockchip,typec-conn-dir = <0xe58c 0 16>;
|
||||
rockchip,usb3tousb2-en = <0xe58c 3 19>;
|
||||
rockchip,external-psm = <0xe594 14 30>;
|
||||
rockchip,pipe-status = <0xe5c0 16 16>;
|
||||
|
||||
tcphy1_dp: dp-port {
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
|
||||
tcphy1_usb3: usb3-port {
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
};
|
||||
@@ -5,6 +5,8 @@ This file provides information on what the device node for the R-Car generation
|
||||
|
||||
Required properties:
|
||||
- compatible: "renesas,usb2-phy-r8a7795" if the device is a part of an R8A7795
|
||||
SoC.
|
||||
"renesas,usb2-phy-r8a7796" if the device is a part of an R8A7796
|
||||
SoC.
|
||||
"renesas,rcar-gen3-usb2-phy" for a generic R-Car Gen3 compatible device.
|
||||
|
||||
@@ -30,11 +32,11 @@ Example (R-Car H3):
|
||||
compatible = "renesas,usb2-phy-r8a7795", "renesas,rcar-gen3-usb2-phy";
|
||||
reg = <0 0xee080200 0 0x700>;
|
||||
interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&mstp7_clks R8A7795_CLK_EHCI0>;
|
||||
clocks = <&cpg CPG_MOD 703>;
|
||||
};
|
||||
|
||||
usb-phy@ee0a0200 {
|
||||
compatible = "renesas,usb2-phy-r8a7795", "renesas,rcar-gen3-usb2-phy";
|
||||
reg = <0 0xee0a0200 0 0x700>;
|
||||
clocks = <&mstp7_clks R8A7795_CLK_EHCI0>;
|
||||
clocks = <&cpg CPG_MOD 702>;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
Rockchip PCIE PHY
|
||||
-----------------------
|
||||
|
||||
Required properties:
|
||||
- compatible: rockchip,rk3399-pcie-phy
|
||||
- #phy-cells: must be 0
|
||||
- clocks: Must contain an entry in clock-names.
|
||||
See ../clocks/clock-bindings.txt for details.
|
||||
- clock-names: Must be "refclk"
|
||||
- resets: Must contain an entry in reset-names.
|
||||
See ../reset/reset.txt for details.
|
||||
- reset-names: Must be "phy"
|
||||
|
||||
Example:
|
||||
|
||||
grf: syscon@ff770000 {
|
||||
compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
...
|
||||
|
||||
pcie_phy: pcie-phy {
|
||||
compatible = "rockchip,rk3399-pcie-phy";
|
||||
#phy-cells = <0>;
|
||||
clocks = <&cru SCLK_PCIEPHY_REF>;
|
||||
clock-names = "refclk";
|
||||
resets = <&cru SRST_PCIEPHY>;
|
||||
reset-names = "phy";
|
||||
};
|
||||
};
|
||||
@@ -27,6 +27,9 @@ Optional Properties:
|
||||
- clocks : phandle + clock specifier for the phy clocks
|
||||
- clock-names: string, clock name, must be "phyclk"
|
||||
- #clock-cells: for users of the phy-pll, should be 0
|
||||
- reset-names: Only allow the following entries:
|
||||
- phy-reset
|
||||
- resets: Must contain an entry for each entry in reset-names.
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ Required properties:
|
||||
* allwinner,sun8i-a23-usb-phy
|
||||
* allwinner,sun8i-a33-usb-phy
|
||||
* allwinner,sun8i-h3-usb-phy
|
||||
* allwinner,sun50i-a64-usb-phy
|
||||
- reg : a list of offset + length pairs
|
||||
- reg-names :
|
||||
* "phy_ctrl"
|
||||
|
||||
@@ -31,6 +31,8 @@ OMAP USB2 PHY
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be "ti,omap-usb2"
|
||||
Should be "ti,dra7x-usb2" for the 1st instance of USB2 PHY on
|
||||
DRA7x
|
||||
Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
|
||||
in DRA7x
|
||||
- reg : Address and length of the register set for the device.
|
||||
|
||||
@@ -49,6 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
|
||||
state = gpiod_get_value_cansleep(data->id_gpiod);
|
||||
if (data->pdata->gpio_active_low)
|
||||
state = !state;
|
||||
|
||||
extcon_set_state_sync(data->edev, data->pdata->extcon_id, state);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,15 @@ config PHY_BCM_NS_USB2
|
||||
Enable this to support Broadcom USB 2.0 PHY connected to the USB
|
||||
controller on Northstar family.
|
||||
|
||||
config PHY_BCM_NS_USB3
|
||||
tristate "Broadcom Northstar USB 3.0 PHY Driver"
|
||||
depends on ARCH_BCM_IPROC || COMPILE_TEST
|
||||
depends on HAS_IOMEM && OF
|
||||
select GENERIC_PHY
|
||||
help
|
||||
Enable this to support Broadcom USB 3.0 PHY connected to the USB
|
||||
controller on Northstar family.
|
||||
|
||||
config PHY_BERLIN_USB
|
||||
tristate "Marvell Berlin USB PHY Driver"
|
||||
depends on ARCH_BERLIN && RESET_CONTROLLER && HAS_IOMEM && OF
|
||||
@@ -258,7 +267,9 @@ config PHY_SUN4I_USB
|
||||
depends on RESET_CONTROLLER
|
||||
depends on EXTCON
|
||||
depends on POWER_SUPPLY
|
||||
depends on USB_SUPPORT
|
||||
select GENERIC_PHY
|
||||
select USB_COMMON
|
||||
help
|
||||
Enable this to support the transceiver that is part of Allwinner
|
||||
sunxi SoCs.
|
||||
@@ -358,6 +369,14 @@ config PHY_ROCKCHIP_USB
|
||||
help
|
||||
Enable this to support the Rockchip USB 2.0 PHY.
|
||||
|
||||
config PHY_ROCKCHIP_INNO_USB2
|
||||
tristate "Rockchip INNO USB2PHY Driver"
|
||||
depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF
|
||||
depends on COMMON_CLK
|
||||
select GENERIC_PHY
|
||||
help
|
||||
Support for Rockchip USB2.0 PHY with Innosilicon IP block.
|
||||
|
||||
config PHY_ROCKCHIP_EMMC
|
||||
tristate "Rockchip EMMC PHY Driver"
|
||||
depends on ARCH_ROCKCHIP && OF
|
||||
@@ -372,6 +391,23 @@ config PHY_ROCKCHIP_DP
|
||||
help
|
||||
Enable this to support the Rockchip Display Port PHY.
|
||||
|
||||
config PHY_ROCKCHIP_PCIE
|
||||
tristate "Rockchip PCIe PHY Driver"
|
||||
depends on (ARCH_ROCKCHIP && OF) || COMPILE_TEST
|
||||
select GENERIC_PHY
|
||||
select MFD_SYSCON
|
||||
help
|
||||
Enable this to support the Rockchip PCIe PHY.
|
||||
|
||||
config PHY_ROCKCHIP_TYPEC
|
||||
tristate "Rockchip TYPEC PHY Driver"
|
||||
depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
|
||||
select EXTCON
|
||||
select GENERIC_PHY
|
||||
select RESET_CONTROLLER
|
||||
help
|
||||
Enable this to support the Rockchip USB TYPEC PHY.
|
||||
|
||||
config PHY_ST_SPEAR1310_MIPHY
|
||||
tristate "ST SPEAR1310-MIPHY driver"
|
||||
select GENERIC_PHY
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
obj-$(CONFIG_GENERIC_PHY) += phy-core.o
|
||||
obj-$(CONFIG_PHY_BCM_NS_USB2) += phy-bcm-ns-usb2.o
|
||||
obj-$(CONFIG_PHY_BCM_NS_USB3) += phy-bcm-ns-usb3.o
|
||||
obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o
|
||||
obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o
|
||||
obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o
|
||||
@@ -39,8 +40,11 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2) += phy-s5pv210-usb2.o
|
||||
obj-$(CONFIG_PHY_EXYNOS5_USBDRD) += phy-exynos5-usbdrd.o
|
||||
obj-$(CONFIG_PHY_QCOM_APQ8064_SATA) += phy-qcom-apq8064-sata.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_EMMC) += phy-rockchip-emmc.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o
|
||||
obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA) += phy-qcom-ipq806x-sata.o
|
||||
obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o
|
||||
obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Broadcom Northstar USB 3.0 PHY Driver
|
||||
*
|
||||
* Copyright (C) 2016 Rafał Miłecki <rafal@milecki.pl>
|
||||
*
|
||||
* All magic values used for initialization (and related comments) were obtained
|
||||
* from Broadcom's SDK:
|
||||
* Copyright (c) Broadcom Corp, 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#define BCM_NS_USB3_MII_MNG_TIMEOUT_US 1000 /* usecs */
|
||||
|
||||
enum bcm_ns_family {
|
||||
BCM_NS_UNKNOWN,
|
||||
BCM_NS_AX,
|
||||
BCM_NS_BX,
|
||||
};
|
||||
|
||||
struct bcm_ns_usb3 {
|
||||
struct device *dev;
|
||||
enum bcm_ns_family family;
|
||||
void __iomem *dmp;
|
||||
void __iomem *ccb_mii;
|
||||
struct phy *phy;
|
||||
};
|
||||
|
||||
static const struct of_device_id bcm_ns_usb3_id_table[] = {
|
||||
{
|
||||
.compatible = "brcm,ns-ax-usb3-phy",
|
||||
.data = (int *)BCM_NS_AX,
|
||||
},
|
||||
{
|
||||
.compatible = "brcm,ns-bx-usb3-phy",
|
||||
.data = (int *)BCM_NS_BX,
|
||||
},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, bcm_ns_usb3_id_table);
|
||||
|
||||
static int bcm_ns_usb3_wait_reg(struct bcm_ns_usb3 *usb3, void __iomem *addr,
|
||||
u32 mask, u32 value, unsigned long timeout)
|
||||
{
|
||||
unsigned long deadline = jiffies + timeout;
|
||||
u32 val;
|
||||
|
||||
do {
|
||||
val = readl(addr);
|
||||
if ((val & mask) == value)
|
||||
return 0;
|
||||
cpu_relax();
|
||||
udelay(10);
|
||||
} while (!time_after_eq(jiffies, deadline));
|
||||
|
||||
dev_err(usb3->dev, "Timeout waiting for register %p\n", addr);
|
||||
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
static inline int bcm_ns_usb3_mii_mng_wait_idle(struct bcm_ns_usb3 *usb3)
|
||||
{
|
||||
return bcm_ns_usb3_wait_reg(usb3, usb3->ccb_mii + BCMA_CCB_MII_MNG_CTL,
|
||||
0x0100, 0x0000,
|
||||
usecs_to_jiffies(BCM_NS_USB3_MII_MNG_TIMEOUT_US));
|
||||
}
|
||||
|
||||
static int bcm_ns_usb3_mii_mng_write32(struct bcm_ns_usb3 *usb3, u32 value)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bcm_ns_usb3_mii_mng_wait_idle(usb3);
|
||||
if (err < 0) {
|
||||
dev_err(usb3->dev, "Couldn't write 0x%08x value\n", value);
|
||||
return err;
|
||||
}
|
||||
|
||||
writel(value, usb3->ccb_mii + BCMA_CCB_MII_MNG_CMD_DATA);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm_ns_usb3_phy_init_ns_bx(struct bcm_ns_usb3 *usb3)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* Enable MDIO. Setting MDCDIV as 26 */
|
||||
writel(0x0000009a, usb3->ccb_mii + BCMA_CCB_MII_MNG_CTL);
|
||||
|
||||
/* Wait for MDIO? */
|
||||
udelay(2);
|
||||
|
||||
/* USB3 PLL Block */
|
||||
err = bcm_ns_usb3_mii_mng_write32(usb3, 0x587e8000);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
/* Assert Ana_Pllseq start */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x58061000);
|
||||
|
||||
/* Assert CML Divider ratio to 26 */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x582a6400);
|
||||
|
||||
/* Asserting PLL Reset */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x582ec000);
|
||||
|
||||
/* Deaaserting PLL Reset */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x582e8000);
|
||||
|
||||
/* Waiting MII Mgt interface idle */
|
||||
bcm_ns_usb3_mii_mng_wait_idle(usb3);
|
||||
|
||||
/* Deasserting USB3 system reset */
|
||||
writel(0, usb3->dmp + BCMA_RESET_CTL);
|
||||
|
||||
/* PLL frequency monitor enable */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x58069000);
|
||||
|
||||
/* PIPE Block */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x587e8060);
|
||||
|
||||
/* CMPMAX & CMPMINTH setting */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x580af30d);
|
||||
|
||||
/* DEGLITCH MIN & MAX setting */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x580e6302);
|
||||
|
||||
/* TXPMD block */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x587e8040);
|
||||
|
||||
/* Enabling SSC */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x58061003);
|
||||
|
||||
/* Waiting MII Mgt interface idle */
|
||||
bcm_ns_usb3_mii_mng_wait_idle(usb3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm_ns_usb3_phy_init_ns_ax(struct bcm_ns_usb3 *usb3)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* Enable MDIO. Setting MDCDIV as 26 */
|
||||
writel(0x0000009a, usb3->ccb_mii + BCMA_CCB_MII_MNG_CTL);
|
||||
|
||||
/* Wait for MDIO? */
|
||||
udelay(2);
|
||||
|
||||
/* PLL30 block */
|
||||
err = bcm_ns_usb3_mii_mng_write32(usb3, 0x587e8000);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x582a6400);
|
||||
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x587e80e0);
|
||||
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x580a009c);
|
||||
|
||||
/* Enable SSC */
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x587e8040);
|
||||
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x580a21d3);
|
||||
|
||||
bcm_ns_usb3_mii_mng_write32(usb3, 0x58061003);
|
||||
|
||||
/* Waiting MII Mgt interface idle */
|
||||
bcm_ns_usb3_mii_mng_wait_idle(usb3);
|
||||
|
||||
/* Deasserting USB3 system reset */
|
||||
writel(0, usb3->dmp + BCMA_RESET_CTL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm_ns_usb3_phy_init(struct phy *phy)
|
||||
{
|
||||
struct bcm_ns_usb3 *usb3 = phy_get_drvdata(phy);
|
||||
int err;
|
||||
|
||||
/* Perform USB3 system soft reset */
|
||||
writel(BCMA_RESET_CTL_RESET, usb3->dmp + BCMA_RESET_CTL);
|
||||
|
||||
switch (usb3->family) {
|
||||
case BCM_NS_AX:
|
||||
err = bcm_ns_usb3_phy_init_ns_ax(usb3);
|
||||
break;
|
||||
case BCM_NS_BX:
|
||||
err = bcm_ns_usb3_phy_init_ns_bx(usb3);
|
||||
break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
err = -ENOTSUPP;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static const struct phy_ops ops = {
|
||||
.init = bcm_ns_usb3_phy_init,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int bcm_ns_usb3_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct of_device_id *of_id;
|
||||
struct bcm_ns_usb3 *usb3;
|
||||
struct resource *res;
|
||||
struct phy_provider *phy_provider;
|
||||
|
||||
usb3 = devm_kzalloc(dev, sizeof(*usb3), GFP_KERNEL);
|
||||
if (!usb3)
|
||||
return -ENOMEM;
|
||||
|
||||
usb3->dev = dev;
|
||||
|
||||
of_id = of_match_device(bcm_ns_usb3_id_table, dev);
|
||||
if (!of_id)
|
||||
return -EINVAL;
|
||||
usb3->family = (enum bcm_ns_family)of_id->data;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmp");
|
||||
usb3->dmp = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(usb3->dmp)) {
|
||||
dev_err(dev, "Failed to map DMP regs\n");
|
||||
return PTR_ERR(usb3->dmp);
|
||||
}
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ccb-mii");
|
||||
usb3->ccb_mii = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(usb3->ccb_mii)) {
|
||||
dev_err(dev, "Failed to map ChipCommon B MII regs\n");
|
||||
return PTR_ERR(usb3->ccb_mii);
|
||||
}
|
||||
|
||||
usb3->phy = devm_phy_create(dev, NULL, &ops);
|
||||
if (IS_ERR(usb3->phy)) {
|
||||
dev_err(dev, "Failed to create PHY\n");
|
||||
return PTR_ERR(usb3->phy);
|
||||
}
|
||||
|
||||
phy_set_drvdata(usb3->phy, usb3);
|
||||
platform_set_drvdata(pdev, usb3);
|
||||
|
||||
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
|
||||
if (!IS_ERR(phy_provider))
|
||||
dev_info(dev, "Registered Broadcom Northstar USB 3.0 PHY driver\n");
|
||||
|
||||
return PTR_ERR_OR_ZERO(phy_provider);
|
||||
}
|
||||
|
||||
static struct platform_driver bcm_ns_usb3_driver = {
|
||||
.probe = bcm_ns_usb3_probe,
|
||||
.driver = {
|
||||
.name = "bcm_ns_usb3",
|
||||
.of_match_table = bcm_ns_usb3_id_table,
|
||||
},
|
||||
};
|
||||
module_platform_driver(bcm_ns_usb3_driver);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
@@ -18,11 +18,6 @@
|
||||
#include <linux/phy.h>
|
||||
#include <linux/phy/phy.h>
|
||||
|
||||
struct ns2_pci_phy {
|
||||
struct mdio_device *mdiodev;
|
||||
struct phy *phy;
|
||||
};
|
||||
|
||||
#define BLK_ADDR_REG_OFFSET 0x1f
|
||||
#define PLL_AFE1_100MHZ_BLK 0x2100
|
||||
#define PLL_CLK_AMP_OFFSET 0x03
|
||||
@@ -30,17 +25,17 @@ struct ns2_pci_phy {
|
||||
|
||||
static int ns2_pci_phy_init(struct phy *p)
|
||||
{
|
||||
struct ns2_pci_phy *phy = phy_get_drvdata(p);
|
||||
struct mdio_device *mdiodev = phy_get_drvdata(p);
|
||||
int rc;
|
||||
|
||||
/* select the AFE 100MHz block page */
|
||||
rc = mdiobus_write(phy->mdiodev->bus, phy->mdiodev->addr,
|
||||
rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
|
||||
BLK_ADDR_REG_OFFSET, PLL_AFE1_100MHZ_BLK);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
/* set the 100 MHz reference clock amplitude to 2.05 v */
|
||||
rc = mdiobus_write(phy->mdiodev->bus, phy->mdiodev->addr,
|
||||
rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
|
||||
PLL_CLK_AMP_OFFSET, PLL_CLK_AMP_2P05V);
|
||||
if (rc)
|
||||
goto err;
|
||||
@@ -48,19 +43,19 @@ static int ns2_pci_phy_init(struct phy *p)
|
||||
return 0;
|
||||
|
||||
err:
|
||||
dev_err(&phy->mdiodev->dev, "Error %d writing to phy\n", rc);
|
||||
dev_err(&mdiodev->dev, "Error %d writing to phy\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static struct phy_ops ns2_pci_phy_ops = {
|
||||
static const struct phy_ops ns2_pci_phy_ops = {
|
||||
.init = ns2_pci_phy_init,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
|
||||
{
|
||||
struct device *dev = &mdiodev->dev;
|
||||
struct phy_provider *provider;
|
||||
struct ns2_pci_phy *p;
|
||||
struct phy *phy;
|
||||
|
||||
phy = devm_phy_create(dev, dev->of_node, &ns2_pci_phy_ops);
|
||||
@@ -69,16 +64,7 @@ static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
|
||||
return PTR_ERR(phy);
|
||||
}
|
||||
|
||||
p = devm_kmalloc(dev, sizeof(struct ns2_pci_phy),
|
||||
GFP_KERNEL);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
p->mdiodev = mdiodev;
|
||||
dev_set_drvdata(dev, p);
|
||||
|
||||
p->phy = phy;
|
||||
phy_set_drvdata(phy, p);
|
||||
phy_set_drvdata(phy, mdiodev);
|
||||
|
||||
provider = devm_of_phy_provider_register(&phy->dev,
|
||||
of_phy_simple_xlate);
|
||||
|
||||
@@ -357,6 +357,21 @@ int phy_set_mode(struct phy *phy, enum phy_mode mode)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(phy_set_mode);
|
||||
|
||||
int phy_reset(struct phy *phy)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!phy || !phy->ops->reset)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&phy->mutex);
|
||||
ret = phy->ops->reset(phy);
|
||||
mutex_unlock(&phy->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(phy_reset);
|
||||
|
||||
/**
|
||||
* _of_phy_get() - lookup and obtain a reference to a phy by phandle
|
||||
* @np: device_node for which to get the phy
|
||||
|
||||
@@ -154,7 +154,7 @@ static int da8xx_usb_phy_probe(struct platform_device *pdev)
|
||||
d_phy->regmap = syscon_regmap_lookup_by_compatible(
|
||||
"ti,da830-cfgchip");
|
||||
else
|
||||
d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon.0");
|
||||
d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon");
|
||||
if (IS_ERR(d_phy->regmap)) {
|
||||
dev_err(dev, "Failed to get syscon\n");
|
||||
return PTR_ERR(d_phy->regmap);
|
||||
|
||||
@@ -249,7 +249,7 @@ static void exynos5_usbdrd_phy_isol(struct phy_usb_instance *inst,
|
||||
static unsigned int
|
||||
exynos5_usbdrd_pipe3_set_refclk(struct phy_usb_instance *inst)
|
||||
{
|
||||
static u32 reg;
|
||||
u32 reg;
|
||||
struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
|
||||
|
||||
/* restore any previous reference clock settings */
|
||||
@@ -295,7 +295,7 @@ exynos5_usbdrd_pipe3_set_refclk(struct phy_usb_instance *inst)
|
||||
static unsigned int
|
||||
exynos5_usbdrd_utmi_set_refclk(struct phy_usb_instance *inst)
|
||||
{
|
||||
static u32 reg;
|
||||
u32 reg;
|
||||
struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
|
||||
|
||||
/* restore any previous reference clock settings */
|
||||
|
||||
+46
-54
@@ -133,11 +133,49 @@ static int omap_usb_power_on(struct phy *x)
|
||||
return omap_usb_phy_power(phy, true);
|
||||
}
|
||||
|
||||
static int omap_usb2_disable_clocks(struct omap_usb *phy)
|
||||
{
|
||||
clk_disable(phy->wkupclk);
|
||||
if (!IS_ERR(phy->optclk))
|
||||
clk_disable(phy->optclk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap_usb2_enable_clocks(struct omap_usb *phy)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = clk_enable(phy->wkupclk);
|
||||
if (ret < 0) {
|
||||
dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);
|
||||
goto err0;
|
||||
}
|
||||
|
||||
if (!IS_ERR(phy->optclk)) {
|
||||
ret = clk_enable(phy->optclk);
|
||||
if (ret < 0) {
|
||||
dev_err(phy->dev, "Failed to enable optclk %d\n", ret);
|
||||
goto err1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err1:
|
||||
clk_disable(phy->wkupclk);
|
||||
|
||||
err0:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int omap_usb_init(struct phy *x)
|
||||
{
|
||||
struct omap_usb *phy = phy_get_drvdata(x);
|
||||
u32 val;
|
||||
|
||||
omap_usb2_enable_clocks(phy);
|
||||
|
||||
if (phy->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
|
||||
/*
|
||||
*
|
||||
@@ -155,8 +193,16 @@ static int omap_usb_init(struct phy *x)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap_usb_exit(struct phy *x)
|
||||
{
|
||||
struct omap_usb *phy = phy_get_drvdata(x);
|
||||
|
||||
return omap_usb2_disable_clocks(phy);
|
||||
}
|
||||
|
||||
static const struct phy_ops ops = {
|
||||
.init = omap_usb_init,
|
||||
.exit = omap_usb_exit,
|
||||
.power_on = omap_usb_power_on,
|
||||
.power_off = omap_usb_power_off,
|
||||
.owner = THIS_MODULE,
|
||||
@@ -376,65 +422,11 @@ static int omap_usb2_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int omap_usb2_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct omap_usb *phy = platform_get_drvdata(pdev);
|
||||
|
||||
clk_disable(phy->wkupclk);
|
||||
if (!IS_ERR(phy->optclk))
|
||||
clk_disable(phy->optclk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap_usb2_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct omap_usb *phy = platform_get_drvdata(pdev);
|
||||
int ret;
|
||||
|
||||
ret = clk_enable(phy->wkupclk);
|
||||
if (ret < 0) {
|
||||
dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);
|
||||
goto err0;
|
||||
}
|
||||
|
||||
if (!IS_ERR(phy->optclk)) {
|
||||
ret = clk_enable(phy->optclk);
|
||||
if (ret < 0) {
|
||||
dev_err(phy->dev, "Failed to enable optclk %d\n", ret);
|
||||
goto err1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err1:
|
||||
clk_disable(phy->wkupclk);
|
||||
|
||||
err0:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops omap_usb2_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(omap_usb2_runtime_suspend, omap_usb2_runtime_resume,
|
||||
NULL)
|
||||
};
|
||||
|
||||
#define DEV_PM_OPS (&omap_usb2_pm_ops)
|
||||
#else
|
||||
#define DEV_PM_OPS NULL
|
||||
#endif
|
||||
|
||||
static struct platform_driver omap_usb2_driver = {
|
||||
.probe = omap_usb2_probe,
|
||||
.remove = omap_usb2_remove,
|
||||
.driver = {
|
||||
.name = "omap-usb2",
|
||||
.pm = DEV_PM_OPS,
|
||||
.of_match_table = omap_usb2_id_table,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -283,10 +283,8 @@ static int __ufs_qcom_phy_init_vreg(struct phy *phy,
|
||||
err = 0;
|
||||
}
|
||||
snprintf(prop_name, MAX_PROP_NAME, "%s-always-on", name);
|
||||
if (of_get_property(dev->of_node, prop_name, NULL))
|
||||
vreg->is_always_on = true;
|
||||
else
|
||||
vreg->is_always_on = false;
|
||||
vreg->is_always_on = of_property_read_bool(dev->of_node,
|
||||
prop_name);
|
||||
}
|
||||
|
||||
if (!strcmp(name, "vdda-pll")) {
|
||||
|
||||
@@ -280,6 +280,7 @@ static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch)
|
||||
|
||||
static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
|
||||
{ .compatible = "renesas,usb2-phy-r8a7795" },
|
||||
{ .compatible = "renesas,usb2-phy-r8a7796" },
|
||||
{ .compatible = "renesas,rcar-gen3-usb2-phy" },
|
||||
{ }
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user