Commit 080eba78 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'char-misc-5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
 "Here are a small number of char/misc driver fixes for 5.17-rc4 for
  reported issues. They contain:

   - phy driver fixes

   - iio driver fix

   - eeprom driver fix

   - speakup regression fix

   - fastrpc fix

  All of these have been in linux-next with no reported issues"

* tag 'char-misc-5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  iio: buffer: Fix file related error handling in IIO_BUFFER_GET_FD_IOCTL
  speakup-dectlk: Restore pitch setting
  bus: mhi: pci_generic: Add mru_default for Cinterion MV31-W
  bus: mhi: pci_generic: Add mru_default for Foxconn SDX55
  eeprom: ee1004: limit i2c reads to I2C_SMBUS_BLOCK_MAX
  misc: fastrpc: avoid double fput() on failed usercopy
  phy: dphy: Correct clk_pre parameter
  phy: phy-mtk-tphy: Fix duplicated argument in phy-mtk-tphy
  phy: stm32: fix a refcount leak in stm32_usbphyc_pll_enable()
  phy: xilinx: zynqmp: Fix bus width setting for SGMII
  phy: cadence: Sierra: fix error handling bugs in probe()
  phy: ti: Fix missing sentinel for clk_div_table
  phy: broadcom: Kconfig: Fix PHY_BRCM_USB config option
  phy: usb: Leave some clocks running during suspend
