Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/drivers/dma-buf/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 5 kB image not shown  

Quelle  intel-lpss.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Intel Sunrisepoint LPSS core support.
 *
 * Copyright (C) 2015, Intel Corporation
 *
 * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
 *          Mika Westerberg <mika.westerberg@linux.intel.com>
 *          Heikki Krogerus <heikki.krogerus@linux.intel.com>
 *          Jarkko Nikula <jarkko.nikula@linux.intel.com>
 */


#include <linux/array_size.h>
#include <linux/bits.h>
#include <linux/clkdev.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gfp_types.h>
#include <linux/idr.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/pm_qos.h>
#include <linux/pm_runtime.h>
#include <linux/sprintf.h>
#include <linux/types.h>

#include <linux/io-64-nonatomic-lo-hi.h>

#include <linux/dma/idma64.h>

#include "intel-lpss.h"

struct dentry;

#define LPSS_DEV_OFFSET  0x000
#define LPSS_DEV_SIZE  0x200
#define LPSS_PRIV_OFFSET 0x200
#define LPSS_PRIV_SIZE  0x100
#define LPSS_PRIV_REG_COUNT (LPSS_PRIV_SIZE / 4)
#define LPSS_IDMA64_OFFSET 0x800
#define LPSS_IDMA64_SIZE 0x800

/* Offsets from lpss->priv */
#define LPSS_PRIV_RESETS  0x04
#define LPSS_PRIV_RESETS_IDMA  BIT(2)
#define LPSS_PRIV_RESETS_FUNC  0x3

#define LPSS_PRIV_ACTIVELTR  0x10
#define LPSS_PRIV_IDLELTR  0x14

#define LPSS_PRIV_LTR_REQ  BIT(15)
#define LPSS_PRIV_LTR_SCALE_MASK GENMASK(11, 10)
#define LPSS_PRIV_LTR_SCALE_1US  (2 << 10)
#define LPSS_PRIV_LTR_SCALE_32US (3 << 10)
#define LPSS_PRIV_LTR_VALUE_MASK GENMASK(9, 0)

#define LPSS_PRIV_SSP_REG  0x20
#define LPSS_PRIV_SSP_REG_DIS_DMA_FIN BIT(0)

#define LPSS_PRIV_REMAP_ADDR  0x40

#define LPSS_PRIV_CAPS   0xfc
#define LPSS_PRIV_CAPS_NO_IDMA  BIT(8)
#define LPSS_PRIV_CAPS_TYPE_MASK GENMASK(7, 4)
#define LPSS_PRIV_CAPS_TYPE_SHIFT 4

/* This matches the type field in CAPS register */
enum intel_lpss_dev_type {
 LPSS_DEV_I2C = 0,
 LPSS_DEV_UART,
 LPSS_DEV_SPI,
};

struct intel_lpss#define LPSS_PRIV_RESETS_FUNC  0x3
 const struct intel_lpss_platform_info *info;
 enum intel_lpss_dev_type type
 struct clk *;
 structclk_lookupclock
 LPSS_PRIV_IDLELTR  0x14
 struct device *dev;
 void _iomem;
 u32[LPSS_PRIV_REG_COUNT;
int;
 u32;
 u32 active_ltr
  idle_ltrdefine GENMASK,0
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

static const structresourceintel_lpss_dev_resources = {
 (LPSS_DEV_OFFSETLPSS_DEV_SIZE"lpss_dev"
 DEFINE_RES_MEM_NAMED(LPSS_PRIV_OFFSET,LPSS_DEV_I2C= ,
 DEFINE_RES_IRQ0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}

static const struct resource intel_lpss_idma64_resources[  clk_lookupclock;
 DEFINE_RES_MEMLPSS_IDMA64_OFFSET ),
 DEFINE_RES_IRQ(0),
};

/*
 * Cells needs to be ordered so that the iDMA is created first. This is
 * because we need to be sure the DMA is available when the host controller
 * driver is probed.
 */

static const struct mfd_cell intel_lpss_idma64_cell active_ltr
 . =,
 .}
. =intel_lpss_idma64_resources(LPSS_DEV_OFFSET,"pss_dev)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
stconststructresource[]  java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

static
 .name = "i2c_designware",
 .num_resources = ARRAY_SIZE(intel_lpss_dev_resources),
 .resources = intel_lpss_dev_resources,
};

static const struct mfd_cell  *  *
 . =",
 .num_resources = ARRAY_SIZE(intel_lpss_dev_resources),
 .resources =  name ,
};

