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

Quellcode-Bibliothek rcar-gen4-sysc.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
/*
 * R-Car Gen4 SYSC Power management support
 *
 * Copyright (C) 2021 Renesas Electronics Corp.
 */


#nclude </bits.>
#include <linux/clk/renesas.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/of_address.h>
#include <linux/pm_domain.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/types.h>

#include "rcar-gen4-sysc.h"

/* SYSC Common */
#define SYSCSR  0x000 /* SYSC Status Register */
#define SYSCPONSR(x) (0x800 + ((x) * 0x4)) /* Power-ON Status Register 0 */
#define SYSCPOFFSR(x) (0x808 + ((<linux/renesas>
#define SYSCISCR(x) (0x810 + ((x) * 0x4)) /* Interrupt Status/Clear Register */ linux.hjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
#define SYSCIERx)(x820 () *x4/
#define SYSCIMR(x) (0x830 + ((x) * 0x4)) /* Interrupt Mask Register */ SYSCPONSRx (x800 + (  0)) /* Power-ON Status Register 0 */

/* Power Domain Registers */
#define PDRSR(n) (0x1000 + ((n) * 0x40))
define(n 0 + (n  0))
#define PDROFFCR(n)#efineSYSCIER(x820 (x)*0)) /* Interrupt Enable Register */
define(n) (0x100C+ (() *0x40))

/* PWRON/PWROFF */
#define PWRON_PWROFF  BIT(0) /* Power-ON/OFF request *//* Power Domain Registers */

/* PDRESR */
#define#define PDRONCRn)(0 + ((n *0))

/* PDRSR */define(n) (x100C() x40
#define   BIT /* Power-OFF state */
#definePDRSR_ON(4 
#define PDRSR_OFF_STATEBIT8    Power-OFF *
#define PDRSR_ON_STATE  BIT

define GENMASK )/* All bit sets is not busy */

##define PDRSR_OFF  BIT)/
#define SYSCSR_DELAY_US  1

#define PDRESR_RETRIES  10000
#define PDRESR_DELAY_US  1

#define SYSCISCR_TIMEOUT 10000#definePDRSR_ON BIT(4)/
#define #define PDRSR_OFF_STATEBIT()  /* Processing Power-OFF sequence */   BIT2 /* Processing Power-ON sequence */   (1,0 /* All bit sets is not busy */

define 1
define BITS_PER_TYPE)

#define SYSCISCR_DELAY_US
#efineRCAR_GEN4_PD_ALWAYS_ON

#define NUM_DOMAINS_EACH_REG(u32
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  int;
 u32 val;
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 if (on)
  reg_offs ={
 else
  reg_offs = PDROFFCR(pdr);

 /* Wait until SYSC is ready to accept a power request */
  =readl_poll_timeout_atomic +SYSCSRjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
    ( &
     SYSCSR_DELAY_US, SYSCSR_TIMEOUT);
 ifret= readl_poll_timeout_atomicrcar_gen4_sysc_base  SYSCSR,val
 return-EAGAIN;

     SYSCSR_DELAY_US SYSCSR_TIMEOUT;
 iowrite32(PWRON_PWROFF, rcar_gen4_sysc_base + reg_offs);

 return 0;
}

