The new phy-rockchip-usb2 DM driver is now available, so remove rockchip_usb2_phy related code. Also remove a variable no longer needed from an include file.
Signed-off-by: Johan Jonker <[email protected]> --- Changed V4: (Jonas) split patch --- arch/arm/mach-rockchip/board.c | 28 ------- drivers/usb/phy/Kconfig | 3 - drivers/usb/phy/Makefile | 1 - drivers/usb/phy/rockchip_usb2_phy.c | 113 ---------------------------- include/usb/dwc2_udc.h | 1 - 5 files changed, 146 deletions(-) delete mode 100644 drivers/usb/phy/rockchip_usb2_phy.c diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 2e6bb38b9235..1538f4fef081 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -269,34 +269,6 @@ int board_usb_init(int index, enum usb_init_type init) } otg_data.regs_otg = ofnode_get_addr(node); -#ifdef CONFIG_ROCKCHIP_USB2_PHY - int ret; - u32 phandle, offset; - ofnode phy_node; - - ret = ofnode_read_u32(node, "phys", &phandle); - if (ret) - return ret; - - node = ofnode_get_by_phandle(phandle); - if (!ofnode_valid(node)) { - debug("Not found usb phy device\n"); - return -ENODEV; - } - - phy_node = ofnode_get_parent(node); - if (!ofnode_valid(node)) { - debug("Not found usb phy device\n"); - return -ENODEV; - } - - otg_data.phy_of_node = phy_node; - ret = ofnode_read_u32(node, "reg", &offset); - if (ret) - return ret; - otg_data.regs_phy = offset + - (u32)syscon_get_first_range(ROCKCHIP_SYSCON_GRF); -#endif return dwc2_udc_probe(&otg_data); } diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index c505862f1e15..9c91f63786ac 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -7,6 +7,3 @@ comment "USB Phy" config TWL4030_USB bool "TWL4030 PHY" - -config ROCKCHIP_USB2_PHY - bool "Rockchip USB2 PHY" diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index b67a70bbe8ed..cf6109dee610 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -4,4 +4,3 @@ # Tom Rix <[email protected]> obj-$(CONFIG_TWL4030_USB) += twl4030.o -obj-$(CONFIG_ROCKCHIP_USB2_PHY) += rockchip_usb2_phy.o diff --git a/drivers/usb/phy/rockchip_usb2_phy.c b/drivers/usb/phy/rockchip_usb2_phy.c deleted file mode 100644 index bdbd0d44813a..000000000000 --- a/drivers/usb/phy/rockchip_usb2_phy.c +++ /dev/null @@ -1,113 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright 2016 Rockchip Electronics Co., Ltd - */ - -#include <hang.h> -#include <log.h> -#include <asm/io.h> -#include <linux/bitops.h> -#include <linux/delay.h> - -#include "../gadget/dwc2_udc_otg_priv.h" - -#define BIT_WRITEABLE_SHIFT 16 - -struct usb2phy_reg { - unsigned int offset; - unsigned int bitend; - unsigned int bitstart; - unsigned int disable; - unsigned int enable; -}; - -/** - * struct rockchip_usb2_phy_cfg: usb-phy port configuration - * @port_reset: usb otg per-port reset register - * @soft_con: software control usb otg register - * @suspend: phy suspend register - */ -struct rockchip_usb2_phy_cfg { - struct usb2phy_reg port_reset; - struct usb2phy_reg soft_con; - struct usb2phy_reg suspend; -}; - -struct rockchip_usb2_phy_dt_id { - char compatible[128]; - const void *data; -}; - -static const struct rockchip_usb2_phy_cfg rk3066a_pdata = { - .port_reset = {0x00, 12, 12, 0, 1}, - .soft_con = {0x08, 2, 2, 0, 1}, - .suspend = {0x08, 8, 3, (0x01 << 3), (0x2A << 3)}, -}; - -static const struct rockchip_usb2_phy_cfg rk3288_pdata = { - .port_reset = {0x00, 12, 12, 0, 1}, - .soft_con = {0x08, 2, 2, 0, 1}, - .suspend = {0x0c, 5, 0, 0x01, 0x2A}, -}; - -static struct rockchip_usb2_phy_dt_id rockchip_usb2_phy_dt_ids[] = { - { .compatible = "rockchip,rk3066a-usb-phy", .data = &rk3066a_pdata }, - { .compatible = "rockchip,rk3188-usb-phy", .data = &rk3288_pdata }, - { .compatible = "rockchip,rk3288-usb-phy", .data = &rk3288_pdata }, - {} -}; - -static void property_enable(struct dwc2_plat_otg_data *pdata, - const struct usb2phy_reg *reg, bool en) -{ - unsigned int val, mask, tmp; - - tmp = en ? reg->enable : reg->disable; - mask = GENMASK(reg->bitend, reg->bitstart); - val = (tmp << reg->bitstart) | (mask << BIT_WRITEABLE_SHIFT); - - writel(val, pdata->regs_phy + reg->offset); -} - -void otg_phy_init(struct dwc2_udc *dev) -{ - struct dwc2_plat_otg_data *pdata = dev->pdata; - struct rockchip_usb2_phy_cfg *phy_cfg = NULL; - struct rockchip_usb2_phy_dt_id *of_id; - int i; - - for (i = 0; i < ARRAY_SIZE(rockchip_usb2_phy_dt_ids); i++) { - of_id = &rockchip_usb2_phy_dt_ids[i]; - if (ofnode_device_is_compatible(pdata->phy_of_node, - of_id->compatible)){ - phy_cfg = (struct rockchip_usb2_phy_cfg *)of_id->data; - break; - } - } - if (!phy_cfg) { - debug("Can't find device platform data\n"); - - hang(); - return; - } - pdata->priv = phy_cfg; - /* disable software control */ - property_enable(pdata, &phy_cfg->soft_con, false); - - /* reset otg port */ - property_enable(pdata, &phy_cfg->port_reset, true); - mdelay(1); - property_enable(pdata, &phy_cfg->port_reset, false); - udelay(1); -} - -void otg_phy_off(struct dwc2_udc *dev) -{ - struct dwc2_plat_otg_data *pdata = dev->pdata; - struct rockchip_usb2_phy_cfg *phy_cfg = pdata->priv; - - /* enable software control */ - property_enable(pdata, &phy_cfg->soft_con, true); - /* enter suspend */ - property_enable(pdata, &phy_cfg->suspend, true); -} diff --git a/include/usb/dwc2_udc.h b/include/usb/dwc2_udc.h index aa37e957b47c..c8610ef8c98a 100644 --- a/include/usb/dwc2_udc.h +++ b/include/usb/dwc2_udc.h @@ -15,7 +15,6 @@ struct dwc2_plat_otg_data { void *priv; - ofnode phy_of_node; int (*phy_control)(int on); uintptr_t regs_phy; uintptr_t regs_otg; -- 2.39.5

