blob: 3a58eba2b33edecf061e79aae8db6ea05b1066de [file] [log] [blame]
/*
<:copyright-BRCM:2016:DUAL/GPL:standard
Broadcom Proprietary and Confidential.(c) 2016 Broadcom
All Rights Reserved
Unless you and Broadcom execute a separate written software license
agreement governing use of this software, this software is licensed
to you under the terms of the GNU General Public License version 2
(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
with the following added to such license:
As a special exception, the copyright holders of this software give
you permission to link this software with independent modules, and
to copy and distribute the resulting executable under terms of your
choice, provided that you also meet, for each linked independent
module, the terms and conditions of the license of that module.
An independent module is a module which is not derived from this
software. The special exception does not apply to any modifications
of the software.
Not withstanding the above, under no circumstances may you combine
this software in any way with any other Broadcom software provided
under a license other than the GPL, without Broadcom's express prior
written consent.
:>
*/
#ifndef _BCMOLT_BOARD_H_
#define _BCMOLT_BOARD_H_
#include <bcmos_system.h>
#include <bcmolt_model_types.h>
typedef enum
{
SVK_1 = 0x7, /* SVK #1 - BCM968620S: all PON flavors supported, SFP+ */
SVK_2_XG = 0x6, /* SVK #2 - BCM968620XG: XGPON */
SVK_2_XE = 0x5, /* SVK #2 - BCM968620XE: 10G EPON */
SVK_3 = 0x4, /* SVK #3 - BCM968620K: all PON flavors supported, XFP */
} bcm_board_svk_board_id;
bcmos_errno bcm_board_dev_change(uint32_t addr);
bcmos_errno bcm_board_dev_write(uint32_t count, uint32_t addr, uint32_t val);
bcmos_errno bcm_board_dev_read(uint32_t count, uint32_t addr, uint32_t *val);
bcmos_errno bcm_board_switch_write(uint32_t val);
bcmos_errno bcm_board_switch_read(uint32_t *val);
bcmos_errno bcm_board_fpga_write(uint32_t addr, uint32_t val);
bcmos_errno bcm_board_fpga_read(uint32_t addr, uint32_t *val);
bcmos_errno bcm_board_host_event_write(uint32_t val);
bcmos_errno bcm_board_fpga_version_get(uint32_t *version);
/* FPGA GPIO access */
typedef enum
{
BCM_FPGA_GPIO_DIR_INPUT,
BCM_FPGA_GPIO_DIR_OUTPUT,
} bcm_fpga_gpio_dir;
typedef enum
{
GPON_DPLL,
EPON_DPLL,
GPON_SYNCE
} bcm_dpll_users;
typedef struct
{
uint8_t page;
uint8_t reg;
uint8_t data;
} dpll_command;
bcmos_errno bcm_board_fpga_set_gpio_dir(bcmolt_gpio_pin gpio_pin, bcm_fpga_gpio_dir dir);
bcmos_errno bcm_board_fpga_get_gpio_dir(bcmolt_gpio_pin gpio_pin, bcm_fpga_gpio_dir *dir);
bcmos_errno bcm_board_fpga_write_gpio(bcmolt_gpio_pin gpio_pin, uint32_t val);
bcmos_errno bcm_board_fpga_read_gpio(bcmolt_gpio_pin gpio_pin, uint32_t *val);
bcmos_errno bcm_board_fpga_gen_gpio_irq(bcmolt_ext_irq ext_irq);
bcmos_errno bcm_board_trx_enable(uint8_t pon, bcmos_bool is_enabled);
bcmos_errno bcm_board_trx_present(uint8_t pon);
bcmos_errno bcm_board_device_reset(void);
bcmos_errno bcm_board_device_on(void);
bcmos_errno bcm_board_device_off(void);
bcmos_errno bcm_board_kt2_device_on(void);
bcmos_errno bcm_board_kt2_device_off(void);
bcmos_errno bcm_board_get_board_id(bcm_board_svk_board_id * board_id);
bcmos_errno bcm_board_fpga_reg_read(uint32_t reg, uint32_t *val);
bcmos_errno bcm_board_fpga_reg_write(uint32_t reg, uint32_t val);
bcmos_errno bcm_board_pci_debug(uint32_t device, uint32_t command, int32_t start, int32_t howmany, uint32_t *dumpptr);
bcmos_errno bcm_board_burn_pon_dpll(bcm_dpll_users dpll_dev);
bcmos_errno bcm_board_write_dpll(uint32_t page, uint32_t reg, uint32_t val);
bcmos_errno bcm_board_read_dpll(uint32_t page, uint32_t reg, uint32_t *val);
bcmos_errno bcm_board_init(void);
void bcm_board_uninit(void);
#endif