Luis R. Rodriguez | 8525f28 | 2010-04-15 17:38:19 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010 Atheros Communications Inc. |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #include "hw.h" |
Felix Fietkau | da6f1d7 | 2010-04-15 17:38:31 -0400 | [diff] [blame] | 18 | #include "ar9003_phy.h" |
Luis R. Rodriguez | 8525f28 | 2010-04-15 17:38:19 -0400 | [diff] [blame] | 19 | |
| 20 | /** |
| 21 | * ar9003_hw_set_channel - set channel on single-chip device |
| 22 | * @ah: atheros hardware structure |
| 23 | * @chan: |
| 24 | * |
| 25 | * This is the function to change channel on single-chip devices, that is |
| 26 | * all devices after ar9280. |
| 27 | * |
| 28 | * This function takes the channel value in MHz and sets |
| 29 | * hardware channel value. Assumes writes have been enabled to analog bus. |
| 30 | * |
| 31 | * Actual Expression, |
| 32 | * |
| 33 | * For 2GHz channel, |
| 34 | * Channel Frequency = (3/4) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17) |
| 35 | * (freq_ref = 40MHz) |
| 36 | * |
| 37 | * For 5GHz channel, |
| 38 | * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^10) |
| 39 | * (freq_ref = 40MHz/(24>>amodeRefSel)) |
| 40 | * |
| 41 | * For 5GHz channels which are 5MHz spaced, |
| 42 | * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17) |
| 43 | * (freq_ref = 40MHz) |
| 44 | */ |
| 45 | static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) |
| 46 | { |
| 47 | /* TODO */ |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * ar9003_hw_spur_mitigate - convert baseband spur frequency |
| 53 | * @ah: atheros hardware structure |
| 54 | * @chan: |
| 55 | * |
| 56 | * For single-chip solutions. Converts to baseband spur frequency given the |
| 57 | * input channel frequency and compute register settings below. |
| 58 | * |
| 59 | * Spur mitigation for MRC CCK |
| 60 | */ |
| 61 | static void ar9003_hw_spur_mitigate(struct ath_hw *ah, |
| 62 | struct ath9k_channel *chan) |
| 63 | { |
| 64 | /* TODO */ |
| 65 | } |
| 66 | |
| 67 | static u32 ar9003_hw_compute_pll_control(struct ath_hw *ah, |
| 68 | struct ath9k_channel *chan) |
| 69 | { |
| 70 | /* TODO */ |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | static void ar9003_hw_set_channel_regs(struct ath_hw *ah, |
| 75 | struct ath9k_channel *chan) |
| 76 | { |
| 77 | /* TODO */ |
| 78 | } |
| 79 | |
| 80 | static void ar9003_hw_init_bb(struct ath_hw *ah, |
| 81 | struct ath9k_channel *chan) |
| 82 | { |
| 83 | /* TODO */ |
| 84 | } |
| 85 | |
| 86 | static int ar9003_hw_process_ini(struct ath_hw *ah, |
| 87 | struct ath9k_channel *chan) |
| 88 | { |
| 89 | /* TODO */ |
| 90 | return -1; |
| 91 | } |
| 92 | |
| 93 | static void ar9003_hw_set_rfmode(struct ath_hw *ah, |
| 94 | struct ath9k_channel *chan) |
| 95 | { |
| 96 | /* TODO */ |
| 97 | } |
| 98 | |
| 99 | static void ar9003_hw_mark_phy_inactive(struct ath_hw *ah) |
| 100 | { |
| 101 | /* TODO */ |
| 102 | } |
| 103 | |
| 104 | static void ar9003_hw_set_delta_slope(struct ath_hw *ah, |
| 105 | struct ath9k_channel *chan) |
| 106 | { |
| 107 | /* TODO */ |
| 108 | } |
| 109 | |
| 110 | static bool ar9003_hw_rfbus_req(struct ath_hw *ah) |
| 111 | { |
| 112 | /* TODO */ |
| 113 | return false; |
| 114 | } |
| 115 | |
| 116 | static void ar9003_hw_rfbus_done(struct ath_hw *ah) |
| 117 | { |
| 118 | /* TODO */ |
| 119 | } |
| 120 | |
| 121 | static void ar9003_hw_enable_rfkill(struct ath_hw *ah) |
| 122 | { |
| 123 | /* TODO */ |
| 124 | } |
| 125 | |
| 126 | static void ar9003_hw_set_diversity(struct ath_hw *ah, bool value) |
| 127 | { |
| 128 | /* TODO */ |
| 129 | } |
| 130 | |
| 131 | void ar9003_hw_attach_phy_ops(struct ath_hw *ah) |
| 132 | { |
| 133 | struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); |
| 134 | |
| 135 | priv_ops->rf_set_freq = ar9003_hw_set_channel; |
| 136 | priv_ops->spur_mitigate_freq = ar9003_hw_spur_mitigate; |
| 137 | priv_ops->compute_pll_control = ar9003_hw_compute_pll_control; |
| 138 | priv_ops->set_channel_regs = ar9003_hw_set_channel_regs; |
| 139 | priv_ops->init_bb = ar9003_hw_init_bb; |
| 140 | priv_ops->process_ini = ar9003_hw_process_ini; |
| 141 | priv_ops->set_rfmode = ar9003_hw_set_rfmode; |
| 142 | priv_ops->mark_phy_inactive = ar9003_hw_mark_phy_inactive; |
| 143 | priv_ops->set_delta_slope = ar9003_hw_set_delta_slope; |
| 144 | priv_ops->rfbus_req = ar9003_hw_rfbus_req; |
| 145 | priv_ops->rfbus_done = ar9003_hw_rfbus_done; |
| 146 | priv_ops->enable_rfkill = ar9003_hw_enable_rfkill; |
| 147 | priv_ops->set_diversity = ar9003_hw_set_diversity; |
| 148 | } |