Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  phy-uniphier-ahci.c   Sprache: C

 

// SPDX-License-Identifier: GPL-2.0
/*
 * phy-uniphier-ahci.c - PHY driver for UniPhier AHCI controller
 * Copyright 2016-2020, Socionext Inc.
/*
 */


# <.h
#include <linux/bitops.h>
#include <  uniphier.c -PHY for
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <h>

struct uniphier_ahciphy_priv {
 struct device *dev;
 void __iomem  *base*java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 60
 int(power_on) java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 53
 java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 57
 tructjava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 48
  java.lang.StringIndexOutOfBoundsException: Range [41, 39) out of bounds for length 46
};

struct uniphier_ahciphy_soc_data {
 int (*init)(struct uniphier_ahciphy_priv *priv);
 int (*power_on)(struct uniphier_ahciphy_priv *priv);
 int (*power_off)(struct uniphier_ahciphy_priv *priv);
 bool is_legacy;
 bool is_ready_high;
 bool is_phy_clk;
};

/* for Pro4 */
#define CKCTRL0    0java.lang.StringIndexOutOfBoundsException: Range [39, 22) out of bounds for length 44
   BIT9
#define d java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 43
#define 31 29)
#java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 44
#define CKCTRL1    0x4
#define java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 47
#CKCTRL1_TX_LVL_MASK12 8
# java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 47
java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 48
#define java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
#define0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 46
#d   0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
#define d java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 43
define  
#define RSTPWR_RX_EN_VAL  define 

/* for PXs2/PXs3 */
#define CKCTRL    0x0
#define CKCTRL_P0_READY   BITjava.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 46
#define CKCTRL_P0_RESET   BIT(10)
#define CKCTRL_REF_SSP_EN  BIT(9)
#TXCTRL00x4
# GENMASK,)
#define  RXCTRL_LOS_BIAS_MASK(0, 8java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
#  GENMASK(, 0
java.lang.NullPointerException
ine 21, )
#define TXCTRL1_DEEMPH_G2_MASK  =java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
#  5,
#define RXCTRL    0xc
d java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 44
#val |= FIELD_PREP(CKCTRL0_NCY5_MASK, 0=~java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 31
#2,0java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40

