/* * include/linux/netip_subsystem.h * * GPL LICENSE SUMMARY * * Copyright(c) 2015-2018 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * The full GNU General Public License is included in this distribution * in the file called LICENSE.GPL. * * Contact Information: * Intel Corporation * 2200 Mission College Blvd. * Santa Clara, CA 97052 * * */ #ifndef LINUX_NETIP_SUBSYSTEM_H #define LINUX_NETIP_SUBSYSTEM_H #include #define NET_SUBSYTEM_DEV_ID 0x2BE9 #define NETIP_BRIDGE_IIR_OFFSET 0x2020 #define NETIP_BRIDGE_IER_OFFSET 0x2024 #define NETIP_BRIDGE_IMR_OFFSET 0x2028 #define NETIP_BRIDGE_ISR_OFFSET 0x202C #define NETIP_BRIDGE_IRQ_MASK 0x1FF #define NETSS_DEV_GPIO_MMIO_OFFSET (0x140000) #define NETSS_DEV_GPIO_MMIO_SIZE (0x10000) #define NETSS_DEV_HWMUTEX_MMIO_OFFSET (0x190000) #define NETSS_DEV_HWMUTEX_MMIO_SIZE (0x10000) #define NETSS_DEV_HWMBX_MMIO_OFFSET (0x1A0000) #define NETSS_DEV_HWMBX_MMIO_SIZE (0x20000) #define NETSS_DEV_PP1_MMIO_OFFSET (0x3000000) #define NETSS_DEV_PP1_MMIO_SIZE (0x1000000) #define NETSS_DEV_PP2_MMIO_OFFSET (0x9000000) #define NETSS_DEV_PP2_MMIO_SIZE (0x1000000) #define NETSS_DEV_ATOM_INTC_MMIO_OFFSET (0xE0000) #define NETSS_DEV_ATOM_INTC_MMIO_SIZE (0x10000) #define NETSS_DEV_HW_COUNTERS_MMIO_OFFSET (0x150000) #define NETSS_DEV_HW_COUNTERS_MMIO_SIZE (0x10000) #define NETSS_DEV_MOCA_MMIO_OFFSET (0xE800000) #define NETSS_DEV_MOCA_MMIO_SIZE (0x800000) #define NETSS_DEV_GBEG_MMIO_OFFSET (0x318000) #define NETSS_DEV_GBEG_MMIO_SIZE (0x6000) #define NETSS_DEV_GBE5_MMIO_OFFSET (0x314000) #define NETSS_DEV_GBE5_MMIO_SIZE (0x4000) #define NETSS_DEV_GBE4_MMIO_OFFSET (0x310000) #define NETSS_DEV_GBE4_MMIO_SIZE (0x4000) #define NETSS_DEV_GBE3_MMIO_OFFSET (0x30C000) #define NETSS_DEV_GBE3_MMIO_SIZE (0x4000) #define NETSS_DEV_GBE2_MMIO_OFFSET (0x308000) #define NETSS_DEV_GBE2_MMIO_SIZE (0x4000) #define NETSS_DEV_GBE1_MMIO_OFFSET (0x304000) #define NETSS_DEV_GBE1_MMIO_SIZE (0x4000) #define NETSS_DEV_GBE0_MMIO_OFFSET (0x300000) #define NETSS_DEV_GBE0_MMIO_SIZE (0x4000) #define NETSS_DEV_CLK_MMIO_OFFSET (0xD0000) #define NETSS_DEV_CLK_MMIO_SIZE (0x10000) #define NETSS_DEV_BOOTCFG_MMIO_OFFSET (0xC0000) #define NETSS_DEV_BOOTCFG_MMIO_SIZE (0x10000) #define NETSS_DEV_TDM_MMIO_OFFSET (0x100000) #define NETSS_DEV_TDM_MMIO_SIZE (0x100) #define NETSS_DEV_TIMER0_MMIO_OFFSET (0x30000) #define NETSS_DEV_TIMER0_MMIO_SIZE (0x100) #define NETSS_DEV_TIMER1_MMIO_OFFSET (0x110000) #define NETSS_DEV_TIMER1_MMIO_SIZE (0x100) #define NETSS_DEV_TDM1_MMIO_OFFSET (0x120000) #define NETSS_DEV_TDM1_MMIO_SIZE (0x100) #define NETSS_DEV_TIMER2_MMIO_OFFSET (0x130000) #define NETSS_DEV_TIMER2_MMIO_SIZE (0x100) #define NETSS_DEV_TDM2_MMIO_OFFSET (0x180000) #define NETSS_DEV_TDM2_MMIO_SIZE (0x100) #define NETSS_DEV_VCODEC_MMIO_OFFSET (0xF6000) #define NETSS_DEV_VCODEC_MMIO_SIZE (0x150) #define NETSS_DEV_BOOT_RAM_MMIO_OFFSET (0xFFF0000) #define NETSS_DEV_BOOT_RAM_MMIO_SIZE (0x4000) #define NETSS_DEV_CLK_CTRL_MMIO_OFFSET (0xD0000) #define NETSS_DEV_CLK_CTRL_MMIO_SIZE (0x10000) #define NETSS_DEV_BBU_CTRLR_MMIO_OFFSET (0x160000) #define NETSS_DEV_BBU_CTRLR_MMIO_SIZE (0x20000) /*128 KB */ #define NETSS_DEV_PERIPHERAL_SRAM_MMIO_OFFSET (0xFFF0000) #define NETSS_DEV_PERIPHERAL_SRAM_MMIO_SIZE (0x4000) #define NETSS_DEV_PWM_MMIO_OFFSET (0x165000) #define NETSS_DEV_PWM_MMIO_SIZE (0x10) #define NETSS_INTERUPT_ARM11_MAX (96) /*ARM11 is a bundle of 96 interrupts */ #define NETSS_DEV_BOOTCFG_BASE (0xF00C0000) #define BOOTCFG_FUSE_VALUE1_OFFSET (0x0148) #define BOOTCFG_DIS_FCC_FUSE_BIT (20) #define BOOTCFG_DIS_IPSEC_FUSE_BIT (24) #define BOOTCFG_DIS_MOCA_FUSE_BIT (35) #define BOOTCFG_FUSE_BIT_VALUE(b) !!(*(Uint32*)(IO_PHY2VIRT(NETSS_DEV_BOOTCFG_BASE + BOOTCFG_FUSE_VALUE1_OFFSET + 4*((b)>>5))) & (1<<((b)&0x1f))) typedef enum { NETSS_DEV_HW_MAILBOX = 0, NETSS_DEV_GPIO, NETSS_DEV_HW_MUTEX, NETSS_DEV_PACKET_PROCESSOR1, NETSS_DEV_PACKET_PROCESSOR2, NETSS_DEV_ATOM_INTC, NETSS_DEV_HW_COUNTERS, NETSS_DEV_MOCA, NETSS_DEV_GBE, NETSS_DEV_GBE5, NETSS_DEV_GBE4, NETSS_DEV_GBE3, NETSS_DEV_GBE2, NETSS_DEV_GBE1, NETSS_DEV_GBE0, NETSS_DEV_CLK, NETSS_DEV_CLK_CTRL, NETSS_DEV_BBU_CTRLR, NETSS_DEV_PERIPHERAL_SRAM, NETSS_DEV_BOOTCFG, NETSS_DEV_TDM, NETSS_DEV_TIMER0, NETSS_DEV_TIMER1, NETSS_DEV_TDM1, NETSS_DEV_TIMER2, NETSS_DEV_TDM2, NETSS_DEV_VCODEC, NETSS_DEV_BOOT_RAM, NETSS_DEV_PWM, NETSS_DEV_MAX }netss_dev_t; typedef enum { NETSS_INTERUPT_HWMBOX = 0, NETSS_INTERUPT_HWMUTEX, NETSS_INTERUPT_PP_WIFIPROXY1, NETSS_INTERUPT_PP_WIFIPROXY2, NETSS_INTERUPT_PP_DPIPROXY, NETSS_INTERUPT_PP_HOSTPROXY, NETSS_INTERUPT_ARM11, NETSS_INTERUPT_MOCA, NETSS_INTERUPT_GBE, NETSS_INTERUPT_MAX }netss_interrupt_t; typedef irqreturn_t (* netss_subdevice_irq_func)(int irqnum, void *); typedef struct netss_interrupt_info { netss_subdevice_irq_func func; void * args; }netss_interrupt_info_t; typedef struct netss_dev_info { unsigned long base; unsigned long size; }netss_dev_info_t; /**Enum to represent NetIP power state used to notify to the NetSS subdevice drivers */ typedef enum netss_power_state { NETSS_NETIP_POWER_STATE_ACTIVE = 0, NETSS_NETIP_POWER_STATE_OFF }netss_power_state_t; /**NetSS subdevice drivers callback function to notify and handle the NetIP power state change */ typedef int (* netss_subdevice_power_state_change_cb) (void * data, netss_power_state_t state); /**Structure defining the NetIP power state change handling callback and its argument */ typedef struct netss_power_state_callback_info { netss_subdevice_power_state_change_cb func; /**NetIP power state change handling function */ void * args; /**argument to be passed to the callback function */ } netss_power_state_callback_info_t; #define NETSS_SERVICES_MAX 13 typedef enum netss_service_id_t { NETIP_SUBSYSTEM = 0, NETSS_SERVICE_ID_DOCSIS, NETSS_SERVICE_ID_SPECTRAL_ANALYSIS, NETSS_SERVICE_ID_VIDEO, NETSS_SERVICE_ID_VOICE, NETSS_SERVICE_ID_MOCA, NETSS_SERVICE_ID_BBU, NETSS_SERVICE_ID_WIFI, NETSS_SERVICE_ID_EXSW, NETSS_SERVICE_ID_SFP, NETSS_SERVICE_ID_SGMII1_BARE, NETSS_SERVICE_ID_ETHPHY, NETSS_SERVICE_ID_RGMII3_BARE, NETSS_SERVICE_ID_SGMII0_BARE, NETSS_SERVICE_ID_RGMII2_BARE, NETSS_SERVICE_ID_MAX } netss_service_id_t; void netss_interrupt_register(netss_interrupt_t intrpt, int arm11_int_id, netss_interrupt_info_t *irq_info); bool netss_driver_ready(void); int netss_device_get_info(netss_dev_t subdevice, netss_dev_info_t *mmio); /**************************************************************************/ /*! \fn void netss_interrupt_enable(netss_interrupt_t intrpt) ************************************************************************** * \brief NetSS driver API to enable NET IP interrupts t to be seein in NET * IP bridge. This API should be only called while opening/loading * or while resuming of the respective NetIP sub device driver * module. This API should not be called from the sub device driver * ISR and if it wants to switch to polling mode and wants to do * disable/enable interrupts it should do that by disabling/enabling * its source of interrupts. * \param[in] intrpt - Enum netss_interrupt_t of NETIP interrupt. * \return void. **************************************************************************/ void netss_interrupt_enable(netss_interrupt_t intrpt); /**************************************************************************/ /*! \fn void netss_interrupt_disable(netss_interrupt_t intrpt) ************************************************************************** * \brief NetSS driver API to enable NET IP interrupts t to be seein in NET * IP bridge. This API should be only called while closing/unloading * or while suspending of the respective NetIP sub device driver * module. This API should not be called from the sub device driver * ISR and if it wants to switch to polling mode and wants to do * disable/enable interrupts it should do that by disabling/enabling * its source of interrupts. * \param[in] intrpt - Enum netss_interrupt_t of NETIP interrupt. * \return void. **************************************************************************/ void netss_interrupt_disable(netss_interrupt_t intrpt); void netss_interrupt_ack(netss_interrupt_t intrpt); unsigned int netss_subsystem_get_silicon_step(void); /**************************************************************************/ /*! \fn int netss_power_state_change_callback_register(netss_dev_t subdevice ,netss_power_state_callback_info_t *cbinfo) ************************************************************************** * \brief NetSS driver API to register/unregister callback function that * handles netip power state changes. * \param[in] subdevice - Enum of NetIP subdevice * \param[in] cbinfo - structure holding power management callback function and its argument. * \return 0, success. -1 failure if a callback is already registered for a * subdevice. **************************************************************************/ int netss_power_state_change_callback_register(netss_dev_t subdevice, netss_power_state_callback_info_t *cbinfo); int netss_request_npcpu_irq(int irq_num, const char* irq_name, netss_subdevice_irq_func func, void *args); #endif