-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wl18xx: read clock frequency and do top init accordingly
Instead of using hardcoded values for a single frequency, we need to read the frequency and use the appropriate values for it in the top initialization. Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Arik Nemtsov <arik@wizery.com>
- Loading branch information
Luciano Coelho
committed
Jun 5, 2012
1 parent
d9fedea
commit be65202
Showing
6 changed files
with
181 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
wl18xx-objs = main.o acx.o tx.o | ||
wl18xx-objs = main.o acx.o tx.o io.o | ||
|
||
obj-$(CONFIG_WL18XX) += wl18xx.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* This file is part of wl18xx | ||
* | ||
* Copyright (C) 2011 Texas Instruments | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
* | ||
* 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; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA | ||
* | ||
*/ | ||
|
||
#include "../wlcore/wlcore.h" | ||
#include "../wlcore/io.h" | ||
|
||
#include "io.h" | ||
|
||
void wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val) | ||
{ | ||
u32 tmp; | ||
|
||
if (WARN_ON(addr % 2)) | ||
return; | ||
|
||
if ((addr % 4) == 0) { | ||
tmp = wl1271_read32(wl, addr); | ||
tmp = (tmp & 0xffff0000) | val; | ||
wl1271_write32(wl, addr, tmp); | ||
} else { | ||
tmp = wl1271_read32(wl, addr - 2); | ||
tmp = (tmp & 0xffff) | (val << 16); | ||
wl1271_write32(wl, addr - 2, tmp); | ||
} | ||
} | ||
|
||
u16 wl18xx_top_reg_read(struct wl1271 *wl, int addr) | ||
{ | ||
u32 val; | ||
|
||
if (WARN_ON(addr % 2)) | ||
return 0; | ||
|
||
if ((addr % 4) == 0) { | ||
/* address is 4-bytes aligned */ | ||
val = wl1271_read32(wl, addr); | ||
return val & 0xffff; | ||
} else { | ||
val = wl1271_read32(wl, addr - 2); | ||
return (val & 0xffff0000) >> 16; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* This file is part of wl18xx | ||
* | ||
* Copyright (C) 2011 Texas Instruments | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
* | ||
* 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; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA | ||
* | ||
*/ | ||
|
||
#ifndef __WL18XX_IO_H__ | ||
#define __WL18XX_IO_H__ | ||
|
||
void wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val); | ||
u16 wl18xx_top_reg_read(struct wl1271 *wl, int addr); | ||
|
||
#endif /* __WL18XX_IO_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters