diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-09-03 18:14:29 -0400 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-10-19 02:55:53 -0400 |
commit | aba3792ac2d7c808a2d2fd2adf89531e083bdb90 (patch) | |
tree | fdf901fe2d666805ad27a421b076cce2bfed7352 /drivers/net/wimax/i2400m/i2400m.h | |
parent | 32742e6158657f19ad31653705bef56d983508e7 (diff) |
wimax/i2400m: rework bootrom initialization to be more flexible
This modifies the bootrom initialization code of the i2400m driver so
it can more easily support upcoming hardware.
Currently, the code detects two types of barkers (magic numbers) sent
by the device to indicate the types of firmware it would take (signed
vs non-signed).
This schema is extended so that multiple reboot barkers are
recognized; upcoming hw will expose more types barkers which will have
to match a header in the firmware image before we can load it.
For that, a barker database is introduced; the first time the device
sends a barker, it is matched in the database. That gives the driver
the information needed to decide how to upload the firmware and which
types of firmware to use. The database can be populated from module
parameters.
The execution flow is not altered; a new function
(i2400m_is_boot_barker) is introduced to determine in the RX path if
the device has sent a boot barker. This function is becoming heavier,
so it is put away from the hot reception path [this is why there is
some reorganization in sdio-rx.c:i2400ms_rx and
usb-notifc.c:i2400mu_notification_grok()].
The documentation on the process has also been updated.
All these modifications are heavily based on previous work by Dirk
Brandewie <dirk.brandewie@intel.com>.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers/net/wimax/i2400m/i2400m.h')
-rw-r--r-- | drivers/net/wimax/i2400m/i2400m.h | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h index 73b4e6a15135..bcb1882ed741 100644 --- a/drivers/net/wimax/i2400m/i2400m.h +++ b/drivers/net/wimax/i2400m/i2400m.h | |||
@@ -194,6 +194,7 @@ enum i2400m_reset_type { | |||
194 | 194 | ||
195 | struct i2400m_reset_ctx; | 195 | struct i2400m_reset_ctx; |
196 | struct i2400m_roq; | 196 | struct i2400m_roq; |
197 | struct i2400m_barker_db; | ||
197 | 198 | ||
198 | /** | 199 | /** |
199 | * struct i2400m - descriptor for an Intel 2400m | 200 | * struct i2400m - descriptor for an Intel 2400m |
@@ -419,6 +420,12 @@ struct i2400m_roq; | |||
419 | * | 420 | * |
420 | * @fw_version: version of the firmware interface, Major.minor, | 421 | * @fw_version: version of the firmware interface, Major.minor, |
421 | * encoded in the high word and low word (major << 16 | minor). | 422 | * encoded in the high word and low word (major << 16 | minor). |
423 | * | ||
424 | * @barker: barker type that the device uses; this is initialized by | ||
425 | * i2400m_is_boot_barker() the first time it is called. Then it | ||
426 | * won't change during the life cycle of the device and everytime | ||
427 | * a boot barker is received, it is just verified for it being the | ||
428 | * same. | ||
422 | */ | 429 | */ |
423 | struct i2400m { | 430 | struct i2400m { |
424 | struct wimax_dev wimax_dev; /* FIRST! See doc */ | 431 | struct wimax_dev wimax_dev; /* FIRST! See doc */ |
@@ -484,6 +491,7 @@ struct i2400m { | |||
484 | struct dentry *debugfs_dentry; | 491 | struct dentry *debugfs_dentry; |
485 | const char *fw_name; /* name of the current firmware image */ | 492 | const char *fw_name; /* name of the current firmware image */ |
486 | unsigned long fw_version; /* version of the firmware interface */ | 493 | unsigned long fw_version; /* version of the firmware interface */ |
494 | struct i2400m_barker_db *barker; | ||
487 | }; | 495 | }; |
488 | 496 | ||
489 | 497 | ||
@@ -574,6 +582,14 @@ extern void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *); | |||
574 | extern int i2400m_dev_bootstrap(struct i2400m *, enum i2400m_bri); | 582 | extern int i2400m_dev_bootstrap(struct i2400m *, enum i2400m_bri); |
575 | extern int i2400m_read_mac_addr(struct i2400m *); | 583 | extern int i2400m_read_mac_addr(struct i2400m *); |
576 | extern int i2400m_bootrom_init(struct i2400m *, enum i2400m_bri); | 584 | extern int i2400m_bootrom_init(struct i2400m *, enum i2400m_bri); |
585 | extern int i2400m_is_boot_barker(struct i2400m *, const void *, size_t); | ||
586 | static inline | ||
587 | int i2400m_is_d2h_barker(const void *buf) | ||
588 | { | ||
589 | const __le32 *barker = buf; | ||
590 | return le32_to_cpu(*barker) == I2400M_D2H_MSG_BARKER; | ||
591 | } | ||
592 | extern void i2400m_unknown_barker(struct i2400m *, const void *, size_t); | ||
577 | 593 | ||
578 | /* Make/grok boot-rom header commands */ | 594 | /* Make/grok boot-rom header commands */ |
579 | 595 | ||
@@ -736,20 +752,6 @@ extern int i2400m_rx(struct i2400m *, struct sk_buff *); | |||
736 | extern struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *, size_t *); | 752 | extern struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *, size_t *); |
737 | extern void i2400m_tx_msg_sent(struct i2400m *); | 753 | extern void i2400m_tx_msg_sent(struct i2400m *); |
738 | 754 | ||
739 | static const __le32 i2400m_NBOOT_BARKER[4] = { | ||
740 | cpu_to_le32(I2400M_NBOOT_BARKER), | ||
741 | cpu_to_le32(I2400M_NBOOT_BARKER), | ||
742 | cpu_to_le32(I2400M_NBOOT_BARKER), | ||
743 | cpu_to_le32(I2400M_NBOOT_BARKER) | ||
744 | }; | ||
745 | |||
746 | static const __le32 i2400m_SBOOT_BARKER[4] = { | ||
747 | cpu_to_le32(I2400M_SBOOT_BARKER), | ||
748 | cpu_to_le32(I2400M_SBOOT_BARKER), | ||
749 | cpu_to_le32(I2400M_SBOOT_BARKER), | ||
750 | cpu_to_le32(I2400M_SBOOT_BARKER) | ||
751 | }; | ||
752 | |||
753 | extern int i2400m_power_save_disabled; | 755 | extern int i2400m_power_save_disabled; |
754 | 756 | ||
755 | /* | 757 | /* |
@@ -848,6 +850,12 @@ void __i2400m_msleep(unsigned ms) | |||
848 | #endif | 850 | #endif |
849 | } | 851 | } |
850 | 852 | ||
853 | |||
854 | /* module initialization helpers */ | ||
855 | extern int i2400m_barker_db_init(const char *); | ||
856 | extern void i2400m_barker_db_exit(void); | ||
857 | |||
858 | |||
851 | /* Module parameters */ | 859 | /* Module parameters */ |
852 | 860 | ||
853 | extern int i2400m_idle_mode_disabled; | 861 | extern int i2400m_idle_mode_disabled; |