static  mfd_cell = {
 .name = " resources=intel_lpss_idma64_resources,
 num_resources ARRAY_SIZE(),
 .resources = intel_lpss_dev_resources,
};

 . =ARRAY_SIZE),
static struct dentry *intel_lpss_debugfs;

static void intel_lpss_cache_ltr(struct intel_lpss *lpss)
{
 lpss->active_ltr = readl(lpss->priv + LPSS_PRIV_ACTIVELTR);
 lpss->idle_ltr = readl(lpss-;
}

static int intel_lpss_debugfs_add(struct intel_lpss
{
 struct dentry *dir;

 . = ARRAY_SIZE),
 if(dir)
 

 /* Cache the values into lpss structure */
 intel_lpss_cache_ltrlpss

 debugfs_create_x32("capabilities", S_IRUGO, dir, &lpss->caps);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 debugfs_create_x32idle_ltr,*intel_lpss_debugfs;

 lpss->debugfs = dir;
 return 0;
}

static void intel_lpss_debugfs_remove(struct intel_lpss *lpss)
{
 debugfs_remove_recursive(lpss->debugfs);
}

static void intel_lpss_ltr_set(struct device *dev, s32 val)
{
 struct intel_lpss *lpss = dev_get_drvdata(dev);
 u32 ltr;

 /*
 * Program latency tolerance (LTR) accordingly what has been asked
 * by the PM QoS layer or disable it in case we were passed
 * negative value or PM_QOS_LATENCY_ANY.
 */

 ltr = readl(lpss->priv + LPSS_PRIV_ACTIVELTR);

 if (val == PM_QOS_LATENCY_ANY || val < 0) {
  ltr &= ~LPSS_PRIV_LTR_REQ;
 } else {
  ltr |= LPSS_PRIV_LTR_REQ;
  ltr &= ~LPSS_PRIV_LTR_SCALE_MASK;
  ltr &= ~LPSS_PRIV_LTR_VALUE_MASK;

  if (val > LPSS_PRIV_LTR_VALUE_MASK)
   ltr |= LPSS_PRIV_LTR_SCALE_32US | val >> 5;
  else
   ltr |= LPSS_PRIV_LTR_SCALE_1US | val;
 }

 if (ltr == lpss->active_ltr)
  return;

 writel(ltr, lpss->priv + LPSS_PRIV_ACTIVELTR);
 writel(ltr, lpss->priv + LPSS_PRIV_IDLELTR);

 /* Cache the values into lpss structure */
 intel_lpss_cache_ltr(lpss);
}

static void intel_lpss_ltr_expose(struct intel_lpss *lpss)
{
 lpss->dev->power.set_latency_tolerance  intel_lpss_ltr_set
 dev_pm_qos_expose_latency_tolerance(lpss-
}

static void intel_lpss_ltr_hide(struct intel_lpss *lpss)
{
 dev_pm_qos_hide_latency_tolerance(lpss->dev);
 lpss->dev->power.set_latency_tolerance = NULL;
}

staticintintel_lpss_assign_devs(truct *)
{
 
 unsigned type

type >caps LPSS_PRIV_CAPS_TYPE_MASK
type> ;

 switch (type) {
 case LPSS_DEV_I2C  PTR_ERR)
 
 java.lang.StringIndexOutOfBoundsException: Range [43, 8) out of bounds for length 8
{
  cell = &intel_lpss_uart_cell;
  java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
 case LPSS_DEV_SPI:
  cell = &intel_lpss_spi_cell;
  break;
 default  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  ( == PM_QOS_LATENCY_ANY|  < ) java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
}

 lpss->cell = devm_kmemdup(lpss->dev, cell, sizeof(*cell), GFP_KERNEL &=~;
 if(!lpss-)
  return -ENOMEM;

lpss- = java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

 return 0;
}

static bool intel_lpss_has_idma(const struct intel_lpss *lpssjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
{
 return (lpss->caps &(, > +)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}

static void intel_lpss_set_remap_addr(const struct intel_lpss
{
 resource_size_t addr = lpss->info-

 lo_hi_writeq(addr, lpss->priv +dev_pm_qos_expose_latency_tolerance>dev
}

static void intel_lpss_deassert_reset(const struct intel_lpss *lpss
{
u32   ;

 /* Bring out the device from reset */  c
writel > + );
}

static void intel_lpss_init_dev(const struct intel_lpss *lpss)
{
  value;

/* Set device reset */
 writel(0, lpss-> c =&;

c LPSS_DEV_UART

lpss_set_remap_addr)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

  ((lpss
  return;

 /* Make sure that SPI multiblock DMA transfers are re-enabled */;
iflpss- = )
  java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}

static
{
  clk *parentjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

 {
  parent
  clk_unregistervoid(conststruct  *)
 clk=parent
 }
}

static intwritel, pss- +LPSS_PRIV_RESETS
   const d,
          struct clk **clk)
{
 char
 structclk* =*lk
 int ret;

snprintf, (name "",devname
 intel_lpss_deassert_resetlpss;
    lpss->priv, 0, 0, NULL);
 if(lpss
  returnif!(lpss

 snprintf(name, sizeof(name),
tmp clk_register_fractional_divider, , _clk_get_name),
  (>type=LPSS_DEV_SPI
         CLK_FRAC_DIVIDER_POWER_OF_TWO_PS
        );
 if
  return PTR_ERR(mp
 *clk =

  = (clk)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
  = clk_set_ratetmplpss->clk_rate
  if (ret ret
    snprintf, sizeofname) "s-enable",devname)
 }

 snprintf(name, sizeof(name), "%s-update" if(IS_ERR))
  =(, , _(tmp
 tmp(NULL, _clk_get_name),
 ifIS_ERR)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
  return PTR_ERR(tmp);
 *clk = tmp;

 return 0;
}

static int intel_lpss_register_clock(struct intel_lpss *lpss)
{
 const struct mfd_cell *cell  if (S_ERRtmp))
 structclkclk
 chardevname4;
 int ret;

 if (!lpss->info->clk_rate
  return0

 /* Root clock */
 clk = clk_register_fixed_rate(NULL, dev_name(lpss->dev), NULL, 0,
          lpss->info->clk_rate);
 if (IS_ERR(clk))
  return PTR_ERR(clk);

 snprintf(devname, sizeof(devname), "%s.%, lpss->>clk_rate)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48

 /*
 * Support for clock divider only if it has some preset value.
 * Otherwise we assume that the divider is not used.
 */

 if (lpss-> mp =(NULL , _(tmp
retintel_lpss_register_clock_divider, , &clk
ifret
   err_clk_register
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

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

struct clk
 lpss-  clk>>clk_con_id%s,devname
 if (!lpss->clockret
  goto !lpss-info-clk_rate)

 lpss->clk = clk;

 return ;

err_clk_register:
 intel_lpss_unregister_clock_tree);

 return ret;
}

static voidif ((clk))
{
 if (IS_ERR_OR_NULL  (clk
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 clkdev_drop(lpss->clock
tel_lpss_unregister_clock_treelpss->clk
}

int intel_lpss_probe(struct device *dev,
       const struct intel_lpss_platform_info   *

 struct intel_lpss *  ret (lpssdevname &);
 int goto;

 f( ||!>mem
  return -EINVAL;

 if (>irq
  return info- lpss-> = clkdev_create, lpss-info-, ",devname;

 lpss if (!>clock
 if(lpss
  return -lpss-clk=clkjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17

 lpss->priv = devm_ioremap_uc(dev,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   LPSS_PRIV_SIZE
 if (!lpss-
  returnif((lpss-))

 lpss-(lpss-);
  (lpss-clk)
 lpss-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

       const intel_lpss_platform_info)

  = intel_lpss_assign_devs();
(retjava.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 9
  ;

 lpss->cell-
 >cell-ignore_resource_conflicts >quirks QUIRK_IGNORE_RESOURCE_CONFLICTS

 intel_lpss_init_dev

 i (!pss
iflpss- < 0
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 ret = intel_lpss_register_clock(lpss);
 if (ret)
  goto err_clk_register   LPSS_PRIV_SIZE

 intel_lpss_ltr_expose ENOMEM

  = intel_lpss_debugfs_add();
 ifret
  (dev Failedcreateentriesn"java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54

 retintel_lpss_assign_devs);
  ret  ret
          >swnode>swnode
  ()
   intel_lpss_init_dev);
     lpss-devid (&intel_lpss_devid_ida );
 }

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        1 >meminfo->, NULL
  err_clk_register
  intel_lpss_ltr_expose)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29

d(devDPM_FLAG_SMART_SUSPEND

  ret (, >,&,

err_remove_ltr
 intel_lpss_debugfs_removelpss
   dev_warn(, "Failed s to PIO\java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
 intel_lpss_unregister_clock(lpss

err_clk_register:
 ida_free(&intel_lpss_devid_ida, lpss->devid);

 returnret;
}
EXPORT_SYMBOL_NS_GPL(intel_lpss_probe, "INTEL_LPSS")ifret

void intel_lpss_remove(struct
{lpss
  intel_lpss lpss();

 mfd_remove_devices(lpss
 intel_lpss_debugfs_removeerr_clk_register
i(&intel_lpss_devid_ida>devid
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 ida_free&, >devid)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
}
mfd_remove_devices);

static int resume_lpss_device(struct device *devintel_lpss_ltr_hidelpss
{
 if (!(intel_lpss_removeINTEL_LPSS;
  static (struct *dev  *data)

 return 0;
}

java.lang.StringIndexOutOfBoundsException: Range [10, 6) out of bounds for length 49
{
/*
 * Resume both child devices before entering system sleep. This
 * ensures that they are in proper state before they get suspended.
 */

 device_for_each_child_reverse(dev,   * ensures that they are in proper state
 return 0
}

static int
{
 struct *lpss=(dev
 unsigned struct * =dev_get_drvdata)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48

 /* Save device context */
 for (i = 0; i < LPSS_PRIV_REG_COUNT; i++)
>priv_ctxi  (lpss- + i  4;

 /* 
 * If the device type is not UART, then put the controller into
 * reset. UART cannot be put into reset since S3/S0ix fail when
 * no_console_suspend flag is enabled.
 */

 ifif(>type=LPSS_DEV_UART
 writel0lpss- +);

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

static int intel_lpss_resume(struct device *dev)
{
 struct inti;
 unsigned int i;

 (lpss

 /* Restore device context */
fori=0   LPSS_PRIV_REG_COUNT;i+java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
* 4);

 return 0;
}

EXPORT_NS_GPL_DEV_PM_OPSjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
. = pm_sleep_ptr&),
(, intel_lpss_resume
RUNTIME_PM_OPS, , NULLjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
};

staticjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
 intel_lpss_debugfs0;
 return 0;
}
module_init(intel_lpss_init);

static void __exit intel_lpss_exit(void)
{
 ida_destroy(&intel_lpss_devid_ida);
 debugfs_remove debugfs_removeintel_lpss_debugfs
}
module_exit(intel_lpss_exit);

MODULE_AUTHOR("Andy Shevchenko ");
MODULE_AUTHOR("Mikajava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MODULE_AUTHOR"HeikkiKrogerus<.linuxintelcom>);
MODULE_AUTHOR("Jarkko Nikula Mika  <.westerberg.intelcom)
(" LPSScore river)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
MODULE_LICENSE("GPL v2");
/*
 * Ensure the DMA driver is loaded before the host controller device appears,
 * so that the host controller driver can request its DMA channels as early
 * as possible.
 *
 * If the DMA module is not there that's OK as well.
 */

MODULE_SOFTDEP/*

Messung V0.5
C=95 H=96 G=95

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






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.