parents dcd72f54 c72ea205
...@@ -44,6 +44,7 @@ static struct var_t vars[] = { ...@@ -44,6 +44,7 @@ static struct var_t vars[] = {
{ CAPS_START, .u.s = {"[:dv ap 160] " } }, { CAPS_START, .u.s = {"[:dv ap 160] " } },
{ CAPS_STOP, .u.s = {"[:dv ap 100 ] " } }, { CAPS_STOP, .u.s = {"[:dv ap 100 ] " } },
{ RATE, .u.n = {"[:ra %d] ", 180, 75, 650, 0, 0, NULL } }, { RATE, .u.n = {"[:ra %d] ", 180, 75, 650, 0, 0, NULL } },
{ PITCH, .u.n = {"[:dv ap %d] ", 122, 50, 350, 0, 0, NULL } },
{ INFLECTION, .u.n = {"[:dv pr %d] ", 100, 0, 10000, 0, 0, NULL } }, { INFLECTION, .u.n = {"[:dv pr %d] ", 100, 0, 10000, 0, 0, NULL } },
{ VOL, .u.n = {"[:dv g5 %d] ", 86, 60, 86, 0, 0, NULL } }, { VOL, .u.n = {"[:dv g5 %d] ", 86, 60, 86, 0, 0, NULL } },
{ PUNCT, .u.n = {"[:pu %c] ", 0, 0, 2, 0, 0, "nsa" } }, { PUNCT, .u.n = {"[:pu %c] ", 0, 0, 2, 0, 0, "nsa" } },
......
...@@ -366,6 +366,7 @@ static const struct mhi_pci_dev_info mhi_foxconn_sdx55_info = { ...@@ -366,6 +366,7 @@ static const struct mhi_pci_dev_info mhi_foxconn_sdx55_info = {
.config = &modem_foxconn_sdx55_config, .config = &modem_foxconn_sdx55_config,
.bar_num = MHI_PCI_DEFAULT_BAR_NUM, .bar_num = MHI_PCI_DEFAULT_BAR_NUM,
.dma_data_width = 32, .dma_data_width = 32,
.mru_default = 32768,
.sideband_wake = false, .sideband_wake = false,
}; };
...@@ -401,6 +402,7 @@ static const struct mhi_pci_dev_info mhi_mv31_info = { ...@@ -401,6 +402,7 @@ static const struct mhi_pci_dev_info mhi_mv31_info = {
.config = &modem_mv31_config, .config = &modem_mv31_config,
.bar_num = MHI_PCI_DEFAULT_BAR_NUM, .bar_num = MHI_PCI_DEFAULT_BAR_NUM,
.dma_data_width = 32, .dma_data_width = 32,
.mru_default = 32768,
}; };
static const struct mhi_channel_config mhi_sierra_em919x_channels[] = { static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/math64.h> #include <linux/math64.h>
...@@ -196,12 +197,9 @@ static u32 ps2bc(struct nwl_dsi *dsi, unsigned long long ps) ...@@ -196,12 +197,9 @@ static u32 ps2bc(struct nwl_dsi *dsi, unsigned long long ps)
/* /*
* ui2bc - UI time periods to byte clock cycles * ui2bc - UI time periods to byte clock cycles
*/ */
static u32 ui2bc(struct nwl_dsi *dsi, unsigned long long ui) static u32 ui2bc(unsigned int ui)
{ {
u32 bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); return DIV_ROUND_UP(ui, BITS_PER_BYTE);
return DIV64_U64_ROUND_UP(ui * dsi->lanes,
dsi->mode.clock * 1000 * bpp);
} }
/* /*
...@@ -232,12 +230,12 @@ static int nwl_dsi_config_host(struct nwl_dsi *dsi) ...@@ -232,12 +230,12 @@ static int nwl_dsi_config_host(struct nwl_dsi *dsi)
} }
/* values in byte clock cycles */ /* values in byte clock cycles */
cycles = ui2bc(dsi, cfg->clk_pre); cycles = ui2bc(cfg->clk_pre);
DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_t_pre: 0x%x\n", cycles); DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_t_pre: 0x%x\n", cycles);
nwl_dsi_write(dsi, NWL_DSI_CFG_T_PRE, cycles); nwl_dsi_write(dsi, NWL_DSI_CFG_T_PRE, cycles);
cycles = ps2bc(dsi, cfg->lpx + cfg->clk_prepare + cfg->clk_zero); cycles = ps2bc(dsi, cfg->lpx + cfg->clk_prepare + cfg->clk_zero);
DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_tx_gap (pre): 0x%x\n", cycles); DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_tx_gap (pre): 0x%x\n", cycles);
cycles += ui2bc(dsi, cfg->clk_pre); cycles += ui2bc(cfg->clk_pre);
DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_t_post: 0x%x\n", cycles); DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_t_post: 0x%x\n", cycles);
nwl_dsi_write(dsi, NWL_DSI_CFG_T_POST, cycles); nwl_dsi_write(dsi, NWL_DSI_CFG_T_POST, cycles);
cycles = ps2bc(dsi, cfg->hs_exit); cycles = ps2bc(dsi, cfg->hs_exit);
......
...@@ -1569,9 +1569,17 @@ static long iio_device_buffer_getfd(struct iio_dev *indio_dev, unsigned long arg ...@@ -1569,9 +1569,17 @@ static long iio_device_buffer_getfd(struct iio_dev *indio_dev, unsigned long arg
} }
if (copy_to_user(ival, &fd, sizeof(fd))) { if (copy_to_user(ival, &fd, sizeof(fd))) {
put_unused_fd(fd); /*
ret = -EFAULT; * "Leak" the fd, as there's not much we can do about this
goto error_free_ib; * anyway. 'fd' might have been closed already, as
* anon_inode_getfd() called fd_install() on it, which made
* it reachable by userland.
*
* Instead of allowing a malicious user to play tricks with
* us, rely on the process exit path to do any necessary
* cleanup, as in releasing the file, if still needed.
*/
return -EFAULT;
} }
return 0; return 0;
......
...@@ -114,6 +114,9 @@ static ssize_t ee1004_eeprom_read(struct i2c_client *client, char *buf, ...@@ -114,6 +114,9 @@ static ssize_t ee1004_eeprom_read(struct i2c_client *client, char *buf,
if (offset + count > EE1004_PAGE_SIZE) if (offset + count > EE1004_PAGE_SIZE)
count = EE1004_PAGE_SIZE - offset; count = EE1004_PAGE_SIZE - offset;
if (count > I2C_SMBUS_BLOCK_MAX)
count = I2C_SMBUS_BLOCK_MAX;
return i2c_smbus_read_i2c_block_data_or_emulated(client, offset, count, buf); return i2c_smbus_read_i2c_block_data_or_emulated(client, offset, count, buf);
} }
......
...@@ -1288,7 +1288,14 @@ static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp) ...@@ -1288,7 +1288,14 @@ static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp)
} }
if (copy_to_user(argp, &bp, sizeof(bp))) { if (copy_to_user(argp, &bp, sizeof(bp))) {
dma_buf_put(buf->dmabuf); /*
* The usercopy failed, but we can't do much about it, as
* dma_buf_fd() already called fd_install() and made the
* file descriptor accessible for the current process. It
* might already be closed and dmabuf no longer valid when
* we reach this point. Therefore "leak" the fd and rely on
* the process exit path to do any required cleanup.
*/
return -EFAULT; return -EFAULT;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/bits.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -250,7 +251,7 @@ static int phy_meson_axg_mipi_dphy_power_on(struct phy *phy) ...@@ -250,7 +251,7 @@ static int phy_meson_axg_mipi_dphy_power_on(struct phy *phy)
(DIV_ROUND_UP(priv->config.clk_zero, temp) << 16) | (DIV_ROUND_UP(priv->config.clk_zero, temp) << 16) |
(DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24)); (DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24));
regmap_write(priv->regmap, MIPI_DSI_CLK_TIM1, regmap_write(priv->regmap, MIPI_DSI_CLK_TIM1,
DIV_ROUND_UP(priv->config.clk_pre, temp)); DIV_ROUND_UP(priv->config.clk_pre, BITS_PER_BYTE));
regmap_write(priv->regmap, MIPI_DSI_HS_TIM, regmap_write(priv->regmap, MIPI_DSI_HS_TIM,
DIV_ROUND_UP(priv->config.hs_exit, temp) | DIV_ROUND_UP(priv->config.hs_exit, temp) |
......
...@@ -97,8 +97,7 @@ config PHY_BRCM_USB ...@@ -97,8 +97,7 @@ config PHY_BRCM_USB
depends on OF depends on OF
select GENERIC_PHY select GENERIC_PHY
select SOC_BRCMSTB if ARCH_BRCMSTB select SOC_BRCMSTB if ARCH_BRCMSTB
default ARCH_BCM4908 default ARCH_BCM4908 || ARCH_BRCMSTB
default ARCH_BRCMSTB
help help
Enable this to support the Broadcom STB USB PHY. Enable this to support the Broadcom STB USB PHY.
This driver is required by the USB XHCI, EHCI and OHCI This driver is required by the USB XHCI, EHCI and OHCI
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/soc/brcmstb/brcmstb.h> #include <linux/soc/brcmstb/brcmstb.h>
#include <dt-bindings/phy/phy.h> #include <dt-bindings/phy/phy.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/suspend.h>
#include "phy-brcm-usb-init.h" #include "phy-brcm-usb-init.h"
...@@ -70,12 +71,35 @@ struct brcm_usb_phy_data { ...@@ -70,12 +71,35 @@ struct brcm_usb_phy_data {
int init_count; int init_count;
int wake_irq; int wake_irq;
struct brcm_usb_phy phys[BRCM_USB_PHY_ID_MAX]; struct brcm_usb_phy phys[BRCM_USB_PHY_ID_MAX];
struct notifier_block pm_notifier;
bool pm_active;
}; };
static s8 *node_reg_names[BRCM_REGS_MAX] = { static s8 *node_reg_names[BRCM_REGS_MAX] = {
"crtl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec" "crtl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec"
}; };
static int brcm_pm_notifier(struct notifier_block *notifier,
unsigned long pm_event,
void *unused)
{
struct brcm_usb_phy_data *priv =
container_of(notifier, struct brcm_usb_phy_data, pm_notifier);
switch (pm_event) {
case PM_HIBERNATION_PREPARE:
case PM_SUSPEND_PREPARE:
priv->pm_active = true;
break;
case PM_POST_RESTORE:
case PM_POST_HIBERNATION:
case PM_POST_SUSPEND:
priv->pm_active = false;
break;
}
return NOTIFY_DONE;
}
static irqreturn_t brcm_usb_phy_wake_isr(int irq, void *dev_id) static irqreturn_t brcm_usb_phy_wake_isr(int irq, void *dev_id)
{ {
struct phy *gphy = dev_id; struct phy *gphy = dev_id;
...@@ -91,6 +115,9 @@ static int brcm_usb_phy_init(struct phy *gphy) ...@@ -91,6 +115,9 @@ static int brcm_usb_phy_init(struct phy *gphy)
struct brcm_usb_phy_data *priv = struct brcm_usb_phy_data *priv =
container_of(phy, struct brcm_usb_phy_data, phys[phy->id]); container_of(phy, struct brcm_usb_phy_data, phys[phy->id]);
if (priv->pm_active)
return 0;
/* /*
* Use a lock to make sure a second caller waits until * Use a lock to make sure a second caller waits until
* the base phy is inited before using it. * the base phy is inited before using it.
...@@ -120,6 +147,9 @@ static int brcm_usb_phy_exit(struct phy *gphy) ...@@ -120,6 +147,9 @@ static int brcm_usb_phy_exit(struct phy *gphy)
struct brcm_usb_phy_data *priv = struct brcm_usb_phy_data *priv =
container_of(phy, struct brcm_usb_phy_data, phys[phy->id]); container_of(phy, struct brcm_usb_phy_data, phys[phy->id]);
if (priv->pm_active)
return 0;
dev_dbg(&gphy->dev, "EXIT\n"); dev_dbg(&gphy->dev, "EXIT\n");
if (phy->id == BRCM_USB_PHY_2_0) if (phy->id == BRCM_USB_PHY_2_0)
brcm_usb_uninit_eohci(&priv->ini); brcm_usb_uninit_eohci(&priv->ini);
...@@ -488,6 +518,9 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) ...@@ -488,6 +518,9 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)
if (err) if (err)
return err; return err;
priv->pm_notifier.notifier_call = brcm_pm_notifier;
register_pm_notifier(&priv->pm_notifier);
mutex_init(&priv->mutex); mutex_init(&priv->mutex);
/* make sure invert settings are correct */ /* make sure invert settings are correct */
...@@ -528,7 +561,10 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) ...@@ -528,7 +561,10 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)
static int brcm_usb_phy_remove(struct platform_device *pdev) static int brcm_usb_phy_remove(struct platform_device *pdev)
{ {
struct brcm_usb_phy_data *priv = dev_get_drvdata(&pdev->dev);
sysfs_remove_group(&pdev->dev.kobj, &brcm_usb_phy_group); sysfs_remove_group(&pdev->dev.kobj, &brcm_usb_phy_group);
unregister_pm_notifier(&priv->pm_notifier);
return 0; return 0;
} }
...@@ -539,6 +575,7 @@ static int brcm_usb_phy_suspend(struct device *dev) ...@@ -539,6 +575,7 @@ static int brcm_usb_phy_suspend(struct device *dev)
struct brcm_usb_phy_data *priv = dev_get_drvdata(dev); struct brcm_usb_phy_data *priv = dev_get_drvdata(dev);
if (priv->init_count) { if (priv->init_count) {
dev_dbg(dev, "SUSPEND\n");
priv->ini.wake_enabled = device_may_wakeup(dev); priv->ini.wake_enabled = device_may_wakeup(dev);
if (priv->phys[BRCM_USB_PHY_3_0].inited) if (priv->phys[BRCM_USB_PHY_3_0].inited)
brcm_usb_uninit_xhci(&priv->ini); brcm_usb_uninit_xhci(&priv->ini);
...@@ -578,6 +615,7 @@ static int brcm_usb_phy_resume(struct device *dev) ...@@ -578,6 +615,7 @@ static int brcm_usb_phy_resume(struct device *dev)
* Uninitialize anything that wasn't previously initialized. * Uninitialize anything that wasn't previously initialized.
*/ */
if (priv->init_count) { if (priv->init_count) {
dev_dbg(dev, "RESUME\n");
if (priv->wake_irq >= 0) if (priv->wake_irq >= 0)
disable_irq_wake(priv->wake_irq); disable_irq_wake(priv->wake_irq);
brcm_usb_init_common(&priv->ini); brcm_usb_init_common(&priv->ini);
......
...@@ -1338,7 +1338,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) ...@@ -1338,7 +1338,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct cdns_sierra_data *data; const struct cdns_sierra_data *data;
unsigned int id_value; unsigned int id_value;
int i, ret, node = 0; int ret, node = 0;
void __iomem *base; void __iomem *base;
struct device_node *dn = dev->of_node, *child; struct device_node *dn = dev->of_node, *child;
...@@ -1416,7 +1416,8 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) ...@@ -1416,7 +1416,8 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
dev_err(dev, "failed to get reset %s\n", dev_err(dev, "failed to get reset %s\n",
child->full_name); child->full_name);
ret = PTR_ERR(sp->phys[node].lnk_rst); ret = PTR_ERR(sp->phys[node].lnk_rst);
goto put_child2; of_node_put(child);
goto put_control;
} }
if (!sp->autoconf) { if (!sp->autoconf) {
...@@ -1424,7 +1425,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) ...@@ -1424,7 +1425,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(dev, "missing property in node %s\n", dev_err(dev, "missing property in node %s\n",
child->name); child->name);
goto put_child; of_node_put(child);
reset_control_put(sp->phys[node].lnk_rst);
goto put_control;
} }
} }
...@@ -1434,7 +1437,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) ...@@ -1434,7 +1437,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
if (IS_ERR(gphy)) { if (IS_ERR(gphy)) {
ret = PTR_ERR(gphy); ret = PTR_ERR(gphy);
goto put_child; of_node_put(child);
reset_control_put(sp->phys[node].lnk_rst);
goto put_control;
} }
sp->phys[node].phy = gphy; sp->phys[node].phy = gphy;
phy_set_drvdata(gphy, &sp->phys[node]); phy_set_drvdata(gphy, &sp->phys[node]);
...@@ -1446,26 +1451,28 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) ...@@ -1446,26 +1451,28 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
if (sp->num_lanes > SIERRA_MAX_LANES) { if (sp->num_lanes > SIERRA_MAX_LANES) {
ret = -EINVAL; ret = -EINVAL;
dev_err(dev, "Invalid lane configuration\n"); dev_err(dev, "Invalid lane configuration\n");
goto put_child2; goto put_control;
} }
/* If more than one subnode, configure the PHY as multilink */ /* If more than one subnode, configure the PHY as multilink */
if (!sp->autoconf && sp->nsubnodes > 1) { if (!sp->autoconf && sp->nsubnodes > 1) {
ret = cdns_sierra_phy_configure_multilink(sp); ret = cdns_sierra_phy_configure_multilink(sp);
if (ret) if (ret)
goto put_child2; goto put_control;
} }
pm_runtime_enable(dev); pm_runtime_enable(dev);
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
return PTR_ERR_OR_ZERO(phy_provider); if (IS_ERR(phy_provider)) {
ret = PTR_ERR(phy_provider);
put_child: goto put_control;
node++; }
put_child2:
for (i = 0; i < node; i++) return 0;
reset_control_put(sp->phys[i].lnk_rst);
of_node_put(child); put_control:
while (--node >= 0)
reset_control_put(sp->phys[node].lnk_rst);
clk_disable: clk_disable:
cdns_sierra_phy_disable_clocks(sp); cdns_sierra_phy_disable_clocks(sp);
reset_control_assert(sp->apb_rst); reset_control_assert(sp->apb_rst);
......
...@@ -992,7 +992,7 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc ...@@ -992,7 +992,7 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
/* no efuse, ignore it */ /* no efuse, ignore it */
if (!instance->efuse_intr && if (!instance->efuse_intr &&
!instance->efuse_rx_imp && !instance->efuse_rx_imp &&
!instance->efuse_rx_imp) { !instance->efuse_tx_imp) {
dev_warn(dev, "no u3 intr efuse, but dts enable it\n"); dev_warn(dev, "no u3 intr efuse, but dts enable it\n");
instance->efuse_sw_en = 0; instance->efuse_sw_en = 0;
break; break;
......
...@@ -36,7 +36,7 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, ...@@ -36,7 +36,7 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock,
cfg->clk_miss = 0; cfg->clk_miss = 0;
cfg->clk_post = 60000 + 52 * ui; cfg->clk_post = 60000 + 52 * ui;
cfg->clk_pre = 8000; cfg->clk_pre = 8;
cfg->clk_prepare = 38000; cfg->clk_prepare = 38000;
cfg->clk_settle = 95000; cfg->clk_settle = 95000;
cfg->clk_term_en = 0; cfg->clk_term_en = 0;
...@@ -97,7 +97,7 @@ int phy_mipi_dphy_config_validate(struct phy_configure_opts_mipi_dphy *cfg) ...@@ -97,7 +97,7 @@ int phy_mipi_dphy_config_validate(struct phy_configure_opts_mipi_dphy *cfg)
if (cfg->clk_post < (60000 + 52 * ui)) if (cfg->clk_post < (60000 + 52 * ui))
return -EINVAL; return -EINVAL;
if (cfg->clk_pre < 8000) if (cfg->clk_pre < 8)
return -EINVAL; return -EINVAL;
if (cfg->clk_prepare < 38000 || cfg->clk_prepare > 95000) if (cfg->clk_prepare < 38000 || cfg->clk_prepare > 95000)
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Author: Wyon Bi <bivvy.bi@rock-chips.com> * Author: Wyon Bi <bivvy.bi@rock-chips.com>
*/ */
#include <linux/bits.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/iopoll.h> #include <linux/iopoll.h>
...@@ -364,7 +365,7 @@ static void inno_dsidphy_mipi_mode_enable(struct inno_dsidphy *inno) ...@@ -364,7 +365,7 @@ static void inno_dsidphy_mipi_mode_enable(struct inno_dsidphy *inno)
* The value of counter for HS Tclk-pre * The value of counter for HS Tclk-pre
* Tclk-pre = Tpin_txbyteclkhs * value * Tclk-pre = Tpin_txbyteclkhs * value
*/ */
clk_pre = DIV_ROUND_UP(cfg->clk_pre, t_txbyteclkhs); clk_pre = DIV_ROUND_UP(cfg->clk_pre, BITS_PER_BYTE);
/* /*
* The value of counter for HS Tlpx Time * The value of counter for HS Tlpx Time
......
...@@ -304,7 +304,7 @@ static int stm32_usbphyc_pll_enable(struct stm32_usbphyc *usbphyc) ...@@ -304,7 +304,7 @@ static int stm32_usbphyc_pll_enable(struct stm32_usbphyc *usbphyc)
ret = __stm32_usbphyc_pll_disable(usbphyc); ret = __stm32_usbphyc_pll_disable(usbphyc);
if (ret) if (ret)
return ret; goto dec_n_pll_cons;
} }
ret = stm32_usbphyc_regulators_enable(usbphyc); ret = stm32_usbphyc_regulators_enable(usbphyc);
......
...@@ -233,6 +233,7 @@ static const struct clk_div_table clk_div_table[] = { ...@@ -233,6 +233,7 @@ static const struct clk_div_table clk_div_table[] = {
{ .val = 1, .div = 2, }, { .val = 1, .div = 2, },
{ .val = 2, .div = 4, }, { .val = 2, .div = 4, },
{ .val = 3, .div = 8, }, { .val = 3, .div = 8, },
{ /* sentinel */ },
}; };
static const struct wiz_clk_div_sel clk_div_sel[] = { static const struct wiz_clk_div_sel clk_div_sel[] = {
......
...@@ -134,7 +134,8 @@ ...@@ -134,7 +134,8 @@
#define PROT_BUS_WIDTH_10 0x0 #define PROT_BUS_WIDTH_10 0x0
#define PROT_BUS_WIDTH_20 0x1 #define PROT_BUS_WIDTH_20 0x1
#define PROT_BUS_WIDTH_40 0x2 #define PROT_BUS_WIDTH_40 0x2
#define PROT_BUS_WIDTH_SHIFT 2 #define PROT_BUS_WIDTH_SHIFT(n) ((n) * 2)
#define PROT_BUS_WIDTH_MASK(n) GENMASK((n) * 2 + 1, (n) * 2)
/* Number of GT lanes */ /* Number of GT lanes */
#define NUM_LANES 4 #define NUM_LANES 4
...@@ -445,12 +446,12 @@ static void xpsgtr_phy_init_sata(struct xpsgtr_phy *gtr_phy) ...@@ -445,12 +446,12 @@ static void xpsgtr_phy_init_sata(struct xpsgtr_phy *gtr_phy)
static void xpsgtr_phy_init_sgmii(struct xpsgtr_phy *gtr_phy) static void xpsgtr_phy_init_sgmii(struct xpsgtr_phy *gtr_phy)
{ {
struct xpsgtr_dev *gtr_dev = gtr_phy->dev; struct xpsgtr_dev *gtr_dev = gtr_phy->dev;
u32 mask = PROT_BUS_WIDTH_MASK(gtr_phy->lane);
u32 val = PROT_BUS_WIDTH_10 << PROT_BUS_WIDTH_SHIFT(gtr_phy->lane);
/* Set SGMII protocol TX and RX bus width to 10 bits. */ /* Set SGMII protocol TX and RX bus width to 10 bits. */
xpsgtr_write(gtr_dev, TX_PROT_BUS_WIDTH, xpsgtr_clr_set(gtr_dev, TX_PROT_BUS_WIDTH, mask, val);
PROT_BUS_WIDTH_10 << (gtr_phy->lane * PROT_BUS_WIDTH_SHIFT)); xpsgtr_clr_set(gtr_dev, RX_PROT_BUS_WIDTH, mask, val);
xpsgtr_write(gtr_dev, RX_PROT_BUS_WIDTH,
PROT_BUS_WIDTH_10 << (gtr_phy->lane * PROT_BUS_WIDTH_SHIFT));
xpsgtr_bypass_scrambler_8b10b(gtr_phy); xpsgtr_bypass_scrambler_8b10b(gtr_phy);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment