aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wimax
diff options
context:
space:
mode:
authorDirk Brandewie <dirk.j.brandewie@intel.com>2009-05-21 14:56:34 -0400
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-06-11 06:30:24 -0400
commit7308a0c23901f2a295265bb71d8521ef7d47bf4c (patch)
tree3bb54a208a5f587f1732f73ed8cffc7e1f2d538c /drivers/net/wimax
parentecddfd5ed73c070413f07a5251c16c10e69f35a2 (diff)
wimax/i2400m: move boot time poke table out of common driver
This change moves the table of "pokes" performed on the device at boot time to the bus specific portion of the driver. Different models of the i2400m device supported by this driver require different poke tables, thus having a single table that works for all is impossible. For that, the table is moved to the bus-specific driver, who can decide which table to use based on the specifics of the device and point the generic driver to it. Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Diffstat (limited to 'drivers/net/wimax')
-rw-r--r--drivers/net/wimax/i2400m/fw.c45
-rw-r--r--drivers/net/wimax/i2400m/i2400m.h28
2 files changed, 41 insertions, 32 deletions
diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
index c48fa241857a..349344ad9b61 100644
--- a/drivers/net/wimax/i2400m/fw.c
+++ b/drivers/net/wimax/i2400m/fw.c
@@ -770,40 +770,21 @@ error_read_mac:
770static 770static
771int i2400m_dnload_init_nonsigned(struct i2400m *i2400m) 771int i2400m_dnload_init_nonsigned(struct i2400m *i2400m)
772{ 772{
773#define POKE(a, d) { \ 773 unsigned i = 0;
774 .address = cpu_to_le32(a), \ 774 int ret = 0;
775 .data = cpu_to_le32(d) \
776}
777 static const struct {
778 __le32 address;
779 __le32 data;
780 } i2400m_pokes[] = {
781 POKE(0x081A58, 0xA7810230),
782 POKE(0x080040, 0x00000000),
783 POKE(0x080048, 0x00000082),
784 POKE(0x08004C, 0x0000081F),
785 POKE(0x080054, 0x00000085),
786 POKE(0x080058, 0x00000180),
787 POKE(0x08005C, 0x00000018),
788 POKE(0x080060, 0x00000010),
789 POKE(0x080574, 0x00000001),
790 POKE(0x080550, 0x00000005),
791 POKE(0xAE0000, 0x00000000),
792 };
793#undef POKE
794 unsigned i;
795 int ret;
796 struct device *dev = i2400m_dev(i2400m); 775 struct device *dev = i2400m_dev(i2400m);
797
798 dev_warn(dev, "WARNING!!! non-signed boot UNTESTED PATH!\n");
799
800 d_fnstart(5, dev, "(i2400m %p)\n", i2400m); 776 d_fnstart(5, dev, "(i2400m %p)\n", i2400m);
801 for (i = 0; i < ARRAY_SIZE(i2400m_pokes); i++) { 777 if (i2400m->bus_bm_pokes_table) {
802 ret = i2400m_download_chunk(i2400m, &i2400m_pokes[i].data, 778 while (i2400m->bus_bm_pokes_table[i].address) {
803 sizeof(i2400m_pokes[i].data), 779 ret = i2400m_download_chunk(
804 i2400m_pokes[i].address, 1, 1); 780 i2400m,
805 if (ret < 0) 781 &i2400m->bus_bm_pokes_table[i].data,
806 break; 782 sizeof(i2400m->bus_bm_pokes_table[i].data),
783 i2400m->bus_bm_pokes_table[i].address, 1, 1);
784 if (ret < 0)
785 break;
786 i++;
787 }
807 } 788 }
808 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, ret); 789 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, ret);
809 return ret; 790 return ret;
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h
index 59cd78315498..1fe5da4cf0a0 100644
--- a/drivers/net/wimax/i2400m/i2400m.h
+++ b/drivers/net/wimax/i2400m/i2400m.h
@@ -156,6 +156,27 @@ enum {
156 I2400M_BM_ACK_BUF_SIZE = 256, 156 I2400M_BM_ACK_BUF_SIZE = 256,
157}; 157};
158 158
159/**
160 * struct i2400m_poke_table - Hardware poke table for the Intel 2400m
161 *
162 * This structure will be used to create a device specific poke table
163 * to put the device in a consistant state at boot time.
164 *
165 * @address: The device address to poke
166 *
167 * @data: The data value to poke to the device address
168 *
169 */
170struct i2400m_poke_table{
171 __le32 address;
172 __le32 data;
173};
174
175#define I2400M_FW_POKE(a, d) { \
176 .address = cpu_to_le32(a), \
177 .data = cpu_to_le32(d) \
178}
179
159 180
160/** 181/**
161 * i2400m_reset_type - methods to reset a device 182 * i2400m_reset_type - methods to reset a device
@@ -264,6 +285,12 @@ struct i2400m_roq;
264 * address provided in boot mode is kind of broken and needs to 285 * address provided in boot mode is kind of broken and needs to
265 * be re-read later on. 286 * be re-read later on.
266 * 287 *
288 * @bus_bm_pokes_table: [fill/optional] A table of device addresses
289 * and values that will be poked at device init time to move the
290 * device to the correct state for the type of boot/firmware being
291 * used. This table MUST be terminated with (0x000000,
292 * 0x00000000) or bad things will happen.
293 *
267 * 294 *
268 * @wimax_dev: WiMAX generic device for linkage into the kernel WiMAX 295 * @wimax_dev: WiMAX generic device for linkage into the kernel WiMAX
269 * stack. Due to the way a net_device is allocated, we need to 296 * stack. Due to the way a net_device is allocated, we need to
@@ -424,6 +451,7 @@ struct i2400m {
424 struct i2400m_bootrom_header *, size_t); 451 struct i2400m_bootrom_header *, size_t);
425 const char **bus_fw_names; 452 const char **bus_fw_names;
426 unsigned bus_bm_mac_addr_impaired:1; 453 unsigned bus_bm_mac_addr_impaired:1;
454 const struct i2400m_poke_table *bus_bm_pokes_table;
427 455
428 spinlock_t tx_lock; /* protect TX state */ 456 spinlock_t tx_lock; /* protect TX state */
429 void *tx_buf; 457 void *tx_buf;