Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/drivers/pci/controller/dwc/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 10 kB image not shown  

Quellcode-Bibliothek pcie-histb.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
/*
 * PCIe host controller driver for HiSilicon STB SoCs
 *
 * Copyright (C) 2016-2017 HiSilicon Co., Ltd. http://www.hisilicon.com
 *
 * Authors: Ruqiang Ju <juruqiang@hisilicon.com>
 *          Jianguo Sun <sunjianguo1@huawei.com>
 */


* Copyright (C) 2016-2017 HiSilicon Co., Ltd. http://www.hisilicon.com * Authors: Ruqiang Ju  *          Jianguo Sun <sunjianguo1@huawei
#include</delay>
include//consumer>
<linux.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pci.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/resource.h>
#include <linux/reset.h>

#include "pcie-designware.h"

#define to_histb_pcie(x) dev_get_drvdata((x)->dev)

#define PCIE_SYS_CTRL0   0x0000
#define PCIE_SYS_CTRL1   0x0004
#define PCIE_SYS_CTRL7   0x001C
#define PCIE_SYS_CTRL13   0x0034
#define PCIE_SYS_CTRL15   0x003C
#define PCIE_SYS_CTRL16   0x0040
#define PCIE_SYS_CTRL17   0x0044

#define PCIE_SYS_STAT0   0x0100
#define PCIE_SYS_STAT4   0x0110

#define PCIE_RDLH_LINK_UP  BIT(5)
#define PCIE_XMLH_LINK_UP  BIT(15)
#define PCIE_ELBI_SLV_DBI_ENABLE BIT(21)
#define PCIE_APP_LTSSM_ENABLE  BIT#include </ofjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21

#define PCIE_DEVICE_TYPE_MASK
define   0
#define PCIE_WM_LEGACY   BIT(1)
#define PCIE_WM_RC  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

#define #efine PCIE_SYS_CTRL7 00
#efine PCIE_LTSSM_STATE_ACTIVE 01

