/*
* Atheros AR9170 driver
*
* PHY and RF code
*
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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; see the file COPYING. If not, see
* http://www.gnu.org/licenses/.
*
* This file incorporates work covered by the following copyright and
* permission notice:
* Copyright (c) 2007-2008 Atheros Communications, Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <linux/bitrev.h>
#include "ar9170.h"
#include "cmd.h"
static int ar9170_init_power_cal(struct ar9170 *ar)
{
ar9170_regwrite_begin(ar);
ar9170_regwrite(0x1bc000 + 0x993c, 0x7f);
ar9170_regwrite(0x1bc000 + 0x9934, 0x3f3f3f3f);
ar9170_regwrite(0x1bc000 + 0x9938, 0x3f3f3f3f);
ar9170_regwrite(0x1bc000 + 0xa234, 0x3f3f3f3f);
ar9170_regwrite(0x1bc000 + 0xa238, 0x3f3f3f3f);
ar9170_regwrite(0x1bc000 + 0xa38c, 0x3f3f3f3f);
ar9170_regwrite(0x1bc000 + 0xa390, 0x3f3f3f3f);
ar9170_regwrite(0x1bc000 + 0xa3cc, 0x3f3f3f3f);
ar9170_regwrite(0x1bc000 + 0xa3d0, 0x3f3f3f3f);
ar9170_regwrite(0x1bc000 + 0xa3d4, 0x3f3f3f3f);
ar9170_regwrite_finish();
return ar9170_regwrite_result();
}
struct ar9170_phy_init {
u32 reg, _5ghz_20, _5ghz_40, _2ghz_40, _2ghz_20;
};
static struct ar9170_phy_init ar5416_phy_init[] = {
{ 0x1c5800, 0x00000007, 0x00000007, 0x00000007, 0x00000007, },
{ 0x1c5804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300, },
{ 0x1c5808, 0x00000000, 0x00000000, 0x00000000, 0x00000000, },
{ 0x1c580c, 0xad848e19, 0xad848e19, 0xad848e19, 0xad848e19, },
{ 0x1c5810, 0x7d14e000, 0x7d14e000, 0x7d14e000, 0x7d14e000, },
{ 0x1c5814, 0x9c0a9f6b, 0x9c0a9f6b, 0x9c0a9f6b, 0x9c0a9f6b, },
{ 0x1c5818, 0x00000090, 0x00000090, 0x00000090, 0x00000090, },
{ 0x1c581c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, },
{ 0x1c5820, 0x02020200, 0x02020200, 0x02020200, 0x02020200, },
{ 0x1c5824, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, },
{ 0x1c5828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001, },
{ 0x1c582c, 0x0000a000, 0x0000a000, 0x0000a0