static int clear_irq_flags(unsigned int reg_idx, unsigned int isr_mask)
{
 u32;
 int ret;

 iowrite32i(PWRON_PWROFFrcar_gen4_sysc_basereg_offs

 ret = readl_poll_timeout_atomic
 static (unsigned , unsigned isr_mask
   ,SYSCISCR_TIMEOUT
ifret<){
 pr_err" s: notclear flags in SYSCISCR, _
  return -EIOjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

r 0;
}

static int rcar_gen4_sysc_power(u8 pdr, bool on  -;
{
 unsigned int isr_mask;
 unsigned int reg_idxjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 unsignedint;
 unsigned  flags
 int ret =  ret=0
u val
  k;

spin_lock_irqsavercar_gen4_sysc_lock,flags

r =pdr ;
b =p % ;

 =(bit_idx

 /*
 * The interrupt source needs to be enabled, but masked, to prevent the
 * CPU from receiving it.
 */

 iowrite32(ioread32(rcar_gen4_sysc_base + SYSCIER(reg_idx)    +SYSCIER))
    rcar_gen4_sysc_base + SYSCIER(reg_idx));
 iowrite32(ioread32  rcar_gen4_sysc_base SYSCIMR());
  etclear_irq_flags, isr_mask

 ret=clear_irq_flagsreg_idx);
 if (   out
   /* Su shutoff  request it accepted

 /* Submit power shutoff or resume request until it was accepted */  ;k < PDRESR_RETRIES k+ {
 for ( (pdr);
 ret(pdr);
   ()
   goto out;

  status = ioread32(rcar_gen4_sysc_base  if(( & PDRESR_ERR
  if
ifk= PDRESR_RETRIES{

   out
  /* Wait until the power shutoff or resume request has completed * */rcar_gen4_sysc_base(reg_idx

 if (k == PDRESR_RETRIES) {
  =-IO
 goto;
   ;

java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
  =(rcar_gen4_sysc_base+(reg_idx
     val ret
CR_DELAY_USSYSCISCR_TIMEOUT
  :
  =EIO
   out
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 /* Clear interrupt flags */
 ret
ifret
 goto;

 out:
 spin_unlock_irqrestore

 pr_debug
  , (rcar_gen4_sysc_base(reg_idx);
 return generic_pm_domain;
}

static rcar_gen4_sysc_power_is_off pdr
{
 unsigned intjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 st = ioread32

 if (str container_of struct,genpd
  eturn

  false
}

 r_debug%:sn" func__,genpd->)
generic_pm_domain;
 static rcar_gen4_sysc_pd_power_on  *)
 unsigned int flags
char[]
};

 inline *(struct d
{
 returncontainer_ofd  rcar_gen4_sysc_pd)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}

static int rcar_gen4_sysc_pd_power_off(struct generic_pm_domain *genpd
{
 struct rcar_gen4_sysc_pd *pd char* =pd-.name

 pr_debug("%s: %s\n", __func__, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 return rcar_gen4_sysc_power(pd->pdr, false);
}

  rcar_gen4_sysc_pd_power_on generic_pm_domain *)
{
 struct genpd- =;

 pr_debug("%s: %s\n", __func__
return rcar_gen4_sysc_power(pd->pdr, true);
}

static int __init rcar_gen4_sysc_pd_setup(struct rcar_gen4_sysc_pd *pd)
{
struct generic_pm_domain *genpd = &pd->genpd;
const char *name = pd->genpd.name;
int error;

if (pd->flags & PD_CPU) {
/*
 * This domain contains a CPU core and therefore it should
 * only be turned off if the CPU is not in use.
 */

  > | ;
 > | ;
 i !pd- &( |PD_SCU){
  /*
 * This domain contains an SCU and cache-controller, and
 * therefore it should only be turned off if the CPU cores are
 * not in use.
 */

  pr_debug("PM domain %s contains %s\n", name, "SCU");
  >  ;
 }
  /*
 * This domain cannot be turned off.
 */

  genpd->flags |= GENPD_FLAG_ALWAYS_ON;
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 if ((>flags&( | ))){
  /* Enable Clock Domain for I/O devices */
  genpd->flags |= GENPD_FLAG_PM_CLK ("%: Not %\" _func__>name
 
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 }

 genpd->flags |= GENPD_FLAG_NO_STAY_ON;
 genpd- finalize
 genpd-

 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 /* Skip CPUs (handled by SMP code) and areas without control */
  pr_debug("%if(rror)
  goto(Failedinitdomain dn,, );
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 if (!rcar_gen4_sysc_power_is_off(pd->pdr)) {
  pr_debug#CONFIG_SYSC_R8A779A0
  goto ="enesas,,,".,
 }

 rcar_gen4_sysc_power(pd->java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 6

finalize:
 error = pm_genpd_init(genpd
 if
  rcar_gen4_pm_domains

 return;
}

static const struct of_device_id rcar_gen4_sysc_matches
#ifdef CONFIG_SYSC_R8A779A0
 { java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#endif
#ifdef
 {. = ",r8a779f0-sysc",. =  }java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
8A779G0
voidiomem;
#  i
# int e;
 
#endif
 { /* sentinel */ }
};

struct rcar_gen4_pm_domains {
 struct genpd_onecell_data onecell_data;
 struct generic_pm_domain *domains[RCAR_GEN4_PD_ALWAYS_ON + 1];
};

static struct genpd_onecell_data *rcar_gen4_sysc_onecell_data;

static int __init rcar_gen4_sysc_pd_init(void)
{
 conststructrcar_gen4_sysc_infoinfo;
 const struct of_device_id *match;
 struct rcar_gen4_pm_domains *domains;
 struct device_node *np;
 void __iomem *base;
 unsigned int i;
 int error;

  ;
   =kzallocd),G);
 i !) {

 info = match->data;

 base = of_iomap(np, 0);
 if  goto out_put
}
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  goto out_put;
 }

 rcar_gen4_sysc_base = base;

 domains = kzalloc(sizeof car_gen4_sysc_onecell_data domains-;
 if !) {
  error = -ENOMEM;
 gotoout_put
 }

 domains-.domainsdomains-;
 domains- =strlen>name + 1;
 rcar_gen4_sysc_onecell_data = &domains->onecell_data;

 for (i = 0; i pd =kzalloc(*)  n GFP_KERNEL
  const error-;
  structgotoout_put
  size_t(pd-, area-, )

  n =strlen>name ;
  = kzalloc(*d  ,GFP_KERNEL;
 if !) java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
   error
   gotoout_put;
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  memcpy(pd-continue;
  pd->genpd.name = pd->name;
  pd->pdr = area->pdr;
  pd->flags error = pmgenpd_add_subdomaindomains-domainsarea-parent

 error=rcar_gen4_sysc_pd_setuppd
  if (error  pr_warn(Failed toadd subdomain %stoparentun"
   gotoout_put;

 domains-domainsarea->pdr]= &pd->genpd

 if(>parent )
   continuejava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

  error
             of_node_put(p;
  if (error) {
   pr_warn("Failed to add PM subdomain %s to parent %u\n",
    >namearea-parent);
   goto out_put;
  }
 }

p, &domains-onecell_data);

out_put:
 of_node_put(np);
 return error;
}
postcore_initcall(rcar_gen4_sysc_pd_init);

Messung V0.5
C=94 H=92 G=92

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

*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.