Houston Hoffman | 32bc8eb | 2016-03-14 21:11:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #include "hif.h" |
Houston Hoffman | 54ef87d | 2016-03-14 21:11:58 -0700 | [diff] [blame] | 29 | #include "hif_main.h" |
Houston Hoffman | 32bc8eb | 2016-03-14 21:11:34 -0700 | [diff] [blame] | 30 | #include "multibus.h" |
| 31 | #include "pci_api.h" |
Houston Hoffman | ca581c4 | 2016-03-14 21:11:56 -0700 | [diff] [blame] | 32 | #include "hif_io32.h" |
| 33 | #include "dummy.h" |
Nirav Shah | 3573f95 | 2016-05-12 18:37:03 +0530 | [diff] [blame] | 34 | #include "ce_api.h" |
Houston Hoffman | 32bc8eb | 2016-03-14 21:11:34 -0700 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * hif_initialize_pci_ops() - initialize the pci ops |
| 38 | * @bus_ops: hif_bus_ops table pointer to initialize |
| 39 | * |
| 40 | * Return: QDF_STATUS_SUCCESS |
| 41 | */ |
Houston Hoffman | 54ef87d | 2016-03-14 21:11:58 -0700 | [diff] [blame] | 42 | QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc) |
Houston Hoffman | 32bc8eb | 2016-03-14 21:11:34 -0700 | [diff] [blame] | 43 | { |
Houston Hoffman | 54ef87d | 2016-03-14 21:11:58 -0700 | [diff] [blame] | 44 | struct hif_bus_ops *bus_ops = &hif_sc->bus_ops; |
| 45 | |
Houston Hoffman | 32bc8eb | 2016-03-14 21:11:34 -0700 | [diff] [blame] | 46 | bus_ops->hif_bus_open = &hif_pci_open; |
| 47 | bus_ops->hif_bus_close = &hif_pci_close; |
Houston Hoffman | 4ca03b6 | 2016-03-14 21:11:51 -0700 | [diff] [blame] | 48 | bus_ops->hif_bus_prevent_linkdown = &hif_pci_prevent_linkdown; |
| 49 | bus_ops->hif_reset_soc = &hif_pci_reset_soc; |
| 50 | bus_ops->hif_bus_suspend = &hif_pci_bus_suspend; |
| 51 | bus_ops->hif_bus_resume = &hif_pci_bus_resume; |
Houston Hoffman | ca581c4 | 2016-03-14 21:11:56 -0700 | [diff] [blame] | 52 | |
Houston Hoffman | 54ef87d | 2016-03-14 21:11:58 -0700 | [diff] [blame] | 53 | /* do not put the target to sleep for epping or maxperf mode */ |
| 54 | if (CONFIG_ATH_PCIE_MAX_PERF == 0 && |
Houston Hoffman | 75ef5a5 | 2016-04-14 17:15:49 -0700 | [diff] [blame] | 55 | !QDF_IS_EPPING_ENABLED(hif_get_conparam(hif_sc))) |
Houston Hoffman | ca581c4 | 2016-03-14 21:11:56 -0700 | [diff] [blame] | 56 | bus_ops->hif_target_sleep_state_adjust = |
| 57 | &hif_pci_target_sleep_state_adjust; |
| 58 | else |
| 59 | bus_ops->hif_target_sleep_state_adjust = |
| 60 | &hif_dummy_target_sleep_state_adjust; |
Houston Hoffman | 4ca03b6 | 2016-03-14 21:11:51 -0700 | [diff] [blame] | 61 | |
Houston Hoffman | 8f239f6 | 2016-03-14 21:12:05 -0700 | [diff] [blame] | 62 | bus_ops->hif_disable_isr = &hif_pci_disable_isr; |
| 63 | bus_ops->hif_nointrs = &hif_pci_nointrs; |
| 64 | bus_ops->hif_enable_bus = &hif_pci_enable_bus; |
| 65 | bus_ops->hif_disable_bus = &hif_pci_disable_bus; |
| 66 | bus_ops->hif_bus_configure = &hif_pci_bus_configure; |
Nirav Shah | 3573f95 | 2016-05-12 18:37:03 +0530 | [diff] [blame] | 67 | bus_ops->hif_get_config_item = &hif_dummy_get_config_item; |
| 68 | bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap; |
| 69 | bus_ops->hif_claim_device = &hif_dummy_claim_device; |
| 70 | bus_ops->hif_shutdown_device = &hif_ce_stop; |
| 71 | bus_ops->hif_stop = &hif_ce_stop; |
Nirav Shah | 3573f95 | 2016-05-12 18:37:03 +0530 | [diff] [blame] | 72 | bus_ops->hif_cancel_deferred_target_sleep = |
| 73 | &hif_pci_cancel_deferred_target_sleep; |
Houston Hoffman | 8f239f6 | 2016-03-14 21:12:05 -0700 | [diff] [blame] | 74 | bus_ops->hif_irq_disable = &hif_pci_irq_disable; |
| 75 | bus_ops->hif_irq_enable = &hif_pci_irq_enable; |
Houston Hoffman | 3c017e7 | 2016-03-14 21:12:11 -0700 | [diff] [blame] | 76 | bus_ops->hif_dump_registers = &hif_pci_dump_registers; |
Nirav Shah | 3573f95 | 2016-05-12 18:37:03 +0530 | [diff] [blame] | 77 | bus_ops->hif_dump_target_memory = &hif_ce_dump_target_memory; |
| 78 | bus_ops->hif_ipa_get_ce_resource = &hif_ce_ipa_get_ce_resource; |
| 79 | bus_ops->hif_mask_interrupt_call = &hif_dummy_mask_interrupt_call; |
Houston Hoffman | b4149dd | 2016-03-23 15:55:41 -0700 | [diff] [blame] | 80 | bus_ops->hif_enable_power_management = |
| 81 | &hif_pci_enable_power_management; |
| 82 | bus_ops->hif_disable_power_management = |
| 83 | &hif_pci_disable_power_management; |
| 84 | |
Houston Hoffman | 8f239f6 | 2016-03-14 21:12:05 -0700 | [diff] [blame] | 85 | |
Houston Hoffman | 32bc8eb | 2016-03-14 21:11:34 -0700 | [diff] [blame] | 86 | return QDF_STATUS_SUCCESS; |
| 87 | } |
Houston Hoffman | 162164c | 2016-03-14 21:12:10 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * hif_pci_get_context_size() - return the size of the pci context |
| 91 | * |
| 92 | * Return the size of the context. (0 for invalid bus) |
| 93 | */ |
| 94 | int hif_pci_get_context_size(void) |
| 95 | { |
| 96 | return sizeof(struct hif_pci_softc); |
| 97 | } |