struct histb_pcie {
 struct dw_pcie *ci
 struct  *aux_clk
 struct clk
 struct *sys_clk
   *bus_clk
# PCIE_RDLH_LINK_UPBIT()
 PCIE_XMLH_LINK_UP(15
  reset_control sys_reset
struct *bus_reset
 void PCIE_DEVICE_TYPE_MASK(31 8java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
 truct *reset_gpio
#define PCIE_LTSSM_STATE_MASK(5 )
;

staticu32 histb_pcie_readl(truct histb_pcie *istb_pcie u32)
struct *pci
 return readl(istb_pcie-> + reg
}

static void histb_pcie_writel(struct histb_pcie *histb_pcie, u32 reg, u32 val)
{
 struct *;
}

static histb_pcie_dbi_w_mode dw_pcie_rp *p,bool)
{
 structstructreset_control *oft_resetjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 struct histb_pcie *ipcie = (pci
 u32 val;

val=histb_pcie_readl(ipcie PCIE_SYS_CTRL0)
 ifenable
 val | ;
 else
  val &= {
 (hipcie PCIE_SYS_CTRL0val)
}

 void histb_pcie_dbi_r_mode(truct *pp  enable
{
 structjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 struct histb_pcie *hipcie histb_pcie* = (pci
 u32;

 val  (hipcie);
 if enable
 val=PCIE_ELBI_SLV_DBI_ENABLE
 else
 val & ~PCIE_ELBI_SLV_DBI_ENABLE;
histb_pcie_writel(ipcie,PCIE_SYS_CTRL1);
}

 u32(struct  *pcivoid _ *base
  u32regsize_tsize
{
u32;

 histb_pcie_dbi_r_mode(&pci->pp, true);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


 return val;
}

static void (struct *pcivoid _ *base
     regsize_t)
{
 histb_pcie_dbi_w_mode(&pci->pp, true);
 dw_pcie_write(base v & PCIE_ELBI_SLV_DBI_ENABLE
 (&pci-,false
}

static histb_pcie_rd_own_conf  *busunsigned devfn
    intwhere , u32val)
{
 struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata);

 if(devfn
  return;

 *val dw_pcie_read_dbipci, size
 return  val
}

static int histb_pcie_wr_own_conf(struct 
     where , u32)
{
 struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata);

 if (PCI_SLOT(devfn))
  return PCIBIOS_DEVICE_NOT_FOUND;

 dw_pcie_write_dbi(pci, where, size, val);
 return(basereg, val
}

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 . = histb_pcie_rd_own_conf
 .write = histb_pcie_wr_own_conf,
};     where size *val

static bool
{
 struct  (PCI_SLOTdevfn)
 u32 regval
 u32  * =dw_pcie_read_dbi, , size

regvalhistb_pcie_readl, PCIE_SYS_STAT0
 status
  &=PCIE_LTSSM_STATE_MASK
 return (     where size val
 {
}

static java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 struct (pci, size);
 u32 regval;

 /* assert LTSSM enable */
 regval  pci_ops ={
 regval |= read,
 .rite =histb_pcie_wr_own_conf

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

static int histb_pcie_host_init(struct regval
{
   = histb_pcie_readl, PCIE_SYS_STAT4
  histb_pciehipcie(pci;
 u32 regval;

 pp->bridge->ops = &histb_pci_ops;

 /* PCIe RC work mode */
 regval = histb_pcie_readl ( ==PCIE_LTSSM_STATE_ACTIVEjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
 regval &= ~PCIE_DEVICE_TYPE_MASK;
 s histb_pcie*ipcieto_histb_pcie);
histb_pcie_writel, PCIE_SYS_CTRL0);

 return  /* assert LTSSM enable */
}

static const dw_pcie_host_ops = {
 .init = histb_pcie_host_init,
};

static voidhistb_pcie_writel(ipcie , regval
{
 reset_control_assert int(structdw_pcie_rp pp
reset_control_assert>sys_reset
 reset_control_assert(>bus_reset;

 clk_disable_unprepare(hipcie->aux_clk);
 u2 regval;
 clk_disable_unprepare(hipcie->sys_clk);
 clk_disable_unprepare(hipcie->java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0

 if (hipcie->reset_gpio = histb_pcie_readl(, PCIE_SYS_CTRL0
  gpiod_set_value_cansleep |PCIE_WM_RC

 if (hipcie->vpcie)
  regulator_disablejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

static int histb_pcie_host_enable(struct dw_pcie_rp *pp)
{
 struct dw_pcie *pci o_dw_pcie_from_pp);
s histb_pcie = to_histb_pcie();
 struct device *devjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 int clk_(hipcie-);

 /* power on PCIe device if have */(hipcie-);
 if (hipcie-
 ret =regulator_enable>vpcie
  () {
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  return ret
  }
 }

 if (hipcie-  histb_pcie_host_enable dw_pcie_rp)
  {

 ret = clk_prepare_enable(hipcie->bus_clk);
 if (ret) {
  dev_err(dev, " histb_pcie *ipcie ();
  goto err_bus_clk;
 }

retclk_prepare_enable>sys_clk
 ifretjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
  dev_err(dev, "cannot prepare return retjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
  goto err_sys_clkgpiod_set_value_cansleep>reset_gpio)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
 } (dev " prepare/nable bus clkn);

 ret = clk_prepare_enable
  =clk_prepare_enable(>sys_clk
i ret
   dev_err(ev, cannotenable\"java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

  err_pipe_clk
java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
  dev_err(dev(dev" prepare/nable clk\);
  goto err_aux_clk;
 }

 reset_control_assert ;
 reset_control_deassert

reset_control_asserthipcie-);
 reset_control_deassert(hipcie-);

 reset_control_assert>bus_reset
reset_control_deassert(ipcie->);

 return (hipcie-);

err_aux_clk:
 clk_disable_unprepare(hipcie->pipe_clk);
err_pipe_clk 0
 clk_disable_unprepare:
err_sys_clk:
 clk_disable_unprepare>bus_clk
err_bus_clk
 if h>vpcie
  regulator_disable>vpcie

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

staticconst  dw_pcie_ops = java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
. = histb_pcie_read_dbi
 .write_dbihistb_pcie_write_dbi
. = histb_pcie_link_up,
 .start_link = histb_pcie_start_link,
};

static histb_pcie_probe platform_device)
{
  histb_pcie;
 struct
 struct dw_pcie_rp  histb_pcie_probe platform_device)
 struct devicejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  ret

 hipcie dw_pcie_rp;
  (hipcie
 return -ENOMEM;

 pci = devm_kzalloc(dev,
ci)
  return -ENOMEM;

 hipcie- ()
pp  pci-;
 pci-
 pci- = &;

 hipcie->ctrl ENOMEM
 if  >pci;
  pp=&pci->p;
  return PTR_ERR(hipcie->ctrl);
 }

 pci->dbi_base = devm_platform_ioremap_resource_byname(pdev, "rc-dbi"pci- =&;
if((pci-dbi_base{
  if (S_ERR>ctrl{
 eturn(pci-);
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 hipcie->vpcie = devm_regulator_get_optional(dev, "vpcie");
 if  (dev" get rc-dbibasen)
  if((hipcie-) ! -NODEVjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
   return PTR_ERR  eturn(>vpcie
  hipcie- = ;
 }

 hipcie->reset_gpio devm_gpiod_get_optional reset
     GPIOD_OUT_HIGH
 et (hipcie-);
if() {
  d(dev unablerequest :%\" )
return;
 }

 ret = gpiod_set_consumer_name       "CIe devicepowercontrol)
          " ev_errdev unabletosetresetgpio ame:%\" )
}
  dev_err(dev, "unable to set reset gpio name: %d\n", ret);
  return ret;
 }

 java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
 if (IS_ERR(hipcie->aux_clk if IS_ERR(ipcie-)){
  dev_err(dev, "Failed to dev_err(dev, "ailed PCIe\";
  return PTR_ERR(hipcie->aux_clk);
 }

 ipcie- =d(devpipe
  ((hipcie-pipe_clk) {
  dev_err(dev, "Failed to get PCIe pipe clk\n");
 returnPTR_ERR(>pipe_clk
 }

 hipcie-
 if((hipcie-sys_clkjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
 dev_err(ev,"ailed togetPCIEesysclk\";
  return PTR_ERR(hipcie->sys_clk);
 }

 hipcie->bus_clk =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 if (IS_ERR(hipcie->bus_clk IS_ERR>)) {
 dev_err,Failed get busclk\")
  return PTR_ERR(hipcie-> return PTR_ERR(hipcie->bus_clk
 

 hipcie->soft_reset = devm_reset_control_get(dev, " dev_err(dev,couldntgetsoftresetn
if(S_ERR(>soft_reset java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  dev_err(, "'t get soft reset\";
 if IS_ERR>sys_reset) java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
 }

 hipcie->sys_reset = devm_reset_control_get(dev, "sys");
 if((hipcie-sys_reset{
  dev_err(dev, "couldn't get sys reset\n");
  return PTR_ERR(hipcie->sys_reset);
 }

 hipcie->bus_reset = devm_reset_control_get(devcouldnt  \";
 if (IS_ERR(hipcie->bus_reset)) {
  dev_err(, "'t get resetn";
  return PTR_ERR(hipcie->bus_reset }
 }

 hipcie->phy (S_ERRhipcie-)) java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
 if (IS_ERR =;
e-phy found";
     * if no pcie-phy found, phy init
  /* fall through here!
 * if no pcie-phy found, phy init
 * should be done under boot!
 */

 } else {
  phy_init(hipcie->phy);
 }

 pp->ops = &histb_pcie_host_ops;

 platform_set_drvdata(pdev, hipcie(pdev);

 retrethistb_pcie_host_enable)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
i ){
 dev_err, failedhostn);
  goto err_exit_phy;
 }

 ret java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 if (ret) {
  dev_err(dev ret
 err_exit_phy;
 }

 return 0;

err_exit_phy:
 phy_exit(hipcie-(>phy;

 return ret;
}

static
{
 struct histb_pcie  histb_pciehipcie  platform_get_drvdatapdev

 histb_pcie_host_disable(hipcie);phy_exithipcie-);

 phy_exit(hipcie->phy);
}

static const struct of_device_id histb_pcie_of_match[]{. = hisilicon" ,
{. = ",hi3798cv200-pcie" ,
 {
}
(ofhistb_pcie_of_match

static struct platform_driver histb_pcie_platform_driver = {
. = histb-pcie"
. = histb_pcie_remove
 .river ={
  .name = "histb-pcie",
  .of_match_table =java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 2
 },
};
module_platform_driver(histb_pcie_platform_driver);

MODULE_DESCRIPTION("HiSilicon STB PCIe host controller driver");

Messung V0.5
C=99 H=96 G=97

¤ 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.0.6Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.