openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

shbde.h (2326B)


      1 /*
      2  * Copyright 2017 Broadcom
      3  * 
      4  * This program is free software; you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License, version 2, as
      6  * published by the Free Software Foundation (the "GPL").
      7  * 
      8  * This program is distributed in the hope that it will be useful, but
      9  * WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     11  * General Public License version 2 (GPLv2) for more details.
     12  * 
     13  * You should have received a copy of the GNU General Public License
     14  * version 2 (GPLv2) along with this source code.
     15  */
     16 /*
     17  * $Id: $
     18  * $Copyright: (c) 2014 Broadcom Corp.
     19  * All Rights Reserved.$
     20  *
     21  */
     22 
     23 #ifndef __SHBDE_H__
     24 #define __SHBDE_H__
     25 
     26 typedef void (*shbde_log_func_t)(int level, const char *str, int param);
     27 
     28 #define SHBDE_ERR       0
     29 #define SHBDE_WARN      1
     30 #define SHBDE_DBG       2
     31 
     32 /* iProc configuration (primarily used for PCI-AXI bridge) */
     33 typedef struct shbde_iproc_config_s {
     34     unsigned int dev_id;
     35     unsigned int dev_rev;
     36     unsigned int use_msi;
     37     unsigned int iproc_ver;
     38     unsigned int cmic_ver;
     39     unsigned int cmic_rev;
     40     unsigned int dma_hi_bits;
     41     unsigned int mdio_base_addr;
     42     unsigned int pcie_phy_addr;
     43     unsigned int adjust_pcie_preemphasis;
     44 } shbde_iproc_config_t;
     45 
     46 /* Hardware abstraction functions */
     47 typedef struct shbde_hal_s {
     48 
     49     /* Optional log output interface */
     50     shbde_log_func_t log_func;
     51 
     52     /* PCI configuration access */
     53     unsigned char (*pcic8_read)(void *pci_dev, unsigned int reg);
     54     void (*pcic8_write)(void *pci_dev, unsigned int reg, unsigned char data);
     55     unsigned short (*pcic16_read)(void *pci_dev, unsigned int reg);
     56     void (*pcic16_write)(void *pci_dev, unsigned int reg, unsigned short data);
     57     unsigned int (*pcic32_read)(void *pci_dev, unsigned int reg);
     58     void (*pcic32_write)(void *pci_dev, unsigned int reg, unsigned int data);
     59 
     60     /* iProc register access */
     61     unsigned int (*io32_read)(void *addr);
     62     void (*io32_write)(void *addr, unsigned int);
     63 
     64     /* usleep function (optional) */
     65     void (*usleep)(int usec);
     66 
     67     /* PCI parent device access */
     68     void *(*pci_parent_device_get)(void *pci_dev);
     69 
     70     /* iProc configuration */
     71     shbde_iproc_config_t icfg;
     72 
     73 } shbde_hal_t;
     74 
     75 
     76 #endif /* __SHBDE_H__ */