162306a36Sopenharmony_ci/**********************************************************************
262306a36Sopenharmony_ci * Author: Cavium, Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Contact: support@cavium.com
562306a36Sopenharmony_ci *          Please include "LiquidIO" in the subject.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright (c) 2003-2016 Cavium, Inc.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * This file is free software; you can redistribute it and/or modify
1062306a36Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as
1162306a36Sopenharmony_ci * published by the Free Software Foundation.
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * This file is distributed in the hope that it will be useful, but
1462306a36Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
1562306a36Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
1662306a36Sopenharmony_ci * NONINFRINGEMENT.  See the GNU General Public License for more details.
1762306a36Sopenharmony_ci ***********************************************************************/
1862306a36Sopenharmony_ci/*! \file  cn66xx_device.h
1962306a36Sopenharmony_ci *  \brief Host Driver: Routines that perform CN66XX specific operations.
2062306a36Sopenharmony_ci */
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#ifndef __CN66XX_DEVICE_H__
2362306a36Sopenharmony_ci#define  __CN66XX_DEVICE_H__
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci/* Register address and configuration for a CN6XXX devices.
2662306a36Sopenharmony_ci * If device specific changes need to be made then add a struct to include
2762306a36Sopenharmony_ci * device specific fields as shown in the commented section
2862306a36Sopenharmony_ci */
2962306a36Sopenharmony_cistruct octeon_cn6xxx {
3062306a36Sopenharmony_ci	/** PCI interrupt summary register */
3162306a36Sopenharmony_ci	u8 __iomem *intr_sum_reg64;
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	/** PCI interrupt enable register */
3462306a36Sopenharmony_ci	u8 __iomem *intr_enb_reg64;
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	/** The PCI interrupt mask used by interrupt handler */
3762306a36Sopenharmony_ci	u64 intr_mask64;
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci	struct octeon_config *conf;
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	/* Example additional fields - not used currently
4262306a36Sopenharmony_ci	 *  struct {
4362306a36Sopenharmony_ci	 *  }cn6xyz;
4462306a36Sopenharmony_ci	 */
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci	/* For the purpose of atomic access to interrupt enable reg */
4762306a36Sopenharmony_ci	spinlock_t lock_for_droq_int_enb_reg;
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cienum octeon_pcie_mps {
5262306a36Sopenharmony_ci	PCIE_MPS_DEFAULT = -1,	/* Use the default setup by BIOS */
5362306a36Sopenharmony_ci	PCIE_MPS_128B = 0,
5462306a36Sopenharmony_ci	PCIE_MPS_256B = 1
5562306a36Sopenharmony_ci};
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cienum octeon_pcie_mrrs {
5862306a36Sopenharmony_ci	PCIE_MRRS_DEFAULT = -1,	/* Use the default setup by BIOS */
5962306a36Sopenharmony_ci	PCIE_MRRS_128B = 0,
6062306a36Sopenharmony_ci	PCIE_MRRS_256B = 1,
6162306a36Sopenharmony_ci	PCIE_MRRS_512B = 2,
6262306a36Sopenharmony_ci	PCIE_MRRS_1024B = 3,
6362306a36Sopenharmony_ci	PCIE_MRRS_2048B = 4,
6462306a36Sopenharmony_ci	PCIE_MRRS_4096B = 5
6562306a36Sopenharmony_ci};
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/* Common functions for 66xx and 68xx */
6862306a36Sopenharmony_ciint lio_cn6xxx_soft_reset(struct octeon_device *oct);
6962306a36Sopenharmony_civoid lio_cn6xxx_enable_error_reporting(struct octeon_device *oct);
7062306a36Sopenharmony_civoid lio_cn6xxx_setup_pcie_mps(struct octeon_device *oct,
7162306a36Sopenharmony_ci			       enum octeon_pcie_mps mps);
7262306a36Sopenharmony_civoid lio_cn6xxx_setup_pcie_mrrs(struct octeon_device *oct,
7362306a36Sopenharmony_ci				enum octeon_pcie_mrrs mrrs);
7462306a36Sopenharmony_civoid lio_cn6xxx_setup_global_input_regs(struct octeon_device *oct);
7562306a36Sopenharmony_civoid lio_cn6xxx_setup_global_output_regs(struct octeon_device *oct);
7662306a36Sopenharmony_civoid lio_cn6xxx_setup_iq_regs(struct octeon_device *oct, u32 iq_no);
7762306a36Sopenharmony_civoid lio_cn6xxx_setup_oq_regs(struct octeon_device *oct, u32 oq_no);
7862306a36Sopenharmony_ciint lio_cn6xxx_enable_io_queues(struct octeon_device *oct);
7962306a36Sopenharmony_civoid lio_cn6xxx_disable_io_queues(struct octeon_device *oct);
8062306a36Sopenharmony_ciirqreturn_t lio_cn6xxx_process_interrupt_regs(void *dev);
8162306a36Sopenharmony_civoid lio_cn6xxx_bar1_idx_setup(struct octeon_device *oct, u64 core_addr,
8262306a36Sopenharmony_ci			       u32 idx, int valid);
8362306a36Sopenharmony_civoid lio_cn6xxx_bar1_idx_write(struct octeon_device *oct, u32 idx, u32 mask);
8462306a36Sopenharmony_ciu32 lio_cn6xxx_bar1_idx_read(struct octeon_device *oct, u32 idx);
8562306a36Sopenharmony_ciu32
8662306a36Sopenharmony_cilio_cn6xxx_update_read_index(struct octeon_instr_queue *iq);
8762306a36Sopenharmony_civoid lio_cn6xxx_enable_interrupt(struct octeon_device *oct, u8 unused);
8862306a36Sopenharmony_civoid lio_cn6xxx_disable_interrupt(struct octeon_device *oct, u8 unused);
8962306a36Sopenharmony_civoid cn6xxx_get_pcie_qlmport(struct octeon_device *oct);
9062306a36Sopenharmony_civoid lio_cn6xxx_setup_reg_address(struct octeon_device *oct, void *chip,
9162306a36Sopenharmony_ci				  struct octeon_reg_list *reg_list);
9262306a36Sopenharmony_ciu32 lio_cn6xxx_coprocessor_clock(struct octeon_device *oct);
9362306a36Sopenharmony_ciu32 lio_cn6xxx_get_oq_ticks(struct octeon_device *oct, u32 time_intr_in_us);
9462306a36Sopenharmony_ciint lio_setup_cn66xx_octeon_device(struct octeon_device *oct);
9562306a36Sopenharmony_ciint lio_validate_cn6xxx_config_info(struct octeon_device *oct,
9662306a36Sopenharmony_ci				    struct octeon_config *conf6xxx);
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci#endif
99