Lines Matching refs:octeon_dev
3344 static int setup_nic_devices(struct octeon_device *octeon_dev) in setup_nic_devices() argument
3366 octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC, in setup_nic_devices()
3368 lio_nic_info, octeon_dev); in setup_nic_devices()
3373 octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_NORESP_NET, in setup_nic_devices()
3376 octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_NORESP_NET_SG, in setup_nic_devices()
3379 octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_RESP_NET_SG, in setup_nic_devices()
3382 for (i = 0; i < octeon_dev->ifcount; i++) { in setup_nic_devices()
3386 octeon_alloc_soft_command(octeon_dev, data_size, in setup_nic_devices()
3396 if (OCTEON_CN23XX_PF(octeon_dev)) { in setup_nic_devices()
3397 num_iqueues = octeon_dev->sriov_info.num_pf_rings; in setup_nic_devices()
3398 num_oqueues = octeon_dev->sriov_info.num_pf_rings; in setup_nic_devices()
3399 base_queue = octeon_dev->sriov_info.pf_srn; in setup_nic_devices()
3401 gmx_port_id = octeon_dev->pf_num; in setup_nic_devices()
3402 ifidx_or_pfnum = octeon_dev->pf_num; in setup_nic_devices()
3405 octeon_get_conf(octeon_dev), i); in setup_nic_devices()
3407 octeon_get_conf(octeon_dev), i); in setup_nic_devices()
3409 octeon_get_conf(octeon_dev), i); in setup_nic_devices()
3411 octeon_get_conf(octeon_dev), i); in setup_nic_devices()
3415 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3427 octeon_prepare_soft_command(octeon_dev, sc, OPCODE_NIC, in setup_nic_devices()
3434 retval = octeon_send_soft_command(octeon_dev, sc); in setup_nic_devices()
3436 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3440 octeon_free_soft_command(octeon_dev, sc); in setup_nic_devices()
3447 retval = wait_for_sc_completion_timeout(octeon_dev, sc, 0); in setup_nic_devices()
3453 dev_err(&octeon_dev->pci_dev->dev, "iq/oq config failed\n"); in setup_nic_devices()
3457 snprintf(octeon_dev->fw_info.liquidio_firmware_version, in setup_nic_devices()
3462 fw_ver = octeon_dev->fw_info.liquidio_firmware_version; in setup_nic_devices()
3466 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3471 } else if (atomic_read(octeon_dev->adapter_fw_state) == in setup_nic_devices()
3473 dev_info(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3482 octeon_dev->fw_info.ver.maj = LIQUIDIO_BASE_MAJOR_VERSION; in setup_nic_devices()
3483 octeon_dev->fw_info.ver.min = LIQUIDIO_BASE_MINOR_VERSION; in setup_nic_devices()
3484 octeon_dev->fw_info.ver.rev = micro; in setup_nic_devices()
3493 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3501 if (OCTEON_CN6XXX(octeon_dev)) { in setup_nic_devices()
3502 max_num_queues = CFG_GET_IQ_MAX_Q(CHIP_CONF(octeon_dev, in setup_nic_devices()
3504 } else if (OCTEON_CN23XX_PF(octeon_dev)) { in setup_nic_devices()
3505 max_num_queues = CFG_GET_IQ_MAX_Q(CHIP_CONF(octeon_dev, in setup_nic_devices()
3509 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3516 dev_err(&octeon_dev->pci_dev->dev, "Device allocation failed\n"); in setup_nic_devices()
3521 SET_NETDEV_DEV(netdev, &octeon_dev->pci_dev->dev); in setup_nic_devices()
3530 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3538 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3550 props = &octeon_dev->props[i]; in setup_nic_devices()
3572 if (OCTEON_CN23XX_PF(octeon_dev) || in setup_nic_devices()
3573 OCTEON_CN6XXX(octeon_dev)) { in setup_nic_devices()
3622 lio->oct_dev = octeon_dev; in setup_nic_devices()
3626 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3630 for (j = 0; j < octeon_dev->sriov_info.max_vfs; j++) { in setup_nic_devices()
3635 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3656 if (liquidio_setup_io_queues(octeon_dev, i, in setup_nic_devices()
3659 dev_err(&octeon_dev->pci_dev->dev, "I/O queues creation failed\n"); in setup_nic_devices()
3665 lio->tx_qsize = octeon_get_tx_qsize(octeon_dev, lio->txq); in setup_nic_devices()
3666 lio->rx_qsize = octeon_get_rx_qsize(octeon_dev, lio->rxq); in setup_nic_devices()
3668 if (lio_setup_glists(octeon_dev, lio, num_iqueues)) { in setup_nic_devices()
3669 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3677 octeon_dev->priv_flags = OCT_PRIV_FLAG_DEFAULT; in setup_nic_devices()
3679 octeon_dev->priv_flags = 0x0; in setup_nic_devices()
3695 if ((octeon_dev->fw_info.app_cap_flags & in setup_nic_devices()
3705 dev_err(&octeon_dev->pci_dev->dev, "Device registration failed\n"); in setup_nic_devices()
3709 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3726 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3729 if (octeon_dev->subsystem_id == in setup_nic_devices()
3731 octeon_dev->subsystem_id == in setup_nic_devices()
3733 cur_ver = OCT_FW_VER(octeon_dev->fw_info.ver.maj, in setup_nic_devices()
3734 octeon_dev->fw_info.ver.min, in setup_nic_devices()
3735 octeon_dev->fw_info.ver.rev); in setup_nic_devices()
3739 dev_info(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3741 octeon_dev->speed_setting = 25; in setup_nic_devices()
3742 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3747 if (octeon_dev->speed_setting == 0) { in setup_nic_devices()
3748 octeon_dev->speed_setting = 25; in setup_nic_devices()
3749 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3752 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3753 octeon_dev->speed_setting = 10; in setup_nic_devices()
3755 octeon_dev->speed_boot = octeon_dev->speed_setting; in setup_nic_devices()
3758 if (octeon_dev->speed_boot == 25 && in setup_nic_devices()
3759 !octeon_dev->no_speed_setting) { in setup_nic_devices()
3761 octeon_dev->props[lio->ifidx].fec_boot = in setup_nic_devices()
3762 octeon_dev->props[lio->ifidx].fec; in setup_nic_devices()
3766 device_lock(&octeon_dev->pci_dev->dev); in setup_nic_devices()
3769 &octeon_dev->pci_dev->dev); in setup_nic_devices()
3771 device_unlock(&octeon_dev->pci_dev->dev); in setup_nic_devices()
3772 dev_err(&octeon_dev->pci_dev->dev, "devlink alloc failed\n"); in setup_nic_devices()
3777 lio_devlink->oct = octeon_dev; in setup_nic_devices()
3779 octeon_dev->devlink = devlink; in setup_nic_devices()
3780 octeon_dev->eswitch_mode = DEVLINK_ESWITCH_MODE_LEGACY; in setup_nic_devices()
3782 device_unlock(&octeon_dev->pci_dev->dev); in setup_nic_devices()
3789 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3791 liquidio_destroy_nic_device(octeon_dev, i); in setup_nic_devices()
4055 static int octeon_device_init(struct octeon_device *octeon_dev) in octeon_device_init() argument
4062 (struct octeon_device_priv *)octeon_dev->priv; in octeon_device_init()
4063 atomic_set(&octeon_dev->status, OCT_DEV_BEGIN_STATE); in octeon_device_init()
4068 if (octeon_pci_os_setup(octeon_dev)) in octeon_device_init()
4071 atomic_set(&octeon_dev->status, OCT_DEV_PCI_ENABLE_DONE); in octeon_device_init()
4074 if (octeon_chip_specific_setup(octeon_dev)) { in octeon_device_init()
4075 dev_err(&octeon_dev->pci_dev->dev, "Chip specific setup failed\n"); in octeon_device_init()
4079 atomic_set(&octeon_dev->status, OCT_DEV_PCI_MAP_DONE); in octeon_device_init()
4085 octeon_register_device(octeon_dev, octeon_dev->pci_dev->bus->number, in octeon_device_init()
4086 PCI_SLOT(octeon_dev->pci_dev->devfn), in octeon_device_init()
4087 PCI_FUNC(octeon_dev->pci_dev->devfn), in octeon_device_init()
4090 octeon_dev->app_mode = CVM_DRV_INVALID_APP; in octeon_device_init()
4099 if (OCTEON_CN23XX_PF(octeon_dev) && in octeon_device_init()
4100 cn23xx_fw_loaded(octeon_dev) && fw_type_is_auto()) { in octeon_device_init()
4101 atomic_cmpxchg(octeon_dev->adapter_fw_state, in octeon_device_init()
4106 fw_state = atomic_cmpxchg(octeon_dev->adapter_fw_state, in octeon_device_init()
4123 if (octeon_dev->fn_list.soft_reset(octeon_dev)) in octeon_device_init()
4129 if (octeon_init_dispatch_list(octeon_dev)) in octeon_device_init()
4132 octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC, in octeon_device_init()
4135 octeon_dev); in octeon_device_init()
4137 octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC, in octeon_device_init()
4139 octeon_recv_vf_drv_notice, octeon_dev); in octeon_device_init()
4140 INIT_DELAYED_WORK(&octeon_dev->nic_poll_work.work, nic_starter); in octeon_device_init()
4141 octeon_dev->nic_poll_work.ctxptr = (void *)octeon_dev; in octeon_device_init()
4142 schedule_delayed_work(&octeon_dev->nic_poll_work.work, in octeon_device_init()
4145 atomic_set(&octeon_dev->status, OCT_DEV_DISPATCH_INIT_DONE); in octeon_device_init()
4147 if (octeon_set_io_queues_off(octeon_dev)) { in octeon_device_init()
4148 dev_err(&octeon_dev->pci_dev->dev, "setting io queues off failed\n"); in octeon_device_init()
4152 if (OCTEON_CN23XX_PF(octeon_dev)) { in octeon_device_init()
4153 ret = octeon_dev->fn_list.setup_device_regs(octeon_dev); in octeon_device_init()
4155 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: Failed to configure device registers\n"); in octeon_device_init()
4162 if (octeon_setup_sc_buffer_pool(octeon_dev)) { in octeon_device_init()
4163 dev_err(&octeon_dev->pci_dev->dev, "sc buffer pool allocation failed\n"); in octeon_device_init()
4166 atomic_set(&octeon_dev->status, OCT_DEV_SC_BUFF_POOL_INIT_DONE); in octeon_device_init()
4169 if (octeon_setup_instr_queues(octeon_dev)) { in octeon_device_init()
4170 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4174 atomic_set(&octeon_dev->status, OCT_DEV_INSTR_QUEUE_INIT_DONE); in octeon_device_init()
4179 if (octeon_setup_response_list(octeon_dev)) { in octeon_device_init()
4180 dev_err(&octeon_dev->pci_dev->dev, "Response list allocation failed\n"); in octeon_device_init()
4183 atomic_set(&octeon_dev->status, OCT_DEV_RESP_LIST_INIT_DONE); in octeon_device_init()
4185 if (octeon_setup_output_queues(octeon_dev)) { in octeon_device_init()
4186 dev_err(&octeon_dev->pci_dev->dev, "Output queue initialization failed\n"); in octeon_device_init()
4190 atomic_set(&octeon_dev->status, OCT_DEV_DROQ_INIT_DONE); in octeon_device_init()
4192 if (OCTEON_CN23XX_PF(octeon_dev)) { in octeon_device_init()
4193 if (octeon_dev->fn_list.setup_mbox(octeon_dev)) { in octeon_device_init()
4194 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: Mailbox setup failed\n"); in octeon_device_init()
4197 atomic_set(&octeon_dev->status, OCT_DEV_MBOX_SETUP_DONE); in octeon_device_init()
4200 (octeon_dev, in octeon_device_init()
4201 octeon_dev->sriov_info.num_pf_rings)) { in octeon_device_init()
4202 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: ioq vector allocation failed\n"); in octeon_device_init()
4205 atomic_set(&octeon_dev->status, OCT_DEV_MSIX_ALLOC_VECTOR_DONE); in octeon_device_init()
4212 ret = octeon_dev->fn_list.setup_device_regs(octeon_dev); in octeon_device_init()
4214 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4221 dev_dbg(&octeon_dev->pci_dev->dev, "Initializing droq tasklet\n"); in octeon_device_init()
4226 if (octeon_setup_interrupt(octeon_dev, in octeon_device_init()
4227 octeon_dev->sriov_info.num_pf_rings)) in octeon_device_init()
4231 octeon_dev->fn_list.enable_interrupt(octeon_dev, OCTEON_ALL_INTR); in octeon_device_init()
4233 atomic_set(&octeon_dev->status, OCT_DEV_INTR_SET_DONE); in octeon_device_init()
4243 for (j = 0; j < octeon_dev->num_oqs; j++) in octeon_device_init()
4244 writel(octeon_dev->droq[j]->max_count, in octeon_device_init()
4245 octeon_dev->droq[j]->pkts_credit_reg); in octeon_device_init()
4248 ret = octeon_dev->fn_list.enable_io_queues(octeon_dev); in octeon_device_init()
4250 dev_err(&octeon_dev->pci_dev->dev, "Failed to enable input/output queues"); in octeon_device_init()
4254 atomic_set(&octeon_dev->status, OCT_DEV_IO_QUEUES_DONE); in octeon_device_init()
4257 dev_dbg(&octeon_dev->pci_dev->dev, "Waiting for DDR initialization...\n"); in octeon_device_init()
4259 dev_info(&octeon_dev->pci_dev->dev, in octeon_device_init()
4273 ret = octeon_wait_for_ddr_init(octeon_dev, &ddr_timeout); in octeon_device_init()
4275 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4281 if (octeon_wait_for_bootloader(octeon_dev, 1000)) { in octeon_device_init()
4282 dev_err(&octeon_dev->pci_dev->dev, "Board not responding\n"); in octeon_device_init()
4287 ret = octeon_console_send_cmd(octeon_dev, bootcmd, 50); in octeon_device_init()
4289 dev_dbg(&octeon_dev->pci_dev->dev, "Initializing consoles\n"); in octeon_device_init()
4290 ret = octeon_init_consoles(octeon_dev); in octeon_device_init()
4292 dev_err(&octeon_dev->pci_dev->dev, "Could not access board consoles\n"); in octeon_device_init()
4299 ret = octeon_add_console(octeon_dev, 0, dbg_enb); in octeon_device_init()
4301 dev_err(&octeon_dev->pci_dev->dev, "Could not access board console\n"); in octeon_device_init()
4307 octeon_dev->console[0].print = octeon_dbg_console_print; in octeon_device_init()
4310 atomic_set(&octeon_dev->status, OCT_DEV_CONSOLE_INIT_DONE); in octeon_device_init()
4312 dev_dbg(&octeon_dev->pci_dev->dev, "Loading firmware\n"); in octeon_device_init()
4313 ret = load_firmware(octeon_dev); in octeon_device_init()
4315 dev_err(&octeon_dev->pci_dev->dev, "Could not load firmware to board\n"); in octeon_device_init()
4319 atomic_set(octeon_dev->adapter_fw_state, FW_HAS_BEEN_LOADED); in octeon_device_init()
4322 handshake[octeon_dev->octeon_id].init_ok = 1; in octeon_device_init()
4323 complete(&handshake[octeon_dev->octeon_id].init); in octeon_device_init()
4325 atomic_set(&octeon_dev->status, OCT_DEV_HOST_OK); in octeon_device_init()
4326 oct_priv->dev = octeon_dev; in octeon_device_init()