linux/drivers/ssb/driver_mipscore.c
<<
>>
Prefs
   1/*
   2 * Sonics Silicon Backplane
   3 * Broadcom MIPS core driver
   4 *
   5 * Copyright 2005, Broadcom Corporation
   6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
   7 *
   8 * Licensed under the GNU/GPL. See COPYING for details.
   9 */
  10
  11#include <linux/ssb/ssb.h>
  12
  13#include <linux/serial.h>
  14#include <linux/serial_core.h>
  15#include <linux/serial_reg.h>
  16#include <linux/time.h>
  17
  18#include "ssb_private.h"
  19
  20
  21static inline u32 mips_read32(struct ssb_mipscore *mcore,
  22                              u16 offset)
  23{
  24        return ssb_read32(mcore->dev, offset);
  25}
  26
  27static inline void mips_write32(struct ssb_mipscore *mcore,
  28                                u16 offset,
  29                                u32 value)
  30{
  31        ssb_write32(mcore->dev, offset, value);
  32}
  33
  34static const u32 ipsflag_irq_mask[] = {
  35        0,
  36        SSB_IPSFLAG_IRQ1,
  37        SSB_IPSFLAG_IRQ2,
  38        SSB_IPSFLAG_IRQ3,
  39        SSB_IPSFLAG_IRQ4,
  40};
  41
  42static const u32 ipsflag_irq_shift[] = {
  43        0,
  44        SSB_IPSFLAG_IRQ1_SHIFT,
  45        SSB_IPSFLAG_IRQ2_SHIFT,
  46        SSB_IPSFLAG_IRQ3_SHIFT,
  47        SSB_IPSFLAG_IRQ4_SHIFT,
  48};
  49
  50static inline u32 ssb_irqflag(struct ssb_device *dev)
  51{
  52        u32 tpsflag = ssb_read32(dev, SSB_TPSFLAG);
  53        if (tpsflag)
  54                return ssb_read32(dev, SSB_TPSFLAG) & SSB_TPSFLAG_BPFLAG;
  55        else
  56                /* not irq supported */
  57                return 0x3f;
  58}
  59
  60static struct ssb_device *find_device(struct ssb_device *rdev, int irqflag)
  61{
  62        struct ssb_bus *bus = rdev->bus;
  63        int i;
  64        for (i = 0; i < bus->nr_devices; i++) {
  65                struct ssb_device *dev;
  66                dev = &(bus->devices[i]);
  67                if (ssb_irqflag(dev) == irqflag)
  68                        return dev;
  69        }
  70        return NULL;
  71}
  72
  73/* Get the MIPS IRQ assignment for a specified device.
  74 * If unassigned, 0 is returned.
  75 * If disabled, 5 is returned.
  76 * If not supported, 6 is returned.
  77 */
  78unsigned int ssb_mips_irq(struct ssb_device *dev)
  79{
  80        struct ssb_bus *bus = dev->bus;
  81        struct ssb_device *mdev = bus->mipscore.dev;
  82        u32 irqflag;
  83        u32 ipsflag;
  84        u32 tmp;
  85        unsigned int irq;
  86
  87        irqflag = ssb_irqflag(dev);
  88        if (irqflag == 0x3f)
  89                return 6;
  90        ipsflag = ssb_read32(bus->mipscore.dev, SSB_IPSFLAG);
  91        for (irq = >ir3on>
s21 >
  v2.6.18.3
  
  
  
  
  
  [] = {

  v2.6.18.2
  
  9     93                    "+code=tpsflag" clasref">tmp;
irqflag)
  849     9         return   859     9 unsigned intrivers/ssb/driver_mipscore.c#L72" id="L72"9class="l9ne" name="L86">  869irq = >ir3on>
s21= 5lue="v2.n28
  
  
  
  
  
  ##incl11 unsigned intrivers/ssb/driver_mipscore.c#L72" id="L72"1 class="liine" name="L16">  16##incl1ef="+crivers/ssb/driver_mipscore.c#L72" id="L72"1 class="liine" name="L17">  17

  18##incl1de &qu ssb_mips_irqssb_device *dev)
irq;
  19

  201
irq;
ssb_mips_irq(struct dev);
  211stati12 struct ssb_bus *bus = dev->bus;
  12
<ssb_device *mdev = bus->mipscore.dev;
  231{
u32 irqflag = ssb_irqflag(dev);
  241     1  retuivers/ssb/driver_mipscore.c#L88" id="L88"1 class="liine" name="L25">  251}
dev);
irq;
  261
  271stati12 dev->irq = >ir3on>
s21 de=bus" class="sref">irq = >ir3on>
s2+ 2rivers/ssb/driver_mipscore.c#L88" id="L88"1 class="liine" name="L28">  281     1      ivers/ssb/driver_mipscore.c#L88" id="L88"1 class="liine" name="L29">  291     1              dcomment">/* Get the MIPSclearQ assolded */ href="drivers/ssb/driver_mipscore.c#L10" id="L10"  class="l1ine" name="L30">  301{
irq;
  311     1  ssb_write32(mdev = SSB_IPSFLAG);NTVECf="d, (~(1v2.6.="+code=bus" class="ss="sref">irqflag)
ssb_read32(mdev = SSB_IPSFLAG);NTVECf="drrdrivers/ssb/driver_mipscore.c#L88" id="L88"1 class="l1ine" name="L32">  321}
irq;
  13#i
