Lines Matching refs:octeon_dev

3341 static int setup_nic_devices(struct octeon_device *octeon_dev)  in setup_nic_devices()  argument
3363 octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC, in setup_nic_devices()
3365 lio_nic_info, octeon_dev); in setup_nic_devices()
3370 octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_NORESP_NET, in setup_nic_devices()
3373 octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_NORESP_NET_SG, in setup_nic_devices()
3376 octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_RESP_NET_SG, in setup_nic_devices()
3379 for (i = 0; i < octeon_dev->ifcount; i++) { in setup_nic_devices()
3383 octeon_alloc_soft_command(octeon_dev, data_size, in setup_nic_devices()
3393 if (OCTEON_CN23XX_PF(octeon_dev)) { in setup_nic_devices()
3394 num_iqueues = octeon_dev->sriov_info.num_pf_rings; in setup_nic_devices()
3395 num_oqueues = octeon_dev->sriov_info.num_pf_rings; in setup_nic_devices()
3396 base_queue = octeon_dev->sriov_info.pf_srn; in setup_nic_devices()
3398 gmx_port_id = octeon_dev->pf_num; in setup_nic_devices()
3399 ifidx_or_pfnum = octeon_dev->pf_num; in setup_nic_devices()
3402 octeon_get_conf(octeon_dev), i); in setup_nic_devices()
3404 octeon_get_conf(octeon_dev), i); in setup_nic_devices()
3406 octeon_get_conf(octeon_dev), i); in setup_nic_devices()
3408 octeon_get_conf(octeon_dev), i); in setup_nic_devices()
3412 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3424 octeon_prepare_soft_command(octeon_dev, sc, OPCODE_NIC, in setup_nic_devices()
3431 retval = octeon_send_soft_command(octeon_dev, sc); in setup_nic_devices()
3433 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3437 octeon_free_soft_command(octeon_dev, sc); in setup_nic_devices()
3444 retval = wait_for_sc_completion_timeout(octeon_dev, sc, 0); in setup_nic_devices()
3450 dev_err(&octeon_dev->pci_dev->dev, "iq/oq config failed\n"); in setup_nic_devices()
3454 snprintf(octeon_dev->fw_info.liquidio_firmware_version, in setup_nic_devices()
3459 fw_ver = octeon_dev->fw_info.liquidio_firmware_version; in setup_nic_devices()
3463 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3468 } else if (atomic_read(octeon_dev->adapter_fw_state) == in setup_nic_devices()
3470 dev_info(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3479 octeon_dev->fw_info.ver.maj = LIQUIDIO_BASE_MAJOR_VERSION; in setup_nic_devices()
3480 octeon_dev->fw_info.ver.min = LIQUIDIO_BASE_MINOR_VERSION; in setup_nic_devices()
3481 octeon_dev->fw_info.ver.rev = micro; in setup_nic_devices()
3490 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3498 if (OCTEON_CN6XXX(octeon_dev)) { in setup_nic_devices()
3499 max_num_queues = CFG_GET_IQ_MAX_Q(CHIP_CONF(octeon_dev, in setup_nic_devices()
3501 } else if (OCTEON_CN23XX_PF(octeon_dev)) { in setup_nic_devices()
3502 max_num_queues = CFG_GET_IQ_MAX_Q(CHIP_CONF(octeon_dev, in setup_nic_devices()
3506 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3513 dev_err(&octeon_dev->pci_dev->dev, "Device allocation failed\n"); in setup_nic_devices()
3518 SET_NETDEV_DEV(netdev, &octeon_dev->pci_dev->dev); in setup_nic_devices()
3527 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3535 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3547 props = &octeon_dev->props[i]; in setup_nic_devices()
3569 if (OCTEON_CN23XX_PF(octeon_dev) || in setup_nic_devices()
3570 OCTEON_CN6XXX(octeon_dev)) { in setup_nic_devices()
3619 lio->oct_dev = octeon_dev; in setup_nic_devices()
3623 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3627 for (j = 0; j < octeon_dev->sriov_info.max_vfs; j++) { in setup_nic_devices()
3632 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3653 if (liquidio_setup_io_queues(octeon_dev, i, in setup_nic_devices()
3656 dev_err(&octeon_dev->pci_dev->dev, "I/O queues creation failed\n"); in setup_nic_devices()
3662 lio->tx_qsize = octeon_get_tx_qsize(octeon_dev, lio->txq); in setup_nic_devices()
3663 lio->rx_qsize = octeon_get_rx_qsize(octeon_dev, lio->rxq); in setup_nic_devices()
3665 if (lio_setup_glists(octeon_dev, lio, num_iqueues)) { in setup_nic_devices()
3666 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3674 octeon_dev->priv_flags = OCT_PRIV_FLAG_DEFAULT; in setup_nic_devices()
3676 octeon_dev->priv_flags = 0x0; in setup_nic_devices()
3692 if ((octeon_dev->fw_info.app_cap_flags & in setup_nic_devices()
3702 dev_err(&octeon_dev->pci_dev->dev, "Device registration failed\n"); in setup_nic_devices()
3706 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3723 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3726 if (octeon_dev->subsystem_id == in setup_nic_devices()
3728 octeon_dev->subsystem_id == in setup_nic_devices()
3730 cur_ver = OCT_FW_VER(octeon_dev->fw_info.ver.maj, in setup_nic_devices()
3731 octeon_dev->fw_info.ver.min, in setup_nic_devices()
3732 octeon_dev->fw_info.ver.rev); in setup_nic_devices()
3736 dev_info(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3738 octeon_dev->speed_setting = 25; in setup_nic_devices()
3739 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3744 if (octeon_dev->speed_setting == 0) { in setup_nic_devices()
3745 octeon_dev->speed_setting = 25; in setup_nic_devices()
3746 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3749 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3750 octeon_dev->speed_setting = 10; in setup_nic_devices()
3752 octeon_dev->speed_boot = octeon_dev->speed_setting; in setup_nic_devices()
3755 if (octeon_dev->speed_boot == 25 && in setup_nic_devices()
3756 !octeon_dev->no_speed_setting) { in setup_nic_devices()
3758 octeon_dev->props[lio->ifidx].fec_boot = in setup_nic_devices()
3759 octeon_dev->props[lio->ifidx].fec; in setup_nic_devices()
3763 device_lock(&octeon_dev->pci_dev->dev); in setup_nic_devices()
3766 &octeon_dev->pci_dev->dev); in setup_nic_devices()
3768 device_unlock(&octeon_dev->pci_dev->dev); in setup_nic_devices()
3769 dev_err(&octeon_dev->pci_dev->dev, "devlink alloc failed\n"); in setup_nic_devices()
3774 lio_devlink->oct = octeon_dev; in setup_nic_devices()
3776 octeon_dev->devlink = devlink; in setup_nic_devices()
3777 octeon_dev->eswitch_mode = DEVLINK_ESWITCH_MODE_LEGACY; in setup_nic_devices()
3779 device_unlock(&octeon_dev->pci_dev->dev); in setup_nic_devices()
3786 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3788 liquidio_destroy_nic_device(octeon_dev, i); in setup_nic_devices()
4052 static int octeon_device_init(struct octeon_device *octeon_dev) in octeon_device_init() argument
4059 (struct octeon_device_priv *)octeon_dev->priv; in octeon_device_init()
4060 atomic_set(&octeon_dev->status, OCT_DEV_BEGIN_STATE); in octeon_device_init()
4065 if (octeon_pci_os_setup(octeon_dev)) in octeon_device_init()
4068 atomic_set(&octeon_dev->status, OCT_DEV_PCI_ENABLE_DONE); in octeon_device_init()
4071 if (octeon_chip_specific_setup(octeon_dev)) { in octeon_device_init()
4072 dev_err(&octeon_dev->pci_dev->dev, "Chip specific setup failed\n"); in octeon_device_init()
4076 atomic_set(&octeon_dev->status, OCT_DEV_PCI_MAP_DONE); in octeon_device_init()
4082 octeon_register_device(octeon_dev, octeon_dev->pci_dev->bus->number, in octeon_device_init()
4083 PCI_SLOT(octeon_dev->pci_dev->devfn), in octeon_device_init()
4084 PCI_FUNC(octeon_dev->pci_dev->devfn), in octeon_device_init()
4087 octeon_dev->app_mode = CVM_DRV_INVALID_APP; in octeon_device_init()
4096 if (OCTEON_CN23XX_PF(octeon_dev) && in octeon_device_init()
4097 cn23xx_fw_loaded(octeon_dev) && fw_type_is_auto()) { in octeon_device_init()
4098 atomic_cmpxchg(octeon_dev->adapter_fw_state, in octeon_device_init()
4103 fw_state = atomic_cmpxchg(octeon_dev->adapter_fw_state, in octeon_device_init()
4120 if (octeon_dev->fn_list.soft_reset(octeon_dev)) in octeon_device_init()
4126 if (octeon_init_dispatch_list(octeon_dev)) in octeon_device_init()
4129 octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC, in octeon_device_init()
4132 octeon_dev); in octeon_device_init()
4134 octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC, in octeon_device_init()
4136 octeon_recv_vf_drv_notice, octeon_dev); in octeon_device_init()
4137 INIT_DELAYED_WORK(&octeon_dev->nic_poll_work.work, nic_starter); in octeon_device_init()
4138 octeon_dev->nic_poll_work.ctxptr = (void *)octeon_dev; in octeon_device_init()
4139 schedule_delayed_work(&octeon_dev->nic_poll_work.work, in octeon_device_init()
4142 atomic_set(&octeon_dev->status, OCT_DEV_DISPATCH_INIT_DONE); in octeon_device_init()
4144 if (octeon_set_io_queues_off(octeon_dev)) { in octeon_device_init()
4145 dev_err(&octeon_dev->pci_dev->dev, "setting io queues off failed\n"); in octeon_device_init()
4149 if (OCTEON_CN23XX_PF(octeon_dev)) { in octeon_device_init()
4150 ret = octeon_dev->fn_list.setup_device_regs(octeon_dev); in octeon_device_init()
4152 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: Failed to configure device registers\n"); in octeon_device_init()
4159 if (octeon_setup_sc_buffer_pool(octeon_dev)) { in octeon_device_init()
4160 dev_err(&octeon_dev->pci_dev->dev, "sc buffer pool allocation failed\n"); in octeon_device_init()
4163 atomic_set(&octeon_dev->status, OCT_DEV_SC_BUFF_POOL_INIT_DONE); in octeon_device_init()
4166 if (octeon_setup_instr_queues(octeon_dev)) { in octeon_device_init()
4167 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4171 atomic_set(&octeon_dev->status, OCT_DEV_INSTR_QUEUE_INIT_DONE); in octeon_device_init()
4176 if (octeon_setup_response_list(octeon_dev)) { in octeon_device_init()
4177 dev_err(&octeon_dev->pci_dev->dev, "Response list allocation failed\n"); in octeon_device_init()
4180 atomic_set(&octeon_dev->status, OCT_DEV_RESP_LIST_INIT_DONE); in octeon_device_init()
4182 if (octeon_setup_output_queues(octeon_dev)) { in octeon_device_init()
4183 dev_err(&octeon_dev->pci_dev->dev, "Output queue initialization failed\n"); in octeon_device_init()
4187 atomic_set(&octeon_dev->status, OCT_DEV_DROQ_INIT_DONE); in octeon_device_init()
4189 if (OCTEON_CN23XX_PF(octeon_dev)) { in octeon_device_init()
4190 if (octeon_dev->fn_list.setup_mbox(octeon_dev)) { in octeon_device_init()
4191 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: Mailbox setup failed\n"); in octeon_device_init()
4194 atomic_set(&octeon_dev->status, OCT_DEV_MBOX_SETUP_DONE); in octeon_device_init()
4197 (octeon_dev, in octeon_device_init()
4198 octeon_dev->sriov_info.num_pf_rings)) { in octeon_device_init()
4199 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: ioq vector allocation failed\n"); in octeon_device_init()
4202 atomic_set(&octeon_dev->status, OCT_DEV_MSIX_ALLOC_VECTOR_DONE); in octeon_device_init()
4209 ret = octeon_dev->fn_list.setup_device_regs(octeon_dev); in octeon_device_init()
4211 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4218 dev_dbg(&octeon_dev->pci_dev->dev, "Initializing droq tasklet\n"); in octeon_device_init()
4223 if (octeon_setup_interrupt(octeon_dev, in octeon_device_init()
4224 octeon_dev->sriov_info.num_pf_rings)) in octeon_device_init()
4228 octeon_dev->fn_list.enable_interrupt(octeon_dev, OCTEON_ALL_INTR); in octeon_device_init()
4230 atomic_set(&octeon_dev->status, OCT_DEV_INTR_SET_DONE); in octeon_device_init()
4240 for (j = 0; j < octeon_dev->num_oqs; j++) in octeon_device_init()
4241 writel(octeon_dev->droq[j]->max_count, in octeon_device_init()
4242 octeon_dev->droq[j]->pkts_credit_reg); in octeon_device_init()
4245 ret = octeon_dev->fn_list.enable_io_queues(octeon_dev); in octeon_device_init()
4247 dev_err(&octeon_dev->pci_dev->dev, "Failed to enable input/output queues"); in octeon_device_init()
4251 atomic_set(&octeon_dev->status, OCT_DEV_IO_QUEUES_DONE); in octeon_device_init()
4254 dev_dbg(&octeon_dev->pci_dev->dev, "Waiting for DDR initialization...\n"); in octeon_device_init()
4256 dev_info(&octeon_dev->pci_dev->dev, in octeon_device_init()
4270 ret = octeon_wait_for_ddr_init(octeon_dev, &ddr_timeout); in octeon_device_init()
4272 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4278 if (octeon_wait_for_bootloader(octeon_dev, 1000)) { in octeon_device_init()
4279 dev_err(&octeon_dev->pci_dev->dev, "Board not responding\n"); in octeon_device_init()
4284 ret = octeon_console_send_cmd(octeon_dev, bootcmd, 50); in octeon_device_init()
4286 dev_dbg(&octeon_dev->pci_dev->dev, "Initializing consoles\n"); in octeon_device_init()
4287 ret = octeon_init_consoles(octeon_dev); in octeon_device_init()
4289 dev_err(&octeon_dev->pci_dev->dev, "Could not access board consoles\n"); in octeon_device_init()
4296 ret = octeon_add_console(octeon_dev, 0, dbg_enb); in octeon_device_init()
4298 dev_err(&octeon_dev->pci_dev->dev, "Could not access board console\n"); in octeon_device_init()
4304 octeon_dev->console[0].print = octeon_dbg_console_print; in octeon_device_init()
4307 atomic_set(&octeon_dev->status, OCT_DEV_CONSOLE_INIT_DONE); in octeon_device_init()
4309 dev_dbg(&octeon_dev->pci_dev->dev, "Loading firmware\n"); in octeon_device_init()
4310 ret = load_firmware(octeon_dev); in octeon_device_init()
4312 dev_err(&octeon_dev->pci_dev->dev, "Could not load firmware to board\n"); in octeon_device_init()
4316 atomic_set(octeon_dev->adapter_fw_state, FW_HAS_BEEN_LOADED); in octeon_device_init()
4319 handshake[octeon_dev->octeon_id].init_ok = 1; in octeon_device_init()
4320 complete(&handshake[octeon_dev->octeon_id].init); in octeon_device_init()
4322 atomic_set(&octeon_dev->status, OCT_DEV_HOST_OK); in octeon_device_init()
4323 oct_priv->dev = octeon_dev; in octeon_device_init()