Re: [PATCH] b43: N-PHY: clean table init, check PHY rev (V2)

2010-01-02 Thread Rafał Miłecki
W dniu 2 stycznia 2010 18:43 użytkownik Michael Buesch  napisał:
> On Saturday 02 January 2010 17:33:53 Rafał Miłecki wrote:
>> --- a/drivers/net/wireless/b43/tables_nphy.h
>> +++ b/drivers/net/wireless/b43/tables_nphy.h
>
>> -extern const u8 b43_ntab_adjustpower0[];
>> +static const u8 b43_ntab_adjustpower0[];
>
> Are you serious? o.O
> Come on... You can do better ;)

Yeah, I guess so :)

-- 
Rafał
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43: N-PHY: clean table init, check PHY rev (V2)

2010-01-02 Thread Michael Buesch
On Saturday 02 January 2010 17:33:53 Rafał Miłecki wrote:
> --- a/drivers/net/wireless/b43/tables_nphy.h
> +++ b/drivers/net/wireless/b43/tables_nphy.h

> -extern const u8 b43_ntab_adjustpower0[];
> +static const u8 b43_ntab_adjustpower0[];

Are you serious? o.O
Come on... You can do better ;)

-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH] b43: N-PHY: clean table init, check PHY rev (V2)

2010-01-02 Thread Rafał Miłecki

From 2ba3a7f93ac358a49f36433f49b6d3cf2f930d5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= 
Date: Sat, 2 Jan 2010 17:06:12 +0100
Subject: [PATCH] b43: N-PHY: clean table init, check PHY rev (V2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Move table init to tables_nphy.c, detect newer PHY which use different init.
We don't init newer PHYs yet but this at least shows what more is needed.

V2: Make some functions and tables static

Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c   |   43 ++---
 drivers/net/wireless/b43/tables_nphy.c |  100 +++
 drivers/net/wireless/b43/tables_nphy.h |   55 +
 3 files changed, 110 insertions(+), 88 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 992318a..a662ced 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -197,44 +197,15 @@ void b43_nphy_radio_turn_off(struct b43_wldev *dev)
 ~B43_NPHY_RFCTL_CMD_EN);
 }

-#define ntab_upload(dev, offset, data) do { \
-   unsigned int i; \
-   for (i = 0; i < (offset##_SIZE); i++)\
-   b43_ntab_write(dev, (offset) + i, (data)[i]);   \
-   } while (0)
-
-/* Upload the N-PHY tables. */
+/* Upload the N-PHY tables.
+ * http://bcm-v4.sipsolutions.net/802.11/PHY/N/InitTables
+ */
 static void b43_nphy_tables_init(struct b43_wldev *dev)
 {
-   /* Static tables */
-   ntab_upload(dev, B43_NTAB_FRAMESTRUCT, b43_ntab_framestruct);
-   ntab_upload(dev, B43_NTAB_FRAMELT, b43_ntab_framelookup);
-   ntab_upload(dev, B43_NTAB_TMAP, b43_ntab_tmap);
-   ntab_upload(dev, B43_NTAB_TDTRN, b43_ntab_tdtrn);
-   ntab_upload(dev, B43_NTAB_INTLEVEL, b43_ntab_intlevel);
-   ntab_upload(dev, B43_NTAB_PILOT, b43_ntab_pilot);
-   ntab_upload(dev, B43_NTAB_PILOTLT, b43_ntab_pilotlt);
-   ntab_upload(dev, B43_NTAB_TDI20A0, b43_ntab_tdi20a0);
-   ntab_upload(dev, B43_NTAB_TDI20A1, b43_ntab_tdi20a1);
-   ntab_upload(dev, B43_NTAB_TDI40A0, b43_ntab_tdi40a0);
-   ntab_upload(dev, B43_NTAB_TDI40A1, b43_ntab_tdi40a1);
-   ntab_upload(dev, B43_NTAB_BDI, b43_ntab_bdi);
-   ntab_upload(dev, B43_NTAB_CHANEST, b43_ntab_channelest);
-   ntab_upload(dev, B43_NTAB_MCS, b43_ntab_mcs);
-
-   /* Volatile tables */
-   ntab_upload(dev, B43_NTAB_NOISEVAR10, b43_ntab_noisevar10);
-   ntab_upload(dev, B43_NTAB_NOISEVAR11, b43_ntab_noisevar11);
-   ntab_upload(dev, B43_NTAB_C0_ESTPLT, b43_ntab_estimatepowerlt0);
-   ntab_upload(dev, B43_NTAB_C1_ESTPLT, b43_ntab_estimatepowerlt1);
-   ntab_upload(dev, B43_NTAB_C0_ADJPLT, b43_ntab_adjustpower0);
-   ntab_upload(dev, B43_NTAB_C1_ADJPLT, b43_ntab_adjustpower1);
-   ntab_upload(dev, B43_NTAB_C0_GAINCTL, b43_ntab_gainctl0);
-   ntab_upload(dev, B43_NTAB_C1_GAINCTL, b43_ntab_gainctl1);
-   ntab_upload(dev, B43_NTAB_C0_IQLT, b43_ntab_iqlt0);
-   ntab_upload(dev, B43_NTAB_C1_IQLT, b43_ntab_iqlt1);
-   ntab_upload(dev, B43_NTAB_C0_LOFEEDTH, b43_ntab_loftlt0);
-   ntab_upload(dev, B43_NTAB_C1_LOFEEDTH, b43_ntab_loftlt1);
+   if (dev->phy.rev < 3)
+   b43_nphy_rev0_1_2_tables_init(dev);
+   else
+   b43_nphy_rev3plus_tables_init(dev);
 }

 static void b43_nphy_workarounds(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/b43/tables_nphy.c 
b/drivers/net/wireless/b43/tables_nphy.c
index 4e23363..d0b91b5 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -1336,7 +1336,7 @@ b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel)
 }


-const u8 b43_ntab_adjustpower0[] = {
+static const u8 b43_ntab_adjustpower0[] = {
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03,
0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
@@ -1355,7 +1355,7 @@ const u8 b43_ntab_adjustpower0[] = {
0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F,
 };

-const u8 b43_ntab_adjustpower1[] = {
+static const u8 b43_ntab_adjustpower1[] = {
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03,
0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
@@ -1374,11 +1374,11 @@ const u8 b43_ntab_adjustpower1[] = {
0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F,
 };

-const u16 b43_ntab_bdi[] = {
+static const u16 b43_ntab_bdi[] = {
0x0070, 0x0126, 0x012C, 0x0246, 0x048D, 0x04D2,
 };

-const u32 b43_ntab_channelest[] = {
+static const u32 b43_ntab_channelest[] = {
0x, 0x, 0x, 0x,
0x, 0x, 0x, 0x,
0x10101010, 0x10101010, 0x10101010, 0x10101010,
@@ -1405,7 +1405,7 @@ const u32 b43_n