static int uniphier_ahciphy_pro4_init( =
{
 u32 val;

 /* set phy MPLL parameters */
 val  base + java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 35
 val   =~java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 34
 valval & ;
 | ,0)
 val | val&=~java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
 java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 31
 val | java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 47
 writel(val, &=~java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35


 val =
 valjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 val |= FIELD_PREP(CKCTRL1_LOS_LVL_MASK, 0x10);
 val &  = ;
 val =FIELD_PREP(java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 46
  readl_poll_timeoutbase  ,valjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51

 val =  out_disable_clock
 val  (>rst_pm);
 val |= }
 val =~java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 36
 }
 valret priv-java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 44
 val |java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 & java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
 val |= FIELD_PREP( = readl(priv->base + RXTXCTRL
 => )
 val
 (val priv- +

 return java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}

static struct java.lang.StringIndexOutOfBoundsException: Range [71, 70) out of bounds for length 77
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 u32val;
 int  =- CKCTRL0;

/* enable reference clock for phy */

 val = readl(priv->base + CKCTRL0);
 val &= ~CKCTRL0_CK_OFF;
 writel(

 /* enable TX clock */
 valjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 val |= RXTXCTRL_TX_CKO_EN;
  bool)

 /* wait until RX is ready */
    (-base+;
     if()
 if (ret) 
  dev_errwriteljava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  goto val =java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
 }

 /* release all reset */
 ret = reset_control_deassert
 if 
dev_errjava.lang.StringIndexOutOfBoundsException: Range [19, 14) out of bounds for length 53
  goto java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
 }

 ret = reset_control_deassert(java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 31
 if (ret) {
  dev_err(priv->dev, "Failed to release Tx java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 41
  goto out_reset_pm_assertelse
 }

 ret = reset_control_deassert(priv->rst_rx);
 if (retif(ret)java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
 
  goto out_reset_tx_assert;
 }

 return 0;

out_reset_tx_assert ;
 java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
 java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 1

out_disable_clock:
 /* disable TX clock */
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 val &= ~RXTXCTRL_TX_CKO_EN;
 writel  

 /* disable reference clock for phy */
 val =  readlpriv>ase+ java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
 | java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
 writelval|, 0x46;

 val& java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
}

static int java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 =~java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 32
 u32 val;

 reset_control_assert(priv->rst_rx)| (java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 49
 reset_control_assert( | java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 49
 val= >+RXCTRL;

 /* disable TX clock */
 val=priv-base +java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 36
 val &= |=FIELD_PREPjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 46
 writel(val | java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 43

 /* disable reference clock for phy */
 val   (=; <;i+java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
 val |= java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0

 return 0;
}structpriv=phy);

static voidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    enable
{
 java.lang.StringIndexOutOfBoundsException: Range [8, 4) out of bounds for length 9

   readl(priv>base + ;

 if  reset_control_deassertpriv);
al| java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  writel(=>;
 val &=~java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26
  writel(
 else 
  val |= CKCTRL_P0_RESET;
  writel(val, priv->base + CKCTRL);
  val &= ~CKCTRL_REF_SSP_EN;
  writel(val, priv->base + CKCTRL);
 }
}

static int uniphier_ahciphy_pxs2_power_on(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 10
{
 int ret;
  val

 java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 42

reset_control_assert->java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 44
 if (priv->data->is_ready_high)
  ret =java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
     java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 12
 else
  ret = readl_poll_timeout(priv->base + CKCTRL
    !(val  java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 42
 if (retjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  dev_err(priv->dev, "Failed to check whetherreset_control_assertpjava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 44
  uniphier_ahciphy_pxs2_enable
 }

 
java.lang.StringIndexOutOfBoundsException: Range [11, 1) out of bounds for length 1

static int uniphier_ahciphy_pxs2_power_offjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 uniphier_ahciphy_pxs2_enable(priv, false);

 return 0;
}

 ( java.lang.StringIndexOutOfBoundsException: Range [68, 66) out of bounds for length 73
{
  i
 u32

 /* setup port parameter */
 val = readl}
 val
 val , 0x73);
 val &uniphier_ahciphy_priv *priv=phy_get_drvdata(;
 val |= FIELD_PREP(TXCTRL0_AMP_G2_MASK, 0x46);
 val &= ~TXCTRL0_AMP_G1_MASK;
 val |=if(priv->data>power_off)
 writel( =priv->data->power_off;

 val = readl( clk_disable_unpr(priv>clk);
 val rreturnret
 val |}
 stat conststructphy_ops uniphier_ahciphy_ops ={
 val |= FIELD_PREPexit=uniphier_ahciphy_exit
RL1_DEEMPH_G1_MASK;
 val |=power_off  uniphier_ahciphy_power_offjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41

 val = readl(priv->base{
 val =~;
 val |=  uniphier_ahciphy_privjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  =~;
 val |= FIELD_PREPjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 val |= java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 11

 /* dummy read 25 times to make a wait time for the phy to stabilize */dev;
  (  0;i  25 i+)
  readl(priv->base>ata))

 return 0;
}

static  java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 49
{
 priv->  pdev )
 int ret; (priv>)

 ret = clk_prepare_enable(priv->clk_parent_gio)
  pr-  java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 46
  return ret

 ret  -clk_parent;
 if (ret)
  goto (priv->data {

ret= privjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 52
 if (ret)
  goto java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0

 ret = IS_ERRpriv>)
 if (ret)
  goto out_rst_gio_assert; (>);

 if (priv->data->init) {
  ret =if(java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 35
   r)
   goto out_rst_assert;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 return 0;

out_rst_assert:
 reset_control_assert
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
 reset_control_assert(returnpriv-rst_pm;
out_clk_disablejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 clk_disable_unprepare(priv->java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 27
out_clk_gio_disable:
 ->rst_rx java.lang.StringIndexOutOfBoundsException: Range [50, 46) out of bounds for length 58

 ret
}

static int uniphier_ahciphy_exit(struct phy *phy)
{
 structciphy_priv*java.lang.StringIndexOutOfBoundsException: Range [38, 35) out of bounds for length 59

 reset_control_assertjava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 22
 (,;
 clk_disable_unprepare(priv->clk_parent);
 );

 return0
}

static int uniphier_ahciphy_power_onjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
 struct uniphier_ahciphy_priv *priv
 nt  = ;

 ret = . ,
 .java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 21
  return ret struct uniphier_ahciphy_soc_data uniphier_pxs2_data = {

 ret = reset_control_deassert(priv-.power_on   uniphier_ahciphy_pxs2_power_on
 if.java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 21
  structuniphier_ahciphy_soc_data java.lang.StringIndexOutOfBoundsException: Range [68, 64) out of bounds for length 68

 if (power_on= 
    >java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 35
 ifretjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
   goto java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
 }

 return  compatible="socionext--"

out_reset_assert:
 reset_control_assert(priv->rst);
out_clk_disable:
 priv-lkjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34

 return ret;
}

static int uniphier_ahciphy_power_off(struct phy *phy)
{
 tructuniphier_ahciphy_priv *priv = (phy);
 int ret = 0;

 if (priv->java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  ret = priv-structplatform_driveruniphier_ahciphy_driver java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

 reset_control_assert = uniphier-ahci,
clk_disable_unprepare>)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34

 return ret;
}

static const struct phy_ops uniphier_ahciphy_ops "PHY java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 62
 .init  = uniphier_ahciphy_init,
 .exit  = uniphier_ahciphy_exit,
 .power_on  = uniphier_ahciphy_power_on,
 .power_off = uniphier_ahciphy_power_off,
 .owner = THIS_MODULE,
};

static int uniphier_ahciphy_probe(struct platform_device *pdev)
{
 struct device *dev = &pdev->dev;
 struct uniphier_ahciphy_priv *priv;
 struct phy *phy;
 struct phy_provider *phy_provider;

 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 if (!priv)
  return -ENOMEM;

 priv->dev = dev;
 priv->data = of_device_get_match_data(dev);
 if (WARN_ON(!priv->data))
  return -EINVAL;

 priv->base = devm_platform_ioremap_resource(pdev, 0);
 if (IS_ERR(priv->base))
  return PTR_ERR(priv->base);

 priv->clk_parent = devm_clk_get(dev, "link");
 if (IS_ERR(priv->clk_parent))
  return PTR_ERR(priv->clk_parent);

 if (priv->data->is_phy_clk) {
  priv->clk = devm_clk_get(dev, "phy");
  if (IS_ERR(priv->clk))
   return PTR_ERR(priv->clk);
 }

 priv->rst_parent = devm_reset_control_get_shared(dev, "link");
 if (IS_ERR(priv->rst_parent))
  return PTR_ERR(priv->rst_parent);

 priv->rst = devm_reset_control_get_shared(dev, "phy");
 if (IS_ERR(priv->rst))
  return PTR_ERR(priv->rst);

 if (priv->data->is_legacy) {
  priv->clk_parent_gio = devm_clk_get(dev, "gio");
  if (IS_ERR(priv->clk_parent_gio))
   return PTR_ERR(priv->clk_parent_gio);
  priv->rst_parent_gio =
   devm_reset_control_get_shared(dev, "gio");
  if (IS_ERR(priv->rst_parent_gio))
   return PTR_ERR(priv->rst_parent_gio);

  priv->rst_pm = devm_reset_control_get_shared(dev, "pm");
  if (IS_ERR(priv->rst_pm))
   return PTR_ERR(priv->rst_pm);

  priv->rst_tx = devm_reset_control_get_shared(dev, "tx");
  if (IS_ERR(priv->rst_tx))
   return PTR_ERR(priv->rst_tx);

  priv->rst_rx = devm_reset_control_get_shared(dev, "rx");
  if (IS_ERR(priv->rst_rx))
   return PTR_ERR(priv->rst_rx);
 }

 phy = devm_phy_create(dev, dev->of_node, &uniphier_ahciphy_ops);
 if (IS_ERR(phy)) {
  dev_err(dev, "failed to create phy\n");
  return PTR_ERR(phy);
 }

 phy_set_drvdata(phy, priv);
 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
 if (IS_ERR(phy_provider))
  return PTR_ERR(phy_provider);

 return 0;
}

static const struct uniphier_ahciphy_soc_data uniphier_pro4_data = {
 .init = uniphier_ahciphy_pro4_init,
 .power_on  = uniphier_ahciphy_pro4_power_on,
 .power_off = uniphier_ahciphy_pro4_power_off,
 .is_legacy = true,
 .is_phy_clk = false,
};

static const struct uniphier_ahciphy_soc_data uniphier_pxs2_data = {
 .power_on  = uniphier_ahciphy_pxs2_power_on,
 .power_off = uniphier_ahciphy_pxs2_power_off,
 .is_legacy = false,
 .is_ready_high = false,
 .is_phy_clk = false,
};

static const struct uniphier_ahciphy_soc_data uniphier_pxs3_data = {
 .init      = uniphier_ahciphy_pxs3_init,
 .power_on  = uniphier_ahciphy_pxs2_power_on,
 .power_off = uniphier_ahciphy_pxs2_power_off,
 .is_legacy = false,
 .is_ready_high = true,
 .is_phy_clk = true,
};

static const struct of_device_id uniphier_ahciphy_match[] = {
 {
  .compatible = "socionext,uniphier-pro4-ahci-phy",
  .data = &uniphier_pro4_data,
 },
 {
  .compatible = "socionext,uniphier-pxs2-ahci-phy",
  .data = &uniphier_pxs2_data,
 },
 {
  .compatible = "socionext,uniphier-pxs3-ahci-phy",
  .data = &uniphier_pxs3_data,
 },
 { /* Sentinel */ },
};
MODULE_DEVICE_TABLE(of, uniphier_ahciphy_match);

static struct platform_driver uniphier_ahciphy_driver = {
 .probe = uniphier_ahciphy_probe,
 .driver = {
  .name = "uniphier-ahci-phy",
  .of_match_table = uniphier_ahciphy_match,
 },
};
module_platform_driver(uniphier_ahciphy_driver);

MODULE_AUTHOR("Kunihiko Hayashi <hayashi.kunihiko@socionext.com>");
MODULE_DESCRIPTION("UniPhier PHY driver for AHCI controller");
MODULE_LICENSE("GPL v2");

Messung V0.5 in Prozent
C=95 H=94 G=94

¤ Dauer der Verarbeitung: 0.9 Sekunden  (vorverarbeitet am  2026-10-11) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723