ssb_mips_irqclear"srebus = irq;
  341stati13 retuivers/ssb/driver_mipscore.c#L88" id="L88"1 class="l1ine" name="L35">  351     1  0,
/* Get the MIPSas retQ assnew one/ href="drivers/ssb/driver_mipscore.c#L10" id="L10"  class="liine" name="L36">  361     136if (irq = >ir3on>
s21= 0lue="v2.n28
  
  
  
  [] = {

  v2.6.18.2
  
  1
u32 ipsflag oldss="sreef="+co(de=ipsflag" class="sref">ipsflag = ipsflag_irq_mask[] = {

  v2.6.18.2
  
  [] = {

  v2.6.18.2
  
  1stati14                       ssb_device *mdev = find_device(struct dev, ipsflag oldss="sreef="drivers/ssb/driver_mipscore.c#L91" id="L91"1 class="liine" name="L43">  431     143                            "+code=irqflag" claoldsref">mdev =   441     14         return ssb_mips_irqmdev =   451     14         struct   461     1  irqflag = ipsflag_irq_shift[] = {

  v2.6.18.2
  
  1     14         if (irqflag = ipsflag = ipsflag_irq_mask[] = {

  v2.6.18.2
  
  1};
ssb_write32(mdev = SSB_IPSFLAG);
irqflag)
  491
  501stati15  *ipsflag_irq_a> *ipsflag_irq_KERN);NFO="+code=ipsflag" claPFXf">ipsflag_irq_PFXretuivers/ssb/driver_mipscore.c#L88" id="L88"1 class="l1ine" name="L51">  511{
/* ef=ing"ref="dr  521     15                       dev->irqflag)
d="+code=dev" class="id="sdf">irqflag)id="sdef=",tde=irqflag" claoldsref">irq;
  531     1  if (rivers/ssb/driver_mipscore.c#L70" id="L70"1 class="l1ine" name="L54">  541     15 retuivers/ssb/driver_mipscore.c#L88" id="L88"1 class="l1ine" name="L55">  551     1  else ssb_mips_irqprint"sressb_device *dev)
irq;
  561     1      e="v2.n28
  
  
  
  
Tas originLXR Get u3meyf="dcothis expg.h thelxr@L12ux.no="+co
lxr.L12ux.no kindly hosted byQvers/ssb/http://www.redpill-L12pro.no">Redpill L12pro ASf="dcoprovider of L12uxef="+ultingsand operationsueg. href since 19 5.